/* SaccoParcel by Lightswitch: UI theme. Lightswitch design tokens (standard 01 §2.2), shared with Lightswitch Rent and
   Agripropagate so the products read as one family. Colours, sizes and fonts come only from --ls-* tokens.
   Contrast: text >= 4.5:1, UI >= 3:1, light and dark. Breakpoints 600 / 820 / 1280. */
@font-face { font-family: "Sora"; src: url("fonts/sora-700.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Sora"; src: url("fonts/sora-600.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "DM Sans"; src: url("fonts/dmsans-500.woff") format("woff"); font-weight: 500; font-display: swap; }

:root {
  /* ---- Standard tokens (values as Lightswitch Rent's tokens.css) ---- */
  --ls-ink: #0B2E1C;
  --ls-paper: #F6F8F6;
  --ls-surface: #FFFFFF;
  --ls-line: #D5DDD8;
  /* UI green: white on it is ~5.4:1. The logo green #119447 (~3.9:1) is for the logo files and the brand strip only. */
  --ls-primary: #1F7A3E;
  --ls-primary-deep: #14552B;
  --ls-primary-tint: #E4F2E8;
  --ls-on-primary: #FFFFFF;
  --ls-accent: #F26B1D;        /* brand strip and the band's one primary action; never warnings */
  --ls-brand-panel: #0B2E1C;
  --ls-on-brand: #FFFFFF;
  --ls-on-brand-muted: #B9CCC0;
  --ls-brand-green-text: #3BCB74;
  --ls-success: #1F7A3E;
  --ls-warning: #B26A00;
  --ls-danger: #C0392B;
  --ls-info: #1F5FA8;
  --ls-muted: #4A5A52;
  --ls-font-heading: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ls-font-ui: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ls-font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ls-text-xs: 0.75rem; --ls-text-sm: 0.875rem; --ls-text-md: 1rem; --ls-text-lg: 1.125rem;
  --ls-text-xl: 1.375rem; --ls-text-2xl: 1.75rem; --ls-text-3xl: 2.25rem;
  --ls-space-1: 4px; --ls-space-2: 8px; --ls-space-3: 12px; --ls-space-4: 16px; --ls-space-5: 24px; --ls-space-6: 32px; --ls-space-7: 48px;
  --ls-radius-sm: 10px;
  --ls-radius-md: 14px;
  --ls-radius-lg: 16px;
  --ls-radius-pill: 999px;
  --ls-target-min: 44px;
  --ls-nav-width: 240px;
  --ls-gutter: 16px;
  --ls-shadow: 0 1px 2px rgb(11 46 28 / 0.05), 0 10px 28px -18px rgb(11 46 28 / 0.35);
  --ls-shadow-raised: 0 2px 4px rgb(11 46 28 / 0.06), 0 18px 36px -20px rgb(11 46 28 / 0.45);
  --ls-field-line: #8A9A91;    /* 3.1:1 on surface (WCAG 1.4.11) */
  --ls-band: #0B2E1C;
  --ls-band-text: #FFFFFF;
  --ls-band-muted: #A9C2B3;
  --ls-band-glow: rgb(17 148 71 / 0.5);
  --ls-strip-green: #119447;
  --ls-tint-danger: #FDECEA;
  --ls-tint-success: #E4F2E8;
  --ls-tint-warning: #FEF3E2;
  --ls-surface-2: #F3F6F4;
  --ls-ink-2: #2E4237;

  /* ---- SRS parcel status colours: always paired with the status text (never colour alone). ---- */
  --ls-st-grey: #5B6670;
  --ls-st-blue: #1D5FBF;
  --ls-st-navy: #12305E;
  --ls-st-amber: #8A5300;
  --ls-st-amber-bg: #FFE2B0;
  --ls-st-green: #17703F;
  --ls-st-black: #111111;
  --ls-st-red: #B4272C;

  /* ---- Aliases for names used by module pages (kept so every page picks up the theme). ---- */
  --ls-bg: var(--ls-paper);
  --ls-line-strong: var(--ls-field-line);
  --ls-primary-ink: var(--ls-on-primary);
  --ls-primary-700: var(--ls-primary-deep);
  --ls-link: var(--ls-primary-deep);
  --ls-sidebar: var(--ls-brand-panel);
  --ls-focus: var(--ls-primary);
  --ls-danger-tint: var(--ls-tint-danger);
  --ls-success-tint: var(--ls-tint-success);
  --ls-warn: var(--ls-warning);
  --ls-warn-tint: var(--ls-tint-warning);
  --ls-font: var(--ls-font-body);
  --ls-radius: var(--ls-radius-md);
  --ls-space: var(--ls-space-4);
  --ls-target: var(--ls-target-min);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ls-ink: #E8EFEA;
    --ls-paper: #101512;
    --ls-surface: #18201B;
    --ls-surface-2: #1C2620;
    --ls-ink-2: #C7D5CC;
    --ls-line: #2B372F;
    --ls-primary: #5CC47F;
    --ls-primary-deep: #3E9E60;
    --ls-primary-tint: #1C2B21;
    --ls-on-primary: #101512;
    --ls-accent: #FF8A47;
    --ls-success: #5CC47F;
    --ls-warning: #E0A040;
    --ls-danger: #F07A6E;
    --ls-info: #7FB0E8;
    --ls-muted: #A9B8AF;
    --ls-shadow: none;
    --ls-shadow-raised: 0 18px 36px -24px rgb(0 0 0 / 0.8);
    --ls-field-line: #6F8278;
    --ls-band: #05190E;
    --ls-tint-danger: #3A1714;
    --ls-tint-success: #12301F;
    --ls-tint-warning: #3A2A0E;
    --ls-link: var(--ls-primary);
    --ls-st-grey: #A7B1BA;
    --ls-st-blue: #7FB0FF;
    --ls-st-navy: #A9C2EE;
    --ls-st-amber: #FFC56B;
    --ls-st-amber-bg: #3A2A10;
    --ls-st-green: #6FD69A;
    --ls-st-black: #F2F2F2;
    --ls-st-red: #FF8A8E;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; }
body { margin: 0; background: var(--ls-paper); color: var(--ls-ink); font: var(--ls-text-md)/1.5 var(--ls-font-body); }
a { color: var(--ls-link); }
h1, h2, h3 { font-family: var(--ls-font-heading); line-height: 1.25; }
h1 { font-size: var(--ls-text-2xl); font-weight: 700; margin: 0 0 .25rem; }
h2 { font-size: var(--ls-text-lg); font-weight: 600; margin: 1.5rem 0 .6rem; }
h3 { font-size: 1rem; font-weight: 600; margin: .9rem 0 .3rem; }
code { font-size: .85em; word-break: break-all; }
:focus-visible { outline: 3px solid var(--ls-focus); outline-offset: 2px; }
/* Blazor moves focus to the page h1 after navigation (tabindex -1) so screen readers announce it; no ring for that. */
h1:focus, h1:focus-visible { outline: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ls-muted); }
.hint { color: var(--ls-muted); font-size: var(--ls-text-sm); margin: .25rem 0 .75rem; }
.skip-link {
  position: absolute; left: var(--ls-space-4); top: -100px; z-index: 100; background: var(--ls-surface); color: var(--ls-ink);
  padding: var(--ls-space-3) var(--ls-space-4); border-radius: var(--ls-radius-sm); border: 2px solid var(--ls-primary);
}
.skip-link:focus { top: var(--ls-space-3); }

/* ---------- Shell: top bar with the brand strip, light side navigation, content ---------- */
.shell {
  display: grid; min-height: 100vh;
  grid-template-columns: 1fr; grid-template-areas: "top" "nav" "main"; grid-template-rows: auto auto 1fr;
}
.topbar {
  grid-area: top; position: sticky; top: 0; z-index: 20;
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--ls-space-3) var(--ls-space-4);
  min-height: 64px; padding: 5px var(--ls-space-4) 0; background: var(--ls-surface); border-bottom: 1px solid var(--ls-line);
}
/* Signature strip: logo green, then Switch Orange (the brand's only use of orange outside the logo). */
.topbar::before, .public-header::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: linear-gradient(90deg, var(--ls-strip-green) 0 62%, var(--ls-accent) 62% 100%);
}
.brand { display: inline-flex; align-items: center; min-height: var(--ls-target-min); text-decoration: none; }
.brand img { display: block; height: 40px; width: auto; }
.brand .logo-dark { display: none; }
@media (prefers-color-scheme: dark) { .brand .logo-light { display: none; } .brand .logo-dark { display: block; } }
.role-pill {
  display: inline-flex; align-items: center; gap: var(--ls-space-2); min-height: 32px; padding: 0 var(--ls-space-3);
  border: 1px solid var(--ls-line); border-radius: var(--ls-radius-pill); font: 500 var(--ls-text-sm) var(--ls-font-ui); color: var(--ls-ink);
}
.role-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ls-primary); }
.user-box { margin-left: auto; display: flex; align-items: center; gap: var(--ls-space-3); font: 500 var(--ls-text-sm) var(--ls-font-ui); }
.user-box form { margin: 0; }
.user-name { color: var(--ls-muted); }
.avatar {
  display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--ls-primary-tint); color: var(--ls-primary-deep); font: 700 .8rem var(--ls-font-heading); letter-spacing: .02em;
}
.sidebar { grid-area: nav; background: var(--ls-surface); border-bottom: 1px solid var(--ls-line); }
.nav-toggle > summary {
  min-height: var(--ls-target-min); display: flex; align-items: center; gap: var(--ls-space-2); padding: 0 var(--ls-space-4);
  cursor: pointer; font: 500 1rem var(--ls-font-ui); list-style: none;
}
.nav-toggle > summary::-webkit-details-marker { display: none; }
.nav-toggle > summary::before { content: "☰"; font-size: 1.1rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; padding: var(--ls-space-2); }
.nav-wide { display: none !important; }
.nav-group {
  font: 500 .72rem var(--ls-font-ui); text-transform: uppercase; letter-spacing: .08em; color: var(--ls-muted);
  padding: var(--ls-space-4) var(--ls-space-3) var(--ls-space-1); margin: 0;
}
.nav-group:first-child { padding-top: var(--ls-space-1); }
.sidebar nav a {
  min-height: var(--ls-target-min); display: flex; align-items: center; gap: 10px; padding: 0 var(--ls-space-3);
  border-radius: var(--ls-radius-sm); color: var(--ls-ink); text-decoration: none; font: 500 .95rem var(--ls-font-ui);
  transition: background-color .15s;
}
.sidebar nav a:hover { background: var(--ls-primary-tint); }
.sidebar nav a.active { background: var(--ls-primary); color: var(--ls-on-primary); box-shadow: var(--ls-shadow); }
.nav-icon { flex: none; width: 20px; height: 20px; opacity: .7; }
.sidebar nav a.active .nav-icon { opacity: 1; }
.content { grid-area: main; padding: 0 var(--ls-gutter) var(--ls-space-7); max-width: 1280px; width: 100%; min-width: 0; }
.content:focus { outline: none; }
@media (min-width: 820px) {
  .shell { grid-template-columns: var(--ls-nav-width) 1fr; grid-template-areas: "top top" "nav main"; grid-template-rows: auto 1fr; }
  .sidebar { border-bottom: 0; border-right: 1px solid var(--ls-line); }
  .sidebar .nav-toggle { display: none; }
  .nav-wide { display: flex !important; }
  .nav-wide { position: sticky; top: 70px; padding: 18px 12px; }
  .content { --ls-gutter: 28px; }
}

