﻿:root {
  --bg: #eef1f5;
  --ink: #0e0e12;
  --muted: #6a6e78;
  --panel: #ffffff;
  --panel-2: #e9edf2;
  --line: #d9dde4;
  --red: #e82127;
  --red-dk: #b31217;
  --teal: #17756f;
  --gold: #b47a23;
  --blue: #365f9d;
  --green: #537b3e;
  --graph: #3b404b;
  --steel: #9aa0ab;
  --shadow: 0 18px 44px rgba(14, 14, 18, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

img,
svg {
  max-width: 100%;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 30;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
}

.skip-link:focus {
  top: 1rem;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem;
  align-items: end;
  padding: 1.6rem clamp(1rem, 4vw, 3rem) 1.1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 0.4rem;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(1.8rem, 4vw, 3.7rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0.45rem;
  font-size: clamp(1.45rem, 3vw, 2.6rem);
  line-height: 1.08;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 0.35rem;
  font-size: 1.05rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.lede,
.section-head p,
.hero-copy p,
.story-card p,
.workflow-detail p,
.storyboard-card p,
.storyboard-card li,
.step-card p,
.chart-card p {
  color: var(--muted);
}

.lede {
  max-width: 860px;
  margin-bottom: 0;
  font-size: 1rem;
}

.topbar-actions,
.hero-actions,
.segmented,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topbar-side {
  display: flex;
  min-width: 470px;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.55rem;
}

.tesla-logo {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.tesla-logo img {
  display: block;
  width: 4.3rem;
  height: auto;
}

.market-widget {
  display: grid;
  width: min(100%, 500px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
}

.quote-tile {
  min-width: 0;
  padding: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.quote-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.quote-tile strong {
  display: block;
  margin-top: 0.12rem;
  color: var(--ink);
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  line-height: 1;
}

.quote-tile p {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.quote-tile p.is-up {
  color: var(--green);
}

.quote-tile p.is-down {
  color: var(--red);
}

.market-widget a {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: right;
}

.topbar-actions a,
.primary-action,
.ghost-action,
.segmented button,
.chip,
.close-button {
  display: inline-flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.48rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
}

.primary-action,
.segmented button[aria-pressed="true"],
.chip[aria-pressed="true"],
.tabbar button[aria-selected="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.ghost-action:hover,
.topbar-actions a:hover,
.segmented button:hover,
.chip:hover,
.close-button:hover {
  border-color: var(--red);
}

.tabbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 0.35rem;
  overflow-x: auto;
  padding: 0.65rem clamp(1rem, 4vw, 3rem);
  background: rgba(10, 11, 13, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.tabbar button {
  min-height: 2.25rem;
  padding: 0.42rem 0.78rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}

main {
  padding: 1.35rem clamp(1rem, 4vw, 3rem) 3rem;
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid > *,
.hero-shell > *,
.forecast-stage > *,
.deck-layout > *,
.workflow-board > *,
.table-grid > *,
.viz-grid > * {
  min-width: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin: 1.6rem 0 0.9rem;
}

.section-head p {
  max-width: 860px;
  margin-bottom: 0;
}

.hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  gap: 1rem;
  min-height: min(620px, calc(100vh - 190px));
  align-items: stretch;
}

.hero-copy,
.command-panel,
.workflow-map,
.workflow-detail,
.scenario-card,
.viz-panel,
.story-card,
.storyboard-card,
.step-card,
.chart-card,
.source-card,
.table-card,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1rem, 4vw, 2.2rem);
}

.hero-copy h2 {
  max-width: 780px;
  font-size: clamp(2.1rem, 5vw, 5.1rem);
}

.command-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(1rem, 3vw, 1.8rem);
  overflow: hidden;
}

.console-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.console-grid div,
.metric-card,
.fact-chip {
  padding: 0.85rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.console-grid span,
.metric-card span span,
.story-card span,
.step-card > span,
.workflow-detail span,
.slide-index {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.console-grid strong,
.metric-card strong {
  display: block;
  margin-top: 0.2rem;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  line-height: 1;
}

.drawn-circuit {
  margin: 1rem 0;
  padding: 0.7rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.circuit-line,
.flow-backbone {
  fill: none;
  stroke: var(--red);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 10 9;
  animation: dashMove 1.4s linear infinite;
}

.circuit-node circle {
  fill: var(--red);
  stroke: var(--panel);
  stroke-width: 4;
}
.circuit-node.is-mid circle { fill: var(--red-dk); }

.circuit-step {
  fill: #fff;
  font-size: 18px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
}
.circuit-cap {
  fill: var(--ink);
  font-size: 15px;
  font-weight: 700;
  text-anchor: middle;
}

.stacked-bar {
  display: flex;
  height: 1.15rem;
  overflow: hidden;
  background: var(--panel-2);
  border-radius: 7px;
}

.stacked-bar span {
  display: block;
  min-width: 2px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.legend i {
  display: inline-block;
  width: 0.78rem;
  height: 0.78rem;
  margin-right: 0.24rem;
  border-radius: 3px;
  vertical-align: -0.1rem;
}

.metric-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-top: 1rem;
}

.metric-card p {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

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

.source-card {
  padding: 1rem;
  text-decoration: none;
}

.source-card strong {
  display: block;
  margin: 0.25rem 0;
  font-size: 1.08rem;
}

.story-card {
  padding: 1rem;
  border-top: 4px solid var(--teal);
}

.story-card:nth-child(2) {
  border-top-color: var(--gold);
}

.story-card:nth-child(3) {
  border-top-color: var(--red);
}

.story-card:nth-child(4) {
  border-top-color: var(--blue);
}

.workflow-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.32fr);
  gap: 1rem;
  align-items: stretch;
}

.workflow-map {
  position: relative;
  min-height: 300px;
  padding: 1rem;
  overflow: hidden;
}

.workflow-map svg {
  position: absolute;
  inset: 4.3rem 1.4rem auto;
  z-index: 1;
  width: calc(100% - 2.8rem);
  height: 155px;
  opacity: 0.95;
  pointer-events: none;
}

.workflow-nodes {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 0.75rem;
  height: 100%;
  align-items: center;
}

.flow-node {
  min-height: 142px;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 11, 13, 0.86);
  color: var(--ink);
  text-align: left;
  transform: translateY(calc((var(--i) - 2) * 12px));
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.flow-node span {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  border-radius: 50%;
  background: var(--panel-2);
  font-weight: 900;
}

.flow-node strong {
  display: block;
}

.flow-node.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  transform: translateY(calc((var(--i) - 2) * 12px - 8px));
}

.flow-node.is-active span {
  background: var(--red);
  color: #fff;
}

.workflow-detail {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.2rem;
  border-left: 4px solid var(--red);
}

.workflow-step-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.rail-step {
  min-height: 190px;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rail-step span {
  color: var(--red);
  font-weight: 900;
}

.deck-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.25fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.deck-panel {
  position: sticky;
  top: 4.8rem;
}

.search-input {
  width: 100%;
  min-height: 2.55rem;
  margin: 0.85rem 0;
  padding: 0.58rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
}

.storyboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.storyboard-card {
  padding: 1rem;
  border-left: 4px solid var(--teal);
}

.storyboard-card ul {
  margin: 0.7rem 0 0;
  padding-left: 1.1rem;
}

.storyboard-card details,
.storyboard-card .table-wrap {
  margin-top: 0.75rem;
}

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

.model-hero {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.model-hero > div {
  min-width: 0;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.model-hero > div:nth-child(2) {
  border-top-color: var(--teal);
}

.model-hero > div:nth-child(3) {
  border-top-color: var(--green);
}

.model-hero > div:nth-child(4) {
  border-top-color: var(--gold);
}

.model-hero span,
.model-panel > span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.model-hero strong {
  display: block;
  margin: 0.25rem 0;
  font-size: clamp(1.5rem, 3vw, 2.4rem);
  line-height: 1;
}

.model-hero p {
  margin: 0;
  color: var(--muted);
}

.model-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr) 34px minmax(0, 1fr);
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 1rem;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.flow-pill {
  min-height: 3.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  font-weight: 850;
  text-align: center;
}

.flow-arrow {
  height: 2px;
  background: var(--red);
  position: relative;
}

.flow-arrow::after {
  content: "";
  position: absolute;
  top: -4px;
  right: 0;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--red);
}

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

.model-panel {
  min-width: 0;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.model-panel h3 {
  margin-top: 0.25rem;
}

.model-panel p {
  color: var(--muted);
}

.step-card {
  padding: 1rem;
}

.mini-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.mini-metrics b {
  flex: 1 1 128px;
  min-width: 0;
  padding: 0.58rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.mini-metrics small {
  display: block;
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.forecast-stage {
  display: grid;
  grid-template-columns: minmax(300px, 0.38fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
}

.scenario-card,
.viz-panel {
  padding: 1rem;
}

.scenario-card h3 {
  margin-top: 1rem;
}

.scenario-callout {
  margin: 0.8rem 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: var(--panel);
}

.scenario-callout.downside {
  border-left-color: var(--red);
  background: rgba(255, 43, 48, 0.10);
}

.scenario-callout.base {
  border-left-color: var(--blue);
  background: rgba(120, 132, 150, 0.12);
}

.scenario-callout.upside {
  border-left-color: var(--green);
  background: rgba(90, 143, 74, 0.14);
}

.scenario-callout span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.scenario-callout strong {
  display: block;
  margin: 0.2rem 0;
}

.scenario-callout p {
  margin: 0;
  color: var(--muted);
}

.forecast-detail {
  display: grid;
  gap: 1rem;
}

.forecast-case-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.forecast-case-card,
.forecast-explain-card {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.forecast-case-card {
  border-top: 4px solid var(--line);
}

.forecast-case-card.is-active {
  border-top-color: var(--red);
  box-shadow: 0 14px 34px rgba(232, 33, 39, 0.12);
}

.forecast-case-card span,
.forecast-explain-card > span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.forecast-case-card strong {
  display: block;
  margin: 0.25rem 0;
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  line-height: 1;
}

.forecast-case-card p {
  color: var(--muted);
}

.forecast-case-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.forecast-case-metrics b {
  padding: 0.58rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.forecast-case-metrics small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.forecast-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  gap: 1rem;
}

.driver-list,
.sensitivity-list,
.method-list,
.check-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.driver-card,
.sensitivity-card,
.method-list div,
.check-list div {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.driver-card {
  display: grid;
  grid-template-columns: minmax(160px, 0.38fr) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
}

.driver-card h4 {
  margin: 0 0 0.15rem;
}

.driver-card p,
.sensitivity-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.driver-bars {
  display: grid;
  gap: 0.38rem;
}

.driver-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 78px;
  gap: 0.5rem;
  align-items: center;
}

.driver-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.driver-row i {
  display: block;
  height: 0.56rem;
  border-radius: 999px;
  background: var(--teal);
}

.driver-row.is-active i {
  background: var(--red);
}

.driver-row b {
  text-align: right;
  font-size: 0.86rem;
}

.method-list div,
.check-list div,
.sensitivity-card div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.method-list span,
.check-list span,
.sensitivity-card span {
  color: var(--muted);
  font-weight: 800;
}

.check-list strong {
  color: var(--green);
}

.viz-grid,
.table-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 1rem;
}

.live-chart {
  width: 100%;
  min-height: 260px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.live-chart text {
  fill: var(--ink);
  font-size: 17px;
  font-weight: 760;
}

.axis {
  stroke: #91a096;
  stroke-width: 2;
}

.bar-revenue {
  fill: var(--teal);
}

.bar-oi,
.bar-base {
  fill: var(--gold);
}

.bar-upside {
  fill: var(--green);
}

.bar-downside {
  fill: var(--red);
}

.bar-error {
  fill: var(--blue);
}

.bar-group rect {
  opacity: 0.72;
  transition: opacity 160ms ease, transform 160ms ease;
  transform-origin: center bottom;
}

.bar-group.active-bar rect {
  opacity: 1;
  filter: drop-shadow(0 5px 10px rgba(23, 117, 111, 0.25));
}

.chart-key text {
  font-size: 15px;
}

.policy-chart {
  min-height: 300px;
}

.policy-axis-label {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.policy-gridline {
  stroke: var(--line);
  stroke-width: 2;
}

.policy-label-title {
  fill: var(--ink);
  font-size: 17px;
  font-weight: 900;
}

.policy-label-note {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 680;
}

.policy-value {
  fill: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

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

.chart-card {
  overflow: visible;
  display: flex;
  flex-direction: column;
  min-height: 280px;
}
.chart-card .drawn-chart,
.chart-card .horizon-bars,
.chart-card .contribution-chart,
.chart-card .contribution-rows {
  width: 100%;
  min-height: 200px;
}
.chart-card .drawn-chart svg {
  display: block;
  width: 100%;
  height: auto;
}
.chart-card figcaption {
  margin-top: auto;
}

.chart-card button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.chart-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: contain;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.chart-card figcaption {
  padding: 0.85rem;
}

.chart-card p {
  margin-bottom: 0;
  font-size: 0.86rem;
}

.figure-section {
  margin-top: 1.2rem;
}

.figure-list {
  display: grid;
  gap: 1.15rem;
}

.figure-card {
  display: grid;
  grid-template-columns: minmax(230px, 0.28fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-width: 0;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.figure-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.figure-meta span {
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.figure-meta h3 {
  margin-top: 0.35rem;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
}

.figure-meta p {
  margin: 0;
  color: var(--muted);
}

.figure-card button {
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.figure-card img {
  display: block;
  width: 100%;
  max-height: 620px;
  object-fit: contain;
  background: var(--panel);
  border-radius: 6px;
}

.workflow-graph-card {
  display: grid;
  grid-template-columns: minmax(230px, 0.26fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: stretch;
  min-width: 0;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
}

.workflow-graph-meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
}

.workflow-graph-meta span {
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.workflow-graph-meta h3 {
  margin-top: 0.35rem;
  font-size: clamp(1.1rem, 2vw, 1.55rem);
}

.workflow-graph-meta p {
  margin: 0;
  color: var(--muted);
}

.workflow-graph-canvas {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background:
    linear-gradient(90deg, rgba(232, 33, 39, 0.06), transparent 46%),
    #f8fafc;
}

.workflow-graph-canvas svg {
  position: absolute;
  inset: 1.4rem 1rem auto;
  width: calc(100% - 2rem);
  height: 190px;
  pointer-events: none;
}

.workflow-graph-path {
  fill: none;
  stroke: var(--teal);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 18 12;
  animation: dashMove 7s linear infinite;
}

.workflow-graph-ring circle {
  fill: var(--panel);
  stroke: var(--red);
  stroke-width: 5;
  animation: nodePulse 1800ms ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 150ms);
}

.workflow-graph-ring text {
  fill: var(--ink);
  font-size: 17px;
  font-weight: 900;
  text-anchor: middle;
}

.workflow-graph-stages {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.75rem;
  min-height: 100%;
  align-items: end;
  padding-top: 190px;
}

.workflow-graph-stage {
  position: relative;
  min-height: 175px;
  overflow: hidden;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(20, 23, 28, 0.92);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transform: translateY(calc((var(--i) - 2) * 10px));
}

.workflow-graph-stage::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--teal), var(--gold));
  transform: scaleX(0);
  transform-origin: left center;
}

.workflow-graph-stage.is-visible::before {
  animation: nodeSweep 900ms ease-out both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

.workflow-graph-stage span {
  display: inline-flex;
  width: 2rem;
  height: 2rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.55rem;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.workflow-graph-stage h3 {
  margin-bottom: 0.35rem;
}

.workflow-graph-stage p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 0.28fr);
  gap: 1rem;
  align-items: start;
}

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

.source-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.table-card {
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

th,
td {
  padding: 0.65rem 0.72rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--panel-2);
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: var(--muted);
}

summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
}

.empty-state {
  padding: 1rem;
  color: var(--muted);
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
}

.modal-root.is-open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(18, 21, 20, 0.84);
}

.modal-content {
  width: min(1120px, 96vw);
  max-height: 94vh;
  overflow: auto;
  background: var(--panel);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.modal-content header {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
}

.modal-content img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--panel);
}

.reveal-up {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 420ms ease, transform 420ms ease;
  transition-delay: var(--delay, 0ms);
}

.reveal-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(199, 68, 50, 0.33);
  outline-offset: 2px;
}

@keyframes dashMove {
  to {
    stroke-dashoffset: -96;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  .reveal-up {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 1180px) {
  .metric-grid,
  .story-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid,
  .step-grid,
  .model-panel-grid,
  .model-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 880px) {
  .topbar,
  .hero-shell,
  .workflow-board,
  .deck-layout,
  .figure-card,
  .workflow-graph-card,
  .forecast-stage,
  .forecast-case-grid,
  .forecast-detail-grid,
  .viz-grid,
  .table-grid,
  .library-toolbar,
  .model-flow {
    grid-template-columns: minmax(0, 1fr);
  }

  .flow-arrow {
    width: 2px;
    height: 22px;
    justify-self: center;
  }

  .flow-arrow::after {
    top: auto;
    right: -4px;
    bottom: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 8px solid var(--red);
    border-bottom: 0;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .topbar-side {
    align-items: flex-start;
    min-width: 0;
    width: 100%;
  }

  .market-widget {
    width: 100%;
  }

  .hero-shell {
    min-height: 0;
  }

  .deck-panel {
    position: static;
  }

  .workflow-map {
    min-height: auto;
  }

  .workflow-map svg {
    display: block;
    inset: 1rem;
    height: calc(100% - 2rem);
    opacity: 0.25;
  }

  .workflow-nodes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flow-node {
    min-height: 112px;
    transform: none;
  }

  .flow-node.is-active {
    transform: none;
  }

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

@media (max-width: 620px) {
  main {
    padding: 1rem 1rem 2.5rem;
  }

  .section-head {
    display: block;
  }

  .console-grid,
  .metric-grid,
  .story-grid,
  .chart-grid,
  .step-grid,
  .model-panel-grid,
  .model-hero,
  .workflow-step-grid,
  .source-list,
  .workflow-nodes,
  .workflow-graph-stages {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-graph-canvas {
    min-height: auto;
  }

  .workflow-graph-canvas svg {
    display: none;
  }

  .workflow-graph-stages {
    padding-top: 0;
  }

  .workflow-graph-stage {
    min-height: 132px;
    transform: none;
  }

  .driver-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .command-panel {
    display: none;
  }

  .market-widget {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-copy h2 {
    font-size: 2.25rem;
  }

  .live-chart {
    min-height: 220px;
  }
}

/* Theme pass: Tabler-style executive dashboard. */
:root {
  --bg: #f5f7fb;
  --ink: #111827;
  --muted: #64748b;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --line: #dbe3ee;
  --red: #e82127;
  --teal: #0f766e;
  --gold: #c0841a;
  --blue: #2563eb;
  --green: #15803d;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

body {
  background:
    linear-gradient(180deg, #fff 0, #f5f7fb 260px),
    var(--bg);
  color: var(--ink);
}

.topbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.topbar::before {
  content: "";
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 5px;
  background: var(--red);
}

.tabbar {
  background: rgba(10, 11, 13, 0.86);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
}

.tabbar button,
.segmented button,
.chip,
.topbar-actions a,
.primary-action,
.ghost-action {
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.hero-copy,
.command-panel,
.workflow-map,
.workflow-detail,
.scenario-card,
.viz-panel,
.story-card,
.storyboard-card,
.step-card,
.chart-card,
.source-card,
.table-card,
.metric-card {
  border-radius: 6px;
}

.hero-copy {
  background:
    linear-gradient(90deg, rgba(232, 33, 39, 0.08), transparent 38%),
    #ffffff;
  border-top: 4px solid var(--red);
}

.hero-copy h2 {
  max-width: 900px;
  font-size: clamp(2rem, 4.2vw, 4.4rem);
}

.command-panel,
.workflow-map,
.viz-panel {
  background: var(--panel);
}

.metric-card {
  background: var(--panel);
  border-top: 3px solid var(--red);
}

.metric-card:nth-child(2),
.metric-card:nth-child(5) {
  border-top-color: var(--teal);
}

.metric-card:nth-child(3),
.metric-card:nth-child(6) {
  border-top-color: var(--gold);
}

.metric-card span,
.console-grid span span,
.story-card span,
.step-card > span,
.workflow-detail span,
.slide-index {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.metric-card strong {
  color: var(--ink);
}

.story-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}


.story-card {
  border-top: 0;
  border-left: 4px solid var(--teal);
}

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

.storyboard-card {
  display: grid;
  grid-template-columns: minmax(0, 0.58fr) minmax(320px, 0.42fr);
  gap: 1rem;
  align-items: start;
  border-left: 0;
  border-top: 1px solid var(--line);
  padding: 1.05rem;
}

.storyboard-card .slide-index,
.storyboard-card h3,
.storyboard-card ul,
.storyboard-card > p,
.storyboard-card > details {
  grid-column: 1;
}

.storyboard-card h3 {
  font-size: 1.25rem;
}

.storyboard-card ul {
  margin-top: 0.35rem;
}

.storyboard-card li {
  margin: 0.2rem 0;
}






.workflow-detail {
  border-left-color: var(--red);
}

.flow-node.is-active,
.primary-action,
.segmented button[aria-pressed="true"],
.chip[aria-pressed="true"],
.tabbar button[aria-selected="true"] {
  background: var(--panel-2);
  border-color: var(--red);
  color: #fff;
}

.flow-node.is-active span {
  background: var(--red);
}

.live-chart {
  background: var(--panel);
}

th {
  background: var(--panel-2);
}

@media (max-width: 900px) {
  .storyboard-card {
    grid-template-columns: minmax(0, 1fr);
  }

}

@media (max-width: 620px) {
  .story-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Motion pass: charts build into view and workflow stages stay visibly active. */
.chart-card img,
.figure-card img {
  clip-path: inset(0 100% 0 0);
  transform: translateZ(0);
}

.chart-card.is-visible img,
.figure-card.is-visible img {
  animation: chartWipe 1100ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--delay, 0ms) + 120ms);
}

.viz-panel .axis {
  stroke-dasharray: 720;
  stroke-dashoffset: 720;
}

.viz-panel.is-visible .axis {
  animation: drawAxis 720ms ease-out both;
}

.viz-panel .bar-group rect {
  transform: scaleY(0);
  transform-box: fill-box;
  transform-origin: center bottom;
}

.viz-panel.is-visible .bar-group rect {
  animation: barRise 820ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(180ms + (var(--i, 0) * 95ms));
}

.viz-panel .bar-row rect {
  transform: scaleX(0);
  transform-box: fill-box;
  transform-origin: left center;
}

.viz-panel.is-visible .bar-row rect {
  animation: barGrowX 820ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(180ms + (var(--i, 0) * 75ms));
}

.viz-panel .bar-group text,
.viz-panel .bar-row text,
.viz-panel .chart-key {
  opacity: 0;
}

.viz-panel.is-visible .bar-group text,
.viz-panel.is-visible .bar-row text,
.viz-panel.is-visible .chart-key {
  animation: fadeSettle 520ms ease-out both;
  animation-delay: calc(620ms + (var(--i, 0) * 70ms));
}

.stacked-bar span {
  transform: scaleX(0);
  transform-origin: left center;
}

.command-panel.is-visible .stacked-bar span,
.scenario-card.is-visible .stacked-bar span {
  animation: fillAcross 760ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: var(--fill-delay, 0ms);
}

.flow-node {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.flow-node::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  z-index: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--teal), var(--gold));
  transform: scaleX(0);
  transform-origin: left center;
  animation: nodeSweep 2800ms ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 150ms);
}

.flow-node::after {
  content: "";
  position: absolute;
  top: 0.72rem;
  right: 0.72rem;
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 0 rgba(232, 33, 39, 0.35);
  animation: nodePulse 1800ms ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 150ms);
}

.flow-node span,
.flow-node strong {
  position: relative;
  z-index: 1;
}

.flow-dot {
  fill: var(--red);
  opacity: 0.88;
  animation: nodePulse 1800ms ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 150ms);
}

.rail-step {
  position: relative;
  overflow: hidden;
}

.rail-step::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--teal));
  transform: scaleX(0);
  transform-origin: left center;
}

.rail-step.is-visible::before {
  animation: nodeSweep 900ms ease-out both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

.story-card,
.metric-card,
.model-panel,
.step-card,
.rail-step,
.chart-card,
.figure-card,
.workflow-graph-card,
.workflow-graph-stage,
.viz-panel,
.scenario-card,
.source-card {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.story-card:hover,
.metric-card:hover,
.model-panel:hover,
.step-card:hover,
.rail-step:hover,
.chart-card:hover,
.figure-card:hover,
.workflow-graph-card:hover,
.workflow-graph-stage:hover,
.viz-panel:hover,
.scenario-card:hover,
.source-card:hover {
  transform: translateY(-2px);
  border-color: rgba(232, 33, 39, 0.35);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1);
}

.flow-arrow {
  overflow: hidden;
}

.flow-arrow::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,43,48,0.85), transparent);
  transform: translateX(-110%);
  animation: arrowTravel 1800ms ease-in-out infinite;
}

@keyframes chartWipe {
  from {
    clip-path: inset(0 100% 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes drawAxis {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes barRise {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes barGrowX {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes fadeSettle {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fillAcross {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes nodeSweep {
  0% {
    transform: scaleX(0);
  }
  45%,
  100% {
    transform: scaleX(1);
  }
}

@keyframes nodePulse {
  0%,
  100% {
    opacity: 0.72;
    box-shadow: 0 0 0 0 rgba(232, 33, 39, 0.28);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 0 8px rgba(232, 33, 39, 0);
  }
}

@keyframes arrowTravel {
  0% {
    transform: translateX(-110%);
  }
  55%,
  100% {
    transform: translateX(110%);
  }
}

/* Redesigned deck style pass. */
:root {
  --bg: #0a0b0d;
  --ink: #f3f4f6;
  --muted: #9aa0ab;
  --panel: #15171c;
  --panel-2: #1d2026;
  --line: #2b2f37;
  --red: #ff2b30;
  --red-dk: #c20f14;
  --teal: #c6ccd6;
  --gold: #8b919c;
  --blue: #6b7280;
  --green: #5a8f4a;
  --graph: #cdd2da;
  --steel: #7e848f;
  --dark: #000000;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

body {
  background: var(--panel);
  color: var(--ink);
  font-family: Calibri, Aptos, Inter, Arial, sans-serif;
}

.topbar,
.tabbar {
  background: var(--panel);
  box-shadow: none;
}

.topbar {
  align-items: start;
  border-bottom: 1px solid var(--line);
}

.topbar::before {
  width: 0;
}

.tesla-logo img {
  width: 3rem;
}

.market-widget {
  border-left-color: var(--red);
  background: var(--panel);
}

.quote-tile {
  background: var(--panel);
}

.tabbar button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
}

.tabbar button[aria-selected="true"] {
  background: transparent;
  border-color: var(--red);
  color: var(--ink);
}

.eyebrow {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  color: var(--red);
  font-weight: 900;
}

.eyebrow::before {
  content: "";
  width: 0.72rem;
  height: 0.72rem;
  background: var(--red);
}

.hero-copy {
  position: relative;
  overflow: hidden;
  background: var(--dark);
  border: 0;
  border-radius: 0;
  color: #fff;
}

.hero-copy::after {
  content: "";
  position: absolute;
  right: 2rem;
  top: 2rem;
  width: min(25vw, 12rem);
  aspect-ratio: 1;
  background: url("assets/tesla-mark-red.png") center / contain no-repeat;
  opacity: 0.18;
}

.hero-copy > * {
  position: relative;
  z-index: 1;
}

.hero-copy p,
.hero-copy .eyebrow {
  color: #d7dbe4;
}

.hero-copy .eyebrow {
  color: var(--red);
}

.command-panel,
.workflow-map,
.workflow-detail,
.scenario-card,
.viz-panel,
.story-card,
.step-card,
.chart-card,
.source-card,
.table-card,
.metric-card,
.model-panel,
.forecast-case-card,
.forecast-explain-card,
.figure-card,
.workflow-graph-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: none;
}

.metric-card,
.story-card,
.model-panel,
.step-card,
.rail-step,
.forecast-case-card,
.chart-card,
.figure-card {
  border-top: 5px solid var(--red);
}

.story-card:nth-child(2),
.story-card:nth-child(3),
.story-card:nth-child(4),
.metric-card:nth-child(2),
.metric-card:nth-child(3),
.metric-card:nth-child(5),
.metric-card:nth-child(6) {
  border-top-color: var(--red);
}

.primary-action,
.segmented button[aria-pressed="true"],
.chip[aria-pressed="true"] {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.ghost-action,
.topbar-actions a,
.segmented button,
.chip,
.close-button {
  background: var(--panel);
}

.live-chart {
  background: var(--panel);
}

.bar-revenue,
.bar-error,
.bar-upside,
.bar-downside {
  fill: #9aa1ac;
}

.bar-oi,
.bar-base,
.bar-group.active-bar rect {
  fill: var(--red);
}

.drawn-chart {
  min-width: 0;
  min-height: 280px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.drawn-figure .drawn-chart {
  border-top: 0;
}

.figure-card > .drawn-chart {
  min-height: 390px;
}

.drawn-chart h4 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.drawn-chart button {
  font: inherit;
}

.drawn-axis {
  stroke: #c8ced8;
  stroke-width: 2;
}

.drawn-axis-label,
.drawn-tick {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.drawn-line {
  fill: none !important;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 3px 0 rgba(17, 18, 23, 0.08));
}

.series-red {
  stroke: var(--red);
  fill: var(--red);
}

.series-gray {
  stroke: #7b8492;
  fill: #7b8492;
}

.drawn-point {
  cursor: pointer;
  fill: #ffffff;
  stroke-width: 4;
  transition: r 160ms ease, filter 160ms ease;
}

.drawn-point.series-red {
  stroke: var(--red);
}

.drawn-point.series-gray {
  stroke: #7b8492;
}

.drawn-point:hover,
.drawn-point:focus,
.drawn-point.is-focused {
  r: 9;
  filter: drop-shadow(0 0 8px rgba(237, 28, 36, 0.35));
}

.drawn-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-weight: 800;
}

.drawn-legend i {
  display: inline-block;
  width: 0.8rem;
  height: 0.8rem;
  margin-right: 0.3rem;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--muted); /* fallback for any series without a color class */
}
.drawn-legend i.series-red,
.drawn-legend i.series-gray { background: var(--red); }
.drawn-legend i.series-teal { background: var(--teal); }
.drawn-legend i.series-gold { background: var(--gold); }
.drawn-legend i.series-blue { background: var(--blue); }
.drawn-legend i.series-green { background: var(--green); }

.drawn-bars {
  display: grid;
  gap: 0.55rem;
}

.drawn-selection {
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-left: 4px solid var(--red);
  border-radius: 5px;
  background: var(--dark);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 780;
}

.drawn-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.28fr) minmax(0, 1fr) minmax(78px, auto);
  gap: 0.65rem;
  align-items: center;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.drawn-bar-row i {
  display: block;
  height: 1rem;
  border-radius: 0;
  background: #9aa1ac;
  transform-origin: left center;
  animation: fillAcross 780ms ease-out both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.drawn-bar-row b,
.drawn-bar-row span {
  position: relative;
  z-index: 1;
}

.drawn-bar-row.is-active i,
.drawn-bar-row.is-focused i,
.drawn-bar-row:hover i,
.drawn-bar-row:focus i {
  background: var(--red);
}

.drawn-bar-row.is-focused,
.drawn-bar-row:hover,
.drawn-bar-row:focus {
  border-color: var(--red);
  background: rgba(255, 43, 48, 0.10);
}

.scenario-drawn-chart {
  display: grid;
  gap: 1rem;
}

.scenario-drawn-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.scenario-drawn-card,
.drawn-metric-tile {
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.scenario-drawn-card.is-active,
.scenario-drawn-card.is-focused,
.scenario-drawn-card:hover,
.scenario-drawn-card:focus {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  transform: translateY(-1px);
}

.scenario-drawn-card span,
.scenario-drawn-card small,
.drawn-metric-tile span,
.drawn-metric-tile small {
  display: block;
}

.scenario-drawn-card strong,
.drawn-metric-tile strong {
  display: block;
  margin: 0.28rem 0;
  font-size: clamp(1.25rem, 2vw, 2rem);
}

.segment-mix-chart {
  display: grid;
  gap: 0.8rem;
}

.drawn-stack {
  display: flex;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.drawn-stack button {
  min-width: 88px;
  padding: 0.8rem;
  border: 0;
  border-right: 1px solid var(--line);
  background: #9aa1ac;
  color: #fff;
  text-align: left;
  transition: filter 160ms ease, transform 160ms ease;
}

.drawn-stack button:first-child {
  background: var(--red);
}

.drawn-stack button:hover,
.drawn-stack button:focus,
.drawn-stack button.is-focused {
  filter: brightness(0.92);
  transform: translateY(-2px);
}

.cvp-tile-chart {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.drawn-metric-tile {
  border-left: 6px solid #4b5563;
}

.drawn-metric-tile.is-red,
.drawn-metric-tile.is-focused,
.drawn-metric-tile:hover,
.drawn-metric-tile:focus {
  border-left-color: var(--red);
}

.cvp-tile-chart .drawn-selection {
  grid-column: 1 / -1;
}

.reveal-up {
  opacity: 1;
  transform: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

@media (max-width: 760px) {
  .scenario-drawn-cards,
  .cvp-tile-chart {
    grid-template-columns: minmax(0, 1fr);
  }

  .drawn-bar-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Expanded deck content pass */
.workflow-map-remake {
  min-height: 335px;
}

.workflow-map-remake .workflow-nodes {
  padding-top: 4.7rem;
  align-items: stretch;
}

.workflow-route {
  position: absolute;
  top: 1.55rem;
  left: 2rem;
  right: 2rem;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  pointer-events: none;
}

.workflow-route::before {
  content: "";
  position: absolute;
  left: 2rem;
  right: 2rem;
  top: 50%;
  height: 3px;
  background: repeating-linear-gradient(90deg, var(--red) 0 16px, transparent 16px 27px);
  transform: translateY(-50%);
  animation: dashMove 6s linear infinite;
}

.workflow-route-dot {
  position: relative;
  z-index: 1;
  display: block;
  width: 1.1rem;
  height: 1.1rem;
  margin: 0 auto;
  border: 3px solid var(--red);
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 0 0 6px var(--bg);
  animation: nodePulse 1800ms ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 130ms);
}

.workflow-route-dot.is-active {
  background: var(--red);
  border-color: var(--ink);
}

.series-teal {
  stroke: var(--teal);
  fill: var(--teal);
}

.series-gold {
  stroke: var(--gold);
  fill: var(--gold);
}

.series-green {
  stroke: var(--green);
  fill: var(--green);
}

.drawn-line {
  stroke-dasharray: 4000;
  stroke-dashoffset: 0;
  animation: lineDraw 1100ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.drawn-point {
  opacity: 1;
  animation: fadeSettle 520ms ease-out both;
  animation-delay: 780ms;
}

.grouped-chart {
  display: grid;
  gap: 0.75rem;
}

.grouped-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.26fr) minmax(0, 1fr);
  gap: 0.7rem;
  align-items: center;
}

.grouped-row h4 {
  margin: 0;
  color: var(--ink);
}

.grouped-bars {
  display: grid;
  gap: 0.38rem;
}

.grouped-bars button,
.horizon-bar,
.ecosystem-flow button,
.ecosystem-classes button,
.luxfer-facts button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--ink);
  text-align: left;
}

.grouped-bars button {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) 4.5rem;
  gap: 0.5rem;
  align-items: center;
  padding: 0.48rem;
}

.grouped-bars i,
.horizon-bar i {
  display: block;
  height: 0.82rem;
  border-radius: 0;
  background: #9aa1ac;
  transform: scaleX(0);
  transform-origin: left center;
  animation: fillAcross 780ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 80ms);
}

.grouped-bars .is-current i,
.grouped-bars button:hover i,
.grouped-bars button:focus i {
  background: var(--red);
}

.grouped-bars button:hover,
.grouped-bars button:focus,
.grouped-bars button.is-focused,
.horizon-bar:hover,
.horizon-bar:focus,
.horizon-bar.is-focused,
.ecosystem-flow button:hover,
.ecosystem-flow button:focus,
.ecosystem-flow button.is-focused,
.ecosystem-classes button:hover,
.ecosystem-classes button:focus,
.ecosystem-classes button.is-focused,
.luxfer-facts button:hover,
.luxfer-facts button:focus,
.luxfer-facts button.is-focused {
  border-color: var(--red);
  background: rgba(255, 43, 48, 0.10);
}

.horizon-chart {
  display: grid;
  gap: 0.72rem;
}

.horizon-axis {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.horizon-row {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  gap: 0.65rem;
  align-items: center;
}

.horizon-row h4 {
  margin: 0;
  color: var(--red);
  font-size: 0.85rem;
}

.horizon-bars {
  display: grid;
  gap: 0.4rem;
}

.horizon-bar {
  display: grid;
  grid-template-columns: 5.6rem minmax(0, 1fr) 5rem;
  gap: 0.5rem;
  align-items: center;
  padding: 0.5rem;
}

.horizon-bar.downside i {
  background: #9aa1ac;
}

.horizon-bar.base i,
.horizon-bar.actual i {
  background: var(--red);
}

.horizon-bar.upside i {
  background: var(--green);
}

.ecosystem-chart {
  display: grid;
  gap: 0.9rem;
}

.ecosystem-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
}

.ecosystem-flow button {
  position: relative;
  min-height: 92px;
  padding: 0.85rem;
  border-left: 5px solid var(--red);
}

.ecosystem-flow button:not(:last-child)::after {
  content: "+";
  position: absolute;
  top: 50%;
  right: -0.56rem;
  z-index: 1;
  color: var(--red);
  font-size: 1.25rem;
  font-weight: 900;
  transform: translate(50%, -50%);
}

.ecosystem-flow strong,
.ecosystem-classes strong,
.luxfer-facts strong {
  display: block;
  font-size: clamp(1.25rem, 2vw, 2rem);
}

.ecosystem-flow span,
.ecosystem-classes span,
.ecosystem-classes small,
.luxfer-facts span {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
}

.ecosystem-classes,
.luxfer-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.ecosystem-classes button,
.luxfer-facts button {
  min-height: 112px;
  padding: 0.85rem;
  border-left: 6px solid var(--red);
}

.ecosystem-classes .excluded {
  border-left-color: #9aa1ac;
}

.luxfer-chart {
  display: grid;
  gap: 1rem;
}

.luxfer-chart > .drawn-bars {
  min-height: 0;
}

.validation-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.48fr);
  gap: 1rem;
  align-items: stretch;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--dark);
  color: #fff;
}

.validation-hero span,
.validation-hero small {
  color: #cbd5e1;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.validation-hero p {
  margin: 0;
  color: #d8dee8;
}

.validation-metrics {
  display: grid;
  gap: 0.6rem;
}

.validation-metrics b {
  display: block;
  padding: 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 5px solid var(--red);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 1.35rem;
}

.validation-metrics small {
  display: block;
  margin-top: 0.18rem;
}

.validation-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 1rem 0;
}

.validation-takeaways {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.validation-takeaways article {
  padding: 1rem;
  border: 1px solid var(--line);
  border-top: 5px solid var(--red);
  border-radius: 6px;
  background: var(--panel);
}

.validation-takeaways span {
  color: var(--red);
  font-weight: 900;
}

.validation-takeaways p {
  margin: 0;
  color: var(--muted);
}

@keyframes lineDraw {
  from {
    stroke-dashoffset: 4000;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@media (max-width: 900px) {
  .grouped-row,
  .horizon-row,
  .validation-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .ecosystem-flow,
  .ecosystem-classes,
  .luxfer-facts,
  .validation-grid,
  .validation-takeaways {
    grid-template-columns: minmax(0, 1fr);
  }

  .ecosystem-flow button:not(:last-child)::after {
    content: "";
  }
}

@media (prefers-reduced-motion: reduce) {
  .drawn-line,
  .drawn-point,
  .workflow-route::before,
  .workflow-route-dot,
  .grouped-bars i,
  .horizon-bar i {
    animation: none !important;
    opacity: 1;
    stroke-dashoffset: 0;
    transform: none;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

  .topbar {
    width: 100%;
    max-width: 100vw;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    overflow: hidden;
  }

  .topbar > * {
    min-width: 0;
    max-width: 100%;
  }

  .topbar > div:first-child {
    width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
  }

  .topbar-side {
    width: 100%;
    min-width: 0;
    align-items: stretch;
  }

  .tesla-logo {
    align-self: flex-start;
  }

  .tesla-logo img {
    width: 3.1rem;
  }

  .market-widget {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .market-widget a {
    text-align: left;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  h1,
  h2,
  h3,
  .lede {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .lede {
    display: none;
  }

  h1 {
    font-size: clamp(1.6rem, 8vw, 2.15rem);
  }

  .tabbar {
    max-width: 100vw;
  }
}

/* Readability and overlap correction pass */
html,
body {
  max-width: 100%;
}

main {
  max-width: 100vw;
  overflow-x: hidden;
}

.topbar {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 520px);
  align-items: start;
}

.topbar h1 {
  max-width: 900px;
}

.topbar-side {
  min-width: 0;
  width: 100%;
}

.tabbar {
  scroll-padding-inline: clamp(1rem, 4vw, 3rem);
  scrollbar-width: none;
}

.tabbar::-webkit-scrollbar {
  display: none;
}

.tabbar button {
  flex: 0 0 auto;
}

.section-head {
  align-items: start;
}

.hero-shell,
.forecast-stage,
.workflow-board,
.figure-card,
.workflow-graph-card,
.validation-hero {
  min-width: 0;
}

.chart-card,
.figure-card,
.viz-panel,
.forecast-explain-card,
.forecast-case-card,
.model-panel,
.story-card,
.metric-card,
.rail-step,
.source-card,
.validation-takeaways article {
  overflow: hidden;
}

.drawn-chart {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.figure-card > .drawn-chart {
  min-height: 340px;
}

.drawn-chart .drawn-chart {
  min-height: 0;
  padding: 0.75rem;
  border-radius: 5px;
  box-shadow: none;
}

.drawn-line-chart svg {
  display: block;
  width: 100%;
  min-height: 300px;
}

.drawn-axis-label,
.drawn-tick,
.live-chart text {
  paint-order: stroke;
  stroke: var(--bg);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.drawn-selection {
  width: 100%;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.drawn-bar-row {
  grid-template-columns: minmax(150px, 0.32fr) minmax(90px, 1fr) minmax(82px, auto);
}

.drawn-bar-row span,
.driver-row span,
.horizon-bar span,
.grouped-bars span,
.policy-label-title,
.policy-label-note {
  overflow-wrap: anywhere;
}

.scenario-drawn-card strong,
.drawn-metric-tile strong,
.ecosystem-flow strong,
.ecosystem-classes strong,
.luxfer-facts strong,
.metric-card strong,
.model-hero strong,
.forecast-case-card strong {
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.workflow-nodes {
  align-items: stretch;
}

.flow-node {
  min-height: 128px;
  overflow: hidden;
}

.workflow-step-grid,
.step-grid {
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.model-panel-grid {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.metric-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.story-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.chart-grid {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.source-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.figure-card {
  grid-template-columns: minmax(210px, 0.24fr) minmax(0, 1fr);
}

.figure-meta {
  justify-content: start;
  padding-top: 0.35rem;
}

.forecast-detail-grid,
.validation-grid,
.viz-grid {
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}

.driver-card {
  grid-template-columns: minmax(170px, 0.32fr) minmax(0, 1fr);
}

.driver-row {
  grid-template-columns: minmax(78px, 0.22fr) minmax(80px, 1fr) minmax(76px, auto);
}

.workflow-graph-stages {
  align-items: stretch;
}

.workflow-graph-stage {
  min-height: 150px;
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar-side {
    align-items: flex-start;
  }

  .market-widget {
    width: min(100%, 620px);
  }

  .workflow-board,
  .forecast-stage,
  .figure-card,
  .workflow-graph-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .workflow-map-remake .workflow-nodes,
  .workflow-nodes,
  .workflow-graph-stages {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .workflow-route {
    display: none;
  }

  .flow-node {
    transform: none;
  }

  .flow-node.is-active {
    transform: translateY(-3px);
  }
}

@media (max-width: 760px) {
  main {
    padding-inline: 1rem;
  }

  .section-head {
    display: block;
  }

  .hero-shell,
  .forecast-stage,
  .workflow-board,
  .forecast-detail-grid,
  .viz-grid,
  .validation-grid,
  .figure-card,
  .workflow-graph-card,
  .model-flow,
  .model-hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-copy h2 {
    font-size: clamp(2rem, 11vw, 3.1rem);
  }

  .console-grid,
  .forecast-case-grid,
  .forecast-case-metrics,
  .mini-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .model-flow {
    gap: 0.45rem;
  }

  .flow-arrow {
    width: 2px;
    height: 22px;
    justify-self: center;
  }

  .flow-arrow::after {
    top: auto;
    right: -4px;
    bottom: -4px;
    border-top: 8px solid var(--red);
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 0;
  }

  .workflow-map-remake {
    min-height: 0;
  }

  .workflow-map-remake .workflow-nodes {
    padding-top: 0;
  }

  .flow-node,
  .rail-step,
  .workflow-graph-stage {
    min-height: auto;
  }

  .drawn-chart {
    padding: 0.75rem;
  }

  .figure-card > .drawn-chart,
  .drawn-line-chart svg {
    min-height: 250px;
  }

  .drawn-tick {
    font-size: 11px;
  }

  .drawn-axis-label {
    font-size: 11px;
  }

  .drawn-bar-row,
  .driver-card,
  .driver-row,
  .horizon-bar,
  .grouped-row,
  .grouped-bars button {
    grid-template-columns: minmax(0, 1fr);
  }

  .drawn-bar-row i,
  .driver-row i,
  .horizon-bar i,
  .grouped-bars i {
    min-width: 3rem;
  }

  .driver-row b {
    text-align: left;
  }

  .ecosystem-flow,
  .ecosystem-classes,
  .luxfer-facts,
  .scenario-drawn-cards,
  .validation-takeaways {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-wrap {
    max-width: calc(100vw - 2rem);
  }
}

@media (max-width: 430px) {
  .topbar {
    padding-inline: 1rem;
  }

  .topbar > div:first-child {
    width: calc(100vw - 2rem);
    max-width: calc(100vw - 2rem);
  }

  .market-widget,
  .quote-tile,
  .topbar-actions a {
    min-width: 0;
  }

  .tabbar {
    padding-inline: 1rem;
  }

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

/* Deck 4 contribution cross-check */
.contribution-chart {
  display: grid;
  gap: 0.85rem;
}

.contribution-summary {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-left: 6px solid var(--red);
  border-radius: 6px;
  background: var(--panel);
}

.contribution-summary span {
  display: block;
  color: var(--red);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.contribution-summary strong {
  display: block;
  margin: 0.2rem 0;
  font-size: clamp(1.65rem, 3vw, 2.65rem);
  line-height: 1;
}

.contribution-summary p {
  margin: 0;
  color: var(--muted);
}

.contribution-rows {
  display: grid;
  gap: 0.7rem;
}

.contribution-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.18fr) minmax(0, 1fr) minmax(92px, auto);
  gap: 0.65rem;
  align-items: center;
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.contribution-row.is-active {
  border-color: rgba(255, 43, 48, 0.55);
  background: rgba(255, 43, 48, 0.08);
}

.contribution-row h4,
.contribution-row small {
  margin: 0;
}

.contribution-row h4 {
  color: var(--ink);
  font-size: 0.95rem;
}

.contribution-row small {
  color: var(--muted);
  font-weight: 850;
}

.contribution-bars {
  display: grid;
  gap: 0.38rem;
}

.contribution-bar {
  display: grid;
  grid-template-columns: minmax(125px, 0.24fr) minmax(70px, 1fr) minmax(78px, auto);
  gap: 0.55rem;
  align-items: center;
  width: 100%;
  padding: 0.46rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--ink);
  text-align: left;
}

.contribution-bar i {
  display: block;
  height: 0.92rem;
  border-radius: 0;
  background: #9aa1ac;
  transform: scaleX(1);
  transform-origin: left center;
  animation: fillAcross 780ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 95ms);
}

.contribution-bar.crosscheck i,
.contribution-row.is-active .contribution-bar.crosscheck i,
.contribution-bar:hover i,
.contribution-bar:focus i,
.contribution-bar.is-focused i {
  background: var(--red);
}

.contribution-bar:hover,
.contribution-bar:focus,
.contribution-bar.is-focused {
  border-color: var(--red);
  background: var(--panel);
}

@media (prefers-reduced-motion: reduce) {
  .contribution-bar i {
    animation: none !important;
    transform: none;
  }
}

@media (max-width: 760px) {
  .contribution-row,
  .contribution-bar {
    grid-template-columns: minmax(0, 1fr);
  }

  .contribution-row small {
    text-align: left;
  }
}




/* ============================================================
   New interactive components (what-if, risks, window, nav, team)
   ============================================================ */

/* Project team credit strip on the intro */
.team-strip {
  margin-top: 1.6rem;
  padding: 1rem 1.2rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  border-left: 4px solid var(--red);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.4rem;
}
.team-strip > span {
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--red);
}
.team-strip ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
}
.team-strip li {
  font-size: 0.85rem;
  color: var(--ink);
  position: relative;
  padding-left: 0.85rem;
}
.team-strip li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--red);
  transform: translateY(-50%);
}

/* ---- Live what-if sensitivity widget ---- */
.whatif {
  margin: 1.2rem 0;
  padding: 1.25rem 1.4rem 1.4rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  border-top: 4px solid var(--red);
}
.whatif-head h3 {
  margin: 0.2rem 0 0.35rem;
  font-size: 1.2rem;
}
.whatif-head p {
  margin: 0;
  color: var(--muted);
  max-width: 62ch;
  font-size: 0.92rem;
}
.whatif-body {
  margin-top: 1.1rem;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 1.4rem;
  align-items: center;
}
.whatif-levers {
  display: grid;
  gap: 1.1rem;
}
.whatif-lever span {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.84rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.whatif-lever span b {
  font-size: 1.05rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.whatif-lever small {
  display: flex;
  justify-content: space-between;
  font-size: 0.66rem;
  color: var(--steel);
  margin-top: 0.25rem;
}
.whatif-lever input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red) 0 50%, var(--panel-2) 50% 100%);
  background: var(--panel-2);
  outline: none;
}
.whatif-lever input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.whatif-lever input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.whatif-lever input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  background: var(--red);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(14, 14, 18, 0.25);
  cursor: pointer;
  transition: transform 120ms ease;
}
.whatif-lever input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--red);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(14, 14, 18, 0.25);
  cursor: pointer;
}
.whatif-lever input[type="range"]:active::-webkit-slider-thumb {
  transform: scale(1.12);
}
.whatif-readout {
  background: var(--dark);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  color: #eef0f3;
}
.whatif-out {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.whatif-out span {
  font-size: 0.82rem;
  color: #aab0bb;
}
.whatif-out strong {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}
.whatif-out.whatif-oi {
  border-bottom: 0;
  padding-top: 0.6rem;
}
.whatif-out.whatif-oi span {
  color: #fff;
  font-weight: 600;
}
.whatif-out.whatif-oi strong {
  font-size: 1.7rem;
  color: #fff;
}
.whatif-out.whatif-oi strong.is-neg {
  color: #ff6b6b;
}
.whatif-bar {
  position: relative;
  height: 8px;
  margin: 0.7rem 0 0.5rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: visible;
}
.whatif-bar i {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--red);
  transition: width 180ms ease;
}
.whatif-bar i.is-neg {
  background: #ff6b6b;
}
.whatif-bar u {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 14px;
  background: var(--panel);
  opacity: 0.7;
}
.whatif-vs {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: #aab0bb;
}
.whatif-vs b.pos { color: #6bd58c; }
.whatif-vs b.neg { color: #ff6b6b; }

/* ---- Forecast risk cards ---- */
.risk-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
}
.risk-card {
  padding: 1rem 1.1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  border-left: 4px solid var(--steel);
  transition: transform 180ms ease, box-shadow 180ms ease;
}
.risk-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(14, 14, 18, 0.08);
}
.risk-card.accent-red { border-left-color: var(--red); }
.risk-card.accent-graph { border-left-color: var(--graph); }
.risk-card.accent-steel { border-left-color: var(--steel); }
.risk-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}
.risk-card header strong {
  font-size: 1rem;
  line-height: 1.25;
}
.risk-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.risk-tag {
  flex: none;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--panel-2);
  color: var(--graph);
}
.risk-tag.dir-down { background: #fdecec; color: var(--red-dk); }
.risk-tag.dir-up { background: #eaf3ec; color: var(--green); }
.risk-tag.dir-swing { background: #f3eee3; color: var(--gold); }

/* Musk compensation callout (dark) */
.comp-callout {
  margin-top: 0.9rem;
  padding: 1.15rem 1.3rem;
  background: var(--dark);
  border-radius: 6px;
  border-left: 4px solid var(--red);
  color: #d8dbe2;
}
.comp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 0.9rem;
  margin-bottom: 0.5rem;
}
.comp-head span {
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--red);
}
.comp-head strong { color: #fff; font-size: 1.05rem; }
.comp-head em { color: #aab0bb; font-style: normal; font-size: 0.82rem; }
.comp-callout p { margin: 0.3rem 0 0; font-size: 0.9rem; }
.comp-effect { color: #eef0f3; }
.comp-effect b { color: #fff; }

/* ---- Window comparison (Tesla vs Luxfer) ---- */
.wc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
}
.wc-legend {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 0.8rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.wc-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 0.35rem;
  vertical-align: -1px;
}
.wc-legend i.long { background: var(--graph); }
.wc-legend i.short { background: var(--steel); }
.wc-chart {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 1rem;
  height: 240px;
  padding-top: 1.4rem;
  border-bottom: 1px solid var(--line);
}
.wc-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
  justify-content: flex-end;
  flex: 1;
}
.wc-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  height: 100%;
}
.wc-bar {
  position: relative;
  width: 46px;
  height: var(--h);
  border-radius: 4px 4px 0 0;
  animation: wcRise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.wc-bar.long { background: var(--graph); }
.wc-bar.short { background: var(--steel); }
.wc-bar b {
  position: absolute;
  top: -1.3rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.74rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
@keyframes wcRise {
  from { height: 0; }
}
.wc-label {
  font-weight: 700;
  font-size: 0.92rem;
}
.wc-why {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}
.wc-why article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.8rem 1rem;
  border-left: 4px solid var(--graph);
}
.wc-why article:first-child { border-left-color: var(--steel); }
.wc-why h4 {
  margin: 0 0 0.3rem;
  font-size: 0.95rem;
}
.wc-why p { margin: 0; color: var(--muted); font-size: 0.86rem; }
.wc-verdict {
  background: var(--dark);
  color: #fff;
  border-radius: 6px;
  padding: 0.85rem 1.1rem;
}
.wc-verdict span {
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--red);
  display: block;
  margin-bottom: 0.2rem;
}
.wc-verdict strong { font-size: 1.02rem; }

/* ---- Section prev/next navigation + progress ---- */
.section-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.4rem 0 0.5rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line);
}
.section-nav-spacer { flex: 1; }
.section-nav-btn {
  flex: 1;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.7rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: left;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.section-nav-btn.next { text-align: right; align-items: flex-end; }
.section-nav-btn:hover {
  border-color: var(--red);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(14, 14, 18, 0.08);
}
.section-nav-btn span {
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
}
.section-nav-btn strong { font-size: 1rem; color: var(--ink); }
.section-progress {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}
.section-progress .dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--line);
  cursor: pointer;
  transition: width 200ms ease, background 200ms ease;
}
.section-progress .dot:hover { background: var(--steel); }
.section-progress .dot.is-active {
  width: 26px;
  background: var(--red);
}

@media (max-width: 760px) {
  .whatif-body { grid-template-columns: 1fr; }
  .risk-grid,
  .wc-grid { grid-template-columns: 1fr; }
  .wc-chart { height: 200px; }
  .section-nav-btn strong { font-size: 0.85rem; }
}

/* ============================================================
   Animated workflow pipeline (dark)
   ============================================================ */
.flowpipe {
  position: relative;
  margin: 1rem 0 1.4rem;
  padding: 1.6rem 1.4rem 1.5rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.flowpipe::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: 0.75;
}
.flowpipe-rail {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}
.fp-io {
  flex: none;
  width: 88px;
  margin-top: 1.9rem;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.35;
  text-align: center;
}
.fp-io b {
  display: block;
  color: var(--red);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  margin-bottom: 0.2rem;
}
.fp-io.in { text-align: right; }
.fp-io.out { text-align: left; }
.fp-track {
  position: relative;
  flex: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2.7rem 0.8rem 0.4rem;
}
.fp-wire {
  position: absolute;
  top: 3.05rem;
  left: 1.6rem;
  right: 1.6rem;
  height: 3px;
  background: var(--line);
  border-radius: 999px;
}
.fp-wire-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red-dk), var(--red));
  box-shadow: 0 0 12px rgba(255, 43, 48, 0.65);
  transition: width 0.6s cubic-bezier(0.4, 0.8, 0.3, 1);
}
.fp-pulse {
  display: none; /* hidden — traveling pulses created visual noise; .fp-wire-fill already shows progress */
}
.fp-pulse:nth-child(2) { animation-delay: 0s; }
.fp-pulse:nth-child(3) { animation-delay: 0.8s; }
.fp-pulse:nth-child(4) { animation-delay: 1.6s; }
.fp-pulse:nth-child(5) { animation-delay: 2.4s; }
@keyframes fpPulse {
  0% { left: -1%; opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { left: 101%; opacity: 0; }
}
.flowpipe.is-paused .fp-pulse { animation-play-state: paused; }
.fp-node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.32rem;
  width: 19%;
  padding: 0;
  border: 0;
  background: none;
  text-align: center;
  opacity: 0.5;
  cursor: pointer;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.fp-node.is-done { opacity: 0.82; }
.fp-node.is-active { opacity: 1; transform: translateY(-3px); }
.fp-dot {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--panel-2);
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, transform 0.35s ease;
}
.fp-dot b {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--muted);
  transition: color 0.35s ease;
}
.fp-node.is-done .fp-dot { border-color: var(--red-dk); }
.fp-node.is-done .fp-dot b { color: var(--ink); }
.fp-node.is-active .fp-dot {
  background: var(--red);
  border-color: var(--red);
  transform: scale(1.16);
  box-shadow: 0 0 0 7px rgba(255, 43, 48, 0.16), 0 0 26px rgba(255, 43, 48, 0.6);
  animation: fpDotPulse 1.8s ease-in-out infinite;
}
.fp-node.is-active .fp-dot b { color: #fff; }
@keyframes fpDotPulse {
  0%, 100% { box-shadow: 0 0 0 7px rgba(255, 43, 48, 0.16), 0 0 22px rgba(255, 43, 48, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(255, 43, 48, 0.06), 0 0 34px rgba(255, 43, 48, 0.8); }
}
.fp-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}
.fp-metric { font-size: 0.66rem; color: var(--muted); }
.fp-countdown {
  position: absolute;
  bottom: -8px;
  left: 16%;
  right: 16%;
  height: 2px;
  border-radius: 2px;
  background: var(--red);
  transform-origin: left;
  transform: scaleX(0);
  opacity: 0;
}
.fp-node.is-active .fp-countdown { opacity: 1; }
@keyframes fpCount {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.flowpipe-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0 0.2rem;
}
.fp-play {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.05rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  transition: border-color 0.2s ease, transform 0.15s ease;
}
.fp-play:hover { border-color: var(--red); transform: translateY(-1px); }
.fp-play-icon { color: var(--red); font-size: 0.74rem; }
.fp-steps-indicator { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.fp-steps-indicator span { color: var(--red); font-weight: 800; }
.flowpipe-detail { margin-top: 1.3rem; display: grid; gap: 1rem; }
.fp-detail-head {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 4px solid var(--red);
  border-radius: 8px;
  padding: 1rem 1.2rem;
  animation: fpFade 0.5s ease both;
}
.fp-detail-metric {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.3rem;
}
.fp-detail-head h3 { margin: 0.1rem 0 0.4rem; font-size: 1.2rem; }
.fp-detail-head p { margin: 0; color: var(--muted); max-width: 76ch; }
.fp-steps-label {
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}
.fp-detail-steps { animation: fpFade 0.5s ease both; }
@keyframes fpFade {
  from { opacity: 0; transform: translateY(8px); }
}
@media (prefers-reduced-motion: reduce) {
  .fp-pulse, .fp-node.is-active .fp-dot, .fp-detail-head, .fp-detail-steps { animation: none; }
}
@media (max-width: 760px) {
  .fp-io { display: none; }
  .fp-track { padding: 2.4rem 0 0.4rem; }
  .fp-wire { left: 0.6rem; right: 0.6rem; }
  .fp-node { width: 19%; }
  .fp-dot { width: 38px; height: 38px; }
  .fp-dot b { font-size: 0.78rem; }
  .fp-name { font-size: 0.66rem; }
  .fp-metric { display: none; }
}

/* ============================================================
   Methods & math tab
   ============================================================ */
.stack-grid { grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.stack-card {
  display: flex; gap: .85rem; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: .9rem 1rem;
  transition: border-color .2s ease, transform .2s ease;
}
.stack-card:hover { border-color: var(--red); transform: translateY(-2px); }
.stack-ico {
  flex: none; width: 38px; height: 38px; border-radius: 9px;
  background: rgba(255,43,48,.12); display: grid; place-items: center;
}
.stack-ico svg { width: 20px; height: 20px; color: var(--red); }
.stack-card strong { font-size: .98rem; display: block; }
.stack-card p { margin: .2rem 0 0; font-size: .82rem; color: var(--muted); line-height: 1.45; }

.mstep-tabs { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 1rem; }
.mstep-tab {
  width: 40px; height: 40px; border-radius: 9px; flex: none;
  background: var(--panel); border: 1px solid var(--line); color: var(--muted);
  font-weight: 800; font-size: 1rem; cursor: pointer;
  transition: all .2s ease;
}
.mstep-tab:hover { border-color: var(--steel); color: var(--ink); }
.mstep-tab.is-active {
  background: var(--red); border-color: var(--red); color: #fff;
  box-shadow: 0 0 0 5px rgba(255,43,48,.14);
}
.mstep-body {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; border-top: 4px solid var(--red);
  padding: 1.3rem 1.4rem;
}
.mstep-head { display: flex; align-items: baseline; gap: .8rem; }
.mstep-num {
  font-size: .68rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--red); background: rgba(255,43,48,.12); padding: .25rem .55rem; border-radius: 6px;
}
.mstep-head h3 { margin: 0; font-size: 1.25rem; }
.mstep-what { color: var(--muted); margin: .6rem 0 1.1rem; max-width: 80ch; }
.mstep-cols { display: grid; grid-template-columns: .9fr 1.1fr; gap: 1rem; align-items: start; }
.mstep-formula span, .mstep-nums + * { }
.mstep-formula > span {
  display: block; font-size: .66rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-bottom: .4rem;
}
.mstep-formula code {
  display: block; white-space: pre-wrap; background: var(--dark); color: #e7e9ee;
  border-radius: 8px; padding: .8rem 1rem; font-size: .86rem; line-height: 1.5;
  border: 1px solid var(--line);
}
.mstep-nums { margin-top: 1rem; }
.mstep-num-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: .5rem .2rem; border-bottom: 1px solid var(--line);
}
.mstep-num-row:last-child { border-bottom: 0; }
.mstep-num-row span { font-size: .85rem; color: var(--muted); }
.mstep-num-row b { font-size: 1rem; font-variant-numeric: tabular-nums; }

.code-panel {
  background: var(--dark); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; margin-top: .4rem;
}
.code-panel.inline { margin-top: 0; }
.code-head {
  display: flex; align-items: center; gap: .4rem;
  padding: .55rem .9rem; border-bottom: 1px solid rgba(255,255,255,.07);
  background: rgba(255,255,255,.02);
}
.code-dot { width: 10px; height: 10px; border-radius: 50%; background: #3a3f48; }
.code-dot:first-child { background: var(--red); }
.code-head em {
  margin-left: auto; font-style: normal; font-size: .74rem;
  color: var(--steel); font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.code-panel pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; }
.code-panel code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: .8rem; line-height: 1.6; color: #d7dbe2; white-space: pre;
}

.methods-grid { grid-template-columns: 1.25fr .75fr; gap: .9rem; align-items: start; }
.mranking { display: grid; gap: .5rem; margin-top: .3rem; }
.mrank-row {
  display: grid; grid-template-columns: 116px 1fr 52px auto; gap: .6rem; align-items: center;
}
.mrank-name { font-size: .82rem; font-weight: 600; }
.mrank-track { height: 18px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.mrank-bar { display: block; height: 100%; border-radius: 5px; background: var(--steel); }
.mrank-bar.good { background: var(--red); }
.mrank-bar.base { background: var(--gold); }
.mrank-bar.bad { background: #4a4f59; }
.mrank-val { font-size: .82rem; font-variant-numeric: tabular-nums; text-align: right; font-weight: 700; }
.mrank-verdict { font-size: .72rem; }
.mrank-verdict.good { color: var(--red); font-weight: 700; }
.mrank-verdict.base { color: var(--gold); }
.mrank-verdict.bad { color: var(--muted); }
.mranking-note { margin: .9rem 0 0; font-size: .8rem; color: var(--muted); line-height: 1.5; }

.methods-side { display: grid; gap: .8rem; align-content: start; }
.method-primary {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--red); border-radius: 8px; padding: 1rem 1.1rem;
}
.method-primary > span, .method-cross > span {
  font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--red);
}
.method-primary strong { display: block; font-size: 1.05rem; margin: .25rem 0 .35rem; }
.method-primary p { margin: 0 0 .6rem; font-size: .85rem; color: var(--muted); }
.formula-chip {
  display: block; white-space: pre-wrap; background: var(--dark); color: #e7e9ee;
  border-radius: 7px; padding: .55rem .7rem; font-size: .78rem; line-height: 1.5;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.method-cross {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem;
}
.method-cross ul { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .45rem; }
.method-cross li { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; font-size: .85rem; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.method-cross li:last-child { border-bottom: 0; }
.method-cross li i { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ============================================================
   Requirements tab
   ============================================================ */
.req-progress { display: flex; align-items: center; gap: 1rem; margin: 0 0 1.2rem; }
.req-progress-bar { flex: 1; height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; max-width: 360px; }
.req-progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red-dk), var(--red)); border-radius: 999px; animation: barGrowSimple .9s ease both; }
.req-progress span { font-size: .85rem; color: var(--muted); font-weight: 600; }
@keyframes barGrowSimple { from { width: 0 !important; } }

.req-list { display: grid; gap: .7rem; }
.req-row {
  display: flex; gap: 1rem; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--steel); border-radius: 8px; padding: .95rem 1.1rem;
  transition: transform .2s ease, box-shadow .2s ease;
}
.req-row:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(0,0,0,.35); }
.req-row.status-done { border-left-color: var(--red); }
.req-row.status-adapted { border-left-color: var(--gold); }
.req-n {
  flex: none; width: 34px; height: 34px; border-radius: 8px;
  background: var(--panel-2); display: grid; place-items: center;
  font-weight: 800; font-size: 1rem; color: var(--ink);
}
.req-row.status-done .req-n { background: rgba(255,43,48,.14); color: var(--red); }
.req-main { flex: 1; }
.req-top { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.req-top strong { font-size: 1rem; }
.req-badge {
  font-size: .64rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  padding: .2rem .55rem; border-radius: 999px;
}
.req-badge.done { background: rgba(255,43,48,.14); color: var(--red); }
.req-badge.adapted { background: rgba(155,161,172,.16); color: var(--gold); }
.req-badge.partial { background: var(--panel-2); color: var(--muted); }
.req-note { margin: .4rem 0 .4rem; font-size: .86rem; color: var(--muted); line-height: 1.5; }
.req-loc { margin: 0; font-size: .76rem; color: var(--steel); display: flex; align-items: center; gap: .35rem; }
.req-loc svg { width: 14px; height: 14px; }

.req-rule {
  display: flex; gap: 1rem; align-items: flex-start; margin: 1.1rem 0;
  background: var(--dark); border-radius: 10px; border-left: 4px solid var(--red);
  padding: 1.1rem 1.3rem; color: #d8dbe2;
}
.req-rule-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; background: rgba(255,43,48,.16); display: grid; place-items: center; }
.req-rule-ico svg { width: 22px; height: 22px; color: var(--red); }
.req-rule strong { color: #fff; font-size: 1.02rem; }
.req-rule p { margin: .25rem 0 0; font-size: .88rem; }

.req-extra-grid { grid-template-columns: 1fr 1fr; gap: .9rem; }
.req-chips { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .45rem; }
.req-chips li { display: flex; align-items: flex-start; gap: .5rem; font-size: .86rem; color: var(--ink); }
.req-chips svg { width: 15px; height: 15px; flex: none; margin-top: .15rem; color: var(--red); }
.req-chips.accent svg { color: var(--steel); }

@media (max-width: 760px) {
  .stack-grid, .mstep-cols, .methods-grid, .req-extra-grid { grid-template-columns: 1fr; }
  .mrank-row { grid-template-columns: 90px 1fr 44px; }
  .mrank-verdict { display: none; }
}

/* ============================================================
   Data & sources tab (Excel-style)
   ============================================================ */
.sheet-shell {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden;
}
.sheet-tabs {
  display: flex; gap: 2px; overflow-x: auto; padding: .5rem .5rem 0;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}
.sheet-tab {
  flex: none; padding: .55rem .85rem; border: 1px solid transparent; border-bottom: 0;
  border-radius: 7px 7px 0 0; background: transparent; color: var(--muted);
  font-size: .8rem; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.sheet-tab:hover { color: var(--ink); background: rgba(255,255,255,.03); }
.sheet-tab.is-active {
  background: var(--panel); color: var(--ink);
  border-color: var(--line); border-bottom: 1px solid var(--panel);
  margin-bottom: -1px; box-shadow: 0 -2px 0 var(--red) inset;
}
.sheet-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem .9rem; border-bottom: 1px solid var(--line);
}
.sheet-search {
  display: flex; align-items: center; gap: .5rem; flex: 1; max-width: 360px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: .4rem .7rem;
}
.sheet-search svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.sheet-search input {
  flex: 1; border: 0; background: none; color: var(--ink); font-size: .86rem; outline: none;
}
.sheet-search input::placeholder { color: var(--steel); }
.sheet-count { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sheet-view { padding: 1.1rem 1.2rem 1.3rem; }
.sheet-head { margin-bottom: .9rem; }
.sheet-head h3 { margin: 0 0 .25rem; font-size: 1.15rem; }
.sheet-head p { margin: 0; font-size: .84rem; color: var(--muted); }
.sheet-scroll { overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.data-table thead th {
  position: sticky; top: 0; text-align: left; padding: .55rem .7rem;
  font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700;
  color: var(--muted); border-bottom: 1.5px solid var(--line); background: var(--panel);
  white-space: nowrap;
}
.data-table th.num, .data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tbody th[scope="row"] { text-align: left; font-weight: 600; color: var(--ink); padding: .5rem .7rem; }
.data-table tbody td { padding: .5rem .7rem; color: var(--ink); border-bottom: 1px solid var(--line); }
.data-table tbody th[scope="row"] { border-bottom: 1px solid var(--line); }
.data-table tbody tr:nth-child(even) td,
.data-table tbody tr:nth-child(even) th[scope="row"] { background: rgba(255,255,255,.018); }
.data-table tbody tr:hover td,
.data-table tbody tr:hover th[scope="row"] { background: rgba(255,43,48,.06); }
.data-table tr.is-total td, .data-table tr.is-total th[scope="row"] {
  font-weight: 800; color: #fff; border-top: 1.5px solid rgba(255,43,48,.4);
}
.data-table tr.is-total td.num { color: var(--red); }

.source-table th, .source-table td { vertical-align: top; }
.src-id { font-weight: 800; color: var(--red); white-space: nowrap; font-size: .78rem; }
.src-name { font-weight: 600; max-width: 240px; }
.src-what { color: var(--muted); font-size: .82rem; max-width: 320px; }
.src-link a {
  display: inline-flex; align-items: center; gap: .3rem; color: var(--red);
  text-decoration: none; font-size: .8rem; white-space: nowrap;
}
.src-link a:hover { text-decoration: underline; }
.src-link svg { width: 13px; height: 13px; }
.src-nolink { color: var(--steel); font-size: .8rem; font-style: italic; }
.th-link { text-align: left; }

/* ============================================================
   Interactive code explorer (Methods tab)
   ============================================================ */
.code-explorer {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; border-top: 4px solid var(--red); overflow: hidden;
}
.cx-series { padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.cx-series-label { font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--muted); }
.cx-series-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.cx-pt {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: .3rem .5rem; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.cx-pt b { color: var(--ink); font-size: .72rem; }
.cx-pt.last { border-color: var(--red); }
.cx-pt.last b { color: var(--red); }
.cx-tabs { display: flex; gap: .4rem; flex-wrap: wrap; padding: .8rem 1.1rem 0; }
.cx-tab {
  padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel-2); color: var(--muted); font-size: .8rem; font-weight: 600; cursor: pointer;
  transition: all .18s ease;
}
.cx-tab:hover { color: var(--ink); border-color: var(--steel); }
.cx-tab.is-active { background: var(--red); border-color: var(--red); color: #fff; }
.cx-main { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1rem; padding: 1rem 1.1rem 1.2rem; align-items: start; }
.cx-main .code-panel { margin: 0; }
.cx-main .code-panel pre { min-height: 168px; }
.cx-run { display: flex; flex-direction: column; gap: .75rem; }
.cx-desc { margin: 0; font-size: .86rem; color: var(--muted); line-height: 1.5; }
.cx-run-btn {
  display: inline-flex; align-items: center; gap: .45rem; align-self: flex-start;
  background: var(--red); color: #fff; border: 0; border-radius: 8px;
  padding: .55rem .9rem; font-size: .8rem; font-weight: 700; cursor: pointer;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  transition: transform .15s ease, box-shadow .15s ease;
}
.cx-run-btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(255,43,48,.32); }
.cx-run-btn code { background: rgba(0,0,0,.22); padding: 0 .3rem; border-radius: 4px; color: #fff; }
.cx-play { font-size: .7rem; }
.cx-output { background: var(--dark); border-radius: 8px; padding: .9rem 1rem; border: 1px solid var(--line); }
.cx-out-line { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.cx-out-line span { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; color: var(--steel); }
.cx-out-line strong { font-size: 1.6rem; color: #fff; font-variant-numeric: tabular-nums; transition: color .2s ease; }
.code-explorer.has-run .cx-out-line strong { color: #6bd58c; }
.cx-out-bar { position: relative; height: 8px; margin: .7rem 0 .55rem; border-radius: 999px; background: rgba(255,255,255,.1); overflow: visible; }
.cx-out-bar i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--red); }
.cx-out-bar u { position: absolute; top: -3px; width: 2px; height: 14px; background: #fff; opacity: .65; left: 0; }
@keyframes cxBar { from { width: 0; } }
.cx-note { margin: 0; font-size: .78rem; color: #aab0bb; line-height: 1.45; }

@media (max-width: 760px) {
  .cx-main { grid-template-columns: 1fr; }
  .data-table { font-size: .8rem; }
  .src-name, .src-what { max-width: none; }
}

/* ============================================================
   Graphs tab — category tabs, figure layout, insights
   ============================================================ */
.graph-cat-tabs {
  display: flex; gap: .5rem; flex-wrap: wrap; margin: 0 0 1.3rem;
  position: sticky; top: 0; z-index: 5;
  padding: .6rem 0; background: linear-gradient(var(--bg) 70%, transparent);
}
.graph-cat {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .5rem .95rem; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--muted); font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: all .18s ease;
}
.graph-cat:hover { color: var(--ink); border-color: var(--steel); transform: translateY(-1px); }
.graph-cat.is-active { background: var(--red); border-color: var(--red); color: #fff; }
.graph-cat span {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 .35rem;
  border-radius: 999px; background: var(--panel-2); color: var(--muted);
  font-size: .72rem; font-weight: 800;
}
.graph-cat.is-active span { background: rgba(0,0,0,.22); color: #fff; }

/* Figure card: meta header, then chart + insight side by side */
.figure-section { margin-top: 1.4rem; }
.figure-list { display: grid; gap: 1.1rem; grid-template-columns: 1fr; }
.figure-card {
  display: block;
  padding: 1.15rem 1.2rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
}
.figure-meta {
  display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap;
  padding-bottom: .8rem; margin-bottom: 1rem; border-bottom: 1px solid var(--line);
}
.figure-meta span {
  font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--red); background: rgba(255,43,48,.12); padding: .22rem .5rem; border-radius: 6px;
}
.figure-meta h3 { margin: 0; font-size: 1.12rem; flex: 1 1 auto; }
.figure-meta p { margin: 0; font-size: .76rem; color: var(--steel); width: 100%; }
.figure-body {
  display: grid; grid-template-columns: 1.25fr .75fr; gap: 1.3rem; align-items: start;
}
.figure-chart { min-width: 0; }
.figure-insight {
  background: var(--panel-2); border: 1px solid var(--line);
  border-left: 4px solid var(--red); border-radius: 8px; padding: 1rem 1.1rem;
  align-self: stretch;
}
.figure-insight-head { margin-bottom: .55rem; }
.figure-insight-head strong { display: block; font-size: 1rem; line-height: 1.3; color: var(--ink); }
.figure-stat {
  display: inline-block; margin-top: .4rem; font-size: .72rem; font-weight: 700;
  color: var(--red); background: rgba(255,43,48,.1); padding: .25rem .55rem; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.figure-insight p { margin: 0; font-size: .85rem; color: var(--muted); line-height: 1.55; }

/* Clearer readout when a point/bar/tile is clicked */
.drawn-selection {
  min-height: 1px;
  transition: border-color .25s ease, background .25s ease;
}
.sel-hint {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  line-height: 1.5;
}
.drawn-selection.has-selection {
  display: flex; align-items: flex-start; gap: .65rem;
  background: var(--dark); border-left-color: var(--red);
}
.drawn-selection.just-changed { animation: selFlash .4s ease; }
@keyframes selFlash {
  0% { box-shadow: 0 0 0 0 rgba(255,43,48,.45); }
  100% { box-shadow: 0 0 0 8px rgba(255,43,48,0); }
}
.sel-tag {
  flex: none; margin-top: 1px;
  font-size: .6rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: var(--red); padding: .22rem .5rem; border-radius: 5px;
}
.sel-box { display: flex; flex-direction: column; gap: .25rem; }
.sel-title { font-size: .9rem; color: #fff; font-weight: 700; }
.sel-desc { font-size: .82rem; color: #cdd2da; line-height: 1.5; }

@media (max-width: 820px) {
  .figure-body { grid-template-columns: 1fr; gap: .9rem; }
  .graph-cat-tabs { position: static; }
}

/* ============================================================
   WOW ANIMATION LAYER
   ============================================================ */

/* --- scroll progress bar --- */
#scroll-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 200; pointer-events: none;
  background: rgba(255,255,255,.04);
}
#scroll-progress i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--red-dk), var(--red), #ff6266);
  box-shadow: 0 0 12px rgba(255,43,48,.7);
  transition: width .12s linear;
}

/* --- ambient animated background (orbs + grid) --- */
#ambient-fx { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#ambient-fx .orb {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .16;
  background: radial-gradient(circle at 30% 30%, #ff2b30, transparent 70%);
  animation: orbFloat 22s ease-in-out infinite;
}
#ambient-fx .o1 { width: 520px; height: 520px; top: -160px; left: -120px; }
#ambient-fx .o2 { width: 440px; height: 440px; bottom: -160px; right: -100px; animation-delay: -7s; opacity: .12; }
#ambient-fx .o3 { width: 360px; height: 360px; top: 40%; left: 55%; animation-delay: -14s; opacity: .08; }
#ambient-fx .grid-veil {
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  animation: gridPan 40s linear infinite;
}
@keyframes orbFloat {
  0%,100% { transform: translate(0,0) scale(1); }
  33% { transform: translate(60px,40px) scale(1.12); }
  66% { transform: translate(-40px,30px) scale(.94); }
}
@keyframes gridPan { to { background-position: 46px 46px; } }
.app, .topbar, .tabbar, #scroll-progress { position: relative; z-index: 1; }

/* --- animated header gradient sweep --- */
.topbar { overflow: hidden; }
.topbar::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--red), #ff7a7d, var(--red), transparent);
  background-size: 200% 100%;
  animation: sweepX 3.4s linear infinite;
}
@keyframes sweepX { to { background-position: -200% 0; } }
.topbar h1 {
  background: linear-gradient(100deg, var(--ink) 0%, var(--ink) 40%, #ff5a5e 50%, var(--ink) 60%, var(--ink) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text;
  animation: titleSheen 6s ease-in-out infinite;
}
@keyframes titleSheen { 0%,100% { background-position: 120% 0; } 50% { background-position: -20% 0; } }

/* --- tab content crossfade on switch --- */
.tab-enter > * { animation: tabFade .5s ease both; }
.tab-enter > *:nth-child(1) { animation-delay: 0ms; }
.tab-enter > *:nth-child(2) { animation-delay: 50ms; }
.tab-enter > *:nth-child(3) { animation-delay: 100ms; }
.tab-enter > *:nth-child(4) { animation-delay: 150ms; }
.tab-enter > *:nth-child(5) { animation-delay: 200ms; }
.tab-enter > *:nth-child(n+6) { animation-delay: 240ms; }
@keyframes tabFade { from { opacity: 0; transform: translateY(14px); } }

/* --- richer reveal: base already exists; add scale + blur polish --- */
.reveal-up { transition: opacity .7s cubic-bezier(.2,.8,.2,1), transform .7s cubic-bezier(.2,.8,.2,1), filter .7s ease; }
.reveal-up:not(.is-visible) { filter: blur(2px); }
.reveal-up.is-visible { filter: none; }
.pop-in:not(.is-visible) { transform: translateY(20px) scale(.96); }
.pop-in.is-visible { animation: popIn .6s cubic-bezier(.34,1.56,.64,1) both; animation-delay: var(--delay,0ms); }
@keyframes popIn { 0% { opacity:0; transform: translateY(20px) scale(.94); } 60% { transform: translateY(-4px) scale(1.02); } 100% { opacity:1; transform: translateY(0) scale(1); } }

/* --- KPI / metric cards: tilt, glare, shimmer, spark --- */
.metric-card, .figure-card, .stack-card, .risk-card {
  transform: perspective(900px) rotateX(var(--rx,0)) rotateY(var(--ry,0));
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
  transform-style: preserve-3d; position: relative; overflow: hidden;
}
.metric-card::before, .stack-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(circle 120px at var(--gx,50%) var(--gy,50%), rgba(255,43,48,.18), transparent 60%);
  transition: opacity .3s ease;
}
.metric-card:hover, .stack-card:hover, .figure-card:hover, .risk-card:hover {
  box-shadow: 0 18px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(255,43,48,.25);
  border-color: rgba(255,43,48,.4);
}
.metric-card:hover::before, .stack-card:hover::before { opacity: 1; }
.metric-card strong { display: inline-block; }
.metric-spark {
  position: absolute; top: 14px; right: 14px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 0 rgba(255,43,48,.55);
  animation: sparkPulse 2.4s ease-out infinite; animation-delay: calc(var(--i,0) * .3s);
}
@keyframes sparkPulse {
  0% { box-shadow: 0 0 0 0 rgba(255,43,48,.5); opacity: 1; }
  70% { box-shadow: 0 0 0 12px rgba(255,43,48,0); opacity: .6; }
  100% { box-shadow: 0 0 0 0 rgba(255,43,48,0); opacity: 1; }
}
/* shimmer sweep across metric cards once revealed */
.metric-card.is-visible::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 50%; height: 100%; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.07), transparent);
  transform: skewX(-18deg); animation: shimmerSweep 4.5s ease-in-out infinite; animation-delay: calc(1s + var(--i,0)*.25s);
}
@keyframes shimmerSweep { 0% { left: -60%; } 35%,100% { left: 140%; } }

/* --- animated nav underline + hover --- */
.tabbar a, .tabbar button { position: relative; transition: color .2s ease; }
.tabbar a::after, .tabbar button::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--red); transform: scaleX(0); transform-origin: center;
  transition: transform .28s cubic-bezier(.2,.8,.2,1);
}
.tabbar a:hover::after, .tabbar button:hover::after,
.tabbar a.is-active::after, .tabbar button.is-active::after { transform: scaleX(1); }

/* --- button shine on primary actions --- */
.topbar-actions a, .topbar-actions button, .hero-actions a, .hero-actions button {
  position: relative; overflow: hidden;
}
.topbar-actions a::after, .topbar-actions button::after,
.hero-actions a::after, .hero-actions button::after {
  content: ""; position: absolute; top: 0; left: -120%; width: 60%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.25), transparent);
  transform: skewX(-20deg); transition: left .5s ease;
}
.topbar-actions a:hover::after, .topbar-actions button:hover::after,
.hero-actions a:hover::after, .hero-actions button:hover::after { left: 130%; }

/* --- the source→model→forecast nodes: gentle breathing + traveling spark already red --- */
.circuit-node circle { animation: nodeBreath 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.circuit-node.is-mid circle { animation-delay: .5s; }
.circuit-node:last-of-type circle { animation-delay: 1s; }
@keyframes nodeBreath { 0%,100% { filter: drop-shadow(0 0 0 rgba(255,43,48,.0)); } 50% { filter: drop-shadow(0 0 10px rgba(255,43,48,.6)); } }

/* --- stat chips & badges: subtle entrance pulse --- */
.figure-stat, .req-badge, .mstep-num, .fp-detail-metric { animation: chipIn .5s ease both; }
@keyframes chipIn { from { opacity:0; transform: scale(.8); } }

/* --- section headings: red kicker bar grows in --- */
.section-head .eyebrow { position: relative; }

/* --- reduced motion: kill the spectacle --- */
@media (prefers-reduced-motion: reduce) {
  #ambient-fx, .topbar::after, .topbar h1, .metric-spark,
  .metric-card.is-visible::after, .circuit-node circle { animation: none !important; }
  .topbar h1 { -webkit-text-fill-color: currentColor; color: var(--ink); }
  .tab-enter > * { animation: none !important; }
  .reveal-up:not(.is-visible) { filter: none; }
  .metric-card, .figure-card, .stack-card, .risk-card { transform: none !important; }
}

/* ============================================================
   Conclusion / findings tab
   ============================================================ */
.findings-grid { grid-template-columns: 1fr 1fr; gap: .9rem; }
.finding-card {
  display: flex; gap: .9rem; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 4px solid var(--red); border-radius: 10px; padding: 1.1rem 1.2rem;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.finding-card:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(0,0,0,.4); border-left-color: var(--red); }
.finding-ico { flex: none; width: 40px; height: 40px; border-radius: 10px; background: rgba(255,43,48,.12); display: grid; place-items: center; }
.finding-ico svg { width: 22px; height: 22px; color: var(--red); }
.finding-card strong { display: block; font-size: 1.02rem; margin-bottom: .3rem; }
.finding-card p { margin: 0; font-size: .86rem; color: var(--muted); line-height: 1.55; }

.fw-grid { grid-template-columns: 1.3fr .7fr; gap: .9rem; align-items: start; }
.fw-tests { display: grid; gap: .6rem; }
.fw-test {
  display: flex; gap: .8rem; align-items: flex-start;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .85rem 1rem;
}
.fw-num {
  flex: none; width: 28px; height: 28px; border-radius: 7px; background: rgba(255,43,48,.14);
  color: var(--red); font-weight: 800; display: grid; place-items: center; font-size: .9rem;
}
.fw-test strong { font-size: .95rem; }
.fw-test p { margin: .25rem 0 0; font-size: .83rem; color: var(--muted); line-height: 1.5; }
.fw-rule {
  display: flex; align-items: center; gap: .6rem;
  background: var(--dark); border-radius: 8px; border-left: 4px solid var(--red);
  padding: .85rem 1rem; color: #fff; font-weight: 600; font-size: .9rem;
}
.fw-rule svg { width: 20px; height: 20px; color: var(--red); flex: none; }
.fw-side { display: grid; gap: .8rem; align-content: start; }
.fw-target {
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--red);
  border-radius: 8px; padding: 1rem 1.1rem;
}
.fw-target span, .fw-anti span {
  font-size: .66rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--red);
}
.fw-target strong { display: block; margin-top: .35rem; font-size: 1.05rem; color: var(--ink); }
.fw-anti { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem; }
.fw-anti span { color: var(--gold); }
.fw-anti p { margin: .35rem 0 0; font-size: .84rem; color: var(--muted); line-height: 1.5; }

.integrity-grid { grid-template-columns: repeat(2, 1fr); gap: .55rem; }
.integrity-item {
  display: flex; align-items: center; gap: .7rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem;
  font-size: .9rem; color: var(--ink);
}
.integrity-item svg {
  width: 20px; height: 20px; flex: none; color: #fff;
  background: var(--red); border-radius: 50%; padding: 3px;
}

.limitation-grid { grid-template-columns: repeat(3, 1fr); gap: .8rem; }
.limitation-card {
  background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--steel);
  border-radius: 10px; padding: 1rem 1.1rem;
}
.limitation-card strong { display: block; margin-bottom: .4rem; font-size: .98rem; }
.limitation-card p { margin: 0; font-size: .84rem; color: var(--muted); line-height: 1.55; }

.closing-note {
  margin-top: 1.6rem; text-align: center; padding: 1.6rem;
  background: linear-gradient(180deg, rgba(255,43,48,.06), transparent);
  border-top: 1px solid var(--line); border-radius: 12px;
}
.closing-note p { margin: 0; font-size: 1.05rem; font-weight: 600; color: var(--ink); }

@media (max-width: 820px) {
  .findings-grid, .fw-grid, .integrity-grid, .limitation-grid { grid-template-columns: 1fr; }
}

/* References source-register table — wrap long content, short host links */
.object-table { width: 100%; border-collapse: collapse; font-size: .85rem; table-layout: fixed; }
.object-table th, .object-table td {
  text-align: left; padding: .55rem .7rem; vertical-align: top;
  border-bottom: 1px solid var(--line); overflow-wrap: anywhere; word-break: break-word;
}
.object-table thead th {
  font-size: .66rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700;
  color: var(--muted); border-bottom: 1.5px solid var(--line); background: var(--panel);
}
.object-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.018); }
.object-table tbody tr:hover td { background: rgba(255,43,48,.06); }
/* column widths: id, tier, name, what, link */
.object-table th:nth-child(1), .object-table td:nth-child(1) { width: 64px; font-weight: 700; color: var(--red); }
.object-table th:nth-child(2), .object-table td:nth-child(2) { width: 92px; color: var(--muted); }
.object-table th:nth-child(5), .object-table td:nth-child(5) { width: 120px; }
.object-table .col-link a {
  display: inline-flex; align-items: center; gap: .3rem; color: var(--red);
  text-decoration: none; font-size: .8rem;
}
.object-table .col-link a:hover { text-decoration: underline; }
.object-table .col-link svg { width: 13px; height: 13px; flex: none; }

@media (max-width: 640px) {
  .object-table { font-size: .78rem; }
  .object-table th:nth-child(2), .object-table td:nth-child(2) { display: none; }
}

/* Smooth momentum scrolling + swipe affordance on scrollable tables (mobile) */
.sheet-scroll, .table-wrap, .code-panel pre {
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 640px) {
  .sheet-scroll, .table-wrap {
    position: relative;
    -webkit-mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent 100%);
    mask-image: linear-gradient(90deg, #000 0, #000 calc(100% - 22px), transparent 100%);
  }
}

/* ============================================================================
   Forecast Hindsight section (FY2025 bake-off + 2026/2027 outlook)
   ========================================================================== */
.fcst-hindsight { margin-top: 2.6rem; display: flex; flex-direction: column; gap: 1.1rem; }
.fcst-hindsight .section-head { margin-bottom: 0.5rem; }
.fcst-hindsight .section-head h2 { font-size: 1.4rem; line-height: 1.2; }
.fcst-hindsight .section-head p { color: var(--muted); font-size: 0.92rem; }
.fcst-bakeoff, .fcst-forward, .fcst-combined {
  padding: 1.3rem 1.4rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.fcst-bakeoff header h3, .fcst-forward header h3, .fcst-combined header h3 {
  margin: 0 0 0.35rem 0; font-size: 1.1rem; font-weight: 700;
}
.fcst-lede { font-size: 0.84rem; color: var(--muted); margin: 0 0 0.95rem 0; }
.fc-pill {
  display: inline-block; padding: 0.08rem 0.5rem; margin: 0 0.2rem;
  border-radius: 999px; font-size: 0.74rem; font-weight: 700;
}
.fcst-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.fcst-table {
  width: 100%; border-collapse: collapse; font-size: 0.84rem;
  min-width: 720px;
}
.fcst-table th, .fcst-table td {
  padding: 0.55rem 0.5rem; text-align: center; border-bottom: 1px solid var(--line);
}
.fcst-table th { background: var(--panel-2); font-weight: 700; text-align: center; }
.fcst-table th:first-child, .fcst-table td:first-child { text-align: left; }
.fcst-table td.fc-method { min-width: 160px; }
.fcst-table td.fc-method small { color: var(--muted); font-size: 0.72rem; line-height: 1.25; display: block; margin-top: 0.15rem; }
.fcst-table td strong { display: block; font-size: 0.92rem; font-weight: 700; }
.fcst-table td span { display: block; font-size: 0.72rem; opacity: 0.85; }
/* Actuals row — always dark background regardless of theme so the
   white text reads. Don't use var(--ink) here because that token swaps
   meaning between light and dark themes. */
.fcst-table tr.fcst-actual-row td,
.fcst-table tr.fcst-actual-row td:first-child {
  background: #0e0e12 !important;
  color: #ffffff !important;
  font-weight: 700;
  border-top: 3px solid var(--red);
}
.fcst-table tr.fcst-actual-row td.fc-actual strong,
.fcst-table tr.fcst-actual-row td:first-child strong {
  font-size: 1.1rem;
  color: #ffffff !important;
}
.fcst-table tr.fcst-actual-row td:first-child small { color: #d1d5db !important; }

/* Cell color scheme — solid backgrounds + white text always readable
   in both light and dark themes. */
.fcst-table td.fc-excellent { background: #166534; color: #ffffff; }
.fcst-table td.fc-good      { background: #4d7c0f; color: #ffffff; }
.fcst-table td.fc-amber     { background: #b45309; color: #ffffff; }
.fcst-table td.fc-poor      { background: #b91c1c; color: #ffffff; }
.fcst-table td.fc-excellent strong,
.fcst-table td.fc-good strong,
.fcst-table td.fc-amber strong,
.fcst-table td.fc-poor strong { color: #ffffff; font-size: 1rem; }
.fcst-table td.fc-excellent span,
.fcst-table td.fc-good span,
.fcst-table td.fc-amber span,
.fcst-table td.fc-poor span { color: rgba(255, 255, 255, 0.92); font-weight: 700; }
.fcst-table td.is-winner { box-shadow: inset 0 0 0 3px #fbbf24; }
.fcst-table td.is-winner::after { color: #fbbf24; font-size: 1rem; }
.fcst-table td.is-winner { box-shadow: inset 0 0 0 2px var(--red); position: relative; }
.fcst-table td.is-winner::after {
  content: "★"; position: absolute; top: 2px; right: 5px;
  color: var(--red); font-size: 0.8rem; font-weight: 700;
}

.fcst-winners { margin-top: 1.1rem; }
.fcst-winners h4 { margin: 0 0 0.5rem 0; font-size: 0.95rem; }
.fcst-winners-grid, .fcst-fwd-grid, .fcst-combined-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem;
}
.fcst-winner-card, .fcst-fwd-card, .fcst-combined-card {
  padding: 0.7rem 0.85rem;
  background: var(--panel-2);
  border-left: 3px solid var(--red);
  border-radius: 6px;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.fcst-winner-card .fc-target, .fcst-fwd-card .fc-target, .fcst-combined-card .fc-target {
  font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700;
}
.fc-winner-method, .fc-fwd-value { font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.fc-err { font-size: 0.8rem; color: var(--red); font-weight: 700; }
.fc-fwd-method { font-size: 0.78rem; color: var(--muted); }
.fcst-winner-card small, .fcst-fwd-card small { font-size: 0.74rem; color: var(--muted); margin-top: 0.2rem; }

.fcst-readout {
  margin-top: 1rem; padding: 0.75rem 0.95rem;
  background: var(--panel-2); border-left: 3px solid var(--gold, var(--red));
  border-radius: 6px; font-size: 0.86rem; line-height: 1.5;
}
.fcst-totals {
  margin-top: 0.95rem; padding: 0.65rem 0.9rem;
  background: var(--ink, #0e0e12); color: #fff;
  border-radius: 6px; font-size: 0.9rem;
}
.fcst-totals.fc-grand { background: var(--red); color: #fff; }
.fcst-totals strong { color: #fff; }
.fc-cstack { display: flex; flex-direction: column; gap: 0.18rem; font-size: 0.82rem; }
.fc-cstack .fc-total { color: var(--red); font-weight: 700; }
.fc-cstack strong { color: var(--ink); }
.fc-yoy { font-size: 0.78rem; font-weight: 700; }
.fc-yoy.is-pos { color: var(--green, #5a8f4a); }
.fc-yoy.is-neg { color: var(--red); }
.fcst-disclaimer { font-size: 0.78rem; color: var(--muted); margin-top: 0.85rem; font-style: italic; line-height: 1.5; }
