/* Stanley Intelligence — restrained monochrome, after the original login */
:root {
  --bg: #0a0a0a; --panel: #0d0d0d; --raised: #111; --ink: #e8e8e8; --text: #c8c8c8; --muted: #6a6a6a; --dim: #444; --faint: #2a2a2a;
  --line: #1a1a1a; --line-2: #252525; --focus: #e8e8e8;
  --red: #ff5a52; --amber: #e8a33d; --yellow: #cbb45a; --green: #6cbf84; --blue: #6f9fd8; --violet: #a98bd6; --cyan: #5fb3b3;
  --mono: "SF Mono", "Cascadia Code", "Fira Code", "JetBrains Mono", "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 12.5px/1.6 var(--mono); }
body { padding-bottom: 32px; }
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--faint); }
a:hover { border-bottom-color: var(--ink); }
:focus-visible { outline: 1px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font: inherit; margin: 0; }
.label, h3, .table th, .tile-label, .ctl-label, .panel-title {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
h3 { margin: 18px 0 8px; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .small { font-size: 11px; }
.warn { color: var(--amber); } .ok { color: var(--green); } .inline { display: inline; }

/* Controls */
.ctl, .btn { font: 700 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text); background: transparent;
  border: 1px solid var(--line-2); padding: 6px 10px; cursor: pointer; white-space: nowrap; list-style: none; text-decoration: none; }
.ctl::-webkit-details-marker, .btn::-webkit-details-marker { display: none; }
.ctl:hover, .btn:hover { border-color: #3a3a3a; color: var(--ink); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: #fff; color: var(--bg); }
.btn:disabled, .ctl:disabled { opacity: .35; cursor: not-allowed; }
.btn-small { padding: 4px 8px; }
.btn-link, .link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-decoration-color: var(--faint); }
.link-btn:hover { color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line-2); }
.seg button { font: 700 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; background: none; border: 0; color: var(--muted);
  padding: 5px 10px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--ink); color: var(--bg); }
