/* ─────────────────────────────────────────────────────────────────────────────
   Fleetman Modern — the theme.

   Loaded after bootstrap.min.css and site.css, and ONLY when the request
   resolves to the modern theme (see Services/FleetmanTheme.cs), so selectors
   here are deliberately unscoped: the file is never present in a classic-theme
   document. Custom properties come from css/tokens.css.

   Design language: a dark navy sidebar carrying the whole navigation, a sticky
   glass header, and a light "paper" work surface. Teal→blue gradient for every
   primary action, generous radii (nothing is square), hairline borders, soft
   neutral shadows plus a brand glow on CTAs. Status is colour *and* icon *and*
   label — never colour alone.

   Bootstrap 5.1 compiles literal colours into its component classes, so those
   components are overridden rule-by-rule below; `.bg-*` / `.text-*` utilities
   carry !important in Bootstrap, so the overrides here must match it.

   Sections
     1. Base & typography          7. Forms
     2. Icons                      8. Navigation components
     3. Shell: sidebar             9. Ticket board
     4. Shell: header             10. Layout components (.fm-*)
     5. Shell: main               11. Utilities
     6. Buttons / cards / tables  12. Focus, motion, print
   ──────────────────────────────────────────────────────────────────────────── */

/* ── 1. Base & typography ──────────────────────────────────────────────────── */

/* site.css clamps `html, body { overflow-x: hidden }`, which is what keeps
   body.scrollWidth <= clientWidth on the 37 pages whose tables are not wrapped
   in .table-responsive. We must keep that clamp — but `overflow-x: hidden` on
   body turns body into a scroll container, and a sticky header inside a scroll
   container never sticks. `clip` clamps the overflow identically without
   creating one, so .fm-topbar keeps working. */
html, body { overflow-x: clip; }

body {
    font-family: var(--font-body);
    font-size: var(--text-body-m);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--surface-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    line-height: var(--leading-snug);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
}

/* The page title. Nearly every page writes <h1 class="h3">, so this one rule
   sets the headline scale app-wide. Clamped so it cannot overflow at 390px. */
h1, .h1 { font-size: clamp(1.55rem, 1.3rem + 1vw, var(--text-display-m)); }
h2, .h2 { font-size: clamp(1.25rem, 1.1rem + 0.6vw, var(--text-heading-m)); }
h3, .h3 { font-size: var(--text-heading-m); }
h4, .h4 { font-size: var(--text-heading-s); }
h1.h3, h1.h4 { font-size: clamp(1.55rem, 1.3rem + 1vw, var(--text-display-m)); }

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--interactive-pressed); text-decoration: underline; }

small, .small { font-size: var(--text-body-s); }
code, kbd, samp, pre, .font-monospace { font-family: var(--font-mono); }

hr { border-top: 1px solid var(--border-subtle); opacity: 1; }

::selection { background: rgba(0, 182, 148, 0.22); }

/* Uppercase micro-label — carried over from the classic theme's markup contract. */
.fm-label {
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    font-size: var(--text-caption);
    font-weight: var(--weight-bold);
    font-family: var(--font-display);
    color: var(--text-muted);
}

/* ── 2. Icons ──────────────────────────────────────────────────────────────── */
.fm-icon {
    display: inline-block;
    flex: none;
    vertical-align: -0.18em;
    fill: currentColor;
}

/* ── 3. Shell: sidebar ─────────────────────────────────────────────────────── */
.fm-shell { padding-left: var(--shell-sidebar-width); }

.fm-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--shell-sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--navy-850);
    color: rgba(255, 255, 255, 0.75);
    z-index: 1045;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.fm-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
    padding: 22px 20px 18px;
    color: #fff;
    text-decoration: none;
}
.fm-sidebar-brand:hover { color: #fff; text-decoration: none; }

.fm-sidebar-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: var(--radius-brand);
    background: var(--gradient-brand);
    color: #fff;
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    font-size: 18px;
}

.fm-sidebar-wordmark {
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    font-size: 15px;
    letter-spacing: var(--tracking-caps);
    white-space: nowrap;
}

