/* Dark by request — this is a verification build, not the polished
   artifact, but that doesn't mean it has to hurt to look at. */

:root {
  /* Dark-navy + blue-violet-gradient system (Prompt 12 / 8 of 10) --
     byte-identical to Factor Strategy/FactorIndex's own --bg/--panel/
     --panel2/--line/--accent tokens (bg/surface/surface-2/border/accent
     here), the platform-wide template this restyle brings Short-Horizon
     onto. --accent-2 is Factor Strategy's own --grad-end violet exactly
     -- theme.css's existing gradient declarations (nav .brand, .hero h1,
     .strategy-card::before) already read var(--accent), var(--accent-2),
     so recoloring just these two tokens turns every one of them from
     cyan-violet into the same blue-violet gradient with no further edits
     needed; --accent-2 is also reused as the chart "entry marker" /
     cost-bar "fees" segment color elsewhere in this app, unchanged in
     role, just recolored. shared/charts.js restates these same two
     values for its own canvas-drawn lines (can't read CSS vars from
     canvas) -- kept in sync there too. */
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1e222b;
  --border: #2a2f3a;
  --ink: #e6edf3;
  --ink-soft: #93a1b5;
  --ink-faint: #62708a;
  --accent: #5b9dff;      /* was cyan #22d3ee -- brand, active states, entries */
  --accent-2: #a855f7;    /* was #a78bfa -- violet — secondary highlight / gradient end */
  --good: #34d399;
  --bad: #f87171;
  --warn: #fbbf24;
  font-size: 15px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "Helvetica Neue", Arial, sans-serif;
}

main { max-width: 1080px; margin: 0 auto; padding: 24px; }

nav {
  display: flex; gap: 4px; align-items: center;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
nav a {
  color: var(--ink-soft); text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 6px 12px; border-radius: 4px;
}
nav a:hover { color: var(--ink); }
nav a.active { color: #04222a; background: var(--accent); }
nav .brand {
  font-weight: 800; margin-right: 16px; letter-spacing: -.01em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

h1 { font-size: 20px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 24px 0 10px; color: var(--ink); }
p.note { color: var(--ink-soft); font-size: 13px; margin: 4px 0 20px; }

.controls { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.controls label { font-size: 13px; color: var(--ink-soft); }

.tabs { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 2px; }
.tabs button {
  border: none; background: none; padding: 6px 14px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); border-radius: 4px; cursor: pointer;
}
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--accent); color: #04222a; }

select, input[type=number], input[type=text] {
  font-size: 13px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 5px;
  background: var(--surface-2); color: var(--ink);
}
select:focus, input:focus, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
button { cursor: pointer; }

table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
th, td { text-align: left; padding: 8px 12px; font-size: 13px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
th { color: var(--ink-faint); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: 0.03em; }
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--surface-2); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 12px 14px; border-top: 2px solid var(--accent); }
.card .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-faint); }
.card .value { font-size: 20px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; color: var(--ink); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.pill.good { background: rgba(52, 211, 153, 0.15); color: var(--good); }
.pill.bad { background: rgba(248, 113, 113, 0.15); color: var(--bad); }
.pill.neutral { background: var(--surface-2); color: var(--ink-soft); }

.up { color: var(--good); } .down { color: var(--bad); }

#status { color: var(--ink-soft); font-size: 13px; padding: 40px 0; text-align: center; }

a { color: var(--accent); }

.chart-wrap { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin-bottom: 20px; }
.chart-wrap canvas { width: 100%; height: 320px; display: block; }
.chart-wrap.small canvas { height: 160px; }
.chart-tooltip {
  position: absolute; display: none; transform: translate(-50%, -130%);
  background: #04222a; color: var(--ink); border: 1px solid var(--accent); font-size: 11px; padding: 4px 8px;
  border-radius: 4px; white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums;
}
.chart-legend { display: flex; gap: 18px; font-size: 12px; color: var(--ink-soft); margin-top: 8px; flex-wrap: wrap; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chart-legend .tri { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid; display: inline-block; }

/* gauge — a plain CSS bar, used for the RSI gauge on Execution */
.gauge { position: relative; height: 10px; border-radius: 999px; margin: 14px 0 6px;
  background: linear-gradient(90deg, var(--good) 0%, var(--good) 30%, var(--surface-2) 30%, var(--surface-2) 70%, var(--bad) 70%, var(--bad) 100%); }
.gauge .marker { position: absolute; top: -4px; width: 3px; height: 18px; background: var(--ink); border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 6px var(--accent); }
.gauge-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-faint); }

