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

   Loaded after bootstrap.min.css and site.css, only when the request resolves to
   the orange theme (Services/FleetmanTheme.cs), so selectors here are deliberately
   unscoped: the file is never present in a classic- or modern-theme document.
   Custom properties come from css/tokens-orange.css and already encode both the
   light and dark palette — nothing below branches on [data-fm-color-mode]; every
   rule just reads a token and gets the right value for whichever mode is active.

   Design language: a white (dark: elevated graphite) sidebar and topbar, a soft
   neutral canvas, white/raised cards, orange reserved for brand — active nav,
   primary actions, focus, selected states — never applied wholesale. Status is
   colour *and* icon *and* label, never colour alone.

   Reuses the exact shell markup contract from Pages/Shared/_NavigationModern.cshtml
   (fm-sidebar*, fm-topbar*, fm-user*, …) — that partial carries no theme-specific
   colours, so it needed no changes to serve the orange theme.

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

h1, .h1, h1.h3, h1.h4 { 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); }

a { color: var(--brand-primary); text-decoration: none; }
a:hover { color: var(--brand-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(255, 90, 0, 0.22); }

.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 — white/raised, not dark navy ───────────────────────── */
.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(--surface-raised);
    border-right: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    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: var(--text-primary);
    text-decoration: none;
}
.fm-sidebar-brand:hover { color: var(--text-primary); 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: 16px;
    letter-spacing: 0;
    white-space: nowrap;
    color: var(--text-primary);
}

.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: var(--text-secondary);
    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: var(--surface-subtle);
    color: var(--text-primary);
    text-decoration: none;
}
.fm-sidebar-item > span:not(.fm-sidebar-badge) { flex: 1 1 auto; min-width: 0; }

.fm-sidebar-item.active {
    background: var(--tint-brand-bg);
    color: var(--tint-brand-fg);
}

.fm-sidebar-item.is-off { color: var(--text-muted); opacity: 0.72; }

.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: var(--text-secondary);
    font-size: var(--text-body-s);
    font-weight: var(--weight-medium);
    text-decoration: none;
}
.fm-sidebar-subitem:hover, .fm-sidebar-subitem:focus-visible {
    background: var(--surface-subtle);
    color: var(--text-primary);
    text-decoration: none;
}
.fm-sidebar-subitem.active {
    background: var(--tint-brand-bg);
    border-left-color: var(--brand-primary);
    color: var(--tint-brand-fg);
}

.fm-sidebar-badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 7px;
    flex: none;
    border-radius: var(--radius-pill);
    background: var(--tint-neutral-bg);
    color: var(--tint-neutral-fg);
    font-size: 10px;
    font-weight: var(--weight-bold);
    letter-spacing: 0.06em;
}
.fm-sidebar-badge.is-count { background: var(--tint-danger-bg); color: var(--tint-danger-fg); }

.fm-sidebar-footer {
    flex: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 12px 16px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    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: var(--text-secondary);
    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: var(--surface-subtle); color: var(--text-primary); }

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

@media (max-width: 1399.98px) {
    .fm-shell { padding-left: 0; }
    .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; }
}

/* ── 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 28px;
    background: var(--surface-base);
    border-bottom: 1px solid var(--border-subtle);
}

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

.fm-iconbutton {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    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-subtle);
    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; } }

/* Color-mode quick toggle (Hell/Dunkel/System) — see wwwroot/js/shell.js */
.fm-modetoggle {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: var(--touch-target);
    padding: 0 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-pill);
    background: var(--surface-raised);
    color: var(--text-secondary);
    font-size: var(--text-body-s);
    font-weight: var(--weight-semibold);
    cursor: pointer;
}
.fm-modetoggle:hover, .fm-modetoggle:focus-visible { background: var(--surface-subtle); color: var(--text-primary); }
@media (max-width: 575.98px) {
    /* Same treatment as the "+Neu" button's d-none d-sm-inline label: icon-only
       below Bootstrap's sm breakpoint. Without this the topbar (navtoggle +
       modetoggle + Neu + bell + avatar, no wrap) overflows a 390px viewport. */
    .fm-modetoggle { gap: 0; padding: 0; width: var(--touch-target); justify-content: center; }
    .fm-modetoggle span[data-fm-mode-label] { display: none; }
}

.fm-searchpill {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 560px;
    min-height: var(--touch-target);
    padding: 0 12px 0 16px;
    background: var(--surface-subtle);
    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(--tint-danger-fg);
    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-subtle); }

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

.btn-primary, .btn-success, .btn-primary:disabled, .btn-primary.disabled {
    background: var(--gradient-brand);
    background-color: var(--brand-primary);
    border: 0;
    color: var(--on-brand);
    box-shadow: var(--glow-cta);
}
.btn-primary:hover, .btn-primary:focus, .btn-success:hover, .btn-success:focus {
    filter: brightness(1.05);
    color: var(--on-brand);
    box-shadow: var(--glow-brand);
}
.btn-primary:active, .btn-success:active { filter: brightness(0.95); color: var(--on-brand); }
.btn-primary:disabled, .btn-primary.disabled { opacity: 0.55; box-shadow: none; }

.btn-secondary, .btn-light, .btn-warning, .btn-info,
.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-secondary:hover, .btn-outline-success:hover, .btn-outline-warning:hover, .btn-outline-info:hover, .btn-outline-dark:hover, .btn-outline-light:hover {
    background-color: var(--surface-subtle);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Outline-brand: orange rim, orange text, never a solid danger-adjacent fill. */
.btn-outline-primary {
    background-color: var(--surface-raised);
    border: 1px solid var(--brand-primary);
    color: var(--brand-primary);
}
.btn-outline-primary:hover, .btn-outline-primary:focus {
    background-color: var(--tint-brand-bg);
    border-color: var(--brand-primary);
    color: var(--brand-pressed);
}

/* Danger stays red — never orange, per brand rule. */
.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(--tint-danger-fg);
    border-color: var(--tint-danger-fg);
    color: #fff;
}

