/* VOICE   work: an operator's network manual — precise, calm, left-anchored
   IDEA    the dispatch room's transit map: every surface is a line, every module a station
   PICTURE route lines drawn from the Z mark, departure boards, live mono figures
   COLOUR  Paper ground, Ink text, Ultramarine action, Station Orange only where things meet
   TYPE    Commissioner display + Noto Sans text + IBM Plex Mono for live numerals
   LAYOUT  12 columns, 8px baseline, coordinate ticks on section edges, content anchored left */

/* =========================================================
   1. TOKENS — light (default)
   ========================================================= */
:root,
[data-theme="light"] {
  color-scheme: light;
  /* neutrals (blue-violet bias, like map paper) */
  --paper: #F7F7FB;          /* page ground */
  --surface: #FFFFFF;        /* cards, tables, inputs */
  --raised: #FFFFFF;         /* menus, dialogs */
  --rail: #DCDDE8;           /* dividers, track backgrounds (decorative) */
  --signal: #8A8CA3;         /* control borders, icons — non-text only, 3:1 */
  --slate: #4A4C63;          /* secondary text */
  --ink: #12132A;            /* primary text */
  /* brand */
  --action: #2B39D9;         /* Ultramarine — links, primary buttons */
  --action-hover: #2230B8;
  --action-active: #1B2796;
  --on-action: #FFFFFF;
  --live: #FF6A1F;           /* Station Orange — live / active / selection / interchange (fills only) */
  --on-live: #12132A;
  --live-ring: rgba(255, 106, 31, .35);
  /* semantic */
  --ok: #13804A;
  --warn: #A65F00;
  --err: #C8243B;
  --ok-tint: #E3F3EA;
  --warn-tint: #FBEEDB;
  --err-tint: #FBE4E7;
  --info-tint: #E6E8FB;
  /* service lines (transit-map colours) */
  --line-ride: #2B39D9;
  --line-scheduled: #A3216B;
  --line-courier: #2F7A1F;
  --line-fleet: #12132A;
  /* focus */
  --focus: #2B39D9;
  --focus-gap: #FFFFFF;
  /* skeleton */
  --skel: #E9EAF2;
  --skel-hi: #F4F5FA;
}

/* dark — same idea at night */
[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0E0F1F;
  --surface: #17182C;
  --raised: #1F2138;
  --rail: #2B2D45;
  --signal: #767A9C;
  --slate: #A4A7C2;
  --ink: #F2F2FA;
  --action: #8C96FF;
  --action-hover: #A3ABFF;
  --action-active: #7782F0;
  --on-action: #0E0F1F;
  --live: #FF8A4C;
  --on-live: #0E0F1F;
  --live-ring: rgba(255, 138, 76, .35);
  --ok: #4CC38A;
  --warn: #F0A73A;
  --err: #FF6B7D;
  --ok-tint: #12301F;
  --warn-tint: #33240A;
  --err-tint: #3A1219;
  --info-tint: #1E2350;
  --line-ride: #8C96FF;
  --line-scheduled: #F27AB8;
  --line-courier: #7CCB5E;
  --line-fleet: #F2F2FA;
  --focus: #A3ABFF;
  --focus-gap: #0E0F1F;
  --skel: #1F2138;
  --skel-hi: #2B2D45;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0E0F1F;
    --surface: #17182C;
    --raised: #1F2138;
    --rail: #2B2D45;
    --signal: #767A9C;
    --slate: #A4A7C2;
    --ink: #F2F2FA;
    --action: #8C96FF;
    --action-hover: #A3ABFF;
    --action-active: #7782F0;
    --on-action: #0E0F1F;
    --live: #FF8A4C;
    --on-live: #0E0F1F;
    --live-ring: rgba(255, 138, 76, .35);
    --ok: #4CC38A;
    --warn: #F0A73A;
    --err: #FF6B7D;
    --ok-tint: #12301F;
    --warn-tint: #33240A;
    --err-tint: #3A1219;
    --info-tint: #1E2350;
    --line-ride: #8C96FF;
    --line-scheduled: #F27AB8;
    --line-courier: #7CCB5E;
    --line-fleet: #F2F2FA;
    --focus: #A3ABFF;
    --focus-gap: #0E0F1F;
    --skel: #1F2138;
    --skel-hi: #2B2D45;
  }
}

/* theme-independent tokens */
:root {
  /* type */
  --f-display: "Commissioner", "Noto Sans", system-ui, sans-serif;
  --f-body: "Noto Sans", "Noto Sans Arabic", "Noto Sans Devanagari", "Noto Sans Thai", "Noto Sans JP", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --t-display: clamp(40px, 5.2vw, 64px);
  --t-h1: clamp(32px, 3.6vw, 44px);
  --t-h2: clamp(26px, 2.6vw, 32px);
  --t-h3: 22px;
  --t-body-l: 18px;
  --t-body: 16px;
  --t-small: 14px;
  --t-label: 13px;
  --t-figure: 28px;
  --t-led: clamp(40px, 6vw, 64px);
  /* 8px baseline spacing */
  --s-05: 4px;
  --s-1: 8px;
  --s-2: 16px;
  --s-3: 24px;
  --s-4: 32px;
  --s-5: 48px;
  --s-6: 64px;
  --s-7: 96px;
  /* shape */
  --r-1: 4px;
  --r-2: 8px;
  --r-pill: 999px;
  --stroke: 3;               /* route & icon stroke on a 24-unit grid = 8/64 of the logo */
  /* layout */
  --max: 1376px;
  --gutter: 16px;
  --header-h: 64px;
  /* motion */
  --dur-instant: 100ms;
  --dur-quick: 160ms;
  --dur-base: 240ms;
  --dur-flip: 480ms;
  --dur-route: 1200ms;
  --dur-ring: 1600ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-route: cubic-bezier(.45, 0, .2, 1);
}
@media (min-width: 768px) { :root { --gutter: 24px; --header-h: 72px; } }
@media (min-width: 1024px) { :root { --gutter: 32px; } }