/* ---------- Page band: Ink with a green glow and dot grid, edge to edge; holds the page's h1 ---------- */
.page-header {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: var(--ls-space-4) var(--ls-space-5);
  margin: 0 calc(-1 * var(--ls-gutter)) var(--ls-space-5); padding: 28px var(--ls-gutter) 30px;
  background: var(--ls-band); color: var(--ls-band-text);
}
.page-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(44rem 20rem at 92% -30%, var(--ls-band-glow), transparent 62%),
    radial-gradient(rgb(255 255 255 / 0.07) 1px, transparent 1px) 0 0 / 20px 20px;
}
.page-header h1 { margin: 0; font-size: clamp(1.5rem, 1.2rem + 1vw, 1.9rem); color: var(--ls-band-text); }
.page-subtitle { color: var(--ls-band-muted); margin: 6px 0 0; max-width: 60ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: var(--ls-space-2); align-items: center; }
.page-header :focus-visible { outline-color: rgb(255 255 255 / 0.8); }
/* Buttons on the band: outlined white; the page's primary action is the one orange fill (Ink text, 5.9:1). */
.page-header .btn { background: transparent; color: var(--ls-band-text); border-color: rgb(255 255 255 / 0.45); }
.page-header .btn:hover { background: rgb(255 255 255 / 0.08); }
.page-header .btn-primary { background: var(--ls-accent); border-color: var(--ls-accent); color: var(--ls-brand-panel); }
.page-header .btn-primary:hover { background: var(--ls-accent); filter: brightness(1.06); }
.page-header a:not(.btn) { color: var(--ls-band-text); }

