/*
 * OpenBGA Environmental LIMS application theme for Bootstrap 5.3: Evergreen.
 *
 * Bootstrap supplies every control, dialog, dropdown, table and form widget; DataTables supplies
 * grid behaviour. This file sets the design tokens for the light, dark and print modes (Bootstrap
 * `data-bs-theme`, chosen in the theme menu, applied before paint by static/js/theme-init.js),
 * maps them onto Bootstrap's variables, and styles the few pieces Bootstrap has no equivalent for.
 * docs/ui-standards.md section 12 states the design system; this file is the implementation.
 *
 * Separation by surface colour, never by lines: the shell (top bar and sidebar, one pale sage
 * surface), the content ground, panels, raised layers and hover each have their own tint. Panels,
 * table rows, the shell and dialogs have no outlines. The only lines are field outlines, checkbox
 * and radio edges, focus rings, the invalid outline and the coloured lines of the line diagram.
 * Rounded everywhere; no pure black or white on screen; status is always icon plus text.
 *
 * One voice, Overpass, for reading and data (data adds tabular figures and a slashed zero).
 * Forest green is action: the primary button, links, focus, the current nav item.
 */

/* ================================================================ Tokens */

/* Overpass (OFL-1.1; static/vendor/overpass-5.3.0): the reading and data voice.
   Its own metrics (hhea and OS/2 typo, 2000 units per em: ascent 1766, descent 766, line gap 0,
   cap height 1400) put capitals 0.1em above the centre of the line box, so labels sat high in
   buttons, fields and nav items. The overrides keep the same total height (2532 units). Centring
   the cap height exactly would need ascent 1966; Chrome rounds ascent and descent to whole pixels
   at each size, which left 13px labels a pixel high, so ascent is set to 2080 (104%, descent
   452 = 22.6%), with labels on whole-pixel line boxes (--vr-line-height-label): the values that
   centre labels in buttons, fields and pills at 1x and within half a pixel at 2x (pixel
   measurements in .local/evidence/restyle/alignment/). Metrics measured with fontTools.
   The middle dot (U+00B7) is left out of the latin range: Overpass's GDEF classes periodcentered
   as a mark, so shapers give it no advance and it sat on the following space ("Water ·Surface").
   The system font draws it with even spacing. */
@font-face {
  font-family: "Overpass";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  ascent-override: 104%;
  descent-override: 22.6%;
  line-gap-override: 0%;
  src: url("../vendor/overpass-5.3.0/overpass-latin-wght-normal.8cb6433d191e.woff2") format("woff2");
  unicode-range: U+0000-00B6, U+00B8-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;
}

@font-face {
  font-family: "Overpass";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  ascent-override: 104%;
  descent-override: 22.6%;
  line-gap-override: 0%;
  src: url("../vendor/overpass-5.3.0/overpass-latin-ext-wght-normal.aa51d5767186.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;
}

/* Evergreen, light: a pale sage shell (top bar and sidebar are one surface), a warm off-white
   ground, panels separated by tone rather than lines, forest green for action and the current
   item. Contrast: every text pair meets WCAG AA (4.5:1); field outlines, focus, the current nav
   fill and the line colours meet 3:1 on every surface they sit on. */
:root,
[data-bs-theme="light"] {
  color-scheme: light;

  /* Shell: top bar and sidebar */
  --vr-topbar-bg: #e6ebe1;
  --vr-topbar-text: #1f2a20;
  --vr-topbar-text-rgb: 31, 42, 32;
  --vr-topbar-text-muted: #535f51; /* nav group labels and icons */
  --vr-topbar-field: #fafaf6; /* sample lookup */
  --vr-topbar-field-border: #7d8175;
  --vr-topbar-field-text: #1f2a20;
  --vr-topbar-field-muted: #535f51;
  --vr-topbar-accent: #2f6e3e; /* focus on the shell */
  --vr-shell-chip: #d9e1d4; /* laboratory name */
  --vr-shell-hover: #dae2d5;
  --vr-shell-current: #2f5f3a; /* the current nav item */
  --vr-on-shell-current: #f5f8f2;

  /* Ground, panels, text */
  --vr-paper: #f2f3ee; /* content ground behind the panels */
  --vr-surface: #fcfcf9; /* panels and table cards */
  --vr-surface-2: #f3f2ec; /* counts, wells, history items */
  --vr-surface-hover: #ecebe3;
  --vr-raised: #fcfcf9; /* menus, dialogs, popovers */
  --vr-border: #dcdbd2; /* a hairline, only where one is still needed */
  --vr-text: #212720;
  --vr-text-strong: #171c16; /* titles and emphasised values */
  --vr-text-muted: #585f55;
  --vr-placeholder: #5f665c;
  --vr-selection: #d6eadb; /* selected rows, chips, matched text, ::selection */

  /* Action, links, focus */
  --vr-ink: #2f6e3e; /* primary button, current page, checked controls */
  --vr-ink-rgb: 47, 110, 62;
  --vr-ink-hover: #255833;
  --vr-on-ink: #f8fbf6;
  --vr-pen: #2c6639; /* links */
  --vr-pen-rgb: 44, 102, 57;
  --vr-pen-hover: #1e4a28;
  --vr-pen-hover-rgb: 30, 74, 40;
  --vr-focus: #2f6e3e;
  --vr-pencil: #a8392c; /* the required mark and struck prior values */

  /* Fields (treatment A): a 1px outline, a green ring and halo on focus */
  --vr-border-strong: #7d8175; /* field outline, checkbox and radio edge: 3:1 on every surface */
  --vr-border-strong-hover: #62665b;
  --vr-focus-halo: rgba(47, 110, 62, 0.16);

  /* Buttons */
  --vr-button-secondary: #ebeae2;
  --vr-button-secondary-hover: #e1e0d6;

  /* Tables */
  --vr-th-bg: #f2f1ea;
  --vr-row-stripe: #f7f6f1;
  --vr-row-hover: #ebf1e9;

  /* Status tones: text (and icon) on a tinted fill. Borders only for the invalid outline, toned
     table rows and the destructive outline button. */
  --vr-neutral-text: #4c5249;
  --vr-neutral-text-rgb: 76, 82, 73;
  --vr-neutral-bg: #ebeae4;
  --vr-neutral-border: #8a8e84;
  --vr-info-text: #22577a;
  --vr-info-text-rgb: 34, 87, 122;
  --vr-info-bg: #e2edf2;
  --vr-info-border: #6b93ad;
  --vr-progress-text: #61407f;
  --vr-progress-bg: #efe9f3;
  --vr-progress-border: #9a82b0;
  --vr-success-text: #28623a;
  --vr-success-text-rgb: 40, 98, 58;
  --vr-success-bg: #e2f0e3;
  --vr-success-border: #6c9d78;
  --vr-warning-text: #7a4d0c;
  --vr-warning-text-rgb: 122, 77, 12;
  --vr-warning-bg: #f6ecd5;
  --vr-warning-border: #b08a45;
  --vr-danger-text: #a2311f;
  --vr-danger-text-rgb: 162, 49, 31;
  --vr-danger-bg: #f8e7e2;
  --vr-danger-border: #bb4a3c; /* the invalid field outline */
  --vr-danger-solid: #a8392c;
  --vr-on-danger: #fdf8f6;
  --vr-hold-text: #8a2d58;
  --vr-hold-bg: #f5e6ec;
  --vr-hold-border: #b5779a;

  /* Line diagram: one accent colour per laboratory area, never a status */
  --vr-line-intake: #bf5a37;
  --vr-line-sales: #9d6a9c;
  --vr-line-bench: #a37a14;
  --vr-line-release: #6e8a1e;
  --vr-line-lab: #2a8892;
  --vr-line-setup: #777b70;
  --vr-line-pending: #d1d0c6;
  --vr-lane: #f4f3ed;
  --vr-station-hover: #ecebe3;
  --vr-count: #e1e9df;
  --vr-on-count: #1f3b27;

  /* Matrix tag: one key colour per matrix, on the icon tile only (never a status) */
  --vr-matrix-water: #1f6680;
  --vr-matrix-wastewater: #55607a;
  --vr-matrix-soil: #86572a;
  --vr-on-matrix: #fcfcf9;

  /* Scrollbars */
  --vr-scrollbar: #b9beb2;
  --vr-scrollbar-hover: #8a8f83;
  --vr-scrollbar-active: #6c7165;

  /* Elevation: soft layers, never a hard offset */
  --vr-shadow-panel: 0 1px 2px rgba(28, 34, 24, 0.05), 0 2px 10px rgba(28, 34, 24, 0.04);
  --vr-shadow-raised: 0 8px 24px rgba(28, 34, 24, 0.14), 0 2px 6px rgba(28, 34, 24, 0.06);
  --vr-shadow-dialog: 0 24px 60px rgba(28, 34, 24, 0.22), 0 4px 12px rgba(28, 34, 24, 0.08);
  --vr-shadow-button: 0 1px 2px rgba(28, 34, 24, 0.12);
  --vr-shadow-current: 0 1px 2px rgba(28, 34, 24, 0.1);
  --vr-shadow-scroll-top: 0 6px 14px -8px rgba(28, 34, 24, 0.22);
  --vr-shadow-scroll-bottom: 0 -6px 14px -8px rgba(28, 34, 24, 0.22);
  --vr-shadow-scroll-side: 6px 0 14px -8px rgba(28, 34, 24, 0.22);
  --vr-backdrop: rgba(28, 34, 24, 0.5);

  /* Help drawer (static/css/documentation.css): its surface, a soft left shadow instead of a border,
     the numbered-step badge, the good-to-know fill, label chips and filter matches. */
  --vr-help-bg: #fbfbf8;
  --vr-help-step: #2f5f3a;
  --vr-on-help-step: #f5f8f2;
  --vr-help-tip-bg: #eef3ea;
  --vr-help-label-bg: #eceee7;
  --vr-help-mark: #f3e3a6;
  --vr-help-shadow: -12px 0 32px rgba(28, 34, 24, 0.09), -1px 0 0 rgba(28, 34, 24, 0.06);
}

/* Evergreen, dark: forest night. Composed, not inverted: deep green ground, the shell darker than
   the panels, pale green for action. */
[data-bs-theme="dark"] {
  color-scheme: dark;

  --vr-topbar-bg: #0f1c14;
  --vr-topbar-text: #dfe8e0;
  --vr-topbar-text-rgb: 223, 232, 224;
  --vr-topbar-text-muted: #9fb3a3;
  --vr-topbar-field: #1a2c20;
  --vr-topbar-field-border: #7b8a7e;
  --vr-topbar-field-text: #dfe8e0;
  --vr-topbar-field-muted: #9fb3a3;
  --vr-topbar-accent: #9fd7a9;
  --vr-shell-chip: #1a2c20;
  --vr-shell-hover: #17281d;
  --vr-shell-current: #7cbf89;
  --vr-on-shell-current: #0d1f12;

  --vr-paper: #141f18;
  --vr-surface: #1a271e;
  --vr-surface-2: #1f2d24;
  --vr-surface-hover: #26362b;
  --vr-raised: #202e25;
  --vr-border: #2b3a30;
  --vr-text: #dce5dc;
  --vr-text-strong: #ecf1eb;
  --vr-text-muted: #a3b1a4;
  --vr-placeholder: #9cab9e;
  --vr-selection: #2b5235;

  --vr-ink: #86c993;
  --vr-ink-rgb: 134, 201, 147;
  --vr-ink-hover: #a4d8ad;
  --vr-on-ink: #0f2214;
  --vr-pen: #93d09f;
  --vr-pen-rgb: 147, 208, 159;
  --vr-pen-hover: #bce4c2;
  --vr-pen-hover-rgb: 188, 228, 194;
  --vr-focus: #93d09f;
  --vr-pencil: #f09c87;

  --vr-border-strong: #7b8a7e;
  --vr-border-strong-hover: #9aa99c;
  --vr-focus-halo: rgba(134, 201, 147, 0.2);

  --vr-button-secondary: #26352b;
  --vr-button-secondary-hover: #2e3f33;

  --vr-th-bg: #1f2d24;
  --vr-row-stripe: #1d2a21;
  --vr-row-hover: #25352a;

  --vr-neutral-text: #c3cdc3;
  --vr-neutral-text-rgb: 195, 205, 195;
  --vr-neutral-bg: #28362c;
  --vr-neutral-border: #74867a;
  --vr-info-text: #b3d6e8;
  --vr-info-text-rgb: 179, 214, 232;
  --vr-info-bg: #1f3540;
  --vr-info-border: #5f8aa1;
  --vr-progress-text: #dbc6e8;
  --vr-progress-bg: #33283d;
  --vr-progress-border: #8e76a3;
  --vr-success-text: #acdcb4;
  --vr-success-text-rgb: 172, 220, 180;
  --vr-success-bg: #1f3b27;
  --vr-success-border: #5f9a6c;
  --vr-warning-text: #ecd193;
  --vr-warning-text-rgb: 236, 209, 147;
  --vr-warning-bg: #3a301a;
  --vr-warning-border: #a38548;
  --vr-danger-text: #f4b7aa;
  --vr-danger-text-rgb: 244, 183, 170;
  --vr-danger-bg: #45261f;
  --vr-danger-border: #e0866f;
  --vr-danger-solid: #e0866f;
  --vr-on-danger: #1d0f0b;
  --vr-hold-text: #efb6cf;
  --vr-hold-bg: #36262f;
  --vr-hold-border: #a66d8a;

  --vr-line-intake: #e59272;
  --vr-line-sales: #c393c2;
  --vr-line-bench: #d9b04f;
  --vr-line-release: #a9c35a;
  --vr-line-lab: #62bcc5;
  --vr-line-setup: #9aa39b;
  --vr-line-pending: #36463b;
  --vr-lane: #1d2a21;
  --vr-station-hover: #26362b;
  --vr-count: #2c3f31;
  --vr-on-count: #d8e9da;

  --vr-matrix-water: #7ec0d6;
  --vr-matrix-wastewater: #aab5cb;
  --vr-matrix-soil: #d6a674;
  --vr-on-matrix: #0f1712;

  --vr-scrollbar: #3e4e43;
  --vr-scrollbar-hover: #617266;
  --vr-scrollbar-active: #7d8c80;

  --vr-shadow-panel: 0 1px 2px rgba(0, 0, 0, 0.22);
  --vr-shadow-raised: 0 10px 28px rgba(0, 0, 0, 0.4);
  --vr-shadow-dialog: 0 28px 64px rgba(0, 0, 0, 0.5);
  --vr-shadow-button: none;
  --vr-shadow-current: none;
  --vr-shadow-scroll-top: 0 6px 14px -8px rgba(0, 0, 0, 0.55);
  --vr-shadow-scroll-bottom: 0 -6px 14px -8px rgba(0, 0, 0, 0.55);
  --vr-shadow-scroll-side: 6px 0 14px -8px rgba(0, 0, 0, 0.55);
  --vr-backdrop: rgba(4, 8, 6, 0.6);

  --vr-help-bg: #18241c;
  --vr-help-step: #86c993;
  --vr-on-help-step: #0f2214;
  --vr-help-tip-bg: #1f3126;
  --vr-help-label-bg: #26352b;
  --vr-help-mark: #5a4b1c;
  --vr-help-shadow: -14px 0 36px rgba(0, 0, 0, 0.45), -1px 0 0 rgba(255, 255, 255, 0.04);
}

:root {
  --vr-document-paper: #ffffff; /* issued documents (reports, labels) print on white in every mode */

  /* Scales. Outside this section app.css uses these tokens, not literal lengths
     (tests/test_css_tokens.py). rem steps follow a 16px root. */

  /* Spacing: --vr-space-N is N x 0.25rem (margins, padding, gaps, offsets). */
  --vr-space-0-5: 0.125rem;
  --vr-space-1: 0.25rem;
  --vr-space-1-5: 0.375rem;
  --vr-space-2: 0.5rem;
  --vr-space-2-5: 0.625rem;
  --vr-space-3: 0.75rem;
  --vr-space-3-5: 0.875rem;
  --vr-space-4: 1rem;
  --vr-space-5: 1.25rem;
  --vr-space-6: 1.5rem;
  --vr-space-8: 2rem;
  --vr-space-10: 2.5rem;
  --vr-space-12: 3rem;

  /* Type: Overpass for reading and data (data adds tabular figures and a slashed zero); the
     system monospace only for code. Sizes 1 (smallest) to 9; 2 is the table body, 3 the body. */
  --vr-font-sans: "Overpass", system-ui, -apple-system, "Segoe UI", sans-serif;
  --vr-font-data: "Overpass", system-ui, sans-serif;
  --vr-font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --vr-data-features: "tnum" 1, "zero" 1;
  --vr-word-spacing: 0.04em; /* Overpass sets words tight */
  --vr-font-size-1: 0.75rem;
  --vr-font-size-2: 0.8125rem;
  --vr-font-size-3: 0.875rem;
  --vr-font-size-4: 0.9375rem;
  --vr-font-size-5: 1rem;
  --vr-font-size-6: 1.125rem;
  --vr-font-size-7: 1.25rem;
  --vr-font-size-8: 1.5rem;
  --vr-font-size-9: 1.875rem; /* page title */
  --vr-font-weight-regular: 400;
  --vr-font-weight-medium: 500;
  --vr-font-weight-semibold: 600;
  --vr-font-weight-bold: 700;
  --vr-font-weight-black: 800;
  --vr-line-height-tight: 1.2;
  --vr-line-height-snug: 1.3;
  --vr-line-height-base: 1.5;
  /* Labels in boxes (buttons, nav items, pills) sit on a whole-pixel line box: a fractional one
     (13px x 1.2 = 15.6px) rounds differently at each size and leaves the label up to a pixel off
     centre. */
  --vr-line-height-label: 1rem;
  --vr-line-height-label-sm: 0.875rem;
  --vr-tracking-title: -0.015em;
  --vr-tracking-label: 0.06em; /* uppercase labels: sidebar groups, table heads */

  /* Shape: rounded everywhere; lines only on fields, checks, focus and the line diagram. */
  --vr-radius-xs: 1px;
  --vr-radius-sm: 4px;
  --vr-radius: 8px;
  --vr-radius-lg: 10px; /* fields, nav items, table rows, menu options */
  --vr-radius-tag: 6px; /* matrix tiles: squarer than a pill, so a matrix never reads as a status */
  --vr-radius-button: 12px;
  --vr-radius-menu: 12px;
  --vr-radius-lane: 14px;
  --vr-radius-xl: 16px; /* panels, notices */
  --vr-radius-dialog: 18px;
  --vr-radius-main: 18px; /* the content sheet's corner against the shell */
  --vr-radius-pill: 999px; /* status pills, counts, chips */
  --vr-border-width: 1px;
  --vr-border-width-md: 1.5px; /* checkbox and radio edges */
  --vr-border-width-lg: 2px;
  --vr-border-width-xl: 3px; /* station rings */
  --vr-line-width: 4px; /* the line diagram: lines, and the stations on them */
  --vr-station-lg: 1.25rem;
  --vr-focus-width: 2px;
  --vr-focus-offset: 2px;
  --vr-halo-width: 4px;

  /* Stacking: within the page, then the shell over it. Bootstrap's own layers (dropdown 1000,
     offcanvas 1045, modal 1055, tooltip 1080) sit between the top bar and the skip link. */
  --vr-z-below: -1;
  --vr-z-base: 0;
  --vr-z-raised: 1;
  --vr-z-sticky: 5;
  --vr-z-topbar: 1030;
  --vr-z-menu: 1060; /* select menus and date popovers: over the top bar, and within a dialog */
  --vr-z-confirm-backdrop: 1065; /* a confirmation stacked over the form dialog, and its scrim */
  --vr-z-confirm: 1070;
  --vr-z-skip: 1100;

  /* Density and layout */
  --vr-control-height: 2.25rem;
  --vr-control-height-sm: 1.875rem;
  --vr-nav-item-height: 2.125rem;
  --vr-row-height: 2.5rem;
  --vr-matrix-tile-sm: 1.125rem;
  --vr-matrix-tile: 1.25rem;
  --vr-matrix-tile-lg: 1.5rem;
  --vr-matrix-source-width: 8rem; /* the source truncates in dense rows */
  --vr-cell-sub-width: 6rem; /* a sub-line under a name in a list table */
  --vr-reading-grid-width: 24rem; /* two readable columns of bench observations */
  --vr-badge-py: 0.1875rem; /* status pills */
  --vr-badge-px: 0.625rem;
  --vr-badge-py-lg: 0.3125rem;
  --vr-badge-px-lg: 0.75rem;
  --vr-panel-inset: 1.25rem; /* content inside a panel, from its edge */
  --vr-stack: 0.75rem; /* between stacked blocks in a panel */
  --vr-cell-py: 0.625rem;
  --vr-cell-py-list: 0.5rem;
  --vr-cell-px-list: 0.5rem;
  --vr-cell-px: 0.5625rem;
  --vr-topbar-height: 3.5rem;
  --vr-sidenav-width: 15rem;
  --vr-sidenav-rail-width: 4.25rem; /* the collapsed sidebar: icons only */
  --vr-shell-gutter: 0.5rem; /* keeps the sidebar's scrollbar inside the shell */
  --vr-content-pad-x: 1rem;
  --vr-content-pad-y: 1rem;
  --vr-form-width: 48rem;
  --vr-fact-width: 11rem; /* one key-fact track (Record detail) */
  --vr-scrollbar-size: 0.75rem;
  --vr-scrollbar-inset: 3px;
  --vr-scrollbar-inset-hover: 2px;
  --vr-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --vr-motion-fast: 140ms;
}

/* Derived tokens and the Bootstrap mapping, re-evaluated per mode because the tokens change
   underneath. */
:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --vr-field-focus-ring: 0 0 0 var(--vr-border-width) var(--vr-focus), 0 0 0 var(--vr-halo-width) var(--vr-focus-halo);
  --vr-field-invalid-ring: 0 0 0 var(--vr-border-width) var(--vr-danger-border);

  --bs-body-font-family: var(--vr-font-sans);
  --bs-font-sans-serif: var(--vr-font-sans);
  --bs-font-monospace: var(--vr-font-mono);
  --bs-primary: var(--vr-ink);
  --bs-primary-rgb: var(--vr-ink-rgb);
  --bs-primary-text-emphasis: var(--vr-text);
  --bs-primary-bg-subtle: var(--vr-selection);
  --bs-primary-border-subtle: var(--vr-ink);
  --bs-body-color: var(--vr-text);
  --bs-body-bg: var(--vr-paper);
  --bs-emphasis-color: var(--vr-text-strong);
  --bs-heading-color: var(--vr-text-strong);
  --bs-secondary-color: var(--vr-text-muted);
  --bs-secondary-bg: var(--vr-surface-2);
  --bs-tertiary-bg: var(--vr-surface-2);
  --bs-tertiary-color: var(--vr-text-muted);
  /* Separation is by surface, not lines: stock Bootstrap edges disappear. */
  --bs-border-color: transparent;
  --bs-border-color-translucent: transparent;
  --bs-border-radius: var(--vr-radius-lg);
  --bs-border-radius-sm: var(--vr-radius);
  --bs-border-radius-lg: var(--vr-radius-xl);
  --bs-border-radius-xl: var(--vr-radius-xl);
  --bs-border-radius-pill: var(--vr-radius-pill);
  /* Bootstrap 5.3 hovers links through the -rgb variable: both are set, or links hover blue. */
  --bs-link-color: var(--vr-pen);
  --bs-link-color-rgb: var(--vr-pen-rgb);
  --bs-link-hover-color: var(--vr-pen-hover);
  --bs-link-hover-color-rgb: var(--vr-pen-hover-rgb);
  --bs-focus-ring-color: var(--vr-focus-halo);
  --bs-form-invalid-color: var(--vr-danger-text);
  --bs-form-invalid-border-color: var(--vr-danger-border);
  --bs-form-valid-color: var(--vr-success-text);
  --bs-form-valid-border-color: var(--vr-success-border);
  --bs-highlight-bg: var(--vr-selection);
  --bs-highlight-color: var(--vr-text);
  --bs-backdrop-bg: var(--vr-backdrop);
  --bs-backdrop-opacity: 1;
  /* Bootstrap's semantic colours take the status tones (secondary is the neutral tone), so its
     utilities, alerts and validation follow the theme. */
  --bs-secondary: var(--vr-neutral-text);
  --bs-secondary-rgb: var(--vr-neutral-text-rgb);
  --bs-secondary-text-emphasis: var(--vr-neutral-text);
  --bs-secondary-bg-subtle: var(--vr-neutral-bg);
  --bs-secondary-border-subtle: var(--vr-neutral-border);
  --bs-info: var(--vr-info-text);
  --bs-info-rgb: var(--vr-info-text-rgb);
  --bs-info-text-emphasis: var(--vr-info-text);
  --bs-info-bg-subtle: var(--vr-info-bg);
  --bs-info-border-subtle: var(--vr-info-border);
  --bs-success: var(--vr-success-text);
  --bs-success-rgb: var(--vr-success-text-rgb);
  --bs-success-text-emphasis: var(--vr-success-text);
  --bs-success-bg-subtle: var(--vr-success-bg);
  --bs-success-border-subtle: var(--vr-success-border);
  --bs-warning: var(--vr-warning-text);
  --bs-warning-rgb: var(--vr-warning-text-rgb);
  --bs-warning-text-emphasis: var(--vr-warning-text);
  --bs-warning-bg-subtle: var(--vr-warning-bg);
  --bs-warning-border-subtle: var(--vr-warning-border);
  --bs-danger: var(--vr-danger-text);
  --bs-danger-rgb: var(--vr-danger-text-rgb);
  --bs-danger-text-emphasis: var(--vr-danger-text);
  --bs-danger-bg-subtle: var(--vr-danger-bg);
  --bs-danger-border-subtle: var(--vr-danger-border);
}

