:root {
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --text: #1d1d1f;
  --text-2: #424245;
  --muted: #6e6e73;
  --muted-2: #8e8e93;
  --line: #e3e3e8;
  --line-strong: #d2d2d7;
  --accent: #635bff;
  --accent-hover: #5148e5;
  --accent-soft: #f0efff;
  --blue: #1683ff;
  --green: #168451;
  --green-soft: #eaf7f0;
  --red: #c7473a;
  --red-soft: #fff0ed;
  --orange: #ff5c35;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 12px; }
body {
  min-width: 320px;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button, input, a { outline: none; }
button:focus-visible, input:focus-visible, a:focus-visible {
  box-shadow: 0 0 0 3px rgba(99, 91, 255, .18);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* One compact, non-fixed utility bar. */
.site-header {
  min-height: 56px;
  padding: 8px clamp(14px, 1.7vw, 28px);
  display: grid;
  grid-template-columns: auto minmax(280px, 520px) minmax(240px, 1fr) auto auto;
  align-items: center;
  gap: clamp(10px, 1.3vw, 20px);
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid var(--line);
}
.brand {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.025em;
}
.brand-dot { color: var(--orange); }
.brand-mark { width: 22px; height: 22px; display: inline-flex; }
.brand-mark svg { width: 100%; fill: var(--text); }
.brand-mark .mark-cut {
  fill: none;
  stroke: white;
  stroke-width: 1.9;
  stroke-linecap: round;
}
.search-shell {
  min-width: 0;
  height: 40px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  padding: 3px 3px 3px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.search-shell:focus-within {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 91, 255, .12);
}
.search-shell > svg {
  width: 17px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
}
.search-shell input {
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
}
.search-shell input::placeholder { color: var(--muted-2); font-weight: 400; }
.search-shell kbd {
  min-width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: white;
  color: var(--muted-2);
  font: 11px var(--mono);
  box-shadow: 0 1px 0 var(--line-strong);
}
.search-shell button {
  align-self: stretch;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.search-shell button:hover { background: var(--accent-hover); }
.search-shell button span { margin-left: 5px; }
.quick-picks {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow: hidden;
}
.quick-picks button {
  padding: 6px 7px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 11px var(--mono);
  cursor: pointer;
}
.quick-picks button:hover { background: #eeeeF2; color: var(--text); }
.site-header nav { display: flex; gap: 14px; }
.site-header nav a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.site-header nav a:hover { color: var(--text); }
.command-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 10px;
}
.command-meta i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 132, 81, .11);
}
.command-meta strong { font-weight: 500; }

.workspace {
  min-height: calc(100vh - 56px);
  padding: 12px clamp(12px, 1.45vw, 24px) 48px;
}
.loading-state, .error-state {
  min-height: calc(100vh - 104px);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
}
.loader {
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { text-align: center; }
.error-state strong { font-size: 17px; }
.error-state span { color: var(--muted); }
.error-state button {
  margin-top: 4px;
  padding: 8px 14px;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: white;
  font-weight: 600;
  cursor: pointer;
}

.company-row {
  min-height: 58px;
  padding: 8px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.company-identity { min-width: 0; display: flex; gap: 10px; align-items: center; }
.ticker-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  font: 600 14px var(--mono);
}
.company-identity > div > div { min-width: 0; display: flex; align-items: center; gap: 8px; }
.company-identity h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -.02em;
}
#ticker-chip {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font: 9px var(--mono);
}
.company-identity p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}
.price-block {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  column-gap: 10px;
  text-align: right;
}
.price-block span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}
.price-block strong { font: 600 19px var(--mono); letter-spacing: -.04em; }
.price-block em {
  color: var(--green);
  font: 500 10px var(--mono);
  font-style: normal;
}
.price-block em.negative { color: var(--red); }

