/* Shared tokens and application shell. :root below is the source of truth for
   every token, and its values are the default brand's.
   The default brand book palette is achromatic and has exactly three values:
   #F3F3F3 (light), #000000 (black), #3C3C3B (warm dark gray). Production adds
   restrained semantic state colours and one approved chromatic exception for
   Host performance and bonus chart marks only.
   Another brand restyles the shell from its own sheet, loaded after this one
   (static/brands/<slug>/brand.css). It may override only the canvas, surface,
   rail and accent backgrounds, the non-status text colours, the borders, the
   focus ring, --font-ui, --font-display and --brand-logo-*. Status, scrim,
   disabled and chart colours, --font-data, spacing and radius stay shared. */

/* The brand typeface is Helvetica Neue LT Com Extended, which we have no
   webfont licence for. Archivo (SIL OFL) is the substitute: it carries a real
   width axis, so the display voice can stay extended while UI text stays at
   normal width. See --stretch-display / --stretch-ui below. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-variable-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("fonts/archivo-variable-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg-canvas: #F3F3F3;
  --bg-surface: #FFFFFF;
  --bg-subtle: #EAEAE8;
  --bg-rail: #000000;
  --bg-rail-hover: #1A1A1A;
  --bg-rail-selected: #FFFFFF;
  --bg-accent: #000000;
  --bg-accent-hover: #3C3C3B;
  --bg-accent-subtle: #EAEAE8;
  --chart-bonus-mark: #1473E6;
  --chart-pph-line: #0057D9;
  --chart-pph-point: #003F9E;
  --chart-series-1: #004F9E;
  --chart-series-2: #9A3B00;
  --chart-series-3: #00695C;
  --chart-series-4: #6A3D9A;
  --chart-series-5: #A0005A;
  --chart-series-6: #4F6400;
  --chart-series-1: #2563eb;
  --chart-series-1-rgb: 37 99 235;
  --chart-series-2: #ea580c;
  --chart-series-2-rgb: 234 88 12;
  --chart-series-3: #0d9488;
  --chart-series-3-rgb: 13 148 136;
  --chart-series-4: #7c3aed;
  --chart-series-4-rgb: 124 58 237;
  --chart-series-5: #db2777;
  --chart-series-5-rgb: 219 39 119;
  --chart-series-6: #4d7c0f;
  --chart-series-6-rgb: 77 124 15;
  --chart-dim-alpha: 0.18;
  --chart-grid-soft: #E5E5E2;
  --chart-stroke: 2px;
  --bg-hover: #EAEAE8;
  --bg-disabled: #E0E0DE;
  --bg-success: #EBF5F0;
  --bg-danger: #FDECEA;
  --bg-warning: #FBF3E2;
  --bg-scrim: rgba(0, 0, 0, 0.6);
  --text-primary: #000000;
  --text-secondary: #5B5B58;
  --text-on-dark: #F3F3F3;
  --text-on-dark-muted: #A3A3A0;
  --text-on-dark-faint: #7A7A78;
  --text-disabled: #A3A3A0;
  --text-inverse: #FFFFFF;
  --text-accent: #000000;
  --text-success: #0F7B4F;
  --text-danger: #B42318;
  --text-warning: #8A6100;
  --border-default: #D7D7D3;
  --border-strong: #3C3C3B;
  --border-dark: #2A2A2A;
  --border-accent-soft: #3C3C3B;
  --border-success: #0F7B4F;
  --border-danger: #B42318;
  --focus-ring: #000000;
  --font-ui: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: "Archivo", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-data: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --brand-logo-mask: url("brand/juspit-logotipo.svg");
  --brand-logo-ratio: 1682.74 / 536.1;
  --stretch-display: 125%;
  --stretch-ui: 100%;
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-md: 1rem;
  --text-lg: 1.125rem; --text-xl: 1.5rem; --text-2xl: clamp(2rem, 4vw, 2.75rem);
  --leading-tight: 1.1; --leading-normal: 1.5;
  --weight-medium: 500;
  --weight-strong: 700;
  --weight-emphasis: 750;
  --weight-display: 900;
  --tracking-label: 0.1em;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-8: 4rem;
  --radius-xs: 0.625rem;
  --radius-sm: 0.875rem;
  --radius-pill: 999rem;
  --shadow-raised: 0 0.0625rem 0.125rem rgba(0, 0, 0, 0.04), 0 0.25rem 0.75rem rgba(0, 0, 0, 0.04);
  --control-min: 2.75rem;
  --mobile-nav-clearance: 6rem;
  --rail-width: 15rem;
  --content-form: 44rem;
  --content-max: 90rem;
  --daily-record-columns: minmax(6.5rem, 0.85fr) minmax(7rem, 1fr) auto;
  --daily-metric-columns: repeat(4, minmax(0, 1fr));
  --motion-fast: 120ms;
  --rule: 0.0625rem;
}

* { box-sizing: border-box; }
html { background: var(--bg-canvas); }
body {
  min-width: 20rem;
  margin: 0;
  color: var(--text-primary);
  background: var(--bg-canvas);
  font-family: var(--font-ui);
  font-size: var(--text-md);
  font-stretch: var(--stretch-ui);
  line-height: var(--leading-normal);
}
button, input, select { font: inherit; }
button, input, select, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 0.1875rem solid var(--focus-ring); outline-offset: 0.1875rem; }
/* Native date segments can own keyboard focus without matching :focus-visible. */
input:is([type="date"], [type="month"]):focus-within {
  outline: 0.1875rem solid var(--focus-ring);
  outline-offset: 0.1875rem;
}
/* The accent is black, so links cannot be told apart from body text by colour.
   The underline is the non-colour cue and must survive. */