.fm-sidebar-nav {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
}

.fm-sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: var(--touch-target);
    padding: 0 12px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-family: var(--font-body);
    font-size: var(--text-body-m);
    font-weight: var(--weight-semibold);
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-standard),
                color var(--duration-fast) var(--ease-standard);
}
.fm-sidebar-item:hover,
.fm-sidebar-item:focus-visible {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
    text-decoration: none;
}
/* The label grows so trailing badges and the chevron sit hard right. */
.fm-sidebar-item > span:not(.fm-sidebar-badge) { flex: 1 1 auto; min-width: 0; }

.fm-sidebar-item.active {
    background: rgba(0, 182, 148, 0.16);
    color: var(--fm-teal-300);
}

.fm-sidebar-item.is-off {
    color: rgba(255, 255, 255, 0.45);
    opacity: 0.72;
}

/* Sub-navigation (Stammdaten) — indented, with a 2px activity rail. */
.fm-sidebar-sub {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 14px;
    margin: 2px 0 4px;
}

.fm-sidebar-subitem {
    display: flex;
    align-items: center;
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-left: 2px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: rgba(255, 255, 255, 0.55);
    font-size: var(--text-body-s);
    font-weight: var(--weight-medium);
    text-decoration: none;
}
.fm-sidebar-subitem:hover,
.fm-sidebar-subitem:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
}
.fm-sidebar-subitem.active {
    background: rgba(255, 255, 255, 0.1);
    border-left-color: var(--brand-primary);
    color: #fff;
}

.fm-sidebar-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    flex: none;
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    font-size: 10px;
    font-weight: var(--weight-bold);
    letter-spacing: 0.06em;
}
.fm-sidebar-badge.is-count { background: var(--brand-danger); color: #fff; }

/* Sidebar footer — identity plus the app's single logout control.
   The responsive suite asserts a visible button named "Abmelden" at every
   viewport. That holds here because the assertion runs *after* the drawer has
   been opened below 1400px, and above it the sidebar is always on screen.
   Keep it the only element with that accessible name: Playwright's locators
   are strict and a second one fails the whole suite. */
.fm-sidebar-footer {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--text-body-s);
}

.fm-sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 8px;
    min-width: 0;
}
.fm-sidebar-user > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fm-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-height: 40px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    font-family: var(--font-body);
    font-size: var(--text-body-s);
    font-weight: var(--weight-semibold);
    cursor: pointer;
}
.fm-logout:hover, .fm-logout:focus-visible { background: rgba(255, 255, 255, 0.09); color: #fff; }

.fm-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: var(--surface-overlay);
    border: 0;
    padding: 0;
    display: none;
}

/* Below the shell breakpoint the sidebar becomes an off-canvas drawer. It is
   position:fixed in both states, so it never contributes to body scrollWidth. */
@media (max-width: 1399.98px) {
    .fm-shell { padding-left: 0; }

    /* Closed with transform + visibility rather than display:none, so the drawer
       animates, keeps its links in the DOM for the navigation crawl, and still
       takes its contents out of the tab order while off screen. */
    .fm-sidebar {
        width: var(--shell-sidebar-drawer-width);
        transform: translateX(-100%);
        visibility: hidden;
        box-shadow: var(--shadow-lg);
        transition: transform var(--duration-normal) var(--ease-out),
                    visibility var(--duration-normal) var(--ease-out);
    }

    body.fm-nav-open .fm-sidebar { transform: none; visibility: visible; }
    body.fm-nav-open .fm-nav-backdrop { display: block; }
    /* Deliberately no scroll lock on body: any non-visible overflow value would
       make body a scroll container again and unstick .fm-topbar. The backdrop
       already blocks interaction with the page behind the drawer. */
}

/* ── 4. Shell: header ──────────────────────────────────────────────────────── */
.fm-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--shell-header-height);
    padding: 12px 20px;
    background: var(--surface-glass);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-subtle);
}

.fm-topbar-spacer { flex: 1 1 auto; }

