/* S-TRACE design system.
 * Tokens first; components use tokens only. One interaction accent (--accent); severity colors are
 * reserved for alert and status indicators. Surfaces are flat with 1px borders; elevation is used only
 * for floating layers (menus, dialogs, toasts). Spacing follows a 4px grid. */
:root {
  /* surfaces */
  --bg: #0a0e13;
  --surface-1: #0f141a;
  --surface-2: #141a22;
  --surface-3: #1a212b;
  --hover: rgba(255, 255, 255, 0.04);
  --border: #222a35;
  --border-strong: #2f3946;
  /* text */
  --text: #e4e9ef;
  --text-2: #a7b1be;
  --text-3: #7a8594;
  /* interaction accent */
  --accent: #4cb0d9;
  --accent-strong: #7cc7e6;
  --accent-weak: rgba(76, 176, 217, 0.14);
  --accent-line: rgba(76, 176, 217, 0.45);
  --on-accent: #06141b;
  /* semantic: severity and health (indicators only) */
  --critical: #ef5a64;
  --high: #ef8f45;
  --medium: #ddbf4c;
  --low: #6f97ec;
  --nominal: #4fbf8b;
  --sim: #a78bf0;
  --danger: #ef5a64;
  /* type */
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-md: 13px;
  --fs-lg: 14px;
  --fs-xl: 16px;
  --fs-2xl: 20px;
  /* space, radius, size */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --r1: 4px;
  --r2: 6px;
  --r3: 8px;
  --control: 30px;
  --control-sm: 24px;
  --topbar: 48px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border-strong);
  /* motion */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}
html.density-compact { --control: 26px; --s3: 10px; --s4: 12px; }
html.text-large { --fs-xs: 12px; --fs-sm: 13px; --fs-md: 14px; --fs-lg: 15px; --fs-xl: 17px; --fs-2xl: 22px; }
html.contrast-high { --border: #34404f; --border-strong: #4a5869; --text-2: #c3ccd6; --text-3: #9aa5b3; --bg: #05080b; }
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after {
  animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: var(--fs-md) / 1.45 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
:where(svg:not(.main-svg)) { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-radius: var(--r1); }
::selection { background: rgba(76, 176, 217, 0.35); }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--s2); top: var(--s2); z-index: 99; background: var(--surface-3); padding: var(--s2) var(--s3); }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.mono { font-family: var(--mono); font-size: 0.94em; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
code { font-family: var(--mono); font-size: 0.92em; }

/* ------------------------------------------------------------ app frame */
body.app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: var(--topbar); flex: none; display: flex; align-items: center; gap: var(--s4);
  padding: 0 var(--s4); border-bottom: 1px solid var(--border); background: var(--surface-1);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; flex: none; }
