/* eCaymis design system v5 — app chrome. See DESIGN.md. Governmental, layered, calm. Landing page ships its own landing.css. */

/* ============ tokens ============ */
:root {
  --primary: #1E5AC8; --deep: #173FA0; --bright: #3E86E0; --navy: #0F2E63; --navy-2: #143A7A; --gold: #D4941A;
  --teal: #0F9BB5; --violet: #6A5AE0; --emerald: #1E9E63; --danger: #B3261E;
  --ink: #14213D; --muted: #4F5F7A; --line: #E6EBF2; --line-strong: #CFD8E6;
  --bg: #F4F7FB; --card: #FFFFFF; --card-alt: #FBFCFE; --glass: color-mix(in srgb, var(--card) 82%, transparent);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px; --radius-sm: 12px; --radius-lg: 24px; --hit: 48px;
  --shadow-sm: 0 1px 2px rgba(15, 46, 99, .06);
  --shadow: 0 10px 30px -18px rgba(15, 46, 99, .18), 0 1px 2px rgba(15, 46, 99, .04);
  --shadow-lg: 0 30px 60px -30px rgba(15, 46, 99, .32);
  --focus: 0 0 0 4px rgba(30, 90, 200, .22);
}
[data-theme="dark"] {
  --ink: #E6EDF8; --muted: #9FB0CB; --line: #24324A; --line-strong: #34456A; --bg: #0B1526; --card: #121F35; --card-alt: #0F1A2E;
  --navy: #E6EDF8; --navy-2: #1A2C4D; --primary: #5B93EA; --deep: #7FAAF0; --glass: color-mix(in srgb, var(--card) 78%, transparent);
  --shadow: 0 12px 32px -14px rgba(0, 0, 0, .6), 0 1px 2px rgba(0, 0, 0, .4); --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .55);
  --focus: 0 0 0 4px rgba(91, 147, 234, .35);
  color-scheme: dark;
}

