/* QIWAM · قِوام — design system. Logical properties everywhere so RTL (ar) and LTR (en/fr) share one sheet. */

:root {
  --jade: #0E7C66; --jade-deep: #0A5C4C; --jade-mist: #E3F2EE; --jade-glow: rgba(14,124,102,.14);
  --coral: #FF6B4A; --coral-deep: #E2502F; --coral-mist: #FFE9E3;
  --gold: #E8B04B; --gold-mist: #FBF0D9;
  --sky: #3A9FD6; --sky-mist: #E2F1FA;
  --violet: #7A5AF8; --violet-mist: #EEE9FE;
  --success: #16A34A; --warning: #B45309; --danger: #DC2626;

  --bg: #FAF7F2; --surface: #FFFFFF; --surface-2: #F3EEE6; --surface-3: #ECE5DA;
  --ink: #10201D; --ink-2: #2B3B37; --muted: #5A6A65; --border: #E4DCCF; --border-strong: #CFC4B3;
  --on-primary: #FFFFFF; --primary: var(--jade); --primary-deep: var(--jade-deep); --primary-mist: var(--jade-mist);
  --focus: var(--jade);

  --font-display: 'Readex Pro', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --font-body: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --scale: 1;
  --radius-s: 10px; --radius: 16px; --radius-l: 24px; --radius-xl: 32px;
  --shadow-s: 0 1px 2px rgba(16,32,29,.06), 0 1px 1px rgba(16,32,29,.04);
  --shadow: 0 6px 20px -8px rgba(16,32,29,.18), 0 2px 6px rgba(16,32,29,.05);
  --shadow-l: 0 24px 60px -20px rgba(16,32,29,.28);
  --ease: cubic-bezier(.2,.8,.2,1);
  --header-h: 68px;
  --wrap: 1200px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0B1513; --surface: #12201D; --surface-2: #182A26; --surface-3: #1F3530;
  --ink: #ECF2EF; --ink-2: #C9D6D1; --muted: #9DB0AA; --border: #24382F; --border-strong: #335046;
  --jade: #2BB394; --jade-deep: #5ED3B6; --jade-mist: #143A32; --jade-glow: rgba(43,179,148,.18);
  --coral-mist: #3A1E17; --gold-mist: #3A2E15; --sky-mist: #13293A; --violet-mist: #241B47;
  --on-primary: #06201A;
  --shadow: 0 8px 24px -8px rgba(0,0,0,.5); --shadow-l: 0 24px 60px -20px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* High contrast — for low-vision members */
:root[data-contrast="high"] {
  --bg: #000; --surface: #000; --surface-2: #0d0d0d; --surface-3: #1a1a1a;
  --ink: #fff; --ink-2: #fff; --muted: #FFE14D; --border: #FFE14D; --border-strong: #FFE14D;
  --jade: #36F1A8; --jade-deep: #36F1A8; --jade-mist: #062a1d; --primary: #36F1A8; --on-primary: #000;
  --coral: #FF9D85; --gold: #FFE14D; --sky: #7FD3FF; --violet: #C8B8FF;
  --coral-mist: #000; --gold-mist: #000; --sky-mist: #000; --violet-mist: #000;
  --focus: #FFE14D; --shadow: none; --shadow-l: none; --shadow-s: none;
  color-scheme: dark;
}
:root[data-large="1"] { --scale: 1.22; }
:root[data-dyslexia="1"] body { letter-spacing: .02em; word-spacing: .12em; line-height: 1.9; }

*, *::before, *::after { box-sizing: border-box; }
html { font-size: calc(100% * var(--scale)); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: 1.0625rem; line-height: 1.65;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  min-height: 100dvh; display: flex; flex-direction: column;
}
html[lang="en"] body, html[lang="fr"] body { line-height: 1.6; }
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-deep); }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: clamp(2rem, 4vw + 1rem, 2.75rem); font-weight: 700; }
h2 { font-size: clamp(1.6rem, 2vw + 1rem, 2rem); font-weight: 600; }
h3 { font-size: 1.3rem; font-weight: 600; }
h4 { font-size: 1.08rem; font-weight: 600; }
p { margin: 0 0 1em; }
small, .small { font-size: .875rem; }
.muted { color: var(--muted); }
bdi { white-space: nowrap; }
.num, .tabular { font-variant-numeric: tabular-nums; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.5rem 0; }
::selection { background: var(--jade-mist); color: var(--ink); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 3000; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; }
.skip-link:focus { top: 10px; }