.brand-mark { width: 26px; height: 26px; color: var(--accent); }
.brand-mark svg { width: 26px; height: 26px; stroke-width: 1.7; }
.brand-name { font-weight: 650; font-size: 15px; letter-spacing: 0.08em; }
.brand-name i { font-style: normal; color: var(--accent); }
.brand-sub { font-size: var(--fs-xs); color: var(--text-3); border-left: 1px solid var(--border); padding-left: 10px; white-space: nowrap; }
.nav { display: flex; align-items: stretch; height: 100%; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav a {
  display: flex; align-items: center; gap: 6px; padding: 0 var(--s3); color: var(--text-2); font-weight: 500;
  border-bottom: 2px solid transparent; white-space: nowrap; text-decoration: none !important;
  transition: color var(--dur-1) var(--ease), border-color var(--dur-2) var(--ease);
}
.nav a:hover { color: var(--text); }
.nav a.on { color: var(--text); border-bottom-color: var(--accent); }
.count-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--surface-3); color: var(--text); font-size: var(--fs-xs); display: inline-grid; place-items: center; font-weight: 600; }
.count-badge.alert { box-shadow: inset 0 0 0 1px rgba(239, 90, 100, 0.55); color: #ffb4b9; }
.count-badge:empty { display: none; }
.sim-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; color: var(--sim); border: 1px solid rgba(167, 139, 240, 0.5); padding: 0 4px; border-radius: 3px; }
.top-right { display: flex; align-items: center; gap: var(--s3); flex: none; }
.freshness { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); padding: 0 var(--s2); height: var(--control-sm); border-radius: var(--r1); }
.freshness .dot { width: 7px; height: 7px; }
.freshness.stale { color: #f3d27a; }
.freshness.down { color: #ffb4b9; }
.next-refresh { background: none; border: 1px solid var(--border); cursor: pointer; font: inherit; font-size: var(--fs-sm); }
.next-refresh:hover { border-color: var(--accent); }
.clock { font-family: var(--mono); font-size: var(--fs-sm); color: var(--text-2); white-space: nowrap; }
.avatar-btn { display: flex; align-items: center; gap: var(--s2); background: none; border: 1px solid transparent; border-radius: 16px; padding: 2px 8px 2px 2px; color: var(--text-2); }
.avatar-btn:hover, .avatar-btn[aria-expanded="true"] { background: var(--hover); border-color: var(--border); color: var(--text); }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #23415a; color: #d8ecf7; font-size: 11.5px; font-weight: 650; letter-spacing: 0.02em; flex: none; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.role-chip { font-size: var(--fs-xs); color: var(--text-3); text-transform: capitalize; }
main#view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
main#view:focus { outline: none; }
.page { padding: var(--s4) var(--s5) var(--s6); animation: page-in var(--dur-3) var(--ease-out); }
.page[data-page="overview"] { padding: 0; display: flex; flex-direction: column; flex: 1; min-height: 0; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.005em; }
.kicker { margin: 2px 0 0; color: var(--text-3); font-size: var(--fs-md); }
.bullet { color: var(--text-3); font-weight: 400; }

/* ------------------------------------------------------------ surfaces */
.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r3); padding: var(--s3) var(--s4); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin: 0 0 var(--s2); min-height: 22px; }
.panel-head h3, .panel h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.section-label { margin: var(--s4) 0 var(--s2); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.note { color: var(--text-3); font-size: var(--fs-sm); margin: var(--s2) 0 0; line-height: 1.5; }
.empty-note { color: var(--text-3); padding: var(--s5) var(--s3); text-align: center; font-size: var(--fs-md); }
.empty-note b { color: var(--text-2); }
.error-note { color: #ffb4b9; padding: var(--s4) var(--s3); text-align: center; }
.error-note button { margin-top: var(--s2); }
.skeleton { display: block; height: 12px; border-radius: 3px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; margin: 8px 0; }
.skeleton.w60 { width: 60%; }
.skeleton.w40 { width: 40%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control); padding: 0 var(--s3);
  border-radius: var(--r2); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 500; white-space: nowrap; text-decoration: none !important;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn.danger { color: #ffb4b9; border-color: rgba(239, 90, 100, 0.45); background: transparent; }
.btn.danger:hover:not(:disabled) { background: rgba(239, 90, 100, 0.1); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover:not(:disabled) { background: var(--hover); color: var(--text); }
.btn.small { height: var(--control-sm); padding: 0 var(--s2); font-size: var(--fs-sm); }
.btn.block { width: 100%; }
.icon-btn {
  width: var(--control-sm); height: var(--control-sm); display: inline-grid; place-items: center; border-radius: var(--r1);
  border: 1px solid transparent; background: none; color: var(--text-3); padding: 0; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--accent); }
.inp {
  height: var(--control); padding: 0 var(--s2); border-radius: var(--r2); border: 1px solid var(--border-strong);
  background: var(--surface-1); color: var(--text); min-width: 0;
}
textarea.inp { height: auto; padding: var(--s2); resize: vertical; width: 100%; min-height: 64px; margin-top: var(--s2); }
.inp:focus { border-color: var(--accent-line); outline: none; box-shadow: 0 0 0 3px var(--accent-weak); }
select.inp { padding-right: 24px; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 8px; color: var(--text-3); pointer-events: none; }
.search input { height: var(--control); padding: 0 var(--s2) 0 28px; border-radius: var(--r2); border: 1px solid var(--border-strong); background: var(--surface-1); width: 220px; }
.search input:focus { border-color: var(--accent-line); outline: none; box-shadow: 0 0 0 3px var(--accent-weak); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--r2); overflow: hidden; background: var(--surface-1); }
.seg button { height: calc(var(--control) - 2px); padding: 0 var(--s3); border: 0; background: none; color: var(--text-2); font-weight: 500; }
.seg button + button { border-left: 1px solid var(--border-strong); }
.seg button.on { background: var(--accent-weak); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.seg button:hover:not(.on) { background: var(--hover); color: var(--text); }
label.check, .check { display: flex; align-items: center; gap: var(--s2); color: var(--text-2); cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
.field, .pass-controls label, .alert-filters label { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-sm); color: var(--text-3); font-weight: 500; }
#sim-config > .field, #sim-config > div > .field { margin-top: var(--s3); }
.form-error { color: #ffb4b9; font-size: var(--fs-sm); margin: var(--s2) 0 0; }
.form-ok { color: #9be3c0; font-size: var(--fs-sm); margin: var(--s2) 0 0; }
.toggle { position: relative; display: inline-block; width: 30px; height: 18px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle i { position: absolute; inset: 0; border-radius: 9px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background var(--dur-2) var(--ease); }
.toggle i::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 50%; background: var(--text-2); transition: transform var(--dur-2) var(--ease); }
.toggle input:checked + i { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + i::after { transform: translateX(12px); background: var(--on-accent); }
.toggle input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ indicators */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--text-3); }
.s-critical { background: var(--critical); }
.s-high { background: var(--high); }
.s-medium { background: var(--medium); }
.s-low { background: var(--low); }
.s-nominal { background: var(--nominal); }
.s-unknown { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-3); }
.status-cell { display: inline-flex; align-items: center; gap: 6px; text-transform: capitalize; color: var(--text-2); }
.sev { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); white-space: nowrap; }
.sev::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
.sev.critical { color: var(--critical); }
.sev.high { color: var(--high); }
.sev.medium { color: var(--medium); }
.sev.low { color: var(--low); }
.sev.nominal { color: var(--nominal); }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 6px; border-radius: var(--r1); font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); background: var(--surface-3); white-space: nowrap; vertical-align: middle; }
.tag.ok { color: #9be3c0; background: rgba(79, 191, 139, 0.12); }
.tag.warn { color: #f3d27a; background: rgba(221, 191, 76, 0.12); }
.tag.err { color: #ffb4b9; background: rgba(239, 90, 100, 0.12); }
.tag.cyan, .tag.accent { color: var(--accent-strong); background: var(--accent-weak); }
.tag.sim { color: #cdbcff; background: rgba(167, 139, 240, 0.14); }
.tag.demo { color: var(--text-2); background: var(--surface-3); }
.tag.dashed { background: transparent; box-shadow: inset 0 0 0 1px var(--border-strong); }
.trend { font-size: var(--fs-xs); color: var(--text-3); }
.meter { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; display: block; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width var(--dur-3) var(--ease); }
.progress { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin: var(--s2) 0; }
.progress i { display: block; height: 100%; background: var(--sim); transition: width var(--dur-3) linear; }
.link { font-size: var(--fs-sm); }
.spark { width: 100%; height: 28px; display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.spark path.area { fill: var(--accent-weak); stroke: none; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow: auto; border-radius: var(--r2); }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
table.grid th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-1); text-align: left; font-weight: 500; font-size: var(--fs-sm);
  color: var(--text-3); padding: 0 var(--s3); height: 32px; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none;
}
table.grid th[data-sort] { cursor: pointer; }
table.grid.wrap-head th { white-space: normal; height: auto; padding-top: 6px; padding-bottom: 6px; line-height: 1.25; }
table.grid th.num { text-align: right; }
table.grid th[data-sort]:hover { color: var(--text); }
table.grid th .arrow { color: var(--accent); font-size: 9px; margin-left: 2px; }
table.grid td { padding: 0 var(--s3); height: 36px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--text); }
table.grid td .muted.small, table.grid td .small.muted { line-height: 1.3; }
table.grid tbody tr { transition: background var(--dur-1) var(--ease); }
table.grid tbody tr:hover { background: var(--hover); }
table.grid tbody tr[data-id], table.grid tbody tr[data-win], table.grid tbody tr[data-st] { cursor: pointer; }
table.grid tbody tr.sel { background: var(--accent-weak); box-shadow: inset 2px 0 0 var(--accent); }
table.grid tbody tr.checked:not(.sel) { background: rgba(255, 255, 255, 0.025); }
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid td.wrap { white-space: normal; padding-top: 6px; padding-bottom: 6px; }
.row-menu { position: relative; width: 36px; }
.row-menu .icon-btn { opacity: 0; transition: opacity var(--dur-1); }
tr:hover .row-menu .icon-btn, tr.sel .row-menu .icon-btn, .row-menu .icon-btn:focus-visible { opacity: 1; }
.row-menu .menu { right: 4px; top: 30px; }
.star { color: var(--text-3); background: none; border: 0; padding: 0; width: 20px; height: 20px; display: inline-grid; place-items: center; }
.star svg { width: 14px; height: 14px; }
.star.on { color: var(--medium); }
.star.on svg { fill: currentColor; }
.star:hover { color: var(--text); }
.kv { display: grid; grid-template-columns: minmax(104px, auto) 1fr; gap: 5px var(--s3); margin: var(--s2) 0; font-size: var(--fs-md); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.kv.wide { grid-template-columns: 140px 1fr; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { display: flex; align-items: center; gap: var(--s2); padding: 6px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list-plain li:last-child { border-bottom: 0; }
.scroll-list { max-height: 300px; overflow: auto; }
.evidence, .tle { font-family: var(--mono); font-size: var(--fs-sm); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r2); padding: var(--s2) var(--s3); color: var(--text-2); max-height: 200px; overflow: auto; }

/* ------------------------------------------------------------ menus, dialogs, toasts */
.menu-wrap { position: relative; }
.menu {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 210px; max-height: 420px; overflow: auto;
  background: var(--surface-2); border-radius: var(--r3); box-shadow: var(--shadow); padding: var(--s1);
  animation: pop var(--dur-2) var(--ease-out);
}
.menu.right { left: auto; right: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } }
.menu button, .menu label, .menu a {
  display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 30px; padding: 4px var(--s2); border: 0; background: none;
  color: var(--text); text-align: left; border-radius: var(--r1); font-size: var(--fs-md); cursor: pointer; text-decoration: none !important;
}
.menu button:hover, .menu label:hover, .menu a:hover { background: var(--hover); }
.menu button.on { color: var(--accent-strong); }
.menu .danger { color: #ffb4b9; }
.menu-title { padding: var(--s2) var(--s2) 4px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: var(--s1) 0; }
.menu .menu-search { padding: var(--s1); }
.menu .menu-search input { width: 100%; }
.menu-note { padding: 4px var(--s2) var(--s2); font-size: var(--fs-xs); color: var(--text-3); }
.account-head { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s2); }
.account-head b { display: block; font-weight: 600; }
.account-menu { width: 280px; }
dialog.dlg {
  border: 0; border-radius: var(--r3); padding: var(--s5); width: min(560px, calc(100vw - 32px)); background: var(--surface-2);
  color: var(--text); box-shadow: var(--shadow);
}
dialog.dlg[open] { animation: dlg-in var(--dur-3) var(--ease-out); }
dialog.dlg::backdrop { background: rgba(3, 6, 9, 0.6); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s4); }
.dlg-head h3 { margin: 0; font-size: var(--fs-xl); font-weight: 600; }
.dlg .x { background: none; border: 0; font-size: 20px; color: var(--text-3); width: 28px; height: 28px; border-radius: var(--r1); }
.dlg .x:hover { background: var(--hover); color: var(--text); }
.dlg label { display: flex; flex-direction: column; gap: 4px; margin: var(--s3) 0; color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.dlg label.check { flex-direction: row; }
.dlg input:not([type="checkbox"]), .dlg textarea, .dlg select { height: var(--control); padding: 0 var(--s2); border-radius: var(--r2); border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text); }
.dlg textarea { height: auto; padding: var(--s2); font-family: var(--mono); font-size: var(--fs-sm); }
.dlg-actions { display: flex; justify-content: flex-end; gap: var(--s2); margin-top: var(--s5); }
.add-mode { margin-bottom: var(--s2); }
.cat-results { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r2); }
.cat-results button { display: grid; grid-template-columns: 70px 1fr auto; gap: var(--s2); align-items: center; width: 100%; padding: 6px var(--s2); background: none; border: 0; border-bottom: 1px solid var(--border); text-align: left; color: var(--text); }
.cat-results button:hover:not(:disabled) { background: var(--hover); }
.toasts { position: fixed; right: var(--s4); bottom: var(--s4); display: flex; flex-direction: column; gap: var(--s2); z-index: 60; pointer-events: none; }
.toast {
  pointer-events: auto; min-width: 260px; max-width: 420px; padding: var(--s3) var(--s4); border-radius: var(--r3); background: var(--surface-3);
  box-shadow: var(--shadow); color: var(--text); font-size: var(--fs-md); display: flex; gap: var(--s2); align-items: flex-start;
  animation: toast-in var(--dur-3) var(--ease-out);
}
.toast.err { box-shadow: var(--shadow), inset 3px 0 0 var(--danger); }
.toast.alert { cursor: pointer; }
.toast .sev { margin-top: 2px; }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity var(--dur-2), transform var(--dur-2); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ------------------------------------------------------------ overview layout */
.kpis { display: flex; align-items: stretch; gap: 0; border-bottom: 1px solid var(--border); background: var(--surface-1); flex: none; overflow-x: auto; }
.kpi { display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: var(--s2) var(--s5); min-width: 170px; border-right: 1px solid var(--border); }
.kpi:last-child { border-right: 0; }
.kpi-label { font-size: var(--fs-xs); color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.kpi-value { font-size: var(--fs-2xl); font-weight: 600; line-height: 1.15; display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.kpi-value small { font-size: var(--fs-sm); font-weight: 400; color: var(--text-3); }
.kpi-sev { display: flex; gap: var(--s3); font-size: var(--fs-sm); color: var(--text-2); }
.kpi-sev span { display: inline-flex; align-items: center; gap: 4px; }
.kpi-sev .dot { width: 6px; height: 6px; }
.kpi.button-like { cursor: pointer; }
.kpi.button-like:hover { background: var(--hover); }
.kpi-spacer { flex: 1; border-right: 0; }
.kpi .flash { animation: value-flash 900ms var(--ease); }
@keyframes value-flash { 0% { color: var(--accent-strong); } 100% { color: inherit; } }

.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--left-w, 248px) minmax(0, 1fr) var(--right-w, 340px); position: relative; }
.workspace.left-collapsed { grid-template-columns: 36px minmax(0, 1fr) var(--right-w, 340px); }
.workspace.right-none { grid-template-columns: var(--left-w, 248px) minmax(0, 1fr) 0; }
.workspace.left-collapsed.right-none { grid-template-columns: 36px minmax(0, 1fr) 0; }
.side { min-height: 0; overflow: auto; background: var(--surface-1); display: flex; flex-direction: column; position: relative; }
.side-left { border-right: 1px solid var(--border); }
.side-right { border-left: 1px solid var(--border); }
.side-tools { display: flex; align-items: center; justify-content: space-between; padding: var(--s2) var(--s2) var(--s2) var(--s4); border-bottom: 1px solid var(--border); min-height: 40px; }
.side-tools h2 { margin: 0; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.left-collapsed .side-left .side-tools { padding: var(--s2) 6px; justify-content: center; }
.left-collapsed .side-left .side-tools h2, .left-collapsed .side-left .side-body, .left-collapsed .side-left .panels-btn { display: none; }
.collapse-btn svg { transition: transform var(--dur-2) var(--ease); }
.left-collapsed .collapse-btn svg { transform: rotate(180deg); }
.side-body { flex: 1; min-height: 0; }
.sect { border-bottom: 1px solid var(--border); }
.sect > summary, .sect-head {
  list-style: none; display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s3) 0 var(--s4); height: 38px; cursor: pointer;
  font-weight: 600; font-size: var(--fs-md); color: var(--text); user-select: none;
}
.sect > summary::-webkit-details-marker { display: none; }
.sect > summary .chev { margin-left: auto; color: var(--text-3); transition: transform var(--dur-2) var(--ease); }
.sect:not([open]) > summary .chev { transform: rotate(-90deg); }
.sect > summary:hover { background: var(--hover); }
.sect > summary .meta { font-weight: 400; color: var(--text-3); font-size: var(--fs-sm); }
.sect-body { padding: 0 var(--s4) var(--s3); }
.sect[open] .sect-body { animation: sect-in var(--dur-2) var(--ease-out); }
@keyframes sect-in { from { opacity: 0; transform: translateY(-3px); } }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: flex; align-items: center; gap: var(--s2); height: 30px; padding: 0 var(--s2); margin: 0 calc(var(--s2) * -1); border-radius: var(--r1); cursor: pointer; color: var(--text-2); }
.rows li:hover { background: var(--hover); color: var(--text); }
.rows li b { margin-left: auto; font-weight: 600; color: var(--text); }
.rows li.on { background: var(--accent-weak); color: var(--text); }
.rows li.off { opacity: 0.5; }
.rows li .meter { flex: 1; margin: 0 var(--s2); }
.orbit-rows li span:first-child { width: 36px; font-family: var(--mono); font-size: var(--fs-sm); }
.source-rows { list-style: none; margin: 0; padding: 0; }
.source-rows li { display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s2); padding: 6px 0; font-size: var(--fs-sm); color: var(--text-2); }
.source-rows li b { font-weight: 600; color: var(--text); }
.source-rows .meter { grid-column: 1 / -1; }
.resizer { position: absolute; z-index: 5; background: transparent; touch-action: none; }
.resizer.v { top: 0; bottom: 0; width: 7px; cursor: col-resize; }
.resizer.h { left: 0; right: 0; height: 7px; cursor: row-resize; top: -4px; }
.resizer:hover::after, .resizer.dragging::after { content: ""; position: absolute; background: var(--accent-line); }
.resizer.v:hover::after, .resizer.v.dragging::after { top: 0; bottom: 0; left: 3px; width: 1px; }
.resizer.h:hover::after, .resizer.h.dragging::after { left: 0; right: 0; top: 3px; height: 1px; }
.side-left > .resizer { right: -4px; }
.side-right > .resizer { left: -4px; }
.left-collapsed .side-left > .resizer { display: none; }

