/*
 * OpenBGA Lab Ops application theme for Bootstrap 5.3: Damson.
 *
 * 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 mauve
 * 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).
 * Damson plum 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.
   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;
}

/* Damson, light: a pale mauve shell (top bar and sidebar are one surface), a soft off-white
   ground, panels separated by tone rather than lines, damson plum 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: #eee8ed;
  --vr-topbar-text: #2d252c;
  --vr-topbar-text-rgb: 45, 37, 44;
  --vr-topbar-text-muted: #625961; /* nav group labels and icons */
  --vr-topbar-field: #fbf9fb; /* client lookup */
  --vr-topbar-field-border: #857e84;
  --vr-topbar-field-text: #2d252c;
  --vr-topbar-field-muted: #625961;
  --vr-topbar-accent: #8a4894; /* focus on the shell */
  --vr-shell-chip: #e4dce3; /* laboratory name */
  --vr-shell-hover: #e6dde4;
  --vr-shell-current: #75427c; /* the current nav item */
  --vr-on-shell-current: #fcf5fc;

  /* Ground, panels, text */
  --vr-paper: #f5f2f4; /* content ground behind the panels */
  --vr-surface: #fdfcfd; /* panels and table cards */
  --vr-surface-2: #f4f0f4; /* counts, wells, history items */
  --vr-surface-hover: #eee9ee;
  --vr-raised: #fdfcfd; /* menus, dialogs, popovers */
  --vr-border: #ded9de; /* a hairline, only where one is still needed */
  --vr-text: #282428;
  --vr-text-strong: #1e1a1d; /* titles and emphasised values */
  --vr-text-muted: #615b61;
  --vr-placeholder: #696268;
  --vr-selection: #f4def7; /* selected rows, chips, matched text, ::selection */

  /* Action, links, focus */
  --vr-ink: #8a4894; /* primary button, current page, checked controls */
  --vr-ink-rgb: 138, 72, 148;
  --vr-ink-hover: #6d3a76;
  --vr-on-ink: #fef8ff;
  --vr-pen: #7f4389; /* links */
  --vr-pen-rgb: 127, 67, 137;
  --vr-pen-hover: #5d2f65;
  --vr-pen-hover-rgb: 93, 47, 101;
  --vr-focus: #8a4894;
  --vr-pencil: #a8392c; /* the required mark and struck prior values */

  /* Fields (treatment A): a 1px outline, a plum ring and halo on focus */
  --vr-border-strong: #857e84; /* field outline, checkbox and radio edge: 3:1 on every surface */
  --vr-border-strong-hover: #696368;
  --vr-focus-halo: rgba(138, 72, 148, 0.16);

  /* Buttons */
  --vr-button-secondary: #ede9ed;
  --vr-button-secondary-hover: #e4dee3;

  /* Tables */
  --vr-th-bg: #f4f0f3;
  --vr-row-stripe: #f8f5f7;
  --vr-row-hover: #f6ecf7;

  /* 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: #554f54;
  --vr-neutral-text-rgb: 85, 79, 84;
  --vr-neutral-bg: #ece9ec;
  --vr-neutral-border: #918b90;
  --vr-info-text: #22577a;
  --vr-info-text-rgb: 34, 87, 122;
  --vr-info-bg: #e2edf2;
  --vr-info-border: #6b93ad;
  --vr-progress-text: #494889;
  --vr-progress-bg: #eaeaf5;
  --vr-progress-border: #8588b8;
  --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: #8d2c4f;
  --vr-hold-bg: #f6e6e9;
  --vr-hold-border: #bc7689;

  /* Line diagram: one accent colour per area of work (clients, service desk, records, setup),
     never a status */
  --vr-line-clients: #a76941;
  --vr-line-records: #977e43;
  --vr-line-desk: #4c8689;
  --vr-line-setup: #7e787d;
  --vr-line-pending: #d3ced3;
  --vr-lane: #f5f2f5;
  --vr-station-hover: #eee9ee;
  --vr-count: #efe3f0;
  --vr-on-count: #472a4b;

  /* Scrollbars */
  --vr-scrollbar: #c1bac0;
  --vr-scrollbar-hover: #928b91;
  --vr-scrollbar-active: #756d74;

  /* Elevation: soft layers, never a hard offset */
  --vr-shadow-panel: 0 1px 2px rgba(37, 31, 36, 0.05), 0 2px 10px rgba(37, 31, 36, 0.04);
  --vr-shadow-raised: 0 8px 24px rgba(37, 31, 36, 0.14), 0 2px 6px rgba(37, 31, 36, 0.06);
  --vr-shadow-dialog: 0 24px 60px rgba(37, 31, 36, 0.22), 0 4px 12px rgba(37, 31, 36, 0.08);
  --vr-shadow-button: 0 1px 2px rgba(37, 31, 36, 0.12);
  --vr-shadow-current: 0 1px 2px rgba(37, 31, 36, 0.1);
  --vr-shadow-scroll-top: 0 6px 14px -8px rgba(37, 31, 36, 0.22);
  --vr-shadow-scroll-bottom: 0 -6px 14px -8px rgba(37, 31, 36, 0.22);
  --vr-shadow-scroll-side: 6px 0 14px -8px rgba(37, 31, 36, 0.22);
  --vr-backdrop: rgba(37, 31, 36, 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: #fcfafc;
  --vr-help-step: #75427c;
  --vr-on-help-step: #fcf5fc;
  --vr-help-tip-bg: #f8eff9;
  --vr-help-label-bg: #f0ecf0;
  --vr-help-mark: #fcd8f7;
  --vr-help-shadow: -12px 0 32px rgba(37, 31, 36, 0.09), -1px 0 0 rgba(37, 31, 36, 0.06);
}

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

  --vr-topbar-bg: #1e171e;
  --vr-topbar-text: #eae4e9;
  --vr-topbar-text-rgb: 234, 228, 233;
  --vr-topbar-text-muted: #b8aab6;
  --vr-topbar-field: #2f252e;
  --vr-topbar-field-border: #8e848c;
  --vr-topbar-field-text: #eae4e9;
  --vr-topbar-field-muted: #b8aab6;
  --vr-topbar-accent: #e5bceb;
  --vr-shell-chip: #2f252e;
  --vr-shell-hover: #2b212a;
  --vr-shell-current: #d1a0d8;
  --vr-on-shell-current: #27152a;

  --vr-paper: #211a20;
  --vr-surface: #292228;
  --vr-surface-2: #30272f;
  --vr-surface-hover: #393038;
  --vr-raised: #312830;
  --vr-border: #3d333b;
  --vr-text: #e7e0e6;
  --vr-text-strong: #f3eff2;
  --vr-text-muted: #b5abb3;
  --vr-placeholder: #aea4ad;
  --vr-selection: #532c5a;

  --vr-ink: #dba9e2;
  --vr-ink-rgb: 219, 169, 226;
  --vr-ink-hover: #e6bfeb;
  --vr-on-ink: #2a172e;
  --vr-pen: #e0b2e6;
  --vr-pen-rgb: 224, 178, 230;
  --vr-pen-hover: #efd1f2;
  --vr-pen-hover-rgb: 239, 209, 242;
  --vr-focus: #e0b2e6;
  --vr-pencil: #f09c87;

  --vr-border-strong: #8e848c;
  --vr-border-strong-hover: #aca2ab;
  --vr-focus-halo: rgba(219, 169, 226, 0.2);

  --vr-button-secondary: #382f36;
  --vr-button-secondary-hover: #433841;

  --vr-th-bg: #30272f;
  --vr-row-stripe: #2c242b;
  --vr-row-hover: #3c2c3e;

  --vr-neutral-text: #d0c8cf;
  --vr-neutral-text-rgb: 208, 200, 207;
  --vr-neutral-bg: #393038;
  --vr-neutral-border: #8a7e88;
  --vr-info-text: #b3d6e8;
  --vr-info-text-rgb: 179, 214, 232;
  --vr-info-bg: #1f3540;
  --vr-info-border: #5f8aa1;
  --vr-progress-text: #c8cbf0;
  --vr-progress-bg: #2a2b41;
  --vr-progress-border: #797bab;
  --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: #f2b6c5;
  --vr-hold-bg: #38252a;
  --vr-hold-border: #ab6c7e;

  --vr-line-clients: #d09b7c;
  --vr-line-records: #cfb274;
  --vr-line-desk: #7eb8bc;
  --vr-line-setup: #a59fa4;
  --vr-line-pending: #494048;
  --vr-lane: #2c242b;
  --vr-station-hover: #393038;
  --vr-count: #433745;
  --vr-on-count: #f2def5;

  --vr-scrollbar: #514850;
  --vr-scrollbar-hover: #756b74;
  --vr-scrollbar-active: #90858e;

  --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(9, 6, 9, 0.6);

  --vr-help-bg: #271f26;
  --vr-help-step: #dba9e2;
  --vr-on-help-step: #2a172e;
  --vr-help-tip-bg: #39273b;
  --vr-help-label-bg: #382f36;
  --vr-help-mark: #5d445a;
  --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; /* printed documents 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-tag: 6px; /* small tiles and label chips: squarer than a pill */
  --vr-radius-lg: 10px; /* fields, nav items, table rows, menu options */
  --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-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-touch-target: 2.75rem; /* 44px: the least a touch control measures on phones */
  --vr-thumbbar-height: 4rem; /* the phone bottom bar, without the device's safe area */
  --vr-sheet-max-height: 85vh; /* a bottom sheet leaves the top of the page in view */
  --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: #ece4ee;
  --vr-scene-headline: #2a1c2c;
  --vr-scene-subline: #5a4a5c;
}

