/* Worcester Moslem Jamaa: Sensusvorm. Shared styles for the family form, admin and print pages. */
:root {
  --bg: #f6f2e8;
  --paper: #fffdf8;
  --paper-2: #fbf8f0;
  --ink: #17251f;
  --ink-2: #3c4a43;
  --muted: #6b766f;
  --line: #e2dac8;
  --line-2: #cfc4ab;
  --green: #0f3d2e;
  --green-2: #1b5a43;
  --green-3: #e6efe9;
  --gold: #a9853a;
  --gold-2: #d9c08a;
  --gold-3: #f6eedb;
  --amber: #a8650f;
  --amber-bg: #fdf1dc;
  --red: #a2342a;
  --red-bg: #fbe6e3;
  --ok: #1f7a4c;
  --ok-bg: #e2f3ea;
  --focus: #c79a3c;
  --shadow: 0 1px 2px rgba(23, 37, 31, .06), 0 8px 24px rgba(23, 37, 31, .07);
  --radius: 14px;
  --fs: 18px;
  --serif: "Fraunces", "Georgia", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1613; --paper: #16201b; --paper-2: #1a2620; --ink: #ecf0ea; --ink-2: #c9d2cb; --muted: #93a098;
    --line: #2a3a32; --line-2: #3a4d43; --green: #8fd0ad; --green-2: #6dbb92; --green-3: #1d2e26;
    --gold: #d8b56a; --gold-2: #8a7140; --gold-3: #2a2618; --amber: #e7a54a; --amber-bg: #2d2313;
    --red: #ef8a7d; --red-bg: #33201d; --ok: #74d3a1; --ok-bg: #16301f; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1613; --paper: #16201b; --paper-2: #1a2620; --ink: #ecf0ea; --ink-2: #c9d2cb; --muted: #93a098;
  --line: #2a3a32; --line-2: #3a4d43; --green: #8fd0ad; --green-2: #6dbb92; --green-3: #1d2e26;
  --gold: #d8b56a; --gold-2: #8a7140; --gold-3: #2a2618; --amber: #e7a54a; --amber-bg: #2d2313;
  --red: #ef8a7d; --red-bg: #33201d; --ok: #74d3a1; --ok-bg: #16301f; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
:root[data-size="large"] { --fs: 21px; }

* { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); line-height: 1.5; }
img { max-width: 100%; }
a { color: var(--green-2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- crest (logo block, the same on every page) */
.crest { text-align: center; color: var(--ink); }
.crest .name { font-family: "Times New Roman", var(--serif); font-size: 1.45rem; letter-spacing: .06em; margin: 0; font-weight: 500; }
.crest .marks { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .4rem 0 .2rem; }
.crest .ayah { height: 2.3rem; width: auto; }
.crest .seal { height: 2.6rem; width: auto; }
.crest .meaning { font-size: .72rem; color: var(--muted); margin: 0; font-style: italic; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .crest img { filter: invert(1) hue-rotate(180deg) brightness(1.1); } }
:root[data-theme="dark"] .crest img { filter: invert(1) hue-rotate(180deg) brightness(1.1); }

/* ---------- top bar */
.topbar { display: flex; align-items: center; justify-content: flex-end; gap: .4rem; padding: .6rem 1rem; }
.chip-btn { border: 1px solid var(--line-2); background: var(--paper); border-radius: 999px; padding: .3rem .8rem; font-size: .8rem; cursor: pointer; min-height: 2.2rem; }
.chip-btn[aria-pressed="true"] { background: var(--green); color: var(--paper); border-color: var(--green); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; overflow: hidden; background: var(--paper); }
.seg button { border: 0; background: transparent; padding: .3rem .75rem; font-size: .8rem; cursor: pointer; min-height: 2.2rem; }
.seg button[aria-pressed="true"] { background: var(--green); color: var(--paper); }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 3rem; padding: .6rem 1.3rem;
  border-radius: 12px; border: 1px solid transparent; font-weight: 600; cursor: pointer; text-decoration: none; font-size: .95rem; }
.btn-primary { background: var(--green); color: #fff; }
:root[data-theme="dark"] .btn-primary { color: #0f1613; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-primary { color: #0f1613; } }
.btn-primary:hover { background: var(--green-2); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-small { min-height: 2.3rem; padding: .3rem .8rem; font-size: .82rem; border-radius: 10px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-link { background: none; border: 0; color: var(--green-2); text-decoration: underline; cursor: pointer; padding: .2rem; font-size: .9rem; }

/* ---------- form fields */
.grid { display: grid; gap: .9rem 1rem; grid-template-columns: repeat(12, 1fr); }
.f { grid-column: span 12; display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
@media (min-width: 640px) {
  .f.w6 { grid-column: span 6; } .f.w4 { grid-column: span 4; } .f.w8 { grid-column: span 8; } .f.w3 { grid-column: span 3; }
}
.f > label, .f > .label { font-weight: 600; font-size: .85rem; color: var(--ink-2); letter-spacing: .01em; }
.f .opt { font-weight: 400; color: var(--muted); font-size: .78rem; }
.f .hint { font-size: .78rem; color: var(--muted); }
.in { width: 100%; min-height: 3rem; padding: .55rem .8rem; border: 1.5px solid var(--line-2); border-radius: 10px; background: var(--paper); }
.in:focus { border-color: var(--green-2); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 35%, transparent); }
.in.idnum { letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.f.bad .in, .f.bad .choices button { border-color: var(--red); }
.f .err { color: var(--red); font-size: .8rem; font-weight: 600; }
.idnote { font-size: .82rem; padding: .35rem .6rem; border-radius: 8px; display: inline-flex; gap: .4rem; align-items: center; }
.idnote.ok { background: var(--ok-bg); color: var(--ok); }
.idnote.bad { background: var(--red-bg); color: var(--red); }
.dateparts { display: grid; grid-template-columns: 4.2rem 1fr 5.6rem; gap: .5rem; }
.check { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; font-size: .92rem; }
.check input { width: 1.5rem; height: 1.5rem; margin-top: .1rem; accent-color: var(--green); flex: none; }

.choices { display: flex; flex-wrap: wrap; gap: .5rem; }
.choices button { min-height: 3rem; padding: .45rem 1rem; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--paper);
  cursor: pointer; font-weight: 500; display: inline-flex; align-items: center; gap: .5rem; }
.choices button::before { content: ""; width: 1.05rem; height: 1.05rem; border: 2px solid var(--line-2); border-radius: 4px; flex: none; }
.choices button[aria-pressed="true"] { border-color: var(--green); background: var(--green-3); color: var(--ink); font-weight: 650; }
.choices button[aria-pressed="true"]::before { background: var(--green); border-color: var(--green);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 100%; }
.choices.big button { flex: 1 1 9rem; justify-content: flex-start; min-height: 3.4rem; }

/* ---------- cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pcard { border: 1px solid var(--line); border-radius: 12px; padding: 1rem; background: var(--paper-2); margin-top: .9rem; }
.pcard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .7rem; gap: .5rem; }
.pcard-head h4 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; }
.add-btn { width: 100%; margin-top: .9rem; border: 2px dashed var(--line-2); background: transparent; border-radius: 12px; min-height: 3.4rem;
  font-weight: 600; color: var(--green-2); cursor: pointer; }
.add-btn:hover { background: var(--green-3); }

.banner { border-radius: 12px; padding: .8rem 1rem; font-size: .9rem; display: flex; gap: .7rem; align-items: flex-start; }
.banner.amber { background: var(--amber-bg); color: var(--amber); }
.banner.ok { background: var(--ok-bg); color: var(--ok); }
.banner.red { background: var(--red-bg); color: var(--red); }
.banner.info { background: var(--gold-3); color: var(--ink-2); }
.banner strong { display: block; }

.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: .7rem 1.1rem;
  border-radius: 12px; z-index: 100; box-shadow: var(--shadow); font-size: .9rem; max-width: calc(100% - 2rem); }

.builtby { text-align: center; font-size: .72rem; color: var(--muted); padding: 1.5rem 1rem 2rem; }
.builtby a { color: var(--muted); }

/* ---------- the paper replica (review step, print page, family card) */
.sheet { background: #fff; color: #111; border: 1px solid #d9d2c0; padding: 1.4rem 1.4rem 1.6rem; font-family: Arial, Helvetica, sans-serif; font-size: .8rem; }
.sheet .crest { color: #111; }
.sheet .crest img { filter: none !important; }
.sheet h2 { color: #111 !important; font-family: Arial, Helvetica, sans-serif !important; font-weight: 700; text-align: center; text-decoration: underline; font-size: 1rem; margin: .8rem 0 1rem; letter-spacing: .02em; }
.sheet h3 { font-size: .85rem; text-decoration: underline; margin: 1rem 0 .4rem; }
.sheet .row { display: flex; flex-wrap: wrap; gap: .2rem 1.2rem; margin: .35rem 0; }
.sheet .kv { display: flex; gap: .35rem; align-items: baseline; flex: 1 1 14rem; min-width: 0; }
.sheet .kv b { font-weight: 400; white-space: nowrap; text-transform: uppercase; font-size: .72rem; }
.sheet .kv span { border-bottom: 1px dotted #555; flex: 1; min-height: 1.1rem; padding: 0 .2rem; font-weight: 600; overflow-wrap: anywhere; }
.sheet .boxes { display: flex; gap: .9rem; flex-wrap: wrap; align-items: center; margin: .45rem 0; }
.sheet .box { display: inline-flex; gap: .3rem; align-items: center; text-transform: uppercase; font-size: .72rem; }
.sheet .box i { width: .95rem; height: .95rem; border: 1.2px solid #222; display: inline-flex; align-items: center; justify-content: center; font-style: normal; font-weight: 700; font-size: .7rem; }
.sheet table { width: 100%; border-collapse: collapse; margin-top: .3rem; font-size: .72rem; }
.sheet th { font-weight: 400; font-size: .62rem; text-transform: uppercase; padding: .2rem; text-align: left; }
.sheet td { border: 1px solid #555; padding: .3rem .3rem; height: 1.6rem; font-weight: 600; }
.sheet td.n { width: 1.4rem; font-weight: 400; color: #444; }
.sheet .tablewrap { overflow-x: auto; }
@media (max-width: 440px) { .crest .name { font-size: 1.12rem; letter-spacing: .04em; } }
