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

/* ============ fonts ============ */
/* Self-hosted (link speed 2026-10-27): no render-blocking third-party stylesheet. Plus Jakarta Sans + Fraunces (SIL OFL 1.1), the
   variable woff2 files Google Fonts serves, latin + latin-ext subsets. A browser downloads a face only when the page uses it. */
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/plus-jakarta-sans-normal-latin-v1.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/plus-jakarta-sans-normal-latin-ext-v1.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fraunces'; font-style: italic; font-weight: 400 500; font-display: swap; src: url(/fonts/fraunces-italic-latin-v1.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Fraunces'; font-style: italic; font-weight: 400 500; font-display: swap; src: url(/fonts/fraunces-italic-latin-ext-v1.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ============ 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; }
/* "View as" (super admin, read-only): a gold band under the top bar on every page; wraps on phones, Stop keeps a 44 px target */
.viewas-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .55rem 1rem; background: var(--gold, #D4941A); color: #1A1200; font-size: .9rem; font-weight: 600; }
.viewas-bar > span { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.viewas-bar .btn { min-height: 44px; }
.viewas-bar.viewas-failed { background: #FDECEC; color: #7A1C1C; font-weight: 500; }
[data-theme="dark"] .viewas-bar { background: #8A5E0C; color: #fff; }
[data-theme="dark"] .viewas-bar.viewas-failed { background: #3A1515; color: #FBD5D5; }

.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; }
.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; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.nav { display: flex; align-items: center; gap: .6rem; flex-wrap: nowrap; }
.icon-btn.icon-help { color: var(--gold); text-decoration: none; } /* signed-out header: Support as a gold life-buoy, same hit area as the theme toggle */
[data-theme="dark"] .icon-btn.icon-help { color: var(--gold); }
.nav-link { display: inline-flex; align-items: center; min-height: var(--hit); padding: 0 .5rem; color: var(--navy); font-weight: 600; font-size: .88rem; text-decoration: none; white-space: nowrap; }
.nav-link:hover { text-decoration: underline; text-underline-offset: 4px; }
[data-theme="dark"] .nav-link { color: var(--ink); }
.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; }
.help-col { max-width: 640px; margin-inline: auto; } /* /help and the visitor ticket: one centred column, header + card + sign-in line share its edges */
.legal section { margin-top: 1.5rem; } .legal h2 { font-size: 1.15rem; } .legal p { color: var(--ink); }

/* ============ shell: HEMIS-style sidebar pinned to the page edge (start side; right in Arabic), icon rail when folded, drawer on phones ============ */
:root { --topbar-h: 76px; /* fallback only: app.js sets the measured top-bar height */ --sb-w: 248px; --sb-rail: 72px; }
.page.page-app { max-width: none; padding: 0; display: flex; flex-direction: column; } /* app pages use the full width beside the sidebar */
.shell { flex: 1; display: grid; grid-template-columns: auto minmax(0, 1fr); min-height: calc(100vh - var(--topbar-h)); }
.shell > * { min-width: 0; }
.shell-main { min-width: 0; display: grid; gap: 1.25rem; align-content: start; padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 3vw, 2rem) 4rem; }
.menu-btn { display: none; }
.sidenav-head { display: none; }
.sidenav { width: var(--sb-w); background: var(--navy); border-inline-end: 1px solid rgba(255,255,255,.06); transition: width .2s ease; }
[data-theme="dark"] .sidenav { background: #0B1730; border-inline-end-color: var(--line); }
.sidenav-in { position: sticky; top: var(--topbar-h); max-height: calc(100vh - var(--topbar-h)); display: flex; flex-direction: column; }
.sidenav-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: .75rem .75rem 1rem; }
.nav-group { display: grid; gap: .1rem; margin-bottom: .6rem; }
.nav-group-h { margin: 1.1rem .8rem .3rem; font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: #7F97C4; font-weight: 700; white-space: nowrap; }
.nav-group:first-child .nav-group-h { margin-top: .2rem; }
.sidenav a, .sb-toggle { position: relative; display: flex; align-items: center; gap: .65rem; padding: .55rem .8rem; border-radius: 10px; color: #C9D6EC; text-decoration: none; font-weight: 600; white-space: nowrap; min-height: 42px; border: 1px solid transparent; }
.sidenav a.on { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.14); }
@media (hover: hover) { .sidenav a:not(.on):hover, .sb-toggle:hover { background: rgba(255,255,255,.06); color: #fff; } }
.sidenav a:focus-visible, .sb-toggle:focus-visible { outline: 2px solid #E7C982; outline-offset: -2px; }
.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; }
.sb-toggle { margin: .75rem .75rem 0; background: transparent; border-color: rgba(255,255,255,.14); font: inherit; font-weight: 600; font-size: .88rem; cursor: pointer; }
.sb-chev { flex: none; transition: transform .2s ease; }
[dir="rtl"] .sb-chev { transform: scaleX(-1); }
.sb-when-closed { display: none; }
.sb-tip { position: fixed; z-index: 70; transform: translateY(-50%); padding: .35rem .65rem; border-radius: 8px; background: #14213D; color: #fff; font-size: .82rem; font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s ease; box-shadow: var(--shadow); }
.sb-tip.on { opacity: 1; transition-delay: .3s; }
.sb-tip::before { content: ""; position: absolute; top: 50%; inset-inline-start: -5px; width: 10px; height: 10px; background: inherit; transform: translateY(-50%) rotate(45deg); border-radius: 2px; }
[data-theme="dark"] .sb-tip { background: #E6EDF8; color: #0B1526; }
@media (min-width: 821px) {
  .drawer-backdrop { display: none !important; }
  html.sb-collapsed .sidenav { width: var(--sb-rail); }
  html.sb-collapsed .sidenav-list { padding-inline: .6rem; }
  html.sb-collapsed .sidenav a, html.sb-collapsed .sb-toggle { justify-content: center; padding-inline: 0; gap: 0; }
  html.sb-collapsed .sb-toggle { margin-inline: .6rem; }
  html.sb-collapsed .sb-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* still the link's name for screen readers */
  html.sb-collapsed .nav-group-h { display: none; }
  html.sb-collapsed .nav-group + .nav-group { border-top: 1px solid rgba(255,255,255,.12); padding-top: .6rem; }
  html.sb-collapsed .sb-when-open { display: none; }
  html.sb-collapsed .sb-when-closed { display: inline; }
  html.sb-collapsed .sb-chev { transform: scaleX(-1); }
  html.sb-collapsed[dir="rtl"] .sb-chev { transform: none; }
}

@media (max-width: 820px) {
  .shell { display: block; min-height: 0; }
  .shell-main { padding: 1rem 1rem 4rem; }
  .menu-btn { display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; margin: 1rem 1rem 0; width: calc(100% - 2rem); padding: 0 .9rem; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); color: var(--navy); font: inherit; font-weight: 600; justify-content: flex-start; cursor: pointer; }
  [data-theme="dark"] .menu-btn { color: var(--ink); }
  .menu-btn:focus-visible { outline: none; box-shadow: var(--focus); }
  .sidenav { position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); z-index: 60; transform: translateX(-100%); visibility: hidden; transition: transform .3s cubic-bezier(.2,.7,.2,1), visibility 0s linear .3s; overflow-y: auto; border: 0; } /* closed: hidden after the slide-out, so its links leave the tab order */
  [dir="rtl"] .sidenav { inset: 0 0 0 auto; transform: translateX(100%); }
  html.drawer-open .sidenav { transform: none; visibility: visible; transition-delay: 0s; box-shadow: 20px 0 60px -20px rgba(0,0,0,.35); } /* shadow only while open: none leaks at the edge */
  html.drawer-open[dir="rtl"] .sidenav { box-shadow: -20px 0 60px -20px rgba(0,0,0,.35); }
  html.drawer-open { overflow: hidden; }
  .sidenav-in { position: static; max-height: none; }
  .sidenav-list { overflow: visible; padding: 0 1rem 1rem; }
  .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; padding: 1rem 1rem .75rem; color: #fff; }
  .sidenav-head .icon-btn { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.14); color: #fff; }
  .sidenav a { padding: .7rem .8rem; font-size: 1rem; }
  .sb-toggle, .sb-tip { display: none; }
}

/* ============ 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 { height: 44px; min-height: 44px; 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); }
.table .nowrap { white-space: nowrap; }
/* .table-stack: a real table from 640px up; under it every row is a card (label · value lines from data-label), so nothing scrolls or clips (0101 ledger) */
@media (max-width: 639px) {
  .table-wrap:has(> .table-stack) { overflow: visible; background: none; border: 0; }
  .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; }
  .table-stack thead { display: none; }
  .table-stack tr { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .35rem .9rem; margin-bottom: .75rem; }
  .table-stack td { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: .25rem .5rem; padding: .5rem 0; border-bottom: 1px solid var(--line); text-align: end; }
  .table-stack td > div:not(.chips) { flex: 0 0 100%; } /* a sub-line (member no., purpose, receipt) under its value, not beside it */
  .table-stack td:last-child { border-bottom: 0; }
  .table-stack td::before { content: attr(data-label); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-inline-end: auto; }
  .table-stack td .chips { justify-content: flex-end; }
}
@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; }

/* 0088: the member's own words (insurer hint) quoted on the SHIA / insurer desks */
.hint-box { margin: 0 0 1rem; padding: .7rem .9rem; border-inline-start: 3px solid var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); border-radius: var(--radius-sm); font-size: .95rem; }
.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); } }
/* Card hand-off overlay (CardHandoff in views/form.tsx): shown by app.js when a card payment is submitted, until the browser reaches bila.so. */
.handoff { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.handoff[hidden] { display: none; }
.handoff-box { width: min(100%, 360px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem 1.25rem; text-align: center; box-shadow: 0 20px 60px rgba(15, 46, 99, .18); }
.handoff-box img { display: block; margin: 0 auto .9rem; }
.handoff-spinner { width: 28px; height: 28px; border-width: 3px; color: var(--primary); margin: 0 0 1rem; }
.handoff-title { margin: 0 0 .4rem; font-weight: 700; font-size: 1.05rem; color: var(--navy); }
.handoff-note { margin: 0; color: var(--muted); font-size: .9rem; }
.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; }
/* fee step: the phone field belongs to the WaafiPay choice only (the Premier card is typed on Bila's hosted page) */
.pay-form:has(input[name="method"][value="card"]:checked) .for-waafipay { display: none; }
.pay-form .choices { margin: 0 0 1rem; padding: 0; border: 0; }
.pay-form .choices legend { padding: 0; margin: 0 0 .5rem; }

.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; }
/* 0071: what this facility can claim for the member (card check) */
.elig-services { margin-top: 1rem; } .elig-services h3 { font-size: 1rem; margin: 0 0 .5rem; }
.list-plain { list-style: none; margin: 0; padding: 0; } .list-plain li { padding: .45rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.elig-services details { margin-top: .5rem; } .elig-services summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }

.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 ============ */
/* One control height everywhere (text, number, select, phone, date); label, control, help/error stack top-down and never stretch the control.
   Edit forms sit in a readable column (880px), two columns for short fields on desktop, one under 720px. Logical properties only (RTL). */
.form { display: grid; gap: 1.25rem; align-content: start; }
.form.card { max-width: 880px; width: 100%; overflow: visible; padding: clamp(1.1rem, 2.5vw, 1.75rem); }
.form > h2, .form-section-h { font-size: 1.1rem; margin: 0; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.form > h2 + .muted, .form > h2 + p { margin-top: -.6rem; }
.form-grid { display: grid; gap: 1.25rem 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.form-grid:has(> .field-short:first-child) { grid-template-columns: minmax(9rem, 15rem) minmax(0, 1fr); } /* code + name: the code stays narrow */
@media (min-width: 1100px) { .form-grid:has(> :nth-child(3)):not(:has(> :nth-child(4))):not(:has(> .field-short:first-child)) { grid-template-columns: repeat(3, minmax(0, 1fr)); } } /* three short fields in one row on wide screens */
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.form-actions > .btn-primary, .form-actions > button[type=submit] { order: 1; } /* primary at the end (right; left in Arabic), secondary before it */
.form-actions > .btn, .form.card > .btn-primary { width: auto; }
.form.card > .btn-primary:last-child, .form.card > .btn[type=submit]:last-child { justify-self: end; min-width: 10rem; }
.inline-form { display: inline; }
.field { display: grid; gap: .4rem; align-content: start; min-width: 0; }
.field label { font-weight: 700; font-size: .9rem; line-height: 1.4; color: var(--navy); display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
[data-theme="dark"] .field label { color: var(--ink); }
.field label .opt { color: var(--muted); font-weight: 500; font-size: .78rem; white-space: nowrap; }
.field-short .control { max-width: 15rem; }
.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; line-height: 1.4; color: var(--ink); background: var(--card); transition: border-color .15s, box-shadow .15s; }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select { height: var(--hit); }
.field select { appearance: none; -webkit-appearance: none; padding-inline-end: 2.6rem; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%234F5F7A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .95rem center; }
[dir="rtl"] .field select { background-position: left .95rem center; }
.field input[type=date] { -webkit-appearance: none; appearance: none; }
.field textarea { padding: .7rem .9rem; min-height: 7.5rem; resize: vertical; line-height: 1.55; }
/* file picker: a real button + the chosen file name, not the raw browser control */
.field input[type=file] { height: auto; min-height: var(--hit); padding: .35rem; display: flex; align-items: center; color: var(--muted); font-size: .9rem; cursor: pointer; }
.field input[type=file]::file-selector-button { min-height: 38px; margin-inline-end: .75rem; padding: 0 1rem; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card-alt); color: var(--navy); font: inherit; font-weight: 700; font-size: .88rem; cursor: pointer; }
[data-theme="dark"] .field input[type=file]::file-selector-button { color: var(--ink); background: var(--bg); }
@media (hover: hover) { .field input[type=file]:hover::file-selector-button { background: var(--bg); border-color: var(--primary); } }
.field input::placeholder, .field textarea::placeholder { color: #9AA8BF; }
/* member photo: card, review, Officer page (beside the ID document), facility card check */
.member-photo { display: block; object-fit: cover; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card-alt); }
.member-photo-md { width: 120px; height: 150px; }
.member-photo-sm { width: 72px; height: 90px; }
.member-card-id { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.id-match { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; margin-bottom: 1rem; }
.id-match figure { margin: 0; display: grid; gap: .35rem; }
.id-doc-preview { display: block; max-width: min(100%, 320px); max-height: 220px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card-alt); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.field input[readonly] { background: var(--card-alt); color: var(--muted); }
.field.is-valid input { border-color: var(--emerald); padding-inline-end: 2.6rem; }
.field.is-valid .control::after { content: "✓"; position: absolute; inset-inline-end: .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, .field-error select:focus, .field-error textarea:focus { box-shadow: 0 0 0 4px rgba(179, 38, 30, .18); }
.help { margin: 0; font-size: .82rem; line-height: 1.45; color: var(--muted); }
.error { margin: 0; font-size: .85rem; line-height: 1.45; color: var(--danger); font-weight: 600; display: flex; gap: .35rem; align-items: center; }
.toggle-pw { position: absolute; inset-inline-end: .4rem; top: 50%; transform: translateY(-50%); min-height: 40px; 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-inline-end: 4.2rem; }
/* Fixed +252 before a phone number: the pair always reads LTR, also in Arabic (logical sides below resolve LTR inside it). */
.control.has-prefix { direction: ltr; }
.field-prefix { display: flex; align-items: center; height: var(--hit); padding: 0 .75rem; border: 1px solid var(--line-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--bg); color: var(--navy); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; user-select: none; }
[data-theme="dark"] .field-prefix { color: var(--ink); }
.control.has-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; min-width: 0; text-align: left; }
.field-error .field-prefix { border-color: var(--danger); }
.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; }
/* a multi-select of checkboxes inside a .field (facility services): each box sits beside its clickable label, 3 / 2 / 1 columns */
fieldset.field:has(> .checks) { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.field:has(> .checks) > legend { padding: 0; margin-bottom: .35rem; font-weight: 700; font-size: .9rem; color: var(--navy); }
.field .checks { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .15rem 1rem; }
.field .checks .check { justify-content: flex-start; align-items: center; font-size: .92rem; cursor: pointer; }
.field .checks .check input { width: 20px; height: 20px; min-height: 0; padding: 0; margin: 0; flex: none; }
@media (max-width: 900px) { .field .checks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .field .checks { grid-template-columns: 1fr; } }

/* ============ 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[disabled]:not([aria-busy="true"]) { cursor: not-allowed; }
.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; }
  .nav-link { padding: 0 .35rem; font-size: .84rem; }
  .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; }
  .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, [dir="rtl"] .topbar:has(.icon-help) .brand > span { display: none; } } /* signed in on a phone (and signed out in Arabic, whose Sign in runs wider): logo only, so EN / SO / AR and the buttons fit */

/* ============ RTL mirroring ============ */
[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 */

/* 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: "اختياري"; }
/* "Required" marker on forms that opt in (.form-req: the organisation profile — what "Save and activate" needs) */
.form-req .field:has(> .control > [required]) > label::after, .form-req .field.is-req > label::after { content: "Required"; color: var(--danger); font-weight: 500; font-size: .8rem; }
:lang(so) .form-req .field:has(> .control > [required]) > label::after, :lang(so) .form-req .field.is-req > label::after { content: "Waa qasab"; }
:lang(ar) .form-req .field:has(> .control > [required]) > label::after, :lang(ar) .form-req .field.is-req > label::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 */

/* organisation logo: 40px in lists, 72px on a profile; initials placeholder in the same square */
.org-logo { display: inline-grid; place-items: center; flex: none; border-radius: 10px; object-fit: contain; background: #fff; border: 1px solid var(--line, #dbe3f0); vertical-align: middle; }
.org-logo-xs { width: 24px; height: 24px; font-size: .6rem; border-radius: 6px; } .org-logo-sm { width: 40px; height: 40px; font-size: .9rem; } .org-logo-lg { width: 72px; height: 72px; font-size: 1.5rem; border-radius: 14px; }
.org-logo-ph { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; letter-spacing: .02em; }
[data-theme="dark"] .org-logo-ph { background: var(--primary); border-color: var(--primary); }
.org-cell { display: flex; align-items: center; gap: .65rem; }
.org-list li + li { margin-top: .35rem; }
.org-inline { display: inline-flex; align-items: center; gap: .45rem; vertical-align: middle; }
.avatar > img { width: 100%; height: 100%; border-radius: 50%; object-fit: contain; background: #fff; }
.org-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; }
/* success toast (profile saved) + own-profile view */
.toast { position: fixed; inset-inline: 16px; bottom: max(16px, env(safe-area-inset-bottom)); margin-inline: auto; max-width: 420px; z-index: 60; display: flex; gap: .55rem; align-items: center; padding: .8rem 1rem; border-radius: var(--radius-sm); background: #145A38; color: #fff; font-weight: 600; font-size: .95rem; box-shadow: 0 8px 24px rgba(15, 46, 99, .22); animation: toast-out .4s ease 4s forwards; pointer-events: none; }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); visibility: hidden; } }
.profile-view .org-head { margin-bottom: 1rem; }
.profile-view .org-head h2 { margin: 0; font-size: 1.2rem; overflow-wrap: anywhere; }
.profile-view .org-head p { margin: .15rem 0 0; }
.profile-view .kv { grid-template-columns: minmax(7.5rem, max-content) 1fr; }
.profile-view .kv dd { overflow-wrap: anywhere; min-width: 0; }
.profile-view .not-set { color: var(--muted); font-weight: 400; }
.profile-history { margin: 0 0 1rem; font-size: .9rem; }
@media (max-width: 480px) { .profile-view .kv { grid-template-columns: 1fr; gap: .1rem; } .profile-view .kv dd { margin-bottom: .55rem; } }

/* "New version available" bar: slim, sticky, brand navy in both themes (RTL: logical properties only) */
.update-bar { position: sticky; top: 0; z-index: 65; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .5rem .75rem; padding: .45rem .75rem; background: #0F2E63; color: #fff; border-bottom: 2px solid var(--gold); font-size: .9rem; font-weight: 500; text-align: center; }
.update-bar .update-go { min-height: 36px; padding: 0 .9rem; border: 0; border-radius: 999px; background: var(--gold); color: #14213D; font: inherit; font-weight: 700; cursor: pointer; }
.update-bar .update-x { min-width: 40px; min-height: 40px; border: 0; background: transparent; color: #C9D6EC; font-size: 1.4rem; line-height: 1; cursor: pointer; border-radius: 8px; }
.update-bar .update-go:hover { filter: brightness(1.08); } .update-bar .update-x:hover { color: #fff; background: rgba(255,255,255,.12); }
.update-bar button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ============ forms on phones: one column, full-width actions (primary first) at the end of the form — never sticky, so they never cover a field ============ */
.toolbar .btn { min-height: 44px; }
@media (max-width: 720px) {
  .form-grid, .form-grid:has(> .field-short:first-child) { grid-template-columns: 1fr; }
  .field-short .control { max-width: none; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions > .btn-primary, .form-actions > button[type=submit] { order: -1; }
  .form-actions > .btn, .form.card > .btn-primary:last-child, .form.card > .btn[type=submit]:last-child { width: 100%; justify-self: stretch; }
  .toolbar input[type=search], .toolbar input[type=date], .toolbar select { min-width: 0; flex: 1 1 100%; }
  .toolbar .btn { flex: 1 1 auto; }
}
@media (max-width: 899px), (pointer: coarse) { .btn-sm { min-height: 44px; } }

/* ============ guided steps (package draft): one step per screen ============ */
.wsteps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; counter-reset: ws; max-width: 880px; }
.wsteps li { counter-increment: ws; min-width: 0; }
.wsteps a, .wsteps span.ws { display: flex; align-items: center; gap: .6rem; min-height: 52px; height: 100%; padding: .5rem .8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--card); color: var(--muted); font-weight: 600; font-size: .9rem; line-height: 1.25; text-decoration: none; }
.wsteps a::before, .wsteps span.ws::before { content: counter(ws); flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); font-size: .8rem; font-weight: 800; }
.wsteps .done a::before { content: "✓"; background: var(--emerald); border-color: var(--emerald); color: #fff; }
.wsteps [aria-current="step"] { border-color: var(--primary); color: var(--navy); box-shadow: var(--focus); }
[data-theme="dark"] .wsteps [aria-current="step"] { color: var(--ink); }
.wsteps [aria-current="step"]::before { background: var(--primary); border-color: var(--primary); color: #fff; }
@media (hover: hover) { .wsteps a:hover { border-color: var(--primary); color: var(--navy); } }
.wstep { max-width: 880px; width: 100%; display: grid; gap: 1.25rem; align-content: start; overflow: visible; }
.wstep > h2 { font-size: 1.2rem; margin: 0; }
.wstep-lede { margin: -.85rem 0 0; color: var(--muted); }
.wstep-nav { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 1rem; }
.wstep-nav > :last-child { margin-inline-start: auto; }
.wstep .form { gap: 1.25rem; }
.wstep .kv { margin: 0; }
.wstep-nav .btn-block { width: auto; }
.table td:has(> .btn-sm) { white-space: nowrap; }
.why-disabled { margin: 0; color: var(--muted); font-size: .9rem; }
.add-panel { border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: .75rem; }
.add-panel[open] { border-style: solid; border-color: var(--primary); }
.add-panel > summary { list-style: none; cursor: pointer; width: fit-content; }
.add-panel > summary::-webkit-details-marker { display: none; }
.add-panel[open] > summary { margin-bottom: 1rem; }
.add-panel .form { padding: 0; }
.svc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.svc-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--line); }
.svc-list li:last-child { border-bottom: 0; }
.title-row { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.title-row h1 { margin: 0; }
.page-head .title-row { margin-bottom: .5rem; }
/* danger zone: a destructive action sits apart, behind a confirm step */
.danger-zone { border-color: #F1C4C0; max-width: 880px; }
[data-theme="dark"] .danger-zone { border-color: #6B2A25; }
.confirm-step > summary { list-style: none; width: fit-content; cursor: pointer; }
.confirm-step > summary::-webkit-details-marker { display: none; }
.confirm-step[open] > summary { display: none; }
.confirm-step .confirm-box { display: grid; gap: .75rem; padding: 1rem; border-radius: var(--radius-sm); background: #FBEDEC; color: #7A1D17; }
[data-theme="dark"] .confirm-step .confirm-box { background: #3A1614; color: #FFD9D6; }
.confirm-box .form-actions { justify-content: flex-start; }
@media (max-width: 720px) {
  .wsteps a, .wsteps span.ws { flex-direction: column; justify-content: center; text-align: center; gap: .3rem; padding: .5rem .35rem; font-size: .78rem; }
  .wstep-nav { flex-direction: column-reverse; align-items: stretch; }
  .wstep-nav > *, .wstep-nav .btn-block { width: 100%; margin-inline-start: 0; }
  .wstep-nav > .form-actions { flex-direction: column; align-items: stretch; }
  .wstep-nav > :last-child { margin-inline-start: 0; }
}
.form.card.form-narrow { max-width: 640px; } /* a short single-purpose form (settings group, invite, lookup) */
.form-grid > :only-child { grid-column: 1 / -1; } /* a lone field takes the whole row */
/* ex-inline styles (strict CSP: no style attributes) */
.org-head-body { flex: 1; min-width: 0; }
.scan-video { width: 100%; border-radius: 12px; max-height: 280px; object-fit: cover; }
.member-no-ink { color: var(--navy); }
[data-theme="dark"] .member-no-ink { color: #fff; }
.narrow-block { max-width: 640px; margin-bottom: 16px; }
.section-h { margin-top: 24px; }

/* ---- the member card (members/card.tsx): ID-1 / CR80 at true size, front + back; printed via the page's own @page rule */
.card-tools { margin-bottom: 1rem; align-items: center; flex-wrap: wrap; } .card-tools h2 { margin: 0; margin-inline-end: auto; }
.member-card-wrap .card-sheet { margin-top: .5rem; }
.card-sheet { display: grid; gap: 1.25rem; justify-items: start; }
.cardface { position: relative; box-sizing: border-box; width: 85.6mm; height: 54mm; margin: 0; border-radius: 3mm; overflow: hidden; background: #fff; color: #171C26; font-family: var(--font); font-size: 7pt; line-height: 1.25; box-shadow: var(--shadow-lg); border: 1px solid var(--line); -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.cardface::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1.4mm; background: #D4941A; }
.cf-side { position: absolute; top: 100%; left: 0; margin-top: .3rem; font-size: .75rem; color: var(--muted); font-family: var(--font); }
.card-sheet { padding-bottom: 1.5rem; }
.cf-head { display: flex; align-items: center; gap: 2mm; padding: 2.2mm 3mm; height: 13.4mm; box-sizing: border-box; background: linear-gradient(135deg, #0F2E63, #173FA0); color: #fff; }
.cf-logo { width: 9mm; height: 9mm; flex: none; }
.cf-brand b { display: block; font-size: 10pt; font-weight: 800; line-height: 1.1; }
.cf-brand small { display: block; font-size: 4.3pt; color: #C9D6EC; line-height: 1.25; white-space: nowrap; }
.cf-title { margin-inline-start: auto; text-align: end; }
.cf-title b { display: block; font-size: 6pt; font-weight: 700; }
.cf-title span { display: block; font-size: 5pt; color: #C9D6EC; }
.cf-body { display: flex; gap: 2.8mm; padding: 2.4mm 3mm 0; }
.cf-photo { width: 18mm; height: 22.5mm; object-fit: cover; border: .3mm solid #D7DEE8; border-radius: 1mm; background: #F2F5FA; flex: none; }
.cf-main { flex: 1; min-width: 0; }
.cf-label { margin: 0; font-size: 3.8pt; letter-spacing: .08em; text-transform: uppercase; color: #D4941A; font-weight: 800; }
.cf-no { margin: 0; font-size: 12pt; font-weight: 800; letter-spacing: .06em; font-variant-numeric: tabular-nums; color: #173FA0; line-height: 1.2; }
.cf-name { margin: .4mm 0 1.2mm; font-size: 8pt; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.3mm 2mm; margin: 0; }
.cf-grid dt { font-size: 3.4pt; letter-spacing: .05em; text-transform: uppercase; color: #6B7280; font-weight: 700; }
.cf-grid dd { margin: 0; font-size: 6pt; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-ins { display: flex; align-items: center; gap: 1mm; } .cf-ins img { width: 3.6mm; height: 3.6mm; border-radius: .6mm; object-fit: cover; }
.cf-band { background: #0F2E63; color: #fff; font-size: 5pt; font-weight: 700; padding: 1mm 3mm; height: 4.2mm; box-sizing: border-box; }
.cf-back-body { display: flex; gap: 3mm; padding: 2.4mm 3mm 0; }
.cf-qr { width: 24mm; height: 24mm; flex: none; background: #fff; } .cf-qr svg { width: 100%; height: 100%; display: block; }
.cf-back-text { flex: 1; min-width: 0; }
.cf-show { margin: 0 0 1.5mm; } .cf-show b { display: block; font-size: 6.2pt; } .cf-show span { display: block; font-size: 5.6pt; }
.cf-small { margin: 0 0 1mm; font-size: 4.6pt; color: #4B5563; }
.cf-sign { position: absolute; left: 30mm; right: 3mm; bottom: 3.5mm; display: flex; align-items: flex-end; justify-content: space-between; gap: 3mm; }
.cf-sigline { flex: 1; border-top: .3mm solid #171C26; padding-top: .6mm; font-size: 3.8pt; color: #6B7280; }
.cf-stamp { width: 17mm; height: 12mm; border: .3mm dashed #B9C2D0; border-radius: 1mm; display: flex; align-items: flex-end; padding: .8mm; box-sizing: border-box; font-size: 3.1pt; color: #6B7280; white-space: nowrap; overflow: hidden; }
[data-theme="dark"] .cardface { border-color: transparent; }

/* logo picked on the profile form: preview after app.js has shrunk it */
.logo-preview { display: block; width: 72px; height: 72px; object-fit: contain; border-radius: 12px; border: 1px solid var(--line); background: var(--card); margin-top: 8px; }

/* support chat (docs/support_tickets.md): a thread of bubbles; the sender's own on the end side, the other party's on the start side */
.chat { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.chat li { max-width: 88%; }
.chat .msg-admin { justify-self: start; } .chat .msg-user { justify-self: end; } .chat .msg-system { justify-self: center; max-width: 100%; }
.chat .msg-head { display: flex; gap: .5rem; align-items: baseline; font-size: .8rem; color: var(--muted); margin: 0 .2rem .15rem; }
.chat .msg-body { padding: .6rem .8rem; border-radius: 14px; background: var(--card-alt); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; font-size: .95rem; }
.chat .msg-user .msg-body { background: color-mix(in srgb, var(--primary) 10%, var(--card)); border-color: color-mix(in srgb, var(--primary) 25%, var(--line)); }
.chat .msg-system .msg-body { background: transparent; border-style: dashed; color: var(--muted); font-size: .85rem; text-align: center; }
.chat .attachments { margin-top: .35rem; }
.support-grid { display: grid; gap: 1rem; } @media (min-width: 1024px) { .support-grid { grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; } }
.support-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
.support-tabs a { padding: .6rem .9rem; min-height: 44px; display: inline-flex; align-items: center; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; text-decoration: none; }
.support-tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
