/* ==========================================================================
   Mitchell County HelpDesk — v2 design system
   Theme: Carbon + Steel Blue (dark-first; light theme retained).
   Loaded AFTER bootstrap/site.css/dashboard-theme.css. It re-points the legacy
   tokens (so every page inherits the palette) and restyles shared components.

   Approved dark palette
     background #111820 · sidebar #161F2A · cards #252F3A · borders #3B4755
     accent #3B82F6 · highlight #93C5FD · text #F8FAFC · secondary text #CBD5E1
   ========================================================================== */

/* ── 1. Tokens ────────────────────────────────────────────────────────────── */
:root {
    /* Light theme (kept; dark is the default) — slate neutrals, blue accents */
    --hd-bg: #EEF2F6;
    --hd-bg-glow: rgba(59, 130, 246, 0.07);
    --hd-surface: #FFFFFF;
    --hd-surface-2: #F4F7FA;          /* inset wells: table heads, meters, mini stats */
    --hd-surface-hover: rgba(37, 99, 235, 0.06);
    --hd-border: #D5DDE6;
    --hd-border-strong: #BCC7D3;
    --hd-text: #0F172A;
    --hd-text-2: #334155;
    --hd-muted: #5B6B7F;              /* tertiary/meta text — AA on white */
    --hd-accent: #2563EB;             /* light theme uses the deeper blue for AA contrast */
    --hd-accent-hover: #1D4ED8;
    --hd-accent-soft: rgba(37, 99, 235, 0.09);
    --hd-accent-text: #1D4ED8;
    --hd-accent-bd: rgba(37, 99, 235, 0.28);
    --hd-ring: rgba(59, 130, 246, 0.40);
    --hd-shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 22px -14px rgba(15, 23, 42, 0.18);
    --hd-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.06), 0 18px 34px -16px rgba(30, 64, 175, 0.28);
    --hd-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    --hd-glass: rgba(255, 255, 255, 0.80);
    --hd-glass-strong: rgba(255, 255, 255, 0.94);
    --hd-input-bg: #FFFFFF;

    /* Sidebar + welcome banner stay carbon in both themes */
    --hd-side-bg: #161F2A;
    --hd-side-border: #222C38;
    --hd-side-text: #CBD5E1;
    --hd-side-muted: rgba(203, 213, 225, 0.45);
    --hd-side-hover: rgba(255, 255, 255, 0.05);
    --hd-side-active-bg: rgba(59, 130, 246, 0.16);
    --hd-side-active-bd: rgba(59, 130, 246, 0.38);
    --hd-banner-bg: linear-gradient(135deg, #1B2430 0%, #222D3A 55%, #1C2836 100%);
    --hd-banner-border: #3B4755;

    --hd-radius-sm: 8px;
    --hd-radius: 12px;
    --hd-radius-lg: 14px;
    --hd-radius-xl: 18px;

    --hd-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --hd-fast: 140ms;
    --hd-med: 240ms;

    --hd-font: "Inter", "Segoe UI Variable Text", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --hd-font-display: "Inter", "Segoe UI Variable Display", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

    --sidebar-width: 264px;
    --topbar-height: 64px;

    /* Legacy tokens re-pointed (site.css / dashboard-theme.css / inline view styles) */
    --bg: var(--hd-bg);
    --page-bg: var(--hd-bg);
    --card: var(--hd-surface);
    --card-bg: var(--hd-surface);
    --text: var(--hd-text);
    --text-primary: var(--hd-text);
    --muted: var(--hd-muted);
    --text-secondary: var(--hd-muted);
    --border: var(--hd-border);
    --link: var(--hd-accent-text);
    --accent-primary: var(--hd-accent);
    --accent-purple-light: var(--hd-accent-soft);   /* legacy name, now the blue accent tint */
    --card-radius: var(--hd-radius-lg);
    --card-shadow: var(--hd-shadow);
    --radius: var(--hd-radius);
    --radius-sm: var(--hd-radius-sm);
    --shadow: var(--hd-shadow);
    --shadow-hover: var(--hd-shadow-hover);

    /* Semantic colours (light) — fg / tinted bg / border.
       blue = informational/active · green = success/resolved · amber = warning/pending
       orange = on hold · red = overdue/critical · gray = closed/inactive · cyan = scheduled */
    --hd-blue: #1D4ED8;    --hd-blue-bg: rgba(37, 99, 235, 0.08);   --hd-blue-bd: rgba(37, 99, 235, 0.26);
    --hd-active-fg: #FFFFFF; --hd-active-bg: #2563EB;               --hd-active-bd: #2563EB;
    --hd-green: #166534;   --hd-green-bg: rgba(34, 197, 94, 0.12);  --hd-green-bd: rgba(22, 163, 74, 0.30);
    --hd-amber: #92400E;   --hd-amber-bg: rgba(245, 158, 11, 0.15); --hd-amber-bd: rgba(217, 119, 6, 0.36);
    --hd-orange: #9A3412;  --hd-orange-bg: rgba(249, 115, 22, 0.12);--hd-orange-bd: rgba(234, 88, 12, 0.32);
    --hd-red: #B91C1C;     --hd-red-bg: rgba(239, 68, 68, 0.10);    --hd-red-bd: rgba(220, 38, 38, 0.30);
    --hd-gray: #475569;    --hd-gray-bg: rgba(100, 116, 139, 0.10); --hd-gray-bd: rgba(100, 116, 139, 0.26);
    --hd-cyan: #0E7490;    --hd-cyan-bg: rgba(6, 182, 212, 0.10);   --hd-cyan-bd: rgba(8, 145, 178, 0.28);

    color-scheme: light;
}

html[data-theme="dark"] {
    --hd-bg: #111820;
    --hd-bg-glow: rgba(59, 130, 246, 0.06);
    --hd-surface: #252F3A;
    --hd-surface-2: #1C2530;
    --hd-surface-hover: rgba(59, 130, 246, 0.09);
    --hd-border: #3B4755;
    --hd-border-strong: #4A5868;
    --hd-text: #F8FAFC;
    --hd-text-2: #CBD5E1;
    --hd-muted: #94A3B8;              /* tertiary/meta text — ≥5:1 on #252F3A */
    --hd-accent: #3B82F6;
    --hd-accent-hover: #2563EB;
    --hd-accent-soft: rgba(59, 130, 246, 0.14);
    --hd-accent-text: #93C5FD;
    --hd-accent-bd: rgba(59, 130, 246, 0.40);
    --hd-ring: rgba(59, 130, 246, 0.55);
    --hd-shadow: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 26px -14px rgba(0, 0, 0, 0.65);
    --hd-shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 20px 38px -18px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(59, 130, 246, 0.25);
    --hd-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    --hd-glass: rgba(17, 24, 32, 0.78);
    --hd-glass-strong: rgba(37, 47, 58, 0.96);
    --hd-input-bg: #1C2530;

    --hd-blue: #93C5FD;    --hd-blue-bg: rgba(59, 130, 246, 0.14);  --hd-blue-bd: rgba(59, 130, 246, 0.38);
    --hd-active-fg: #EFF6FF; --hd-active-bg: rgba(59, 130, 246, 0.42); --hd-active-bd: #3B82F6;
    --hd-green: #86EFAC;   --hd-green-bg: rgba(34, 197, 94, 0.14);  --hd-green-bd: rgba(34, 197, 94, 0.34);
    --hd-amber: #FCD34D;   --hd-amber-bg: rgba(245, 158, 11, 0.14); --hd-amber-bd: rgba(245, 158, 11, 0.36);
    --hd-orange: #FDBA74;  --hd-orange-bg: rgba(249, 115, 22, 0.14);--hd-orange-bd: rgba(249, 115, 22, 0.36);
    --hd-red: #FCA5A5;     --hd-red-bg: rgba(239, 68, 68, 0.16);    --hd-red-bd: rgba(239, 68, 68, 0.40);
    --hd-gray: #CBD5E1;    --hd-gray-bg: rgba(148, 163, 184, 0.12); --hd-gray-bd: rgba(148, 163, 184, 0.30);
    --hd-cyan: #67E8F9;    --hd-cyan-bg: rgba(6, 182, 212, 0.12);   --hd-cyan-bd: rgba(34, 211, 238, 0.30);

    /* Legacy dark-mode tokens → Carbon palette.
       site.css and dashboard-theme.css redefine these under html[data-theme="dark"], which
       outranks the :root re-points above; restating them here (same selector, loaded later)
       makes every legacy rule that uses them follow the Carbon palette. */
    --bg: var(--hd-bg);
    --page-bg: var(--hd-bg);
    --card: var(--hd-surface);
    --card-bg: var(--hd-surface);
    --text: var(--hd-text);
    --text-primary: var(--hd-text);
    --muted: var(--hd-muted);
    --text-secondary: var(--hd-muted);
    --border: var(--hd-border);
    --link: var(--hd-accent-text);
    --shadow: var(--hd-shadow);
    --shadow-hover: var(--hd-shadow-hover);
    --card-shadow: var(--hd-shadow);
    /* Legacy link/ticket-number blue (View all, View Schedule, recent ticket numbers…):
       #2563EB is too dark on carbon cards, so dark mode uses the steel-blue highlight. */
    --accent-blue: #93C5FD;

    --accent-green-light: rgba(34, 197, 94, 0.16);
    --accent-orange-light: rgba(249, 115, 22, 0.16);
    --accent-red-light: rgba(239, 68, 68, 0.16);
    --accent-blue-light: rgba(59, 130, 246, 0.16);
    --accent-teal-light: rgba(6, 182, 212, 0.14);

    color-scheme: dark;
}

/* ── 2. Base ──────────────────────────────────────────────────────────────── */
html { font-size: 15px; }
@media (min-width: 768px) { html { font-size: 15px; } }

body,
html[data-theme="dark"] body {
    font-family: var(--hd-font);
    color: var(--hd-text);
    background:
        radial-gradient(1000px 560px at 8% -14%, var(--hd-bg-glow), transparent 62%),
        var(--hd-bg) !important;
    background-attachment: fixed !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    animation: none;
    letter-spacing: -0.003em;
}

