/* ═══════════════════════════════════════════════════════════════
   WORLD MONITOR TERMINAL — Live multiview intelligence desk
   Super-responsive · self-explaining · self-maintaining
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg-0: #07080b;
  --bg-1: #0b0d12;
  --bg-2: #11141b;
  --bg-3: #181c26;
  --bg-4: #222733;
  --border: #2a3140;
  --border-hi: #3d4658;
  --amber: #f5a623;
  --amber-dim: #b87a12;
  --amber-glow: rgba(245, 166, 35, 0.14);
  --orange: #ff6b1a;
  --green: #00c853;
  --green-dim: #1a7a3c;
  --red: #ff3b30;
  --blue: #4a9eff;
  --cyan: #00d4ff;
  --purple: #b388ff;
  --yellow: #ffd60a;
  --text: #e8eaed;
  --text-dim: #9aa3b5;
  --text-mute: #5a6275;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
  --sans: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --radius: 4px;
  --topbar-h: 44px;
  --context-h: 40px;
  --ticker-h: 78px;
  --bottom-h: 200px;
  --side-w: 128px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --widget-min-h: 120px;
  --ease: 0.12s ease;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.mono { font-family: var(--mono); }
.accent { color: var(--amber); }
em { font-style: normal; font-family: var(--mono); color: var(--amber); font-weight: 600; }
code { font-family: var(--mono); font-size: 0.92em; color: var(--amber); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  color: var(--text);
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--amber-dim);
  box-shadow: 0 0 0 2px var(--amber-glow);
}

/* ─── Shell ─── */
.terminal {
  display: grid;
  grid-template-rows: var(--topbar-h) var(--context-h) 1fr var(--bottom-h);
  height: 100dvh;
  width: 100vw;
  max-height: 100dvh;
  background:
    radial-gradient(ellipse 90% 40% at 50% -10%, rgba(245, 166, 35, 0.05), transparent 55%),
    var(--bg-0);
}

.body-row {
  display: grid;
  grid-template-columns: var(--side-w) 1fr;
  min-height: 0;
  overflow: hidden;
}
.main-col {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

/* ─── Top bar ─── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 12px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border-bottom: 1px solid var(--border);
  z-index: 40;
  min-width: 0;
}

.topbar-left, .topbar-right, .topbar-center {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-center { flex: 1; justify-content: center; max-width: 640px; margin: 0 auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
}
/* Modern timeless mark: globe + amber lens */
.brand-logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #c5cae9;
  flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(74,158,255,0.08));
  border: 1px solid rgba(74, 158, 255, 0.22);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.25) inset, 0 2px 10px rgba(0, 0, 0, 0.25);
}
.brand-logo svg {
  display: block;
  width: 22px;
  height: 22px;
}
.brand-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text);
  line-height: 1.15;
}
.brand-name .accent {
  color: var(--amber);
  font-weight: 700;
}
.brand-name-sep { letter-spacing: 0.1em; }
/* Blue blinking terminal cursor (replaces green LIVE chip) */
.brand-live {
  display: inline-flex;
  align-items: center;
  align-self: center;
  margin-left: 2px;
  height: 14px;
  padding: 0 1px;
}
.brand-cursor {
  display: block;
  width: 7px;
  height: 13px;
  background: #4a9eff;
  border-radius: 1px;
  box-shadow: 0 0 8px rgba(74, 158, 255, 0.65);
  animation: cursor-blink 1.05s step-end infinite;
}
@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.view-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-0);
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 5px 10px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  border-radius: var(--radius);
  white-space: nowrap;
  transition: all var(--ease);
}
.tab:hover { color: var(--text); background: var(--bg-3); }
.tab.active { color: var(--bg-0); background: var(--amber); }
.tab:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

.search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 120px;
  max-width: 280px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 8px;
  height: 30px;
}
.search-box:focus-within { border-color: var(--amber-dim); }
.search-ico { color: var(--text-mute); font-size: 14px; }
.search-box input {
  border: none;
  background: transparent;
  padding: 0;
  width: 100%;
  font-size: 11px;
  box-shadow: none !important;
}
.search-box input::placeholder { color: var(--text-mute); }

.time-range {
  display: flex;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
}
.time-range button {
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
}
.time-range button:hover { color: var(--amber); background: var(--bg-3); }
.time-range button.active {
  color: var(--amber);
  background: var(--amber-glow);
  box-shadow: inset 0 -2px 0 var(--amber);
}

.feed-health {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-0);
  cursor: pointer;
}
.fh-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-mute);
}
.fh-dot.ok { background: var(--green); box-shadow: 0 0 6px var(--green); }
.fh-dot.warn { background: var(--amber); box-shadow: 0 0 6px var(--amber); }
.fh-dot.err { background: var(--red); box-shadow: 0 0 6px var(--red); }
.fh-count { color: var(--text-mute); }

.status-live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  color: #4a9eff;
  letter-spacing: 0.1em;
}
.pulse {
  width: 2px;
  height: 11px;
  border-radius: 1px;
  background: #4a9eff;
  box-shadow: 0 0 6px rgba(74, 158, 255, 0.7);
  animation: cursor-blink 1.05s step-end infinite;
}

.clock-block { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.clock-label { font-size: 8px; color: var(--text-mute); font-family: var(--mono); letter-spacing: 0.1em; }
.clock { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--amber); }

.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-0);
  color: var(--text-dim);
  font-size: 14px;
  transition: all var(--ease);
  flex-shrink: 0;
}
.icon-btn:hover, .icon-btn[aria-pressed="true"] {
  color: var(--amber);
  border-color: var(--amber-dim);
  background: var(--amber-glow);
}

/* ─── Flash + Indices (two full-width rows — nothing clipped) ─── */
.ticker-wrap {
  display: flex;
  flex-direction: column;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  min-height: var(--ticker-h);
  height: auto;
  overflow: visible;
  flex-shrink: 0;
}

.flash-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  height: 36px;
  min-height: 36px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}

.indices-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  height: 42px;
  min-height: 42px;
  min-width: 0;
}

.ticker-label,
.indices-label {
  display: grid;
  place-items: center;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
  z-index: 2;
  flex-shrink: 0;
}
.ticker-label { background: var(--red); }
.indices-label {
  background: #1565c0;
  letter-spacing: 0.06em;
}

.ticker {
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
  width: 100%;
  mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.ticker-track {
  display: flex;
  gap: 36px;
  white-space: nowrap;
  animation: scroll-ticker 70s linear infinite;
  width: max-content;
  padding: 0 16px;
  will-change: transform;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes scroll-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-item {
  font-family: var(--mono);
  font-size: 11px;
  color: #ffb74d;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 480px;
}
.ticker-item .t-txt {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 380px;
  color: #ffb74d;
}
.ticker-item:has(.sev.crit),
.ticker-item.brk {
  background: rgba(120, 12, 12, 0.65);
  padding: 2px 8px;
  border-radius: 2px;
}
.ticker-item:has(.sev.crit) .t-txt {
  color: #ffd54f;
  font-weight: 600;
}
.ticker-item .sev { font-weight: 700; flex-shrink: 0; }
.ticker-item .sev.crit { color: var(--red); }
.ticker-item .sev.high { color: var(--orange); }
.ticker-item .sev.med { color: var(--amber); }
.ticker-item .sev.info { color: var(--blue); }
.ticker-item .tag {
  color: #ff8f00;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
}
.brk-flag {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #ffd54f;
  background: #8b0000;
  padding: 1px 4px;
  border-radius: 1px;
  flex-shrink: 0;
}

.macro-strip {
  display: flex;
  align-items: stretch;
  gap: 1px;
  background: var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
  width: 100%;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hi) transparent;
  -webkit-overflow-scrolling: touch;
}
.macro-chip {
  background: var(--bg-1);
  padding: 4px 10px;
  min-width: 92px;
  cursor: pointer;
  transition: background var(--ease);
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
  border-right: 1px solid rgba(42, 49, 64, 0.6);
}
.macro-chip:hover, .macro-chip.active { background: var(--bg-3); }
.macro-chip.active { box-shadow: inset 0 -2px 0 var(--amber); }
.macro-chip .ms-sym {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-mute);
  letter-spacing: 0.06em;
  line-height: 1.2;
}
.macro-chip .ms-val {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  white-space: nowrap;
}
.macro-chip .ms-chg {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}
.ms-chg.up { color: var(--green); }
.ms-chg.down { color: var(--red); }
.ms-chg.flat { color: var(--text-mute); }