a { color: var(--text-accent); text-underline-offset: 0.2em; }

.visually-hidden {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  margin: -0.0625rem;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 30;
  top: var(--space-2);
  left: var(--space-2);
  min-height: var(--control-min);
  padding: var(--space-2) var(--space-4);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: var(--rule) solid var(--border-strong);
  border-radius: var(--radius-xs);
  box-shadow: var(--shadow-raised);
  transform: translateY(-200%);
}
.skip-link:focus { transform: translateY(0); }
.shell { min-height: 100vh; }
.control-rail {
  --focus-ring: var(--text-on-dark);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: var(--rail-width);
  display: flex;
  flex-direction: column;
  padding: var(--space-6) var(--space-4);
  color: var(--text-on-dark);
  background: var(--bg-rail);
  border-right: var(--rule) solid var(--border-dark);
}
.wordmark { margin: 0 0 var(--space-8); }
.control-rail > section { margin-bottom: var(--space-6); }
/* The logotipo is painted with a mask so it inherits currentColor: black on
   the light mobile header, --text-on-dark on the black rail. The artwork and
   its proportions are tokens (--brand-logo-mask, --brand-logo-ratio) so a
   brand sheet can swap the logo without restating this rule. */
.wordmark-logo {
  display: block;
  width: min(100%, 9rem);
  aspect-ratio: var(--brand-logo-ratio);
  background-color: currentColor;
  -webkit-mask: var(--brand-logo-mask) no-repeat center / contain;
  mask: var(--brand-logo-mask) no-repeat center / contain;
}
.wordmark small {
  display: block;
  margin-top: var(--space-3);
  color: var(--text-on-dark-muted);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
/* The rail is position: fixed and cannot scroll, so the nav owns the overflow:
   without this the entry list pushes the session form and .rail-note past the
   bottom edge and they become unreachable. min-height: 0 is load-bearing — a
   flex item defaults to min-height: auto and refuses to shrink below its
   content, which would leave overflow-y with nothing to do. The inline gutter
   keeps the 0.1875rem focus outline and its 0.1875rem offset inside the scroll
   container (overflow-y: auto makes overflow-x compute to auto, which would
   otherwise clip the ring); the negative margin gives the space back, so the
   links stay exactly where they were. */
.rail-nav {
  display: grid;
  gap: var(--space-2);
  min-height: 0;
  overflow-y: auto;
  padding-inline: var(--space-2);
  margin-inline: calc(var(--space-2) * -1);
  scroll-padding-block: var(--space-2);
}
.rail-nav a {
  min-height: var(--control-min);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  color: var(--text-on-dark-muted);
  text-decoration: none;
  border-left: 0.1875rem solid transparent;
}
.rail-nav a:hover { color: var(--text-on-dark); background: var(--bg-rail-hover); }
.rail-nav a[aria-current="page"] {
  --focus-ring: var(--text-primary);
  color: var(--text-primary);
  background: var(--bg-rail-selected);
  border-left-color: var(--bg-rail-selected);
  font-weight: var(--weight-strong);
}
.nav-index {
  order: -1;
  color: var(--text-on-dark-faint);
  font-family: var(--font-data);
  font-size: var(--text-xs);
}
.rail-nav a:hover .nav-index, .rail-nav a[aria-current="page"] .nav-index { color: inherit; }
.control-rail > form { margin-top: auto; }
.control-rail > form .button { width: 100%; }
.control-rail .button-secondary {
  color: var(--text-on-dark);
  background: transparent;
  border-color: var(--text-on-dark-faint);
}
.control-rail .button-secondary:hover { color: var(--text-primary); background: var(--bg-rail-selected); }
.rail-note {
  margin: var(--space-4) 0 0;
  padding-top: var(--space-4);
  color: var(--text-on-dark-muted);
  border-top: var(--rule) solid var(--border-dark);
  font-size: var(--text-sm);
}
.mobile-shell-head { display: none; }
main {
  width: min(calc(100% - var(--rail-width)), var(--content-max));
  min-height: 100vh;
  margin-left: var(--rail-width);
  padding: var(--space-8);
}

.page-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-5);
  border-bottom: var(--rule) solid var(--border-strong);
}
/* Three labels, three tiers. .eyebrow names the page, .section-kicker names a
   panel and sits beside an h2, .record-label names a cell on mobile. Only the
   page-level one earns uppercase and tracking. */