.btn-dark { background-color: var(--text-primary); border-color: var(--text-primary); color: var(--surface-raised); }
.btn-link { color: var(--brand-primary); text-decoration: none; font-weight: var(--weight-semibold); }
.btn-link:hover { color: var(--brand-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); }

.card { background: var(--surface-raised); 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; }

.table {
    --bs-table-bg: transparent;
    color: var(--text-primary);
    background: var(--surface-raised);
    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-raised); 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-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-hover); color: var(--text-primary); }
.table-sm > :not(caption) > * > * { padding: 9px 12px; }
.table-actions { white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 0.3rem 0.7rem; border-radius: var(--radius-pill); font-size: 12px; font-weight: var(--weight-bold); 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-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-pill);
    border: 1px solid transparent;
    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: var(--text-primary); border-color: transparent; color: var(--surface-raised); }
.deadline-badge { font-size: 12px; }

.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(--tint-success-fg); color: var(--tint-success-fg); }
.alert-warning { background: var(--tint-warning-bg); border-color: var(--tint-warning-bd); border-left-color: var(--tint-warning-fg); color: var(--tint-warning-fg); }
.alert-danger { background: var(--tint-danger-bg); border-color: var(--tint-danger-bd); border-left-color: var(--tint-danger-fg); color: var(--tint-danger-fg); }
.alert-info, .alert-primary { background: var(--tint-info-bg); border-color: var(--tint-info-bd); border-left-color: var(--tint-info-fg); 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;
    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-subtle); 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(--tint-danger-fg); }
.form-control.is-valid, .form-select.is-valid { border-color: var(--tint-success-fg); }
.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 ──────────────────────────────────────────────── */
.nav-tabs {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    flex-wrap: wrap;
    gap: 4px;
    padding: 4px;
    background: var(--surface-subtle);
    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: var(--surface-hover); color: var(--text-primary); }
.nav-tabs .nav-link.active { background: var(--surface-raised); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.nav-tabs .nav-link.disabled { color: var(--text-muted); opacity: 0.6; }

.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-raised); border-color: var(--border-subtle); }
.page-link:hover { background: var(--surface-subtle); 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-subtle); }

.list-group { border-radius: var(--radius-panel); }
.list-group-item { background: var(--surface-raised); 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-raised); 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-subtle); 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-raised); 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-subtle); border-radius: var(--radius-pill); }
.progress-bar { background: var(--gradient-brand); }

.accordion-item { background: var(--surface-raised); border-color: var(--border-subtle); }
.accordion-button { background: var(--surface-raised); color: var(--text-primary); }
.accordion-button:not(.collapsed) { background: var(--surface-subtle); 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(--tint-info-fg) !important; }
.fm-col-progress { border-top: 3px solid var(--brand-primary) !important; }
.fm-col-waiting { border-top: 3px dashed var(--tint-warning-fg) !important; }
.fm-col-done { border-top: 3px solid var(--tint-success-fg) !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 ─────────────────────────────────────────────────── */
.fm-stack { display: flex; flex-direction: column; gap: 20px; }
.fm-stack-sm { display: flex; flex-direction: column; gap: 12px; }

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

.fm-panel { background: var(--surface-raised); 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 — a single orange-tinted icon chip for every tile (brand used
   consistently, not a rainbow of hues); Kpi.Tone from Pages/Index.cshtml.cs still
   works unmodified — every fm-tone-* below just maps to the same brand tint. */
.fm-kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1200px) { .fm-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .fm-kpi-grid { grid-template-columns: 1fr; } }

.fm-kpi {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    background: var(--surface-raised);
    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:focus-visible { box-shadow: var(--ring-focus); }
.fm-kpi-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: var(--radius-md); background: var(--tint-brand-bg); color: var(--tint-brand-fg); }
.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: 32px; height: 3px; border-radius: var(--radius-pill); background: var(--brand-primary); }
.fm-tone-teal, .fm-tone-blue, .fm-tone-purple, .fm-tone-red, .fm-tone-orange, .fm-tone-green, .fm-tone-cyan { color: var(--text-primary); }
.fm-tone-teal .fm-kpi-icon, .fm-tone-blue .fm-kpi-icon, .fm-tone-purple .fm-kpi-icon,
.fm-tone-red .fm-kpi-icon, .fm-tone-orange .fm-kpi-icon, .fm-tone-green .fm-kpi-icon, .fm-tone-cyan .fm-kpi-icon {
    background: var(--tint-brand-bg);
    color: var(--tint-brand-fg);
}

.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-raised);
    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-hover); border-color: var(--border-strong); color: var(--text-primary); text-decoration: none; box-shadow: var(--shadow-sm); }
.fm-quickaction.is-brand { border-color: var(--brand-primary); color: var(--brand-primary); }
.fm-quickaction.is-brand:hover { background: var(--tint-brand-bg); color: var(--brand-pressed); }

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

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

.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(--surface-subtle); color: var(--text-muted); }
.fm-empty-title { font-weight: var(--weight-bold); color: var(--text-primary); }

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

.fm-wordmark { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--font-display); font-weight: var(--weight-bold); 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; }

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

.fm-split { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 992px) { .fm-split { grid-template-columns: 2fr 1fr; } }

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

.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-subtle) !important; }
.bg-white { background-color: var(--surface-raised) !important; }
.bg-dark { background-color: var(--text-primary) !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: var(--text-muted) !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; }
}