/* ─── Workspace / widgets ─── */
.workspace {
  min-height: 0;
  overflow: auto;
  position: relative;
  padding: 6px 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hi) transparent;
}

.layout-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: var(--amber-glow);
  border: 1px solid var(--amber-dim);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--text-dim);
  position: sticky;
  top: 0;
  z-index: 15;
}
/* Must win over display:flex so DONE fully hides the bar */
.layout-banner[hidden] {
  display: none !important;
}
.layout-banner strong {
  font-family: var(--mono);
  color: var(--amber);
  letter-spacing: 0.08em;
  font-size: 10px;
}

.widget-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-auto-rows: minmax(100px, auto);
  gap: 7px;
  align-content: start;
}

.widget {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 5px;
  display: flex;
  flex-direction: column;
  min-height: var(--widget-min-h);
  min-width: 0;
  position: relative;
  overflow: hidden;
  transition: border-color var(--ease), box-shadow var(--ease), opacity var(--ease);
  grid-column: span 4;
  grid-row: span 2;
}
.widget:hover { border-color: var(--border-hi); }
.widget.collapsed { min-height: 0; grid-row: span 1 !important; }
.widget.collapsed .widget-body,
.widget.collapsed .widget-resize { display: none; }

/* Size presets via data-w / data-h */
.widget[data-w="3"] { grid-column: span 3; }
.widget[data-w="4"] { grid-column: span 4; }
.widget[data-w="5"] { grid-column: span 5; }
.widget[data-w="6"] { grid-column: span 6; }
.widget[data-w="8"] { grid-column: span 8; }
.widget[data-w="12"] { grid-column: span 12; }
.widget[data-h="1"] { grid-row: span 1; min-height: 80px; }
.widget[data-h="2"] { grid-row: span 2; }
.widget[data-h="3"] { grid-row: span 3; min-height: 220px; }
.widget[data-h="4"] { grid-row: span 4; min-height: 300px; }

.widget-grid[data-edit="true"] .widget {
  cursor: grab;
  border-style: dashed;
}
.widget-grid[data-edit="true"] .widget:active { cursor: grabbing; }
.widget-grid[data-edit="true"] .widget-grip { color: var(--amber); }

.widget-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  user-select: none;
}
.widget-grip {
  color: var(--text-mute);
  font-size: 12px;
  cursor: grab;
  padding: 0 2px;
}
.widget-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--amber);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.widget-meta {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-mute);
  flex-shrink: 0;
}
.widget-help, .widget-collapse {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: var(--text-mute);
  border-radius: var(--radius);
  font-size: 11px;
  flex-shrink: 0;
}
.widget-help:hover, .widget-collapse:hover { color: var(--amber); background: var(--bg-3); }

.widget-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  scrollbar-width: thin;
}

.widget-resize {
  position: absolute;
  right: 0; bottom: 0;
  width: 14px; height: 14px;
  cursor: se-resize;
  background: linear-gradient(135deg, transparent 50%, var(--border-hi) 50%);
  opacity: 0;
  transition: opacity var(--ease);
}
.widget:hover .widget-resize,
.widget-grid[data-edit="true"] .widget-resize { opacity: 1; }

/* Widget content primitives */
.w-empty {
  display: grid;
  place-items: center;
  text-align: center;
  height: 100%;
  min-height: 80px;
  color: var(--text-mute);
  font-size: 11px;
  padding: 16px;
  gap: 6px;
}
.w-empty strong { color: var(--text-dim); font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em; }

.layer-list { display: flex; flex-direction: column; gap: 2px; }
.layer-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px; border-radius: var(--radius); cursor: pointer;
}
.layer-item:hover { background: var(--bg-3); }
.layer-item .swatch { width: 8px; height: 8px; border-radius: 1px; flex-shrink: 0; }
.layer-item .lname { flex: 1; font-size: 11px; }
.layer-item .lcount { font-family: var(--mono); font-size: 10px; color: var(--text-mute); }
.layer-item .toggle {
  width: 28px; height: 14px; background: var(--bg-4);
  border: 1px solid var(--border-hi); border-radius: 7px; position: relative; flex-shrink: 0;
}
.layer-item .toggle::after {
  content: ""; position: absolute; top: 1px; left: 1px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--text-mute); transition: all var(--ease);
}
.layer-item.on .toggle { background: var(--amber-glow); border-color: var(--amber-dim); }
.layer-item.on .toggle::after { left: 15px; background: var(--amber); }
.layer-item:not(.on) .lname { color: var(--text-mute); }
.layer-item:not(.on) .swatch { opacity: 0.35; }

.theater-row, .alert-row, .news-row, .quake-row, .log-row {
  display: grid;
  gap: 2px 8px;
  padding: 7px 4px;
  border-bottom: 1px solid rgba(42, 49, 64, 0.45);
  cursor: pointer;
  transition: background var(--ease);
}
.theater-row:hover, .alert-row:hover, .news-row:hover, .quake-row:hover { background: var(--bg-3); }

.theater-row {
  grid-template-columns: 1fr auto;
}
.tname { font-size: 11px; font-weight: 500; }
.tposture {
  font-family: var(--mono); font-size: 8px; font-weight: 700;
  letter-spacing: 0.04em; padding: 1px 5px; border-radius: var(--radius); align-self: start;
}
.tposture.critical { color: #fff; background: var(--red); }
.tposture.elevated { color: var(--bg-0); background: var(--orange); }
.tposture.watch { color: var(--bg-0); background: var(--amber); }
.tposture.stable { color: var(--green); background: rgba(0, 200, 83, 0.12); border: 1px solid var(--green-dim); }
.tmeta { grid-column: 1 / -1; font-family: var(--mono); font-size: 9px; color: var(--text-mute); }

.alert-row { grid-template-columns: 8px 1fr; align-items: start; }
.a-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 4px; }
.a-dot.crit { background: var(--red); box-shadow: 0 0 6px var(--red); }
.a-dot.high { background: var(--orange); }
.a-dot.med { background: var(--amber); }
.a-title { font-size: 11px; font-weight: 500; }
.a-sub { font-family: var(--mono); font-size: 9px; color: var(--text-mute); }

.news-row { grid-template-columns: 1fr; }
.news-src {
  font-family: var(--mono); font-size: 8px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--cyan);
}
.news-title { font-size: 11px; font-weight: 500; line-height: 1.35; }
.news-meta { font-family: var(--mono); font-size: 9px; color: var(--text-mute); }
.news-row.flash .news-title { color: var(--amber); }

.hot-row { margin-bottom: 8px; cursor: pointer; }
.hot-top { display: flex; justify-content: space-between; margin-bottom: 3px; }
.hot-name { font-size: 11px; font-weight: 500; }
.hot-score { font-family: var(--mono); font-size: 11px; font-weight: 700; }
.hot-bar { height: 3px; background: var(--bg-4); border-radius: 2px; overflow: hidden; }
.hot-bar > i { display: block; height: 100%; border-radius: 2px; }
.hot-delta { font-family: var(--mono); font-size: 9px; color: var(--text-mute); margin-top: 2px; }
.hot-delta.up { color: var(--red); }
.hot-delta.down { color: var(--green); }

.market-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  margin: -8px;
}
.mkt-cell { background: var(--bg-1); padding: 8px 10px; min-height: 52px; }
.m-sym { font-family: var(--mono); font-size: 9px; color: var(--text-mute); letter-spacing: 0.06em; }
.m-val { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.m-chg { font-family: var(--mono); font-size: 10px; }
.m-chg.up { color: var(--green); }
.m-chg.down { color: var(--red); }

.ind-intro {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--amber);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  padding: 6px 8px;
  background: var(--amber-glow);
  border: 1px solid rgba(245, 166, 35, 0.25);
  border-radius: var(--radius);
}
.ind-grid { display: flex; flex-direction: column; gap: 8px; }
.ind-card {
  padding: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}