/* ---------- Panels and layout helpers ---------- */
.panel {
  background: var(--ls-surface); border: 1px solid var(--ls-line); border-radius: var(--ls-radius-md);
  padding: 20px 22px; margin: 0 0 var(--ls-space-5); box-shadow: var(--ls-shadow);
}
.panel > h2:first-child, .panel > summary { margin-top: 0; }
.panel-accent { border-left: 4px solid var(--ls-primary); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ls-space-4); }
.tabs { display: flex; flex-wrap: wrap; gap: var(--ls-space-1); border-bottom: 1px solid var(--ls-line); margin-bottom: var(--ls-space-4); }
.tabs a {
  padding: .6rem .9rem; text-decoration: none; color: var(--ls-ink-2); border-bottom: 3px solid transparent;
  min-height: var(--ls-target-min); display: flex; align-items: center; font: 500 .95rem var(--ls-font-ui);
}
.tabs a:hover { color: var(--ls-ink); }
.tabs a.active { color: var(--ls-primary-deep); border-bottom-color: var(--ls-primary); }
details > summary { cursor: pointer; min-height: var(--ls-target-min); display: flex; align-items: center; font-family: var(--ls-font-ui); font-weight: 500; }
.inline-h { display: inline; margin: 0; font-size: 1.1rem; }

