@font-face {
  font-family: "Manrope";
  src: url("../records-hub/service-operations/assets/fonts/Manrope-Variable.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --accent: #2767d8;
  --ink: #162019;
  --muted: #667069;
  --paper: #f3f5f1;
  --panel: #ffffff;
  --soft: #e7ebe5;
  --rule: #cfd5ce;
  --positive: #216447;
  --positive-bg: #e5f1e9;
  --warning: #815a09;
  --warning-bg: #f6edd7;
  --critical: #a33d32;
  --critical-bg: #f8e6e2;
  --rail: #111713;
  --rail-ink: #edf2ed;
  --rail-muted: #929d95;
  color-scheme: light;
  font-family: "Manrope", Arial, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
::selection { color: #fff; background: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 100; padding: .8rem 1rem; color: #fff; background: var(--accent); }
.skip-link:focus { top: 1rem; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side-rail { position: sticky; top: 0; height: 100vh; z-index: 20; display: flex; flex-direction: column; color: var(--rail-ink); background: var(--rail); border-right: 1px solid #2d3730; }
.identity { display: flex; align-items: center; gap: .8rem; min-height: 80px; padding: 0 1.4rem; color: inherit; text-decoration: none; border-bottom: 1px solid #2d3730; }
.identity-mark { display: grid; grid-template-columns: repeat(2, 7px); grid-template-rows: repeat(2, 7px); gap: 3px; transform: rotate(45deg); }
.identity-mark i { display: block; background: var(--accent); }
.identity-copy { min-width: 0; display: grid; }
.identity-copy strong { font-size: .98rem; line-height: 1.2; letter-spacing: -.02em; }
.identity-copy small { margin-top: .2rem; overflow: hidden; color: var(--rail-muted); font-size: .63rem; text-overflow: ellipsis; white-space: nowrap; }
.primary-nav { display: grid; gap: .2rem; padding: 1.3rem .8rem; }
.primary-nav button { position: relative; display: grid; grid-template-columns: 28px 1fr; align-items: center; min-height: 46px; padding: .45rem .7rem; color: var(--rail-muted); text-align: left; background: transparent; border: 0; }
.primary-nav button::before { content: ""; position: absolute; inset-block: 8px; left: -.8rem; width: 3px; background: transparent; }
.primary-nav button:hover { color: var(--rail-ink); background: #19211c; }
.primary-nav button.is-active { color: var(--rail-ink); background: #202923; }
.primary-nav button.is-active::before { background: var(--accent); }
.primary-nav button svg { width: 1.05rem; height: 1.05rem; }
.primary-nav button span { font-size: .76rem; font-weight: 700; }
.rail-footer { margin-top: auto; padding: 1rem .8rem 1.2rem; border-top: 1px solid #2d3730; }
.rail-state { display: grid; grid-template-columns: 8px 1fr; gap: .25rem .65rem; padding: .7rem; }
.rail-state i { width: 8px; height: 8px; margin-top: .3rem; background: var(--accent); border-radius: 50%; }
.rail-state strong { font-size: .7rem; }
.rail-state small { grid-column: 2; color: var(--rail-muted); font-size: .62rem; }
.rail-reset { width: 100%; min-height: 40px; padding: .5rem .7rem; color: var(--rail-muted); text-align: left; background: transparent; border: 1px solid #354039; }
.rail-reset:hover { color: var(--rail-ink); border-color: #66726a; }

.app-main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 15; display: grid; grid-template-columns: auto 1fr auto; align-items: center; min-height: 80px; padding: 0 clamp(1rem, 3vw, 3rem); background: rgba(243, 245, 241, .96); border-bottom: 1px solid var(--rule); }
.page-coordinate { color: var(--muted); font-size: .68rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.page-coordinate::before { content: ""; display: inline-block; width: 24px; height: 1px; margin-right: .6rem; vertical-align: middle; background: var(--accent); }
.topbar-context { justify-self: center; color: var(--muted); font-size: .7rem; }
.role-control { display: grid; grid-template-columns: auto minmax(116px, 1fr); align-items: center; gap: .6rem; color: var(--muted); font-size: .66rem; font-weight: 700; }
.role-control select, .worklist-tools select { min-height: 40px; padding: 0 2rem 0 .7rem; color: var(--ink); background: var(--panel); border: 1px solid var(--rule); border-radius: 0; }
.mobile-menu { display: none; place-items: center; width: 42px; height: 42px; background: var(--panel); border: 1px solid var(--rule); }
.rail-scrim { display: none; }

.system-intro { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(240px, .75fr); gap: clamp(2rem, 5vw, 7rem); align-items: end; padding: clamp(2.2rem, 5vw, 5rem) clamp(1rem, 3vw, 3rem) clamp(1.8rem, 3.5vw, 3rem); border-bottom: 1px solid var(--rule); }
.system-intro h1 { max-width: 13ch; margin: 0; font-size: clamp(2.2rem, 4.5vw, 4.9rem); line-height: .97; letter-spacing: -.04em; text-wrap: balance; }
.system-intro p { max-width: 55ch; margin: 0; color: var(--muted); font-size: clamp(.9rem, 1.25vw, 1.1rem); line-height: 1.6; }
.app-view { min-height: calc(100vh - 80px); padding: clamp(1rem, 2.4vw, 2.5rem) clamp(1rem, 3vw, 3rem) 4rem; outline: none; }

.message-region { position: fixed; top: 96px; right: 1.4rem; z-index: 80; display: grid; grid-template-columns: 24px minmax(0, 1fr) 34px; gap: .7rem; align-items: center; width: min(430px, calc(100vw - 2rem)); padding: .8rem; color: var(--ink); background: var(--panel); border: 1px solid var(--rule); box-shadow: 0 12px 28px rgba(15, 26, 18, .14); }
.message-region[hidden] { display: none; }
.message-region > span { display: grid; place-items: center; width: 24px; height: 24px; color: #fff; font-weight: 800; background: var(--positive); border-radius: 50%; }
.message-region[data-type="error"] > span { background: var(--critical); }
.message-region strong { font-size: .76rem; line-height: 1.45; }
.message-region button { display: grid; place-items: center; width: 34px; height: 34px; background: transparent; border: 0; }

.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: clamp(1.2rem, 2vw, 2rem); border: 1px solid var(--rule); background: var(--panel); }
.stat-strip button { display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; min-height: 96px; padding: 1rem; text-align: left; background: transparent; border: 0; border-right: 1px solid var(--rule); }
.stat-strip button:last-child { border-right: 0; }
.stat-strip button:hover { background: var(--soft); }
.stat-strip span { color: var(--muted); font-size: .64rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.stat-strip strong { grid-row: 1 / 3; grid-column: 2; align-self: center; font-size: clamp(1.7rem, 3vw, 2.6rem); font-weight: 650; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.stat-strip small { font-size: .68rem; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; padding: .65rem .9rem; font-size: .72rem; font-weight: 750; border: 1px solid var(--ink); border-radius: 0; }
.button.primary { color: #fff; background: var(--ink); }
.button.primary:hover { background: var(--accent); border-color: var(--accent); }
.button.secondary { color: var(--ink); background: var(--panel); border-color: var(--rule); }
.button.secondary:hover { border-color: var(--ink); }
.status-chip { display: inline-flex; align-items: center; width: fit-content; min-height: 25px; padding: .28rem .5rem; color: var(--muted); font-size: .61rem; font-weight: 750; line-height: 1.2; background: var(--soft); border-radius: 999px; white-space: nowrap; }
.status-chip::before { content: ""; width: 5px; height: 5px; margin-right: .4rem; background: currentColor; border-radius: 50%; }
.status-chip[data-tone="positive"] { color: var(--positive); background: var(--positive-bg); }
.status-chip[data-tone="warning"] { color: var(--warning); background: var(--warning-bg); }
.status-chip[data-tone="critical"] { color: var(--critical); background: var(--critical-bg); }

.section-head { display: flex; align-items: start; justify-content: space-between; gap: 1rem; padding: 1.2rem 1.3rem; border-bottom: 1px solid var(--rule); }
.section-head h2, .cohort-title h2, .service-title h2, .shipment-list h2, .layer-panel h2 { margin: 0; font-size: 1.1rem; letter-spacing: -.025em; }
.section-head p, .cohort-title p, .service-title p, .shipment-list p, .layer-panel p { margin: .3rem 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.section-head > span, .service-title > span { color: var(--muted); font-size: .65rem; }

.detail-panel { min-width: 0; background: var(--panel); }
.detail-head { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start; padding: 1.25rem; border-bottom: 1px solid var(--rule); }
.detail-head span:first-child, .match-pane > header span, .route-pane > header span, .workflow-record > header span { color: var(--accent); font-size: .62rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.detail-head h2, .match-pane > header h2, .route-pane > header h2, .workflow-record > header h2 { margin: .28rem 0 0; font-size: clamp(1.15rem, 2vw, 1.65rem); line-height: 1.08; letter-spacing: -.035em; }
.detail-head p { margin: .45rem 0 0; color: var(--muted); font-size: .72rem; line-height: 1.45; }
.record-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-bottom: 1px solid var(--rule); }
.record-fields div { min-width: 0; padding: .8rem 1.25rem; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.record-fields div:nth-child(2n) { border-right: 0; }
.record-fields dt { color: var(--muted); font-size: .58rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.record-fields dd { margin: .24rem 0 0; overflow-wrap: anywhere; font-size: .72rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.record-history { padding: 1rem 1.25rem 1.2rem; border-bottom: 1px solid var(--rule); }
.record-history h3 { margin: 0 0 .8rem; font-size: .72rem; }
.record-history ol { display: grid; gap: .7rem; margin: 0; padding: 0; list-style: none; }
.record-history li { display: grid; grid-template-columns: 8px 1fr; gap: .65rem; align-items: start; }
.record-history li i { width: 7px; height: 7px; margin-top: .34rem; background: var(--accent); border-radius: 50%; }
.record-history li span { display: grid; }
.record-history li strong { font-size: .67rem; }
.record-history li small { margin-top: .12rem; color: var(--muted); font-size: .6rem; }
.action-panel { display: grid; gap: .8rem; padding: 1.1rem 1.25rem 1.25rem; background: color-mix(in srgb, var(--accent) 6%, var(--panel)); }
.action-panel header { display: grid; grid-template-columns: 28px 1fr; gap: .6rem; align-items: start; }
.action-panel header > span, .action-panel.is-complete > span { display: grid; place-items: center; width: 28px; height: 28px; color: #fff; background: var(--accent); }
.action-panel strong { font-size: .73rem; }
.action-panel p { margin: .2rem 0 0; color: var(--muted); font-size: .65rem; line-height: 1.45; }
.action-panel label { display: grid; gap: .35rem; }
.action-panel label > span { font-size: .62rem; font-weight: 750; }
.action-panel input { width: 100%; min-height: 42px; padding: 0 .7rem; color: var(--ink); background: var(--panel); border: 1px solid var(--rule); border-radius: 0; }
.action-panel .inline-notice { margin: 0; padding: .55rem .7rem; color: var(--warning); background: var(--warning-bg); }
.action-panel.is-complete { grid-template-columns: 28px 1fr; }

/* Finance: ledger and matching equation */
.finance-board { display: grid; grid-template-columns: minmax(460px, 1.08fr) minmax(460px, .92fr); min-height: 610px; background: var(--panel); border: 1px solid var(--rule); }
.ledger-pane { border-right: 1px solid var(--rule); }
.ledger-head, .ledger-row { display: grid; grid-template-columns: .75fr 1.15fr .7fr .7fr; gap: .8rem; align-items: center; }
.ledger-head { min-height: 40px; padding: 0 1.2rem; color: var(--muted); font-size: .58rem; font-weight: 750; text-transform: uppercase; border-bottom: 1px solid var(--rule); }
.ledger-row { width: 100%; min-height: 70px; padding: .7rem 1.2rem; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--rule); }
.ledger-row:hover, .ledger-row.is-selected { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.ledger-row.is-selected { box-shadow: inset 3px 0 0 var(--accent); }
.ledger-row > span:first-child { display: grid; }
.ledger-row strong { font-size: .7rem; }
.ledger-row small { color: var(--muted); font-size: .58rem; }
.ledger-row > span { font-size: .7rem; }
.money { font-weight: 750; font-variant-numeric: tabular-nums; }
.match-pane > header, .route-pane > header { padding: 1.25rem; border-bottom: 1px solid var(--rule); }
.match-equation { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: .55rem; align-items: center; padding: 1rem 1.25rem; background: var(--ink); color: #fff; }
.match-equation > span { display: grid; }
.match-equation small { color: #aeb8b0; font-size: .56rem; }
.match-equation strong { margin-top: .2rem; font-size: .82rem; font-variant-numeric: tabular-nums; }
.match-equation b { color: var(--accent); font-size: 1rem; }

/* Programme: participant cohort matrix */
.programme-board { display: grid; grid-template-columns: minmax(520px, 1.1fr) minmax(380px, .9fr); background: var(--panel); border: 1px solid var(--rule); }
.cohort-title { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 2rem; align-items: center; padding: 1.3rem; border-bottom: 1px solid var(--rule); }
.cohort-grid { min-width: 0; border-right: 1px solid var(--rule); }
.participant-row { display: grid; grid-template-columns: 40px minmax(140px, 1fr) minmax(90px, .65fr) 46px auto; gap: .75rem; align-items: center; width: 100%; min-height: 78px; padding: .8rem 1.1rem; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--rule); }
.participant-row:hover, .participant-row.is-selected { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.participant-row.is-selected { box-shadow: inset 3px 0 0 var(--accent); }
.participant-mark { display: grid; place-items: center; width: 36px; height: 36px; color: #fff; font-size: .63rem; font-weight: 800; background: var(--ink); border-radius: 50%; }
.participant-row > span:nth-child(2) { display: grid; }
.participant-row strong { font-size: .7rem; }
.participant-row small { color: var(--muted); font-size: .59rem; }
.participant-row > b { font-size: .65rem; font-variant-numeric: tabular-nums; }
.progress-track { height: 5px; overflow: hidden; background: var(--soft); }
.progress-track i { display: block; height: 100%; background: var(--accent); }

/* Spatial: map and layers */
.spatial-board { display: grid; grid-template-columns: 250px minmax(440px, 1fr) minmax(360px, .72fr); min-height: 650px; background: var(--panel); border: 1px solid var(--rule); }
.layer-panel { border-right: 1px solid var(--rule); }
.layer-panel > header, .shipment-list > header { padding: 1.2rem; border-bottom: 1px solid var(--rule); }
.layer-row { display: grid; grid-template-columns: 10px 1fr; gap: .7rem; width: 100%; padding: .8rem 1rem; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--rule); }
.layer-row:hover, .layer-row.is-selected { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.layer-row.is-selected { box-shadow: inset 3px 0 0 var(--accent); }
.layer-row > i { width: 10px; height: 10px; margin-top: .2rem; background: var(--layer); }
.layer-row > span { display: grid; }
.layer-row strong { font-size: .67rem; }
.layer-row small { margin-top: .2rem; color: var(--muted); font-size: .56rem; }
.layer-row .status-chip { grid-column: 2; margin-top: .45rem; }
.map-workspace { position: relative; overflow: hidden; min-height: 520px; background: #e8ece6; border-right: 1px solid var(--rule); }
.map-workspace > svg { width: 100%; height: 100%; min-height: 520px; }
.map-land { fill: #e7ebe4; stroke: none; }
.map-road { fill: none; stroke: #c7cec5; stroke-width: 35; }
.map-road + .map-water { fill: none; stroke: #8fb7c5; stroke-width: 28; opacity: .8; }
.hazard-zone { fill: #e7b0a3; fill-opacity: .55; stroke: #ad5b4c; stroke-width: 2; stroke-dasharray: 7 5; }
.parcel { fill: #f7f8f5; fill-opacity: .65; stroke: #829084; stroke-width: 2; }
.parcel.conflict { fill: #f6cf87; fill-opacity: .55; stroke: #8f6b23; }
.asset-point circle:first-child { fill: var(--accent); stroke: #fff; stroke-width: 3; }
.asset-point circle:last-child { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .5; }
.map-workspace text { fill: #26352c; stroke: none; font: 700 13px Manrope, sans-serif; }
.map-tools { position: absolute; top: 1rem; left: 1rem; display: grid; background: var(--panel); border: 1px solid var(--rule); }
.map-tools button { width: 36px; height: 36px; background: transparent; border: 0; border-bottom: 1px solid var(--rule); }
.map-tools button:last-child { border-bottom: 0; }
.map-legend { position: absolute; left: 1rem; bottom: 1rem; display: flex; gap: 1rem; padding: .65rem .8rem; color: var(--muted); font-size: .58rem; background: var(--panel); border: 1px solid var(--rule); }
.map-legend span { display: flex; align-items: center; gap: .4rem; }
.map-legend i { width: 10px; height: 10px; }
.legend-hazard { background: #e7b0a3; }
.legend-asset { background: var(--accent); border-radius: 50%; }

/* Laboratory: compact worklist and specimen record */
.laboratory-board { display: grid; grid-template-columns: minmax(520px, 1.05fr) minmax(400px, .95fr); min-height: 650px; background: var(--panel); border: 1px solid var(--rule); }
.lab-queue { border-right: 1px solid var(--rule); }
.lab-columns, .lab-row { display: grid; grid-template-columns: 1.2fr .55fr .65fr .7fr; gap: .75rem; align-items: center; }
.lab-columns { min-height: 40px; padding: 0 1.2rem; color: var(--muted); font-size: .57rem; font-weight: 750; text-transform: uppercase; border-bottom: 1px solid var(--rule); }
.lab-row { width: 100%; min-height: 72px; padding: .75rem 1.2rem; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--rule); }
.lab-row:hover, .lab-row.is-selected { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.lab-row.is-selected { box-shadow: inset 3px 0 0 var(--accent); }
.lab-row > span:first-child { display: grid; }
.lab-row strong { font-size: .7rem; }
.lab-row small { color: var(--muted); font-size: .59rem; }
.lab-row > b, .lab-row > span { font-size: .66rem; }

/* Service: kanban plus connected asset record */
.service-board { background: var(--panel); border: 1px solid var(--rule); }
.service-title { display: flex; justify-content: space-between; gap: 2rem; padding: 1.2rem 1.3rem; border-bottom: 1px solid var(--rule); }
.ticket-board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--soft); border-bottom: 1px solid var(--rule); }
.ticket-board > section { min-height: 330px; padding: 1rem; border-right: 1px solid var(--rule); }
.ticket-board > section:last-child { border-right: 0; }
.ticket-board section > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.ticket-board h3 { margin: 0; font-size: .72rem; }
.ticket-board section > header span { display: grid; place-items: center; width: 24px; height: 24px; color: var(--muted); font-size: .62rem; background: var(--panel); border-radius: 50%; }
.ticket-card { display: grid; gap: .45rem; width: 100%; margin-bottom: .7rem; padding: .9rem; text-align: left; background: var(--panel); border: 1px solid transparent; }
.ticket-card:hover { border-color: var(--accent); }
.ticket-card > span { color: var(--muted); font-size: .56rem; font-weight: 750; }
.ticket-card > strong { font-size: .72rem; }
.ticket-card > small { min-height: 2.5em; color: var(--muted); font-size: .61rem; line-height: 1.4; }
.ticket-card footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .3rem; padding-top: .55rem; border-top: 1px solid var(--rule); }
.ticket-card footer b { overflow: hidden; font-size: .57rem; text-overflow: ellipsis; white-space: nowrap; }
.column-empty { color: var(--muted); font-size: .65rem; }
.service-detail { display: grid; grid-template-columns: minmax(0, 1fr); max-width: 760px; border-right: 1px solid var(--rule); }

/* Logistics: shipment selector and multimodal timeline */
.logistics-board { display: grid; grid-template-columns: 240px minmax(430px, 1fr) minmax(360px, .72fr); min-height: 660px; background: var(--panel); border: 1px solid var(--rule); }
.shipment-list { border-right: 1px solid var(--rule); }
.shipment-row { display: grid; gap: .55rem; width: 100%; padding: .9rem 1rem; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--rule); }
.shipment-row:hover, .shipment-row.is-selected { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.shipment-row.is-selected { box-shadow: inset 3px 0 0 var(--accent); }
.shipment-row > span { display: grid; }
.shipment-row strong { font-size: .68rem; }
.shipment-row small { color: var(--muted); font-size: .57rem; }
.route-pane { border-right: 1px solid var(--rule); }
.route-pane > header p { margin: .45rem 0 0; color: var(--muted); font-size: .7rem; }
.leg-timeline { margin: 0; padding: 1.2rem; list-style: none; }
.leg-timeline li { position: relative; display: grid; grid-template-columns: 35px 1fr auto; gap: .8rem; min-height: 100px; padding-bottom: 1rem; }
.leg-timeline li::before { content: ""; position: absolute; top: 29px; bottom: -2px; left: 16px; width: 1px; background: var(--rule); }
.leg-timeline li:last-child::before { display: none; }
.leg-index { display: grid; place-items: center; align-self: start; width: 34px; height: 34px; color: var(--muted); font-size: .58rem; font-weight: 800; background: var(--paper); border: 1px solid var(--rule); border-radius: 50%; }
.leg-timeline li.is-complete .leg-index { color: #fff; background: var(--positive); border-color: var(--positive); }
.leg-timeline li.is-exception .leg-index { color: #fff; background: var(--critical); border-color: var(--critical); }
.leg-timeline li > div { display: grid; align-content: start; }
.leg-timeline li b { color: var(--accent); font-size: .55rem; text-transform: uppercase; }
.leg-timeline li strong { margin-top: .2rem; font-size: .73rem; }
.leg-timeline li small { margin-top: .25rem; color: var(--muted); font-size: .6rem; }
.handover-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 1.2rem 1.2rem; border: 1px solid var(--rule); }
.handover-strip div { display: grid; padding: .8rem; border-right: 1px solid var(--rule); }
.handover-strip div:last-child { border-right: 0; }
.handover-strip span { color: var(--muted); font-size: .55rem; text-transform: uppercase; }
.handover-strip strong { margin-top: .25rem; font-size: .65rem; }

/* Shared secondary views */
.page-intro { display: flex; justify-content: space-between; gap: 2rem; align-items: end; margin-bottom: 1.5rem; padding-bottom: 1.4rem; border-bottom: 1px solid var(--rule); }
.page-intro h1 { margin: 0; font-size: clamp(2rem, 4vw, 4rem); line-height: .98; letter-spacing: -.04em; }
.page-intro p { max-width: 64ch; margin: .65rem 0 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.system-state { padding: .5rem .65rem; color: var(--positive); font-size: .63rem; font-weight: 750; background: var(--positive-bg); }
.worklist-tools { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: .8rem; margin-bottom: 1rem; }
.search-field { display: grid; grid-template-columns: 24px 1fr; gap: .5rem; align-items: center; min-height: 44px; padding: 0 .8rem; background: var(--panel); border: 1px solid var(--rule); }
.search-field svg { color: var(--muted); }
.search-field input { width: 100%; height: 40px; color: var(--ink); background: transparent; border: 0; outline: none; }
.records-layout { display: grid; grid-template-columns: minmax(420px, .95fr) minmax(380px, 1.05fr); background: var(--panel); border: 1px solid var(--rule); }
.records-layout > div { border-right: 1px solid var(--rule); }
.record-list { display: grid; }
.record-row { display: grid; grid-template-columns: .6fr minmax(150px, 1.35fr) .7fr auto; gap: .8rem; align-items: center; width: 100%; min-height: 74px; padding: .75rem 1rem; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--rule); }
.record-row:hover, .record-row.is-selected { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.record-row.is-selected { box-shadow: inset 3px 0 0 var(--accent); }
.record-id { color: var(--muted); font-size: .61rem; font-weight: 750; }
.record-primary { display: grid; }
.record-primary strong { font-size: .7rem; }
.record-primary small { color: var(--muted); font-size: .58rem; }
.record-owner { color: var(--muted); font-size: .64rem; }
.record-list.is-compact .record-row { grid-template-columns: .65fr 1fr auto; min-height: 58px; }
.record-list.is-compact .record-owner { display: none; }
.record-list.is-compact .record-primary small { display: none; }
.empty-state { padding: 3rem 1.2rem; text-align: center; }
.empty-state strong { font-size: .85rem; }
.empty-state p { max-width: 42ch; margin: .4rem auto 1rem; color: var(--muted); font-size: .7rem; line-height: 1.5; }
.workflow-layout { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(390px, .9fr); background: var(--panel); border: 1px solid var(--rule); }
.workflow-steps { margin: 0; padding: 1.2rem 1.4rem 1.2rem 1.2rem; list-style: none; border-right: 1px solid var(--rule); }
.workflow-steps li { position: relative; display: grid; grid-template-columns: 46px 1fr; gap: 1rem; min-height: 95px; }
.workflow-steps li::before { content: ""; position: absolute; top: 34px; bottom: 0; left: 17px; width: 1px; background: var(--rule); }
.workflow-steps li:last-child::before { display: none; }
.workflow-steps li > span { display: grid; place-items: center; align-self: start; width: 36px; height: 36px; color: #fff; font-size: .58rem; font-weight: 800; background: var(--ink); border-radius: 50%; }
.workflow-steps strong { font-size: .77rem; }
.workflow-steps p { margin: .3rem 0 0; color: var(--muted); font-size: .67rem; line-height: 1.48; }
.workflow-record > header { padding: 1.25rem; border-bottom: 1px solid var(--rule); }
.report-sheet { background: var(--panel); border: 1px solid var(--rule); }
.report-sheet > header { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--rule); }
.report-sheet > header div { display: grid; padding: 1rem 1.2rem; border-right: 1px solid var(--rule); }
.report-sheet > header div:last-child { border-right: 0; }
.report-sheet > header span { color: var(--muted); font-size: .57rem; text-transform: uppercase; }
.report-sheet > header strong { margin-top: .3rem; font-size: .68rem; }
.report-bars { display: grid; gap: .9rem; padding: 1.4rem; border-bottom: 1px solid var(--rule); }
.report-bars > div { display: grid; grid-template-columns: 170px 1fr 45px; gap: 1rem; align-items: center; }
.report-bars span { font-size: .67rem; }
.report-bars b { height: 8px; background: var(--soft); }
.report-bars i { display: block; height: 100%; background: var(--accent); }
.report-bars strong { font-size: .72rem; text-align: right; font-variant-numeric: tabular-nums; }
.report-sheet table { width: 100%; border-collapse: collapse; }
.report-sheet th, .report-sheet td { padding: .8rem 1rem; font-size: .65rem; text-align: left; border-bottom: 1px solid var(--rule); }
.report-sheet th { color: var(--muted); font-size: .57rem; text-transform: uppercase; }
.report-sheet td:first-child { display: grid; }
.report-sheet td small { color: var(--muted); }
.connection-list { display: grid; background: var(--panel); border: 1px solid var(--rule); }
.connection-list article { display: grid; grid-template-columns: 46px minmax(180px, 1fr) minmax(280px, .65fr); gap: 1rem; align-items: center; min-height: 108px; padding: 1rem 1.2rem; border-bottom: 1px solid var(--rule); }
.connection-list article:last-child { border-bottom: 0; }
.connection-mark { display: grid; place-items: center; width: 42px; height: 42px; color: #fff; font-size: .58rem; font-weight: 800; background: var(--ink); }
.connection-list h2 { margin: 0; font-size: .83rem; }
.connection-list p { max-width: 62ch; margin: .3rem 0 0; color: var(--muted); font-size: .66rem; line-height: 1.48; }
.connection-list dl { display: grid; grid-template-columns: 1fr 1fr; margin: 0; }
.connection-list dl div { display: grid; gap: .25rem; }
.connection-list dt { color: var(--muted); font-size: .55rem; text-transform: uppercase; }
.connection-list dd { margin: 0; font-size: .65rem; }
.activity-log { margin-top: 1.2rem; background: var(--panel); border: 1px solid var(--rule); }
.activity-log header { display: flex; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--rule); }
.activity-log h2 { margin: 0; font-size: .8rem; }
.activity-log header span { color: var(--muted); font-size: .62rem; }
.activity-log ol { margin: 0; padding: 0; list-style: none; }
.activity-log li { display: grid; grid-template-columns: 120px 1fr 150px; gap: 1rem; padding: .75rem 1.2rem; border-bottom: 1px solid var(--rule); }
.activity-log time, .activity-log span { color: var(--muted); font-size: .61rem; }
.activity-log strong { font-size: .65rem; }

dialog { width: min(460px, calc(100vw - 2rem)); padding: 0; color: var(--ink); background: var(--panel); border: 1px solid var(--rule); }
dialog::backdrop { background: rgba(12, 18, 14, .65); }
.reset-form header { padding: 1.2rem 1.3rem; border-bottom: 1px solid var(--rule); }
.reset-form h2 { margin: 0; font-size: 1.25rem; letter-spacing: -.03em; }
.reset-form p { margin: 0; padding: 1.1rem 1.3rem; color: var(--muted); font-size: .75rem; line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.3rem; background: var(--paper); border-top: 1px solid var(--rule); }

@media (max-width: 1280px) {
  .app-shell { grid-template-columns: 82px minmax(0, 1fr); }
  .identity { justify-content: center; padding: 0; }
  .identity-copy, .primary-nav button span, .rail-state div, .rail-reset { display: none; }
  .primary-nav button { display: grid; place-items: center; grid-template-columns: 1fr; padding: 0; }
  .primary-nav button::before { left: -.8rem; }
  .rail-state { display: grid; place-items: center; grid-template-columns: 1fr; }
  .finance-board, .programme-board, .laboratory-board { grid-template-columns: minmax(400px, 1fr) minmax(340px, .85fr); }
  .spatial-board, .logistics-board { grid-template-columns: 210px minmax(390px, 1fr); }
  .spatial-detail, .logistics-detail { grid-column: 1 / -1; border-top: 1px solid var(--rule); }
}

@media (max-width: 820px) {
  .app-shell { display: block; }
  .side-rail { position: fixed; inset: 0 auto 0 0; width: 250px; height: 100dvh; transform: translateX(-102%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
  .side-rail.is-open { transform: translateX(0); }
  .identity { justify-content: flex-start; padding: 0 1.2rem; }
  .identity-copy, .primary-nav button span, .rail-state div, .rail-reset { display: grid; }
  .primary-nav button { grid-template-columns: 28px 1fr; place-items: initial; padding: .45rem .7rem; }
  .rail-state { grid-template-columns: 8px 1fr; place-items: initial; }
  .rail-scrim { position: fixed; inset: 0; z-index: 18; display: block; width: 100%; background: rgba(12, 18, 14, .48); border: 0; opacity: 0; pointer-events: none; }
  .side-rail.is-open + .rail-scrim { opacity: 1; pointer-events: auto; }
  .topbar { grid-template-columns: auto 1fr auto; min-height: 66px; padding: 0 1rem; }
  .mobile-menu { display: grid; }
  .page-coordinate { justify-self: center; }
  .page-coordinate::before, .topbar-context, .role-control > span { display: none; }
  .role-control { grid-template-columns: minmax(112px, 1fr); }
  .system-intro { grid-template-columns: 1fr; gap: 1rem; }
  .system-intro h1 { max-width: 16ch; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .stat-strip button:nth-child(2) { border-right: 0; }
  .stat-strip button:nth-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .finance-board, .programme-board, .laboratory-board, .records-layout, .workflow-layout { grid-template-columns: 1fr; }
  .ledger-pane, .cohort-grid, .lab-queue, .records-layout > div, .workflow-steps { border-right: 0; border-bottom: 1px solid var(--rule); }
  .spatial-board, .logistics-board { grid-template-columns: 1fr; }
  .layer-panel, .shipment-list, .map-workspace, .route-pane { border-right: 0; border-bottom: 1px solid var(--rule); }
  .map-workspace { min-height: 430px; }
  .map-workspace > svg { min-height: 430px; }
  .ticket-board { grid-template-columns: 1fr; }
  .ticket-board > section { min-height: auto; border-right: 0; border-bottom: 1px solid var(--rule); }
  .service-detail { max-width: none; border-right: 0; }
}

@media (max-width: 560px) {
  .app-view { padding-inline: .75rem; }
  .system-intro { padding-inline: .9rem; }
  .system-intro h1 { max-width: 11ch; font-size: clamp(2.2rem, 12vw, 3.6rem); }
  .role-control select { width: 160px; font-size: .65rem; }
  .stat-strip button { min-height: 84px; padding: .75rem; }
  .stat-strip strong { font-size: 1.7rem; }
  .ledger-head { display: none; }
  .ledger-row { grid-template-columns: .75fr 1fr auto; }
  .ledger-row > span:nth-child(2) { display: none; }
  .match-equation { grid-template-columns: 1fr auto 1fr; }
  .match-equation > span:last-child, .match-equation > b:nth-of-type(2) { display: none; }
  .cohort-title, .service-title, .page-intro { align-items: flex-start; flex-direction: column; }
  .participant-row { grid-template-columns: 36px 1fr 42px; }
  .participant-row .progress-track, .participant-row .status-chip { grid-column: 2 / -1; }
  .lab-columns { display: none; }
  .lab-row { grid-template-columns: 1fr auto; }
  .lab-row > b, .lab-row > span:nth-child(3) { display: none; }
  .map-legend { flex-direction: column; gap: .35rem; }
  .record-fields { grid-template-columns: 1fr; }
  .record-fields div, .record-fields div:nth-child(2n) { border-right: 0; }
  .worklist-tools { grid-template-columns: 1fr; }
  .record-row { grid-template-columns: .55fr 1fr auto; }
  .record-owner { display: none; }
  .report-sheet > header { grid-template-columns: 1fr; }
  .report-sheet > header div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .report-bars > div { grid-template-columns: 100px 1fr 30px; gap: .6rem; }
  .report-sheet th:nth-child(2), .report-sheet td:nth-child(2), .report-sheet th:nth-child(4), .report-sheet td:nth-child(4) { display: none; }
  .connection-list article { grid-template-columns: 40px 1fr; }
  .connection-list dl { grid-column: 2; }
  .activity-log li { grid-template-columns: 90px 1fr; }
  .activity-log li span { display: none; }
  .handover-strip { grid-template-columns: 1fr; }
  .handover-strip div { border-right: 0; border-bottom: 1px solid var(--rule); }
  .handover-strip div:last-child { border-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
