/* =====================================================================
   Danube Bridge Vidin - Calafat platform: design system
   Style "K - Stays + chart": pale steel sidebar with the fan of stays,
   one accent - the blue of the logo (#0072BC) - the chart graticule and
   the two banks (green = BG, red = RO) as graphic motifs.
   Palette "G - Deep water" (2026-10-06, mock-up .claude/design/soft-palette.html,
   variant d2): a blue-grey page (#DCE4EA) with a dot graticule, the panels are
   near-white "sheets" on it (line + soft shadow), inputs stay pure white.
   Contrast: WCAG AA - text >= 4.5:1 on the page, the panels and the tinted
   surfaces (sidebar, soft, paper); control borders and the focus ring >= 3:1.
   Links / accent text placed directly on the page use --color-link (#005A96 there,
   the accent #0072BC gives only 4.0:1 on #DCE4EA); inside cards the accent stays.
   The grey of the logo (#808285) is decorative only, never text.

   Sections:
     1. Tokens            5. Components (buttons, fields, select2, segmented, panel,
                             note, kv, grid-2, badge, tag, filters, table, pager, dialog;
                             fleet: tabs, plate, calcbox, card-grid, fieldset, row actions;
                             passages: status, direction, choice, fee, week, trip card,
                             bridge chart, attention, stat; payments: pay form,
                             invoice fields, payment list, stacked table)
     2. Base              6. Auth layout (layouts/auth.php) + error pages (errors/page.php)
     3. Utilities         7. App layout (layouts/app.php): sidebar, logo, nav, burger
     4. Typography        8. Responsive (<= 820px, touch) and reduced motion
   ===================================================================== */

/* 1. Tokens ----------------------------------------------------------- */
:root {
    /* Colors. Contrast in the comments: on the panel #F4F7F9 / on the page #DCE4EA /
       on the sidebar #D8E1E7 (a single value = on the panel). Panels are one step off white
       (2026-10-06, soft palette "w2"); the fields stay the lightest. */
    --color-bg: #DCE4EA;              /* the page behind the panels ("deep water") */
    --color-surface: #F4F7F9;         /* panels, cards, dialogs, the active menu item, table scroll shadows */
    --color-field: #FAFBFC;           /* inputs and select boxes: the lightest, they stand out (ink 15.2, muted 6.0) */
    --color-logo-band: #FFFFFF;       /* the band behind the logo (the logo has a white ground) */
    --color-ink: #172431;             /* 14.6 / 12.3 / 11.9 */
    --color-muted: #526273;           /* 5.8 / 4.9 / 4.7 - secondary text, labels, placeholders */
    --color-line: #C3D0DA;            /* decorative dividers, card borders, the sidebar edge */
    --color-control: #6E7F91;         /* 3.8 / 3.2 / 3.1 - borders of inputs, selects, buttons (soft 3.6, field 4.0) */
    --color-control-hover: #5E6F80;   /* 4.8 / 4.0 / 3.9 */
    --color-soft: #EAF0F3;            /* table head / hover, disabled: ink 13.7, muted 5.4, accent 4.4 (!) -> links there use accent-hover 6.3 */
    --color-paper: #EDF2F5;           /* calcbox, today, attention, payment list: ink 14.0, muted 5.6, accent 4.5 */
    --color-accent: #0072BC;          /* 4.7 / 4.0 (never text on the page) - the logo blue */
    --color-accent-hover: #005A96;    /* 6.7 / 5.6 / 5.5 */
    --color-accent-active: #004A7C;   /* 8.6 / 7.2 / 7.0 */
    --color-accent-soft: #E8F2FA;
    --color-accent-ink: #FFFFFF;      /* on the accent: 5.1 */
    /* Links: the accent inside cards; the darker blue directly on the page (.main, .auth-form). */
    --color-link: var(--color-accent);
    --color-link-hover: var(--color-accent-hover);
    --color-link-on-bg: #005A96;      /* 5.6 on the page */
    --color-link-on-bg-hover: #004A7C; /* 7.2 on the page */
    --color-nav-ink: #3E5063;         /* 7.7 / 6.5 / 6.3 */
    --color-sidebar: #D8E1E7;
    --color-steel: #AFC0CF;           /* decorative (fan of stays) */
    --color-steel-light: #C9D5E0;
    --color-water: #CFDDE8;
    --color-depth: #8FB0C4;
    --color-logo-grey: #808285;       /* decorative only */
    --color-bank-bg: #15704A;         /* 5.7 / 4.7 / 4.6 - Bulgaria (green) */
    --color-bank-ro: #B8261C;         /* 5.9 / 4.9 / 4.8 - Romania (red) */
    --color-ok: #1A6F45;              /* 5.7 / 4.8 (paper 5.5, soft 5.4) */
    --color-warn: #8A5A00;            /* 5.5 / 4.6 (paper 5.3, soft 5.2) */
    --color-bad: #B3261E;             /* 6.1 / 5.1 */
    --color-bad-hover: #971F19;
    --color-bad-line: #C9544C;        /* 4.0 / 3.4 - border of the outline danger button */
    --color-bad-soft: #FBEFEE;
    --color-info: #1D5FA8;            /* 6.0 / 5.0 */
    --color-val: #6B4FA0;             /* 6.0 / 5.0 */
    --color-done: #3E5063;            /* 7.7 / 6.5 */
    --color-scrim: rgba(23, 36, 49, .28);
    --color-sidebar-veil: rgba(216, 225, 231, .94);

    /* Chart graticule: dots at the crossings of a 44px grid (lines were mistaken for card borders) */
    --grid-size: 44px;
    --grid-dot: radial-gradient(circle at 1px 1px, rgba(0, 90, 150, .2) 1.1px, transparent 1.4px);
    --grid-dot-strong: radial-gradient(circle at 1px 1px, rgba(0, 90, 150, .26) 1.1px, transparent 1.4px);

    /* Radii */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-pill: 999px;

    /* Fonts (see App\Libraries\FontSource; fallback stacks keep the layout if they fail).
       Manrope is the self-hosted VARIABLE font (wght 200-800): the weights below are
       the design weights + 60 for a denser text. IBM Plex Mono is static (400-700):
       the mono rules keep plain 500 / 600 - an in-between value would snap to the
       next static file. */
    --font-sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    --fw-body: 560;                   /* running text (was 500) */
    --fw-semi: 660;                   /* labels, navigation, buttons, links (was 600) */
    --fw-bold: 760;                   /* headings, values, b / strong (was 700) */
    --fw-black: 820;                  /* reserved (was 800) */

    /* Layout */
    --sidebar-width: 236px;
    --auth-form-width: 520px;
    --tap-size: 40px;
    --topbar-height: 61px;
    /* Gap kept above an element scrolled into view (#hash, focus()); grows under the mobile top bar */
    --anchor-offset: 12px;
    /* Cards on the page: a hairline shadow + a soft lift (panel, note, register option, active menu item) */
    --shadow-panel: 0 1px 2px rgba(10, 50, 80, .08), 0 8px 20px rgba(10, 50, 80, .07);
    /* The sidebar edge: only to the right (negative spread - nothing above / below) */
    --shadow-sidebar: 4px 0 12px -4px rgba(10, 50, 80, .16);
    /* The phone drawer: the same direction, stronger - it lies over the page */
    --shadow-drawer: 8px 0 24px -6px rgba(10, 50, 80, .22);
    --shadow-dialog: 0 18px 48px rgba(23, 36, 49, .18);
    --focus-ring: 2px solid var(--color-accent);
    --transition-drawer: .22s ease;
}

/* 2. Base ------------------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--color-bg);
    color: var(--color-ink);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: var(--fw-body);
    line-height: 1.5;
    color-scheme: light;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
    margin: 0;
    font-weight: var(--fw-bold);
    text-wrap: balance;
}

/* The UA "bold" / "bolder" would give 700 / 900 - the variable font takes the token. */
b,
strong,
th {
    font-weight: var(--fw-bold);
}

p {
    margin: 0;
}

a {
    color: var(--color-link);
}

a:hover {
    color: var(--color-link-hover);
}