/* ---------- Stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin: 0 0 var(--ls-space-5); }
.tile {
  position: relative; background: var(--ls-surface); border: 1px solid var(--ls-line); border-radius: var(--ls-radius-md);
  padding: 16px 18px; text-decoration: none; color: var(--ls-ink); display: flex; flex-direction: column-reverse;
  gap: 6px; box-shadow: var(--ls-shadow-raised); transition: background-color .15s, border-color .15s;
}
.tile-warn::after {
  content: ""; position: absolute; top: 16px; right: 16px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ls-warning); box-shadow: 0 0 0 5px color-mix(in srgb, var(--ls-warning) 18%, transparent);
}
a.tile:hover { background: var(--ls-primary-tint); border-color: var(--ls-primary); }
.tile-value { font: 700 1.75rem/1.1 var(--ls-font-heading); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile-money { font-size: 1.25rem; }
.tile-label { color: var(--ls-muted); font: 500 .85rem var(--ls-font-ui); }
.tile-warn .tile-label { padding-right: 24px; }
.tile-warn { border-color: var(--ls-warning); background: var(--ls-tint-warning); }

/* ---------- Forms ---------- */
.form-grid { display: flex; flex-direction: column; gap: var(--ls-space-3); }
fieldset {
  display: flex; flex-direction: column; gap: 14px;
  border: 1px solid var(--ls-line); border-radius: var(--ls-radius-md); padding: 20px 22px; margin: 0;
  background: var(--ls-surface); box-shadow: var(--ls-shadow); min-width: 0;
}
/* Section heading inside the card (floated legends become ordinary flex items). */
legend { float: left; width: 100%; font: 600 1.05rem var(--ls-font-heading); padding: 0 0 10px; margin: 0 0 2px; border-bottom: 1px solid var(--ls-line); }
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; flex: 1; }
.field-row { display: flex; flex-wrap: wrap; gap: var(--ls-space-3) 18px; }
.field-row > .field { min-width: 180px; }
.field.check { flex-direction: row; align-items: center; gap: .5rem; min-height: var(--ls-target-min); }
label, .label { font: 500 .92rem var(--ls-font-ui); }
input, select, textarea {
  font: inherit; font-size: 1rem; color: var(--ls-ink); background: var(--ls-surface); border: 1px solid var(--ls-field-line);
  border-radius: var(--ls-radius-sm); padding: .55rem .75rem; min-height: var(--ls-target-min); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--ls-primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ls-primary) 22%, transparent); outline: none;
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"], .invalid {
  border-color: var(--ls-danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ls-danger) 18%, transparent);
}
.validation-message { color: var(--ls-danger); font-size: var(--ls-text-sm); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 22px; accent-color: var(--ls-primary); box-shadow: none; }
.radio { display: flex; align-items: center; gap: .5rem; min-height: var(--ls-target-min); font-family: var(--ls-font-body); font-weight: 400; }
.input-row { display: flex; gap: .5rem; }
.input-row > input { flex: 1; }
.filters, .quick-find { display: flex; flex-wrap: wrap; gap: var(--ls-space-3); align-items: flex-end; margin: 0 0 var(--ls-space-5); }
.quick-find {
  flex-direction: column; align-items: stretch; max-width: 720px; background: var(--ls-surface); border: 1px solid var(--ls-line);
  border-radius: var(--ls-radius-md); padding: 16px 18px; box-shadow: var(--ls-shadow);
}
.form-actions, .button-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .5rem; }
.price-breakdown { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; margin: 0 0 1rem; max-width: 420px; }
.price-breakdown dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.price-breakdown .total { font: 700 1.2rem var(--ls-font-heading); border-top: 1px solid var(--ls-line); padding-top: .4rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: var(--ls-target-min);
  padding: 0 1.1rem; border-radius: var(--ls-radius-sm); border: 1px solid transparent; font: 500 1rem var(--ls-font-ui);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--ls-primary); color: var(--ls-on-primary); box-shadow: 0 1px 2px rgb(11 46 28 / .12); }