.fm-iconbutton {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: none;
    position: relative;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    text-decoration: none;
}
.fm-iconbutton:hover,
.fm-iconbutton:focus-visible {
    background: var(--surface-sunken);
    color: var(--text-primary);
    text-decoration: none;
}

.fm-navtoggle {
    border-color: var(--border-subtle);
    background: var(--surface-raised);
    color: var(--text-primary);
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
}
@media (min-width: 1400px) { .fm-navtoggle { display: none; } }

/* Global search — a pill, matching the mock's header field. */
.fm-searchpill {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 520px;
    min-height: var(--touch-target);
    padding: 0 12px 0 16px;
    background: var(--surface-sunken);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
}
.fm-searchpill:focus-within {
    border-color: var(--border-focus);
    box-shadow: var(--ring-focus);
}
.fm-searchpill input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
}
.fm-searchpill .fm-kbd {
    flex: none;
    padding: 2px 6px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 11px;
    white-space: nowrap;
}
@media (max-width: 767.98px) {
    .fm-searchpill { display: none; }
}

.fm-notify-count {
    position: absolute;
    top: 3px;
    right: 2px;
    display: grid;
    place-items: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: var(--radius-pill);
    background: var(--brand-danger);
    color: #fff;
    font-size: 10px;
    font-weight: var(--weight-bold);
    line-height: 1;
}

.fm-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-primary);
    cursor: pointer;
}
.fm-user:hover { background: var(--surface-sunken); }

.fm-avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: var(--radius-pill);
    background: var(--gradient-brand);
    color: #fff;
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    font-size: 13px;
}

.fm-user-name {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    max-width: 11rem;
}
.fm-user-name > span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-user-name .fm-user-role { color: var(--text-muted); font-size: 11px; }
@media (max-width: 991.98px) { .fm-user-name { display: none; } }

/* ── 5. Shell: main ────────────────────────────────────────────────────────── */
.fm-main {
    display: block;
    max-width: 100%;
    padding: 24px 20px 56px;
}
@media (min-width: 768px) { .fm-main { padding: 28px 28px 64px; } }

/* Unauthenticated pages (login, kiosk landings) render without the shell. */
body:not(.fm-shell) .fm-main { padding-top: 40px; }

/* ── 6. Buttons, cards, tables ─────────────────────────────────────────────── */
.btn {
    border-radius: var(--radius-control);
    font-weight: var(--weight-semibold);
    font-size: var(--text-body-m);
    padding: 0.55rem 1.1rem;
    transition: transform var(--duration-fast) var(--ease-standard),
                box-shadow var(--duration-fast) var(--ease-standard),
                background-color var(--duration-fast) var(--ease-standard),
                filter var(--duration-fast) var(--ease-standard);
}
.btn:active { transform: scale(var(--press-scale)); }
.btn-sm { border-radius: var(--radius-md); padding: 0.35rem 0.8rem; font-size: var(--text-body-s); }
.btn-lg { border-radius: var(--radius-card); padding: 0.75rem 1.4rem; font-size: var(--text-body-l); }

/* Primary action — the brand gradient. Success maps here too: in Fleetman the
   green "save/confirm" buttons are the same affirmative action. */