/* Sign-in page (Entrance pages). The scene's art is a static picture per theme with its colours
   baked in (static/img/entrance/scene-light.svg, scene-dark.svg; tools/entrance_scene/); app.css
   needs only its sky, shown while the art loads, and the headline over it. */
.vr-scene {
  --vr-scene-sky: #e3ebe2;
  --vr-scene-headline: #1b2b1e;
  --vr-scene-subline: #4a574a;
}

[data-bs-theme="dark"] .vr-scene {
  --vr-scene-sky: #0a1611;
  --vr-scene-headline: #edf2ea;
  --vr-scene-subline: #aebcab;
}

.vr-entrance {
  --vr-shadow-sheet: 0 1px 2px rgba(28, 34, 24, 0.05), 0 12px 32px rgba(28, 34, 24, 0.07);
}

[data-bs-theme="dark"] .vr-entrance {
  --vr-shadow-sheet: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px rgba(0, 0, 0, 0.35);
}

/* The entrance page alone scales its root font: 16px up to about 1500px wide, 20px at 2560px. */
:root {
  --vr-entrance-root-size: clamp(16px, 0.4vw + 10px, 20px);
  --vr-entrance-headline-size: 2.6rem;
  --vr-entrance-subline-size: 1.0625rem;
  --vr-entrance-title-size: 1.625rem;
  --vr-entrance-headline-top: clamp(2.5rem, 7.5vh, 5.5rem);
  --vr-entrance-headline-left: clamp(2.5rem, 5.5%, 5rem);
  --vr-entrance-field-height: 2.625rem;
  --vr-entrance-button-height: 2.75rem;
  --vr-tracking-display: -0.025em;
}

/* Print: one light, high-contrast palette whatever the screen mode; pills print as text and icon
   on white; no shadows. */
@media print {
  :root,
  [data-bs-theme],
  [data-bs-theme="dark"] {
    color-scheme: light;
    --vr-paper: #ffffff;
    --vr-surface: #ffffff;
    --vr-surface-2: #f4f4f2;
    --vr-surface-hover: #ffffff;
    --vr-raised: #ffffff;
    --vr-border: #b9beb2;
    --vr-text: #171c16;
    --vr-text-strong: #000000;
    --vr-text-muted: #3f453d;
    --vr-placeholder: #3f453d;
    --vr-selection: #ffffff;
    --vr-ink: #1b3a27;
    --vr-ink-rgb: 27, 58, 39;
    --vr-ink-hover: #1b3a27;
    --vr-on-ink: #ffffff;
    --vr-pen: #1e4a28;
    --vr-pen-rgb: 30, 74, 40;
    --vr-pen-hover: #1e4a28;
    --vr-pen-hover-rgb: 30, 74, 40;
    --vr-pencil: #8f1f18;
    --vr-border-strong: #555f59;
    --vr-th-bg: #f2f2f0;
    --vr-row-stripe: #ffffff;
    --vr-row-hover: #ffffff;
    --vr-focus: #2f6e3e;
    --vr-focus-halo: rgba(47, 110, 62, 0.16);
    --vr-border-strong-hover: #555f59;
    /* Status: the light tones' text and edges on white, also when printing from dark mode. */
    --vr-neutral-text: #4c5249;
    --vr-neutral-text-rgb: 76, 82, 73;
    --vr-neutral-bg: #ffffff;
    --vr-neutral-border: #8a8e84;
    --vr-info-text: #22577a;
    --vr-info-text-rgb: 34, 87, 122;
    --vr-info-bg: #ffffff;
    --vr-info-border: #6b93ad;
    --vr-progress-text: #61407f;
    --vr-progress-bg: #ffffff;
    --vr-progress-border: #9a82b0;
    --vr-success-text: #28623a;
    --vr-success-text-rgb: 40, 98, 58;
    --vr-success-bg: #ffffff;
    --vr-success-border: #6c9d78;
    --vr-warning-text: #7a4d0c;
    --vr-warning-text-rgb: 122, 77, 12;
    --vr-warning-bg: #ffffff;
    --vr-warning-border: #b08a45;
    --vr-danger-text: #a2311f;
    --vr-danger-text-rgb: 162, 49, 31;
    --vr-danger-bg: #ffffff;
    --vr-hold-text: #8a2d58;
    --vr-hold-bg: #ffffff;
    --vr-hold-border: #b5779a;
    --vr-danger-border: #8f1f18;
    --vr-danger-solid: #8f1f18;
    --vr-on-danger: #ffffff;
    --vr-line-intake: #bf5a37;
    --vr-line-sales: #9d6a9c;
    --vr-line-bench: #a37a14;
    --vr-line-release: #6e8a1e;
    --vr-line-lab: #2a8892;
    --vr-line-setup: #777b70;
    --vr-line-pending: #d1d0c6;
    --vr-matrix-water: #1f6680;
    --vr-matrix-wastewater: #55607a;
    --vr-matrix-soil: #86572a;
    --vr-on-matrix: #ffffff;
    --vr-lane: #ffffff;
    --vr-count: #ffffff;
    --vr-on-count: #171c16;
    --vr-shadow-panel: none;
    --vr-shadow-raised: none;
    --vr-shadow-dialog: none;
    --vr-shadow-button: none;
    --vr-shadow-current: none;
  }
}

/* ================================================================ Base */

html {
  scroll-padding-top: calc(var(--vr-topbar-height) + var(--vr-space-3));
  scroll-padding-bottom: 6rem; /* Clear page-level sticky form actions when tabbing. */
}

body {
  min-height: 100vh;
  background-color: var(--vr-paper);
  color: var(--vr-text);
  font-family: var(--vr-font-sans);
  font-size: var(--vr-font-size-3);
  line-height: var(--vr-line-height-base);
  word-spacing: var(--vr-word-spacing);
  caret-color: var(--vr-text);
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--vr-selection);
  color: var(--vr-text);
}

h1,
h2,
h3,
h4 {
  font-weight: var(--vr-font-weight-bold);
  color: var(--vr-text-strong);
  text-wrap: balance;
}

/* Links: forest, underlined on hover; inside running text they keep the underline, so colour is
   never the only cue. */
a {
  text-decoration: none;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration: underline;
}

p a:not(.btn),
.alert a:not(.btn),
.form-text a {
  text-decoration: underline;
}

:focus-visible {
  outline: var(--vr-focus-width) solid var(--vr-focus);
  outline-offset: var(--vr-focus-offset);
}

.vr-icon {
  width: 1em;
  height: 1em;
  flex: none;
  fill: currentColor;
  vertical-align: -0.125em;
}

.vr-muted,
.text-body-secondary {
  color: var(--vr-text-muted) !important;
}

.vr-nowrap {
  white-space: nowrap;
}

/* The data voice: identifiers, dates, counts and right-aligned figures in Overpass with tabular
   figures and a slashed zero, so 0/O stay distinct and digits line up. */
time,
.vr-id,
.vr-count,
.vr-timeline-meta,
.vr-navlink-count,
.vr-table > tbody > tr > .text-end {
  font-family: var(--vr-font-data);
  font-feature-settings: var(--vr-data-features);
  font-variant-numeric: tabular-nums slashed-zero;
}

.vr-id {
  white-space: nowrap;
}

code,
kbd,
pre,
samp {
  font-family: var(--vr-font-mono);
}

mark,
.mark {
  padding: 0 0.15em;
  border-radius: var(--vr-radius-sm);
  background: var(--vr-selection);
  color: var(--vr-text);
}

/* Red pencil: prior values struck through in corrections and amendments. */
del,
s,
.vr-prior {
  color: var(--vr-text-muted);
  text-decoration-line: line-through;
  text-decoration-color: var(--vr-pencil);
  text-decoration-thickness: var(--vr-border-width-lg);
}

@media (prefers-reduced-motion: no-preference) {
  .btn,
  .form-control,
  .form-select,
  .vr-navlink {
    transition: background-color var(--vr-motion-fast) ease-out, border-color var(--vr-motion-fast) ease-out,
      color var(--vr-motion-fast) ease-out, box-shadow var(--vr-motion-fast) ease-out;
  }
}

/* A registered colour, so the sidebar can fade its scrollbar in: scrollbar colours do not
   transition themselves, but an animatable custom property they read does. */
@property --vr-thumb {
  syntax: "<color>";
  inherits: true;
  initial-value: transparent;
}

/* Scrollbars: one treatment for every scroll container. Thin, rounded, inset from the edge by a
   transparent border on a transparent track; quiet at rest, stronger when the container is
   hovered, strongest on the thumb. Chromium ignores ::-webkit-scrollbar once scrollbar-color is
   set, so the standard properties go only to browsers without it (Firefox). Never hidden. */
::-webkit-scrollbar {
  width: var(--vr-scrollbar-size);
  height: var(--vr-scrollbar-size);
}

::-webkit-scrollbar-track,
::-webkit-scrollbar-corner {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  min-width: var(--vr-space-8);
  min-height: var(--vr-space-8);
  border: var(--vr-scrollbar-inset) solid transparent;
  border-radius: var(--vr-radius-pill);
  background-color: var(--vr-scrollbar);
  background-clip: padding-box;
}

html:hover::-webkit-scrollbar-thumb,
.vr-sidenav:hover::-webkit-scrollbar-thumb,
.modal-body:hover::-webkit-scrollbar-thumb,
.ts-dropdown-content:hover::-webkit-scrollbar-thumb,
.vr-table-wrap:hover::-webkit-scrollbar-thumb,
.vr-record-aside-scroll:hover::-webkit-scrollbar-thumb,
.dt-scroll-body:hover::-webkit-scrollbar-thumb {
  background-color: var(--vr-scrollbar-hover);
}

::-webkit-scrollbar-thumb:hover {
  border-width: var(--vr-scrollbar-inset-hover);
  background-color: var(--vr-scrollbar-hover);
}

::-webkit-scrollbar-thumb:active {
  border-width: var(--vr-scrollbar-inset-hover);
  background-color: var(--vr-scrollbar-active);
}

@supports not selector(::-webkit-scrollbar) {
  html,
  .vr-sidenav,
  .modal-body,
  .ts-dropdown-content,
  .vr-table-wrap {
    scrollbar-width: thin;
    scrollbar-color: var(--vr-scrollbar) transparent;
  }

  html:hover,
  .vr-sidenav:hover,
  .modal-body:hover,
  .ts-dropdown-content:hover,
  .vr-table-wrap:hover {
    scrollbar-color: var(--vr-scrollbar-hover) transparent;
  }
}

/* ================================================================ Bootstrap components */

/* Buttons: filled, never outlined. Primary is forest, secondary a tonal fill, quiet a link. */
.btn {
  --bs-btn-font-family: var(--vr-font-sans);
  --bs-btn-font-size: var(--vr-font-size-2);
  --bs-btn-font-weight: var(--vr-font-weight-bold);
  --bs-btn-border-width: 0;
  --bs-btn-border-radius: var(--vr-radius-button);
  --bs-btn-disabled-opacity: 1;
  --bs-btn-padding-y: 0;
  --bs-btn-padding-x: var(--vr-space-4);
  --bs-btn-line-height: var(--vr-line-height-label);
  --bs-btn-focus-box-shadow: none;
  min-height: var(--vr-control-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--vr-space-2);
  white-space: nowrap;
}

.btn .vr-icon {
  font-size: var(--vr-font-size-5);
}

.btn-sm {
  --bs-btn-padding-x: var(--vr-space-3);
  --bs-btn-font-size: var(--vr-font-size-1);
  --bs-btn-border-radius: var(--vr-radius-lg);
  min-height: var(--vr-control-height-sm);
}

.btn:focus-visible {
  outline: var(--vr-focus-width) solid var(--vr-focus);
  outline-offset: var(--vr-focus-offset);
  box-shadow: none;
}

.btn-primary {
  --bs-btn-color: var(--vr-on-ink);
  --bs-btn-bg: var(--vr-ink);
  --bs-btn-hover-color: var(--vr-on-ink);
  --bs-btn-hover-bg: var(--vr-ink-hover);
  --bs-btn-active-color: var(--vr-on-ink);
  --bs-btn-active-bg: var(--vr-ink-hover);
  box-shadow: var(--vr-shadow-button);
}

/* Secondary actions (btn-outline-secondary is kept as the class contract): a tonal fill. */
.btn-outline-primary,
.btn-outline-secondary {
  --bs-btn-color: var(--vr-text);
  --bs-btn-bg: var(--vr-button-secondary);
  --bs-btn-hover-color: var(--vr-text);
  --bs-btn-hover-bg: var(--vr-button-secondary-hover);
  --bs-btn-active-color: var(--vr-text);
  --bs-btn-active-bg: var(--vr-button-secondary-hover);
}

/* Destructive: danger text on a transparent fill, the danger tint on hover, no outline; it goes
   first in an action row and its label names its object. */
.btn-outline-danger {
  --bs-btn-color: var(--vr-danger-text);
  --bs-btn-bg: transparent;
  --bs-btn-hover-color: var(--vr-danger-text);
  --bs-btn-hover-bg: var(--vr-danger-bg);
  --bs-btn-active-color: var(--vr-danger-text);
  --bs-btn-active-bg: var(--vr-danger-bg);
}

/* The other outline variants are not used by the templates (tests/test_ui_standards.py), but none
   may show Bootstrap's stock colours: tone text on a transparent fill, the tone's tint on hover. */
.btn-outline-success {
  --vr-btn-tone-text: var(--vr-success-text);
  --vr-btn-tone-bg: var(--vr-success-bg);
}

.btn-outline-warning {
  --vr-btn-tone-text: var(--vr-warning-text);
  --vr-btn-tone-bg: var(--vr-warning-bg);
}

.btn-outline-info {
  --vr-btn-tone-text: var(--vr-info-text);
  --vr-btn-tone-bg: var(--vr-info-bg);
}

.btn-outline-light,
.btn-outline-dark {
  --vr-btn-tone-text: var(--vr-text);
  --vr-btn-tone-bg: var(--vr-button-secondary-hover);
}