.ind-card:hover { border-color: var(--amber-dim); background: var(--bg-3); }
.ind-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.ind-name { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.06em; color: var(--amber); }
.ind-label { font-size: 10px; color: var(--text-mute); margin-bottom: 4px; }
.ind-val { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.ind-desc, .ind-read { font-size: 10px; color: var(--text-dim); margin-top: 4px; line-height: 1.45; }
.ind-desc strong, .ind-read strong { color: var(--text-mute); font-weight: 600; }
.ind-delta { font-size: 9px; color: var(--text-mute); margin-top: 4px; }
.ind-explain, .ind-read-line { font-size: 11px; color: var(--text-dim); line-height: 1.45; margin: 6px 0; }
.ind-bar { height: 4px; background: var(--bg-4); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.ind-bar > i { display: block; height: 100%; border-radius: 2px; transition: width 0.5s ease; }
.ind-spark {
  display: flex; align-items: flex-end; gap: 2px; height: 24px; margin-top: 6px;
}
.ind-spark span {
  flex: 1; background: var(--amber-dim); border-radius: 1px 1px 0 0; min-height: 2px;
  opacity: 0.7;
}

.cii-row {
  display: grid; grid-template-columns: 56px 1fr 28px; align-items: center; gap: 8px;
  margin-bottom: 6px; font-size: 11px;
}
.ccode { font-family: var(--mono); font-weight: 600; color: var(--text-dim); }
.cii-bar { height: 4px; background: var(--bg-4); border-radius: 2px; overflow: hidden; }
.cii-bar > i { display: block; height: 100%; }
.cval { font-family: var(--mono); font-size: 10px; font-weight: 600; text-align: right; }

.infra-row {
  display: flex; align-items: center; gap: 8px; font-size: 11px; padding: 4px 0;
}
.i-name { flex: 1; color: var(--text-dim); }
.i-stat {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.04em; padding: 1px 5px; border-radius: var(--radius);
}
.i-stat.ok { color: var(--green); background: rgba(0, 200, 83, 0.1); }
.i-stat.warn { color: var(--amber); background: var(--amber-glow); }
.i-stat.crit { color: var(--red); background: rgba(255, 59, 48, 0.12); }

/* Map */
.map-wrap {
  position: relative;
  height: 100%;
  min-height: 200px;
  background: radial-gradient(ellipse at 50% 55%, #0d1520, var(--bg-0));
  border-radius: var(--radius);
  overflow: hidden;
  cursor: crosshair;
}
#worldMap { width: 100%; height: 100%; display: block; min-height: 200px; }
.map-land { fill: #1a2332; stroke: #2a3a50; stroke-width: 0.6; }
.map-ocean { fill: #0a1018; }
.marker { cursor: pointer; }
.marker.dimmed { opacity: 0.15; pointer-events: none; }
.marker-pulse { animation: marker-pulse 2.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes marker-pulse {
  0% { opacity: 0.7; }
  100% { opacity: 0; }
}
.map-coords {
  position: absolute; bottom: 6px; right: 6px;
  font-family: var(--mono); font-size: 9px; color: var(--text-mute);
  background: rgba(8, 9, 12, 0.8); padding: 3px 6px; border: 1px solid var(--border);
}
.map-legend {
  position: absolute; bottom: 6px; left: 6px;
  display: flex; flex-wrap: wrap; gap: 6px;
  font-family: var(--mono); font-size: 8px; color: var(--text-dim);
  background: rgba(8, 9, 12, 0.85); padding: 5px 7px; border: 1px solid var(--border);
}
.map-legend i {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 3px;
}

.quake-row { grid-template-columns: 40px 1fr; }
.q-mag {
  font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--orange);
}
.q-place { font-size: 11px; }
.q-meta { font-family: var(--mono); font-size: 9px; color: var(--text-mute); }

.health-list { display: flex; flex-direction: column; gap: 4px; }
.health-row {
  display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center;
  font-size: 11px; padding: 4px 0;
}
.health-row .dot { width: 7px; height: 7px; border-radius: 50%; }
.health-row .name { color: var(--text-dim); }
.health-row .age { font-family: var(--mono); font-size: 9px; color: var(--text-mute); }
.health-row .st { font-family: var(--mono); font-size: 9px; font-weight: 700; }

/* ─── Bottom multiview / vertical tape ─── */
.bottom-bar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg-1);
  border-top: 1px solid var(--border);
  min-height: 0;
  padding-bottom: var(--safe-b);
}

.stream-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  min-width: 0;
}
.stream-hint {
  font-size: 8px;
  color: var(--text-mute);
  letter-spacing: 0.08em;
  padding-right: 10px;
  white-space: nowrap;
  flex-shrink: 0;
}

.stream-tabs {
  display: flex; gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.stream-tabs .st {
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.stream-tabs .st:hover { color: var(--text); }
.stream-tabs .st.active { color: var(--amber); border-bottom-color: var(--amber); }

/* Single-column vertical tape */
.stream-pane.vertical-tape.single-col,
.stream-pane.list-mode {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  gap: 0;
  background: var(--bg-0);
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hi) transparent;
}

/* Multiview — 4 equal columns (real terminal tape) */
.stream-pane.multiview-tape {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  overflow: hidden;
  min-height: 0;
}

.mv-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg-0);
  overflow: hidden;
}
.mv-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.mv-head span {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--amber);
}
.mv-head em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-mute);
}
.mv-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-hi) transparent;
  -webkit-overflow-scrolling: touch;
}
.mv-col[data-col="news"] .mv-head span { color: var(--cyan); }
.mv-col[data-col="markets"] .mv-head span { color: #82b1ff; }
.mv-col[data-col="events"] .mv-head span { color: var(--orange); }
.mv-col[data-col="disasters"] .mv-head span { color: #80cbc4; }

.vt-row {
  display: grid;
  grid-template-columns: 40px 52px 1fr;
  gap: 4px 6px;
  align-items: start;
  padding: 4px 6px;
  border-bottom: 1px solid rgba(42, 49, 64, 0.4);
  border-left: 2px solid transparent;
  cursor: pointer;
  transition: background var(--ease);
  font-size: 10px;
  line-height: 1.3;
}
.multiview-tape .vt-row {
  grid-template-columns: 36px 48px 1fr;
  font-size: 10px;
}
.vt-row:hover { background: var(--bg-3); }
.vt-row.crit { border-left-color: var(--red); }
.vt-row.high { border-left-color: var(--orange); }
.vt-row.med { border-left-color: var(--amber); }
.vt-row.info { border-left-color: var(--blue); }
.vt-row.answer { border-left-color: var(--green); }
.vt-time { color: var(--text-mute); font-size: 9px; padding-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-src {
  color: var(--cyan);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.03em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-top: 2px;
}
.vt-title {
  color: #ffb74d; /* amber/orange headline — high readability */
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 500;
}
.vt-title b { color: #ffcc80; font-weight: 700; }
/* Breaking / critical: dark-red rail + amber text on deep red wash */
.vt-row.crit {
  background: linear-gradient(90deg, rgba(120, 12, 12, 0.55), rgba(40, 8, 8, 0.35));
  border-left-color: #ff1744;
}
.vt-row.crit .vt-title {
  color: #ffd54f;
  font-weight: 600;
  text-shadow: 0 0 12px rgba(255, 60, 40, 0.25);
}
.vt-row.crit .vt-src { color: #ff8a80; }
.vt-row.high .vt-title { color: #ff9800; }
.vt-row.info .vt-title { color: #ffb74d; }
.vt-row.med .vt-title { color: #ffc107; }
.vt-row.answer .vt-title { color: #69f0ae; }

/* News panels (main widgets) same language */
.news-title {
  color: #ffb74d !important;
  font-weight: 500;
}
.news-row.flash {
  background: linear-gradient(90deg, rgba(120, 12, 12, 0.45), transparent);
  border-left: 3px solid #ff1744;
  padding-left: 6px;
}
.news-row.flash .news-title {
  color: #ffd54f !important;
  font-weight: 600;
}
.news-src { color: #ff8f00 !important; }
.vt-empty {
  padding: 12px 8px;
  text-align: center;
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 9px;
}

.event-card, .stream-news-card { display: none; }

@media (max-width: 1100px) {
  .stream-pane.multiview-tape {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .stream-pane.multiview-tape {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    overflow-y: auto;
  }
  .mv-col { min-height: 120px; max-height: 160px; }
}

.func-keys {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 4px 10px;
  background: var(--bg-0);
  border-top: 1px solid var(--border);
  font-family: var(--mono); font-size: 9px; color: var(--text-mute);
}
.func-keys kbd {
  display: inline-block; padding: 1px 4px;
  background: var(--bg-3); border: 1px solid var(--border-hi);
  border-radius: 2px; color: var(--amber); font-family: var(--mono); font-size: 8px; margin-right: 2px;
}
.fk-right { margin-left: auto; }
.dev-credit {
  margin-left: 10px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-mute);
  opacity: 0.55;
  white-space: nowrap;
  user-select: none;
}
.dev-credit:hover { opacity: 0.85; color: var(--text-dim); }

@media (max-width: 900px) {
  .dev-credit { display: none; } /* keep footer clean on small screens; still in HTML source */
}

/* ─── Buttons ─── */
.btn-amber {
  background: var(--amber); color: var(--bg-0);
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.06em; padding: 6px 12px; border-radius: var(--radius);
}
.btn-amber:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; color: var(--text-dim);
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.04em; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.btn-ghost:hover { color: var(--amber); border-color: var(--amber-dim); }
.btn-ghost.danger:hover { color: var(--red); border-color: var(--red); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* ─── Drawer ─── */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(380px, 100vw);
  background: rgba(12, 14, 19, 0.98);
  border-left: 1px solid var(--amber-dim);
  z-index: 60;
  transform: translateX(100%);
  transition: transform 0.22s ease;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.drawer.open { transform: translateX(0); }
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  z-index: 55;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--bg-2); border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--amber); letter-spacing: 0.06em;
}
#drawerClose { width: 28px; height: 28px; font-size: 20px; color: var(--text-mute); display: grid; place-items: center; }
#drawerClose:hover { color: var(--text); }
.drawer-body { padding: 14px; overflow-y: auto; flex: 1; }
.drawer-body .d-type { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 0.1em; color: var(--amber); margin-bottom: 4px; }
.drawer-body h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; line-height: 1.3; }
.drawer-body .d-meta {
  display: grid; grid-template-columns: 90px 1fr; gap: 4px 8px;
  font-family: var(--mono); font-size: 10px; margin-bottom: 12px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.drawer-body .d-meta span:nth-child(odd) { color: var(--text-mute); }
.drawer-body p { color: var(--text-dim); line-height: 1.5; margin-bottom: 10px; }
.d-sev {
  display: inline-block; padding: 2px 8px; font-family: var(--mono);
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em; border-radius: var(--radius); margin-bottom: 10px;
}
.d-sev.critical { background: var(--red); color: #fff; }
.d-sev.high { background: var(--orange); color: #fff; }
.d-sev.elevated { background: var(--amber); color: var(--bg-0); }
.d-sev.watch { background: var(--blue); color: #fff; }
.d-sev.info { background: var(--bg-4); color: var(--text-dim); }
.drawer-body a { color: var(--cyan); }

/* ─── Modal ─── */
.modal {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0, 0, 0, 0.65);
  display: grid; place-items: center; padding: 16px;
}
.modal[hidden] { display: none !important; }
.modal-card {
  width: min(640px, 100%);
  max-height: min(88dvh, 800px);
  background: var(--bg-1);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-2);
}
.modal-head h2 {
  font-family: var(--mono); font-size: 12px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--amber);
}
.modal-body { padding: 16px; overflow-y: auto; flex: 1; }
.settings-sec { margin-bottom: 20px; }
.settings-sec h3 {
  font-family: var(--mono); font-size: 10px; font-weight: 700;
  letter-spacing: 0.08em; color: var(--text-dim); margin-bottom: 10px;
}
.settings-grid {
  display: grid; grid-template-columns: 1fr 100px; gap: 8px; align-items: center;
}
.settings-grid label { font-size: 11px; color: var(--text-dim); }
.hint { font-size: 11px; color: var(--text-mute); margin-top: 10px; line-height: 1.5; }
.dev-credit-settings {
  opacity: 0.65;
  font-size: 10px !important;
  letter-spacing: 0.03em;
}

/* About — what / for / do / why */
.about-block {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(74, 158, 255, 0.06), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--blue);
}
.about-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--amber);
  margin: 10px 0 6px;
}
.about-title:first-child { margin-top: 0; }
.about-block p {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
  margin: 0 0 4px;
}
.about-list {
  margin: 6px 0 8px 18px;
  padding: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
}
.about-list li { margin-bottom: 4px; }
.about-privacy {
  margin-top: 10px !important;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: var(--radius);
  font-size: 11px !important;
  color: var(--text-mute) !important;
}
.about-privacy strong { color: var(--cyan); }

/* Help / tour disclaimer */
.disclaimer-foot {
  margin-top: 14px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-mute);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0 0 var(--radius) var(--radius);
}
.disclaimer-foot strong {
  color: var(--text-dim);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 4px;
}
.tour-disclaimer {
  margin-top: 12px;
  margin-bottom: 0;
  padding: 8px 10px;
  font-size: 9px;
  text-align: center;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.feed-toggles { display: flex; flex-direction: column; gap: 4px; }
.feed-tog {
  display: flex; align-items: center; gap: 8px; font-size: 11px; padding: 4px 0; cursor: pointer;
}
.feed-tog input { accent-color: var(--amber); }

.ind-edit {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px; margin-bottom: 8px;
}
.ind-edit .row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px;
}
.ind-edit .weights { display: grid; grid-template-columns: 1fr 60px; gap: 6px; font-size: 10px; }
.ind-edit .weights label { display: flex; justify-content: space-between; align-items: center; color: var(--text-dim); gap: 8px; }
.ind-edit input[type="range"] { width: 100%; accent-color: var(--amber); }

/* ─── Tour ─── */
.tour-overlay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0, 0, 0, 0.55);
  display: grid; place-items: end center;
  padding: 24px;
  padding-bottom: max(24px, var(--safe-b));
}
.tour-overlay[hidden] { display: none !important; }
.tour-card {
  width: min(420px, 100%);
  background: var(--bg-2);
  border: 1px solid var(--amber-dim);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.tour-step { font-family: var(--mono); font-size: 9px; color: var(--amber); letter-spacing: 0.1em; margin-bottom: 6px; }
.tour-card h3 { font-size: 15px; margin-bottom: 8px; }
.tour-card p { color: var(--text-dim); font-size: 12px; line-height: 1.5; margin-bottom: 14px; }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ─── Tooltip / toast ─── */
.tooltip {
  position: fixed; z-index: 90;
  max-width: 260px;
  padding: 8px 10px;
  background: var(--bg-3);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--text);
  line-height: 1.4;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.tooltip[hidden] { display: none !important; }

.toast {
  position: fixed; bottom: calc(var(--bottom-h) + 12px); left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3); border: 1px solid var(--amber-dim);
  color: var(--amber); font-family: var(--mono); font-size: 11px;
  padding: 8px 16px; border-radius: var(--radius); z-index: 100;
  box-shadow: var(--shadow); max-width: 90vw; text-align: center;
}
.toast[hidden] { display: none !important; }

/* Streaming highlight for new items */
@keyframes flash-in {
  0% { background: var(--amber-glow); }
  100% { background: transparent; }
}
.flash-in { animation: flash-in 1.2s ease; }

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  .widget[data-w="3"], .widget[data-w="4"], .widget[data-w="5"] { grid-column: span 6; }
  .widget[data-w="6"], .widget[data-w="8"] { grid-column: span 12; }
  :root { --bottom-h: 190px; --ticker-h: 78px; }
  .macro-chip { min-width: 84px; padding: 4px 8px; }
}

@media (max-width: 768px) {
  .terminal {
    grid-template-rows: auto auto 1fr auto;
    height: 100dvh;
  }
  .topbar {
    flex-wrap: wrap;
    height: auto;
    padding: 8px;
    gap: 8px;
  }
  .topbar-center {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }
  .topbar-left { flex: 1; min-width: 0; }
  .brand-name { display: none; }
  .search-box { max-width: none; flex: 1; }
  .time-range button { padding: 5px 6px; }
  .widget-grid { grid-template-columns: 1fr; }
  .widget, .widget[data-w="3"], .widget[data-w="4"],
  .widget[data-w="5"], .widget[data-w="6"], .widget[data-w="8"],
  .widget[data-w="12"] {
    grid-column: span 1 !important;
  }
  .widget[data-h="3"], .widget[data-h="4"] { grid-row: span 2; min-height: 220px; }
  :root { --bottom-h: 180px; --ticker-h: 72px; }
  .ticker-item { font-size: 10px; }
  .ticker-item .t-txt { max-width: 220px; }
  .indices-label, .ticker-label { font-size: 7px; }
  .func-keys span:not(.fk-right) { display: none; }
  .func-keys .fk-right { margin-left: 0; }
  .drawer { width: 100vw; }
  .market-grid { grid-template-columns: 1fr 1fr; }
  .status-live span:last-child { display: none; }
  .clock-label { display: none; }
}

@media (max-width: 420px) {
  .view-tabs .tab { padding: 5px 7px; font-size: 8px; }
  .fh-count, #fhLabel { display: none; }
  .event-card, .stream-news-card { flex: 0 0 200px; }
}

@media (min-width: 1600px) {
  .widget-grid { gap: 10px; }
  html { font-size: 13px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ticker-track, .pulse, .marker-pulse, .brand-cursor { animation: none !important; }
  .brand-cursor, .pulse { opacity: 1 !important; }
  * { transition-duration: 0.01ms !important; }
}

/* Print */
@media print {
  .topbar, .ticker-wrap, .bottom-bar, .drawer, .modal, .tour-overlay { display: none !important; }
  .terminal { display: block; height: auto; }
  .workspace { overflow: visible; }
}

/* --- V3 PROFESSIONAL SHELL --- */
.brand-text { display: flex; flex-direction: column; line-height: 1.15; gap: 1px; }
.brand-sub {
  font-size: 8px;
  font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.context-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  min-width: 0;
  z-index: 30;
}
.ctx-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.ctx-group.grow { flex: 1; min-width: 120px; max-width: 220px; }
.ctx-group.grow select { width: 100%; }
.ctx-label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  white-space: nowrap;
}
.domain-pills { display: flex; gap: 3px; flex-wrap: nowrap; }
.domain-pill {
  padding: 4px 8px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--bg-0);
  white-space: nowrap;
}
.domain-pill:hover { color: var(--amber); border-color: var(--amber-dim); }
.domain-pill.active {
  color: var(--bg-0);
  background: var(--amber);
  border-color: var(--amber);
}
.ctx-focus-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--amber-glow);
  border: 1px solid var(--amber-dim);
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--amber);
  white-space: nowrap;
}
.ctx-focus-chip button {
  width: 18px; height: 18px;
  border-radius: 50%;
  color: var(--text-mute);
}
.ctx-focus-chip button:hover { color: var(--red); background: var(--bg-3); }