.btn-primary,
.btn-success,
.btn-primary:disabled, .btn-primary.disabled {
    background: var(--gradient-brand);
    background-color: var(--brand-primary);
    border: 0;
    color: #fff;
    box-shadow: var(--glow-cta);
}
.btn-primary:hover, .btn-primary:focus,
.btn-success:hover, .btn-success:focus {
    filter: brightness(1.06);
    color: #fff;
    box-shadow: 0 14px 32px rgba(0, 180, 148, 0.38);
}
.btn-primary:active, .btn-success:active { filter: brightness(0.95); color: #fff; }
.btn-primary:disabled, .btn-primary.disabled { opacity: 0.55; box-shadow: none; }

/* Quiet actions — raised paper with a hairline. */
.btn-secondary, .btn-light, .btn-warning, .btn-info,
.btn-outline-primary, .btn-outline-secondary, .btn-outline-success,
.btn-outline-warning, .btn-outline-info, .btn-outline-dark, .btn-outline-light {
    background-color: var(--surface-raised);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
}
.btn-secondary:hover, .btn-light:hover, .btn-warning:hover, .btn-info:hover,
.btn-outline-primary:hover, .btn-outline-secondary:hover, .btn-outline-success:hover,
.btn-outline-warning:hover, .btn-outline-info:hover, .btn-outline-dark:hover,
.btn-outline-light:hover,
.btn-secondary:focus, .btn-outline-primary:focus, .btn-outline-secondary:focus {
    background-color: var(--surface-sunken);
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.btn-outline-primary { border-color: rgba(0, 182, 148, 0.42); color: var(--brand-primary); }
.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: rgba(0, 182, 148, 0.1);
    border-color: var(--brand-primary);
    color: var(--interactive-pressed);
}

.btn-danger, .btn-outline-danger {
    background-color: var(--tint-danger-bg);
    border: 1px solid var(--tint-danger-bd);
    color: var(--tint-danger-fg);
}
.btn-danger:hover, .btn-danger:focus,
.btn-outline-danger:hover, .btn-outline-danger:focus {
    background-color: var(--brand-danger);
    border-color: var(--brand-danger);
    color: #fff;
}

.btn-dark { background-color: var(--ink-1); border-color: var(--ink-1); color: #fff; }
.btn-link { color: var(--brand-primary); text-decoration: none; font-weight: var(--weight-semibold); }
.btn-link:hover { color: var(--interactive-pressed); text-decoration: underline; }

.btn:focus, .btn:focus-visible, .btn-check:focus + .btn { box-shadow: var(--ring-focus); }

.btn-close { border-radius: var(--radius-pill); }

/* Cards */
.card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-sm);
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 1.25rem;
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    font-size: var(--text-heading-s);
    color: var(--text-primary);
    border-radius: var(--radius-panel) var(--radius-panel) 0 0;
}
.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-subtle);
    border-radius: 0 0 var(--radius-panel) var(--radius-panel);
}
.card-body { padding: 1.25rem; }
.card-metric { min-width: 9rem; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* Tables. Two shapes exist in the codebase — a bare `.table` and a `.table`
   inside `.table-responsive` — and both have to read as the same panel. */
.table {
    --bs-table-bg: transparent;
    color: var(--text-primary);
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-collapse: separate;
    border-spacing: 0;
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-responsive {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-sm);
    max-width: 100%;
    overflow-x: auto;
}
.table-responsive > .table {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    margin-bottom: 0;
}

.table > thead > tr > th {
    padding: 14px 16px;
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wide);
    white-space: nowrap;
}

.table > :not(caption) > * > * {
    padding: 14px 16px;
    background-color: transparent;
    border-bottom-color: var(--border-subtle);
    box-shadow: none;
}
.table > tbody > tr:last-child > * { border-bottom-width: 0; }
.table > :not(:first-child) { border-top: 0; }

.table-striped > tbody > tr:nth-of-type(odd) > * { background-color: transparent; }
.table-hover > tbody > tr:hover > * { background-color: var(--surface-sunken); color: var(--text-primary); }
.table-sm > :not(caption) > * > * { padding: 9px 12px; }
.table-actions { white-space: nowrap; }

/* Badges — tinted pills. Bootstrap's .bg-* utilities carry !important. */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-pill);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: var(--weight-bold);
    letter-spacing: 0;
    line-height: 1.35;
}
.badge.bg-success {
    background-color: var(--tint-success-bg) !important;
    color: var(--tint-success-fg) !important;
}
.badge.bg-warning {
    background-color: var(--tint-warning-bg) !important;
    color: var(--tint-warning-fg) !important;
}
.badge.bg-danger {
    background-color: var(--tint-danger-bg) !important;
    color: var(--tint-danger-fg) !important;
}
.badge.bg-primary, .badge.bg-info {
    background-color: var(--tint-info-bg) !important;
    color: var(--tint-info-fg) !important;
}
.badge.bg-secondary, .badge.bg-light, .badge.bg-dark {
    background-color: var(--tint-neutral-bg) !important;
    color: var(--tint-neutral-fg) !important;
}