.btn-outline-success,
.btn-outline-warning,
.btn-outline-info,
.btn-outline-light,
.btn-outline-dark {
  --bs-btn-color: var(--vr-btn-tone-text);
  --bs-btn-bg: transparent;
  --bs-btn-hover-color: var(--vr-btn-tone-text);
  --bs-btn-hover-bg: var(--vr-btn-tone-bg);
  --bs-btn-active-color: var(--vr-btn-tone-text);
  --bs-btn-active-bg: var(--vr-btn-tone-bg);
  --bs-btn-disabled-color: var(--vr-text-muted);
  --bs-btn-disabled-bg: transparent;
}

/* The filled destructive button: only the second step of a destructive choice (Discard changes). */
.btn-danger {
  --bs-btn-color: var(--vr-on-danger);
  --bs-btn-bg: var(--vr-danger-solid);
  --bs-btn-hover-color: var(--vr-on-danger);
  --bs-btn-hover-bg: var(--vr-danger-text);
  --bs-btn-active-color: var(--vr-on-danger);
  --bs-btn-active-bg: var(--vr-danger-text);
}

.btn-link {
  --bs-btn-color: var(--vr-pen);
  --bs-btn-hover-color: var(--vr-pen-hover);
  --bs-btn-active-color: var(--vr-pen-hover);
  text-decoration: none;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Disabled buttons: muted text on the second surface, at full opacity so the label stays legible
   (the reason sits in text beside the control, docs/ui-standards.md section 10). */
.btn-primary,
.btn-outline-primary,
.btn-outline-secondary,
.btn-outline-danger,
.btn-danger {
  --bs-btn-disabled-color: var(--vr-text-muted);
  --bs-btn-disabled-bg: var(--vr-surface-2);
}

.btn-primary:disabled {
  box-shadow: none;
}

.btn-link {
  --bs-btn-disabled-color: var(--vr-text-muted);
}

/* Fields, treatment A: no fill, a 1px outline that meets 3:1 on every surface, a green ring and
   halo on focus, the danger outline and ring when invalid (never a red fill). The Form controls
   section extends this box to Tom Select, the date field and unit groups. */
.form-control,
.form-select {
  min-height: var(--vr-control-height);
  padding-top: var(--vr-space-1-5);
  padding-bottom: var(--vr-space-1-5);
  background-color: transparent;
  border: var(--vr-border-width) solid var(--vr-border-strong);
  border-radius: var(--vr-radius-lg);
  color: var(--vr-text);
  font-size: var(--vr-font-size-2);
}

.form-control:hover:not(:disabled, [readonly], :focus, .is-invalid, [aria-invalid="true"]),
.form-select:hover:not(:disabled, :focus, .is-invalid, [aria-invalid="true"]) {
  border-color: var(--vr-border-strong-hover);
}

.form-control::placeholder {
  color: var(--vr-placeholder);
  opacity: 1;
}

.form-control:focus,
.form-select:focus {
  background-color: transparent;
  border-color: var(--vr-focus);
  box-shadow: var(--vr-field-focus-ring);
  color: var(--vr-text);
  outline: none;
}

.form-control:disabled,
.form-select:disabled,
.form-control[readonly] {
  background-color: var(--vr-surface-2);
  color: var(--vr-text-muted);
}

/* Django 5.2 marks fields with errors aria-invalid="true"; style them like Bootstrap's .is-invalid,
   without its warning icon (the message under the field carries the icon). */
.form-control.is-invalid,
.form-select.is-invalid,
.form-control[aria-invalid="true"],
.form-select[aria-invalid="true"] {
  border-color: var(--vr-danger-border);
  box-shadow: var(--vr-field-invalid-ring);
}

.form-control.is-invalid,
.form-control[aria-invalid="true"] {
  padding-right: var(--vr-space-3);
  background-image: none;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus,
.form-control[aria-invalid="true"]:focus,
.form-select[aria-invalid="true"]:focus {
  border-color: var(--vr-danger-border);
  box-shadow: var(--vr-field-invalid-ring), 0 0 0 var(--vr-halo-width) var(--vr-focus-halo);
}

/* Checkbox and radio: Bootstrap's own box with a 1.5px edge, forest when checked. */
.form-check-input {
  width: 1.125em;
  height: 1.125em;
  background-color: transparent;
  border: var(--vr-border-width-md) solid var(--vr-border-strong);
  border-radius: var(--vr-radius-sm);
}

.form-check-input[type="radio"] {
  border-radius: 50%;
}

.form-check-input:focus {
  border-color: var(--vr-focus);
  box-shadow: var(--vr-field-focus-ring);
  outline: none;
}

/* Checked and mixed ("select all" on a partly selected page). Bootstrap hard-codes its blue for
   [type=checkbox]:indeterminate, so the selector matches its specificity. */
.form-check-input:checked,
.form-check-input[type="checkbox"]:indeterminate {
  background-color: var(--vr-ink);
  border-color: var(--vr-ink);
}

/* Bootstrap's own tick and bar, drawn in the dark-mode ink (--vr-on-ink) on the pale green box. */
[data-bs-theme="dark"] .form-check-input:checked[type="checkbox"] {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%230f2214' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
}

[data-bs-theme="dark"] .form-check-input[type="checkbox"]:indeterminate {
  --bs-form-check-bg-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%230f2214' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10h8'/%3e%3c/svg%3e");
}

/* A disabled box keeps its tick: only an empty one takes the muted surface. */
.form-check-input:disabled:not(:checked, :indeterminate) {
  background-color: var(--vr-surface-2);
}

.form-check-input[aria-invalid="true"] {
  border-color: var(--vr-danger-border);
}

.form-switch .form-check-input {
  width: 2.25em;
  border-radius: var(--vr-radius-pill);
}

.form-label {
  margin-bottom: var(--vr-space-1-5);
  color: var(--vr-text);
  font-size: var(--vr-font-size-2);
  font-weight: var(--vr-font-weight-bold);
}

.form-check-label {
  font-size: var(--vr-font-size-2);
}

.form-text {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

/* Unit and prefix text inside an input group: muted text, no box of its own. */
.input-group-text {
  background-color: transparent;
  border: var(--vr-border-width) solid var(--vr-border-strong);
  border-radius: var(--vr-radius-lg);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
}

/* Pager: quiet number buttons; the current page is the forest fill. */
.pagination {
  --bs-pagination-color: var(--vr-text);
  --bs-pagination-bg: transparent;
  --bs-pagination-border-width: 0;
  --bs-pagination-border-radius: var(--vr-radius-button);
  --bs-pagination-hover-color: var(--vr-text);
  --bs-pagination-hover-bg: var(--vr-surface-hover);
  --bs-pagination-focus-color: var(--vr-text);
  --bs-pagination-focus-bg: var(--vr-surface-hover);
  --bs-pagination-focus-box-shadow: none;
  --bs-pagination-active-color: var(--vr-on-ink);
  --bs-pagination-active-bg: var(--vr-ink);
  --bs-pagination-disabled-color: var(--vr-text-muted);
  --bs-pagination-disabled-bg: transparent;
  gap: var(--vr-space-1);
  font-size: var(--vr-font-size-2);
}

.page-link {
  min-width: var(--vr-control-height-sm);
  min-height: var(--vr-control-height-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--vr-radius-button) !important; /* Bootstrap rounds only the outer ends */
}

.page-item.active .page-link {
  font-weight: var(--vr-font-weight-bold);
}

.page-link:focus-visible {
  outline: var(--vr-focus-width) solid var(--vr-focus);
  outline-offset: var(--vr-focus-offset);
}

/* Bootstrap components that hard-code its default blue rather than --bs-primary. */
.nav {
  --bs-nav-link-color: var(--vr-pen);
  --bs-nav-link-hover-color: var(--vr-pen-hover);
}

.nav-link:focus-visible {
  outline: var(--vr-focus-width) solid var(--vr-focus);
  outline-offset: calc(-1 * var(--vr-focus-offset));
  box-shadow: none;
}

.list-group {
  --bs-list-group-bg: transparent;
  --bs-list-group-border-color: transparent;
  --bs-list-group-active-color: var(--vr-on-ink);
  --bs-list-group-active-bg: var(--vr-ink);
  --bs-list-group-active-border-color: var(--vr-ink);
}

.progress,
.progress-stacked {
  --bs-progress-bg: var(--vr-surface-2);
  --bs-progress-border-radius: var(--vr-radius-pill);
  --bs-progress-bar-bg: var(--vr-ink);
  --bs-progress-bar-color: var(--vr-on-ink);
}

.form-range {
  accent-color: var(--vr-ink);
}

/* Menus: a raised surface with the menu shadow, no outline; options are rounded rows. */
.dropdown-menu {
  --bs-dropdown-bg: var(--vr-raised);
  --bs-dropdown-color: var(--vr-text);
  --bs-dropdown-border-width: 0;
  --bs-dropdown-border-radius: var(--vr-radius-menu);
  --bs-dropdown-inner-border-radius: var(--vr-radius-lg);
  --bs-dropdown-link-color: var(--vr-text);
  --bs-dropdown-link-hover-color: var(--vr-text);
  --bs-dropdown-link-hover-bg: var(--vr-surface-hover);
  --bs-dropdown-link-active-color: var(--vr-on-ink);
  --bs-dropdown-link-active-bg: var(--vr-ink);
  --bs-dropdown-header-color: var(--vr-text-muted);
  --bs-dropdown-divider-bg: var(--vr-surface-hover);
  --bs-dropdown-font-size: var(--vr-font-size-2);
  --bs-dropdown-box-shadow: var(--vr-shadow-raised);
  box-shadow: var(--vr-shadow-raised);
  padding: var(--vr-space-1-5);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--vr-space-2);
  border-radius: var(--vr-radius-lg);
}

.dropdown-header {
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
}

/* Dialogs: raised, the dialog radius and shadow, a scrim behind, no rules inside. */
.modal {
  --bs-modal-bg: var(--vr-raised);
  --bs-modal-color: var(--vr-text);
  --bs-modal-border-width: 0;
  --bs-modal-border-radius: var(--vr-radius-dialog);
  --bs-modal-inner-border-radius: var(--vr-radius-dialog);
  --bs-modal-header-border-width: 0;
  --bs-modal-footer-border-width: 0;
  --bs-modal-box-shadow: var(--vr-shadow-dialog);
}

.modal-content {
  box-shadow: var(--vr-shadow-dialog);
}

.modal-title {
  color: var(--vr-text-strong);
  font-size: var(--vr-font-size-8);
  font-weight: var(--vr-font-weight-black);
  letter-spacing: var(--vr-tracking-title);
}

.modal-backdrop {
  --bs-backdrop-bg: var(--vr-backdrop);
  --bs-backdrop-opacity: 1;
}

/* A confirmation (includes/confirm_dialog.html) may open over the form dialog, e.g. Discard
   changes: it and its own scrim sit above the dialog. Bootstrap does not stack modals itself. */
.vr-confirm-dialog {
  z-index: var(--vr-z-confirm);
}

.modal-backdrop ~ .modal-backdrop {
  z-index: var(--vr-z-confirm-backdrop);
}

.vr-confirm-dialog .modal-dialog {
  max-width: 28rem;
}

.vr-confirm-dialog .modal-header,
.vr-confirm-dialog .modal-body,
.vr-confirm-dialog .modal-footer {
  padding-inline: var(--vr-space-6);
}

.vr-confirm-dialog .modal-title {
  font-size: var(--vr-font-size-7);
}

.offcanvas {
  --bs-offcanvas-bg: var(--vr-topbar-bg);
  --bs-offcanvas-color: var(--vr-topbar-text);
  --bs-offcanvas-border-width: 0;
}

/* Panels: a filled surface with the panel shadow, no outline and no heading band. */
.card {
  --bs-card-bg: var(--vr-surface);
  --bs-card-border-width: 0;
  --bs-card-border-radius: var(--vr-radius-xl);
  --bs-card-inner-border-radius: var(--vr-radius-xl);
  --bs-card-cap-bg: transparent;
  --bs-card-cap-padding-y: var(--vr-space-3);
  --bs-card-cap-padding-x: var(--vr-space-5);
  --bs-card-spacer-y: var(--vr-space-4);
  --bs-card-spacer-x: var(--vr-space-5);
  box-shadow: var(--vr-shadow-panel);
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vr-space-2) var(--vr-space-3);
  min-height: 3.25rem;
  padding-bottom: var(--vr-space-1);
  border-bottom: 0;
}

.card-title {
  margin: 0;
  color: var(--vr-text-strong);
  font-size: var(--vr-font-size-5);
  font-weight: var(--vr-font-weight-bold);
}

/* The count beside a panel title is a pill. */
.card-header .vr-count {
  display: inline-flex;
  align-items: center;
  min-height: var(--vr-space-5);
  padding: 0 var(--vr-space-2);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-surface-2);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
}

.card-footer {
  background: transparent;
  border-top: 0;
}

/* Panel spacing, defined once (includes/panel.html, panel_section.html): every panel body insets
   its content by --vr-panel-inset, and stacked blocks inside it are separated by one gap,
   --vr-stack. A table is flush only as a table panel's own body; selection bars, notes and
   disclosure summaries keep the inset. */
.vr-panel-body {
  padding: var(--vr-space-3) var(--vr-panel-inset) var(--vr-panel-inset);
}

.card .vr-panel-body > * {
  margin-top: 0;
  margin-bottom: 0;
}

.card .vr-panel-body > * + * {
  margin-top: var(--vr-stack);
}

/* A form inside a panel: its sections lie on the panel (no surface, padding or extra space of
   their own), so fields share the panel's inset. */
.vr-panel-body .vr-form-section {
  padding: 0;
  margin-bottom: 0;
  background: none;
}

.vr-panel-body .vr-form-section + .vr-form-section {
  margin-top: var(--vr-space-6);
}

/* A table inside a mixed panel body (also a section of a table card) sits on the body's inset, with
   no extra table inset of its own. */
.vr-panel-body > .vr-table-wrap {
  padding: 0;
}

/* Notices: the tone's tinted fill, rounded like a panel, no edge; the status (unfilled) first. */
.alert {
  --bs-alert-padding-y: var(--vr-space-3-5);
  --bs-alert-padding-x: var(--vr-space-5);
  --bs-alert-border-radius: var(--vr-radius-xl);
  --bs-alert-border-color: transparent;
  border: 0;
  color: var(--vr-text);
}

/* Glyph label + body (includes/messages.html, form_errors.html, status alerts) sit side by side.
   Plain-text alerts stay in normal flow so inline text, links and emphasis wrap as one paragraph. */
/* One notice grid: the status in its own column, top-aligned so its label shares the first line
   of the content; the content in the second column; a close button, when present, last. */
.alert:has(> .vr-status) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: var(--vr-space-4);
  align-items: start;
}

.alert-dismissible:has(> .vr-status) {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

/* The pill box is centred on the first line of the content (a 1.5 line box). */
.alert > .vr-status {
  margin-top: calc((var(--vr-line-height-base) * var(--vr-font-size-3) - var(--vr-line-height-label-sm) - 2 * var(--vr-badge-py)) / 2);
}

.alert > :last-child {
  margin-bottom: 0;
}

.alert dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--vr-space-1) var(--vr-space-3);
  margin: 0;
}

/* {% fact %} rows wrap each pair in a <div>; inside a notice the pairs share its two columns. */
.alert dl > div {
  display: contents;
}

.alert dt {
  font-weight: var(--vr-font-weight-bold);
}

.alert dd {
  margin: 0;
}

.alert-info {
  --bs-alert-bg: var(--vr-info-bg);
  --bs-alert-link-color: var(--vr-pen);
}

.alert-warning {
  --bs-alert-bg: var(--vr-warning-bg);
  --bs-alert-link-color: var(--vr-pen);
}

.alert-success {
  --bs-alert-bg: var(--vr-success-bg);
  --bs-alert-link-color: var(--vr-pen);
}

.alert-danger {
  --bs-alert-bg: var(--vr-danger-bg);
  --bs-alert-link-color: var(--vr-pen);
}

.alert-secondary {
  --bs-alert-bg: var(--vr-neutral-bg);
  --bs-alert-link-color: var(--vr-pen);
}

/* Tones Bootstrap has no variant for (includes/notice.html maps every status tone to one). */
.alert-progress {
  --bs-alert-bg: var(--vr-progress-bg);
  --bs-alert-link-color: var(--vr-pen);
}

.alert-hold {
  --bs-alert-bg: var(--vr-hold-bg);
  --bs-alert-link-color: var(--vr-pen);
}

.alert .btn-close {
  border-radius: var(--vr-radius-lg);
}

/* Laboratory announcements (includes/announcements.html): notices on the sign-in page, the staff
   dashboard and the client portal home page. The label and title share the first line and the
   message takes the notice's full width below, so a long message still reads in the narrow
   sign-in panel. The message is plain text; only a word longer than the line is broken. */
.vr-announcements {
  margin-bottom: var(--vr-space-4);
}

.vr-announcements > .alert {
  margin-bottom: var(--vr-space-2);
  overflow-wrap: break-word;
}

.vr-announcement-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-1) var(--vr-space-2-5);
  align-items: baseline;
  margin-bottom: var(--vr-space-1-5);
}

.vr-announcement-title {
  min-width: 0;
  margin: 0;
  font-size: var(--vr-font-size-5);
  font-weight: var(--vr-font-weight-bold);
  line-height: var(--vr-line-height-snug);
  color: inherit;
}

.vr-announcement-body {
  margin: 0;
}

/* Sign-in page: the announcements box under the sheet, beside it from 1280px (see Entrance
   pages). Denser text; a single notice fills the box. */
.vr-announcements-aside {
  width: 100%;
  max-width: 28rem;
  margin: var(--vr-space-4) 0 0;
}

.vr-announcements-aside .vr-announcement-title,
.vr-announcements-aside .vr-announcement-body {
  font-size: var(--vr-font-size-3);
  line-height: var(--vr-line-height-base);
}

.vr-announcements-aside > .alert {
  padding: var(--vr-space-3) var(--vr-space-4);
  box-shadow: var(--vr-shadow-panel);
}

/* Inside a notice the status drops its pill fill: the notice is already the tone. */
.alert > .vr-status,
.vr-announcement-head > .vr-status {
  flex: none;
  padding-inline: 0;
  background: transparent;
}

.breadcrumb {
  --bs-breadcrumb-margin-bottom: var(--vr-space-1);
  --bs-breadcrumb-font-size: var(--vr-font-size-2);
  --bs-breadcrumb-divider: "/";
  --bs-breadcrumb-divider-color: var(--vr-text-muted);
  --bs-breadcrumb-item-active-color: var(--vr-text-muted);
  --bs-breadcrumb-item-padding-x: var(--vr-space-2);
}

.breadcrumb-item a {
  font-weight: var(--vr-font-weight-semibold);
  text-decoration: none;
}

