/* ==========================================================================
   Ganly — design system
   RTL-first, mobile-first. Light + dark via tokens.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg:          #f5f4fa;
  --bg-tint:     #eeebfb;
  --surface:     #ffffff;
  --surface-2:   #f9f8fd;
  --surface-3:   #f2f0fa;
  --ink:         #191530;
  --ink-2:       #4f4a6b;
  --muted:       #8a86a3;
  --line:        #e9e6f3;
  --line-strong: #d9d4ea;

  --brand:       #6343f0;
  --brand-ink:   #4b2fd1;
  --brand-2:     #8b6dff;
  --brand-soft:  #efebff;
  --brand-ring:  rgba(99, 67, 240, .22);
  --accent:      #ff7d55;
  --accent-soft: #fff0ea;
  --sun:         #ffc443;
  --sun-soft:    #fff6db;

  --good:        #0f8f4b;
  --good-strong: #12a356;
  --good-soft:   #e3f6eb;
  --warn:        #b26a00;
  --warn-strong: #f0a20f;
  --warn-soft:   #fff3d9;
  --bad:         #cf2f48;
  --bad-soft:    #fde9ec;
  --info-soft:   #e8f1fe;
  --info:        #1f62c6;

  --t1: #ffe1d6; --t1i: #b2482a;
  --t2: #dff3e6; --t2i: #1f7a46;
  --t3: #e3e8ff; --t3i: #3a4fc0;
  --t4: #fff0c7; --t4i: #8a6200;
  --t5: #fbe0ee; --t5i: #a3326b;
  --t6: #ddf2f7; --t6i: #1b6c80;

  --radius-sm: 10px;
  --radius:    16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(25, 21, 48, .05);
  --shadow:    0 1px 2px rgba(25, 21, 48, .04), 0 6px 20px -6px rgba(25, 21, 48, .10);
  --shadow-lg: 0 12px 40px -10px rgba(25, 21, 48, .22);
  --sidebar-w: 268px;
  --font: "Rubik", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:          #0f0d18;
    --bg-tint:     #171328;
    --surface:     #181524;
    --surface-2:   #1d1a2c;
    --surface-3:   #242036;
    --ink:         #f2f0fa;
    --ink-2:       #c2bdd8;
    --muted:       #8e89a8;
    --line:        #2a2640;
    --line-strong: #39344f;
    --brand:       #8a6dff;
    --brand-ink:   #a58fff;
    --brand-2:     #a58fff;
    --brand-soft:  #2a2250;
    --brand-ring:  rgba(138, 109, 255, .32);
    --accent-soft: #3a2219;
    --sun-soft:    #3a3016;
    --good:        #3fcf7f;
    --good-soft:   #15301f;
    --warn:        #f3b13c;
    --warn-soft:   #352812;
    --bad:         #ff6b80;
    --bad-soft:    #3a1820;
    --info:        #79a8f2;
    --info-soft:   #182640;
    --t1: #3b2219; --t1i: #ffb39a;
    --t2: #16301f; --t2i: #85dca6;
    --t3: #1e2547; --t3i: #a9b6ff;
    --t4: #352a10; --t4i: #f2c75a;
    --t5: #3a1b2b; --t5i: #f3a3c9;
    --t6: #13303a; --t6i: #87cfe0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow:    0 1px 2px rgba(0, 0, 0, .25), 0 8px 24px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 16px 48px -12px rgba(0, 0, 0, .7);
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
p { margin: 0; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.ic { width: 20px; height: 20px; flex: none; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 26px; height: 26px; }
:focus-visible { outline: 3px solid var(--brand-ring); outline-offset: 2px; border-radius: 8px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.hidden { display: none !important; }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0;
  width: var(--sidebar-w);
  background: var(--surface);
  border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 16px 16px;
  z-index: 40;
  transition: transform .3s var(--ease);
}
.main { margin-inline-start: var(--sidebar-w); min-width: 0; }
.content { max-width: 1180px; margin: 0 auto; padding: 28px 32px 64px; }

.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 38px; height: 38px; }
.brand-name { font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; }

.gan-switch {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px;
  color: var(--ink); width: 100%; font: inherit; text-align: start; cursor: pointer;
}
.gan-switch:hover { border-color: var(--line-strong); text-decoration: none; }
.gan-switch .gan-ico {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--sun), var(--accent)); color: #fff; flex: none;
}
.gan-switch .gan-meta { min-width: 0; flex: 1; }
.gan-switch strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gan-switch span { font-size: .8rem; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: .72rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; padding: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--ink-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav a:hover { background: var(--surface-3); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--brand-soft); color: var(--brand-ink); }
.nav a.active .ic { color: var(--brand); }
.nav .badge { margin-inline-start: auto; }

.sidebar-foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; color: var(--ink); }
.me:hover { background: var(--surface-3); text-decoration: none; }
.me-meta { min-width: 0; flex: 1; }
.me-meta strong { display: block; font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-meta span { font-size: .78rem; color: var(--muted); }

.topbar { display: none; }
.tabbar { display: none; }
.scrim { display: none; }

.impersonation {
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  background: linear-gradient(90deg, #2b1f6b, #4b2fd1); color: #fff;
  padding: 8px 16px; font-size: .88rem;
}
.impersonation a { color: #fff; font-weight: 600; text-decoration: underline; }

/* ---------- Page head ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: .88rem; margin-bottom: 6px; }
.crumb:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  --b-bg: var(--surface); --b-ink: var(--ink); --b-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px;
  font: inherit; font-weight: 500; font-size: .95rem; line-height: 1;
  color: var(--b-ink); background: var(--b-bg);
  border: 1px solid var(--b-line); border-radius: 12px;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: transform .12s var(--ease), box-shadow .15s, background .15s, border-color .15s;
}
.btn:hover { text-decoration: none; border-color: var(--muted); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.btn-primary {
  --b-bg: var(--brand); --b-ink: #fff; --b-line: transparent;
  background: linear-gradient(180deg, var(--brand-2), var(--brand));
  box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 6px 16px -6px var(--brand);
}
.btn-primary:hover { border-color: transparent; filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 10px 22px -8px var(--brand); }
.btn-soft { --b-bg: var(--brand-soft); --b-ink: var(--brand-ink); --b-line: transparent; }
.btn-soft:hover { border-color: transparent; filter: brightness(.97); }
.btn-ghost { --b-bg: transparent; --b-line: transparent; --b-ink: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-danger { --b-bg: var(--bad-soft); --b-ink: var(--bad); --b-line: transparent; }
.btn-danger:hover { border-color: var(--bad); }
.btn-sm { height: 36px; padding: 0 12px; font-size: .88rem; border-radius: 10px; }
.btn-lg { height: 52px; padding: 0 24px; font-size: 1.02rem; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 34px; }
.btn-pay { height: 48px; border-radius: 14px; font-weight: 600; flex: 1; }
.btn-bit { --b-bg: #e9fbf8; --b-ink: #087b6e; --b-line: transparent; }
.btn-paybox { --b-bg: #e8f1ff; --b-ink: #1556b8; --b-line: transparent; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-bit { --b-bg: #11302c; --b-ink: #6fe0d0; } :root:not([data-theme="light"]) .btn-paybox { --b-bg: #142540; --b-ink: #8fb9ff; } }
.inline { display: inline; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px 22px 22px; }
.card + .card { margin-top: 16px; }
.section { margin-top: 28px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-title h2 { font-size: 1.08rem; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }

/* ---------- Stats ---------- */
.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: .88rem; font-weight: 500; }
.stat-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.stat-ico .ic { width: 18px; height: 18px; }
.stat-value { font-size: 1.85rem; font-weight: 600; letter-spacing: -.02em; margin-top: 10px; line-height: 1.1; }
.stat-foot { margin-top: 6px; font-size: .84rem; color: var(--muted); }
.stat-foot a { font-weight: 500; }
.tone-brand { background: var(--brand-soft); color: var(--brand-ink); }
.tone-good  { background: var(--good-soft);  color: var(--good); }
.tone-warn  { background: var(--warn-soft);  color: var(--warn); }
.tone-bad   { background: var(--bad-soft);   color: var(--bad); }
.tone-accent{ background: var(--accent-soft); color: var(--accent); }
.tone-info  { background: var(--info-soft);  color: var(--info); }

