/* «وِرد» — web interface. Same palette as the app: warm paper, deep green, gold. */

@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-Medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-SemiBold.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Arabic"; src: url("../fonts/ibm-plex-sans-arabic/IBMPlexSansArabic-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Amiri"; src: url("../fonts/amiri/Amiri-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
/* Quran text (App\Support\QuranVerse, partials/quran-verse — never typed by hand): only in the KFGQPC
   Uthmanic font of its riwaya (the Complex's free-use terms, fonts/kfgqpc/TERMS.txt); `.q-plain` = the
   plain verified text shown when that font could not be loaded. */
@font-face { font-family: "KFGQPC Hafs"; src: url("../fonts/kfgqpc/UthmanicHafs-v-3.0.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "KFGQPC Warsh"; src: url("../fonts/kfgqpc/UthmanicWarsh-v-3.0.ttf") format("truetype"); font-display: block; }
.q-hafs { font-family: "KFGQPC Hafs", "Amiri", serif; }
.q-warsh { font-family: "KFGQPC Warsh", "Amiri", serif; }
.q-text.q-plain { font-family: "Amiri", "Traditional Arabic", serif; }

:root {
  --paper: #F6F0E1;
  --surface: #FFFBF2;
  --surface-2: #FBF5E8;
  --surface-3: #F4ECDB;
  --surface-4: #E9DFC9;
  --line: #E0D5BC;
  --surface-lowest: #FFFFFF;
  --surface-high: #EFE6D2;
  --line-strong: #8F8772; /* field and control borders: >= 3:1 on every surface (was #9C9480, 2.8:1) */
  --ink: #26291F;
  --ink-2: #5E5A4C;
  --green: #1E5A46;
  --on-green: #FFFFFF;
  --green-soft: #D5E8DC;
  --on-green-soft: #0C2E22;
  --gold: #A77B22;
  --on-gold: #FFFFFF;
  --gold-text: #84601A; /* small gold TEXT (gold itself is 3.7:1 on paper; this one 5:1) */
  --gold-soft: #F3E4BC;
  --on-gold-soft: #3E2D06;
  --success: #2E7D5B;
  --late: #B5542E;
  --danger: #A33A2A;
  --danger-soft: #F6DDD4;
  /* School page accents (SP1, tokens.json «accent-*»): a school's theme.accent maps to these only; green and gold
     reuse --green / --gold. */
  --accent-plum: #6A2E52; --on-accent-plum: #FFFFFF; --accent-plum-soft: #F2E3EC;
  --accent-night: #17465A; --on-accent-night: #FFFFFF; --accent-night-soft: #DDEBF1;
  /* The four grades «ممتاز، جيد، مقبول، يُعاد»: ONE group, shared by the hifz map, the grade buttons and
     pills, the school pages and (as text colours) the PDF. Each has its text colour (-on) with >= 4.5:1.
     tokens.json (unify-tokens) will replace the values; nothing else in the CSS names a grade colour. */
  --grade-excellent: #1E5A46; --grade-excellent-on: #FFFFFF;
  --grade-good: #2E7D5B; --grade-good-on: #FFFFFF;
  --grade-acceptable: #C9A23E; --grade-acceptable-on: #1D1600;
  --grade-repeat: #B5542E; --grade-repeat-on: #FFFFFF;
  /* hifz map: the grades, plus «سجّلتُه» (claimed) and «لم يبدأ» (none) */
  --h-excellent: var(--grade-excellent);
  --h-good: var(--grade-good);
  --h-acceptable: var(--grade-acceptable);
  --h-claimed: #EBD9A6;
  --h-review: var(--grade-repeat);
  --h-none: #ECE3CF;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-field: 14px;
  --radius-btn: 16px;
  --radius-dialog: 24px;
  /* Control heights: comfortable (phone widths, touch) 56 / 48 / 38; compact (desktop, mouse) 48 / 44 / 36. */
  --ctl-lg: 48px; --ctl-md: 44px; --ctl-sm: 36px;
  /* Depth: cards are FLAT (thin border, no shadow); this shadow is only for what floats (ayah bar, index
     panel, menus, notification previews). */
  --shadow: 0 1px 2px rgba(60, 50, 20, .06), 0 6px 18px rgba(60, 50, 20, .07);
  --font-ui: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, system-ui, sans-serif;
  --font-display: "Amiri", "Traditional Arabic", serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141815; --surface: #181D19; --surface-2: #1D231E; --surface-3: #212823; --surface-4: #303830;
    --line: #3C443D; --line-strong: #8C8676; --ink: #ECE6D6; --ink-2: #C3BCA9;
    --green: #8FCBB0; --on-green: #0A2A1F; --green-soft: #214A3B; --on-green-soft: #CDEBDD;
    --gold: #D9B762; --on-gold: #2A2000; --gold-soft: #3B321C; --on-gold-soft: #F3E4BC;
    --success: #7CC8A2; --late: #E59A72; --danger: #F0907C; --danger-soft: #45231C;
    --surface-lowest: #111512; --surface-high: #283029; --gold-text: #D9B762;
    --grade-excellent: #5FB592; --grade-excellent-on: #0A2A1F; --grade-good: #3E7F62; --grade-good-on: #FFFFFF;
    --grade-acceptable: #B08A2E; --grade-acceptable-on: #1D1600; --grade-repeat: #C9764F; --grade-repeat-on: #1D0A02;
    --h-claimed: #5A4A22; --h-none: #262D27;
    --accent-plum: #D9A6C4; --on-accent-plum: #2E0F22; --accent-plum-soft: #3A2231;
    --accent-night: #9CC9DB; --on-accent-night: #0B2430; --accent-night-soft: #1E3540;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141815; --surface: #181D19; --surface-2: #1D231E; --surface-3: #212823; --surface-4: #303830;
  --line: #3C443D; --line-strong: #8C8676; --ink: #ECE6D6; --ink-2: #C3BCA9;
  --green: #8FCBB0; --on-green: #0A2A1F; --green-soft: #214A3B; --on-green-soft: #CDEBDD;
  --gold: #D9B762; --on-gold: #2A2000; --gold-soft: #3B321C; --on-gold-soft: #F3E4BC;
  --success: #7CC8A2; --late: #E59A72; --danger: #F0907C; --danger-soft: #45231C;
  --surface-lowest: #111512; --surface-high: #283029; --gold-text: #D9B762;
  --grade-excellent: #5FB592; --grade-excellent-on: #0A2A1F; --grade-good: #3E7F62; --grade-good-on: #FFFFFF;
  --grade-acceptable: #B08A2E; --grade-acceptable-on: #1D1600; --grade-repeat: #C9764F; --grade-repeat-on: #1D0A02;
  --h-claimed: #5A4A22; --h-none: #262D27;
  --accent-plum: #D9A6C4; --on-accent-plum: #2E0F22; --accent-plum-soft: #3A2231;
  --accent-night: #9CC9DB; --on-accent-night: #0B2430; --accent-night-soft: #1E3540;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

@media (max-width: 600px), (pointer: coarse) {
  :root { --ctl-lg: 56px; --ctl-md: 48px; --ctl-sm: 38px; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--green); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.4; margin: 0 0 .4em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
img, svg { max-width: 100%; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- layout ---- */
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding: 24px 0 40px; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 0; }

/* ---- header / nav ---- */
/* Signed-in pages = the app's second skin (phase UD1). A slim top bar; below it the shell: the menu
   (a persistent column from 840px, the phone's drawer below) and the page. On phones a bottom bar
   of الرئيسية / المصحف / الرفيق / الدعوة / القائمة. Markup: resources/views/layouts/app.blade.php,
   entries: App\Support\Nav, drawer: public/js/nav.js. */
.skip-link {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--green); color: var(--on-green); font-weight: 600; text-decoration: none; transition: top .15s;
}
.skip-link:focus { top: 12px; }
.topbar {
  background: color-mix(in srgb, var(--paper) 90%, transparent); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40;
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
}
.topbar .container { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.topbar .container.wide { max-width: 1360px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--green); font-family: var(--font-display); font-size: 1.7rem; line-height: 1; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; flex: none; }
span.brand-mark.mark, .brand span.mark { background: var(--green); color: var(--on-green); display: grid; place-items: center; font-size: 1.2rem; }
.topbar .account { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
/* The user's name in a header (NV4 E1): initial in a round avatar + first name (partials/name-chip). */
.name-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; max-width: 190px; padding-block: 3px; padding-inline: 4px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; }
.name-chip:hover { background: var(--surface-3); }
.name-chip .avatar { width: 34px; height: 34px; font-size: 1.1rem; }
.name-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 380px) { .name-chip { padding-inline: 4px; } .name-chip-name { display: none; } }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; font: inherit; }
.icon-btn:hover { background: var(--surface-3); }
.icon-btn svg { width: 20px; height: 20px; }
/* المظهر: فاتح / داكن / حسب الجهاز (partials/theme-switch; shown by public/js/theme.js) */
.theme-switch { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.theme-switch button { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--ink-2); cursor: pointer; }
.theme-switch button:hover { background: var(--surface-3); color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--green-soft); color: var(--on-green-soft); }
.theme-switch button:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.theme-switch svg { width: 18px; height: 18px; }
@media (max-width: 480px) { .theme-switch button { width: 30px; height: 30px; } }