/* Side nav — pre-configured desks */
.side-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 5px;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  min-height: 0;
}
#deskNav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-height: 0;
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 8px;
  border-radius: var(--radius);
  color: var(--text-dim);
  text-align: left;
  border: 1px solid transparent;
  transition: all var(--ease);
  width: 100%;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active {
  background: var(--amber-glow);
  border-color: var(--amber-dim);
  color: var(--amber);
}
.nav-ico { font-size: 11px; opacity: 0.9; line-height: 1; }
.nav-txt {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.nav-foot {
  margin-top: auto;
  padding: 8px 6px 4px;
  font-size: 9px;
  color: var(--amber);
  border-top: 1px solid var(--border);
}

.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 4px 2px 8px;
  flex-wrap: wrap;
}
.view-header h1 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--amber);
}
.view-header p {
  font-size: 11px;
  color: var(--text-mute);
  max-width: 560px;
  margin-top: 2px;
}
.view-header-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.btn-ghost.sm {
  padding: 3px 8px;
  font-size: 9px;
}
.pill {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 99px;
  background: var(--amber);
  color: var(--bg-0);
}
.pill.soft {
  background: var(--bg-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }

/* Map 3D */
.widget[data-id="map"] .widget-body {
  padding: 0;
  overflow: hidden;
}
.map-host {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 220px;
  border-radius: 0;
  overflow: hidden;
  background: #05070b;
}
#maplibre-root { width: 100%; height: 100%; }
.map3d-ctrl {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 4px;
}
.map3d-ctrl button {
  width: 28px; height: 28px;
  background: rgba(12,14,19,0.88);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-size: 14px;
}
.map3d-ctrl button:hover,
.map3d-ctrl button.active {
  color: var(--amber);
  border-color: var(--amber-dim);
}
.map3d-badge {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 4px 8px;
  background: rgba(12,14,19,0.88);
  border: 1px solid var(--border);
  color: var(--cyan);
  border-radius: var(--radius);
}
.maplibregl-ctrl-attrib {
  font-size: 9px !important;
  background: rgba(8,9,12,0.75) !important;
}
.svg-fallback .map3d-badge {
  position: absolute; top: 8px; left: 8px; z-index: 2;
}

/* KMRI hero */
.kmri-hero { cursor: pointer; }
.kmri-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-mute);
}
.kmri-val {
  font-family: var(--mono);
  font-size: 42px;
  font-weight: 700;
  line-height: 1.1;
  margin: 4px 0;
}
.kmri-delta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.ind-bar.big { height: 6px; margin-bottom: 10px; }
.driver-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  margin-bottom: 8px;
}
.driver {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 10px;
  color: var(--text-mute);
}
.driver b { color: var(--text); font-family: var(--mono); }
.driver em { margin-left: auto; font-style: normal; color: var(--text-mute); font-family: var(--mono); font-size: 9px; }
.ind-card.flagship {
  border-color: var(--amber-dim);
  box-shadow: 0 0 0 1px var(--amber-glow);
}