/* ---------- Hero (parent status) ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 26px; padding: 28px;
  color: #fff;
  background:
    radial-gradient(600px 240px at 0% 0%, rgba(255,255,255,.18), transparent 60%),
    radial-gradient(500px 300px at 100% 120%, rgba(255,196,67,.35), transparent 60%),
    linear-gradient(135deg, #6a48f5 0%, #4b2fd1 55%, #3a24a8 100%);
  box-shadow: 0 20px 50px -20px rgba(75, 47, 209, .6);
}
.hero.is-clear {
  background:
    radial-gradient(600px 240px at 0% 0%, rgba(255,255,255,.2), transparent 60%),
    linear-gradient(135deg, #1fb871 0%, #0f9257 60%, #0b7a49 100%);
  box-shadow: 0 20px 50px -20px rgba(15, 146, 87, .55);
}
.hero-eyebrow { font-size: .9rem; opacity: .85; display: flex; align-items: center; gap: 8px; }
.hero-amount { font-size: 2.8rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.05; margin-top: 8px; }
.hero-sub { margin-top: 8px; opacity: .9; }
.hero-deco { position: absolute; inset-inline-end: 18px; top: 50%; transform: translateY(-50%); width: 120px; opacity: .16; pointer-events: none; }
.hero .chips { margin-top: 18px; }
.hero .chip { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.18); }

/* ---------- Fund (pay) cards ---------- */
.pay-card { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.pay-card .fund-name { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; background: var(--sw, var(--brand)); }
.pay-card .amount { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
.pay-card .kids { display: flex; flex-wrap: wrap; gap: 6px; }
.pay-actions { display: flex; gap: 8px; }
.pay-card.is-paid { background: linear-gradient(180deg, var(--good-soft), var(--surface) 70%); }

/* ---------- Badges / chips ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: .78rem; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.badge .ic { width: 14px; height: 14px; }
.badge-good  { background: var(--good-soft); color: var(--good); }
.badge-warn  { background: var(--warn-soft); color: var(--warn); }
.badge-bad   { background: var(--bad-soft);  color: var(--bad); }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-info  { background: var(--info-soft); color: var(--info); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-size: .88rem; font-weight: 500; white-space: nowrap;
}
.chip:hover { text-decoration: none; border-color: var(--muted); color: var(--ink); }
.chip.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip .count { opacity: .65; font-weight: 400; }

/* ---------- Avatars ---------- */
.avatar {
  --size: 40px;
  width: var(--size); height: var(--size); border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  font-weight: 600; font-size: calc(var(--size) * .38);
  background: var(--t3); color: var(--t3i);
  overflow: hidden; object-fit: cover;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sq { border-radius: 30%; }
.avatar.t1 { background: var(--t1); color: var(--t1i); } .avatar.t2 { background: var(--t2); color: var(--t2i); }
.avatar.t3 { background: var(--t3); color: var(--t3i); } .avatar.t4 { background: var(--t4); color: var(--t4i); }
.avatar.t5 { background: var(--t5); color: var(--t5i); } .avatar.t6 { background: var(--t6); color: var(--t6i); }
.avatar.xs { --size: 28px; } .avatar.sm { --size: 34px; } .avatar.lg { --size: 64px; } .avatar.xl { --size: 120px; }

/* ---------- Progress ---------- */
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--bar, var(--brand)); transition: width .5s var(--ease); }
.progress.lg { height: 12px; }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .label { font-weight: 500; font-size: .9rem; color: var(--ink); }
.field .req { color: var(--bad); }
.hint { font-size: .82rem; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 48px; padding: 0 14px;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.textarea { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238a86a3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; padding-left: 40px;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: .8; }
.input[type="date"] { direction: rtl; }
.input-ltr { direction: ltr; text-align: right; }
.input-group { position: relative; }
.input-group .addon { position: absolute; inset-block: 0; inset-inline-end: 14px; display: grid; place-items: center; color: var(--muted); pointer-events: none; font-weight: 500; }
.input-group .input { padding-inline-end: 40px; }
.form-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-start; padding-top: 6px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.fieldset { border: 0; margin: 0; padding: 0; }
.fieldset-title { font-weight: 600; margin-bottom: 4px; }

/* Segmented radio */
.segmented { display: inline-flex; padding: 4px; background: var(--surface-3); border-radius: 14px; gap: 4px; flex-wrap: wrap; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; font-weight: 500; color: var(--ink-2); transition: all .15s; }
.segmented input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 3px solid var(--brand-ring); }

/* Option cards (role picker) */
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.option { position: relative; cursor: pointer; }
.option input { position: absolute; opacity: 0; }
.option .opt {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; height: 100%;
  border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--surface);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.option .opt strong { display: block; font-weight: 600; }
.option .opt small { color: var(--muted); }
.option input:checked + .opt { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 0 0 3px var(--brand-ring); }
.option input:focus-visible + .opt { outline: 3px solid var(--brand-ring); }

/* Checkbox pills (children picker) */
.pick-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { position: relative; cursor: pointer; }
.pick input { position: absolute; opacity: 0; }
.pick > span {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 6px;
  border: 1.5px solid var(--line-strong); border-radius: 999px; background: var(--surface);
  font-weight: 500; color: var(--ink-2); transition: all .15s;
}
.pick .avatar { --size: 28px; }
.pick input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.pick input:focus-visible + span { outline: 3px solid var(--brand-ring); }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

/* Photo uploader */
.photo-up { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.photo-up .preview {
  width: 132px; height: 132px; border-radius: 28px; overflow: hidden; flex: none;
  background: var(--surface-3); display: grid; place-items: center; color: var(--muted);
  border: 2px dashed var(--line-strong); position: relative;
}
.photo-up .preview.has { border-style: solid; border-color: transparent; box-shadow: var(--shadow); }
.photo-up .preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-up .preview .ic { width: 36px; height: 36px; }
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 26px 16px; border: 2px dashed var(--line-strong); border-radius: 16px; background: var(--surface-2);
  cursor: pointer; position: relative; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.dropzone .dz-file { font-weight: 600; color: var(--ink); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  text-align: start; font-weight: 500; font-size: .8rem; color: var(--muted);
  padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .t-num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .t-actions { text-align: end; white-space: nowrap; width: 1%; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who strong { font-weight: 600; display: block; }
.who small { color: var(--muted); }

/* ---------- Payments matrix ---------- */
.matrix th, .matrix td { padding: 10px 12px; }
.matrix thead th { position: sticky; top: 0; z-index: 2; vertical-align: bottom; }
.matrix .sticky-col { position: sticky; inset-inline-start: 0; background: var(--surface); z-index: 1; min-width: 190px; box-shadow: -1px 0 0 var(--line) inset; }
.matrix thead .sticky-col { z-index: 3; }
.matrix tbody tr:hover .sticky-col { background: var(--surface-2); }
.fund-th { min-width: 150px; text-align: center !important; }
.fund-th .fund-th-name { display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; color: var(--ink); font-size: .88rem; }
.fund-th .fund-th-meta { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.fund-th .progress { height: 4px; margin-top: 8px; }
.matrix td.cell { text-align: center; }
.pay-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 112px; height: 38px; padding: 0 12px; border-radius: 10px;
  font: inherit; font-size: .86rem; font-weight: 600; cursor: pointer;
  border: 1.5px dashed var(--line-strong); background: transparent; color: var(--muted);
  transition: all .15s var(--ease);
}
.pay-btn:hover { border-color: var(--brand); color: var(--brand-ink); }
.pay-btn.s-paid    { border: 1.5px solid transparent; background: var(--good-soft); color: var(--good); }
.pay-btn.s-partial { border: 1.5px solid transparent; background: var(--warn-soft); color: var(--warn); }
.pay-btn.s-exempt  { border: 1.5px solid transparent; background: var(--surface-3); color: var(--ink-2); }
.pay-btn .ic { width: 16px; height: 16px; }
.pay-btn.flash { animation: pop .45s var(--ease); }
@keyframes pop { 0% { transform: scale(.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }

.popover {
  position: fixed; z-index: 100; width: 260px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg);
  padding: 8px; animation: fadeUp .16s var(--ease);
}
.popover .pop-title { font-size: .8rem; color: var(--muted); padding: 6px 10px 8px; }
.popover button.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px; border: 0; background: none; border-radius: 10px; font: inherit; color: var(--ink); cursor: pointer; text-align: start;
}
.popover button.pop-item:hover { background: var(--surface-3); }
.popover .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.popover .partial-row { display: flex; gap: 6px; padding: 6px 4px 4px; }
.popover .partial-row .input { height: 38px; font-size: .92rem; }
.popover .partial-row .btn { height: 38px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- Contacts ---------- */
.kids-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.kid-card { overflow: hidden; display: flex; flex-direction: column; transition: transform .18s var(--ease), box-shadow .18s; }
.kid-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.kid-photo { aspect-ratio: 1 / 1; position: relative; background: var(--surface-3); overflow: hidden; }
.kid-photo img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.kid-card:hover .kid-photo img { transform: scale(1.03); }
.kid-photo .placeholder { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3.2rem; font-weight: 600; }
.kid-photo .placeholder.t1 { background: var(--t1); color: var(--t1i); } .kid-photo .placeholder.t2 { background: var(--t2); color: var(--t2i); }
.kid-photo .placeholder.t3 { background: var(--t3); color: var(--t3i); } .kid-photo .placeholder.t4 { background: var(--t4); color: var(--t4i); }
.kid-photo .placeholder.t5 { background: var(--t5); color: var(--t5i); } .kid-photo .placeholder.t6 { background: var(--t6); color: var(--t6i); }
.kid-photo .corner { position: absolute; top: 10px; inset-inline-start: 10px; display: flex; gap: 6px; }
.kid-photo .corner .badge { background: rgba(255,255,255,.92); color: #191530; box-shadow: var(--shadow-sm); }
.kid-photo .edit-fab {
  position: absolute; top: 10px; inset-inline-end: 10px; width: 36px; height: 36px; border-radius: 12px;
  background: rgba(255,255,255,.92); color: #191530; display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.kid-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.kid-name { font-weight: 600; font-size: 1.05rem; }
.kid-meta { color: var(--muted); font-size: .84rem; display: flex; align-items: center; gap: 5px; }
.kid-allergy { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--bad); background: var(--bad-soft); padding: 4px 10px; border-radius: 8px; align-self: flex-start; }
.parent-line { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.parent-line:first-of-type { border-top: 0; padding-top: 0; }
.parent-line .p-meta { flex: 1; min-width: 0; }
.parent-line .p-name { font-weight: 500; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.parent-line .p-rel { font-size: .78rem; color: var(--muted); }
.icon-link {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--surface-3); color: var(--ink-2); flex: none; transition: background .15s, color .15s;
}
.icon-link:hover { background: var(--brand-soft); color: var(--brand-ink); text-decoration: none; }
.icon-link.wa:hover { background: #dcf8e7; color: #128c4a; }
.icon-link .ic { width: 17px; height: 17px; }
.committee { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.committee .person { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); flex: none; }

.search { position: relative; min-width: 240px; }
.search .ic { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-inline-start: 42px; height: 44px; }

/* ---------- Lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .li-sub { font-size: .84rem; color: var(--muted); }
.list-item .li-end { text-align: end; font-weight: 600; }

.exp-ico { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; flex: none; position: relative; background: var(--surface-3); color: var(--ink-2); }
.exp-ico::after { content: ""; position: absolute; bottom: -2px; inset-inline-end: -2px; width: 12px; height: 12px; border-radius: 4px; background: var(--sw); border: 2px solid var(--surface); }

/* ---------- Fund overview cards ---------- */
.fund-card { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.fund-card .fc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fund-card .fc-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.02rem; }
.fund-card .fc-figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fund-card .fc-fig small { display: block; color: var(--muted); font-size: .78rem; }
.fund-card .fc-fig strong { font-size: 1.05rem; font-weight: 600; }
.fund-card.archived { opacity: .7; }

/* ---------- Charts ---------- */
.chart-box { position: relative; height: 300px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; font-size: .85rem; color: var(--ink-2); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.bar-list { display: flex; flex-direction: column; gap: 14px; }
.bar-row .bar-top { display: flex; justify-content: space-between; gap: 10px; font-size: .9rem; margin-bottom: 6px; }
.bar-row .bar-top span:first-child { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.bar-row .progress { height: 10px; }
.view-toggle { display: inline-flex; gap: 4px; padding: 3px; background: var(--surface-3); border-radius: 10px; }
.view-toggle button { border: 0; background: none; font: inherit; font-size: .82rem; font-weight: 500; color: var(--ink-2); padding: 5px 10px; border-radius: 8px; cursor: pointer; }
.view-toggle button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- Empty states ---------- */
.empty { text-align: center; padding: 48px 24px; }
.empty .empty-ico { width: 72px; height: 72px; border-radius: 24px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty .empty-ico .ic { width: 32px; height: 32px; }
.empty h3 { font-size: 1.1rem; margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 18px; }

/* ---------- Onboarding checklist ---------- */
.steps { display: flex; flex-direction: column; gap: 4px; }
.step { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; color: var(--ink); }
.step:hover { background: var(--surface-2); text-decoration: none; }
.step .step-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); color: var(--muted); font-weight: 600; font-size: .85rem; flex: none; }
.step.done .step-dot { background: var(--good-strong); border-color: var(--good-strong); color: #fff; }
.step.done .step-title { color: var(--muted); text-decoration: line-through; }
.step .step-title { font-weight: 500; flex: 1; }

/* ---------- Flash / toasts ---------- */
.toasts { position: fixed; z-index: 200; top: 18px; inset-inline: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  max-width: 520px; width: 100%; padding: 12px 14px 12px 12px; border-radius: 14px;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-lg);
  font-weight: 500; font-size: .93rem; animation: toastIn .35s var(--ease);
}
.toast .t-ico { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.toast.success .t-ico { background: var(--good-strong); color: #fff; }
.toast.error .t-ico { background: var(--bad); color: #fff; }
.toast.info .t-ico { background: var(--brand); color: #fff; }
.toast .t-close { margin-inline-start: auto; background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 4px; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 14px; font-size: .92rem; }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-bad { background: var(--bad-soft); color: var(--bad); }
.alert-good { background: var(--good-soft); color: var(--good); }

/* ---------- Dialog ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 22px; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.modal::backdrop { background: rgba(15, 12, 30, .45); backdrop-filter: blur(3px); }
dialog.modal[open] { animation: fadeUp .2s var(--ease); }
.modal-body { padding: 24px; }
.modal-body h3 { font-size: 1.15rem; margin-bottom: 8px; }
.modal-body p { color: var(--ink-2); }
.modal-ico { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: var(--bad-soft); color: var(--bad); margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; padding: 0 24px 24px; }
.modal-actions .btn { flex: 1; }

/* ---------- Guest / auth ---------- */
.guest {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; padding: 32px 16px;
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(139, 109, 255, .22), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(255, 196, 67, .22), transparent 60%),
    var(--bg);
}
.guest-card { width: 100%; max-width: 440px; }
.guest-card.wide { max-width: 620px; }
.guest-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 26px; color: var(--ink); }
.guest-brand:hover { text-decoration: none; }
.guest-brand .brand-logo { width: 46px; height: 46px; }
.guest-brand .brand-name { font-size: 1.7rem; }
.auth-card { padding: 32px 28px; border-radius: 26px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.45rem; text-align: center; }
.auth-card .lead { text-align: center; color: var(--ink-2); margin: 8px 0 24px; }
.guest-foot { text-align: center; margin-top: 20px; color: var(--muted); font-size: .9rem; }
.phone-input { font-size: 1.25rem !important; letter-spacing: .04em; text-align: center !important; height: 56px !important; direction: ltr; }
.otp-input {
  height: 64px !important; font-size: 2rem !important; letter-spacing: .5em; text-align: center !important;
  font-weight: 600; direction: ltr; padding-inline-start: .5em !important; font-variant-numeric: tabular-nums;
}
.resend { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 18px; font-size: .9rem; color: var(--muted); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--brand-ink); cursor: pointer; font-weight: 500; }
.link-btn:hover { text-decoration: underline; }
.link-btn[disabled] { color: var(--muted); cursor: default; text-decoration: none; }

.gan-pick { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); width: 100%; font: inherit; color: var(--ink); cursor: pointer; text-align: start; transition: all .15s; }
.gan-pick:hover { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.gan-pick .gan-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--sun), var(--accent)); color: #fff; flex: none; }
.gan-pick strong { display: block; font-weight: 600; font-size: 1.02rem; }
.gan-pick small { color: var(--muted); }

/* ---------- Landing ---------- */
.landing { background: var(--bg); overflow-x: hidden; }
.l-nav { max-width: 1180px; margin: 0 auto; padding: 20px 24px; display: flex; align-items: center; justify-content: space-between; }
.l-hero { max-width: 1180px; margin: 0 auto; padding: 40px 24px 80px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.l-eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 500; font-size: .88rem; }
.l-title { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.08; margin: 18px 0; }
.l-title em { font-style: normal; background: linear-gradient(90deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.l-lead { font-size: 1.15rem; color: var(--ink-2); max-width: 520px; }
.l-cta { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.l-visual { position: relative; }
.l-mock { border-radius: 28px; background: var(--surface); box-shadow: var(--shadow-lg); border: 1px solid var(--line); padding: 18px; transform: rotate(-1.5deg); }
.l-mock .hero { padding: 22px; border-radius: 20px; }
.l-mock .hero-amount { font-size: 2.2rem; }
.l-float { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-lg); padding: 12px 14px; display: flex; align-items: center; gap: 10px; font-weight: 500; font-size: .9rem; }
.l-float.f1 { top: -18px; inset-inline-start: -24px; transform: rotate(3deg); }
.l-float.f2 { bottom: -22px; inset-inline-end: -16px; transform: rotate(-2deg); }
.l-features { max-width: 1180px; margin: 0 auto; padding: 0 24px 90px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.l-feature { padding: 24px; }
.l-feature .stat-ico { width: 44px; height: 44px; border-radius: 14px; margin-bottom: 14px; }
.l-feature .stat-ico .ic { width: 22px; height: 22px; }
.l-feature h3 { margin-bottom: 6px; }
.l-feature p { color: var(--ink-2); font-size: .95rem; }
.l-foot { text-align: center; color: var(--muted); padding: 30px 24px 40px; font-size: .9rem; border-top: 1px solid var(--line); }

/* ---------- Misc ---------- */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: .85rem; margin: 6px 0; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.danger-zone { border: 1px solid var(--bad-soft); }
.kbd { font-family: ui-monospace, monospace; background: var(--surface-3); padding: 2px 6px; border-radius: 6px; font-size: .85em; }
.check-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.check-list li { display: flex; align-items: center; gap: 10px; }
.money-pos { color: var(--good); }
.money-neg { color: var(--bad); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { transform: translateX(100%); box-shadow: var(--shadow-lg); width: min(300px, 86vw); }
  [dir="rtl"] .sidebar { transform: translateX(100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(15, 12, 30, .4); z-index: 39; animation: fadeIn .2s; }
  .main { margin-inline-start: 0; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    position: sticky; top: 0; z-index: 30;
    padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand { padding: 0; }
  .topbar .brand-logo { width: 32px; height: 32px; }
  .topbar .brand-name { font-size: 1.15rem; }
  .topbar .tb-gan { font-size: .82rem; color: var(--muted); max-width: 46vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .content { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; bottom: 0; inset-inline: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 2px; border-radius: 12px; border: 0; background: none; font: inherit;
    font-size: .7rem; font-weight: 500; color: var(--muted); cursor: pointer;
  }
  .tabbar a:hover { text-decoration: none; }
  .tabbar .ic { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--brand-ink); }
  .tabbar a.active .ic { color: var(--brand); }
  h1 { font-size: 1.4rem; }
  .page-head { margin-bottom: 18px; align-items: flex-start; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .form-grid, .options { grid-template-columns: minmax(0, 1fr); }
  .l-hero { grid-template-columns: minmax(0, 1fr); padding-top: 16px; gap: 56px; }
  .l-features { grid-template-columns: minmax(0, 1fr); }
  .l-float.f1 { inset-inline-start: -4px; }
  .l-float.f2 { inset-inline-end: -4px; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 1.4rem; }
  .stat-label { font-size: .8rem; }
  .stat-ico { width: 28px; height: 28px; }
  .hero { padding: 22px; border-radius: 22px; }
  .hero-amount { font-size: 2.3rem; }
  .card-pad { padding: 18px; }
  .card-head { padding: 16px 18px 0; }
  .card-body { padding: 14px 18px 18px; }
  .kids-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kid-body { padding: 12px; }
  .kid-name { font-size: .98rem; }
  .parent-line { flex-wrap: wrap; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .search { min-width: 0; width: 100%; }
  .auth-card { padding: 26px 20px; }
  .fund-card .fc-figs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .table-cards thead { display: none; }
  .table-cards tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table-cards td { padding: 0; border: 0; }
  .table-cards td[data-hide-sm] { display: none; }
  .table-cards td.t-actions { grid-column: 1 / -1; text-align: start; padding-top: 6px; }
  .pay-actions { flex-direction: column; }
  .pay-actions .btn-pay { flex: none; width: 100%; }
  .matrix .sticky-col { min-width: 140px; max-width: 160px; }
  .matrix .who small { display: none; }
  .fund-th { min-width: 128px; }
  .pay-btn { min-width: 100px; }
  .hero-deco { display: none; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .topbar, .tabbar, .page-head .actions, .btn { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ---------- Late additions ---------- */
.sm-only { display: none; }
@media (max-width: 560px) { .sm-only { display: inline; } }
.pay-btn.is-loading { opacity: .5; pointer-events: none; }
@media (max-width: 900px) { .photo-card { order: -1; } .photo-card .preview { max-width: 260px; margin: 0 auto; } }
.popover .pop-item.current { background: var(--good-soft); }
.popover { max-height: 70vh; overflow-y: auto; }
.inst { display: flex; flex-direction: column; gap: 8px; }
.inst-steps { display: flex; gap: 6px; }
.inst-steps span { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); }
.inst-steps span.done { background: var(--good-strong); }
.parent-rows { display: flex; flex-direction: column; gap: 10px; }
.parent-row { display: grid; grid-template-columns: 150px 1fr 1fr 40px; gap: 8px; align-items: center; }
@media (max-width: 700px) {
  .parent-row { grid-template-columns: 1fr 40px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; }
  .parent-row .select { grid-column: 1; }
  .parent-row [data-row-remove] { grid-column: 2; grid-row: 1; }
  .parent-row .input { grid-column: 1 / -1; }
}

/* ---------- Pricing ---------- */
.price-card {
  border-radius: 18px; padding: 18px; margin-bottom: 22px;
  background: linear-gradient(160deg, var(--brand-soft), var(--surface) 75%);
  border: 1px solid var(--line);
}
.price-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.price-label { font-size: .85rem; color: var(--ink-2); font-weight: 500; }
.price-amount { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.price-amount small { font-size: .9rem; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.price-ico { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--brand-2), var(--brand)); }
.price-list { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-direction: column; gap: 6px; font-size: .92rem; }
.price-list li { display: flex; align-items: center; gap: 8px; }
.price-list .ic { color: var(--good-strong); }
.price-note { display: flex; gap: 8px; align-items: flex-start; font-size: .85rem; color: var(--ink-2); padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.steps-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; font-size: .92rem; }
.steps-list li { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.steps-list li .n { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; font-size: .75rem; font-weight: 600; flex: none; }
.steps-list li.done { color: var(--good); font-weight: 500; }
.steps-list li.done .ic { width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: var(--good-strong); color: #fff; }