.shell { flex: 1; display: flex; align-items: stretch; width: 100%; max-width: 1360px; margin: 0 auto; }
.shell-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* the menu: the drawer on phones, a column from 840px */
.sidemenu {
  position: fixed; top: 0; bottom: 0; inset-inline-start: 0; z-index: 60; width: min(84vw, 340px);
  overflow-y: auto; overscroll-behavior: contain; padding: calc(12px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
  background: var(--surface); border-inline-end: 1px solid var(--line); box-shadow: var(--shadow);
  transform: translateX(-102%); visibility: hidden; transition: transform .2s cubic-bezier(.2, 0, 0, 1), visibility 0s linear .2s;
}
html[dir="rtl"] .sidemenu { transform: translateX(102%); }
.sidemenu:focus { outline: none; }
html[dir] .sidemenu.open, .no-js .sidemenu:target { transform: none; visibility: visible; transition: transform .2s cubic-bezier(.2, 0, 0, 1), visibility 0s; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(10, 14, 12, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
body.menu-open .scrim, .no-js .sidemenu:target ~ .scrim { opacity: 1; pointer-events: auto; }
body.menu-open { overflow: hidden; }
.menu-head { display: flex; align-items: center; gap: 10px; padding: 4px 4px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; flex-wrap: wrap; }
.menu-head .avatar { width: 44px; height: 44px; font-size: 1.35rem; }
.menu-head .who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.menu-head .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-head .who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-group { display: flex; flex-direction: column; gap: 2px; }
.menu-title { font-size: .78rem; font-weight: 700; color: var(--ink-2); padding: 14px 10px 4px; }
.menu-row {
  display: flex; align-items: center; gap: 12px; min-height: var(--ctl-md); padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--ink); text-decoration: none; font-weight: 500;
}
.menu-row svg { width: 22px; height: 22px; flex: none; color: var(--green); }
.menu-row .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-row .hint { font-size: .78rem; color: var(--ink-2); }
.menu-row:hover { background: var(--surface-3); }
.menu-row.on { background: var(--green-soft); color: var(--on-green-soft); font-weight: 700; }
.menu-row.on svg { color: currentColor; }
.menu-row:focus-visible { outline: 3px solid var(--gold); outline-offset: -2px; }
.desk-only { display: none; }

/* bottom bar (phones) */
.bottomnav { display: none; }
@media (max-width: 839px) {
  .bottomnav {
    display: flex; align-items: flex-end; position: fixed; inset-inline: 0; bottom: 0; z-index: 50;
    background: var(--surface); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottomnav a { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--ink-2); font-size: .75rem; padding: 4px 0; border-radius: var(--radius-sm); }
  .bottomnav a svg { width: 24px; height: 24px; }
  .bottomnav a .ico { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; transition: background .15s; }
  .bottomnav a:not(:has(.ico)) svg { margin-block: 3px; }
  .bottomnav a.on { color: var(--on-green-soft); font-weight: 600; }
  .bottomnav a.on .ico { background: var(--green-soft); }
  .bottomnav a:focus-visible { outline: 3px solid var(--gold); outline-offset: -2px; }
  /* «الرفيق»: the raised badge in the middle */
  .bottomnav a.raised .ico { width: 52px; height: 52px; margin-top: -22px; background: var(--green); color: var(--on-green); border: 3px solid var(--surface); }
  .bottomnav a.raised.on .ico { background: var(--green); }
  .bottomnav a.raised { color: var(--green); font-weight: 600; }
  body.has-bottomnav { --sticky-bottom: 76px; }
  body.has-bottomnav main { padding-bottom: 96px; }
}
@media (min-width: 840px) {
  .sidemenu {
    position: sticky; top: 64px; inset-inline-start: auto; z-index: auto; flex: none; width: 264px; height: calc(100vh - 64px);
    padding: 12px 10px 24px; transform: none !important; visibility: visible; transition: none; box-shadow: none; background: transparent;
  }
  .sidemenu .menu-close, .scrim { display: none; }
  .desk-only { display: flex; }
  .menu-head { flex-wrap: nowrap; }
  .menu-head .btn { display: none; }
}
@media (max-width: 760px) { h1 { font-size: 1.7rem; } }

/* ---- surfaces ---- */
/* Flat: a thin border, no shadow (the shadow is for what floats: see --shadow). */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2, .card h3 { margin-top: 0; }
.card + .card { margin-top: 16px; }
.section-title { font-family: var(--font-ui); font-size: .95rem; font-weight: 600; color: var(--ink-2); margin: 0 0 12px; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--ctl-lg); padding: 0 22px; border-radius: var(--radius-btn);
  border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 1rem;
  cursor: pointer; text-decoration: none; transition: filter .15s, background .15s;
  background: var(--green); color: var(--on-green);
}
.btn:hover { filter: brightness(1.08); }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.btn.gold { background: var(--gold); color: var(--on-gold); }
.btn.soft { background: var(--green-soft); color: var(--on-green-soft); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: var(--ctl-sm); padding: 0 14px; font-size: .9rem; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; filter: none; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
.actions.end { justify-content: flex-end; }
/* Primary actions sit at the bottom of the screen on phones. */
@media (max-width: 839px) {
  .actions.sticky { position: sticky; bottom: var(--sticky-bottom, 0); background: linear-gradient(to top, var(--surface) 70%, transparent); padding: 12px 0 4px; margin-bottom: -4px; }
  .actions .btn { flex: 1; }
}

/* ---- forms ---- */
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > .btn { align-self: flex-start; }
.field label, .label { font-weight: 600; font-size: .95rem; }
.field .hint { font-size: .85rem; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=month], input[type=date], input[type=tel], select, textarea {
  width: 100%; min-height: var(--ctl-lg); padding: 10px 14px; border-radius: var(--radius-field);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
  font: inherit;
}
textarea { min-height: 90px; }
input.ltr-input { direction: ltr; text-align: left; }
.field.error input, .field.error select { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: .875rem; }
.inline-fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.choice { display: flex; gap: 8px; flex-wrap: wrap; }
.choice label { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer; font-weight: 500; }
.choice input { accent-color: var(--green); }
.choice label:has(input:checked) { background: var(--green-soft); border-color: var(--green); color: var(--on-green-soft); }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }

/* ---- section head (app SectionHeader): Amiri title + gold bar, then one line saying what the section is ---- */
.section-head { margin: 28px 0 14px; }
.card > h2:first-child { display: flex; align-items: center; gap: 10px; }
.card > h2:first-child::before { content: ""; flex: none; width: 4px; height: 1.1em; border-radius: 2px; background: var(--gold); }
.section-head h2 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.5rem; }
.section-head h2::before { content: ""; flex: none; width: 4px; height: 1.1em; border-radius: 2px; background: var(--gold); }
.section-head p { margin: 2px 0 0; padding-inline-start: 14px; color: var(--ink-2); font-size: .9rem; }

