/* GeoBD design system — one stylesheet for every page.
   Tokens first; components below. Light theme by default, dark via the OS setting or the
   toggle in the user menu (html[data-theme]). */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --bg: #F5F7F9; --surface: #FFFFFF; --surface-2: #F1F5F7; --surface-3: #E9EFF2;
  --ink: #0E1B22; --ink-2: #33474F; --muted: #6A7E87; --line: #E2E8EB; --line-2: #D2DBDF;
  --primary: #0B6E77; --primary-600: #095B62; --primary-50: #E7F3F4; --primary-100: #CDE6E8;
  --accent: #E4572E; --accent-50: #FDEDE7;
  --ok: #1E8757; --ok-50: #E6F4EC; --warn: #B06F12; --warn-50: #FBF2E2;
  --danger: #C2352B; --danger-50: #FBE9E7; --info: #2F6FDB; --info-50: #E9F0FC;
  --radius: 12px; --radius-sm: 8px; --radius-xs: 6px;
  --shadow-1: 0 1px 2px rgba(14,27,34,.06), 0 1px 3px rgba(14,27,34,.05);
  --shadow-2: 0 4px 16px rgba(14,27,34,.08), 0 1px 3px rgba(14,27,34,.06);
  --shadow-3: 0 18px 50px rgba(14,27,34,.22);
  --nav-w: 248px; --top-h: 60px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1316; --surface: #101C20; --surface-2: #15242A; --surface-3: #1B2D34;
    --ink: #E6EEF0; --ink-2: #C3D1D5; --muted: #8DA0A7; --line: #213339; --line-2: #2B4048;
    --primary: #2FA7B1; --primary-600: #4CBAC3; --primary-50: #10292D; --primary-100: #16393E;
    --accent: #F07A50; --accent-50: #32201A; --ok: #43B67F; --ok-50: #122A20;
    --warn: #E0A548; --warn-50: #2E2415; --danger: #EF6B5F; --danger-50: #2F1A18;
    --info: #6F9CF0; --info-50: #172238;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 4px 18px rgba(0,0,0,.45);
    --shadow-3: 0 18px 50px rgba(0,0,0,.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1316; --surface: #101C20; --surface-2: #15242A; --surface-3: #1B2D34;
  --ink: #E6EEF0; --ink-2: #C3D1D5; --muted: #8DA0A7; --line: #213339; --line-2: #2B4048;
  --primary: #2FA7B1; --primary-600: #4CBAC3; --primary-50: #10292D; --primary-100: #16393E;
  --accent: #F07A50; --accent-50: #32201A; --ok: #43B67F; --ok-50: #122A20;
  --warn: #E0A548; --warn-50: #2E2415; --danger: #EF6B5F; --danger-50: #2F1A18;
  --info: #6F9CF0; --info-50: #172238;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4); --shadow-2: 0 4px 18px rgba(0,0,0,.45);
  --shadow-3: 0 18px 50px rgba(0,0,0,.6); color-scheme: dark;
}

* { box-sizing: border-box; }
/* Every icon from GEOBD.icon() is aria-hidden: give it a sane default size so an icon in a
   context nobody styled can never blow up to full width. Specific rules below override. */