/* =========================================================
   2. BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--t-body)/1.5 var(--f-body); overflow-x: clip; }
img, svg { max-width: 100%; }
a { color: var(--action); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--action-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--live); color: var(--on-live); }
h1, h2, h3, h4 { font-family: var(--f-display); color: var(--ink); margin: 0; text-wrap: balance; letter-spacing: -.02em; }
h1 { font-size: var(--t-h1); line-height: 1.12; font-weight: 700; }
h2 { font-size: var(--t-h2); line-height: 1.2; font-weight: 700; }
h3 { font-size: var(--t-h3); line-height: 1.36; font-weight: 600; letter-spacing: -.01em; }
h4 { font-size: 18px; line-height: 1.33; font-weight: 600; letter-spacing: 0; }
p { margin: 0; max-width: 68ch; }
.display { font-family: var(--f-display); font-size: var(--t-display); line-height: 1.06; font-weight: 700; letter-spacing: -.03em; }
.lead { font-size: var(--t-body-l); line-height: 1.55; color: var(--slate); }
.small { font-size: var(--t-small); line-height: 1.45; }
.muted { color: var(--slate); }
.num, .mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums slashed-zero; font-feature-settings: "tnum" 1, "zero" 1; }
code { font-family: var(--f-mono); font-size: .92em; overflow-wrap: anywhere; }
[hidden] { display: none !important; }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 16px; top: -100px; z-index: 100; background: var(--action); color: var(--on-action); padding: 12px 16px; border-radius: var(--r-2); font-weight: 600; }
.skip:focus { top: 12px; }
.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: var(--stroke); stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 16px; height: 16px; }
[dir="rtl"] .icon--dir { transform: scaleX(-1); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stack-sm > * + * { margin-block-start: var(--s-1); }
.stack-md > * + * { margin-block-start: var(--s-2); }
.stack-lg > * + * { margin-block-start: var(--s-3); }

/* =========================================================
   3. GRID — 12 columns, 8px baseline, coordinate ticks
   ========================================================= */
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-3); }
.grid > * { grid-column: 1 / -1; min-width: 0; }
@media (min-width: 768px) {
  .t-6 { grid-column: span 6; }
  .t-4 { grid-column: span 4; }
}
@media (min-width: 1024px) {
  .d-3 { grid-column: span 3; }
  .d-4 { grid-column: span 4; }
  .d-5 { grid-column: span 5; }
  .d-6 { grid-column: span 6; }
  .d-7 { grid-column: span 7; }
  .d-8 { grid-column: span 8; }
  .d-9 { grid-column: span 9; }
  .d-lead { grid-column: 1 / span 7; }
  .d-side { grid-column: 9 / span 4; }
  .d-wide { grid-column: 1 / span 9; }
}
.sec { padding-block: var(--s-6) var(--s-6); position: relative; }
.sec + .sec { padding-block-start: 0; }
.sec--tint { background: var(--surface); }
.ticks { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); height: 24px; margin-block-end: var(--s-3); border-block-start: 1px solid var(--rail); }
.ticks span { border-inline-start: 1px solid var(--signal); height: 8px; font: 500 13px/1 var(--f-mono); color: var(--slate); padding-inline-start: 4px; padding-block-start: 10px; white-space: nowrap; }
.ticks span:first-child { border-inline-start-color: var(--action); }
@media (max-width: 767px) { .ticks span:not(:nth-child(3n+1)) { color: transparent; } }
.sec-head { display: grid; gap: var(--s-2); margin-block-end: var(--s-4); max-width: 820px; }
.demo { background: var(--surface); border: 1px solid var(--rail); border-radius: var(--r-2); padding: var(--s-3); }
.demo--paper { background: var(--paper); }
.demo-label { font: 600 13px/16px var(--f-body); color: var(--slate); margin-block-end: var(--s-2); }
.note { border-inline-start: 3px solid var(--rail); padding-inline-start: var(--s-2); color: var(--slate); font-size: var(--t-small); }
.note strong { color: var(--ink); }
.sample-line { font-size: 13px; color: var(--slate); margin-block-start: var(--s-1); }

/* =========================================================
   4. SIGNATURE — station label
   ========================================================= */
.station { display: flex; width: fit-content; max-width: 100%; flex-wrap: wrap; align-items: center; gap: 8px; font: 600 var(--t-label)/16px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink); margin: 0; }
.station__no { font-family: var(--f-mono); color: var(--action); letter-spacing: 0; font-weight: 600; }
.station .icon { width: 16px; height: 16px; color: var(--live); stroke-width: 3.2; }
[dir="rtl"] .station .icon { transform: scaleX(-1); }
.station--live .station__no { color: var(--ink); background: var(--live); color: var(--on-live); padding: 2px 6px; border-radius: var(--r-1); }

[lang="ar"] .station, [dir="rtl"] .station, [lang="ar"] .board th, [lang="ar"] .led__label { letter-spacing: 0; text-transform: none; }