/* ---- empty state (app EmptyState): gold icon 48, title, one line, the next action ---- */
.empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 28px 16px; }
.empty .ico { color: var(--gold); }
.empty .ico svg { width: 48px; height: 48px; }
.empty h3 { margin: 4px 0 0; font-family: var(--font-ui); font-size: 1.1rem; font-weight: 600; }
.empty p { margin: 0; max-width: 42ch; }
.empty .actions { justify-content: center; margin-top: 10px; }
.list > li.empty-row { display: block; padding: 0; border-bottom: 0; }

/* ---- alerts ---- */
.alert { border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; border: 1px solid; }
.alert.ok { background: var(--green-soft); border-color: var(--green); color: var(--on-green-soft); }
.alert.err { background: var(--danger-soft); border-color: var(--danger); color: var(--ink); }
.alert.info { background: var(--gold-soft); border-color: var(--gold); color: var(--on-gold-soft); }
.alert ul { margin: 0; padding-inline-start: 20px; }

/* ---- chips / statuses ---- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip.done { background: var(--green-soft); color: var(--on-green-soft); }
.chip.partial { background: var(--gold-soft); color: var(--on-gold-soft); }
.chip.pending { background: var(--danger-soft); color: var(--late); }
.chip.none::before { opacity: .3; }
.chip.plain::before { display: none; }
.badge { display: inline-block; padding: 0 10px; border-radius: 999px; background: var(--gold-soft); color: var(--on-gold-soft); font-size: .8rem; font-weight: 600; }

/* ---- family dashboard ---- */
.member { display: flex; flex-direction: column; gap: 14px; }
.member-head { display: flex; align-items: center; gap: 12px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--gold-soft); color: var(--on-gold-soft); display: grid; place-items: center; font-family: var(--font-display); font-size: 1.4rem; flex: none; }
.avatar.child { background: var(--green-soft); color: var(--on-green-soft); }
.member-head h3 { margin: 0; }
.wird-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wird-type { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.wird-type .name { font-size: .85rem; color: var(--ink-2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { text-align: center; padding: 8px; border-radius: var(--radius-sm); background: var(--surface-3); }
.stat b { display: block; font-size: 1.35rem; font-weight: 700; color: var(--green); line-height: 1.3; }
.stat span { font-size: .8rem; color: var(--ink-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 180px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 6px 16px; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--ink); font-weight: 500; }
.tabs a.on { background: var(--green); border-color: var(--green); color: var(--on-green); }

/* ---- hifz map ---- */
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: .85rem; color: var(--ink-2); margin: 12px 0 18px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1px solid var(--line); }
.surah-map { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.surah-tile { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 10px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); overflow: hidden; min-height: 78px; }
.surah-tile:hover { border-color: var(--green); }
.surah-tile .num { font-size: .75rem; color: var(--ink-2); }
.surah-tile .nm { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.3; }
.surah-tile .bar { position: absolute; inset-inline: 0; bottom: 0; height: 7px; display: flex; background: var(--h-none); }
.surah-tile .bar i { display: block; height: 100%; }
.surah-tile.full-excellent { background: color-mix(in srgb, var(--h-excellent) 18%, var(--surface)); }
.surah-tile.full-good { background: color-mix(in srgb, var(--h-good) 18%, var(--surface)); }
.surah-tile.full-acceptable { background: color-mix(in srgb, var(--h-acceptable) 20%, var(--surface)); }
.surah-tile.full-claimed { background: color-mix(in srgb, var(--h-claimed) 45%, var(--surface)); }
.surah-tile.full-review { background: color-mix(in srgb, var(--h-review) 22%, var(--surface)); }
.c-excellent { background: var(--h-excellent); }
.c-good { background: var(--h-good); }
.c-acceptable { background: var(--h-acceptable); }
.c-claimed { background: var(--h-claimed); }
.c-review { background: var(--h-review); }
.c-none { background: var(--h-none); }
.ayah-grid { display: flex; flex-wrap: wrap; gap: 4px; }
.ayah-grid span { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: .72rem; color: var(--ink); border: 1px solid var(--line); }
.ayah-grid span.c-excellent { color: var(--grade-excellent-on); }
.ayah-grid span.c-good { color: var(--grade-good-on); }
.ayah-grid span.c-acceptable { color: var(--grade-acceptable-on); }
.ayah-grid span.c-review { color: var(--grade-repeat-on); }
.mistake-row { display: grid; grid-template-columns: 90px 90px 1fr; gap: 8px; margin-bottom: 8px; }
@media (max-width: 520px) { .mistake-row { grid-template-columns: 1fr 1fr; } .mistake-row input:last-child { grid-column: 1 / -1; } }

/* ---- QR / codes ---- */
.code-box { text-align: center; }
.qr { background: #fff; display: inline-block; padding: 14px; border-radius: var(--radius); border: 1px solid var(--line); }
.qr svg { display: block; width: min(260px, 70vw); height: auto; }
.bigcode { font-family: "IBM Plex Sans Arabic", monospace; font-size: 2rem; letter-spacing: .25em; font-weight: 700; direction: ltr; unicode-bidi: isolate; color: var(--green); }
.countdown { font-weight: 700; font-variant-numeric: tabular-nums; }
.expired .qr, .expired .bigcode { opacity: .25; filter: grayscale(1); }

/* ---- legal pages (the home page and the marketing pages: public/css/site.css) ---- */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.4em; }
.prose ul { padding-inline-start: 22px; }
.prose li { margin-bottom: .4em; }

footer.site { border-top: 1px solid var(--line); background: var(--surface); padding: 20px 0; font-size: .875rem; color: var(--ink-2); }
footer.site .container { display: flex; gap: 8px 20px; flex-wrap: wrap; justify-content: space-between; }
footer.site nav { display: flex; gap: 16px; flex-wrap: wrap; }
body.has-bottomnav footer.site { padding-bottom: 90px; }
@media (min-width: 840px) { body.has-bottomnav footer.site { padding-bottom: 20px; } }

/* ---- auth pages ---- */
.auth-card { max-width: 440px; margin: 24px auto; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: .85rem; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.google-btn { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }

/* ---- tables (devices) ---- */
.device { display: flex; gap: 14px; align-items: flex-start; }
.device .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); display: grid; place-items: center; flex: none; }
.device .ico svg { width: 22px; height: 22px; }
.device.revoked { opacity: .6; }
.kv { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: .875rem; color: var(--ink-2); }

/* ---- schools ---- */
.grade-pill { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-3); color: var(--ink); white-space: nowrap; }
.grade-pill.grade-excellent { background: var(--grade-excellent); color: var(--grade-excellent-on); }
.grade-pill.grade-good { background: var(--grade-good); color: var(--grade-good-on); }
.grade-pill.grade-acceptable { background: var(--grade-acceptable); color: var(--grade-acceptable-on); }
.grade-pill.grade-repeat { background: var(--grade-repeat); color: var(--grade-repeat-on); }
.note-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.note-item:last-of-type { border-bottom: 0; }
.report-table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: .9rem; }
.report-table th, .report-table td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.report-table th { color: var(--ink-2); font-weight: 600; background: var(--surface-2); }
.report-table tr.bad td { background: var(--danger-soft); }
.report-table tr.skip td { color: var(--ink-2); }
@media (max-width: 520px) { .report-table th:nth-child(3), .report-table td:nth-child(3) { display: none; } }
kbd { font-family: inherit; font-size: .8em; padding: 0 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--ink); }