.table {
  --bs-table-color: var(--vr-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: transparent;
  --bs-table-hover-color: var(--vr-text);
  --bs-table-hover-bg: transparent;
  --bs-table-striped-bg: var(--vr-row-stripe);
}

/* Toned rows: an error (invalid result/QC entry, import row) and a set-aside row (an excluded
   observation), in the theme's tones so text keeps its contrast in both modes. */
.vr-table > tbody > tr.table-danger {
  --vr-row-fill: var(--vr-danger-bg);
}

.vr-table > tbody > tr.table-secondary {
  --vr-row-fill: var(--vr-neutral-bg);
}

.table-danger,
.table-secondary {
  --bs-table-color: var(--vr-text);
  --bs-table-bg: transparent;
  --bs-table-border-color: transparent;
  --bs-table-striped-color: var(--vr-text);
  --bs-table-active-color: var(--vr-text);
  --bs-table-hover-color: var(--vr-text);
}

/* ================================================================ Application shell */

/* The shell is one pale sage L: the top bar and the sidebar share --vr-topbar-bg, with no line
   between them and the content. The content is a lighter sheet (--vr-paper) whose top-left corner
   is rounded where it meets the shell. */
.vr-app:not(.vr-entrance-page) {
  background-color: var(--vr-topbar-bg);
}

.vr-skip:focus {
  position: fixed !important;
  top: var(--vr-space-2);
  left: var(--vr-space-2);
  z-index: var(--vr-z-skip);
  padding: var(--vr-space-2) var(--vr-space-3);
  background: var(--vr-raised);
  border-radius: var(--vr-radius-lg);
  box-shadow: var(--vr-shadow-raised);
}

.vr-topbar {
  position: sticky;
  top: 0;
  z-index: var(--vr-z-topbar);
  min-height: var(--vr-topbar-height);
  padding: 0 var(--vr-space-4) 0 var(--vr-space-5);
  display: flex;
  align-items: center;
  gap: var(--vr-space-4);
  background: var(--vr-topbar-bg);
  color: var(--vr-topbar-text);
}

.vr-topbar :focus-visible,
.vr-sidenav :focus-visible {
  outline-color: var(--vr-topbar-accent);
}

/* Menus open from the bar onto the page: they take the page's focus colour back. */
.vr-topbar .dropdown-menu :focus-visible {
  outline-color: var(--vr-focus);
}

/* Product lock-up (includes/brand.html): the mark, "OpenBGA" over "Environmental LIMS". */
.vr-brand,
.vr-brand:hover {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--vr-space-2-5);
  color: var(--vr-topbar-text);
  text-decoration: none;
  white-space: nowrap;
}

.vr-brand img {
  width: 1.875rem;
  height: 1.875rem;
  border-radius: var(--vr-radius);
}

.vr-wordmark {
  display: grid;
  line-height: var(--vr-line-height-tight);
}

.vr-wordmark-name {
  font-size: var(--vr-font-size-5);
  font-weight: var(--vr-font-weight-bold);
}

.vr-wordmark-parent {
  color: var(--vr-topbar-text-muted);
  font-size: var(--vr-font-size-1);
}

/* Laboratory logo preview (core/lab_profile.html): bounded, on the white of the report page it
   prints on, so a logo drawn for paper stays legible in dark mode. */
.vr-lab-logo {
  display: block;
  width: auto;
  height: auto;
  max-width: min(100%, 18rem);
  max-height: 8rem;
  object-fit: contain;
  padding: var(--vr-space-2);
  background-color: var(--vr-document-paper);
  border-radius: var(--vr-radius-lg);
}

/* Phones: the bar keeps its controls whole, so it shows the mark alone rather than a cut-off name.
   The name stays in the link for assistive technology and the navigation drawer shows it in full. */
@media (max-width: 575.98px) {
  .vr-topbar .vr-wordmark {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* Wider screens: the brand keeps its size; the lab name, then the sample lookup give way first. */
@media (min-width: 576px) {
  .vr-topbar > .vr-brand {
    flex-shrink: 0;
  }
}

/* Small tablets: the two-line name leaves less room, so the lookup may narrow further. */
@media (min-width: 576px) and (max-width: 639.98px) {
  .vr-topbar .vr-lookup {
    min-width: 5rem;
  }
}

/* The laboratory's name: a tonal pill beside the brand. */
.vr-lab-name {
  min-width: 0;
  flex: 0 100 auto;
  padding: var(--vr-space-1) var(--vr-space-3);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-shell-chip);
  color: var(--vr-topbar-text);
  font-size: var(--vr-font-size-2);
  font-weight: var(--vr-font-weight-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vr-topbar-end {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: auto;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--vr-space-1);
}

/* Quiet icon and text buttons: Help, Theme and Account in the top bar, the theme menu on entrance
   pages. */
.vr-topbar-btn {
  --bs-btn-color: var(--vr-text);
  --bs-btn-bg: transparent;
  --bs-btn-hover-color: var(--vr-text);
  --bs-btn-hover-bg: var(--vr-surface-hover);
  --bs-btn-active-color: var(--vr-text);
  --bs-btn-active-bg: var(--vr-surface-hover);
  --bs-btn-padding-x: var(--vr-space-3);
  --bs-btn-font-weight: var(--vr-font-weight-medium);
  --bs-btn-font-size: var(--vr-font-size-2);
}

.vr-topbar .vr-topbar-btn {
  --bs-btn-color: var(--vr-topbar-text);
  --bs-btn-hover-color: var(--vr-topbar-text);
  --bs-btn-hover-bg: var(--vr-shell-hover);
  --bs-btn-active-color: var(--vr-topbar-text);
  --bs-btn-active-bg: var(--vr-shell-hover);
  min-height: var(--vr-control-height);
}

.vr-topbar .vr-topbar-btn .vr-icon {
  color: var(--vr-topbar-text-muted);
}

/* What's new (includes/whats_new_button.html): the unread count, in the current-item fill of the
   shell so it reads as "for you" in both themes. The link's accessible name carries the count. */
.vr-whats-new {
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-1-5);
}

.vr-whats-new:hover {
  text-decoration: none;
}

.vr-topbar-count {
  min-width: var(--vr-space-5);
  padding: 0 var(--vr-space-1-5);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-shell-current);
  color: var(--vr-on-shell-current);
  font-family: var(--vr-font-data);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
  line-height: var(--vr-line-height-base);
  text-align: center;
}

/* Sample lookup: a field-A box on the shell's field surface. */
.vr-lookup {
  position: relative;
  flex: 0 1 17rem;
  min-width: 7.5rem;
  margin-right: var(--vr-space-2);
}

.vr-lookup .vr-icon {
  position: absolute;
  left: var(--vr-space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--vr-topbar-field-muted);
  pointer-events: none;
}

.vr-lookup .form-control {
  padding-left: var(--vr-space-8);
  background-color: var(--vr-topbar-field);
  border-color: var(--vr-topbar-field-border);
  color: var(--vr-topbar-field-text);
}

.vr-lookup .form-control::placeholder {
  color: var(--vr-topbar-field-muted);
}

.vr-lookup .form-control:focus {
  background-color: var(--vr-topbar-field);
  border-color: var(--vr-topbar-accent);
  color: var(--vr-topbar-field-text);
}

.vr-user-roles {
  display: block;
  font-size: var(--vr-font-size-1);
  color: var(--vr-text-muted);
}

/* Theme menu: the pressed option carries a check; text names the mode. */
.vr-theme-option .vr-theme-check {
  margin-left: auto;
  visibility: hidden;
}

.vr-theme-option[aria-pressed="true"] .vr-theme-check {
  visibility: visible;
}

.vr-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  background: var(--vr-topbar-bg);
}

/* Offcanvas below lg, a sticky sidebar from lg up (Bootstrap .offcanvas-lg). */
.vr-sidenav {
  --bs-offcanvas-width: 17rem;
}

@media (min-width: 992px) {
  .vr-shell {
    grid-template-columns: var(--vr-sidenav-width) minmax(0, 1fr);
    min-height: calc(100vh - var(--vr-topbar-height));
  }

  .vr-portal .vr-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The sidebar keeps a gutter, so its scrollbar sits inside the shell and never touches the
     content sheet. */
  .vr-sidenav {
    position: sticky;
    top: var(--vr-topbar-height);
    height: calc(100vh - var(--vr-topbar-height));
    margin-right: var(--vr-shell-gutter);
    overflow-y: auto;
    scrollbar-gutter: stable;
    background: var(--vr-topbar-bg);
  }

  .vr-main {
    border-top-left-radius: var(--vr-radius-main);
  }

  .vr-portal .vr-main {
    border-top-left-radius: 0;
  }
}

/* The sidebar's scrollbar is quiet at rest and fades in while the sidebar is hovered or holds
   focus. */
.vr-sidenav {
  --vr-thumb: transparent;
  transition: --vr-thumb 180ms ease-out;
}

.vr-sidenav:hover,
.vr-sidenav:focus-within {
  --vr-thumb: var(--vr-scrollbar-hover);
}

.vr-sidenav::-webkit-scrollbar-thumb,
.vr-sidenav:hover::-webkit-scrollbar-thumb {
  background-color: var(--vr-thumb);
}

@supports not selector(::-webkit-scrollbar) {
  .vr-sidenav,
  .vr-sidenav:hover {
    scrollbar-color: var(--vr-thumb) transparent;
  }
}

@media (prefers-reduced-motion: reduce) {
  .vr-sidenav {
    transition: none;
  }
}

.vr-sidenav .offcanvas-body {
  display: block;
  padding: var(--vr-space-2) var(--vr-space-1) var(--vr-space-8) var(--vr-space-3);
}

.vr-nav-list + .vr-nav-section,
.vr-nav-section + .vr-nav-section {
  margin-top: var(--vr-space-4);
}

/* Group labels: small bold capitals, each opened by a stub in its area's line colour. */
.vr-nav-heading {
  display: flex;
  align-items: center;
  gap: var(--vr-space-2);
  margin: 0 0 var(--vr-space-1);
  padding: 0 var(--vr-space-3);
  color: var(--vr-topbar-text-muted);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
  letter-spacing: var(--vr-tracking-label);
  text-transform: uppercase;
}

.vr-nav-heading::before {
  content: "";
  flex: none;
  width: 1.125rem;
  height: var(--vr-line-width);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-line, var(--vr-line-setup));
}

#vr-nav-sales {
  --vr-line: var(--vr-line-sales);
}

#vr-nav-intake {
  --vr-line: var(--vr-line-intake);
}

#vr-nav-bench {
  --vr-line: var(--vr-line-bench);
}

#vr-nav-release {
  --vr-line: var(--vr-line-release);
}

#vr-nav-lab {
  --vr-line: var(--vr-line-lab);
}

#vr-nav-setup {
  --vr-line: var(--vr-line-setup);
}

.vr-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--vr-space-0-5);
  margin: 0;
  padding: 0;
}

.vr-navlink {
  display: flex;
  align-items: center;
  gap: var(--vr-space-2-5);
  min-height: var(--vr-nav-item-height);
  line-height: var(--vr-line-height-label);
  padding: 0 var(--vr-space-3);
  border-radius: var(--vr-radius-lg);
  color: var(--vr-topbar-text);
  font-size: var(--vr-font-size-2);
  text-decoration: none;
}

.vr-navlink > .vr-icon {
  color: var(--vr-topbar-text-muted);
  font-size: var(--vr-font-size-5);
}

a.vr-navlink:hover {
  background: var(--vr-shell-hover);
  color: var(--vr-topbar-text);
  text-decoration: none;
}

/* Where you are: the forest fill, bold text; aria-current carries the state. */
.vr-navlink[aria-current="page"],
a.vr-navlink[aria-current="page"]:hover {
  background: var(--vr-shell-current);
  color: var(--vr-on-shell-current);
  font-weight: var(--vr-font-weight-bold);
  box-shadow: var(--vr-shadow-current);
}

.vr-navlink[aria-current="page"] > .vr-icon {
  color: var(--vr-on-shell-current);
}

.vr-navlink.is-unavailable {
  color: var(--vr-topbar-text-muted);
}

.vr-navlink-note {
  margin-left: auto;
  font-size: var(--vr-font-size-1);
  color: var(--vr-topbar-text-muted);
  font-weight: var(--vr-font-weight-regular);
}

.vr-navlink-count {
  margin-left: auto;
  min-width: 1.75rem;
  padding: 0 var(--vr-space-1-5);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-count);
  color: var(--vr-on-count);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
  text-align: center;
}

/* Client portal: top navigation instead of the staff sidebar. */
.vr-topbar-portal {
  flex-wrap: wrap;
}

.vr-topbar-portal .vr-brand {
  flex: 1 1 0;
  min-width: 0;
}

.vr-topbar-portal .vr-brand span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.vr-topbar-portal .vr-topbar-end {
  flex: none;
}

@media (min-width: 768px) {
  .vr-topbar-portal .vr-brand {
    flex: 0 1 auto;
  }
}

.vr-portal-nav {
  order: 3;
  flex-basis: 100%;
}

/* Keep every portal destination visible on phones. */
@media (max-width: 767.98px) {
  .vr-portal-nav {
    min-width: 0; /* let the flex item shrink so its tab row scrolls instead of being clipped */
  }

  .vr-portal-nav .nav {
    flex-wrap: wrap;
  }

  .vr-portal-nav .nav-link {
    white-space: nowrap;
  }
}

@media (min-width: 768px) {
  .vr-portal-nav {
    order: 0;
    flex-basis: auto;
    margin-left: var(--vr-space-2);
  }
}

.vr-portal-nav .nav {
  gap: var(--vr-space-1);
}

.vr-portal-nav .nav-link {
  padding: var(--vr-space-2) var(--vr-space-3);
  border-radius: var(--vr-radius-lg);
  color: var(--vr-topbar-text);
  font-size: var(--vr-font-size-2);
}

.vr-portal-nav .nav-link:hover {
  background: var(--vr-shell-hover);
  color: var(--vr-topbar-text);
}

.vr-portal-nav .nav-link[aria-current="page"] {
  background: var(--vr-shell-current);
  color: var(--vr-on-shell-current);
  font-weight: var(--vr-font-weight-bold);
}

.vr-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: var(--vr-space-6) var(--vr-space-6) var(--vr-space-12);
  background: var(--vr-paper);
}

/* Containers that receive focus from script (skip target, dialogs, phone menu) need no ring: the
   focus ring belongs to the controls inside them. */
.vr-main:focus,
.modal:focus,
.offcanvas:focus,
.offcanvas-lg:focus {
  outline: none;
}

/* ================================================================ Shell: collapsible sidebar

   static/js/sidebar.js: from 992px the staff menu folds into an icon rail (.vr-nav-collapsed on
   .vr-shell, the user's "nav.collapsed" preference). Labels stay in the markup for assistive
   technology and show as Bootstrap tooltips; group headings become thin dividers. */

.vr-nav-toggle {
  display: none;
}

@media (min-width: 992px) {
  .vr-shell {
    transition: grid-template-columns var(--vr-motion-fast) ease-out;
  }

  .vr-nav-toggle {
    display: flex;
    align-items: center;
    gap: var(--vr-space-2-5);
    width: 100%;
    min-height: var(--vr-nav-item-height);
    margin-bottom: var(--vr-space-2);
    padding: 0 var(--vr-space-3);
    background: transparent;
    color: var(--vr-topbar-text-muted);
    border: 0;
    border-radius: var(--vr-radius-lg);
    font-size: var(--vr-font-size-2);
    text-align: left;
  }

  .vr-nav-toggle:hover {
    background: var(--vr-shell-hover);
    color: var(--vr-topbar-text);
  }

  .vr-nav-toggle > .vr-icon {
    flex: none;
    font-size: var(--vr-font-size-5);
    transition: transform var(--vr-motion-fast) ease-out;
  }

  .vr-shell.vr-nav-collapsed {
    grid-template-columns: var(--vr-sidenav-rail-width) minmax(0, 1fr);
  }

  .vr-nav-collapsed .vr-sidenav .offcanvas-body {
    padding-right: 0;
    padding-left: var(--vr-space-2);
  }

  .vr-nav-collapsed .vr-nav-toggle > .vr-icon {
    transform: rotate(180deg);
  }

  /* Icons only: the label and count leave the layout but stay in the accessibility tree. */
  .vr-nav-collapsed .vr-nav-toggle,
  .vr-nav-collapsed .vr-navlink {
    justify-content: center;
    padding: 0;
  }

  .vr-nav-collapsed .vr-nav-toggle-label,
  .vr-nav-collapsed .vr-navlink > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* Group headings become a short rule in their area's line colour. */
  .vr-nav-collapsed .vr-nav-heading {
    justify-content: center;
    gap: 0;
    margin: var(--vr-space-1) 0;
    padding: 0;
    font-size: 0;
  }

  .vr-nav-collapsed .vr-nav-list + .vr-nav-section,
  .vr-nav-collapsed .vr-nav-section + .vr-nav-section {
    margin-top: var(--vr-space-2);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vr-shell,
  .vr-nav-toggle > .vr-icon {
    transition: none;
  }
}

/* The rail's label tooltips: the shell's current-item colours. */
.vr-nav-tooltip {
  --bs-tooltip-bg: var(--vr-shell-current);
  --bs-tooltip-color: var(--vr-on-shell-current);
  --bs-tooltip-font-size: var(--vr-font-size-2);
}

/* ================================================================ Page header */

.vr-page-header {
  margin-bottom: var(--vr-space-5);
}

.vr-page-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--vr-space-3) var(--vr-space-6);
}

/* The title block takes the free space and wraps its own key facts, so the actions stay right of
   the title, aligned to its foot, from 992px (standard 4). */
.vr-page-header-row > :first-child {
  flex: 1 1 16rem;
  min-width: 0;
}

.vr-page-title {
  margin: 0;
  color: var(--vr-text-strong);
  font-size: var(--vr-font-size-9);
  font-weight: var(--vr-font-weight-black);
  letter-spacing: var(--vr-tracking-title);
  line-height: var(--vr-line-height-tight);
}

/* Key facts: a row of muted text; on a record the status pill comes first. */
.vr-page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vr-space-1-5) var(--vr-space-4);
  margin: var(--vr-space-2) 0 0;
  padding: 0;
  list-style: none;
  color: var(--vr-text-muted);
}

.vr-page-meta strong {
  color: var(--vr-text);
  font-weight: var(--vr-font-weight-semibold);
}

.vr-page-intro {
  max-width: 72ch;
  margin: var(--vr-space-2) 0 0;
  color: var(--vr-text-muted);
}

.vr-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vr-space-2);
}

@media (min-width: 992px) {
  .vr-page-actions {
    max-width: 66%;
    justify-content: flex-end;
  }
}

/* Dateline: today's date and ISO week in the laboratory's time zone, under an overview's title
   (includes/dateline.html). */
.vr-dateline {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-1) var(--vr-space-4);
  margin: var(--vr-space-2) 0 0;
  color: var(--vr-text-muted);
}

/* Small option forms inside a page-action dropdown (e.g. label download). */
.vr-labels-menu {
  width: min(18rem, calc(100vw - 2rem));
  padding: var(--vr-space-3-5);
}

.vr-labels-menu fieldset,
.vr-labels-menu .vr-field {
  margin-bottom: var(--vr-space-3);
}

.vr-labels-menu legend {
  font-size: inherit;
  font-weight: var(--vr-font-weight-bold);
}

.vr-section-title {
  font-size: var(--vr-font-size-6);
  margin: 0 0 var(--vr-space-3);
}

/* Section tabs (includes/section_tabs.html): rounded quiet links; the current tab takes the forest
   fill, like the current sidebar item. */
.vr-section-tabs {
  margin-bottom: var(--vr-space-5);
}

.nav-tabs {
  --bs-nav-tabs-border-width: 0;
  --bs-nav-tabs-border-radius: var(--vr-radius-lg);
  gap: var(--vr-space-1);
  border-bottom: 0;
}

.nav-tabs .nav-link {
  min-height: var(--vr-control-height-sm);
  display: inline-flex;
  align-items: center;
  padding: 0 var(--vr-space-3);
  border: 0;
  border-radius: var(--vr-radius-lg);
  background: transparent;
  color: var(--vr-text);
  font-size: var(--vr-font-size-2);
  font-weight: var(--vr-font-weight-medium);
}

.nav-tabs .nav-link:hover {
  background: var(--vr-surface-hover);
  color: var(--vr-text);
}

.nav-tabs .nav-link.active,
.nav-tabs .nav-link[aria-current="page"] {
  background: var(--vr-ink);
  color: var(--vr-on-ink);
  font-weight: var(--vr-font-weight-bold);
}

/* "On this page" anchors (includes/page_toc.html). */
.vr-page-toc {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--vr-space-1) var(--vr-space-4);
  margin-bottom: var(--vr-space-4);
  font-size: var(--vr-font-size-2);
}

.vr-page-toc-title {
  margin: 0;
  color: var(--vr-text-muted);
  font-weight: var(--vr-font-weight-bold);
}