/* route-line divider (drawn by JS at real width; animates via stroke-dashoffset) */
.route { display: block; width: 100%; height: 48px; color: var(--action); overflow: visible; }
.route path.route__line { fill: none; stroke: currentColor; stroke-width: 6; stroke-linejoin: round; stroke-linecap: butt; }
.route .route__stop { fill: var(--paper); stroke: currentColor; stroke-width: 4; }
.route .route__x { fill: var(--live); stroke: var(--paper); stroke-width: 3; }
.route.is-drawing path.route__line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw var(--dur-route) var(--ease-route) forwards; }
.route.is-drawing .route__stop, .route.is-drawing .route__x { opacity: 0; animation: pop var(--dur-base) var(--ease-out) forwards; animation-delay: calc(var(--dur-route) * .85); }
.route.is-drawing .route__stop:first-of-type { animation-delay: 0ms; }
.sec--tint .route .route__stop, .sec--tint .route .route__x { stroke: var(--surface); }
.sec--tint .route .route__stop { fill: var(--surface); stroke: currentColor; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.route__stop, .route__x { transform-box: fill-box; transform-origin: center; }

/* =========================================================
   5. SIGNATURE — dispatch board
   ========================================================= */
.board-wrap { background: var(--surface); border: 1px solid var(--rail); border-radius: var(--r-2); }
.board-cap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-1) var(--s-2); padding: var(--s-2) var(--s-3); border-block-end: 1px solid var(--rail); }
.board { width: 100%; border-collapse: collapse; font-family: var(--f-mono); font-variant-numeric: tabular-nums slashed-zero; font-feature-settings: "tnum" 1, "zero" 1; font-size: 15px; }
.board th { text-align: start; font: 600 13px/16px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--slate); padding: 12px 16px; border-block-end: 2px solid var(--ink); white-space: nowrap; }
.board td { padding: 12px 16px; border-block-end: 1px solid var(--rail); vertical-align: middle; perspective: 400px; }
.board tr:last-child td { border-block-end: 0; }
.board tbody tr:hover td { background: var(--info-tint); }
.board tbody tr[aria-selected="true"] td { background: var(--info-tint); }
.board tbody tr[aria-selected="true"] td:first-child { box-shadow: inset 4px 0 0 var(--live); }
.board td.r, .board th.r { text-align: end; }
.board .cell { display: inline-block; transform-origin: 50% 50%; backface-visibility: hidden; }
.board tr.is-flipping .cell { animation: flip var(--dur-flip) var(--ease-in-out); }
.board tr.is-new td { background: color-mix(in srgb, var(--live) 14%, transparent); transition: background var(--dur-route) var(--ease-out); }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.line-tag { display: inline-flex; align-items: center; gap: 8px; font-family: var(--f-body); font-size: 14px; white-space: nowrap; }
.line-tag::before { content: ""; width: 20px; height: 6px; border-radius: 3px; background: var(--c, var(--line-ride)); }
@media (max-width: 640px) {
  .board thead { display: none; }
  .board tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 16px; border-block-end: 1px solid var(--rail); }
  .board td { display: block; padding: 0; border: 0; }
  .board td[data-l]::before { content: attr(data-l); display: block; font: 600 12px/16px var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--slate); }
  .board td.r { text-align: start; }
}

/* status pills (row status) */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: var(--r-pill); font: 600 13px/18px var(--f-body); white-space: nowrap; background: var(--info-tint); color: var(--ink); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--action); }
.pill--live { background: var(--live); color: var(--on-live); }
.pill--live::before { background: var(--on-live); }
.pill--ok { background: var(--ok-tint); }
.pill--ok::before { background: var(--ok); }
.pill--warn { background: var(--warn-tint); }
.pill--warn::before { background: var(--warn); }
.pill--err { background: var(--err-tint); }
.pill--err::before { background: var(--err); border-radius: 1px; }
.pill--idle { background: transparent; box-shadow: inset 0 0 0 1px var(--signal); }
.pill--idle::before { background: transparent; box-shadow: inset 0 0 0 2px var(--slate); }

/* =========================================================
   6. SIGNATURE — LED live figure
   ========================================================= */
.led-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11em, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--rail); border-radius: var(--r-2); overflow: hidden; }
.led { padding: var(--s-2) var(--s-3) var(--s-3); border-inline-end: 1px solid var(--rail); display: grid; gap: 4px; align-content: start; }
.led:last-child { border-inline-end: 0; }
.led__label { display: flex; align-items: center; gap: 8px; font: 600 13px/16px var(--f-body); letter-spacing: .08em; text-transform: uppercase; color: var(--slate); }
.led__value { font-family: var(--f-mono); font-variant-numeric: tabular-nums slashed-zero; font-feature-settings: "tnum" 1, "zero" 1; font-size: var(--t-led); line-height: 1; font-weight: 500; letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
.led__unit { font-size: .4em; color: var(--slate); letter-spacing: 0; margin-inline-start: .2em; }
.led__meta { font: 400 13px/18px var(--f-mono); color: var(--slate); }
.led--live { background: var(--paper); }
.led--live .led__value { color: var(--ink); }
.live-dot { position: relative; width: 10px; height: 10px; border-radius: 50%; background: var(--live); flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--live); opacity: 0; animation: ring var(--dur-ring) var(--ease-out) infinite; }
@keyframes ring { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.8); opacity: 0; } }

/* =========================================================
   7. SIGNATURE — transit-line module map
   ========================================================= */
.tmap { display: grid; gap: var(--s-3); }
.tline { --c: var(--line-ride); display: grid; grid-template-columns: 9.5rem repeat(5, minmax(0, 1fr)); align-items: start; position: relative; }
.tline__name { display: flex; align-items: center; gap: 8px; font: 600 15px/20px var(--f-display); padding-block-start: 2px; }
.tline__name::before { content: ""; width: 14px; height: 14px; border-radius: 3px; background: var(--c); flex: none; }
.stop { position: relative; display: grid; justify-items: center; gap: 8px; text-align: center; padding-inline: 4px; }
.stop::before { content: ""; position: absolute; inset-inline: 0; top: 10px; height: 0; border-block-start: 6px solid var(--c); }
.stop:nth-child(2)::before { inset-inline-start: 50%; }
.stop:last-child::before { inset-inline-end: 50%; }
.stop.is-soon::before { border-block-start-style: dashed; }
.stop__dot { position: relative; z-index: 1; width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 4px solid var(--paper); box-shadow: 0 0 0 3px var(--c); margin-block-start: -0px; }
.stop.is-beta .stop__dot { background: var(--paper); border-width: 0; box-shadow: inset 0 0 0 5px var(--c); }
.stop.is-soon .stop__dot { background: var(--paper); border: 3px dashed var(--c); box-shadow: none; }
.stop.is-x .stop__dot { width: 44px; height: 26px; border-radius: 13px; background: var(--live); box-shadow: 0 0 0 3px var(--ink); border-color: var(--paper); }
.stop.is-x::after { content: ""; position: absolute; z-index: 0; top: 13px; height: calc(100% + var(--s-3)); width: 6px; background: var(--ink); inset-inline-start: calc(50% - 3px); }
.tline:last-child .stop.is-x::after { display: none; }
.stop.is-x .stop__name, .stop.is-x .stop__state { position: relative; z-index: 2; background: var(--paper); padding-inline: 6px; border-radius: 3px; }
.stop__name { font-size: 14px; line-height: 1.3; font-weight: 600; }
.stop__state { font-size: 13px; color: var(--slate); }
.tmap-key { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); font-size: 14px; color: var(--slate); margin-block-start: var(--s-3); padding-block-start: var(--s-2); border-block-start: 1px solid var(--rail); }
.tmap-key span { display: inline-flex; align-items: center; gap: 8px; }
.k-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--ink); }
.k-ring { width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 4px var(--ink); }
.k-dash { width: 28px; border-block-start: 4px dashed var(--ink); }
.k-x { width: 26px; height: 14px; border-radius: 7px; background: var(--live); box-shadow: 0 0 0 2px var(--ink); }
@media (max-width: 860px) {
  .tline { grid-template-columns: 1fr; gap: 0; padding-inline-start: 4px; }
  .tline__name { margin-block-end: var(--s-1); }
  .stop { grid-template-columns: 26px 1fr; justify-items: start; text-align: start; column-gap: 14px; row-gap: 0; padding: 6px 0 14px; }
  .stop::before { inset-inline: auto; inset-inline-start: 10px; top: 0; bottom: 0; height: auto; border-block-start: 0; border-inline-start: 6px solid var(--c); width: 0; }
  .stop.is-soon::before { border-inline-start-style: dashed; }
  .stop:nth-child(2)::before { top: 18px; inset-inline-start: 10px; }
  .stop:last-child::before { bottom: auto; height: 18px; inset-inline-end: auto; }
  .stop__dot, .stop.is-x .stop__dot { grid-row: span 2; width: 26px; }
  .stop.is-x::after { display: none; }
}