.btn-primary:hover:not(:disabled) { background: var(--ls-primary-deep); }
.btn-secondary { background: var(--ls-surface); color: var(--ls-primary-deep); border-color: var(--ls-primary); }
.btn-secondary:hover:not(:disabled) { background: var(--ls-primary-tint); }
.btn-ghost { background: transparent; color: var(--ls-ink-2); border-color: var(--ls-line); }
.btn-ghost:hover:not(:disabled) { background: var(--ls-surface-2); border-color: var(--ls-field-line); }
.btn-danger { background: var(--ls-danger); color: #fff; }
.btn-lg { min-height: 52px; font-size: 1.05rem; padding: 0 1.5rem; }
.btn-sm { min-height: 36px; padding: 0 .8rem; font-size: .9rem; }
.confirm-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; }

/* ---------- Alerts, badges, states ---------- */
.alert { border-radius: var(--ls-radius-sm); padding: .75rem 1rem; margin: .5rem 0 var(--ls-space-4); border: 1px solid; border-left-width: 4px; }
.alert-error { background: var(--ls-tint-danger); color: var(--ls-danger); border-color: var(--ls-danger); }
.alert-success { background: var(--ls-tint-success); color: var(--ls-success); border-color: var(--ls-success); }
.alert-warn { background: var(--ls-tint-warning); color: var(--ls-warning); border-color: var(--ls-warning); }
.alert a { color: inherit; font-weight: 600; }
.badge {
  display: inline-flex; align-items: center; gap: .3rem; padding: .1rem .65rem; border-radius: var(--ls-radius-pill);
  font: 500 .8rem var(--ls-font-ui); border: 1.5px solid currentColor; white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-grey { color: var(--ls-st-grey); }
.badge-blue { color: var(--ls-st-blue); }
.badge-navy { color: var(--ls-st-navy); }
.badge-amber { color: var(--ls-st-amber); background: var(--ls-st-amber-bg); }
.badge-green { color: var(--ls-st-green); }
.badge-black { color: var(--ls-st-black); }
.badge-red { color: var(--ls-st-red); }
.state-empty {
  color: var(--ls-muted); padding: var(--ls-space-6); text-align: center; background: var(--ls-surface);
  border: 1px dashed var(--ls-field-line); border-radius: var(--ls-radius-md);
}
.state-loading { color: var(--ls-muted); display: flex; align-items: center; gap: .5rem; padding: var(--ls-space-4) 0; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--ls-line); border-top-color: var(--ls-primary); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Tables and lists ---------- */
.grid {
  width: 100%; border-collapse: separate; border-spacing: 0; background: var(--ls-surface); border: 1px solid var(--ls-line);
  border-radius: var(--ls-radius-md); overflow: hidden; font-size: .95rem; box-shadow: var(--ls-shadow); margin-bottom: var(--ls-space-5);
}
.grid th, .grid td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--ls-line); vertical-align: middle; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: var(--ls-surface-2); }
.grid thead th { background: var(--ls-surface-2); font: 500 .78rem var(--ls-font-ui); text-transform: uppercase; letter-spacing: .05em; color: var(--ls-muted); }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid input { min-height: 38px; }
.card-list, .plain-list, .check-list { list-style: none; padding: 0; margin: 0; }
.card-list { display: flex; flex-direction: column; gap: .75rem; }
.card { background: var(--ls-surface); border: 1px solid var(--ls-line); border-radius: var(--ls-radius-md); padding: 16px 18px; box-shadow: var(--ls-shadow); }
.card-row {
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; background: var(--ls-surface); border: 1px solid var(--ls-line);
  border-radius: var(--ls-radius-sm); padding: .7rem 1rem;
}
.card-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: baseline; }
.plain-list li { padding: .4rem 0; border-bottom: 1px dashed var(--ls-line); }
.check-list li { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; min-height: var(--ls-target-min); border-bottom: 1px solid var(--ls-line); padding: .3rem 0; }
.check-list label { font-family: var(--ls-font-body); font-weight: 400; flex: 1; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.25rem; margin: 0; }
.details dt { color: var(--ls-muted); font: 500 .9rem var(--ls-font-ui); }
.details dd { margin: 0; }
.details.inline { grid-template-columns: repeat(4, max-content 1fr); }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--ls-line); }
.timeline li { padding: .3rem 0 .7rem 1.1rem; position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -7px; top: .65rem; width: 12px; height: 12px; border-radius: 50%;
  background: var(--ls-surface); border: 3px solid var(--ls-primary);
}
.timeline li:last-child::before { background: var(--ls-primary); }
.timeline time { color: var(--ls-muted); font-size: .88rem; margin-right: .35rem; }
.pay-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.pay-option { border: 1px solid var(--ls-line); border-radius: var(--ls-radius-md); padding: 16px; background: var(--ls-surface-2); }
.pay-option h3 { margin-top: 0; }