/* cost bar — a plain CSS stacked bar, used on Execution */
.cost-bar { display: flex; height: 22px; border-radius: 4px; overflow: hidden; margin: 8px 0; border: 1px solid var(--border); }
.cost-bar .seg { display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #04222a; }

/* regime strip — a row of colored month blocks, used on Register */
.regime-strip { display: flex; gap: 2px; height: 28px; border-radius: 4px; overflow: hidden; margin: 10px 0; }
.regime-strip .block { flex: 1; min-width: 3px; }

/* landing page — hero + strategy blocks */
.hero { padding: 56px 0 36px; text-align: center; }
.hero h1 {
  font-size: 34px; margin: 0 0 10px; letter-spacing: -.02em;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { color: var(--ink-soft); font-size: 14px; max-width: 60ch; margin: 0 auto; }

.flow { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 28px 0 44px; flex-wrap: wrap; }
.flow .step { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 16px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.flow .arrow { color: var(--ink-faint); font-size: 14px; }

.regime-badge {
  display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px 6px 10px; font-size: 12px; color: var(--ink-soft); margin-bottom: 8px;
}
.regime-badge .dot { width: 8px; height: 8px; border-radius: 50%; }

.strategy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 40px; }
.strategy-card {
  display: block; text-decoration: none; color: var(--ink); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 22px; position: relative; overflow: hidden; transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.strategy-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.strategy-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 10px 30px -12px rgba(91, 157, 255, 0.35); }
.strategy-card h3 { margin: 6px 0 8px; font-size: 17px; }
.strategy-card p { margin: 0 0 14px; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.strategy-card .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.strategy-card .tags span { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--accent); background: rgba(91, 157, 255, 0.1); padding: 3px 8px; border-radius: 999px; }
.strategy-card .go { position: absolute; right: 20px; bottom: 20px; color: var(--ink-faint); font-size: 18px; transition: transform .15s ease, color .15s ease; }
.strategy-card:hover .go { transform: translateX(4px); color: var(--accent); }

.empty-note { text-align: center; color: var(--ink-faint); font-size: 13px; padding: 40px 0; }

/* strategy "how it decides" flowchart — shared by /strategy/, the
   single-instrument /stock/ header and /portfolio/ (rendered by
   renderFlowchart() in api-client.js). */
.flowchart { display: flex; flex-direction: column; align-items: center; gap: 0; margin: 20px 0 28px; }
.flow-box {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 12px 16px; font-size: 13px; line-height: 1.5; color: var(--ink);
  max-width: 560px; width: 100%;
}
.flow-box .n {
  display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px;
  border-radius: 50%; background: var(--accent); color: #04222a; font-size: 11px; font-weight: 800;
  margin-right: 10px; flex-shrink: 0;
}
.flow-arrow { color: var(--ink-faint); font-size: 18px; line-height: 1; padding: 6px 0; }
.meta-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.meta-tags span { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; color: var(--accent); background: rgba(91, 157, 255, 0.1); padding: 3px 8px; border-radius: 999px; }

/* step-gated flow — the single-instrument Stock page and the Portfolio
   page. Same pattern as Long_term_valuation/WACC/wacc.html: a numbered
   card per step, nothing past the current step shown until the one
   before it completes. */
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin: 14px 0; }
.step-card.locked { border-color: var(--accent); }
.step-card.pending { opacity: .45; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.step-num {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px;
  border-radius: 50%; background: var(--surface-2); border: 2px solid var(--accent); color: var(--accent);
  font-size: 11px; font-weight: 800; flex-shrink: 0;
}
.step-card.locked .step-num { background: var(--accent); color: #04222a; }
.step-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--ink); }
.step-sub { font-size: 12px; color: var(--ink-soft); margin: 0 0 12px; line-height: 1.5; }

.btn-primary {
  background: var(--accent); color: #04222a; font-weight: 700; font-size: 13px; border: none;
  padding: 9px 20px; border-radius: 6px; text-decoration: none; display: inline-block;
}
.btn-primary:hover { filter: brightness(1.1); }
.toggle-btn {
  font-size: 12px; color: var(--accent); background: rgba(91, 157, 255, 0.08);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 12px; font-weight: 600;
}
.toggle-btn:hover { border-color: var(--accent); }
.toggle-btn.active { background: var(--accent); color: #04222a; }

.next-step {
  display: block; text-decoration: none; margin-top: 32px; padding: 20px 22px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  transition: transform .15s ease, border-color .15s ease;
}
.next-step:hover { transform: translateY(-1px); border-color: var(--accent); }
.next-step .ns-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--accent); }
.next-step .ns-title { font-size: 17px; font-weight: 800; color: var(--ink); margin-top: 3px; }
.next-step .ns-sub { font-size: 12px; color: var(--ink-soft); margin-top: 4px; line-height: 1.5; }