/* globe */
.globe-area { position: relative; min-width: 0; min-height: 0; background: radial-gradient(ellipse at 50% 45%, #0e1620 0%, var(--bg) 70%); overflow: hidden; }
.globe-stage { position: absolute; inset: 0; }
.globe-stage canvas, .map-stage canvas { position: absolute; inset: 0; display: block; cursor: grab; touch-action: none; }
.globe-stage canvas:active { cursor: grabbing; }
.globe-toolbar { position: absolute; top: var(--s3); left: var(--s3); right: var(--s3); display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; z-index: 6; pointer-events: none; }
.globe-toolbar > * { pointer-events: auto; }
.tool {
  height: var(--control); display: inline-flex; align-items: center; gap: 6px; padding: 0 var(--s3); border-radius: var(--r2);
  border: 1px solid var(--border-strong); background: rgba(15, 20, 26, 0.92); color: var(--text-2); font-weight: 500; white-space: nowrap;
}
.tool:hover, .tool[aria-expanded="true"] { color: var(--text); background: var(--surface-3); }
.tool .badge { min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: var(--on-accent); font-size: 10px; display: inline-grid; place-items: center; padding: 0 4px; font-weight: 700; }
.globe-toolbar .seg { background: rgba(15, 20, 26, 0.92); }
.globe-toolbar .spacer { flex: 1; }
.view-label { font-size: var(--fs-sm); color: var(--text-3); padding: 0 var(--s2); pointer-events: none; }
.zoom-tools { position: absolute; right: var(--s3); bottom: var(--s3); display: flex; flex-direction: column; border: 1px solid var(--border-strong); border-radius: var(--r2); overflow: hidden; background: rgba(15, 20, 26, 0.92); z-index: 6; }
.zoom-tools button { width: 32px; height: 32px; border: 0; background: none; color: var(--text-2); display: grid; place-items: center; font-size: 16px; }
.zoom-tools button + button { border-top: 1px solid var(--border-strong); }
.zoom-tools button:hover { background: var(--surface-3); color: var(--text); }
.zoom-tools button.on { color: var(--accent); background: var(--accent-weak); }
.legend { position: absolute; left: var(--s3); bottom: var(--s3); z-index: 6; display: flex; flex-wrap: wrap; gap: 4px var(--s3); align-items: center; max-width: calc(100% - 80px); padding: 6px var(--s3); border-radius: var(--r2); background: rgba(15, 20, 26, 0.88); border: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.legend i { display: inline-block; flex: none; }
.lg-sat { width: 7px; height: 7px; border-radius: 50%; background: #dfe8ef; }
.lg-gs { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-bottom: 7px solid var(--nominal); }
.lg-pred { width: 16px; border-top: 1.5px dashed var(--accent-strong); }
.lg-conf { width: 16px; border-top: 2px solid var(--nominal); }
.lg-orbit { width: 16px; border-top: 1.5px solid var(--accent); }
.legend-note { color: var(--text-3); }
.legend .lg-toggle { background: none; border: 0; color: var(--text-3); padding: 0; font-size: var(--fs-xs); }
.legend .lg-toggle:hover { color: var(--text); }
.hover-tip { position: absolute; z-index: 8; pointer-events: none; padding: 4px var(--s2); border-radius: var(--r1); background: var(--surface-3); box-shadow: var(--shadow); font-size: var(--fs-sm); white-space: nowrap; }
.globe-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 4; text-align: center; color: var(--text-3); pointer-events: none; }
.motion-note { position: absolute; top: 52px; left: var(--s3); z-index: 6; font-size: var(--fs-xs); color: var(--text-3); background: rgba(15, 20, 26, 0.88); border: 1px solid var(--border); border-radius: var(--r1); padding: 2px 6px; }

/* inspector */
.side-right { overflow: hidden; }
.right-stack { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.inspector { flex: 1 1 auto; min-height: 0; overflow: auto; border-bottom: 1px solid var(--border); animation: slide-in var(--dur-3) var(--ease-out); }
.inspector + .alerts-sect { flex: 0 1 auto; max-height: 38%; }
.alerts-sect { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.alerts-sect > .sect-head { flex: none; border-bottom: 1px solid var(--border); cursor: default; }
.alerts-sect.collapsed > .live-alerts { display: none; }
.alerts-sect.collapsed { flex: none; }
@keyframes slide-in { from { opacity: 0; transform: translateX(10px); } }
.ins-head { position: sticky; top: 0; z-index: 2; background: var(--surface-1); padding: var(--s3) var(--s3) var(--s2) var(--s4); border-bottom: 1px solid var(--border); }
.ins-kind { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); display: flex; align-items: center; gap: var(--s2); }
.ins-title { display: flex; align-items: center; gap: var(--s2); margin-top: 2px; }
.ins-title h3 { margin: 0; font-size: var(--fs-xl); font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ins-sub { color: var(--text-3); font-size: var(--fs-sm); margin-top: 2px; display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.ins-body { padding: var(--s3) var(--s4) var(--s4); }
.ins-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin-bottom: var(--s3); }
.ins-metrics div { background: var(--surface-2); border-radius: var(--r2); padding: 6px var(--s2); min-width: 0; }
.ins-metrics span { display: block; font-size: var(--fs-xs); color: var(--text-3); }
.ins-metrics b { display: block; font-weight: 600; font-size: var(--fs-lg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ins-metrics b small { font-weight: 400; font-size: var(--fs-xs); color: var(--text-3); }
.ins-actions { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s3); }
.disclose { border-top: 1px solid var(--border); }
.disclose > summary { list-style: none; display: flex; align-items: center; gap: var(--s2); height: 36px; cursor: pointer; font-weight: 600; color: var(--text); user-select: none; }
.disclose > summary::-webkit-details-marker { display: none; }
.disclose > summary .meta { font-weight: 400; color: var(--text-3); font-size: var(--fs-sm); }
.disclose > summary .chev { margin-left: auto; color: var(--text-3); transition: transform var(--dur-2) var(--ease); }
.disclose:not([open]) > summary .chev { transform: rotate(-90deg); }
.disclose > summary:hover { color: var(--accent-strong); }
.disclose[open] > :not(summary) { animation: sect-in var(--dur-2) var(--ease-out); }
.disclose-body { padding-bottom: var(--s3); }
.cw-list { list-style: none; margin: 0; padding: 0; }
.cw-list li { padding: var(--s2) var(--s2); margin: 0 calc(var(--s2) * -1); border-radius: var(--r2); cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px var(--s2); }
.cw-list li:hover { background: var(--hover); }
.cw-list li.on { background: var(--accent-weak); box-shadow: inset 2px 0 0 var(--accent); }
.cw-list li.live { box-shadow: inset 2px 0 0 var(--nominal); }
.cw-list .cw-meta { grid-column: 1 / -1; font-size: var(--fs-sm); color: var(--text-3); font-family: var(--mono); }
.cw-list .cw-station { font-weight: 500; }
.live-alerts { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; min-height: 0; }
.live-alerts li { display: grid; grid-template-columns: 66px 1fr auto; gap: var(--s2); align-items: start; padding: var(--s2) var(--s3) var(--s2) var(--s4); border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--dur-1); }
.live-alerts li:hover { background: var(--hover); }
.live-alerts li.on { background: var(--accent-weak); }
.live-alerts li.fresh { animation: alert-in 700ms var(--ease-out); }
@keyframes alert-in { from { background: rgba(76, 176, 217, 0.16); } }
.live-alerts .sev { padding-top: 2px; }
.a-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.a-sub { font-size: var(--fs-sm); color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.a-when { text-align: right; font-size: var(--fs-sm); color: var(--text-3); display: flex; flex-direction: column; align-items: flex-end; gap: 2px; white-space: nowrap; }

/* registry dock */
.dock { flex: none; border-top: 1px solid var(--border); background: var(--surface-1); display: flex; flex-direction: column; position: relative; height: var(--dock-h, 280px); transition: height var(--dur-3) var(--ease); }
.dock.dragging { transition: none; }
.dock.minimized { height: 42px !important; }
.dock.minimized .dock-body, .dock.minimized .resizer { display: none; }
.dock-head { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s3) 0 var(--s4); height: 42px; flex: none; border-bottom: 1px solid var(--border); }
.dock.minimized .dock-head { border-bottom: 0; }
.dock-head h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; display: flex; align-items: center; gap: var(--s2); white-space: nowrap; }
.dock-head .count { color: var(--text-3); font-weight: 400; font-size: var(--fs-sm); white-space: nowrap; }
.dock-tools { display: flex; align-items: center; gap: var(--s2); margin-left: auto; }
.dock-tools .search input { width: 200px; height: var(--control-sm); }
.dock-tools .inp, .dock-tools .btn, .dock-tools .seg button { height: var(--control-sm); }
.dock-tools .seg button { height: calc(var(--control-sm) - 2px); padding: 0 var(--s2); font-size: var(--fs-sm); }
.dock-body { flex: 1; min-height: 0; overflow: auto; }
.dock-body table.grid th { background: var(--surface-1); }
.dock-body table.grid td:first-child, .dock-body table.grid th:first-child { padding-left: var(--s4); width: 36px; }
.filter-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 4px 0 8px; border-radius: 11px; background: var(--accent-weak); color: var(--accent-strong); font-size: var(--fs-xs); border: 0; }
.filter-chip:hover { background: rgba(76, 176, 217, 0.24); }
.problems { padding: var(--s2) var(--s4); font-size: var(--fs-sm); color: var(--text-3); border-top: 1px solid var(--border); }

/* ------------------------------------------------------------ satellites */
.sat-layout { display: grid; grid-template-columns: minmax(420px, 0.85fr) minmax(0, 1.4fr); gap: var(--s4); align-items: start; }
.sat-list { position: sticky; top: calc(var(--topbar) + var(--s4)); max-height: calc(100vh - var(--topbar) - 120px); display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.sat-list .table-wrap { flex: 1; }
.reg-head { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--border); }
.reg-head h3 { margin: 0; font-size: var(--fs-md); font-weight: 600; display: flex; gap: var(--s2); align-items: center; }
.reg-count { color: var(--text-3); font-size: var(--fs-sm); }
.reg-count b { color: var(--text); font-weight: 600; }
.reg-tools { display: flex; gap: var(--s2); align-items: center; margin-left: auto; flex-wrap: wrap; }
.reg-tools .search input { width: 200px; }
.sat-detail { padding: var(--s4) var(--s5); }
.det-head { display: flex; justify-content: space-between; gap: var(--s4); align-items: flex-start; flex-wrap: wrap; margin-bottom: var(--s4); }
.det-head h2 { margin: 0 0 2px; font-size: var(--fs-2xl); font-weight: 600; display: flex; align-items: center; gap: var(--s3); }
.det-head h2 .status-cell { font-size: var(--fs-md); font-weight: 500; }
.det-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.det-card { background: var(--surface-2); border-radius: var(--r3); padding: var(--s3) var(--s4); min-width: 0; }
.det-card h3 { margin: 0 0 var(--s2); font-size: var(--fs-md); font-weight: 600; }
.det-card.span2 { grid-column: span 2; }
.det-card.span3 { grid-column: 1 / -1; }
.det-card table.grid th { background: var(--surface-2); }
.mini-chart { height: 200px; }

/* ------------------------------------------------------------ passes */
.pass-controls { display: flex; gap: var(--s4); align-items: flex-end; flex-wrap: wrap; margin-bottom: var(--s4); }
.pass-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--s4); margin-bottom: var(--s4); }
.pass-map { display: flex; flex-direction: column; }
.map-stage { position: relative; height: 320px; border-radius: var(--r2); overflow: hidden; background: var(--bg); }
.pass-layout2 { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, 0.8fr); gap: var(--s4); }
.gantt { height: 220px; }
.sky { height: 300px; }
.summary-line { display: flex; gap: var(--s2); flex-wrap: wrap; margin: var(--s1) 0 var(--s3); }
.summary-line div { background: var(--surface-2); border-radius: var(--r2); padding: 6px var(--s3); min-width: 110px; }
.summary-line b { display: block; font-size: var(--fs-xl); font-weight: 600; }
.summary-line span { font-size: var(--fs-xs); color: var(--text-3); }

