/* style.css — Cap Table Commander */

:root {
  --bg: #F4F0E8;
  --surface: #FCFAF5;
  --surface-2: #F0EBE0;
  --surface-3: #E8E1D4;
  --ink: #1A1814;
  --ink-2: #4A453C;
  --muted: #8A8275;
  --line: #DCD4C3;
  --line-2: #E8E1D2;

  --safe: #4A6B5C;
  --note: #8B6F47;
  --equity: #6B4A5C;
  --founder: #2D5A4A;
  --investor: #8B4A5C;
  --pool: #B89968;
  --good: #3E6B53;
  --warn: #B8843A;
  --bad: #9B4A3C;

  --shadow-xs: 0 1px 2px rgba(28,26,23,.05);
  --shadow-sm: 0 1px 3px rgba(28,26,23,.07), 0 1px 2px rgba(28,26,23,.04);
  --shadow: 0 4px 16px -6px rgba(28,26,23,.12), 0 1px 3px rgba(28,26,23,.06);
  --shadow-lg: 0 24px 64px -20px rgba(28,26,23,.28), 0 8px 24px -8px rgba(28,26,23,.12);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.22, .61, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, 'Times New Roman', Times, serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  color-scheme: dark;
}
@media (prefers-color-scheme: light){
  :root { color-scheme: light; }
}
html[data-theme="light"] {
  --bg: #F4F0E8; --surface: #FCFAF5; --surface-2: #F0EBE0; --surface-3: #E8E1D4;
  --ink: #1A1814; --ink-2: #4A453C; --muted: #8A8275;
  --line: #DCD4C3; --line-2: #E8E1D2;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #15130F;
  --surface: #1E1B16;
  --surface-2: #26221C;
  --surface-3: #2E2922;
  --ink: #F2EDE2;
  --ink-2: #C4BCAE;
  --muted: #918979;
  --line: #363028;
  --line-2: #2D2820;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.2);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.25), 0 1px 2px rgba(0,0,0,.15);
  --shadow: 0 4px 20px -6px rgba(0,0,0,.5), 0 1px 3px rgba(0,0,0,.2);
  --shadow-lg: 0 24px 64px -16px rgba(0,0,0,.7), 0 8px 24px -8px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, color-mix(in srgb, var(--founder) 5%, transparent), transparent 70%),
    radial-gradient(ellipse 60% 40% at 100% 100%, color-mix(in srgb, var(--investor) 4%, transparent), transparent 70%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.003em;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---------- Scrollbars ---------- */
.panel::-webkit-scrollbar,
.overlay-card::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-track,
.overlay-card::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb,
.overlay-card::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.panel::-webkit-scrollbar-thumb:hover,
.overlay-card::-webkit-scrollbar-thumb:hover { background: var(--muted); }
.panel,
.overlay-card { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 92%, var(--bg)));
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--founder) 25%, var(--line)), color-mix(in srgb, var(--investor) 15%, var(--line)), transparent);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  color: var(--founder);
  font-size: 18px;
  text-shadow: 0 0 12px color-mix(in srgb, var(--founder) 40%, transparent);
  animation: brandPulse 4s var(--ease) infinite;
}
@keyframes brandPulse {
  0%, 100% { text-shadow: 0 0 12px color-mix(in srgb, var(--founder) 40%, transparent); }
  50% { text-shadow: 0 0 20px color-mix(in srgb, var(--founder) 60%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .brand-mark { animation: none; }
}
.brand-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.015em;
}

/* ---------- Stage track ---------- */
.stage-track {
  display: flex;
  gap: 0;
  flex: 1;
  justify-content: center;
  align-items: center;
}
.stage-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
  transition: all .35s var(--ease);
  position: relative;
  z-index: 1;
}
.stage-pill + .stage-pill { margin-left: -1px; }
.stage-pill:not(:last-child)::after {
  content: '';
  position: absolute;
  right: -14px;
  top: 50%;
  width: 14px;
  height: 1px;
  background: var(--line);
  z-index: -1;
}
.stage-pill.done {
  color: var(--good);
  border-color: color-mix(in srgb, var(--good) 30%, var(--line));
  background: color-mix(in srgb, var(--good) 6%, var(--surface-2));
}
.stage-pill.done:not(:last-child)::after {
  background: color-mix(in srgb, var(--good) 40%, var(--line));
}
.stage-pill.current {
  color: var(--ink);
  border-color: var(--founder);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--founder) 10%, transparent), var(--shadow-sm);
}
.stage-idx {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--line);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: all .35s var(--ease);
}
.stage-pill.current .stage-idx {
  background: var(--founder);
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--founder) 20%, transparent);
}
.stage-pill.done .stage-idx { background: var(--good); color: #fff; }
.stage-name { font-weight: 500; letter-spacing: -0.01em; }

/* ---------- Meters ---------- */
.meters { display: flex; gap: 20px; flex-shrink: 0; }
.meter { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.meter-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}
.meter-val {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  font-feature-settings: 'tnum' 1;
  transition: color .3s var(--ease);
}
.meter-val.warn { color: var(--warn); }
.meter-val.neg { color: var(--bad); }
.meter-sector { font-size: 12px; }

/* ---------- Grid ---------- */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr;
  gap: 1px;
  background: var(--line);
  overflow: hidden;
  min-height: 0;
}
.panel {
  background: var(--bg);
  padding: 24px 26px;
  overflow-y: auto;
  min-height: 0;
}
.panel-head { margin-bottom: 20px; }
.panel-head h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 21px;
  margin: 0;
  letter-spacing: -0.02em;
}
.panel-sub { font-size: 12px; color: var(--muted); letter-spacing: 0.01em; }