svg[aria-hidden="true"] { width: 16px; height: 16px; flex-shrink: 0; vertical-align: -3px; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; font-weight: 650; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
code, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
hr { border: none; border-top: 1px solid var(--line); margin: 16px 0; }
.muted { color: var(--muted); } .small { font-size: .82rem; } .tiny { font-size: .74rem; }
.nowrap { white-space: nowrap; } .ta-right { text-align: right; } .center { text-align: center; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ app shell */
.app { display: grid; grid-template-columns: var(--nav-w) minmax(0,1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
html[data-nav="collapsed"] { --nav-w: 72px; }
.sidenav { position: sticky; top: 0; height: 100vh; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; z-index: 40; overflow: hidden; }
.brand { height: var(--top-h); display: flex; align-items: center; gap: 10px; padding: 0 18px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.brand .logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--primary), #1AA0AB);
  display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .9rem; flex-shrink: 0; }
.brand .word { font-weight: 750; font-size: 1.12rem; letter-spacing: -.02em; white-space: nowrap; }
.brand .word span { color: var(--primary); }
.navscroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px 10px 16px; }
.navgroup { margin-top: 14px; } .navgroup:first-child { margin-top: 4px; }
.navlabel { font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  padding: 6px 10px; white-space: nowrap; }
.navitem { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; color: var(--ink-2);
  font-weight: 500; white-space: nowrap; position: relative; text-decoration: none !important; }
.navitem svg { width: 19px; height: 19px; flex-shrink: 0; stroke: currentColor; }
.navitem:hover { background: var(--surface-2); color: var(--ink); }
.navitem.on { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.navitem.on::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
.navitem .pill { margin-left: auto; font-size: .68rem; padding: 1px 7px; border-radius: 99px; background: var(--accent-50); color: var(--accent); font-weight: 600; }
.navfoot { border-top: 1px solid var(--line); padding: 10px; flex-shrink: 0; }
.collapse-btn { width: 100%; justify-content: flex-start; }
html[data-nav="collapsed"] .navlabel, html[data-nav="collapsed"] .navitem .txt,
html[data-nav="collapsed"] .brand .word, html[data-nav="collapsed"] .navitem .pill,
html[data-nav="collapsed"] .collapse-btn .txt { display: none; }
html[data-nav="collapsed"] .navitem { justify-content: center; padding: 10px 0; }
html[data-nav="collapsed"] .brand { justify-content: center; padding: 0; }
html[data-nav="collapsed"] .collapse-btn { justify-content: center; }
html[data-nav="collapsed"] .collapse-btn svg { transform: rotate(180deg); }
html[data-nav="collapsed"] .navlabel { height: 1px; padding: 0; margin: 10px 8px; background: var(--line); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: var(--top-h); position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.topbar .title { min-width: 0; }
.topbar .title h1 { font-size: 1.12rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title .sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
/* .btn sets display, so this needs the extra specificity or the drawer button shows on desktop */
.topbar .hamburger { display: none; }
.page { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; }
.page.wide { max-width: none; }
.page.flush { padding: 0; max-width: none; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0,1fr); }
  .sidenav { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-3); }
  html[data-drawer="open"] .sidenav { transform: none; }
  html[data-drawer="open"]::after { content: ""; position: fixed; inset: 0; background: rgba(8,16,20,.45); z-index: 35; }
  html[data-nav="collapsed"] .navitem .txt, html[data-nav="collapsed"] .navlabel, html[data-nav="collapsed"] .brand .word { display: revert; }
  .topbar .hamburger { display: inline-flex; } .collapse-btn { display: none; }
  .topbar { padding: 0 14px; } .page { padding: 16px; }
}

/* user menu */
.usermenu { position: relative; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-100); color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: .82rem; }
.userbtn { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: var(--surface);
  padding: 4px 10px 4px 4px; border-radius: 99px; cursor: pointer; font: inherit; color: var(--ink); }
.userbtn:hover { border-color: var(--line-2); }
.userbtn { flex-shrink: 0; max-width: 260px; }
.userbtn .who { text-align: left; line-height: 1.2; min-width: 0; }
.userbtn .who b, .userbtn .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.userbtn .who b { font-size: .82rem; } .userbtn .who span { font-size: .72rem; color: var(--muted); }
.userbtn > svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
@media (max-width: 700px) { .userbtn .who { display: none; } .userbtn { padding: 3px; } }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-2); padding: 6px; display: none; z-index: 60; }
.menu.open { display: block; }
.menu .mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: none; background: none;
  border-radius: 8px; font: inherit; color: var(--ink-2); cursor: pointer; text-align: left; text-decoration: none !important; }
.menu .mi:hover { background: var(--surface-2); color: var(--ink); }
.menu .mi svg { width: 17px; height: 17px; }
.menu .mhead { padding: 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .mhead b { display: block; } .menu .mhead span { font-size: .78rem; color: var(--muted); }

/* ------------------------------------------------------------------ primitives */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 550; font-size: .86rem;
  cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .12s, border-color .12s, color .12s; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-600); }