/* Status system. The glyph prefixes are kept from the classic theme so status
   never depends on hue alone — the design system requires icon + colour + label. */
.status-badge {
    display: inline-flex;
    align-items: center;
    /* The ::before glyphs are flex items, so their trailing space collapses. */
    gap: 0.3em;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: var(--weight-bold);
    line-height: 1.3;
    white-space: nowrap;
    background: var(--tint-neutral-bg);
    color: var(--tint-neutral-fg);
}
.status-ok {
    background: var(--tint-success-bg);
    border-color: var(--tint-success-bd);
    color: var(--tint-success-fg);
}
.status-ok::before { content: "✓"; }
.status-warn {
    background: var(--tint-warning-bg);
    border-color: var(--tint-warning-bd);
    color: var(--tint-warning-fg);
}
.status-warn::before { content: "⚠"; }
.status-critical {
    background: var(--tint-danger-bg);
    border-color: var(--tint-danger-bd);
    color: var(--tint-danger-fg);
}
.status-critical::before { content: "!"; }
.status-neutral {
    background: var(--tint-neutral-bg);
    border-color: var(--tint-neutral-bd);
    color: var(--tint-neutral-fg);
}
.status-final {
    background: rgba(11, 16, 36, 0.85);
    border-color: transparent;
    color: #fff;
}
.deadline-badge { font-size: 12px; }

/* Alerts — tinted panels with a left accent bar. */
.alert {
    border: 1px solid transparent;
    border-left-width: 3px;
    border-radius: var(--radius-md);
    padding: 0.9rem 1.1rem;
}
.alert-success {
    background: var(--tint-success-bg);
    border-color: var(--tint-success-bd);
    border-left-color: var(--brand-success);
    color: var(--tint-success-fg);
}
.alert-warning {
    background: var(--tint-warning-bg);
    border-color: var(--tint-warning-bd);
    border-left-color: var(--brand-warning);
    color: var(--tint-warning-fg);
}
.alert-danger {
    background: var(--tint-danger-bg);
    border-color: var(--tint-danger-bd);
    border-left-color: var(--brand-danger);
    color: var(--tint-danger-fg);
}
.alert-info, .alert-primary {
    background: var(--tint-info-bg);
    border-color: var(--tint-info-bd);
    border-left-color: var(--signal-blue);
    color: var(--tint-info-fg);
}
.alert-secondary, .alert-light, .alert-dark {
    background: var(--tint-neutral-bg);
    border-color: var(--tint-neutral-bd);
    border-left-color: var(--text-muted);
    color: var(--text-primary);
}
.alert h1, .alert h2, .alert h3, .alert h4, .alert h5 { color: inherit; }

/* ── 7. Forms ──────────────────────────────────────────────────────────────── */
.form-label {
    font-size: var(--text-body-s);
    font-weight: var(--weight-semibold);
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control, .form-select {
    min-height: var(--touch-target);
    padding: 0.5rem 0.85rem;
    /* Bootstrap paints the select chevron as a background image at the right
       edge; without extra inset the longest option text runs underneath it. */

    background-color: var(--surface-raised);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--text-body-m);
}
.form-control::placeholder { color: var(--text-muted); }
.form-control:focus, .form-select:focus {
    background-color: var(--surface-raised);
    border-color: var(--border-focus);
    box-shadow: var(--ring-focus);
    color: var(--text-primary);
}
.form-select { padding-right: 2.4rem; background-position: right 0.85rem center; }
.form-control-sm, .form-select-sm { min-height: 36px; border-radius: var(--radius-sm); }
textarea.form-control { min-height: 6rem; }

.form-check-input {
    border-color: var(--border-strong);
    background-color: var(--surface-raised);
}
.form-check-input:checked {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}
.form-check-input:focus { border-color: var(--border-focus); box-shadow: var(--ring-focus); }

.input-group-text {
    background: var(--surface-sunken);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
}

