/* Terminal dashboard polish — preserves the data-dense layout while making
   every surface and reading legible in both shared themes. */

body { background:var(--bg); color:var(--text); }

/* Entry and market context */
.hero { padding:34px 24px 20px; }
.hero-logo { height:58px; margin-bottom:22px; filter:hue-rotate(58deg) saturate(.95); }
.hero .search { max-width:680px; margin-bottom:16px; }
.search-input {
  min-height:52px; padding-left:48px; border-radius:999px;
  background:var(--bg-card); border-color:var(--border);
  color:var(--text-strong); font-size:.96rem; box-shadow:var(--shadow-1);
}
.search-input:hover { border-color:var(--muted-dim); }
.search-input:focus {
  background:var(--bg-card); border-color:var(--accent);
  box-shadow:var(--ring),var(--shadow-1);
}
.search-results { border-radius:12px; box-shadow:var(--shadow-3); }
.search-group { padding:11px 16px 7px; font-size:.7rem; color:var(--muted); }
.search-item { min-height:44px; padding:10px 16px; font-size:.86rem; }
.search-item:hover,.search-item.active { background:var(--bg-chip); }
.search-item .s-meta { font-size:.74rem; color:var(--muted); }

.hero-indices {
  width:min(calc(100% - 48px),1320px); margin:0 auto 8px; padding:0;
  flex-wrap:nowrap; border:1px solid var(--border); border-radius:12px;
  background:var(--bg-card); box-shadow:var(--shadow-1); overflow-x:auto;
  justify-content:stretch;
}
.hidx { flex:1 0 145px; min-height:72px; justify-content:center; padding:10px 20px; }
.hidx + .hidx { border-left:1px solid var(--border); }
.hidx-label { font-size:.7rem; letter-spacing:.04em; color:var(--muted); }
.hidx-price { font-size:1.06rem; font-weight:650; }
.hidx-chg { font-size:.78rem; }