.btn.secondary { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn.secondary:hover { border-color: var(--muted); background: var(--surface-2); }
.btn.ghost { background: transparent; color: var(--ink-2); } .btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--danger); color: #fff; } .btn.danger:hover { filter: brightness(.94); }
.btn.soft { background: var(--primary-50); color: var(--primary); } .btn.soft:hover { background: var(--primary-100); }
.btn.sm { height: 30px; padding: 0 10px; font-size: .8rem; border-radius: 7px; }
.btn.xs { height: 26px; padding: 0 8px; font-size: .76rem; border-radius: 6px; }
.btn.icon { width: 36px; padding: 0; } .btn.sm.icon { width: 30px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.card-h h2, .card-h h3 { font-size: 1rem; } .card-h .sub { font-size: .8rem; color: var(--muted); }
.card-b { padding: 16px 18px; } .card-b.flush { padding: 0; }
.card-f { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.kpi { padding: 16px 18px; }
.kpi .k { font-size: .76rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.kpi .ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); }
.kpi .ico svg { width: 18px; height: 18px; }
.kpi.accent .ico { background: var(--accent-50); color: var(--accent); }
.kpi.ok .ico { background: var(--ok-50); color: var(--ok); }
.up { color: var(--ok); } .down { color: var(--danger); }

.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .72rem; font-weight: 600; padding: 2px 8px;
  border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge.primary { background: var(--primary-50); color: var(--primary); border-color: var(--primary-100); }
.badge.ok { background: var(--ok-50); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-50); color: var(--warn); border-color: transparent; }
.badge.danger { background: var(--danger-50); color: var(--danger); border-color: transparent; }
.badge.accent { background: var(--accent-50); color: var(--accent); border-color: transparent; }
.badge.info { background: var(--info-50); color: var(--info); border-color: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: currentColor; }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink-2); font: inherit; font-size: .8rem; font-weight: 500; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--primary); color: var(--ink); }
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .n { font-size: .72rem; opacity: .7; font-variant-numeric: tabular-nums; }
.chip.dim { opacity: .5; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; }
.seg button { border: none; background: none; height: 30px; padding: 0 14px; border-radius: 7px; font: inherit; font-size: .84rem; font-weight: 550;
  color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.seg button svg { width: 15px; height: 15px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-1); }

.input, .select, textarea.input { height: 38px; width: 100%; padding: 0 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: .88rem; outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-50); }
.input.sm, .select.sm { height: 32px; font-size: .82rem; }
.searchbox { position: relative; }
.searchbox svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.searchbox .input { padding-left: 36px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: .76rem; color: var(--muted); }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex-shrink: 0; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:disabled + .track { opacity: .5; }
.switch .lbl { font-size: .86rem; }

