/* AI Data Center — StocksWatch visual language. Tokens: /tokens.css */
* { box-sizing: border-box; }
body.dc-page {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: var(--type-body, 0.95rem)/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
.dc-shell { min-height: 100vh; }
.dc-page a { color: var(--green); text-decoration: none; }
.dc-page a:hover { text-decoration: underline; }
.dc-page code {
  background: var(--chip);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--mono);
}
.dc-page .muted { color: var(--muted); }
.dc-page .mono { font-family: var(--mono); }
.dc-page .desktop-only { display: block; }
@media (max-width: 640px) {
  .dc-page .desktop-only { display: none !important; }
}
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.15rem;
}
.hero {
  padding: 1.35rem 0 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
}
.hero-copy { min-width: 0; flex: 1 1 16rem; }
.hero-brand {
  margin: 0 0 0.3rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}
.hero h1 {
  font-size: clamp(1.45rem, 3.2vw, 1.95rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 0.35rem;
  letter-spacing: -0.03em;
}
.hero .tagline {
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 34rem;
  margin: 0;
}
.hero-kpis {
  display: flex;
  gap: 0;
  margin: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}
.hero-kpi {
  padding: 0.55rem 0.9rem;
  border-right: 1px solid var(--border-subtle);
  min-width: 4.5rem;
}
.hero-kpi:last-child { border-right: none; }
.hero-kpi dt {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}
.hero-kpi dd {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
  font-weight: 650;
}
.board-stage { padding-bottom: 2rem; }
.board-chrome {
  margin-top: 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}
.board-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 1px solid var(--border-subtle);
}
.board-eyebrow {
  margin: 0 0 0.15rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
}
.board-header h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.board-subtitle {
  margin: 0.25rem 0 0;
  color: var(--dim);
  font-size: 0.78rem;
  font-family: var(--mono);
}
.board-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.search-wrap { min-width: min(240px, 70vw); }
.search-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}
.search-input:focus { border-color: var(--green); }
.btn-refresh {
  background: var(--green);
  color: #052e16;
  border: none;
  border-radius: var(--radius);
  padding: 0.55rem 0.9rem;
  font-weight: 650;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn-refresh:hover { opacity: 0.92; }
.btn-refresh:disabled { opacity: 0.5; cursor: wait; }
.mainnav {
  display: flex;
  gap: 4px;
  margin-top: 0.35rem;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: thin;
}
.mainnav button {
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 650;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.mainnav button:hover { color: var(--text); }
.mainnav button.active {
  color: var(--text);
  border-bottom-color: var(--green);
}
.mode-purpose {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: var(--type-meta, 0.8rem);
  font-family: var(--mono);
  line-height: 1.4;
  min-height: 1.4em;
  transition: opacity 0.2s ease;
}
.view-pane { animation: mode-fade 0.22s ease; }
@keyframes mode-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.hidden { display: none !important; }
.filterbar {
  display: flex;
  align-items: center;
  gap: 0.65rem 0.85rem;
  flex-wrap: wrap;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: color-mix(in srgb, var(--bg) 55%, var(--bg-elevated));
}
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.seg button {
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.seg button.active { background: var(--green); color: #052e16; }
.seg button:not(.active):hover {
  color: var(--text);
  background: var(--surface-hover);
}
.exposure-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.flabel {
  color: var(--dim);
  font-size: 0.68rem;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-right: 0.15rem;
}
.exposure-filter button {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.28rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.exposure-filter button.active {
  border-color: color-mix(in srgb, var(--green) 50%, var(--border));
  color: var(--text);
  background: color-mix(in srgb, var(--green) 12%, transparent);
}
.exposure-filter button:hover { color: var(--text); }
.filters-btn {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
}
.filters-btn.active,
.filters-btn[aria-expanded="true"] {
  border-color: var(--green);
  color: var(--text);
}
.movers {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}
.movers .mv {
  font-size: 0.72rem;
  font-family: var(--mono);
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  cursor: pointer;
}
.movers .mv.up { color: var(--green); }
.movers .mv.down { color: var(--red); }
.statusbar.live-status,
.live-status.statusbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.4rem 1rem;
  background: var(--bg);
  border-bottom: none;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--muted);
}
.live-status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  flex-shrink: 0;
}
.statusbar #meta { margin-left: auto; color: var(--dim); }
.filters-panel {
  padding: 0.75rem 1rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg);
}
.filters-panel.hidden { display: none !important; }
.focus-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.9rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  border-radius: var(--radius);
  font-size: 0.85rem;
}
.focus-banner b { color: var(--text); }
.focus-banner button {
  margin-left: auto;
  background: transparent;
  color: var(--green);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.focus-banner button:hover { border-color: var(--green); }
.alerts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0.85rem 0 0;
  padding: 0.55rem 0.85rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
}
.alerts.hidden { display: none; }
.al-h { font-size: 12px; font-weight: 700; color: var(--amber); margin-right: 4px; }
.al-item {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12px;
  cursor: pointer;
}
.al-item b { font-weight: 700; }
.al-item.up { border-color: rgba(34, 197, 94, 0.45); }
.al-item.up b { color: var(--green); }
.al-item.down { border-color: rgba(239, 68, 68, 0.45); }
.al-item.down b { color: var(--red); }
.al-item:hover { background: var(--surface-hover); }
.hist-row {
  display: grid;
  grid-template-columns: 44px 120px 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.hist-lbl { font-size: 11px; color: var(--muted); }
.hist-end {
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}
.spark { display: block; }
.spark-empty { font-size: 11px; color: var(--muted); }
.hist-note { font-size: 11px; color: var(--muted); margin-top: 4px; }
main#layers { padding: 0.9rem 0 2rem; }
.loading {
  color: var(--muted);
  padding: 2.5rem 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.layer {
  margin-bottom: 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
}
.layer-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  user-select: none;
  background: color-mix(in srgb, var(--bg) 40%, var(--bg-elevated));
}
.layer-head:hover { background: var(--surface-hover); }
.layer-head h2 { margin: 0; font-size: 0.95rem; font-weight: 650; }
.layer-head .count {
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--mono);
}
.layer-head .caret {
  margin-left: auto;
  color: var(--muted);
  transition: transform 0.15s;
}
.layer.collapsed .caret { transform: rotate(-90deg); }
.layer .blurb {
  padding: 0 1rem 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  max-width: 1000px;
}
.layer.collapsed .blurb,
.layer.collapsed .table-wrap { display: none; }
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
}
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: right;
  padding: 0.55rem 0.75rem;
  color: var(--dim);
  font-weight: 600;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  cursor: pointer;
  background: var(--bg-elevated);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