.ic { width: 1.25em; height: 1.25em; flex: none; }
.ic-lg { width: 1.6em; height: 1.6em; }
.ic-xl { width: 2.2em; height: 2.2em; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 16px; }
@media (min-width: 768px) { .wrap { padding-inline: 28px; } }

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 1000; height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { height: 100%; display: flex; align-items: center; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex: none; }
.brand-mark { width: 36px; height: 36px; }
.brand-words { display: flex; flex-direction: column; line-height: 1; }
.brand-en { font-family: var(--font-display); font-weight: 700; letter-spacing: .14em; font-size: .95rem; }
.brand-ar { font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; color: var(--primary); margin-top: 3px; }
.main-nav { display: none; gap: 2px; margin-inline-start: 8px; flex: 1; }
.main-nav a {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 999px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: .95rem; white-space: nowrap;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.main-nav a:hover { background: var(--surface-2); color: var(--ink); }
.main-nav a[aria-current="page"] { background: var(--jade-mist); color: var(--primary-deep); }
.header-tools { display: flex; align-items: center; gap: 6px; margin-inline-start: auto; }
@media (min-width: 1100px) { .main-nav { display: flex; } .menu-btn { display: none !important; } }

.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer; position: relative; transition: background .18s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 8px; inset-inline-end: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--coral); color: #fff; font-size: .7rem; font-weight: 700; display: grid; place-items: center; }
.lang-select { height: 44px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); padding-inline: 10px; font: inherit; font-size: .9rem; cursor: pointer; }

/* drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(6,18,15,.45); z-index: 1500; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(340px, 88vw); background: var(--surface); z-index: 1600; padding: 18px; overflow-y: auto;
  transform: translateX(105%); transition: transform .26s var(--ease); box-shadow: var(--shadow-l); display: flex; flex-direction: column; gap: 4px; }
[dir="rtl"] .drawer { transform: translateX(-105%); }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
.drawer a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 500; min-height: 48px; }
.drawer a:hover, .drawer a[aria-current="page"] { background: var(--jade-mist); color: var(--primary-deep); }
.drawer h4 { margin: 14px 14px 4px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }

/* bottom tab bar (members, mobile) */
.tabbar { display: none; }
@media (max-width: 899px) {
  body.authed .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 900;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  body.authed main { padding-bottom: 84px; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; min-height: 52px; justify-content: center; }
  .tabbar a[aria-current="page"] { color: var(--primary-deep); background: var(--jade-mist); }
}

