:root {
  color-scheme: dark;
  --ink: #f2f4f6;
  --muted: #9ca6ad;
  --line: #3b4248;
  --panel: #15181b;
  --panel-2: #0f1113;
  --surface: #08090a;
  --accent: #d7a84d;
  --accent-2: #9d1f1f;
  --accent-3: #d8dee4;
  --danger: #ff5b5b;
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(215, 168, 77, 0.08), transparent 30%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 10px),
    linear-gradient(180deg, #171a1d 0%, var(--surface) 42%, #020303 100%);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 8px 0 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "/// ";
  color: #7d858b;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.96;
  text-shadow: 0 2px 0 #000, 0 0 22px rgba(216, 222, 228, 0.16);
}

h2 {
  font-size: 1.05rem;
}

.quote-strip,
.symbol-browser,
.symbol-tabs,
.controls,
.summary-grid,
.panel {
  border: 1px solid var(--line);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.01) 38%),
    linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
}

[hidden] {
  display: none !important;
}

.workspace-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.workspace-tab {
  min-width: 132px;
  min-height: 40px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
}

.workspace-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  background: linear-gradient(180deg, rgba(215, 168, 77, 0.08), transparent);
}

.quote-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px;
  border-radius: 8px;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), var(--shadow);
}

#quotePrice {
  font-size: 1.2rem;
  font-weight: 800;
}

#quoteState {
  color: var(--muted);
  font-size: 0.88rem;
}

button {
  min-height: 34px;
  border: 1px solid #565f66;
  border-radius: 7px;
  padding: 0 12px;
  color: #050607;
  background: linear-gradient(180deg, #f1d48a, var(--accent));
  cursor: pointer;
  font-weight: 800;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.symbol-browser {
  margin-bottom: 16px;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow);
}

.group-tabs,
.symbol-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px;
  scrollbar-width: thin;
}

.group-tabs {
  border-bottom: 1px solid var(--line);
  background: #090b0c;
}