.primary-screen {
  min-height: 560px;
  height: calc(100vh - 138px);
  margin-top: 10px;
  display: grid;
  grid-template-columns: minmax(205px, 232px) minmax(520px, 1fr) minmax(340px, 390px);
  gap: 10px;
}
.stats-rail, .chart-card, .controls-card, .consensus-card, .financials-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.stats-rail {
  padding: 14px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.rail-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px 8px;
}
.rail-title span, .rail-title strong {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
}
.rail-title strong { color: var(--muted-2); font-weight: 500; }
.stats-rail .metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.metric-grid article {
  min-width: 0;
  min-height: 94px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.metric-grid span, .model-summary span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.3;
}
.metric-grid strong {
  display: block;
  margin: 7px 0 5px;
  font: 600 18px var(--mono);
  letter-spacing: -.04em;
}
.metric-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}
.metric-grid .metric-accent {
  border-color: #dcd9ff;
  background: var(--accent-soft);
}
.metric-grid .metric-accent strong { color: var(--accent); }
.consensus-rail-title, .balance-rail-title { margin-top: 15px; }
.stats-rail .signal-grid { display: grid; gap: 0; }
.signal-grid > div {
  min-width: 0;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 8px;
  align-items: baseline;
}
.signal-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}
.signal-grid strong {
  grid-row: 1 / 3;
  grid-column: 2;
  color: var(--text);
  font: 600 13px var(--mono);
}
.signal-grid small {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.3;
}
.signal-grid strong.positive, .consensus-table .positive { color: var(--green); }
.signal-grid strong.negative, .consensus-table .negative { color: var(--red); }

.chart-card {
  padding: 15px 17px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.card-kicker {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .03em;
}
.card-head h3 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -.02em;
}
.horizon-switch, .period-switch {
  display: flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}