.form-control.is-invalid, .form-select.is-invalid { border-color: var(--brand-danger); }
.form-control.is-valid, .form-select.is-valid { border-color: var(--brand-success); }
.invalid-feedback,
.text-danger.field-validation-error,
span.field-validation-error {
    color: var(--tint-danger-fg) !important;
    font-weight: var(--weight-semibold);
}
.form-text { color: var(--text-muted); }

/* ── 8. Navigation components ──────────────────────────────────────────────── */
/* Tabs become a segmented control, matching the vehicle-detail tabs in the mock. */
.nav-tabs {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: var(--tint-neutral-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
}
.nav-tabs .nav-link {
    border: 0;
    border-radius: var(--radius-md);
    padding: 0.45rem 1rem;
    color: var(--text-secondary);
    font-weight: var(--weight-semibold);
    font-size: var(--text-body-s);
}
.nav-tabs .nav-link:hover { background: rgba(255, 255, 255, 0.6); color: var(--text-primary); }
.nav-tabs .nav-link.active {
    background: var(--surface-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.nav-pills .nav-link { border-radius: var(--radius-pill); color: var(--text-secondary); font-weight: var(--weight-semibold); }
.nav-pills .nav-link.active { background: var(--gradient-brand); color: #fff; }

.breadcrumb { font-size: var(--text-body-s); }
.breadcrumb-item a { color: var(--text-secondary); }
.breadcrumb-item.active { color: var(--text-primary); font-weight: var(--weight-semibold); }

.page-link {
    color: var(--text-primary);
    background: var(--surface-card);
    border-color: var(--border-subtle);
}
.page-link:hover { background: var(--surface-sunken); color: var(--text-primary); }
.page-item:first-child .page-link { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.page-item:last-child .page-link { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.page-item.active .page-link {
    background: var(--gradient-brand);
    border-color: transparent;
    color: #fff;
}
.page-item.disabled .page-link { color: var(--text-muted); background: var(--surface-sunken); }

.list-group { border-radius: var(--radius-panel); }
.list-group-item {
    background: var(--surface-card);
    border-color: var(--border-subtle);
    color: var(--text-primary);
    padding: 0.85rem 1.1rem;
}
.list-group-item:first-child { border-radius: var(--radius-panel) var(--radius-panel) 0 0; }
.list-group-item:last-child { border-radius: 0 0 var(--radius-panel) var(--radius-panel); }
.list-group-item.active { background: var(--gradient-brand); border-color: transparent; color: #fff; }

.dropdown-menu {
    padding: 6px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: var(--text-body-m);
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-sunken); color: var(--text-primary); }
.dropdown-item.active { background: var(--gradient-brand); color: #fff; }
.dropdown-divider { border-top-color: var(--border-subtle); }

.modal-content {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-lg);
}
.modal-header, .modal-footer { border-color: var(--border-subtle); }

.progress { background: var(--surface-sunken); border-radius: var(--radius-pill); }
.progress-bar { background: var(--gradient-brand); }

.accordion-item { background: var(--surface-card); border-color: var(--border-subtle); }
.accordion-button { background: var(--surface-card); color: var(--text-primary); }
.accordion-button:not(.collapsed) { background: var(--surface-sunken); color: var(--text-primary); box-shadow: none; }
.accordion-button:focus { box-shadow: var(--ring-focus); }

/* ── 9. Ticket board — identity by border style AND tint ───────────────────── */
.fm-col-new { border-top: 3px solid var(--signal-blue) !important; }
.fm-col-progress { border-top: 3px solid var(--brand-primary) !important; }
.fm-col-waiting { border-top: 3px dashed var(--brand-warning) !important; }
.fm-col-done { border-top: 3px solid var(--brand-success) !important; }
.fm-col-archived { border-top: 3px dotted var(--text-muted) !important; }
.fm-card-overdue { border: 1px solid var(--tint-danger-bd) !important; box-shadow: var(--glow-brand); }

/* ── 10. Layout components ─────────────────────────────────────────────────── */
/* Vertical rhythm for refitted pages. */
.fm-stack { display: flex; flex-direction: column; gap: 20px; }
.fm-stack-sm { display: flex; flex-direction: column; gap: 12px; }

/* Page header: title + optional sub-line on the left, actions on the right. */
.fm-pagehead {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.fm-pagehead h1 { margin: 0; }
.fm-pagehead-sub { color: var(--text-muted); font-size: var(--text-body-s); }

/* Generic surface panel — the .card look without Bootstrap's body/header split. */
.fm-panel {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}
.fm-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    font-size: var(--text-heading-s);
    color: var(--text-primary);
}

/* KPI tiles. */
.fm-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}
.fm-kpi {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    text-align: left;
    text-decoration: none;
    transition: transform var(--duration-normal) var(--ease-out),
                box-shadow var(--duration-normal) var(--ease-standard);
}
.fm-kpi:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    color: var(--text-primary);
    text-decoration: none;
}
.fm-kpi-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--tint-neutral-bg);
    color: var(--text-secondary);
}
.fm-kpi-value {
    display: block;
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: var(--weight-bold);
    line-height: 1.1;
}
.fm-kpi-label { display: block; margin-top: 2px; font-size: var(--text-body-s); color: var(--text-secondary); }
.fm-kpi-rule { display: block; width: 36px; height: 3px; border-radius: var(--radius-pill); background: currentColor; }

/* Per-tile accents. Tone classes set both the icon chip and the rule colour. */
.fm-tone-teal { color: var(--brand-primary); }
.fm-tone-teal .fm-kpi-icon { background: rgba(0, 182, 148, 0.12); color: var(--brand-primary); }
.fm-tone-blue { color: var(--signal-blue); }
.fm-tone-blue .fm-kpi-icon { background: rgba(63, 123, 255, 0.12); color: var(--signal-blue); }
.fm-tone-purple { color: var(--pulse-purple); }
.fm-tone-purple .fm-kpi-icon { background: rgba(106, 63, 224, 0.12); color: var(--pulse-purple); }
.fm-tone-red { color: var(--tint-danger-fg); }
.fm-tone-red .fm-kpi-icon { background: var(--tint-danger-bg); color: var(--tint-danger-fg); }
.fm-tone-orange { color: var(--tint-warning-fg); }
.fm-tone-orange .fm-kpi-icon { background: var(--tint-warning-bg); color: var(--tint-warning-fg); }
.fm-tone-green { color: var(--tint-success-fg); }
.fm-tone-green .fm-kpi-icon { background: var(--tint-success-bg); color: var(--tint-success-fg); }
.fm-tone-cyan { color: #1C8FB0; }
.fm-tone-cyan .fm-kpi-icon { background: rgba(78, 200, 232, 0.16); color: #1C8FB0; }

/* Quick-action chips. */
.fm-quickactions { display: flex; flex-wrap: wrap; gap: 10px; }
.fm-quickaction {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 16px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    color: var(--text-primary);
    font-weight: var(--weight-semibold);
    white-space: nowrap;
    text-decoration: none;
}
.fm-quickaction:hover {
    background: var(--surface-raised);
    border-color: var(--border-strong);
    color: var(--text-primary);
    text-decoration: none;
    box-shadow: var(--shadow-sm);
}

/* Filter toolbar and pills. */
.fm-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fm-filter-pill {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 16px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    color: var(--text-secondary);
    font-size: var(--text-body-s);
    font-weight: var(--weight-semibold);
    text-decoration: none;
}
.fm-filter-pill:hover { color: var(--text-primary); border-color: var(--border-strong); text-decoration: none; }
.fm-filter-pill.active {
    background: var(--gradient-brand);
    border-color: transparent;
    color: #fff;
}

/* Inline search field used on list pages. */
.fm-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 220px;
    min-width: 0;
    max-width: 360px;
    min-height: 42px;
    padding: 0 14px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    color: var(--text-muted);
}
.fm-search:focus-within { border-color: var(--border-focus); box-shadow: var(--ring-focus); }
.fm-search input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
}

/* Empty state. */
.fm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 48px 20px;
    color: var(--text-secondary);
}
.fm-empty-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-pill);
    background: var(--tint-neutral-bg);
    color: var(--text-muted);
}
.fm-empty-title { font-weight: var(--weight-bold); color: var(--text-primary); }

