:root {
  /* Brand palette, from the brand guidelines */
  --arc-dark: #323c46;       /* primary dark slate, Pantone 432 C: the anchor */
  --arc-blue: #009bdc;       /* highlight blue: accent */
  --arc-lime: #b4dc00;       /* accent lime: accent, at home on slate */
  --arc-blue-soft: #a5b9c8;  /* secondary blue-grey: support, text on slate */
  --arc-stone: #d7d2c8;      /* warm grey: support, calm fills */

  /* Derived surfaces: page, then panel (zones, field fill, table head), then panel-2 (tracks, quiet buttons), then white cards */
  --arc-page: #f5f6f4; --arc-panel: #eef1f3; --arc-panel-2: #e5eaee; --arc-white: #fff;
  /* Derived inks and tints. Every ink passes 4.5:1 on every light surface. */
  --arc-ink: #131d26; --arc-muted: #56626d; --arc-blue-ink: #006c9a; --arc-lime-ink: #566b00;
  --arc-danger: #b3372c;     /* functional only: errors and destructive actions */
  --arc-blue-tint: #d9edf7; --arc-lime-tint: #f0f8cc; --arc-stone-tint: #ebe8e4; --arc-danger-tint: #f7ebea;
  --arc-line: rgba(50, 60, 70, .12); --arc-line-on-dark: rgba(255, 255, 255, .14); /* hairlines */
  --arc-rule: #75828c;       /* field underline: 3:1 on every light surface */
  --arc-ghost: var(--arc-line); /* legacy alias from version 1 */

  --font-display: "Sora", Tahoma, "Segoe UI", Arial, sans-serif;
  --font-body: "Nunito Sans", Tahoma, "Segoe UI", Arial, sans-serif;

  --radius-sm: 6px; --radius-md: 12px; --radius-lg: 20px; --radius-xl: 28px; --radius-pill: 99px;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 72px;
  --shadow-float: 0 12px 40px rgba(19, 29, 38, .06);
  --max-width: 1240px;

  --dur-fast: 150ms; --dur-state: 300ms; --dur-draw: 1200ms; --stagger: 60ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1); --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  /* Set per zone: the accent, and the surface that marks sit on */
  --accent: var(--arc-blue); --surface: var(--arc-white);
}
[data-accent="blue"] { --accent: var(--arc-blue); }
[data-accent="lime"] { --accent: var(--arc-lime); }

/* ---------- Base ---------- */
* { box-sizing: border-box; }
body { margin: 0; font: 300 16px/1.6 var(--font-body); color: var(--arc-ink); background: var(--arc-page); -webkit-print-color-adjust: exact; print-color-adjust: exact; } /* fills carry data, so they must print */
h1, h2, h3, h4, .h1, .h2, .h3, .metric { margin: 0; font-family: var(--font-display); font-weight: 200; letter-spacing: -.03em; color: var(--arc-dark); }
h1, .h1 { font-size: clamp(34px, 5vw, 60px); line-height: 1.05; }
h2, .h2 { font-size: 34px; line-height: 1.1; }
h3, .h3 { font-size: 20px; line-height: 1.25; font-weight: 300; letter-spacing: -.02em; }
h4 { font-size: 16px; line-height: 1.3; font-weight: 300; letter-spacing: -.01em; }
.metric { font-size: 32px; line-height: 1.1; }
.metric.is-hero { font-size: 56px; }
p, figure { margin: 0; }
a { color: var(--arc-blue-ink); }
code { font: inherit; color: var(--arc-ink); }
.meta { font-size: 13px; line-height: 1.5; font-weight: 400; color: var(--arc-muted); }
.ui { font-size: 14px; line-height: 1.5; font-weight: 400; }
:focus-visible { outline: 2px solid var(--arc-blue-ink); outline-offset: 2px; }

/* Surfaces: page, panel, card. Slate is the stage. */
.card { background: var(--arc-white); border-radius: var(--radius-md); padding: var(--space-6); }
.panel { background: var(--arc-panel); border-radius: var(--radius-lg); padding: var(--space-6); }
.stage { border-radius: var(--radius-lg); padding: var(--space-6); }
.tone-dark { --surface: var(--arc-dark); background: var(--arc-dark); color: var(--arc-white); }
.tone-dark :is(h1, h2, h3, h4, .metric, code) { color: var(--arc-white); }
.tone-dark .meta { color: var(--arc-blue-soft); }
.tone-dark :focus-visible, .tone-dark:focus-visible { outline-color: var(--arc-blue); }

/* The arc: constant-weight lines that share their end points. One per group takes the accent. */
.arcs { position: absolute; inset: auto 0 0; width: 100%; height: 200px; color: var(--arc-white); pointer-events: none; }
.arcs path { fill: none; stroke: currentColor; stroke-width: 1.5; vector-effect: non-scaling-stroke; }