[data-bs-theme="dark"] .vr-scene {
  --vr-scene-sky: #120c16;
  --vr-scene-headline: #f3ecf4;
  --vr-scene-subline: #c2b2c6;
}

.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: #fffeff;
    --vr-surface: #fffeff;
    --vr-surface-2: #f5f3f5;
    --vr-surface-hover: #fffeff;
    --vr-raised: #fffeff;
    --vr-border: #c1bac0;
    --vr-text: #1e1a1d;
    --vr-text-strong: #000000;
    --vr-text-muted: #474246;
    --vr-placeholder: #474246;
    --vr-selection: #ffffff;
    --vr-ink: #47294b;
    --vr-ink-rgb: 71, 41, 75;
    --vr-ink-hover: #47294b;
    --vr-on-ink: #ffffff;
    --vr-pen: #5d2f65;
    --vr-pen-rgb: 93, 47, 101;
    --vr-pen-hover: #5d2f65;
    --vr-pen-hover-rgb: 93, 47, 101;
    --vr-pencil: #8f1f18;
    --vr-border-strong: #615b60;
    --vr-th-bg: #f3f1f3;
    --vr-row-stripe: #fffeff;
    --vr-row-hover: #ffffff;
    --vr-focus: #8a4894;
    --vr-focus-halo: rgba(138, 72, 148, 0.16);
    --vr-border-strong-hover: #615b60;
    /* Status: the light tones' text and edges on white, also when printing from dark mode. */
    --vr-neutral-text: #554f54;
    --vr-neutral-text-rgb: 85, 79, 84;
    --vr-neutral-bg: #fffeff;
    --vr-neutral-border: #918b90;
    --vr-info-text: #22577a;
    --vr-info-text-rgb: 34, 87, 122;
    --vr-info-bg: #ffffff;
    --vr-info-border: #6b93ad;
    --vr-progress-text: #494889;
    --vr-progress-bg: #ffffff;
    --vr-progress-border: #8588b8;
    --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: #8d2c4f;
    --vr-hold-bg: #fffeff;
    --vr-hold-border: #bc7689;
    --vr-danger-border: #8f1f18;
    --vr-danger-solid: #8f1f18;
    --vr-on-danger: #ffffff;
    --vr-line-clients: #a76941;
    --vr-line-records: #977e43;
    --vr-line-desk: #4c8689;
    --vr-line-setup: #7e787d;
    --vr-line-pending: #d3ced3;
    --vr-lane: #fffeff;
    --vr-count: #ffffff;
    --vr-on-count: #1f1920;
    --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 (docs/ui-standards.md section 8, Interaction states). A text link is plum text that takes
   an underline on hover; inside running text it has the underline from the start, so colour is
   never the only cue. A link drawn as a control (button, tile, tab, menu or navigation item)
   answers on its own surface and never underlines. A control carries its component's class, so
   the underline goes only to links without a class and to the named text links below; a
   component that draws a bare <a> as a control turns the underline off in its own rule. */
a {
  text-decoration: none;
  text-underline-offset: 0.2em;
}

a:where(:not([class]), .vr-row-link, .vr-id, .vr-entry-file-name):hover {
  text-decoration: underline;
}

:is(p, .alert, .form-text) a:where(:not([class]), .vr-id) {
  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;
}

/* A request ID (32 hex digits, core.request_logging) in the body text colour (Bootstrap's code
   colour is too light on a striped row), breaking anywhere, so a stacked row on a phone keeps it
   inside its card (Bootstrap's code keeps word-wrap: break-word, which does not shrink). */
.vr-request-id {
  color: var(--vr-text);
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* A value that can be one long unbroken word (a username) wraps anywhere, so its row fits its
   card. */
.vr-break-anywhere {
  overflow-wrap: anywhere;
}

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 plum, 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);
}

/* Quiet (Cancel, Clear all): plum text and no fill at rest; on hover the secondary button's fill,
   as every button answers on its surface, never with an underline. */
