:root {
  --bg: #f4f5f2;
  --surface: #ffffff;
  --surface-muted: #f8f9f6;
  --ink: #17201c;
  --muted: #68736e;
  --line: #dfe4df;
  --line-strong: #cbd3cd;
  --brand: #176b4d;
  --brand-dark: #0f4f39;
  --brand-soft: #e4f2eb;
  --buy: #c94b38;
  --buy-soft: #fbe9e5;
  --sell: #18845e;
  --sell-soft: #e4f4ed;
  --amber: #a56616;
  --amber-soft: #fff2d9;
  --danger: #b43c35;
  --shadow: 0 14px 40px rgba(24, 40, 32, 0.08);
  --radius: 18px;
  /* Type scale — every literal font-size in the file should reference
     one of these tokens. 8 sizes is enough to express every level of
     hierarchy the dashboard needs; finer gradations get rounded up. */
  --text-2xs: 11px;   /* micro-labels (badges, chip text, eyebrow kicker) */
  --text-xs:  12px;   /* secondary metadata, table cell text, signal meta */
  --text-sm:  13px;   /* body-in-cards, control inputs, instrument meta */
  --text-md:  14px;   /* default body, buttons, toast */
  --text-lg:  16px;   /* section subhead, dense table numeric */
  --text-xl:  18px;   /* panel h2, brand-name */
  --text-2xl: 22px;   /* page-level heading, comparison-leader */
  --text-3xl: clamp(23px, 3vw, 34px);  /* h1 instrument name */
  --text-metric: clamp(18px, 1.9vw, 24px);  /* metric-card value (fits a 6-col grid) */
  --text-4xl: 36px;   /* summary card value */
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { min-width: 320px; }
button, input, select { font: inherit; }
button { color: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: #15251f;
  color: #f6fbf8;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #d9f4e5;
  color: #123b2c;
  font-size: var(--text-md);
  font-weight: 850;
  letter-spacing: 0.04em;
}
.brand-name { font-size: var(--text-xl); font-weight: 760; letter-spacing: -0.02em; }
.brand-caption { margin-top: 4px; color: #a9bbb3; font-size: var(--text-sm); }
.health-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #718078;
}
.health-dot.online { background: #57d99a; box-shadow: 0 0 0 4px rgba(87, 217, 154, 0.12); }
.health-dot.degraded { background: #efb24c; box-shadow: 0 0 0 4px rgba(239, 178, 76, 0.12); }

.sidebar-section { padding: 20px 18px; }
.sidebar-section + .sidebar-section { border-top: 1px solid rgba(255, 255, 255, 0.08); }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #c9d8d1;
  font-size: var(--text-xs);
  font-weight: 760;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.shortcut, .count-pill {
  min-width: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #aebfb7;
  text-align: center;
  font-size: var(--text-xs);
}

.search-form { display: grid; gap: 10px; }
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  transition: border-color 150ms ease, background 150ms ease;
}
.search-box:focus-within { border-color: #67c89d; background: rgba(255, 255, 255, 0.1); }
.search-icon { color: #8ea39a; font-size: var(--text-xl); line-height: 1; }
.search-box input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: #f5faf7;
  background: transparent;
  font-size: var(--text-sm);
}
.search-box input::placeholder { color: #82958c; }
.search-options { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.search-options select, .group-field input {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  outline: 0;
  background: #20342c;
  color: #e9f1ed;
}
.search-options select { height: 38px; padding: 0 9px; font-size: var(--text-sm); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 720;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, opacity 120ms ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: 0.45; }
.button-primary { background: #d9f4e5; color: #133c2d; }
.button-primary:hover { background: #c6ecd7; }
.button-secondary { border-color: var(--line-strong); background: var(--surface); color: #34413b; }
.button-secondary:hover { border-color: #a9b5ae; background: #fafbf9; }
.button-dark { background: var(--ink); color: white; }
.button-dark:hover { background: #2b3932; }

.search-results { display: grid; gap: 7px; margin-top: 12px; }
.search-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.045);
}
.result-name { overflow: hidden; color: #edf5f1; font-size: var(--text-sm); font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.result-meta { margin-top: 3px; color: #8fa299; font-size: var(--text-xs); }
.result-add {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #dff6e9;
  cursor: pointer;
  font-size: var(--text-lg);
}
.result-add:hover { background: rgba(217, 244, 229, 0.17); }
.sidebar-message { padding: 9px 2px; color: #91a49a; font-size: var(--text-sm); line-height: 1.5; }

.group-field { display: grid; gap: 6px; margin-bottom: 14px; color: #91a49a; font-size: var(--text-xs); }
.group-field input { height: 36px; padding: 0 10px; font-size: var(--text-sm); }
.watchlist { display: grid; gap: 15px; }
.watch-group { display: grid; gap: 5px; }
.watch-group-title {
  padding: 0 4px;
  overflow: hidden;
  color: #8fa299;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}
.watch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 9px 9px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #dce8e2;
  text-align: left;
  cursor: pointer;
}
.watch-item:hover { background: rgba(255, 255, 255, 0.06); }
.watch-item.active { border-color: rgba(104, 205, 159, 0.32); background: rgba(80, 176, 132, 0.16); }
.watch-item-main { min-width: 0; }
.watch-item-name { overflow: hidden; font-size: var(--text-sm); font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.watch-item-code { margin-top: 3px; color: #84988e; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-xs); }
.watch-remove {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #80958a;
  cursor: pointer;
  font-size: var(--text-lg);
}
.watch-remove:hover { background: rgba(213, 82, 70, 0.14); color: #ffb0a7; }

.main-content { min-width: 0; padding: 0 34px 38px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 104px;
  padding: 20px 0;
  background: rgba(244, 245, 242, 0.92);
  border-bottom: 1px solid rgba(203, 211, 205, 0.7);
  backdrop-filter: blur(12px);
}
.eyebrow, .panel-kicker {
  color: var(--brand);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.instrument-heading h1 { margin: 5px 0 4px; font-size: var(--text-3xl); letter-spacing: -0.035em; }
.instrument-meta { color: var(--muted); font-size: var(--text-sm); }
.topbar-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: calc(100vh - 110px);
  color: var(--muted);
  text-align: center;
}
.empty-state h2 { margin: 20px 0 8px; color: var(--ink); font-size: var(--text-2xl); }
.empty-state p { margin: 0; max-width: 420px; font-size: var(--text-sm); line-height: 1.6; }
.empty-orbit {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border: 1px solid #c8d5ce;
  border-radius: 50%;
  box-shadow: inset 0 0 0 17px #e8eee9;
}
.empty-orbit span { width: 17px; height: 17px; border-radius: 50%; background: var(--brand); box-shadow: 25px -19px 0 -4px #86b9a3, -22px 20px 0 -5px #a6c9b9; }

.dashboard { padding-top: 20px; }
.status-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: var(--text-xs);
  font-weight: 760;
  text-transform: uppercase;
}
.status-badge.hit { border-color: #b8dec9; background: var(--sell-soft); color: #126747; }
.status-badge.network, .status-badge.refreshed { border-color: #b9d0eb; background: #eaf2fb; color: #275d94; }
.status-badge.stale-fallback { border-color: #efd094; background: var(--amber-soft); color: #805015; }
.status-badge.neutral { color: var(--muted); }
.status-detail { color: var(--muted); font-size: var(--text-xs); }
.status-detail + .status-detail::before { content: "·"; margin-right: 8px; color: #a8b2ac; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 18px;
}
.metric-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(22, 36, 29, 0.035);
}
.metric-primary { border-color: #b7d3c5; background: linear-gradient(145deg, #edf7f1, #ffffff 70%); }
.metric-label { color: var(--muted); font-size: var(--text-xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.metric-value { margin-top: 12px; overflow: hidden; color: var(--ink); font-size: var(--text-metric); font-weight: 780; letter-spacing: -0.045em; text-overflow: ellipsis; white-space: nowrap; }
.metric-compact { font-size: var(--text-metric); }
.metric-note { margin-top: 6px; overflow: hidden; color: #8a958f; font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.chart-panel { padding: 20px 20px 12px; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
}
.panel-header.compact { margin-bottom: 15px; }
.panel-header h2 { margin: 5px 0 0; font-size: var(--text-lg); letter-spacing: -0.02em; }
.chart-controls { display: flex; gap: 9px; }
.chart-controls label { display: grid; gap: 4px; color: var(--muted); font-size: var(--text-2xs); font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.chart-controls select {
  min-width: 100px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: var(--text-xs);
}
.price-chart { width: 100%; height: 560px; }

.signals-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.signal-panel { padding: 19px; }
.buy-color { color: var(--buy); }
.sell-color { color: var(--sell); }
.signal-count { display: grid; place-items: center; min-width: 32px; height: 26px; padding: 0 8px; border-radius: 999px; font-size: var(--text-xs); font-weight: 800; }
.signal-count.buy { background: var(--buy-soft); color: var(--buy); }
.signal-count.sell { background: var(--sell-soft); color: var(--sell); }
.signal-list { display: grid; gap: 8px; }
.signal-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); line-height: 1.35; }
.signal-direction { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; font-size: var(--text-sm); font-weight: 850; }
.signal-card.buy .signal-direction { background: var(--buy-soft); color: var(--buy); }
.signal-card.sell .signal-direction { background: var(--sell-soft); color: var(--sell); }
.signal-content { min-width: 0; }
.signal-title { overflow: hidden; font-size: var(--text-xs); font-weight: 720; text-overflow: ellipsis; white-space: nowrap; }
.signal-meta { margin-top: 4px; color: var(--muted); font-size: var(--text-xs); line-height: 1.35; }
.signal-price { font-size: var(--text-sm); font-weight: 760; }
.signal-empty { padding: 18px 10px; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); font-size: var(--text-xs); text-align: center; }

.busy-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 13px;
  background: rgba(244, 245, 242, 0.78);
  color: #425149;
  font-size: var(--text-sm);
  font-weight: 700;
  backdrop-filter: blur(5px);
}
.busy-overlay[hidden] { display: none; }
.spinner { width: 34px; height: 34px; border: 3px solid #cbd8d1; border-top-color: var(--brand); border-radius: 50%; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-region { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: grid; gap: 8px; width: min(360px, calc(100vw - 44px)); }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #17251f; color: #eef6f2; box-shadow: 0 14px 36px rgba(17, 32, 24, 0.22); font-size: var(--text-sm); line-height: 1.45; animation: toast-in 180ms ease-out; }
.toast.error { border-color: #a44841; background: #5c2925; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; max-height: none; }
  .brand { padding: 17px 18px; }
  .sidebar-section { padding: 16px 18px; }
  .watchlist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-content { padding: 0 18px 28px; }
  .topbar { position: static; align-items: flex-start; min-height: auto; }
}
@media (max-width: 680px) {
  .topbar { display: grid; }
  .topbar-actions { justify-content: flex-start; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .signals-grid { grid-template-columns: 1fr; }
  .panel-header { align-items: flex-start; flex-direction: column; }
  .chart-controls { width: 100%; }
  .chart-controls label { flex: 1; }
  .chart-controls select { width: 100%; }
  .price-chart { height: 480px; }
}
@media (max-width: 460px) {
  .watchlist { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 14px; }
  .topbar-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .topbar-actions .button:last-child { grid-column: 1 / -1; }
}


/* Phase 4A watchlist intelligence */
.overview-nav {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 15px;
  padding: 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: #dce8e2;
  text-align: left;
  cursor: pointer;
}
.overview-nav:hover { background: rgba(255, 255, 255, 0.075); }
.overview-nav.active { border-color: rgba(104, 205, 159, 0.4); background: rgba(80, 176, 132, 0.18); }
.overview-nav-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: rgba(217, 244, 229, 0.12); color: #bcebd4; font-size: var(--text-lg); }
.overview-nav-copy { display: grid; min-width: 0; gap: 3px; }
.overview-nav-copy strong { font-size: var(--text-sm); }
.overview-nav-copy small { overflow: hidden; color: #8fa299; font-size: var(--text-2xs); text-overflow: ellipsis; white-space: nowrap; }
.overview-nav-count { display: grid; place-items: center; min-width: 25px; height: 25px; padding: 0 7px; border-radius: 999px; background: rgba(217, 244, 229, 0.12); color: #bcebd4; font-size: var(--text-xs); font-weight: 800; }

.overview { padding-top: 20px; }
.overview-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 18px;
}
.summary-card {
  position: relative;
  min-width: 0;
  min-height: 126px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(22, 36, 29, 0.035);
}
.summary-card::after { content: ""; position: absolute; right: -24px; bottom: -28px; width: 72px; height: 72px; border-radius: 50%; background: #eef2ef; }
.summary-attention { border-color: #e6c994; background: linear-gradient(145deg, #fff8e9, #fff 75%); }
.summary-attention::after { background: #f8e7c4; }
.summary-changes { border-color: #b9d0eb; background: linear-gradient(145deg, #edf5fc, #fff 75%); }
.summary-changes::after { background: #dcebf8; }
.summary-buy { border-color: #efc5bd; background: linear-gradient(145deg, #fff2ef, #fff 75%); }
.summary-buy::after { background: #fae3df; }
.summary-sell { border-color: #b8dec9; background: linear-gradient(145deg, #edf8f2, #fff 75%); }
.summary-sell::after { background: #dff2e8; }
.summary-issues { border-color: #d4d9d5; background: linear-gradient(145deg, #f6f7f5, #fff 75%); }
.summary-label { position: relative; z-index: 1; color: var(--muted); font-size: var(--text-xs); font-weight: 760; letter-spacing: 0.04em; text-transform: uppercase; }
.summary-value { position: relative; z-index: 1; margin-top: 12px; font-size: var(--text-4xl); font-weight: 800; letter-spacing: -0.04em; }
.summary-note { position: relative; z-index: 1; margin-top: 5px; overflow: hidden; color: #87928c; font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }

.overview-panel { overflow: hidden; }
.overview-panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 21px 22px 17px; border-bottom: 1px solid var(--line); }
.overview-panel-header h2 { margin: 5px 0 0; font-size: var(--text-xl); letter-spacing: -0.02em; }
.overview-panel-header p { margin: 7px 0 0; color: var(--muted); font-size: var(--text-xs); line-height: 1.5; }
.overview-generated { display: grid; flex: none; gap: 5px; color: var(--muted); font-size: var(--text-xs); text-align: right; }
.overview-generated span:first-child { color: var(--ink); font-weight: 750; }
.overview-filters { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(170px, 1.25fr); gap: 10px; padding: 14px 22px; border-bottom: 1px solid var(--line); background: var(--surface-muted); }
.overview-filters label { display: grid; gap: 5px; color: var(--muted); font-size: var(--text-2xs); font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; }
.overview-filters select { min-width: 0; width: 100%; height: 35px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; outline: 0; background: var(--surface); color: var(--ink); font-size: var(--text-xs); text-transform: none; }
.overview-filters select:focus { border-color: #8abca5; box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.08); }
.overview-table-wrap { width: 100%; overflow-x: auto; }
.overview-table { width: 100%; min-width: 1120px; border-collapse: collapse; table-layout: fixed; }
.overview-table th { padding: 10px 11px; border-bottom: 1px solid var(--line); background: #fbfcfa; color: #7b8781; font-size: var(--text-2xs); font-weight: 780; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.overview-table th:first-child, .overview-table td:first-child { width: 18%; padding-left: 22px; }
.overview-table th:nth-child(2) { width: 10%; }
.overview-table th:nth-child(3) { width: 10%; }
.overview-table th:nth-child(4) { width: 7%; }
.overview-table th:nth-child(5) { width: 10%; }
.overview-table th:nth-child(6) { width: 10%; }
.overview-table th:nth-child(7) { width: 14%; }
.overview-table th:nth-child(8) { width: 9%; }
.overview-table th:last-child, .overview-table td:last-child { width: 16%; padding-right: 22px; }
.overview-table td { height: 76px; padding: 11px; border-bottom: 1px solid #eaeeeb; vertical-align: middle; font-size: var(--text-xs); line-height: 1.35; }
.overview-row { position: relative; cursor: pointer; transition: background 120ms ease; }
.overview-row:hover { background: #f6faf7; }
.overview-row:focus { outline: 2px solid rgba(23, 107, 77, 0.35); outline-offset: -2px; }
.overview-row.attention-high { box-shadow: inset 3px 0 #c67a22; }
.overview-row.attention-medium { box-shadow: inset 3px 0 #e7bd70; }
.overview-cell-stack { display: grid; min-width: 0; gap: 5px; }
.overview-name, .overview-price { overflow: hidden; font-size: var(--text-xs); font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.overview-name { font-size: var(--text-sm); }
.overview-subtext { display: block; overflow: hidden; color: #84908a; font-size: var(--text-2xs); line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.overview-subtext.rising { color: var(--amber); }
.classification-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.classification-badge { padding: 4px 6px; border-radius: 6px; background: #eff2ef; color: #64716a; font-size: var(--text-2xs); font-weight: 780; letter-spacing: 0.03em; text-transform: uppercase; }
.classification-badge.market { background: #e9f2ed; color: var(--brand); }
.overview-change strong { font-size: var(--text-xs); }
.overview-change.positive { color: var(--buy); }
.overview-change.negative { color: var(--sell); }
.overview-change.flat { color: var(--muted); }
.overview-signal { display: inline-flex; width: fit-content; max-width: 100%; padding: 5px 7px; overflow: hidden; border-radius: 7px; font-size: var(--text-2xs); font-weight: 760; text-overflow: ellipsis; white-space: nowrap; }
.overview-signal.buy { background: var(--buy-soft); color: var(--buy); }
.overview-signal.sell { background: var(--sell-soft); color: var(--sell); }
.overview-signal.neutral { background: #eff2ef; color: #66736c; }
.overview-data-badge { display: inline-flex; width: fit-content; padding: 4px 7px; border-radius: 999px; font-size: var(--text-2xs); font-weight: 780; text-transform: uppercase; }
.overview-data-badge.fresh { background: var(--sell-soft); color: #126747; }
.overview-data-badge.stale { background: var(--amber-soft); color: #805015; }
.overview-data-badge.error { background: var(--buy-soft); color: var(--danger); }
.attention-cell { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; }
.attention-score { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border: 1px solid var(--line); border-radius: 50%; background: #f3f5f3; color: #67736d; font-size: var(--text-xs); font-weight: 820; }
.attention-score.high { border-color: #e4bc78; background: #fff0d5; color: #915b17; }
.attention-score.medium { border-color: #ead8ad; background: #fff8e9; color: #8a6a29; }
.attention-reason { display: -webkit-box; overflow: hidden; color: #6e7a74; font-size: var(--text-2xs); line-height: 1.35; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.overview-empty { padding: 44px 20px; color: var(--muted); font-size: var(--text-sm); text-align: center; }

@media (max-width: 1180px) {
  .overview-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-filters { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}
@media (max-width: 900px) {
  .overview-nav { max-width: 420px; }
  .overview-summary { grid-template-columns: repeat(6, minmax(150px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
  .summary-card { min-height: 114px; }
}
@media (max-width: 680px) {
  .overview-panel-header { display: grid; }
  .overview-generated { text-align: left; }
  .overview-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 13px 15px; }
  .overview-filters label:last-child { grid-column: 1 / -1; }
  .overview-table th:first-child, .overview-table td:first-child { padding-left: 15px; }
}
@media (max-width: 460px) {
  .overview-summary { grid-template-columns: repeat(6, minmax(138px, 1fr)); }
  .overview-filters { grid-template-columns: 1fr; }
  .overview-filters label:last-child { grid-column: auto; }
}


/* Phase 4B local intelligence history */
.overview-row.has-changes { background: linear-gradient(90deg, rgba(221, 237, 249, 0.42), transparent 34%); }
.overview-row.has-changes:hover { background: linear-gradient(90deg, rgba(210, 230, 246, 0.62), #f6faf7 45%); }
.overview-name-line { display: flex; align-items: center; min-width: 0; gap: 6px; }
.overview-name-line .overview-name { min-width: 0; }
.new-change-badge { flex: none; padding: 3px 5px; border-radius: 999px; background: #e2effa; color: #27618d; font-size: var(--text-2xs); font-weight: 820; letter-spacing: 0.03em; text-transform: uppercase; }
.attention-copy { display: grid; min-width: 0; gap: 4px; }
.score-delta { width: fit-content; font-size: var(--text-2xs); font-weight: 750; white-space: nowrap; }
.score-delta.up { color: var(--buy); }
.score-delta.down { color: var(--sell); }
.score-delta.flat, .score-delta.baseline { color: #8a958f; }

.event-feed-panel { margin-top: 18px; overflow: hidden; }
.event-feed-header { align-items: center; }
.event-feed-count { display: inline-flex; align-items: center; justify-content: center; min-height: 27px; padding: 0 9px; border: 1px solid #c5d7e6; border-radius: 999px; background: #edf5fc; color: #35698f; font-size: var(--text-2xs); font-weight: 780; white-space: nowrap; }
.event-feed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; padding: 16px 22px 21px; }
.event-feed-empty, .history-empty, .history-event-empty { padding: 28px 20px; color: var(--muted); font-size: var(--text-xs); line-height: 1.6; text-align: center; }
.intelligence-event { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-muted); }
.intelligence-event.clickable { cursor: pointer; transition: border-color 120ms ease, background 120ms ease, transform 120ms ease; }
.intelligence-event.clickable:hover { border-color: #b8cfc3; background: #f4f9f6; transform: translateY(-1px); }
.intelligence-event.clickable:focus { outline: 2px solid rgba(23, 107, 77, 0.32); outline-offset: 1px; }
.intelligence-event-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: #e9eeeb; color: #66736c; font-size: var(--text-sm); font-weight: 850; }
.intelligence-event.direction-buy .intelligence-event-icon, .intelligence-event.direction-up .intelligence-event-icon { background: var(--buy-soft); color: var(--buy); }
.intelligence-event.direction-sell .intelligence-event-icon, .intelligence-event.direction-down .intelligence-event-icon { background: var(--sell-soft); color: var(--sell); }
.intelligence-event.direction-warning .intelligence-event-icon { background: var(--amber-soft); color: var(--amber); }
.intelligence-event.direction-recovered .intelligence-event-icon { background: var(--brand-soft); color: var(--brand); }
.intelligence-event.severity-high { border-color: #e9c3bb; }
.intelligence-event-content { min-width: 0; }
.intelligence-event-heading { display: flex; align-items: baseline; justify-content: space-between; min-width: 0; gap: 9px; }
.intelligence-event-title { overflow: hidden; font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.intelligence-event-date { flex: none; color: #929c97; font-size: var(--text-2xs); }
.intelligence-event-detail { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: var(--text-2xs); line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }

.intelligence-history-panel { margin-bottom: 18px; padding: 19px 20px 17px; }
.intelligence-history-header { margin-bottom: 13px; }
.intelligence-history-header p { margin: 6px 0 0; }
.history-meta { color: var(--muted); font-size: var(--text-2xs); font-weight: 500; line-height: 1.4; letter-spacing: 0; text-transform: none; }
.intelligence-history-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(270px, 0.8fr); gap: 16px; align-items: stretch; }
.history-chart-column { min-width: 0; min-height: 250px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfa; overflow: hidden; }
.history-chart { width: 100%; height: 250px; }
.history-empty { display: grid; place-items: center; min-height: 248px; }
.history-events { display: grid; align-content: start; gap: 7px; max-height: 250px; overflow-y: auto; padding-right: 2px; }
.history-events .intelligence-event { padding: 9px; }
.history-events .intelligence-event-icon { width: 27px; height: 27px; border-radius: 8px; font-size: var(--text-xs); }
.history-event-empty { display: grid; place-items: center; min-height: 120px; border: 1px dashed var(--line-strong); border-radius: 12px; }

@media (max-width: 900px) {
  .intelligence-history-layout { grid-template-columns: 1fr; }
  .history-events { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: none; }
}
@media (max-width: 680px) {
  .event-feed { grid-template-columns: 1fr; padding: 13px 15px 17px; }
  .history-events { grid-template-columns: 1fr; }
  .intelligence-history-panel { padding: 16px 14px; }
}


/* Phase 4C cross-instrument comparison */
.compare-nav { margin-top: -8px; }
.compare-nav:disabled { cursor: not-allowed; opacity: 0.48; }
.compare-nav:disabled:hover { background: rgba(255, 255, 255, 0.045); }
.watch-item.comparison-selected { box-shadow: inset 3px 0 #67c89d; }

.comparison-tray {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 14px 17px;
  border-color: #b9d7c8;
  background: linear-gradient(135deg, #edf7f1, #fff 68%);
  box-shadow: 0 9px 28px rgba(23, 107, 77, 0.07);
}
.comparison-tray-text { margin-top: 4px; font-size: var(--text-xs); font-weight: 760; white-space: nowrap; }
.comparison-tray-actions { display: flex; gap: 8px; }
.comparison-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; min-width: 0; }
.comparison-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 29px;
  padding: 0 7px 0 9px;
  border: 1px solid #c7d9cf;
  border-radius: 999px;
  background: #fff;
  color: #44524b;
  font-size: var(--text-2xs);
  white-space: nowrap;
}
.comparison-chip strong { color: var(--ink); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-xs); }
.comparison-chip span + span::before { content: "·"; margin-right: 5px; color: #9aa49f; }
.comparison-chip-remove { display: grid; place-items: center; width: 19px; height: 19px; padding: 0; border: 0; border-radius: 50%; background: #eef2ef; color: #68756e; cursor: pointer; font-size: var(--text-sm); line-height: 1; }
.comparison-chip-remove:hover { background: var(--buy-soft); color: var(--danger); }

.overview-instrument-select { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; min-width: 0; }
.overview-compare-check { display: grid; place-items: center; width: 20px; height: 20px; cursor: pointer; }
.overview-compare-check input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.overview-check-mark { display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid #bfc9c3; border-radius: 5px; background: #fff; transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease; }
.overview-compare-check input:checked + .overview-check-mark { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px #fff; }
.overview-compare-check input:focus-visible + .overview-check-mark { outline: 2px solid rgba(23, 107, 77, 0.35); outline-offset: 2px; }
.overview-compare-check input:disabled + .overview-check-mark { cursor: not-allowed; opacity: 0.38; }
.overview-row.comparison-selected { background: linear-gradient(90deg, rgba(228, 242, 235, 0.78), transparent 42%); }
.overview-row.comparison-selected:hover { background: linear-gradient(90deg, rgba(216, 237, 227, 0.92), #f6faf7 48%); }

.comparison { display: grid; gap: 18px; padding-top: 20px; }
.comparison-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 21px 22px; }
.comparison-hero-copy { min-width: 0; }
.comparison-hero h2 { margin: 5px 0 0; font-size: var(--text-xl); letter-spacing: -0.025em; }
.comparison-hero p, .comparison-explainer { margin: 7px 0 13px; color: var(--muted); font-size: var(--text-xs); line-height: 1.55; }
.comparison-controls { display: flex; align-items: end; gap: 9px; flex: none; }
.comparison-controls label { display: grid; gap: 5px; color: var(--muted); font-size: var(--text-2xs); font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; }
.comparison-controls select { min-width: 132px; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 10px; outline: 0; background: var(--surface-muted); color: var(--ink); font-size: var(--text-xs); text-transform: none; }
.comparison-controls select:focus { border-color: #8abca5; box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.08); }

.comparison-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.comparison-summary-card { min-width: 0; min-height: 112px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 8px 24px rgba(22, 36, 29, 0.035); }
.comparison-summary-card.performance { border-color: #b7d3c5; background: linear-gradient(145deg, #edf7f1, #fff 75%); }
.comparison-summary-card.volatility { border-color: #bed0df; background: linear-gradient(145deg, #eef5fa, #fff 75%); }
.comparison-summary-card.drawdown { border-color: #dbcdaa; background: linear-gradient(145deg, #faf6e9, #fff 75%); }
.comparison-summary-card.attention { border-color: #e6c994; background: linear-gradient(145deg, #fff8e9, #fff 75%); }
.comparison-leader { margin-top: 12px; overflow: hidden; font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.035em; text-overflow: ellipsis; white-space: nowrap; }

.comparison-chart-panel { padding: 20px 20px 12px; }
.comparison-chart-panel .panel-header { align-items: flex-start; }
.comparison-chart-panel .panel-header h2 { margin: 5px 0 0; }
.comparison-range { flex: none; padding: 6px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-muted); color: var(--muted); font-size: var(--text-2xs); white-space: nowrap; }
.comparison-chart { width: 100%; height: 430px; }
.comparison-empty { display: grid; place-items: center; min-height: 180px; padding: 24px; color: var(--muted); font-size: var(--text-xs); line-height: 1.6; text-align: center; }

.comparison-metrics-panel { overflow: hidden; }
.comparison-table-wrap { width: 100%; overflow-x: auto; }
.comparison-table { width: 100%; min-width: 1340px; border-collapse: collapse; }
.comparison-table th { padding: 10px 11px; border-bottom: 1px solid var(--line); background: #fbfcfa; color: #7b8781; font-size: var(--text-2xs); font-weight: 790; letter-spacing: 0.04em; text-align: left; text-transform: uppercase; white-space: nowrap; }
.comparison-table td { min-width: 76px; height: 72px; padding: 11px; border-bottom: 1px solid #eaeeeb; color: #455149; font-size: var(--text-xs); line-height: 1.35; vertical-align: middle; white-space: nowrap; }
.comparison-table tr:last-child td { border-bottom: 0; }
.comparison-table tbody tr:hover { background: #f7faf8; }
.comparison-table th:first-child, .comparison-table td:first-child { min-width: 190px; padding-left: 22px; }
.comparison-table th:last-child, .comparison-table td:last-child { min-width: 150px; padding-right: 22px; }
.comparison-sticky-cell { background: inherit; }
.comparison-identity { display: grid; gap: 5px; min-width: 0; }
.comparison-instrument-link { width: fit-content; max-width: 180px; padding: 0; overflow: hidden; border: 0; background: transparent; color: var(--ink); cursor: pointer; font-size: var(--text-xs); font-weight: 760; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.comparison-instrument-link:hover { color: var(--brand); text-decoration: underline; }
.comparison-positive { color: var(--buy) !important; }
.comparison-negative { color: var(--sell) !important; }
.comparison-flat { color: var(--muted) !important; }
.comparison-attention-cell { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; white-space: normal; }
.comparison-table-empty { height: 130px !important; color: var(--muted) !important; text-align: center; }

.comparison-lower-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.8fr); gap: 18px; }
.correlation-panel, .comparison-notices-panel { min-width: 0; overflow: hidden; }
.correlation-matrix { padding: 16px 22px 22px; }
.correlation-table-wrap { overflow-x: auto; }
.correlation-table { width: 100%; min-width: 420px; border-collapse: separate; border-spacing: 5px; }
.correlation-table th { min-width: 62px; padding: 7px; color: #69756f; font-size: var(--text-2xs); font-weight: 780; text-align: center; }
.correlation-table th:first-child { position: sticky; left: 0; background: var(--surface); text-align: left; }
.correlation-table td { min-width: 62px; height: 46px; border-radius: 9px; background: #f1f3f1; color: #5d6862; font-size: var(--text-xs); font-weight: 780; text-align: center; }
.correlation-table td.positive { background: rgba(53, 111, 159, calc(0.08 + var(--correlation-strength) * 0.14)); color: #315f83; }
.correlation-table td.positive-strong { background: rgba(53, 111, 159, calc(0.16 + var(--correlation-strength) * 0.25)); color: #174d76; }
.correlation-table td.negative { background: rgba(165, 102, 22, calc(0.08 + var(--correlation-strength) * 0.14)); color: #8a591c; }
.correlation-table td.negative-strong { background: rgba(165, 102, 22, calc(0.16 + var(--correlation-strength) * 0.25)); color: #70420b; }
.correlation-table td.unavailable { color: #a1aaa5; }

.comparison-errors, .comparison-warnings { display: grid; gap: 8px; padding: 15px 20px 0; }
.comparison-warnings { padding-bottom: 20px; }
.comparison-error-item, .comparison-warning-item { display: grid; gap: 4px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: var(--text-2xs); line-height: 1.45; }
.comparison-error-item { border-color: #e8bdb7; background: #fff5f3; color: #7d3730; }
.comparison-error-item strong { color: var(--danger); font-size: var(--text-xs); }
.comparison-warning-item { background: var(--surface-muted); }

@media (max-width: 1180px) {
  .comparison-tray { grid-template-columns: auto minmax(0, 1fr); }
  .comparison-tray-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .comparison-lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .comparison-hero { display: grid; }
  .comparison-controls { flex-wrap: wrap; }
  .comparison-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comparison-chart { height: 390px; }
}
@media (max-width: 680px) {
  .comparison-tray { grid-template-columns: 1fr; padding: 14px; }
  .comparison-tray-actions { grid-column: auto; justify-content: flex-start; }
  .comparison-hero { padding: 17px 15px; }
  .comparison-controls { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .comparison-controls label:last-of-type { grid-column: 2; }
  .comparison-controls select { width: 100%; min-width: 0; }
  .comparison-controls .button { grid-column: 1 / -1; }
  .comparison-summary { display: flex; overflow-x: auto; padding-bottom: 3px; }
  .comparison-summary-card { min-width: 190px; }
  .comparison-chart-panel { padding: 16px 13px 10px; }
  .comparison-chart { height: 340px; }
  .comparison-range { white-space: normal; }
  .comparison-table th:first-child, .comparison-table td:first-child { padding-left: 15px; }
  .correlation-matrix { padding: 12px 10px 16px; }
}
@media (max-width: 460px) {
  .comparison-controls { grid-template-columns: 1fr; }
  .comparison-controls label:last-of-type, .comparison-controls .button { grid-column: auto; }
}


/* Phase 5A Strategy Lab */
.strategy-lab-panel { margin-bottom: 18px; overflow: hidden; }
.strategy-lab-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 21px 22px 17px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f7fbf8, #fff 72%);
}
.strategy-lab-header h2 { margin: 5px 0 0; font-size: var(--text-xl); letter-spacing: -0.025em; }
.strategy-lab-header p { max-width: 680px; margin: 7px 0 0; color: var(--muted); font-size: var(--text-xs); line-height: 1.55; }
.strategy-research-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #dfc487;
  border-radius: 999px;
  background: var(--amber-soft);
  color: #7e5015;
  font-size: var(--text-2xs);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.strategy-disclaimer { padding: 10px 22px; border-bottom: 1px solid #ead9b2; background: #fffaf0; color: #765a29; font-size: var(--text-2xs); line-height: 1.5; }
.strategy-lab-layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: 560px; }
.strategy-tabs { display: grid; align-content: start; gap: 7px; padding: 16px; border-right: 1px solid var(--line); background: var(--surface-muted); }
.strategy-tab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.strategy-tab:hover { border-color: #b8ccc1; transform: translateY(-1px); }
.strategy-tab.active { border-color: #81b49c; box-shadow: 0 0 0 3px rgba(23, 107, 77, 0.08); }
.strategy-tab-copy { display: grid; min-width: 0; gap: 4px; }
.strategy-tab-copy strong { overflow: hidden; font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.strategy-tab-copy small { overflow: hidden; color: var(--muted); font-size: var(--text-2xs); text-overflow: ellipsis; text-transform: capitalize; white-space: nowrap; }
.strategy-tab-state, .strategy-state-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-weight: 800; white-space: nowrap; }
.strategy-tab-state { max-width: 78px; min-height: 23px; padding: 0 7px; overflow: hidden; font-size: var(--text-2xs); text-overflow: ellipsis; }
.strategy-state-badge { min-height: 31px; padding: 0 11px; font-size: var(--text-2xs); letter-spacing: 0.025em; text-transform: uppercase; }
.state-watch { background: #edf2f5; color: #536770; }
.state-setup { background: var(--amber-soft); color: #855517; }
.state-entry { background: var(--buy-soft); color: var(--buy); }
.state-hold { background: var(--brand-soft); color: var(--brand); }
.state-exit { background: #e7f2ed; color: var(--sell); }
.state-avoid { background: #f5e9e7; color: #963f37; }
.state-not_applicable { background: #eff1ef; color: #7b8580; }

.strategy-detail { min-width: 0; padding: 18px 20px 21px; }
.strategy-state-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.strategy-state-identity { min-width: 0; }
.strategy-state-identity h3 { margin: 5px 0 0; font-size: var(--text-xl); letter-spacing: -0.025em; }
.strategy-state-identity p { max-width: 720px; margin: 7px 0 0; color: var(--muted); font-size: var(--text-xs); line-height: 1.55; }
.strategy-state-box { display: grid; justify-items: end; flex: none; gap: 6px; }
.strategy-state-date { color: #89938e; font-size: var(--text-2xs); }
.strategy-guardrail { display: grid; gap: 5px; margin-top: 14px; padding: 11px 13px; border: 1px solid #e7cc91; border-radius: 11px; background: #fffaf0; color: #6f5527; font-size: var(--text-2xs); line-height: 1.5; }
.strategy-guardrail strong { color: #7c4f13; font-size: var(--text-2xs); text-transform: uppercase; }
.strategy-action-timing { width: fit-content; padding: 3px 6px; border-radius: 6px; background: #f6e9c8; font-weight: 720; }
.strategy-evaluation-error { margin-top: 14px; padding: 13px; border: 1px solid #e8bdb7; border-radius: 10px; background: #fff5f3; color: var(--danger); font-size: var(--text-xs); }

.strategy-definition, .strategy-plan { margin-top: 18px; }
.strategy-definition > h4, .strategy-plan > h4, .strategy-column-heading, .strategy-data-card h4, .strategy-transitions-card h4 { margin: 0 0 9px; color: #647069; font-size: var(--text-2xs); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.strategy-definition-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.strategy-info-card { min-width: 0; min-height: 112px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-muted); }
.strategy-info-kicker { color: var(--brand); font-size: var(--text-2xs); font-weight: 820; letter-spacing: 0.04em; text-transform: uppercase; }
.strategy-info-title { display: block; margin-top: 6px; overflow: hidden; font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.strategy-info-card p { margin: 6px 0 0; color: var(--muted); font-size: var(--text-2xs); line-height: 1.5; }
.strategy-reference { display: inline-flex; margin-top: 7px; padding: 3px 6px; border-radius: 6px; background: #e9eeeb; color: #59665f; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--text-2xs); }

.strategy-detail-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.8fr); gap: 16px; margin-top: 18px; }
.strategy-rules-column, .strategy-evidence-column { min-width: 0; }
.strategy-rule-section + .strategy-rule-section { margin-top: 12px; }
.strategy-rule-section h4 { margin: 0 0 6px; color: #7b8680; font-size: var(--text-2xs); }
.strategy-rule-list { display: grid; gap: 5px; }
.strategy-rule { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfa; }
.strategy-rule.satisfied { border-color: #c6dfd2; background: #f3faf6; }
.strategy-rule.unsatisfied { border-color: #e5d4b4; background: #fffaf1; }
.strategy-rule.not-evaluated { background: #f5f6f4; opacity: 0.8; }
.strategy-rule-icon { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 7px; background: #e9eeeb; color: #68746d; font-size: var(--text-xs); font-weight: 850; }
.strategy-rule.satisfied .strategy-rule-icon { background: var(--brand-soft); color: var(--brand); }
.strategy-rule.unsatisfied .strategy-rule-icon { background: var(--amber-soft); color: var(--amber); }
.strategy-rule-copy { display: grid; min-width: 0; gap: 3px; }
.strategy-rule-copy strong { font-size: var(--text-2xs); line-height: 1.35; }
.strategy-rule-copy span, .strategy-rule-copy small { color: var(--muted); font-size: var(--text-2xs); line-height: 1.35; }
.strategy-evidence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.strategy-evidence-card { display: grid; gap: 4px; min-width: 0; min-height: 83px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfa; }
.strategy-evidence-card > span { color: var(--muted); font-size: var(--text-2xs); }
.strategy-evidence-card strong { overflow: hidden; font-size: var(--text-md); letter-spacing: -0.02em; text-overflow: ellipsis; white-space: nowrap; }
.strategy-evidence-card small { overflow: hidden; color: #8d9792; font-size: var(--text-2xs); text-overflow: ellipsis; white-space: nowrap; }
.strategy-inline-empty { padding: 16px 10px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted); font-size: var(--text-2xs); text-align: center; }

.strategy-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.strategy-plan-grid .strategy-info-card { min-height: 128px; }
.strategy-exit-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.strategy-exit-list strong { margin-right: 3px; font-size: var(--text-2xs); }
.strategy-exit-list span { padding: 4px 7px; border-radius: 7px; background: #eef2ef; color: #58655e; font-size: var(--text-2xs); }
.strategy-footer-grid { display: grid; grid-template-columns: minmax(260px, 0.7fr) minmax(0, 1.3fr); gap: 10px; margin-top: 18px; }
.strategy-data-card, .strategy-transitions-card { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-muted); }
.strategy-data-card { display: grid; align-content: start; gap: 5px; }
.strategy-data-card.sufficient { border-color: #c6dfd2; background: #f4faf6; }
.strategy-data-card.insufficient { border-color: #e5c989; background: #fffaf0; }
.strategy-data-card strong { font-size: var(--text-xs); }
.strategy-data-card span { color: var(--muted); font-size: var(--text-2xs); line-height: 1.4; }
.strategy-transitions-card { display: grid; align-content: start; gap: 6px; }
.strategy-transition-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 3px 8px; padding: 7px 8px; border-radius: 8px; background: #fff; }
.strategy-transition-date { grid-row: 1 / 3; color: #8a958f; font-size: var(--text-2xs); }
.strategy-transition-row strong { font-size: var(--text-2xs); text-transform: capitalize; }
.strategy-transition-row small { overflow: hidden; color: var(--muted); font-size: var(--text-2xs); text-overflow: ellipsis; white-space: nowrap; }
.strategy-empty { display: grid; place-items: center; min-height: 260px; padding: 30px; color: var(--muted); font-size: var(--text-xs); text-align: center; }
.strategy-legacy-policy { padding: 10px 22px; border-top: 1px solid var(--line); background: #f7f8f6; color: #737f79; font-size: var(--text-2xs); line-height: 1.45; }
.legacy-signal-banner { display: flex; align-items: center; gap: 9px; margin: 18px 0 -2px; padding: 10px 12px; border: 1px solid #d7ddd9; border-radius: 11px; background: #f7f8f6; color: var(--muted); font-size: var(--text-2xs); line-height: 1.4; }
.legacy-signal-banner strong { flex: none; color: #56625c; font-size: var(--text-2xs); letter-spacing: 0.04em; text-transform: uppercase; }

@media (max-width: 1180px) {
  .strategy-lab-layout { grid-template-columns: 210px minmax(0, 1fr); }
  .strategy-definition-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strategy-detail-grid { grid-template-columns: 1fr; }
  .strategy-evidence-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .strategy-lab-layout { grid-template-columns: 1fr; }
  .strategy-tabs { grid-template-columns: repeat(2, minmax(190px, 1fr)); overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .strategy-plan-grid { grid-template-columns: 1fr; }
  .strategy-plan-grid .strategy-info-card { min-height: auto; }
}
@media (max-width: 680px) {
  .strategy-lab-header { display: grid; padding: 17px 15px 14px; }
  .strategy-research-badge { width: fit-content; white-space: normal; }
  .strategy-disclaimer, .strategy-legacy-policy { padding-left: 15px; padding-right: 15px; }
  .strategy-tabs { grid-template-columns: repeat(2, minmax(175px, 1fr)); padding: 12px; }
  .strategy-detail { padding: 15px; }
  .strategy-state-header { display: grid; }
  .strategy-state-box { justify-items: start; }
  .strategy-definition-grid { grid-template-columns: 1fr; }
  .strategy-info-card { min-height: auto; }
  .strategy-evidence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .strategy-footer-grid { grid-template-columns: 1fr; }
  .legacy-signal-banner { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 460px) {
  .strategy-tabs { grid-template-columns: 1fr; }
  .strategy-evidence-grid { grid-template-columns: 1fr 1fr; }
}

/* Phase 5A.1 bilingual interface */
.language-toggle {
  min-width: 76px;
  border-color: #a9c7b8;
  color: var(--brand-dark);
  letter-spacing: 0.01em;
}
.language-toggle::before {
  content: "文";
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 6px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: var(--text-2xs);
  font-weight: 850;
}

/* Fundamentals (valuation context) */
.fundamentals-panel { margin-bottom: 18px; overflow: hidden; }
.fundamentals-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
  padding: 21px 22px 17px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f8fafc, #fff 72%);
}
.fundamentals-header h2 { margin: 5px 0 0; font-size: var(--text-xl); letter-spacing: -0.025em; }
.fundamentals-header p { max-width: 680px; margin: 7px 0 0; color: var(--muted); font-size: var(--text-xs); line-height: 1.55; }
.fundamentals-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
  padding: 16px 22px;
}
.fundamentals-grid .metric-card { background: var(--surface); }
.fundamentals-note:empty { display: none; }
.fundamentals-note {
  margin: 0;
  padding: 10px 22px 16px;
  color: var(--muted);
  font-size: var(--text-2xs);
  line-height: 1.5;
}
@media (max-width: 1180px) {
  .fundamentals-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .fundamentals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fundamentals-header { flex-direction: column; }
}
@media (max-width: 460px) {
  .fundamentals-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Collapsible sidebar ---------- */
.topbar-lead { display: flex; align-items: center; gap: 16px; min-width: 0; }

.sidebar-toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
}
.sidebar-toggle-icon {
  display: block;
  color: #4a5a52;
}
.sidebar-toggle-chevron { transition: transform 160ms ease; transform-origin: 12.4px 10px; }
.sidebar-collapsed .sidebar-toggle-chevron { transform: scaleX(-1); }

.app-shell { transition: grid-template-columns 200ms ease; }
.sidebar-collapsed .app-shell { grid-template-columns: 68px minmax(0, 1fr); }

.rail-button { display: none; }

.sidebar-collapsed .sidebar { overflow: hidden; }

/* Rail: hide prose, keep one tappable icon per affordance. */
.sidebar-collapsed .brand { justify-content: center; padding: 22px 0 18px; }
.sidebar-collapsed .brand > div:not(.brand-mark) { display: none; }
.sidebar-collapsed .brand-mark { flex: none; }

.sidebar-collapsed .sidebar-section { padding: 14px 0; }
.sidebar-collapsed .section-heading,
.sidebar-collapsed .search-form,
.sidebar-collapsed .search-results,
.sidebar-collapsed .group-field,
.sidebar-collapsed .watch-group-title,
.sidebar-collapsed .overview-nav-copy,
.sidebar-collapsed .watch-item-main,
.sidebar-collapsed .watch-remove { display: none; }

.sidebar-collapsed .rail-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin: 0 auto;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.07);
  color: #bcebd4;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.sidebar-collapsed .rail-button:hover { border-color: #67c89d; background: rgba(255, 255, 255, 0.12); }
.rail-icon { font-size: var(--text-xl); line-height: 1; }

.sidebar-collapsed .overview-nav {
  grid-template-columns: auto;
  justify-items: center;
  width: 40px;
  margin: 0 auto 9px;
  padding: 5px;
}
.sidebar-collapsed .overview-nav-count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 15px;
  padding: 0 3px;
  font-size: var(--text-2xs);
  line-height: 15px;
}
.sidebar-collapsed .overview-nav { position: relative; }

.sidebar-collapsed .watchlist { gap: 6px; justify-items: center; }
.sidebar-collapsed .watch-group { gap: 4px; width: 100%; justify-items: center; }
.sidebar-collapsed .watch-item {
  grid-template-columns: auto;
  justify-items: center;
  width: 40px;
  padding: 0;
  height: 36px;
  align-content: center;
}
/* Ticker initials stand in for the hidden name; content comes from JS via data-rail. */
.sidebar-collapsed .watch-item::before {
  content: attr(data-rail);
  color: #cfe0d8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: -0.01em;
}

@media (max-width: 900px) {
  /* Sidebar is a full-width static block here; collapsing it would strand the watchlist. */
  .sidebar-toggle { display: none; }
  .sidebar-collapsed .app-shell { grid-template-columns: 1fr; }
  .sidebar-collapsed .sidebar { overflow: visible; }
  .sidebar-collapsed .rail-button { display: none; }
  .sidebar-collapsed .brand { justify-content: flex-start; padding: 17px 18px; }
  .sidebar-collapsed .brand > div:not(.brand-mark) { display: block; }
  .sidebar-collapsed .sidebar-section { padding: 16px 18px; }
  .sidebar-collapsed .section-heading,
  .sidebar-collapsed .search-form,
  .sidebar-collapsed .search-results,
  .sidebar-collapsed .group-field,
  .sidebar-collapsed .watch-group-title,
  .sidebar-collapsed .overview-nav-copy,
  .sidebar-collapsed .watch-item-main,
  .sidebar-collapsed .watch-remove { display: revert; }
  .sidebar-collapsed .overview-nav { grid-template-columns: auto minmax(0, 1fr) auto; justify-items: stretch; width: 100%; margin-bottom: 15px; padding: 11px; }
  .sidebar-collapsed .overview-nav-count { position: static; }
  .sidebar-collapsed .watch-item { grid-template-columns: minmax(0, 1fr) auto; justify-items: stretch; width: 100%; height: auto; padding: 9px 9px 9px 11px; }
  .sidebar-collapsed .watch-item::before { content: none; }
  .sidebar-collapsed .watchlist, .sidebar-collapsed .watch-group { justify-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell,
  .sidebar-toggle-chevron,
  .rail-button { transition: none; }
}

/* ---------- Persistent disclaimer footer ---------- */
.app-disclaimer {
  margin: 28px 0 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.55;
  text-align: center;
}
.app-disclaimer #app-disclaimer-text::before {
  content: "ⓘ ";
  color: var(--brand);
  font-weight: 800;
}

/* ---------- First-run research-only banner ---------- */
.first-run-banner {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 30, 26, 0.45);
  backdrop-filter: blur(4px);
}
.first-run-card {
  width: min(440px, 100%);
  padding: 24px 24px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.first-run-title { margin: 0 0 10px; font-size: var(--text-xl); font-weight: 760; letter-spacing: -0.01em; }
.first-run-body { margin: 0 0 18px; color: var(--muted); font-size: var(--text-sm); line-height: 1.6; }
.first-run-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.first-run-ack { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: var(--text-sm); cursor: pointer; }
.first-run-ack input { width: 14px; height: 14px; accent-color: var(--brand); }