/* ---------- Cap table ---------- */
.capbar {
  display: flex;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
  margin-bottom: 16px;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.06);
}
html[data-theme="dark"] .capbar { box-shadow: inset 0 1px 3px rgba(0,0,0,.3); }
.capbar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,.12), transparent 40%, rgba(0,0,0,.06));
  pointer-events: none;
  border-radius: var(--radius-sm);
}
html[data-theme="dark"] .capbar::after {
  background: linear-gradient(180deg, rgba(255,255,255,.06), transparent 40%, rgba(0,0,0,.15));
}
.cap-seg {
  height: 100%;
  transition: width .7s var(--ease);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.cap-seg:not(:last-child) { border-right: 1px solid rgba(0,0,0,.1); }
html[data-theme="dark"] .cap-seg:not(:last-child) { border-right-color: rgba(255,255,255,.08); }
.cap-seg-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  letter-spacing: -0.01em;
  font-feature-settings: 'tnum' 1;
  white-space: nowrap;
}

.cap-legend { display: flex; flex-direction: column; gap: 4px; margin-bottom: 24px; }
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  padding: 6px 8px;
  margin: 0 -8px;
  border-radius: var(--radius-xs);
  transition: background .2s var(--ease);
}
.legend-item:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-label { color: var(--ink-2); flex: 1; }
.legend-pct {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  font-feature-settings: 'tnum' 1;
}

/* ---------- Control block ---------- */
.control-block {
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 95%, var(--surface-2)));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}
.control-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.control-label span:first-child {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.control-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 20px;
  color: var(--founder);
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.02em;
}
.control-track {
  position: relative;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: visible;
  border: 1px solid var(--line-2);
}
.control-fill {
  height: 100%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--founder) 85%, white 15%), var(--founder));
  border-radius: 4px;
  transition: width .7s var(--ease);
  box-shadow: 0 0 8px color-mix(in srgb, var(--founder) 30%, transparent);
}
.control-threshold {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 1px;
  background: var(--ink-2);
  opacity: .35;
}
.control-threshold::after {
  content: attr(data-t) '%';
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
}
.control-threshold[data-t="51"] { left: 51%; }
.control-threshold[data-t="40"] { left: 40%; }
.control-status {
  margin-top: 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.01em;
}
.control-status.good { color: var(--good); }
.control-status.warn { color: var(--warn); }
.control-status.bad { color: var(--bad); }