/* Centred single-message card — errors, access denied, login. */
.fm-centre {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 20px 0;
}
.fm-centre-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    width: 100%;
    max-width: 460px;
    padding: 40px 32px;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-lg);
}
.fm-centre-card.is-form { align-items: stretch; text-align: left; }

/* Brandmark. The markup contract (.fm-wordmark wrapping .fm-mark) is shared with
   the classic theme, which renders it as a road-marking square; here it becomes
   the gradient "F" tile from the design. */
.fm-wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    letter-spacing: var(--tracking-caps);
    text-transform: uppercase;
    color: var(--text-primary);
}
.fm-mark {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: var(--radius-brand);
    background: var(--gradient-brand);
    box-shadow: var(--glow-brand);
}
.fm-mark::after {
    content: "F";
    color: #fff;
    font-family: var(--font-display);
    font-weight: var(--weight-bold);
    font-size: 20px;
    line-height: 1;
}

/* Definition grid — the vehicle-detail fact panel. */
.fm-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}
.fm-fact-label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--text-muted); }
.fm-fact-value { font-weight: var(--weight-bold); }

/* Split layout — main column plus a meta rail. */
.fm-split { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 992px) { .fm-split { grid-template-columns: 2fr 1fr; } }

/* Toggle switch (notification settings). */
.fm-switch {
    position: relative;
    width: 46px;
    height: 26px;
    flex: none;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
    cursor: pointer;
}
.fm-switch[aria-checked="true"] { background: var(--gradient-brand); }
.fm-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: var(--radius-pill);
    background: #fff;
    transition: left var(--duration-fast) var(--ease-standard);
}
.fm-switch[aria-checked="true"]::after { left: 23px; }