a:active {
    color: var(--color-accent-active);
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

::placeholder {
    color: var(--color-muted);
    opacity: 1;
}

:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

svg {
    display: block;
}

/* 3. Utilities -------------------------------------------------------- */
/* [hidden] always wins over the display of components (e.g. .field is a grid). */
[hidden] {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.muted {
    color: var(--color-muted);
}

.small {
    font-size: 12.5px;
}

.mono {
    font-family: var(--font-mono);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

/* 4. Typography ------------------------------------------------------- */
h1 {
    font-weight: var(--fw-bold);
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.2;
    letter-spacing: -.02em;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
    justify-content: space-between;
}

.eyebrow {
    display: block;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 12px;
    color: var(--color-muted);
}

/* 5. Components ------------------------------------------------------- */

/* Buttons: pill shaped; .btn-primary is the one main action of a screen. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-ink);
    font-weight: var(--fw-semi);
    font-size: 14px;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
}

.btn:hover {
    border-color: var(--color-control-hover);
    background: var(--color-soft);
    color: var(--color-ink);
}

.btn-primary {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

.btn-primary:hover {
    border-color: var(--color-accent-hover);
    background: var(--color-accent-hover);
    color: var(--color-accent-ink);
}

.btn-primary:active {
    border-color: var(--color-accent-active);
    background: var(--color-accent-active);
}

.btn-lg {
    padding: 12px 18px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Export buttons of a list (administrator), part of the page head actions. */
.export-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Forms */
.form {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    /* One column that never grows past the field: a long value (select2) is cut, not the page widened. */
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 5px;
    min-width: 0;
}

.field label,
.field-label {
    font-size: 12.5px;
    font-weight: var(--fw-semi);
    color: var(--color-muted);
}

.field input,
.field select {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-md);
    background: var(--color-field);
}

.field input:hover,
.field select:hover {
    border-color: var(--color-control-hover);
}

.field input:focus-visible,
.field select:focus-visible,
.field input:is([type="date"], [type="time"], [type="datetime-local"]):focus-within {
    outline: var(--focus-ring);
    outline-offset: 1px;
    border-color: var(--color-accent);
}

.field-hint {
    font-size: 12.5px;
    color: var(--color-muted);
}

.field-error {
    font-size: 12.5px;
    font-weight: var(--fw-semi);
    color: var(--color-bad);
}

.field-error a {
    margin-left: 4px;
    color: var(--color-link);
}

.field.has-error input,
.field.has-error select {
    border-color: var(--color-bad);
}

/* Enhanced selects (select2 4.1, public/assets/vendor/select2, loaded by app.js section 10 only
   on pages with a select). The look of .field select: 44px, the control border, the blue focus.
   app.css is after select2.min.css in the cascade, so these rules win at the same specificity. */
/* Never wider than its field: the container, the box and the chosen text may all shrink to it;
   a long chosen value ends with "…" (the whole text is in the open list). */
.select2-container {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    font-size: 14px;
}

/* The open list lives in its own .select2-container, a direct child of <body> placed with
   position:absolute (left = the field's left). 100% there meant the width of the page from
   that point and widened it sideways; it takes the width of its list (= the field, set inline
   by select2) instead. */
body > .select2-container {
    width: auto;
}

.select2-container--default .select2-selection--single {
    display: flex;
    align-items: center;
    height: auto;
    min-height: 44px;
    min-width: 0;
    max-width: 100%;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-md);
    background: var(--color-field);
}

.select2-container--default .select2-selection--single:hover {
    border-color: var(--color-control-hover);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    padding: 0 34px 0 12px;
    color: var(--color-ink);
    line-height: 1.4;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: var(--color-muted);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 0;
    right: 8px;
    width: 20px;
    height: 100%;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
    border-color: var(--color-nav-ink) transparent transparent;
    border-width: 6px 5px 0;
    margin-left: -5px;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent var(--color-nav-ink);
    border-width: 0 5px 6px;
}

/* The open list is a separate card under (or above) the field: the field keeps its round corners. */
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single,
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single {
    border-radius: var(--radius-md);
}

.select2-container--default .select2-selection--single:focus-visible,
.select2-container--default.select2-container--open .select2-selection--single {
    outline: var(--focus-ring);
    outline-offset: 1px;
    border-color: var(--color-accent);
}

.field.has-error .select2-container--default .select2-selection--single {
    border-color: var(--color-bad);
}

.select2-container--default.select2-container--disabled .select2-selection--single {
    background: var(--color-soft);
    cursor: default;
}

.select2-dropdown {
    border: 1px solid var(--color-control);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: 0 10px 28px rgba(23, 36, 49, .14);
    overflow: hidden;
}

.select2-container--open .select2-dropdown--below {
    margin-top: 4px;
    border-top: 1px solid var(--color-control);
    border-radius: var(--radius-md);
}

.select2-container--open .select2-dropdown--above {
    margin-top: -4px;
    border-bottom: 1px solid var(--color-control);
    border-radius: var(--radius-md);
}

.select2-search--dropdown {
    padding: 8px;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-sm);
    background: var(--color-field);
}

.select2-container--default .select2-search--dropdown .select2-search__field:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 1px;
    border-color: var(--color-accent);
}

.select2-container--default .select2-results > .select2-results__options {
    max-height: 280px;
}

.select2-results__option {
    padding: 9px 12px;
    color: var(--color-ink);
}

.select2-container--default .select2-results__option--selected {
    background: var(--color-accent-soft);
    font-weight: var(--fw-semi);
}

.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

.select2-container--default .select2-results__option--disabled {
    color: var(--color-muted);
}

.select2-results__message {
    color: var(--color-muted);
}

.field-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
    gap: 12px;
}

/* Checkbox with its label text on the right: one row, the box on the first line of the text,
   a long text wraps next to the box (not under it). The whole label is the click target (>= 24px high).
   "label.check" / "input[type=checkbox]" outweigh ".field label" / ".field input" (a check inside a .field). */
label.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 24px;
    padding: 2px 0;
    font-size: 12.5px;
    font-weight: var(--fw-body);
    line-height: 20px;
    color: var(--color-ink);
    cursor: pointer;
}

.check input[type="checkbox"] {
    flex: none;
    width: 18px;
    height: 18px;
    min-width: 0;
    min-height: 0;
    margin: 1px 0 0;
    padding: 0;
    font-size: inherit;
    accent-color: var(--color-accent);
    cursor: pointer;
}

.check input[type="checkbox"]:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.check > span {
    min-width: 0;
}

.check a {
    font-weight: var(--fw-semi);
}

.check.has-error {
    color: var(--color-bad);
}

/* The box itself is marked like the other fields with an error (a native checkbox takes no reliable border).
   Focus stays different: the blue focus ring further out instead of the red one. */
.check.has-error input[type="checkbox"] {
    outline: 2px solid var(--color-bad);
    outline-offset: 1px;
}

.check.has-error input[type="checkbox"]:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 3px;
}

/* Segmented control: native radios styled as pills (works without JS). */
.seg-field {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.seg {
    display: inline-flex;
    flex-wrap: wrap;
    max-width: 100%;
    padding: 3px;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
}

.seg-option {
    position: relative;
    display: inline-flex;
}

.seg-option input {
    position: absolute;
    inset: 0;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.seg-option span {
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    font-weight: var(--fw-semi);
    font-size: 13px;
    color: var(--color-nav-ink);
    cursor: pointer;
}

.seg-option input:checked + span {
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

.seg-option input:focus-visible + span {
    outline: var(--focus-ring);
    outline-offset: 1px;
}

/* Keyboard focus on the group: the same outer ring as the other fields, so it is clearly
   visible even when the focused option is the selected (accent) one. */
.seg:has(input:focus-visible) {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

/* The focused selected option: an inner light ring marks which pill has the focus. */
.seg-option input:checked:focus-visible + span {
    outline: 2px solid var(--color-accent-ink);
    outline-offset: -4px;
}

/* Panel: a light "sheet" on the page - line + soft shadow */
.panel {
    display: grid;
    gap: 12px;
    align-content: start;
    min-width: 0;
    padding: 16px 18px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-panel);
}

/*
 * Links directly on the page (#DCE4EA) take the darker blue (5.6:1); every card with its own
 * near-white ground brings the logo blue back (4.7:1 on the panel). A card type missing here only gets the
 * darker blue - still AA.
 */
.main,
.auth-form {
    --color-link: var(--color-link-on-bg);
    --color-link-hover: var(--color-link-on-bg-hover);
}

.panel,
.note,
.dialog,
.register-option,
.choice,
.calcbox,
.table-wrap,
.tabs,
.seg {
    --color-link: var(--color-accent);
    --color-link-hover: var(--color-accent-hover);
}

.panel h2 {
    font-weight: var(--fw-bold);
    font-size: 15px;
}

/* Note: flash messages and hints; the left edge carries the meaning. */
.note {
    --note-color: var(--color-info);
    padding: 10px 14px;
    border: 1px solid var(--color-line);
    border-left: 3px solid var(--note-color);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    box-shadow: var(--shadow-panel);
    font-size: 13.5px;
}

/* A note inside a card is part of it: no lift of its own. */
.panel .note,
.dialog .note {
    box-shadow: none;
}

.note ul {
    margin: 4px 0 0;
    padding-left: 18px;
}

.note-success {
    --note-color: var(--color-ok);
}

.note-error {
    --note-color: var(--color-bad);
}

.note-warning {
    --note-color: var(--color-warn);
}

/* The error summary shown inside the form with the errors (components/form_error_summary)
   replaces the one at the top of the page (partials/flash). Browsers without :has() show both. */
.main:has(.form-error-summary) .flash-summary-only,
.main:has(.form-error-summary) .flash-summary {
    display: none;
}

/* Request / payment numbers and plates in running text never break (passage_text_html()). */
.nowrap {
    white-space: nowrap;
}

/* Key / value list */
.kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 6px 16px;
    margin: 0;
    font-size: 13.5px;
}

.kv dt {
    color: var(--color-muted);
}

.kv dd {
    margin: 0;
    font-weight: var(--fw-body);
    overflow-wrap: anywhere;
}

/* Language switch: "BG · EN" */
.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    font-weight: var(--fw-semi);
    color: var(--color-muted);
}

.lang-switch a {
    color: var(--color-muted);
    text-decoration: none;
}

.lang-switch a:hover {
    color: var(--color-ink);
    text-decoration: underline;
}

.lang-switch .is-current {
    color: var(--color-ink);
    font-weight: var(--fw-bold);
}

/* Buttons for destructive actions: outline in the list of actions, solid in the confirmation. */
.btn-danger {
    border-color: var(--color-bad);
    background: var(--color-bad);
    color: var(--color-accent-ink);
}

.btn-danger:hover {
    border-color: var(--color-bad-hover);
    background: var(--color-bad-hover);
}

.btn-danger-outline {
    border-color: var(--color-bad-line);
    color: var(--color-bad);
}

.btn-danger-outline:hover {
    border-color: var(--color-bad);
    color: var(--color-bad-hover);
    background: var(--color-bad-soft);
}

/* Form parts: read-only value in a form, the row of submit buttons */
.field-static {
    font-weight: var(--fw-semi);
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 2px;
}

/* Two columns of panels (one column on narrow screens) */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    gap: 16px;
    align-items: start;
}