/* ---------- Cap table rows ---------- */
.cap-table { font-size: 13px; }
.ct-head, .ct-row {
  display: grid;
  grid-template-columns: 1fr 80px 80px;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
  transition: background .2s var(--ease);
}
.ct-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}
.ct-row:last-child { border-bottom: none; }
.ct-row:hover { background: color-mix(in srgb, var(--founder) 3%, transparent); }
.ct-name { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.ct-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.ct-dot.founder { background: var(--founder); }
.ct-dot.investor { background: var(--investor); }
.ct-dot.pool { background: var(--pool); }
.ct-pct, .ct-vote {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
  color: var(--ink);
  font-feature-settings: 'tnum' 1;
}

/* ---------- Action panel ---------- */
.instrument-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 22px;
}
.inst-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 14px 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all .25s var(--ease);
  position: relative;
  overflow: hidden;
}
.inst-card::before {
  content: '';
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 3px;
  background: var(--inst-color);
  border-radius: 0 2px 2px 0;
  opacity: .3;
  transition: opacity .25s var(--ease);
}
.inst-card:hover {
  border-color: var(--inst-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.inst-card.selected {
  border-color: var(--inst-color);
  background: color-mix(in srgb, var(--inst-color) 5%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--inst-color) 12%, transparent), var(--shadow-sm);
}
.inst-card.selected::before { opacity: 1; }
.inst-name { font-weight: 600; font-size: 13px; color: var(--ink); letter-spacing: -0.01em; }
.inst-blurb { font-size: 11px; color: var(--muted); line-height: 1.45; }

/* ---------- Terms / sliders ---------- */
.terms { display: flex; flex-direction: column; gap: 18px; margin-bottom: 20px; }
.term-slider { display: flex; flex-direction: column; gap: 7px; }
.term-head { display: flex; justify-content: space-between; align-items: baseline; }
.term-head span:first-child { font-size: 12px; color: var(--ink-2); font-weight: 500; }
.term-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.01em;
}
.term-track-wrap {
  position: relative;
  padding-top: 14px;
}
.term-slider input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(to right,
    var(--founder) 0%,
    var(--founder) var(--fill, 50%),
    var(--line) var(--fill, 50%),
    var(--line) 100%);
  border-radius: 3px;
  outline: none;
  margin: 0;
  cursor: pointer;
  transition: filter .15s var(--ease);
}
.term-slider input[type=range]:hover { filter: brightness(1.05); }
.term-slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--founder) 85%, white 15%), var(--founder));
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.2), 0 0 0 1px var(--line);
  cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease);
}
.term-slider input[type=range]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(0,0,0,.25), 0 0 0 1px var(--founder);
}
.term-slider input[type=range]::-webkit-slider-thumb:active { transform: scale(1.05); }
.term-slider input[type=range]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--founder);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  cursor: pointer;
}
.term-slider input[type=range]::-moz-range-track {
  height: 6px;
  background: var(--line);
  border-radius: 3px;
}
.term-range {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-feature-settings: 'tnum' 1;
}

/* Fair-value marker on valuation sliders */
.term-marker {
  position: absolute;
  top: 14px;
  height: 6px;
  width: 2px;
  background: var(--warn);
  pointer-events: none;
  transform: translateX(-50%);
  z-index: 1;
  opacity: .7;
  border-radius: 1px;
}
.term-marker-label {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-bottom: 3px;
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--warn);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ---------- Calc preview ---------- */
.calc-preview {
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 95%, var(--surface-2)));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-xs);
}
.calc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
}
.calc-row span { color: var(--ink-2); }
.calc-row strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  font-feature-settings: 'tnum' 1;
}
.calc-row.bad strong { color: var(--bad); }
.calc-row.warn strong { color: var(--warn); }
.calc-notes {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-2);
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.calc-note { font-size: 11px; color: var(--muted); line-height: 1.45; }

/* ---------- Buttons ---------- */
.action-buttons { display: flex; gap: 10px; }
.btn {
  flex: 1;
  padding: 13px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s var(--ease);
  letter-spacing: -0.01em;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn:focus-visible { outline: 2px solid var(--founder); outline-offset: 2px; }
.btn-primary {
  background: linear-gradient(180deg, color-mix(in srgb, var(--founder) 90%, white 10%), var(--founder));
  color: #fff;
  border-color: color-mix(in srgb, var(--founder) 80%, black 20%);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--founder) 60%, black 40%) inset, 0 4px 12px -4px color-mix(in srgb, var(--founder) 40%, transparent);
}
.btn-primary:hover {
  background: linear-gradient(180deg, color-mix(in srgb, var(--founder) 85%, white 15%), color-mix(in srgb, var(--founder) 92%, white 8%));
  box-shadow: 0 1px 0 color-mix(in srgb, var(--founder) 60%, black 40%) inset, 0 6px 18px -4px color-mix(in srgb, var(--founder) 50%, transparent);
}
.btn-primary:active {
  background: var(--founder);
  box-shadow: 0 1px 3px color-mix(in srgb, var(--founder) 30%, black 70%) inset;
}
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary.disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface); border-color: var(--muted); }