/* tri-state access control: inherit / on / off */
.tri { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.tri button { border: none; background: var(--surface); height: 28px; padding: 0 10px; font: inherit; font-size: .76rem; font-weight: 550; color: var(--muted); cursor: pointer; }
.tri button + button { border-left: 1px solid var(--line-2); }
.tri button.on.inherit { background: var(--surface-3); color: var(--ink); }
.tri button.on.yes { background: var(--ok); color: #fff; }
.tri button.on.no { background: var(--danger); color: #fff; }

.table-wrap { overflow: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; }
.table th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: .74rem; font-weight: 600; color: var(--muted);
  background: var(--surface-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th.sortable { cursor: pointer; user-select: none; } .table th.sortable:hover { color: var(--ink); }
.table th .arr { opacity: .5; margin-left: 3px; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.click { cursor: pointer; } .table tbody tr.click:hover td { background: var(--surface-2); }
.table tbody tr.sel td { background: var(--primary-50); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; color: var(--ink); }
.table .sub { font-size: .76rem; color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tab { border: none; background: none; padding: 11px 14px; font: inherit; font-weight: 550; font-size: .88rem; color: var(--muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--ink); } .tab.on { color: var(--primary); border-bottom-color: var(--primary); }
.tab .count { font-size: .72rem; background: var(--surface-2); padding: 0 7px; border-radius: 99px; color: var(--muted); }

.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); font-size: .86rem; color: var(--ink-2); }
.callout svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.callout.info { background: var(--info-50); border-color: transparent; } .callout.info svg { color: var(--info); }
.callout.warn { background: var(--warn-50); border-color: transparent; } .callout.warn svg { color: var(--warn); }
.callout.danger { background: var(--danger-50); border-color: transparent; } .callout.danger svg { color: var(--danger); }
.callout.ok { background: var(--ok-50); border-color: transparent; } .callout.ok svg { color: var(--ok); }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 36px; height: 36px; color: var(--line-2); margin-bottom: 8px; }
.empty b { display: block; color: var(--ink); font-size: .95rem; margin-bottom: 4px; }

.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%;
  animation: skel 1.3s ease infinite; border-radius: 6px; height: 14px; }
@keyframes skel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-2); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ collapsible side panels */
.panel { background: var(--surface); border: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; min-height: 0; transition: width .18s ease; }
.panel-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.panel-h h3 { font-size: .92rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-b { flex: 1; overflow-y: auto; min-height: 0; }
.panel.collapsed { width: 44px !important; }
.panel.collapsed .panel-b, .panel.collapsed .panel-h h3, .panel.collapsed .panel-h .extra { display: none; }
.panel.collapsed .panel-h { flex-direction: column; padding: 10px 0; border-bottom: none; }
.panel .collapse-toggle svg { transition: transform .18s; }
/* side modifiers are at-left / at-right - NOT .left/.right, which would collide with text utilities */
.panel.at-left.collapsed .collapse-toggle svg { transform: rotate(180deg); }
.panel.at-right.collapsed .collapse-toggle svg { transform: rotate(180deg); }
.panel .vlabel { display: none; writing-mode: vertical-rl; transform: rotate(180deg); font-size: .78rem; font-weight: 600; color: var(--muted); margin-top: 10px; cursor: pointer; white-space: nowrap; }
.panel.collapsed .vlabel { display: block; }
.fsec { padding: 14px; border-bottom: 1px solid var(--line); }
.fsec:last-child { border-bottom: none; }
.fsec > .label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }

/* right drawer */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: var(--shadow-3); z-index: 90; transform: translateX(100%); transition: transform .2s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-h { display: flex; align-items: flex-start; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer-h .t { flex: 1; min-width: 0; } .drawer-h h2 { font-size: 1.1rem; }
.drawer-b { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }
.backdrop { position: fixed; inset: 0; background: rgba(8,16,20,.4); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; }
.backdrop.open { opacity: 1; pointer-events: auto; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 120; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(8,16,20,.5); }
.modal.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-3); width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal-box.lg { width: min(1180px, 100%); height: calc(100vh - 40px); }
.modal-h { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-h h2 { flex: 1; font-size: 1.15rem; min-width: 0; }
.modal-b { padding: 20px 22px; overflow-y: auto; flex: 1; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 10px;
  background: var(--ink); color: var(--surface); box-shadow: var(--shadow-2); font-size: .86rem; animation: tin .2s ease; }
.toast.err { background: var(--danger); color: #fff; } .toast.ok { background: var(--ok); color: #fff; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* tooltips on collapsed nav + anything with data-tip */
[data-tip] { position: relative; }
.tipbox { position: fixed; z-index: 300; background: var(--ink); color: var(--surface); font-size: .76rem; padding: 5px 9px; border-radius: 6px;
  pointer-events: none; white-space: nowrap; box-shadow: var(--shadow-2); }

/* charts */
.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid line { stroke: var(--line); }
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: .78rem; color: var(--muted); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.hbar { display: grid; grid-template-columns: minmax(120px, 34%) 1fr auto; gap: 10px; align-items: center; padding: 6px 0; font-size: .84rem; }
.hbar .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; background: var(--primary); }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; min-width: 42px; text-align: right; }

/* steps explaining a calculation */
.calc { display: flex; align-items: stretch; gap: 8px; flex-wrap: wrap; }
.calc .term { flex: 1; min-width: 110px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.calc .term .k { font-size: .72rem; color: var(--muted); } .calc .term .v { font-size: 1.05rem; font-weight: 700; }
.calc .op { display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.calc .term.result { background: var(--primary-50); border-color: var(--primary-100); } .calc .term.result .v { color: var(--primary); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: none; }
.list-item.click { cursor: pointer; } .list-item.click:hover { background: var(--surface-2); }

.quick { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink); text-decoration: none !important; transition: border-color .12s, transform .12s, box-shadow .12s; }
.quick:hover { border-color: var(--primary); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.quick .qi { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-50); color: var(--primary); flex-shrink: 0; }
.quick .qi svg { width: 22px; height: 22px; }
.quick h3 { font-size: .98rem; margin-bottom: 3px; } .quick p { margin: 0; font-size: .82rem; color: var(--muted); }
.quick.locked { opacity: .55; pointer-events: none; }

.notice-bar { font-size: .74rem; color: var(--muted); padding: 14px 24px 22px; text-align: center; }


/* ------------------------------------------------------------------ keyboard focus */
.btn:focus-visible, .chip:focus-visible, .seg button:focus-visible, .tab:focus-visible, .navitem:focus-visible,
.linkbtn:focus-visible, .pc-sel:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.linkbtn { border: none; background: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; font-weight: 550; }
.linkbtn:hover { text-decoration: underline; }
.ok-t { color: var(--ok); font-weight: 600; } .warn-t { color: var(--warn); }
.spinner.sm { width: 14px; height: 14px; border-width: 2px; vertical-align: -2px; }
.field-err { color: var(--danger); font-size: .8rem; min-height: 18px; margin-top: 8px; }
.orline { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .76rem; margin: 12px 0; }
.orline::before, .orline::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ------------------------------------------------------------------ people browser (web/people.js) */
.cx { display: flex; flex-direction: column; gap: 10px; }
.cx.busy { opacity: .6; pointer-events: none; }
.cx-head { display: flex; align-items: flex-start; gap: 8px; }
.cx-t { font-weight: 650; font-size: .95rem; }
.cx-s { font-size: .8rem; color: var(--muted); margin-top: 1px; min-height: 18px; }
.cx-cost { display: flex; gap: 8px; align-items: flex-start; font-size: .78rem; color: var(--ink-2); background: var(--primary-50);
  border: 1px solid var(--primary-100); border-radius: 9px; padding: 8px 10px; }
.cx-cost svg { color: var(--primary); margin-top: 1px; }
.cx-presets { gap: 5px; } .cx-presets .chip { height: 28px; padding: 0 10px; font-size: .76rem; }
.cx-adv { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.cx-adv .chips .chip { height: 26px; padding: 0 9px; font-size: .74rem; text-transform: capitalize; }
.cx-tools { display: flex; gap: 8px; align-items: center; }
.cx-bulk { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); }
.cx-bulk.on { border-color: var(--primary-100); background: var(--primary-50); }
.cx-check { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; color: var(--ink-2); cursor: pointer; }
.cx-check input, .pc-sel { accent-color: var(--primary); width: 16px; height: 16px; cursor: pointer; margin: 0; }
.cx-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.cx.wide .cx-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 0; }
.pc { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 11px 12px;
  border-bottom: 1px solid var(--line); transition: background .12s; }
.cx.wide .pc { border-right: 1px solid var(--line); }
.pc:last-child { border-bottom: none; }
.pc:hover { background: var(--surface-2); }
.pc.sel { background: var(--primary-50); }
.pc .pc-sel { margin-top: 9px; }
.pc-av { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2);
  font-weight: 700; font-size: .74rem; letter-spacing: .02em; }