/* Briefs */
.brief-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}
.brief-title .mono { color: var(--text-mute); font-size: 11px; margin-left: 6px; }
.brief-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.brief-grid > div {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
}
.brief-grid span {
  display: block;
  font-size: 9px;
  font-family: var(--mono);
  color: var(--text-mute);
  letter-spacing: 0.06em;
}
.brief-grid b { font-size: 13px; }
.brief-list { font-size: 11px; color: var(--text-dim); margin-bottom: 8px; line-height: 1.6; }
.brief-list em { font-style: normal; font-size: 9px; margin-left: 4px; }
.btn-ghost.full { width: 100%; margin-top: 6px; }

.transport-row, .ins-row, .politics-row, .wx-row {
  padding: 7px 4px;
  border-bottom: 1px solid rgba(42,49,64,0.45);
  cursor: pointer;
}
.transport-row:hover, .wx-row:hover { background: var(--bg-3); }
.tr-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tr-name, .ins-name, .wx-name { font-size: 11px; font-weight: 500; }
.wx-world-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: min(420px, 50vh);
  overflow-y: auto;
  scrollbar-width: thin;
}
.wx-row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 4px 10px;
  align-items: center;
  padding: 7px 6px;
  border-bottom: 1px solid rgba(42, 49, 64, 0.4);
  cursor: pointer;
}
.wx-row:hover, .wx-row.active {
  background: rgba(0, 212, 255, 0.08);
}
.wx-row.active {
  border-left: 3px solid var(--cyan);
  padding-left: 4px;
}
.wx-temp {
  font-size: 16px;
  font-weight: 700;
  color: #80d8ff;
  text-align: right;
  line-height: 1.1;
}
.wx-name { font-size: 12px; font-weight: 500; }
.wx-code {
  font-size: 9px;
  color: var(--text-mute);
  font-weight: 600;
}
.wx-vals { font-size: 10px; color: var(--text-mute); }
.wx-row .i-stat { align-self: center; }
.mini-note {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-mute);
}
.mkt-cell.focused {
  outline: 1px solid var(--amber-dim);
  background: var(--amber-glow) !important;
}
.health-detail {
  font-size: 9px;
  color: var(--text-mute);
  margin: -2px 0 6px 18px;
  font-family: var(--mono);
}
.scenario-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.scenario-btn {
  text-align: left;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-2);
}
.scenario-btn:hover { border-color: var(--amber-dim); color: var(--text); }
.scenario-btn.active {
  border-color: var(--amber);
  color: var(--amber);
  background: var(--amber-glow);
}
.model-cat-row {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  background: var(--bg-2);
}
.model-cat-row.flagship { border-color: var(--amber-dim); }
.model-cat-row strong { color: var(--amber); font-family: var(--mono); }

.settings-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.stab {
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  border-bottom: 2px solid transparent;
}
.stab.active { color: var(--amber); border-bottom-color: var(--amber); }
.modal-card.wide { width: min(720px, 100%); }
.drawer-foot {
  font-size: 10px !important;
  color: var(--text-mute) !important;
  font-family: var(--mono) !important;
}