/* =========================================================
   8. SIGNATURE — annotated screenshot frame
   ========================================================= */
.shot { display: grid; gap: var(--s-3); }
@media (min-width: 1024px) { .shot { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); align-items: start; } }
.frame { position: relative; border: 2px solid var(--ink); border-radius: var(--r-2); background: var(--surface); overflow: hidden; }
.frame__bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-block-end: 2px solid var(--ink); background: var(--paper); font: 500 13px/16px var(--f-mono); color: var(--slate); }
.frame__bar b { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--signal); }
.frame__url { flex: 1; background: var(--surface); border: 1px solid var(--rail); border-radius: var(--r-1); padding: 4px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame__body { position: relative; }
.callout { position: absolute; z-index: 3; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--live); color: var(--on-live); font: 700 15px/1 var(--f-mono); text-decoration: none; box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink); transform: translate(-50%, -50%); }
[dir="rtl"] .callout { transform: translate(50%, -50%); }
.callout:hover { color: var(--on-live); background: var(--live); outline: 3px solid var(--ink); outline-offset: 3px; }
.callout--flow { position: relative; transform: none; width: 24px; height: 24px; font-size: 13px; display: inline-grid; vertical-align: middle; margin-inline: 6px; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
[dir="rtl"] .callout--flow { transform: none; }
.mini__kpi.on .callout--flow { box-shadow: 0 0 0 2px var(--live), 0 0 0 4px var(--on-live); background: var(--on-live); color: var(--live); }
.captions { margin: 0; padding: 0; list-style: none; counter-reset: cap; display: grid; gap: var(--s-2); }
.captions li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; padding: 8px; border-radius: var(--r-2); }
.captions li::before { counter-increment: cap; content: counter(cap); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--live); color: var(--on-live); font: 700 15px/1 var(--f-mono); }
.captions li:target, .captions li.is-hl { background: var(--info-tint); }
.captions strong { display: block; }

/* mini app UI used inside frames */
.mini { display: grid; grid-template-columns: 148px minmax(0, 1fr); min-height: 340px; font-size: 13px; }
.mini__side { background: var(--paper); border-inline-end: 1px solid var(--rail); padding: 12px; display: grid; align-content: start; gap: 4px; }
.mini__side span { padding: 7px 10px; border-radius: var(--r-1); color: var(--slate); }
.mini__side span.on { background: var(--info-tint); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--live); }
.mini__main { padding: 14px; display: grid; gap: 12px; align-content: start; }
.mini__kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.mini__kpi { border: 1px solid var(--rail); border-radius: var(--r-1); padding: 8px 10px; }
.mini__kpi b { display: block; font: 500 24px/1.1 var(--f-mono); font-variant-numeric: tabular-nums slashed-zero; font-feature-settings: "zero" 1; }
.mini__kpi.on { background: var(--live); border-color: var(--live); color: var(--on-live); }
.mini table { width: 100%; border-collapse: collapse; font: 13px/1.3 var(--f-mono); }
.mini td { border-block-end: 1px solid var(--rail); padding: 7px 4px; white-space: nowrap; }
@media (max-width: 560px) { .mini { grid-template-columns: 1fr; } .mini__side { display: none; } }

/* =========================================================
   9. HEADER, MEGA MENU, DRAWER, BOTTOM BAR, FOOTER
   ========================================================= */
