/* Off Taker Term Evaluation.
   Brand follows hyperedgedelivery.com: Georgia headings and key values in navy, a gold uppercase
   eyebrow, Arial text, hairline rules, square corners, outlined badges. No logo, no images, no web fonts. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #f8f7f4;
  --ink: #2b3038;
  --navy: #0b2d51;
  --gold: #9a7b3f;
  --muted: #6f757e;
  --rule: #d9d6d0;
  --field: #ffffff;
  --on-navy: #ffffff;
  --series-1: #1c5cab;   /* chart colours: validated on this surface, see CLAUDE.md */
  --series-2: #c08a1e;
  --series-3: #2a9d8f;
  --serif: Georgia, "Times New Roman", serif;
  --sans: Arial, "Helvetica Neue", Helvetica, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101826;
    --panel: #162033;
    --ink: #e8eaee;
    --navy: #dfe7f2;
    --gold: #c9a866;
    --muted: #9aa3ae;
    --rule: #2a3444;
    --field: #101826;
    --on-navy: #101826;
    --series-1: #3987e5;
    --series-2: #c08a1e;
    --series-3: #2a9d8f;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--sans); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 28px; }

/* Header */
.top { padding: 30px 0 4px; }
.eyebrow { margin: 0 0 6px; font: 700 11px/1.45 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); }
h1 { margin: 0; font: 400 36px/1.15 var(--serif); color: var(--navy); }
.sub { margin: 10px 0 0; color: var(--muted); font-size: 13px; }

.grid { display: grid; grid-template-columns: 324px minmax(0, 1fr); gap: 44px; padding-top: 26px; padding-bottom: 40px; align-items: start; }

h2 { margin: 34px 0 0; padding-bottom: 8px; border-bottom: 1px solid var(--navy); font: 400 20px/1.45 var(--serif); color: var(--navy); }
.results > h2:first-child { margin-top: 0; }

/* Inputs */
.panel { background: var(--panel); border-top: 1px solid var(--navy); padding: 14px 18px 18px; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.panel h2 { margin: 0 0 12px; padding: 0; border: 0; font-size: 20px; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
button { font: 700 10.5px/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--navy); background: transparent; border: 1px solid var(--navy); padding: 6px 9px; cursor: pointer; border-radius: 0; }
button:hover { background: var(--navy); color: var(--on-navy); }
button.on { background: var(--navy); color: var(--on-navy); }
button.link { border: 0; padding: 0; margin-top: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
button.link:hover { background: transparent; color: var(--navy); }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

fieldset { border: 0; margin: 0; padding: 12px 0 2px; border-top: 1px solid var(--rule); min-width: 0; }
fieldset:first-of-type { border-top: 0; }
legend { padding: 0; float: left; width: 100%; margin-bottom: 6px; font: 400 16px/1.35 var(--serif); color: var(--navy); }
legend small { display: block; font: 400 12px/1.4 var(--sans); color: var(--muted); }
.fields { clear: both; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; align-items: end; }
.field { min-width: 0; padding: 2px 0 6px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; white-space: nowrap; }
.field input[type="number"] { display: block; width: 100%; font: 400 14px/1.3 var(--sans); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); background: var(--field); border: 1px solid var(--rule); border-radius: 0; padding: 6px 8px; }
.field input[type="number"]:focus { border-color: var(--navy); outline: none; }
.field input[type="range"] { display: block; width: 100%; margin: 6px 0 0; accent-color: var(--navy); }
.field.changed input[type="number"] { border-color: var(--navy); font-weight: 700; color: var(--navy); }
.field.wide { grid-column: 1 / -1; }
.field.wide input { width: calc(50% - 8px); }

.status { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); font-size: 12.5px; color: var(--muted); }
.status p { margin: 0 0 4px; }
.status ul { margin: 0; padding-left: 16px; }
.status .warn, .status .error { color: var(--gold); font-weight: 700; margin-top: 8px; }