.search-suggest {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  z-index: 50;
}
.search-box { position: relative; }

@media (max-width: 1100px) {
  :root { --side-w: 72px; }
  .nav-txt { display: none; }
  .nav-item { align-items: center; }
  .brand-sub { display: none; }
}
@media (max-width: 768px) {
  .terminal {
    grid-template-rows: auto auto 1fr auto;
  }
  .body-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .side-nav {
    flex-direction: row;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 6px;
  }
  .nav-item { flex-direction: row; gap: 4px; padding: 6px 8px; flex-wrap: wrap; }
  .nav-txt { display: inline; font-size: 8px; white-space: nowrap; }
  .nav-hint, .nav-section, .nav-foot { display: none; }
  .context-bar { flex-wrap: wrap; height: auto; padding: 6px 8px; gap: 8px; }
  .ctx-group.grow { max-width: none; flex: 1 1 140px; }
  .domain-pills { max-width: 100%; overflow-x: auto; }
  .main-col { grid-template-rows: auto 1fr; }
  :root { --bottom-h: 200px; --ticker-h: 72px; --side-w: 0px; }
  .kmri-val { font-size: 32px; }
  .triad-board { grid-template-columns: 1fr; }
  .triad-x { display: none; }
  .radar-wrap { grid-template-columns: 1fr; }
  .pulse-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════
   V4 — WORLD INTELLIGENCE TERMINAL
   Answer Desk · Positive Paths · Hybrid map · Model radar
   ═══════════════════════════════════════════════════════════════ */

:root {
  --side-w: 148px;
  --glow-green: rgba(0, 200, 83, 0.12);
  --glow-cyan: rgba(0, 212, 255, 0.1);
}

.terminal {
  background:
    radial-gradient(ellipse 70% 35% at 12% -8%, rgba(0, 212, 255, 0.06), transparent 50%),
    radial-gradient(ellipse 60% 30% at 88% 0%, rgba(245, 166, 35, 0.06), transparent 45%),
    var(--bg-0);
}

/* Side nav sections */
.nav-section {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  padding: 8px 8px 4px;
}
.nav-item {
  position: relative;
  padding: 8px 10px;
}
.nav-hint {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.nav-item.active .nav-hint { color: rgba(245, 166, 35, 0.7); }
.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--amber);
  border-radius: 1px;
  box-shadow: 0 0 8px var(--amber);
}

.view-path {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--cyan);
  margin-bottom: 4px;
  opacity: 0.9;
}
.view-header-main { min-width: 0; }

/* Widget accent stripe */
.widget::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--w-accent, var(--border-hi)), transparent);
  opacity: 0.7;
  pointer-events: none;
}
.widget[data-id="answers"],
.widget[data-id="implications"] {
  border-color: rgba(0, 200, 83, 0.25);
  background:
    linear-gradient(180deg, var(--glow-green), transparent 48px),
    var(--bg-1);
}
.widget[data-id="map"] {
  border-color: rgba(0, 212, 255, 0.22);
}
.widget[data-id="kmri"],
.widget[data-id="radar"],
.widget[data-id="indicators"] {
  border-color: rgba(245, 166, 35, 0.22);
}

/* Layout edit UX */
body.layout-edit .widget-head { cursor: grab; }
body.is-dragging {
  cursor: grabbing !important;
  user-select: none !important;
}
/* Do NOT set pointer-events:none on widgets — breaks drop hit-testing */

.widget-ghost {
  position: fixed;
  z-index: 250;
  pointer-events: none;
  padding: 10px 14px;
  border: 1px solid var(--amber);
  box-shadow: 0 12px 40px rgba(0,0,0,0.55), 0 0 0 1px var(--amber-glow);
  border-radius: var(--radius);
  background: rgba(18, 21, 28, 0.96);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.widget-ghost .ghost-hint {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}

.widget.dragging {
  opacity: 0.45;
  border-style: dashed !important;
  border-color: var(--amber-dim) !important;
}
.widget.drag-over {
  border-color: var(--amber) !important;
  box-shadow: 0 0 0 2px var(--amber-glow), inset 0 0 0 1px rgba(245,166,35,0.35);
  background: rgba(245, 166, 35, 0.06) !important;
}
.widget.drop-before::before,
.widget.drop-after::after {
  content: "";
  position: absolute;
  left: 6px; right: 6px;
  height: 3px;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  z-index: 5;
  border-radius: 2px;
  pointer-events: none;
}
.widget.drop-before::before { top: 2px; }
.widget.drop-after::after { bottom: 2px; }

.widget-grid[data-edit="true"] {
  outline: 1px dashed rgba(245, 166, 35, 0.25);
  outline-offset: 2px;
  border-radius: var(--radius);
  padding: 2px;
}
.widget-grid[data-edit="true"] .widget.editable .widget-head {
  cursor: grab;
  background: linear-gradient(180deg, rgba(245,166,35,0.1), var(--bg-2));
}
.widget-grid[data-edit="true"] .widget-grip {
  color: var(--amber);
  padding: 2px 6px;
  border-radius: var(--radius);
  background: var(--amber-glow);
}
.widget-grid[data-edit="true"] .widget-resize {
  opacity: 1;
  width: 18px;
  height: 18px;
  background: linear-gradient(135deg, transparent 45%, var(--amber) 45%);
}

/* Map basemap switch */
.map-basemap-switch {
  display: flex;
  gap: 2px;
  background: rgba(12, 14, 19, 0.9);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
}
.map-basemap-switch button {
  width: auto !important;
  min-width: 0;
  height: 24px !important;
  padding: 0 7px !important;
  font-family: var(--mono);
  font-size: 8px !important;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  border: none !important;
  background: transparent !important;
  border-radius: 2px;
}
.map-basemap-switch button:hover { color: var(--text) !important; }
.map-basemap-switch button.active {
  color: var(--bg-0) !important;
  background: var(--cyan) !important;
}
.map3d-ctrl {
  flex-wrap: wrap;
  max-width: calc(100% - 50px);
  gap: 5px;
}

/* Answer Desk */
.answer-list { display: flex; flex-direction: column; gap: 8px; }
.answer-card {
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--ease), background var(--ease), transform var(--ease);
}
.answer-card:hover {
  background: var(--bg-3);
  border-color: var(--green-dim);
  transform: translateX(2px);
}
.answer-q {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.35;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.aq-ico {
  flex-shrink: 0;
  width: 18px; height: 18px;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  background: var(--green);
  color: var(--bg-0);
  border-radius: 3px;
}
.answer-a {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-bottom: 8px;
}
.answer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.answer-foot .conf {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--green);
  font-weight: 600;
}
.answer-foot .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.answer-foot .tags em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 600;
  padding: 2px 5px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-mute);
}
.answer-go {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border: 1px solid var(--green-dim);
  border-radius: var(--radius);
  color: var(--green);
  background: var(--glow-green);
}
.answer-go:hover { background: rgba(0, 200, 83, 0.22); }

/* Positive Paths / Implications */
.impl-intro {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--green);
  margin-bottom: 10px;
  padding: 6px 8px;
  background: var(--glow-green);
  border: 1px solid rgba(0, 200, 83, 0.25);
  border-radius: var(--radius);
}
.impl-list { display: flex; flex-direction: column; gap: 10px; }
.impl-card {
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-top: 2px solid var(--green);
}
.impl-card.sev-critical { border-top-color: var(--red); }
.impl-card.sev-high { border-top-color: var(--orange); }
.impl-card.sev-elevated { border-top-color: var(--amber); }
.impl-card.sev-watch { border-top-color: var(--blue); }
.impl-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.impl-topic {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--amber);
}
.impl-score {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.impl-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.45;
  padding: 4px 0;
  border-top: 1px solid rgba(42, 49, 64, 0.4);
}
.impl-row .il {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  padding-top: 2px;
}
.impl-row.path .il { color: var(--cyan); }
.impl-row.out {
  background: var(--glow-green);
  margin: 4px -4px 0;
  padding: 6px 4px;
  border-radius: var(--radius);
  border-top: none;
}
.impl-row.out .il { color: var(--green); }
.impl-row.out span:last-child { color: var(--text); font-weight: 500; }
.impl-row.mon .il { color: var(--amber); }

/* Triad board */
.triad-board {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  gap: 6px;
  align-items: stretch;
}
.triad-node {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  min-width: 0;
}
.tn-label {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.triad-node strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.25;
}
.triad-node em {
  display: block;
  font-style: normal;
  font-size: 10px;
  color: var(--text-mute);
  line-height: 1.35;
}
.triad-x {
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--amber);
  font-weight: 700;
  opacity: 0.7;
}
.triad-blurb {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 6px;
  padding: 8px;
  background: rgba(179, 136, 255, 0.06);
  border: 1px solid rgba(179, 136, 255, 0.2);
  border-radius: var(--radius);
}
.triad-kmri {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
  letter-spacing: 0.08em;
}

/* World Pulse */
.pulse-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.pulse-cell {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 6px;
  text-align: center;
  transition: border-color var(--ease);
}
.pulse-cell:hover { border-color: var(--border-hi); }
.pc-k {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.pc-v {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.1;
}

/* Model Radar */
.radar-wrap {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 8px;
  align-items: center;
  min-height: 180px;
}
.radar-svg {
  width: 100%;
  max-height: 220px;
  overflow: visible;
}
.radar-label {
  font-family: var(--mono);
  font-size: 7px;
  fill: var(--text-mute);
  font-weight: 600;
}
.radar-legend { display: flex; flex-direction: column; gap: 4px; }
.rl-row {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 6px;
  align-items: center;
  font-size: 10px;
}
.rl-row span {
  width: 8px; height: 8px;
  border-radius: 50%;
}
.rl-row b {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 10px;
  color: var(--text-dim);
}
.rl-row em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
}

/* Lens picker */
.lens-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.lens-btn {
  text-align: left;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all var(--ease);
}
.lens-btn strong {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}
.lens-btn span {
  font-size: 10px;
  color: var(--text-mute);
  line-height: 1.35;
}
.lens-btn:hover {
  border-color: var(--amber-dim);
  background: var(--bg-3);
}
.lens-btn.active {
  border-color: var(--amber);
  background: var(--amber-glow);
}
.lens-btn.active strong { color: var(--amber); }
.lens-btn.active span { color: var(--text-dim); }

/* ═══════════════════════════════════════════════════════════════
   HD market board · mountain charts · impact · grocery
   ═══════════════════════════════════════════════════════════════ */

.tooltip.rich {
  max-width: 300px;
  padding: 0;
  overflow: hidden;
  border-color: var(--amber-dim);
  background: rgba(12, 14, 19, 0.98);
}
.tooltip.rich .tip-win {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--bg-0);
  background: var(--amber);
  padding: 5px 10px;
}
.tooltip.rich .tip-body {
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--text);
}

.panel-banner {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--text-mute);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.panel-banner b { color: var(--amber); font-weight: 600; }