.btn-link {
  --bs-btn-color: var(--vr-pen);
  --bs-btn-hover-color: var(--vr-pen-hover);
  --bs-btn-hover-bg: var(--vr-button-secondary);
  --bs-btn-active-color: var(--vr-pen-hover);
  --bs-btn-active-bg: var(--vr-button-secondary-hover);
  text-decoration: none;
}

/* 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 plum 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, plum 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%;
}

/* The box and its label are one target: both show the pointer, and hovering either gives the box
   the field's hover edge (the deeper plum when it is checked, below). Only where a pointer
   hovers: on a touch screen the last box tapped would keep the hover look. */
.form-check-input:not(:disabled),
.form-check-input:not(:disabled) ~ .form-check-label {
  cursor: pointer;
}

@media (hover: hover) {
  .form-check-input:is(:hover, :has(~ .form-check-label:hover)):not(:disabled, :focus) {
    border-color: var(--vr-border-strong-hover);
  }
}

.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);
}

@media (hover: hover) {
  .form-check-input:is(:checked, [type="checkbox"]:indeterminate):is(:hover, :has(~ .form-check-label:hover)):not(:disabled, :focus) {
    background-color: var(--vr-ink-hover);
    border-color: var(--vr-ink-hover);
  }
}

/* Bootstrap's own tick and bar, drawn in the dark-mode ink (--vr-on-ink) on the pale plum 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 plum 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);
}

/* Let the message take a full line when the label and readable text cannot fit together.
   This also works in a narrow record sidebar on a wide screen. */
.alert:has(> .vr-status) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--vr-space-1) var(--vr-space-4);
}

.alert > .vr-status + div {
  flex: 1 1 24ch;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The pill box is centred on the first line of the content (a 1.5 line box). */
.alert > .vr-status {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  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);
}

.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 (an invalid entry or 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);
}

/* ================================================================ Sheets

   A bottom sheet (includes/sheet.html) is Bootstrap's offcanvas-bottom, like the navigation drawer:
   a raised surface with the dialog's rounded top corners, a header (title and Close), a scrolling
   body and an optional sticky footer, over Bootstrap's scrim and above the thumb bar. With
   below="sm" it is a sheet only below 576px; from 576px Bootstrap's offcanvas-sm leaves plain
   inline content (header hidden, body without padding), which the rules below keep untouched. */

.vr-sheet {
  --bs-offcanvas-bg: var(--vr-raised);
  --bs-offcanvas-color: var(--vr-text);
  --bs-offcanvas-border-width: 0;
  --bs-offcanvas-height: auto;
  --bs-offcanvas-padding-x: var(--vr-space-5);
  --bs-offcanvas-padding-y: var(--vr-space-4);
}

.vr-sheet.offcanvas {
  max-height: var(--vr-sheet-max-height);
  border-radius: var(--vr-radius-dialog) var(--vr-radius-dialog) 0 0;
  box-shadow: var(--vr-shadow-dialog);
}

/* A sheet at every width stays a phone-shaped sheet on a wide screen: centred, at the form width. */
@media (min-width: 576px) {
  .vr-sheet.offcanvas {
    width: min(100%, var(--vr-form-width));
    margin-inline: auto;
  }
}

@media (max-width: 575.98px) {
  .vr-sheet.offcanvas-sm {
    max-height: var(--vr-sheet-max-height);
    border-radius: var(--vr-radius-dialog) var(--vr-radius-dialog) 0 0;
    box-shadow: var(--vr-shadow-dialog);
  }
}

.vr-sheet-header {
  justify-content: space-between;
  gap: var(--vr-space-3);
  padding-bottom: var(--vr-space-2);
}

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

.vr-sheet-header .vr-btn-icon {
  flex: none;
}

.vr-sheet-body {
  overscroll-behavior: contain;
}

/* The footer is the sheet's last element: its action row sticks below the scrolling body. */
.vr-sheet-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--vr-space-2);
  padding: var(--vr-space-3) var(--vr-space-5) calc(var(--vr-space-3) + env(safe-area-inset-bottom));
  background: var(--vr-raised);
  box-shadow: var(--vr-shadow-scroll-bottom);
}

/* A section of a sheet's body: a small muted label over its controls. */
.vr-sheet-section-title {
  margin: 0 0 var(--vr-space-2);
  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;
}

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

/* The shell is one pale mauve 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 "Lab Ops". */
.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 (core/lab_profile.html, the portal home): bounded, on a white tile, 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 client 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-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;
}

/* Client 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,
  .vr-shell.vr-shell-bare {
    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-clients {
  --vr-line: var(--vr-line-clients);
}

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

#vr-nav-records,
#vr-nav-quality {
  --vr-line: var(--vr-line-records);
}

#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);
}

/* Where you are: the plum 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);
}

.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 plum
   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);
}

/* ================================================================ 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-grid-filter, > .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 (a city under an organization, a role under a name). */
.vr-sub {
  display: block;
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
}

.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;
}

/* 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;
}

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

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

.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 long 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 title, a
   revision) 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);
}

.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);
}

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

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

[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-grid-filter, .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-box {
  position: relative; /* the field alone, so an error under it does not move the icon */
}

.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: the toolbar collapses behind one "Filter and sort" button (includes/grid_toolbar.html), so
   the rows come first. The button carries the count of active filters, a one-line summary of the
   filters and the sort sits under it, and the toolbar itself (search, filters, Apply, Clear all,
   Columns) and a "Sort by" section open in a bottom sheet (Sheets). From 576px the sheet is plain
   inline content: the toolbar is as before and the button, summary and sort section are not shown. */
.vr-filter-bar,
.vr-sort-section {
  display: none;
}

.vr-filter-button .vr-icon {
  margin-right: var(--vr-space-2);
}

.vr-filter-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5em;
  margin-left: var(--vr-space-2);
  padding: 0 var(--vr-space-1-5);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-ink);
  color: var(--vr-on-ink);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-bold);
  line-height: var(--vr-line-height-base);
}

.vr-filter-summary {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vr-filter-summary .vr-icon {
  width: 0.8125rem;
  height: 0.8125rem;
  vertical-align: -0.125em;
}

/* The sort links copied into the sheet (app.js): the same chips as the table's "Sort by" row. */
.vr-sort-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.vr-sort-chips .vr-sort {
  min-height: var(--vr-touch-target);
  padding: 0 var(--vr-space-3);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-button-secondary);
  color: var(--vr-text);
}

.vr-sort-chips .vr-sort:hover {
  background: var(--vr-button-secondary-hover);
}

.vr-sort-chips .vr-sort[aria-current] {
  background: var(--vr-selection);
  color: var(--vr-text-strong);
}

.vr-sort-chips .vr-sort .vr-icon {
  opacity: 1;
}