.eyebrow {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-emphasis);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.section-kicker {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-strong);
}
h1 {
  margin: var(--space-1) 0 0;
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-display);
  font-stretch: var(--stretch-display);
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
}
h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-display);
  font-stretch: var(--stretch-display);
  line-height: var(--leading-tight);
}
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-display);
  font-stretch: var(--stretch-display);
  line-height: var(--leading-tight);
}
.date-stamp, .version-stamp { margin: 0; text-align: right; }
.date-stamp span, .version-stamp span {
  display: block;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.date-stamp strong, .version-stamp strong {
  display: block;
  margin-top: var(--space-1);
  font-family: var(--font-data);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.status-region { min-height: var(--space-1); }
.notice {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: var(--rule) solid;
  border-radius: var(--radius-xs);
  font-size: var(--text-sm);
  font-weight: var(--weight-strong);
}
.notice-success { color: var(--text-success); background: var(--bg-success); border-color: var(--border-success); }
.notice-error { color: var(--text-danger); background: var(--bg-danger); border-color: var(--border-danger); }
.notice-warning { color: var(--text-warning); background: var(--bg-warning); border-color: var(--border-strong); }
.workspace-grid {
  display: grid;
  grid-template-columns: minmax(18rem, 0.72fr) minmax(34rem, 1.28fr);
  gap: var(--space-6);
  align-items: start;
}
.panel {
  min-width: 0;
  overflow: hidden;
  background: var(--bg-surface);
  border: var(--rule) solid var(--border-default);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-raised);
}
.entry-panel { border-top-color: var(--border-strong); }
.panel-head {
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--rule) solid var(--border-default);
}
.panel-body { padding: var(--space-5); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.field { display: grid; align-content: start; gap: var(--space-2); }
/* `display: grid` above outranks the user agent's `[hidden]` rule. */
.field[hidden] { display: none; }
[data-fallback-fieldset][hidden] { display: none; }
.field-wide { grid-column: 1 / -1; }
label { overflow-wrap: anywhere; font-size: var(--text-sm); font-weight: var(--weight-strong); }
input:not([type="checkbox"]):not([type="radio"]), select {
  width: 100%;
  min-height: var(--control-min);
  padding: var(--space-2) var(--space-3);
  color: var(--text-primary);
  background: var(--bg-surface);
  border: var(--rule) solid var(--border-strong);
  border-radius: var(--radius-xs);
}
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover { border-color: var(--text-primary); }
input[aria-invalid="true"] { border: 0.125rem solid var(--text-danger); }
select[aria-invalid="true"] { border: 0.125rem solid var(--text-danger); }
input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--bg-accent);
}
.checkbox-control {
  min-height: var(--control-min);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-block: var(--space-2);
  cursor: pointer;
}
summary {
  min-height: var(--control-min);
  padding-block: var(--space-3);
  overflow-wrap: anywhere;
  cursor: pointer;
}
.duration-field { margin: 0; padding: 0; border: 0; }
.duration-field legend { margin-bottom: var(--space-2); font-size: var(--text-sm); font-weight: var(--weight-strong); }
.duration-options { display: grid; gap: var(--space-2); }
.duration-option {
  min-height: var(--control-min);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border: var(--rule) solid var(--border-strong);
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.duration-option:hover { background: var(--bg-hover); }
.duration-option:has(input:checked) { border-color: var(--bg-accent); background: var(--bg-subtle); }
input[type="radio"] {
  width: var(--space-5);
  height: var(--space-5);
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--bg-accent);
}
.precise-times { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.precise-times[hidden] { display: none; }
.field-error { margin: 0; color: var(--text-danger); font-size: var(--text-xs); font-weight: var(--weight-strong); }
.form-actions { display: flex; gap: var(--space-3); margin-top: var(--space-5); }
.button {
  min-width: 0;
  min-height: var(--control-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: var(--rule) solid transparent;
  border-radius: var(--radius-xs);
  font-weight: var(--weight-emphasis);
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-decoration: none;
  white-space: normal;
  cursor: pointer;
  transition: background-color var(--motion-fast), transform var(--motion-fast);
}
.button-primary { color: var(--text-inverse); background: var(--bg-accent); }
.button-primary:hover { background: var(--bg-accent-hover); }
.button-secondary { color: var(--text-primary); background: transparent; border-color: var(--border-strong); }
.button-secondary:hover { background: var(--bg-subtle); }
.button-danger { color: var(--text-danger); background: transparent; border-color: var(--border-danger); }
.button-danger:hover { background: var(--bg-danger); }
.button:active { transform: translateY(0.0625rem); }
.button:disabled { color: var(--text-disabled); background: var(--bg-disabled); border-color: var(--border-default); cursor: not-allowed; }
/* Who holds this station decides who every scan is credited to, so the occupant
   has to be readable at a glance from the working screen, not only from the rail's
   secondary text. The label and the name stay in one text node because several
   tests assert the contiguous "Estación de: <name>" string. */
.station-occupant { font-size: var(--text-lg); font-weight: var(--weight-strong); }
.rail-station {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  border: var(--rule) solid var(--border-dark);
  border-radius: var(--radius-sm);
}
.rail-station dl { display: grid; gap: var(--space-2); margin: 0; }
.rail-station dt {
  color: var(--text-on-dark-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-strong);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.rail-station dd { margin: 0; font-weight: var(--weight-strong); overflow-wrap: anywhere; }
.rail-station .station-occupant { margin: 0; overflow-wrap: anywhere; }
.rail-station .button { width: 100%; }
.records { display: grid; margin: 0; padding: 0; list-style: none; }
.record {
  display: grid;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--rule) solid var(--border-default);
}
.record:last-child { border-bottom: 0; }
.record:hover { background: var(--bg-hover); }
.record-data { font-family: var(--font-data); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.record-data, .record-primary { min-width: 0; }
.record-data strong, .record-primary strong { display: block; }
.record-data span:not(.record-label), .record-primary > span:not(.record-label):not(.status-pill) {
  display: block;
  color: var(--text-secondary);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}
.record-label {
  display: none;
  margin: 0 0 var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-xs);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: var(--space-1) var(--space-2);
  color: var(--text-success);
  background: var(--bg-success);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--weight-emphasis);
}
.record-primary .status-pill { margin-top: var(--space-1); }
.text-action {
  min-width: var(--control-min);
  min-height: var(--control-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--weight-emphasis);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.empty-state { padding: var(--space-8) var(--space-6); text-align: center; }
.empty-state strong { display: block; }
.empty-state p { margin: var(--space-1) 0 var(--space-4); color: var(--text-secondary); font-size: var(--text-sm); }
.mobile-nav { display: none; }

/* The sheet's only min-width breakpoints. Everything else here is
   desktop-first, so these are declared *before* the max-width blocks: media
   queries carry no specificity, and this source order keeps the narrow
   overrides winning if a boundary is ever loosened by mistake. */

/* Centre the column once the viewport is wider than the rail plus the cap;
   without this the whole slack lands on the right and the page reads as
   broken. max() is self-disabling — with no slack it returns the rail width,
   so narrower desktops render exactly as before. Scoped to the range where
   .control-rail actually exists: below 48rem the rail is display: none and
   main resets to width: 100%; margin: 0, which this must never outrank. */
@media (min-width: 48.0625rem) {
  main {
    margin-left: max(var(--rail-width), calc((100% - var(--content-max)) / 2));
    margin-right: auto;
  }
}

/* Past 1600px a 90rem cap starves the data grids while the viewport keeps
   growing. Only the custom property moves: main's width and the centring
   calc both read it, so no geometry is restated. --content-form deliberately
   stays at 44rem — data grids gain columns, text fields do not gain width. */
@media (min-width: 100rem) {
  :root { --content-max: 120rem; }
}

@media (max-width: 76rem) {
  .workspace-grid { grid-template-columns: 1fr; }
  .entry-panel { max-width: 44rem; }
}
@media (max-width: 48rem) {
  html { scroll-padding-bottom: calc(var(--mobile-nav-clearance) + var(--space-5) + env(safe-area-inset-bottom)); }
  body { padding-bottom: calc(var(--mobile-nav-clearance) + var(--space-5) + env(safe-area-inset-bottom)); }
  .control-rail { display: none; }
  .mobile-shell-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-surface);
    border-bottom: var(--rule) solid var(--border-default);
  }
  .mobile-shell-head .wordmark { margin: 0; }
  /* A percentage width inside this shrink-to-fit flex item resolves to 0, which hid
     the logo; a fixed width with a percentage cap keeps it visible and bounded. */
  .mobile-shell-head .wordmark-logo { width: 6.5rem; max-width: 100%; }
  .mobile-shell-head .button { min-height: var(--control-min); padding-inline: var(--space-3); }
  main { width: 100%; margin: 0; padding: var(--space-5) var(--space-4); }
  .page-head { align-items: start; margin-bottom: var(--space-5); }
  .date-stamp, .version-stamp { text-align: left; }
  .record { grid-template-columns: 1fr 1fr; gap: var(--space-3) var(--space-4); }
  .record-label { display: block; }
  .mobile-nav {
    --focus-ring: var(--text-on-dark-faint);
    position: fixed;
    inset: auto var(--space-3) calc(var(--space-3) + env(safe-area-inset-bottom));
    z-index: 20;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: var(--space-1);
    padding: var(--space-1) var(--space-1) max(var(--space-1), env(safe-area-inset-bottom));
    background: var(--bg-rail);
    border: var(--rule) solid var(--border-dark);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raised);
  }
  .mobile-nav a {
    min-height: var(--control-min);
    display: grid;
    place-items: center;
    padding: var(--space-2);
    color: var(--text-on-dark-muted);
    text-decoration: none;
    border-radius: var(--radius-xs);
    font-size: var(--text-sm);
  }
  .mobile-nav a:hover { color: var(--text-on-dark); background: var(--bg-rail-hover); }
  .mobile-nav a[aria-current="page"] { color: var(--text-primary); background: var(--bg-rail-selected); font-weight: var(--weight-emphasis); }
  .mobile-nav[data-admin-nav] {
    display: block;
    bottom: 0;
    left: 0;
    right: 0;
    padding-bottom: calc(var(--space-1) + env(safe-area-inset-bottom));
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }
  .mobile-nav-menu {
    min-width: 0;
    display: grid;
  }
  .mobile-nav-menu-summary {
    min-height: var(--control-min);
    grid-row: 2;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    color: var(--text-on-dark);
    border-radius: var(--radius-xs);
    font-size: var(--text-sm);
    font-weight: var(--weight-emphasis);
    white-space: normal;
    list-style: none;
  }
  .mobile-nav-menu-summary::-webkit-details-marker { display: none; }
  .mobile-nav-menu-summary::after { content: "+"; }
  .mobile-nav-menu[open] .mobile-nav-menu-summary::after { content: "−"; }
  .mobile-nav-menu-summary:hover { background: var(--bg-rail-hover); }
  .mobile-nav-menu-label {
    min-width: 0;
    overflow: visible;
    overflow-wrap: anywhere;
    text-overflow: clip;
  }
  .mobile-nav-menu-current {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-nav-menu-current {
    color: var(--text-on-dark-muted);
    text-align: right;
  }
  .mobile-nav-menu-list {
    grid-row: 1;
    display: grid;
    gap: var(--space-1);
    max-height: calc(100vh - var(--mobile-nav-clearance) - var(--space-6) - env(safe-area-inset-bottom));
    max-height: calc(100dvh - var(--mobile-nav-clearance) - var(--space-6) - env(safe-area-inset-bottom));
    padding-bottom: var(--space-1);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .mobile-nav-menu:not([open]) > .mobile-nav-menu-list { display: none; }
  .mobile-nav[data-admin-nav] a {
    place-items: center start;
    padding-inline: var(--space-3);
  }
}
@media (max-width: 24rem) {
  main { padding: var(--space-3); }
  .page-head { display: grid; }
  .field-grid { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .precise-times { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .form-actions .button { width: 100%; }
  .panel-head, .panel-body, .record { padding-left: var(--space-4); padding-right: var(--space-4); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  .button, .panel, .mobile-nav { border-color: CanvasText; }
  .notice, .status-pill, .checkbox-control, summary { border: var(--rule) solid CanvasText; }
  .mobile-nav a[aria-current="page"] { border: var(--rule) solid CanvasText; }
  .mobile-nav :focus-visible { outline-color: Highlight; }
}

.chart-table-wrap:focus-visible { outline: 0.1875rem solid var(--focus-ring); outline-offset: 0.1875rem; }

/* Host station scanner on phones, tablets in portrait, and short landscape screens:
   one compact sticky bar replaces the rail and the 236px stacked header, and the
   single-page station needs no bottom nav or clearance for it. */
@media (max-width: 48rem), (max-height: 30rem) {
  body.is-station { padding-bottom: env(safe-area-inset-bottom); }
  html:has(body.is-station) { scroll-padding-bottom: 0; }
  body.is-station .control-rail { display: none; }
  body.is-station main { width: 100%; margin: 0; padding: var(--space-5) var(--space-4); }
  .station-bar {
    position: sticky;
    top: 0;
    z-index: 15;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--space-3);
    padding: max(var(--space-2), env(safe-area-inset-top)) var(--space-4) var(--space-2);
    background: var(--bg-surface);
    border-bottom: var(--rule) solid var(--border-default);
  }
  .station-bar .wordmark { margin: 0; color: var(--text-primary); }
  .station-bar .wordmark-logo { width: 4.5rem; max-width: 100%; }
  /* One region holds the occupant and the shift actions, as the rail card does. */
  .station-bar-station {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--space-3);
  }
  .station-bar-who { min-width: 0; display: grid; line-height: 1.25; }
  .station-bar-who span {
    overflow: hidden;
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--weight-strong);
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  /* The occupant decides who every scan is credited to: wrap, never truncate. */
  .station-bar-who .station-occupant { font-size: var(--text-sm); overflow-wrap: anywhere; }
  .station-bar-menu { position: relative; }
  .station-bar-menu > summary {
    min-height: var(--control-min);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: 0 var(--space-3);
    border: var(--rule) solid var(--border-strong);
    border-radius: var(--radius-xs);
    font-size: var(--text-sm);
    font-weight: var(--weight-emphasis);
    list-style: none;
    cursor: pointer;
  }
  .station-bar-menu > summary::-webkit-details-marker { display: none; }
  .station-bar-menu > summary::after { content: "\25BE"; font-size: var(--text-xs); }
  .station-bar-menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + var(--space-2));
    width: min(16rem, calc(100vw - 2rem));
    display: grid;
    gap: var(--space-2);
    padding: var(--space-3);
    background: var(--bg-surface);
    border: var(--rule) solid var(--border-default);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raised);
  }
  .station-bar-menu-list .button { width: 100%; }
}
@media (min-width: 48.0625rem) and (min-height: 30.0625rem) {
  .station-bar { display: none; }
}