/* HD mountain chart canvas */
.bb-chart {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 40px;
  background: linear-gradient(180deg, #0a1228 0%, #060a14 100%);
  border-radius: 2px;
}
.bb-chart-host {
  height: 56px;
  margin: 6px 0 4px;
  border: 1px solid rgba(41, 98, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
  background: #060a14;
}
.bb-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.bb-board.compact {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.bb-board-card {
  background: linear-gradient(180deg, #0d1528 0%, #0a0e18 100%);
  border: 1px solid #1a2744;
  border-radius: 3px;
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.bb-board-card:hover {
  border-color: #2962ff;
  box-shadow: 0 0 0 1px rgba(41, 98, 255, 0.25), 0 8px 24px rgba(0, 0, 0, 0.35);
}
.bb-board-card.focused {
  border-color: var(--amber);
  box-shadow: 0 0 0 1px var(--amber-glow);
}
.bb-board-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.bb-sym {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #e8eaed;
}
.bb-sym i { color: var(--cyan); font-style: normal; font-size: 9px; }
.bb-name {
  font-size: 10px;
  color: #6b7388;
  margin-top: 2px;
  line-height: 1.25;
}
.bb-px { text-align: right; }
.bb-val {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.1;
}
.bb-val.xl { font-size: 28px; }
.bb-chg {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}
.bb-chg.up { color: #00e676; }
.bb-chg.down { color: #ff5252; }
.bb-chg.flat { color: #8b93a7; }
.bb-foot {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 8px;
  color: #5a6275;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mkt-board-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.mkt-board-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #82b1ff;
}
.mkt-board-sub {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 2px;
}
.mkt-board-sub b { color: var(--text-dim); }
.mkt-board-count {
  font-size: 10px;
  color: #2962ff;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.bb-hero {
  background: linear-gradient(180deg, #0c1428 0%, #070b14 100%);
  border: 1px solid #1a2744;
  border-radius: 4px;
  padding: 12px 14px;
  cursor: pointer;
  min-height: 180px;
}
.bb-hero.empty {
  display: grid;
  place-items: center;
  color: var(--text-mute);
  font-family: var(--mono);
}
.bb-hero-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.bb-hero-title {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #fff;
}
.bb-hero-sub { font-size: 10px; color: #6b7388; margin-top: 2px; }
.bb-hero-px { text-align: right; }
.bb-hero-chart {
  height: 140px;
  border: 1px solid rgba(41, 98, 255, 0.3);
  border-radius: 2px;
  overflow: hidden;
  background: #050914;
  box-shadow: inset 0 0 40px rgba(41, 98, 255, 0.08);
}
.bb-hero-note {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: #4a5570;
}

.mkt-cell .m-spark {
  margin-top: 6px;
  height: 28px;
  border-radius: 2px;
  overflow: hidden;
  border: 1px solid rgba(41, 98, 255, 0.2);
}
.market-grid .mkt-cell {
  min-height: 72px;
  padding: 10px;
}
.market-grid .m-val { font-size: 15px; }

/* Grocery / daily life */
.grocery-hero {
  padding: 12px;
  border-radius: 4px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}
.grocery-hero.firmer {
  background: rgba(255, 82, 82, 0.08);
  border-color: rgba(255, 82, 82, 0.3);
}
.grocery-hero.easier {
  background: rgba(0, 230, 118, 0.08);
  border-color: rgba(0, 230, 118, 0.3);
}
.grocery-hero.mixed {
  background: var(--amber-glow);
  border-color: rgba(245, 166, 35, 0.3);
}
.gh-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.gh-head {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  margin-bottom: 4px;
}
.gh-sub { font-size: 10px; color: var(--text-mute); line-height: 1.4; }
.grocery-list { display: flex; flex-direction: column; gap: 4px; }
.grocery-row {
  display: grid;
  grid-template-columns: 56px 100px 1fr;
  gap: 4px 10px;
  padding: 7px 6px;
  border-bottom: 1px solid rgba(42, 49, 64, 0.4);
  font-size: 11px;
}
.grocery-row .g-sym { font-weight: 700; color: var(--amber); }
.grocery-row .g-val { color: var(--text); }
.grocery-row .g-val i { font-style: normal; margin-left: 4px; }
.grocery-row .g-val i.up { color: #ff5252; }
.grocery-row .g-val i.down { color: #00e676; }
.grocery-row .g-shop { grid-column: 1 / -1; color: var(--text-dim); font-size: 10px; }
.grocery-row .g-pos {
  grid-column: 1 / -1;
  color: var(--green);
  font-size: 10px;
  line-height: 1.35;
}

/* Climate */
.climate-list { display: flex; flex-direction: column; gap: 8px; }
.climate-card {
  padding: 10px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.04), var(--bg-2));
  border: 1px solid var(--border);
  border-radius: 4px;
}
.cl-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.cl-top strong { font-size: 12px; }
.climate-card p { font-size: 11px; color: var(--text-dim); line-height: 1.4; margin-bottom: 6px; }
.cl-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 6px;
  font-size: 10px;
  padding: 3px 0;
  color: var(--text-dim);
}
.cl-row span {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  padding-top: 2px;
}
.cl-row.pos { background: var(--glow-green); margin: 4px -4px 0; padding: 6px 4px; border-radius: 3px; }
.cl-row.pos span { color: var(--green); }
.cl-row.pos b { color: var(--text); font-weight: 500; }
.cl-reg { font-size: 9px; color: var(--text-mute); margin-top: 6px; }

/* Impact monitor */
.impact-board { display: flex; flex-direction: column; gap: 8px; }
.impact-focus {
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--cyan);
  margin-bottom: 2px;
}
.impact-block {
  padding: 10px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-2);
}
.impact-block .ib-k {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.impact-block p { font-size: 12px; line-height: 1.45; color: var(--text-dim); }
.impact-block.pol { border-left: 3px solid var(--orange); }
.impact-block.geo { border-left: 3px solid #2962ff; }
.impact-block.day { border-left: 3px solid var(--amber); }
.impact-block.pos {
  border-left: 3px solid var(--green);
  background: var(--glow-green);
}
.impact-block.pos p { color: var(--text); }
.impact-tape {
  font-size: 9px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  padding: 6px 0 0;
  border-top: 1px solid var(--border);
}

/* Chips & data centers brief */
.tech-brief { display: flex; flex-direction: column; gap: 8px; }
.tb-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #64ffda;
}
.tb-block {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-2);
  border-left: 3px solid #64ffda;
}
.tb-block span {
  display: block;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.tb-block p { font-size: 12px; line-height: 1.45; color: var(--text-dim); }
.tb-block.pos {
  border-left-color: var(--green);
  background: var(--glow-green);
}
.tb-block.pos p { color: var(--text); }

.widget[data-id="metals"] {
  border-color: rgba(255, 215, 64, 0.3);
}
.widget[data-id="semiconductors"],
.widget[data-id="datacenters"],
.widget[data-id="techbrief"] {
  border-color: rgba(100, 255, 218, 0.28);
}
.widget[data-id="afford"],
.widget[data-id="affordRank"],
.widget[data-id="affordEdu"],
.widget[data-id="affordHome"],
.widget[data-id="affordMove"] {
  border-color: rgba(0, 200, 83, 0.3);
}

/* Affordability */
.afford-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  align-items: flex-start;
}
.af-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--green);
  margin-bottom: 4px;
}
.af-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.af-note { font-size: 11px; color: var(--text-dim); line-height: 1.4; max-width: 420px; }
.af-score-box {
  text-align: center;
  padding: 10px 14px;
  border: 2px solid var(--green);
  border-radius: 6px;
  background: var(--glow-green);
  min-width: 88px;
}
.af-score-n {
  display: block;
  font-family: var(--mono);
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}
.af-score-l {
  font-size: 9px;
  color: var(--text-mute);
  font-family: var(--mono);
  line-height: 1.3;
}
.afford-legend {
  font-size: 9px;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.afford-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}
.afford-cat {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
}
.ac-top {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 4px;
}
.ac-top b { font-family: var(--mono); }
.ac-bar {
  height: 5px;
  background: var(--bg-4);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.ac-bar > i { display: block; height: 100%; border-radius: 3px; }
.ac-bar.grow { flex: 1; margin: 0 8px; }
.ac-tip { font-size: 9px; color: var(--text-mute); line-height: 1.3; }
.afford-foot {
  margin-top: 10px;
  font-size: 10px;
  color: var(--text-mute);
  line-height: 1.4;
}
.afford-rank-list { display: flex; flex-direction: column; gap: 3px; }
.ar-row {
  display: grid;
  grid-template-columns: 28px 1fr 32px 48px;
  gap: 6px;
  align-items: center;
  padding: 6px 6px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: var(--bg-2);
  text-align: left;
  width: 100%;
  color: inherit;
  cursor: pointer;
}
.ar-row:hover, .ar-row.active {
  border-color: var(--green-dim);
  background: var(--glow-green);
}
.ar-rank { font-size: 10px; color: var(--text-mute); }
.ar-name { font-size: 11px; font-weight: 500; }
.ar-score { font-size: 12px; font-weight: 700; text-align: right; }
.ar-bar {
  height: 4px;
  background: var(--bg-4);
  border-radius: 2px;
  overflow: hidden;
}
.ar-bar > i { display: block; height: 100%; }
.afford-edu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.ae-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px;
}
.ae-top {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 12px;
}
.ae-top span { font-family: var(--mono); font-weight: 700; }
.ae-card p { font-size: 10px; color: var(--text-dim); margin-top: 6px; line-height: 1.35; }
.ae-read { color: var(--text-mute) !important; font-style: normal; }
.afford-home { display: flex; flex-direction: column; gap: 8px; }
.ah-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
}
.ah-row > span { min-width: 140px; color: var(--text-dim); }
.ah-row b { font-family: var(--mono); min-width: 24px; text-align: right; }

@media (max-width: 700px) {
  .afford-edu { grid-template-columns: 1fr; }
  .afford-hero { flex-direction: column; }
  .ah-row { flex-wrap: wrap; }
  .ah-row > span { min-width: 100%; }
}

/* HD widget polish */
.widget[data-id="mktboard"],
.widget[data-id="mkthero"],
.widget[data-id="currencies"],
.widget[data-id="markets"],
.widget[data-id="commodities"],
.widget[data-id="energy"] {
  border-color: rgba(41, 98, 255, 0.28);
  background: linear-gradient(180deg, rgba(12, 20, 40, 0.9), var(--bg-1));
}
.widget[data-id="grocery"],
.widget[data-id="impact"] {
  border-color: rgba(0, 200, 83, 0.28);
}
.widget[data-id="climate"] {
  border-color: rgba(0, 212, 255, 0.28);
}
.widget[data-id="newsfocus"] {
  border-color: rgba(0, 212, 255, 0.22);
}

.side-nav .nav-item {
  border-radius: 4px;
}
.side-nav .nav-item:hover {
  border-color: rgba(245, 166, 35, 0.25);
}

/* How-to modal */
.howto-card .modal-body { max-height: min(78dvh, 720px); }
.howto-nav-map {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 4px;
}
.hnm-item {
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hnm-item b {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--amber);
  letter-spacing: 0.08em;
}
.hnm-item span { font-size: 11px; color: var(--text-dim); }
.howto-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.howto-step {
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--amber);
}
.howto-step h4 {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--amber);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.howto-step p {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.howto-h3 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--amber);
  margin: 8px 0 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.howto-models {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.howto-ind {
  padding: 8px 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 11px;
}
.howto-ind strong {
  font-family: var(--mono);
  color: var(--amber);
  margin-right: 6px;
}
.howto-ind .hi-label { color: var(--text-mute); font-size: 10px; }
.howto-ind p { color: var(--text-dim); margin-top: 4px; line-height: 1.4; }
.howto-ind p.muted { color: var(--text-mute); font-size: 10px; }
.howto-ind p.read { color: var(--green); font-size: 10px; }
.howto-ind em { font-style: normal; font-weight: 700; color: var(--text-mute); }

@media (max-width: 700px) {
  .howto-grid, .howto-models { grid-template-columns: 1fr; }
  .howto-nav-map { grid-template-columns: 1fr 1fr; }
  .vt-row { grid-template-columns: 40px 56px 1fr; gap: 6px; font-size: 10px; }
  .stream-hint { display: none; }
  .context-bar { gap: 6px; }
  .domain-pill { padding: 4px 6px; font-size: 8px; }
  .bb-board { grid-template-columns: 1fr; }
  .bb-val.xl { font-size: 22px; }
  .bb-hero-chart { height: 100px; }
  .view-header h1 { font-size: 12px; }
  .grocery-row { grid-template-columns: 48px 1fr; }
}

/* Extra mobile safety for full terminal shell */
@media (max-width: 520px) {
  .topbar-right .status-live,
  .topbar-right .clock-label { display: none; }
  .func-keys span:not(.fk-right) { display: none; }
  .func-keys .fk-right { display: inline; font-size: 8px; }
  .howto-nav-map { grid-template-columns: 1fr; }
  :root { --bottom-h: 220px; }
}

/* Context bar: more selectors */
.context-bar {
  gap: 10px;
  scrollbar-width: thin;
}
.ctx-group.grow { max-width: 200px; }
.ctx-group select {
  font-size: 11px;
  padding: 5px 6px;
  min-height: 28px;
}

/* Smoother widget body scroll on touch */
.widget-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Desktop density */
@media (min-width: 1400px) {
  :root { --side-w: 156px; }
  .nav-txt { font-size: 10px; }
  .pulse-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 1100px) {
  .map-basemap-switch button { padding: 0 5px !important; font-size: 7px !important; }
  .impl-row { grid-template-columns: 1fr; gap: 2px; }
  .impl-row .il { margin-bottom: 0; }
  .nav-hint { display: none; }
  .nav-section { display: none; }
}
@media (max-width: 900px) {
  .triad-board {
    grid-template-columns: 1fr;
  }
  .triad-x { display: none; }
}