/* ---------- Public pages (tracking, web booking) ---------- */
.public-header {
  position: relative; display: flex; align-items: center; min-height: 64px; padding: 5px var(--ls-space-4) 0;
  background: var(--ls-surface); border-bottom: 1px solid var(--ls-line);
}
.public-main { max-width: 760px; margin: 0 auto; padding: 36px var(--ls-gutter) var(--ls-space-6); }
.public-main > h1:first-child, .public-main > section:first-child > h1:first-child { font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); margin-bottom: var(--ls-space-3); }
.public-footer { display: flex; justify-content: center; align-items: center; gap: .5rem; color: var(--ls-muted); font: 500 .85rem var(--ls-font-ui); padding: 2rem 1rem; }
.public-footer img { height: 22px; width: auto; }
.track-form { margin: 1rem 0; }
.track-status { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ---------- Sign-in: brand panel (Ink) beside the form; stacked on phones ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 5fr) 7fr; background: var(--ls-paper); }
.auth-brand {
  position: relative; display: flex; flex-direction: column; gap: var(--ls-space-5);
  padding: var(--ls-space-7) clamp(var(--ls-space-5), 5vw, 72px); background: var(--ls-brand-panel); color: var(--ls-on-brand); overflow: hidden;
}
.auth-brand::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--ls-accent); }
.auth-brand::after {
  content: ""; position: absolute; right: -120px; bottom: -120px; width: 360px; height: 360px; border-radius: 72px;
  border: 40px solid var(--ls-on-brand); opacity: .05; transform: rotate(45deg); pointer-events: none;
}
.auth-logo img { display: block; width: 280px; height: auto; }
.auth-promise { font: 700 clamp(1.5rem, 2.6vw, 2.25rem)/1.2 var(--ls-font-heading); margin: var(--ls-space-6) 0 0; max-width: 18ch; }
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--ls-space-4); max-width: 40ch; }
.auth-points li { position: relative; padding-left: 32px; color: var(--ls-on-brand-muted); font: 500 1rem/1.5 var(--ls-font-ui); }
.auth-points li::before {
  content: ""; position: absolute; left: 0; top: .35em; width: 18px; height: 18px; border-radius: 50%; background: var(--ls-brand-green-text);
  -webkit-mask: radial-gradient(circle, transparent 0 4px, #000 4.5px); mask: radial-gradient(circle, transparent 0 4px, #000 4.5px);
}
.auth-made { margin: auto 0 0; color: var(--ls-on-brand-muted); font-size: var(--ls-text-sm); }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--ls-space-6) var(--ls-space-4); }
.auth-card {
  width: 100%; max-width: 440px; background: var(--ls-surface); border: 1px solid var(--ls-line); border-radius: var(--ls-radius-md);
  padding: var(--ls-space-6); box-shadow: 0 12px 32px rgb(11 46 28 / .08); margin: 0 auto;
}
.auth-card h1 { margin: 0 0 var(--ls-space-2); }
.auth-card .btn-primary { width: 100%; }
.auth-help { margin-top: var(--ls-space-5); color: var(--ls-muted); font-size: var(--ls-text-sm); text-align: center; max-width: 440px; }
@media (max-width: 899px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: var(--ls-space-5) var(--ls-space-4); gap: var(--ls-space-3); }
  .auth-brand::after, .auth-points, .auth-made { display: none; }
  .auth-logo img { width: 170px; }
  .auth-promise { margin: 0; font-size: var(--ls-text-lg); max-width: none; }
  .auth-main { justify-content: flex-start; padding-top: var(--ls-space-5); }
  .auth-card { padding: var(--ls-space-5); box-shadow: none; }
}