@media (max-width: 575.98px) {
  .vr-filter-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--vr-space-1-5);
    padding: var(--vr-space-4) var(--vr-space-5) var(--vr-space-3);
  }

  .vr-filter-summary {
    padding-left: var(--vr-space-1);
  }

  .vr-sort-section:not([hidden]) {
    display: block;
    margin-top: var(--vr-space-5);
  }

  /* The summary replaces the chips row; Clear all stays in the sheet. */
  .vr-grid-filter .vr-chips {
    display: none;
  }

  .vr-grid-sheet .vr-grid-toolbar {
    padding: 0;
  }

  .vr-grid-toolbar .vr-field {
    flex: 1 1 100%;
  }

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

/* From 576px the sheet is inline content: Bootstrap's responsive offcanvas body is a flex row that
   would shrink the form to its content, so it stays a block, as the toolbar always was. */
@media (min-width: 576px) {
  .vr-sheet.vr-grid-sheet .vr-sheet-body {
    display: block;
  }
}

/* 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);
  text-decoration: none;
}

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

/* 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;
}

/* 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. */
/* Ticket form definitions. The native select stays in sync with the enhanced picker. Hidden
   settings retain their values while switching types before save, including without script. */
.vr-form:not(:has([data-vr-field-kind] :is([value="choice"], [value="multiple_choice"]):checked)) .vr-setting-choices,
.vr-form:not(:has([data-vr-field-kind] [value="number"]:checked)) .vr-setting-number,
.vr-form:not(:has([data-vr-field-kind] [value="items"]:checked)) .vr-setting-catalog,
.vr-form:not(:has([data-vr-field-kind] :is([value="choice"], [value="multiple_choice"], [value="number"], [value="items"]):checked)) .vr-form-section:has(.vr-setting-choices),
.vr-form:has([data-vr-field-kind] :is([value="confirmation"], [value="heading"]):checked) .vr-setting-required,
.vr-form:has([data-vr-field-kind] [value="heading"]:checked) .vr-form-section:has(.vr-setting-patient),
.vr-form:has([data-vr-field-kind] :is([value="heading"], [value="date"], [value="time"], [value="datetime"], [value="confirmation"]):checked) .vr-setting-repeat,
.vr-form:has(.vr-setting-patient input:checked) .vr-setting-repeat,
.vr-form:not(:has([name="audience"] [value="client"]:checked)) .vr-setting-repeat {
  display: none;
}

.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);
}

/* Access review (audit_review): one block per account, one row per grant with Keep and Remove side
   by side under its name, on a phone as on a desktop. */
.vr-review-account {
  padding: var(--vr-space-3) 0;
  border-top: var(--vr-border-width) solid var(--vr-border);
}

.vr-review-account > fieldset,
.vr-decision {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.vr-review-account-name {
  float: none;
  width: 100%;
  margin: 0 0 var(--vr-space-2);
  padding: 0;
  font-size: var(--vr-font-size-4);
  font-weight: var(--vr-font-weight-semibold);
}

.vr-decision {
  margin-bottom: var(--vr-space-3);
}

.vr-decision-grant {
  float: none;
  width: 100%;
  margin: 0;
  padding: 0;
  font-size: var(--vr-font-size-4);
}

.vr-decision-choices .vr-choices {
  display: flex;
  flex-wrap: wrap;
  column-gap: var(--vr-space-6);
}

.vr-review-item,
.vr-review-removal {
  margin-bottom: var(--vr-space-2);
}

.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);
}

/* 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-stacked-lead > .vr-record-lead {
  display: grid;
  align-content: start;
  align-self: start;
  gap: var(--vr-space-5);
  min-width: 0;
}

.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-stacked-lead.vr-record-has-aside {
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  }

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

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

  .vr-record-lead > .card:only-child {
    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;
  }
}

/* History timeline: 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-change-list > .vr-section-title {
  margin-top: var(--vr-stack);
}

.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 mauve 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.42dff159f685.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.bb4dec3f1585.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);
}

.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);
}

/* A long option, one unbroken word included, wraps inside the menu rather than past its edge. */
.ts-dropdown .vr-ts-text {
  min-width: 0;
  overflow-wrap: anywhere;
}

.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-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;
}

/* ---- 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);
}

/* Hover: the label and its chevron turn plum. A collapsible panel's title is a heading with a
   colour of its own, so it follows its summary. */
details > summary:hover {
  color: var(--vr-pen);
}

details > summary.card-header:hover .card-title {
  color: inherit;
}

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;
}

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

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

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

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

/* Dashboard panels follow their available width, including while the Help drawer is open. */
.vr-dashboard {
  container: dashboard / inline-size;
}

.vr-dashboard-panels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--vr-space-4);
  align-items: start;
}

@container dashboard (min-width: 56rem) {
  .vr-dashboard-panels {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
}

.vr-dashboard-panels > .card {
  min-width: 0;
}

.vr-dashboard-panels .card-header {
  flex-wrap: nowrap;
}

.vr-dashboard-panels .card-header > .card-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: var(--vr-font-size-6);
}

.vr-dashboard-area {
  display: flex;
  align-items: center;
  gap: var(--vr-space-2);
  margin: 0 0 var(--vr-space-1);
  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-dashboard-area::before {
  content: "";
  flex: none;
  width: var(--vr-space-4);
  height: var(--vr-space-1);
  border-radius: var(--vr-radius-pill);
  background: var(--vr-line);
}

.vr-dashboard-queues {
  padding: 0 var(--vr-space-3) var(--vr-space-3);
}

.vr-dashboard-queues > h3 {
  padding: var(--vr-space-2) var(--vr-space-3);
}

.vr-queue-list,
.vr-dashboard-definitions {
  margin: 0;
  padding: 0;
  list-style: none;
}

.vr-queue-list + h3 {
  margin-top: var(--vr-space-3);
}

.vr-queue-link {
  --vr-queue-ink: var(--vr-neutral-text);
  --vr-queue-tint: var(--vr-neutral-bg);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: var(--vr-space-2-5);
  min-height: var(--vr-touch-target);
  padding: var(--vr-space-2) var(--vr-space-3);
  border-radius: var(--vr-radius-lg);
  color: var(--vr-pen);
}

.vr-queue-link[data-tone="danger"] {
  --vr-queue-ink: var(--vr-danger-text);
  --vr-queue-tint: var(--vr-danger-bg);
}

.vr-queue-link[data-tone="warning"] {
  --vr-queue-ink: var(--vr-warning-text);
  --vr-queue-tint: var(--vr-warning-bg);
}

.vr-queue-link[data-tone="progress"] {
  --vr-queue-ink: var(--vr-progress-text);
  --vr-queue-tint: var(--vr-progress-bg);
}

.vr-queue-link[data-tone="info"] {
  --vr-queue-ink: var(--vr-info-text);
  --vr-queue-tint: var(--vr-info-bg);
}

.vr-queue-list li:nth-child(odd) .vr-queue-link {
  background: var(--vr-row-stripe);
}

.vr-queue-list li .vr-queue-link:hover {
  background: var(--vr-row-hover);
}

.vr-queue-icon {
  display: grid;
  width: var(--vr-space-8);
  height: var(--vr-space-8);
  place-items: center;
  border-radius: var(--vr-radius-lg);
  color: var(--vr-queue-ink);
  background: var(--vr-queue-tint);
}

.vr-queue-copy {
  display: grid;
  gap: var(--vr-space-0-5);
  overflow-wrap: anywhere;
  line-height: var(--vr-line-height-snug);
}

.vr-queue-copy small,
.vr-dashboard-directory small {
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-1);
  font-weight: var(--vr-font-weight-regular);
}

