/* Solo Runway prototype - single stylesheet, no build step, no web fonts.
 * Colour roles follow the validated data-viz palette (see spec/product-spec.md
 * "Prototype notes"): series 1 blue = base case, series 2 orange = downside.
 * Light and dark are separate selected steps, not an automatic flip. */

:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --plane: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --good-text: #006300;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --plane: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --series-1: #3987e5;
    --series-2: #d95926;
    --good: #0ca30c;
    --warning: #fab219;
    --critical: #d03b3b;
    --good-text: #0ca30c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --plane: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --series-1: #3987e5;
  --series-2: #d95926;
  --good-text: #0ca30c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--plane);
  color: var(--text-primary);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 28px 20px 72px; }

header.top { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
header.top h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
header.top p.sub { margin: 0; color: var(--text-secondary); max-width: 62ch; }
.spacer { flex: 1 1 auto; }

.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.badge {
  font-size: 12px; color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
  background: var(--surface-1);
}

button.ghost {
  font: inherit; font-size: 13px; cursor: pointer;
  background: var(--surface-1); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 11px;
}
button.ghost:hover { color: var(--text-primary); }

.grid { display: grid; grid-template-columns: 330px 1fr; gap: 20px; margin-top: 22px; align-items: start; }
@media (max-width: 860px) { .grid { grid-template-columns: 1fr; } }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 14px; font-weight: 600; }

/* ---------------------------------------------------------------- inputs */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field .hint { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.inputline { display: flex; align-items: stretch; }
.inputline .affix {
  display: flex; align-items: center; padding: 0 9px; font-size: 13px;
  color: var(--muted); background: var(--plane);
  border: 1px solid var(--border); border-right: 0; border-radius: 8px 0 0 8px;
}
.inputline .affix.suffix { border: 1px solid var(--border); border-left: 0; border-radius: 0 8px 8px 0; }
.inputline input {
  font: inherit; width: 100%; min-width: 0; padding: 7px 9px;
  background: var(--plane); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: 0 8px 8px 0;
  font-variant-numeric: tabular-nums;
}
.inputline input.noright { border-radius: 0; }
.inputline input:focus { outline: 2px solid var(--series-1); outline-offset: -1px; }

/* ---------------------------------------------------------------- verdict */

.verdict { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.verdict .dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 12px; }
.verdict .label { font-size: 20px; font-weight: 650; letter-spacing: -0.01em; }
.verdict.ready .dot { background: var(--good); }
.verdict.nearly .dot { background: var(--warning); }
.verdict.notyet .dot { background: var(--critical); }
.verdict-note { color: var(--text-secondary); font-size: 13px; margin: 0 0 18px; }

/* Exactly three columns for six tiles, so the grid never ends on a half-empty
 * row showing the hairline background through an empty cell. */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
@media (max-width: 1040px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 420px) { .tiles { grid-template-columns: 1fr; } }
.tile { background: var(--surface-1); padding: 13px 14px; }
.tile .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 25px; font-weight: 650; letter-spacing: -0.02em; margin-top: 3px; }
.tile .v small { font-size: 13px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0; white-space: nowrap; }
.tile .n { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ---------------------------------------------------------------- checks */

ul.checks { list-style: none; margin: 0; padding: 0; }
ul.checks li { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--grid); }
ul.checks li:first-child { border-top: 0; }
ul.checks .mark { flex: 0 0 18px; font-weight: 700; font-size: 14px; line-height: 1.45; }
ul.checks li.pass .mark { color: var(--good-text); }
ul.checks li.fail .mark { color: var(--critical); }
ul.checks .ct { font-weight: 600; font-size: 14px; }
ul.checks .cd { color: var(--text-secondary); font-size: 13px; }

/* ---------------------------------------------------------------- chart */

.chartwrap { position: relative; margin-top: 6px; }
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
svg.chart .gridline { stroke: var(--grid); stroke-width: 1; }
svg.chart .zeroline { stroke: var(--axis); stroke-width: 1.5; }
svg.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
svg.chart .axistitle { fill: var(--muted); font-size: 11px; }
svg.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .s1 { stroke: var(--series-1); }
svg.chart .s2 { stroke: var(--series-2); }
svg.chart .endlabel { font-size: 12px; font-weight: 600; }
svg.chart .crosshair { stroke: var(--axis); stroke-width: 1; stroke-dasharray: 3 3; }
svg.chart .hoverdot { stroke: var(--surface-1); stroke-width: 2; }
/* The safety buffer. Dashed and in the muted step, so it reads as a rule the user
 * set rather than as a third forecast. */
svg.chart .floorline { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 6 4; }
svg.chart .floorlabel { fill: var(--muted); }

.legend { display: flex; gap: 18px; flex-wrap: wrap; margin: 2px 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-secondary); }
.legend span[hidden] { display: none; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
/* Matches the dashed buffer line, drawn in CSS so the legend cannot drift from it. */
.legend i.dashed {
  height: 0; border-radius: 0; width: 16px;
  border-top: 2px dashed var(--muted);
}

/* display:none rather than opacity:0 - a hidden-but-laid-out tooltip keeps the
 * absolute `left` it was given at the previous viewport width and silently widens
 * the document on a narrow screen. (Caught by the 390px overflow check in e2e.mjs.) */
.tooltip {
  position: absolute; pointer-events: none; display: none;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; min-width: 150px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .13);
}
.tooltip.on { display: block; }
.tooltip .tm { font-weight: 650; margin-bottom: 4px; }
.tooltip .row { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tooltip .row i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }

/* ---------------------------------------------------------------- table */

table.months { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.months th, table.months td { text-align: right; padding: 5px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.months th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; position: sticky; top: 0; background: var(--surface-1); }
table.months th:first-child, table.months td:first-child { text-align: left; }
table.months td.neg { color: var(--critical); font-weight: 600; }
.tablescroll { max-height: 330px; overflow: auto; margin-top: 10px; }

/* ---------------------------------------------------------------- misc */

.notes { margin-top: 22px; }
.notes h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 8px; }
.notes ul { margin: 0; padding-left: 20px; color: var(--text-secondary); font-size: 13px; }
.notes li { margin-bottom: 5px; }

.prolist { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.prolist li { padding: 7px 0; border-top: 1px solid var(--grid); color: var(--text-secondary); }
.prolist li:first-child { border-top: 0; }
.prolist .tag {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  color: var(--surface-1); background: var(--text-secondary);
  border-radius: 4px; padding: 1px 5px; margin-right: 7px; vertical-align: 1px;
}

footer.foot { margin-top: 34px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); padding-top: 14px; }
.warn { color: var(--critical); font-size: 12px; margin-top: 8px; }

/* A caution the reader has to actually read, as opposed to an error. The signal is
 * a warning-coloured rule, not warning-coloured text: #fab219 fails contrast against
 * both the light and the dark surface, so the words stay at full contrast. */
.note-caution,
.tile .n.caveat {
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.45;
  border-left: 3px solid var(--warning);
  padding-left: 8px;
  margin-top: 7px;
}