#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--ls-tint-warning); color: var(--ls-warning); padding: .75rem 1rem; z-index: 100; }

/* ---------- Mobile (standard 01 §5): tables become cards below 820 px, no horizontal scroll ---------- */
@media (max-width: 819px) {
  .user-name { display: none; }
  .two-col, .pay-options { grid-template-columns: 1fr; }
  .details.inline { grid-template-columns: max-content 1fr; }
  .mfa-link { display: none; }
  .grid, .grid tbody, .grid tr, .grid td, .grid tfoot, .grid tfoot th { display: block; width: 100%; }
  .grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .grid tr { border-bottom: 1px solid var(--ls-line); padding: .5rem 0; }
  .grid tbody tr:last-child { border-bottom: 0; }
  .grid td { border: 0; padding: .3rem .9rem; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
  .grid td[data-label]::before { content: attr(data-label); font: 500 .85rem var(--ls-font-ui); color: var(--ls-muted); text-align: left; }
  .grid .num { text-align: right; }
}
@media (max-width: 600px) {
  .field-row > .field { min-width: 100%; }
  .role-pill { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 14px; }
  .tile-value { font-size: 1.45rem; }
  .brand img { height: 30px; }
}

/* ---------- Print: 80 mm labels (72 mm printable) and A4 manifests ---------- */
.print-page { padding: 16px; background: #fff; color: #000; min-height: 100vh; }
.print-toolbar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.label-80mm { width: 72mm; font-family: Arial, Helvetica, sans-serif; color: #000; border: 1px dashed #999; padding: 2mm; text-align: center; }
.label-sacco { font-size: 10pt; font-weight: 700; text-transform: uppercase; }
.label-waybill { font-size: 22pt; font-weight: 800; letter-spacing: 1px; margin: 1mm 0; }
.label-route { font-size: 16pt; font-weight: 700; }
.label-town { font-size: 12pt; margin-bottom: 1mm; }
.label-qr { width: 30mm; height: 30mm; image-rendering: pixelated; }
.label-line { font-size: 10pt; margin-top: 1mm; }
.label-fragile { font-size: 14pt; font-weight: 800; border: 2px solid #000; margin: 1mm 0; padding: .5mm; }
.manifest { color: #000; }
.signatures { margin-top: 2rem; }
@media print {
  .page-header { background: #fff; color: #000; margin: 0 0 8px; padding: 0; } .page-header::before { display: none; } .page-header h1 { color: #000; } .page-actions { display: none; }
  .no-print, .sidebar, .topbar, .skip-link { display: none !important; }
  body, .print-page { background: #fff; padding: 0; }
  .label-80mm { border: 0; }
  @page { margin: 4mm; }
}

/* Scan box (FR-3.1): large field for keyboard-wedge scanners. */
.scan-box input { flex: 1; min-width: 12rem; font-size: 1.15rem; letter-spacing: .04em; }
.scan-ok, .scan-miss { margin: .5rem 0 0; padding: .4rem .6rem; border-radius: 6px; font-weight: 600; }
.scan-ok { color: var(--ls-success); background: var(--ls-success-tint); }
.scan-miss { color: var(--ls-danger); background: var(--ls-danger-tint); }

/* Reconciliation (AT-15) verdict. */
.recon-ok { border-left: 6px solid var(--ls-success); background: var(--ls-success-tint); }
.recon-bad { border-left: 6px solid var(--ls-danger); background: var(--ls-danger-tint); }
.recon-ok h2, .recon-bad h2 { margin-top: 0; }

/* Two-factor enrolment. */
.mfa-key { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; margin: .75rem 0; }
.mfa-key img { background: #fff; padding: .5rem; border: 1px solid var(--ls-line); border-radius: 8px; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .4rem; list-style: none; padding: 0; }
.recovery-codes code { font-size: 1.05rem; letter-spacing: .05em; }

/* Conductor phone pages: big touch targets, camera preview. */
.crew-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .75rem; }
.crew-card { display: grid; gap: .25rem; padding: 1rem; border: 1px solid var(--ls-line); border-radius: 10px; background: var(--ls-surface); color: inherit; text-decoration: none; }
.crew-card:hover, .crew-card:focus-visible { border-color: var(--ls-primary); }
.crew-card-title { font-weight: 700; font-size: 1.1rem; }
.crew-progress { font-size: 1.2rem; margin: .25rem 0 .75rem; }
.crew-camera video { width: 100%; max-width: 28rem; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; background: #000; }
.crew-done { color: var(--ls-success); }