/* Workspace geometry */
.terminal {
  max-width:1920px; gap:18px; padding:18px clamp(12px,2vw,28px) 52px;
  grid-template-columns:minmax(300px,330px) minmax(0,1fr) minmax(320px,370px);
}
.term-col,.main-stack { gap:18px; }
.briefing { gap:14px; }
.highlight-row,.macro-tables,.tv-stack { gap:16px; }
.term-center > .homemap + .highlight-row { margin-top:-18px; }
.activity-panels { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.activity-panels > .bmod { min-width:0; height:330px; min-height:0; }
.activity-panels .bmod-body { flex:1; min-height:0; overflow:hidden; }

/* One surface language across modules, map, video and wire */
.bmod,.pane,.tv-slot {
  border:1px solid var(--border); border-radius:12px; background:var(--bg-card);
  box-shadow:var(--shadow-1); overflow:hidden;
}
.bmod { min-height:190px; padding:0; }
.bmod-feature { border-left:1px solid var(--border); }
.bmod-feature::before {
  content:''; display:block; height:3px; margin:-1px -1px 0;
  background:var(--accent);
}
.bmod-head,.pane-header {
  min-height:46px; height:auto; margin:0; padding:0 15px;
  border-bottom:1px solid var(--border-soft); background:var(--bg-panel);
}
.bmod-head h3,.pane-title {
  color:var(--text-strong); font-size:.76rem; font-weight:700;
  letter-spacing:.025em; text-transform:none;
}
.bmod-body { padding:10px 16px 8px; }
.bmod-link {
  min-height:39px; margin:0; padding:11px 16px;
  border-top:1px solid var(--border-soft); color:var(--accent-strong);
  font-size:.74rem; font-weight:650; letter-spacing:0;
}
.bmod-link:hover { background:var(--accent-soft); color:var(--accent-strong); }
.bmod-chip {
  padding:4px 8px; border-radius:999px; background:var(--bg-card);
  color:var(--muted); font-size:.69rem; letter-spacing:.035em;
}
.bmod-chip.live { background:var(--up-soft); border-color:var(--up-line); }
/* Snapshot past its refresh window — see paintPulseFreshness() in landing.js. */
.bmod-chip.stale { color:var(--warn, #f5a524); border-color:rgba(245,165,36,.35); }

/* Data rows */
.brow { min-height:34px; gap:9px; padding:7px 0; font-size:.84rem; }
.b-tick { min-width:52px; font-weight:650; }
.b-name { font-size:.77rem; color:var(--muted); }
.b-val { font-size:.8rem; font-weight:650; }
.b-price { min-width:64px; font-size:.78rem; color:var(--text-soft); }
.b-sub { font-size:.72rem; color:var(--muted); }
.b-badge { background:var(--accent-soft); color:var(--accent-strong); font-size:.7rem; }
.btabs { gap:6px; margin-bottom:10px; }
.btab {
  min-height:30px; padding:4px 10px; border-radius:999px;
  background:var(--bg-panel); color:var(--muted); font-size:.7rem;
}
.btab:hover { color:var(--text-strong); border-color:var(--muted-dim); }
.btab.active { color:var(--text-strong); background:var(--accent-soft); border-color:var(--accent-line); }
.movers-session { font-size:.7rem; }
.wire-edition { font-size:.69rem; letter-spacing:.04em; }
.wire-bullets li { padding:7px 0 7px 16px; color:var(--text); font-size:.84rem; line-height:1.48; }

/* Dense activity modules need hierarchy, not four competing inline cells. */
.activity-intro {
  margin:0 0 5px; padding-bottom:9px; border-bottom:1px solid var(--border-soft);
  color:var(--muted); font-size:.72rem; line-height:1.4;
}
.activity-row {
  display:grid; grid-template-columns:54px minmax(0,1fr); align-items:start;
  gap:10px; min-height:48px; padding:9px 0;
}
.activity-row .b-tick { padding-top:1px; }
.activity-copy { display:flex; flex-direction:column; gap:4px; min-width:0; }
.activity-title {
  color:var(--text-strong); font-size:.78rem; font-weight:600; line-height:1.3;
  white-space:normal; overflow-wrap:anywhere;
}
.activity-detail { color:var(--muted); font-size:.7rem; line-height:1.25; font-variant-numeric:tabular-nums; }
.activity-detail.pos { color:var(--up); font-weight:650; }

/* Fear & Greed module */
.gauge-num { font-size:1.8rem; font-weight:650; }
.gauge-label { font-size:.8rem; color:var(--text-soft); }
.gauge-delta { font-size:.7rem; }
.mood-spark-title { font-size:.69rem; color:var(--muted); }
.fg-comp { min-height:30px; gap:10px; }
.fgc-label { width:88px; color:var(--text-soft); font-size:.7rem; }
.fgc-bar { height:8px; background:var(--bg-chip); border:1px solid var(--border-soft); }
.fgc-val { width:28px; color:var(--text-soft); font-size:.7rem; }

/* Map controls and chart frame */
.homemap .pane-header { min-height:52px; }
.homemap-controls { gap:10px; }
.homemap .seg { border-radius:999px; background:var(--bg-card); }
.homemap .seg button { min-height:30px; padding:4px 11px; background:transparent; font-size:.73rem; }
.homemap .seg button:hover { background:var(--bg-chip); color:var(--text-strong); }
.homemap .seg button.active { background:var(--accent); color:#101410; font-weight:700; }
.homemap-link { color:var(--accent-strong); font-size:.75rem; font-weight:650; }
.homemap-area { height:clamp(340px,42vw,500px); background:#171717; }

/* Live wire */
.feed-item { padding:13px 15px; grid-template-columns:30px 1fr; gap:11px; }
.feed-item:hover { background:var(--bg-panel); }
.feed-avatar { width:30px; height:30px; border-radius:7px; background:var(--bg-chip); }
.feed-meta { font-size:.69rem; margin-bottom:5px; }
.feed-ticker { padding:2px 7px; border-radius:999px; background:var(--bg-chip); }
.feed-headline { margin-bottom:5px; color:var(--text-strong); font-size:.85rem; line-height:1.42; }
.feed-summary { color:var(--muted); font-size:.75rem; line-height:1.48; }
.sentiment { padding:3px 7px; border-radius:999px; font-size:.69rem; }
.filter-pill { min-height:28px; background:var(--bg-card); border-color:var(--border); }

/* Video treatments use accessible tints in either theme. */
.tv-slot-yahoo { border-left:1px solid var(--border); }
.tv-slot-bloomberg { border-left:1px solid var(--border); }
.tv-badge { padding:4px 8px; border-radius:999px; font-size:.69rem; }
.tv-badge.yahoo { background:rgba(168,85,247,.14); color:#9b4fe1; }
.tv-badge.bloomberg { background:var(--down-soft); color:var(--down); }

/* Skeletons need separation from the card in light mode. */
.skel { background:linear-gradient(90deg,var(--bg-panel) 25%,var(--bg-chip) 50%,var(--bg-panel) 75%); }

/* Explicit theme finishing avoids low-contrast inherited legacy shades. */
html.light .bmod,html.light .pane,html.light .tv-slot,html.light .hero-indices {
  border-color:#d9dee5; box-shadow:0 1px 2px rgba(20,20,20,.04),0 10px 30px -24px rgba(20,20,20,.28);
}
html.light .bmod-head,html.light .pane-header { background:#f6f8fa; }
html.light .bmod-link,html.light .homemap-link { color:var(--accent-strong); }
html.light .feed-source.x { color:#356c96; }
html.light .tv-badge.yahoo { color:#7732ad; }
html.light .search-results { box-shadow:0 18px 45px -20px rgba(20,20,20,.32); }

html:not(.light) .bmod,html:not(.light) .pane,html:not(.light) .tv-slot,html:not(.light) .hero-indices {
  border-color:#343434; box-shadow:0 14px 36px -28px #000;
}
html:not(.light) .bmod-head,html:not(.light) .pane-header { background:#202020; }
html:not(.light) .bmod-link,html:not(.light) .homemap-link { color:var(--accent); }
html:not(.light) .tv-badge.yahoo { color:#c58bf0; }

/* Responsive workspace
   >= 1440: briefing | workspace | live wire
   1024-1439: workspace + briefing rail; live wire follows the workspace
   768-1023: one column with a compact two-up briefing section
   < 768: one readable stack. */
@media (min-width:1440px) {
  .terminal {
    display:grid;
    grid-template-columns:minmax(280px,320px) minmax(0,1fr) minmax(300px,340px);
    align-items:start;
  }
  .main-stack { display:contents; }
  .term-feed { position:sticky; top:12px; height:calc(100vh - 24px); }
  #col-feed .pane { min-height:0; height:auto; }
}

@media (max-width:1439px) {
  .terminal {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(300px,340px);
    align-items:stretch;
  }
  .main-stack {
    display:flex; flex-direction:column; gap:18px; min-width:0; order:-1;
  }
  #briefing { order:0; }
  #col-feed { position:static; height:auto; flex:0 0 auto; }
  #col-feed .pane { height:clamp(420px,58vh,620px); min-height:0; }
}

/* Cards find their own natural column count instead of snapping 3 -> 1. */
@media (max-width:1439px) and (min-width:768px) {
  .highlight-row,.macro-tables {
    grid-template-columns:repeat(auto-fit,minmax(min(250px,100%),1fr));
  }
  .highlight-row > .bmod-feature { height:392px; }
  #bm-wire { height:392px; }
}

@media (max-width:1023px) {
  .terminal {
    display:flex; flex-direction:column; align-items:stretch;
    padding:14px clamp(12px,2vw,18px) 40px;
  }
  .main-stack { display:contents; }
  #col-center { order:1; }
  #briefing {
    order:2; display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    align-items:start;
  }
  #tv-stack { order:3; }
  #col-feed { order:4; }
  #col-feed .pane { height:clamp(380px,60vh,560px); min-height:0; }
  .hero-indices { width:min(calc(100% - 28px),1320px); }
  .activity-panels { grid-template-columns:1fr; gap:14px; }
  #homemap .pane-header { padding:10px 14px; }
}

@media (max-width:767px) {
  .hero { padding:24px 14px 14px; }
  .hero-logo { height:42px; margin-bottom:18px; }
  .hero .search { margin-bottom:8px; }
  .hero-indices {
    justify-content:flex-start; flex-wrap:nowrap; overflow-x:auto;
    border-radius:10px; scroll-snap-type:x proximity;
  }
  .hidx { flex-basis:132px; min-height:66px; }
  .hidx + .hidx { border-left:1px solid var(--border); }
  .terminal { padding:12px 12px 34px; }
  #briefing { display:flex; }
  .highlight-row,.macro-tables { grid-template-columns:1fr; }
  .highlight-row > .bmod-feature { height:auto; }
  #bm-wire { height:min(480px,65vh); }
  .bmod,.pane,.tv-slot { border-radius:10px; }
  .homemap-area { height:clamp(320px,88vw,380px); }
}