/* ------------------------------------------------------------ alerts */
.alert-filters { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--s4); }
.chipset { display: flex; gap: 4px; }
.chipset button { display: inline-flex; align-items: center; gap: 6px; height: var(--control); padding: 0 var(--s2); border-radius: var(--r2); border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text-3); text-transform: capitalize; font-size: var(--fs-md); }
.chipset button.on { color: var(--text); background: var(--surface-3); }
.chipset button b { font-weight: 600; }
.alert-layout { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: var(--s4); align-items: start; }
#alert-table { padding: 0; overflow: hidden; }
.alert-detail { position: sticky; top: calc(var(--topbar) + var(--s4)); max-height: calc(100vh - var(--topbar) - 40px); overflow: auto; }
.alert-detail h2 { font-size: var(--fs-xl); margin: var(--s2) 0 var(--s1); font-weight: 600; }

/* ------------------------------------------------------------ events */
.events-page:not([hidden]) { display: flex; flex-direction: column; flex: 1; min-height: 0; padding-bottom: var(--s4); }
.events-page .page-head { margin-bottom: var(--s3); }
.events-bar { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.explorer-frame { flex: 1; width: 100%; min-height: 560px; border: 1px solid var(--border); border-radius: var(--r3); background: var(--bg); }
.src-pill { display: inline-flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--text-3); }
.src-pill select { height: var(--control-sm); border-radius: var(--r1); border: 1px solid var(--border-strong); background: var(--surface-1); color: var(--text); padding: 0 var(--s2); }