/* ---------- Feed ---------- */
.sentiment-block { margin-bottom: 22px; }
.sent-label { display: flex; justify-content: space-between; margin-bottom: 8px; }
.sent-label span:first-child {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.sent-label span:last-child {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  font-feature-settings: 'tnum' 1;
}
.sent-track {
  height: 7px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.sent-fill {
  height: 100%;
  background: var(--muted);
  transition: width .7s var(--ease), background .4s var(--ease);
  border-radius: 3px;
}
.sent-fill.hot { background: linear-gradient(90deg, var(--good), color-mix(in srgb, var(--good) 80%, white 20%)); }
.sent-fill.cold { background: linear-gradient(90deg, var(--bad), color-mix(in srgb, var(--bad) 80%, white 20%)); }
.sent-zones {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  margin-top: 7px;
  letter-spacing: 0.02em;
}

.milestones { margin-bottom: 22px; }
.ms-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all .3s var(--ease);
}
.ms-item.done {
  color: var(--ink);
  background: color-mix(in srgb, var(--good) 5%, var(--surface));
  border-color: color-mix(in srgb, var(--good) 20%, var(--line));
}
.ms-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all .3s var(--ease);
}
.ms-item.done .ms-mark {
  background: var(--good);
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 15%, transparent);
}

.feed-list { display: flex; flex-direction: column; gap: 1px; }
.feed-item {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-2);
  font-size: 12px;
  line-height: 1.45;
  transition: background .2s var(--ease);
}
.feed-stage {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  flex-shrink: 0;
  width: 64px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 1px;
  font-weight: 600;
}
.feed-text { color: var(--ink-2); }
.feed-item.good .feed-text { color: var(--good); }
.feed-item.warn .feed-text { color: var(--warn); }
.feed-item.bad .feed-text { color: var(--bad); }
.feed-item.macro .feed-text { color: var(--ink); font-style: italic; }

/* Fresh feed entries slide in with a tinted flash */
.feed-item.new {
  --flash: var(--founder);
  animation: feedFresh 1s var(--ease-out);
}
.feed-item.new.good { --flash: var(--good); }
.feed-item.new.warn { --flash: var(--warn); }
.feed-item.new.bad { --flash: var(--bad); }
.feed-item.new.macro { --flash: var(--ink-2); }
@keyframes feedFresh {
  0%   { opacity: 0; transform: translateX(-10px); background: color-mix(in srgb, var(--flash) 18%, transparent); }
  35%  { opacity: 1; background: color-mix(in srgb, var(--flash) 10%, transparent); }
  100% { opacity: 1; transform: translateX(0); background: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .feed-item.new { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* ---------- Overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20,18,14,.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s var(--ease), visibility .35s var(--ease);
}
.overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.overlay-card {
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 96%, var(--surface-2)));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  max-width: 580px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}
.overlay.show .overlay-card {
  animation: cardIn .45s var(--ease-spring);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .overlay.show .overlay-card { animation: none; }
}

.ov-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 14px;
  font-weight: 600;
}
.ov-eyebrow-good { color: var(--good); }
.ov-eyebrow-warn { color: var(--warn); }
.ov-eyebrow-bad { color: var(--bad); }
.ov-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 40px;
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
}
.ov-lede {
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 26px;
}
.ov-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 12px;
  font-weight: 600;
}
.ov-objectives { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.ov-obj {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
  border: 1px solid var(--line-2);
  transition: border-color .2s var(--ease);
}
.ov-obj strong { color: var(--ink); }
.ov-obj-num {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--founder);
  flex-shrink: 0;
  width: 24px;
  letter-spacing: 0.02em;
}
.ov-obj.miss {
  background: color-mix(in srgb, var(--bad) 6%, var(--surface-2));
  border-color: color-mix(in srgb, var(--bad) 20%, var(--line-2));
}
.ov-obj.miss .ov-obj-num { color: var(--bad); }
.ov-rules {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.6;
  margin-bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ov-rules strong { color: var(--ink); }
.ov-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}
.ov-stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--line-2);
}
.ov-stat span {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.ov-stat strong {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--ink);
  font-weight: 700;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.02em;
}
.ov-start {
  width: 100%;
  padding: 15px;
  font-size: 15px;
  border-radius: var(--radius);
}