.tabs { display: flex; flex-wrap: wrap; gap: 0; margin: 0 0 10px; border-bottom: 1px solid var(--line); }
.tab { font: 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; background: none; border: 0; border-bottom: 1px solid transparent;
  color: var(--muted); padding: 6px 10px; margin-bottom: -1px; cursor: pointer; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
input, select, textarea { font: 12px var(--mono); color: var(--ink); background: #111; border: 1px solid #252525; padding: 6px 8px; max-width: 100%; }
input:focus, select:focus, textarea:focus { border-color: #3a3a3a; outline: none; }
label { display: block; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
label input, label select { display: block; width: 100%; margin-top: 5px; letter-spacing: 0; text-transform: none; font-size: 12px; }
.alert { font-size: 11px; color: #ff6b6b; padding: 7px 10px; border-left: 2px solid #ff4444; background: #110a0a; }

/* Login (original design) */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; padding-bottom: 16px; }
.login-shell { width: min(320px, 100%); font-size: 13px; }
.login-header { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid #222; padding-bottom: 16px; margin-bottom: 24px; }
.login-mark { flex: none; opacity: .9; }
.login-brand { font-size: 14px; font-weight: 700; letter-spacing: .08em; color: #e8e8e8; text-transform: uppercase; }
.login-subtitle { margin-top: 5px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #444; }
.login-status { display: none; }
.login-form .field { margin-bottom: 12px; }
.login-form label { color: #555; margin-bottom: 5px; }
.login-form input { width: 100%; padding: 9px 10px; background: #111; border: 1px solid #252525; color: #e8e8e8; font-size: 13px; margin-top: 5px; transition: border-color .12s; }
.login-form input:focus { border-color: #3a3a3a; }
.login-form button { width: 100%; padding: 9px; background: #e8e8e8; color: #0a0a0a; border: none; font: 700 11px var(--mono);
  letter-spacing: .1em; text-transform: uppercase; cursor: pointer; margin-top: 4px; transition: background .12s; }
.login-form button:hover { background: #fff; }
.login-error { font-size: 11px; color: #ff6b6b; margin-bottom: 14px; padding: 7px 10px; border-left: 2px solid #ff4444; background: #110a0a; }
.login-footer { margin-top: 22px; padding-top: 14px; border-top: 1px solid #161616; font-size: 10px; color: #2a2a2a; letter-spacing: .04em; line-height: 1.8; }
.login-footer a, .login-footer .btn-link { color: #555; border: 0; }

/* Top bar with sections */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; padding: 10px 20px; border-bottom: 1px solid #222;
  background: rgba(10, 10, 10, .97); position: sticky; top: 0; z-index: 1000; }
.brand { display: inline-flex; align-items: center; gap: 10px; border: 0; color: var(--ink); font-size: 12px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; }
.sections { display: flex; flex-wrap: wrap; gap: 2px 18px; flex: 1; }
.section-link { border: 0; color: var(--muted); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; padding: 4px 0;
  border-bottom: 1px solid transparent; }
.section-link:hover { color: var(--ink); border-bottom-color: transparent; }
.section-link.active { color: var(--ink); border-bottom-color: var(--ink); }
.topbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ctl-label { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.ctl-select { width: auto; max-width: 170px; padding: 5px 6px; font-size: 11.5px; margin: 0; }
.ctl-icon { font-size: 13px; padding: 3px 9px; letter-spacing: 0; }
.menu-label { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); padding: 8px 14px 2px; }
.ctl-label select { margin: 0; width: auto; max-width: 190px; padding: 5px 6px; font-size: 11.5px; }
.menu { position: relative; }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); background: #0f0f0f; border: 1px solid #252525; min-width: 260px; z-index: 1500; padding: 4px 0; }
.menu-body a, .menu-item { display: block; width: 100%; text-align: left; padding: 8px 14px; border: 0; background: none; color: var(--text);
  font: 11.5px var(--mono); cursor: pointer; }
.menu-body a:hover, .menu-item:hover { background: #161616; color: var(--ink); }
.menu-body form { margin: 0; border-top: 1px solid #1c1c1c; }

/* View and panels */
.view { padding: 18px 20px 28px; outline: none; }
.view-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin: 0 0 14px; }
.view-title h1 { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink); }
.view-title .sub { color: var(--muted); font-size: 11px; }
.grid { display: grid; gap: 18px; }
.grid-overview { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); align-items: stretch; }
.grid-overview > .panel { display: flex; flex-direction: column; height: calc(100vh - 180px); min-height: 460px; }
.grid-overview > .panel > .panel-body { flex: 1; min-height: 0; overflow-y: auto; }
.grid-overview .map, .grid-overview .map-side { height: 100%; max-height: none; }
.grid-overview .map-shell { height: 100%; }
.grid-below { margin-top: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); align-items: start; }
.panel { border: 1px solid #1c1c1c; background: var(--panel); min-width: 0; scroll-margin-top: 64px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px;
  padding: 10px 14px; border-bottom: 1px solid #1a1a1a; }
.panel-title { color: var(--text); letter-spacing: .12em; }
.panel-title .count { color: var(--muted); margin-left: 8px; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.panel-body { padding: 12px 14px 14px; min-width: 0; }
.note { color: var(--muted); font-size: 11px; margin: 0 0 10px; line-height: 1.6; }
.scroll { max-height: 560px; overflow-y: auto; }
.filter { width: 100%; margin-bottom: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; align-items: center; }
.filters select, .filters input { width: auto; }
.filters input[type=search] { flex: 1; min-width: 180px; }

/* Map */
.map-shell { display: grid; grid-template-columns: minmax(0, 1fr) 340px; border-top: 0; }
.map-shell.no-side { grid-template-columns: minmax(0, 1fr); }
.map { height: 620px; background: #0b0c0e; }
.map.light { background: #e6e6e6; }
.map-side { border-left: 1px solid #1a1a1a; display: flex; flex-direction: column; max-height: 620px; min-height: 0; }
.map-side-head { padding: 10px 12px; border-bottom: 1px solid #1a1a1a; }
.map-side-list { overflow-y: auto; flex: 1; padding: 0 12px; }
.layers-menu .menu-body { min-width: 230px; padding: 8px 0; }
.layer-row { display: flex; align-items: center; gap: 10px; padding: 5px 14px; cursor: pointer; font: 11.5px var(--mono);
  text-transform: none; letter-spacing: 0; color: var(--text); }
.layer-row:hover { background: #161616; }
.layer-row input { margin: 0; width: auto; accent-color: #e8e8e8; }
.layer-row .sw { width: 9px; height: 9px; flex: none; }
.legend-block { padding: 2px 14px 8px; font-size: 10.5px; color: var(--muted); line-height: 1.9; }
.legend-row i { display: inline-block; width: 9px; height: 9px; margin-right: 8px; vertical-align: -1px; }
.layers-menu .menu-body { max-height: calc(100vh - 160px); overflow-y: auto; }
.leaflet-container { font: 11px var(--mono); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #111; color: var(--text); border: 1px solid #252525; box-shadow: none; border-radius: 0; }
.leaflet-popup-content { margin: 10px 12px; font: 11.5px/1.5 var(--mono); }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar, .leaflet-bar a { border-radius: 0 !important; }
.leaflet-bar a { background: #111; color: var(--text); border-color: #252525 !important; }
.leaflet-bar { border: 1px solid #252525 !important; box-shadow: none !important; }
.map.light .leaflet-bar a { background: #fff; color: #222; border-color: #ccc !important; }
.leaflet-tooltip { background: #111; color: var(--ink); border: 1px solid #2a2a2a; border-radius: 0; font: 11px var(--mono); box-shadow: none; }
.leaflet-tooltip-top::before { border-top-color: #2a2a2a; }
.leaflet-control-attribution { background: rgba(10, 10, 10, .7) !important; color: #555; font: 9.5px var(--mono); }
.leaflet-control-attribution a { color: #777; border: 0; }
.map.light .leaflet-control-attribution { background: rgba(255, 255, 255, .8) !important; color: #555; }
.map-legend { background: rgba(10, 10, 10, .88); border: 1px solid #222; padding: 8px 10px; font: 10px var(--mono); color: var(--muted); line-height: 1.8; letter-spacing: .04em; }
.map.light .map-legend { background: rgba(255, 255, 255, .92); border-color: #ccc; color: #444; }
.map-legend i { display: inline-block; width: 9px; height: 9px; margin-right: 7px; vertical-align: -1px; }
.lg-ring { border-radius: 50%; border: 2px solid; }
.lg-sq { border: 2px solid #e8a33d; }
.popup strong { color: var(--ink); }
.popup ul { padding-left: 14px; margin: 6px 0 0; }
.mk-site { background: #e8e8e8; border: 2px solid #0a0a0a; outline: 1px solid #e8e8e8; }
.mk-choke { background: #0a0a0a; border: 2px solid currentColor; }

/* Tables */
.table-wrap { overflow-x: auto; max-height: 620px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; border-bottom: 1px solid #222; padding: 6px 10px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.table td { border-bottom: 1px solid #161616; padding: 7px 10px; vertical-align: top; }
.table.compact td { padding: 4px 8px; }
.table caption { caption-side: bottom; padding: 12px; color: var(--muted); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.row-click { cursor: pointer; } .row-click:hover { background: #121212; }
.row-focus td:first-child { box-shadow: inset 2px 0 0 var(--ink); }
.actions { white-space: nowrap; }
.conf { color: var(--muted); }

/* Status marks — the only colour */
.grade, .kind, .band, .lvl { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.grade::before, .band::before, .lvl::before { content: "■ "; }
.grade-confirmed { color: var(--red); } .grade-probable { color: var(--amber); } .grade-possible { color: var(--yellow); } .grade-unverified { color: var(--dim); }
.kind { color: var(--muted); } .kind-data { color: var(--green); } .kind-official { color: var(--blue); } .kind-media { color: var(--violet); }
.evbar { display: inline-flex; gap: 8px; }
.band-critical { color: var(--red); font-weight: 700; } .band-high { color: var(--red); } .band-moderate { color: var(--amber); }
.band-elevated { color: var(--yellow); } .band-low { color: var(--green); } .band-not_applicable, .band-watch { color: var(--dim); }
.lvl-act { color: var(--red); font-weight: 700; } .lvl-watch { color: var(--amber); } .lvl-info { color: var(--dim); }
.lvl-info::before { content: "□ "; }
.dom { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.trend { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; margin-left: 8px; }
.trend-rising, .trend-new { color: var(--red); } .trend-falling { color: var(--green); } .trend-stable { color: var(--dim); }
.tag { color: var(--dim); margin-left: 8px; font-size: 10.5px; }

/* Verification */
.ver { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.ver-verified { color: var(--green); } .ver-discarded { color: var(--dim); text-decoration: line-through; }
.ver-reviewing { color: var(--amber); } .ver-monitoring { color: var(--blue); }
.verify .filters input[type=text] { flex: 1; min-width: 220px; }

/* Unusual and RRA */
.unusual { color: #e07bd6; font-size: 10.5px; letter-spacing: .04em; }
.ans { font-weight: 700; font-size: 10.5px; letter-spacing: .08em; }
.ans-yes { color: var(--red); } .ans-no { color: var(--green); } .ans-unclear { color: var(--amber); }

/* Attention */
.attn { list-style: none; margin: 0; padding: 0; }
.attn li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 8px 0; border-bottom: 1px solid #161616; }
.attn li:last-child { border-bottom: 0; }
.attn .lvl { grid-column: 1 / -1; }
.attn .when { color: var(--dim); white-space: nowrap; font-size: 10.5px; }
.attn a { border: 0; color: var(--ink); } .attn a:hover { text-decoration: underline; text-decoration-color: var(--dim); }
.attn-empty { color: var(--muted); }
.attn-summary { display: flex; gap: 16px; margin-bottom: 4px; flex-wrap: wrap; }
.attn.compact li { grid-template-columns: 70px 1fr auto; align-items: baseline; }
.attn.compact .lvl { grid-column: auto; }

/* Signals */
.signals { list-style: none; padding: 0; margin: 0; }
.signal { padding: 8px 0; border-bottom: 1px solid #161616; }
.signal-meta { color: var(--muted); font-size: 10.5px; letter-spacing: .02em; }
.signal-title { margin-top: 2px; overflow-wrap: anywhere; color: var(--ink); }
.signal-title a { border-bottom-color: #222; }
.signal-summary { font-size: 11px; color: var(--muted); margin-top: 3px; }
.signal.pick { cursor: pointer; } .signal.pick:hover { background: #121212; }
.loc { color: var(--cyan); }

/* Context tiles, drivers */
.ctx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); border-top: 1px solid #1c1c1c; border-left: 1px solid #1c1c1c; margin: 10px 0; }
.tile { padding: 9px 12px; border-right: 1px solid #1c1c1c; border-bottom: 1px solid #1c1c1c; }
.tile-value { font-size: 18px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile-sub { font-size: 11px; color: var(--text); } .tile-src { font-size: 10px; color: var(--dim); margin-top: 2px; }
.risk-list { border-top: 1px solid #1a1a1a; }
.risk { border-bottom: 1px solid #1a1a1a; padding: 8px 2px; }
.risk summary { cursor: pointer; color: var(--ink); list-style-position: outside; }
.risk-not_applicable { opacity: .45; }
.drivers { margin: 8px 0; padding: 0; list-style: none; }
.drivers li { padding: 2px 0; display: grid; grid-template-columns: 30px 1fr; gap: 8px; }
.pts { color: var(--muted); font-variant-numeric: tabular-nums; }
.src { font-size: 10px; color: var(--dim); }
.package { border-left: 2px solid #3a3a3a; padding: 6px 12px; margin: 8px 0; background: #101010; font-size: 12px; }
.plain { list-style: none; padding: 0; } .plain li { margin: 4px 0; }
.briefing-text { white-space: pre-wrap; margin: 12px 0; line-height: 1.7; color: var(--ink); }
.hs-domains { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.cand { list-style: none; padding: 0; margin: 4px 0; }
.cand li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding: 3px 0; }
.spark { display: block; width: 100%; height: 28px; }
.bar { height: 5px; background: #1a1a1a; position: relative; min-width: 80px; }
.bar > span { position: absolute; inset: 0 auto 0 0; background: #8a8a8a; }
.ask-input { width: 100%; resize: vertical; margin-bottom: 8px; }
.top-list { list-style: none; padding: 0; margin: 0; }
.top-list li { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; padding: 6px 0; border-bottom: 1px solid #161616; cursor: pointer; }
.top-list li:hover { background: #121212; }

/* Drawer */
.drawer { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); z-index: 2000; display: flex; justify-content: flex-end; }
.drawer[hidden] { display: none; }
.drawer-panel { background: #0c0c0c; border-left: 1px solid #222; width: min(780px, 100%); height: 100%; overflow-y: auto; padding: 18px 22px 40px; position: relative; }
.drawer-close { position: absolute; top: 12px; right: 14px; }
.drawer-panel h2 { color: var(--ink); margin: 0 110px 14px 0; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.stack { display: grid; gap: 12px; } .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Status line */
.statusline { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; display: flex; flex-wrap: wrap; gap: 0 22px; align-items: center;
  padding: 6px 20px; background: #0a0a0a; border-top: 1px solid #1a1a1a; color: var(--dim); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.statusline b { color: var(--muted); font-weight: 400; }
.statusline .link-btn { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.statusline .grow { flex: 1; }

/* Admin */
.admin { display: grid; gap: 18px; padding: 18px 20px 28px; max-width: 1200px; margin: 0 auto; }
.admin .card { border: 1px solid #1c1c1c; background: var(--panel); }
.admin .card-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid #1a1a1a; }
.admin .card-head h2 { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--text); }
.admin .card-head h2 .p, .admin .card-head h2 .d, .admin .card-head h2 .c { color: inherit; }
.admin .card-body { padding: 12px 14px; }
.note-line { color: var(--muted); font-size: 11px; }
.row-form { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.otp { border: 1px solid #3a3a3a; padding: 10px 12px; margin-bottom: 10px; }
.otp-code { font-size: 14px; font-weight: 700; padding: 2px 6px; background: #1a1a1a; color: var(--ink); user-select: all; }
.setting { display: grid; grid-template-columns: minmax(200px, 1fr) minmax(260px, 1.3fr); gap: 6px 14px; padding: 10px 0; border-bottom: 1px solid #161616; }
.setting-input { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.setting-input input, .setting-input select { flex: 1; min-width: 180px; }

@media (max-width: 1500px) {
  .sections { gap: 2px 14px; }
  .view { padding: 14px 16px 24px; }
  .topbar { padding: 8px 16px; gap: 6px 16px; }
  .brand span { display: none; }
  .statusline .opt { display: none; }
}
@media (max-width: 1100px) {
  .grid-overview { grid-template-columns: minmax(0, 1fr); }
  .grid-overview > .panel { height: auto; }
  .grid-overview > .panel:first-child { max-height: 420px; }
  .grid-overview .map { height: 480px; }
  .map-shell { grid-template-columns: minmax(0, 1fr); }
  .map-side { border-left: 0; border-top: 1px solid #1a1a1a; max-height: 380px; }
}
@media (max-width: 640px) {
  .map { height: 440px; }
  .view { padding: 14px 16px 24px; }
  .topbar { padding: 10px 16px; }
  .setting, .row { grid-template-columns: 1fr; }
  .statusline .opt { display: none; }
  .top-list li { grid-template-columns: 80px 1fr; }
}