/* Panel whose content (a table) runs to its edges */
.panel-flush {
    padding: 0;
    overflow: hidden;
}

.panel-subtitle {
    margin-top: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--color-line);
    font-weight: var(--fw-bold);
    font-size: 14px;
}

/* Back link above a page title */
.back-link {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 12.5px;
    font-weight: var(--fw-semi);
    text-decoration: none;
}

.back-link::before {
    content: "\2190\00a0";
}

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

/* Badge: a status as a soft pill with a coloured dot (the colour carries the meaning). */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    background: var(--color-soft);
    color: var(--color-nav-ink);
    font-size: 12px;
    font-weight: var(--fw-semi);
    line-height: 1.5;
    white-space: nowrap;
}

.badge::before {
    content: "";
    flex: none;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.badge-ok {
    color: var(--color-ok);
}

.badge-bad {
    color: var(--color-bad);
}

.badge-warn {
    color: var(--color-warn);
}

.badge-info {
    color: var(--color-info);
}

/* Tag: a neutral label (e.g. a user group), no dot */
.tag {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-sm);
    color: var(--color-nav-ink);
    font-size: 12px;
    font-weight: var(--fw-semi);
    white-space: nowrap;
}

/* Filters above a list: search + selects + buttons on one wrapping line */
.filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
}

.filters .field {
    flex: 1 1 170px;
}

/* One control height in a filter row: a date input and a select differ by a few
   pixels by default, which moved the labels of the row out of line. */
.filters .field input,
.filters .field select {
    height: 44px;
}

.filters .filters-search {
    flex: 2 1 260px;
}

/* Dates need less room; the owner select (long names) gets more, so
   "All owners" is never cut at 1366px */
.filters .filters-date {
    flex: 1 1 150px;
}

.filters .filters-owner {
    flex: 2 1 260px;
}

/* Selects whose default option is long ("All statuses", "All vehicles"): wide enough
   for it at 14px and at 16px (phones / touch), so it is not cut with "…" on desktop. */
.filters .filters-wide {
    flex: 1 1 260px;
}

.filters-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* The buttons of a filter row have the height of its fields (44px), so the row
   lines up at the bottom whether the buttons stay on the line or wrap together. */
.filters-actions .btn {
    min-height: 44px;
}

/* The fields and the buttons keep their order; when there is no room the buttons
   wrap as one group to the next line. */
.filters > .filters-actions {
    order: 1;
}

/* A note that belongs to the whole filter block (e.g. the full "Name · email" of the
   chosen owner): always its own line under the fields AND the buttons - the fields
   keep one height, so the labels and the controls stay aligned. */
.filters .filters-note {
    flex: 1 0 100%;
    order: 2;
    margin: -4px 0 0;
}

/* Desktop / tablet: the fields grow only up to a sensible width. Without a cap the
   last field of a wrapped line (e.g. "Currency" with 3 options) stretched to the end
   of the row; now the free room stays on the right. The dates are capped too, else
   they would take the room the capped selects leave on their line. Phones (<=640px)
   keep one field per line (media query below). */
@media (min-width: 641px) {
    .filters .field {
        max-width: 240px;
    }

    .filters .filters-date {
        max-width: 200px;
    }

    .filters .filters-wide {
        max-width: 320px;
    }

    .filters .filters-search {
        max-width: 400px;
    }

    /* Same width as the standalone owner filter (.owner-filter .field). */
    .filters .filters-owner {
        max-width: 360px;
    }
}

/* Phones: two selects of 170px shared one line and cut the default option
   ("All statuses", "All vehicles"). Every select field gets its own line; the
   two dates stay side by side (a date needs less room). */
@media (max-width: 640px) {
    .filters .field:not(.filters-date) {
        flex-basis: 100%;
    }

    /* A field on its own line has no neighbour to keep in line with: a long chosen
       value wraps (the field grows) instead of ending with "…". The arrow is 100% of
       the field's height, so it stays centred. */
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        padding-top: 10px;
        padding-bottom: 10px;
        white-space: normal;
        overflow-wrap: anywhere;
        text-overflow: clip;
    }
}

/* Table: scrolls sideways inside .table-wrap on narrow screens. Edge shadows
   show that there is more: the two surface-coloured "covers" move with the
   content (local) and hide the fixed shadows (scroll) at the start / the end. */
.table-wrap {
    /* Positioned: absolutely positioned content (e.g. .visually-hidden in the last
       column) stays inside the scroll box instead of widening the page. */
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background:
        linear-gradient(to right, var(--color-surface) 30%, transparent) left center / 40px 100% no-repeat local,
        linear-gradient(to left, var(--color-surface) 30%, transparent) right center / 40px 100% no-repeat local,
        radial-gradient(farthest-side at 0 50%, rgba(23, 36, 49, .22), rgba(23, 36, 49, 0)) left center / 16px 100% no-repeat scroll,
        radial-gradient(farthest-side at 100% 50%, rgba(23, 36, 49, .22), rgba(23, 36, 49, 0)) right center / 16px 100% no-repeat scroll;
    background-color: var(--color-surface);
}

.table-wrap:focus-visible {
    outline-offset: -2px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.table th {
    padding: 10px 8px;
    border-bottom: 1px solid var(--color-line);
    color: var(--color-muted);
    font-size: 12px;
    font-weight: var(--fw-semi);
    text-align: left;
    white-space: nowrap;
}

.table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--color-line);
    vertical-align: middle;
}

/* Codes, numbers and dates never break; text cells may wrap. */
.table .mono,
.table .num,
.table .nowrap {
    white-space: nowrap;
}

.table .cell-main {
    min-width: 220px;
}

/* Header that may break into two lines (long label over a narrow column) */
.table .th-wrap {
    min-width: 84px;
    white-space: normal;
}

/* Second line of a cell: the email under the name, the time under a date */
.table .cell-sub {
    display: block;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: var(--fw-body);
}

/* The email under the name: sans (narrower than mono), and only a very long
   one breaks (anywhere) instead of widening the whole table. */
.table .cell-email {
    overflow-wrap: anywhere;
}

.table th:first-child,
.table td:first-child {
    padding-left: 18px;
}

.table th:last-child,
.table td:last-child {
    padding-right: 18px;
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table tbody tr:hover {
    background: var(--color-soft);
}

.table .num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.table .mono {
    font-size: 12.5px;
}

.table .cell-main a {
    font-weight: var(--fw-semi);
    text-decoration: none;
}

.table .cell-main a:hover {
    text-decoration: underline;
}

.empty-state {
    padding: 28px 18px;
    color: var(--color-muted);
    text-align: center;
}

/* Pagination: Previous · 1 2 [3] 4 · Next */
.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pager-pages {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pager-link {
    display: inline-grid;
    place-items: center;
    min-width: var(--tap-size);
    min-height: var(--tap-size);
    padding: 0 12px;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-ink);
    font-weight: var(--fw-semi);
    font-size: 13px;
    text-decoration: none;
}

a.pager-link:hover {
    border-color: var(--color-control-hover);
    background: var(--color-soft);
}

.pager-link.is-current {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

/* Disabled: muted text on a soft ground with a light border - no opacity, the text keeps its contrast. */
.pager-link.is-disabled {
    border-color: var(--color-line);
    background: var(--color-soft);
    color: var(--color-muted);
    cursor: default;
}

/* List of actions with a hint under each button (e.g. admin: user actions) */
.action-list {
    display: grid;
    gap: 14px;
}

.action-item {
    display: grid;
    justify-items: start;
    gap: 6px;
}

/* Confirmation dialog (components/confirm_dialog.php): native <dialog>, modal with JS. */
.dialog {
    width: min(460px, calc(100vw - 32px));
    padding: 0;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    color: var(--color-ink);
    box-shadow: var(--shadow-dialog);
}

/* Without JS the dialog is rendered "open" (non-modal): keep it centred above the page. */
.dialog[open]:not(:modal) {
    position: fixed;
    inset: 0;
    z-index: 40;
    margin: auto;
    height: fit-content;
}

.dialog::backdrop {
    background: var(--color-scrim);
}

.dialog-body {
    display: grid;
    gap: 12px;
    padding: 20px 22px;
}

.dialog-title {
    font-weight: var(--fw-bold);
    font-size: 17px;
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 6px;
}

/* ---- Fleet (stage 3): tabs, plate, calculation box, composition cards ---- */

/* Tabs: links between two lists of one register (e.g. towing vehicles / trailers). */
.tabs {
    display: inline-flex;
    flex-wrap: wrap;
    justify-self: start;
    max-width: 100%;
    padding: 3px;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
    padding: 7px 14px;
    border-radius: var(--radius-pill);
    color: var(--color-nav-ink);
    font-weight: var(--fw-semi);
    font-size: 13px;
    text-decoration: none;
}

.tab:hover {
    background: var(--color-soft);
}

.tab.is-active {
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

.tab:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 1px;
}

.tab-count {
    font-variant-numeric: tabular-nums;
}

/* Register switch: two large links between the registers of one list (towing vehicles /
   trailers). Each option says what is inside it (silhouette + description) and how many.
   The silhouettes are the symbols in components/fleet_icons.php. */
.register-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 340px));
    gap: 12px;
}

