/* Reporting workspace — Revenue Transit Map system, Reporting line.
   Light only: signal-white ground, white data panels, sign-black type and rules.
   Charts read these variables through demo/js/charts.js colors(). */
:root {
  --font-sans: 'Barlow', system-ui, sans-serif;
  --font-cond: 'Barlow Semi Condensed', 'Barlow', system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --bg: #eef0f2; --surface: #ffffff; --surface-2: #e2e5e9; --border: #c9ced4;
  --sign: #141414; --sign-2: #232323;
  --text: #141414; --text-2: #3d4248; --text-muted: #5c636b;
  /* ink is the primary data series; the soft fill is a neutral, not a wash */
  --accent: #141414; --accent-soft: #e2e5e9;
  --here: #ff0075; --route: #00a38a; --route-ink: #00785f;
  --pos: #1f7a3d; --neg: #b3261e; --warn: #9a5b00; --chart-muted: #9aa1a8;
  --edge: clamp(20px, 4vw, 64px);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; }
html { scrollbar-color: var(--sign) var(--surface-2); }
body { font: 500 16px/1.5 var(--font-sans); background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: #ff0075; color: #fff; }
:focus-visible { outline: 3px solid var(--here); outline-offset: 3px; }

/* Signs (buttons) */
.btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 9px 14px; border: 0; border-radius: 0; background: transparent; color: var(--text); box-shadow: inset 0 0 0 3px var(--sign); font: 700 16px/1 var(--font-cond); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color .2s ease-out, color .2s ease-out; }
.btn:hover { background: var(--sign); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; background: transparent; color: var(--text); }
.btn-primary { background: var(--sign); color: #fff; box-shadow: none; }
.btn-primary:hover { background: var(--sign-2); }

/* Workspace shell: view list on the left, the view on the right */
.layout { max-width: 1440px; margin: 0 auto; padding: clamp(28px, 3.4vw, 48px) var(--edge) clamp(56px, 7vw, 96px); display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: clamp(24px, 3vw, 48px); min-height: calc(100vh - 140px); }
.sidenav { align-self: start; position: sticky; top: 24px; display: flex; flex-direction: column; border-top: 3px solid var(--sign); }
.sidenav a { display: block; padding: 13px 14px 13px 16px; border-bottom: 1px solid var(--border); text-decoration: none; color: var(--text-2); font: 700 18px/1.15 var(--font-cond); }
.sidenav a:hover { color: var(--text); background: var(--surface); }
.sidenav a[aria-current="page"] { color: var(--text); background: var(--surface); box-shadow: inset 5px 0 0 var(--here); }
.sidenav .asof { margin-top: 14px; padding: 0 2px; font: 600 14px/1.3 var(--font-cond); color: var(--text-muted); }
main { min-width: 0; }
.boot { max-width: 560px; margin: 80px auto; text-align: center; color: var(--text-muted); }

/* View header */
.view-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 18px 24px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 3px solid var(--sign); }
.view-head h1 { font: 800 clamp(34px, 3.8vw, 56px)/1 var(--font-cond); letter-spacing: -0.02em; }
.view-head p { margin-top: 10px; font: 600 15px/1.3 var(--font-cond); color: var(--text-muted); }