.hdr { position: sticky; top: 0; z-index: 50; background: var(--paper); border-block-end: 1px solid var(--rail); }
.hdr__in { display: flex; align-items: center; gap: var(--s-3); height: var(--header-h); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font: 700 22px/1 var(--f-display); letter-spacing: -.03em; min-height: 44px; }
.brand:hover { color: var(--ink); }
.brand svg { width: 32px; height: 32px; }
.mark-line { fill: none; stroke: var(--action); stroke-width: 8; stroke-linejoin: round; }
.mark-stop { fill: var(--paper); stroke: var(--action); stroke-width: 4; }
.mark-x { fill: var(--live); stroke: var(--paper); stroke-width: 3; }
.nav { display: none; margin-inline-start: var(--s-2); }
.nav > ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__btn, .nav__link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; border: 0; background: none; color: var(--ink); font: 500 15px/1 var(--f-body); border-radius: var(--r-2); cursor: pointer; text-decoration: none; }
.nav__btn:hover, .nav__link:hover { background: var(--info-tint); color: var(--ink); }
.nav__btn[aria-expanded="true"] { background: var(--info-tint); box-shadow: inset 0 -3px 0 var(--live); }
.nav__btn .icon { width: 16px; height: 16px; transition: transform var(--dur-quick) var(--ease-out); }
.nav__btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
.mega { position: absolute; inset-inline: 0; top: 100%; background: var(--raised); border-block: 1px solid var(--rail); box-shadow: 0 12px 24px rgba(18, 19, 42, .08); }
.mega[hidden] { display: none; }
.mega__in { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); padding-block: var(--s-4); }
.mega__col { grid-column: span 3; display: grid; align-content: start; gap: 4px; }
.mega__h { font: 600 13px/16px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--slate); margin-block-end: 8px; display: flex; gap: 8px; align-items: center; }
.mega__col a { display: block; padding: 10px 12px; margin-inline: -12px; border-radius: var(--r-2); color: var(--ink); text-decoration: none; min-height: 44px; }
.mega__col a:hover { background: var(--info-tint); }
.mega__col a span { display: block; font-size: 14px; color: var(--slate); }
.mega__feature { grid-column: 10 / span 3; background: var(--paper); border-radius: var(--r-2); padding: var(--s-3); display: grid; gap: var(--s-1); align-content: start; }
.hdr__end { margin-inline-start: auto; display: flex; align-items: center; gap: var(--s-1); }
.hdr .hdr__cta { display: none; }
.hdr .menu-btn { display: inline-flex; }
@media (min-width: 1024px) {
  .nav { display: block; }
  .hdr .hdr__cta { display: inline-flex; }
  .hdr .menu-btn { display: none; }
}
.drawer { position: fixed; inset: var(--header-h) 0 0 0; z-index: 60; background: var(--paper); overflow-y: auto; padding: var(--s-2) var(--gutter) 120px; }
.drawer[hidden] { display: none; }
.acc-btn { display: flex; width: 100%; justify-content: space-between; align-items: center; min-height: 56px; padding: 0; border: 0; border-block-end: 1px solid var(--rail); background: none; color: var(--ink); font: 600 18px/1.2 var(--f-display); text-align: start; cursor: pointer; }
.acc-btn .icon { transition: transform var(--dur-quick) var(--ease-out); }
.acc-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
.acc-btn[aria-expanded="true"] { border-block-end-color: transparent; box-shadow: inset 4px 0 0 var(--live); padding-inline-start: 12px; }
.acc-panel { padding: 4px 0 16px; border-block-end: 1px solid var(--rail); }
.acc-panel[hidden] { display: none; }
.acc-panel a { display: flex; align-items: center; min-height: 44px; color: var(--ink); text-decoration: none; padding-inline-start: 12px; }
.bottom-bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 55; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--paper); border-block-start: 1px solid var(--rail); }
@media (min-width: 768px) { .bottom-bar { display: none; } }
@media (max-width: 767px) { body { padding-block-end: 72px; } }
.ftr { background: var(--ink); color: var(--paper); padding-block: var(--s-6) var(--s-4); margin-block-start: var(--s-6); }
[data-theme="dark"] .ftr { background: var(--surface); color: var(--ink); }
.ftr a { color: inherit; text-decoration: none; display: inline-flex; min-height: 44px; align-items: center; }
.ftr a:hover { text-decoration: underline; color: inherit; }
.ftr h2 { font: 600 13px/16px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: inherit; opacity: .78; margin-block-end: 8px; }
.ftr ul { list-style: none; margin: 0; padding: 0; }
.ftr__base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2); padding-block-start: var(--s-3); margin-block-start: var(--s-4); border-block-start: 1px solid currentColor; font-size: 14px; }
.ftr .mark-stop { fill: var(--ink); stroke: currentColor; }
.ftr .mark-line { stroke: currentColor; }
.ftr .mark-x { stroke: var(--ink); }
[data-theme="dark"] .ftr .mark-stop, [data-theme="dark"] .ftr .mark-x { fill: var(--surface); }
[data-theme="dark"] .ftr .mark-x { fill: var(--live); stroke: var(--surface); }
.lang { display: inline-flex; gap: 4px; }
.lang a { min-width: 44px; justify-content: center; border: 1px solid currentColor; border-radius: var(--r-1); }
.lang a[aria-current="true"] { background: var(--live); color: var(--on-live); border-color: var(--live); }

/* =========================================================
   10. BUTTONS
   ========================================================= */