.vr-page-toc ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-1) var(--vr-space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ================================================================ Status stamps */

/* Every status is a tinted pill: the tone's fill, its text and a Bootstrap Icons glyph
   (includes/status.html), no edge. Colour is never the only cue. */
.vr-status {
  --vr-tone-text: var(--vr-neutral-text);
  --vr-tone-bg: var(--vr-neutral-bg);
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-1-5);
  padding: var(--vr-badge-py) var(--vr-badge-px);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-tone-bg);
  color: var(--vr-tone-text);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
  line-height: var(--vr-line-height-label-sm);
  white-space: nowrap;
}

.vr-status .vr-status-glyph {
  font-size: 0.875em;
}

/* The record's own status, first in the page header's key facts (standard 4): a larger pill. */
.vr-page-meta > li:first-child > .vr-status {
  padding: var(--vr-badge-py-lg) var(--vr-badge-px-lg);
  font-size: var(--vr-font-size-2);
}

/* Helper notes under a cell value (e.g. the preparation identity under a test name) wrap, so a
   narrow card does not push the last columns out of view. */
.vr-table td .vr-form-note {
  white-space: normal;
}

/* A table cell may carry a long status sentence (a blocker reason): the pill wraps, with a
   smaller radius, instead of widening the table past its card. */
.vr-table td .vr-status {
  max-width: 24rem;
  align-items: flex-start;
  border-radius: var(--vr-radius-lg);
  white-space: normal;
}

.vr-table td .vr-status > .vr-status-glyph {
  flex: none;
}

/* In a list, pills never wrap inside themselves: the column gives them room. */
.vr-table[data-vr-grid] td .vr-status {
  max-width: none;
  align-items: center;
  border-radius: var(--vr-radius-pill);
}

.vr-table td .vr-status > .vr-status-glyph {
  margin-top: var(--vr-space-0-5);
}

.vr-status[data-tone="info"] {
  --vr-tone-text: var(--vr-info-text);
  --vr-tone-bg: var(--vr-info-bg);
}

.vr-status[data-tone="progress"] {
  --vr-tone-text: var(--vr-progress-text);
  --vr-tone-bg: var(--vr-progress-bg);
}

.vr-status[data-tone="success"] {
  --vr-tone-text: var(--vr-success-text);
  --vr-tone-bg: var(--vr-success-bg);
}

.vr-status[data-tone="warning"] {
  --vr-tone-text: var(--vr-warning-text);
  --vr-tone-bg: var(--vr-warning-bg);
}

.vr-status[data-tone="danger"] {
  --vr-tone-text: var(--vr-danger-text);
  --vr-tone-bg: var(--vr-danger-bg);
}

.vr-status[data-tone="hold"] {
  --vr-tone-text: var(--vr-hold-text);
  --vr-tone-bg: var(--vr-hold-bg);
}

/* Matrix tag: what the sample is (water, wastewater, soil) and its source, one component wherever a
   matrix appears. A small tile in the matrix colour carries the Bootstrap icon; the name and
   source stay plain text. It is squarer than a status pill and never carries a tone. */
[data-matrix="water"] {
  --vr-matrix: var(--vr-matrix-water);
}

[data-matrix="wastewater"] {
  --vr-matrix: var(--vr-matrix-wastewater);
}

[data-matrix="soil"] {
  --vr-matrix: var(--vr-matrix-soil);
}

.vr-matrix-tag {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vr-space-1) var(--vr-space-1-5);
  max-width: 100%;
  line-height: var(--vr-line-height-label);
  vertical-align: middle;
}

.vr-matrix-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--vr-matrix-tile);
  height: var(--vr-matrix-tile);
  border-radius: var(--vr-radius-tag);
  background: var(--vr-matrix, var(--vr-text-muted));
  color: var(--vr-on-matrix);
  font-size: var(--vr-font-size-1);
  line-height: 0;
}

.vr-matrix-name {
  color: var(--vr-text-strong);
  font-weight: var(--vr-font-weight-bold);
}

.vr-matrix-sep,
.vr-matrix-source {
  color: var(--vr-text-muted);
  font-weight: var(--vr-font-weight-regular);
}


.vr-matrix-tag.is-sm {
  gap: var(--vr-space-1);
  font-size: var(--vr-font-size-1);
}

.vr-matrix-tag.is-sm .vr-matrix-icon {
  width: var(--vr-matrix-tile-sm);
  height: var(--vr-matrix-tile-sm);
}

.vr-matrix-tag.is-lg {
  font-size: var(--vr-font-size-2);
}

.vr-matrix-tag.is-lg .vr-matrix-icon {
  width: var(--vr-matrix-tile-lg);
  height: var(--vr-matrix-tile-lg);
}

/* In a table row the tag keeps one line and the source ends in an ellipsis (the full text is in
   the tag's title); elsewhere (facts, key facts) it wraps and shows the whole value. */
/* In a table row: the tile and name keep one line; the source is a muted sub-line aligned under
   the name. The tag drops the repeated matrix word from the source ("influent" under
   "Wastewater"), so sources stay distinguishable on one line; the full value is the tag's title. */
.vr-table .vr-matrix-tag {
  min-width: calc(var(--vr-matrix-tile) + var(--vr-space-1-5) + var(--vr-cell-sub-width)); /* room for a short source such as "Surface water" */
  display: inline-grid;
  grid-template-columns: auto minmax(max-content, 1fr);
  align-items: center;
  column-gap: var(--vr-space-1-5);
  row-gap: 0;
  white-space: nowrap;
}

.vr-table .vr-matrix-tag.is-sm {
  column-gap: var(--vr-space-1);
}

.vr-table .vr-matrix-sep {
  display: none;
}

.vr-table .vr-matrix-source {
  grid-column: 2;
  width: 0; /* takes the column's width instead of setting it */
  min-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis; /* rarely needed: the source drops the repeated matrix word */
  font-size: var(--vr-font-size-1);
}

/* ================================================================ Data tables */

/* Tables are separated by fills, not rules: a rounded header row, a faint zebra, a hover fill and
   rounded row ends. Every cell paints its row's fill (opaque, so the sticky identifier column
   covers what scrolls under it) and bleeds it 1px right, so fractional column widths never show
   a hairline gap. */
.vr-table-card {
  overflow: hidden;
}

/* A table card's own body (the one holding the table, toolbar or empty state) is flush: the table
   carries its own inset and the other blocks get the panel inset one by one below. Sections in the
   same card (panel_section) keep the normal panel body. */
.vr-table-card > .vr-table-body,
.vr-table-card > .card-body:not(.vr-panel-body):has(> .vr-table-wrap, > table, > .dt-container, > .vr-grid-toolbar, > .vr-empty) {
  padding: 0;
}

/* Text blocks placed directly in a flush table card keep the panel inset. */
.vr-table-card > :is(p, h3, h4, .vr-form-note) {
  margin: 0;
  padding: var(--vr-space-2) var(--vr-panel-inset);
}

.vr-table-wrap {
  overflow-x: auto;
  padding: 0 var(--vr-space-3) var(--vr-space-3);
  scroll-padding-inline-start: 8rem; /* Clear the sticky row identifier on keyboard focus. */
}

.vr-table {
  margin: 0;
  font-size: var(--vr-font-size-2);
  border-collapse: separate;
  border-spacing: 0;
}

.vr-table > :not(caption) > * > * {
  padding: var(--vr-cell-py) var(--vr-cell-px);
  border: 0;
  box-shadow: none;
}

.vr-table > thead > tr > th {
  padding-top: var(--vr-space-2);
  padding-bottom: var(--vr-space-2);
  background: var(--vr-th-bg);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
  letter-spacing: var(--vr-tracking-label);
  text-transform: uppercase;
  vertical-align: middle;
  overflow-wrap: normal; /* heads wrap between words only (a card breaks words) */
}

.vr-table > * > tr > :first-child {
  border-top-left-radius: var(--vr-radius-lg);
  border-bottom-left-radius: var(--vr-radius-lg);
}

.vr-table > * > tr > :last-child {
  border-top-right-radius: var(--vr-radius-lg);
  border-bottom-right-radius: var(--vr-radius-lg);
}

.vr-table > tbody > tr {
  --vr-row-fill: var(--vr-surface);
}

.vr-table > tbody > tr:nth-child(even) {
  --vr-row-fill: var(--vr-row-stripe);
}

.vr-table > tbody > tr:hover {
  --vr-row-fill: var(--vr-row-hover);
}

/* Selected rows: the selection fill, also while hovered and in DataTables-enhanced lists. */
.vr-table > tbody > tr:has(> * > input[type="checkbox"]:checked),
.vr-table > tbody > tr:has(> * > .form-check > input[type="checkbox"]:checked) {
  --vr-row-fill: var(--vr-selection);
}

.vr-table > tbody > tr > * {
  --bs-table-bg: var(--vr-row-fill);
  --bs-table-bg-state: var(--vr-row-fill);
  background-color: var(--vr-row-fill);
  box-shadow: var(--vr-border-width) 0 0 var(--vr-row-fill);
  vertical-align: top;
  white-space: nowrap;
}

/* One sizing rule for every list (the tables grid.js presents, table[data-vr-grid]), so a list
   fits its card without scrolling sideways: column heads and names wrap; identifiers, dates and
   times, figures, statuses and the row link stay on one line. Other tables (record sub-tables,
   entry grids, previews) keep one line per cell, but their column heads wrap too; a record table
   fits through column priority, and only entry grids and wide data tables scroll. */
.vr-table[data-vr-grid] > tbody > tr > * {
  white-space: normal;
}

.vr-table[data-vr-grid] :is(.vr-id, .vr-row-link, .vr-nowrap, .vr-status),
.vr-table[data-vr-grid] > tbody > tr > .text-end {
  white-space: nowrap;
}

.vr-table[data-vr-grid] > tbody > tr > td {
  min-width: 4.5rem;
}

/* List rows are at most two lines and dense (about eleven rows on a 900px screen): snug leading,
   a smaller vertical cell padding; a date and its time may stack. */
.vr-table[data-vr-grid] > tbody > tr > * {
  padding: var(--vr-cell-py-list) var(--vr-cell-px-list);
  line-height: var(--vr-line-height-snug);
}

.vr-table[data-vr-grid] > thead > tr > th {
  padding-right: var(--vr-cell-px-list);
  padding-left: var(--vr-cell-px-list);
}

.vr-table[data-vr-grid] time {
  white-space: normal;
}

.vr-table > tbody > tr > :last-child {
  box-shadow: none;
}

/* A muted sub-line under a cell value (the project under its client, the source under a matrix). */
.vr-sub {
  display: block;
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

/* A cell that keeps one line: the value and its sub-line end in an ellipsis; the full text is
   in the cell's title. */
/* A name cell with a sub-line (client over project): each keeps one line and ends in an ellipsis,
   taking the column's width instead of setting it; the full text is in the cell's title and in
   the DOM for screen readers. */
.vr-table .vr-clip {
  width: 10rem; /* a table cell's width is its minimum */
}

/* Below 1366px low-priority columns are hidden by default (grid.js), and the name cell takes
   their room: about 24 characters. */
@media (max-width: 1365.98px) {
  .vr-table .vr-clip {
    width: 14rem;
  }
}

.vr-table .vr-clip > :is(.vr-clip-main, .vr-sub) {
  display: block;
  width: 0;
  min-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Low-priority columns of tables without a Columns control (marked by app.js) give way below
   1366px, so the table fits; the record still holds the full data. */
@media (max-width: 1365.98px) {
  .vr-table:not([data-vr-grid]) [data-vr-low] {
    display: none;
  }
}

/* Long free text (notes, descriptions) may wrap; everything else stays on one scannable line. */
.vr-table > tbody > tr > .vr-wrap {
  white-space: normal;
  min-width: 14rem;
}

/* Instrument labels preserve the spaces transcribed from the source. */
.vr-table .vr-preserve-space {
  white-space: break-spaces;
  overflow-wrap: anywhere;
}

/* A list in a cell (intended tests, containers) wraps its items, so a record table fits its card. */
.vr-table > tbody > tr > td > ul {
  white-space: normal;
}

/* Evidence and note rows that span the table (preservation, preparation, revision notes) are
   sentences, not columns: they wrap instead of forcing a horizontal scroll. */
.vr-table > tbody > tr > td[colspan].small {
  white-space: normal;
}

/* Dashboard work queues: the label wraps so the count and age stay on screen on a phone. */
.vr-table.vr-queue-table > tbody > tr > .vr-wrap {
  min-width: 9rem;
}

/* The identifier is the link: forest, bold, underlined only on hover. */
.vr-table th[scope="row"] {
  font-weight: var(--vr-font-weight-regular);
}

.vr-table .vr-row-link {
  font-weight: var(--vr-font-weight-bold);
  text-decoration: none;
  white-space: nowrap;
}

.vr-table .vr-row-link:hover {
  text-decoration: underline;
}

.vr-table caption {
  caption-side: top;
  padding: var(--vr-space-2-5) var(--vr-space-3);
  color: var(--vr-text-muted);
}

/* Keep the row identifier visible while a wide table scrolls sideways: the frozen cell paints its
   row's opaque fill (zebra, hover, selection included), sits above the scrolled cells, keeps its
   content's width, and casts the one scroll-edge shadow only while the table is scrolled
   (app.js marks the wrap .is-scrolled-x). A row header of free text (.vr-wrap: a finding message)
   is not an identifier and scrolls with its row, so it never covers the cells beside it. */
.vr-table-wrap {
  container-type: inline-size;
}

.vr-table:not(:has(> tbody > tr > th.vr-wrap:first-child)) > thead > tr > th:first-child,
.vr-table > tbody > tr > th[scope="row"]:first-child:not(.vr-wrap) {
  position: sticky;
  left: 0;
  z-index: var(--vr-z-sticky); /* above enhanced fields scrolled beneath it */
  white-space: nowrap;
}

/* In a record table the identifier keeps one line, but a sub-line under it (a report's title, a
   revision and batch) wraps, so the identifier column stays narrow and the table fits its card. */
.vr-table:not([data-vr-grid]) > tbody > tr > th[scope="row"] > div {
  white-space: normal;
}

/* While scrolled, the frozen cell also covers the table's inset strip to its left with its own fill,
   so nothing scrolls past on that side. */
.vr-table-wrap.is-scrolled-x .vr-table > tbody > tr > th[scope="row"]:first-child:not(.vr-wrap) {
  box-shadow: calc(-1 * var(--vr-space-3)) 0 0 var(--vr-row-fill), var(--vr-shadow-scroll-side);
}

.vr-table-wrap.is-scrolled-x .vr-table:not(:has(> tbody > tr > th.vr-wrap:first-child)) > thead > tr > th:first-child {
  box-shadow: calc(-1 * var(--vr-space-3)) 0 0 var(--vr-th-bg), var(--vr-shadow-scroll-side);
}

/* A full-width sub-row (a return reason, row errors): its content stays pinned to the visible part
   of the table, so it is never cut off at the left while the grid scrolls. */
.vr-table > tbody > tr > td.vr-subrow {
  white-space: normal;
}

.vr-subrow-content {
  position: sticky;
  left: var(--vr-cell-px);
  max-width: calc(100cqi - 2 * var(--vr-space-3) - 2 * var(--vr-cell-px));
}

/* Inputs inside table cells: wide enough to read back typed values and dates. */
.vr-table .vr-calculated-entry {
  min-width: var(--vr-reading-grid-width);
}

.vr-table .form-control,
.vr-table .form-select {
  min-width: 6.5rem;
}

.vr-table input[type="datetime-local"].form-control,
.vr-table input[type="date"].form-control {
  min-width: 12.5rem;
}

.vr-table input[type="number"].form-control {
  min-width: 5rem;
}

/* A select in a table cell (entry grids) takes the width of its longest option instead of
   shrinking with the column, so the chosen value stays readable. */
.vr-table .form-select {
  width: auto;
  max-width: 22rem;
}

/* Sortable headers: the sorted column is in the strong text colour with its arrow. */
.vr-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-1);
  color: inherit;
  text-decoration: none;
}

.vr-sort:hover {
  color: var(--vr-text-strong);
  text-decoration: none;
}

th[aria-sort] .vr-sort {
  color: var(--vr-text-strong);
}

.vr-sort .vr-icon {
  width: 0.8125rem;
  height: 0.8125rem;
  opacity: 0;
}

th[aria-sort] .vr-sort .vr-icon,
.vr-sort:hover .vr-icon,
.vr-sort:focus-visible .vr-icon {
  opacity: 1;
}

.vr-table-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--vr-space-2) var(--vr-space-4);
  padding: var(--vr-space-1) var(--vr-space-5) var(--vr-space-4);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
}

.vr-count {
  margin: 0;
  color: var(--vr-text-muted);
}

.vr-count strong {
  color: var(--vr-text);
}

/* A flush table body (the table panel's own body): blocks placed beside the table (headings,
   notes, selection text) take the panel inset one by one. Sections of the card (.vr-panel-body)
   inset as a whole instead. */
.vr-table-card > :is(.vr-table-body, .card-body:not(.vr-panel-body)) > :not(.vr-table-wrap, .vr-table-footer, .vr-grid-toolbar, .vr-bulkbar, .vr-chips, .vr-empty, table, ul, ol, .dt-container) {
  padding-left: var(--vr-panel-inset);
  padding-right: var(--vr-panel-inset);
}

.vr-table-card > :is(.vr-table-body, .card-body:not(.vr-panel-body)) > :is(h3, h4, .d-flex):first-child {
  padding-top: var(--vr-space-3);
}

.vr-table-card > :is(.vr-table-body, .card-body:not(.vr-panel-body)) > :is(h3, h4, .d-flex) {
  padding-bottom: var(--vr-space-1);
}

.vr-table-card > :is(.vr-table-body, .card-body:not(.vr-panel-body)) > p:last-child {
  padding-top: var(--vr-space-2);
  padding-bottom: var(--vr-space-3);
  margin-bottom: 0;
}

.vr-table-card > :is(.vr-table-body, .card-body:not(.vr-panel-body)) > :is(ul, ol) {
  padding-left: calc(var(--vr-panel-inset) + var(--vr-space-5));
  padding-right: var(--vr-panel-inset);
}

/* ================================================================ Grid toolbar, filters, columns */

/* One compact row above the table: search, everyday filters, more filters, then Columns. No rule
   under it: the table's header fill starts the list. */
.vr-grid-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--vr-space-3);
  padding: var(--vr-space-4) var(--vr-space-5) var(--vr-space-3);
}

/* The search box takes the free space and shrinks first: its basis is small so it never forces
   the row to wrap; the everyday filters keep a readable width. */
.vr-grid-toolbar .vr-field {
  margin: 0;
  min-width: 8rem;
  max-width: 11rem;
  flex: 1 1 8.5rem;
}

.vr-grid-toolbar .vr-grid-search {
  min-width: 9rem;
  max-width: none;
  flex: 4 1 9rem;
}

.vr-grid-toolbar .form-label {
  margin-bottom: var(--vr-space-1);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

.vr-grid-search {
  position: relative;
}

.vr-grid-search .vr-icon {
  position: absolute;
  left: var(--vr-space-3);
  bottom: calc((var(--vr-control-height) - 1em) / 2); /* centred in the search field */
  color: var(--vr-text-muted);
  pointer-events: none;
}

.vr-grid-search .form-control {
  padding-left: var(--vr-space-8);
}

.vr-filter-actions,
.vr-grid-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-2);
  align-items: center;
}

.vr-grid-tools {
  margin-left: auto;
}

/* "More filters": a disclosure row under the toolbar. */
.vr-grid-more {
  flex-basis: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: var(--vr-space-2-5) var(--vr-space-3);
  padding-top: var(--vr-space-1);
}

.vr-grid-more[hidden] {
  display: none;
}

.vr-grid-more .vr-field {
  margin: 0;
}

/* Phones: one filter per row, tools beside the actions instead of on their own line. */
@media (max-width: 575.98px) {
  .vr-grid-toolbar .vr-field {
    flex: 1 1 100%;
  }

  .vr-grid-tools {
    margin-left: 0;
  }
}

