:root, [data-uboat-color="graphite"] {
    color-scheme: dark;
    --bg: #070809;
    --surface: #0e1013;
    --raised: #15181c;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.20);
    --text: #F2F4F7;
    --muted: #A1A8B3;
    --quiet: #808794; /* >= 4.5:1 on --bg, --surface, --raised and --dim */
    --accent: #F4F5F7;
    --on-accent: #070809;
    --dim: #1c2026;
    --crit: #ef4444;
    --crit-bg: rgba(239, 68, 68, 0.14);
    --warn: #f59e0b;
    --warn-bg: rgba(245, 158, 11, 0.14);
    --ok: #22c55e;
    --ok-bg: rgba(34, 197, 94, 0.14);
    --font-heading: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Inter", sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  }

  [data-uboat-color="high-contrast"] {
    --bg: #030304;
    --surface: #090a0b;
    --raised: #141619;
    --border: rgba(255, 255, 255, 0.28);
    --border-strong: rgba(255, 255, 255, 0.55);
    --text: #FFFFFF;
    --muted: #DEDFE3;
    --quiet: #B0B4BC;
    --accent: #FFFFFF;
    --on-accent: #050506;
    --dim: #282b30;
  }

  :root, [data-uboat-density="standard"] {
    --radius: 8px; --radius-sm: 5px; --pad: 16px; --gap: 14px;
  }
  [data-uboat-density="compact"] {
    --radius: 5px; --radius-sm: 4px; --pad: 11px; --gap: 10px;
  }

  * { box-sizing: border-box; margin: 0; padding: 0; }
  ::selection { background: rgba(244, 245, 247, 0.22); color: #ffffff; }
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 99px; }
  ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.28); }
  html, body {
    width: 100%; height: 100%;
    background: var(--bg); color: var(--text);
    font-family: var(--font-sans); font-size: 13.5px; line-height: 1.48;
    -webkit-font-smoothing: antialiased;
    caret-color: var(--accent);
  }
  body.view-globe { overflow: hidden; }
  button, input, select { font: inherit; color: inherit; }
  button { cursor: pointer; }
  button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, [data-kbd-click]:focus-visible {
    outline: 1.5px solid var(--accent); outline-offset: 2px;
  }
  tr[data-kbd-click]:focus-visible { outline-offset: -2px; }
  a { color: var(--text); text-underline-offset: 3px; }
  .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
  .eyebrow {
    font-family: var(--font-mono); font-size: 10px; font-weight: 500;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--quiet);
  }
  .sev-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--quiet); }
  .sev-dot.crit { background: var(--crit); }
  .sev-dot.elevated, .sev-dot.warn { background: var(--warn); }
  .sev-dot.ok { background: var(--ok); }

  /* Slim 48px Tactical Header (Anduril / Palantir / Google Earth Omnibox) */
  .site-header {
    position: sticky; top: 0; z-index: 60; height: 48px;
    display: grid; grid-template-columns: auto minmax(220px, 320px) 1fr auto; align-items: center;
    padding: 0 14px; gap: 14px;
    background: rgba(7, 8, 9, 0.94); backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
  }
  .brand-group { display: inline-flex; align-items: center; gap: 10px; }
  .brand-btn {
    display: inline-flex; align-items: center; gap: 6px; width: max-content;
    background: none; border: none; padding: 0; color: var(--text);
  }
  .brand-btn .lockup { height: 20px; width: auto; display: block; }
  .brand-btn .signet { height: 22px; width: 22px; display: none; }

  .live-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 7px; border-radius: 99px;
    background: rgba(255,255,255,0.03); border: 1px solid var(--border);
    font-family: var(--font-mono); font-size: 9.5px; color: var(--muted);
    letter-spacing: 0.05em; cursor: pointer; white-space: nowrap;
  }
  .live-pill:hover { border-color: var(--border-strong); color: var(--text); }
  .live-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
  .live-dot.warn { background: var(--warn); }

  /* Compact Header Omnibox: 32px pill when idle, expands smoothly on focus */
  .smart-bar {
    position: relative; width: 100%; z-index: 90;
  }
  .smart-row {
    height: 32px; display: flex; align-items: center; gap: 6px; padding: 0 7px 0 9px;
    background: rgba(18, 21, 26, 0.92); border: 1px solid var(--border); border-radius: 7px;
    transition: border-color 0.15s ease, background 0.15s ease;
  }
  .smart-bar.expanded .smart-row, .smart-row:hover {
    border-color: var(--border-strong); background: #14171c;
  }
  .smart-row:focus-within {
    border-color: rgba(255, 255, 255, 0.38); background: #14171c;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1);
  }
  .smart-mode-chip {
    font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--muted); padding: 1px 5px; border-radius: 4px; background: rgba(255,255,255,0.06);
    flex-shrink: 0; cursor: pointer; border: none;
  }
  .smart-mode-chip:hover { color: var(--text); background: rgba(255,255,255,0.12); }
  .smart-input {
    flex: 1; background: transparent; border: none; color: var(--text);
    font-size: 12.5px; outline: none; min-width: 0;
  }
  .smart-input:focus, .smart-input:focus-visible { outline: none; box-shadow: none; }
  .smart-input::placeholder { color: var(--quiet); }
  .smart-pop {
    position: absolute; top: calc(100% + 6px); left: 0; width: min(500px, calc(100vw - 28px));
    background: rgba(11, 13, 16, 0.98); backdrop-filter: blur(18px);
    border: 1px solid var(--border-strong); border-radius: 9px;
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.72);
    display: none; overflow: hidden;
  }
  .smart-bar.expanded .smart-pop { display: block; }
  .smart-tabs {
    display: flex; align-items: center; gap: 2px;
    padding: 6px 8px; border-bottom: 1px solid var(--border); background: rgba(255,255,255,0.02);
  }
  .smart-tab {
    background: none; border: 1px solid transparent; border-radius: 5px;
    color: var(--muted); padding: 4px 9px; font-family: var(--font-mono);
    font-size: 10px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
    transition: all 0.12s;
  }
  .smart-tab:hover { color: var(--text); background: rgba(255,255,255,0.05); }
  .smart-tab.active { color: var(--on-accent); background: var(--accent); font-weight: 600; }
  .smart-watch-grid {
    display: none; grid-template-columns: 1fr 1fr 78px; gap: 6px;
    padding: 8px; border-bottom: 1px solid var(--border);
  }
  .smart-watch-grid.open { display: grid; }
  .smart-dropdown {
    display: none; max-height: 54vh; overflow-y: auto;
  }
  .smart-dropdown.open { display: block; }
  .smart-item {
    padding: 8px 11px; border-bottom: 1px solid var(--border);
    cursor: pointer; display: flex; flex-direction: column; gap: 2px;
  }
  .smart-item:last-child { border-bottom: none; }
  .smart-item:hover { background: rgba(255,255,255,0.045); }

  .main-nav { display: flex; align-items: center; justify-content: center; gap: 2px; }
  .nav-btn {
    background: none; border: 1px solid transparent; color: var(--muted);
    padding: 5px 10px; border-radius: 6px; font-size: 13px; font-weight: 500;
    transition: color 0.13s, background 0.13s; white-space: nowrap;
  }
  .nav-btn:hover { color: var(--text); background: rgba(255,255,255,0.04); }
  .nav-btn[aria-current="page"] { color: var(--text); background: var(--raised); border-color: var(--border); }

  .header-right { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
  .ws-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 9px; border-radius: 6px;
    background: transparent; border: 1px solid var(--border);
    color: var(--muted); font-size: 12px; font-weight: 500;
    transition: border-color 0.13s, color 0.13s, background 0.13s; white-space: nowrap;
  }
  .ws-btn:hover { border-color: var(--border-strong); color: var(--text); background: rgba(255,255,255,0.03); }
  .ws-btn.active { background: var(--raised); border-color: var(--border-strong); color: var(--text); }
  .op-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px; border-radius: 6px;
    background: transparent; border: 1px solid var(--border);
    font-family: var(--font-mono); font-size: 10.5px; color: var(--muted);
  }
  .op-badge:hover { border-color: var(--border-strong); color: var(--text); }

  /* Controls & Evidence Tags */
  .btn {
    display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 7px 12px; border-radius: 7px;
    background: var(--raised); border: 1px solid var(--border);
    color: var(--text); font-size: 12.5px; font-weight: 500;
    transition: all 0.13s ease; white-space: nowrap;
  }
  .btn:hover { border-color: var(--border-strong); background: #22252a; }
  .btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
  .btn.primary:hover { background: #ffffff; }
  .btn.sm { padding: 4px 9px; font-size: 11.5px; gap: 5px; }
  .btn.ghost { background: transparent; border-color: var(--border); color: var(--muted); }
  .btn.ghost:hover { color: var(--text); border-color: var(--border-strong); }
  .kbd {
    font-family: var(--font-mono); font-size: 10px; color: var(--quiet);
    border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px;
  }
  .input, .select {
    background: var(--raised); border: 1px solid var(--border); color: var(--text);
    border-radius: 6px; padding: 7px 10px; font-size: 13px; outline: none;
  }
  .input:focus, .select:focus { border-color: var(--accent); }
  .input::placeholder { color: var(--quiet); }

  .ev-tag {
    display: inline-flex; align-items: center; gap: 4px;
    font-family: var(--font-mono); font-size: 10px; font-weight: 500;
    letter-spacing: 0.06em; text-transform: uppercase;
    padding: 2px 6px; border-radius: 4px;
    background: var(--raised); border: 1px solid var(--border); color: var(--text);
    white-space: nowrap;
  }
  .ev-tag svg { width: 12px; height: 12px; flex-shrink: 0; }
  .ev-tag.crit { background: var(--crit-bg); border-color: rgba(239,68,68,0.45); color: #fca5a5; }
  .ev-tag.warn { background: var(--warn-bg); border-color: rgba(245,158,11,0.45); color: #fcd34d; }
  .ev-tag.ok { background: var(--ok-bg); border-color: rgba(34,197,94,0.4); color: #86efac; }
  .ev-tag.hi { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.3); color: #ffffff; }

  /* =====================================================================
     VIEW 1: FULL-BLEED 3D EARTH CANVAS (ANDURIL / PALANTIR / GOOGLE EARTH)
     ===================================================================== */
  #globeView {
    position: relative; width: 100%; height: calc(100vh - 48px);
    background: radial-gradient(ellipse at 52% 48%, #101318 0%, #07080a 60%, #030405 100%);
    overflow: hidden;
  }
  #globeMap {
    position: absolute; inset: 0; width: 100%; height: 100%;
  }
  /* Subtle God's-Eye optical corner aperture brackets (quiet 1px edge precision) */
  .hud-bracket {
    position: absolute; width: 12px; height: 12px; pointer-events: none; z-index: 12;
    border-color: rgba(255, 255, 255, 0.16); border-style: solid; border-width: 0;
  }
  .hud-bracket.tl { top: 8px; left: 8px; border-top-width: 1px; border-left-width: 1px; }
  .hud-bracket.tr { top: 8px; right: 8px; border-top-width: 1px; border-right-width: 1px; }
  .hud-bracket.bl { bottom: 44px; left: 8px; border-bottom-width: 1px; border-left-width: 1px; }
  .hud-bracket.br { bottom: 44px; right: 8px; border-bottom-width: 1px; border-right-width: 1px; }

  .maplibregl-ctrl-attrib {
    background: rgba(7,8,10,0.84) !important; color: #b5bcc7 !important;
    border: 1px solid rgba(255,255,255,0.12) !important;
    font-family: var(--font-mono) !important; font-size: 9px !important;
    border-radius: 4px !important;
  }
  .maplibregl-ctrl-attrib a { color: #e2e8f0 !important; }
  .maplibregl-ctrl-bottom-right { bottom: 40px !important; right: 14px !important; opacity: 0.88; transition: right 0.22s cubic-bezier(0.22, 1, 0.36, 1); }
  body.wb-open .maplibregl-ctrl-bottom-right { right: 414px !important; }
  .maplibregl-ctrl-bottom-left { bottom: 40px !important; left: 14px !important; }

  /* Minimal Top-Left Corner Control Strip (32px tall — 95%+ canvas stays unobstructed!) */
  .globe-strip {
    position: absolute; top: 14px; left: 14px; z-index: 20;
    display: inline-flex; align-items: center; gap: 2px; padding: 3px;
    background: rgba(11, 13, 16, 0.86); backdrop-filter: blur(12px);
    border: 1px solid var(--border); border-radius: 8px;
  }
  .strip-btn {
    height: 26px; padding: 0 9px; border-radius: 5px;
    display: inline-flex; align-items: center; gap: 5px;
    background: transparent; border: 1px solid transparent;
    color: var(--muted); font-size: 11.5px; font-weight: 500;
    transition: background 0.12s, color 0.12s; white-space: nowrap;
  }
  .strip-btn:hover { color: var(--text); background: rgba(255,255,255,0.06); }
  .strip-btn.active { color: var(--on-accent); background: var(--accent); font-weight: 600; }
  .strip-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
  .strip-sep { width: 1px; height: 14px; background: var(--border); margin: 0 2px; }

  /* On-Demand Compact Popovers under Top-Left Strip */
  .corner-pop {
    position: absolute; top: 52px; left: 14px; z-index: 24;
    width: 268px; max-height: calc(100vh - 140px); overflow-y: auto;
    padding: 11px; border-radius: 9px;
    background: rgba(11, 13, 16, 0.96); backdrop-filter: blur(16px);
    border: 1px solid var(--border-strong); box-shadow: 0 18px 44px rgba(0,0,0,0.72);
    display: none;
  }
  .corner-pop.open { display: block; }
  .scale-seg, .basemap-seg {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px;
    padding: 2px; background: rgba(7,8,10,0.9); border: 1px solid var(--border); border-radius: 6px;
  }
  .scale-seg button, .basemap-seg button {
    background: none; border: 1px solid transparent; color: var(--muted);
    padding: 4px 2px; border-radius: 4px; font-family: var(--font-mono); font-size: 10px;
  }
  .scale-seg button:hover, .basemap-seg button:hover { color: var(--text); }
  .scale-seg button.active, .basemap-seg button.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }

  .monitor-pill {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 8px; border-radius: 5px; width: 100%;
    background: transparent; border: 1px solid transparent;
    color: var(--muted); font-size: 12px; text-align: left;
  }
  .monitor-pill:hover { border-color: var(--border); color: var(--text); background: rgba(255,255,255,0.04); }

  /* Vehicle Model Legend inside Layers Popover */
  .legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 6px; }
  .legend-item {
    display: flex; align-items: center; gap: 6px; padding: 3px 6px;
    border-radius: 4px; background: rgba(255,255,255,0.03);
    font-family: var(--font-mono); font-size: 9.5px; color: var(--muted);
  }
  .ask-watcher-banner {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
    padding: 10px 12px; border-radius: 8px;
    background: rgba(255,255,255,0.04); border: 1px solid var(--border-strong);
  }

  /* Right Vertical 3D Camera Rail (Google Earth / Anduril Precision) */
  .map-tools {
    position: absolute; right: 14px; top: 50%; transform: translateY(-54%); z-index: 16;
    display: flex; flex-direction: column; gap: 2px; padding: 3px;
    background: rgba(11, 13, 16, 0.86); backdrop-filter: blur(12px);
    border: 1px solid var(--border); border-radius: 8px;
    transition: right 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  }
  body.wb-open .map-tools { right: 414px; }
  .tool-btn {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    background: none; border: 1px solid transparent; border-radius: 5px;
    color: var(--muted); font-size: 13px; font-family: var(--font-mono); font-weight: 600;
    transition: all 0.12s;
  }
  .tool-btn:hover { color: var(--text); background: rgba(255,255,255,0.07); }
  .tool-btn.active { color: #e0f2fe; background: rgba(125, 211, 252, 0.16); border-color: rgba(125, 211, 252, 0.42); }
  .tool-btn svg { width: 15px; height: 15px; }
  .tool-sep { height: 1px; background: var(--border); margin: 3px 4px; }

  .layer-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 5px 6px; border-radius: 5px; cursor: pointer; font-size: 11.5px;
    background: transparent; border: none; width: 100%; text-align: left; color: var(--muted);
  }
  .layer-row:hover { background: rgba(255,255,255,0.05); color: var(--text); }
  .layer-row[aria-pressed="true"] { color: var(--text); }
  .layer-check {
    width: 13px; height: 13px; border: 1px solid var(--border-strong); border-radius: 3px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 9px; flex-shrink: 0;
  }
  .layer-row[aria-pressed="true"] .layer-check { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
  .swatch { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

  /* Distance Measure & Spatial Recon Pill (positioned below top-left strip — zero overlap at 1440x900!) */
  .measure-pill {
    position: absolute; top: 56px; left: 50%; transform: translateX(-50%); z-index: 22;
    display: none; align-items: center; gap: 10px;
    max-width: min(560px, calc(100vw - 380px));
    padding: 6px 12px; border-radius: 7px;
    background: rgba(11, 13, 16, 0.94); backdrop-filter: blur(12px);
    border: 1px solid var(--border-strong);
    font-family: var(--font-mono); font-size: 11px;
  }
  .measure-pill > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .measure-pill.open { display: inline-flex; }

  /* Unified 36px Bottom Hairline Dock: Telemetry · Time Window · Editorial Breaking Wire */
  .hud-dock {
    position: absolute; left: 0; right: 0; bottom: 0; height: 36px; z-index: 38;
    display: grid; grid-template-columns: auto auto minmax(min(180px, 100%), 1fr) auto; align-items: center; gap: 14px;
    padding: 0 14px;
    background: rgba(7, 8, 10, 0.94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--border);
  }
  .dock-telemetry {
    display: inline-flex; align-items: center; gap: 10px;
    font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); white-space: nowrap;
  }
  .dock-div { width: 1px; height: 14px; background: var(--border); flex-shrink: 0; }
  .dock-time { display: inline-flex; align-items: center; gap: 6px; }
  .tw-btns { display: inline-flex; gap: 1px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); border-radius: 5px; padding: 1px; }
  .tw-btn {
    padding: 2px 6px; border-radius: 4px; background: transparent;
    border: none; color: var(--quiet); font-family: var(--font-mono); font-size: 10px;
  }
  .tw-btn:hover { color: var(--text); }
  .tw-btn.active { background: var(--raised); color: var(--text); font-weight: 600; }
  .dock-slider { width: 64px; accent-color: var(--accent); cursor: pointer; height: 3px; }
  .signal-banner {
    display: inline-flex; align-items: center; gap: 8px; min-width: 0; justify-self: end;
    max-width: 100%; background: none; border: none; color: var(--muted);
    padding: 3px 6px; border-radius: 5px; text-align: left;
  }
  .signal-banner:hover { background: rgba(255,255,255,0.05); color: var(--text); }
  .signal-banner .sig-k { font-family: var(--font-mono); font-size: 9.5px; color: var(--crit); text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }
  .signal-banner .sig-t { font-size: 11.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .dock-clock {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--font-mono); font-size: 10.5px; color: var(--quiet); white-space: nowrap;
  }

  /* Hover Tooltip & Right-Click Tactical Context Menu */
  #globeTooltip {
    position: fixed; z-index: 65; pointer-events: none; display: none;
    background: rgba(9, 11, 14, 0.96); border: 1px solid var(--border-strong);
    border-radius: 6px; padding: 6px 9px; max-width: 280px; font-family: var(--font-mono);
  }
  .tt-k { font-size: 9px; color: var(--quiet); letter-spacing: 0.07em; text-transform: uppercase; }
  .tt-t { font-size: 12px; color: var(--text); font-weight: 600; margin-top: 2px; font-family: var(--font-sans); }
  .tt-m { font-size: 10px; color: var(--muted); margin-top: 2px; }
  #globeCtxMenu {
    position: fixed; z-index: 80; display: none; min-width: 232px;
    background: rgba(8, 10, 14, 0.97); backdrop-filter: blur(16px);
    border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.72);
  }
  #globeCtxMenu .ctx-head {
    padding: 5px 8px 6px; border-bottom: 1px solid var(--border); margin-bottom: 3px;
    font-family: var(--font-mono); font-size: 10px; color: var(--quiet);
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
  }
  #globeCtxMenu .ctx-btn {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 6px 8px; border: none; border-radius: 4px; background: transparent;
    color: var(--text); font-size: 11.5px; text-align: left; cursor: pointer;
  }
  #globeCtxMenu .ctx-btn:hover { background: rgba(255, 255, 255, 0.08); }
  #globeCtxMenu .ctx-btn .ctx-k { font-family: var(--font-mono); font-size: 9.5px; color: var(--quiet); }
  .dock-sector {
    display: none; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 4px;
    background: rgba(56, 189, 248, 0.12); border: 1px solid rgba(56, 189, 248, 0.36);
    color: #7dd3fc; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.04em;
    cursor: pointer; white-space: nowrap;
  }
  .dock-sector:hover { background: rgba(56, 189, 248, 0.22); color: #e0f2fe; }
  .kg-canvas-wrap {
    position: relative; width: 100%; height: 480px; background: #06080c;
    border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  }
  .kg-canvas-wrap canvas { width: 100%; height: 100%; display: block; cursor: grab; }
  .kg-canvas-wrap canvas:active { cursor: grabbing; }

  /* Right Dockable Live Monitor Workbench (Editorial Wire Drawer) */
  .workbench {
    position: fixed; top: 48px; right: 0; bottom: 0; width: 400px; max-width: 100vw; z-index: 35;
    display: flex; flex-direction: column;
    background: rgba(11, 13, 16, 0.97); backdrop-filter: blur(18px);
    border-left: 1px solid var(--border);
    transform: translateX(410px); visibility: hidden;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.22s;
  }
  body.view-globe .workbench { bottom: 36px; }
  body.wb-open .workbench { transform: translateX(0); visibility: visible; transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s; }
  .wb-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 10px 14px; border-bottom: 1px solid var(--border);
  }
  .wb-tabs {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px;
    padding: 6px 10px; border-bottom: 1px solid var(--border); background: var(--bg);
  }
  .wb-tab {
    padding: 5px 4px; border-radius: 5px; background: transparent; border: 1px solid transparent;
    color: var(--muted); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  }
  .wb-tab:hover { color: var(--text); }
  .wb-tab.active { background: var(--raised); border-color: var(--border); color: var(--text); }
  .wb-body { flex: 1; overflow-y: auto; padding: 8px 12px 18px; display: flex; flex-direction: column; gap: 0; }
  .feed-item {
    padding: 10px 4px; border-bottom: 1px solid var(--border);
    display: flex; flex-direction: column; gap: 4px;
  }
  .feed-item:last-child { border-bottom: none; }
  .feed-item:hover { background: rgba(255,255,255,0.025); }

  /* Slide-Over Object Inspector Dossier (docked cleanly left of 3D Globe controls strip) */
  .dossier {
    position: fixed; top: 60px; right: 66px; width: 372px; max-width: calc(100vw - 84px);
    max-height: calc(100vh - 112px); z-index: 45;
    display: flex; flex-direction: column;
    background: rgba(11, 13, 16, 0.97); backdrop-filter: blur(18px);
    border: 1px solid var(--border-strong); border-radius: 9px;
    box-shadow: 0 22px 54px rgba(0, 0, 0, 0.72);
    transform: translateX(460px); opacity: 0; pointer-events: none;
    /* Closed, it is also invisible to keyboard and screen readers (visibility flips after the slide). */
    visibility: hidden;
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.14s ease, right 0.22s ease, visibility 0s linear 0.2s;
  }
  body.wb-open.view-globe .dossier { right: 466px; }
  .dossier.open {
    transform: translateX(0); opacity: 1; pointer-events: auto; visibility: visible;
    transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.14s ease, right 0.22s ease, visibility 0s;
  }
  /* Over the page views only actor profiles show; map inspectors wait for the globe. */
  body:not(.view-globe) .dossier { right: 16px; max-height: calc(100vh - 76px); }
  body:not(.view-globe) .dossier:not([data-kind="entity"]) { display: none; }
  .dossier-head { display: flex; justify-content: space-between; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .dossier-head > div { min-width: 0; } /* a long title wraps; the close button never leaves the panel */
  .dossier-head h2:focus { outline: none; }
  .dossier-head h2:focus-visible { outline: 1.5px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
  .icon-btn { width: 30px; height: 30px; padding: 0; justify-content: center; flex-shrink: 0; }
  .icon-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .dossier-body { overflow-y: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }

  /* =====================================================================
     PAGE VIEWS: INVESTIGATE · DECISIONS · AGENTS · SOURCE ATLAS
     ===================================================================== */
  .page-view { display: none; min-height: calc(100vh - 48px); overflow-y: auto; }
  .page-view.active { display: block; }
  .wrap { max-width: 1460px; margin: 0 auto; padding: 24px 28px 48px; }
  .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
  .page-head h1 {
    font-family: var(--font-heading); font-size: clamp(26px, 2.8vw, 38px);
    font-weight: 500; line-height: 1.06; letter-spacing: -0.03em; margin-top: 5px;
  }
  .page-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }

  /* A control the key's role does not allow: shown, explained in its title, never sent. */
  [data-role-locked] { opacity: 0.45; cursor: not-allowed; }
  .auth-who { font-size: 11px; color: var(--muted); margin-bottom: 7px; overflow-wrap: anywhere; }
  .auth-who[hidden] { display: none; }

  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .subnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 11px; margin-bottom: 14px; }
  .subnav-group { display: inline-flex; gap: 4px; }
  .subnav-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; flex-shrink: 0; }
  .subnav-btn {
    padding: 6px 12px; border-radius: 6px; background: transparent; white-space: nowrap;
    border: 1px solid transparent; color: var(--muted); font-size: 13px; font-weight: 500;
  }
  .subnav-btn:hover { color: var(--text); background: var(--surface); }
  .subnav-btn.active, .subnav-btn[aria-current="page"] { background: var(--raised); border-color: var(--border-strong); color: var(--text); }
  .pillbar { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
  #invSubbar:empty { display: none; }

  /* Investigate > Actors directory */
  .actors-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
  .actors-search { position: relative; flex: 1 1 280px; min-width: 0; }
  .actors-search svg {
    position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%);
    fill: none; stroke: var(--quiet); stroke-width: 2; pointer-events: none;
  }
  .actors-search .input { width: 100%; padding-left: 31px; }
  .actors-bar .select { max-width: 220px; }
  .actors-check { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; padding: 6px 2px; }
  .actors-check input { accent-color: var(--accent); width: 15px; height: 15px; }
  .actors-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
  .actors-status .mono { font-size: 11px; color: var(--quiet); }
  .actors-table td { padding-top: 8px; padding-bottom: 8px; }
  .actors-table td.num, .actors-table th.num { text-align: right; white-space: nowrap; }
  .actors-table th.num .th-sort { margin-left: auto; }
  .th-sort {
    display: inline-flex; align-items: center; gap: 4px; padding: 0; background: none; border: none;
    font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer;
  }
  .th-sort:hover, th[aria-sort="ascending"] .th-sort, th[aria-sort="descending"] .th-sort { color: var(--text); }
  .th-arrow { display: inline-block; min-width: 8px; }
  .actors-table th { white-space: nowrap; }
  .link-btn {
    background: none; border: none; padding: 0; color: var(--text); font-weight: 600; font-size: 13px;
    text-align: left; cursor: pointer; text-decoration: none;
  }
  .link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
  .actor-name { min-width: 180px; }
  /* GDELT leads beside a situation: dashed and violet, so they read as machine-coded context, not sources */
  .lead-context { display: grid; gap: 5px; padding: 7px 9px; border: 1px dashed rgba(192,132,252,0.5); border-radius: 6px; background: rgba(192,132,252,0.05); min-width: 0; }
  .lead-context-k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: #d8b4fe; }
  .lead-context-item { display: grid; gap: 2px; min-width: 0; }
  .lead-context-t { font-size: 12px; line-height: 1.35; color: var(--text); overflow-wrap: anywhere; }
  button.lead-context-t { text-align: start; font-weight: 600; }
  .lead-context-m { font-size: 10.5px; color: var(--quiet); overflow-wrap: anywhere; }
  .lead-context-note { font-size: 10.5px; line-height: 1.4; color: var(--muted); }
  .actor-name .ev-tag { margin-left: 6px; vertical-align: 1px; }
  .actor-sub { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
  .phone-only { display: none; }
  .actor-bar {
    display: inline-block; width: calc(var(--w) * 0.48); max-width: 48px; height: 4px; margin-right: 8px;
    border-radius: 2px; background: var(--border-strong); vertical-align: middle;
  }
  .actor-san, .quiet { color: var(--quiet); font-size: 12px; }
  tr.is-flagged td { opacity: 0.72; }
  .actors-more { display: flex; justify-content: center; padding: 12px 0 4px; }
  .empty-state {
    display: grid; justify-items: center; gap: 10px; padding: 28px 16px; text-align: center;
    border: 1px dashed var(--border-strong); border-radius: 6px; color: var(--muted); font-size: 13px;
  }
  .empty-state p { max-width: 56ch; }

  .panel {
    position: relative;
    background: linear-gradient(180deg, rgba(16, 19, 24, 0.96) 0%, rgba(11, 13, 17, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-top-color: rgba(255, 255, 255, 0.16);
    border-radius: 5px;
    padding: var(--pad);
    min-width: 0;
  }
  .panel h2 { font-family: var(--font-heading); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin: 4px 0 10px; }
  .grid-2 { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(min(300px, 100%), 1fr); gap: var(--gap); align-items: start; }
  .grid-eq { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }
  .kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
  .stat-card {
    background: rgba(13, 15, 20, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-top: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 4px;
    padding: 11px 13px;
  }
  .stat-card .v { font-family: var(--font-heading); font-size: 21px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
  .stat-card .sub { font-family: var(--font-mono); font-size: 10px; color: var(--quiet); margin-top: 3px; }
  .big-metric { font-family: var(--font-heading); font-size: 40px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; margin: 6px 0; }

  .table-wrap { background: rgba(11, 13, 17, 0.96); border: 1px solid rgba(255, 255, 255, 0.09); border-radius: 4px; overflow: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
  th {
    text-align: left; font-family: var(--font-mono); font-size: 10px; font-weight: 500;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--quiet);
    padding: 9px 11px; border-bottom: 1px solid var(--border); background: var(--bg); white-space: nowrap;
  }
  td { padding: 9px 11px; border-bottom: 1px solid rgba(255,255,255,0.06); vertical-align: middle; }
  tr.clickable { cursor: pointer; }
  tr.clickable:hover td { background: rgba(255,255,255,0.035); }
  .report-row { padding: 11px 14px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
  .report-row:last-child { border-bottom: none; }
  .report-row:hover { background: rgba(255,255,255,0.025); }
  .pol-row { display: grid; grid-template-columns: 220px 1fr 56px; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,0.06); }
  .pol-track { position: relative; height: 7px; background: rgba(255,255,255,0.07); border-radius: 2px; }
  .pol-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: rgba(255,255,255,0.3); }
  .pol-fill { position: absolute; top: 0; bottom: 0; }
  .tri-bar { display: flex; height: 6px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
  .tri-b { background: #f1f1f1; } .tri-d { background: var(--crit); } .tri-u { background: #444; }

  /* Modals & Popovers */
  .modal-bg {
    position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,0.75);
    backdrop-filter: blur(5px); display: none; align-items: flex-start; justify-content: center; padding-top: 7vh;
  }
  .modal-bg.open { display: flex; }
  .modal {
    width: 680px; max-width: calc(100vw - 24px);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
    overflow: hidden; box-shadow: 0 28px 72px rgba(0,0,0,0.85);
  }
  .modal-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 15px; border-bottom: 1px solid var(--border); }

  /* Command palette (Ctrl/Cmd-K) */
  .palette-bg { padding-top: 12vh; z-index: 90; }
  .modal.palette { width: 640px; display: flex; flex-direction: column; max-height: min(620px, 76vh); }
  .palette-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .palette-head svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; flex-shrink: 0; }
  .palette-input {
    flex: 1; min-width: 0; background: transparent; border: none; outline: none;
    color: var(--text); font-size: 15px; padding: 4px 0;
  }
  .palette-input::placeholder { color: var(--quiet); }
  .palette-input:focus-visible { outline: none; }
  .palette-close {
    font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); background: transparent;
    border: 1px solid var(--border); border-radius: 4px; padding: 3px 7px; min-height: 26px;
  }
  .palette-close:hover { color: var(--text); border-color: var(--border-strong); }
  .palette-list { overflow-y: auto; padding: 4px 0 6px; overscroll-behavior: contain; }
  .palette-sec {
    padding: 10px 14px 4px; font-family: var(--font-mono); font-size: 10px; font-weight: 500;
    letter-spacing: 0.08em; text-transform: uppercase; color: var(--quiet);
  }
  .palette-opt { display: grid; gap: 2px; padding: 8px 14px; margin: 0 6px; border-radius: 6px; cursor: pointer; }
  .palette-opt.active { background: rgba(255, 255, 255, 0.08); }
  .palette-opt-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .palette-opt-label { font-size: 13.5px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .palette-opt-sub { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .palette-empty { padding: 22px 14px; text-align: center; color: var(--muted); font-size: 13px; }
  .palette-loading { padding: 8px 14px 2px; text-align: left; font-size: 11.5px; color: var(--quiet); }
  .palette-foot {
    display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border);
    font-size: 11px; color: var(--quiet);
  }
  .palette-foot .kbd { margin-right: 3px; }

  /* How is X connected to Y (uboat-connect.js): each path is a rail of actors (dots) and the hops
     between them; a co-mention hop is dashed, a same-organization step dotted. */
  .conn-path { display: grid; gap: 6px; padding: 8px 10px; background: var(--raised); border: 1px solid var(--border); border-radius: 6px; font-size: 12px; min-width: 0; }
  .conn-path.weak { border-style: dashed; }
  .conn-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
  .conn-rail { display: grid; gap: 2px; padding-left: 14px; min-width: 0; }
  .conn-node {
    position: relative; display: block; width: 100%; text-align: left; background: none; border: 0; padding: 2px 0;
    font-weight: 600; font-size: 12.5px; color: var(--text); cursor: pointer; overflow-wrap: anywhere; min-height: 24px;
  }
  .conn-node::before { content: ""; position: absolute; left: -14px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
  .conn-node:hover span:first-child, .conn-node:focus-visible span:first-child { text-decoration: underline; }
  .conn-hop { display: grid; gap: 3px; margin-left: -10px; padding: 3px 0 5px 12px; border-left: 2px solid var(--border-strong); color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
  .conn-hop.weak { border-left-style: dashed; border-left-color: var(--warn); }
  .conn-hop.same { border-left-style: dotted; border-left-color: var(--ok); }
  .conn-hop-head { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; color: var(--text); }
  .conn-ev { padding: 4px 7px; background: var(--surface); border: 1px solid var(--border); border-radius: 5px; display: grid; gap: 2px; font-size: 11.5px; }
  .conn-ev .mono { font-size: 10.5px; color: var(--quiet); overflow-wrap: anywhere; }
  .modal-body { padding: 15px; max-height: 75vh; overflow-y: auto; }
  .popover {
    position: fixed; top: 54px; right: 14px; z-index: 70; width: 324px;
    max-height: calc(100vh - 108px); overflow-y: auto;
    background: rgba(11, 13, 16, 0.97); backdrop-filter: blur(16px);
    border: 1px solid var(--border-strong); border-radius: 9px;
    padding: 13px; box-shadow: 0 20px 52px rgba(0,0,0,0.82); display: none;
  }
  .popover.open { display: block; }
  .ws-preset {
    display: flex; align-items: center; justify-content: space-between; width: 100%;
    padding: 7px 9px; border-radius: 6px; background: transparent; border: 1px solid transparent;
    text-align: left; font-size: 12.5px; color: var(--muted);
  }
  .ws-preset:hover { background: var(--raised); color: var(--text); }
  .ws-preset.active { background: var(--raised); border-color: var(--border-strong); color: var(--text); font-weight: 600; }
  .divider { height: 1px; background: var(--border); margin: 11px 0; }
  .empty { padding: 22px 12px; text-align: center; color: var(--quiet); font-family: var(--font-mono); font-size: 12px; }

  /* Tactical Optics Viewport Filters (Zero-overhead GPU look modes) */
  #globeMap.optics-nvg canvas { filter: sepia(100%) hue-rotate(78deg) saturate(2.5) contrast(1.22) brightness(0.92); }
  #globeMap.optics-thermal canvas { filter: contrast(1.42) brightness(1.06) hue-rotate(195deg) saturate(2.4) invert(0.08); }
  #globeMap.optics-blueprint canvas { filter: sepia(100%) hue-rotate(182deg) saturate(2.8) contrast(1.24) brightness(0.94); }
  .smart-item.kbd-active { background: rgba(56, 189, 248, 0.14) !important; border-left: 2px solid #38bdf8; }

  /* Plain-language source confidence */
  .conf-badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 1px 7px 1px 6px;
    border-radius: 999px; font-size: 10.5px; font-weight: 500; line-height: 16px;
    color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--c) 32%, transparent); white-space: nowrap;
  }
  .conf-badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
  .conf-card {
    border: 1px solid var(--border); border-left: 2px solid var(--c);
    background: rgba(255,255,255,0.025); border-radius: 6px; padding: 9px 11px; display: grid; gap: 6px;
  }
  .conf-card-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
  .conf-card-head strong { color: var(--c); font-weight: 600; }
  .conf-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
  .conf-card-src { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--quiet); }
  .conf-reasons { margin: 0; padding-left: 16px; display: grid; gap: 2px; font-size: 11.5px; color: var(--muted); line-height: 1.45; }
  .conf-note { font-size: 11px; border-radius: 4px; padding: 6px 8px; }
  .conf-note.bad { color: #fca5a5; background: rgba(239,68,68,.10); border: 1px solid rgba(239,68,68,.28); }
  .conf-outlets { font-size: 11px; color: var(--quiet); }
  .smart-sec-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 5px 10px 4px; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--quiet); background: rgba(255,255,255,0.025);
    border-top: 1px solid var(--border);
  }

  /* Today · Developing Situations Dock (calm floating analyst landing panel — always clears bottom map legend) */
  .today-dock {
    position: absolute; top: 56px; left: 14px; z-index: 18; width: 306px; max-height: calc(100vh - 196px);
    background: rgba(10, 12, 16, 0.88); backdrop-filter: blur(16px);
    border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
    display: flex; flex-direction: column; overflow: hidden;
    transition: width 0.2s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s;
  }
  .today-dock.collapsed { width: auto; }
  .today-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
    padding: 8px 10px; border: none; border-bottom: 1px solid var(--border); cursor: pointer;
    background: transparent; color: var(--text); text-align: left; min-height: 36px;
  }
  .today-head:hover { background: rgba(255,255,255,0.03); }
  .today-dock.collapsed .today-head { border-bottom: none; }
  .today-dock.collapsed .today-list { display: none; }
  .today-list { overflow-y: auto; display: grid; }
  .today-item {
    display: grid; gap: 3px; padding: 9px 11px; border: none; border-bottom: 1px solid rgba(255,255,255,0.05);
    background: transparent; text-align: left; color: var(--text); cursor: pointer;
    transition: background 0.12s;
  }
  .today-item:last-child { border-bottom: none; }
  .today-item:hover { background: rgba(255,255,255,0.05); }
  .today-item-top { display: flex; align-items: center; gap: 6px; font-size: 10px; font-family: var(--font-mono); color: var(--quiet); text-transform: uppercase; letter-spacing: 0.04em; }
  .today-item-place { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .today-item-title { font-size: 12px; font-weight: 500; line-height: 1.32; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .today-item-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 10.5px; color: var(--muted); }
  .trend-tag { font-family: var(--font-mono); font-size: 9px; padding: 0 5px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); text-transform: uppercase; }
  .trend-tag.rising, .trend-tag.new { color: #7dd3fc; border-color: rgba(125,211,252,0.35); background: rgba(125,211,252,0.08); }

  /* Persistent Compact Map Legend (bottom-left above dock) */
  .map-legend {
    position: absolute; left: 14px; bottom: 46px; z-index: 16;
    display: inline-flex; align-items: center; gap: 11px; padding: 5px 10px;
    background: rgba(10, 12, 16, 0.84); backdrop-filter: blur(12px);
    border: 1px solid var(--border); border-radius: 7px;
    font-family: var(--font-mono); font-size: 9.5px; color: var(--muted);
  }
  .lg-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
  .lg-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
  .lg-ring { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #f5a524; display: inline-block; }
  .lg-item[hidden] { display: none; }
  .lg-lead { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #c084fc; border: 1.5px solid #f5f3ff; }
  .lg-lead.hollow { background: transparent; border-color: #c084fc; margin-left: -2px; }
  .lg-beacon { width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #7dd3fc; box-shadow: inset 0 0 0 2px rgba(10,12,16,0.9), inset 0 0 0 4px #7dd3fc; display: inline-block; }

  /* Loading Skeletons & Clean Situations / Area Brief Cards */
  @keyframes ubShimmer { 0% { opacity: 0.35; } 50% { opacity: 0.7; } 100% { opacity: 0.35; } }
  .skel-list { display: grid; gap: 10px; padding: 6px 2px; }
  .skel-card { padding: 11px; border-radius: 7px; border: 1px solid var(--border); background: rgba(255,255,255,0.025); display: grid; gap: 7px; animation: ubShimmer 1.4s ease-in-out infinite; }
  .skel-line { height: 10px; border-radius: 4px; background: rgba(255,255,255,0.09); }
  .skel-line.w40 { width: 40%; }
  .skel-line.w75 { width: 75%; }
  .skel-line.w95 { width: 95%; }
  .sit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(410px, 100%), 1fr)); gap: 12px; }
  .sit-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
    padding: 14px; display: grid; gap: 9px; min-width: 0; overflow: hidden;
    transition: border-color 0.14s, background 0.14s;
  }
  .sit-card:hover { border-color: var(--border-strong); background: rgba(21, 24, 30, 0.92); }
  /* Flex/grid items default to min-width:auto and never shrink, so long report titles widened the
     card instead of truncating with their ellipsis. */
  .sit-card div, .sit-card a { min-width: 0; }
  /* Titles and places come from feeds: a long unbroken token (a URL, a hash, a run-on name) wraps
     instead of running out of the card, the Today list or the inspector. */
  .sit-title, .today-item-title, .dossier-head h2, #dossierSub { overflow-wrap: anywhere; }
  /* Feed titles and names carry dir="auto": Arabic or Hebrew text reads right to left, from its own edge. */
  .today-item-title, .palette-opt-label, .link-btn { text-align: start; }
  .brief-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .brief-stat { padding: 7px 9px; border-radius: 6px; background: var(--raised); border: 1px solid var(--border); }
  .brief-stat .k { font-family: var(--font-mono); font-size: 9px; text-transform: uppercase; color: var(--quiet); }
  .brief-stat .v { font-family: var(--font-mono); font-size: 14px; font-weight: 600; color: var(--text); margin-top: 2px; }
  .cal-notice {
    display: flex; align-items: flex-start; gap: 10px; padding: 11px 13px; border-radius: 8px;
    background: rgba(125, 211, 252, 0.06); border: 1px solid rgba(125, 211, 252, 0.22);
    font-size: 12.5px; color: var(--muted); line-height: 1.5;
  }
  .cal-notice strong { color: var(--text); }
  .adv-disclosure { border: 1px solid var(--border); border-radius: 9px; background: var(--surface); margin-top: 14px; }
  .adv-disclosure > summary {
    padding: 12px 15px; cursor: pointer; font-weight: 600; font-size: 13.5px; list-style: none;
    display: flex; align-items: center; justify-content: space-between; color: var(--text);
  }
  .adv-disclosure > summary::-webkit-details-marker { display: none; }
  .adv-disclosure[open] > summary { border-bottom: 1px solid var(--border); }
  .adv-disclosure-body { padding: 14px; display: grid; gap: 14px; }

  /* Keep MapLibre compact attribution cleanly above dock and clear of bottom-left legend */
  .maplibregl-ctrl-bottom-right { bottom: 42px !important; right: 56px !important; }
  .maplibregl-ctrl-bottom-left { bottom: 82px !important; left: 14px !important; }

  /* UBOAT v10 Below-the-Surface Deep Dossier & Framing Components */
  .depth-section {
    border: 1px solid var(--border); border-radius: 8px;
    background: rgba(255, 255, 255, 0.022); padding: 10px 11px; display: grid; gap: 7px;
  }
  .depth-head {
    display: flex; align-items: center; justify-content: space-between; gap: 6px;
    font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--quiet);
  }
  .blindspot-banner {
    padding: 7px 9px; border-radius: 6px; font-size: 11.5px; line-height: 1.4;
    color: #fde68a; background: rgba(245, 165, 36, 0.10); border: 1px solid rgba(245, 165, 36, 0.32);
  }
  .bloc-chips { display: flex; gap: 5px; flex-wrap: wrap; }
  .bloc-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px;
    border-radius: 999px; font-family: var(--font-mono); font-size: 10px;
    background: rgba(125, 211, 252, 0.09); border: 1px solid rgba(125, 211, 252, 0.25); color: #bae6fd;
  }
  .bloc-chip.warn { background: rgba(245, 165, 36, 0.10); border-color: rgba(245, 165, 36, 0.30); color: #fde68a; }
  .bloc-chip.ok { background: rgba(74, 222, 128, 0.10); border-color: rgba(74, 222, 128, 0.28); color: #bbf7d0; }
  .reality-verdict {
    padding: 8px 10px; border-radius: 6px; font-size: 12px; line-height: 1.45;
    border: 1px solid var(--border); background: var(--raised);
  }
  .reality-verdict.aligned { border-left: 3px solid #4ade80; }
  .reality-verdict.divergence { border-left: 3px solid #f5a524; background: rgba(245, 165, 36, 0.06); }
  .reality-verdict.neutral { border-left: 3px solid #7dd3fc; }
  .mkt-strip { display: flex; gap: 5px; flex-wrap: wrap; }
  .mkt-pill {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px;
    border-radius: 5px; font-family: var(--font-mono); font-size: 10px;
    background: rgba(15, 23, 42, 0.65); border: 1px solid var(--border); color: var(--text);
  }
  .persp-row {
    padding: 6px 8px; border-radius: 5px; background: var(--raised);
    border: 1px solid var(--border); display: grid; gap: 3px;
  }
  .ripple-row {
    display: flex; justify-content: space-between; align-items: center; gap: 8px;
    padding: 6px 8px; border-radius: 5px; background: var(--raised);
    border: 1px solid var(--border); font-size: 11.5px;
  }

  @media (max-width: 1080px) {
    /* Grid columns may shrink below the min-content of a wide table or a row of inputs (tables scroll
       inside themselves): Watchers measured 1089 px in a 768 px window and 626 px in a 390 px one. */
    .wrap .grid-2 > *, .wrap .grid-eq > *, .wrap [style*="display:grid"] > * { min-width: 0; }
    .site-header { grid-template-columns: auto minmax(150px, 220px) 1fr auto; gap: 6px; padding: 0 10px; }
    .main-nav { gap: 1px; }
    .main-nav .nav-btn { padding: 5px 8px; font-size: 12px; }
    .live-pill, .dock-clock .sync-txt { display: none; }
  }
  @media (max-width: 720px) {
    .site-header { grid-template-columns: auto 1fr auto; }
    .brand-btn .lockup, .main-nav { display: none; }
    .brand-btn .signet { display: block; }
    .grid-2, .grid-eq { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .hud-dock { grid-template-columns: 1fr auto; }
    .dock-time, .signal-banner { display: none; }
    .wrap { padding: 16px 14px 36px; }
  }

  /* Phones: the primary nav was hidden here with nothing in its place, so views other than the
     globe were unreachable. It becomes a bottom tab bar in place of the telemetry strip (which
     overflowed the screen), and the floating panels leave the map and its controls visible. */
  @media (max-width: 720px) {
    .main-nav {
      display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
      height: calc(48px + env(safe-area-inset-bottom)); padding: 0 6px env(safe-area-inset-bottom);
      justify-content: space-around; gap: 0;
      background: rgba(7, 8, 10, 0.96); backdrop-filter: blur(14px);
      border-top: 1px solid var(--border);
    }
    .main-nav .nav-btn { flex: 1; height: 38px; padding: 0 4px; font-size: 12px; }
    /* A backdrop-filter makes the header the containing block of the fixed tab bar; it is 94% opaque anyway. */
    .site-header { backdrop-filter: none; -webkit-backdrop-filter: none; }
    .hud-dock { display: none; }
    .wrap { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
    .header-right { gap: 4px; }
    /* The "Wire" word stays for screen readers (the button would otherwise be named "80"). */
    #wbToggleBtn > span:not(.mono) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .header-right .ws-btn[aria-label] { display: none; } /* the key button opens the same popover */
    .globe-strip { max-width: calc(100vw - 28px); overflow-x: auto; scrollbar-width: none; }
    .globe-strip::-webkit-scrollbar { display: none; }
    .today-dock { width: calc(100vw - 84px); max-height: 42vh; }
    .map-legend { bottom: calc(56px + env(safe-area-inset-bottom)); max-width: calc(100vw - 28px); overflow-x: auto; }
    .maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: calc(88px + env(safe-area-inset-bottom)) !important; }
    body.view-globe .workbench, .workbench { bottom: calc(48px + env(safe-area-inset-bottom)); }
    #hudToast { bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
    /* Wide data tables scroll sideways inside their view instead of widening the page. */
    .wrap table { display: block; max-width: 100%; overflow-x: auto; }
    /* Situation cards: the badge row may wrap. */
    .sit-head > div { flex-wrap: wrap; }
    /* Views set two-column grids inline (e.g. 270px 1fr for Reports & Threads), which beats the
       stylesheet's single-column rule: stack them on phones. */
    .wrap .grid-2[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
    /* Investigate's section and event bars wrapped to five rows and pushed the first result below
       the fold: one row each, scrolled sideways, edge to edge. */
    .subnav, .pillbar {
      flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
      margin-left: -14px; margin-right: -14px; padding-left: 14px; padding-right: 14px;
      scroll-padding-inline: 14px;
    }
    .subnav::-webkit-scrollbar, .pillbar::-webkit-scrollbar { display: none; }
    .subnav { padding-bottom: 8px; margin-bottom: 10px; }
    .subnav-btn { min-height: 40px; padding: 0 12px; }
    .pillbar .btn { flex-shrink: 0; }
    /* Actors: name, reports and sanctions fit a phone; kind and country move under the name. */
    .actors-search { flex-basis: 100%; }
    .actors-bar .select, .actors-check { flex: 1 1 40%; min-width: 0; max-width: none; min-height: 40px; }
    .actors-table .hdr-extra { display: none; }
    .actors-table .col-opt { display: none; }
    .actors-table .phone-only { display: block; }
    .actors-table table { display: table; }
    .actor-name { min-width: 0; }
    .actor-bar { display: none; }
    .actors-table th, .actors-table td { padding-left: 9px; padding-right: 9px; }
    /* The inspector becomes a bottom sheet above the tab bar instead of a column beside the camera rail. */
    .dossier, body:not(.view-globe) .dossier {
      top: auto; left: 8px; right: 8px; bottom: calc(56px + env(safe-area-inset-bottom));
      width: auto; max-width: none; max-height: 72vh; transform: translateY(24px);
    }
    .dossier.open { transform: none; }
    body.wb-open.view-globe .dossier { right: 8px; }
    .palette-bg { padding-top: 8px; }
    .modal.palette { max-height: calc(100vh - 72px - env(safe-area-inset-bottom)); }
    .palette-opt { padding: 10px 12px; }
    .palette-foot { display: none; }
    /* Touch targets: small buttons were 24-27 px tall. */
    .btn.sm { min-height: 36px; }
    .strip-btn { height: 34px; }
    .tw-btn, .wb-tab { min-height: 32px; }
    .today-item { padding: 11px 12px; }
  }

  /* Reduced motion: state still changes, without travel. Panels appear in place instead of sliding,
     skeletons hold still, and the globe stops rotating and pulsing (uboat-core.js). */
  @media (prefers-reduced-motion: reduce) {
    .skel-card { animation: none; opacity: 0.6; }
    .workbench, body.wb-open .workbench, .dossier, .dossier.open, .today-dock, .map-tools,
    .maplibregl-ctrl-bottom-right, .smart-row, .btn, .tool-btn, .strip-btn, .sit-card {
      transition-duration: 0s !important;
    }
    .dossier { transform: none !important; }
  }