.horizon-switch button, .period-switch button {
  min-width: 38px;
  height: 27px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 550;
  cursor: pointer;
}
.horizon-switch button.active, .period-switch button.active {
  background: white;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .12);
}
.chart-legend {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 14px;
  color: var(--muted);
  font-size: 11px;
}
.chart-legend i {
  width: 7px;
  height: 7px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 50%;
}
.dot-history { background: #7a8494; }
.dot-consensus { background: #1683ff; }
.dot-coral { background: var(--accent); }
.dot-cream { border: 1px solid #a6adba; }
.chart-readout { margin-left: auto; color: var(--text-2); font: 10px var(--mono); }
.consensus-toggle {
  width: max-content;
  max-width: 100%;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.consensus-toggle > input { position: absolute; opacity: 0; pointer-events: none; }
.consensus-toggle > span {
  width: 26px;
  height: 15px;
  padding: 2px;
  display: block;
  flex: 0 0 auto;
  border-radius: 10px;
  background: #d8dae0;
}
.consensus-toggle > span i {
  width: 11px;
  height: 11px;
  display: block;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .18s ease;
}
.consensus-toggle input:checked + span { background: var(--accent); }
.consensus-toggle input:checked + span i { transform: translateX(11px); }
.consensus-toggle b { font-weight: 500; }
.chart-wrap {
  position: relative;
  min-height: 330px;
  flex: 1;
  margin-top: 7px;
}
#projection-chart { width: 100%; height: 100%; display: block; }
.chart-tooltip {
  position: absolute;
  z-index: 3;
  min-width: 126px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .96);
  color: var(--text);
  pointer-events: none;
  font: 10px/1.5 var(--mono);
  box-shadow: 0 8px 30px rgba(16, 24, 40, .13);
}
.model-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 0 -17px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.model-summary > div {
  min-width: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
}
.model-summary > div:last-child { border-right: 0; }
.model-summary strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 600 13px var(--mono);
}
.model-summary small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#verdict-box.cheap strong { color: var(--green); }
#verdict-box.expensive strong { color: var(--red); }

.controls-card {
  padding: 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.reset-button {
  width: 29px;
  height: 29px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--muted);
  cursor: pointer;
}
.reset-button:hover { border-color: var(--line-strong); color: var(--text); }
.basis-control {
  margin-top: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.basis-control > span, .profitability-title > span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.basis-switch {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}
.basis-switch button {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.basis-switch button:hover { background: white; }
.basis-switch button b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 600;
}
.basis-switch button small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted-2);
  font: 8px var(--mono);
  white-space: nowrap;
}
.basis-switch button.active {
  border-color: #dcd9ff;
  background: var(--accent-soft);
  color: var(--accent);
}
.basis-switch button.active small { color: #716bd2; }
.basis-control p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}
.profitability-bridge {
  margin-top: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.profitability-title, .allocation-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.profitability-title strong {
  padding: 3px 5px;
  border-radius: 5px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 8px;
  font-weight: 600;
}
.profitability-bridge.negative .profitability-title strong {
  background: var(--red-soft);
  color: var(--red);
}
.profitability-bridge.transition .profitability-title strong {
  background: #eaf4ff;
  color: var(--blue);
}
.margin-route {
  margin-top: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 9px;
  align-items: center;
}
.margin-route > div:last-child { text-align: right; }
.margin-route > div > span {
  display: block;
  color: var(--muted-2);
  font-size: 8px;
}
.margin-route strong { display: block; margin-top: 3px; font: 600 13px var(--mono); }
.route-line {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 4px;
}
.route-line i { height: 1px; display: block; background: var(--line-strong); }
.route-line span { color: var(--muted-2); font: 8px var(--mono); }
.profitability-bridge > p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}
.allocation-bridge {
  margin-top: 8px;
  padding: 11px;
  border: 1px solid #dcd9ff;
  border-radius: 8px;
  background: var(--accent-soft);
}
.allocation-title > span {
  color: #5651a8;
  font-size: 10px;
  font-weight: 650;
}
.allocation-title strong {
  padding: 3px 5px;
  border-radius: 5px;
  background: white;
  color: var(--green);
  font-size: 8px;
  font-weight: 650;
}
.allocation-bridge.warning .allocation-title strong { color: #a05a00; }
.allocation-bridge.invalid .allocation-title strong { color: var(--red); }
.allocation-grid {
  margin-top: 9px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid rgba(99, 91, 255, .18);
  border-left: 1px solid rgba(99, 91, 255, .18);
}
.allocation-grid > div {
  min-width: 0;
  padding: 8px;
  border-right: 1px solid rgba(99, 91, 255, .18);
  border-bottom: 1px solid rgba(99, 91, 255, .18);
}
.allocation-grid span {
  display: block;
  color: #716bd2;
  font-size: 8px;
  line-height: 1.3;
}
.allocation-grid strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--text);
  font: 600 11px var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.allocation-bridge > p {
  margin: 8px 0 0;
  color: #625da7;
  font-size: 9px;
  line-height: 1.45;
}
.accounting-method {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(99, 91, 255, .18);
  color: #625da7;
  font-size: 9px;
}
.accounting-method summary {
  width: max-content;
  cursor: pointer;
  color: #5651a8;
  font-weight: 650;
}
.accounting-method p { margin: 7px 0 0; line-height: 1.5; }
.accounting-method b { color: #49458d; }
.control-list, .primary-control-list { margin-top: 8px; }
.driver-note {
  margin: 10px 1px 2px;
  padding: 9px 10px;
  border-radius: 7px;
  background: #f4f4f7;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}
.range-control {
  display: block;
  padding: 10px 1px;
  border-top: 1px solid var(--line);
}
.range-control > span {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}
.range-control b {
  min-width: 0;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
}
.range-control b em {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9px;
  font-style: normal;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.direct-field {
  min-width: 68px;
  height: 29px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}
.direct-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 91, 255, .1);
}
.direct-field input {
  width: 48px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: right;
  font: 500 10px var(--mono);
}
.direct-field input::-webkit-inner-spin-button { opacity: .3; }
.direct-field i {
  margin-left: 3px;
  color: var(--muted);
  font: 9px var(--mono);
  font-style: normal;
}
.range-control > input[type="range"] {
  width: 100%;
  height: 3px;
  margin: 12px 0 6px;
  display: block;
  appearance: none;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--fill, 50%), #dedee4 var(--fill, 50%));
  cursor: pointer;
}
.range-control > input[type="range"]::-webkit-slider-thumb {
  width: 13px;
  height: 13px;
  appearance: none;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 1px 2px rgba(0, 0, 0, .2);
}
.range-control small {
  display: flex;
  justify-content: space-between;
  color: var(--muted-2);
  font: 9px var(--mono);
}
.range-control small i { font-style: normal; }
.range-scale i:last-child { color: #807ad1; }
.return-control {
  margin: 0 -6px;
  padding: 10px 7px;
  border: 1px solid #dcd9ff;
  border-radius: 7px;
  background: var(--accent-soft);
}
.return-control .direct-field { border-color: #cbc7ff; }
.return-equation {
  margin: 7px 0 0;
  color: #716bd2;
  font: 9px/1.45 var(--mono);
}
.return-equation.invalid { color: var(--red); }
.allocation-control { background: linear-gradient(to right, rgba(99, 91, 255, .035), transparent); }
.margin-control { transition: opacity .15s ease; }
.margin-control.inactive { display: none; }
.control-warning {
  margin: 9px 0 0;
  padding: 8px 9px;
  border-left: 2px solid #d97800;
  border-radius: 0 5px 5px 0;
  background: #fff6e8;
  color: #805000;
  font-size: 9px;
  line-height: 1.45;
}
.model-note { display: none; }

.consensus-card, .financials-card {
  margin-top: 10px;
  padding: 17px 18px 8px;
  scroll-margin-top: 10px;
}
.consensus-head { gap: 20px; }
.source-pill {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 9px;
}
.receipts-actions { display: flex; align-items: center; gap: 9px; }
.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted);
  text-align: right;
  font-size: 10px;
  font-weight: 600;
}
th:first-child, td:first-child { padding-left: 0; text-align: left; }
td {
  padding: 11px;
  border-bottom: 1px solid var(--line);
  color: var(--text-2);
  text-align: right;
  font: 11px var(--mono);
}
tbody tr:hover { background: #fafaff; }
td:first-child { color: var(--text); }
td.muted { color: var(--muted-2); }
td.positive { color: var(--green); }
td.negative { color: var(--red); }
.consensus-table td strong { color: var(--text); font-weight: 600; }
.consensus-table td small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.consensus-table .range-cell { color: var(--muted); }

footer {
  min-height: 50px;
  padding: 14px clamp(16px, 1.7vw, 28px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
}

@media (min-width: 1650px) {
  .site-header { grid-template-columns: auto minmax(360px, 590px) minmax(330px, 1fr) auto auto; }
  .primary-screen { grid-template-columns: 250px minmax(700px, 1fr) 440px; }
}

@media (max-width: 1250px) {
  .site-header { grid-template-columns: auto minmax(280px, 1fr) auto auto; }
  .quick-picks { display: none; }
  .primary-screen { grid-template-columns: 215px minmax(0, 1fr); height: auto; }
  .stats-rail { max-height: 620px; }
  .chart-card { min-height: 620px; }
  .controls-card {
    grid-column: 1 / -1;
    max-height: none;
    overflow: visible;
  }
  .primary-control-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 18px;
  }
  .primary-control-list .driver-note { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .site-header {
    min-height: 52px;
    padding: 6px 10px;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
  }
  .brand { font-size: 0; gap: 0; }
  .brand-mark { width: 25px; height: 25px; }
  .site-header nav, .command-meta { display: none; }
  .search-shell {
    height: 40px;
    grid-template-columns: 17px minmax(0, 1fr) auto;
    padding-left: 10px;
  }
  .search-shell kbd { display: none; }
  .search-shell button {
    width: 38px;
    padding: 0;
    font-size: 0;
  }
  .search-shell button span { margin: 0; font-size: 14px; }
  .workspace { min-height: calc(100vh - 52px); padding: 8px 8px 36px; }
  .company-row { min-height: 54px; padding: 7px 9px; }
  .ticker-avatar { display: none; }
  .company-identity h3 { max-width: 175px; font-size: 13px; }
  .price-block span { display: none; }
  .price-block strong { font-size: 15px; }
  .price-block em { display: block; margin-top: 2px; font-size: 8px; }
  .primary-screen {
    min-height: 0;
    height: auto;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
  }
  .chart-card { order: 1; min-height: 500px; padding: 13px 11px 0; }
  .stats-rail { order: 2; max-height: none; padding: 11px; }
  .controls-card { order: 3; grid-column: auto; padding: 12px; }
  .chart-legend { gap: 6px 10px; }
  .chart-legend span:nth-child(4) { display: none; }
  .chart-readout { width: 100%; margin-left: 0; }
  .chart-wrap { min-height: 310px; }
  .model-summary { grid-template-columns: 1fr 1fr; margin: 0 -11px; }
  .model-summary > div:nth-child(2) { border-right: 0; }
  .model-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .stats-rail .metric-grid { grid-template-columns: 1fr 1fr; }
  .signal-grid { grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .primary-control-list { display: block; }
  .basis-switch button { padding-left: 6px; padding-right: 6px; }
  .consensus-card, .financials-card { padding: 14px 12px 7px; }
  .source-pill { display: none; }
  .receipts-actions { align-items: flex-end; }
  footer { flex-direction: column; gap: 3px; align-items: flex-start; }
}