/* Active filter chips: selection-tinted pills, each removable; text states field and value. */
.vr-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vr-space-1-5);
  padding: 0 var(--vr-space-5) var(--vr-space-3);
  margin: 0;
  list-style: none;
  font-size: var(--vr-font-size-2);
}

.vr-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-1);
  padding: var(--vr-space-0-5) var(--vr-space-0-5) var(--vr-space-0-5) var(--vr-space-2-5);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-selection);
  color: var(--vr-text);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-semibold);
}

.vr-chip .vr-muted {
  color: inherit !important; /* the label sits on the selection fill, not on the page */
  font-weight: var(--vr-font-weight-regular);
}

.vr-chip a {
  display: inline-flex;
  padding: var(--vr-space-1);
  border-radius: var(--vr-radius-pill);
  color: var(--vr-text);
}

.vr-chip a:hover {
  background: var(--vr-surface);
  color: var(--vr-text-strong);
}

.vr-chip a:focus-visible {
  outline-offset: calc(-1 * var(--vr-focus-offset));
}

/* Bulk action bar above a selectable table (standard 5.5): target, action, selection count. */
.vr-bulkbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--vr-space-3) var(--vr-space-4);
  margin: 0 var(--vr-space-3) var(--vr-space-2);
  padding: var(--vr-space-2-5) var(--vr-space-3);
  border-radius: var(--vr-radius-lg);
  background: var(--vr-surface-2);
}

.vr-bulkbar .vr-field {
  margin: 0;
}

/* Columns dialog: visibility checkbox, label and move controls per column, as rounded rows. */
.vr-columns-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--vr-space-1);
  margin: 0;
  padding: 0;
}

.vr-columns-list > li {
  display: flex;
  align-items: center;
  gap: var(--vr-space-2);
  padding: var(--vr-space-1-5) var(--vr-space-2) var(--vr-space-1-5) var(--vr-space-3);
  border-radius: var(--vr-radius-lg);
  background: var(--vr-surface-2);
}

.vr-columns-list .form-check {
  flex: 1 1 auto;
  margin: 0;
}

.vr-columns-list .vr-col-locked {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

.vr-columns-list .btn {
  --bs-btn-padding-x: var(--vr-space-1-5);
}

/* DataTables chrome inside our table card (Bootstrap 5 integration). */
.vr-table-card .dt-container {
  padding: 0;
}

/* The adapter's wrappers take the table's width when it cannot fit (a narrow screen), so the wrap
   scrolls the whole table and keeps its end inset, instead of the last column running into it. */
.vr-table-wrap > .dt-container {
  width: fit-content;
  min-width: 100%;
}

/* The adapter wraps the table in a Bootstrap row/col (gutters, .mt-2); an enhanced list must sit
   exactly where the plain server-rendered table does. */
.vr-table-card .dt-container > .row {
  --bs-gutter-x: 0;
  --bs-gutter-y: 0;
  margin: 0 !important;
}

.vr-table-card .dt-container > .row > * {
  padding: 0;
  margin-top: 0;
}

/* DataTables repaints every cell with --bs-table-bg and its own hover overlay; keep the header
   fill and the row fills of .vr-table. */
.vr-table-card table.table.dataTable.vr-table > thead > tr > th {
  background-color: var(--vr-th-bg);
}

.vr-table-card table.table.dataTable.vr-table > tbody > tr > * {
  background-color: var(--vr-row-fill);
  box-shadow: var(--vr-border-width) 0 0 var(--vr-row-fill);
}

.vr-table-card table.table.dataTable.vr-table > tbody > tr > :last-child {
  box-shadow: none;
}

.vr-table-card .dt-container .dt-paging,
.vr-table-card .dt-container .dt-info,
.vr-table-card .dt-container .dt-length {
  font-size: var(--vr-font-size-2);
  color: var(--vr-text-muted);
}

.vr-table-card .dt-container .dt-layout-row:last-child {
  padding: var(--vr-space-1) var(--vr-space-5) var(--vr-space-4);
}

.vr-table-card table.dataTable {
  margin: 0 !important;
}

.vr-table-card .dt-processing {
  background: var(--vr-raised);
  color: var(--vr-text);
  border: 0;
  border-radius: var(--vr-radius-menu);
  box-shadow: var(--vr-shadow-raised);
}

/* Column drag (ColReorder): its insertion marks and the dragged copy use the theme, not its blue
   and fixed white. */
table.dataTable tbody tr td.dtcr-moving-first {
  border-left-color: var(--vr-ink);
}

table.dataTable tbody tr td.dtcr-moving-last {
  border-right-color: var(--vr-ink);
}

table.dtcr-cloned.dataTable {
  background-color: var(--vr-raised);
  border: 0;
  border-radius: var(--vr-radius-lg);
  box-shadow: var(--vr-shadow-raised);
  opacity: 0.94;
}

/* ================================================================ Empty, loading, error */

.vr-empty {
  padding: var(--vr-space-10) var(--vr-space-6);
  text-align: center;
}

.vr-empty-title {
  margin: 0 0 var(--vr-space-1);
  color: var(--vr-text-strong);
  font-size: var(--vr-font-size-6);
  font-weight: var(--vr-font-weight-bold);
}

.vr-empty-body {
  max-width: 36rem;
  margin: 0 auto var(--vr-space-4);
  color: var(--vr-text-muted);
}

.vr-empty[data-kind="error"] .vr-empty-title {
  color: var(--vr-danger-text);
}

.vr-empty-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--vr-space-2);
}

[aria-busy="true"] {
  cursor: progress;
}

/* ================================================================ Forms */

.vr-form {
  max-width: var(--vr-form-width);
}

/* Grid-style forms (a table of inputs, e.g. result entry) use the full content width. */
.vr-form:has(.vr-table-card),
.vr-form.vr-form-wide {
  max-width: none;
}

/* A form with a table of inputs (quote lines, price list, report sample picker) uses the full
   content width for that table; its other sections keep the reading width. */
.vr-form-wide > .vr-form-section:not(:has(table)) {
  max-width: var(--vr-form-width);
}

/* Reading width for panels that sit with a form (history under an edit form) but are not one. */
.vr-narrow {
  max-width: var(--vr-form-width);
}

.vr-field {
  margin-bottom: var(--vr-space-4);
}

.row > [class*="col"] > .vr-field {
  margin-bottom: 0;
}

.vr-field > fieldset > legend,
fieldset.vr-field > legend {
  font-size: var(--vr-font-size-5);
}

.vr-req {
  color: var(--vr-pencil);
  margin-left: var(--vr-space-0-5);
}

.vr-field-errors {
  display: block;
  margin: var(--vr-space-1) 0 0;
  padding: 0;
  list-style: none;
  color: var(--bs-form-invalid-color);
  font-weight: var(--vr-font-weight-semibold);
  font-size: var(--vr-font-size-3);
}

.vr-field-errors li::before {
  content: "Error: ";
}

.vr-choices .form-check {
  margin-bottom: var(--vr-space-1);
}

.vr-multi {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-2);
}

.vr-multi > * {
  flex: 1 1 10rem;
}

/* Form groups: a fieldset with a bold legend, separated by space, never by lines or wells. */
.vr-form-section {
  padding: var(--vr-space-5);
  margin-bottom: var(--vr-space-8);
  background: var(--vr-surface);
  border: 0;
  border-radius: var(--vr-radius-lg);
}

.vr-form-section > legend,
.vr-form-section > h2 {
  float: left; /* keeps a fieldset legend inside the panel instead of on its border */
  width: 100%;
  margin: 0 0 var(--vr-space-1);
  padding: 0;
  background: transparent;
  border: 0;
  font-size: var(--vr-font-size-5);
  font-weight: var(--vr-font-weight-bold);
}

/* Bootstrap floats <legend> and clears only "legend + *"; hidden inputs after a legend would
   leave following blocks (e.g. nested fieldsets) beside the float. */
.vr-form-section > legend ~ *,
.vr-form-section > h2 ~ *,
.vr-container > legend ~ * {
  clear: left;
}

.vr-form .vr-field {
  margin-bottom: var(--vr-space-4);
}

.vr-form .row > [class*="col"] > .vr-field,
.vr-form-section > .vr-field:last-child {
  margin-bottom: 0;
}

.vr-form textarea.form-control {
  height: 5.5rem;
  resize: vertical;
}

/* Action row (standard 7.5): Cancel, then the primary action at the end of the row; a destructive
   action, when present, starts the row (.vr-form-actions-start). On a page it is plain: in flow,
   directly after its fields, with no sticky position, band or shadow. Only a form dialog's footer
   is sticky and carries the one raised-edge shadow (--vr-shadow-scroll-bottom); it is always the
   dialog's last element (the form fragment renders nothing after it). */
.vr-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--vr-space-3);
  margin: var(--vr-space-6) 0 0;
  padding: 0;
}

.card-body .vr-form-actions,
.vr-entrance-panel .vr-form-actions,
.dropdown-menu .vr-form-actions,
.modal .vr-form-actions {
  margin-top: var(--vr-space-4);
}

.vr-form-actions-start {
  margin-right: auto;
}

/* Form dialogs reuse the page's form and validation, with one frame and one scroll surface.
   Bootstrap owns focus trapping, backdrop, scrolling and responsive fullscreen behaviour. */
.vr-form-dialog {
  --vr-dialog-pad: var(--vr-space-6);
  --bs-modal-margin: var(--vr-space-6);
}

.vr-form-dialog .modal-content {
  overflow: hidden;
}

.vr-form-dialog-header {
  flex-wrap: nowrap;
  gap: var(--vr-space-4);
  padding: var(--vr-space-4) var(--vr-dialog-pad);
}

.vr-form-dialog-header .modal-title {
  min-width: 0;
  overflow-wrap: anywhere;
}

.vr-form-dialog-header .btn {
  flex: none;
}

/* A small square icon button (the dialog's Close): Bootstrap button roles, icon only. */
.vr-btn-icon {
  --bs-btn-padding-x: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--vr-control-height-sm);
  height: var(--vr-control-height-sm);
}

.vr-form-dialog #vr-form-content {
  padding: var(--vr-dialog-pad);
  background: var(--vr-raised);
  scroll-padding-block: 1rem 5rem;
}

.vr-form-dialog .vr-main {
  padding: 0;
  background: none;
}

.vr-form-dialog :is(.vr-page-header, nav[aria-label="Breadcrumb"]) {
  display: none;
}

/* A dialog ends with its form's action row: the history and the page footer stay on the full page,
   also when a form URL opened directly becomes the dialog. Header actions move to the dialog
   header (form-dialog.js). */
.vr-form-dialog :is(.vr-page-only, [data-vr-form-page] > .vr-page-actions) {
  display: none;
}

.vr-form-dialog .vr-form,
.vr-form-dialog .vr-form-wide > .vr-form-section {
  max-width: none;
}

.vr-form-dialog .vr-form-section {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.vr-form-dialog .vr-form-section + .vr-form-section {
  padding-top: var(--vr-space-2);
}

/* Inside a dialog nothing is raised but the footer: panels lie flat on the dialog surface. */
.vr-form-dialog .card {
  border: 0;
  box-shadow: none;
}

.vr-form-dialog .vr-form .card-header {
  padding-inline: 0;
  background: transparent;
}

.vr-form-dialog .vr-form .card:not(.vr-table-card) > .card-body {
  padding-inline: 0;
}

.vr-form-dialog .vr-form-actions {
  position: sticky;
  bottom: calc(-1 * var(--vr-dialog-pad));
  z-index: var(--vr-z-sticky);
  margin: var(--vr-space-6) calc(-1 * var(--vr-dialog-pad)) calc(-1 * var(--vr-dialog-pad));
  padding: var(--vr-space-4) var(--vr-dialog-pad);
  background: var(--vr-raised);
  box-shadow: var(--vr-shadow-scroll-bottom);
}

@media (min-width: 576px) {
  .vr-form-dialog .modal-dialog:not(.modal-fullscreen) {
    width: calc(100% - 2 * var(--bs-modal-margin));
  }
}

@media (max-width: 575.98px) {
  .vr-form-dialog {
    --vr-dialog-pad: var(--vr-space-2);
  }

  .vr-form-dialog-header {
    gap: var(--vr-space-2);
    padding-block: var(--vr-space-3);
  }
}

.vr-form-note {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-3);
}

/* One container row of a receipt formset. */
.vr-container {
  padding: var(--vr-space-4) 0 var(--vr-space-1);
}

.vr-container:first-child {
  border-top: 0;
  padding-top: 0;
}

.vr-container > legend {
  font-size: var(--vr-font-size-4);
  font-weight: var(--vr-font-weight-semibold);
  margin-bottom: var(--vr-space-2);
}

/* Filter box above long checkbox lists (added by app.js). */
.vr-choice-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vr-space-1-5) var(--vr-space-3);
  margin-bottom: var(--vr-space-2-5);
}

.vr-choice-filter .form-control {
  max-width: 20rem;
}

/* ================================================================ Record detail */

/* Key facts sit on one grid of equal tracks (--vr-fact-width at least), so labels and values line
   up from row to row. A long value wraps inside its cell; a fact marked wide ({% fact wide=True %}:
   a project, a location, a preservation check) spans two tracks, or the full width when only one
   track fits. */
.vr-facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--vr-fact-width), 100%), 1fr));
  gap: var(--vr-space-4) var(--vr-space-6);
  margin: 0;
  container-type: inline-size;
}

.vr-facts > div {
  min-width: 0;
}

.vr-facts > .vr-fact-wide {
  grid-column: span 2;
}

/* Fewer than two tracks (2 × --vr-fact-width + the column gap): a wide fact takes the row. */
@container (width < 23.5rem) {
  .vr-facts > .vr-fact-wide {
    grid-column: 1 / -1;
  }
}

.vr-facts dt {
  margin-bottom: var(--vr-space-0-5);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
}

.vr-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* Record layout (includes/record_layout.html): the first panel and the action panel share the top
   row from 1200px; the remaining panels follow at full width. Below 1200px everything stacks in
   document order: lead, actions, the rest. The action panel never hides content silently: it
   grows with its content up to the viewport's height, then scrolls inside its own box with the
   scrollbar always shown and a fade at its foot while more lies below. */
.vr-record {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: var(--vr-space-5);
}

.vr-record > * {
  margin-bottom: var(--vr-space-5);
}

.vr-record-lead > .card,
.vr-record-aside-scroll > .card {
  margin-bottom: 0;
}

@media (min-width: 1200px) {
  .vr-record.vr-record-has-aside {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  }

  .vr-record > * {
    grid-column: 1 / -1;
  }

  .vr-record > .vr-record-lead {
    grid-column: 1;
    grid-row: 1;
  }

  .vr-record-lead > .card {
    height: 100%;
  }

  .vr-record > .vr-record-aside {
    grid-column: 2;
    grid-row: 1;
    align-self: start;
  }

  .vr-record-aside-scroll {
    max-height: calc(100dvh - var(--vr-topbar-height) - var(--vr-space-12));
    overflow-y: auto;
    border-radius: var(--vr-radius-xl);
  }

  /* The fade: sticky at the foot of the scroll region, so it shows over content still below and
     comes to rest over the panel's bottom padding at the end. */
  .vr-record-aside-scroll::after {
    content: "";
    position: sticky;
    bottom: 0;
    display: block;
    height: var(--vr-space-6);
    margin-top: calc(-1 * var(--vr-space-6));
    border-radius: 0 0 var(--vr-radius-xl) var(--vr-radius-xl);
    background: linear-gradient(transparent, var(--vr-surface));
    pointer-events: none;
  }
}

/* The scrollbar stays visible (not an overlay that appears only while scrolling). */
.vr-record-aside-scroll::-webkit-scrollbar-thumb {
  background-color: var(--vr-scrollbar-hover);
}

@supports not selector(::-webkit-scrollbar) {
  .vr-record-aside-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--vr-scrollbar-hover) transparent;
  }
}

.vr-record-aside-scroll:focus-visible {
  outline: var(--vr-focus-width) solid var(--vr-focus);
  outline-offset: var(--vr-focus-offset);
}

/* Record foot line: the identifier, when this view was produced and by whom (printed with the
   page). */
.vr-record-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-1) var(--vr-space-3);
  margin-top: var(--vr-space-6);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

/* Application footer: product name, the AGPL-3.0 section 13 source link and the licence. */
.vr-app-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-1) var(--vr-space-4);
  margin-top: auto;
  padding-top: var(--vr-space-6);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

.vr-app-foot-centered {
  justify-content: center;
  margin-top: var(--vr-space-2);
  padding-top: 0;
}

.vr-form-dialog .vr-app-foot {
  display: none;
}

@media print {
  .vr-app-foot {
    display: none;
  }
}

/* Custody timeline and history: each entry a rounded row on the second surface, oldest first. */
.vr-timeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--vr-space-1-5);
  margin: 0;
  padding: 0;
}

.vr-timeline > li {
  padding: var(--vr-space-3);
  border-radius: var(--vr-radius-lg);
  background: var(--vr-surface-2);
}

.vr-timeline-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-1) var(--vr-space-3);
  align-items: baseline;
}

.vr-timeline-title {
  color: var(--vr-text-strong);
  font-weight: var(--vr-font-weight-bold);
}

.vr-timeline-meta {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
}

.vr-timeline-body {
  margin: var(--vr-space-1) 0 0;
}

.vr-history-item > p {
  margin-bottom: 0;
}

/* What's new (core/whats_new.html): one change per rounded row on the second surface. The type
   is an uppercase label before the title; summary and technical notes keep their paragraphs. */
.vr-changes {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--vr-space-1-5);
  margin: 0;
  padding: 0;
}

.vr-change {
  padding: var(--vr-space-3);
  border-radius: var(--vr-radius-lg);
  background: var(--vr-surface-2);
}

.vr-change-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-1) var(--vr-space-2);
  align-items: baseline;
}

.vr-change-title {
  color: var(--vr-text-strong);
  font-weight: var(--vr-font-weight-bold);
}

.vr-change-type {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
  letter-spacing: var(--vr-tracking-label);
  text-transform: uppercase;
}

.vr-change-meta {
  margin: var(--vr-space-0-5) 0 var(--vr-space-1);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
}

.vr-change-summary > p,
.vr-change-notes-body > p {
  margin-bottom: var(--vr-space-1-5);
}

.vr-change-summary > :last-child,
.vr-change-notes-body > :last-child {
  margin-bottom: 0;
}

.vr-change-more {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--vr-space-1) var(--vr-space-4);
  margin-top: var(--vr-space-2);
}

.vr-change-notes > summary {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
}

.vr-change-notes-body {
  margin-top: var(--vr-space-1-5);
  font-size: var(--vr-font-size-2);
}

.vr-history-changes {
  margin-bottom: 0;
  padding-left: var(--vr-space-5);
}

/* Lab record-retention statement (core/record_retention.html): free text kept as entered. */
.vr-retention-statement > :last-child {
  margin-bottom: 0;
}

/* ================================================================ Entrance pages */

/* Sign-in: the scene, then the body on the shell's sage ground: brand with Help and Theme on top,
   the sheet centred with its note under it, the source footer at the bottom. */
html:has(> body.vr-entrance-page) {
  font-size: var(--vr-entrance-root-size);
}

.vr-entrance {
  display: grid;
  min-height: 100vh;
  background: var(--vr-topbar-bg);
}

.vr-entrance-body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  padding: var(--vr-space-6) clamp(var(--vr-space-6), 5%, var(--vr-space-12));
}

.vr-entrance-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--vr-space-3);
}

.vr-entrance-theme {
  display: flex;
  gap: var(--vr-space-1);
}

.vr-entrance-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--vr-space-8) 0;
}

/* The panel and an optional aside (sign-in announcements): stacked, side by side from 1280px. */
.vr-entrance-sheets {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.vr-entrance-brand,
.vr-entrance-brand:hover {
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-2-5);
  color: var(--vr-topbar-text);
  text-decoration: none;
}

.vr-entrance-brand img {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--vr-radius);
}