.vr-queue-count {
  color: var(--vr-queue-ink);
  font-size: var(--vr-font-size-7);
  font-weight: var(--vr-font-weight-bold);
}

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

.vr-dashboard-definitions > div + div,
.vr-dashboard-queues > .vr-form-note {
  margin-top: var(--vr-space-3);
}

.vr-dashboard-definitions dd {
  margin: 0;
}

.vr-dashboard-recent {
  container: dashboard-directory / inline-size;
}

.vr-dashboard-directory {
  table-layout: fixed;
}

.vr-dashboard-directory th:first-child {
  width: 53%;
}

.vr-dashboard-directory th:last-child {
  width: 20%;
}

.vr-dashboard-directory .vr-row-link {
  display: grid;
  align-content: center;
  min-height: var(--vr-touch-target);
  line-height: var(--vr-line-height-snug);
  white-space: normal;
  overflow-wrap: anywhere;
}

.vr-dashboard-directory > tbody > tr > :is(th, td) {
  padding-block: var(--vr-space-1);
  vertical-align: middle;
}

.vr-dashboard-directory td.vr-directory-location {
  color: var(--vr-text-muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

.vr-directory-inline-location {
  display: none;
}

@container dashboard-directory (max-width: 29rem) {
  .vr-dashboard-directory .vr-directory-location {
    display: none;
  }

  .vr-directory-inline-location {
    display: inline;
  }

  .vr-dashboard-directory th:first-child {
    width: auto;
  }

  .vr-dashboard-directory th:last-child {
    width: 6rem;
  }
}

/* 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;
}

/* ================================================================ Phones

   Phone layout (docs/ui-standards.md section 13): every page works one-handed on a 360 to
   430 px screen. Below 576px a table's rows become stacked cards, touch controls measure at
   least 44px, and a thumb bar at the bottom holds the menu, the client lookup and the page's
   primary action. Touch screens of any width get the larger controls too. Desktop keeps its
   density. */

@media (max-width: 575.98px), (pointer: coarse) {
  .btn,
  .btn-sm,
  .form-control,
  .form-select,
  .ts-control,
  .vr-topbar-btn,
  .dropdown-item,
  .page-link,
  .vr-navlink {
    min-height: var(--vr-touch-target);
  }

  .vr-topbar-btn,
  .btn-close {
    min-width: var(--vr-touch-target);
    min-height: var(--vr-touch-target);
  }

  /* A number with a unit: the input inside the field box is the target, so it gets the whole
     44px and the box grows by its border (the rule under Numbers subtracts the border). */
  .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: var(--vr-touch-target);
  }

  /* Checkbox and radio: the label is the 44px target and the box sits on its middle line. */
  .form-check {
    min-height: var(--vr-touch-target);
  }

  .form-check > .form-check-input {
    margin-top: calc((var(--vr-touch-target) - 1em) / 2);
  }

  .form-check-label {
    flex-wrap: wrap;
    column-gap: var(--vr-space-2);
  }

  .vr-app-foot {
    align-items: center;
  }

  /* Every control sized from these tokens grows with them: fields, selects, small buttons,
     pager numbers, menu items, sidebar links. */
  :root {
    --vr-control-height: var(--vr-touch-target);
    --vr-control-height-sm: var(--vr-touch-target);
    --vr-nav-item-height: var(--vr-touch-target);
  }

  /* Standalone links and small icon buttons that the tokens do not size. Links inside running
     text keep their line height (WCAG 2.5.8 exempts them). */
  .vr-brand,
  .vr-entrance-brand,
  .form-check-label,
  .card-header a:not(.btn),
  .vr-portal-nav .nav-link,
  .vr-change-more > a,
  .vr-change-list > summary,
  .vr-history-item div > a,
  .vr-change-notes > summary,
  .vr-link-list > li > a,
  .vr-disclosure > summary,
  .vr-app-foot a,
  .vr-entrance-row > a,
  .vr-back-link {
    display: inline-flex;
    align-items: center;
    min-height: var(--vr-touch-target);
  }

  .vr-link-list > li > a {
    min-width: var(--vr-touch-target);
  }

  .vr-chip a,
  .vr-ts-clear,
  .vr-date-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: var(--vr-touch-target);
    min-height: var(--vr-touch-target);
  }
}

/* Screens without hover: what a pointer would reveal on hover is shown from the start. */
@media (hover: none) {
  .vr-sort .vr-icon {
    opacity: 1;
  }
}

/* Stacked rows: each row is a card, its row header the title, every other cell a label (the
   column's header, data-vr-label from app.js) beside its value. A table's totals (tfoot) are one
   more card after the rows. A table marked .vr-table-scroll (an entry grid, genuinely wide data)
   keeps sideways scrolling inside its card instead. */
@media (max-width: 575.98px) {
  .vr-table-wrap:has(> table.vr-table:not(.vr-table-scroll)) {
    overflow: visible;
  }

  /* A table with no sortable column keeps its header for assistive technology only. */
  table.vr-table:not(.vr-table-scroll) > thead:not(:has(.vr-sort)) {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  /* A sortable list keeps its sort links: the header row becomes a wrapping "Sort by" row of
     chips, the same server-side links as on desktop, so sorting works the same on a phone.
     Columns that cannot be sorted drop out of the row (their label is on every card). */
  table.vr-table:not(.vr-table-scroll) > thead:has(.vr-sort) {
    --vr-th-bg: transparent;
    display: block;
    margin-bottom: var(--vr-space-3);
  }

  table.vr-table:not(.vr-table-scroll) > thead:has(.vr-sort) > tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--vr-space-2);
  }

  table.vr-table:not(.vr-table-scroll) > thead:has(.vr-sort) > tr::before {
    content: "Sort by";
    flex: 1 0 100%;
    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;
  }

  table.vr-table:not(.vr-table-scroll) > thead > tr > th:not(:has(.vr-sort)) {
    display: none;
  }

  table.vr-table:not(.vr-table-scroll) > thead > tr > th:has(.vr-sort) {
    position: static;
    display: block;
    padding: 0;
    border-radius: 0;
  }

  table.vr-table:not(.vr-table-scroll) > thead .vr-sort {
    min-height: var(--vr-touch-target);
    padding: 0 var(--vr-space-3);
    border-radius: var(--vr-radius-pill);
    background: var(--vr-button-secondary);
    color: var(--vr-text);
    letter-spacing: normal;
    text-transform: none;
  }

  table.vr-table:not(.vr-table-scroll) > thead [aria-sort] > .vr-sort {
    background: var(--vr-selection);
    color: var(--vr-text-strong);
  }

  table.vr-table:not(.vr-table-scroll),
  table.vr-table:not(.vr-table-scroll) > :is(tbody, tfoot) {
    display: block;
    width: 100% !important;
  }

  table.vr-table:not(.vr-table-scroll) > tfoot {
    margin-top: var(--vr-space-2);
  }

  table.vr-table:not(.vr-table-scroll) > :is(tbody, tfoot) > tr {
    --vr-row-fill: var(--vr-surface-2); /* the cells already paint the row fill */
    display: block;
    padding: var(--vr-space-3) var(--vr-space-4);
    border-radius: var(--vr-radius-lg);
    background: var(--vr-row-fill);
  }

  table.vr-table:not(.vr-table-scroll) > tbody > tr + tr {
    margin-top: var(--vr-space-2);
  }

  table.vr-table:not(.vr-table-scroll) > :is(tbody, tfoot) > tr > :is(th, td) {
    position: static;
    display: flex;
    gap: var(--vr-space-3);
    padding: var(--vr-space-1) 0;
    border: 0;
    border-radius: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  table.vr-table:not(.vr-table-scroll) > :is(tbody, tfoot) > tr > [data-vr-label]::before {
    content: attr(data-vr-label);
    flex: 0 0 38%;
    color: var(--vr-text-muted);
    font-size: var(--vr-font-size-1);
    font-weight: var(--vr-font-weight-semibold);
    letter-spacing: var(--vr-tracking-label);
    text-transform: uppercase;
  }

  table.vr-table:not(.vr-table-scroll) > :is(tbody, tfoot) > tr > th[scope="row"] {
    flex-wrap: wrap;
    padding-bottom: var(--vr-space-2);
    font-size: var(--vr-font-size-3);
  }

  table.vr-table:not(.vr-table-scroll) th[scope="row"] > .vr-row-link {
    min-width: min(var(--vr-touch-target), 100%); /* a touch target, however short the name */
    white-space: normal;
    overflow-wrap: anywhere;
  }

  table.vr-table:not(.vr-table-scroll) > :is(tbody, tfoot) > tr > th[scope="row"]::before {
    content: none;
  }

  /* A link that is a cell's whole value (the card's title, an email address, a count) is a touch
     target, in both dimensions. */
  table.vr-table:not(.vr-table-scroll) > :is(tbody, tfoot) > tr > :is(th, td) > a {
    display: inline-flex;
    align-items: center;
    min-width: var(--vr-touch-target);
    min-height: var(--vr-touch-target);
  }
}

/* When the filter sheet holds the sort links (app.js copies them there), the table's own "Sort by"
   row steps aside; without script it stays. */
@media (max-width: 575.98px) {
  .vr-table-card[data-vr-sort-sheet] table.vr-table:not(.vr-table-scroll) > thead:has(.vr-sort) {
    display: none;
  }
}

/* Client portal on phones: its navigation moves to the bottom edge, within thumb reach. */
@media (max-width: 575.98px) {
  .vr-portal .vr-portal-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: var(--vr-z-topbar);
    display: flex;
    align-items: center;
    min-height: calc(var(--vr-thumbbar-height) + env(safe-area-inset-bottom));
    padding: var(--vr-space-2) var(--vr-space-3) calc(var(--vr-space-2) + env(safe-area-inset-bottom));
    background: var(--vr-topbar-bg);
    box-shadow: var(--vr-shadow-scroll-bottom);
  }

  .vr-portal .vr-main {
    padding-bottom: calc(var(--vr-thumbbar-height) + env(safe-area-inset-bottom) + var(--vr-space-6));
  }
}

/* Thumb bar: the shell's surface along the bottom edge, above the device's safe area. The page's
   primary action (the .btn-primary of page_actions) is placed at its right end. */
.vr-thumbbar {
  display: none;
}

@media (max-width: 575.98px) {
  .vr-thumbbar {
    position: fixed;
    inset: auto 0 0;
    z-index: var(--vr-z-topbar);
    display: flex;
    align-items: center;
    gap: var(--vr-space-1);
    min-height: calc(var(--vr-thumbbar-height) + env(safe-area-inset-bottom));
    padding: var(--vr-space-2) var(--vr-space-3) calc(var(--vr-space-2) + env(safe-area-inset-bottom));
    background: var(--vr-topbar-bg);
    box-shadow: var(--vr-shadow-scroll-bottom);
  }

  .vr-thumbbar-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--vr-space-0-5);
    min-width: var(--vr-touch-target);
    min-height: var(--vr-touch-target);
    padding: var(--vr-space-1) var(--vr-space-2);
    border: 0;
    border-radius: var(--vr-radius-lg);
    background: transparent;
    color: var(--vr-topbar-text);
    font-size: var(--vr-font-size-1);
    font-weight: var(--vr-font-weight-semibold);
    text-decoration: none;
  }

  .vr-thumbbar-btn:hover,
  .vr-thumbbar-btn:active {
    background: var(--vr-shell-hover);
    color: var(--vr-topbar-text);
  }

  .vr-thumbbar-btn:focus-visible {
    outline: var(--vr-focus-width) solid var(--vr-topbar-accent);
    outline-offset: var(--vr-space-0-5);
  }

  .vr-app:has(> .vr-thumbbar) .vr-main {
    padding-bottom: calc(var(--vr-thumbbar-height) + env(safe-area-inset-bottom) + var(--vr-space-6));
  }

  .vr-app:has(> .vr-thumbbar) .vr-page-actions > .btn-primary {
    position: fixed;
    right: var(--vr-space-3);
    bottom: calc(var(--vr-space-2) + (var(--vr-thumbbar-height) - var(--vr-space-4) - var(--vr-touch-target)) / 2 + env(safe-area-inset-bottom));
    z-index: calc(var(--vr-z-topbar) + 1);
  }

  /* The thumb bar holds the menu button on phones. */
  .vr-app:has(> .vr-thumbbar) .vr-topbar > [data-bs-target="#vr-nav"] {
    display: none;
  }
}

/* ================================================================ Request desk

   The request page's composer and conversation (desk/templates/desk/request_detail.html). Which
   entries a client sees is decided on the server; here only the labels: every entry and the
   composer state their visibility in words, with the colour as a second cue. */

/* Give the subject the whole first row. The badges and actions share the next row
   when they fit, in the same order as the underlying record header. */
.vr-ticket-header .vr-page-header-row {
  align-items: center;
  gap: var(--vr-space-2) var(--vr-space-4);
}

.vr-ticket-header .vr-page-header-row > :first-child {
  display: contents;
}

.vr-ticket-header .vr-page-title {
  flex: 0 0 100%;
  min-width: 0;
  font-size: var(--vr-font-size-7);
  overflow-wrap: anywhere;
  text-wrap: wrap;
}

.vr-ticket-header .vr-page-meta {
  flex: 1 1 16rem;
  margin: 0;
}

.vr-ticket-fact-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--vr-space-3) var(--vr-space-6);
}

.vr-ticket-fact-groups h3,
.vr-conversation-day h3 {
  padding-bottom: var(--vr-space-1);
  margin: 0 0 var(--vr-space-2);
  border-bottom: var(--vr-border-width) solid var(--vr-border);
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
  font-weight: var(--vr-font-weight-semibold);
}

.vr-ticket-fact-groups .vr-facts {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--vr-space-2);
}

.vr-ticket-fact-groups dd {
  line-height: var(--vr-line-height-snug);
}

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

.vr-composer .vr-file-ready .vr-drop {
  flex-flow: row wrap;
  justify-content: flex-start;
  gap: var(--vr-space-1) var(--vr-space-2);
  padding: var(--vr-space-2) var(--vr-space-3);
  border: var(--vr-border-width) dashed var(--vr-border-strong);
  box-shadow: none;
  background: var(--vr-surface-2);
  text-align: start;
}

.vr-composer .vr-drop .vr-icon {
  font-size: var(--vr-font-size-4);
}

.vr-composer .vr-drop-hint {
  flex-basis: 100%;
}

.vr-composer-mode .form-check {
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-1-5); /* as a flex item the box loses Bootstrap's gap to its label */
  margin-right: var(--vr-space-4);
}

.vr-composer-visibility {
  display: flex;
  align-items: center;
  gap: var(--vr-space-1-5);
  margin: var(--vr-space-2) 0 0;
  padding: var(--vr-space-2) var(--vr-space-3);
  border-radius: var(--vr-radius);
  background: var(--vr-info-bg);
  color: var(--vr-info-text);
  font-size: var(--vr-font-size-2);
}

.vr-composer-internal {
  display: none;
}

.vr-composer:has(input[name="kind"]:not([value="reply"]):checked) .vr-composer-visibility {
  background: var(--vr-warning-bg);
  color: var(--vr-warning-text);
}

.vr-composer:has(input[name="kind"]:not([value="reply"]):checked) .vr-composer-public {
  display: none;
}

.vr-composer:has(input[name="kind"]:not([value="reply"]):checked) .vr-composer-internal {
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-1-5);
}

.vr-composer-public {
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-1-5);
}

/* The contact's fields belong to "Log contact" only. */
.vr-composer:not(:has(input[name="kind"][value="contact"]:checked)) .vr-composer-contact {
  display: none;
}

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

.vr-entry {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: var(--vr-space-3);
  padding: var(--vr-space-3) var(--vr-space-4);
  border: var(--vr-border-width) solid var(--vr-border);
  border-radius: var(--vr-radius-lg);
  background: var(--vr-surface);
  overflow-wrap: anywhere;
}

.vr-entry > :not(time) {
  grid-column: 2;
}

.vr-entry > time {
  color: var(--vr-text-muted);
  font-variant-numeric: tabular-nums;
  font-size: var(--vr-font-size-2);
}

.vr-entry-note,
.vr-entry-contact {
  border-color: var(--vr-warning-border);
  background: var(--vr-warning-bg);
}

.vr-entry-withdrawn {
  border-style: dashed;
  background: var(--vr-surface-2);
}

.vr-entry-event {
  padding: var(--vr-space-1) var(--vr-space-4);
  border: 0;
  background: none;
  color: var(--vr-text-muted);
  font-size: var(--vr-font-size-2);
}

.vr-entry-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-1) var(--vr-space-3);
  margin-bottom: var(--vr-space-1);
  font-size: var(--vr-font-size-2);
}

.vr-entry-kind {
  display: inline-flex;
  align-items: center;
  gap: var(--vr-space-1-5);
  font-weight: var(--vr-font-weight-semibold);
}

.vr-entry-body > :last-child {
  margin-bottom: 0;
}

.vr-entry-contact {
  margin-bottom: var(--vr-space-2);
}

p.vr-entry-contact {
  border: 0;
  background: none;
}

.vr-guidance {
  margin-top: var(--vr-space-3);
  padding: var(--vr-space-3);
  border-radius: var(--vr-radius);
  background: var(--vr-info-bg);
  color: var(--vr-info-text);
}

.vr-record-pager {
  display: flex;
  justify-content: space-between;
  gap: var(--vr-space-2);
  margin-bottom: var(--vr-space-3);
}

.vr-view-menu .dropdown-item {
  display: flex;
  justify-content: space-between;
  gap: var(--vr-space-4);
}

.vr-find {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--vr-space-3);
}

.vr-find .vr-grid-search {
  flex: 1 1 20rem;
}

.vr-plain-list {
  margin: 0;
  padding-left: var(--vr-space-4);
}

/* The request list's bulk actions: one compact row of choices above the table. */
.vr-bulkbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--vr-space-2) var(--vr-space-3);
  padding: 0 var(--vr-space-5) var(--vr-space-3);
}

.vr-bulkbar > .vr-field {
  flex: 0 1 14rem;
  margin: 0;
}

.vr-bulkbar > .vr-form-note {
  flex: 1 0 100%;
}

.vr-bulk-master,
.vr-bulk-trigger {
  display: none;
}

/* Keep the selection action in thumb reach while the operator moves through phone cards. */
@media (max-width: 575.98px) {
  [data-vr-bulk-enhanced] .vr-bulk-master {
    display: inline-flex;
    align-items: center;
    gap: var(--vr-space-2);
    min-height: var(--vr-touch-target);
  }

  .vr-table-card:has(input[name="requests"]:checked) [data-vr-bulk-enhanced] .vr-bulk-trigger {
    position: fixed;
    z-index: var(--vr-z-topbar);
    right: var(--vr-space-3);
    bottom: calc(var(--vr-thumbbar-height) + env(safe-area-inset-bottom) + var(--vr-space-2));
    display: inline-flex;
    align-items: center;
    gap: var(--vr-space-2);
    box-shadow: var(--vr-shadow-dialog);
  }

  .vr-bulk-sheet .vr-bulkbar {
    display: grid;
    padding: 0;
  }

  /* The native POST and individual checkboxes remain usable without Bootstrap. */
  form:not([data-vr-bulk-enhanced]) > .vr-bulk-sheet {
    position: static;
    visibility: visible;
    height: auto;
    max-height: none;
    transform: none;
    box-shadow: none;
  }

  form:not([data-vr-bulk-enhanced]) .vr-sheet-header {
    display: none;
  }

  .vr-clock-badge {
    display: grid;
    min-width: 0;
    justify-items: start;
    gap: var(--vr-space-1);
  }

  .vr-clock-badge .vr-status,
  .vr-clock-badge time {
    white-space: normal;
  }
}

/* ================================================================ 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-grid-filter,
  .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;
  }

}

/* 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;
}

/* ================================================================ Clients and portal
   On a phone the organization page's "On this page" anchors are its section switcher, so each is
   a full touch target (ui-standards section 13). */

@media (max-width: 575.98px), (pointer: coarse) {
  .vr-page-toc a {
    display: inline-flex;
    align-items: center;
    min-height: var(--vr-touch-target);
  }
}

/* ===================================================================== Service clocks */
/* The request page's two clocks (service_levels/_request_clock.html): one line each on a phone,
   side by side when there is room. The state is a .vr-status with its glyph and words. */
.vr-clocks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--vr-space-3);
  padding: var(--vr-space-2) var(--vr-space-3);
  border-radius: var(--vr-radius);
  background: var(--vr-surface-2);
  font-size: var(--vr-font-size-2);
}

.vr-clock-name {
  font-weight: var(--vr-font-weight-semibold);
}

.vr-request-links .vr-empty {
  padding: var(--vr-space-2) var(--vr-panel-inset) var(--vr-space-3);
  text-align: start;
}

.vr-request-links .vr-empty-title {
  font-size: var(--vr-font-size-2);
}

.vr-request-links .vr-empty-body {
  max-width: none;
  margin: 0;
}

/* ================================================================ Ticket forms
   The portal service menu (request_forms/_service_grid.html): one full-width tile per form on a
   phone, the whole tile a touch target; two columns from 576px, three from 992px. The item-list
   field (request_forms/widgets/items.html): one row per catalog item, the quantity box at the
   end of the row within thumb reach. */

.vr-service-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--vr-space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

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

@media (min-width: 992px) {
  .vr-service-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.vr-service-tile {
  display: flex;
  align-items: center;
  gap: var(--vr-space-3);
  height: 100%;
  min-height: calc(var(--vr-touch-target) * 1.5);
  padding: var(--vr-space-3);
  color: var(--vr-text);
  text-decoration: none;
  background: var(--vr-surface);
  border: var(--vr-border-width) solid var(--vr-border);
  border-radius: var(--vr-radius-lg);
  transition: background-color var(--vr-motion-fast) var(--vr-ease),
    border-color var(--vr-motion-fast) var(--vr-ease);
}

.vr-service-tile:hover {
  color: var(--vr-text);
  background: var(--vr-surface-hover);
  border-color: var(--vr-border-strong);
}

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

.vr-service-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: var(--vr-touch-target);
  height: var(--vr-touch-target);
  font-size: var(--vr-font-size-5);
  color: var(--vr-progress-text);
  background: var(--vr-progress-bg);
  border-radius: var(--vr-radius);
}

.vr-service-tile-other .vr-service-icon {
  color: var(--vr-neutral-text);
  background: var(--vr-neutral-bg);
}

.vr-service-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--vr-space-0-5);
  min-width: 0;
}

.vr-service-label {
  font-weight: var(--vr-font-weight-semibold);
  line-height: var(--vr-line-height-snug);
  color: var(--vr-text-strong);
}

.vr-service-desc {
  font-size: var(--vr-font-size-2);
  line-height: var(--vr-line-height-snug);
  color: var(--vr-text-muted);
}

.vr-service-go {
  flex: none;
  color: var(--vr-text-muted);
}

.vr-items-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border: var(--vr-border-width) solid var(--vr-border);
  border-radius: var(--vr-radius);
}

.vr-items-row {
  display: flex;
  align-items: center;
  gap: var(--vr-space-3);
  min-height: var(--vr-touch-target);
  padding: var(--vr-space-2) var(--vr-space-3);
}

.vr-items-row + .vr-items-row {
  border-top: var(--vr-border-width) solid var(--vr-border);
}

.vr-items-label {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: var(--vr-space-0-5);
  min-width: 0;
  margin: 0;
}

.vr-items-name {
  font-weight: var(--vr-font-weight-medium);
}

.vr-items-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--vr-space-2);
  font-size: var(--vr-font-size-2);
  color: var(--vr-text-muted);
}

.vr-items-qty {
  flex: none;
  width: calc(var(--vr-touch-target) * 2);
}

.vr-items-qty .form-control {
  min-height: var(--vr-touch-target);
  text-align: end;
}

/* A section heading inside a request form (request_forms/_layout.html). */
.vr-form-heading {
  padding-top: var(--vr-space-2);
  border-top: var(--vr-border-width) solid var(--vr-border);
}

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

/* The form details inside the staff request page's Request panel, and the intake slot. */
.vr-form-details,
.vr-intake {
  display: flex;
  flex-direction: column;
  gap: var(--vr-stack);
  margin-top: var(--vr-stack);
}

.vr-form-details-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--vr-space-2);
}

/* ======================================================================= Attachments (M2-B) */
/* The file picker (attachments/widgets/files.html) and an entry's file list
   (attachments/_entry_files.html). The picker reuses the frame's drop zone (.vr-file-field,
   .vr-file-ready); these rules add the list of chosen files and an entry's files. */
.vr-files-list {
  margin: var(--vr-space-2) 0 0;
}

.vr-files-item,
.vr-entry-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--vr-space-1) var(--vr-space-3);
  min-height: var(--vr-touch-target);
}

.vr-files-name,
.vr-entry-file-name {
  overflow-wrap: anywhere;
}

.vr-files-problem {
  color: var(--vr-danger-text);
  margin: var(--vr-space-2) 0 0;
}

.vr-entry-files {
  margin: var(--vr-space-2) 0 0;
}

/* The composer offers files for a reply or a note, not for a logged contact. */
.vr-composer:has(input[name="kind"][value="contact"]:checked) .vr-composer-files:not(:has([data-vr-files-retry])) {
  display: none;
}

.vr-entry-file-withdrawn .vr-entry-file-name {
  text-decoration: line-through;
}

/* ================================================================ Session warning
   The warning before automatic sign-out (includes/session_warning.html, static/js/session.js): a
   confirmation-sized alert dialog (.vr-confirm-dialog), which may open over the form dialog. The
   countdown keeps its width as it changes. On a phone the dialog sits at the bottom of the screen,
   above the device's safe area, with full-width buttons and the primary one last, in thumb reach. */
.vr-session-countdown {
  font-variant-numeric: tabular-nums;
  font-weight: var(--vr-font-weight-bold);
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .vr-session-warning .modal-dialog-centered {
    align-items: flex-end;
    min-height: calc(100% - 2 * var(--bs-modal-margin) - env(safe-area-inset-bottom));
    margin-bottom: calc(var(--bs-modal-margin) + env(safe-area-inset-bottom));
  }

  .vr-session-warning .modal-footer {
    flex-direction: column;
    align-items: stretch;
    gap: var(--vr-space-2);
  }

  .vr-session-warning .modal-footer > * {
    margin: 0;
  }

  .vr-session-warning .modal-footer .btn {
    width: 100%;
  }
}