.btn { --bg: var(--action); --fg: var(--on-action); --bd: var(--action); display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border: 2px solid var(--bd); border-radius: var(--r-2); background: var(--bg); color: var(--fg); font: 600 16px/1 var(--f-body); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background var(--dur-quick) var(--ease-out), border-color var(--dur-quick) var(--ease-out), transform var(--dur-instant) var(--ease-out); }
.btn:hover, .btn.is-hover { --bg: var(--action-hover); --bd: var(--action-hover); color: var(--fg); text-decoration: none; }
.btn:active, .btn.is-active { --bg: var(--action-active); --bd: var(--action-active); transform: translateY(1px); }
.btn:focus-visible, .btn.is-focus { outline: 3px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 3px var(--focus-gap) inset; }
.btn--secondary { --bg: transparent; --fg: var(--ink); --bd: var(--ink); }
.btn--secondary:hover, .btn--secondary.is-hover { --bg: var(--info-tint); --bd: var(--ink); --fg: var(--ink); }
.btn--secondary:active, .btn--secondary.is-active { --bg: var(--rail); --bd: var(--ink); }
.btn--text { --bg: transparent; --fg: var(--action); --bd: transparent; padding-inline: 12px; }
.btn--text:hover, .btn--text.is-hover { --bg: var(--info-tint); --bd: transparent; --fg: var(--action-hover); }
.btn--text:active, .btn--text.is-active { --bg: var(--rail); --bd: transparent; }
.btn--live { --bg: var(--live); --fg: var(--on-live); --bd: var(--live); }
.btn--live:hover, .btn--live.is-hover { --bg: var(--live); --bd: var(--ink); --fg: var(--on-live); }
.btn--live:active, .btn--live.is-active { --bg: var(--live); --bd: var(--ink); }
.btn--sm { min-height: 44px; padding: 0 14px; font-size: 15px; }
.btn--icon { width: 44px; min-height: 44px; padding: 0; }
.btn[disabled], .btn[aria-disabled="true"] { --bg: var(--rail); --bd: var(--rail); --fg: var(--slate); cursor: not-allowed; transform: none; }
.btn--secondary[disabled], .btn--text[disabled] { --bg: transparent; --bd: var(--rail); }
.btn--text[disabled] { --bd: transparent; }
.btn[aria-busy="true"] { cursor: progress; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 3px solid currentColor; border-inline-end-color: transparent; animation: spin 800ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-matrix { display: grid; grid-template-columns: 8rem repeat(6, max-content); gap: 12px 16px; align-items: center; }
.btn-matrix .h { font: 600 13px/16px var(--f-body); color: var(--slate); }

/* =========================================================
   11. CHIPS, CALLOUTS, ANSWER, FACTS, BREADCRUMBS
   ========================================================= */
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 12px 4px 10px; border-radius: var(--r-pill); border: 1px solid var(--signal); background: var(--surface); font: 600 14px/1 var(--f-body); color: var(--ink); white-space: nowrap; }
.chip i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.chip--ok i { background: var(--ok); }
.chip--beta i { box-shadow: inset 0 0 0 3px var(--action); }
.chip--soon i { border: 2px dashed var(--slate); }
.chip--tr b { font: 600 12px/1 var(--f-mono); background: var(--ink); color: var(--paper); padding: 3px 5px; border-radius: 3px; }
.chip small { font: 500 13px/1 var(--f-mono); color: var(--slate); }
.callout-box { display: grid; grid-template-columns: 24px 1fr; gap: 12px; padding: var(--s-2) var(--s-3); border-radius: var(--r-2); background: var(--info-tint); border-inline-start: 4px solid var(--action); }
.callout-box .icon { color: var(--action); }
.callout-box--ok { background: var(--ok-tint); border-color: var(--ok); }
.callout-box--ok .icon { color: var(--ok); }
.callout-box--warn { background: var(--warn-tint); border-color: var(--warn); }
.callout-box--warn .icon { color: var(--warn); }
.callout-box--err { background: var(--err-tint); border-color: var(--err); }
.callout-box--err .icon { color: var(--err); }
.callout-box strong { display: block; margin-block-end: 2px; }
.answer { border: 2px solid var(--ink); border-radius: var(--r-2); padding: var(--s-3); background: var(--surface); display: grid; gap: var(--s-1); }
.answer__q { font: 600 13px/16px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--slate); display: flex; gap: 8px; align-items: center; }
.answer__a { font: 600 20px/1.45 var(--f-display); letter-spacing: -.01em; max-width: 60ch; }
.facts { width: 100%; border-collapse: collapse; font-size: 15px; }
.facts th { text-align: start; font-weight: 600; width: 38%; padding: 12px 16px 12px 0; border-block-end: 1px solid var(--rail); vertical-align: top; }
.facts td { padding: 12px 0; border-block-end: 1px solid var(--rail); }
.facts caption { text-align: start; font: 600 13px/16px var(--f-body); letter-spacing: .1em; text-transform: uppercase; color: var(--slate); padding-block-end: 8px; border-block-end: 2px solid var(--ink); }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 0; list-style: none; margin: 0; padding: 0; font-size: 14px; }
.crumbs li { display: inline-flex; align-items: center; }
.crumbs li + li::before { content: ""; width: 7px; height: 7px; margin-inline: 12px; border-block-start: 2px solid var(--signal); border-inline-end: 2px solid var(--signal); transform: rotate(45deg); }
[dir="rtl"] .crumbs li + li::before { transform: rotate(-135deg); }
.crumbs a { display: inline-flex; align-items: center; min-height: 44px; color: var(--slate); }
.crumbs a:hover { color: var(--action); }
.crumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

/* =========================================================
   12. FAQ / ACCORDION, TABS
   ========================================================= */
.faq { border-block-start: 2px solid var(--ink); }
.faq h3 { margin: 0; font: inherit; }
.faq__btn { display: flex; width: 100%; gap: 16px; justify-content: space-between; align-items: center; min-height: 64px; padding: 12px 0; border: 0; border-block-end: 1px solid var(--rail); background: none; color: var(--ink); font: 600 18px/1.35 var(--f-display); text-align: start; cursor: pointer; }
.faq__btn:hover { color: var(--action); }
.faq__btn .icon { transition: transform var(--dur-base) var(--ease-out); color: var(--action); }
.faq__btn[aria-expanded="true"] .icon { transform: rotate(45deg); color: var(--live); }
.faq__panel { padding: 4px 0 24px; border-block-end: 1px solid var(--rail); }
.faq__panel[hidden] { display: none; }
.tabs [role="tablist"] { display: flex; gap: 4px; border-block-end: 2px solid var(--rail); overflow-x: auto; }
.tabs [role="tab"] { min-height: 48px; padding: 0 16px; border: 0; background: none; color: var(--slate); font: 600 15px/1 var(--f-body); cursor: pointer; border-block-end: 3px solid transparent; margin-block-end: -2px; white-space: nowrap; }
.tabs [role="tab"]:hover { color: var(--ink); background: var(--info-tint); }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); border-block-end-color: var(--live); }
.tabs [role="tab"][disabled] { color: var(--signal); cursor: not-allowed; background: none; }
.tabs [role="tabpanel"] { padding-block-start: var(--s-3); }
.tabs [role="tabpanel"]:focus-visible { outline-offset: 6px; }

/* =========================================================
   13. FORMS
   ========================================================= */