.symbol-tabs {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.group-tab {
  flex: 0 0 auto;
  min-height: 32px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
  font-size: 0.75rem;
  letter-spacing: 0;
}

.group-tab.active {
  border-color: #5d4c2a;
  color: var(--accent);
  background: linear-gradient(180deg, #25231c, #12120f);
}

.symbol-tab {
  flex: 0 0 auto;
  min-width: 58px;
  min-height: 34px;
  border: 1px solid var(--line);
  color: #cfd5da;
  background: linear-gradient(180deg, #252a2e, #111315);
  font-size: 0.82rem;
  font-weight: 800;
}

.symbol-tab.active {
  border-color: var(--accent);
  color: #070809;
  background: linear-gradient(180deg, #f0d38a, var(--accent));
  box-shadow: 0 0 0 1px rgba(215, 168, 77, 0.24), 0 0 16px rgba(215, 168, 77, 0.26);
}

.custom-symbol {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: auto 112px auto;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  margin-left: 4px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.custom-symbol label {
  gap: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.custom-symbol input {
  min-height: 34px;
  text-transform: uppercase;
}

.custom-symbol button {
  min-height: 34px;
  color: #070809;
  background: linear-gradient(180deg, #f0d38a, var(--accent));
}

.controls {
  display: grid;
  grid-template-columns: 180px 220px minmax(180px, 1fr) minmax(180px, 280px);
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

select,
input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--ink);
  background: #0b0d0f;
}

select:focus,
input:focus,
button:focus-visible {
  outline: 2px solid rgba(215, 168, 77, 0.75);
  outline-offset: 2px;
}

input[type="range"] {
  padding: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 16px 0;
  overflow: hidden;
  border-radius: 8px;
  background: #30363b;
}

#ivView .summary-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
#gammaView .summary-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.summary-grid article {
  min-width: 0;
  padding: 16px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.06), transparent),
    #111417;
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  line-height: 1.1;
  color: #f5f2e7;
}

.summary-grid article > small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.66rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-grid strong.trend-rising { color: #83d7b3; }
.summary-grid strong.trend-falling { color: #ef6969; }
.summary-grid strong.trend-flat { color: #d7a84d; }

.vol-state-card {
  box-shadow: inset 0 3px 0 transparent;
}
.vol-state-card strong {
  font-size: 1rem;
  white-space: nowrap;
}
.vol-state-card.vol-state-blue {
  background: rgba(64, 145, 220, 0.18);
  box-shadow: inset 0 3px 0 #67b7ff;
}
.vol-state-card.vol-state-blue strong { color: #9bd0ff; }
.vol-state-card.vol-state-green {
  background: rgba(45, 139, 99, 0.18);
  box-shadow: inset 0 3px 0 #58c997;
}
.vol-state-card.vol-state-green strong { color: #8ae0b9; }
.vol-state-card.vol-state-yellow {
  background: rgba(190, 151, 37, 0.18);
  box-shadow: inset 0 3px 0 #e6c452;
}
.vol-state-card.vol-state-yellow strong { color: #f2d979; }
.vol-state-card.vol-state-red {
  background: rgba(187, 60, 60, 0.19);
  box-shadow: inset 0 3px 0 #e45f5f;
}
.vol-state-card.vol-state-red strong { color: #ff9999; }

.valuation-lead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  min-height: 150px;
  padding: 22px 4px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(215, 168, 77, 0.07), transparent 42%);
}

.valuation-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.valuation-tab {
  min-width: 144px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
}

.valuation-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
  background: rgba(215, 168, 77, 0.07);
}

.universe-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  min-height: 118px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
}

.universe-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #30363b;
}

.universe-summary article {
  min-width: 0;
  padding: 14px 16px;
  border-right: 1px solid var(--line);
  background: #111417;
}

.universe-summary article:last-child { border-right: 0; }
.universe-summary span { display: block; color: var(--muted); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.universe-summary strong { display: block; margin-top: 6px; color: #f5f2e7; font-size: 1.15rem; }
.universe-table-wrap { max-height: min(68vh, 820px); }
.universe-table { min-width: 1420px; }
.universe-table th { position: sticky; top: 0; z-index: 2; padding: 0; background: #0c0e10; }
.universe-table td:first-child { white-space: nowrap; }
.table-sort { width: 100%; min-height: 42px; border: 0; border-radius: 0; padding: 0 12px; color: var(--muted); background: transparent; text-align: left; white-space: nowrap; }
.table-sort:hover, .table-sort.active { color: var(--accent); background: #171a1d; }
.asset-link { min-height: 28px; border: 0; padding: 0 5px; color: var(--accent); background: transparent; }
.asset-link:hover { color: #f1d48a; text-decoration: underline; }
.rank { display: inline-block; width: 28px; color: #727d85; font-size: 0.72rem; }
.positive-text { color: #83d7b3; font-weight: 800; }
.negative-text { color: #ff9393; font-weight: 800; }
.muted-text, .unavailable { color: var(--muted); }
.multiple-difference { color: #d8dee4; font-variant-numeric: tabular-nums; }
.plays-table { min-width: 1380px; }
.plays-table th { padding: 0 12px; }
.plays-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.68rem; }
.plays-table .selection-note { max-width: 260px; color: var(--muted); font-size: 0.72rem; white-space: normal; }
.framework-table { min-width: 1500px; }
.framework-table th { padding: 0 12px; }
.framework-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: 0.68rem; }
.framework-table td strong { color: var(--accent); font-size: 1rem; }
.trade-ideas-lead { background: linear-gradient(90deg, rgba(215, 168, 77, 0.07), transparent 44%); }
.trade-ideas-controls {
  grid-template-columns: minmax(180px, 260px);
  margin-top: 16px;
}
.screener-lead { background: linear-gradient(90deg, rgba(131, 215, 179, 0.07), transparent 44%); }
.screener-controls {
  grid-template-columns: minmax(220px, 280px) minmax(160px, 220px) minmax(160px, 220px) minmax(180px, 1fr);
  margin-top: 16px;
}
.refresh-control { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.refresh-meta { color: var(--muted); font-size: .68rem; white-space: nowrap; }
.screener-table { width: 100%; min-width: 0; table-layout: fixed; text-align: center; }
.screener-table th, .screener-table td { position: relative; padding-left: 6px; padding-right: 6px; text-align: center; vertical-align: middle; }
.screener-table th:nth-child(2), .screener-table td:nth-child(2) { width: 72px; }
.screener-table th:nth-child(1), .screener-table td:nth-child(1) { width: 48px; }
.column-resizer { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; background: rgba(215, 168, 77, .18); }
.column-resizer:hover { background: var(--accent); }
.screener-table td small {
  display: block;
  max-width: 220px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
}
.screener-table td:nth-child(9) strong { font-size: .78rem; }
.screener-target-cell { transition: background-color 120ms ease, box-shadow 120ms ease; }
body[data-market-bias="bull"] .screener-bull-target,
body[data-market-bias="bear"] .screener-bear-target {
  background: rgba(215, 168, 77, .08);
  box-shadow: inset 0 2px 0 var(--accent);
}
.screener-target-input {
  width: 100%;
  max-width: 96px;
  min-width: 0;
  min-height: 32px;
  padding: 0 8px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.screener-target-input:disabled {
  color: var(--muted);
  opacity: 0.7;
}
.divergence-lead { background: linear-gradient(90deg, rgba(215, 168, 77, 0.07), transparent 44%); }
.orbuculum-lead { background: linear-gradient(90deg, rgba(215, 168, 77, 0.07), transparent 44%); }
.orbuculum-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.orbuculum-toggle { position: relative; }
.orbuculum-toggle summary {
  display: grid;
  min-width: 92px;
  min-height: 34px;
  place-items: center;
  border: 1px solid #565f66;
  border-radius: 7px;
  padding: 0 12px;
  color: #050607;
  background: linear-gradient(180deg, #f1d48a, var(--accent));
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}
.orbuculum-toggle summary::-webkit-details-marker { display: none; }
.orbuculum-toggle summary:focus-visible {
  outline: 2px solid rgba(215, 168, 77, 0.75);
  outline-offset: 2px;
}
.orbuculum-toggle-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  width: 170px;
  gap: 3px;
  padding: 6px;
  border: 1px solid #565f66;
  border-radius: 7px;
  background: #0b0d0f;
  box-shadow: var(--shadow);
}
.orbuculum-toggle-menu button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  width: 100%;
  border-color: transparent;
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.orbuculum-toggle-menu button:hover,
.orbuculum-toggle-menu button.active {
  border-color: var(--line);
  background: #252a2e;
}
.vol-swatch {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
}
.vol-swatch-all { background: linear-gradient(90deg, #67b7ff 0 25%, #58c997 25% 50%, #e6c452 50% 75%, #e45f5f 75%); }
.vol-swatch-blue { background: #67b7ff; }
.vol-swatch-green { background: #58c997; }
.vol-swatch-yellow { background: #e6c452; }
.vol-swatch-red { background: #e45f5f; }
.orbuculum-groups { display: grid; gap: 2px; }
.orbuculum-panel { margin-top: 16px; }
.orbuculum-table-wrap { max-height: min(58vh, 680px); }
.orbuculum-table { min-width: 1760px; }
.orbuculum-table th { padding: 0 12px; }
.orbuculum-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
}
.orbuculum-vol-state {
  min-width: 190px;
  box-shadow: inset 3px 0 0 transparent;
}
.orbuculum-vol-state strong { white-space: nowrap; }
.orbuculum-vol-state.vol-state-blue {
  background: rgba(64, 145, 220, 0.16);
  box-shadow: inset 3px 0 0 #67b7ff;
  color: #9bd0ff;
}
.orbuculum-vol-state.vol-state-green {
  background: rgba(45, 139, 99, 0.16);
  box-shadow: inset 3px 0 0 #58c997;
  color: #8ae0b9;
}
.orbuculum-vol-state.vol-state-yellow {
  background: rgba(190, 151, 37, 0.16);
  box-shadow: inset 3px 0 0 #e6c452;
  color: #f2d979;
}
.orbuculum-vol-state.vol-state-red {
  background: rgba(187, 60, 60, 0.17);
  box-shadow: inset 3px 0 0 #e45f5f;
  color: #ff9999;
}
.orbuculum-contracts-cell { min-width: 510px; }
.orbuculum-contract {
  display: flex;
  align-items: baseline;
  gap: 7px;
  white-space: nowrap;
}
.orbuculum-table .orbuculum-contract small {
  display: inline;
  margin-top: 0;
}
.orbuculum-contract + .orbuculum-contract {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--line);
}
.orbuculum-contract > strong {
  display: inline-block;
  min-width: 38px;
  color: var(--accent-soft);
}
.divergence-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}
.credential-state {
  align-self: center;
  color: #83d7b3;
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}
.credential-state::before { content: "LOCKED / "; color: var(--muted); }
.recent-divergence-table { min-width: 1240px; }
.recent-divergence-table th { padding: 0 12px; }
.recent-divergence-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
}
.divergence-indicators {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #30363b;
}
.divergence-indicators article {
  min-width: 0;
  padding: 15px 16px;
  border-right: 1px solid var(--line);
  background: #111417;
}
.divergence-indicators article:last-child { border-right: 0; }
.divergence-indicators span,
.divergence-indicators small {
  display: block;
  color: var(--muted);
}
.divergence-indicators span {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}
.divergence-indicators strong {
  display: block;
  margin-top: 6px;
  color: #f5f2e7;
  font-size: 1.25rem;
}
.divergence-indicators small { margin-top: 4px; font-size: 0.72rem; }
.divergence-summary-table { min-width: 900px; }
.divergence-summary-table th, .divergence-summary-table td { padding-left: 7px; padding-right: 7px; font-size: .76rem; }
.divergence-summary-table td small,
.divergence-ledger-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
}
.divergence-ledger-wrap { max-height: min(62vh, 720px); }
.divergence-ledger-table { min-width: 1260px; }
.divergence-ledger-table th { position: sticky; top: 0; z-index: 2; }
.divergence-ledger-heading {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}
.divergence-ledger-filters {
  display: flex;
  align-items: end;
  gap: 8px;
}
.divergence-ledger-filters label {
  gap: 3px;
  min-width: 132px;
  font-size: 0.62rem;
}
.divergence-ledger-filters select {
  min-height: 30px;
  padding: 0 8px;
  font-size: 0.76rem;
}
.divergence-method {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 2px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}
.divergence-method strong { color: var(--accent); text-transform: uppercase; }
.divergence-method a { color: #e0bd72; text-align: right; text-decoration: none; }
.divergence-method a:hover { text-decoration: underline; }
.gamma-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  min-height: 118px;
  padding: 18px 4px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(215, 168, 77, 0.07), transparent 44%);
}
.gamma-actions,
.gamma-index-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}
.gamma-index-tabs {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090b0c;
}
.gamma-index-tabs button {
  min-width: 64px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}
.gamma-index-tabs button.active {
  border-color: var(--accent);
  color: #050607;
  background: linear-gradient(180deg, #f1d48a, var(--accent));
}
.gamma-month-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.gamma-month-tabs[hidden] { display: none; }
.gamma-month-tabs button {
  flex: 0 0 auto;
  min-width: 92px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
}
.gamma-month-tabs button.active {
  border-color: var(--accent);
  color: #050607;
  background: linear-gradient(180deg, #f1d48a, var(--accent));
}
.gamma-panel canvas {
  height: 430px;
  padding: 0;
}
#gammaProfileCanvas { height: 470px; }
.gamma-split { align-items: stretch; }
.gamma-table-wrap { max-height: 430px; }
.gamma-panel .table-wrap { background: #0b0d0f; }

.gamma-leaders-panel { margin-top: 10px; }
.gamma-leaders-table-wrap { max-height: min(68vh, 760px); }
.gamma-leaders-table { min-width: 1040px; }
.gamma-leaders-table th,
.gamma-leaders-table td { text-align: center; white-space: nowrap; }
.gamma-leaders-table td:nth-child(2) { text-align: left; }
.gamma-leaders-table td:nth-child(2) small { display: block; color: var(--muted); }
.gamma-month-leaders-heading { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.gamma-index-months-wrap { max-height: min(58vh, 620px); }
.gamma-index-months-table { min-width: 940px; }
.gamma-index-months-table th,
.gamma-index-months-table td { text-align: center; white-space: nowrap; }
.disclaimer a { color: #e0bd72; }
.cell.iv-below-rv { box-shadow: inset 0 0 0 2px #f2cf53; }
.rv-legend-swatch { border: 2px solid #f2cf53; background: transparent !important; }
tr.iv-below-rv td {
  border-top: 2px solid #f2cf53;
  border-bottom: 2px solid #f2cf53;
}
tr.iv-below-rv td:first-child { border-left: 2px solid #f2cf53; }
tr.iv-below-rv td:last-child { border-right: 2px solid #f2cf53; }

.valuation-identity {
  min-width: 0;
}

.valuation-identity h2 {
  overflow-wrap: anywhere;
  font-size: clamp(1.4rem, 3vw, 2.25rem);
  line-height: 1.08;
}

.valuation-method {
  max-width: 780px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.fair-value-block {
  flex: 0 0 min(320px, 34vw);
  display: grid;
  justify-items: end;
  gap: 5px;
  text-align: right;
}

.fair-value-block > span:first-child {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.fair-value-block strong {
  color: #f5f2e7;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.gap-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.76rem;
  font-weight: 800;
}

.gap-chip.positive {
  border-color: #39745e;
  color: #83d7b3;
  background: rgba(34, 117, 83, 0.18);
}

.gap-chip.negative {
  border-color: #783939;
  color: #ff9393;
  background: rgba(157, 31, 31, 0.18);
}

.gap-chip.neutral {
  color: var(--muted);
  background: #111417;
}

.valuation-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 16px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #30363b;
}

.valuation-summary article {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: #111417;
}

.valuation-summary article:last-child {
  border-right: 0;
}

.valuation-summary span,
.fundamental-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.valuation-summary strong,
.fundamental-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
  color: #f5f2e7;
  font-size: 1rem;
  line-height: 1.2;
}

.panel-meta {
  max-width: min(720px, 65vw);
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  text-align: right;
}

.chart-source {
  display: block;
  width: fit-content;
  margin: 8px 0 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  text-decoration: none;
}

.chart-source:hover { color: #f3c96b; }

.valuation-table-wrap {
  max-height: none;
}

.valuation-table-wrap th:first-child,
.valuation-table-wrap td:first-child {
  width: 42%;
}

.valuation-table-wrap td strong,
.valuation-table-wrap td small {
  display: block;
}

.valuation-table-wrap td small {
  max-width: 520px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: normal;
}

.valuation-split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 16px;
}

.assumption-list {
  margin: 0;
  padding: 0 16px;
}

.assumption-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
}

.assumption-list > div:last-child {
  border-bottom: 0;
}

.assumption-list dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
  text-transform: uppercase;
}

.assumption-list dd {
  margin: 0;
  color: #f5f2e7;
  font-weight: 800;
  text-align: right;
}

.fundamental-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fundamental-grid article {
  min-width: 0;
  min-height: 76px;
  padding: 15px 16px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fundamental-grid article:nth-child(4n) {
  border-right: 0;
}

.fundamental-grid article:nth-last-child(-n + 4) {
  border-bottom: 0;
}

.research-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 28px;
  padding: 18px 16px 20px;
}

.research-body p {
  margin: 0;
  color: #d8dde1;
  line-height: 1.58;
}

.research-body .market-reference {
  margin-top: 14px;
  color: var(--accent);
}

.valuation-notes {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.valuation-notes li + li {
  margin-top: 5px;
}

.source-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
}

.source-links a {
  color: #e0bd72;
  font-size: 0.75rem;
  text-decoration: none;
}

.source-links a:hover {
  text-decoration: underline;
}

.disclaimer {
  margin: 12px 2px 0;
  color: #727d85;
  font-size: 0.72rem;
  line-height: 1.45;
}

.panel {
  min-width: 0;
  margin-top: 16px;
  border-radius: 8px;
  overflow: hidden;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.08));
}

.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.legend span {
  width: 18px;
  height: 10px;
  border-radius: 2px;
}

.heatmap-wrap {
  overflow: auto;
  max-height: 58vh;
  background: #0b0d0f;
}

.heatmap {
  display: grid;
  min-width: 920px;
  font-size: 0.76rem;
}

.cell,
.axis-cell {
  min-height: 30px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 7px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.axis-cell {
  position: sticky;
  z-index: 2;
  color: #f2f4f6;
  background: #1c2125;
  font-weight: 800;
}

.axis-cell.top {
  top: 0;
}

.axis-cell.left {
  left: 0;
}

.axis-cell.closest-strike {
  color: #070809;
  background: linear-gradient(180deg, #f0d38a, var(--accent));
}

.cell {
  color: #050607;
  text-align: right;
}

.cell.empty {
  background: #111417;
  color: #58616a;
}

.empty-state {
  min-height: 180px;
  padding: 36px 16px;
  color: var(--muted);
  display: grid;
  place-items: center;
  text-align: center;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
  gap: 16px;
}

.contract-detail-panel { margin-top: 16px; }

canvas {
  display: block;
  width: 100%;
  height: 360px;
  padding: 12px;
  background: #0b0d0f;
  cursor: crosshair;
}

.heatmap .cell[data-iv] { cursor: crosshair; }

.chart-readout {
  position: fixed;
  z-index: 1000;
  display: grid;
  width: min(264px, calc(100vw - 16px));
  overflow: hidden;
  border: 1px solid #777f85;
  border-top: 2px solid var(--accent);
  border-radius: 6px;
  color: var(--ink);
  background: #0d1012;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.62);
}

.chart-readout[hidden] { display: none; }

.chart-readout > strong {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 0.82rem;
}

.chart-readout > span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 7px 12px;
  color: #f2f4f6;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.chart-readout > span + span { border-top: 1px solid rgba(255, 255, 255, 0.06); }
.chart-readout b { color: var(--muted); font-weight: 750; }

.table-wrap {
  overflow: auto;
  max-height: 420px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th,
td {
  min-width: 74px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #1c2125;
  font-size: 0.72rem;
  text-transform: uppercase;
}

th.sortable-column {
  padding-right: 30px;
  cursor: pointer;
  user-select: none;
}

th.sortable-column:hover {
  color: var(--accent);
  background: #24292d;
}

th.sortable-column::after {
  position: absolute;
  top: 50%;
  right: 10px;
  content: "↕";
  color: #68727a;
  font-size: 0.72rem;
  transform: translateY(-50%);
}

th.sortable-column[data-sort-direction="asc"]::after {
  content: "▲";
  color: var(--accent);
}

th.sortable-column[data-sort-direction="desc"]::after {
  content: "▼";
  color: var(--accent);
}

th.sortable-column:focus-visible {
  outline: 2px solid rgba(215, 168, 77, 0.75);
  outline-offset: -3px;
}

td {
  color: #e7ebee;
}

tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.025);
}

tbody tr:hover td {
  background: rgba(215, 168, 77, 0.08);
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

.type-pill {
  display: inline-block;
  width: 48px;
  border-radius: 999px;
  padding: 4px 0;
  text-align: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.type-call {
  color: #050607;
  background: var(--accent);
}

.type-put {
  color: #fff;
  background: var(--accent-2);
}

* {
  scrollbar-color: #6f777e #111417;
}

.status {
  min-height: 24px;
  margin: 12px 0 0;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

@media (max-width: 980px) {
  #ivView .summary-grid { grid-template-columns: 1fr; }
  #gammaView .summary-grid { grid-template-columns: 1fr; }
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .gamma-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .quote-strip {
    justify-content: space-between;
  }

  .controls,
  .summary-grid,
  .split,
  .valuation-split,
  .research-body {
    grid-template-columns: 1fr;
  }

  .split {
    gap: 0;
  }

  .summary-grid {
    gap: 1px;
  }

  .valuation-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .valuation-summary article:nth-child(3n) {
    border-right: 0;
  }

  .valuation-summary article:nth-child(-n + 3) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100vw - 20px, 1480px);
    padding-top: 12px;
  }

  h1 {
    font-size: 2rem;
  }

  .quote-strip {
    align-items: stretch;
    flex-direction: column;
    white-space: normal;
  }

  .gamma-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .divergence-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .divergence-indicators { grid-template-columns: 1fr; }
  .divergence-indicators article { border-right: 0; border-bottom: 1px solid var(--line); }
  .divergence-indicators article:last-child { border-bottom: 0; }
  .divergence-method { grid-template-columns: 1fr; }
  .divergence-method a { text-align: left; }

  .custom-symbol {
    grid-template-columns: 1fr 96px auto;
  }

  .workspace-tab {
    flex: 0 0 auto;
    min-width: 116px;
  }

  .valuation-lead {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }

  .valuation-tab { flex: 1 1 0; min-width: 0; }
  .universe-toolbar { align-items: stretch; flex-direction: column; }
  .orbuculum-actions { justify-content: flex-end; }
  .universe-summary { grid-template-columns: 1fr 1fr; }
  .universe-summary article:nth-child(2n) { border-right: 0; }
  .universe-summary article:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }

  .fair-value-block {
    flex-basis: auto;
    justify-items: start;
    text-align: left;
  }

  .valuation-summary,
  .fundamental-grid {
    grid-template-columns: 1fr 1fr;
  }

  .valuation-summary article:nth-child(3n),
  .fundamental-grid article:nth-child(4n) {
    border-right: 1px solid var(--line);
  }

  .valuation-summary article:nth-child(2n),
  .fundamental-grid article:nth-child(2n) {
    border-right: 0;
  }

  .valuation-summary article,
  .fundamental-grid article,
  .fundamental-grid article:nth-last-child(-n + 4) {
    border-bottom: 1px solid var(--line);
  }

  .valuation-summary article:nth-last-child(-n + 2),
  .fundamental-grid article:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .divergence-ledger-heading,
  .divergence-ledger-filters { align-items: stretch; flex-direction: column; width: 100%; }
  .divergence-ledger-filters label { min-width: 0; }

  .panel-meta {
    max-width: 100%;
    text-align: left;
  }
}

/* Bloomberg-inspired market terminal treatment. */
:root {
  color-scheme: dark;
  --ink: #e7e9ea;
  --muted: #9ba1a6;
  --line: #353b40;
  --panel: #191c1f;
  --panel-2: #141719;
  --surface: #0d0f11;
  --accent: #f15a24;
  --accent-soft: #b83c11;
  --accent-2: #c80000;
  --accent-3: #111111;
  --danger: #c80000;
  --shadow: none;
}

body {
  color: var(--ink);
  background: var(--surface);
}

.shell {
  width: min(1540px, calc(100vw - 24px));
  padding-top: 12px;
}

.topbar {
  align-items: center;
  padding: 16px 18px;
  border-bottom: 4px solid var(--accent);
  color: #ffffff;
  background: #000000;
}

.eyebrow { color: #ff8a55; }
.eyebrow::before { color: #ffffff; }
h1 { font-size: clamp(2rem, 4vw, 3.6rem); text-shadow: none; }

.quote-strip,
.symbol-browser,
.symbol-tabs,
.controls,
.summary-grid,
.panel {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: none;
}

.quote-strip {
  border-color: #4b4b4b;
  border-radius: 0;
  color: #ffffff;
  background: #151515;
  box-shadow: none;
}

#quoteState { color: #bdbdbd; }

.workspace-tabs {
  gap: 0;
  margin: 0 0 10px;
  padding: 0 12px;
  border-color: #000000;
  background: #000000;
}

.workspace-tab {
  min-width: 124px;
  border-bottom-width: 4px;
  color: #bdbdbd;
}

.workspace-tab:hover { color: #ffffff; }
.workspace-tab.active {
  border-bottom-color: var(--accent);
  color: #ffffff;
  background: #1d1d1d;
}

button {
  border-color: #111111;
  border-radius: 2px;
  color: #ffffff;
  background: #111111;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent);
}

select,
input {
  border-color: #4a5055;
  border-radius: 2px;
  color: var(--ink);
  background: #101214;
}

select:focus,
input:focus,
button:focus-visible {
  outline-color: rgba(241, 90, 36, 0.72);
}

.symbol-browser,
.controls,
.summary-grid,
.universe-summary,
.valuation-summary,
.divergence-indicators,
.panel {
  border-radius: 0;
}

.group-tabs {
  gap: 2px;
  border-color: #3b3b3b;
  background: #111111;
}

.group-tab {
  color: #cfcfcf;
  background: transparent;
}

.group-tab:hover { color: #ffffff; background: #313131; }
.group-tab.active {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.symbol-tabs { background: #15181a; }
.symbol-tab {
  border-color: #454b50;
  border-radius: 2px;
  color: #d7dadd;
  background: #222629;
}

.symbol-tab:hover { border-color: #111111; color: #ffffff; background: #111111; }
.symbol-tab.active {
  border-color: var(--accent);
  color: #ffffff;
  background: #111111;
  box-shadow: inset 0 -3px 0 var(--accent);
}

.custom-symbol button,
.gamma-index-tabs button.active,
.gamma-month-tabs button.active,
.orbuculum-toggle summary {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.summary-grid,
.universe-summary,
.valuation-summary,
.divergence-indicators { background: var(--line); }

.summary-grid article,
.universe-summary article,
.valuation-summary article,
.divergence-indicators article { background: #181b1e; }

.summary-grid strong,
.universe-summary strong,
.divergence-indicators strong,
.fair-value-block strong,
.valuation-summary strong,
.fundamental-grid strong,
.assumption-list dd { color: #f0f1f2; }

.summary-grid strong.trend-rising,
.positive-text { color: #81d6ad; }
.summary-grid strong.trend-falling,
.negative-text { color: #ef9393; }
.summary-grid strong.trend-flat { color: #e1ca6f; }
.multiple-difference,
.research-body p { color: #d2d5d7; }

.valuation-lead,
.trade-ideas-lead,
.screener-lead,
.divergence-lead,
.orbuculum-lead,
.gamma-toolbar { background: #141719; }

.valuation-tab.active {
  border-bottom-color: var(--accent);
  color: #ff9a70;
  background: #2b1b15;
}

.universe-table th,
th {
  color: #ffffff;
  background: #111111;
}

.table-sort { color: #ffffff; }
.table-sort:hover,
.table-sort.active,
th.sortable-column:hover {
  color: #ffffff;
  background: var(--accent);
}

td { color: #e1e4e6; background: #191c1f; }
tbody tr:nth-child(even) td { background: #141719; }
tbody tr:hover td { background: #29231f; }
.asset-link { color: #ff9165; }
.asset-link:hover { color: #ffb294; }
.rank { color: #8d959b; }

.gamma-index-tabs { border-radius: 2px; background: #121416; }
.gamma-index-tabs button,
.gamma-month-tabs button { color: #aeb4b8; }

.panel-heading {
  border-color: var(--line);
  background: #111416;
}

.screener-actions {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

#updateTargets.filter-active {
  border-color: var(--accent);
  background: var(--accent);
}

.screener-target-input + small {
  min-height: 14px;
  color: #969da2;
}

.target-stale {
  box-shadow: inset 0 -3px 0 #d19500;
}

.target-stale .screener-target-input {
  border-color: #d19500;
  background: #302811;
}

.orbuculum-toggle summary { border-radius: 2px; }
.orbuculum-toggle-menu {
  border-color: #4a5055;
  border-radius: 2px;
  color: #e7e9ea;
  background: #15181a;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.orbuculum-toggle-menu button { color: #e7e9ea; background: #15181a; }
.orbuculum-toggle-menu button:hover,
.orbuculum-toggle-menu button.active {
  border-color: #4a5055;
  color: #ffffff;
  background: #292d30;
  box-shadow: inset 3px 0 0 var(--accent);
}

.orbuculum-vol-state.vol-state-blue,
.vol-state-card.vol-state-blue { color: #8dcaff; background: #152536; }
.orbuculum-vol-state.vol-state-green,
.vol-state-card.vol-state-green { color: #81d6ad; background: #152820; }
.orbuculum-vol-state.vol-state-yellow,
.vol-state-card.vol-state-yellow { color: #e1ca6f; background: #2b2716; }
.orbuculum-vol-state.vol-state-red,
.vol-state-card.vol-state-red { color: #ef9393; background: #30191a; }
.vol-state-card.vol-state-blue strong { color: #8dcaff; }
.vol-state-card.vol-state-green strong { color: #81d6ad; }
.vol-state-card.vol-state-yellow strong { color: #e1ca6f; }
.vol-state-card.vol-state-red strong { color: #ef9393; }

.gap-chip.positive { color: #81d6ad; background: #152820; }
.gap-chip.negative { color: #ef9393; background: #30191a; }
.gap-chip.neutral { background: #222629; }
.credential-state { color: #81d6ad; }

.source-links a,
.divergence-method a,
.disclaimer a,
.chart-source:hover { color: var(--accent-soft); }

.heatmap-wrap,
.gamma-panel .table-wrap,
canvas { background: #0b0d0f; }

.chart-readout {
  color: #ffffff;
  background: #111111;
}

* { scrollbar-color: #555d62 #15181a; }

/* U.S. rates workspace. */
.rates-lead {
  align-items: flex-start;
  background: #141719;
}

.sentiment-controls {
  grid-template-columns: minmax(180px, 0.55fr) minmax(220px, 1fr);
  gap: 1px;
  padding: 1px;
  background: var(--line);
}

.sentiment-controls label {
  min-width: 0;
  padding: 12px;
  background: #171a1d;
}

.sentiment-controls select { width: 100%; }

.sentiment-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.sentiment-summary article { min-width: 0; }
.sentiment-summary small { color: #9da5aa; font-weight: 750; text-transform: uppercase; }
#sentimentFearCard.sentiment-extreme-fear { box-shadow: inset 0 -3px 0 #c14c4c; }
#sentimentFearCard.sentiment-fear { box-shadow: inset 0 -3px 0 #d28245; }
#sentimentFearCard.sentiment-neutral { box-shadow: inset 0 -3px 0 #9da5aa; }
#sentimentFearCard.sentiment-greed { box-shadow: inset 0 -3px 0 #39aa74; }
#sentimentFearCard.sentiment-extreme-greed { box-shadow: inset 0 -3px 0 #54c98b; }

.sentiment-chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 10px 0;
}

.sentiment-chart-panel {
  min-width: 0;
  margin: 0;
}

.sentiment-chart-panel canvas {
  display: block;
  width: 100%;
  height: 390px;
}

.sentiment-table-panel { margin-top: 10px; }
.sentiment-latest-table td:first-child { font-weight: 800; text-align: left; }
.sentiment-method { grid-template-columns: auto minmax(0, 1fr) auto; }

.rates-controls {
  grid-template-columns: 1.15fr 1fr 1fr 1fr 1fr 0.9fr 1.15fr;
  gap: 1px;
  padding: 1px;
  background: var(--line);
}

.rates-controls label {
  min-width: 0;
  padding: 12px;
  background: #171a1d;
}

.rates-controls select,
.rates-controls input {
  width: 100%;
  min-width: 0;
}

.rates-summary {
  grid-template-columns: repeat(8, minmax(0, 1fr));
}

.rates-summary article {
  min-width: 0;
}

.rates-summary strong {
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

#ratesRegimeCard.regime-positive { box-shadow: inset 0 -3px 0 #31b778; }
#ratesRegimeCard.regime-negative { box-shadow: inset 0 -3px 0 #d04d4d; }
#ratesRegimeCard.regime-neutral { box-shadow: inset 0 -3px 0 #d1b24d; }

.rates-turn-band {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(0, 4fr);
  margin: 10px 0;
  border: 1px solid var(--line);
  background: #111416;
}

.rates-turn-score {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 118px;
  padding: 18px;
  border-right: 1px solid var(--line);
}

.rates-turn-score span,
.rates-turn-factor span {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.rates-turn-score strong {
  margin-top: 8px;
  color: #f3f4f5;
  font-size: 1.12rem;
}

.rates-turn-score small { margin-top: 4px; color: #9fa6ab; }

.rates-turn-factors {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.rates-turn-factor {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 14px;
  border-right: 1px solid var(--line);
}

.rates-turn-factor:last-child { border-right: 0; }
.rates-turn-factor strong { margin-top: 8px; font-size: 0.95rem; }
.rates-turn-factor small { margin-top: 5px; color: #858e94; line-height: 1.35; }
.rates-turn-factor.positive strong { color: #81d6ad; }
.rates-turn-factor.negative strong { color: #ef9393; }
.rates-turn-factor.neutral strong { color: #e1ca6f; }

.rates-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(360px, 0.9fr);
  gap: 10px;
  margin: 10px 0;
}

.rates-surface-workspace {
  position: relative;
  min-width: 0;
  min-height: 690px;
  overflow: hidden;
  background: #050607;
}

.rates-surface-workspace .panel-heading {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  background: rgba(5, 6, 7, 0.88);
}

.rates-surface {
  width: 100%;
  height: 690px;
  touch-action: none;
  cursor: grab;
}

.rates-surface:active { cursor: grabbing; }
.rates-surface canvas { display: block; width: 100%; height: 100%; }

.rates-surface-selection {
  position: absolute;
  right: 14px;
  bottom: 12px;
  z-index: 3;
  padding: 7px 9px;
  border-left: 3px solid var(--accent);
  color: #f0f2f3;
  background: rgba(8, 10, 11, 0.88);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.rates-linked-charts {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 10px;
  min-width: 0;
}

.rates-mini-chart {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 340px;
  margin: 0;
}

.rates-mini-chart canvas {
  width: 100%;
  height: 285px;
}

.rates-overlay-panel { margin-top: 10px; }
.rates-overlay-panel canvas { width: 100%; height: 410px; }

.rates-table-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin: 10px 0;
}

.rates-table-grid .panel { margin: 0; }
.rates-alert-table td:last-child { min-width: 300px; text-align: left; }
.rates-change-table td:first-child,
.rates-alert-table td:first-child,
.rates-performance-table td:first-child,
.rates-ledger-table td:first-child { font-weight: 800; }

.rates-state {
  display: inline-block;
  min-width: 72px;
  padding: 3px 6px;
  border-left: 3px solid #70777c;
  color: #cfd3d5;
  background: #222629;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.rates-state.positive { border-color: #31b778; color: #81d6ad; background: #152820; }
.rates-state.negative { border-color: #d04d4d; color: #ef9393; background: #30191a; }
.rates-state.neutral { border-color: #d1b24d; color: #e1ca6f; background: #2b2716; }

.rates-method { grid-template-columns: auto minmax(0, 1fr) auto; }
.rates-source-links { display: flex; gap: 12px; }
.rates-source-links a { color: var(--accent); font-weight: 800; }

@media (max-width: 1180px) {
  .screener-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rates-controls { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rates-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .rates-turn-band { grid-template-columns: 1fr; }
  .rates-turn-score { border-right: 0; border-bottom: 1px solid var(--line); }
  .rates-visual-grid { grid-template-columns: 1fr; }
  .rates-surface-workspace,
  .rates-surface { min-height: 620px; height: 620px; }
  .rates-linked-charts { grid-template-columns: 1fr 1fr; grid-template-rows: auto; }
}

@media (max-width: 760px) {
  .screener-controls { grid-template-columns: 1fr; }
  .sentiment-controls,
  .sentiment-summary { grid-template-columns: 1fr 1fr; }
  .sentiment-chart-panel canvas { height: 320px; }
  .sentiment-method { grid-template-columns: 1fr; }
  .rates-controls { grid-template-columns: 1fr 1fr; }
  .rates-summary { grid-template-columns: 1fr 1fr; }
  .rates-turn-factors { grid-template-columns: 1fr; }
  .rates-turn-factor { border-right: 0; border-bottom: 1px solid var(--line); }
  .rates-turn-factor:last-child { border-bottom: 0; }
  .rates-surface-workspace,
  .rates-surface { min-height: 500px; height: 500px; }
  .rates-linked-charts,
  .rates-table-grid { grid-template-columns: 1fr; }
  .rates-method { grid-template-columns: 1fr; }
  .rates-source-links { justify-content: flex-start; }
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.quote-strip { justify-self: end; }

.market-bias-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-self: center;
  min-width: 174px;
  padding: 3px;
  border: 1px solid #454b50;
  border-radius: 4px;
  background: #111315;
}

.market-bias-toggle button {
  min-width: 80px;
  min-height: 36px;
  border: 0;
  border-radius: 2px;
  color: #8f989e;
  background: transparent;
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.market-bias-toggle button[data-market-bias="bull"].active {
  color: #04130c;
  background: #58c98d;
}

.market-bias-toggle button[data-market-bias="bear"].active {
  color: #180606;
  background: #e26767;
}

.market-bias-toggle button:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

@media (max-width: 880px) {
  .topbar { grid-template-columns: 1fr auto; }
  .market-bias-toggle { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
  .quote-strip { grid-column: 2; grid-row: 1; }
}

@media (max-width: 560px) {
  .topbar { grid-template-columns: 1fr; }
  .topbar > div:first-child,
  .quote-strip,
  .market-bias-toggle { grid-column: 1; }
  .topbar > div:first-child { grid-row: 1; }
  .market-bias-toggle { grid-row: 2; width: 100%; }
  .quote-strip { grid-row: 3; justify-self: stretch; }
}

.account-tools { display: flex; align-items: center; gap: 12px; margin-top: 10px; color: var(--muted); font-size: 0.78rem; }
.account-tools button { min-height: 28px; padding: 3px 8px; border: 1px solid var(--line); background: #1c2023; font-size: 0.76rem; }

.login-page { min-height: 100vh; background: #090b0d; }
.login-shell { width: min(420px, calc(100vw - 32px)); margin: 0 auto; padding-top: min(18vh, 150px); }
.login-brand { padding-bottom: 28px; border-bottom: 4px solid var(--accent); }
.login-brand h1 { margin-top: 8px; font-size: 2.5rem; }
.login-form { display: grid; gap: 10px; padding-top: 28px; }
.login-form h2 { margin-bottom: 14px; font-size: 1.2rem; }
.login-form label { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.login-form input { width: 100%; min-height: 42px; margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 2px; color: var(--ink); background: #171b1e; }
.login-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-form button { min-height: 44px; border: 0; color: #08090a; background: var(--accent); font-weight: 800; }
.login-form button:disabled { opacity: 0.6; }
#loginError { min-height: 1.2em; margin: 0; color: #ff9393; font-size: 0.82rem; }