.vr-entrance-brand .vr-wordmark-name {
  font-size: var(--vr-font-size-6);
}

.vr-entrance-brand .vr-wordmark-parent {
  color: var(--vr-topbar-text-muted);
  font-size: var(--vr-font-size-1);
}

.vr-entrance-panel {
  position: relative;
  width: 100%;
  max-width: 25rem;
  padding: var(--vr-space-8) var(--vr-space-8) var(--vr-space-6);
  background-color: var(--vr-surface);
  border-radius: var(--vr-radius-dialog);
  box-shadow: var(--vr-shadow-sheet);
}

@media (max-width: 575.98px) {
  .vr-entrance-panel {
    padding: var(--vr-space-6) var(--vr-space-5);
  }
}

.vr-entrance-panel h1 {
  font-size: var(--vr-entrance-title-size);
  font-weight: var(--vr-font-weight-black);
  letter-spacing: var(--vr-tracking-title);
  margin-bottom: var(--vr-space-1) !important;
}

.vr-entrance-lead {
  margin-bottom: var(--vr-space-6);
  color: var(--vr-text-muted);
}

.vr-entrance-panel .form-control:not(textarea) {
  height: var(--vr-entrance-field-height);
  font-size: var(--vr-font-size-3);
}

.vr-entrance-panel .btn {
  justify-content: center;
  min-height: var(--vr-entrance-button-height);
  font-size: var(--vr-font-size-3);
}

/* Every entrance action takes the sheet's width (shared when there are two). */
.vr-entrance-panel .vr-form-actions > .btn {
  flex: 1 1 0;
}

/* A note after the form (password reset) keeps its distance; the sheet ends on its padding. */
.vr-entrance-panel > .vr-form + * {
  margin-top: var(--vr-space-4);
}

.vr-entrance-panel > :last-child {
  margin-bottom: 0;
}

/* Remember me and the password-reset link share one row under the password. */
.vr-entrance-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--vr-space-3);
  margin: var(--vr-space-1) 0 var(--vr-space-6);
  font-size: var(--vr-font-size-3);
}

.vr-form .vr-entrance-row > .vr-field {
  margin-bottom: 0;
}

.vr-entrance-row a {
  font-weight: var(--vr-font-weight-semibold);
}

/* "or" divider between password sign-in and the alternative methods: muted words between two
   fills, not rules. */
.vr-entrance-or {
  display: flex;
  align-items: center;
  gap: var(--vr-space-3);
  margin: var(--vr-space-4) 0;
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
  letter-spacing: var(--vr-tracking-label);
  text-transform: uppercase;
}

.vr-entrance-or::before,
.vr-entrance-or::after {
  content: "";
  flex: 1;
  height: var(--vr-border-width-lg);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-surface-2);
}

.vr-entrance-panel .btn .vr-icon {
  margin-right: var(--vr-space-1);
  vertical-align: -0.125em;
}

.vr-entrance-alt {
  margin: var(--vr-space-4) 0 0;
  font-size: var(--vr-font-size-3);
  text-align: center;
}

.vr-entrance-alt .vr-icon {
  margin-right: var(--vr-space-1);
  vertical-align: -0.125em;
}

.vr-entrance-foot {
  margin: var(--vr-space-5) 0 0;
  color: var(--vr-topbar-text-muted);
  font-size: var(--vr-font-size-2);
  text-align: center;
}

.vr-entrance-sep {
  display: inline-block;
  margin: 0 var(--vr-space-1-5);
}

/* Illustrated entrance (sign-in pages): the scene beside the body from 992px, one static picture
   per theme over its sky colour, anchored at the bottom; on narrow screens only the body remains. */
.vr-scene {
  position: relative;
  display: none;
  overflow: hidden;
  background-color: var(--vr-scene-sky);
  background-image: url("../img/entrance/scene-light.0188944241de.svg");
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: cover;
}

[data-bs-theme="dark"] .vr-scene {
  background-image: url("../img/entrance/scene-dark.f63559ecb1c9.svg");
}

.vr-scene-headline {
  position: absolute;
  z-index: var(--vr-z-raised);
  top: var(--vr-entrance-headline-top);
  left: var(--vr-entrance-headline-left);
  max-width: 26rem;
}

.vr-scene-title {
  margin: 0;
  color: var(--vr-scene-headline);
  font-size: var(--vr-entrance-headline-size);
  font-weight: var(--vr-font-weight-black);
  line-height: 1.06;
  letter-spacing: var(--vr-tracking-display);
  text-wrap: balance;
}

/* "CoA" keeps its title tooltip without the browser's dotted underline in the display headline. */
.vr-scene-title abbr[title] {
  text-decoration: none;
  cursor: help;
}

.vr-scene-sub {
  max-width: 22rem;
  margin: var(--vr-space-4) 0 0;
  color: var(--vr-scene-subline);
  font-size: var(--vr-entrance-subline-size);
  line-height: var(--vr-line-height-base);
}

@media (min-width: 992px) {
  .vr-entrance:has(.vr-scene) {
    grid-template-columns: minmax(0, 1.15fr) minmax(30rem, 1fr);
  }

  .vr-entrance:has(.vr-scene) .vr-scene {
    display: block;
  }
}

/* Beside the sheet, the announcements box takes the sheet's height whatever its text: size
   containment keeps its text from sizing it (its width is the flex basis), the row stretches it to
   the sheet, and longer text scrolls inside. The last notice fills the rest of the box. */
@media (min-width: 1280px) {
  .vr-entrance:has(.vr-scene):has(.vr-announcements-aside) {
    grid-template-columns: minmax(0, 1fr) minmax(56.5rem, 1.15fr);
  }

  .vr-entrance-sheets:has(> .vr-announcements-aside) {
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: var(--vr-space-5);
  }

  .vr-entrance-sheets > .vr-announcements-aside {
    display: flex;
    flex: 0 1 26rem;
    flex-direction: column;
    gap: var(--vr-space-2);
    max-width: 26rem;
    margin: 0;
    contain: size;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .vr-entrance-sheets > .vr-announcements-aside > .alert {
    flex: 0 0 auto;
    margin: 0;
    box-shadow: none;
  }

  .vr-entrance-sheets > .vr-announcements-aside > .alert:last-child {
    flex-grow: 1;
  }

  .vr-entrance-sheets:has(> .vr-announcements-aside) > .vr-entrance-panel {
    flex: 0 1 26rem;
  }
}

/* ================================================================ Form controls

   No control shows the browser's default UI (docs/ui-standards.md section 8). Each is one widget
   template in templates/django/forms/widgets/ plus static/js/controls.js; vendor stylesheets keep
   their stock colours, so every colour they set is overridden here with tokens. The field box
   itself (treatment A: a 1px outline, no fill, the focus ring and the invalid ring) is the
   .form-control/.form-select rule in Bootstrap components; this section extends it to the
   enhanced controls. */

/* ---- Select, multi-select and suggestion input (Tom Select) ---------------------------------
   The wrapper keeps the select's .form-select (or the input's .form-control) class, so it is the
   field box; the inner control has no box of its own. Tom Select moves focus inside, so the
   focus and invalid rings are repeated here on its .focus and .is-invalid states. */

.ts-wrapper {
  --bs-body-bg: transparent;
  --bs-body-color: var(--vr-text);
  --bs-border-color: var(--vr-border-strong);
  --bs-border-color-translucent: transparent;
  --bs-secondary-bg: transparent;
  --bs-tertiary-bg: var(--vr-surface-hover);
  --bs-secondary-color: var(--vr-placeholder);
}

.ts-wrapper.form-control,
.ts-wrapper.form-select {
  height: auto;
  min-height: var(--vr-control-height);
  padding: 0;
  background-image: none;
}

.ts-wrapper .ts-control,
.ts-wrapper.form-select .ts-control,
.ts-wrapper.single.input-active .ts-control,
.ts-wrapper.form-control .ts-control {
  min-height: calc(var(--vr-control-height) - 2 * var(--vr-border-width));
  gap: var(--vr-space-1);
  padding: var(--vr-space-1) var(--vr-space-8) var(--vr-space-1) var(--vr-space-3);
  background: transparent;
  color: var(--vr-text);
  border: 0;
  border-radius: inherit;
  box-shadow: none;
  cursor: pointer;
}

/* A suggestion input is free text: no chevron, the text cursor. */
.ts-wrapper.form-control .ts-control {
  padding-right: var(--vr-space-3);
  cursor: text;
}

.ts-wrapper .ts-control > input,
.ts-wrapper .ts-control .item {
  color: var(--vr-text);
}

.ts-wrapper.single .ts-control > .item {
  font-weight: var(--vr-font-weight-medium);
}

.ts-wrapper .ts-control > input::placeholder,
.ts-dropdown .dropdown-input::placeholder {
  color: var(--vr-placeholder);
  opacity: 1;
}

.ts-wrapper.form-select.focus,
.ts-wrapper.form-control.focus {
  background-color: transparent;
  border-color: var(--vr-focus);
  box-shadow: var(--vr-field-focus-ring);
  outline: none;
}

.ts-wrapper.focus .ts-control,
.ts-wrapper.plugin-dropdown_input.focus.dropdown-active .ts-control {
  border-color: transparent;
  box-shadow: none;
}

/* Invalid: the combobox carries aria-invalid (copied from the field); the wrapper shows it. */
.ts-wrapper:has([aria-invalid="true"]),
.ts-wrapper.focus:has([aria-invalid="true"]) {
  border-color: var(--vr-danger-border);
  background-image: none;
  box-shadow: var(--vr-field-invalid-ring);
}

.ts-wrapper.disabled.form-select,
.ts-wrapper.disabled.form-control,
.ts-wrapper.disabled .ts-control {
  background-color: transparent;
  color: var(--vr-text-muted);
  opacity: 1;
}

/* The chevron is a Bootstrap Icons symbol (controls.js), not the stylesheet's background image. */
.vr-ts-caret {
  position: absolute;
  top: 50%;
  right: var(--vr-space-3);
  display: inline-flex;
  color: var(--vr-text-muted);
  pointer-events: none;
  transform: translateY(-50%);
  transition: transform 0.15s var(--vr-ease);
}

.ts-wrapper.dropdown-active .vr-ts-caret {
  transform: translateY(-50%) rotate(180deg);
}

.ts-wrapper.disabled .vr-ts-caret {
  opacity: 0.5;
}

/* Clear button (controls.js addClear): beside the chevron, never moving it. The space is kept
   whether or not it shows, so nothing shifts; it fades in while the control is hovered, focused
   or open, and stays visible on touch screens. Hidden (the attribute) while there is no value. */
.ts-wrapper.vr-clearable .ts-control {
  padding-right: calc(var(--vr-space-8) + var(--vr-space-6));
}

.ts-wrapper.vr-clearable.multi .ts-control {
  padding-right: var(--vr-space-8);
}

.vr-ts-clear {
  position: absolute;
  z-index: calc(var(--vr-z-raised) + 1); /* over Tom Select's control (z-index 1) */
  top: 50%;
  right: var(--vr-space-8);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--vr-space-6);
  height: var(--vr-space-6);
  padding: 0;
  background: transparent;
  color: var(--vr-text-muted);
  border: 0;
  border-radius: var(--vr-radius-pill);
  font-size: var(--vr-font-size-5);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity var(--vr-motion-fast) ease-out;
}

.ts-wrapper.multi .vr-ts-clear {
  right: var(--vr-space-2);
}

.vr-ts-clear[hidden] {
  display: none;
}

.ts-wrapper:hover .vr-ts-clear,
.ts-wrapper.focus .vr-ts-clear,
.ts-wrapper.dropdown-active .vr-ts-clear,
.vr-ts-clear:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .vr-ts-clear {
    opacity: 1;
  }
}

.vr-ts-clear:hover {
  background: var(--vr-surface-hover);
  color: var(--vr-text);
}

.vr-ts-clear:focus-visible {
  outline: var(--vr-focus-width) solid var(--vr-focus);
  outline-offset: 0;
}

@media (prefers-reduced-motion: reduce) {
  .vr-ts-clear {
    transition: none;
  }
}

/* Chosen items of a multi-select: pills with a remove button. */
.ts-wrapper.multi .ts-control {
  padding-left: var(--vr-space-1-5);
  cursor: text;
}

.ts-wrapper.multi .ts-control > div,
.ts-wrapper.multi .ts-control > div.item {
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-1);
  margin: 0;
  padding: var(--vr-space-0-5) var(--vr-space-1) var(--vr-space-0-5) var(--vr-space-2-5);
  background: var(--vr-selection);
  color: var(--vr-text);
  border: 0;
  border-radius: var(--vr-radius-pill);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
}

.ts-wrapper.multi .ts-control > div.item.active {
  background: var(--vr-ink);
  color: var(--vr-on-ink);
}

.ts-wrapper.multi.disabled .ts-control > div,
.ts-wrapper.multi.disabled .ts-control > div.active {
  background: var(--vr-surface-2);
  color: var(--vr-text-muted);
}

/* Selected test for another matrix: text + icon + tone, never colour alone. */
.ts-wrapper.multi .ts-control > div.item.vr-ts-mismatch {
  background: var(--vr-warning-bg);
  color: var(--vr-warning-text);
}

.ts-wrapper.plugin-remove_button .item .remove,
.ts-wrapper.plugin-remove_button:not(.rtl) .item .remove,
.ts-wrapper.plugin-remove_button:not(.rtl) .item.active .remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--vr-space-5);
  height: var(--vr-space-5);
  margin-left: 0;
  padding: 0;
  color: inherit;
  border: 0;
  border-radius: 50%;
  opacity: 0.75;
}

.ts-wrapper.plugin-remove_button .item .remove:hover {
  background: var(--vr-surface-hover);
  color: var(--vr-text);
  opacity: 1;
}

@media (pointer: coarse) {
  .ts-wrapper.plugin-remove_button .item .remove {
    width: var(--vr-space-8);
    height: var(--vr-space-8);
  }
}

/* The menu: a raised surface, fixed beside its control by controls.js (vr-floating) so a dialog
   body or a scrolling table cannot clip it. */
.ts-dropdown,
.ts-dropdown.form-control,
.ts-dropdown.form-select {
  z-index: var(--vr-z-menu);
  height: auto;
  margin: 0;
  padding: var(--vr-space-1-5);
  background: var(--vr-raised);
  color: var(--vr-text);
  border: 0;
  border-radius: var(--vr-radius-menu);
  box-shadow: var(--vr-shadow-raised);
}

.ts-dropdown.vr-floating {
  position: fixed;
}

.ts-dropdown .ts-dropdown-content {
  max-height: 18rem;
  scrollbar-width: thin;
  scrollbar-color: var(--vr-scrollbar) transparent;
}

.ts-dropdown .option,
.ts-dropdown .no-results,
.ts-dropdown .create,
.ts-dropdown .loading-more-results {
  display: flex;
  align-items: center;
  gap: var(--vr-space-2);
  padding: var(--vr-space-1-5) var(--vr-space-2-5);
  color: var(--vr-text);
  border-radius: var(--vr-radius-lg);
}

.ts-dropdown .no-results,
.ts-dropdown .loading-more-results,
.ts-dropdown .create {
  color: var(--vr-text-muted);
}

.ts-dropdown .optgroup-header {
  padding: var(--vr-space-2) var(--vr-space-2-5) var(--vr-space-1);
  background: transparent;
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
}

.ts-dropdown .optgroup::before {
  display: none;
}

.ts-dropdown .active,
.ts-dropdown .active.create {
  background-color: var(--vr-surface-hover);
  color: var(--vr-text);
}

.ts-dropdown .option.selected {
  font-weight: var(--vr-font-weight-bold);
}

.ts-dropdown .vr-ts-check {
  display: none;
  margin-left: auto;
  color: var(--vr-ink);
}

.ts-dropdown .option.selected .vr-ts-check {
  display: inline-flex;
}

.ts-dropdown [data-selectable] .highlight {
  background: var(--vr-selection);
  color: inherit;
  border-radius: var(--vr-radius-xs);
}

.ts-dropdown .spinner::after {
  border-color: var(--vr-border-strong) transparent;
}

/* Search box at the top of a long list's menu (dropdown_input plugin), with a search icon. */
.ts-dropdown .dropdown-input-wrap {
  position: relative;
  margin-bottom: var(--vr-space-1);
}

.ts-dropdown .dropdown-input-wrap > .vr-icon {
  position: absolute;
  top: 50%;
  left: var(--vr-space-2-5);
  color: var(--vr-text-muted);
  pointer-events: none;
  transform: translateY(-50%);
}

.ts-dropdown .dropdown-input,
.plugin-dropdown_input .dropdown-input {
  height: var(--vr-control-height-sm);
  min-height: 0;
  padding: 0 var(--vr-space-2) 0 var(--vr-space-8);
}

.ts-dropdown .vr-ts-analyte {
  font-weight: var(--vr-font-weight-semibold);
}

.ts-dropdown .vr-ts-meta {
  color: var(--vr-text-muted);
}

/* A select in a table cell (entry grids) stays wide enough to read its value. */
.vr-table .ts-wrapper {
  min-width: 10rem;
  max-width: 22rem;
}

/* The requested-tests picker (static/js/test-picker.js). */
.vr-test-summary {
  margin-top: var(--vr-space-1-5);
}

.vr-test-mismatch {
  margin-top: var(--vr-space-2);
  padding: var(--vr-space-2-5) var(--vr-space-3);
  background: var(--vr-warning-bg);
  color: var(--vr-warning-text);
  border-radius: var(--vr-radius-lg);
}

.vr-test-mismatch p {
  display: flex;
  gap: var(--vr-space-2);
  align-items: baseline;
  margin: 0 0 var(--vr-space-1);
  font-weight: var(--vr-font-weight-semibold);
}

.vr-test-mismatch ul {
  margin: 0 0 var(--vr-space-2) var(--vr-space-6);
  padding: 0;
}

.vr-test-mismatch .btn {
  --bs-btn-color: var(--vr-warning-text);
  --bs-btn-border-color: var(--vr-warning-text);
  --bs-btn-hover-bg: var(--vr-surface);
  --bs-btn-hover-color: var(--vr-warning-text);
  --bs-btn-hover-border-color: var(--vr-warning-text);
}

/* ---- Date and date-time fields ----------------------------------------------------------------
   A typed text field with a calendar button; the calendar (Vanilla Calendar Pro, layout only)
   opens in a popover beside it. */

.vr-date-input {
  position: relative;
}

.vr-date-input .vr-date-text {
  padding-right: var(--vr-space-8);
  font-variant-numeric: tabular-nums;
}

.vr-date-input:has(.vr-date-text[aria-expanded="true"]) .vr-date-text {
  border-color: var(--vr-focus);
  box-shadow: var(--vr-field-focus-ring);
}

.vr-table .vr-date-input {
  min-width: 12.5rem;
}

.vr-date-icon {
  position: absolute;
  top: 0;
  right: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--vr-control-height);
  height: var(--vr-control-height);
  padding: 0;
  background: transparent;
  color: var(--vr-text-muted);
  border: 0;
  border-radius: var(--vr-radius-lg);
}

.vr-date-icon:hover:not(:disabled) {
  color: var(--vr-text);
}

.vr-date-icon:disabled {
  opacity: 0.5;
}

.vr-date-hint {
  margin-top: var(--vr-space-1);
}

.vr-date-error:not(:empty) {
  display: block;
}

.vr-popover {
  z-index: var(--vr-z-menu);
  padding: var(--vr-space-3);
  background: var(--vr-raised);
  color: var(--vr-text);
  border: 0;
  border-radius: var(--vr-radius-menu);
  box-shadow: var(--vr-shadow-raised);
}

.vr-popover.vr-floating {
  position: fixed;
}

.vr-popover[hidden] {
  display: none;
}

.vr-datepicker {
  width: 18rem;
  max-width: calc(100vw - 1rem);
}

.vr-datepicker.vr-datetime {
  width: 20rem;
}