.field { display: grid; gap: 6px; max-width: 480px; }
.field label, .field legend { font: 600 15px/20px var(--f-body); color: var(--ink); padding: 0; }
.req { color: var(--err); margin-inline-start: 2px; }
.hint { font-size: 14px; color: var(--slate); }
.input, .select, .textarea { width: 100%; min-height: 48px; padding: 10px 14px; border: 2px solid var(--signal); border-radius: var(--r-2); background: var(--surface); color: var(--ink); font: 400 16px/1.4 var(--f-body); transition: border-color var(--dur-quick) var(--ease-out); }
.input::placeholder { color: var(--slate); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--slate); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible, .input.is-focus { outline: 3px solid var(--focus); outline-offset: 2px; border-color: var(--ink); }
.input[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--err); background: var(--err-tint); }
.input[disabled], .select[disabled] { background: var(--paper); border-color: var(--rail); color: var(--slate); cursor: not-allowed; }
.input[readonly] { background: var(--paper); border-style: dashed; }
.err-msg { display: flex; gap: 8px; align-items: flex-start; font: 600 14px/20px var(--f-body); color: var(--err); }
.err-msg .icon { width: 20px; height: 20px; }
.input-wrap { position: relative; }
.input-wrap .input { padding-inline-start: 44px; }
.input-wrap .icon { position: absolute; inset-inline-start: 12px; top: 12px; color: var(--slate); }
.check { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 16px; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--action); margin: 0; flex: none; }
.check input:disabled + span { color: var(--slate); }
.form-grid { display: grid; gap: var(--s-3); }
@media (min-width: 768px) { .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.err-summary { border: 2px solid var(--err); border-radius: var(--r-2); padding: var(--s-2) var(--s-3); background: var(--err-tint); }
.err-summary h3 { font-size: 18px; }
.err-summary ul { margin: 8px 0 0; padding-inline-start: 20px; }
.err-summary a { color: var(--ink); font-weight: 600; }

/* =========================================================
   14. CODE, TOAST, MODAL, SKELETON, EMPTY/ERROR
   ========================================================= */
.code { position: relative; background: #12132A; color: #F2F2FA; border-radius: var(--r-2); }
[data-theme="dark"] .code { background: #07081A; box-shadow: inset 0 0 0 1px var(--rail); }
.code__bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 4px 4px 16px; border-block-end: 1px solid #2B2D45; font: 500 13px/1 var(--f-mono); color: #A4A7C2; }
.code pre { margin: 0; padding: 16px; overflow-x: auto; font: 400 14px/1.6 var(--f-mono); font-variant-numeric: slashed-zero; font-feature-settings: "zero" 1; }
.code .k { color: #A3ABFF; }
.code .s { color: #9FE0B8; }
.code .n { color: #FFB38A; }
.code .c { color: #A4A7C2; }
.code .copy { min-height: 44px; min-width: 64px; border: 1px solid #4A4C63; background: none; color: #F2F2FA; border-radius: var(--r-1); font: 600 13px/1 var(--f-body); cursor: pointer; }
.code .copy:hover { background: #2B2D45; }
.code .copy:focus-visible { outline-color: #A3ABFF; }
.toasts { position: fixed; z-index: 80; inset-inline-end: var(--gutter); bottom: calc(var(--gutter) + 72px); display: grid; gap: 8px; width: min(380px, calc(100vw - 2 * var(--gutter))); }
@media (min-width: 768px) { .toasts { bottom: var(--gutter); } }
.toast { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: start; padding: 14px 8px 14px 16px; background: var(--ink); color: var(--paper); border-radius: var(--r-2); box-shadow: 0 8px 24px rgba(18, 19, 42, .24); animation: toast-in var(--dur-base) var(--ease-out); border-inline-start: 4px solid var(--live); }
.toast p { font-size: 15px; }
.toast button { min-width: 44px; min-height: 44px; border: 0; background: none; color: inherit; cursor: pointer; border-radius: var(--r-1); margin-block: -10px; }
.toast button:focus-visible { outline-color: var(--live); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
dialog.modal { width: min(560px, calc(100vw - 32px)); padding: 0; border: 2px solid var(--ink); border-radius: var(--r-2); background: var(--raised); color: var(--ink); }
dialog.modal::backdrop { background: rgba(14, 15, 31, .55); }
dialog.modal[open] { animation: toast-in var(--dur-base) var(--ease-out); }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 16px 16px 24px; border-block-end: 1px solid var(--rail); }
.modal__body { padding: 24px; display: grid; gap: 16px; }
.modal__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 16px 24px 24px; }
.skel { display: block; border-radius: var(--r-1); background: linear-gradient(90deg, var(--skel) 0, var(--skel-hi) 50%, var(--skel) 100%) 0 0 / 200% 100%; animation: shimmer 1400ms linear infinite; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.skel-line { height: 16px; margin-block: 8px; }
.skel-fig { height: 48px; width: 60%; }
.state { display: grid; justify-items: start; gap: var(--s-2); padding: var(--s-4); border: 2px dashed var(--rail); border-radius: var(--r-2); background: var(--surface); }
.state svg.state__pic { width: 200px; height: 64px; color: var(--signal); }
.state--err { border-color: var(--err); border-style: solid; }
.state--err svg.state__pic { color: var(--err); }

/* =========================================================
   15. SPECIMEN HELPERS
   ========================================================= */
.sw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sw { border-radius: var(--r-2); overflow: hidden; border: 1px solid var(--rail); background: var(--surface); }
.sw__c { height: 72px; }
.sw__t { padding: 8px 10px; font-size: 13px; line-height: 1.35; }
.sw__t b { display: block; font-size: 14px; }
.sw__t code { color: var(--slate); }
.theme-pair { display: grid; gap: var(--s-2); }
@media (min-width: 1024px) { .theme-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.theme-pair > * { min-width: 0; }
.theme-pane { background: var(--paper); color: var(--ink); border-radius: var(--r-2); padding: var(--s-3); border: 1px solid var(--rail); }
.ctable { width: 100%; border-collapse: collapse; font-size: 14px; }
.ctable th { text-align: start; font: 600 13px/16px var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--slate); padding: 8px; border-block-end: 2px solid var(--ink); white-space: nowrap; }
.ctable td { padding: 8px; border-block-end: 1px solid var(--rail); vertical-align: middle; }
.ctable .r { text-align: end; white-space: nowrap; }
.ctable .aa { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; }
.ctable .aa::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--ok); }
.ctable .aa.fail::before { background: var(--err); border-radius: 1px; }
.ctable .sample { display: inline-grid; place-items: center; min-width: 56px; height: 32px; border-radius: var(--r-1); font-weight: 600; border: 1px solid var(--rail); }
.type-row { display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: 8px 24px; padding-block: 16px; border-block-end: 1px solid var(--rail); align-items: baseline; }
.type-row .spec { font: 400 13px/18px var(--f-mono); color: var(--slate); }
@media (max-width: 640px) { .type-row { grid-template-columns: 1fr; } }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.icon-cell { display: grid; justify-items: center; gap: 8px; padding: 16px 8px; background: var(--surface); border: 1px solid var(--rail); border-radius: var(--r-2); font-size: 13px; text-align: center; }
.icon-cell .icon { width: 32px; height: 32px; stroke-width: 2.5; }
.grid-demo { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gutter); height: 120px; background-image: repeating-linear-gradient(0deg, transparent 0 7px, var(--rail) 7px 8px); }
.grid-demo span { background: color-mix(in srgb, var(--action) 12%, transparent); border-inline: 1px solid color-mix(in srgb, var(--action) 40%, transparent); }
.grid-demo span:nth-child(-n+7) { background: color-mix(in srgb, var(--action) 22%, transparent); }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th { text-align: start; font: 600 13px/16px var(--f-body); letter-spacing: .06em; text-transform: uppercase; color: var(--slate); padding: 10px 12px 10px 0; border-block-end: 2px solid var(--ink); }
.tbl td { padding: 12px 12px 12px 0; border-block-end: 1px solid var(--rail); vertical-align: top; }
.tbl td:first-child { font-weight: 600; white-space: nowrap; }
.tbl code { white-space: nowrap; }
.outline-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.outline-list li { padding: 6px 0 6px calc((var(--lvl, 1) - 1) * 20px); border-block-end: 1px solid var(--rail); display: flex; gap: 10px; }
.outline-list b { font: 600 13px/20px var(--f-mono); color: var(--action); min-width: 24px; }
.og-wrap { width: 100%; aspect-ratio: 1200 / 630; position: relative; overflow: hidden; border: 1px solid var(--rail); border-radius: var(--r-2); }
.og { position: absolute; top: 0; inset-inline-start: 0; width: 1200px; height: 630px; transform-origin: 0 0; background: var(--paper); color: var(--ink); padding: 72px 80px; display: grid; grid-template-rows: auto 1fr auto; }
[dir="rtl"] .og { transform-origin: 100% 0; }
.og__ticks { position: absolute; top: 0; inset-inline: 80px; height: 20px; display: grid; grid-template-columns: repeat(12, 1fr); }
.og__ticks i { border-inline-start: 2px solid var(--signal); height: 14px; }
.og__title { font: 700 76px/1.05 var(--f-display); letter-spacing: -.03em; max-width: 960px; align-self: center; outline: none; }
.og__foot { display: flex; justify-content: space-between; align-items: flex-end; font: 500 26px/1 var(--f-mono); color: var(--slate); }
.og .station { font-size: 24px; line-height: 1; gap: 14px; }
.og .station .icon { width: 26px; height: 26px; }

/* =========================================================
   16. MARKETING / PAGE HELPERS
   ========================================================= */
.hero { padding-block: var(--s-5) var(--s-6); }
.hero__grid { display: grid; gap: var(--s-5); }
@media (min-width: 1024px) { .hero__grid { grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); align-items: center; } }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; }
.rule-list { list-style: none; margin: 0; padding: 0; border-block-start: 2px solid var(--ink); }
.rule-list li { display: grid; grid-template-columns: 40px 1fr; gap: 16px; padding-block: var(--s-3); border-block-end: 1px solid var(--rail); }
.rule-list .icon { width: 32px; height: 32px; color: var(--action); stroke-width: 2.5; }
.dir-map { position: relative; }
.app { display: grid; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--r-2); overflow: hidden; }
@media (min-width: 1024px) { .app { grid-template-columns: 232px minmax(0, 1fr); } }
.app__side { background: var(--surface); border-block-end: 1px solid var(--rail); padding: var(--s-2); }
@media (min-width: 1024px) { .app__side { border-block-end: 0; border-inline-end: 1px solid var(--rail); } }
.app__side ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
@media (min-width: 1024px) { .app__side ul { display: grid; } }
.app__side a { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--r-2); color: var(--ink); text-decoration: none; font-weight: 500; }
.app__side a:hover { background: var(--info-tint); }
.app__side a[aria-current="page"] { background: var(--info-tint); box-shadow: inset 4px 0 0 var(--live); font-weight: 600; }
.app__main { padding: var(--s-3); display: grid; gap: var(--s-3); min-width: 0; }
.app__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--s-2); }
.docs { display: grid; gap: var(--s-4); }
@media (min-width: 1024px) { .docs { grid-template-columns: 220px minmax(0, 1fr); } }
.docs__nav ul { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--rail); }
.docs__nav a { display: flex; align-items: center; min-height: 40px; padding-inline-start: 14px; margin-inline-start: -2px; border-inline-start: 2px solid transparent; color: var(--slate); text-decoration: none; font-size: 15px; }
.docs__nav a:hover { color: var(--ink); border-inline-start-color: var(--signal); }
.docs__nav a[aria-current="page"] { color: var(--ink); font-weight: 600; border-inline-start-color: var(--live); }
.method { font: 600 13px/1 var(--f-mono); background: var(--ok-tint); color: var(--ink); padding: 5px 8px; border-radius: var(--r-1); box-shadow: inset 0 0 0 1px var(--ok); }
.page-dir { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; border-block-start: 2px solid var(--ink); }
.page-dir a { display: grid; grid-template-columns: 56px 1fr auto; gap: 16px; align-items: center; padding: 20px 0; border-block-end: 1px solid var(--rail); color: var(--ink); text-decoration: none; min-height: 44px; }
.page-dir a:hover { background: var(--info-tint); padding-inline: 12px; }
.page-dir .no { font: 600 15px/1 var(--f-mono); color: var(--action); }
.page-dir b { font: 600 20px/1.3 var(--f-display); display: block; }
.page-dir span span { color: var(--slate); font-size: 15px; }