h1, h2, h3, h4, h5, h6, .display-5 { font-family: var(--hd-font-display); letter-spacing: -0.02em; color: var(--hd-text); }
a { color: var(--hd-accent-text); }
a:hover { color: var(--hd-accent); opacity: 1; }
html[data-theme="dark"] a:hover { color: #BFDBFE; }
::selection { background: rgba(59, 130, 246, 0.35); color: inherit; }

.text-muted, html[data-theme="dark"] .text-muted { color: var(--hd-muted) !important; }

:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: 2px; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--hd-border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--hd-border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
html[data-theme="dark"] *::-webkit-scrollbar-thumb { background: var(--hd-border-strong); background-clip: content-box; }

/* Numbers that change (stats, counts) don't jitter */
.dash-stat-value, .stat-card-value, .hd-num, .dept-progress-count { font-variant-numeric: tabular-nums; }

/* ── 3. App shell ─────────────────────────────────────────────────────────── */
.app-page-content,
html[data-theme="dark"] .app-page-content { background: transparent !important; padding: 1.5rem 1.75rem 2.25rem; }

.app-main { transition: margin-left var(--hd-med) var(--hd-ease); }

/* Sidebar — slightly darker than the cards, in both themes */
.app-sidebar {
    width: var(--sidebar-width);
    background: var(--hd-side-bg);
    border-right: 1px solid var(--hd-side-border);
    box-shadow: 6px 0 24px -20px rgba(0, 0, 0, 0.9);
    transition: width var(--hd-med) var(--hd-ease), transform 0.3s var(--hd-ease);
    view-transition-name: hd-sidebar;
}
.app-sidebar::before {
    /* faint steel-blue sheen behind the brand */
    content: "";
    position: absolute;
    inset: -90px -60px auto -60px;
    height: 240px;
    background: radial-gradient(closest-side, rgba(59, 130, 246, 0.13), transparent);
    pointer-events: none;
}

.sidebar-brand {
    position: relative;
    padding: 1.15rem 1.1rem 1.05rem 1.15rem;
    border-bottom: 1px solid var(--hd-side-border);
    gap: 0.75rem;
}
.sidebar-brand-icon {
    width: 40px; height: 40px;
    border-radius: 11px;
    background: linear-gradient(140deg, #3B82F6 0%, #1D4ED8 100%);
    box-shadow: 0 6px 16px -8px rgba(59, 130, 246, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    font-size: 1.15rem;
}
.sidebar-brand-county { font-size: 0.8rem; letter-spacing: 0.04em; text-transform: none; font-weight: 700; color: #F8FAFC; }
.sidebar-brand-sub { font-size: 0.62rem; letter-spacing: 0.14em; color: rgba(147, 197, 253, 0.7); }

.sidebar-nav { padding: 0.5rem 0.75rem 0.75rem; position: relative; }
.sidebar-section-label {
    padding: 1rem 0.65rem 0.35rem;
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    color: var(--hd-side-muted);
}
.sidebar-nav-link {
    margin: 1px 0;
    padding: 0.52rem 0.7rem;
    border-radius: 10px;
    color: var(--hd-side-text);
    font-size: 0.86rem;
    gap: 0.7rem;
    transition: color var(--hd-fast) ease, background var(--hd-fast) ease, transform var(--hd-fast) var(--hd-ease);
}
.sidebar-nav-link .nav-icon {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    font-size: 1rem;
    opacity: 0.9;
    transition: background var(--hd-fast) ease, color var(--hd-fast) ease, transform var(--hd-med) var(--hd-ease);
}
.sidebar-nav-link:hover {
    color: #F8FAFC;
    background: var(--hd-side-hover);
    transform: translateX(2px);
}
.sidebar-nav-link:hover .nav-icon { transform: scale(1.08); color: #93C5FD; }
.sidebar-nav-link.active {
    color: #F8FAFC;
    background: var(--hd-side-active-bg);
    box-shadow: inset 0 0 0 1px var(--hd-side-active-bd);
    font-weight: 600;
}
.sidebar-nav-link.active::before {
    left: -0.75rem; top: 22%; bottom: 22%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #3B82F6;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.75);
}
.sidebar-nav-link.active .nav-icon {
    background: #3B82F6;
    color: #fff;
    box-shadow: 0 6px 14px -8px rgba(59, 130, 246, 0.9);
}
.sidebar-nav-link:focus-visible { outline: 2px solid #93C5FD; outline-offset: 1px; }

.sidebar-footer { border-top: 1px solid var(--hd-side-border); padding: 0.85rem 1rem 1rem; }
.sidebar-support-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--hd-side-border);
    border-radius: 12px;
    color: rgba(203, 213, 225, 0.6);
}

/* Desktop collapse toggle (lives in the topbar) */
.topbar-collapse-btn {
    display: none;
    width: 38px; height: 38px;
    align-items: center; justify-content: center;
    border-radius: 10px;
    border: 1px solid var(--hd-border);
    background: transparent;
    color: var(--hd-muted);
    padding: 0;
    font-size: 1.1rem;
    transition: background var(--hd-fast) ease, color var(--hd-fast) ease, border-color var(--hd-fast) ease;
}
.topbar-collapse-btn:hover { color: var(--hd-text); background: var(--hd-surface-hover); border-color: var(--hd-accent-bd); }
.topbar-collapse-btn i { transition: transform var(--hd-med) var(--hd-ease); }
@media (min-width: 992px) {
    .topbar-collapse-btn { display: inline-flex; }

    /* Collapsed icon rail */
    html.hd-sidebar-collapsed { --sidebar-width: 78px; }
    html.hd-sidebar-collapsed .topbar-collapse-btn i { transform: rotate(180deg); }
    html.hd-sidebar-collapsed .sidebar-brand { justify-content: center; padding-left: 0.5rem; padding-right: 0.5rem; }
    html.hd-sidebar-collapsed .sidebar-brand-text,
    html.hd-sidebar-collapsed .nav-label,
    html.hd-sidebar-collapsed .sidebar-footer { display: none; }
    html.hd-sidebar-collapsed .sidebar-nav { padding-left: 0.6rem; padding-right: 0.6rem; }
    html.hd-sidebar-collapsed .sidebar-section-label {
        font-size: 0; padding: 0.55rem 0.4rem 0.35rem; height: 0.9rem;
    }
    html.hd-sidebar-collapsed .sidebar-section-label::after {
        content: ""; display: block; height: 1px; background: var(--hd-side-border); margin: 0 0.3rem;
    }
    html.hd-sidebar-collapsed .sidebar-nav-link { justify-content: center; padding: 0.45rem; }
    html.hd-sidebar-collapsed .sidebar-nav-link:hover { transform: none; }
    html.hd-sidebar-collapsed .sidebar-nav-link.active::before { left: -0.6rem; }
    html.hd-sidebar-collapsed #sidebarMessagesBadge {
        position: absolute; top: 2px; right: 6px; font-size: 0.55rem; padding: 2px 4px;
    }
}

/* Mobile overlay */
.sidebar-overlay { background: rgba(8, 12, 17, 0.6); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

/* Topbar — sticky glass */
.app-topbar,
html[data-theme="dark"] .app-topbar {
    height: var(--topbar-height);
    background: var(--hd-glass);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-bottom: 1px solid var(--hd-border);
    box-shadow: none;
    padding: 0 1.5rem;
    view-transition-name: hd-topbar;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .app-topbar, html[data-theme="dark"] .app-topbar { background: var(--hd-bg); }
}
.topbar-page-title,
html[data-theme="dark"] .topbar-page-title {
    font-family: var(--hd-font-display);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--hd-text);
}
.topbar-icon-btn, .topbar-hamburger,
html[data-theme="dark"] .topbar-icon-btn, html[data-theme="dark"] .topbar-hamburger {
    width: 38px; height: 38px;
    border-radius: 10px;
    color: var(--hd-muted);
    border: 1px solid transparent;
    transition: background var(--hd-fast) ease, color var(--hd-fast) ease, border-color var(--hd-fast) ease, transform var(--hd-fast) ease;
}
.topbar-icon-btn:hover, .topbar-hamburger:hover,
html[data-theme="dark"] .topbar-icon-btn:hover, html[data-theme="dark"] .topbar-hamburger:hover {
    color: var(--hd-text);
    background: var(--hd-surface-hover);
    border-color: var(--hd-border);
}
.topbar-icon-btn:active { transform: scale(0.94); }
.topbar-theme-btn i { transition: transform 0.5s var(--hd-ease); }
.topbar-theme-btn:hover i { transform: rotate(-20deg); }

.topbar-user-btn {
    border-radius: 12px;
    padding: 0.25rem 0.55rem 0.25rem 0.3rem;
    border: 1px solid var(--hd-border);
    transition: background var(--hd-fast) ease, border-color var(--hd-fast) ease;
}
.topbar-user-btn:hover,
html[data-theme="dark"] .topbar-user-btn:hover { background: var(--hd-surface-hover); border-color: var(--hd-accent-bd); }
.topbar-avatar {
    background: linear-gradient(140deg, #3B82F6, #1D4ED8) !important;
    color: #fff !important;
    border-radius: 10px !important;
    box-shadow: 0 6px 14px -8px rgba(59, 130, 246, 0.8);
}
.topbar-username, html[data-theme="dark"] .topbar-username { color: var(--hd-text); }
.topbar-userrole, html[data-theme="dark"] .topbar-userrole { color: var(--hd-muted); }

#notif-badge {
    background: #EF4444 !important;
    box-shadow: 0 0 0 2px var(--hd-bg), 0 4px 10px -3px rgba(239, 68, 68, 0.7);
}

/* Guest (sign-in) shell inherits the backdrop */
.guest-layout-shell, html[data-theme="dark"] .guest-layout-shell { background: transparent; }
.guest-logo-icon { background: linear-gradient(140deg, #3B82F6, #1D4ED8) !important; color: #fff !important; }

/* ── 4. Surfaces: cards, section cards, panels ──────────────────────────────
   Solid card surfaces + a visible 1px border separate content from the page. */
.card, .theme-card,
html[data-theme="dark"] .card {
    background: var(--hd-surface) !important;
    border: 1px solid var(--hd-border) !important;
    border-radius: var(--hd-radius-lg) !important;
    box-shadow: var(--hd-shadow), var(--hd-highlight);
    color: var(--hd-text) !important;
}
.card:hover, .theme-card:hover { transform: none; box-shadow: var(--hd-shadow), var(--hd-highlight); }
.card-header, .card-footer,
html[data-theme="dark"] .card-header, html[data-theme="dark"] .card-footer {
    background: transparent !important;
    border-color: var(--hd-border) !important;
}
.card-header { font-weight: 600; }
.card > .list-group:first-child .list-group-item:first-child,
.card > .card-header:first-child { border-top-left-radius: var(--hd-radius-lg); border-top-right-radius: var(--hd-radius-lg); }

.section-card,
html[data-theme="dark"] .section-card {
    background: var(--hd-surface);
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-lg);
    box-shadow: var(--hd-shadow), var(--hd-highlight);
}
.section-card-header { padding: 0.95rem 1.15rem 0.75rem; }
.section-card-title, html[data-theme="dark"] .section-card-title {
    font-family: var(--hd-font-display);
    font-size: 0.92rem; font-weight: 650; letter-spacing: -0.01em;
    color: var(--hd-text);
}
.section-card-divider { border-color: var(--hd-border) !important; opacity: 1; margin: 0; }
.section-card-body { padding: 0.95rem 1.15rem 1.05rem; }
.section-card-viewall {
    font-size: 0.76rem; font-weight: 600;
    color: var(--hd-accent-text);
    padding: 0.25rem 0.55rem; border-radius: 8px;
    transition: background var(--hd-fast) ease;
}
.section-card-viewall:hover { background: var(--hd-accent-soft); text-decoration: none; }
.section-icon-circle { width: 32px; height: 32px; border-radius: 10px; }

/* Icon chips (stat-icon-* / sq-*). "purple" is the legacy name for the brand accent → steel blue. */
.stat-icon-circle, .dash-stat-icon-sq { border-radius: 12px; }
.stat-icon-purple, .sq-purple, html[data-theme="dark"] .stat-icon-purple,
.stat-icon-blue,   .sq-blue,   html[data-theme="dark"] .stat-icon-blue   { background: var(--hd-blue-bg);   color: var(--hd-blue);   box-shadow: inset 0 0 0 1px var(--hd-blue-bd); }
.stat-icon-green,  .sq-green,  html[data-theme="dark"] .stat-icon-green  { background: var(--hd-green-bg);  color: var(--hd-green);  box-shadow: inset 0 0 0 1px var(--hd-green-bd); }
.stat-icon-orange, .sq-orange, html[data-theme="dark"] .stat-icon-orange { background: var(--hd-amber-bg);  color: var(--hd-amber);  box-shadow: inset 0 0 0 1px var(--hd-amber-bd); }
.stat-icon-red,    .sq-red,    html[data-theme="dark"] .stat-icon-red    { background: var(--hd-red-bg);    color: var(--hd-red);    box-shadow: inset 0 0 0 1px var(--hd-red-bd); }
.stat-icon-teal,   .sq-teal,   html[data-theme="dark"] .stat-icon-teal   { background: var(--hd-cyan-bg);   color: var(--hd-cyan);   box-shadow: inset 0 0 0 1px var(--hd-cyan-bd); }

/* Legacy pill badges (dashboard-theme.css) */
.badge-pill-purple, html[data-theme="dark"] .badge-pill-purple { background: var(--hd-blue-bg) !important; color: var(--hd-blue) !important; }

/* Stat cards (shared _StatCard partial) */
.stat-card-new,
html[data-theme="dark"] .stat-card-new {
    background: var(--hd-surface);
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-lg);
    box-shadow: var(--hd-shadow), var(--hd-highlight);
    transition: transform var(--hd-med) var(--hd-ease), box-shadow var(--hd-med) var(--hd-ease), border-color var(--hd-fast) ease;
}
a.stat-card-new:hover { transform: translateY(-3px); box-shadow: var(--hd-shadow-hover); border-color: var(--hd-accent-bd); }
.stat-card-label, html[data-theme="dark"] .stat-card-label { color: var(--hd-muted); letter-spacing: 0.06em; }
.stat-card-value, html[data-theme="dark"] .stat-card-value { color: var(--hd-text); font-family: var(--hd-font-display); }

/* Empty states */
.coming-soon-icon { background: var(--hd-accent-soft) !important; color: var(--hd-accent-text) !important; border-radius: 14px; }
.coming-soon-label, html[data-theme="dark"] .coming-soon-label { color: var(--hd-text-2); }

/* ── 5. Buttons ───────────────────────────────────────────────────────────── */
.btn {
    border-radius: 10px;
    font-weight: 600;
    letter-spacing: -0.005em;
    transition: transform var(--hd-fast) ease, box-shadow var(--hd-fast) ease, background var(--hd-fast) ease, border-color var(--hd-fast) ease, color var(--hd-fast) ease;
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn:focus-visible, .btn:focus { box-shadow: 0 0 0 3px var(--hd-ring) !important; outline: none; }

/* Primary: #2563EB fill keeps white label text at AA contrast; #3B82F6 edge + glow carry the accent */
.btn-primary,
html[data-theme="dark"] .btn-primary {
    background: #2563EB !important;
    border: 1px solid #3B82F6 !important;
    color: #fff !important;
    box-shadow: 0 6px 16px -10px rgba(59, 130, 246, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-primary:hover,
html[data-theme="dark"] .btn-primary:hover {
    background: #1D4ED8 !important;
    border-color: #60A5FA !important;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -10px rgba(59, 130, 246, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}
.btn-outline-primary,
html[data-theme="dark"] .btn-outline-primary {
    color: var(--hd-accent-text) !important;
    border-color: var(--hd-accent-bd) !important;
    background: var(--hd-accent-soft) !important;
}
.btn-outline-primary:hover,
html[data-theme="dark"] .btn-outline-primary:hover {
    background: #2563EB !important;
    border-color: #3B82F6 !important;
    color: #fff !important;
}
.btn-secondary, .btn-outline-secondary, .btn-light,
html[data-theme="dark"] .btn-outline-secondary {
    background: var(--hd-surface) !important;
    border: 1px solid var(--hd-border-strong) !important;
    color: var(--hd-text-2) !important;
}
.btn-secondary:hover, .btn-outline-secondary:hover, .btn-light:hover,
html[data-theme="dark"] .btn-outline-secondary:hover {
    background: var(--hd-surface-hover) !important;
    color: var(--hd-text) !important;
    border-color: var(--hd-accent-bd) !important;
}
.btn-success { background: #16A34A !important; border-color: #22C55E !important; color: #fff !important; }
.btn-success:hover { background: #15803D !important; }
.btn-danger  { background: #DC2626 !important; border-color: #EF4444 !important; color: #fff !important; }
.btn-danger:hover  { background: #B91C1C !important; }
.btn-outline-danger  { color: var(--hd-red) !important;   border-color: var(--hd-red-bd) !important;   background: var(--hd-red-bg) !important; }
.btn-outline-danger:hover  { background: #DC2626 !important; color: #fff !important; border-color: #EF4444 !important; }
.btn-outline-success { color: var(--hd-green) !important; border-color: var(--hd-green-bd) !important; background: var(--hd-green-bg) !important; }
.btn-outline-success:hover { background: #16A34A !important; color: #fff !important; border-color: #22C55E !important; }
.btn-link { color: var(--hd-accent-text); }

/* ── 6. Forms ─────────────────────────────────────────────────────────────── */
.form-control, .form-select, .input-group-text,
html[data-theme="dark"] .form-control, html[data-theme="dark"] .form-select {
    background-color: var(--hd-input-bg) !important;
    color: var(--hd-text) !important;
    border: 1px solid var(--hd-border) !important;
    border-radius: 10px;
    transition: border-color var(--hd-fast) ease, box-shadow var(--hd-fast) ease, background-color var(--hd-fast) ease;
}
.input-group-text { color: var(--hd-muted) !important; }
.form-control:hover, .form-select:hover { border-color: var(--hd-border-strong) !important; }
.form-control:focus, .form-select:focus,
input:focus, select:focus, textarea:focus {
    border-color: var(--hd-accent) !important;
    box-shadow: 0 0 0 3px var(--hd-ring) !important;
}
.form-control::placeholder { color: var(--hd-muted); opacity: 0.8; }
.form-label { font-weight: 600; font-size: 0.85rem; color: var(--hd-text-2); }
.form-check-input:checked { background-color: var(--hd-accent); border-color: var(--hd-accent); }
/* Bootstrap paints unchecked checkboxes/radios white — glaring on carbon surfaces */
html[data-theme="dark"] .form-check-input { background-color: var(--hd-input-bg); border-color: var(--hd-border-strong); }
html[data-theme="dark"] .form-check-input:checked,
html[data-theme="dark"] .form-check-input:indeterminate { background-color: var(--hd-accent); border-color: var(--hd-accent); }
html[data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2394A3B8' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
}

/* ── 7. Status / priority badges (shared across every page) ───────────────────
   Ticket status (views):  Open→bg-primary (blue)      InProgress→bg-active (solid blue)
                           OnHold→bg-onhold (orange)   Pending→bg-pending (amber)
                           Resolved→bg-resolved (green) Closed→bg-closed (gray)
   Priority:               Critical→bg-danger (red)    High→bg-warning (amber)
                           Medium→bg-info (blue)       Low→bg-secondary (gray)
   bg-purple / bg-teal are kept as legacy aliases of on-hold / pending. */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    border-radius: 999px;
    padding: 0.36em 0.72em;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.01em;
    line-height: 1.15;
    border: 1px solid transparent;
    vertical-align: middle;
    transition: background var(--hd-fast) ease, color var(--hd-fast) ease;
}
.badge:not(.rounded-pill):not(.position-absolute)::before {
    content: "";
    width: 0.46em; height: 0.46em;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    opacity: 0.9;
}
html .badge.bg-primary,   html[data-theme="dark"] .badge.bg-primary,
html .badge.bg-info,      html[data-theme="dark"] .badge.bg-info,
html .badge.bg-info.text-dark, html[data-theme="dark"] .badge.bg-info.text-dark
                                                                       { background: var(--hd-blue-bg)   !important; color: var(--hd-blue)   !important; border-color: var(--hd-blue-bd)   !important; }
html .badge.bg-active,    html[data-theme="dark"] .badge.bg-active    { background: var(--hd-active-bg) !important; color: var(--hd-active-fg) !important; border-color: var(--hd-active-bd) !important; }
html .badge.bg-warning,   html[data-theme="dark"] .badge.bg-warning,
html .badge.bg-warning.text-dark, html[data-theme="dark"] .badge.bg-warning.text-dark,
html .badge.bg-pending,   html[data-theme="dark"] .badge.bg-pending,
html .badge.bg-teal,      html[data-theme="dark"] .badge.bg-teal      { background: var(--hd-amber-bg)  !important; color: var(--hd-amber)  !important; border-color: var(--hd-amber-bd)  !important; }
html .badge.bg-onhold,    html[data-theme="dark"] .badge.bg-onhold,
html .badge.bg-purple,    html[data-theme="dark"] .badge.bg-purple    { background: var(--hd-orange-bg) !important; color: var(--hd-orange) !important; border-color: var(--hd-orange-bd) !important; }
html .badge.bg-resolved,  html[data-theme="dark"] .badge.bg-resolved,
html .badge.bg-success,   html[data-theme="dark"] .badge.bg-success   { background: var(--hd-green-bg)  !important; color: var(--hd-green)  !important; border-color: var(--hd-green-bd)  !important; }
html .badge.bg-danger,    html[data-theme="dark"] .badge.bg-danger    { background: var(--hd-red-bg)    !important; color: var(--hd-red)    !important; border-color: var(--hd-red-bd)    !important; }
html .badge.bg-closed,    html[data-theme="dark"] .badge.bg-closed,
html .badge.bg-secondary, html[data-theme="dark"] .badge.bg-secondary,
html .badge.bg-light,     html[data-theme="dark"] .badge.bg-light,
html .badge.bg-dark,      html[data-theme="dark"] .badge.bg-dark      { background: var(--hd-gray-bg)   !important; color: var(--hd-gray)   !important; border-color: var(--hd-gray-bd)   !important; }

/* Critical priority: dot gently pulses */
.badge.bg-danger:not(.rounded-pill):not(.position-absolute)::before { animation: hd-pulse-dot 1.8s ease-in-out infinite; }
@keyframes hd-pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.55); }
    50%      { box-shadow: 0 0 0 0.32em rgba(248, 113, 113, 0); }
}

/* Count pills (notification / messages) stay solid */
.badge.rounded-pill.bg-danger, html[data-theme="dark"] .badge.rounded-pill.bg-danger {
    background: #EF4444 !important;
    color: #fff !important;
    border-color: transparent !important;
}

/* ── 8. Tables ────────────────────────────────────────────────────────────── */
.table {
    --bs-table-bg: transparent;
    --bs-table-striped-bg: rgba(148, 163, 184, 0.04);
    --bs-table-hover-bg: var(--hd-surface-hover);
    --bs-table-hover-color: var(--hd-text);
    --bs-table-striped-color: var(--hd-text);
    color: var(--hd-text);
    border-color: var(--hd-border);
    margin-bottom: 0;
}
.table > :not(caption) > * > * { border-bottom-color: var(--hd-border); padding: 0.7rem 0.85rem; }
.table thead th,
html[data-theme="dark"] .table thead th,
.table-light, thead.table-light th, .table > thead.table-light > tr > th,
html[data-theme="dark"] .table-light, html[data-theme="dark"] thead.table-light th,
html[data-theme="dark"] .table > thead.table-light > tr > th {
    background: var(--hd-surface-2) !important;
    color: var(--hd-muted) !important;
    font-size: 0.7rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--hd-border-strong) !important;
    white-space: nowrap;
}
.table tbody tr { transition: background var(--hd-fast) ease, box-shadow var(--hd-fast) ease; }
.table tbody tr:hover,
html[data-theme="dark"] .table tbody tr:hover { background: var(--hd-surface-hover) !important; }
.table tbody tr[data-row-href]:hover { box-shadow: inset 3px 0 0 var(--hd-accent); cursor: pointer; }
/* position: relative keeps absolutely-positioned children (e.g. .visually-hidden header labels)
   inside the scroll container instead of widening the page on small screens */
.table-responsive, .updates-device-table-wrap { border-radius: var(--hd-radius); position: relative; }

/* ── 9. Dropdowns, modals, toasts, alerts, tabs, lists ────────────────────── */
.dropdown-menu,
html[data-theme="dark"] .dropdown-menu {
    --bs-dropdown-color: var(--hd-text);
    background: var(--hd-glass-strong) !important;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--hd-border) !important;
    border-radius: 14px !important;
    box-shadow: 0 24px 48px -20px rgba(0, 0, 0, 0.6), var(--hd-highlight) !important;
    padding: 0.4rem;
    color: var(--hd-text);
}
.dropdown-menu.show { animation: hd-pop-in 160ms var(--hd-ease) both; transform-origin: top right; }
.dropdown-item {
    border-radius: 9px;
    color: var(--hd-text-2);
    padding: 0.45rem 0.7rem;
    transition: background var(--hd-fast) ease, color var(--hd-fast) ease;
}
.dropdown-item:hover, .dropdown-item:focus,
html[data-theme="dark"] .dropdown-item:hover, html[data-theme="dark"] .dropdown-item:focus {
    background: var(--hd-surface-hover) !important;
    color: var(--hd-text) !important;
}
.dropdown-item.active, .dropdown-item:active { background: var(--hd-accent) !important; color: #fff !important; }
.dropdown-divider { border-color: var(--hd-border) !important; }
.notif-dropdown-menu .dropdown-item { border-radius: 10px; border-bottom: 0 !important; margin-bottom: 2px; }

.modal-backdrop.show { opacity: 1; background: rgba(8, 12, 17, 0.62); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal-content,
html[data-theme="dark"] .modal-content {
    background: var(--hd-surface) !important;
    color: var(--hd-text);
    border: 1px solid var(--hd-border) !important;
    border-radius: var(--hd-radius-xl) !important;
    box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.75), var(--hd-highlight);
}
.modal-header, .modal-footer { border-color: var(--hd-border) !important; }
.modal.fade .modal-dialog { transform: translateY(10px) scale(0.97); transition: transform 260ms var(--hd-ease), opacity 200ms ease; }
.modal.show .modal-dialog { transform: none; }
html[data-theme="dark"] .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

#hd-toast-container { gap: 0.6rem; }
.hd-toast,
html[data-theme="dark"] .hd-toast {
    background: var(--hd-glass-strong) !important;
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--hd-border) !important;
    border-radius: 14px !important;
    color: var(--hd-text) !important;
    box-shadow: 0 20px 40px -18px rgba(0, 0, 0, 0.65) !important;
}

.alert { border-radius: var(--hd-radius); border-width: 1px; }

.nav-tabs { border-bottom-color: var(--hd-border) !important; }
.nav-tabs .nav-link { border-radius: 10px 10px 0 0; transition: color var(--hd-fast) ease, border-color var(--hd-fast) ease, background var(--hd-fast) ease; }
.nav-tabs .nav-link.active,
html[data-theme="dark"] .nav-tabs .nav-link.active { color: var(--hd-accent-text) !important; border-bottom-color: var(--hd-accent) !important; background: transparent; }
.nav-pills .nav-link.active { background: #2563EB; }

.list-group-item,
html[data-theme="dark"] .list-group-item { background: transparent; color: var(--hd-text); border-color: var(--hd-border); }
.list-group-item-action:hover,
html[data-theme="dark"] .list-group-item-action:hover { background: var(--hd-surface-hover) !important; color: var(--hd-text) !important; }

html[data-theme="dark"] .bg-white, html[data-theme="dark"] .bg-light { background: var(--hd-surface-2) !important; }

.progress { background: var(--hd-surface-2); border-radius: 999px; }
.progress-bar { background: #3B82F6; }

.pagination .page-link { border-radius: 9px; margin: 0 2px; background: var(--hd-surface); color: var(--hd-text-2); border-color: var(--hd-border); }
.pagination .page-item.active .page-link { background: #2563EB; border-color: #3B82F6; color: #fff; }

/* ── 10. Administrator dashboard ──────────────────────────────────────────── */
.dash-viewport { gap: 1rem; }

/* Welcome banner: charcoal panel, steel-blue edge light (same in both themes) */
.dash-hero,
html[data-theme="dark"] .dash-hero,
.dash-viewport .dash-hero {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--hd-banner-border);
    border-radius: var(--hd-radius-xl);
    padding: 1.1rem 1.6rem 1.1rem 1.85rem;
    color: #F8FAFC;
    background:
        radial-gradient(520px 200px at 100% 0%, rgba(59, 130, 246, 0.16), transparent 70%),
        var(--hd-banner-bg);
    box-shadow: 0 18px 40px -26px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.dash-hero::before {
    /* steel-blue accent rail on the left edge */
    content: "";
    position: absolute; left: 0; top: 18%; bottom: 18%;
    width: 3px; border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, #93C5FD, #3B82F6);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.6);
}
.dash-hero::after {
    /* very fine grid texture, fading in toward the right */
    content: "";
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(148, 163, 184, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, 0.05) 1px, transparent 1px);
    background-size: 26px 26px;
    mask-image: linear-gradient(90deg, transparent 35%, #000 85%);
    -webkit-mask-image: linear-gradient(90deg, transparent 35%, #000 85%);
    pointer-events: none;
}
.dash-hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; position: relative; z-index: 1; }
.dash-hero-eyebrow {
    display: inline-flex; align-items: center; gap: 0.45rem;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
    color: #93C5FD;
}
.dash-hero-eyebrow .hd-live-dot {
    width: 7px; height: 7px; border-radius: 50%; background: #4ADE80;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    animation: hd-live 2.2s ease-out infinite;
}
@keyframes hd-live { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); } 80%, 100% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); } }
.dash-hero-greeting,
html[data-theme="dark"] .dash-hero-greeting,
.dash-viewport .dash-hero-greeting {
    font-family: var(--hd-font-display);
    font-size: 1.55rem; font-weight: 700; letter-spacing: -0.025em;
    color: #F8FAFC; margin: 0.15rem 0 0.1rem; line-height: 1.15;
}
.dash-hero-date, html[data-theme="dark"] .dash-hero-date { color: #CBD5E1; font-size: 0.86rem; margin: 0; }
.dash-hero-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.dash-hero-chip {
    display: inline-flex; align-items: center; gap: 0.45rem;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid #3B4755;
    color: #CBD5E1; font-size: 0.8rem; font-weight: 600;
    text-decoration: none;
    transition: background var(--hd-fast) ease, border-color var(--hd-fast) ease, color var(--hd-fast) ease, transform var(--hd-fast) ease;
}
.dash-hero-chip i { color: #93C5FD; }
.dash-hero-chip strong { font-variant-numeric: tabular-nums; font-size: 0.95rem; color: #F8FAFC; }
.dash-hero-chip:hover { background: rgba(59, 130, 246, 0.12); border-color: #3B82F6; color: #F8FAFC; transform: translateY(-1px); }
.dash-hero-chip.is-alert { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.45); }
.dash-hero-chip.is-alert i { color: #FCA5A5; }
.dash-hero-accent-line, .dash-hero-watermark { display: none; }

/* Stat strips: solid cards, icon chip, animated value, subtle tone glow on hover */
.dash-stat-strip,
html[data-theme="dark"] .dash-stat-strip,
.dash-viewport .dash-stat-strip {
    position: relative;
    overflow: hidden;
    background: var(--hd-surface);
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-lg);
    box-shadow: var(--hd-shadow), var(--hd-highlight);
    padding: 0.85rem 1rem;
    min-height: 84px;
    gap: 0.85rem;
    transition: transform var(--hd-med) var(--hd-ease), box-shadow var(--hd-med) var(--hd-ease), border-color var(--hd-fast) ease;
}
.dash-stat-strip::after {
    content: "";
    position: absolute; right: -34px; top: -34px;
    width: 110px; height: 110px; border-radius: 50%;
    background: radial-gradient(closest-side, var(--hd-stat-glow, rgba(59, 130, 246, 0.18)), transparent);
    opacity: 0.4;
    transition: opacity var(--hd-med) ease, transform var(--hd-med) var(--hd-ease);
    pointer-events: none;
}
.dash-stat-strip:hover {
    transform: translateY(-3px);
    box-shadow: var(--hd-shadow-hover);
    border-color: var(--hd-accent-bd);
    color: inherit;
}
.dash-stat-strip:hover::after { opacity: 0.9; transform: scale(1.15); }
.dash-stat-strip:hover .dash-stat-icon-sq { transform: scale(1.06) rotate(-4deg); }
.dash-stat-strip.tone-steel { --hd-stat-glow: rgba(59, 130, 246, 0.24); }
.dash-stat-strip.tone-green { --hd-stat-glow: rgba(34, 197, 94, 0.22); }
.dash-stat-strip.tone-amber { --hd-stat-glow: rgba(245, 158, 11, 0.22); }
.dash-stat-strip.tone-red   { --hd-stat-glow: rgba(239, 68, 68, 0.24); }
.dash-stat-strip.tone-blue  { --hd-stat-glow: rgba(147, 197, 253, 0.22); }
.dash-stat-icon-sq, .dash-viewport .dash-stat-icon-sq {
    width: 44px; height: 44px; font-size: 1.15rem;
    transition: transform var(--hd-med) var(--hd-ease);
}
.dash-stat-label, html[data-theme="dark"] .dash-stat-label {
    font-size: 0.7rem; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase;
    color: var(--hd-muted);
}
.dash-stat-value, .dash-viewport .dash-stat-value,
html[data-theme="dark"] .dash-stat-value {
    font-family: var(--hd-font-display);
    font-size: 1.65rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1;
    color: var(--hd-text);
}
.dash-stat-trend { font-size: 0.72rem; font-weight: 550; }
.trend-up   { color: var(--hd-green); }
.trend-down { color: var(--hd-red); }
.trend-flat { color: var(--hd-muted); }
.trend-link { color: var(--hd-accent-text); }

/* Value flash when live stats change */
.hd-num-bump { animation: hd-bump 700ms var(--hd-ease); }
@keyframes hd-bump {
    0%   { color: var(--hd-accent-text); transform: translateY(-2px); }
    100% { transform: none; }
}

/* Recent ticket list */
.recent-ticket-item {
    border-radius: 10px;
    margin: 0 0.45rem;
    padding: 0.6rem 0.7rem;
    color: var(--hd-text);
    border-bottom: 0 !important;
    transition: background var(--hd-fast) ease, transform var(--hd-fast) var(--hd-ease);
}
.recent-ticket-item:hover,
html[data-theme="dark"] .recent-ticket-item:hover { background: var(--hd-surface-hover); transform: translateX(2px); color: var(--hd-text); }
/* Colour comes from dashboard-theme.css (var(--accent-blue), re-pointed per theme in section 1) */
.recent-ticket-num { font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.recent-ticket-title { color: var(--hd-text-2); }
.recent-ticket-time { color: var(--hd-muted); }
.recent-ticket-dot { box-shadow: 0 0 0 3px var(--hd-surface-2); }
.dash-card-items { padding: 0.35rem 0 0.5rem; }

/* Device update panel */
.hd-meter-label { font-size: 0.72rem; font-weight: 650; color: var(--hd-muted); text-transform: uppercase; letter-spacing: 0.07em; }
.hd-meter {
    height: 10px; border-radius: 999px;
    background: var(--hd-surface-2);
    box-shadow: inset 0 0 0 1px var(--hd-border);
    overflow: hidden;
}
.hd-meter > span {
    display: block; height: 100%; border-radius: inherit;
    background: linear-gradient(90deg, #2563EB, #3B82F6, #93C5FD, #3B82F6);
    background-size: 200% 100%;
    animation: hd-grow 900ms var(--hd-ease) both, hd-shimmer 3.5s linear 900ms infinite;
    transform-origin: left center;
}
.hd-meter.is-done > span { background: linear-gradient(90deg, #16A34A, #4ADE80); animation: hd-grow 900ms var(--hd-ease) both; }
@keyframes hd-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes hd-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.hd-meter-foot { display: flex; justify-content: space-between; font-size: 0.78rem; color: var(--hd-muted); margin: 0.4rem 0 0.9rem; }
.hd-meter-foot strong { color: var(--hd-text); }
.hd-group-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.42rem 0.1rem; border-bottom: 1px solid var(--hd-border);
    font-size: 0.84rem;
}
.hd-group-row:last-child { border-bottom: 0; }
.hd-group-row i { color: var(--hd-accent-text); opacity: 0.85; }
.hd-group-row .is-pending { color: var(--hd-amber); font-weight: 700; }
.hd-group-row .is-clear { color: var(--hd-green); font-weight: 700; }
.hd-mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin-top: 0.9rem; }
.hd-mini-stat {
    text-align: center; padding: 0.55rem 0.3rem;
    border-radius: 12px;
    background: var(--hd-surface-2);
    border: 1px solid var(--hd-border);
}
.hd-mini-stat .v { font-family: var(--hd-font-display); font-size: 1.2rem; font-weight: 700; color: var(--hd-text); font-variant-numeric: tabular-nums; }
.hd-mini-stat .l { font-size: 0.66rem; color: var(--hd-muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; }
.hd-mini-stat.is-good .v { color: var(--hd-green); }
.hd-mini-stat.is-warn .v { color: var(--hd-amber); }
.hd-section-sub { font-size: 0.7rem; font-weight: 700; color: var(--hd-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.35rem; }

/* Department workload bars */
.dept-progress-item { padding: 0.4rem 0.45rem; margin: 0 -0.45rem; border-radius: 10px; transition: background var(--hd-fast) ease; }
.dept-progress-item:hover { background: var(--hd-surface-hover); }
.dept-progress-name, html[data-theme="dark"] .dept-progress-name { color: var(--hd-text-2); font-weight: 550; }
.dept-progress-count, html[data-theme="dark"] .dept-progress-count { color: var(--hd-text); font-weight: 700; }
.dept-progress-bar-track, html[data-theme="dark"] .dept-progress-bar-track { background: var(--hd-surface-2); box-shadow: inset 0 0 0 1px var(--hd-border); border-radius: 999px; }
.dept-progress-bar-fill {
    background: linear-gradient(90deg, #2563EB, #3B82F6) !important;
    border-radius: 999px;
    transform-origin: left center;
    animation: hd-grow 900ms var(--hd-ease) both;
}

/* Scheduled tasks / replacement / calendar */
.sched-item, .replace-item { border-radius: 10px; transition: background var(--hd-fast) ease; }
.replace-item:hover { background: var(--hd-surface-hover); }
.sched-date-badge, html[data-theme="dark"] .sched-date-badge {
    background: var(--hd-accent-soft); color: var(--hd-accent-text);
    border: 1px solid var(--hd-accent-bd); border-radius: 10px;
}
.sched-title, .replace-name { color: var(--hd-text); }
.sched-dept, .replace-org { color: var(--hd-muted); }
.replace-icon, html[data-theme="dark"] .replace-icon { background: var(--hd-surface-2); color: var(--hd-accent-text); border-radius: 10px; }
.sched-viewall-link { color: var(--hd-accent-text); font-weight: 600; font-size: 0.8rem; }
.dash-cal-month { color: var(--hd-text); font-weight: 650; }
.dash-cal-grid-head span { color: var(--hd-muted); }
.dash-cal-day { border-radius: 8px; transition: background var(--hd-fast) ease; }
.dash-cal-day:hover { background: var(--hd-surface-hover); }
.dash-cal-day-today,
html[data-theme="dark"] .dash-cal-day-today {
    background: var(--hd-accent-soft) !important;
    box-shadow: inset 0 0 0 1px var(--hd-accent);
}
.dash-cal-day-today .dash-cal-day-num { color: var(--hd-accent-text); font-weight: 700; }

/* ── 10a. Dark mode: accent links + nested panels ───────────────────────────
   "View all"-style links take their colour from var(--accent-blue) (#93C5FD in dark).
   dashboard-theme.css forces a darker #1D4ED8 on hover with !important, so dark mode
   needs its own hover/focus state to stay visible. */
html[data-theme="dark"] .section-card-viewall:hover,
html[data-theme="dark"] .section-card-viewall:focus-visible,
html[data-theme="dark"] .sched-viewall-link:hover,
html[data-theme="dark"] .sched-viewall-link:focus-visible {
    color: #DBEAFE !important;
    text-decoration: underline;
    text-underline-offset: 3px;
}
html[data-theme="dark"] a:focus-visible { outline-color: #93C5FD; }

/* Solid accent fills behind white text use #2563EB (5.2:1) like .btn-primary — legacy rules
   fill them with var(--accent-primary) (#3B82F6 in dark, only 3.7:1 with white). */
html[data-theme="dark"] .pagination .page-item.active .page-link,
html[data-theme="dark"] .ops-tabs .nav-link.active,
html[data-theme="dark"] .chat-bubble-own .chat-bubble {
    background: #2563EB !important;
    border-color: #3B82F6 !important;
    color: #fff !important;
}
/* site.css dims timestamps with opacity: 0.65 — too faint on the blue bubble */
html[data-theme="dark"] .chat-bubble-own .chat-bubble-time { color: #EFF6FF; opacity: 1; }

/* Segmented sort control: recessed track, raised active segment */
html[data-theme="dark"] .seg-ctrl { background: var(--hd-surface-2); box-shadow: inset 0 0 0 1px var(--hd-border); }
html[data-theme="dark"] .seg-ctrl-item.active { background: #2E3A47; color: #93C5FD; }

/* Bootstrap's .text-secondary (#6c757d) is unreadable on carbon cards */
html[data-theme="dark"] .text-secondary { color: var(--hd-muted) !important; }

/* Nested panels keep a recessed tone inside #252F3A cards now that --card is the card colour.
   :where() keeps specificity low so own-message bubbles and hover states still win. */
:where(html[data-theme="dark"]) .theme-list-item,
:where(html[data-theme="dark"]) .chat-bubble { background: var(--hd-surface-2); }
/* Bare form fields (site.css styles them with var(--card)). Element-level specificity only,
   so any class-styled field keeps its own look. */
:where(html[data-theme="dark"]) :is(input, select, textarea):where(:not(.form-control, .form-select, .form-check-input, [type="range"], [type="checkbox"], [type="radio"])) {
    background: var(--hd-input-bg);
}

/* ── 10b. IT Operations: Backup Health NAS tiles (dashboard + details page) ──
   Visual only. Status icon colours come from the view (green / red / gray) and are untouched. */
.ops-nas-tile {
    background: var(--hd-surface-2);
    border: 1px solid var(--hd-border);
    border-radius: 10px;
    transition: border-color var(--hd-fast) ease, background var(--hd-fast) ease;
}
.ops-nas-name { color: var(--hd-text); }
.ops-nas-state { color: var(--hd-muted); }
/* Light theme keeps the status-tinted borders */
.ops-nas-tile.is-problem { border-color: var(--hd-red-bd); }
.ops-nas-tile.is-healthy { border-color: var(--hd-green-bd); }

html[data-theme="dark"] .ops-nas-tile,
html[data-theme="dark"] .ops-nas-tile.is-problem,
html[data-theme="dark"] .ops-nas-tile.is-healthy {
    background: #1C2632;
    border-color: #3B4755;
}
html[data-theme="dark"] .ops-nas-name { color: #F8FAFC; }
html[data-theme="dark"] .ops-nas-state { color: #94A3B8; }

/* ── 10c. Tickets page: summary cards, filters, Cards | List results ────────── */
.page-header-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }

/* Summary cards reuse .dash-stat-strip; compact + clear selected state */
.tk-summary .dash-stat-strip { min-height: 76px; padding: 0.7rem 0.9rem; }
.tk-summary .dash-stat-icon-sq { width: 40px; height: 40px; font-size: 1.05rem; }
.tk-summary .dash-stat-value { font-size: 1.45rem; }
.tk-summary .dash-stat-strip.is-active {
    border-color: var(--hd-accent);
    box-shadow: 0 0 0 1px var(--hd-accent), var(--hd-shadow);
}
.tk-summary .dash-stat-strip.is-active .dash-stat-label { color: var(--hd-accent-text); }

/* Filter panel: one compact row on desktop, stacks on smaller screens */
.tk-filter-form { padding: 0.8rem 0.95rem 0.85rem; }
.tk-filter-grid {
    display: grid;
    gap: 0.6rem 0.7rem;
    align-items: end;
    grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(0, 1fr)) auto;
}
.tk-filters .form-label {
    margin-bottom: 0.25rem;
    font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--hd-muted);
}
.tk-filter-actions { display: flex; gap: 0.5rem; }
.tk-search-wrap { position: relative; }
.tk-search-wrap > i {
    position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%);
    color: var(--hd-muted); font-size: 0.82rem; pointer-events: none; z-index: 4;
}
.tk-search-wrap .form-control { padding-left: 1.95rem; }
@media (max-width: 1199.98px) {
    .tk-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tk-filter-search, .tk-filter-actions { grid-column: 1 / -1; }
}
@media (max-width: 575.98px) {
    .tk-filter-grid { grid-template-columns: minmax(0, 1fr); }
}

/* Results header: count · select page · sort · view toggle */
.tk-results-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem; }
.tk-select-page { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0; font-size: 0.8rem; color: var(--hd-text-2); cursor: pointer; }
.tk-select-page .form-check-input { margin: 0; }
/* site.css gives every <button> a card background, border and padding */
.tk-view-toggle .seg-ctrl-item { border: 0; font-family: inherit; line-height: inherit; cursor: pointer; }
.tk-view-toggle .seg-ctrl-item:not(.active) { background: transparent; }

/* Cards are the default. theme-init.js sets a per-area class on <html> when List was chosen:
   hd-tickets-list for the staff Tickets page, hd-portal-list for employee portal lists
   (.tk-portal), so the two preferences never affect each other. */
.tk-list-view { display: none; }
html.hd-tickets-list .tk-results:not(.tk-portal) .tk-list-view,
html.hd-portal-list .tk-results.tk-portal .tk-list-view { display: block; }
html.hd-tickets-list .tk-results:not(.tk-portal) :is(.tk-cards-view, .tk-cards-only),
html.hd-portal-list .tk-results.tk-portal :is(.tk-cards-view, .tk-cards-only) { display: none !important; }

/* In Cards mode the results wrapper steps back so the ticket cards sit on the page,
   like the Dashboard stat cards; List mode keeps the framed table card. */
html:not(.hd-tickets-list) .tk-results:not(.tk-portal),
html:not(.hd-portal-list) .tk-results.tk-portal { background: transparent; border-color: transparent; box-shadow: none; }
html:not(.hd-tickets-list) .tk-results:not(.tk-portal) > .tk-results-header,
html:not(.hd-portal-list) .tk-results.tk-portal > .tk-results-header { padding: 0.15rem 0.1rem 0.7rem; }
html:not(.hd-tickets-list) .tk-results:not(.tk-portal) > .section-card-divider,
html:not(.hd-portal-list) .tk-results.tk-portal > .section-card-divider { display: none; }

/* Grid: columns follow the real content width (sidebar expanded or collapsed) */
.tk-cards-view { container-type: inline-size; }
.tk-grid { display: grid; gap: 0.75rem; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 520px) { .tk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 900px) { .tk-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@supports not (container-type: inline-size) {
    @media (min-width: 768px)  { .tk-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
    @media (min-width: 1280px) { .tk-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
}

/* Ticket card — sized and styled like a Dashboard stat card */
.tk-card {
    position: relative;
    display: flex; flex-direction: column; gap: 0.4rem;
    min-width: 0;
    padding: 0.75rem 0.85rem 0.7rem;
    background: var(--hd-surface);
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-lg);
    box-shadow: var(--hd-shadow), var(--hd-highlight);
    transition: transform 180ms var(--hd-ease), box-shadow 180ms ease, border-color 160ms ease;
}
.tk-card:hover { transform: translateY(-2px); border-color: var(--hd-accent-bd); box-shadow: var(--hd-shadow-hover); }
.tk-card:has(.tk-card-link:focus-visible) { outline: 2px solid var(--hd-accent); outline-offset: 2px; }
.tk-card.is-selected { border-color: var(--hd-accent); box-shadow: 0 0 0 1px var(--hd-accent), var(--hd-shadow); }
/* Priority edge: Critical red, High amber */
.tk-card.prio-critical::before, .tk-card.prio-high::before {
    content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px;
    width: 3px; border-radius: 0 3px 3px 0;
}
.tk-card.prio-critical::before { background: var(--hd-red); }
.tk-card.prio-high::before { background: var(--hd-amber); }

.tk-card-top { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.tk-card-check { position: relative; z-index: 2; margin: 0; flex-shrink: 0; cursor: pointer; }
.tk-card-link {
    font-size: 0.78rem; font-weight: 700; letter-spacing: 0.01em;
    font-variant-numeric: tabular-nums;
    color: var(--hd-accent-text);
    text-decoration: none;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.tk-card-link:hover { color: var(--hd-accent-text); text-decoration: underline; text-underline-offset: 3px; }
.tk-card-link:focus-visible { outline: none; } /* the whole card shows the focus ring */
/* Stretched link: the whole card opens the ticket; the checkbox sits above it */
.tk-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.tk-dot-updated {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    background: var(--hd-accent); box-shadow: 0 0 0 3px var(--hd-accent-soft);
}
.tk-card-prio { margin-left: auto; flex-shrink: 0; }
.tk-card .badge { font-size: 0.66rem; padding: 0.3em 0.62em; }

.tk-card-title {
    margin: 0;
    font-family: var(--hd-font);
    font-size: 0.9rem; font-weight: 600; line-height: 1.32; letter-spacing: -0.005em;
    color: var(--hd-text);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; overflow-wrap: anywhere;
    min-height: calc(1.32em * 2);
}
.tk-card-dept {
    display: flex; align-items: center; gap: 0.35rem; min-width: 0;
    font-size: 0.76rem; color: var(--hd-muted);
}
.tk-card-dept > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tk-card-flags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tk-flag {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.1rem 0.45rem; border-radius: 999px;
    font-size: 0.66rem; font-weight: 650;
    color: var(--hd-muted); background: var(--hd-surface-2); border: 1px solid var(--hd-border);
}
.tk-flag-red   { color: var(--hd-red);   background: var(--hd-red-bg);   border-color: var(--hd-red-bd); }
.tk-flag-amber { color: var(--hd-amber); background: var(--hd-amber-bg); border-color: var(--hd-amber-bd); }

.tk-card-foot {
    margin-top: auto;
    display: flex; align-items: center; gap: 0.5rem; min-width: 0;
    padding-top: 0.55rem;
    border-top: 1px solid var(--hd-border);
    font-size: 0.74rem;
}
.tk-card-tech { display: flex; align-items: center; gap: 0.3rem; flex: 1; min-width: 0; color: var(--hd-text-2); }
.tk-card-tech > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-card-tech.is-unassigned { color: var(--hd-muted); font-style: italic; }
.tk-card-age { color: var(--hd-muted); white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }

.tk-empty {
    text-align: center; padding: 2.5rem 1rem;
    color: var(--hd-muted);
    border: 1px dashed var(--hd-border-strong); border-radius: var(--hd-radius-lg);
}
.tk-empty > i { display: block; font-size: 1.8rem; color: var(--hd-accent-text); margin-bottom: 0.5rem; }
.tk-empty-title { color: var(--hd-text); font-weight: 650; }
.tk-empty-sub { font-size: 0.82rem; }

/* ── 10d. Employee portal ───────────────────────────────────────────────────── */
/* Welcome banner (reuses .dash-hero) with the primary "Submit" call to action */
.pt-hero .dash-hero-inner { align-items: center; }
.pt-hero-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pt-hero .btn-light-outline {
    background: rgba(255, 255, 255, 0.05); border: 1px solid #3B4755; color: #CBD5E1;
}
.pt-hero .btn-light-outline:hover { background: rgba(59, 130, 246, 0.12); border-color: #3B82F6; color: #F8FAFC; }
.pt-hero .btn-lg { padding: 0.6rem 1.15rem; font-size: 0.95rem; }

/* Section tabs (My Requests / Department / Completed) as a pill bar */
.pt-tabs {
    display: flex; flex-wrap: wrap; gap: 0.35rem;
    padding: 0.3rem; margin: 0 0 1rem;
    list-style: none;
    background: var(--hd-surface-2);
    border: 1px solid var(--hd-border);
    border-radius: 12px;
    width: fit-content; max-width: 100%;
}
.pt-tabs a {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 0.85rem; border-radius: 9px;
    font-size: 0.85rem; font-weight: 600;
    color: var(--hd-text-2); text-decoration: none;
    transition: background var(--hd-fast) ease, color var(--hd-fast) ease;
}
.pt-tabs a:hover { background: var(--hd-surface-hover); color: var(--hd-text); }
.pt-tabs a.active { background: #2563EB; color: #fff; box-shadow: 0 4px 12px -6px rgba(59, 130, 246, 0.9); }
.pt-tabs a.active .badge { background: rgba(255, 255, 255, 0.2) !important; color: #fff !important; border-color: transparent !important; }
/* Count badges (tab totals, section counts) aren't statuses — no status dot */
.pt-tabs .badge::before,
.section-card-header > .badge::before { display: none !important; }

/* Search row */
.pt-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem; margin-bottom: 1rem; }
.pt-search { position: relative; flex: 1 1 280px; max-width: 460px; display: flex; gap: 0.4rem; }
.pt-search > i { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--hd-muted); pointer-events: none; z-index: 4; }
.pt-search .form-control { padding-left: 2.1rem; }
.pt-filter-note { font-size: 0.82rem; color: var(--hd-muted); }
.pt-filter-note strong { color: var(--hd-text); }

/* Employee ticket card: status is the headline, so it sits top-right */
.tk-portal .tk-card-status { margin-left: auto; flex-shrink: 0; }
.tk-card-meta { display: flex; align-items: center; gap: 0.35rem; min-width: 0; font-size: 0.76rem; color: var(--hd-muted); }
.tk-card-meta > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Ticket details: header, progress tracker, info list */
.pt-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pt-detail-num { font-size: 0.78rem; font-weight: 700; color: var(--hd-accent-text); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.pt-detail-title { font-size: 1.35rem; font-weight: 700; margin: 0.15rem 0 0.45rem; color: var(--hd-text); overflow-wrap: anywhere; }
.pt-detail-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--hd-muted); }
.pt-detail-chips > span:not(.badge) { display: inline-flex; align-items: center; gap: 0.3rem; }

.hd-progress { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hd-progress-step { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 0.4rem; padding: 0 0.25rem; }
.hd-progress-step::before {
    /* connector to the previous step */
    content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px;
    background: var(--hd-border);
}
.hd-progress-step:first-child::before { display: none; }
.hd-progress-step.is-done::before, .hd-progress-step.is-current::before { background: var(--hd-accent); }
.hd-progress-dot {
    position: relative; z-index: 1;
    width: 32px; height: 32px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700;
    background: var(--hd-surface-2); color: var(--hd-muted);
    border: 2px solid var(--hd-border-strong);
    transition: background var(--hd-med) ease, border-color var(--hd-med) ease;
}
.hd-progress-step.is-done .hd-progress-dot { background: var(--hd-accent); border-color: var(--hd-accent); color: #fff; }
.hd-progress-step.is-current .hd-progress-dot { background: var(--hd-accent-soft); border-color: var(--hd-accent); color: var(--hd-accent-text); box-shadow: 0 0 0 4px var(--hd-accent-soft); }
.hd-progress-step.is-current.tone-amber .hd-progress-dot  { background: var(--hd-amber-bg);  border-color: var(--hd-amber);  color: var(--hd-amber);  box-shadow: 0 0 0 4px var(--hd-amber-bg); }
.hd-progress-step.is-current.tone-orange .hd-progress-dot { background: var(--hd-orange-bg); border-color: var(--hd-orange); color: var(--hd-orange); box-shadow: 0 0 0 4px var(--hd-orange-bg); }
.hd-progress-step.is-current.tone-green .hd-progress-dot  { background: var(--hd-green-bg);  border-color: var(--hd-green);  color: var(--hd-green);  box-shadow: 0 0 0 4px var(--hd-green-bg); }
.hd-progress-label { font-size: 0.78rem; font-weight: 600; color: var(--hd-muted); line-height: 1.25; }
.hd-progress-step.is-done .hd-progress-label, .hd-progress-step.is-current .hd-progress-label { color: var(--hd-text); }
.hd-progress-note {
    display: flex; align-items: flex-start; gap: 0.55rem;
    margin-top: 1rem; padding: 0.7rem 0.85rem;
    border-radius: 10px; font-size: 0.86rem;
    background: var(--hd-surface-2); border: 1px solid var(--hd-border); color: var(--hd-text-2);
}
.hd-progress-note > i { font-size: 1rem; margin-top: 0.05rem; color: var(--hd-accent-text); }
.hd-progress-note.tone-amber  { border-color: var(--hd-amber-bd);  background: var(--hd-amber-bg); }
.hd-progress-note.tone-amber > i  { color: var(--hd-amber); }
.hd-progress-note.tone-orange { border-color: var(--hd-orange-bd); background: var(--hd-orange-bg); }
.hd-progress-note.tone-orange > i { color: var(--hd-orange); }
.hd-progress-note.tone-green  { border-color: var(--hd-green-bd);  background: var(--hd-green-bg); }
.hd-progress-note.tone-green > i  { color: var(--hd-green); }
@media (max-width: 575.98px) { .hd-progress-label { font-size: 0.7rem; } .hd-progress-dot { width: 28px; height: 28px; } .hd-progress-step::before { top: 13px; } }

.pt-info { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 0.9rem; margin: 0; font-size: 0.86rem; }
.pt-info dt { color: var(--hd-muted); font-weight: 500; }
.pt-info dd { margin: 0; color: var(--hd-text); min-width: 0; overflow-wrap: anywhere; }
.pt-section-title { display: flex; align-items: center; gap: 0.5rem; font-weight: 650; font-size: 0.92rem; color: var(--hd-text); }
.pt-section-title > i { color: var(--hd-accent-text); }
.pt-prose { white-space: pre-wrap; line-height: 1.6; color: var(--hd-text-2); overflow-wrap: anywhere; }
.pt-resolution { border-color: var(--hd-green-bd) !important; }
.pt-resolution .pt-section-title > i { color: var(--hd-green); }

/* Attachments */
.pt-files { list-style: none; margin: 0 0 0.85rem; padding: 0; display: grid; gap: 0.4rem; }
.pt-file {
    display: flex; align-items: center; gap: 0.6rem; min-width: 0;
    padding: 0.5rem 0.65rem; border-radius: 10px;
    background: var(--hd-surface-2); border: 1px solid var(--hd-border);
    transition: border-color var(--hd-fast) ease, background var(--hd-fast) ease;
}
.pt-file:hover { border-color: var(--hd-accent-bd); background: var(--hd-surface-hover); }
.pt-file-icon { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--hd-accent-soft); color: var(--hd-accent-text); }
.pt-file a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; text-decoration: none; }
.pt-file a:hover { text-decoration: underline; }
.pt-file-size { font-size: 0.75rem; color: var(--hd-muted); white-space: nowrap; }
.pt-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.pt-upload .form-control { flex: 1 1 220px; max-width: 360px; }
input[type="file"].form-control::file-selector-button {
    margin-right: 0.75rem; border: 0; border-right: 1px solid var(--hd-border);
    background: var(--hd-surface-2); color: var(--hd-text-2); font-weight: 600;
}

/* Conversation (portal only — the staff ticket page keeps its own look for now).
   Markup is shared with ticket-chat.js, which appends new messages live. */
#ticketChatRoot[data-view="portal"] #ticketChatFeed { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.9rem 1rem; }
#ticketChatRoot[data-view="portal"] .comment-item {
    max-width: min(86%, 640px);
    margin: 0; padding: 0.6rem 0.8rem;
    border-radius: 14px; border: 1px solid var(--hd-border);
    background: var(--hd-surface-2);
    box-shadow: none;
}
#ticketChatRoot[data-view="portal"] .comment-tech { align-self: flex-start; border-bottom-left-radius: 4px; border-left: 3px solid var(--hd-accent); }
#ticketChatRoot[data-view="portal"] .comment-user { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--hd-accent-soft); border-color: var(--hd-accent-bd); }
#ticketChatRoot[data-view="portal"] .comment-type-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0; border: 0; background: none !important;
    font-size: 0.75rem; font-weight: 700; color: var(--hd-text-2) !important;
}
#ticketChatRoot[data-view="portal"] .comment-type-tech { color: var(--hd-accent-text) !important; }
#ticketChatRoot[data-view="portal"] .comment-body { color: var(--hd-text); font-size: 0.88rem; line-height: 1.5; overflow-wrap: anywhere; }
#ticketChatRoot[data-view="portal"] .text-muted { font-size: 0.72rem !important; }
.pt-reply { border-top: 1px solid var(--hd-border); padding: 0.85rem 1rem 1rem; }
.pt-reply textarea { resize: vertical; min-height: 84px; }
.pt-reply-actions { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.55rem; }
.pt-reply-hint { font-size: 0.75rem; color: var(--hd-muted); }
.pt-closed-bar { border-top: 1px solid var(--hd-border); padding: 0.85rem 1rem; display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }

/* Activity timeline */
.pt-timeline { list-style: none; margin: 0; padding: 0.4rem 1.15rem 0.9rem; }
.pt-timeline li { position: relative; padding: 0.55rem 0 0.55rem 1.15rem; display: flex; justify-content: space-between; gap: 1rem; font-size: 0.84rem; color: var(--hd-text-2); }
.pt-timeline li::before { content: ""; position: absolute; left: 0; top: 0.95rem; width: 7px; height: 7px; border-radius: 50%; background: var(--hd-accent); box-shadow: 0 0 0 3px var(--hd-accent-soft); }
.pt-timeline li::after { content: ""; position: absolute; left: 3px; top: 1.45rem; bottom: -0.55rem; width: 1px; background: var(--hd-border); }
.pt-timeline li:last-child::after { display: none; }
.pt-timeline time { color: var(--hd-muted); font-size: 0.76rem; white-space: nowrap; }

/* Submit form */
.pt-form-card .section-card-body { display: grid; gap: 1rem; }
.pt-required { color: var(--hd-red); margin-left: 0.15rem; }
.pt-help { font-size: 0.78rem; color: var(--hd-muted); margin-top: 0.3rem; }
.pt-form-actions {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem;
    padding: 0.85rem 1rem; border-radius: var(--hd-radius-lg);
    background: var(--hd-surface); border: 1px solid var(--hd-border);
}
.pt-form-actions .btn-lg { padding: 0.6rem 1.3rem; font-size: 0.95rem; }

.min-w-0 { min-width: 0; }

/* Validation summaries render even when valid — only show them when they have errors */
.validation-summary-valid { display: none !important; }
.validation-summary-errors ul, .alert ul { margin: 0; padding-left: 1.1rem; }

/* ── 10e. Authentication pages (login, MFA, registration, recovery, errors) ── */
.guest-layout-shell { position: relative; overflow: hidden; }
.guest-layout-shell::before {
    /* single, restrained steel-blue accent behind the card */
    content: ""; position: absolute; z-index: 0; pointer-events: none;
    width: 900px; height: 520px; left: 50%; top: -220px; transform: translateX(-50%);
    background: radial-gradient(closest-side, rgba(59, 130, 246, 0.14), transparent);
}
.guest-layout-shell > * { position: relative; z-index: 1; }
.guest-logo-wrap { margin-bottom: 1.4rem; }
.guest-logo-county, html[data-theme="dark"] .guest-logo-county { color: var(--hd-text); font-size: 0.95rem; }
.guest-logo-desk, html[data-theme="dark"] .guest-logo-desk { color: var(--hd-accent-text); }

.hd-auth { width: 100%; max-width: 420px; margin: 0 auto; animation: hd-rise 420ms var(--hd-ease) both; }
.hd-auth.is-wide { max-width: 560px; }
.app-page-content .hd-auth { margin-top: 3vh; }
.hd-auth-card {
    background: var(--hd-surface);
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-xl);
    box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.7), var(--hd-highlight);
    padding: 1.75rem 1.75rem 1.6rem;
}
.hd-auth-head { text-align: center; margin-bottom: 1.35rem; }
.hd-auth-icon {
    width: 48px; height: 48px; margin: 0 auto 0.8rem;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.35rem;
    background: var(--hd-accent-soft); color: var(--hd-accent-text);
    box-shadow: inset 0 0 0 1px var(--hd-accent-bd);
}
.hd-auth-icon.tone-green { background: var(--hd-green-bg); color: var(--hd-green); box-shadow: inset 0 0 0 1px var(--hd-green-bd); }
.hd-auth-icon.tone-red   { background: var(--hd-red-bg);   color: var(--hd-red);   box-shadow: inset 0 0 0 1px var(--hd-red-bd); }
.hd-auth-icon.tone-amber { background: var(--hd-amber-bg); color: var(--hd-amber); box-shadow: inset 0 0 0 1px var(--hd-amber-bd); }
.hd-auth-title { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--hd-text); }
.hd-auth-sub { margin: 0.35rem 0 0; font-size: 0.88rem; color: var(--hd-muted); }
.hd-auth-card .form-label { font-size: 0.82rem; font-weight: 600; color: var(--hd-text-2); margin-bottom: 0.35rem; }
.hd-auth-card .form-control, .hd-auth-card .form-select { padding-top: 0.55rem; padding-bottom: 0.55rem; }
.hd-auth-field { margin-bottom: 1rem; }
.hd-auth-field:last-of-type { margin-bottom: 1.25rem; }
.hd-auth-card .btn-primary.w-100 { padding: 0.62rem 1rem; font-size: 0.95rem; }
.hd-auth-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.35rem; }
.hd-auth-row .form-label { margin-bottom: 0; }
.hd-auth-link { font-size: 0.8rem; font-weight: 600; }
.hd-auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0 1rem; font-size: 0.78rem; color: var(--hd-muted); }
.hd-auth-divider::before, .hd-auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--hd-border); }
.hd-auth-foot { text-align: center; margin-top: 1rem; font-size: 0.8rem; color: var(--hd-muted); }
.hd-auth-foot a { font-weight: 600; }
.hd-auth-card .alert { font-size: 0.85rem; padding: 0.6rem 0.8rem; margin-bottom: 1rem; }
.hd-auth-text { font-size: 0.9rem; color: var(--hd-text-2); line-height: 1.55; text-align: center; margin-bottom: 1rem; }

/* Input with a leading icon and an optional trailing button (show/hide password) */
.hd-input { position: relative; }
.hd-input > i.bi { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--hd-muted); pointer-events: none; z-index: 4; }
.hd-input > .form-control { padding-left: 2.35rem; }
.hd-input.has-action > .form-control { padding-right: 2.75rem; }
.hd-input-action {
    position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%); z-index: 4;
    width: 34px; height: 34px; padding: 0;
    display: flex; align-items: center; justify-content: center;
    border: 0 !important; border-radius: 8px; background: transparent !important;
    color: var(--hd-muted);
}
.hd-input-action:hover { color: var(--hd-text); background: var(--hd-surface-hover) !important; }

/* One-time / recovery code entry */
.hd-code-input {
    text-align: center;
    font-family: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
    font-size: 1.6rem !important; font-weight: 600; letter-spacing: 0.35em;
    padding: 0.6rem 0.5rem !important;
}
.hd-code-input.is-recovery { font-size: 1.1rem !important; letter-spacing: 0.12em; }

/* MFA enrolment */
.hd-mfa-setup { display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; align-items: center; margin-bottom: 1.25rem; }
.hd-mfa-qr { background: #fff; padding: 8px; border-radius: 12px; border: 1px solid var(--hd-border); }
.hd-mfa-qr img { display: block; width: 168px; height: 168px; image-rendering: pixelated; }
.hd-mfa-key {
    display: block; margin-top: 0.35rem; padding: 0.5rem 0.65rem;
    background: var(--hd-surface-2); border: 1px solid var(--hd-border); border-radius: 8px;
    font-size: 0.9rem; color: var(--hd-text); overflow-wrap: anywhere;
}
.hd-steps { margin: 0 0 1.1rem; padding-left: 1.2rem; font-size: 0.86rem; color: var(--hd-text-2); }
.hd-steps li { margin-bottom: 0.25rem; }
@media (max-width: 479.98px) { .hd-mfa-setup { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

.hd-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; margin: 0 0 1.1rem; }
.hd-codes code {
    display: block; text-align: center; padding: 0.5rem; border-radius: 8px;
    background: var(--hd-surface-2); border: 1px solid var(--hd-border);
    color: var(--hd-text); font-size: 0.95rem; letter-spacing: 0.05em;
}

@media (max-width: 479.98px) {
    .hd-auth-card { padding: 1.35rem 1.1rem 1.25rem; border-radius: var(--hd-radius-lg); }
}

/* ── 10f. Application-wide consistency (Device Updates, Assets, Scheduled, shared) ── */

/* Generic Cards | List switch for card/table pages beyond Tickets & Portal.
   <div class="tk-results hd-switch" data-switch="assets|scheduled"> + a .tk-view-toggle whose
   data-view-class (set on <html> by theme-init.js) selects List. Cards is the default. */
html.hd-assets-list    .hd-switch[data-switch="assets"]    .tk-list-view,
html.hd-scheduled-list .hd-switch[data-switch="scheduled"] .tk-list-view { display: block; }
html.hd-assets-list    .hd-switch[data-switch="assets"]    :is(.tk-cards-view, .tk-cards-only),
html.hd-scheduled-list .hd-switch[data-switch="scheduled"] :is(.tk-cards-view, .tk-cards-only) { display: none !important; }
html:not(.hd-assets-list) .hd-switch[data-switch="assets"] { background: transparent; border-color: transparent; box-shadow: none; }
html:not(.hd-assets-list) .hd-switch[data-switch="assets"] > .tk-results-header { padding: 0.15rem 0.1rem 0.7rem; }
html:not(.hd-assets-list) .hd-switch[data-switch="assets"] > .section-card-divider { display: none; }

/* Interactive controls inside a stretched-link card sit above the link */
.tk-card-actions { position: relative; z-index: 2; display: flex; gap: 0.3rem; flex-shrink: 0; }
.tk-card-actions .btn { padding: 0.15rem 0.45rem; }

/* Alerts use the semantic tokens (legacy dark-mode alerts were orange/brown tints) */
html .alert-warning, html[data-theme="dark"] .alert-warning { background: var(--hd-amber-bg) !important; color: var(--hd-text) !important; border-color: var(--hd-amber-bd) !important; }
html .alert-danger,  html[data-theme="dark"] .alert-danger  { background: var(--hd-red-bg)   !important; color: var(--hd-text) !important; border-color: var(--hd-red-bd)   !important; }
html .alert-success, html[data-theme="dark"] .alert-success { background: var(--hd-green-bg) !important; color: var(--hd-text) !important; border-color: var(--hd-green-bd) !important; }
html .alert-info, html .alert-primary,
html[data-theme="dark"] .alert-info, html[data-theme="dark"] .alert-primary { background: var(--hd-blue-bg) !important; color: var(--hd-text) !important; border-color: var(--hd-blue-bd) !important; }
.alert .bi:first-child { opacity: 0.9; }

/* Thin semantic edge on a whole card / panel (instead of tinted backgrounds) */
.section-card.hd-edge-amber, .section-card.hd-edge-red, .section-card.hd-edge-green { position: relative; }
.section-card:is(.hd-edge-amber, .hd-edge-red, .hd-edge-green)::before {
    content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0;
}
.section-card.hd-edge-amber::before { background: var(--hd-amber); }
.section-card.hd-edge-red::before   { background: var(--hd-red); }
.section-card.hd-edge-green::before { background: var(--hd-green); }

/* Legacy accent cards (card-accent-*) use a thick coloured border — slim it to the same edge style */
.card-accent-red, .card-accent-blue, .card-accent-green, .card-accent-orange { border-left-width: 3px !important; }

.hd-group-label { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.25rem 0 0.55rem; }

/* Filter row used by Assets and similar pages */
.hd-filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.7rem; }
.hd-filter-row > div { min-width: 150px; }
.hd-filter-row > .hd-filter-grow { flex: 1 1 260px; }
.hd-filter-row > .tk-filter-actions { min-width: 0; }

/* Status rows: never tint a whole row — a thin left accent carries the state.
   (Bootstrap paints each cell via --bs-table-bg; legacy rules added orange/green tints.) */
.table > tbody > tr:is(.table-warning, .table-success, .table-danger, .table-info, .ticket-critical-row),
.table > tbody > tr:is(.table-warning, .table-success, .table-danger, .table-info, .ticket-critical-row) > *,
html[data-theme="dark"] .table > tbody > tr:is(.table-warning, .table-success, .table-danger, .table-info, .ticket-critical-row),
html[data-theme="dark"] .table > tbody > tr:is(.table-warning, .table-success, .table-danger, .table-info, .ticket-critical-row) > * {
    --bs-table-bg: transparent;
    --bs-table-accent-bg: transparent;
    background-color: transparent !important;
    color: inherit !important;
}
.table > tbody > tr:is(.table-danger, .ticket-critical-row) > :first-child { box-shadow: inset 3px 0 0 var(--hd-red) !important; }
.table > tbody > tr.table-warning > :first-child { box-shadow: inset 3px 0 0 var(--hd-amber) !important; }
.table > tbody > tr.table-success > :first-child { box-shadow: inset 3px 0 0 var(--hd-green) !important; }
.table > tbody > tr.table-info > :first-child { box-shadow: inset 3px 0 0 var(--hd-blue) !important; }
.table > tbody > tr:is(.table-warning, .table-success, .table-danger, .table-info, .ticket-critical-row):hover > * { background-color: var(--hd-surface-hover) !important; }

/* Bootstrap border utilities are near-white (#dee2e6) — match the theme's borders */
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--hd-border) !important; }

/* ── Device Updates ── */
.dv-add-group-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding: 0.7rem 0.95rem; }
.dv-add-group-form .form-label { font-size: 0.82rem; font-weight: 650; color: var(--hd-text-2); white-space: nowrap; }
.dv-add-group-form .form-control { flex: 1 1 240px; max-width: 420px; }
.dv-progress-card .progress { background: var(--hd-surface-2); }
.dv-pending-value { color: var(--hd-amber) !important; }
.dv-pending-value.is-clear { color: var(--hd-green) !important; }

.dv-group .updates-group-header { padding: 0.7rem 0.95rem; gap: 0.75rem; cursor: pointer; user-select: none; border-radius: var(--hd-radius-lg); transition: background var(--hd-fast) ease; }
.dv-group .updates-group-header:hover { background: var(--hd-surface-hover); }
.dv-group .updates-group-header:focus-visible { outline: 2px solid var(--hd-accent); outline-offset: -2px; }
.dv-group-title { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.dv-group-name { font-weight: 650; color: var(--hd-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dv-group-meta { display: flex; flex-wrap: wrap; gap: 0.6rem; font-size: 0.75rem; color: var(--hd-muted); }
.dv-overdue-count { color: var(--hd-red); font-weight: 600; display: inline-flex; align-items: center; gap: 0.25rem; }
.dv-group-side { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.dv-group-progress { width: 110px; }
.dv-group-progress .hd-meter { width: 100%; height: 6px; }
.dv-add-device { padding: 0.65rem 0.95rem; border-bottom: 1px solid var(--hd-border); }
.dv-add-device form { padding: 0.25rem 0 0.15rem; }
.dv-group-foot { border-top: 1px solid var(--hd-border); }
.group-chevron { color: var(--hd-muted); }

/* List view (the original table): neutral rows, red edge for overdue — no brown tint */
html.hd-updates-list .dv-table > tbody > tr.table-warning > :first-child { box-shadow: inset 3px 0 0 var(--hd-red) !important; }

/* Cards view (default): the SAME table rows laid out as compact cards (one set of rows, so
   updates.js keeps working unchanged). Columns follow the group's real width. */
html:not(.hd-updates-list) .updates-device-table-wrap { max-height: none; overflow: visible; padding: 0.85rem 0.95rem; container-type: inline-size; }
html:not(.hd-updates-list) .dv-table { display: block; border: 0; }
html:not(.hd-updates-list) .dv-table > thead { display: none; }
html:not(.hd-updates-list) .dv-table > tbody { display: grid; gap: 0.6rem; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 520px) { html:not(.hd-updates-list) .dv-table > tbody { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (min-width: 900px) { html:not(.hd-updates-list) .dv-table > tbody { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
html:not(.hd-updates-list) .updates-device-table-wrap .dv-table > tbody > tr {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "check name actions" "freq freq freq" "next next next" "last last last";
    align-items: center;
    column-gap: 0.55rem; row-gap: 0.15rem;
    padding: 0.65rem 0.75rem 0.6rem;
    background: var(--hd-surface-2) !important;
    border: 1px solid var(--hd-border);
    border-radius: 12px;
    transition: border-color 160ms ease, transform 180ms var(--hd-ease), box-shadow 180ms ease;
}
html:not(.hd-updates-list) .dv-table > tbody > tr.d-none { display: none !important; }
html:not(.hd-updates-list) .dv-table > tbody > tr:hover { border-color: var(--hd-accent-bd); transform: translateY(-2px); box-shadow: var(--hd-shadow); }
html:not(.hd-updates-list) .updates-device-table-wrap .dv-table > tbody > tr > *,
html:not(.hd-updates-list) .updates-device-table-wrap .dv-table > tbody > tr > :first-child {
    display: block !important;           /* overrides d-none / d-md-table-cell on the meta cells */
    padding: 0 !important; border: 0 !important;
    background: transparent !important; box-shadow: none !important;
    text-align: left !important;
}
html:not(.hd-updates-list) .dv-table .dv-cell-check   { grid-area: check; }
html:not(.hd-updates-list) .dv-table .dv-cell-name    { grid-area: name; min-width: 0; overflow-wrap: anywhere; font-size: 0.88rem; padding-bottom: 0.3rem !important; }
html:not(.hd-updates-list) .dv-table .dv-cell-actions { grid-area: actions; }
html:not(.hd-updates-list) .dv-table .dv-cell-actions .btn { padding: 0.12rem 0.42rem; }
html:not(.hd-updates-list) .updates-device-table-wrap .dv-table > tbody > tr > .dv-cell-meta {
    display: flex !important; justify-content: space-between; gap: 0.5rem;
    font-size: 0.76rem !important; color: var(--hd-text-2) !important;
}
html:not(.hd-updates-list) .dv-table .dv-cell-meta::before { content: attr(data-label); color: var(--hd-muted); }
html:not(.hd-updates-list) .updates-device-table-wrap .dv-table > tbody > tr > [data-label="Frequency"] {
    grid-area: freq; border-top: 1px solid var(--hd-border) !important; padding-top: 0.4rem !important;
}
html:not(.hd-updates-list) .dv-table [data-label="Next due"]     { grid-area: next; }
html:not(.hd-updates-list) .dv-table [data-label="Last updated"] { grid-area: last; }
html:not(.hd-updates-list) .dv-table .check-device-btn { font-size: 1.15rem; line-height: 1; }
/* Overdue: thin red edge (badge stays) · Completed: thin green edge, muted */
html:not(.hd-updates-list) .dv-table > tbody > tr.table-warning::before,
html:not(.hd-updates-list) .dv-table > tbody > tr.table-success::before {
    content: ""; position: absolute; left: -1px; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0;
}
html:not(.hd-updates-list) .dv-table > tbody > tr.table-warning::before { background: var(--hd-red); }
html:not(.hd-updates-list) .dv-table > tbody > tr.table-success::before { background: var(--hd-green); }
html:not(.hd-updates-list) .dv-table > tbody > tr.table-success { opacity: 0.85; }

/* ── 11. Motion: entrances, page transitions ──────────────────────────────── */
@keyframes hd-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes hd-fade { from { opacity: 0; } to { opacity: 1; } }
/* Uses the individual translate/scale properties: Popper positions dropdowns with an inline
   `transform`, which a transform-based keyframe would override mid-animation. */
@keyframes hd-pop-in { from { opacity: 0; translate: 0 -6px; scale: 0.97; } to { opacity: 1; translate: 0 0; scale: 1; } }

/* Page content eases in (first-level blocks, lightly staggered) */
.app-page-content > main > * { animation: hd-rise 420ms var(--hd-ease) both; }
.app-page-content > main > *:nth-child(2) { animation-delay: 40ms; }
.app-page-content > main > *:nth-child(3) { animation-delay: 80ms; }
.app-page-content > main > *:nth-child(n+4) { animation-delay: 120ms; }

/* Dashboard: staggered card entrance (the wrapper itself doesn't animate) */
.app-page-content > main > .dash-viewport { animation: none; }
.dash-hero { animation: hd-rise 480ms var(--hd-ease) both; }
.dash-stat-row > .col { animation: hd-rise 480ms var(--hd-ease) both; }
.dash-stat-row > .col:nth-child(1) { animation-delay: 60ms; }
.dash-stat-row > .col:nth-child(2) { animation-delay: 110ms; }
.dash-stat-row > .col:nth-child(3) { animation-delay: 160ms; }
.dash-stat-row > .col:nth-child(4) { animation-delay: 210ms; }
.dash-stat-row > .col:nth-child(5) { animation-delay: 260ms; }
.dash-main-col { animation: hd-rise 520ms var(--hd-ease) both; }
.dash-main-col:nth-child(1) { animation-delay: 220ms; }
.dash-main-col:nth-child(2) { animation-delay: 290ms; }
.dash-main-col:nth-child(3) { animation-delay: 360ms; }

/* Cross-document page transitions (Edge/Chrome 126+, Safari 18.2+; others just navigate) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 140ms ease both hd-vt-out; }
::view-transition-new(root) { animation: 260ms var(--hd-ease) both hd-vt-in; }
::view-transition-group(hd-sidebar), ::view-transition-group(hd-topbar) { animation-duration: 0s; }
@keyframes hd-vt-out { to { opacity: 0; } }
@keyframes hd-vt-in { from { opacity: 0; transform: translateY(6px); } }

/* ── 12. Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .app-page-content, html[data-theme="dark"] .app-page-content { padding: 1.1rem 1rem 2rem; }
    .app-topbar, html[data-theme="dark"] .app-topbar { padding: 0 1rem; }
    .dash-hero-chips { width: 100%; }
}
@media (max-width: 575.98px) {
    .dash-hero, .dash-viewport .dash-hero { padding: 1rem 1.1rem 1rem 1.3rem; }
    .dash-hero-greeting, .dash-viewport .dash-hero-greeting { font-size: 1.3rem; }
    .dash-stat-value, .dash-viewport .dash-stat-value { font-size: 1.4rem; }
}

/* ── 13. Reduced motion: honour the OS setting everywhere ─────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        animation-delay: 0ms !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    @view-transition { navigation: none; }
}