/* ============ base ============ */
* { box-sizing: border-box; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
html, body { overflow-x: clip; }
body { margin: 0; font-family: var(--font); font-size: 16px; font-weight: 400; color: var(--ink); background: var(--bg); line-height: 1.65; min-height: 100vh; display: flex; flex-direction: column; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { color: var(--navy); margin: 0 0 .5rem; line-height: 1.14; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 3.6vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
p { margin: 0 0 .75rem; }
a { color: var(--primary); }
img, svg, table { max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.eyebrow { color: var(--gold); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: .7rem; margin: 0 0 .6rem; }
.hide-m { display: inline; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============ chrome: govbar, topbar, brand, nav ============ */
.govbar { background: var(--navy); color: #C9D6EC; font-size: .78rem; padding: .4rem 1rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
[data-theme="dark"] .govbar { background: #071022; }
.govbar b { color: #fff; font-weight: 600; }
.govbar .official { display: inline-flex; align-items: center; gap: .4rem; color: #E7C982; font-weight: 600; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .6rem 1rem; background: var(--glass); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 800; color: var(--navy); text-decoration: none; font-size: 1.15rem; min-height: var(--hit); letter-spacing: -.01em; white-space: nowrap; }
[data-theme="dark"] .brand { color: #fff; }
.brand img { border-radius: 9px; }
.topbar > .brand { min-width: 0; flex: 0 1 auto; overflow: hidden; } /* the brand gives way; it never runs under the language switcher */
.topbar > .nav { flex: 0 0 auto; }
.brand small { font-weight: 500; color: var(--muted); font-size: .72rem; display: block; letter-spacing: 0; line-height: 1.1; }
.nav { display: flex; align-items: center; gap: .6rem; flex-wrap: nowrap; }
.nav-user { display: inline-flex; align-items: center; gap: .5rem; color: var(--navy); text-decoration: none; font-weight: 600; white-space: nowrap; }
[data-theme="dark"] .nav-user { color: var(--ink); }
.nav-user small { color: var(--muted); font-weight: 500; text-transform: capitalize; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; font-size: .78rem; font-weight: 700; letter-spacing: .02em; flex: none; }
[data-theme="dark"] .avatar { background: var(--primary); }

.langs { display: inline-flex; gap: .1rem; padding: 2px; border-radius: 999px; border: 1px solid var(--line-strong); }
.langs a { padding: 0 .55rem; min-height: 32px; display: inline-grid; place-items: center; font-size: .72rem; font-weight: 800; letter-spacing: .06em; color: var(--muted); text-decoration: none; border-radius: 999px; }
.langs a.on { background: var(--navy); color: #fff; }
[data-theme="dark"] .langs a.on { background: var(--primary); color: #fff; }
.icon-btn { min-width: 40px; min-height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line-strong); background: var(--card); color: var(--navy); border-radius: 10px; cursor: pointer; transition: background .15s ease; }
[data-theme="dark"] .icon-btn { color: var(--ink); }
@media (hover: hover) { .icon-btn:hover { background: var(--bg); } }
.icon-btn .moon { display: none; }
[data-theme="dark"] .icon-btn .moon { display: block; }
[data-theme="dark"] .icon-btn .sun { display: none; }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }

.page { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 1.5rem) 4rem; }
.page-wide { max-width: 1280px; }
.footer { padding: 1.5rem 1rem; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); background: var(--card); }
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-in { max-width: 1080px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
.legal { max-width: 720px; }
.legal section { margin-top: 1.5rem; } .legal h2 { font-size: 1.15rem; } .legal p { color: var(--ink); }

/* ============ shell: staff sidebar + drawer ============ */
.shell { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
.shell > * { min-width: 0; }
@media (min-width: 900px) { .shell { grid-template-columns: 248px 1fr; gap: 2rem; } }
.menu-btn { display: none; }
.sidenav-head { display: none; }
.sidenav { display: flex; gap: .25rem; overflow-x: auto; padding-bottom: .25rem; min-width: 0; max-width: 100%; }
@media (min-width: 900px) {
  .sidenav {
    flex-direction: column; gap: 0; overflow: visible; position: sticky; top: 5rem; align-self: start;
    background: var(--navy); border-radius: var(--radius-lg); padding: 1rem .75rem; box-shadow: var(--shadow);
  }
  [data-theme="dark"] .sidenav { background: #0B1730; border: 1px solid var(--line); }
}
.nav-group { display: grid; gap: .1rem; margin-bottom: .6rem; }
.nav-group-h { margin: .9rem .8rem .3rem; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
@media (min-width: 900px) { .nav-group-h { color: #7F97C4; margin-top: 1.1rem; } .nav-group:first-child .nav-group-h { margin-top: .2rem; } }
.sidenav a { display: inline-flex; align-items: center; gap: .65rem; padding: .55rem .8rem; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; min-height: 42px; }
@media (min-width: 900px) { .sidenav a { color: #C9D6EC; border-radius: 10px; } }
.sidenav a.on { background: var(--card); color: var(--primary); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
@media (min-width: 900px) { .sidenav a.on { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.14); box-shadow: none; } }
@media (hover: hover) and (min-width: 900px) { .sidenav a:not(.on):hover { background: rgba(255,255,255,.06); color: #fff; } }
.nav-ic { flex: none; opacity: .85; }
.sidenav a.on .nav-ic { opacity: 1; }
.nav-ic-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; opacity: .6; }
.shell-main { min-width: 0; display: grid; gap: 1.25rem; align-content: start; }

@media (max-width: 899px) {
  .menu-btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .9rem; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); color: var(--navy); font: inherit; font-weight: 600; width: 100%; justify-content: flex-start; }
  [data-theme="dark"] .menu-btn { color: var(--ink); }
  .sidenav { position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); background: var(--navy); z-index: 60; transform: translateX(-100%); transition: transform .3s cubic-bezier(.2,.7,.2,1); box-shadow: 20px 0 60px -20px rgba(0,0,0,.35); overflow-y: auto; margin: 0; padding: 1rem; flex-direction: column; gap: 0; display: flex; border-radius: 0; }
  [data-theme="dark"] .sidenav { background: #0B1730; }
  [dir="rtl"] .sidenav { inset: 0 0 0 auto; transform: translateX(100%); }
  html.drawer-open .sidenav { transform: none; }
  html.drawer-open { overflow: hidden; }
  .drawer-backdrop { position: fixed; inset: 0; background: rgba(5, 15, 40, .45); z-index: 55; backdrop-filter: blur(2px); }
  .sidenav-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; color: #fff; }
  .sidenav-head .icon-btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.14); color: #fff; }
  .sidenav a { color: #C9D6EC; padding: .7rem .8rem; font-size: 1rem; border-radius: 10px; }
  .sidenav a.on { background: rgba(255,255,255,.12); color: #fff; border: 0; }
  .shell-main { order: 1; }
}

/* ============ components ============ */
.page-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end; }
.page-head h1 { font-size: clamp(1.5rem, 2.8vw, 2rem); }
.page-head .lede { color: var(--muted); margin: 0; max-width: 70ch; }
.page-head .back { display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .5rem; color: var(--muted); text-decoration: none; font-weight: 600; font-size: .9rem; }
.page-head .back:hover { color: var(--primary); }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.toolbar input[type=search], .toolbar input[type=date], .toolbar select { min-height: 40px; padding: 0 .8rem; border: 1px solid var(--line-strong); border-radius: 10px; font: inherit; background: var(--card); color: var(--ink); min-width: 220px; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; max-width: 100%; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; overflow-x: auto; }
.card h2 { font-size: 1.1rem; }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; }
.stat a { text-decoration: none; color: inherit; display: block; }
.stat b { display: block; font-size: 1.6rem; color: var(--navy); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
[data-theme="dark"] .stat b { color: #fff; }
.stat span { color: var(--muted); font-size: .85rem; }
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.table-wrap { overflow-x: auto; max-width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: start; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table thead th { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); background: var(--card-alt); }
.table tfoot th { text-align: start; background: var(--card-alt); }
.table tbody tr:last-child td { border-bottom: 0; }
.table a { font-weight: 700; text-decoration: none; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; }
.table code { font-size: .85em; color: var(--muted); }
@media (hover: hover) { .table tbody tr:hover td { background: rgba(30, 90, 200, .04); } }
.group-h { background: var(--card-alt); font-weight: 800; color: var(--navy); }
.sub-h { color: var(--muted); font-weight: 700; padding-inline-start: 1.6rem !important; }

.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .65rem; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-link { text-decoration: none; }
.chip-green { background: #E8F6EE; color: #145A38; } .chip-amber { background: #FFF4DF; color: #7A4B00; } .chip-red { background: #FBEDEC; color: #7A1D17; }
.chip-blue { background: #E7F0FD; color: #173FA0; } .chip-grey { background: #EEF2F7; color: #4A5A75; } .chip-violet { background: #EEEBFB; color: #3F2FA6; } .chip-teal { background: #E3F5F8; color: #0B6B7D; }
[data-theme="dark"] .chip-green { background: #0F2E22; color: #9FE0BC; } [data-theme="dark"] .chip-amber { background: #3A2A0C; color: #F2CD7B; } [data-theme="dark"] .chip-red { background: #3A1614; color: #F5B3AE; }
[data-theme="dark"] .chip-blue { background: #14274A; color: #A7C4F5; } [data-theme="dark"] .chip-grey { background: #1E2A40; color: #B8C5DB; } [data-theme="dark"] .chip-violet { background: #241E4A; color: #C4BBF5; } [data-theme="dark"] .chip-teal { background: #0C2C33; color: #9ADCE8; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; font-size: .93rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 600; }

.ttable textarea { width: 100%; min-height: 56px; padding: .45rem .6rem; border: 1px solid var(--line-strong); border-radius: 8px; font: inherit; font-size: .88rem; background: var(--card); color: var(--ink); resize: vertical; }
.tcell.is-over textarea { border-color: var(--gold); }
.tcell-actions { display: flex; gap: .4rem; align-items: center; margin-top: .35rem; flex-wrap: wrap; }
.ttable th[scope=row] { min-width: 160px; font-weight: 600; }
.ttable td { min-width: 240px; }
.tform { display: contents; }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.bars li { display: grid; grid-template-columns: minmax(90px, 40%) 1fr auto; gap: .6rem; align-items: center; font-size: .9rem; }
.bar-k { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.bar-track i { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--teal)); border-radius: 999px; transition: width .6s cubic-bezier(.2,.7,.2,1); }
.bar-v { font-variant-numeric: tabular-nums; color: var(--navy); }
[data-theme="dark"] .bar-v { color: #fff; }
.rep h2 { font-size: 1rem; }

.diff { margin: 0; padding-inline-start: 1rem; font-size: .82rem; color: var(--muted); }

/* registration wizard + member card */
.fee-box { display: flex; align-items: baseline; gap: .75rem; margin: 0 0 1.25rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card-alt); }
.fee-amount { font-size: 2.2rem; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
[data-theme="dark"] .fee-amount { color: #fff; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-inline-end: .35rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.choices { display: grid; gap: .75rem; }
.choice { display: flex; gap: .8rem; align-items: flex-start; padding: 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--card); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.choice:has(input:checked) { border-color: var(--primary); box-shadow: var(--focus); }
.choice input { width: 20px; height: 20px; margin-top: .3rem; accent-color: var(--primary); flex: none; }
.choice-body { display: grid; gap: .2rem; }
.choice-body .eyebrow { margin: 0; }
.choice-body b { font-size: 1.05rem; color: var(--navy); }
[data-theme="dark"] .choice-body b { color: #fff; }
.choice-body small { color: var(--muted); }
.choice-body a { font-size: .85rem; font-weight: 700; text-decoration: none; }

.member-card { background: linear-gradient(160deg, #0F2E63 0%, #143A7A 100%); color: #fff; border-radius: var(--radius); padding: 1.5rem; max-width: 560px; box-shadow: var(--shadow-lg); display: grid; gap: .35rem; position: relative; overflow: hidden; }
.member-card::after { content: ""; position: absolute; inset: auto -20% -40% auto; width: 60%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, rgba(212,148,26,.28), transparent); pointer-events: none; }
.member-card-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .75rem; }
.member-card-head b { display: block; font-size: 1.1rem; } .member-card-head small { display: block; color: #C9D6EC; font-size: .75rem; }
.member-card-head .chip { margin-inline-start: auto; }
.member-no-label { margin: 0; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: #E7C982; font-weight: 700; }
.member-no { margin: 0; font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: 800; letter-spacing: .08em; font-variant-numeric: tabular-nums; color: var(--gold); }
.member-name { margin: 0 0 .75rem; font-size: 1.15rem; font-weight: 700; }
.member-card .kv dt { color: #A9BBD9; } .member-card .kv dd { color: #fff; }
.member-card .muted { color: #C9D6EC; margin: .75rem 0 0; font-size: .85rem; }
.qr { margin-top: 1rem; display: grid; gap: .35rem; justify-items: start; }
.qr-box { background: #fff; padding: .5rem; border-radius: 12px; width: 132px; height: 132px; display: grid; place-items: center; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr small { color: #C9D6EC; }

.elig { max-width: 640px; border-width: 2px; }
.elig-ok { border-color: var(--emerald); } .elig-no { border-color: var(--danger); }
.elig-head { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.elig .member-no { font-size: 1.8rem; margin: .25rem 0 .5rem; color: var(--navy); }
[data-theme="dark"] .elig .member-no { color: #fff; }

.confirm-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .6rem .9rem; margin: 0; display: grid; gap: .25rem; }
.confirm-item legend { font-weight: 700; color: var(--navy); padding: 0 .3rem; }
.confirm-item .check { min-height: 40px; }

/* ============ forms ============ */
.form { display: grid; gap: 1.1rem; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.inline-form { display: inline; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 700; font-size: .9rem; color: var(--navy); display: flex; justify-content: space-between; align-items: baseline; }
[data-theme="dark"] .field label { color: var(--ink); }
.field label .opt { color: var(--muted); font-weight: 500; font-size: .8rem; }
.control { position: relative; display: flex; }
.field input, .field select, .field textarea { width: 100%; min-height: var(--hit); padding: 0 .9rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; color: var(--ink); background: var(--card); transition: border-color .15s, box-shadow .15s; }
.field select { padding: 0 .9rem; }
.field textarea { padding: .6rem .9rem; min-height: var(--hit); }
.field input[type=file] { padding: .6rem .9rem; }
.field input::placeholder { color: #9AA8BF; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.field.is-valid input { border-color: var(--emerald); padding-right: 2.6rem; }
.field.is-valid .control::after { content: "✓"; position: absolute; right: .9rem; top: 50%; transform: translateY(-50%); color: var(--emerald); font-weight: 800; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger); }
.field-error input:focus { box-shadow: 0 0 0 4px rgba(179, 38, 30, .18); }
.help { margin: 0; font-size: .82rem; color: var(--muted); }
.error { margin: 0; font-size: .85rem; color: var(--danger); font-weight: 600; display: flex; gap: .35rem; align-items: center; }
.toggle-pw { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 0 .6rem; border: 0; background: transparent; color: var(--primary); font: inherit; font-weight: 700; font-size: .8rem; cursor: pointer; border-radius: 6px; }
.toggle-pw:focus-visible { box-shadow: var(--focus); outline: none; }
.field.has-toggle input { padding-right: 4.2rem; }
.field.has-toggle.is-valid .control::after { display: none; }
.rules { list-style: none; margin: .25rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .25rem .75rem; font-size: .82rem; color: var(--muted); }
.rules li { display: flex; align-items: center; gap: .4rem; }
.rules li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; transition: background .15s, border-color .15s; }
.rules li[data-ok="1"] { color: var(--emerald); }
.rules li[data-ok="1"]::before { content: "✓"; background: var(--emerald); border-color: var(--emerald); color: #fff; font-size: 10px; line-height: 14px; text-align: center; font-weight: 800; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 600; color: var(--navy); min-height: var(--hit); }
[data-theme="dark"] .check { color: var(--ink); }
.check input { width: 20px; height: 20px; margin-top: .2rem; accent-color: var(--primary); }
.check small { display: block; color: var(--muted); font-weight: 500; }

/* ============ buttons ============ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--hit); padding: 0 1.25rem; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--navy); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
[data-theme="dark"] .btn { color: var(--ink); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 6px 16px -10px rgba(15, 46, 99, .5); }
[data-theme="dark"] .btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:active { transform: translateY(1px); }
.btn-sm { min-height: 40px; padding: 0 .9rem; font-size: .88rem; }
.btn-lg { min-height: 54px; padding: 0 1.6rem; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-light { background: #fff; border-color: #fff; color: var(--navy); }
.btn-danger { color: var(--danger); border-color: #F1C4C0; }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn[disabled], .btn[aria-busy="true"] { opacity: .65; cursor: progress; }
.btn .btn-busy { display: none; }
.btn[aria-busy="true"] .btn-label { display: none; }
.btn[aria-busy="true"] .btn-busy { display: inline; }
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--bg); }
  .btn-primary:hover { background: var(--deep); }
  [data-theme="dark"] .btn-primary:hover { background: #7FAAF0; }
  .btn-light:hover { background: #EAF1FE; }
}

/* ============ states ============ */
.empty { text-align: center; padding: 3rem 1rem; max-width: 520px; margin: 0 auto; display: grid; justify-items: center; gap: .35rem; }
.empty-art { color: var(--line-strong); margin-bottom: .25rem; }
.empty p { color: var(--muted); }
.skeleton { background: linear-gradient(90deg, #E6ECF5 25%, #F2F5FA 37%, #E6ECF5 63%); background-size: 400% 100%; animation: shimmer 1.4s ease infinite; border-radius: 6px; min-height: 1em; }
[data-theme="dark"] .skeleton { background: linear-gradient(90deg, #1A2A46 25%, #22345A 37%, #1A2A46 63%); background-size: 400% 100%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton-list { display: grid; gap: .5rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.section { min-width: 0; display: grid; gap: 1.25rem; align-content: start; } /* the page column's own rules (.shell-main): children may shrink, same spacing */
.nav-skeleton { display: grid; gap: 1.25rem; min-width: 0; }
.nav-loading > :not(.nav-skeleton) { display: none !important; } /* hidden, never removed: the clicked element stays in the document */
.sk-head { height: 2.2rem; width: 55%; }
.sk-table { display: grid; gap: .45rem; }
.sk-row { height: 2.6rem; }
.sk-card { display: grid; gap: .6rem; }
.sk-line { height: 1rem; }
.sk-line:nth-child(odd) { width: 62%; }
.sk-tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.sk-tile { height: 5.5rem; border-radius: var(--radius-sm, 10px); }

.alert { border-radius: var(--radius-sm); padding: .85rem 1rem; font-size: .93rem; display: flex; gap: .6rem; align-items: flex-start; }
.alert > svg { flex: none; margin-top: .1rem; }
.alert-body { display: grid; gap: .25rem; min-width: 0; }
.alert .btn { margin-top: .4rem; justify-self: start; }
.alert-error { background: #FBEDEC; color: #7A1D17; border: 1px solid #F1C4C0; }
.alert-success { background: #E8F6EE; color: #145A38; border: 1px solid #BFE5CF; }
.alert-info { background: #E7F0FD; color: #173FA0; border: 1px solid #C6D8F5; }
[data-theme="dark"] .alert-error { background: #3A1614; color: #FFD9D6; border-color: #6B2A25; }
[data-theme="dark"] .alert-success { background: #0F2E22; color: #C8F0DA; border-color: #1F5A40; }
[data-theme="dark"] .alert-info { background: #14274A; color: #C6D8F5; border-color: #2A4477; }

/* ============ auth split layout ============ */
.auth-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; align-items: stretch; }
@media (min-width: 900px) { .auth-grid { grid-template-columns: 5fr 6fr; gap: 2rem; min-height: 620px; } }
.auth-aside { position: relative; background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; border-radius: var(--radius-lg); padding: 2rem 1.75rem; display: flex; flex-direction: column; gap: 1.5rem; overflow: hidden; isolation: isolate; }
[data-theme="dark"] .auth-aside { background: linear-gradient(160deg, #0F2E63 0%, #143A7A 100%); }
.auth-photo { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.auth-aside::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(15,46,99,.55) 0%, rgba(15,46,99,.88) 55%, var(--navy) 100%); }
.auth-aside::after { content: ""; position: absolute; inset: auto -20% -30% auto; z-index: -1; width: 60%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, rgba(62,134,224,.35), transparent); pointer-events: none; }
.auth-aside .eyebrow { color: #E7C982; }
.auth-aside h2 { color: #fff; font-size: clamp(1.5rem, 2.6vw, 2rem); }
.auth-aside p { color: #C9D6EC; max-width: 38ch; }
.auth-aside .seal { width: 64px; height: 64px; }
.trust { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.trust li { display: flex; gap: .6rem; align-items: flex-start; color: #E6EDF8; font-size: .92rem; }
.trust svg { flex: none; width: 18px; height: 18px; margin-top: .15rem; color: #E7C982; }
.steps { list-style: none; padding: 0; margin: auto 0 0; display: grid; gap: .5rem; counter-reset: s; }
.steps li { counter-increment: s; display: flex; align-items: center; gap: .7rem; font-size: .9rem; color: #A9BBD9; }
.steps li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid #4C6BA3; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 700; flex: none; }
.steps li.done::before, .steps li.active::before { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.steps li.active { color: #fff; font-weight: 700; }
.steps li.done { color: #E6EDF8; }
.steps li.done::before { content: "✓"; }
.steps-light li { color: var(--muted); } .steps-light li.active { color: var(--navy); } .steps-light li.done { color: var(--ink); }
.steps-light li::before { border-color: var(--line-strong); }
.auth-panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: clamp(1.25rem, 3vw, 2.25rem); }
.auth-panel h1 { font-size: clamp(1.5rem, 2.8vw, 1.9rem); }
.auth-panel .lede { color: var(--muted); margin-bottom: 1.5rem; }
.progress { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: .75rem; display: flex; align-items: center; gap: .6rem; }
.progress .bar { flex: 1; height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 25%; background: var(--gold); border-radius: 2px; transition: width .4s ease; }
.alt { text-align: center; color: var(--muted); margin-top: 1.25rem; font-size: .95rem; }
.after-cta { text-align: center; color: var(--muted); font-size: .85rem; margin-top: .6rem; }

/* ============ mobile ============ */
@media (max-width: 899px) {
  .govbar { font-size: .72rem; padding: .35rem .85rem; }
  .govbar span.long, .govbar .official .long, .hide-m, .brand small, .nav-name { display: none; }
  .topbar { padding: .5rem .85rem; gap: .5rem; }
  .brand { font-size: 1.1rem; gap: .5rem; }
  .brand img { width: 32px; height: 32px; }
  .nav { gap: .4rem; }
  .langs a { padding: 0 .45rem; min-height: 30px; font-size: .68rem; }
  .icon-btn { min-width: 36px; min-height: 36px; }
  .btn-sm { min-height: 36px; padding: 0 .75rem; font-size: .84rem; }
  h1 { font-size: clamp(1.6rem, 7.5vw, 2.1rem); }
  .page { padding-left: 1rem; padding-right: 1rem; }
  .page-head { flex-direction: column; align-items: stretch; gap: .6rem; }
  .page-actions { gap: .4rem; }
  .page-actions .btn { flex: 1 1 auto; }
  .stats { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .stat { padding: .75rem .85rem; } .stat b { font-size: 1.3rem; }
  .cards { grid-template-columns: 1fr; }
  .card { padding: 1rem; }
  .kv { grid-template-columns: 1fr; gap: .1rem .5rem; } .kv dt { margin-top: .5rem; font-size: .78rem; }
  .table th, .table td { padding: .55rem .65rem; font-size: .88rem; }
  .form-grid { grid-template-columns: 1fr; }
  .member-card { padding: 1.1rem; }
  .member-no { font-size: 1.7rem; letter-spacing: .06em; }
  .fee-amount { font-size: 1.8rem; }
  .ttable td { min-width: 200px; }
  .toolbar input[type=search] { min-width: 0; flex: 1 1 160px; }
  .footer-in { flex-direction: column; gap: .35rem; }
  .choice { padding: .8rem; }
  .elig .member-no { font-size: 1.5rem; }
  .auth-aside { padding: 1.25rem 1.1rem; gap: .9rem; }
  .auth-aside .seal { width: 44px; height: 44px; }
  .auth-aside h2 { font-size: 1.25rem; }
  .auth-aside p, .auth-aside .trust, .auth-aside .steps { display: none; }
  .auth-panel { padding: 1.1rem 1rem; }
  .ttable, .ttable tbody, .ttable tr, .ttable td, .ttable th[scope=row] { display: block; width: 100%; min-width: 0; }
  .ttable thead { display: none; }
  .ttable tr { border-bottom: 2px solid var(--line); padding: .5rem 0; }
  .ttable th[scope=row] { border: 0; padding: .4rem .9rem 0; }
  .ttable td { border: 0; padding: .35rem .9rem; }
  .ttable td::before { content: attr(data-lang); display: block; font-size: .7rem; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin-bottom: .2rem; }
}
@media (max-width: 480px) { .topbar [data-theme-toggle] { display: none; } }
@media (max-width: 380px) { .langs { display: none; } }
@media (max-width: 440px) { .topbar:has(.nav-user) .brand > span { display: none; } } /* signed in on a phone: logo only, so EN / SO / AR and the account fit (AR too) */

/* ============ RTL mirroring ============ */
[dir="rtl"] .toggle-pw { right: auto; left: .4rem; }
[dir="rtl"] .field.is-valid .control::after { right: auto; left: .9rem; }
[dir="rtl"] .field.has-toggle input { padding-right: .9rem; padding-left: 4.2rem; }
[dir="rtl"] .field.is-valid input { padding-right: .9rem; padding-left: 2.6rem; }
[dir="rtl"] .auth-aside::after { inset: auto auto -30% -20%; }
[dir="rtl"] .steps li, [dir="rtl"] .trust li { flex-direction: row; }
[dir="rtl"] .back-arrow { display: inline-block; transform: scaleX(-1); } /* "back" points right in Arabic */
@media (max-width: 899px) { [dir="rtl"] .shell-main, .shell-main { order: 1; } .sidenav { order: 0; } }

/* flash region: bare 4xx responses (403/429/CSRF expired) land here instead of replacing the page */
.flash { position: fixed; top: .75rem; left: 50%; transform: translateX(-50%); z-index: 60; width: min(92vw, 520px); }
.flash:empty { display: none; }

/* ============ approval chain: step rail, timeline (HEMIS-style), attachments, assignee ============ */
.steprail { display: flex; align-items: flex-start; gap: 0; margin: .75rem 0 1rem; overflow-x: auto; }
.steprail-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; position: relative; min-width: 64px; font-size: .74rem; color: var(--muted); text-align: center; }
.steprail-step i { font-style: normal; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; border: 2px solid var(--line-strong); background: var(--card-alt); position: relative; z-index: 1; }
.steprail-step:not(:last-child)::after { content: ""; position: absolute; top: 15px; inset-inline-start: calc(50% + 15px); inset-inline-end: calc(-50% + 15px); height: 2px; background: var(--line-strong); }
.steprail-step.done i { background: var(--primary); border-color: var(--primary); color: #fff; }
.steprail-step.done:not(:last-child)::after { background: var(--primary); }
.steprail-step.active i { background: var(--deep); border-color: var(--deep); color: #fff; box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--primary); }
.steprail-step.done, .steprail-step.active { color: var(--navy); font-weight: 600; }
.timeline { list-style: none; margin: .5rem 0 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 30px 1fr; gap: .75rem; position: relative; padding-bottom: 1rem; }
.timeline > li:not(:last-child)::before { content: ""; position: absolute; top: 30px; bottom: 0; inset-inline-start: 14px; width: 2px; background: var(--line); }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card-alt); border: 1px solid var(--line-strong); color: var(--primary); }
.tl-dot.tone-red { color: var(--danger); } .tl-dot.tone-green { color: var(--emerald); } .tl-dot.tone-violet { color: var(--violet); } .tl-dot.tone-amber { color: var(--gold); }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.tl-who { font-size: .85rem; color: var(--muted); margin: .15rem 0 0; }
.tl-comment { margin: .35rem 0 0; padding: .45rem .65rem; background: var(--card-alt); border: 1px solid var(--line); border-radius: 10px; white-space: pre-wrap; font-size: .9rem; }
.attachments { list-style: none; margin: .35rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .35rem; }
.attachments a { display: inline-flex; align-items: center; gap: .3rem; min-height: 32px; padding: 0 .6rem; border: 1px solid var(--line-strong); border-radius: 8px; font-size: .8rem; text-decoration: none; background: var(--card); }
.assignee { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin: 0 0 .75rem; }
.audit-row td { font-size: .85rem; }
/* "Optional" marker in the page language (components have no translator; html[lang] decides) */
.opt::after { content: "Optional"; }
:lang(so) .opt::after { content: "Ikhtiyaari"; }
:lang(ar) .opt::after { content: "اختياري"; }
/* boosted-navigation progress bar (htmx adds .htmx-request to #nav-progress while a page loads) */
.nav-progress { position: fixed; inset-inline: 0; top: 0; height: 3px; z-index: 100; pointer-events: none; opacity: 0; transition: opacity .2s; overflow: hidden; }
.nav-progress i { display: block; height: 100%; width: 40%; background: var(--gold); animation: navprog 1.1s ease-in-out infinite; }
.nav-progress.htmx-request { opacity: 1; }
@keyframes navprog { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
[dir="rtl"] .nav-progress i { animation-direction: reverse; }

/* numbers, codes and references keep their reading order inside Arabic text (card numbers, phones, amounts, ids) */
.ltr, code, .member-no { unicode-bidi: isolate; direction: ltr; }
[dir="rtl"] td.num > * , [dir="rtl"] td.num { unicode-bidi: isolate; }
code { overflow-wrap: anywhere; word-break: break-word; } /* long references (payment orders, receipts) wrap at 390 px */