/* segmented toggles (attendance, new/review, lawh stage) */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; flex-wrap: nowrap; }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: block; padding: 8px 12px; min-height: 40px; line-height: 24px; font-weight: 500; font-size: .9rem; color: var(--ink-2); border-inline-start: 1px solid var(--line); white-space: nowrap; }
.seg label:first-child span { border-inline-start: 0; }
.seg input:checked + span { background: var(--green); color: var(--on-green); }
.seg input:focus-visible + span { outline: 3px solid var(--gold); outline-offset: -3px; }
.seg .seg-absent input:checked + span, .seg-absent input:checked + span { background: var(--danger); color: #fff; }
.seg-late input:checked + span { background: var(--gold); color: var(--on-gold); }
.seg-excused input:checked + span { background: var(--surface-4); color: var(--ink); }

/* teacher session */
.keys-hint { margin: -8px 0 16px; }
.student-card { margin-top: 16px; scroll-margin-top: 80px; }
.student-card:focus-within { border-color: var(--green); }
.student-card.busy { opacity: .6; pointer-events: none; }
.teach-row { margin-top: 10px; }
.teach-row select { width: auto; min-height: 42px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font: inherit; padding: 0 10px; }
.teach-row input[type="text"] { width: auto; flex: 1; min-height: 42px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font: inherit; padding: 0 12px; }
.portion { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.portion .grp { display: inline-flex; align-items: center; gap: 6px; }
.portion .pair { display: inline-flex; align-items: center; gap: 3px; direction: ltr; }
.portion input, .stepper input { width: 64px; padding: 0 4px; min-height: 42px; text-align: center; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.grades .btn { grid-column: 1 / -1; }
.grade-btn { min-height: 52px; border-radius: var(--radius-btn); border: 0; font: inherit; font-weight: 700; cursor: pointer; color: #fff; }
.grade-btn kbd { background: rgba(255, 255, 255, .2); color: inherit; border-color: rgba(255, 255, 255, .45); margin-inline-end: 4px; }
.grade-btn.grade-excellent { background: var(--grade-excellent); color: var(--grade-excellent-on); }
.grade-btn.grade-good { background: var(--grade-good); color: var(--grade-good-on); }
.grade-btn.grade-acceptable { background: var(--grade-acceptable); color: var(--grade-acceptable-on); }
.grade-btn.grade-acceptable kbd { border-color: rgba(0, 0, 0, .3); background: rgba(255, 255, 255, .35); }
.grade-btn.grade-repeat { background: var(--grade-repeat); color: var(--grade-repeat-on); }
.grade-btn:hover { filter: brightness(1.06); }
.grade-btn:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
@media (max-width: 520px) { .grades { grid-template-columns: repeat(2, 1fr); } .grade-btn kbd, .keys-hint { display: none; } }
.ok-text { color: var(--success); }
.err-text { color: var(--danger); }

/* ---- family 2.0 ---- */
.invite-grid { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.invite-grid .qr svg { width: min(300px, 72vw); }
@media (max-width: 680px) { .invite-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; } .invite-grid .row { justify-content: center; } }
.chip.sharing-family { background: var(--green-soft); color: var(--on-green-soft); }
.chip.sharing-supervisors { background: var(--gold-soft); color: var(--on-gold-soft); }
.chip.sharing-private { background: var(--surface-3); color: var(--ink-2); }

/* ---- free / sadaqa jariya banner (home), sources and credits, changelog ---- */
.free-banner { display: flex; gap: 12px; align-items: flex-start; margin-top: 18px; padding: 14px 16px; border-radius: var(--radius); background: color-mix(in srgb, var(--gold-soft) 60%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent); }
.free-banner .ico { flex: none; color: var(--gold); margin-top: 3px; }
.free-banner .ico svg { width: 24px; height: 24px; display: block; }
.free-banner p { margin: 0; }
.free-banner .free-line { font-weight: 600; }
.free-banner .sadaqa-line { color: var(--ink-2); margin-top: 4px; font-size: .95rem; line-height: 1.8; }
.latest-release { margin: 12px 0 0; }
.latest-release a { text-decoration: none; font-weight: 500; }
.latest-release a:hover { text-decoration: underline; }
.sources-group { margin-top: 28px; }
.sources-group h2 { display: flex; align-items: center; gap: 10px; }
.sources-group h2::before { content: ""; flex: none; width: 4px; height: 1.1em; border-radius: 2px; background: var(--gold); }
.sources-group .grid > .card { margin-top: 0; }
.source h3 { font-family: var(--font-ui); font-size: 1.05rem; font-weight: 600; line-height: 1.6; color: var(--ink); }
.source p { margin: 0 0 .35em; }
.source .source-link { margin-top: 8px; }
.errata { margin-top: 28px; }
.changelog-entry .row { margin-bottom: 4px; }
.changelog-entry h2 { margin: 0; }
.changelog-title { color: var(--gold-text); font-weight: 600; margin: 4px 0 8px; }
.changelog-entry ul { margin: 0; padding-inline-start: 22px; }
.changelog-entry li { margin-bottom: .45em; line-height: 1.8; }

/* ---- «الأخلّاء» and khatmas ---- */
a.card.group-card { color: var(--ink); text-decoration: none; display: block; }
a.card.group-card:hover { border-color: var(--green); }
.report-table tr.me td { background: var(--green-soft); color: var(--on-green-soft); }
.progress-bar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 8px 0; }
.progress-bar span { display: block; height: 100%; background: var(--green); }
.parts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.part { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.part.done { background: var(--green-soft); border-color: var(--green); }
.part.mine { box-shadow: inset 0 0 0 2px var(--gold); }
.part-head { display: flex; justify-content: space-between; align-items: center; }
.badges-list { display: flex; flex-wrap: wrap; gap: 8px; }
.badges-list .medal { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--gold-soft); color: var(--on-gold-soft); font-size: .9rem; font-weight: 600; }

/* ---- the app's mark: an inline SVG, drawn only by resources/views/partials/brand-mark ---- */
.brand-mark { flex: none; display: inline-block; vertical-align: middle; }

/* ---- «جولة في الوِرد»: the first-visit invitation (home page) ---- */
.tour-invite { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 8px; padding: 12px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--line)); }
.tour-invite p { margin: 0; flex: 1; min-width: 200px; }
.tour-invite .row { gap: 8px; }
/* The three account choices (partials/account-choices): in the home invitation and at the end of the tour. */
.account-choices { flex-basis: 100%; display: grid; gap: 8px; margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); }
.account-choices p { margin: 0; }
.account-choices .row { display: flex; flex-wrap: wrap; gap: 8px; }
.tour-end .account-choices { margin-top: 18px; max-width: 460px; }
.icon-btn.plain { border-color: transparent; background: transparent; }
@media (max-width: 760px) { .hero .actions .tour-btn { flex-basis: 100%; } }