main { flex: 1; outline: none; }
.page { padding-block: 28px 64px; animation: page-in .32s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------------- buttons ---------------- */
.btn {
  --b-bg: var(--primary); --b-fg: var(--on-primary); --b-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px;
  border-radius: 14px; border: 1.5px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg);
  font: 600 1rem/1.2 var(--font-display); text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), filter .18s;
}
.btn:hover { color: var(--b-fg); filter: brightness(1.06); box-shadow: 0 6px 18px -8px var(--b-bg); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .6; cursor: not-allowed; }
.btn-coral { --b-bg: var(--coral); --b-fg: #1b0b06; }
.btn-ghost { --b-bg: transparent; --b-fg: var(--ink); --b-bd: var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-soft { --b-bg: var(--jade-mist); --b-fg: var(--primary-deep); }
.btn-soft:hover { box-shadow: none; }
.btn-danger { --b-bg: transparent; --b-fg: var(--danger); --b-bd: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-sm { min-height: 38px; padding: 6px 14px; font-size: .9rem; border-radius: 11px; }
.btn-lg { min-height: 56px; padding: 14px 28px; font-size: 1.1rem; border-radius: 18px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; padding: 4px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- surfaces ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); padding: 22px; box-shadow: var(--shadow-s); }
.card-tight { padding: 16px; border-radius: var(--radius); }
.card h3 { display: flex; align-items: center; gap: 10px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h3, .card-head h2 { margin: 0; }
.panel { background: var(--surface-2); border-radius: var(--radius); padding: 16px; }
.tile-link { text-decoration: none; color: inherit; display: block; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s; }
.tile-link:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); color: inherit; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.g-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.g-stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }
.stack > * + * { margin-top: 16px; }
.stack-s > * + * { margin-top: 8px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); white-space: nowrap; }
.pill-jade { background: var(--jade-mist); color: var(--primary-deep); border-color: transparent; }
.pill-coral { background: var(--coral-mist); color: var(--coral-deep); border-color: transparent; }
.pill-gold { background: var(--gold-mist); color: #8A5A00; border-color: transparent; }
.pill-sky { background: var(--sky-mist); color: #1C6E9C; border-color: transparent; }
.pill-violet { background: var(--violet-mist); color: #5236D0; border-color: transparent; }
:root[data-theme="dark"] .pill-gold { color: var(--gold); } :root[data-theme="dark"] .pill-sky { color: var(--sky); } :root[data-theme="dark"] .pill-violet { color: #B7A5FF; } :root[data-theme="dark"] .pill-coral { color: var(--coral); }

.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat .v { font: 700 1.6rem/1.1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.stat .v small { font-size: .9rem; color: var(--muted); font-weight: 500; }
.stat-accent { background: linear-gradient(135deg, var(--jade), var(--jade-deep)); border: 0; }
.stat-accent .v, .stat-accent .l, .stat-accent .v small { color: #fff; }
:root[data-contrast="high"] .stat-accent { background: #000; border: 2px solid var(--jade); }

.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--sky-mist); border-inline-start: 4px solid var(--sky); }
.notice-warn { background: var(--gold-mist); border-color: var(--gold); }
.notice-danger { background: var(--coral-mist); border-color: var(--danger); }
.notice-jade { background: var(--jade-mist); border-color: var(--jade); }
.notice p:last-child { margin: 0; }

/* ---------------- forms ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: .92rem; color: var(--ink-2); }
.hint { font-size: .82rem; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.6; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--jade-glow); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .85rem; font-weight: 500; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

.seg { display: flex; flex-wrap: wrap; gap: 6px; padding: 5px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { flex: 1 1 auto; min-height: 42px; border: 0; background: transparent; color: var(--ink-2); padding: 8px 14px; border-radius: 12px; font: 600 .92rem var(--font-display); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--primary-deep); box-shadow: var(--shadow-s); }
:root[data-contrast="high"] .seg button[aria-pressed="true"] { outline: 2px solid var(--jade); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--ink-2); cursor: pointer; font: 500 .92rem var(--font-body); }
.chip[aria-pressed="true"] { border-color: var(--primary); background: var(--jade-mist); color: var(--primary-deep); }
.chip[aria-pressed="true"]::before { content: "✓"; font-weight: 700; }

.check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; transition: background .15s, border-color .15s; }
.check:hover { border-color: var(--border-strong); }
.check input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; margin-top: 2px; cursor: pointer; }
.check.done { background: var(--jade-mist); border-color: transparent; }
.check.done .check-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink) 35%, transparent); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; flex: none; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: var(--shadow-s); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(18px); }
[dir="rtl"] .switch input:checked::after { transform: translateX(-18px); }

/* progress */
.bar { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--jade), #3CC6A2); transition: width .5s var(--ease); }
.bar.coral > span { background: linear-gradient(90deg, var(--coral), #FF9B7F); }
.bar.gold > span { background: linear-gradient(90deg, var(--gold), #F5CE7D); }
.bar.sky > span { background: linear-gradient(90deg, var(--sky), #7CC4EA); }
.ring { --p: 0; --c: var(--jade); width: 132px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-3) 0); position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 12px; border-radius: 50%; background: var(--surface); }
.ring > * { position: relative; text-align: center; }
.ring .v { font: 700 1.7rem/1 var(--font-display); }

/* ---------------- tables ---------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: .85rem; }
tr:last-child td { border-bottom: 0; }

/* ---------------- toast / modal ---------------- */
.toasts { position: fixed; z-index: 4000; inset-inline: 0; bottom: 96px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding-inline: 16px; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: center; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; box-shadow: var(--shadow-l); font-weight: 500; max-width: 520px; animation: toast-in .25s var(--ease); }
.toast.ok .ic { color: #5EE0B9; } .toast.err .ic { color: #FF9B7F; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@media (min-width: 900px) { .toasts { bottom: 24px; } }

dialog.modal { border: 0; padding: 0; border-radius: var(--radius-l); background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); box-shadow: var(--shadow-l); }
dialog.modal::backdrop { background: rgba(6,18,15,.5); backdrop-filter: blur(3px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------------- avatar ---------------- */
.avatar { --h: 160; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; font: 700 .95rem var(--font-display);
  background: hsl(var(--h) 55% 88%); color: hsl(var(--h) 60% 26%); }
:root[data-theme="dark"] .avatar { background: hsl(var(--h) 35% 24%); color: hsl(var(--h) 70% 84%); }
.avatar-lg { width: 64px; height: 64px; font-size: 1.4rem; }

/* ---------------- HOME / landing ---------------- */
.hero { position: relative; overflow: hidden; padding-block: 56px 40px; }
.hero-grid { display: grid; gap: 40px; align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1.1fr .9fr; } .hero { padding-block: 84px 64px; } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px 6px 8px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); font-size: .88rem; font-weight: 600; color: var(--ink-2); box-shadow: var(--shadow-s); }
[dir="rtl"] .eyebrow { padding: 6px 8px 6px 14px; }
.eyebrow b { background: var(--coral); color: #fff; border-radius: 999px; padding: 2px 10px; font-size: .78rem; }
.display { font: 700 clamp(2.5rem, 6vw + .5rem, 4.4rem)/1.08 var(--font-display); letter-spacing: -.02em; margin: 18px 0 18px; }
.display .accent { color: var(--primary); position: relative; white-space: nowrap; }
.display .accent::after { content: ""; position: absolute; inset-inline: 0; bottom: .02em; height: .16em; background: var(--coral); border-radius: 999px; opacity: .85; transform-origin: left; animation: underline 1s .4s var(--ease) both; }
[dir="rtl"] .display .accent::after { transform-origin: right; }
@keyframes underline { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.lead { font-size: clamp(1.08rem, .6vw + 1rem, 1.3rem); color: var(--ink-2); max-width: 40ch; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 26px; }
.trust-row { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 30px; color: var(--muted); font-size: .92rem; }
.trust-row span { display: inline-flex; align-items: center; gap: 8px; }
.trust-row .ic { color: var(--primary); }

.hero-art { position: relative; aspect-ratio: 1; max-width: 520px; margin-inline: auto; width: 100%; }
.orb { position: absolute; border-radius: 50%; filter: blur(2px); }
.orb-a { inset: 6% 10% 14% 6%; background: radial-gradient(circle at 30% 30%, var(--jade-mist), transparent 70%); }
.hero-ring { position: absolute; inset: 12%; border-radius: 50%; border: 22px solid var(--primary); animation: breathe 7s ease-in-out infinite; }
.hero-line { position: absolute; left: 50%; width: 22px; top: 48%; bottom: 0; transform: translateX(-50%); background: var(--coral); border-radius: 999px; }
.hero-dot { position: absolute; left: 50%; top: 50%; width: 48px; height: 48px; margin: -48px 0 0 -24px; border-radius: 50%; background: var(--coral); }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.035); } }
.float-card { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; font-size: .9rem; animation: floaty 6s ease-in-out infinite; }
.float-card strong { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.float-card .ic-wrap { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.fc-1 { top: 6%; inset-inline-start: -2%; } .fc-2 { top: 42%; inset-inline-end: -4%; animation-delay: -2s; } .fc-3 { bottom: 4%; inset-inline-start: 4%; animation-delay: -4s; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@media (max-width: 600px) { .float-card { font-size: .8rem; padding: 8px 10px; } .fc-2 { inset-inline-end: 0; } .fc-1 { inset-inline-start: 0; } }

.section { padding-block: 56px; }
.section-head { max-width: 680px; margin-bottom: 30px; }
.section-head.center { margin-inline: auto; text-align: center; }
.kicker { font: 700 .8rem var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--coral-deep); margin-bottom: 8px; display: block; }
:root[data-theme="dark"] .kicker { color: var(--coral); }
.band { background: var(--surface); border-block: 1px solid var(--border); }
.band-jade { background: linear-gradient(160deg, var(--jade-deep), #06352C); color: #fff; }
.band-jade h2, .band-jade h3 { color: #fff; }
:root[data-theme="dark"] .band-jade { background: linear-gradient(160deg, #0F3D33, #082520); }

.bento { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
@media (min-width: 1024px) {
  .bento { grid-template-columns: repeat(4, 1fr); }
  .bento .span-2 { grid-column: span 2; }
  .bento .tall { grid-row: span 2; }
}
.pillar { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; min-height: 200px; }
.pillar .ic-wrap { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; }
.pillar p { color: var(--muted); margin: 0; font-size: .97rem; }
.pillar .go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--primary); }
.tone-jade .ic-wrap { background: var(--jade-mist); color: var(--primary-deep); }
.tone-coral .ic-wrap { background: var(--coral-mist); color: var(--coral-deep); }
.tone-gold .ic-wrap { background: var(--gold-mist); color: #9A6400; }
.tone-sky .ic-wrap { background: var(--sky-mist); color: #1C6E9C; }
.tone-violet .ic-wrap { background: var(--violet-mist); color: #5236D0; }
:root[data-theme="dark"] .tone-gold .ic-wrap { color: var(--gold); } :root[data-theme="dark"] .tone-sky .ic-wrap { color: var(--sky); } :root[data-theme="dark"] .tone-violet .ic-wrap { color: #B7A5FF; } :root[data-theme="dark"] .tone-coral .ic-wrap { color: var(--coral); }
.pillar-feature { background: linear-gradient(150deg, var(--jade) 0%, var(--jade-deep) 100%); color: #fff; border: 0; }
.pillar-feature h3, .pillar-feature p { color: #fff; } .pillar-feature p { opacity: .9; }
.pillar-feature .ic-wrap { background: rgba(255,255,255,.16); color: #fff; }
.pillar-feature .go { color: #fff; }
.pillar-deco { position: absolute; inset-inline-end: -40px; bottom: -40px; width: 180px; height: 180px; border: 18px solid rgba(255,255,255,.12); border-radius: 50%; }

.audience { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.aud-card { border-radius: var(--radius-l); padding: 22px; border: 1px solid var(--border); background: var(--surface); }
.aud-card .big { font: 700 2.4rem/1 var(--font-display); margin-bottom: 10px; }

.steps { counter-reset: s; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.step { counter-increment: s; position: relative; padding-top: 52px; }
.step::before { content: counter(s, decimal); position: absolute; top: 0; inset-inline-start: 0; width: 40px; height: 40px; border-radius: 12px; background: var(--coral); color: #fff; display: grid; place-items: center; font: 700 1.1rem var(--font-display); }
:root[lang="ar"] .step::before { content: counter(s, arabic-indic); }

.cta-band { border-radius: var(--radius-xl); padding: clamp(28px, 5vw, 56px); background: radial-gradient(120% 140% at 100% 0%, #13a183 0%, var(--jade-deep) 55%, #052a23 100%); color: #fff; position: relative; overflow: hidden; }
.cta-band h2 { color: #fff; font-size: clamp(1.8rem, 3vw + 1rem, 2.6rem); }
.cta-band p { opacity: .9; max-width: 52ch; }
.cta-band .deco { position: absolute; inset-inline-end: -60px; top: -60px; width: 260px; height: 260px; border: 26px solid rgba(255,255,255,.1); border-radius: 50%; }

/* ---------------- footer ---------------- */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); padding-block: 40px 28px; margin-top: 40px; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.site-footer h4 { font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 12px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a { color: var(--ink-2); text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
.disclaimer { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: .85rem; }

/* ---------------- app pages ---------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: clamp(1.7rem, 2.4vw + 1rem, 2.4rem); }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.crumbs { display: flex; gap: 6px; align-items: center; color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--primary); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.prog-card { display: flex; flex-direction: column; gap: 10px; height: 100%; }
.prog-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.prog-card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.prog-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; flex: none; }

.ex { display: grid; grid-template-columns: auto 1fr; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.ex + .ex { margin-top: 10px; }
.ex.done { background: var(--jade-mist); border-color: transparent; }
.ex-num { width: 38px; height: 38px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; font: 700 1rem var(--font-display); color: var(--ink-2); }
.ex.done .ex-num { background: var(--primary); color: var(--on-primary); }
.ex h4 { margin: 0 0 4px; }
.ex .safety { margin-top: 8px; display: flex; gap: 8px; font-size: .9rem; color: var(--primary-deep); background: var(--jade-mist); padding: 8px 12px; border-radius: 10px; }
.ex.done .safety { background: var(--surface); }
.ex-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.timer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-radius: var(--radius-l); background: var(--ink); color: var(--bg); position: sticky; top: calc(var(--header-h) + 10px); z-index: 50; box-shadow: var(--shadow); }
:root[data-theme="dark"] .timer { background: #061411; color: var(--ink); border: 1px solid var(--border); }
.timer .readout { font: 700 2.2rem/1 var(--font-display); font-variant-numeric: tabular-nums; min-width: 4.5ch; }
.timer .btn-ghost { --b-fg: currentColor; --b-bd: color-mix(in srgb, currentColor 30%, transparent); }
.timer .btn-ghost:hover { background: rgba(255,255,255,.08); }

.meal { border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--surface); overflow: hidden; }
.meal + .meal { margin-top: 14px; }
.meal-head { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--surface-2); flex-wrap: wrap; }
.meal-head label { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; font-family: var(--font-display); }
.meal-head input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--primary); }
.meal-body { padding: 16px 18px; }
.ing { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.ing li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: .95rem; }
.ing li b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.macros { display: flex; flex-wrap: wrap; gap: 6px; }

.water { display: flex; flex-wrap: wrap; gap: 8px; }
.cup { width: 46px; height: 56px; border-radius: 8px 8px 16px 16px; border: 2px solid var(--sky); background: transparent; color: var(--sky); cursor: pointer; display: grid; place-items: end center; padding-bottom: 4px; font: 700 .7rem var(--font-display); position: relative; overflow: hidden; }
.cup::before { content: ""; position: absolute; inset: auto 0 0 0; height: 0; background: var(--sky); transition: height .3s var(--ease); z-index: 0; }
.cup span { position: relative; z-index: 1; }
.cup[aria-pressed="true"]::before { height: 100%; }
.cup[aria-pressed="true"] { color: #fff; }

.chat { display: flex; flex-direction: column; height: calc(100dvh - var(--header-h) - 160px); min-height: 460px; border: 1px solid var(--border); border-radius: var(--radius-l); background: var(--surface); overflow: hidden; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: min(82%, 640px); padding: 12px 16px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word; line-height: 1.6; }
.bubble.me { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-end-end-radius: 6px; }
.bubble.them { align-self: flex-start; background: var(--surface-2); border-end-start-radius: 6px; }
.bubble.them strong { color: var(--primary-deep); }
.bubble .meta { display: block; font-size: .72rem; opacity: .7; margin-top: 4px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: var(--surface); align-items: flex-end; }
.chat-form textarea { min-height: 48px; max-height: 160px; }
.typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.suggest { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 18px 12px; }

.post { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.post:last-child { border-bottom: 0; }
.post-body { white-space: pre-wrap; margin-top: 4px; }

.badge-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.badge { text-align: center; padding: 14px 10px; border-radius: var(--radius); border: 1px dashed var(--border-strong); color: var(--muted); }
.badge .medal { width: 54px; height: 54px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); }
.badge.earned { border-style: solid; border-color: var(--gold); color: var(--ink); background: var(--gold-mist); }
.badge.earned .medal { background: var(--gold); color: #fff; }
.badge .t { font-size: .82rem; font-weight: 600; line-height: 1.3; }

.breath-stage { display: grid; place-items: center; min-height: 360px; }
.breath-circle { width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, var(--violet-mist), transparent 70%); border: 10px solid var(--violet); display: grid; place-items: center; transition: transform 4s ease-in-out; font: 600 1.15rem var(--font-display); text-align: center; padding: 20px; }
.breath-circle.in { transform: scale(1.35); } .breath-circle.hold { transform: scale(1.35); } .breath-circle.out { transform: scale(.85); }
.mood-row { display: flex; gap: 10px; flex-wrap: wrap; }
.mood-btn { flex: 1 1 90px; min-height: 92px; border-radius: var(--radius); border: 2px solid var(--border); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font: 600 .9rem var(--font-display); color: var(--ink-2); }
.mood-btn[aria-pressed="true"] { border-color: var(--violet); background: var(--violet-mist); color: var(--ink); }
.mood-btn .face { font-size: 1.9rem; line-height: 1; }

.kid-hero { border-radius: var(--radius-xl); padding: clamp(24px, 4vw, 44px); background: linear-gradient(135deg, #FFD36E 0%, #FF9B7F 55%, #FF6B4A 100%); color: #2A1406; position: relative; overflow: hidden; }
.kid-hero h1 { color: #2A1406; }
.mission { border-radius: var(--radius-l); padding: 18px; border: 2px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.mission.done { border-color: var(--gold); background: var(--gold-mist); }
.mission .emoji { font-size: 2.4rem; line-height: 1; }
.stars { font-size: 1.5rem; letter-spacing: 2px; }

.store-logo { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font: 700 1.2rem var(--font-display); flex: none; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ic { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--border-strong); }

.chart { width: 100%; height: 240px; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .line-w { stroke: var(--jade); fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-v { stroke: var(--coral); fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area-w { fill: var(--jade-glow); }
.chart .pt { fill: var(--surface); stroke-width: 2.5; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: var(--radius); min-height: 120px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.a11y-panel .row { justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.a11y-panel .row:last-child { border-bottom: 0; }

.speak-btn { display: inline-flex; align-items: center; gap: 6px; }

@media print {
  .site-header, .site-footer, .tabbar, .no-print, .timer, .drawer, .toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .meal, .ex { box-shadow: none; break-inside: avoid; border-color: #bbb; }
  .page { padding: 0; animation: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
:root[data-motion="off"] *, :root[data-motion="off"] *::before, :root[data-motion="off"] *::after { animation: none !important; transition: none !important; }
