/* ═══════════════════════════════════════════════════════════════════
   GHG CALCULATOR — styles
   Dark theme by default (family look with the Laminate Calculator: JetBrains Mono, amber accent,
   thin-bordered cards); light theme with data-theme="light".
   Chart colours are tokens; each theme has its own validated steps (colour-vision checked).
   ═══════════════════════════════════════════════════════════════════ */

:root {
  color-scheme: dark;
  --bg:        #08090a;
  --panel:     #0e1011;
  --panel-2:   #131618;
  --input:     #16191b;
  --line:      #1f2326;
  --line-2:    #2b3034;
  --text:      #d8d8d3;
  --text-hi:   #f2f1ec;
  --muted:     #8b908d;
  --dim:       #5f6562;
  --accent:    #e8a735;
  --accent-2:  #b07a20;
  --accent-ink:#151208;
  --danger:    #ef5350;
  --ok:        #22c55e;
  --surface:   #0e1011;          /* chart surface */
  --radius:    10px;
  --mono:      'JetBrains Mono', ui-monospace, monospace;
  --sans:      'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow:    0 1px 0 rgba(255,255,255,0.02), 0 8px 24px rgba(0,0,0,0.35);
  /* chart data colours (dark steps, validated on a dark surface) */
  --gas-CO2:          #3987e5;
  --gas-CH4_fossil:   #d95926;
  --gas-CH4_biogenic: #199e70;
  --gas-CH4_mixed:    #c98500;
  --gas-N2O:          #9085e9;
  --sink:  #0ca30c;
  --temp:  #d55181;
  --net:   #f2f1ec;
  --total: #f2f1ec;
  --grid:  #1c2023;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg:        #f3f2ee;
  --panel:     #ffffff;
  --panel-2:   #f8f7f4;
  --input:     #ffffff;
  --line:      #e3e1da;
  --line-2:    #d3d0c7;
  --text:      #24272a;
  --text-hi:   #0f1112;
  --muted:     #686d6a;
  --dim:       #9a9e9a;
  --accent:    #b8790f;
  --accent-2:  #8f5d08;
  --accent-ink:#ffffff;
  --surface:   #fcfcfb;
  --shadow:    0 1px 2px rgba(0,0,0,0.04), 0 6px 18px rgba(0,0,0,0.05);
  --gas-CO2:          #2a78d6;
  --gas-CH4_fossil:   #eb6834;
  --gas-CH4_biogenic: #1baf7a;
  --gas-CH4_mixed:    #eda100;
  --gas-N2O:          #6250d6;
  --sink:  #008300;
  --temp:  #e87ba4;
  --net:   #1f2a24;
  --total: #1f2a24;
  --grid:  #ecebe6;
}

/* ── Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
a { color: var(--accent); }

/* ── Top bar ──────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; margin-right: 6px; }
.brand-title { font-family: var(--mono); font-weight: 800; font-size: 16px; letter-spacing: 0.1em; color: var(--accent); }
.brand-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.05em; color: var(--muted); }
.spacer { flex: 1; }
.pf-bar { display: flex; align-items: center; gap: 6px; }
.pf-bar select { min-width: 220px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 0 3px color-mix(in srgb, var(--dim) 20%, transparent); }
.status.ok i { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.status.bad i { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.user { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* ── Layout ───────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: minmax(330px, 380px) minmax(0, 1fr);
  gap: 18px;
  padding: 18px 20px 28px;
  max-width: 1720px;
  margin: 0 auto;
  align-items: start;
}
.side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 72px; max-height: calc(100vh - 86px); overflow: auto; padding-right: 2px; }
.main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 640px) {
  .topbar, .layout { padding-left: 12px; padding-right: 12px; }
  .brand-sub, .user, .status span { display: none; }
}

/* ── Cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.card-head h2, .chart-top h2 {
  font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-hi);
}
.card-note { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.card.off .card-body { opacity: 0.45; pointer-events: none; }
.explain { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.explain b { color: var(--text); font-weight: 600; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--dim); font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.empty { text-align: center; padding: 10px 6px; color: var(--muted); }
.empty p { margin: 0 0 12px; }

/* ── Form controls ───────────────────────────────────────────────── */
input, select, button, textarea { font: inherit; color: inherit; }
input[type=number], input[type=text], select {
  width: 100%;
  background: var(--input);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 7px 9px;
  font-family: var(--mono); font-size: 13px;
  color: var(--text-hi);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
input:disabled, select:disabled { opacity: 0.5; }
input[type=number] { -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button { opacity: 0.4; }
.fld { display: flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); min-width: 0; }
.fld-narrow { max-width: 50%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.inwrap { position: relative; display: flex; align-items: center; }
.inwrap input { padding-right: 52px; }
.inwrap .pre + input { padding-left: 24px; }
.inwrap .unit, .inwrap .pre {
  position: absolute; font-family: var(--mono); font-size: 11px; color: var(--dim);
  text-transform: none; letter-spacing: 0; pointer-events: none;
}
.inwrap .unit { right: 9px; }
.inwrap .pre { left: 9px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 12px; border-radius: 7px; cursor: pointer;
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.02em;
  border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--text-hi); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-icon { width: 32px; height: 32px; padding: 0; font-size: 15px; background: transparent; }
.btn-dashed { background: transparent; border-style: dashed; color: var(--accent); }
.btn.wide { width: 100%; }
.btn.small { padding: 3px 9px; font-size: 11px; }
.btn.danger, .danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }

/* segmented control */
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--input); border: 1px solid var(--line-2); border-radius: 9px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 5px 11px; border-radius: 6px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 700; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--text-hi); }
.seg button.on, .seg button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.seg-lg button { padding: 7px 14px; font-size: 12px; }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; }
.seg.disabled { opacity: 0.45; pointer-events: none; }

/* switches */
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex-shrink: 0; cursor: pointer; }
.switch input, .toggle-row input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 22px; transition: background 0.2s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-hi); transition: transform 0.2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--accent-ink); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.toggle-row { position: relative; display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text); user-select: none; }
.toggle-row.compact { font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--muted); }
.switch-sm { position: relative; width: 30px; height: 18px; border-radius: 18px; background: var(--line-2); flex-shrink: 0; transition: background 0.2s; }
.switch-sm::after { content: ''; position: absolute; left: 3px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--text-hi); transition: transform 0.2s; }
.toggle-row input:checked + .switch-sm { background: var(--accent); }
.toggle-row input:checked + .switch-sm::after { transform: translateX(12px); background: var(--accent-ink); }
.toggle-row input:focus-visible + .switch-sm { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.toggle-row input:disabled ~ * { opacity: 0.5; }

/* chips (checkbox or radio styled as pills) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips label { position: relative; cursor: pointer; }
.chips input { position: absolute; opacity: 0; width: 0; height: 0; }
.chips span {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--input);
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--muted);
  text-transform: none; letter-spacing: 0;
  transition: all 0.15s;
}
.chips span:hover { color: var(--text-hi); border-color: var(--muted); }
.chips input:checked + span { border-color: var(--accent); color: var(--text-hi); background: color-mix(in srgb, var(--accent) 14%, var(--input)); }
.chips input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }
.chips-tight span, .chips-tight button {
  padding: 3px 8px; font-size: 11px;
}
.chips button {
  border: 1px solid var(--line-2); background: var(--input); color: var(--muted); cursor: pointer;
  border-radius: 999px; font-family: var(--mono); font-weight: 700; transition: all 0.15s;
}
.chips button:hover { color: var(--text-hi); border-color: var(--muted); }
.chips button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* gas chips: a coloured dot in front */
.gas-chips span i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }


/* ── Emission editor & cards ──────────────────────────────────────── */
.em-form { display: flex; flex-direction: column; gap: 11px; }
.em-form .em-msg { margin: 0; font-size: 12px; color: var(--muted); }
.em-form .em-msg.err { color: var(--danger); }
.em-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.em-actions .grow { flex: 1; }
.em-list { display: flex; flex-direction: column; gap: 8px; }
.em-card {
  display: grid; grid-template-columns: 4px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 12px 9px 0; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel-2); cursor: pointer; transition: border-color 0.15s, transform 0.15s;
}
.em-card:hover { border-color: var(--line-2); }
.em-card .bar { align-self: stretch; border-radius: 9px 0 0 9px; }
.em-card .name { font-weight: 600; color: var(--text-hi); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.em-card .meta { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.em-card .val { text-align: right; font-family: var(--mono); }
.em-card .val b { display: block; color: var(--text-hi); font-size: 13px; }
.em-card .val small { color: var(--dim); font-size: 10px; letter-spacing: 0.06em; }
.em-edit { border: 1px solid var(--accent); border-radius: 9px; padding: 12px; background: var(--panel-2); }

/* ── KPI strip ────────────────────────────────────────────────────── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px 13px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--kc, var(--line-2)); }
.kpi .k-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.kpi .k-value { font-family: var(--mono); font-size: 24px; font-weight: 800; color: var(--text-hi); line-height: 1.25; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .k-value.accent { color: var(--accent); }
.kpi .k-unit { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.kpi .k-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.kpi .k-sub b { color: var(--ok); font-weight: 600; }

/* ── Chart card ───────────────────────────────────────────────────── */
.chart-card { padding: 14px 16px 12px; }
.chart-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.chart-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.zoombar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 8px; }
.zoombar input[type=range] { flex: 1; min-width: 140px; accent-color: var(--accent); }
.zoom-val { font-family: var(--mono); font-size: 12px; color: var(--accent); min-width: 72px; text-align: right; font-weight: 700; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text); margin: 4px 0 8px; min-height: 18px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
i.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; }
i.sw.total { background: var(--total); height: 3px; border-radius: 2px; }
i.sw.sink { background: var(--sink); }
i.sw.temp { background: var(--temp); }
i.sw.reversal { background: repeating-linear-gradient(45deg, var(--temp) 0 2px, transparent 2px 5px); border: 1px solid var(--temp); }
i.sw.net { background: none; height: 0; width: 16px; border-top: 3px dashed var(--net); border-radius: 0; }
.chart { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; outline: none; }
.chart:focus-visible { border-color: var(--accent); }
.overview { margin-top: 8px; }
.chart-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 11.5px; color: var(--text); }
.chart-foot .muted { color: var(--dim); }
.chart-foot b { font-family: var(--mono); color: var(--text-hi); }