/* ---------- Sector selection ---------- */
.sector-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 24px;
}
.sector-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px 14px 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all .25s var(--ease);
  position: relative;
  overflow: hidden;
}
.sector-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--sector-color);
  opacity: .25;
  transition: opacity .25s var(--ease);
}
.sector-card:hover {
  border-color: var(--sector-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.sector-card.selected {
  border-color: var(--sector-color);
  background: color-mix(in srgb, var(--sector-color) 5%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sector-color) 12%, transparent), var(--shadow-sm);
}
.sector-card.selected::before { opacity: 1; }
.sector-name { font-weight: 600; font-size: 13px; color: var(--ink); letter-spacing: -0.01em; }
.sector-desc { font-size: 11px; color: var(--muted); line-height: 1.45; }
.sector-stat {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-top: 3px;
  font-feature-settings: 'tnum' 1;
}

/* ---------- Chance card ---------- */
.chance-card {
  border-radius: 14px;
  padding: 32px 28px;
  text-align: center;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  animation: chanceReveal .5s var(--ease-spring);
}
@keyframes chanceReveal {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .chance-card { animation: none; }
}
.chance-card.good {
  background: linear-gradient(135deg, color-mix(in srgb, var(--good) 12%, var(--surface-2)), var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--good) 30%, var(--line));
  box-shadow: 0 0 48px -12px color-mix(in srgb, var(--good) 35%, transparent);
}
.chance-card.bad {
  background: linear-gradient(135deg, color-mix(in srgb, var(--bad) 12%, var(--surface-2)), var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--bad) 30%, var(--line));
  box-shadow: 0 0 48px -12px color-mix(in srgb, var(--bad) 35%, transparent);
}
.chance-card.neutral {
  background: linear-gradient(135deg, color-mix(in srgb, var(--warn) 10%, var(--surface-2)), var(--surface-2));
  border: 1px solid color-mix(in srgb, var(--warn) 25%, var(--line));
  box-shadow: 0 0 48px -12px color-mix(in srgb, var(--warn) 25%, transparent);
}
.chance-icon-wrap { display: flex; justify-content: center; margin-bottom: 16px; }
.chance-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 24px;
  font-weight: 700;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.chance-card.good .chance-icon {
  color: var(--good);
  border: 2px solid color-mix(in srgb, var(--good) 40%, var(--line));
}
.chance-card.bad .chance-icon {
  color: var(--bad);
  border: 2px solid color-mix(in srgb, var(--bad) 40%, var(--line));
}
.chance-card.neutral .chance-icon {
  color: var(--warn);
  border: 2px solid color-mix(in srgb, var(--warn) 40%, var(--line));
}
.chance-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.chance-title {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.chance-desc {
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0 0 20px;
}
.chance-effects {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.chance-effect {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 18px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 86px;
  box-shadow: var(--shadow-xs);
}
.chance-effect span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.chance-effect strong {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  font-feature-settings: 'tnum' 1;
  letter-spacing: -0.01em;
}
.chance-effect.pos strong { color: var(--good); }
.chance-effect.neg strong { color: var(--bad); }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr; grid-template-rows: auto auto auto; overflow-y: auto; }
  .panel { overflow-y: visible; }
  body { overflow: auto; }
  #app { height: auto; min-height: 100%; }
  .topbar { flex-wrap: wrap; gap: 12px; padding: 12px 18px; }
  .stage-track { order: 3; width: 100%; overflow-x: auto; justify-content: flex-start; }
  .stage-pill:not(:last-child)::after { display: none; }
  .meters { margin-left: auto; }
}
@media (max-width: 560px) {
  .panel { padding: 20px 18px; }
  .overlay-card { padding: 28px 24px; }
  .ov-title { font-size: 32px; }
  .ov-stats { grid-template-columns: 1fr; }
  .instrument-row { grid-template-columns: 1fr; }
  .sector-grid { grid-template-columns: 1fr; }
  .stage-name { display: none; }
  .stage-pill { padding: 6px 10px; }
  .meters { gap: 12px; }
  .meter-val { font-size: 12px; }
  .meter-sector { font-size: 11px; }
  .chance-title { font-size: 22px; }
  .chance-effect { min-width: 72px; padding: 8px 14px; }
  .brand-name { font-size: 15px; }
  .control-val { font-size: 18px; }
  .ov-stat strong { font-size: 18px; }
}