/* =========================================================
   17. MOTION — reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
  .route.is-drawing path.route__line { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
  .route.is-drawing .route__stop, .route.is-drawing .route__x { opacity: 1; animation: none; }
  .board tr.is-flipping .cell { animation: none; }
  .live-dot::after { animation: none; opacity: .5; transform: scale(1.4); }
  .skel { animation: none; }
  .spin { animation: none; border-inline-end-color: currentColor; border-block-start-color: transparent; }
}

/* module map: interchange labelled once, above the first line, so the connector stays solid */
@media (min-width: 861px) {
  .tmap { padding-block-start: 32px; }
  .tline + .tline .stop.is-x .stop__name, .tline + .tline .stop.is-x .stop__state, .tline:first-child .stop.is-x .stop__state { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tline:first-child .stop.is-x .stop__name { position: absolute; bottom: calc(100% + 6px); inset-inline-start: 50%; transform: translateX(-50%); white-space: nowrap; background: var(--live); color: var(--on-live); font-size: 13px; padding: 2px 8px; border-radius: var(--r-1); }
  [dir="rtl"] .tline:first-child .stop.is-x .stop__name { transform: translateX(50%); }
  .stop.is-x { align-self: stretch; }
  .stop.is-x::after { height: calc(100% + var(--s-3)); }
}