/* Reduced motion: no slide, fade or press animation (the app does the same). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ---- «الرئيسية» (today's awrad) ---- */
.today-steady { margin-bottom: 16px; }
.streak { display: flex; align-items: baseline; gap: 8px; }
.streak b { font-size: 1.9rem; font-weight: 700; color: var(--green); line-height: 1; font-variant-numeric: tabular-nums; }
.week-strip { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-strip .day { display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 0; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: .8rem; }
.week-strip .g { font-size: 1.1rem; line-height: 1.3; font-weight: 700; }
.week-strip .n { font-variant-numeric: tabular-nums; }
.week-strip .s-steady { background: var(--green-soft); border-color: var(--green); color: var(--on-green-soft); }
.week-strip .s-partial { background: var(--gold-soft); border-color: var(--gold); color: var(--on-gold-soft); }
.week-strip .s-missed { background: var(--danger-soft); border-color: var(--danger); color: var(--ink); }
.today-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); margin-top: 16px; align-items: start; }
.wird-card { display: flex; flex-direction: column; gap: 4px; }
.wird-card > header h2 { margin: 0; font-size: 1.35rem; }
.wird-card .portion-line { font-size: 1.15rem; font-weight: 600; margin: 0; }
.wird-card .progress-bar { margin: 6px 0 2px; }
.wird-card p { margin: 0 0 4px; }
.wird-card .actions { margin-top: 12px; }
.wird-card .late-note { color: var(--late); }
.wird-card .wird-foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.quick { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.card.quick-link { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-weight: 600; padding: 14px 16px; min-height: var(--ctl-lg); }
.card.quick-link svg { width: 24px; height: 24px; color: var(--green); flex: none; }
.card.quick-link:hover { border-color: var(--green); }

/* The closed drawer sits off-screen: it must not widen the page. (clip, not hidden: sticky keeps working.) */
body.app-shell { overflow-x: clip; }

/* ---- «الجداول» of «الحفظ» (NV2 item 4): a table you scroll sideways, or cards, with a switch ---- */
.segmented { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.segmented a { padding: 6px 16px; text-decoration: none; color: var(--ink); font-weight: 500; }
.segmented a.on { background: var(--green); color: var(--on-green); }
.filters { display: grid; gap: 8px; margin-bottom: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
a.chip.plain { text-decoration: none; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
a.chip.plain.on { background: var(--green); border-color: var(--green); color: var(--on-green); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.data-table { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 640px; font-size: .9rem; }
.data-table th, .data-table td { text-align: start; padding: 0 12px; height: 46px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table th { color: var(--ink-2); font-weight: 600; background: var(--surface-2); }
.data-table .sticky-col { position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface); min-width: 3.6rem; }
.data-table th.sticky-col { background: var(--surface-2); }
.data-table .sticky-2 { inset-inline-start: 3.6rem; border-inline-end: 1px solid var(--line); }
.data-table a { color: var(--ink); text-decoration: none; }
.data-table a:hover { color: var(--green); }
.data-table .count { display: inline-block; min-width: 1.9em; text-align: center; padding: 1px 8px; border-radius: 8px; font-weight: 600; color: var(--ink); }
.data-table .count.c-excellent { background: color-mix(in srgb, var(--h-excellent) 30%, var(--surface)); }
.data-table .count.c-good { background: color-mix(in srgb, var(--h-good) 30%, var(--surface)); }
.data-table .count.c-acceptable { background: color-mix(in srgb, var(--h-acceptable) 32%, var(--surface)); }
.data-table .count.c-review { background: color-mix(in srgb, var(--h-review) 32%, var(--surface)); }
.data-table .count.c-claimed { background: color-mix(in srgb, var(--h-claimed) 55%, var(--surface)); }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; border: 1px solid var(--line); vertical-align: middle; }
.hifz-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); align-items: start; }
.hifz-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.hifz-card > summary { position: relative; list-style: none; cursor: pointer; display: flex; gap: 10px; align-items: center; padding: 12px 14px 18px; }
.hifz-card > summary::-webkit-details-marker { display: none; }
.hifz-card > summary::after { content: "\25BE"; color: var(--ink-2); }
.hifz-card[open] > summary::after { content: "\25B4"; }
.hifz-card .num { width: 30px; font-size: .85rem; color: var(--ink-2); }
.hifz-card .nm { font-family: var(--font-display); font-size: 1.2rem; line-height: 1.3; }
.hifz-card .bar { position: absolute; inset-inline: 0; bottom: 0; height: 6px; display: flex; background: var(--h-none); overflow: hidden; border-radius: 0 0 var(--radius) var(--radius); }
.hifz-card .bar i { display: block; height: 100%; }
.hifz-card .body { padding: 0 14px 14px; }
.legend-lines { list-style: none; margin: 0 0 8px; padding: 0; }
.legend-lines li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.legend-lines i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--line); flex: none; }
.seg-line { display: flex; gap: 10px; align-items: center; padding: 6px 0; }
.seg-line > i { width: 8px; height: 34px; border-radius: 4px; flex: none; }