/* Theme preview tiles (Verwaltung → Design). */
.fm-themecard {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 190px;
    padding: 8px;
    text-align: center;
    background: var(--surface-raised);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    cursor: pointer;
}
.fm-themecard.active { border-color: var(--brand-primary); }
.fm-themecard-swatch { position: relative; height: 56px; border-radius: var(--radius-md); }
.fm-themecard-check {
    position: absolute;
    top: 6px;
    right: 6px;
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
}

/* ── 11. Utilities (match Bootstrap's !important) ──────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-danger { color: var(--tint-danger-fg) !important; }
.text-success { color: var(--tint-success-fg) !important; }
.text-warning { color: var(--tint-warning-fg) !important; }
.text-info, .text-primary { color: var(--brand-primary) !important; }
.text-dark { color: var(--text-primary) !important; }

.bg-light { background-color: var(--surface-sunken) !important; }
.bg-white { background-color: var(--surface-raised) !important; }
.bg-dark { background-color: var(--navy-850) !important; }

.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--border-subtle) !important; }
.border-primary, .border-success { border-color: var(--brand-primary) !important; }
.border-danger { border-color: var(--tint-danger-bd) !important; }
.border-warning { border-color: var(--tint-warning-bd) !important; }
.border-secondary, .border-dark, .border-info { border-color: var(--border-strong) !important; }

.rounded, .rounded-3 { border-radius: var(--radius-md) !important; }
.rounded-pill { border-radius: var(--radius-pill) !important; }

.font-mono { font-family: var(--font-mono); }
.fm-plate { font-family: var(--font-mono); font-weight: var(--weight-semibold); font-size: var(--text-body-s); }

.fm-disabled-feature { color: rgba(255, 255, 255, 0.45) !important; text-decoration: none; }

/* ── 12. Focus, motion, print ──────────────────────────────────────────────── */
:focus-visible {
    outline: none;
    box-shadow: var(--ring-focus);
    border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .fm-sidebar, .fm-topbar, .fm-nav-backdrop, .btn, form[role="search"] { display: none !important; }
    .fm-shell { padding-left: 0; }
    .fm-main { padding: 0; }
    body { background: #fff; }
    .card, .table, .table-responsive, .fm-panel {
        border: 1px solid #ccc;
        box-shadow: none;
    }
    a { color: #000; text-decoration: none; }
}