thead th.left,
tbody td.left { text-align: left; }
thead th.center,
tbody td.center { text-align: center; }
.layer-head.static { cursor: default; }
.layer-head.static:hover {
  background: color-mix(in srgb, var(--bg) 40%, var(--bg-elevated));
}
thead th:hover { color: var(--text); }
thead th.sorted::after { content: " ▾"; color: var(--green); }
thead th.sorted.asc::after { content: " ▴"; }
tbody td {
  padding: 0.55rem 0.75rem;
  text-align: right;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
tbody tr:hover { background: var(--surface-hover); }
.stock-row { cursor: pointer; }
.news-toggle { color: var(--muted); margin-right: 6px; font-size: 10px; }
.stock-row:hover .news-toggle { color: var(--green); }
.news-row > td { background: var(--bg); padding: 0; }
.news-list { display: flex; flex-direction: column; }
.news-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
  padding: 9px 16px 9px 30px;
  border-bottom: 1px solid var(--border-subtle);
  text-decoration: none;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: var(--surface-hover); }
.news-title { color: var(--text); font-size: 12.5px; line-height: 1.35; }
.news-item:hover .news-title { color: var(--green); }
.news-meta {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.news-status { padding: 12px 16px 12px 30px; color: var(--muted); font-size: 12px; }
.news-src { padding: 6px 16px 10px 30px; font-size: 10.5px; color: var(--muted); opacity: 0.7; }
.detail {
  display: flex;
  gap: 24px;
  padding: 14px 18px 16px 30px;
  align-items: flex-start;
}
.detail-col { flex: 1 1 0; min-width: 0; }
.detail-h {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
  margin-bottom: 10px;
  font-family: var(--mono);
}
@media (max-width: 820px) {
  .detail { flex-direction: column; }
}
.sb-head { font-size: 12px; color: var(--text); margin-bottom: 10px; }
.sb-head .sb-note { color: var(--muted); font-size: 11px; }
.sb-row {
  display: grid;
  grid-template-columns: 110px 1fr 28px 34px 42px;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}
.sb-label { font-size: 12px; color: var(--text); white-space: nowrap; }
.sb-bar {
  height: 8px;
  background: var(--panel-2);
  border-radius: 5px;
  overflow: hidden;
}
.sb-fill { display: block; height: 100%; border-radius: 5px; }
.sb-val {
  font-size: 12px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.sb-cov {
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}
.sb-cov.thin { color: var(--amber); opacity: 1; font-weight: 700; }
.sb-wt { font-size: 11px; color: var(--muted); text-align: right; }
.detail-news .news-list,
.detail-news .news-item { padding-left: 0; }
.detail-col .news-item { padding: 8px 8px 8px 0; }
.detail-col .news-status,
.detail-col .news-src { padding-left: 0; }
.tkr { font-weight: 700; letter-spacing: 0.3px; font-family: var(--mono); }
.name { color: var(--text); }
.thesis {
  color: var(--muted);
  font-size: 12px;
  max-width: 360px;
  white-space: normal;
}
.tags { margin-top: 3px; }
.chip {
  display: inline-block;
  background: var(--chip);
  color: var(--muted);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10.5px;
  margin: 2px 3px 0 0;
  border: 1px solid var(--border-subtle);
}
.chip.also {
  color: #8fd6a3;
  border-color: color-mix(in srgb, var(--green) 35%, var(--border));
}
.chip.cur {
  color: #e0b96a;
  font-weight: 700;
  border-color: color-mix(in srgb, var(--amber) 35%, var(--border));
}
.pos { color: var(--green); }
.neg { color: var(--red); }
.dim { color: var(--muted); }
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem 0 max(1.5rem, env(safe-area-inset-bottom));
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 1rem;
}
.site-footer .disclaimer {
  margin: 0.5rem 0 0;
  color: var(--dim);
  font-size: 0.75rem;
  max-width: 48rem;
}
.datacenter,
.rackx,
.analyst,
.lookup { padding: 1.1rem 0 2.5rem; }

/* analyst rating badge (consensus column set) */
.rt { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.rt.pos  { background: rgba(52,211,153,.18); color: var(--green); }
.rt.warn { background: rgba(251,191,36,.16); color: var(--amber); }
.rt.neg  { background: rgba(248,113,113,.16); color: var(--red); }
.rt.dim  { background: transparent; color: var(--muted); }
.rt-n { font-size: 10px; color: var(--muted); margin-left: 5px; }

/* composite score badge */
.score { display: inline-block; min-width: 30px; padding: 2px 8px; border-radius: var(--radius-sm); font-weight: 800; font-size: 12px; color: #06121f; background: var(--sc, var(--muted)); cursor: help; }
.score.na { background: transparent; color: var(--muted); font-weight: 400; }

/* ====================================================================== */
/*  Interactive data-center cutaway                                        */
/* ====================================================================== */
.datacenter { padding: 22px 28px 60px; }
.dc-intro h2 { margin: 0 0 4px; font-size: 18px; }
.dc-intro p { margin: 0 0 18px; max-width: 760px; font-size: 13px; }

.dc-stage { display: flex; gap: 22px; align-items: flex-start; }
.dc-svgwrap { flex: 1 1 auto; min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(180deg, #0c121c 0%, #0a0e16 100%); overflow: hidden; }
.dc-svgwrap svg { display: block; width: 100%; height: auto; }

/* FIXED height + internal scroll: the panel's height never depends on its
   content, so hovering between layers can't reflow the page (no jitter) at any
   width. Long content scrolls inside the panel instead of resizing it. */
.dc-panel { flex: 0 0 330px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 18px; height: 470px; overflow-y: auto; }
@media (max-width: 980px) { .dc-stage { flex-direction: column; align-items: stretch; } .dc-panel { flex-basis: auto; width: 100%; } }

/* SVG zones */
.zone { cursor: pointer; }
/* outline is purely visual — the separate hit-rect handles clicks. Without
   pointer-events:none the Layer-1 shell outline (which spans the whole building)
   would swallow clicks meant for the Compute/Networking zones inside it. */
.zone-outline { fill: var(--zc); fill-opacity: 0; stroke: var(--zc); stroke-opacity: 0; stroke-width: 2.5; transition: fill-opacity .15s, stroke-opacity .15s; pointer-events: none; }
.zone:hover .zone-outline, .zone.hover .zone-outline { stroke-opacity: .85; fill-opacity: .10; }
.zone.selected .zone-outline { stroke-opacity: 1; fill-opacity: .16; }
.zone-tag { font: 700 12px -apple-system, system-ui, sans-serif; fill: var(--text); }
.zone-tag-bg { fill: var(--zc); fill-opacity: .9; }
.zone-tag-num { font: 800 12px system-ui; fill: #06121f; }
.dc-flow-label { font: 700 12px system-ui; fill: var(--muted); letter-spacing: .5px; }

/* CAD dimension lines + measurement labels (data-center map) */
.dc-dim line { stroke: #7c8aa0; stroke-width: 1; opacity: .85; }
.dc-dim-t { font: 600 10px ui-monospace, Menlo, monospace; fill: #9fb1c6; letter-spacing: .3px; }

/* info panel */
.dc-panel .ph { color: var(--muted); font-size: 13px; }
.dc-panel h3 { margin: 0 0 2px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.dc-panel h3 .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.dc-panel .layer-blurb { font-size: 12.5px; color: var(--muted); margin: 8px 0 12px; }
.dc-panel .bottleneck { font-size: 12px; background: var(--panel-2); border-left: 3px solid var(--amber); border-radius: 6px; padding: 8px 11px; margin-bottom: 14px; }
.dc-panel .bottleneck b { color: var(--amber); }
.dc-panel .tk-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.dc-panel .tk { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 5px 8px; border-radius: var(--radius-sm); background: var(--panel-2); }
.dc-panel .tk .tk-t { font-weight: 700; width: 52px; }
.dc-panel .tk .tk-n { color: var(--muted); flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-panel .tk .tk-p { font-variant-numeric: tabular-nums; }
.dc-panel .tk .tk-score { min-width: 24px; text-align: center; padding: 1px 5px; border-radius: 5px; font-size: 11px; font-weight: 800; color: #06121f; }
.dc-panel .tk .tk-exp { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.dc-panel .view-stocks {
  width: 100%; background: var(--accent); color: #052e16; border: none;
  border-radius: var(--radius); padding: 10px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.dc-panel .view-stocks:hover { filter: brightness(1.07); }
.dc-panel .more { font-size: 11.5px; color: var(--muted); margin-top: 8px; text-align: center; }

/* legend */
.dc-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.dc-legend .lg {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px; font-size: 12px; cursor: pointer; color: var(--muted);
}
.dc-legend .lg:hover, .dc-legend .lg.active { color: var(--text); border-color: var(--zc); }
.dc-legend .lg .sw { width: 10px; height: 10px; border-radius: 3px; background: var(--zc); }

/* ====================================================================== */
/*  Rack Explorer (semantic zoom)                                          */
/* ====================================================================== */
.rackx { padding: 22px 28px 60px; }
.rackx-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; }
.rackx-head h2 { margin: 0 0 4px; font-size: 18px; }
.rackx-head p { margin: 0; max-width: 560px; font-size: 13px; }

/* breadcrumb / level rail */
.rackx-rail { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.rx-railitem {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.rx-railitem:hover { color: var(--text); }
.rx-railitem.active { background: rgba(34,197,94,.14); color: var(--green); border-color: var(--green); }
.rx-railnum { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--panel-2); font-size: 10px; }
.rx-railitem.active .rx-railnum { background: var(--accent); color: #052e16; }
.rx-railarrow { color: var(--muted); font-size: 11px; }

.rackx-stage { display: flex; gap: 22px; align-items: stretch; }
.rackx-svgwrap { flex: 1 1 auto; min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: linear-gradient(180deg,#0c121c,#0a0e16); overflow: hidden; }
.rackx-svgwrap svg { display: block; width: 100%; height: auto; }
.rackx-info { flex: 0 0 320px; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 18px; }
@media (max-width: 980px) { .rackx-stage { flex-direction: column; } .rackx-info { flex-basis: auto; width: 100%; } }

/* zoom transition */
@keyframes rxIn  { from { transform: scale(.62); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes rxOut { from { transform: scale(1.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.rx-svg { transform-origin: center; }
.rx-svg.in  { animation: rxIn .36s ease-out; }
.rx-svg.out { animation: rxOut .36s ease-out; }
.rx-call { font: 600 11.5px -apple-system, system-ui, sans-serif; fill: #c4d2e4; }
.rx-scale text { fill: #8a99ad; }
/* CAD dimension lines + measurement labels (rack explorer) */
.rx-dim line { stroke: #7c8aa0; stroke-width: 1; opacity: .85; }
.rx-dim-t { font: 600 10px ui-monospace, Menlo, monospace; fill: #9fb1c6; letter-spacing: .3px; }

/* info panel */
.rackx-info .rx-step { font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--accent); }
.rackx-info h3 { margin: 4px 0 8px; font-size: 16px; }
.rackx-info .rx-scaleline { font-size: 12px; color: var(--text); background: var(--panel-2); border-radius: var(--radius-sm); padding: 8px 11px; margin-bottom: 12px; }
.rackx-info .rx-build { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 0 0 16px; }
.rackx-info .rx-supl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; }
.rackx-info .rx-tks { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 18px; }
.rx-tk { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 4px 11px; font-size: 12px; font-weight: 700; cursor: pointer; }
button.rx-tk:hover { border-color: var(--accent); color: var(--accent); }
.rx-tk.muted { color: var(--muted); font-weight: 600; cursor: default; opacity: .8; }
.rackx-info .rx-nav { display: flex; gap: 8px; }
.rackx-info .rx-nav button { flex: 1 1 0; background: var(--accent); color: #052e16; border: none; border-radius: var(--radius); padding: 9px; font-size: 12.5px; font-weight: 700; cursor: pointer; }
.rackx-info .rx-nav button:disabled { background: var(--panel-2); color: var(--muted); cursor: default; }
.rackx-info .rx-nav button:not(:disabled):hover { filter: brightness(1.07); }

/* ====================================================================== */
/*  AI Analyst                                                             */
/* ====================================================================== */
.analyst { padding: 22px 28px 60px; }
.an-head h2 { margin: 0 0 4px; font-size: 18px; }
.an-head p { margin: 0 0 18px; max-width: 820px; font-size: 13px; }
.an-bar { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 18px; }
.an-pick { font-size: 11.5px; color: var(--muted); display: flex; flex-direction: column; gap: 5px; font-weight: 600; }
.an-pick select { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 9px 11px; font-size: 13px; min-width: 240px; outline: none; }
.an-pick select:focus { border-color: var(--accent); }
.an-reports { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 auto; }
.an-report { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.an-report:hover { border-color: var(--accent); }
.an-report.active { background: rgba(34,197,94,.14); color: var(--green); border-color: var(--green); }

.an-output { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 22px 26px; min-height: 200px; }
.an-loading { color: var(--muted); font-size: 14px; padding: 20px 0; }
.an-bar2 { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 18px; }
.an-meta { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.an-regen { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.an-regen:hover { border-color: var(--accent); color: var(--accent); }
.an-note { font-size: 13px; color: var(--text); margin-bottom: 12px; }
.an-note.err { color: var(--red); }
.an-promptwrap { position: relative; }
.an-copy { position: absolute; top: 8px; right: 8px; background: var(--accent); color: #052e16; border: none; border-radius: var(--radius-sm); padding: 5px 11px; font-size: 12px; font-weight: 700; cursor: pointer; }
.an-prompt { width: 100%; height: 320px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 14px; font: 12px/1.5 ui-monospace, Menlo, monospace; resize: vertical; }

/* rendered markdown */
.md { font-size: 14px; line-height: 1.62; color: var(--text); max-width: 900px; }
.md h3 { font-size: 18px; margin: 22px 0 8px; }
.md h4 { font-size: 15.5px; margin: 18px 0 6px; color: #cfe0f5; }
.md h5, .md h6 { font-size: 13.5px; margin: 14px 0 5px; color: var(--muted); }
.md p { margin: 0 0 12px; }
.md ul, .md ol { margin: 0 0 14px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md strong { color: #fff; }
.md a { color: var(--accent); }
.md code { background: var(--chip); padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.md blockquote { border-left: 3px solid var(--accent); margin: 0 0 14px; padding: 4px 14px; color: var(--muted); background: var(--panel-2); border-radius: 0 6px 6px 0; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
.md-table { width: 100%; border-collapse: collapse; margin: 6px 0 18px; font-size: 12.5px; }
.md-table th, .md-table td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; vertical-align: top; }
.md-table th { background: var(--panel-2); color: var(--text); font-weight: 700; }
.md-table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }

/* ====================================================================== */
/*  Stock Lookup                                                           */
/* ====================================================================== */
.lookup { padding: 22px 28px 60px; }
.lk-head h2 { margin: 0 0 4px; font-size: 18px; }
.lk-head p { margin: 0 0 18px; max-width: 820px; font-size: 13px; }
.lk-bar { display: flex; gap: 10px; margin-bottom: 18px; }
.lk-bar input { flex: 0 1 420px; background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 13px; font-size: 14px; outline: none; }
.lk-bar input:focus { border-color: var(--accent); }
.lk-bar button { background: var(--accent); color: #052e16; border: none; border-radius: var(--radius); padding: 10px 18px; font-weight: 700; font-size: 13px; cursor: pointer; }
.lk-loading { color: var(--muted); padding: 16px 0; }

.lk-card { border: 1px solid var(--border); border-radius: 14px; background: var(--panel); padding: 20px 22px; max-width: 880px; }
.lk-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.lk-name { font-size: 17px; font-weight: 700; }
.lk-tkr { font-weight: 700; color: var(--accent); letter-spacing: .3px; }
.lk-prices { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lk-sub { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }
.lk-exists { font-size: 12px; color: var(--amber); background: rgba(251,191,36,.1); border-radius: var(--radius-sm); padding: 7px 11px; margin-bottom: 12px; }
.lk-summary { font-size: 12.5px; color: var(--muted); line-height: 1.55; margin: 0 0 16px; max-height: 96px; overflow: auto; }

.lk-rec { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.lk-rec-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); margin-bottom: 6px; }
.lk-rec-main { font-size: 15px; }
.lk-conf { font-size: 12px; color: var(--green); font-weight: 700; margin-left: 6px; }
.lk-rec-why { font-size: 12px; color: var(--muted); margin: 5px 0 8px; }
.lk-rec-why code { background: var(--chip); padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.lk-ranked { display: flex; flex-wrap: wrap; gap: 6px; }
.lk-rankchip { background: var(--panel); color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.lk-rankchip:hover { color: var(--accent); border-color: var(--accent); }

.lk-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.lk-form label { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.lk-form select, .lk-form input { background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 12.5px; outline: none; }
.lk-form select:focus, .lk-form input:focus { border-color: var(--accent); }
.lk-form .lk-thesis { flex: 1 1 220px; }
.lk-form .lk-thesis input { width: 100%; }
#lkAdd { background: var(--green); color: #062417; border: none; border-radius: var(--radius); padding: 9px 16px; font-weight: 700; font-size: 13px; cursor: pointer; }
#lkAddMsg { margin-top: 10px; font-size: 12.5px; }
.lk-ok { color: var(--green); }
.lk-note { font-size: 13px; }
.lk-note.err { color: var(--red); }

.lk-added { margin-top: 22px; max-width: 880px; }
.lk-added-h { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; }
.lk-added-row { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.lk-added-name { color: var(--muted); flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lk-remove { background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 10px; font-size: 11.5px; cursor: pointer; }
.lk-remove:hover { color: var(--red); border-color: var(--red); }