/* ---------- Components ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-sm); padding: 12px 16px; font: 400 14px/1.2 var(--font-body); cursor: pointer; transition: background-position var(--dur-state) var(--ease-out), background-size var(--dur-state) var(--ease-out), box-shadow var(--dur-fast), transform var(--dur-fast); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; pointer-events: none; }
/* The gradient stops at blue ink, so the white label keeps 4.5:1 across the whole button. */
.btn-primary { color: var(--arc-white); background: linear-gradient(120deg, var(--arc-dark) 35%, var(--arc-blue-ink)) 55% 0 / 220% 100%; }
.btn-primary:hover { background-position: 100% 0; }
.btn-secondary { background: var(--arc-panel-2); color: var(--arc-dark); }
.btn-secondary:hover { box-shadow: inset 0 0 0 99px var(--arc-line); }
.btn-tertiary { padding-inline: 0; color: var(--arc-blue-ink); background: linear-gradient(currentColor, currentColor) 0 calc(100% - 6px) / 0 1px no-repeat; }
.btn-tertiary:hover { background-size: 100% 1px; }

.field { display: grid; gap: 8px; }
.field label, .hint { font-size: 13px; font-weight: 400; color: var(--arc-muted); }
.hint.is-error { color: var(--arc-danger); }
.input { width: 100%; border: 0; border-bottom: 1px solid var(--arc-rule); border-radius: var(--radius-sm) var(--radius-sm) 0 0; padding: 12px; background-color: var(--arc-panel); font: 400 16px/1.2 var(--font-body); color: var(--arc-ink); outline: 0; transition: border-color var(--dur-fast), box-shadow var(--dur-fast); }
.input:hover { border-bottom-color: var(--arc-ink); }
.input:focus { border-bottom-color: var(--arc-blue-ink); box-shadow: 0 1px 0 var(--arc-blue-ink); }
.input[aria-invalid="true"] { border-bottom-color: var(--arc-danger); box-shadow: 0 1px 0 var(--arc-danger); }
select.input { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.segmented { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: var(--radius-pill); background: var(--arc-panel-2); }
.segmented::before { content: ""; position: absolute; inset: 4px auto 4px 4px; width: calc((100% - 8px) / var(--n)); border: 1px solid transparent; border-radius: inherit; background: var(--arc-white); transform: translateX(calc(var(--i) * 100%)); transition: transform var(--dur-state) var(--ease-in-out); }
.segmented button { position: relative; border: 0; border-radius: inherit; padding: 4px 16px; background: none; font: 400 13px/1.4 var(--font-body); color: var(--arc-muted); cursor: pointer; transition: color var(--dur-fast); }
.segmented [aria-pressed="true"] { color: var(--arc-ink); }

.badge { display: inline-flex; padding: 4px 12px; border-radius: var(--radius-pill); font: 400 12px/1.3 var(--font-body); background: var(--arc-blue-tint); color: var(--arc-blue-ink); }
.badge-lime { background: var(--arc-lime-tint); color: var(--arc-lime-ink); }
.badge-stone { background: var(--arc-stone-tint); color: var(--arc-dark); }
.badge-danger { background: var(--arc-danger-tint); color: var(--arc-danger); }
.delta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--arc-ink); }
.delta::before { content: ""; border: 4px solid transparent; border-top: 0; border-bottom: 6px solid currentColor; }
.delta.is-up { color: var(--arc-lime-ink); }
.delta.is-down::before { transform: rotate(180deg); }
.callout { position: relative; padding: 12px 16px; border-radius: var(--radius-sm); background: var(--arc-panel); font-size: 14px; line-height: 1.5; font-weight: 400; }
.callout::before { content: ""; position: absolute; inset: 8px auto 8px 0; width: 4px; border-radius: var(--radius-pill); background: var(--accent); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-weight: 400; white-space: nowrap; }
th { padding: 8px 16px; text-align: left; font-size: 13px; font-weight: 400; color: var(--arc-muted); background: var(--arc-panel); }
th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
th:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
td { padding: 12px 16px; }
tbody tr { transition: background-color var(--dur-fast); }
tbody tr:hover { background: var(--arc-panel); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.meter { display: flex; align-items: center; gap: 12px; min-width: 152px; font-variant-numeric: tabular-nums; }
.track { display: block; flex: 1; height: 8px; border-radius: var(--radius-pill); background: var(--arc-panel-2); overflow: hidden; color: var(--arc-dark); }
.track i { display: block; height: 100%; width: calc(var(--v, 100) * 1%); border-radius: inherit; background: currentColor; }

/* Tooltip: the one place the float shadow is used. Use the class, or add data-tip to show an element's aria-label. */
.tooltip, [data-tip]:hover::after, [data-tip]:focus-visible::after { position: absolute; z-index: 5; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--arc-dark); color: var(--arc-white); font: 400 13px/1.5 var(--font-body); white-space: nowrap; box-shadow: var(--shadow-float); pointer-events: none; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { content: attr(aria-label); bottom: calc(var(--v) / var(--max) * 100% + 12px); }
.tone-dark .tooltip { background: var(--arc-white); color: var(--arc-ink); }

/* ---------- Charts ---------- */
/* Series roles set a colour and marks paint with currentColor. Text never takes a series colour. */
.s-subject { color: var(--accent); transition: color var(--dur-state); }
.s-lead { color: var(--arc-dark); }
.s-context { color: var(--arc-blue-soft); }
.tone-dark .s-lead { color: var(--arc-white); }

.kpis { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; align-items: end; margin-top: 12px; }
.stat .metric { margin: 4px 0 8px; }
.stat-foot { display: flex; align-items: center; gap: 12px; }
.spark path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark circle { fill: currentColor; stroke: var(--surface); stroke-width: 2; }

.chart h4 { margin-bottom: 24px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin: -8px 0 24px; font-size: 13px; font-weight: 400; }
.key { display: inline-flex; align-items: center; gap: 8px; }
.key i { width: 16px; height: 2px; background: currentColor; }
.key b { font-weight: 600; font-variant-numeric: tabular-nums; }
.plot-area { position: relative; height: 240px; margin: 8px 48px 32px 32px; }
.tick { position: absolute; inset: var(--y) 0 auto; border-top: 1px solid var(--arc-line); }
.tick::before { content: attr(data-v); position: absolute; right: calc(100% + 8px); top: -9px; font: 400 12px/18px var(--font-body); font-variant-numeric: tabular-nums; color: var(--arc-muted); }
.tick.is-base { border-color: var(--arc-blue-soft); }
.xtick { position: absolute; left: var(--x); top: calc(100% + 8px); transform: translateX(-50%); font: 400 12px/18px var(--font-body); color: var(--arc-muted); }
.tone-dark .tick { border-color: var(--arc-line-on-dark); }
.tone-dark .tick::before, .tone-dark .xtick { color: var(--arc-blue-soft); }
.series { position: absolute; inset: 0; width: 100%; height: 100%; }
.series path { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.series .area { fill: currentColor; stroke: none; opacity: .1; }
.cross { position: absolute; inset: 0 auto 0 var(--x, 100%); width: 1px; background: currentColor; opacity: 0; transition: opacity var(--dur-fast); }
.is-active .cross { opacity: .4; }
.dot { position: absolute; left: var(--x, 100%); top: var(--y); width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 2px var(--surface); transition: left var(--dur-fast) var(--ease-out), top var(--dur-fast) var(--ease-out), color var(--dur-state); }
.end { position: absolute; left: calc(100% + 12px); top: var(--y); transform: translateY(-50%); font: 400 13px/1 var(--font-body); font-variant-numeric: tabular-nums; }

.bars { position: absolute; inset: 0; display: flex; margin: 0; padding: 0; list-style: none; }
.bars li { position: relative; flex: 1; display: flex; justify-content: center; align-items: flex-end; }
.bars i { --delay: calc(var(--n) * var(--stagger)); width: 24px; height: calc(var(--v) / var(--max) * 100%); border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: currentColor; }
.bars li:hover i { opacity: .8; }
.bars :is(span, b), [data-tip]::after { position: absolute; left: 50%; transform: translateX(-50%); }
.bars span { top: calc(100% + 8px); font: 400 12px/18px var(--font-body); color: var(--arc-muted); }
.bars b { bottom: calc(var(--v) / var(--max) * 100% + 8px); font: 600 13px/1 var(--font-body); }
.ranked { display: grid; gap: 24px; margin: 0; padding: 0; list-style: none; font-size: 14px; font-weight: 400; }
.ranked li { display: grid; grid-template-columns: 112px minmax(0, 1fr) 40px; align-items: center; gap: 12px; }
.ranked i { --delay: calc(var(--n) * var(--stagger)); height: 12px; width: calc(var(--v) / var(--max) * 100%); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: currentColor; }
.ranked b { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
/* Windows high-contrast mode drops background fills: marks take system colours so charts stay readable. */
@media (forced-colors: active) {
  .s-lead, .s-context, .track { color: CanvasText; }
  .s-subject { color: Highlight; }
  .bars i, .ranked i, .track i, .dot, .key i, .cross, .delta::before { forced-color-adjust: none; }
}

/* ---------- Motion ---------- */
/* Four primitives. Transitions and pre-draw states exist only on screen, so print and PDF get the final state at once. */
.wipe { clip-path: inset(0); }
.grow-x { transform-origin: 0 50%; }
.grow-y { transform-origin: 50% 100%; }
.fade { --delay: calc(var(--dur-draw) - var(--dur-state)); } /* arrives as the draw ends */
@media screen {
  .wipe, .grow-x, .grow-y, .fade { transition: transform var(--t, var(--dur-draw)) var(--e, var(--ease-out)) var(--delay, 0ms), clip-path var(--dur-draw) var(--ease-out) var(--delay, 0ms), opacity var(--dur-state) var(--ease-out) var(--delay, 0ms), color var(--dur-state); }
  .motion { scroll-behavior: smooth; }
  .motion [data-draw]:not(.in) :is(.wipe, .grow-x, .grow-y, .fade) { transition: none; }
  .motion [data-draw]:not(.in) .wipe { clip-path: inset(0 100% 0 0); }
  .motion [data-draw]:not(.in) .grow-x { transform: scaleX(0); }
  .motion [data-draw]:not(.in) .grow-y { transform: scaleY(0); }
  .motion [data-draw]:not(.in) .fade { opacity: 0; }
}
html:not(.motion) [data-replay], .motion .motion-off { display: none; }