/* ------------------------------------------------------------ simulator */
.sim-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: var(--s4); align-items: start; }
#sim-config { position: sticky; top: calc(var(--topbar) + var(--s4)); max-height: calc(100vh - var(--topbar) - 40px); overflow: auto; }
.sim-main { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.sim-state { display: flex; gap: var(--s3); align-items: center; }
.sim-chart { height: 640px; }
.sim-bottom { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: var(--s4); }
.sim-buttons { display: flex; gap: var(--s2); flex-wrap: wrap; margin-top: var(--s4); }
/* Row 1: scenario picker and remove button; row 2: start, length, severity and a wider pattern column. */
.anom { background: var(--surface-2); border-radius: var(--r2); padding: var(--s2); margin-bottom: var(--s2); display: grid; grid-template-columns: repeat(3, minmax(0, 0.9fr)) minmax(0, 1.3fr) auto; gap: 6px; align-items: end; }
.anom > select { grid-column: 1 / 5; }
.anom .field { margin: 0 !important; }
.anom .inp { height: 26px; width: 100%; min-width: 0; }
.anom > * { min-width: 0; }

/* ------------------------------------------------------------ documents */
.doc-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: var(--s4); align-items: start; }
#doc-tree { position: sticky; top: calc(var(--topbar) + var(--s4)); max-height: calc(100vh - var(--topbar) - 40px); overflow: auto; }
#doc-tree .search input { width: 100%; }
.doc-group h4 { margin: var(--s4) 0 var(--s1); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.doc-group button { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: 30px; padding: 4px var(--s2); border: 0; background: none; color: var(--text-2); text-align: left; border-radius: var(--r1); }
.doc-group button span:nth-child(2) { flex: 1; }
.doc-group button:hover { background: var(--hover); color: var(--text); }
.doc-group button.on { background: var(--accent-weak); color: var(--text); }
.doc-view { padding: var(--s4) var(--s6) var(--s6); }
.md { max-width: 860px; line-height: 1.6; font-size: var(--fs-lg); color: var(--text); }
.md h1 { font-size: 24px; margin: var(--s2) 0 var(--s3); font-weight: 600; }
.md h2 { font-size: 18px; margin: var(--s6) 0 var(--s2); font-weight: 600; padding-bottom: var(--s1); border-bottom: 1px solid var(--border); }
.md h3 { font-size: 15px; margin: var(--s4) 0 var(--s1); font-weight: 600; }
.md code { background: var(--surface-3); padding: 1px 4px; border-radius: 3px; }
.md pre { background: var(--surface-2); border-radius: var(--r2); padding: var(--s3); overflow: auto; }
.md pre code { background: none; padding: 0; }
.md table { border-collapse: collapse; margin: var(--s3) 0; font-size: var(--fs-md); display: block; overflow: auto; }
.md th, .md td { border-bottom: 1px solid var(--border); padding: 6px var(--s3); text-align: left; vertical-align: top; }
.md th { color: var(--text-3); font-weight: 500; }
.md blockquote { border-left: 2px solid var(--border-strong); margin: var(--s2) 0; padding: 2px var(--s3); color: var(--text-2); }
.pdf-frame { width: 100%; height: calc(100vh - 230px); border: 1px solid var(--border); border-radius: var(--r2); background: var(--surface-2); }

/* ------------------------------------------------------------ account and settings */
.settings-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--s6); align-items: start; max-width: 1180px; }
.settings-nav { position: sticky; top: calc(var(--topbar) + var(--s4)); display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { padding: 6px var(--s3); border-radius: var(--r2); color: var(--text-2); text-decoration: none !important; }
.settings-nav a:hover { background: var(--hover); color: var(--text); }
.settings-nav a.on { background: var(--surface-3); color: var(--text); }
.settings-nav .nav-label { padding: var(--s3) var(--s3) 4px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.settings-main { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.set-card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r3); }
.set-card > h2 { margin: 0; padding: var(--s4) var(--s5) 0; font-size: var(--fs-xl); font-weight: 600; }
.set-card > p.desc { margin: 4px var(--s5) 0; color: var(--text-3); }
.set-rows { padding: var(--s2) var(--s5) var(--s4); }
.set-row { display: grid; grid-template-columns: minmax(180px, 280px) minmax(0, 1fr); gap: var(--s4); align-items: center; padding: var(--s3) 0; border-bottom: 1px solid var(--border); }
.set-row:last-child { border-bottom: 0; }
.set-row > div:first-child b { display: block; font-weight: 500; }
.set-row > div:first-child span { display: block; color: var(--text-3); font-size: var(--fs-sm); }
.set-row .ctl { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.set-row .ctl .inp { min-width: 220px; }
.profile-head { display: flex; gap: var(--s4); align-items: center; padding: var(--s5); }
.profile-head h2 { margin: 0; font-size: var(--fs-xl); font-weight: 600; }
.codes { display: grid; grid-template-columns: repeat(2, max-content); gap: 4px var(--s5); font-family: var(--mono); font-size: var(--fs-lg); background: var(--surface-2); border-radius: var(--r2); padding: var(--s3) var(--s4); margin: var(--s2) 0; }
.qr { background: #fff; border-radius: var(--r2); padding: var(--s2); width: 176px; height: 176px; }
.qr img { width: 100%; height: 100%; display: block; }
.mfa-setup { display: flex; gap: var(--s5); align-items: flex-start; flex-wrap: wrap; padding: var(--s3) 0; }
.copy-row { display: flex; gap: var(--s2); align-items: center; }
.copy-row input { flex: 1; font-family: var(--mono); font-size: var(--fs-sm); }
.audit-table td.wrap { max-width: 420px; }

/* ------------------------------------------------------------ sign-in */
body.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 520px); background: var(--bg); }
.auth-aside { position: relative; overflow: hidden; border-right: 1px solid var(--border); background: radial-gradient(ellipse at 30% 60%, #0f1823 0%, var(--bg) 70%); display: flex; flex-direction: column; justify-content: space-between; padding: var(--s8); }
.auth-aside svg.art { position: absolute; right: -12%; bottom: -18%; width: 78%; height: auto; color: var(--accent); opacity: 0.55; stroke-width: 0.6; }
.auth-aside .brand { z-index: 1; }
.auth-aside .claim { z-index: 1; max-width: 460px; }
.auth-aside .claim h1 { font-size: 28px; font-weight: 600; margin: 0 0 var(--s2); letter-spacing: -0.01em; }
.auth-aside .claim p { color: var(--text-2); margin: 0; font-size: var(--fs-lg); }
.auth-aside .fine { z-index: 1; color: var(--text-3); font-size: var(--fs-sm); }
.auth-main { display: flex; align-items: center; justify-content: center; padding: var(--s8) var(--s6); }
.auth-card { width: 100%; max-width: 380px; animation: page-in var(--dur-3) var(--ease-out); }
.auth-card h2 { margin: 0 0 4px; font-size: var(--fs-2xl); font-weight: 600; }
.auth-card .lead { margin: 0 0 var(--s5); color: var(--text-3); }
.auth-card .field { margin-bottom: var(--s3); color: var(--text-2); }
.auth-card .field + .field { margin-top: 0; }
.auth-card .inp { height: 36px; width: 100%; font-size: var(--fs-lg); }
.auth-card .btn.primary { height: 36px; width: 100%; margin-top: var(--s2); font-size: var(--fs-lg); }
.auth-links { display: flex; justify-content: space-between; margin-top: var(--s4); font-size: var(--fs-sm); }
.auth-links a { cursor: pointer; }
.auth-msg { padding: var(--s2) var(--s3); border-radius: var(--r2); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); margin-bottom: var(--s3); }
.auth-msg.err { box-shadow: inset 3px 0 0 var(--danger); color: #ffc6ca; }
.auth-msg.ok { box-shadow: inset 3px 0 0 var(--nominal); }
.pw-meter { height: 3px; border-radius: 2px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.pw-meter i { display: block; height: 100%; width: 0; background: var(--high); transition: width var(--dur-2), background var(--dur-2); }
.code-input { letter-spacing: 0.3em; font-family: var(--mono); text-align: center; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1500px) {
  .brand-sub { display: none; }
}
@media (max-width: 1280px) {
  .workspace, .workspace.left-collapsed, .workspace.right-none { grid-template-columns: minmax(0, 1fr) var(--right-w, 320px); }
  .side-left { display: none; }
  .sat-layout, .alert-layout, .pass-layout, .pass-layout2, .sim-layout, .doc-layout { grid-template-columns: 1fr; }
  .sat-list, .alert-detail, #sim-config, #doc-tree { position: static; max-height: none; }
  .det-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock { display: none; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; height: auto; padding: var(--s2) var(--s3) 0; gap: var(--s2); }
  .nav { order: 3; flex-basis: 100%; height: 40px; }
  .top-right { margin-left: auto; }
  main#view, .page[data-page="overview"] { flex: none; min-height: 0; overflow: visible; }
  .workspace, .workspace.left-collapsed, .workspace.right-none { display: flex; flex-direction: column; flex: none; }
  .globe-area { flex: none; }
  .globe-area { height: 62vh; min-height: 380px; }
  .side-right { border-left: 0; border-top: 1px solid var(--border); max-height: none; overflow: visible; }
  .side-right > .resizer { display: none; }
  .inspector { max-height: none; }
  .live-alerts { max-height: 340px; }
  .dock { height: auto !important; max-height: none; }
  .dock .resizer { display: none; }
  .dock-head { flex-wrap: wrap; height: auto; padding: var(--s2) var(--s3); }
  .dock-tools { flex-wrap: wrap; margin-left: 0; }
  .dock-body { max-height: 420px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .set-row { grid-template-columns: 1fr; }
  body.auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 640px) {
  .page { padding: var(--s3); }
  /* A long label (e.g. "Start investigation with the 10 satellites in these results") wraps instead of widening the page. */
  .btn { max-width: 100%; white-space: normal; height: auto; min-height: var(--control); padding-top: 4px; padding-bottom: 4px; text-align: center; }
  .kpi { min-width: 140px; padding: var(--s2) var(--s3); }
  .det-grid { grid-template-columns: 1fr; }
  .det-card.span2 { grid-column: auto; }
  .avatar-btn .who { display: none; }
  .freshness span.txt { display: none; }
  .search input, .dock-tools .search input, .reg-tools .search input { width: 100%; }
  .globe-toolbar .view-label { display: none; }
  .legend { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html:not(.motion-full) *, html:not(.motion-full) *::before, html:not(.motion-full) *::after {
    animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important;
  }
}

/* ------------------------------------------------------------ status model (Up / Limited / Down / Unknown) */
:root { --st-up: var(--nominal); --st-limited: var(--medium); --st-down: var(--critical); --st-unknown: var(--text-3); }
.s-up { background: var(--st-up); }
.s-limited { background: transparent; box-shadow: inset 0 0 0 2px var(--st-limited); }
.s-down { background: transparent; position: relative; }
.s-down::before, .s-down::after { content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 2px; background: var(--st-down); border-radius: 1px; }
.s-down::before { transform: translate(-50%, -50%) rotate(45deg); }
.s-down::after { transform: translate(-50%, -50%) rotate(-45deg); }
.status-cell.st-down { color: #ffb4b9; }
.status-cell.st-limited { color: #f3d27a; }
.lg-down { width: 9px; height: 9px; position: relative; }
.lg-down::before, .lg-down::after { content: ""; position: absolute; left: 0; top: 4px; width: 9px; height: 1.5px; background: var(--st-down); }
.lg-down::before { transform: rotate(45deg); }
.lg-down::after { transform: rotate(-45deg); }
.lg-limited { width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--st-limited); }

/* demo mode */
.demo-flag { height: 22px; padding: 0 8px; border-radius: 11px; border: 1px solid rgba(167, 139, 240, 0.55); background: transparent; color: #cdbcff; font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.demo-flag:hover { background: rgba(167, 139, 240, 0.12); }

/* ------------------------------------------------------------ events explorer (satellite SIEM) */
.ex-head-tools { display: flex; gap: var(--s2); align-items: center; }
#ex-root { display: flex; flex-direction: column; gap: var(--s4); }
.ex-sect { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r3); }
.ex-sect > summary { list-style: none; display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s4); height: 46px; cursor: pointer; user-select: none; }
.ex-sect > summary::-webkit-details-marker { display: none; }
.ex-sect > summary h2 { margin: 0; font-size: var(--fs-lg); font-weight: 600; }
.ex-sect > summary .meta { color: var(--text-3); font-size: var(--fs-sm); }
.ex-sect > summary .chev { margin-left: auto; color: var(--text-3); transition: transform var(--dur-2) var(--ease); }
.ex-sect:not([open]) > summary .chev { transform: rotate(-90deg); }
.ex-sect > summary:hover { background: var(--hover); border-radius: var(--r3); }
.ex-body { padding: 0 var(--s4) var(--s4); }
.ex-sect[open] > .ex-body { animation: sect-in var(--dur-2) var(--ease-out); }
.status-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.stile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--r3); padding: var(--s3) var(--s4); display: flex; flex-direction: column; gap: 2px; text-align: left; color: var(--text); }
button.stile { cursor: pointer; }
button.stile:hover { background: var(--surface-2); }
button.stile.on { box-shadow: inset 0 0 0 1px var(--accent-line); background: var(--accent-weak); }
.stile .lbl { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); color: var(--text-2); }
.stile .val { font-size: 28px; font-weight: 600; line-height: 1.1; }
.stile .sub { font-size: var(--fs-xs); color: var(--text-3); }
.stile .big-icon { width: 14px; height: 14px; }
.stile.metric .val { font-size: 22px; }
.ex-grid2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); gap: var(--s4); }
.ex-map { position: relative; height: 380px; border-radius: var(--r2); overflow: hidden; background: var(--bg); }
.ex-map canvas { position: absolute; inset: 0; }
.ex-map .seg { position: absolute; top: var(--s2); left: var(--s2); z-index: 3; background: rgba(15, 20, 26, 0.92); }
.ex-map .legend { position: absolute; left: var(--s2); bottom: var(--s2); }
.risk { display: grid; grid-template-columns: 70px repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(84px, auto)) 26px; gap: 4px; }
.risk .axis { font-size: var(--fs-xs); color: var(--text-3); display: flex; align-items: center; justify-content: center; text-align: center; text-transform: capitalize; }
.risk .cell { border-radius: var(--r2); padding: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-content: flex-start; background: var(--surface-2); }
.risk .cell.r-high { background: rgba(239, 90, 100, 0.13); }
.risk .cell.r-medium { background: rgba(221, 191, 76, 0.1); }
.risk .cell.r-low { background: rgba(79, 191, 139, 0.07); }
.chip-sat { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--surface-3); border: 0; color: var(--text); font-size: var(--fs-xs); cursor: pointer; }
.chip-sat:hover { background: var(--border-strong); }
.chip-sat .dot { width: 8px; height: 8px; }
.slo-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
.slo-card { background: var(--surface-2); border-radius: var(--r3); padding: var(--s3); display: grid; grid-template-columns: 64px 1fr; gap: var(--s3); align-items: center; }
.slo-card.nodata { opacity: 0.6; }
.gauge { width: 64px; height: 64px; }
.gauge circle { fill: none; stroke-width: 6; }
.gauge .bg { stroke: var(--surface-3); }
.gauge .fg { stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray var(--dur-3) var(--ease); }
.gauge text { fill: var(--text); font-size: 15px; font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.gauge .obj { stroke: var(--text-2); stroke-width: 2; }
.slo-card h4 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.slo-card p { margin: 2px 0 6px; font-size: var(--fs-xs); color: var(--text-3); }
.budget { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.budget i { display: block; height: 100%; border-radius: 3px; }
.slo-counts { display: flex; gap: var(--s2); font-size: var(--fs-xs); color: var(--text-2); margin-top: 4px; flex-wrap: wrap; }
.sat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: var(--s3); }
.sat-card { background: var(--surface-2); border-radius: var(--r3); padding: var(--s3); border: 1px solid transparent; cursor: pointer; display: flex; flex-direction: column; gap: 6px; text-align: left; color: var(--text); }
.sat-card:hover { border-color: var(--border-strong); }
.sat-card.on { border-color: var(--accent-line); }
.sat-card .top { display: flex; align-items: center; gap: var(--s2); }
.sat-card .top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.sat-card .st { font-size: var(--fs-xs); font-weight: 650; letter-spacing: 0.05em; text-transform: uppercase; }
.st-txt-down { color: #ffb4b9; }
.st-txt-limited { color: #f3d27a; }
.st-txt-up { color: #9be3c0; }
.st-txt-unknown { color: var(--text-3); }
.sat-card .problem { font-size: var(--fs-sm); color: var(--text-2); min-height: 2.6em; }
.sat-card .mission { font-size: var(--fs-xs); color: var(--text-3); display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.sli-list { list-style: none; margin: var(--s2) 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sli-list li { display: grid; grid-template-columns: 1fr 70px; gap: 2px var(--s2); font-size: var(--fs-xs); }
.sli-list li span { color: var(--text-2); }
.sli-list li .budget { grid-column: 1 / -1; height: 4px; }
.timeline { position: relative; overflow-x: auto; }
.timeline svg { display: block; max-width: none; }
.tl-lane text { fill: var(--text-2); font-size: 11px; }
.tl-axis text { fill: var(--text-3); font-size: 10px; }
.tl-axis line { stroke: var(--border); }
.tl-bar { cursor: pointer; }
.tl-bar:hover { opacity: 0.85; }
.inc-list { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s3); }
.inc { background: var(--surface-2); border-radius: var(--r3); border-left: 3px solid var(--border-strong); }
.inc.sev-critical { border-left-color: var(--critical); }
.inc.sev-high { border-left-color: var(--high); }
.inc.resolved { opacity: 0.75; }
.inc > summary { list-style: none; display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); cursor: pointer; }
.inc > summary::-webkit-details-marker { display: none; }
.inc > summary .t { font-weight: 600; }
.inc > summary .m { font-size: var(--fs-xs); color: var(--text-3); }
.inc-body { padding: 0 var(--s4) var(--s4); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: var(--s4); }
.inc-body h5 { margin: var(--s3) 0 var(--s1); font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.inc-body h5:first-child { margin-top: 0; }
.tech { display: inline-flex; gap: 4px; align-items: center; padding: 2px 6px; border-radius: var(--r1); background: var(--surface-3); font-size: var(--fs-xs); margin: 0 4px 4px 0; color: var(--text); text-decoration: none !important; }
.tech b { font-family: var(--mono); font-weight: 500; color: var(--accent-strong); }
.inc-actions { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
.notes { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.notes li { padding: 4px 0; border-bottom: 1px solid var(--border); }
.ev-filters { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: flex-end; margin-bottom: var(--s3); }
.ev-filters .search input { width: 260px; }
.ev-list { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow: auto; }
.ev-list li { display: grid; grid-template-columns: 120px 90px 1fr auto; gap: var(--s3); align-items: start; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.ev-list li .when { font-family: var(--mono); color: var(--text-3); font-size: var(--fs-xs); }
.ev-list li .kind { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; }
.ev-list li .ttl { font-weight: 500; }
.ev-list li .desc { color: var(--text-3); font-size: var(--fs-xs); }
.cov { display: grid; grid-template-columns: repeat(9, minmax(110px, 1fr)); gap: 4px; overflow-x: auto; }
.cov-col h6 { margin: 0 0 4px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); min-height: 30px; }
.cov-col h6 small { display: block; color: var(--text-3); font-weight: 400; }
.cov-cell { display: block; font-size: 10.5px; line-height: 1.3; padding: 4px 5px; margin-bottom: 3px; border-radius: 3px; background: var(--surface-2); color: var(--text-3); text-decoration: none !important; }
.cov-cell.on { background: var(--accent-weak); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.cov-cell b { font-family: var(--mono); font-weight: 500; display: block; }
.rule-rows { list-style: none; margin: var(--s3) 0 0; padding: 0; }
.rule-rows li { display: grid; grid-template-columns: 180px 1fr; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.ex-empty { padding: var(--s6); text-align: center; color: var(--text-2); }
.ex-empty h3 { margin: 0 0 var(--s2); font-size: var(--fs-xl); font-weight: 600; color: var(--text); }
@media (max-width: 1280px) {
  .status-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ex-grid2, .inc-body { grid-template-columns: 1fr; }
  .slo-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .status-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slo-cards { grid-template-columns: minmax(0, 1fr); }
  .slo-card > div { min-width: 0; }
  .ev-list li { grid-template-columns: 1fr; }
  .inc > summary { grid-template-columns: auto 1fr; }
}

/* ---- query editor (kql-editor.js) ---- */
.ev-modebar { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin-bottom: var(--s2); }
.kq-editor { position: relative; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
.kq-hl, .kq-input { margin: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r1); white-space: pre-wrap; word-wrap: break-word;
  overflow-wrap: anywhere; font: inherit; letter-spacing: 0; tab-size: 4; min-height: 96px; box-sizing: border-box; width: 100%; }
.kq-hl { position: absolute; inset: 0; overflow: hidden; pointer-events: none; color: var(--text-1); background: var(--surface-2); border-color: transparent; }
.kq-input { position: relative; display: block; resize: vertical; background: transparent; color: transparent; caret-color: var(--text-1); }
.kq-input:focus { outline: none; border-color: var(--accent); }
.kq-input::selection { background: rgba(76, 176, 217, 0.35); color: transparent; }
.kq-tbl { color: #7fd1b9; font-weight: 600; } .kq-op { color: #c39bf0; font-weight: 600; } .kq-pipe { color: #c39bf0; }
.kq-kw { color: #8fb3ff; } .kq-fn { color: #f3c27a; } .kq-str { color: #a5d6a7; } .kq-num { color: #f7a072; } .kq-col { color: var(--text-1); }
.kq-sym { color: var(--text-2); } .kq-cm { color: var(--text-3); font-style: italic; }
.kq-err { text-decoration: wavy underline #ef5a64; text-underline-offset: 3px; background: rgba(239, 90, 100, 0.15); }
.kq-suggest { position: absolute; left: 8px; top: 100%; z-index: 30; margin: 2px 0 0; padding: 4px; list-style: none; min-width: 300px; max-width: 520px;
  max-height: 260px; overflow: auto; background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r2); box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.kq-suggest li { display: flex; gap: 10px; justify-content: space-between; padding: 3px 8px; border-radius: var(--r1); cursor: pointer; font-size: 12px; }
.kq-suggest li span { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kq-suggest li.on, .kq-suggest li:hover { background: rgba(76, 176, 217, 0.18); }
.kq-error { margin-top: 6px; padding: 6px 10px; border-left: 3px solid #ef5a64; background: rgba(239, 90, 100, 0.1); color: #ffb4b9; font-size: var(--fs-sm); }
.kq-bar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin: var(--s2) 0 var(--s3); }
.kbd { font-family: var(--mono); font-size: 10px; opacity: .75; margin-left: 4px; }
.kq-schema { max-height: 320px; overflow: auto; border: 1px solid var(--border); border-radius: var(--r1); padding: 6px 10px; margin-bottom: var(--s3); }
.kq-schema summary { cursor: pointer; padding: 3px 0; }
.kq-results { max-height: 480px; overflow: auto; }
.pager { display: flex; gap: var(--s2); align-items: center; justify-content: flex-end; margin-top: 6px; }

/* ---- investigations ---- */
.inv-form { display: grid; gap: var(--s2); }
.inv-row { display: flex; gap: var(--s2); flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border: 1px solid var(--border); border-radius: 999px; font-size: var(--fs-sm);
  background: var(--surface-2); color: var(--text-1); text-decoration: none; cursor: default; }
button.chip, a.chip { cursor: pointer; } button.chip:hover, a.chip:hover { border-color: var(--accent); }
.chip .icon-btn { width: 18px; height: 18px; font-size: 13px; }
.inv-tabs { margin-top: var(--s2); }
.inv-actions { display: flex; gap: 6px; }
.inv-timeline li { display: flex; gap: var(--s3); padding: 6px 0; border-bottom: 1px solid var(--border); }
.inv-timeline li.system .grow { color: var(--text-2); }
tr.clickable { cursor: pointer; } tr.clickable:hover td { background: rgba(76, 176, 217, 0.06); }
.grp-form { border: 1px solid var(--border); border-radius: var(--r2); padding: var(--s2) var(--s3); margin-bottom: var(--s3); }

/* ---- Leader view: glanceable, high contrast, large type ---- */
.class-banner { text-align: center; color: #fff; font-weight: 700; letter-spacing: .12em; font-size: 13px; padding: 3px 0; }
#leader-root { max-width: 1500px; margin: 0 auto; padding: var(--s3); font-size: 17px; }
.ld-exercise { background: repeating-linear-gradient(45deg, #5b3a00, #5b3a00 14px, #6b4600 14px, #6b4600 28px); color: #ffd98a; text-align: center;
  font-weight: 800; letter-spacing: .08em; padding: 8px; border-radius: var(--r2); margin-bottom: var(--s3); font-size: 18px; }
.ld-head { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s4, 24px); align-items: center; border-radius: 10px; padding: 18px 24px; color: #fff; }
.ld-action { background: #a1121f; } .ld-monitor { background: #8a5a00; } .ld-clear { background: #12663a; }
.ld-verdict { font-size: 40px; font-weight: 900; letter-spacing: .04em; line-height: 1; white-space: nowrap; }
.ld-bluf p { margin: 0; font-size: 24px; font-weight: 600; line-height: 1.3; }
.ld-asof { opacity: .85; font-size: 14px; }
.ld-tools { display: flex; gap: 8px; }
.ld-head .btn { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.4); }
.ld-stale { margin-top: var(--s3); background: #3b2a00; color: #ffd98a; border-left: 6px solid #f3b200; padding: 12px 16px; font-size: 20px; font-weight: 700; border-radius: var(--r2); }
.ld-sect { margin-top: var(--s4, 24px); } .ld-sect h2 { font-size: 22px; margin: 0 0 10px; }
.ld-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ld-item { display: grid; grid-template-columns: 56px 1fr 210px; gap: 16px; background: var(--surface-1); border: 1px solid var(--border);
  border-left: 8px solid #8a5a00; border-radius: 10px; padding: 14px 16px; cursor: pointer; }
.ld-item.ld-action { border-left-color: #e5484d; background: var(--surface-1); }
.ld-item:hover, .ld-item:focus { outline: 2px solid var(--accent); }
.ld-num { font-size: 34px; font-weight: 900; color: var(--text-2); text-align: center; }
.ld-body h3 { margin: 0 0 4px; font-size: 24px; } .ld-body p { margin: 4px 0; line-height: 1.4; }
.ld-impact { color: var(--text-2); } .ld-rec { font-size: 18px; }
.ld-src { font-size: 12px; color: var(--text-3); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; margin-left: 6px; white-space: nowrap; }
.ld-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-content: start; font-size: 15px; }
.ld-meta span { color: var(--text-3); } .ld-meta b { font-size: 17px; } .ld-since { grid-column: 1 / -1; font-size: 13px; }
/* .ld-meta .ld-unassigned beats ".ld-meta span" (the grey label colour), so an unowned item reads red as intended. */
.ld-unassigned, .ld-meta .ld-unassigned { color: #ff6b72; font-weight: 800; letter-spacing: .04em; white-space: nowrap; }
.ld-more { color: var(--text-2); margin: 8px 0 0; } .ld-calm { font-size: 20px; color: #6fd39a; margin: 0; }
.ld-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; }
.ld-group h4 { margin: 10px 0 6px; font-size: 15px; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.ld-tiles { display: flex; flex-wrap: wrap; gap: 8px; }
.ld-tile { display: grid; padding: 8px 12px; border-radius: 8px; min-width: 150px; border: 1px solid transparent; }
.ld-tile b { font-size: 16px; } .ld-tile span { font-size: 13px; opacity: .85; }
.ld-tile.down { background: #4a0d12; border-color: #e5484d; } .ld-tile.deg { background: #3b2a00; border-color: #f3b200; }
.ld-tile.ok { background: #0e3a24; border-color: #2f9e64; } .ld-tile.nd { background: var(--surface-2); border-color: var(--border); }
.ld-foot { color: var(--text-2); font-size: 14px; }
.ld-changes { list-style: none; margin: 0; padding: 0; } .ld-changes li { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 17px; }
.ld-changes li span { display: inline-block; min-width: 120px; color: var(--text-3); font-family: var(--mono); font-size: 14px; }
.ld-ch-resolved { color: #6fd39a; } .ld-ch-escalated, .ld-ch-new { color: var(--text-1); }
.ld-dialog { max-width: 720px; background: var(--surface-1); color: var(--text-1); border: 1px solid var(--border); border-radius: 12px; padding: 20px 24px; font-size: 18px; }
.ld-dialog::backdrop { background: rgba(0,0,0,.6); }
.ld-error { font-size: 20px; padding: 24px; }
/* Board mode: no application chrome; scales up for a room. */
body.board .topbar, body.board .skip, body.board #toasts { display: none !important; }
body.board #view { padding: 0; }
body.board #leader-root { max-width: none; font-size: 20px; padding: 16px 28px; }
body.board .ld-verdict { font-size: 56px; } body.board .ld-bluf p { font-size: 30px; } body.board .ld-body h3 { font-size: 28px; }
@media (max-width: 900px) {
  .ld-head { grid-template-columns: 1fr; } .ld-item { grid-template-columns: 40px 1fr; } .ld-meta { grid-column: 2; } .ld-cols { grid-template-columns: 1fr; }
  .ld-verdict { font-size: 30px; } .ld-bluf p { font-size: 19px; }
}
@media (max-width: 480px) {
  /* "ACTION REQUIRED" fits a phone-width banner. */
  .ld-verdict { font-size: 24px; white-space: normal; } .ld-head { padding: 16px; }
}
/* Print: one-page handout of the Leader view only. */
@media print {
  body { background: #fff !important; color: #000 !important; }
  .topbar, .skip, .page:not([data-page="leader"]), .ld-tools, #toasts, dialog { display: none !important; }
  #view { padding: 0 !important; overflow: visible !important; }
  #leader-root { font-size: 11pt; padding: 0; max-width: none; }
  .class-banner { display: block !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ld-head, .ld-tile, .ld-item, .ld-exercise, .ld-stale { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .ld-item { break-inside: avoid; background: #fff !important; color: #000; } .ld-impact, .ld-meta span, .ld-asof { color: #333 !important; }
  .ld-verdict { font-size: 26pt; } .ld-bluf p { font-size: 14pt; } .ld-body h3 { font-size: 14pt; }
  .ld-tile { color: #fff; } .ld-changes li { color: #000 !important; }
  @page { margin: 12mm; @bottom-center { content: "S-TRACE leader brief · page " counter(page); } }
}

.lead-ctl { display: grid; gap: 6px; } .lead-decision { border-left: 4px solid #f3b200; padding: 6px 10px; margin: 8px 0; background: rgba(243,178,0,.08); }

/* Board and print: decisions left, satellites and the last 24 h right, one screen / one page. */
@media (max-width: 1800px) { .brand-sub { display: none; } }
@media (max-width: 1400px) { .nav a { padding-left: 8px; padding-right: 8px; } }
body.board .ld-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 24px; align-items: start; }
body.board .ld-side { display: block; } body.board .ld-side .ld-sect:first-child { margin-top: 24px; }
body.board .ld-tile { min-width: 0; padding: 5px 9px; } body.board .ld-tile b { font-size: 15px; } body.board .ld-tile span { font-size: 12px; }
body.board .ld-changes li { font-size: 16px; padding: 5px 0; }
body.board .ld-item { grid-template-columns: 48px 1fr 210px; padding: 12px 14px; }
.ld-meta { min-width: 0; } .ld-meta b { overflow-wrap: anywhere; }
@media print {
  .ld-grid { display: grid !important; grid-template-columns: 1.5fr 1fr; gap: 10pt; align-items: start; }
  .ld-side { display: block !important; } .ld-sect { margin-top: 8pt !important; } .ld-sect h2 { font-size: 12pt; margin-bottom: 4pt; }
  .ld-item { grid-template-columns: 22pt 1fr; padding: 6pt 8pt; gap: 6pt; } .ld-meta { grid-column: 2; display: flex; gap: 8pt; flex-wrap: wrap; font-size: 9pt; }
  .ld-num { font-size: 16pt; } .ld-body p { margin: 2pt 0; font-size: 10pt; } .ld-rec { font-size: 10pt !important; }
  .ld-head { padding: 8pt 12pt; gap: 10pt; } .ld-stale, .ld-exercise { font-size: 11pt; padding: 4pt 8pt; margin: 6pt 0; }
  .ld-tile { min-width: 0; padding: 3pt 6pt; } .ld-tile b { font-size: 9pt; } .ld-tile span { font-size: 8pt; }
  .ld-changes li { font-size: 9pt; padding: 2pt 0; } .ld-changes li span { min-width: 70pt; font-size: 8pt; }
  .ld-group h4 { font-size: 8pt; margin: 4pt 0 2pt; } .ld-foot { font-size: 8pt; }
}
