/* Console page: view rail, view layout, tables and charts. Base tokens come from site.css. */
:root {
  --rail-w: 252px;
  --mark: #8f8f89;
  --mark-strong: #c6c5be;
  --mark-dim: #6b6d70;
  --age-1: #55575a;
  --age-2: #7a7c7e;
  --age-3: #a8a7a1;
  /* Buffer zones and the heat ramp were checked against #010101 with the palette validator. */
  --zone-red: #c2364a;
  --zone-yellow: #b98d00;
  --zone-green: #22a07a;
  --heat-0: #121416;
  --heat-1: #1c4a39;
  --heat-2: #2f8f68;
  --heat-3: #5ad6a0;
  --heat-4: #c2f5de;
}
.console [hidden], .tip[hidden] { display: none !important; }

/* Every colour class sets --tone. Marks, legend swatches and tooltip keys read it. */
.series-a { --tone: var(--text); }
.series-b { --tone: var(--age-3); }
.series-c { --tone: var(--mark-dim); }
.age-1 { --tone: var(--age-1); }
.age-2 { --tone: var(--age-2); }
.age-3 { --tone: var(--age-3); }
.age-4 { --tone: var(--accent); }
.age-5 { --tone: var(--accent-hover); }
.zone-red { --tone: var(--zone-red); }
.zone-yellow { --tone: var(--zone-yellow); }
.zone-green { --tone: var(--zone-green); }
.heat-0 { --tone: var(--heat-0); }
.heat-1 { --tone: var(--heat-1); }
.heat-2 { --tone: var(--heat-2); }
.heat-3 { --tone: var(--heat-3); }
.heat-4 { --tone: var(--heat-4); }
.dot-from { --tone: var(--mark); }
.dot-to { --tone: var(--text); }

/* Layout */
.console { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); align-items: start; }
.console-main { display: flex; flex-direction: column; min-width: 0; min-height: calc(100vh - var(--app-bar-h)); }
.rail {
  position: sticky; top: var(--app-bar-h); height: calc(100vh - var(--app-bar-h));
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 24px 0 22px; border-right: 1px solid var(--rule);
}
.rail-list { display: flex; flex-direction: column; }
.rail a {
  display: flex; align-items: baseline; gap: 12px; padding: 10px 16px 10px calc(var(--gutter) - 2px);
  border-left: 2px solid transparent; color: var(--muted); text-decoration: none; font-size: 15px; line-height: 1.3;
  transition: color 160ms ease;
}
.rail a:hover { color: var(--text); }
.rail a[aria-current="page"] { color: var(--text); border-left-color: var(--accent); }
.rail a:focus-visible { outline-offset: -2px; }
.rail-index { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.rail-meta { display: grid; gap: 2px; padding: 0 16px 0 var(--gutter); font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.view { flex: 1; width: 100%; max-width: 1400px; padding: 28px var(--gutter-r) 56px 36px; }
.view:focus { outline: none; }
.console-foot {
  padding: 18px var(--gutter-r) 28px 36px; border-top: 1px solid var(--rule);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--faint);
}

/* View head and blocks */
.view-head { padding-bottom: 30px; }
.view-head-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin-bottom: 14px; }
.view-title { font-size: 15px; font-weight: 600; color: var(--text); }
.view-meta, .block-meta { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.finding {
  max-width: 36em; font-size: clamp(21px, 2.3vw, 32px); font-weight: 300; line-height: 1.24;
  letter-spacing: -0.015em; color: var(--text); text-wrap: pretty;
}
.block { min-width: 0; padding: 20px 0 38px; border-top: 1px solid var(--rule); }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; margin-bottom: 18px; }
.block-head h2 { font-size: 16px; font-weight: 600; color: var(--text); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 48px; }
.split.is-wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.ask-row { padding-top: 20px; border-top: 1px solid var(--rule); }
.chart-note { margin-top: 10px; font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }

/* Tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 0 36px; }
.tile { min-width: 0; padding: 18px 0 32px; border-top: 1px solid var(--rule); }
.tile.is-key { padding-top: 17px; border-top: 2px solid var(--accent); }
.tile.is-refused { border-top-style: dashed; border-top-color: var(--rule-strong); }
.tile-label, .figure-label { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--muted); }
.tile-value { margin-top: 10px; font-size: 46px; font-weight: 300; line-height: 1; letter-spacing: -0.03em; color: var(--text); }
.tile-unit { margin-left: 8px; font-size: 16px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.tile-refused { margin-top: 10px; font-size: 28px; font-weight: 300; line-height: 46px; letter-spacing: -0.02em; color: var(--muted); }
.tile-delta { margin-top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--text-body); }
.tile-sentence { margin-top: 12px; font-size: 14px; line-height: 1.45; color: var(--text-body); }
.tile-note { margin-top: 6px; font-size: 13px; line-height: 1.4; color: var(--faint); }
.tile-source { margin-top: 8px; font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.is-refused { color: var(--muted); }
.is-refused strong { font-weight: 600; color: var(--text); }

/* Figure strips */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 28px; margin: 0 0 10px; }
.figure { min-width: 0; padding: 16px 0 26px; border-top: 1px solid var(--rule); }
.figures dd { margin: 0; }
.figure-value {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px;
  font-size: 30px; font-weight: 300; line-height: 1.1; letter-spacing: -0.025em; color: var(--text);
}
.figure-marker { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.figure-detail { margin-top: 8px; font-size: 13px; line-height: 1.4; color: var(--text-body); }
.hero-figure {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  font-size: clamp(40px, 5vw, 64px); font-weight: 300; line-height: 1; letter-spacing: -0.035em; color: var(--text);
}
.hero-unit { font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.seg-wide { margin: 22px 0 18px; }
.seg-wide .seg-bar { height: 14px; }
.bucket-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px 24px; margin: 0; }
.bucket-list dt { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.bucket-list dd { margin: 0; }
.bucket-list.has-other { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.bucket-value { margin-top: 4px; font-size: 20px; color: var(--text); }
.bucket-share { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.statements {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 32px;
  margin: 0 0 10px; padding: 0; list-style: none;
}
.statements li { padding: 14px 0 26px; border-top: 1px solid var(--rule); font-size: 16px; color: var(--text); }

/* Tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll:focus-visible { outline-offset: 2px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.4; }
table.data th {
  padding: 0 16px 10px 0; border-bottom: 1px solid var(--rule-strong); vertical-align: bottom; text-align: left; white-space: nowrap;
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; color: var(--muted);
}
table.data td { padding: 11px 16px 11px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; color: var(--text-body); }
table.data th:first-child, table.data td:first-child { padding-left: 12px; }
table.data th:last-child, table.data td:last-child { padding-right: 4px; }
table.data .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.data .mono, .nowrap { white-space: nowrap; }
table.data th.wrap { min-width: 104px; white-space: normal; }
table.data tfoot td { border-top: 1px solid var(--rule-strong); border-bottom: 0; font-weight: 600; color: var(--text); }
table.data tr.is-key td { color: var(--text); }
table.data tr.is-key td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.cell-stack { display: grid; min-width: 168px; }
.cell-main { color: var(--text); }
.cell-sub { font-family: var(--font-mono); font-size: 11.5px; color: var(--faint); }
.cell-meter { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.is-zero { color: var(--mark-dim); }
.is-strong { font-weight: 600; color: var(--text); }
.tag {
  display: inline-block; padding: 2px 8px; border: 1px solid var(--rule-strong); border-radius: 2px; white-space: nowrap;
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; color: var(--text-body);
}
.tag.is-strong { border-color: var(--text); font-weight: 400; }
.tag.is-weak { border-style: dashed; color: var(--muted); }
.tag-row { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.table-toggle { margin-top: 18px; }
.table-toggle summary {
  display: inline-flex; align-items: center; min-height: 32px; cursor: pointer; list-style: none;
  font-size: 13.5px; color: var(--text); text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 4px;
}
.table-toggle summary::-webkit-details-marker { display: none; }
.table-toggle[open] summary { margin-bottom: 12px; }
.replay-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 18px; }
.replay-row .btn:disabled { opacity: 0.5; cursor: default; }
.replay-status { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.cause-list { margin: 0; padding: 0; list-style: none; }
.cause { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.cause:first-child { padding-top: 0; }
.cause-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.cause h3 { font-size: 15px; font-weight: 500; color: var(--text); }
.cause p { max-width: 62ch; margin-top: 6px; font-size: 14px; line-height: 1.45; color: var(--text-body); }
.cause-movement { max-width: 72ch; margin-bottom: 18px; font-size: 14px; line-height: 1.45; color: var(--text-body); }
.cause-list.is-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 48px; }
.cause-list.is-grid .cause { padding-top: 14px; }

/* Legend and tooltip */
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 12.5px; color: var(--text-body); }
.legend li { display: inline-flex; align-items: center; gap: 8px; }
.swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 2px; background: var(--tone); }
.swatch.dot-from, .swatch.dot-to { border-radius: 50%; }
.swatch.marker { width: 2px; height: 14px; margin: 0 4px; border-radius: 0; background: var(--text); }
.swatch.is-business { background: none; box-shadow: inset 0 0 0 1px var(--rule); }
.zone-label { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.tip {
  position: fixed; z-index: 60; max-width: 280px; padding: 8px 10px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 2px;
  font-size: 12.5px; line-height: 1.4; color: var(--text-body);
}
.tip-heading { margin-bottom: 4px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.tip-row { display: flex; align-items: baseline; gap: 8px; }
.tip-row strong { font-weight: 600; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tip-key { flex: none; align-self: center; width: 8px; height: 8px; border-radius: 2px; background: var(--tone); }

/* Sparkline and line chart */
.spark { margin-top: 16px; }
.spark-plot { position: relative; height: 44px; margin: 0 5px; cursor: crosshair; }
.spark-plot svg, .line-plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.spark-line { stroke: var(--mark); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark.is-key .spark-line { stroke: var(--accent); }
.spark-dot, .line-dot, .dumbbell-dot {
  position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
  box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
.spark-dot { background: var(--mark-strong); }
.spark.is-key .spark-dot { background: var(--accent); }
.spark .spark-dot.is-hover { background: var(--text); }
.spark-axis { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.line-chart { position: relative; height: 340px; }
.line-plot { position: absolute; inset: 22px 62px 30px 44px; cursor: crosshair; }
.grid-line { position: absolute; left: 0; right: 0; height: 1px; background: var(--grid); }
.grid-label, .x-tick, .series-end { position: absolute; white-space: nowrap; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.grid-label { right: 100%; top: -8px; margin-right: 10px; }
.x-tick { top: 100%; margin-top: 9px; transform: translateX(-50%); }
.line-series { stroke: var(--tone); stroke-width: 2; stroke-linejoin: round; }
.series-name {
  position: absolute; left: 0; margin-bottom: 8px; padding-right: 6px; background: var(--bg);
  font-size: 12.5px; line-height: 1.3; color: var(--text-body); white-space: nowrap;
}
.series-end { left: 100%; margin-left: 10px; transform: translateY(-50%); color: var(--text); }
.crosshair { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--rule-strong); pointer-events: none; }
.line-dot { background: var(--tone); }

/* Bridge */
.bridge { display: grid; gap: 6px; }
.bridge-row { display: grid; grid-template-columns: 176px minmax(0, 1fr) 76px; align-items: center; gap: 14px; height: 40px; }
.bridge-label { display: grid; font-size: 14px; line-height: 1.25; color: var(--text); }
.bridge-track { position: relative; height: 16px; }
.bridge-bar { position: absolute; top: 0; bottom: 0; z-index: 1; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--mark); }
.bridge-bar.is-increase { background: var(--text); }
.bridge-bar.is-decrease { border-radius: 4px 0 0 4px; background: var(--mark-dim); }
/* The link runs from the middle of this track to the middle of the next: one row height plus the gap. */
.bridge-link { position: absolute; top: 50%; width: 1px; height: 46px; background: var(--rule-strong); }
.bridge-value { text-align: right; font-family: var(--font-mono); font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.bridge .chart-note { margin-top: 8px; }

/* Segmented bar, meter, dumbbell, buffer band */
.seg-bar { display: flex; gap: 2px; width: 100%; min-width: 96px; height: 8px; }
.seg { flex: 0 1 0; min-width: 2px; border-radius: 1px; background: var(--tone); }
.meter { position: relative; flex: none; display: inline-block; width: 56px; height: 6px; overflow: hidden; border-radius: 0 3px 3px 0; background: var(--grid); }
.meter-fill { display: block; height: 100%; border-radius: 0 3px 3px 0; background: var(--mark); }
.meter.is-over .meter-fill { background: var(--text); }
.meter.is-progress { width: 96px; }
.meter.is-progress .meter-fill { background: var(--accent); }
.dumbbell { position: relative; display: block; width: 150px; height: 16px; }
.dumbbell::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--grid); }
.dumbbell-link { position: absolute; top: 50%; height: 2px; margin-top: -1px; background: var(--mark-dim); }
.dumbbell-dot { top: 50%; }
.dumbbell-dot.is-from { background: var(--mark); }
.dumbbell-dot.is-to { background: var(--text); }
.dumbbell.is-key .dumbbell-link, .dumbbell.is-key .dumbbell-dot.is-to { background: var(--accent); }
.buffer-band { position: relative; display: block; width: 100%; min-width: 200px; padding: 5px 0; }
.buffer-zones { display: flex; gap: 2px; height: 12px; }
.zone { flex: 0 1 0; background: var(--tone); opacity: 0.4; }
.zone.is-active { opacity: 1; }
.zone:first-child { border-radius: 2px 0 0 2px; }
.zone:last-child { border-radius: 0 2px 2px 0; }
.buffer-marker { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); box-shadow: 0 0 0 2px var(--bg); pointer-events: none; }

/* Heat grid */
.heat-scroll { overflow-x: auto; margin-bottom: 14px; }
.heat { display: grid; grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; min-width: 300px; max-width: 780px; }
.heat-hour { height: 18px; white-space: nowrap; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.heat-day { align-self: center; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.heat-cell { aspect-ratio: 1; min-height: 9px; border-radius: 2px; background: var(--tone); }
.heat-cell.is-business { background: none; box-shadow: inset 0 0 0 1px var(--rule); }

@media (max-width: 1100px) {
  .split, .split.is-wide-left { grid-template-columns: minmax(0, 1fr); }
  .cause-list.is-grid { grid-template-columns: minmax(0, 1fr); }
  .bucket-list.has-other { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 759px) {
  .console { display: block; }
  .console-main { min-height: 0; }
  .rail {
    z-index: 20; display: block; height: auto; padding: 0;
    border-right: 0; border-bottom: 1px solid var(--rule); background: var(--bg);
  }
  .rail-list { flex-direction: row; overflow-x: auto; padding: 0 calc(var(--gutter) - 10px); scrollbar-width: none; }
  .rail-list::-webkit-scrollbar { display: none; }
  .rail a { flex: none; gap: 8px; padding: 13px 10px 11px; border-left: 0; border-bottom: 2px solid transparent; font-size: 14px; white-space: nowrap; }
  .rail a[aria-current="page"] { border-bottom-color: var(--accent); }
  .rail-meta { display: none; }
  .view { padding: 22px var(--gutter-r) 40px var(--gutter); }
  .console-foot { padding-left: var(--gutter); }
  .bucket-list, .bucket-list.has-other { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bridge-row { grid-template-columns: 112px minmax(0, 1fr) 70px; gap: 10px; }
  .bridge .cell-sub { display: none; }
  .cell-stack { min-width: 132px; }
  .line-chart { height: 300px; }
}