/* chart (SVG) */
.chart-svg { display: block; cursor: grab; touch-action: none; user-select: none; }
.chart-svg.dragging { cursor: grabbing; }
.chart-svg text { font-family: var(--mono); }
.chart-svg .axis text { fill: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart-svg .axis .axis-title { fill: var(--dim); font-size: 10.5px; letter-spacing: 0.04em; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .scale-break { stroke: var(--muted, currentColor); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.6; }
.chart-svg .zero { stroke: var(--muted); stroke-width: 1; }
.chart-svg .tick { stroke: var(--dim); stroke-width: 1; }
.chart-svg .series { fill: none; stroke-width: 1.4; stroke-linejoin: round; opacity: 0.95; }
.chart-svg .total { fill: none; stroke: var(--total); stroke-width: 2.5; stroke-linejoin: round; }
.chart-svg .total-thin { fill: none; stroke: var(--total); stroke-width: 1.4; stroke-linejoin: round; opacity: 0.9; }
.chart-svg .layer { stroke: var(--surface); stroke-width: 1; fill-opacity: 0.88; }
.chart-svg .sink { fill: none; stroke: var(--sink); stroke-width: 2; stroke-linejoin: round; }
.chart-svg .sink-area { fill: var(--sink); fill-opacity: 0.38; stroke: none; }
.chart-svg .sink-stop-a { stop-color: var(--sink); stop-opacity: 0.16; }
.chart-svg .sink-stop-b { stop-color: var(--sink); stop-opacity: 0.52; }
.chart-svg .temp-area { fill: var(--temp); fill-opacity: 0.5; stroke: var(--surface); stroke-width: 1; }
.chart-svg .temp-line { fill: none; stroke: var(--temp); stroke-width: 1.75; stroke-linejoin: round; }
.chart-svg .reversal-area { stroke: var(--temp); stroke-width: 1; }
.chart-svg .reversal-line { fill: none; stroke: var(--temp); stroke-width: 1.75; stroke-dasharray: 3 2; }
.chart-svg .hatch-bg { fill: var(--temp); fill-opacity: 0.16; }
.chart-svg .hatch-line { stroke: var(--temp); stroke-width: 2.2; }
.chart-svg .net-halo { fill: none; stroke: var(--surface); stroke-width: 6; stroke-linejoin: round; opacity: 0.85; }
.chart-svg .net { fill: none; stroke: var(--net); stroke-width: 2.6; stroke-dasharray: 7 4; stroke-linejoin: round; }
.chart-svg .band { fill: var(--text); opacity: 0.04; }
.chart-svg .action { stroke: var(--accent); stroke-width: 1.25; stroke-dasharray: 2 3; }
.chart-svg .action-label { fill: var(--accent); font-size: 11px; font-weight: 700; }
.chart-svg .zone { fill: var(--dim); font-size: 10.5px; }
.chart-svg .removal-mark { fill: var(--sink); stroke: var(--surface); stroke-width: 1; }
.chart-svg .temp-mark { fill: var(--temp); stroke: var(--surface); stroke-width: 1; }
.chart-svg .hover-band { fill: var(--text); opacity: 0.07; }
.chart-svg .crosshair { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .dot { stroke: var(--surface); stroke-width: 2; }
.chart-svg .total-dot { fill: var(--total); }
.chart-svg .sink-dot { fill: var(--sink); }
.chart-svg .net-dot { fill: var(--net); }
.chart-svg .empty { fill: var(--muted); font-size: 13px; }
.chart-svg .end-label { font-size: 10px; fill: var(--muted); letter-spacing: 0.04em; }
.chart-svg .end-value { font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.chart-svg .end-value.lab-em { fill: var(--text-hi); }
.chart-svg .end-value.lab-sink { fill: var(--sink); }
.chart-svg .end-value.lab-net { fill: var(--net); }

.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 13rem; max-width: 22rem;
  background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--line-2); border-radius: 9px;
  padding: 9px 11px; font-size: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.tt-year { font-family: var(--mono); font-weight: 800; color: var(--accent); margin-bottom: 4px; }
.tt-row { display: flex; justify-content: space-between; gap: 14px; }
.tt-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-row b { font-family: var(--mono); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--text-hi); }
.tt-row i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.tt-total { margin-top: 3px; }
.tt-total b { font-weight: 800; }
.tt-row.tt-sub { padding-left: 14px; color: var(--muted); font-size: 11.5px; }
.tt-more, .tt-unit { color: var(--dim); font-size: 11px; margin-top: 3px; }

/* overview strip */
.overview-svg { display: block; touch-action: none; user-select: none; }
.overview-svg .ov-bg { fill: var(--surface); stroke: var(--line); }
.overview-svg .ov-em { fill: var(--total); opacity: 0.28; }
.overview-svg .ov-sink { fill: var(--sink); opacity: 0.45; }
.overview-svg .ov-net { fill: none; stroke: var(--net); stroke-width: 1.2; opacity: 0.8; }
.overview-svg .ov-zero { stroke: var(--dim); stroke-width: 0.75; }
.overview-svg .ov-shade { fill: var(--bg); opacity: 0.5; }
.overview-svg .ov-window { fill: var(--accent); fill-opacity: 0.08; stroke: var(--accent); stroke-width: 1.5; }
.overview-svg .ov-handle { fill: var(--accent); }
.overview-svg text { fill: var(--dim); font-family: var(--mono); font-size: 10px; }
.overview-svg .tick { stroke: var(--dim); }

/* ── Result tabs & tables ─────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button {
  border: 0; background: none; cursor: pointer; padding: 9px 12px 10px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button:hover { color: var(--text-hi); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tabs .badge { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10px; }
.tab-panel { padding: 14px 16px 18px; overflow-x: auto; }
.tab-panel h3 { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-hi); margin: 4px 0 10px; }
.tab-panel h3:not(:first-child) { margin-top: 22px; }
.tab-panel p { font-size: 12.5px; color: var(--muted); max-width: 980px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.tbl th {
  font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--muted); text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.tbl th.num { text-align: right; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
.tbl tbody tr:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tbl tr.total td { font-weight: 700; color: var(--text-hi); border-top: 1px solid var(--line-2); }
.tbl tr.dim td { color: var(--muted); }
.tbl tr.best td { background: color-mix(in srgb, var(--ok) 9%, transparent); }
.tbl tr.current td { color: var(--text-hi); font-weight: 600; }
.tbl.auto { width: auto; min-width: 420px; }
.tag { display: inline-block; font-family: var(--mono); font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-right: 6px;
  background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.tag.cur { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.note-box { border: 1px dashed var(--line-2); border-radius: 9px; padding: 12px 14px; color: var(--muted); font-size: 12.5px; }
details.how { margin-top: 14px; }
details.how summary { cursor: pointer; font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.06em; }
details.how p { margin: 8px 0 0; }

.compare-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 6px; }
.cmp { border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; background: var(--panel-2); }
.cmp.win { border-color: var(--ok); }
.cmp .c-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.cmp .c-value { font-family: var(--mono); font-size: 20px; font-weight: 800; color: var(--text-hi); }
.cmp .c-sub { font-size: 11.5px; color: var(--muted); }
.cmp .c-bar { height: 5px; border-radius: 3px; background: var(--line); margin-top: 8px; overflow: hidden; }
.cmp .c-bar i { display: block; height: 100%; background: var(--accent); }
.cmp.win .c-bar i { background: var(--ok); }

.foot { font-family: var(--mono); font-size: 10.5px; color: var(--dim); text-align: center; padding: 4px 0 0; }

/* ── Toasts & dialog ─────────────────────────────────────────────── */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast {
  background: var(--panel); border: 1px solid var(--line-2); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 9px 14px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  animation: toast-in 0.2s ease-out;
}
.toast.error { border-left-color: var(--danger); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
dialog {
  border: 1px solid var(--line-2); border-radius: 12px; padding: 18px 20px; width: min(420px, 92vw);
  background: var(--panel); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
dialog::backdrop { background: rgba(0,0,0,0.55); backdrop-filter: blur(2px); }
dialog h3 { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
dialog p { color: var(--muted); font-size: 13px; }
dialog input { margin: 4px 0 14px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* selected gas chip takes its gas colour */
.gas-chips input:checked + span { border-color: var(--gc); color: var(--text-hi); background: color-mix(in srgb, var(--gc) 20%, var(--input)); }
#temp-opt-fields { display: flex; flex-direction: column; gap: 12px; }
@media (max-width: 1280px) { .layout { grid-template-columns: minmax(310px, 340px) minmax(0, 1fr); } .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } .kpi .k-value { font-size: 21px; } }

/* TCE-based net (period mean of the balance periods) */
.chart-svg .net-tce { fill: none; stroke: var(--accent); stroke-width: 2.8; stroke-linejoin: round; }
.chart-svg .net-tce-dot { fill: var(--accent); }
.chart-svg .end-value.lab-net-tce { fill: var(--accent); }
i.sw.net-tce { background: none; height: 0; width: 16px; border-top: 3px solid var(--accent); border-radius: 0; }

/* names inside the sink areas */
.chart-svg .area-label { font-size: 10.5px; font-weight: 800; letter-spacing: 0.14em; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.chart-svg .al-sink { fill: var(--sink); }
.chart-svg .al-temp { fill: var(--temp); }
.chart-svg .end-value.lab-temp { fill: var(--temp); }
.floor-in input { padding-right: 150px; }

/* C-sink register (2026-11-25): sinks already held, and available ACE */
.chart .owned-line { fill: none; stroke: var(--text); stroke-width: 1.6; stroke-dasharray: 5 3; opacity: .75; }
.chart .avail-area { fill: #2e9d5b; opacity: .45; }
.chart .area-label.al-avail { fill: #1d6b3d; }

/* Three pages (2026-11-25): page navigation, pick lists of the Offsetting page, source tags */
.nav a {
  display: inline-block; text-decoration: none; color: var(--muted);
  padding: 7px 14px; border-radius: 6px;
  font-family: var(--mono); font-size: 12px; font-weight: 700; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { color: var(--text-hi); }
.nav a.on { background: var(--accent); color: var(--accent-ink); }
#sc-note { white-space: nowrap; }
.pf-tools { display: inline-flex; align-items: center; gap: 6px; }
.pf-tools[hidden] { display: none; }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; cursor: pointer; }
.pick > label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; cursor: pointer; }
.pick:has(input[type=checkbox]:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.pick .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-hi); }
.pick .meta { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.pick .share { width: 78px; flex: none; }
.pick .share[hidden] { display: none; }
.pick input[type=checkbox] { accent-color: var(--accent); }
.link-more { font-family: var(--mono); font-size: 11px; align-self: flex-end; text-decoration: none; }
.link-more:hover { text-decoration: underline; }
.side-note { padding: 0 4px; }
.tag.src { margin: 0 0 0 8px; background: color-mix(in srgb, var(--muted) 18%, transparent); color: var(--muted); font-weight: 600; }
@media (max-width: 1640px) {
  .brand-sub, .status > span, .user { display: none; }
  .topbar { gap: 10px; }
}