.pc.unlocked .pc-av { background: var(--ok-50); color: var(--ok); }
.pc-name { font-weight: 600; font-size: .88rem; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pc-name .badge { font-size: .64rem; padding: 0 6px; }
.pc-title { font-size: .8rem; color: var(--ink-2); margin-top: 1px; }
.pc-meta { font-size: .74rem; color: var(--muted); margin-top: 1px; }
.pc-rev { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; font-size: .8rem; align-items: center; }
.pc-rev a { display: inline-flex; align-items: center; gap: 5px; word-break: break-all; }
.pc-rev svg { width: 14px; height: 14px; }
.pc-rev .linkbtn { font-size: .72rem; color: var(--muted); }
.pc-note { font-size: .72rem; color: var(--ok); margin-top: 4px; display: flex; gap: 5px; align-items: center; }
.pc-note svg { width: 13px; height: 13px; }
.pc-act { display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.pc-act .btn svg { width: 13px; height: 13px; }
.pc-none { font-size: .7rem; color: var(--muted); white-space: nowrap; border: 1px dashed var(--line-2); border-radius: 6px; padding: 3px 7px; cursor: help; }
.pc .skel { height: 12px; } .pc-av.skel { height: 34px; }
.cx-pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .78rem; color: var(--muted); }
.cx-more { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .8rem; color: var(--ink-2); padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.cx-more svg { color: var(--info); }
.cx-foot { display: flex; gap: 8px; align-items: flex-start; font-size: .74rem; color: var(--muted); line-height: 1.5; }
.cx-foot svg { width: 14px; height: 14px; color: var(--ok); margin-top: 2px; }
.cx-site .input { min-width: 0; }