.register-option {
    position: relative;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    min-height: 76px;
    padding: 12px 18px 12px 14px;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-panel);
    color: var(--color-ink);
    text-decoration: none;
    transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.register-option:hover {
    border-color: var(--color-control-hover);
    background: var(--color-soft);
}

.register-option:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.register-option.is-active {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
    box-shadow: inset 0 0 0 1px var(--color-accent), var(--shadow-panel);
}

/* The silhouette: steel grey; the active one takes the logo blue, wheels included. */
.register-icon {
    width: 64px;
    height: 36px;
    color: var(--color-steel);
}

.register-option:hover .register-icon { color: var(--color-control); }
.register-option.is-active .register-icon { color: var(--color-accent); }

.register-text { display: grid; gap: 2px; min-width: 0; }

.register-title {
    font-size: 16px;
    font-weight: var(--fw-bold);
    line-height: 1.25;
}

.register-desc {
    font-size: 13px;
    font-weight: var(--fw-body);
    line-height: 1.35;
    color: var(--color-muted);
}

.register-count {
    min-width: 36px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--color-soft);
    color: var(--color-nav-ink);
    font: 500 15px var(--font-mono);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.register-option.is-active .register-count {
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

@media (max-width: 640px) {
    /* Phone: one register per row, the same layout as on desktop, only tighter. */
    .register-switch { grid-template-columns: 1fr; gap: 8px; }
    .register-option {
        grid-template-columns: 52px minmax(0, 1fr) auto;
        gap: 12px;
        min-height: 64px;
        padding: 10px 14px 10px 12px;
    }
    .register-icon { width: 52px; height: 30px; }
    .register-title { font-size: 15px; }
    .register-desc { font-size: 12px; }
}

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

/* The wheels of the silhouettes take the surface colour (fill="#fff" is only the fallback). */
.register-wheel { fill: var(--color-surface); }

/* Holder of inline SVG symbols: takes no space. */
.svg-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Registration plate: the plate as typed, framed like a number plate. */
.plate {
    display: inline-block;
    padding: 1px 7px;
    border: 1px solid var(--color-ink);
    border-radius: 5px;
    background: var(--color-surface);
    color: var(--color-ink);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 12.5px;
    line-height: 1.6;
    letter-spacing: .04em;
    white-space: nowrap;
}

.plate-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* Plate input: upper case while typing (the server normalizes anyway). */
.field input.input-plate,
.field input.input-code {
    font-family: var(--font-mono);
    font-weight: 500;
    letter-spacing: .04em;
    text-transform: uppercase;
}

/* Calculation box of a composition: "X axles + Y axles = N axles · A t + B t -> C t" + the category. */
.calcbox {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px dashed var(--color-depth);
    border-radius: 12px;
    background: var(--color-paper);
}

.calcbox-sum {
    color: var(--color-muted);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.calcbox-value {
    color: var(--color-accent);
    font-weight: var(--fw-bold);
    font-size: 22px;
    line-height: 1.25;
}

.calcbox-rule {
    color: var(--color-muted);
    font-size: 12.5px;
}

/* No category matches: the value carries the warning colour. */
.calcbox.is-empty {
    border-color: var(--color-warn);
    background: #FDF8EF;
}

.calcbox.is-empty .calcbox-value {
    color: var(--color-warn);
}

/* Nothing selected yet: only the hint. */
.calcbox.is-idle {
    background: var(--color-surface);
}

/* Cards of named compositions */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 16px;
    align-items: start;
}

.combo-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 6px 12px;
}

.combo-card-head a {
    font-weight: var(--fw-semi);
}

/* Group of form fields with a legend (e.g. the axle / mass bounds of a category) */
.fieldset {
    display: grid;
    gap: 8px;
    min-width: 0;
    margin: 0;
    padding: 12px 14px 14px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
}

.fieldset legend {
    padding: 0 6px;
    font-size: 12.5px;
    font-weight: var(--fw-bold);
    color: var(--color-ink);
}

/* Actions inside a table row: links and POST buttons that look like links */
.row-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
}

.row-actions form,
.order-cell form {
    display: inline;
    margin: 0;
}

.link-btn {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-link);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.link-btn:hover {
    color: var(--color-link-hover);
}

.link-btn:active {
    color: var(--color-accent-active);
}

.table .cell-actions a,
.row-actions a {
    font-weight: var(--fw-semi);
}

/* Order column: position + up / down buttons. Left-aligned, so the heading
   stands over the number (the first item of the cell), not over the arrows. */
.table .order-col {
    text-align: left;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.order-cell {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.order-cell > span {
    min-width: 18px;
    text-align: right;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    color: var(--color-ink);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.icon-btn:hover:not(:disabled) {
    border-color: var(--color-control-hover);
    background: var(--color-soft);
}

.icon-btn:disabled {
    border-color: var(--color-line);
    background: var(--color-soft);
    color: var(--color-muted);
    cursor: default;
}

/* Inactive row (e.g. a deactivated tariff category): kept in the list, muted. */
.table tr.is-inactive td {
    color: var(--color-muted);
}

/* ---- Passages (stage 4): status, direction, request form, fee, schedule, dashboard ---- */

/* Status badges along the life cycle of a request (the dot + label of .badge). */
.badge-val {
    color: var(--color-val);
}

.badge-done {
    color: var(--color-done);
}

.badge-muted {
    color: var(--color-muted);
    background: transparent;
    box-shadow: inset 0 0 0 1px var(--color-line);
}

/* Direction: the banks in the order of travel - green = Bulgaria, red = Romania. */
.dir {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 12.5px;
    white-space: nowrap;
    color: var(--color-ink);
}

.dir::before,
.dir::after {
    content: "";
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-bank-bg);
}

.dir::after {
    order: 3;
    background: var(--color-bank-ro);
}

.dir > span {
    order: 2;
}

.dir.dir-ro::before {
    background: var(--color-bank-ro);
}

.dir.dir-ro::after {
    background: var(--color-bank-bg);
}

/* A segmented choice with its label and error in a fieldset: the pills keep their width. */
.seg-field.field {
    justify-items: start;
}

/* Direction choice of the form: a dot of the bank of departure in each option. */
.seg-direction .seg-option span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.seg-direction .seg-option span::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--color-bank-bg);
}

.seg-direction .seg-option-ro_bg span::before {
    background: var(--color-bank-ro);
}

/* Phone: the two directions share one row 50/50 across the field. Rounded corners instead of
   a pill, so a label that still has to wrap (very narrow screens) stays a clean tile. */
@media (max-width: 640px) {
    .seg-field.field:has(.seg-direction) {
        justify-items: stretch;
    }

    .seg-direction {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 3px;
        width: 100%;
        border-radius: var(--radius-md);
    }

    .seg-direction .seg-option {
        display: flex;
        min-width: 0;
    }

    .seg-direction .seg-option span {
        flex: 1;
        justify-content: center;
        gap: 6px;
        padding: 8px 8px;
        border-radius: var(--radius-sm);
        text-align: center;
    }

    .seg-direction .seg-option span::before {
        flex: none;
    }
}

/* Stacked radio choices with a hint (e.g. "what crosses" of a passage request) */
.choice-list {
    display: grid;
    gap: 6px;
}

.choice {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--color-control);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    cursor: pointer;
}

.choice:hover {
    border-color: var(--color-control-hover);
}

.choice:has(input:checked) {
    border-color: var(--color-accent);
    box-shadow: inset 0 0 0 1px var(--color-accent);
    background: var(--color-accent-soft);
}

.choice input {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--color-accent);
}

.choice-title {
    display: block;
    font-weight: var(--fw-semi);
}

.choice-hint {
    display: block;
    color: var(--color-muted);
    font-size: 12.5px;
}

.fieldset.has-error {
    border-color: var(--color-bad);
}

/* Request form: the fee panel stays in view next to a long form on a desktop. */
.passage-layout {
    align-items: start;
}

@media (min-width: 1100px) {
    .fee-panel {
        position: sticky;
        top: 16px;
    }

    /* With the invoice fields open the panel may be taller than the screen: no sticking
       (the buttons at its bottom must stay reachable). */
    .fee-panel:has(.invoice-toggle:checked) {
        position: static;
    }
}