/* Result tiles: one per structure */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--rule); }
.tile { padding: 14px 18px 16px; border-left: 1px solid var(--rule); min-width: 0; }
.tile:first-child { border-left: 0; padding-left: 0; }
.tile .name { font: 400 16px/1.4 var(--serif); color: var(--navy); }
.tile .value { margin-top: 2px; font: 400 clamp(21px, 2.1vw, 30px)/1.15 var(--serif); color: var(--navy); white-space: nowrap; }
.tile .detail { margin-top: 4px; font-size: 12px; color: var(--muted); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { display: inline-block; font: 700 10.5px/1.3 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border: 1px solid var(--navy); color: var(--navy); }
.badge.gold { border-color: var(--gold); color: var(--gold); }
.results.loading { opacity: 0.55; }
.note { margin: 8px 0 0; color: var(--muted); font-size: 12.5px; }

/* Tables */
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 0 9px 16px; text-align: right; border-bottom: 1px solid var(--rule); vertical-align: bottom; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
thead th { font: 700 11px/1.4 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--navy); width: 21%; }
thead th:first-child { width: auto; }
tbody th { font: 400 15px/1.4 var(--serif); color: var(--navy); }
tbody tr.key td { font-weight: 700; color: var(--navy); }
tbody tr.sub th { padding-left: 18px; font-size: 14px; }
tbody tr.sub td { color: var(--muted); }
/* Payments by site: the payment and its basis in the first column, then when and USD by site. One block per structure. */
#t-payments { min-width: 540px; }
#t-payments thead th { width: auto; }
#t-payments th, #t-payments td { padding-left: 12px; }
#t-payments th:first-child, #t-payments td:first-child { padding-left: 0; }
#t-payments tbody th small { display: block; font: 400 12px/1.35 var(--sans); color: var(--muted); max-width: 320px; }
#t-payments td.when { white-space: nowrap; color: var(--muted); }
#t-payments tbody tr.group th { padding-top: 18px; font: 400 16px/1.4 var(--serif); color: var(--navy); border-bottom: 1px solid var(--navy); }
#t-payments tbody tr.key th { font-weight: 700; }
.swatch { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--muted); border-radius: 1px; vertical-align: middle; margin-right: 6px; }
.s1 { border-top-color: var(--series-1); }
.s2 { border-top-color: var(--series-2); }
.s3 { border-top-color: var(--series-3); }

/* Chart */
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 12px; color: var(--muted); margin: 12px 0 4px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--rule); stroke-width: 1; }
.chart .axis-line { stroke: var(--muted); stroke-width: 1; }
.chart .mark-line { stroke: var(--muted); stroke-width: 1; }
.chart text { font: 11.5px var(--sans); fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .c1 { stroke: var(--series-1); }
.chart .c2 { stroke: var(--series-2); }
.chart .c3 { stroke: var(--series-3); }
.chart .dot { stroke: var(--bg); stroke-width: 2; }
.chart .d1 { fill: var(--series-1); }
.chart .d2 { fill: var(--series-2); }
.chart .d3 { fill: var(--series-3); }
.chart .cross { stroke: var(--navy); stroke-width: 1; }
.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--bg); color: var(--ink); border: 1px solid var(--navy); padding: 8px 10px; font-size: 12.5px; min-width: 190px; }
.tip .t { font: 400 14px var(--serif); color: var(--navy); margin-bottom: 4px; }
.tip .r { display: flex; align-items: baseline; gap: 8px; }
.tip .r b { font-variant-numeric: tabular-nums; min-width: 58px; text-align: right; color: var(--navy); }
.tip .r span.n { color: var(--muted); }

details { margin-top: 14px; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
summary { cursor: pointer; font: 400 16px/1.4 var(--serif); color: var(--navy); }
details ul { margin: 10px 0 0; padding-left: 18px; color: var(--ink); font-size: 13px; }
details li { margin-bottom: 4px; }
details table { margin-top: 8px; }

.foot { padding-top: 6px; padding-bottom: 30px; color: var(--muted); font-size: 12px; }
.foot p { margin: 0; }

@media (max-width: 900px) {
  .grid { grid-template-columns: minmax(0, 1fr); gap: 26px; }
  .panel { position: static; max-height: none; overflow: visible; }
  .wrap { padding: 0 16px; }
  h1 { font-size: 28px; }
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .tile { border-left: 0; border-top: 1px solid var(--rule); padding-left: 0; }
  .tile:first-child { border-top: 0; }
  .tile .value { font-size: 28px; }
  table { min-width: 540px; }
}
@media print {
  .panel, .tip, button { display: none; }
  .grid { grid-template-columns: 1fr; }
}