/* The calendar itself: Vanilla Calendar's layout sheet, coloured here. */
.vr-datepicker [data-vc="calendar"] {
  min-width: 0;
  padding: 0;
  background: transparent;
  color: var(--vr-text);
  border-radius: 0;
}

.vr-datepicker [data-vc="header"] {
  margin-bottom: var(--vr-space-1);
}

.vr-datepicker [data-vc="month"],
.vr-datepicker [data-vc="year"] {
  color: var(--vr-text);
  font-size: var(--vr-font-size-3);
  font-weight: var(--vr-font-weight-bold);
}

/* Month arrows: Bootstrap Icons chevrons (controls.js); the library's own image is hidden. */
.vr-datepicker [data-vc-arrow] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--vr-control-height-sm);
  height: var(--vr-control-height-sm);
  color: var(--vr-text-muted);
  border-radius: var(--vr-radius-lg);
}

.vr-datepicker [data-vc-arrow]::before {
  content: none;
}

.vr-datepicker [data-vc-arrow]:hover,
.vr-datepicker [data-vc="month"]:hover,
.vr-datepicker [data-vc="year"]:hover {
  background: var(--vr-surface-hover);
  color: var(--vr-text);
}

.vr-datepicker [data-vc-week-day] {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
}

.vr-datepicker [data-vc-date-btn],
.vr-datepicker [data-vc-months-month],
.vr-datepicker [data-vc-years-year] {
  min-height: 2rem;
  background: transparent;
  color: var(--vr-text);
  border-radius: var(--vr-radius-lg);
  font-size: var(--vr-font-size-2);
  font-variant-numeric: tabular-nums;
}

.vr-datepicker [data-vc-date-btn]:hover,
.vr-datepicker [data-vc-months-month]:hover,
.vr-datepicker [data-vc-years-year]:hover {
  background: var(--vr-surface-hover);
}

.vr-datepicker [data-vc-date-month="prev"] [data-vc-date-btn],
.vr-datepicker [data-vc-date-month="next"] [data-vc-date-btn],
.vr-datepicker [data-vc-date-disabled] [data-vc-date-btn],
.vr-datepicker [data-vc-months-month]:disabled,
.vr-datepicker [data-vc-years-year]:disabled {
  color: var(--vr-text-muted);
}

.vr-datepicker [data-vc-date-disabled] [data-vc-date-btn] {
  text-decoration: line-through;
  opacity: 0.6;
}

.vr-datepicker [data-vc-date-today] [data-vc-date-btn] {
  box-shadow: inset 0 0 0 var(--vr-border-width-md) var(--vr-border-strong);
  font-weight: var(--vr-font-weight-bold);
}

.vr-datepicker [data-vc-date-selected] [data-vc-date-btn],
.vr-datepicker [data-vc-months-month][aria-selected="true"],
.vr-datepicker [data-vc-years-year][aria-selected="true"] {
  background: var(--vr-ink);
  color: var(--vr-on-ink);
  font-weight: var(--vr-font-weight-bold);
}

.vr-datepicker [data-vc="calendar"] button:focus-visible,
.vr-datepicker [data-vc="calendar"] [tabindex="0"]:focus-visible,
.vr-datepicker [data-vc="calendar"]:focus-visible {
  outline: var(--vr-focus-width) solid var(--vr-focus);
  outline-offset: calc(-1 * var(--vr-focus-width));
  border-radius: var(--vr-radius-lg);
}

.vr-time-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vr-space-1-5) var(--vr-space-2);
  margin-top: var(--vr-space-2);
  padding-top: var(--vr-space-2);
  font-size: var(--vr-font-size-2);
}

.vr-time-row label {
  font-weight: var(--vr-font-weight-bold);
}

.vr-time-row .vr-time {
  width: 6rem;
  height: var(--vr-control-height-sm);
  min-height: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.vr-tz {
  margin-left: auto;
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

.vr-cal-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-1-5);
  margin-top: var(--vr-space-2);
  padding-top: var(--vr-space-2);
}

/* ---- Numbers ------------------------------------------------------------------------------------
   Text inputs with a numeric keypad: right-aligned tabular digits, no spinners. With a unit, the
   input group is the one field box; the input and the unit inside it have no box of their own. */

.vr-number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.vr-table .vr-number {
  min-width: 5rem;
}

.input-group:has(> .vr-number) {
  flex-wrap: nowrap;
  align-items: stretch;
  border: var(--vr-border-width) solid var(--vr-border-strong);
  border-radius: var(--vr-radius-lg);
}

.input-group:has(> .vr-number):hover {
  border-color: var(--vr-border-strong-hover);
}

.input-group:has(> .vr-number) > .vr-number,
.input-group:has(> .vr-number) > .vr-number:focus,
.input-group:has(> .vr-number) > .vr-number[aria-invalid="true"],
.input-group:has(> .vr-number) > .input-group-text {
  min-height: calc(var(--vr-control-height) - 2 * var(--vr-border-width));
  background: transparent;
  border: 0;
  box-shadow: none;
  outline: none;
}

.input-group:has(> .vr-number) > .input-group-text {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
  font-weight: var(--vr-font-weight-bold);
}

.input-group:has(> .vr-number) > .input-group-text:last-child {
  padding-left: 0;
}

.input-group:has(> .vr-number):focus-within {
  border-color: var(--vr-focus);
  box-shadow: var(--vr-field-focus-ring);
}

.input-group:has(> .vr-number[aria-invalid="true"], > .vr-number.is-invalid) {
  border-color: var(--vr-danger-border);
  box-shadow: var(--vr-field-invalid-ring);
}

.input-group:has(> .vr-number[aria-invalid="true"], > .vr-number.is-invalid) > .input-group-text {
  color: var(--vr-danger-text);
}

/* ---- Files --------------------------------------------------------------------------------------
   Without JavaScript the native input shows as a Bootstrap form-control. Once ready, the native
   input is visually hidden but keeps keyboard focus, and the drop zone shows that focus. */

.vr-file-field .vr-drop,
.vr-file-field .vr-file-name {
  display: none;
}

.vr-file-ready {
  position: relative;
}

.vr-file-ready .vr-file-native {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.vr-file-ready .vr-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--vr-space-1);
  margin: 0;
  padding: var(--vr-space-6) var(--vr-space-4);
  background: var(--vr-surface);
  color: var(--vr-text-muted);
  border-radius: var(--vr-radius-xl);
  box-shadow: var(--vr-shadow-panel);
  text-align: center;
  cursor: pointer;
}

.vr-file-ready .vr-drop:hover,
.vr-file-ready .vr-drop.vr-drop-over {
  background: var(--vr-surface-hover);
}

.vr-file-ready:has(.vr-file-native:focus-visible) .vr-drop {
  box-shadow: var(--vr-field-focus-ring);
}

.vr-file-ready:has(.vr-file-native[aria-invalid="true"]) .vr-drop {
  box-shadow: var(--vr-field-invalid-ring);
}

.vr-file-ready:has(.vr-file-native:disabled) .vr-drop {
  cursor: default;
  opacity: 0.6;
}

.vr-drop .vr-icon {
  color: var(--vr-ink);
  font-size: var(--vr-font-size-8);
}

.vr-drop-title {
  color: var(--vr-pen);
  font-weight: var(--vr-font-weight-semibold);
  text-decoration: underline;
}

.vr-drop-hint {
  font-size: var(--vr-font-size-1);
}

.vr-file-ready .vr-file-name {
  display: block;
  margin: var(--vr-space-1-5) 0 0;
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
  overflow-wrap: anywhere;
}

.vr-file-chosen .vr-file-name {
  color: var(--vr-text);
  font-weight: var(--vr-font-weight-semibold);
}

.vr-file-current {
  margin-bottom: var(--vr-space-1);
}

/* ---- Search boxes: one clear button, never WebKit's own --------------------------------------- */

input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  appearance: none;
}

.vr-search-input {
  padding-right: var(--vr-space-8);
}

.vr-search-clear {
  position: absolute;
  right: var(--vr-space-1);
  bottom: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--vr-space-8);
  height: var(--vr-control-height);
  padding: 0;
  background: transparent;
  color: var(--vr-text-muted);
  border: 0;
  border-radius: var(--vr-radius-lg);
}

.vr-search-clear:hover {
  color: var(--vr-text);
}

.vr-search-clear:focus-visible {
  outline: var(--vr-focus-width) solid var(--vr-focus);
  outline-offset: calc(-1 * var(--vr-focus-width));
}

.vr-search-clear[hidden] {
  display: none;
}

:has(> .vr-search-input) {
  position: relative;
}

.form-control-sm.vr-search-input + .vr-search-clear {
  height: 100%;
}

/* ---- Disclosure: one pattern, <details> with a <summary> ---------------------------------------
   The marker is a chevron that turns when open; the summary is a full-width, focusable row. */

details > summary {
  display: flex;
  align-items: baseline;
  gap: var(--vr-space-1-5);
  list-style: none;
  cursor: pointer;
}

details > summary:not(.card-header) {
  width: fit-content;
  max-width: 100%;
  color: var(--vr-text);
  font-weight: var(--vr-font-weight-semibold);
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "";
  flex: none;
  align-self: center;
  width: 0.75em;
  height: 0.75em;
  background-color: currentColor;
  /* Bootstrap's own select chevron, as a mask in the text colour: pointing right while closed. */
  mask: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") center / contain no-repeat;
  transform: rotate(-90deg);
  transition: transform 0.15s var(--vr-ease);
}

details[open] > summary::before {
  transform: rotate(0deg);
}

details > summary:not(.card-header):hover {
  color: var(--vr-pen);
}

details > summary:focus-visible {
  outline: var(--vr-focus-width) solid var(--vr-focus);
  outline-offset: var(--vr-focus-offset);
  border-radius: var(--vr-radius-sm);
}

details[open] > summary:not(.card-header) {
  margin-bottom: var(--vr-space-2);
}

/* A collapsible panel's summary is its card header (includes/panel.html): it keeps the header's
   look and only gains the marker; closed, it has no rule under it. */
details.card:not([open]) > summary.card-header {
  border-bottom: 0;
}

@media (prefers-reduced-motion: reduce) {
  details > summary::before,
  .vr-ts-caret {
    transition: none;
  }
}

/* ---- Tooltips (Bootstrap, from title attributes; controls.js) --------------------------------- */

.tooltip {
  --bs-tooltip-bg: var(--vr-ink);
  --bs-tooltip-color: var(--vr-on-ink);
  --bs-tooltip-opacity: 1;
  --bs-tooltip-font-size: var(--vr-font-size-1);
  --bs-tooltip-border-radius: var(--vr-radius-lg);
  --bs-tooltip-padding-x: var(--vr-space-3);
  --bs-tooltip-padding-y: var(--vr-space-2);
}

.tooltip-inner {
  box-shadow: var(--vr-shadow-raised);
  line-height: var(--vr-line-height-snug);
  text-align: left;
}

/* ================================================================ Line diagram

   Each laboratory area is a coloured line (--vr-line-*: accents only, never status). On the
   dashboard its work queues are stations along it: a ring when work waits, a tick when empty. A
   sample record shows its route from receipt to report. These dots, rings and stubs are shapes of
   the diagram, not icons (docs/ui-standards.md section 12). */

[data-family="sales"] {
  --vr-line: var(--vr-line-sales);
}

[data-family="intake"] {
  --vr-line: var(--vr-line-intake);
}

[data-family="bench"] {
  --vr-line: var(--vr-line-bench);
}

[data-family="release"] {
  --vr-line: var(--vr-line-release);
}

[data-family="lab"] {
  --vr-line: var(--vr-line-lab);
}

[data-family="setup"] {
  --vr-line: var(--vr-line-setup);
}

/* Dashboard: one lane per area, side by side from 1200px. */
.vr-lines {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--vr-space-3);
  padding: var(--vr-space-2) var(--vr-space-4) var(--vr-space-4);
}

@media (min-width: 768px) {
  .vr-lines {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .vr-lines {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.vr-line {
  padding: var(--vr-space-3) var(--vr-space-3) var(--vr-space-2);
  border-radius: var(--vr-radius-lane);
  background: var(--vr-lane);
}

.vr-line-name {
  display: flex;
  align-items: center;
  gap: var(--vr-space-2);
  margin: 0 0 var(--vr-space-3);
  padding: 0 var(--vr-space-1);
  color: var(--vr-text-strong);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-black);
  letter-spacing: var(--vr-tracking-label);
  text-transform: uppercase;
}

.vr-line-roundel {
  flex: none;
  width: var(--vr-station-lg);
  height: var(--vr-station-lg);
  border-radius: 50%;
  background: var(--vr-line);
}

.vr-line-total {
  margin-left: auto;
  padding: 0 var(--vr-space-2);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-surface);
  color: var(--vr-text);
  font-weight: var(--vr-font-weight-bold);
}

.vr-stations {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* The line joining the stations. */
.vr-stations::before {
  content: "";
  position: absolute;
  top: var(--vr-space-3);
  bottom: var(--vr-space-5);
  left: calc(var(--vr-space-1) + var(--vr-station-lg) / 2 - var(--vr-line-width) / 2);
  width: var(--vr-line-width);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-line);
}

.vr-station {
  position: relative;
  display: grid;
  grid-template-columns: var(--vr-station-lg) minmax(0, 1fr) auto;
  column-gap: var(--vr-space-2-5);
  align-items: start;
  margin-bottom: var(--vr-space-1);
  padding: var(--vr-space-1-5) var(--vr-space-1);
  border-radius: var(--vr-radius-lg);
}

.vr-station[data-state="active"]:hover {
  background: var(--vr-station-hover);
}

.vr-station-dot {
  position: relative;
  z-index: var(--vr-z-raised);
  justify-self: center;
  width: var(--vr-station-lg);
  height: var(--vr-station-lg);
  border: var(--vr-border-width-xl) solid var(--vr-line);
  border-radius: 50%;
  background: var(--vr-surface);
}

/* An empty station is a short tick on the line. */
.vr-station[data-state="zero"] .vr-station-dot {
  width: 0.5rem;
  height: var(--vr-line-width);
  margin-top: var(--vr-space-2);
  border: 0;
  border-radius: var(--vr-radius-pill);
  background: var(--vr-line);
  transform: translateX(0.25rem);
}

.vr-station-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--vr-space-1);
  min-width: 0;
}

/* The queue link covers the whole station, so the station is one target. */
.vr-station .vr-queue-link {
  color: var(--vr-text-strong);
  font-weight: var(--vr-font-weight-semibold);
  line-height: var(--vr-line-height-snug);
  text-decoration: none;
}

.vr-station .vr-queue-link:hover {
  color: var(--vr-pen);
}

.vr-station .vr-queue-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--vr-radius-lg);
}

.vr-station .vr-queue-label {
  color: var(--vr-text-muted);
  line-height: var(--vr-line-height-snug);
}

.vr-station-old {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

.vr-station-count {
  min-width: var(--vr-station-lg);
  padding: 0 var(--vr-space-2);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-count);
  color: var(--vr-on-count);
  font-size: var(--vr-font-size-2);
  font-weight: var(--vr-font-weight-black);
  line-height: var(--vr-line-height-base);
  text-align: center;
}

.vr-station[data-state="zero"] .vr-station-count {
  background: transparent;
  color: var(--vr-text-muted);
  font-weight: var(--vr-font-weight-regular);
}

/* Record: the sample's route, six stops on one line. Done stops are filled in the Intake colour;
   the current stop is a ring with a soft halo in the hold tone; pending stops and segments are
   --vr-line-pending. */
.vr-journey {
  margin-bottom: var(--vr-space-5);
  padding: var(--vr-space-4) var(--vr-space-6) var(--vr-space-3-5);
  border-radius: var(--vr-radius-xl);
  background: var(--vr-surface);
  box-shadow: var(--vr-shadow-panel);
}

.vr-journey ol {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0;
  padding: 0;
}

.vr-stop {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--vr-space-0-5);
  padding-top: calc(var(--vr-station-lg) + var(--vr-space-2));
}

.vr-stop::before {
  content: "";
  position: absolute;
  top: calc(var(--vr-station-lg) / 2 - var(--vr-line-width) / 2);
  left: 0;
  right: 0;
  height: var(--vr-line-width);
  background: var(--vr-line-pending);
}

.vr-stop:first-child::before {
  left: calc(var(--vr-station-lg) / 2);
}

.vr-stop:last-child::before,
.vr-stop[data-stop="current"]::before {
  right: auto;
  width: calc(var(--vr-station-lg) / 2);
}

.vr-stop[data-stop="done"]::before,
.vr-stop[data-stop="current"]::before {
  background: var(--vr-line-intake);
}

.vr-stop-dot {
  position: absolute;
  z-index: var(--vr-z-raised);
  top: 0;
  left: 0;
  width: var(--vr-station-lg);
  height: var(--vr-station-lg);
  border: var(--vr-border-width-xl) solid var(--vr-line-pending);
  border-radius: 50%;
  background: var(--vr-surface);
}

.vr-stop[data-stop="done"] .vr-stop-dot {
  border-color: var(--vr-line-intake);
  background: var(--vr-line-intake);
}

.vr-stop[data-stop="current"] .vr-stop-dot {
  border: var(--vr-line-width) solid var(--vr-text-strong);
  box-shadow: 0 0 0 var(--vr-line-width) var(--vr-hold-bg);
}

.vr-stop-name {
  font-size: var(--vr-font-size-2);
  font-weight: var(--vr-font-weight-bold);
}

.vr-stop[data-stop="next"] .vr-stop-name {
  color: var(--vr-text-muted);
  font-weight: var(--vr-font-weight-semibold);
}

.vr-stop-sub {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

.vr-stop[data-stop="current"] .vr-stop-sub {
  color: var(--vr-hold-text);
  font-weight: var(--vr-font-weight-bold);
}

/* Phones: the route reads top to bottom. */
@media (max-width: 767.98px) {
  .vr-journey ol {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--vr-space-3);
  }

  .vr-stop {
    padding: 0 0 0 calc(var(--vr-station-lg) + var(--vr-space-3));
  }

  .vr-stop::before {
    display: none;
  }
}

/* A dropdown toggle that carries its own chevron (i-chevron-down) drops Bootstrap's caret. */
.dropdown-toggle:has(> .vr-caret)::after {
  display: none;
}

.vr-caret {
  font-size: 0.875em;
}

/* ================================================================ Print

   The light paper palette whatever the screen mode (its tokens are in the Tokens section), and
   no chrome. */

@media print {
  body,
  .vr-app:not(.vr-entrance-page) {
    background: var(--vr-paper);
  }

  .vr-main,
  .vr-shell {
    background: none !important; /* print only: the sheet is the paper */
    border-radius: 0;
  }

  .vr-topbar,
  .vr-sidenav,
  .vr-page-actions,
  .vr-grid-toolbar,
  .vr-chips,
  .vr-bulkbar,
  .vr-pagination,
  .vr-section-tabs,
  .vr-page-toc,
  .vr-skip,
  .vr-main .btn,
  .dt-layout-row:last-child {
    display: none !important; /* print only: beats Bootstrap's display utilities */
  }

  .vr-shell {
    display: block;
  }

  .vr-main {
    padding: 0;
  }

  /* Without fills and shadows a panel needs an edge on paper. */
  .card {
    break-inside: avoid-page;
    border: var(--vr-border-width) solid var(--vr-border);
  }

  .vr-form-actions {
    position: static;
  }

  /* A quote prints as the document alone: no versions, decision forms or history. */
  .vr-main:has(> .vr-quote-document) > :not(.vr-quote-document) {
    display: none !important;
  }

  .vr-quote-document {
    border: 0;
  }

  .vr-quote-document > .card-header,
  .vr-quote-document > .card-body {
    padding-left: 0;
    padding-right: 0;
    background: transparent;
  }
}

/* core.widgets.ListOrOtherWidget: the text input appears only while "Other" is selected. */
.vr-other-input {
  display: none;
  margin-top: var(--vr-space-1-5);
}

.vr-other:has(option[value="__other__"]:checked) .vr-other-input {
  display: block;
}