.fee-box {
    display: grid;
    gap: 12px;
}

.fee-box[aria-busy="true"] {
    opacity: .6;
}

.fee-total {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;
    padding-top: 10px;
    border-top: 1px solid var(--color-line);
    font-size: 14px;
    font-weight: var(--fw-semi);
}

.fee-total b {
    font-size: 26px;
    font-weight: var(--fw-semi);
    line-height: 1.2;
}

.fee-total-sub {
    display: block;
    color: var(--color-muted);
    font-size: 12.5px;
    font-weight: var(--fw-body);
}

.fee-panel .btn-lg {
    justify-self: start;
}

/* "Create and pay" of the request form: "Issue an invoice" (components/invoice_fields) + its hint. */
.create-pay {
    display: grid;
    gap: 6px;
}

/* Request page */
.mono-title {
    font-family: var(--font-mono);
    font-weight: 600;
    letter-spacing: 0;
}

.stack {
    display: grid;
    gap: 16px;
    align-content: start;
    min-width: 0;
}

.panel-flush-title {
    padding: 16px 18px 0;
}

.series-list {
    margin: 0;
    padding: 4px 0 6px;
    list-style: none;
}

.series-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    padding: 8px 18px;
    border-top: 1px solid var(--color-line);
    font-size: 13.5px;
}

.series-list li.is-current {
    background: var(--color-soft);
    font-weight: var(--fw-semi);
}

/* Schedule: week navigation */
.week-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
}