/* Read-only shadow report: local layout, shared brand and semantic tokens. */
.shadow-report small { display: block; color: var(--text-secondary); font-size: var(--text-xs); }
.shadow-report .card { margin: 0; padding: var(--space-4); min-width: 0; }
.shadow-report h2 { margin-top: var(--space-6); }
.shadow-report h3 { margin: 0 0 var(--space-2); }
.shadow-filters { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); margin-block: var(--space-5); }
.shadow-filters label { display: grid; gap: var(--space-1); max-width: 100%; }
.shadow-filters select { max-width: 100%; }
.shadow-report a, .shadow-help summary { display: inline-block; min-height: var(--control-min); padding-block: var(--space-2); }
.shadow-report a:hover, .shadow-help summary:hover { background: var(--bg-hover); }
.shadow-report a:active { background: var(--bg-subtle); }
.shadow-kpis, .shadow-cards, .shadow-detail { display: grid; gap: var(--space-4); margin-block: var(--space-5); }
.shadow-kpis { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.shadow-kpis dd { margin: var(--space-2) 0; font: var(--weight-strong) var(--text-xl) var(--font-data); }
.shadow-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr)); }
.shadow-hero { display: grid; margin-block: var(--space-4); }
.shadow-hero > span:nth-child(2) { font: var(--weight-display) var(--text-2xl) var(--font-data); }
.shadow-status, .shadow-partial { padding: var(--space-1) var(--space-2); border-radius: var(--radius-pill); border: var(--rule) solid var(--border-default); font-size: var(--text-sm); }
.shadow-status[data-status="Requiere acción"], .shadow-report .shadow-negative { color: var(--text-danger); font-weight: var(--weight-strong); }
.shadow-status[data-status="Requiere acción"], .shadow-actions { background: var(--bg-danger); border-color: var(--border-danger); }
.shadow-status[data-status="Parcial"], .shadow-partial { color: var(--text-warning); background: var(--bg-warning); }
.shadow-status[data-status="En curso"] { background: var(--bg-accent); color: var(--text-inverse); }
.shadow-status[data-status="Completo"] { background: var(--bg-success); color: var(--text-success); }
.shadow-counts { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-2); font-size: var(--text-sm); }
.shadow-counts dd { margin: 0; font-family: var(--font-data); }
.shadow-coverage { display: flex; height: var(--space-3); background: repeating-linear-gradient(135deg, var(--bg-subtle) 0 var(--space-1), var(--bg-surface) var(--space-1) var(--space-2)); border: var(--rule) solid var(--border-default); border-radius: var(--radius-pill); overflow: hidden; }
.shadow-coverage span:first-child, .shadow-margin-bar { background: var(--bg-accent); }
.shadow-coverage span:nth-child(2) { background: var(--text-secondary); }
.shadow-margin-bar { height: var(--space-2); }
.shadow-scroll { min-width: 0; overflow-x: auto; }
.shadow-scroll table { width: 100%; }
.shadow-checklist li, .shadow-timeline li { margin-block: var(--space-3); }
.shadow-help { margin-top: var(--space-6) !important; }
.shadow-help summary { cursor: pointer; font-weight: var(--weight-strong); }
@media (min-width: 64rem) { .shadow-detail { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } }
