/*
VOICE   mission-control for mining intelligence: calm, exact, confident
IDEA    an orbiting survey station over Africa — the logo's globe + orbit
PICTURE the map itself, edge to edge; gold swipe blade cuts before/after
COLOUR  GeoSphere navy #091E34 grounds, emerald #2FB98E for action, gold #FFC221 for highlights
TYPE    Inter Tight for headings/years, Inter for text, tabular numbers
LAYOUT  header · [panel | map | drawer] · year timeline;  console: nav | content
*/
:root {
  color-scheme: dark;
  --bg: #091e34; --deep: #06162a; --panel: #0d2540; --panel-2: #133050; --panel-3: #183a5e;
  --line: #21405f; --line-2: #2c5076;
  --ink: #f4f7fa; --mute: #93a7bc; --faint: #6d849c;
  --brand: #2fb98e; --brand-hi: #3fd0a2; --brand-ink: #04261a;
  --gold: #ffc221; --gold-ink: #2a1d00;
  --danger: #ff6b5a; --warn: #ffc221; --ok: #2fb98e;
  --r: 10px; --head: 60px;
  --ff: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --ff-d: 'Inter Tight', 'Inter', system-ui, sans-serif;
}
* { box-sizing: border-box; min-width: 0; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--ff); font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand-hi); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { font-family: var(--ff-d); }
h2.eyebrow, .panel h2 { font: 600 13px/1.2 var(--ff-d); color: var(--mute); margin: 0 0 10px; }
[hidden] { display: none !important; }

/* ---------- buttons & form controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 14px; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #3c6590; background: var(--panel-3); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.btn.primary:hover { background: var(--brand-hi); }
.btn.gold { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); font-weight: 600; }
.btn.danger { color: #ffb0a6; border-color: #6b2f2a; background: #2a1820; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.busy::after { content: ''; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 8px; position: relative; color: var(--ink); }
.icon-btn:hover { background: var(--panel-2); }
.link { background: none; border: 0; padding: 4px 2px; color: var(--brand-hi); }
label.field { display: grid; gap: 6px; font-size: 13px; color: var(--mute); align-content: start; }
label.field > span b { color: var(--ink); font-weight: 500; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; min-height: 42px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--deep); padding: 8px 12px; font-size: 16px; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px #2fb98e33; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--brand); margin: 0; flex: none; }
input[type=range] { width: 100%; accent-color: var(--brand); }
.help { font-size: 12.5px; color: var(--faint); margin: 0; }
.err { color: #ffb0a6; font-size: 14px; margin: 0; }
.ok-msg { color: var(--brand-hi); font-size: 14px; margin: 0; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; padding: 2px 10px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line-2); white-space: nowrap; }
.badge i { width: 9px; height: 9px; border-radius: 50%; }
.badge.ok { color: var(--brand-hi); border-color: #1f6b54; background: #0c3a30; }
.badge.warn { color: var(--gold); border-color: #6b5410; background: #2d2610; }
.badge.off { color: #ffb0a6; border-color: #6b2f2a; background: #2a1820; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--deep); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 3px; }
.seg button { border: 0; background: transparent; border-radius: 6px; min-height: 38px; padding: 4px 6px; font-size: 13px; font-weight: 500; color: var(--mute); }
.seg button[aria-checked="true"] { background: var(--panel-3); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- header (shared) ---------- */
.top { height: var(--head); display: flex; align-items: center; gap: 14px; padding: 0 14px 0 16px; background: var(--bg); border-bottom: 1px solid var(--line); position: relative; z-index: 1200; }
.top::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--brand) 0 22%, var(--gold) 22% 26%, transparent 26%); opacity: .8; }
.brand { display: flex; align-items: center; flex: none; }
.brand img { height: 30px; width: auto; display: block; }
.brand .mark { display: none; height: 34px; }
.top .grow { flex: 1; }
.search { flex: 1 1 320px; max-width: 440px; }
.search input, .top select { height: 40px; min-height: 40px; background: var(--panel); }
.top .preset { flex: 0 1 260px; }
.top .preset select { font-size: 14px; }
.engine { font-size: 12px; color: var(--mute); border: 1px solid var(--line); padding: 4px 10px; border-radius: 99px; white-space: nowrap; }
.engine.warn { color: var(--gold); border-color: #6b5410; }
.nav-link { color: var(--mute); text-decoration: none; font-size: 14px; padding: 8px 10px; border-radius: 8px; white-space: nowrap; }
.nav-link:hover, .nav-link.on { color: var(--ink); background: var(--panel-2); }
.dot-count { position: absolute; top: 6px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--gold); color: var(--gold-ink); font: 700 11px/18px var(--ff); text-align: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font: 700 14px var(--ff-d); }
.menu { position: absolute; top: calc(var(--head) - 6px); right: 10px; width: min(380px, calc(100vw - 20px)); background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 18px 40px #0009; overflow: hidden; z-index: 1300; }
.menu header { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.menu header b { font-family: var(--ff-d); }
.menu .list { max-height: min(460px, 70vh); overflow-y: auto; }
.menu a.item, .menu button.item { display: block; width: 100%; text-align: left; padding: 11px 16px; border: 0; background: none; color: var(--ink); text-decoration: none; font-size: 14px; border-bottom: 1px solid #ffffff08; }
.menu .item:hover { background: var(--panel-2); }
.menu .note-item.unread { box-shadow: inset 3px 0 0 var(--gold); background: #ffffff05; }
.menu .note-item small { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.menu .note-item span { display: block; color: var(--mute); font-size: 13px; }
.menu .empty { padding: 24px 16px; color: var(--mute); font-size: 14px; text-align: center; }
.menu .who { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.menu .who b { display: block; } .menu .who span { color: var(--mute); font-size: 13px; }

/* ---------- map page ---------- */
body.map-page { display: grid; grid-template-rows: var(--head) minmax(0, 1fr) auto; overflow: hidden; }
.stage { position: relative; display: grid; grid-template-columns: 310px minmax(0, 1fr) auto; min-height: 0; }
.panel { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; z-index: 20; }
.panel section { padding: 16px; border-bottom: 1px solid var(--line); }
.panel section.grow { flex: 1; border-bottom: 0; }
.row-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.links { font-size: 13px; color: var(--mute); }
.hint { margin: 10px 0 0; font-size: 13px; color: var(--mute); }
.kinds { display: grid; gap: 6px; margin-bottom: 10px; font-size: 14px; }
.kinds label, .cats label { display: flex; align-items: center; gap: 9px; min-height: 32px; cursor: pointer; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; }
.dot.solid { background: var(--mute); }
.dot.ring { border: 2px dashed var(--mute); }
.cats { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.cats li label { padding: 1px 0; font-size: 14px; }
.cats .n { margin-left: auto; color: var(--mute); font-size: 13px; }
.cats li.empty { opacity: .5; }
.count { color: var(--ink); font-weight: 600; margin-left: 4px; }
.sitelist { list-style: none; margin: 0; padding: 0; }
.sitelist button { width: 100%; text-align: left; display: grid; grid-template-columns: 12px 1fr; gap: 2px 10px; align-items: center; padding: 8px 6px; background: none; border: 0; border-radius: 7px; }
.sitelist button:hover { background: var(--panel-2); }
.sitelist .nm { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sitelist .sub { grid-column: 2; font-size: 12px; color: var(--mute); }
.sitelist .empty { color: var(--mute); font-size: 13px; padding: 6px 0; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }

.maps { position: relative; overflow: hidden; background: var(--deep); }
.map { position: absolute; inset: 0; background: var(--deep); }
body[data-mode="single"] #mapA { visibility: hidden; }
body[data-mode="side"] #mapA { right: calc(50% + 1px); }
body[data-mode="side"] #mapB { left: calc(50% + 1px); }
body[data-mode="swipe"] #mapB { clip-path: inset(0 0 0 calc(var(--swipe, .5) * 100%)); }
.swipe { display: none; position: absolute; top: 0; bottom: 0; left: calc(var(--swipe, .5) * 100%); width: 3px; margin-left: -1.5px; background: var(--gold); z-index: 500; cursor: ew-resize; touch-action: none; }
body[data-mode="swipe"] .swipe { display: block; }
.knob { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; box-shadow: 0 2px 10px #0008; }
.tag { position: absolute; top: 12px; z-index: 510; font: 600 14px var(--ff-d); background: #091e34e6; border: 1px solid var(--line-2); padding: 5px 11px; border-radius: 7px; pointer-events: none; white-space: nowrap; }
.tag-a { left: 12px; } .tag-b { right: 12px; }
body[data-mode="single"] .tag-a { display: none; }
body[data-mode="single"] .tag-b { left: 12px; right: auto; }
body[data-mode="side"] .tag-b { left: calc(50% + 12px); right: auto; }
.veg-card { position: absolute; z-index: 516; right: 12px; bottom: 34px; width: min(230px, calc(50% - 24px)); min-width: 160px; background: #091e34ec; border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 12px; display: grid; gap: 7px; font-size: 12px; box-shadow: 0 4px 18px #0009; pointer-events: none; }
.veg-card h4 { margin: 0; font: 600 11px/1.2 var(--ff-d); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
.veg-row > div { display: flex; justify-content: space-between; margin-bottom: 3px; }
.veg-row b { font-weight: 600; }
.veg-track { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.veg-track i { display: block; height: 100%; border-radius: 4px; }
.veg-track i.from { background: var(--brand); } .veg-track i.to { background: var(--gold); }
.veg-delta { font: 600 13px var(--ff-d); }
.veg-delta.down { color: #ff9a8a; } .veg-delta.up { color: var(--brand-hi); } .veg-delta.same { color: var(--mute); }
@media (max-width: 600px) { .veg-card { width: min(200px, 60%); bottom: 40px; } }
.analyze { position: absolute; z-index: 520; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 99px; border: 0; background: var(--brand); color: var(--brand-ink); font: 600 15px var(--ff-d); box-shadow: 0 4px 18px #0009; }
.analyze:hover { background: var(--brand-hi); }
body[data-mode="side"] .analyze, body[data-mode="swipe"] .analyze { top: auto; bottom: 34px; }
.analyze[disabled] { background: #1d4a44; color: #8fc3b2; cursor: not-allowed; }
.analyze.busy span::after { content: ''; display: inline-block; width: 12px; height: 12px; margin-left: 9px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
.placing .maps { cursor: crosshair; }
.place-banner { position: absolute; z-index: 530; top: 64px; left: 50%; transform: translateX(-50%); background: var(--gold); color: var(--gold-ink); padding: 8px 10px 8px 16px; border-radius: 99px; font-weight: 600; font-size: 14px; display: flex; gap: 10px; align-items: center; box-shadow: 0 4px 18px #0009; white-space: nowrap; }
.place-banner button { border: 0; background: #0002; border-radius: 99px; padding: 4px 10px; font-weight: 600; }
.note { position: absolute; z-index: 515; left: 12px; bottom: 34px; max-width: min(420px, calc(100% - 24px)); background: #0d2540f2; border: 1px solid #6b5410; color: #ffe08a; padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.attrib { position: absolute; z-index: 515; left: 0; bottom: 0; max-width: 100%; background: #091e34cc; color: #a9bccd; font-size: 11px; padding: 3px 8px; border-top-right-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-tip { background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); box-shadow: 0 2px 8px #0008; font-size: 13px; }
.ms-tip::before { display: none; }
.leaflet-container { background: var(--deep); font-family: var(--ff); }
.leaflet-bar a { background: var(--panel); color: var(--ink); border-color: var(--line); }
.leaflet-bar a:hover { background: var(--panel-2); }
.leaflet-control-scale-line { background: #091e34b0; color: var(--ink); border-color: var(--ink); }

.drawer { width: 390px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; position: relative; padding: 18px 18px 28px; z-index: 20; }
.drawer .close { position: absolute; top: 8px; right: 8px; }
.drawer h3 { font: 600 24px/1.15 var(--ff-d); margin: 8px 44px 6px 0; text-wrap: balance; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 7px 12px; margin: 16px 0; font-size: 14px; }
.kv dt { color: var(--mute); } .kv dd { margin: 0; overflow-wrap: anywhere; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.caveat { font-size: 13px; color: var(--mute); border-left: 2px solid var(--gold); padding: 2px 0 2px 10px; margin: 12px 0; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat b { display: block; font: 600 22px/1.1 var(--ff-d); white-space: nowrap; }
.stat span { font-size: 12px; color: var(--mute); }
.stat.hot b { color: #ff8a7a; }
.legend { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 4px; font-size: 13px; }
.legend li { display: flex; gap: 8px; align-items: center; }
.legend i { width: 14px; height: 10px; border-radius: 2px; }
.toggle-row { display: flex; align-items: center; gap: 10px; min-height: 36px; font-size: 14px; }
.cand-list { list-style: none; padding: 0; margin: 8px 0; }
.cand-list button { width: 100%; display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; text-align: left; background: none; border: 0; padding: 8px 4px; border-bottom: 1px solid var(--line); font-size: 14px; }
.cand-list .r { color: var(--mute); font-size: 12px; white-space: nowrap; }
.conf-high { color: #ff9a7a; } .conf-medium { color: var(--gold); } .conf-low { color: var(--mute); }
details { margin-top: 12px; font-size: 13px; color: var(--mute); }
summary { cursor: pointer; min-height: 32px; color: var(--ink); }

.timeline { display: flex; gap: 14px; align-items: center; padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--line); z-index: 30; }
.play { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; flex: none; }
body:not([data-mode="single"]) .play { display: none; }
.rows { flex: 1; display: grid; gap: 6px; }
.yrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.yrow .lbl { font: 600 13px var(--ff-d); color: var(--mute); width: 46px; }
body[data-mode="single"] .yrow .lbl { display: none; }
body[data-mode="single"] .yrow { grid-template-columns: minmax(0, 1fr) auto; }
.years { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.years button { min-height: 38px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); font: 600 15px var(--ff-d); color: var(--mute); padding: 0; }
.years button:hover { color: var(--ink); border-color: var(--line-2); }
.years button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.years button.na { opacity: .45; }
.yrow select { height: 38px; min-height: 38px; width: auto; max-width: 170px; padding: 0 8px; font-size: 13px; background: var(--panel); }

/* ---------- modal & toast ---------- */
.modal-back { position: fixed; inset: 0; background: #020a14b8; z-index: 2000; display: grid; place-items: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 24px 60px #000a; }
.modal.wide { width: min(760px, 100%); }
.modal > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px 0; }
.modal > header h2 { font: 600 20px var(--ff-d); margin: 0; }
.modal .body { padding: 16px 18px; display: grid; gap: 14px; }
.modal > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 18px 18px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.copy-row { display: flex; gap: 8px; } .copy-row input { font-size: 13px; }
.toast { position: fixed; left: 50%; bottom: 110px; transform: translate(-50%, 20px); opacity: 0; transition: .25s; background: var(--panel-3); border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 9px; z-index: 3000; max-width: min(520px, 92vw); font-size: 14px; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.checklist { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 0 8px; background: var(--deep); }
.checklist label { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 14px; color: var(--ink); padding: 0 4px; border-radius: 6px; cursor: pointer; }
.checklist label:hover { background: var(--panel-2); }
.checklist label small { color: var(--faint); margin-left: auto; }
.mini-map { height: 240px; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; }

/* ---------- auth pages ---------- */
body.auth-page { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(360px, 520px); }
.auth-art { position: relative; overflow: hidden; background: radial-gradient(120% 90% at 30% 40%, #10345a 0%, var(--bg) 55%, var(--deep) 100%); display: flex; flex-direction: column; justify-content: space-between; padding: 40px; }
.auth-art .logo { width: min(340px, 70%); height: auto; }
.auth-art svg.orbit { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-art .claim { position: relative; z-index: 1; max-width: 440px; }
.auth-art .claim h1 { font: 600 clamp(30px, 3.1vw, 42px)/1.08 var(--ff-d); margin: 0 0 14px; text-wrap: balance; }
.auth-art .claim h1 em { font-style: normal; color: var(--brand); }
.auth-art .claim p { color: var(--mute); margin: 0; font-size: 16px; max-width: 34ch; }
.auth-art .stats-row { position: relative; display: flex; gap: 28px; flex-wrap: wrap; }
.auth-art .stats-row b { display: block; font: 700 26px var(--ff-d); color: var(--gold); }
.auth-art .stats-row span { color: var(--mute); font-size: 13px; }
.auth-card { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 5vw, 56px); gap: 18px; }
.auth-card h2 { font: 600 28px/1.15 var(--ff-d); margin: 0; }
.auth-card .sub { color: var(--mute); margin: 0; }
.auth-card form { display: grid; gap: 14px; }
.auth-card .btn { min-height: 46px; font-size: 15px; }
.auth-card .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.auth-card .mobile-logo { display: none; height: 30px; width: auto; align-self: flex-start; }
.pw-meter { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; } .pw-meter i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s; }

/* ---------- admin console ---------- */
body.console { display: grid; grid-template-rows: var(--head) minmax(0, 1fr); min-height: 100vh; }
.console-wrap { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 0; }
.side-nav { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 12px; border-radius: 8px; color: var(--mute); text-decoration: none; font-size: 14.5px; font-weight: 500; }
.side-nav a:hover { background: var(--panel-2); color: var(--ink); }
.side-nav a[aria-current="page"] { background: #0c3a30; color: var(--brand-hi); box-shadow: inset 3px 0 0 var(--brand); }
.side-nav svg { flex: none; }
.side-nav .sep { height: 1px; background: var(--line); margin: 10px 6px; }
.content { padding: clamp(18px, 3vw, 34px); overflow-y: auto; max-width: 1280px; width: 100%; }
.content:focus { outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font: 600 30px/1.1 var(--ff-d); margin: 0 0 4px; }
.page-head p { color: var(--mute); margin: 0; max-width: 70ch; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 160px; flex: 1 1 160px; max-width: 280px; min-height: 40px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
section.card + section.card { margin-top: 16px; }
.card > header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.card > header h2 { font: 600 17px var(--ff-d); margin: 0; }
.card > header p { margin: 2px 0 0; color: var(--mute); font-size: 13px; }
.card .pad { padding: 16px 18px; display: grid; gap: 14px; }
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font: 600 12.5px var(--ff); color: var(--mute); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #0b2139; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid #ffffff0d; vertical-align: middle; }
.tbl tr:hover td { background: #ffffff05; }
.tbl td.num { text-align: right; white-space: nowrap; }
.tbl .who b { display: block; font-weight: 500; } .tbl .who span { color: var(--mute); font-size: 13px; }
.tbl .acts { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.tbl .empty-row td { text-align: center; color: var(--mute); padding: 28px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--panel-3); color: var(--ink); white-space: nowrap; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 16px; color: var(--mute); font-size: 13px; flex-wrap: wrap; }
.perm-grid { display: grid; gap: 14px; }
.perm-grid fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 10px; margin: 0; }
.perm-grid legend { font: 600 13px var(--ff-d); color: var(--mute); padding: 0 6px; }
.perm-grid label { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; font-size: 14px; color: var(--ink); }
.perm-grid label small { display: block; color: var(--faint); font-size: 12px; }
.role-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.role-card { padding: 16px; display: grid; gap: 10px; align-content: start; }
.role-card h3 { margin: 0; font: 600 18px var(--ff-d); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.role-card p { margin: 0; color: var(--mute); font-size: 13.5px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 18px; align-items: start; }
.secret-row { display: flex; gap: 8px; align-items: center; }
.secret-row .state { font-size: 13px; color: var(--mute); white-space: nowrap; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid #ffffff0d; }
.switch-row:last-child { border-bottom: 0; }
.switch-row b { font-weight: 500; display: block; } .switch-row span { color: var(--mute); font-size: 13px; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line-2); transition: .15s; pointer-events: none; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + i { background: var(--brand); } .switch input:checked + i::after { left: 23px; }
.switch input:focus-visible + i { outline: 2px solid var(--gold); outline-offset: 2px; }
.pref-tbl td:not(:first-child), .pref-tbl th:not(:first-child) { text-align: center; width: 90px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { padding: 14px 16px; } .kpi b { display: block; font: 700 26px var(--ff-d); } .kpi span { color: var(--mute); font-size: 13px; }
pre.details { margin: 0; white-space: pre-wrap; font-size: 12px; color: var(--mute); max-width: 420px; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: reduce) { .toast, .switch i, .switch i::after { transition: none; } .analyze.busy span::after, .btn.busy::after { animation: none; } }

/* ---------- narrow ---------- */
.only-narrow { display: none; }
@media (max-width: 980px) {
  body.auth-page { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-card { border-left: 0; min-height: 100vh; justify-content: flex-start; padding-top: 48px; }
  .auth-card .mobile-logo { display: block; }
}
@media (max-width: 900px) {
  .only-narrow { display: grid; }
  .top .preset, .engine, .top .nav-link.wide { display: none; }
  .stage { grid-template-columns: minmax(0, 1fr); }
  .panel { position: absolute; inset: 0 auto 0 0; width: min(330px, 88vw); transform: translateX(-102%); transition: transform .2s; z-index: 1050; }
  .panel.open { transform: none; box-shadow: 8px 0 24px #0009; }
  .drawer { position: absolute; left: 0; right: 0; bottom: 0; width: auto; max-height: 62%; border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: 0 -8px 24px #0009; z-index: 1100; }
  .yrow select { max-width: 120px; }
  .console-wrap { grid-template-columns: minmax(0, 1fr); }
  .side-nav { position: fixed; top: var(--head); bottom: 0; left: 0; width: 260px; transform: translateX(-102%); transition: transform .2s; z-index: 1100; }
  .side-nav.open { transform: none; box-shadow: 8px 0 24px #0009; }
}
@media (max-width: 600px) {
  :root { --head: 56px; }
  .top { gap: 4px; padding: 0 6px; }
  .brand .full { display: none; } .brand .mark { display: block; }
  .timeline { padding: 8px; gap: 8px; }
  .play { width: 44px; height: 44px; }
  .years { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .years button { min-height: 34px; font-size: 14px; }
  .yrow, body[data-mode="single"] .yrow { grid-template-columns: minmax(0, 1fr); }
  .yrow .lbl { width: auto; }
  .yrow select { max-width: none; width: 100%; }
  .analyze { font-size: 14px; padding: 0 14px; top: 50px; }
  .tag { font-size: 12px; }
  .note { max-width: calc(100% - 80px); }
  .grid2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 105px 1fr; }
  .tbl.stack thead { display: none; }
  .tbl.stack tr { display: grid; padding: 8px 0; border-bottom: 1px solid var(--line); }
  .tbl.stack td { border: 0; padding: 4px 14px; }
  .tbl.stack td.num { text-align: left; }
  .tbl.stack .acts { justify-content: flex-start; }
}

/* ---------- language switcher ---------- */
.lang-select { display: inline-flex; align-items: center; gap: 4px; color: var(--mute); border: 1px solid var(--line); border-radius: 8px; padding: 0 2px 0 8px; height: 38px; flex: none; }
.lang-select:hover { border-color: var(--line-2); color: var(--ink); }
.lang-select select { width: auto; min-height: 34px; height: 34px; border: 0; background: transparent; padding: 0 6px; font-size: 14px; color: var(--ink); cursor: pointer; }
.lang-select select:focus { box-shadow: none; }
.lang-select:focus-within { outline: 2px solid var(--gold); outline-offset: 2px; }
.lang-select option { background: var(--panel); color: var(--ink); }
.auth-top { display: flex; align-items: center; gap: 10px; }
.auth-top #langSlot { margin-left: auto; }
.auth-card { position: relative; }
@media (min-width: 981px) { .auth-top { position: absolute; top: 20px; right: clamp(20px, 4vw, 40px); } }
@media (max-width: 600px) {
  .lang-select svg { display: none; }
  .lang-select { padding: 0 0 0 2px; height: 36px; }
  .lang-select select { font-size: 13px; max-width: 96px; padding: 0 2px; }
}
.menu .lang-row { padding: 10px 16px; border-bottom: 1px solid #ffffff08; }
.menu .lang-row .lang-select { width: 100%; }
.menu .lang-row .lang-select select { flex: 1; max-width: none; }
.analyze { white-space: nowrap; }
@media (max-width: 900px) { #headerRight > .lang-select { display: none; } }
@media (min-width: 901px) { .menu .lang-row { display: none; } }