.week-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn.is-current {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* A navigation button without a target (e.g. the edge of the schedule range) */
.btn.is-disabled,
.btn.is-disabled:hover {
    border-color: var(--color-line);
    background: var(--color-soft);
    color: var(--color-muted);
    cursor: default;
}

/* Schedule: the week as 7 columns (scrolls sideways when narrow, a list of days on a phone). */
.week-scroll {
    /* Containing block for absolutely positioned children (e.g. .visually-hidden),
       so they are clipped here instead of widening the page. */
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.week {
    display: grid;
    grid-template-columns: repeat(7, minmax(128px, 1fr));
    min-width: 896px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.week-day {
    display: grid;
    align-content: start;
    gap: 8px;
    min-width: 0;
    min-height: 210px;
    padding: 10px 8px 12px;
    border-right: 1px solid var(--color-line);
}

.week-day:last-child {
    border-right: 0;
}

.week-day.is-today {
    background: var(--color-paper);
}

.week-day-head {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    color: var(--color-muted);
    font-size: 12px;
    font-weight: var(--fw-semi);
}

.week-day.is-today .week-day-head {
    color: var(--color-accent);
}

.week-day-count {
    font-family: var(--font-mono);
    font-weight: 500;
}

.week-day-empty {
    color: var(--color-muted);
    font-size: 12px;
}

.week-trips {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* A request card: the left edge carries the bank of departure. */
.trip {
    --trip-edge: var(--color-bank-bg);
    display: grid;
    gap: 5px;
    padding: 7px 8px;
    border: 1px solid var(--color-line);
    border-left: 3px solid var(--trip-edge);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-ink);
    font-size: 12px;
    text-decoration: none;
}

.trip:hover {
    border-color: var(--color-control-hover);
    border-left-color: var(--trip-edge);
    background: var(--color-soft);
}

.trip.trip-ro {
    --trip-edge: var(--color-bank-ro);
}

.trip-time {
    font-weight: var(--fw-semi);
    font-size: 13px;
}

.trip .plate-row {
    gap: 4px;
}

.trip .plate {
    padding: 0 5px;
    font-size: 11.5px;
}

.trip-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

.trip-meta .badge {
    padding: 1px 7px;
    font-size: 11.5px;
}

/* Cancelled: a dashed, greyed card - no opacity, so the texts keep their contrast;
   the dashes in the control grey (3:1), the light line would hardly show. */
.trip.is-cancelled {
    border-color: var(--color-control);
    border-left-color: var(--trip-edge);
    border-style: dashed;
    border-left-style: solid;
    background: var(--color-soft);
}

.trip.is-cancelled .trip-time {
    text-decoration: line-through;
}

/* Dashboard "Next passages": request cards on a phone instead of the table. */
.next-cards {
    display: none;
    gap: 6px;
    margin: 0;
    padding: 12px 18px 18px;
    list-style: none;
}

@media (max-width: 640px) {
    .next-cards {
        display: grid;
    }

    .next-table {
        display: none;
    }
}

/* Plates in a table cell stay on one line (the table scrolls instead). */
.table .plate-row {
    flex-wrap: nowrap;
}

/* List of requests: the number is the link to the request. */
.table .cell-main-link a {
    font-weight: var(--fw-semi);
    text-decoration: none;
}

.table .cell-main-link a:hover {
    text-decoration: underline;
}

/*
 * IBM Plex Mono is static (400-700): where a sans rule with a weight token (560 / 660)
 * also hits a mono element, the in-between weight would snap to the next file (600 / 700).
 * These keep the weights the mono text had before the variable Manrope.
 */
.table .cell-sub.mono {
    font-weight: 500;
}

.trip-time.mono,
.table .cell-main a.mono,
.table .cell-main-link.mono a,
.table .cell-actions a.mono,
.row-actions a.mono,
.attention-main a.mono,
.bridge-list a.mono {
    font-weight: 600;
}

/* Dashboard: the bridge chart (components/bridge_today.php, inline SVG, colours only from here). */
.bridge-chart {
    display: grid;
    gap: 10px;
}

.bridge-chart svg {
    width: 100%;
    height: auto;
}

.bridge-chart text {
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 11px;
    fill: var(--color-ink);
}

.bc-paper {
    fill: var(--color-paper);
}

.bc-water {
    fill: #DCE6EE;
}

.bridge-chart .bc-river,
.bridge-chart .bc-hour {
    fill: var(--color-muted);
}

.bc-bank-bg {
    fill: #E6F2EC;
}

.bc-bank-ro {
    fill: #F8E8E6;
}

.bridge-chart .bc-bank-bg-text {
    font-size: 12px;
    fill: var(--color-bank-bg);
}

.bridge-chart .bc-bank-ro-text {
    font-size: 12px;
    fill: var(--color-bank-ro);
}

.bc-tick {
    stroke: var(--color-muted);
    stroke-width: 1;
}

.bc-now {
    stroke: var(--color-accent);
    stroke-width: 1;
    stroke-dasharray: 2 3;
}

/* Darker than the accent: the label may sit over the water (the accent gives 4.0:1 there). */
.bridge-chart .bc-now-text {
    fill: var(--color-accent-hover);
}

.bc-line-bg,
.bc-line-ro {
    stroke-width: 2;
}

.bc-line-bg {
    stroke: var(--color-bank-bg);
}

.bc-line-ro {
    stroke: var(--color-bank-ro);
}

.bc-line-bg.is-planned,
.bc-line-ro.is-planned {
    stroke-dasharray: 5 4;
}

.bc-dot-bg {
    fill: var(--color-bank-bg);
}

.bc-dot-ro {
    fill: var(--color-bank-ro);
}

/* Passage labels: a halo in the paper colour keeps the text readable over a line it has to cross. */
.bridge-chart .bc-label {
    paint-order: stroke;
    stroke: var(--color-paper);
    stroke-width: 4px;
    stroke-linejoin: round;
}

/* Bank names: full on wider screens, short on a phone (see below). */
.bridge-chart .bc-bank-short {
    display: none;
}

.bridge-list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.bridge-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 8px 10px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
    font-size: 13px;
}

.bridge-list a {
    font-weight: var(--fw-semi);
}

/* Desktop: the chart carries the labels, the list stays for screen readers only. */
@media (min-width: 641px) {
    .bridge-list {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* Phone: the SVG labels would be ~5px - the chart keeps the lines and bigger bank / hour labels, the list shows the rest. */
@media (max-width: 640px) {
    .bridge-chart .bc-label,
    .bridge-chart .bc-river,
    .bridge-chart .bc-now-text {
        display: none;
    }

    .bridge-chart text,
    .bridge-chart .bc-bank-bg-text,
    .bridge-chart .bc-bank-ro-text {
        font-size: 22px;
    }

    /* At 22px the full bank name would run into the "06:00" label. */
    .bridge-chart .bc-bank-full {
        display: none;
    }

    .bridge-chart .bc-bank-short {
        display: inline;
    }
}

/* Dashboard: needs attention */
.attention-summary {
    font-weight: var(--fw-semi);
}

.attention {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Two columns: the details wrap inside the first one, the amount always sits
   in the same place at the right (with or without a trailer). */
.attention li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
    padding: 10px 12px;
    border: 1px solid var(--color-line);
    border-left: 3px solid var(--color-warn);
    border-radius: var(--radius-md);
    background: var(--color-paper);
}

.attention-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
}

.attention-main a {
    font-weight: var(--fw-semi);
}

.attention-amount {
    white-space: nowrap;
    text-align: right;
}

/* A short list of links inside a table cell (e.g. the requests of a payment) */
.inline-list {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* A table whose rows become cards on a phone (cells carry their header in data-label) */
@media (max-width: 640px) {
    .table-stack thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .table-stack,
    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
        width: 100%;
    }

    .table-stack tr {
        display: grid;
        gap: 4px;
        padding: 12px 16px;
        border-bottom: 1px solid var(--color-line);
    }

    .table.table-stack td {
        display: grid;
        grid-template-columns: 96px 1fr;
        gap: 2px 10px;
        padding: 0;
        border: 0;
        text-align: left;
        white-space: normal;
    }

    /* Everything in a cell stays in the value column, under its label. */
    .table.table-stack td > * {
        grid-column: 2;
        justify-self: start;
    }

    .table-stack td::before {
        grid-column: 1;
        grid-row: 1 / span 3;
        content: attr(data-label);
        color: var(--color-muted);
        font-family: var(--font-sans);
        font-size: 12px;
    }
}

/* Payments: "Pay" forms (components/pay_form) and the payments of a request */
.pay-form {
    display: grid;
    justify-items: start;
    gap: 10px;
    margin: 0;
}

/* "Issue an invoice" in a pay form (components/invoice_fields): the fields only
   while the box is checked; browsers without :has() always show them. */
.invoice-block {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: 560px;
}

.fieldset.invoice-fields {
    display: none;
}

.invoice-block:has(.invoice-toggle:checked) > .fieldset.invoice-fields {
    display: grid;
}

@supports not selector(:has(*)) {
    .fieldset.invoice-fields {
        display: grid;
    }
}

/* In the dashboard's attention list the form takes the whole row. */
.attention-main .pay-form {
    flex-basis: 100%;
}

.pay-form button[aria-busy="true"] {
    cursor: progress;
    opacity: .7;
}

/* A payment waiting for its result on the operator's page (components/payment_waiting). */
.payment-waiting {
    display: grid;
    gap: 8px;
}

.payment-waiting p {
    margin: 0;
}

.payment-list {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.payment-list li {
    display: grid;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
    background: var(--color-paper);
}

.payment-list-main {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 10px;
}

/* Dashboard: counters (each is a link to its list) */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 16px;
}

.stat {
    gap: 4px;
    color: var(--color-ink);
    text-decoration: none;
}

.stat:hover {
    border-color: var(--color-control-hover);
}

.stat-label {
    color: var(--color-muted);
    font-size: 12.5px;
}

.stat-value {
    font-size: 26px;
    font-weight: var(--fw-bold);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-hint {
    color: var(--color-accent);
    font-size: 12.5px;
    font-weight: var(--fw-semi);
}

/* Owner of the records - administrator only (components/owner_filter, owner_field, owner_name) */
.owner-filter .field {
    flex: 0 1 360px;
}

/* "Name · email" of the chosen owner under the filter row (only when two owners share the name) */
.owner-email {
    overflow-wrap: anywhere;
}

/* Fleet import (client/fleet/import/*): summary, the preview table by rows, the report */
.import-summary {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.import-summary p {
    margin: 0;
}

.import-summary form {
    margin: 0;
}

.import-summary .form-actions {
    align-items: center;
}

.import-counts {
    gap: 6px 10px;
}

/* A value of the file that failed its check */
.import-bad {
    color: var(--color-bad);
    font-weight: var(--fw-semi);
    text-decoration: underline wavy;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

.import-reasons {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 220px;
    font-size: 13px;
}

.import-table td {
    vertical-align: top;
}

/* A value as typed in the file: long unbroken text wraps inside a limited width */
.import-value {
    display: inline-block;
    max-width: 24ch;
    overflow-wrap: anywhere;
}

.import-table tr.import-row-error {
    background: color-mix(in srgb, var(--color-bad) 5%, transparent);
}

.import-table tr.import-row-duplicate {
    background: color-mix(in srgb, var(--color-warn) 7%, transparent);
}

.import-report {
    margin-bottom: 18px;
}

@media (max-width: 640px) {
    .import-reasons {
        min-width: 0;
    }
}

/* Passage request form (administrator): the owner block, then "Load data from an earlier request",
   then the form. All are direct children of .main: its 22px gap separates them, no margins of their own. */
.owner-panel,
.copy-panel {
    margin-bottom: 0;
}

/* The chosen request (vehicles, category, price) is long and the field is alone on its
   line: it wraps (the field grows) on every width instead of ending with "...", as all
   select2 fields do at <=640px. The arrow is 100% of the field's height, so it stays centred. */
.copy-panel .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-top: 10px;
    padding-bottom: 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    text-overflow: clip;
}

.trip-owner {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Several currencies in one counter (payments today) */
.stat-value-money {
    font-size: 22px;
}

/* Dev email preview (admin/dev/emails, development only): the HTML version in a
   sandboxed frame on the soft email background, the text version as it is sent. */
.email-frame {
    display: block;
    width: 100%;
    /* Without JS: tall enough for a normal email; app.js section 8 sets the exact height. */
    height: 85vh;
    min-height: 720px;
    border: 0;
    border-top: 1px solid var(--color-line);
    background: var(--color-soft);
}

.email-frame.is-fitted {
    min-height: 0;
}

.email-text {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    background: var(--color-soft);
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Validation, surcharges / refunds */
.text-warning {
    color: var(--color-warn);
    font-weight: var(--fw-semi);
}

.payment-list .action-item {
    margin-top: 6px;
}

.attention .pay-form .btn {
    min-height: 36px;
    padding-top: 6px;
    padding-bottom: 6px;
}

/* 6. Auth layout ------------------------------------------------------ */
.auth {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}

.auth-visual {
    position: relative;
    display: grid;
    align-content: space-between;
    gap: 24px;
    padding: 36px;
    overflow: hidden;
    /* The same edge as the sidebar of the app: a line + a shadow only to the right, over the form side. */
    z-index: 1;
    border-right: 1px solid var(--color-line);
    box-shadow: var(--shadow-sidebar);
    background-color: var(--color-sidebar);
    background-image: var(--grid-dot-strong);
    background-size: var(--grid-size) var(--grid-size);
}

.auth-visual svg {
    width: 100%;
    height: auto;
}

.auth-map {
    width: 100%;
    max-width: 560px;
}

.visual-title {
    display: grid;
    gap: 10px;
    max-width: 34em;
}

.visual-title h2 {
    font-weight: var(--fw-bold);
    font-size: clamp(26px, 3.4vw, 38px);
    line-height: 1.15;
    letter-spacing: -.02em;
}

.visual-meta {
    display: grid;
    gap: 2px;
    font-family: var(--font-mono);
    font-weight: 500;
    font-size: 12px;
    color: var(--color-muted);
}

.auth-lang {
    position: absolute;
    top: 20px;
    right: clamp(18px, 4vw, 40px);
    z-index: 1;
}

.auth-form {
    display: grid;
    align-content: center;
    gap: 18px;
    width: 100%;
    max-width: var(--auth-form-width);
    justify-self: center;
    padding: 64px clamp(18px, 4vw, 56px) 40px;
}

.auth-form h1 {
    font-size: 28px;
}

.auth-form .btn-primary {
    width: 100%;
}

.auth-links {
    display: flex;
    justify-content: flex-end;
}

.auth-links a {
    font-size: 12.5px;
}

.auth-foot {
    font-size: 13.5px;
    color: var(--color-muted);
}

.auth-foot a {
    font-weight: var(--fw-semi);
}

/* Error pages (errors/page.php): the status code as the big figure of the chart side */
.error-code {
    font-weight: var(--fw-bold);
    font-size: clamp(64px, 11vw, 128px);
    line-height: 1;
    letter-spacing: -.04em;
    color: var(--color-accent);
}

/* Registration: company-only / person-only parts, switched by data-account-type on the form. */
[data-account-type="person"] [data-show-for="company"],
[data-account-type="company"] [data-show-for="person"] {
    display: none;
}

/* 7. App layout ------------------------------------------------------- */
/* Anchors, headings and focused fields land below the sticky top bar when scrolled into view. */
.main,
.main [id],
.main :is(h1, h2, h3, h4),
.main :focus {
    scroll-margin-top: var(--anchor-offset);
}

.app-page {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100vh;
    height: 100dvh;
    /* No top padding: the white brand band starts at the very top edge. */
    padding: 0 14px 22px;
    /* Low windows (e.g. 768px with the admin menu): the sidebar scrolls instead of cutting off the user box. */
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    /* A clear edge to the page: a line + a soft shadow only to the right, above the main column. */
    z-index: 1;
    border-right: 1px solid var(--color-line);
    background: var(--color-sidebar);
    box-shadow: var(--shadow-sidebar);
}

/*
 * Brand: a white band across the full width of the sidebar (edge to edge over its 14px padding),
 * the logo (public/assets/images/logo.svg) fills its width - its alt text is the link's name.
 */
.brand {
    display: block;
    align-self: stretch;
    margin: 0 -14px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--color-line);
    background: var(--color-logo-band);
    line-height: 0;
}

/* The sidebar clips its overflow: the focus ring is drawn inside the band. */
.brand:focus-visible {
    outline-offset: -4px;
}

.brand-logo {
    display: block;
    width: 100%;
    height: auto;
}

.auth-logo {
    display: block;
    width: auto;
    max-width: 100%;
    border-radius: 4px;
    box-shadow: 0 0 0 1px var(--color-line);
    height: 72px;
}

.nav {
    position: relative;
    z-index: 1;
    display: flex;
    /* Grows to push the user box down, never shrinks below its links (the sidebar scrolls instead). */
    flex: 1 0 auto;
    flex-direction: column;
    gap: 2px;
    min-height: 0;
}

/* Every item (also the active "sheet") has the same inset as the others: not flush to the left edge (QA 2026-10-06). */
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 0;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-nav-ink);
    font-size: 14px;
    font-weight: var(--fw-semi);
    text-decoration: none;
}

.nav-link:hover {
    background: rgba(0, 114, 188, .09);
    color: var(--color-ink);
}

/* Active item: a light "sheet" lifted off the sidebar, the text in the logo blue (4.7:1 on the surface). */
.nav-link.is-active {
    background: var(--color-surface);
    color: var(--color-accent);
    font-weight: var(--fw-semi);
    box-shadow: var(--shadow-panel);
}

/* The focus ring (accent) is drawn inside the item: the sidebar clips its overflow. */
.nav-link:focus-visible {
    outline-offset: -2px;
}

/* Menu section title (e.g. "Administration") and its group of links.
   A thin divider with air above it separates the section from the links before it (sidebar and mobile drawer). */
.nav-section {
    margin: 16px 0 4px;
    padding: 14px 0 0 12px;
    border-top: 1px solid var(--color-line);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Logout after a menu section: a little air before it */
.nav-group + .nav-form button.nav-link {
    margin-top: 10px;
}

/* Logout: a POST form whose button looks like the other menu links */
.nav-form {
    display: contents;
}

button.nav-link {
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 14px;
    font-weight: var(--fw-semi);
    text-align: left;
    cursor: pointer;
}

.sidebar-foot {
    display: grid;
    gap: 8px;
    margin-top: auto;
    font-size: 12.5px;
    color: var(--color-muted);
}

/* Desktop: the user box sits on the fan of stays - a veil keeps a long name readable. */
@media (min-width: 821px) {
    .sidebar-foot {
        padding: 10px 12px;
        border: 1px solid var(--color-line);
        border-radius: var(--radius-md);
        background: var(--color-sidebar-veil);
    }
}

.userbox {
    overflow-wrap: anywhere;
}

/* The fan of stays drawn from a pylon, at the bottom of the sidebar. */
/*
 * In the flow (last flex item), pulled back over the bottom of the menu by its margins, so it stays at the
 * bottom of the content when the sidebar scrolls. The margins net to -20px (= the flex gap) and cover the
 * 14px side / 22px bottom padding: on a tall screen it sits exactly where an absolute bottom:0 box would.
 */
.sidebar-fan {
    position: relative;
    flex: none;
    height: 200px;
    margin: -198px -14px -22px;
    pointer-events: none;
}

.sidebar-fan svg {
    width: 100%;
    height: 100%;
}

.burger,
.scrim {
    display: none;
}

.main {
    position: relative;
    display: grid;
    align-content: start;
    gap: 22px;
    min-width: 0;
    padding: 26px clamp(16px, 3vw, 36px) 44px;
    background-image: var(--grid-dot);
    background-size: var(--grid-size) var(--grid-size);
}

.content-narrow {
    max-width: 640px;
}

/* 8. Responsive ------------------------------------------------------- */
@media (max-width: 820px) {
    /* Auth: one column, the chart on top */
    .auth {
        grid-template-columns: 1fr;
    }

    /* The chart and the form share one centred column of the form's width. */
    .auth-visual {
        justify-items: center;
        min-height: 200px;
        padding: 56px 16px 24px;
        border-right: 0;
        border-bottom: 1px solid var(--color-line);
        box-shadow: none;
    }

    .auth-visual > * {
        width: 100%;
        max-width: calc(var(--auth-form-width) - 32px);
    }

    /* The logo keeps its own width (centred above the column), not the column's. */
    .auth-visual > .auth-logo {
        width: auto;
    }

    .auth-lang {
        top: 8px;
        right: 8px;
    }

    .auth-form {
        padding: 28px 16px 40px;
    }

    /* App: the sidebar becomes a sticky top bar with a hamburger drawer */
    .app-page {
        --anchor-offset: calc(var(--topbar-height) + 12px);
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .sidebar {
        z-index: 20;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        height: var(--topbar-height);
        padding: 4px 12px 4px 16px;
        overflow: visible;
        border-right: 0;
        border-bottom: 1px solid var(--color-line);
        background: var(--color-logo-band);
        box-shadow: none;
    }

    .sidebar-fan {
        display: none;
    }

    /* Top bar: the bar itself is the white band, the logo is 52px tall (61px bar - 2x4px padding - 1px line). */
    .brand {
        align-self: center;
        margin: 0;
        padding: 0;
        border-bottom: 0;
        background: transparent;
    }

    .brand:focus-visible {
        outline-offset: 2px;
    }

    .brand-logo {
        width: auto;
        height: 52px;
    }

    .auth-logo {
        height: 56px;
    }

    .burger {
        display: grid;
        place-items: center;
        width: 40px;
        height: 40px;
        padding: 0;
        border: 0;
        border-radius: var(--radius-sm);
        background: transparent;
        cursor: pointer;
    }

    .burger i {
        position: relative;
        display: block;
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: var(--color-ink);
        box-shadow: 0 -6px 0 var(--color-ink), 0 6px 0 var(--color-ink);
    }

    .is-nav-open .burger i {
        background: transparent;
        box-shadow: none;
    }

    .is-nav-open .burger i::before,
    .is-nav-open .burger i::after {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        width: 20px;
        height: 2px;
        border-radius: 2px;
        background: var(--color-ink);
        transform: rotate(45deg);
    }

    .is-nav-open .burger i::after {
        transform: rotate(-45deg);
    }

    /* The drawer: same look as the desktop sidebar, slides in from the left under the top bar. */
    .nav {
        position: fixed;
        top: var(--topbar-height);
        bottom: 0;
        left: 0;
        z-index: 30;
        width: min(280px, 82%);
        padding: 14px 14px 24px;
        overflow-y: auto;
        overscroll-behavior: contain;
        border-right: 1px solid var(--color-line);
        background: var(--color-sidebar);
        box-shadow: var(--shadow-drawer);
        transform: translateX(-102%);
        visibility: hidden;
        transition: transform var(--transition-drawer), visibility 0s .22s;
    }

    .is-nav-open .nav {
        transform: none;
        visibility: visible;
        transition: transform var(--transition-drawer);
    }

    .sidebar-foot {
        padding-top: 14px;
        border-top: 1px solid var(--color-line);
    }

    /* Drawer open: the page behind does not scroll (class on <html>, set by app.js). */
    .is-scroll-locked,
    .is-scroll-locked body {
        overflow: hidden;
    }

    /*
     * Below the sidebar (z-index 20): the sticky sidebar is a stacking context, so the
     * drawer inside it (z-index 30) can never be above anything the sidebar is below.
     * With the scrim at 15 the whole sidebar - top bar and drawer - is above it.
     */
    .scrim {
        position: fixed;
        inset: var(--topbar-height) 0 0 0;
        z-index: 15;
        display: block;
        background: var(--color-scrim);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-drawer);
    }

    .is-nav-open .scrim {
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        padding-top: 18px;
    }
}

/* Phones and touch screens: 16px inputs (no iOS zoom on focus), 40x40 tap targets in the language switch. */
@media (max-width: 820px), (pointer: coarse) {
    .field input,
    .field select,
    .select2-container,
    .select2-container--default .select2-search--dropdown .select2-search__field {
        font-size: 16px;
    }

    .select2-results__option {
        padding: 11px 12px;
    }

    .lang-switch {
        gap: 0;
    }

    .lang-switch a,
    .lang-switch .is-current {
        display: inline-grid;
        place-items: center;
        min-width: var(--tap-size);
        min-height: var(--tap-size);
    }

    /* Order buttons of the tariff categories: 40x40 tap targets. */
    .icon-btn {
        width: var(--tap-size);
        height: var(--tap-size);
    }

    .tab {
        min-height: var(--tap-size);
    }
}

/* Phone: the week of the schedule becomes a vertical list of days (no sideways scroll). */
@media (max-width: 640px) {
    .week {
        grid-template-columns: 1fr;
        min-width: 0;
    }

    .week-day {
        min-height: 0;
        padding: 10px 14px 12px;
        border-right: 0;
        border-bottom: 1px solid var(--color-line);
    }

    .week-day:last-child {
        border-bottom: 0;
    }

    /* An empty day is one line: the day and its "0". */
    .week-day.is-empty .week-day-empty {
        display: none;
    }

    .week-nav {
        width: 100%;
    }

    .week-nav .btn {
        flex: 1 1 auto;
    }

    /* Page head: the export buttons are a row of their own below the other actions, equal width and 44px. */
    .actions .export-links {
        order: 1;
        flex: 1 1 100%;
    }

    .export-links .btn {
        flex: 1 1 0;
        min-height: 44px;
        white-space: nowrap;
    }

    .actions:has(> .export-links) {
        flex: 1 1 100%;
    }

    .actions:has(> .export-links) > .btn {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nav,
    .scrim {
        transition: none !important;
    }
}

/* =====================================================================
   Help page (pages/help) and the "Help" menu item - added 2026-10-06,
   navigation rebuilt 2026-10-06 (approved mock-up .claude/design/help-nav-c2.html):
   a sticky, grouped list of the sections on the left, all sections one below
   the other on the right; on a phone (<= 820px) a sticky "Section" bar opens
   the list as a bottom sheet. Behaviour: app.js, initHelp().
   Own block on purpose: no tokens / colours are defined or changed here,
   only the existing ones are used.
   ===================================================================== */

/* "Help" right after the administration group: the same air as before "Log out". */
.nav-group + .nav-link {
    margin-top: 10px;
}

/* Smooth jumps from the list (not with reduced motion). */
@media (prefers-reduced-motion: no-preference) {
    html:has(.help-layout) {
        scroll-behavior: smooth;
    }
}

.help-layout {
    display: grid;
    /* 280px; a bit narrower on a small desktop (821-1160px), so the text column keeps its width. */
    grid-template-columns: clamp(220px, 24vw, 280px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.help-content {
    display: grid;
    gap: 18px;
    min-width: 0;
}

/* --- The list of sections (a second-level menu) --------------------- */
.help-toc {
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    padding: 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    background: var(--color-soft);
}

.help-toc-group {
    margin: 8px 8px 6px;
    font-size: 11.5px;
    font-weight: var(--fw-bold);
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.help-toc-group:first-child {
    margin-top: 4px;
}

.help-toc-list {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.help-toc-rule {
    margin: 8px 6px;
    border: 0;
    border-top: 1px dashed var(--color-line);
}

/* The number in a circle (list and section headings) */
.help-num {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: var(--fw-black);
    line-height: 1;
}

.help-toc-link {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding: 7px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--color-nav-ink);
    font-weight: var(--fw-bold);
    text-decoration: none;
}

.help-toc-link .help-num {
    width: 24px;
    height: 24px;
    font-size: 12px;
    border: 1.5px solid var(--color-control);
    background: var(--color-surface);
    color: var(--color-nav-ink);
}

/* One line; the full title is in the title attribute (long en / ro titles). */
.help-toc-title {
    overflow: hidden;
    font-size: 13.5px;
    line-height: 1.3;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.help-toc-link:hover {
    background: var(--color-surface);
    color: var(--color-ink);
}

/* Sections already passed: a blue number */
.help-toc-link.is-done .help-num {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* The current section: a white "sheet", blue circle and title */
.help-toc-link[aria-current="location"] {
    border-color: var(--color-line);
    background: var(--color-surface);
    box-shadow: var(--shadow-panel);
    color: var(--color-accent);
}

.help-toc-link[aria-current="location"] .help-num {
    border-color: var(--color-accent);
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

/* The administrator section is not a step: a dashed circle */
.help-toc-link.is-admin .help-num {
    border-style: dashed;
}

/* On the soft ground the logo blue is 4.4:1 - the darker blue (6.3:1). */
.help-top {
    display: block;
    margin: 10px 8px 2px;
    color: var(--color-accent-hover);
    font-size: 13px;
    font-weight: var(--fw-bold);
    text-decoration: none;
}

.help-top:hover {
    color: var(--color-accent-active);
    text-decoration: underline;
}

/* --- The sections ----------------------------------------------------- */
/* .main prefix: beats the general ".main [id]" scroll margin. */
.main .help-section {
    scroll-margin-top: 20px;
}

.help-section h2 {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 0;
    font-size: 20px;
    font-weight: var(--fw-black);
    letter-spacing: -.01em;
    line-height: 1.25;
}

.help-section h2 .help-num {
    background: var(--color-accent);
    color: var(--color-accent-ink);
}

.help-section.is-admin h2 .help-num {
    border: 1.5px dashed var(--color-control);
    background: var(--color-surface);
    color: var(--color-nav-ink);
}

.help-list {
    display: grid;
    gap: 4px;
    margin: 0;
    padding-left: 22px;
}

/* Nested list (the options of a step) */
.help-list .help-list {
    margin-top: 4px;
}

/* Running text stays readable on wide screens. */
.help-section > p,
.help-section > .help-list {
    max-width: 82ch;
}

/* The guide tables run from edge to edge of the panel (over its 18px padding), with lines above and
   below; the first / last cells keep the panel's inset, so the text lines up with the paragraphs.
   Too wide for a phone: they still scroll inside .table-wrap. */
.help-section .table-wrap {
    margin-inline: -18px;
    border-top: 1px solid var(--color-line);
    border-bottom: 1px solid var(--color-line);
}

.help-section .table {
    width: 100%;
}

.help-section .table th:first-child,
.help-section .table td:first-child {
    padding-left: 18px;
}

.help-section .table th:last-child,
.help-section .table td:last-child {
    padding-right: 18px;
}

/* Row headers of the guide tables read as text, not as column labels. */
.help-section .table tbody th {
    color: var(--color-ink);
    font-size: 13.5px;
    vertical-align: top;
    white-space: nowrap;
}

.help-section .table td {
    vertical-align: top;
}

.help-section .table tbody tr:last-child th {
    border-bottom: 0;
}

/* --- Phone: the "Section" bar and the bottom sheet ------------------- */
.help-bar,
.help-scrim {
    display: none;
}

@media (max-width: 820px) {
    .help-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    /* Without JS the list stays in the flow above the sections. */
    .help-toc {
        position: static;
        max-height: none;
    }

    /* Under the top bar (61px) and the "Section" bar */
    .main .help-section {
        scroll-margin-top: calc(var(--anchor-offset) + 64px);
    }

    .help-section h2 {
        font-size: 18px;
    }

    /* The bar bleeds to the edges of .main (its side padding is clamp(16px, 3vw, 36px)). */
    .help-bar:not([hidden]) {
        position: sticky;
        top: var(--topbar-height);
        z-index: 10;
        display: block;
        margin: -10px calc(-1 * clamp(16px, 3vw, 36px)) -8px;
        padding: 8px clamp(16px, 3vw, 36px);
        border-bottom: 1px solid var(--color-line);
        background: var(--color-sidebar-veil);
    }

    .help-bar-btn {
        display: flex;
        gap: 12px;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        min-height: 44px;
        padding: 7px 14px;
        border: 1px solid var(--color-control);
        border-radius: var(--radius-md);
        background: var(--color-surface);
        color: var(--color-ink);
        font: inherit;
        font-weight: var(--fw-bold);
        text-align: left;
        cursor: pointer;
    }

    .help-bar-text {
        display: grid;
        min-width: 0;
    }

    .help-bar-text small {
        font-size: 11px;
        font-weight: var(--fw-bold);
        letter-spacing: .06em;
        text-transform: uppercase;
        color: var(--color-muted);
    }

    .help-bar-current {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .help-bar-caret {
        flex: none;
        color: var(--color-nav-ink);
    }

    /* With JS the list lives in the bottom sheet: hidden until the bar opens it. */
    .help-layout.is-enhanced .help-toc {
        display: none;
    }

    .help-layout.is-enhanced .help-toc.is-open {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 26;
        display: block;
        max-height: 80vh;
        max-height: 80dvh;
        padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
        border-width: 1px 0 0;
        border-radius: 16px 16px 0 0;
        box-shadow: var(--shadow-dialog);
    }

    /* Above the top bar (z-index 20) too: the sheet is the only thing in reach while open. */
    .help-scrim:not([hidden]) {
        position: fixed;
        inset: 0;
        z-index: 25;
        display: block;
        background: var(--color-scrim);
    }

    .help-layout.is-enhanced .help-toc-link {
        min-height: 44px;
    }
}

/* =====================================================================
   QA cosmetics 2026-10-06 (layout only, no tokens / colours).
   ===================================================================== */

/* Phone / narrow screen: the "DANUBE" label and the bridge length of the login chart would be ~8px - hidden. */
@media (max-width: 820px) {
    .auth-map-danube,
    .auth-map-dim {
        display: none;
    }
}

/* Dashboard chart: the dimension line bank to bank next to "DANUBE · 1 971 m" (the bridge length) -
   thin and grey, so it is never taken for the (blue) bridge or a passage line. */
.bc-dim {
    fill: none;
    stroke: var(--color-nav-ink);
    stroke-width: 1.25;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Phone: the river text is hidden (too small), so is its dimension line. */
@media (max-width: 640px) {
    .bridge-chart .bc-dim {
        display: none;
    }
}

/* Low desktop screen: the fan of stays would run behind "Help" / "Log out" - hidden. */
@media (min-width: 821px) and (max-height: 800px) {
    .sidebar-fan {
        display: none;
    }
}

/* The logo blue is 4.4:1 on --color-soft (below AA): links and blue texts on a soft ground
   (a hovered table row / trip card, the current series row, a hovered "current" button)
   take the darker blue #005A96 (6.3:1). */
.table tbody tr:hover,
.trip:hover,
.series-list li.is-current {
    --color-link: var(--color-accent-hover);
    --color-link-hover: var(--color-accent-active);
}

.btn.is-current:hover {
    color: var(--color-accent-hover);
}