/* Filters: period as a fork-style segmented sign, selects as square fields */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.seg { display: inline-flex; box-shadow: inset 0 0 0 3px var(--sign); }
.seg button { border: 0; border-radius: 0; background: transparent; color: var(--text); font: 700 15px/1 var(--font-cond); padding: 12px 13px; cursor: pointer; }
.seg button:hover { background: var(--surface); }
.seg button[aria-pressed="true"] { background: var(--sign); color: #fff; }
.filters select { appearance: none; -webkit-appearance: none; font: 600 15px/1 var(--font-cond); color: var(--text); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23141414' stroke-width='2.2' fill='none'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 8px; border: 1px solid var(--sign); border-radius: 2px; padding: 12px 34px 12px 12px; max-width: 100%; cursor: pointer; }

/* KPI figures: white panels capped by a black rule */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { display: block; width: 100%; background: var(--surface); border: 0; border-top: 3px solid var(--sign); border-radius: 0; padding: 16px 18px 18px; text-decoration: none; text-align: left; font: inherit; color: inherit; transition: box-shadow .2s ease-out; }
a.kpi, button.kpi { cursor: pointer; }
a.kpi:hover, button.kpi:hover { box-shadow: inset 0 0 0 3px var(--sign); }
.kpi-label { font: 700 15px/1.2 var(--font-cond); color: var(--text-2); }
.kpi-value { font: 800 clamp(30px, 2.6vw, 42px)/0.95 var(--font-cond); letter-spacing: -0.02em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi-sub { font: 600 14px/1.3 var(--font-cond); color: var(--text-muted); margin-top: 8px; }
.pos { color: var(--pos); } .neg { color: var(--neg); } .warn { color: var(--warn); }

/* Panels */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.card { background: var(--surface); border: 0; border-radius: 0; padding: 18px 20px 20px; min-width: 0; margin-bottom: 12px; }
.grid-2 > .card { margin-bottom: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 14px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { font: 800 clamp(20px, 1.7vw, 24px)/1.1 var(--font-cond); letter-spacing: -0.01em; }
.card-head p { font: 600 14px/1.3 var(--font-cond); color: var(--text-muted); }
.chart { position: relative; height: 270px; }
.chart-fallback { display: grid; place-items: center; height: 100%; color: var(--text-muted); font: 600 15px/1.3 var(--font-cond); }

/* Tables: strong rule under the head, hairlines between rows */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.data-table th { text-align: left; font: 700 14px/1.2 var(--font-cond); color: var(--text-2); border-bottom: 3px solid var(--sign); padding: 0; white-space: nowrap; }
.data-table th[aria-sort] { color: var(--text); }
.data-table th button { all: unset; cursor: pointer; display: block; padding: 8px 12px 9px 0; }
.data-table th button:hover { color: var(--text); text-decoration: underline; text-decoration-thickness: 2px; }
.data-table th button:focus-visible { outline: 3px solid var(--here); outline-offset: 2px; }
.data-table th.num button { text-align: right; padding: 8px 0 9px 12px; }
.data-table td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: 15px; }
.data-table td.num { padding: 10px 0 10px 12px; }
.data-table .num { text-align: right; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover { background: var(--bg); box-shadow: inset 4px 0 0 var(--sign); }
.data-table tr.clickable:hover td:first-child { padding-left: 10px; }

/* Status: small text with a coloured dot, never a pill */
.badge { display: inline-flex; align-items: center; gap: 6px; font: 700 14px/1.2 var(--font-cond); padding: 0; background: none; border-radius: 0; }
.badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.badge-Healthy, .badge-pos { color: var(--pos); }
.badge-Watch, .badge-warn { color: var(--warn); }
.badge-Critical, .badge-neg { color: var(--neg); }
.badge-muted { color: var(--text-2); }
.badge-muted::before { background: transparent; box-shadow: inset 0 0 0 2px currentColor; }

/* Margin-health chips: a row of square toggles */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip { border: 0; border-radius: 0; background: transparent; box-shadow: inset 0 0 0 2px var(--sign); padding: 9px 14px; font: 700 15px/1 var(--font-cond); cursor: pointer; color: var(--text); }
.chip:hover { background: var(--surface); }
.chip[aria-pressed="true"] { background: var(--sign); color: #fff; box-shadow: none; }

.empty { padding: 48px 16px; text-align: center; color: var(--text-2); background: var(--surface); border: 0; border-top: 3px solid var(--sign); border-radius: 0; font: 700 18px/1.3 var(--font-cond); }
.footnote { font-size: 14px; line-height: 1.5; color: var(--text-muted); margin-top: 8px; max-width: 86ch; }

/* Forecast bar */
.progress { position: relative; height: 18px; background: var(--surface-2); border-radius: 0; overflow: visible; display: flex; }
.progress span { display: block; height: 100%; }
.progress .won { background: var(--accent); }
.progress .weighted { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.progress .target { position: absolute; top: -6px; bottom: -6px; width: 3px; background: var(--text); }
.legend { display: flex; gap: 8px 20px; flex-wrap: wrap; font: 600 14px/1.3 var(--font-cond); color: var(--text-2); margin-top: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 7px; vertical-align: -1px; }

/* Drill drawer: a white panel hung off a black edge */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(20, 20, 20, .45); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(780px, 100vw); background: var(--surface); border-left: 6px solid var(--sign); z-index: 41; display: flex; flex-direction: column; }
.drawer header { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding: 20px 22px 18px; background: var(--sign); color: #fff; }
.drawer h2 { font: 800 clamp(24px, 2.2vw, 32px)/1.05 var(--font-cond); letter-spacing: -0.01em; }
.drawer header p { margin-top: 6px; font: 600 15px/1.3 var(--font-cond); color: #c8ccd1; }
.drawer header .btn { box-shadow: inset 0 0 0 3px #fff; color: #fff; }
.drawer header .btn:hover { background: #fff; color: var(--sign); }
.drawer header .btn:disabled { background: transparent; color: #fff; }
.drawer-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.drawer-body { overflow: auto; padding: 8px 22px 28px; }
.drawer-body .empty { border-top: 0; }

/* Other samples */
.samples { background: var(--bg); }
.samples .xt-wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; padding-block: 22px 26px; border-top: 3px solid var(--sign); font: 700 17px/1.4 var(--font-cond); }
.samples h2 { font: inherit; color: var(--text-muted); margin-right: 6px; }
.samples a { text-decoration: none; }
.samples a:hover { text-decoration: underline; }
.samples .sep { color: var(--text-muted); }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 20px; }
  .sidenav { position: static; flex-direction: row; overflow-x: auto; border-top: 0; border-bottom: 3px solid var(--sign); }
  .sidenav a { white-space: nowrap; border-bottom: 0; padding: 12px 14px; }
  .sidenav a[aria-current="page"] { box-shadow: inset 0 -5px 0 var(--here); }
  .sidenav .asof { display: none; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi { padding: 12px 12px 14px; }
  .kpi-value { font-size: 26px; }
  .drawer header { flex-direction: column; }
  .seg button { padding: 12px 10px; }
}
@media print {
  .xt-mast, .xt-route, .xt-terminus, .xt-foot, .samples, .sidenav, .filters, .drawer-backdrop { display: none !important; }
  .layout { display: block; padding: 0; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
