/* ValveTrac AG Grid demo — sidebar shell with dark mode + collapsible sidebar.
   Light/dark themes are driven by [data-theme] on <html>. Sidebar collapse is
   driven by html.sidebar-collapsed. */

@import url('https://fonts.googleapis.com/css?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Brand */
    --puffer-blue: #004b8d;
    --puffer-blue-dark: #003a6f;
    --puffer-blue-light: #1a6bb0;
    --puffer-accent: #f0ad4e;
    --puffer-gray: #939598;

    /* Shell dimensions */
    --sidebar-width: 240px;
    --sidebar-width-collapsed: 64px;
    --topbar-height: 56px;

    /* Light theme tokens */
    --bg: #f7f9fc;
    --bg-elevated: #ffffff;
    --text: #2f3b4a;
    --text-muted: #6b7686;
    --text-strong: #1a232f;
    --border-soft: #e6eaef;
    --border-hard: #cfd6df;
    --hover-bg: #eef2f7;
    --topbar-bg: #ffffff;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-elevated: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --input-bg: #ffffff;
    --input-border: #e6eaef;

    /* Sidebar (always Puffer-blue for brand identity) */
    --sb-bg: var(--puffer-blue);
    --sb-text: #cfe0f0;
    --sb-text-strong: #ffffff;
    --sb-divider: rgba(255, 255, 255, 0.08);
    --sb-hover: rgba(255, 255, 255, 0.06);
    --sb-active: rgba(255, 255, 255, 0.14);
}

[data-theme="dark"] {
    --bg: #0f141c;
    --bg-elevated: #181f2a;
    --text: #d8dee6;
    --text-muted: #8e98a8;
    --text-strong: #ffffff;
    --border-soft: #232b39;
    --border-hard: #2c3548;
    --hover-bg: #1f2734;
    --topbar-bg: #181f2a;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-elevated: 0 1px 3px rgba(0, 0, 0, 0.5), 0 1px 2px rgba(0, 0, 0, 0.4);
    --input-bg: #1d2531;
    --input-border: #2c3548;

    --sb-bg: #0a2c54;                      /* slightly deeper puffer-blue */
    --sb-text: #b7cee4;
    --sb-divider: rgba(255, 255, 255, 0.06);
    --sb-hover: rgba(255, 255, 255, 0.05);
    --sb-active: rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a, .btn-link { color: var(--puffer-blue); text-decoration: none; }
a:hover, .btn-link:hover { color: var(--puffer-blue-dark); }

[data-theme="dark"] a,
[data-theme="dark"] .btn-link { color: #6fb1ff; }
[data-theme="dark"] a:hover,
[data-theme="dark"] .btn-link:hover { color: #99c8ff; }

/* ===================================================================
   App shell
   =================================================================== */
.app-shell { min-height: 100vh; }

/* ---------- Non-production environment banner ---------- */
.env-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    z-index: 1100;               /* above the fixed sidebar (1040) and sticky topbar (1030) */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: #3a2e00;
    background: repeating-linear-gradient(45deg, #ffd86b, #ffd86b 14px, #ffc107 14px, #ffc107 28px);
    border-bottom: 1px solid #d39e00;
}
.env-banner a { color: inherit; text-decoration: underline; font-weight: 800; }
.env-banner a:hover { text-decoration: none; }
/* Keep the banner text on ONE line within the fixed 30px band; long text ellipsizes rather than
   overflowing the band on narrow screens. */
.env-banner > span, .env-banner a { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env-banner-short { display: none; }   /* full sentence by default; compact label swaps in on mobile */
/* When the banner is shown, push the fixed sidebar, sticky topbar and content down by its height. */
body.has-env-banner .sidebar { top: 30px; }
body.has-env-banner .topbar  { top: 30px; }
body.has-env-banner .app-main { padding-top: 30px; }
[data-theme="dark"] .env-banner {
    color: #ffe9b0;
    background: repeating-linear-gradient(45deg, #4a3a0f, #4a3a0f 14px, #5b4615 14px, #5b4615 28px);
    border-bottom-color: #6b5418;
}

/* ---------- Sidebar ---------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background-color: var(--sb-bg);
    color: var(--sb-text);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.04);
    transition: transform 0.22s ease, width 0.2s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--sb-divider);
    height: var(--topbar-height);
    overflow: hidden;
}
.sidebar-brand img.brand-mark { height: 28px; flex: 0 0 auto; }
.sidebar-brand .brand-name {
    color: var(--sb-text-strong);
    font-weight: 600;
    font-size: 17px;
    letter-spacing: 0.4px;
    white-space: nowrap;
    flex: 1;
}

.sidebar-collapse-toggle {
    margin-left: auto;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background-color 0.12s;
}
.sidebar-collapse-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
    /* Thin, translucent scrollbar that blends with the blue sidebar (Firefox) */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
/* WebKit/Chromium scrollbar styling for the sidebar nav */
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, 0.45); }
.sidebar-nav-section {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 14px 14px 6px;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 14px;
    color: var(--sb-text);
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    margin-bottom: 2px;
    line-height: 1.2;
    transition: background-color 0.12s, color 0.12s;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-nav a i {
    font-size: 16px;
    opacity: 0.85;
    width: 18px;
    text-align: center;
    flex: 0 0 18px;
}
.sidebar-nav a:hover {
    background-color: var(--sb-hover);
    color: var(--sb-text-strong);
    text-decoration: none;
}
.sidebar-nav a.active {
    background-color: var(--sb-active);
    color: var(--sb-text-strong);
    box-shadow: inset 3px 0 0 var(--puffer-accent);
}
.sidebar-nav a.active i { opacity: 1; }

/* External-link indicator on the right edge of links that leave the app */
.sidebar-nav a .external-icon {
    margin-left: auto;
    font-size: 11px !important;
    opacity: 0.5;
    width: auto !important;
    flex: 0 0 auto;
}
.sidebar-nav a:hover .external-icon { opacity: 0.85; }

/* Collapsed sidebar: hide the external-icon too (only show the primary leading icon) */
html.sidebar-collapsed .sidebar-nav a .external-icon { display: none; }

.sidebar-footer {
    padding: 12px 16px;
    min-height: 44px;            /* keep in lockstep with .app-footer so the two bands align */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-size: 11px;
    line-height: 20px;           /* fixed line box (not font-size dependent) so both footers match */
    color: rgba(255, 255, 255, 0.5);
    border-top: 1px solid var(--sb-divider);
    overflow: hidden;
}
.sidebar-footer .demo-switch { margin-bottom: 10px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-footer .demo-switch > span {
    color: rgba(255, 255, 255, 0.45);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.sidebar-footer .demo-switch a {
    display: block;
    color: var(--sb-text);
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-footer .demo-switch a.active { background-color: var(--sb-active); color: var(--sb-text-strong); }
.sidebar-footer .demo-switch a:hover { background-color: var(--sb-hover); color: var(--sb-text-strong); text-decoration: none; }

/* ---------- Sidebar collapsed (desktop only) ---------- */
html.sidebar-collapsed .sidebar { width: var(--sidebar-width-collapsed); }
html.sidebar-collapsed .app-main { margin-left: var(--sidebar-width-collapsed); }
html.sidebar-collapsed .sidebar-brand { padding: 14px 0; justify-content: center; }
/* Centre the logo mark within the (still flex:1) brand link when collapsed. */
html.sidebar-collapsed .sidebar-brand-link { justify-content: center; gap: 0; flex: 0 1 auto; }
html.sidebar-collapsed .sidebar-brand .brand-name,
html.sidebar-collapsed .sidebar-collapse-toggle,
html.sidebar-collapsed .sidebar-nav-section,
html.sidebar-collapsed .sidebar-nav a span,
html.sidebar-collapsed .sidebar-footer .demo-switch > span,
html.sidebar-collapsed .sidebar-footer .demo-switch a span,
html.sidebar-collapsed .sidebar-footer .copyright {
    display: none;
}
html.sidebar-collapsed .sidebar-nav a { justify-content: center; padding: 10px 0; }
html.sidebar-collapsed .sidebar-nav a i { font-size: 18px; }
html.sidebar-collapsed .sidebar-footer .demo-switch a { text-align: center; padding: 6px 0; }
html.sidebar-collapsed .sidebar-footer .demo-switch a i { margin: 0 !important; }

/* Floating "expand" button shown only when collapsed */
.sidebar-expand-toggle {
    display: none;
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 8px;
    margin: 0 auto 6px;
    border-radius: 4px;
    width: 36px;
    align-items: center;
    justify-content: center;
}
.sidebar-expand-toggle:hover { background: rgba(255, 255, 255, 0.12); color: white; }
html.sidebar-collapsed .sidebar-expand-toggle { display: flex; }

/* ---------- Main column ---------- */
.app-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.2s ease;
    background-color: var(--bg);
}

/* ---------- Topbar ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    height: var(--topbar-height);
    background-color: var(--topbar-bg);
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 14px;
}

.sidebar-toggle {
    background: transparent;
    border: 0;
    font-size: 22px;
    color: var(--text);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    display: none;
}
.sidebar-toggle:hover { background-color: var(--hover-bg); }


.topbar-breadcrumb { color: var(--text-muted); font-size: 13px; }
.topbar-breadcrumb a { color: var(--text-muted); }
.topbar-breadcrumb a:hover { color: var(--puffer-blue); text-decoration: none; }
.topbar-breadcrumb .crumb-current { color: var(--text); font-weight: 500; }

.topbar-spacer { flex: 1; }

/* Mobile-only Home link in the topbar (a house icon, styled like the other topbar-icon-btn actions).
   Hidden on desktop where the breadcrumb + always-visible sidebar already give a Home path; shown below
   768px where both are gone/buried. Selector combines both classes so it beats .topbar-icon-btn's own
   display:inline-flex (same specificity, but that rule is defined later and would otherwise win). */
.topbar-home-mobile.topbar-icon-btn { display: none; }

.topbar-actions { display: flex; align-items: center; gap: 6px; }
/* Puffer logo pinned to the far right of the top bar, after the user menu */
.topbar-logo { height: 26px; width: auto; margin-left: 8px; }
/* Swap the Puffer logo to the white version in dark mode (the default is the dark/colour logo). */
.topbar-logo.logo-dark { display: none; }
[data-theme="dark"] .topbar-logo.logo-light { display: none; }
[data-theme="dark"] .topbar-logo.logo-dark { display: inline; }
.topbar-icon-btn {
    background: transparent;
    border: 0;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.topbar-icon-btn:hover { background-color: var(--hover-bg); color: var(--puffer-blue); }
[data-theme="dark"] .topbar-icon-btn:hover { color: #6fb1ff; }
.topbar-icon-btn i { font-size: 18px; }
.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: 999px;
    cursor: pointer;
}
.user-menu:hover { background-color: var(--hover-bg); }
.user-menu .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: var(--puffer-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}
.user-menu .user-name { font-size: 13px; color: var(--text); font-weight: 500; }

/* ---------- Content ---------- */
.content { padding: 24px 28px 40px; flex: 1; }

/* ---------- App footer (all pages) ---------- */
.app-footer {
    border-top: 1px solid var(--border-soft);
    padding: 12px 28px;
    min-height: 44px;            /* keep in lockstep with .sidebar-footer so the two bands align */
    box-sizing: border-box;
    background-color: var(--topbar-bg);
    font-size: 12px;
    line-height: 20px;           /* fixed line box (not font-size dependent) so both footers match */
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 4px 16px;
}
.app-footer-help a { color: var(--puffer-blue); text-decoration: none; }
.app-footer-help a:hover { text-decoration: underline; }
.app-footer-copy { white-space: nowrap; }
@media (max-width: 575.98px) {
    .app-footer { padding: 12px 16px; flex-direction: column; align-items: flex-start; }
}

/* ---------- Mobile / drawer ---------- */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.42);
    z-index: 1035;
}

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
    .sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0 !important; }
    .sidebar-toggle { display: inline-flex; }
    .sidebar-backdrop.show { display: block; }
    .content { padding: 18px 16px 32px; }
    /* Disable collapsed mode on mobile - the sidebar is a full-width drawer here, never a rail.
       A persisted desktop-collapsed state must not leak into the drawer (it centered the brand and
       hid the << toggle). Fully revert every collapsed-mode layout rule, not just visibility. */
    html.sidebar-collapsed .sidebar { width: var(--sidebar-width) !important; }
    html.sidebar-collapsed .sidebar-brand,
    html.sidebar-collapsed .sidebar-nav-section,
    html.sidebar-collapsed .sidebar-nav a span,
    html.sidebar-collapsed .sidebar-footer .demo-switch > span,
    html.sidebar-collapsed .sidebar-footer .demo-switch a span,
    html.sidebar-collapsed .sidebar-footer .copyright { display: revert !important; }
    html.sidebar-collapsed .sidebar-brand { padding: 14px 16px; justify-content: revert; }
    html.sidebar-collapsed .sidebar-brand-link { justify-content: revert; gap: 10px; flex: 1; }
    html.sidebar-collapsed .sidebar-nav a { justify-content: revert; padding: 9px 14px; }
    html.sidebar-collapsed .sidebar-expand-toggle { display: none; }
    html.sidebar-collapsed .sidebar-collapse-toggle { display: inline-flex !important; }
}

/* ===================================================================
   Layout variants — Sidebar (default) | Top nav | Launcher
   Driven by html.layout-{sidebar|top|launcher}. Default = sidebar.
   =================================================================== */

/* Top-nav row that appears below the topbar in top/launcher mode */
.topbar-nav { display: none; }
.topbar-nav {
    position: sticky;
    top: var(--topbar-height);
    z-index: 1029;
    background-color: var(--topbar-bg);
    border-bottom: 1px solid var(--border-soft);
    padding: 0 24px;
}
.topbar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 2px;
    overflow-x: auto;
    white-space: nowrap;
}
.topbar-nav li { display: inline-block; }
.topbar-nav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    text-decoration: none;
    transition: color 0.12s, border-color 0.12s, background-color 0.12s;
}
.topbar-nav a i { font-size: 15px; opacity: 0.85; }
.topbar-nav a:hover { color: var(--text-strong); background-color: var(--hover-bg); text-decoration: none; }
.topbar-nav a.active {
    color: var(--puffer-blue);
    border-bottom-color: var(--puffer-blue);
}
[data-theme="dark"] .topbar-nav a.active { color: #6fb1ff; border-bottom-color: #6fb1ff; }

/* Show/hide the chrome based on layout class on <html> */
html.layout-sidebar .topbar-nav { display: none; }
html.layout-sidebar .sidebar { display: flex; }
html.layout-sidebar .app-main { margin-left: var(--sidebar-width); }

html.layout-top .sidebar,
html.layout-launcher .sidebar { display: none; }
html.layout-top .topbar-nav,
html.layout-launcher .topbar-nav { display: block; }
html.layout-top .app-main,
html.layout-launcher .app-main { margin-left: 0; }
html.layout-top .sidebar-toggle,
html.layout-launcher .sidebar-toggle { display: none !important; }

/* When sidebar is collapsed AND we're in sidebar mode, narrow the content margin.
   Other layouts ignore the collapsed class (no sidebar to collapse). */
html.layout-sidebar.sidebar-collapsed .app-main { margin-left: var(--sidebar-width-collapsed); }
html:not(.layout-sidebar) .sidebar-expand-toggle { display: none !important; }

/* Mobile: drawer behavior is sidebar-only. Top/launcher hide the sidebar entirely. */
@media (max-width: 991.98px) {
    .topbar-nav { padding: 0 12px; }
    .topbar-nav a { padding: 10px 12px; font-size: 13px; }
}

/* ===================================================================
   Repair Tracker (modernized "pizza tracker")
   =================================================================== */
.tracker-section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}
.tracker-section-title { font-size: 16px; font-weight: 600; color: var(--text-strong); margin: 0 0 4px; }
.tracker-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    color: var(--text-muted);
    font-size: 13px;
}
.tracker-meta i { margin-right: 4px; opacity: 0.8; }
.tracker-meta strong { color: var(--text); }
.tracker-customer { color: var(--text-muted); }

.tracker-config-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.tracker-config-select { min-width: 240px; }

/* Horizontal stepper */
.stepper {
    list-style: none;
    margin: 0;
    padding: 6px 4px 8px;
    display: flex;
    gap: 0;
    overflow-x: auto;
    counter-reset: step;
}
.step {
    flex: 1 1 0;
    min-width: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    padding: 4px 4px 0;
}

/* Connector line: lives on each step :before, drawn from left-half across to center */
.step:not(:first-child)::before {
    content: '';
    position: absolute;
    top: 24px;                /* matches half of 48px circle */
    left: -50%;
    right: 50%;
    height: 2px;
    background: var(--border-soft);
    z-index: 0;
    transition: background-color 0.25s;
}
.step-done:not(:first-child)::before,
.step-current:not(:first-child)::before { background: var(--puffer-blue); }

/* Circle node */
.step-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--bg-elevated);
    border: 2px solid var(--border-soft);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    position: relative;
    z-index: 1;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}

/* State: done — filled with checkmark */
.step-done .step-circle {
    background-color: var(--puffer-blue);
    border-color: var(--puffer-blue);
    color: white;
}

/* State: current — white fill, puffer-blue ring, pulsing halo */
.step-current .step-circle {
    background-color: var(--bg-elevated);
    border-color: var(--puffer-blue);
    color: var(--puffer-blue);
    box-shadow: 0 0 0 4px rgba(0, 75, 141, 0.18);
    animation: stepper-pulse 2.2s ease-in-out infinite;
}

/* State: pending — outlined gray */
.step-pending .step-circle {
    background-color: var(--bg-elevated);
    border-color: var(--border-soft);
    color: var(--text-muted);
    opacity: 0.85;
}

/* Exception (red ring) */
.step-exception .step-circle {
    border-color: #d9534f;
    color: #d9534f;
    box-shadow: 0 0 0 4px rgba(217, 83, 79, 0.18);
    animation: stepper-pulse-exception 2.2s ease-in-out infinite;
}

@keyframes stepper-pulse-exception {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(217, 83, 79, 0.18);
    }

    50% {
        box-shadow: 0 0 0 7px rgba(217, 83, 79, 0.06);
    }
}

.step-info { margin-top: 10px; }
.step-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
    max-width: 120px;
}
.step-current .step-label { color: var(--puffer-blue); }
[data-theme="dark"] .step-current .step-label { color: #6fb1ff; }
.step-pending .step-label { color: var(--text-muted); font-weight: 500; }
.step-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

@keyframes stepper-pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(0, 75, 141, 0.18); }
    50%      { box-shadow: 0 0 0 10px rgba(0, 75, 141, 0.04); }
}

/* ===== Dashboard variant: bigger circles, count badge ===== */
.stepper-counts .step-circle {
    width: 62px;
    height: 62px;
    font-size: 22px;
}
.stepper-counts .step:not(:first-child)::before { top: 31px; }
.stepper-counts .step-circle-button {
    cursor: pointer;
    border-style: solid;
}
.stepper-counts .step-circle-button:hover {
    transform: translateY(-2px);
    border-color: var(--puffer-blue);
    color: var(--puffer-blue);
    box-shadow: 0 4px 12px rgba(0, 75, 141, 0.12);
}
.stepper-counts .step.step-selected .step-circle {
    background-color: var(--puffer-blue);
    border-color: var(--puffer-blue);
    color: white;
}
.step-count {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--puffer-blue);
    color: white;
    border: 2px solid var(--bg-elevated);   /* white ring separates the blue badge from the blue circle */
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    min-width: 24px;
    line-height: 1.4;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
/* No jobs at this station: keep the circle opaque (same fill as the active circles) so the
   connector line doesn't show through it. The absent count badge is the only "empty" cue. */
.stepper-counts .step-empty .step-circle { background-color: var(--bg-elevated); opacity: 1; }

/* Repair-status cell as a "stoplight" dot + label. */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
}
/* Official marketing stoplight palette (see vt-grid.js stoplightColor for the status -> class map). */
.status-dot-lime  { background-color: #87DA87; }  /* Received */
.status-dot-green { background-color: #1FB47D; }  /* Shipped */
.status-dot-amber { background-color: #F6B017; }  /* Advised Cost / Waiting on Parts / Outside Processing */
.status-dot-red   { background-color: #ED4747; }  /* On Hold / Pretest / Teardown / Inspection / BER / Machining / Assembly / Testing / Final Inspection / Paint / Preparing for Shipment */
.status-dot-gray  { background-color: var(--puffer-gray); }  /* New / Planned / unknown */


/* "How this scales" info card */
.alert-card {
    display: flex;
    gap: 12px;
    background-color: rgba(0, 75, 141, 0.06);
    border: 1px solid rgba(0, 75, 141, 0.18);
    border-radius: 10px;
    padding: 14px 16px;
}
.alert-card i { font-size: 20px; color: var(--puffer-blue); margin-top: 2px; }
.alert-card p { margin: 4px 0 0; color: var(--text); font-size: 13px; }
.alert-card code {
    background-color: rgba(0, 0, 0, 0.06);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
}
[data-theme="dark"] .alert-card {
    background-color: rgba(111, 177, 255, 0.06);
    border-color: rgba(111, 177, 255, 0.22);
}

/* ERP-degradation banner: ONE amber warning banner shown at the top of every page when the ERP (Oracle) is unavailable. 
   Same markup + style everywhere (see _ErpUnavailable partial) so an outage reads consistently. Amber = #F6B017 */
.erp-banner {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background-color: rgba(246, 176, 23, 0.12);
    border: 1px solid rgba(246, 176, 23, 0.45);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 16px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.4;
}
.erp-banner i { font-size: 20px; color: #C8890B; margin-top: 1px; flex-shrink: 0; }
.erp-banner a { color: inherit; text-decoration: underline; font-weight: 600; }
[data-theme="dark"] .erp-banner {
    background-color: rgba(246, 176, 23, 0.10);
    border-color: rgba(246, 176, 23, 0.40);
}
[data-theme="dark"] .erp-banner i { color: #F6B017; }
[data-theme="dark"] .alert-card i { color: #6fb1ff; }
[data-theme="dark"] .alert-card code { background-color: rgba(255, 255, 255, 0.08); }

/* ===== Mobile / tablet: switch to vertical timeline ===== */
@media (max-width: 767.98px) {
    .stepper { flex-direction: column; gap: 0; padding: 8px 4px; }
    .step {
        flex: 0 0 auto;
        flex-direction: row;
        align-items: center;
        text-align: left;
        padding: 6px 0 10px;
        min-width: 0;
        gap: 14px;
    }
    /* Vertical connector now runs above each step from the previous step's circle */
    .step:not(:first-child)::before {
        top: -10px;
        left: 23px;
        right: auto;
        bottom: auto;
        width: 2px;
        height: 16px;
    }
    .stepper-counts .step:not(:first-child)::before { left: 30px; }
    .step-info { margin-top: 0; flex: 1; max-width: none; }
    .step-label { max-width: none; }
    .step-count { top: -2px; right: -6px; }
}

/* ===================================================================
   Dashboard (KPI tiles + chart cards + mini grid)
   =================================================================== */
.dashboard-filterbar {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 16px;
}
.dash-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dash-filter-group label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; }
.dash-filter-group select { min-width: 180px; height: 38px; }
/* Widen the closed multiselect toggle ("All Asset Types") so the box lines up with its content-sized open
   menu below it. The width covers the longest asset-type option; the menu's min-width:100% then pins the
   panel to the same width, so the two match. */
.dash-filter-group .vt-multiselect { min-width: 220px; }

/* Wildcard input + Search button sit on one row */
.dash-wildcard { display: flex; gap: 6px; align-items: stretch; }
.dash-wildcard input { min-width: 260px; }
/* Cost Approval wildcard: the placeholder ("Search Tag, Customer Asset ID, and PO") is long, so give
   the input room to show it without clipping. */
.cost-filter-wildcard input { min-width: 300px; }
.dash-wildcard .btn { white-space: nowrap; }
/* Wide screens: view buttons pinned top-right (margin-left:auto absorbs the free space AFTER the search
   cluster, so the Sites/Asset Types/Search controls keep their fixed 12px gaps - the gap between them
   never changes on resize; only the space before the buttons flexes, which is the intended right-align).
   When the bar runs out of room, .is-wrapped drops the buttons to their own row, left-aligned per the
   app-wide wrapped-control convention. */
.dash-view-buttons { margin-left: auto; }
.is-wrapped > .dash-view-buttons { margin-left: 0; flex-basis: 100%; }


/* ===================================================================
   Mobile pass (<576px and 576—991px tablet refinements)
   =================================================================== */

/* --- Topbar: shed non-essential bits on narrow screens --- */
@media (max-width: 767.98px) {
    .topbar { padding: 0 10px; gap: 6px; }
    .topbar-breadcrumb { display: none; }                  /* page-header already labels the page */
    .topbar-home-mobile.topbar-icon-btn { display: inline-flex; }   /* the Home link the hidden breadcrumb held */
    .user-menu { padding: 4px; }                           /* avatar-only, no padding bloat */
    /* Compact env-banner text so it fits the fixed 30px band instead of overflowing it. */
    .env-banner-full { display: none; }
    .env-banner-short { display: inline; }
    .env-banner { gap: 4px; padding: 0 8px; letter-spacing: 0; }
}

/* --- Sidebar drawer: a bit roomier on phones for thumb-friendly tapping --- */
@media (max-width: 575.98px) {
    .sidebar { width: 280px; }
    .sidebar-nav a { padding: 12px 16px; font-size: 14.5px; }
    .sidebar-nav a i { font-size: 18px; width: 22px; }
}

/* --- Page header --- */
@media (max-width: 575.98px) {
    .page-header h2 { font-size: 20px; }
    .content { padding: 14px 12px 28px; }
}

/* --- Asset Search form: stack each input full-width on phones --- */
@media (max-width: 575.98px) {
    .search-criteria { gap: 8px; flex-direction: column; align-items: stretch; }
    .search-criteria .form-group { width: 100%; }
    .search-criteria .form-control,
    .search-criteria .form-select {
        max-width: none;
        min-width: 0;
        width: 100%;
        height: 38px;            /* taller for finger taps */
        font-size: 14px;
    }
    .search-card { padding: 12px; }
}

/* On phones the search buttons row should stay horizontal but take full width */
@media (max-width: 575.98px) {
    .search-criteria:last-of-type { flex-direction: row; flex-wrap: wrap; }
    .search-criteria:last-of-type .btn { flex: 1 1 auto; }
}

/* --- Dashboard filter bar: stack on phones --- */
@media (max-width: 575.98px) {
    .dashboard-filterbar { padding: 12px; }
    .dash-filter-group { width: 100%; }
    .dash-filter-group select { min-width: 0; width: 100%; height: 38px; }
    .dashboard-filterbar .btn { width: 100%; }
    /* Keep the wildcard input + Search button on ONE row: the input flex-shrinks (drops its 260px min)
       and the Search button sizes to content instead of the full-width rule above, so it stays inside
       the card at ~360px instead of overflowing. */
    .dash-wildcard input { min-width: 0; flex: 1 1 auto; }
    .dash-wildcard .btn { width: auto; flex: 0 0 auto; }
}

/* When a filter bar's controls wrap to more than one row, the asset-type pills would otherwise strand
   below everything. JS adds .is-wrapped (see _Layout) at the REAL wrap point, sidebar state, or zoom, 
   and we reorder the pill strip to sit right under its dropdown, pushing the remaining controls below it. 
   On a single-row layout the strip stays a full-width bottom row. */
.is-wrapped #assetTypeChips { order: 1; }
.is-wrapped > .dash-filter-wildcard,
.is-wrapped > .dash-view-buttons,
.is-wrapped > .cost-filter-wildcard,
.is-wrapped > button[type="submit"] { order: 2; }

/* --- AG Grid pagination panel: avoid pushing the page-jump off-screen --- */
@media (max-width: 575.98px) {
    .ag-theme-quartz .ag-paging-panel {
        flex-wrap: wrap;
        gap: 8px 12px;
        padding-top: 8px;
        padding-bottom: 8px;
    }
    .ag-page-jump { margin-right: 0; }
    .ag-page-jump-label { display: none; }                 /* save space; input + Go is enough */
    .ag-page-jump-input { width: 56px; }
}

/* --- Results-meta row above the grid: smaller on phones --- */
@media (max-width: 575.98px) {
    .results-meta { font-size: 12px; }
}

/* --- Launcher cards: tighter spacing on phones --- */
@media (max-width: 575.98px) {
    .launcher-grid { gap: 10px; }
    .launcher-card { padding: 18px 16px 16px; min-height: auto; }
    .launcher-card .lc-icon { width: 38px; height: 38px; font-size: 19px; margin-bottom: 10px; }
    .launcher-welcome h2 { font-size: 22px; }
}


/* Status pill cells */
.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    line-height: 1.6;
}
.status-ok        { background-color: rgba(40, 167, 69, 0.15);  color: #1e7e34; }
.status-warn      { background-color: rgba(240, 173, 78, 0.18); color: #c47100; }
.status-danger    { background-color: rgba(217, 83, 79, 0.18);  color: #c0392b; }
.status-neutral   { background-color: rgba(147, 149, 152, 0.18); color: #5f6164; }

[data-theme="dark"] .status-ok        { background-color: rgba(40, 167, 69, 0.22);  color: #74d089; }
[data-theme="dark"] .status-warn      { background-color: rgba(240, 173, 78, 0.22); color: #ffc983; }
[data-theme="dark"] .status-danger    { background-color: rgba(217, 83, 79, 0.25);  color: #ff9c95; }
[data-theme="dark"] .status-neutral   { background-color: rgba(154, 164, 178, 0.18); color: #cfd6e0; }

/* ===================================================================
   Launcher cards (Home dashboard)
   =================================================================== */
.launcher-welcome { margin: 4px 0 20px; }
.launcher-welcome h2 {
    font-weight: 600;
    font-size: 26px;
    margin: 0 0 6px;
    color: var(--text-strong);
}
.launcher-welcome p { color: var(--text-muted); margin: 0; font-size: 14px; }

.launcher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.launcher-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 22px 22px 20px;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    box-shadow: var(--shadow-card);
    color: inherit;
    min-height: 140px;
}
.launcher-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated);
    border-color: var(--puffer-blue);
    text-decoration: none;
}
.launcher-card .lc-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background-color: rgba(0, 75, 141, 0.10);
    color: var(--puffer-blue);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 14px;
}
[data-theme="dark"] .launcher-card .lc-icon {
    background-color: rgba(111, 177, 255, 0.15);
    color: #6fb1ff;
}
.launcher-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-strong);
    margin: 0 0 4px;
}
.launcher-card p { color: var(--text-muted); font-size: 13px; margin: 0; }
.launcher-card .lc-badge {
    display: inline-block;
    margin-top: 8px;
    padding: 2px 8px;
    background-color: rgba(240, 173, 78, 0.18);
    color: var(--puffer-accent);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

/* ---------- Home: global lookup ---------- */
/* Size the search card to a share of the content area (which already excludes the sidebar) so it stays
   roughly two "Jump back in" cards wide. The max(...) floor keeps it comfortably wide on smaller/mid screens
   where a bare 76% would fall behind the near-full-width cards; the overall width:min(...) never exceeds the container, 
   so it still drops to full width when space is tight.max-width caps it on ultra-wide monitors. */
.global-lookup { margin: 4px 0 16px; width: min(100%, max(76%, 760px)); max-width: 900px; min-width: 0; }
@media (max-width: 992px) { .global-lookup { width: 100%; } }
.global-lookup-title { font-size: 18px; font-weight: 600; color: var(--text-strong); margin: 0 0 2px; }
.global-lookup-subtitle { font-size: 13px; color: var(--text-muted); margin: 0 0 14px; }
.global-lookup-form {
    display: flex;
    align-items: center;
    flex-wrap: wrap;   /* buttons drop below the input on narrow widths instead of overflowing the card */
    gap: 10px;
    position: relative;
    max-width: 720px;
}
.global-lookup-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 16px;
    pointer-events: none;
}
/* Hero global-search box is intentionally larger than standard 38px fields.
   Scoped selector keeps it at 46px despite the global field rule. */
.global-lookup-form .global-lookup-input {
    flex: 1;
    min-width: 180px;   /* keeps the input usable instead of collapsing to a sliver when space tightens */
    height: 46px;
    padding-left: 40px;
    font-size: 15px;
}
.global-lookup-form .btn { height: 46px; padding: 0 22px; }
.global-lookup-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* Narrow screens (Zebra TC22 ~360px): the input takes the full first row so Search + Reset wrap together
   onto the next row (easier to read). The search icon is pinned to the input's 46px height (top:0) so it
   stays inside the box - centering it on the whole form drifted it below the input once the buttons wrapped. */
@media (max-width: 575.98px) {
    .global-lookup-form .global-lookup-input { flex: 1 1 100%; }
    .global-lookup-icon { top: 0; height: 46px; display: flex; align-items: center; }
    .global-lookup-form .btn { flex: 1 1 auto; }   /* Search + Reset split the second row evenly */
}

/* ---------- Home: lookup results ---------- */
.lookup-results { margin: 18px 0 26px; }
/* Home lookup meta reads as plain left-aligned text (override the grid's space-between meta). */
.lookup-results .results-meta { display: block; margin-bottom: 10px; font-size: 14px; color: var(--text); }

/* Two-column results: active repairs (left) + assets (right). */
.lookup-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.lookup-col { min-width: 0; }
.lookup-col-head {
    display: flex; align-items: center; gap: 6px;
    margin: 2px 0 8px; font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted);
}
.lookup-col-count { font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.lookup-col-empty { color: var(--text-muted); font-size: 13px; padding: 10px 2px; }

/* Admin Reports - expandable account-manager sections (one collapsible grid per manager). */
.am-group { border: 1px solid var(--border-soft); border-radius: 8px; margin-bottom: 8px; overflow: hidden; }
.am-group-head {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 10px 14px; background: var(--surface-2, transparent); border: 0;
    text-align: left; cursor: pointer; font-size: 14px; color: var(--text);
}
.am-group-head:hover { background: var(--row-hover, rgba(0,0,0,0.03)); }
.am-group-name { font-weight: 600; }
.am-chevron { transition: transform 0.15s ease; color: var(--text-muted); }
.am-group-head.open .am-chevron { transform: rotate(90deg); }
.am-group-body { padding: 10px 14px 14px; border-top: 1px solid var(--border-soft); }
/* Compact row inside the narrower columns: type chip (with icon) left, id/sub + meta stacked,
   chevron right — the original look, fit to half width. */
.lookup-columns .lookup-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) 16px;
    gap: 1px 10px;
    align-items: center;
}
.lookup-columns .lookup-type { grid-column: 1; grid-row: 1 / span 2; align-self: center; }
.lookup-columns .lookup-main { grid-column: 2; grid-row: 1; }
.lookup-columns .lookup-meta-line { grid-column: 2; grid-row: 2; font-size: 12px; color: var(--text-muted); }
.lookup-columns .lookup-chevron { grid-column: 3; grid-row: 1 / span 2; align-self: center; color: var(--text-muted); }
@media (max-width: 800px) {
    .lookup-columns { grid-template-columns: 1fr; gap: 8px; }
}
.lookup-list {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-card);
}
.lookup-row {
    display: grid;
    grid-template-columns: 110px minmax(180px, 1.4fr) minmax(140px, 1fr) minmax(120px, 1fr) auto 18px;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    text-decoration: none;
    color: inherit;
    border-top: 1px solid var(--border-soft);
    transition: background-color 0.12s;
}
.lookup-row:first-child { border-top: none; }
.lookup-row:hover { background-color: var(--row-hover, rgba(0, 75, 141, 0.05)); text-decoration: none; }
.lookup-type {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    padding: 3px 9px;
    border-radius: 999px;
    justify-self: start;
}
.lookup-type.lt-asset { background-color: rgba(0, 75, 141, 0.12); color: var(--puffer-blue); }
.lookup-type.lt-repair { background-color: rgba(240, 173, 78, 0.18); color: var(--puffer-accent); }
[data-theme="dark"] .lookup-type.lt-asset { background-color: rgba(111, 177, 255, 0.16); color: #6fb1ff; }
.lookup-main { display: flex; flex-direction: column; min-width: 0; }
.lookup-id { font-weight: 600; color: var(--text-strong); }
/* The active-repair WIP badge is the shared .recent-badge (no built-in margin), so give it the same
   spacing from the title that .lookup-life gets, and center it against the larger id text. */
.lookup-id .recent-badge { margin-left: 8px; vertical-align: middle; }
/* Repair lifecycle badge (Active in-shop vs Historical/closed) - global search results. */
.lookup-life {
    display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 10px;
    font-size: 11px; font-weight: 600; vertical-align: middle; white-space: nowrap;
}
.lookup-life.ll-active { background-color: rgba(31, 180, 125, 0.16); color: #1FB47D; }
.lookup-life.ll-historical { background-color: rgba(147, 149, 152, 0.20); color: #5f6164; }  /* brand gray */
[data-theme="dark"] .lookup-life.ll-active { background-color: rgba(135, 218, 135, 0.18); color: #87DA87; }
[data-theme="dark"] .lookup-life.ll-historical { background-color: rgba(147, 149, 152, 0.20); color: #b9bbbe; }
/* Inline emphasis used in the repair-results note. */
.ll-active-text { color: #1FB47D; }
.ll-historical-text { color: var(--puffer-gray); }

/* Severity text colours (Repair grid, employee-only) - ported from legacy .severity-{code}.
   Code from RepairStatus.sql DECODE: Emergency=100, 4 Hour=200, Hot(Same Day=300, Next Day=400,
   Two Day=500, else/Routine=600. Higher urgency = warmer/bolder. */
.severity-100 { color: #e2231a; font-weight: 700; }   /* Emergency */
.severity-200 { color: #ec7423; font-weight: 700; }   /* 4 Hour */
.severity-300 { color: #cb4b90; font-weight: 700; }   /* Hot (Same Day) */
.severity-400 { color: #7e458d; font-weight: 700; }   /* Next Day */
.severity-500 { color: #4378a8; font-weight: 700; }   /* Two Day */
.severity-600 { color: #333333; font-weight: 400; }   /* Routine / other */
/* Dark theme: brighten so the colours stay legible on the dark grid (600 #333 would vanish). */
[data-theme="dark"] .severity-100 { color: #ff6b61; }
[data-theme="dark"] .severity-200 { color: #f6a05a; }
[data-theme="dark"] .severity-300 { color: #e07bb4; }
[data-theme="dark"] .severity-400 { color: #b48fd0; }
[data-theme="dark"] .severity-500 { color: #7aa6d8; }
[data-theme="dark"] .severity-600 { color: #b9bbbe; }
/* Collapsible "N historical repairs" toggle in the repairs column. */
.lookup-histtoggle {
    display: flex; align-items: center; gap: 6px; width: 100%;
    margin-top: 6px; padding: 7px 10px; border: 1px dashed var(--border, #d4d9e0);
    border-radius: 8px; background: transparent; color: var(--text-muted);
    font-size: 13px; font-weight: 600; cursor: pointer; text-align: left;
}
.lookup-histtoggle:hover { background-color: var(--row-hover, rgba(0, 75, 141, 0.05)); color: var(--text); }
.lookup-historical { margin-top: 4px; }
/* Filter-within-results input. */
.lookup-filter { position: relative; display: flex; align-items: center; margin: 4px 0 10px; }
.lookup-filter .bi-funnel { position: absolute; left: 12px; color: var(--text-muted); font-size: 14px; pointer-events: none; }
.lookup-filter input { padding-left: 34px; padding-right: 34px; }
.lookup-filter-clear {
    position: absolute; right: 8px; border: none; background: transparent;
    color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 4px;
}
.lookup-filter-clear:hover { color: var(--text); }
.lookup-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lookup-matched { font-size: 12px; color: var(--text-muted); font-style: italic; }
.lookup-cust { font-size: 13px; color: var(--text); }
.lookup-status { font-size: 13px; color: var(--text); }
.lookup-chevron { color: var(--text-muted); font-size: 14px; justify-self: end; }

.lookup-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    font-size: 13px;
    color: var(--text-muted);
}
.lookup-spinner .search-spinner-circle { width: 20px; height: 20px; border-width: 2px; }
.lookup-stillsearching { color: var(--text-muted); font-size: 13px; }
.lookup-note {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 9px 12px;
    font-size: 12.5px;
    color: var(--text-muted);
    background-color: rgba(0, 75, 141, 0.05);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
}
.lookup-note i { color: var(--puffer-blue); margin-top: 1px; }
[data-theme="dark"] .lookup-note { background-color: rgba(111, 177, 255, 0.08); }
[data-theme="dark"] .lookup-note i { color: #6fb1ff; }

.home-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-strong);
    margin: 26px 0 12px;
}

/* ---------- Home: announcements ---------- */
.announcements { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.announce {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-soft);
    border-left-width: 3px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    background-color: var(--bg-elevated);
}
.announce .announce-text { flex: 1; }
.announce > i { margin-top: 1px; font-size: 15px; }
.announce-info    { border-left-color: var(--puffer-blue); }
.announce-info > i { color: var(--puffer-blue); }
.announce-warn    { border-left-color: var(--puffer-accent); }
.announce-warn > i { color: var(--puffer-accent); }
.announce-success { border-left-color: #2e9e5b; }
.announce-success > i { color: #2e9e5b; }
.announce-dismiss {
    background: none; border: none; cursor: pointer; padding: 0 2px;
    color: var(--text-muted); font-size: 12px; line-height: 1;
}
.announce-dismiss:hover { color: var(--text-strong); }

/* ---------- Home: work-queue tiles (toggle) ---------- */
.workqueue { margin: 4px 0 8px; }
.wq-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s;
}
.wq-toggle:hover { border-color: var(--puffer-blue); }
.wq-toggle .wq-caret { transition: transform 0.2s; font-size: 12px; color: var(--text-muted); }
.wq-toggle.open .wq-caret { transform: rotate(180deg); }
.wq-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-top: 12px;
}
.wq-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px;
    border: 1px solid var(--border-soft);
    border-left-width: 4px;
    border-radius: 10px;
    background: var(--bg-elevated);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}
.wq-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-elevated); text-decoration: none; }
.wq-tile .wq-count { font-size: 28px; font-weight: 700; color: var(--text-strong); line-height: 1.1; }
.wq-tile .wq-meta { font-size: 12.5px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.wq-warn    { border-left-color: var(--puffer-accent); }
.wq-info    { border-left-color: var(--puffer-blue); }
.wq-success { border-left-color: #2e9e5b; }

/* ---------- Home: recently viewed ---------- */
/* Column count follows the actual available width (viewport minus the sidebar), not fixed viewport
   breakpoints: auto-fill packs as many >=340px cards as fit, so the grid never over-collapses to one
   column while there is still room for two (the old max-width breakpoints ignored the sidebar width). */
.recent-list {
    display: grid;
    /* Responsive column count that fills the row AND caps at 4. Each track's minimum is the LARGER of
       340px or a quarter of the row (minus the 3 x 10px gaps): once four >=340px cards fit, the min becomes
       ~1/4 width so the four columns stretch to fill (no dead space on wide screens), and a 5th can never
       squeeze in because each column is already ~1/4 wide. Narrower than 4x340 it drops to 3, 2, 1 by space. */
    grid-template-columns: repeat(auto-fill, minmax(max(340px, (100% - 30px) / 4), 1fr));
    gap: 10px;
}
.recent-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: var(--bg-elevated);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.recent-item:hover { border-color: var(--puffer-blue); box-shadow: var(--shadow-card); text-decoration: none; }
.recent-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
/* Header row: id + a badge (repairs = live status in stoplight colours; assets = grey valve type). */
.recent-id-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.recent-id { font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-sub { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-chevron { color: var(--text-muted); font-size: 13px; }
/* Pill badge next to the recent-card header. Stoplight palette for repair status; grey for asset type. */
.recent-badge {
    display: inline-block; flex: none; padding: 1px 8px; border-radius: 10px;
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
}
.recent-badge-red   { background: rgba(237, 71, 71, 0.15);  color: #d83a3a; }
.recent-badge-amber { background: rgba(246, 176, 23, 0.18); color: #b5790a; }
.recent-badge-lime  { background: rgba(135, 218, 135, 0.25); color: #2f8f2f; }
.recent-badge-green { background: rgba(31, 180, 125, 0.16); color: #18996a; }
.recent-badge-gray  { background: rgba(147, 149, 152, 0.20); color: #5f6164; }
[data-theme="dark"] .recent-badge-red   { color: #ff7b72; }
[data-theme="dark"] .recent-badge-amber { color: #ffc04d; }
[data-theme="dark"] .recent-badge-lime  { color: #9fe09f; }
[data-theme="dark"] .recent-badge-green { color: #4fd0a0; }
[data-theme="dark"] .recent-badge-gray  { color: #b9bbbe; }

@media (max-width: 767.98px) {
    .lookup-row {
        grid-template-columns: 1fr auto;
        grid-auto-rows: auto;
        gap: 4px 10px;
    }
    .lookup-type { grid-row: 1; }
    .lookup-chevron { grid-row: 1; grid-column: 2; }
    .lookup-main { grid-column: 1 / -1; }
    .lookup-matched, .lookup-cust, .lookup-status { grid-column: 1 / -1; }
}

/* ===================================================================
   Page-level styles
   =================================================================== */
.page-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}
.page-header h2 { font-weight: 600; color: var(--text-strong); margin: 0; font-size: 24px; }

.page-header-actions { display: flex; gap: 8px; align-items: center; }
.page-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12.5px;
    text-decoration: none;
    margin-bottom: 6px;
}
.back-link:hover { color: var(--puffer-blue); text-decoration: none; }
[data-theme="dark"] .back-link:hover { color: #6fb1ff; }

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin: 0 0 12px;
}

/* Key-value list used on detail pages */
.kv-list {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 8px 14px;
    margin: 0;
    font-size: 13.5px;
}
.kv-list dt { color: var(--text-muted); font-weight: 500; }
/* min-width:0 lets the value column shrink; overflow-wrap breaks a long email/URL instead of forcing the
   card (and its parent grid) wider than the screen. */
.kv-list dd { margin: 0; color: var(--text); font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* Plain HTML data table used inside cards */
.data-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.data-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-soft);
}
.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text);
}
.data-table tr:last-child td { border-bottom: 0; }
.data-table a { color: var(--puffer-blue); font-weight: 500; }
[data-theme="dark"] .data-table a { color: #6fb1ff; }

.empty-state-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background-color: var(--bg);
    border: 1px dashed var(--border-soft);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13px;
}
.empty-state-inline i { font-size: 18px; color: var(--text-muted); }


/* Repair search uses a labeled 6-column grid */
.search-grid-6 {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px; /* gap between the fields and the SEARCH button row */
}
@media (max-width: 1199.98px) { .search-grid-6 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 767.98px)  { .search-grid-6 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 575.98px)  { .search-grid-6 { grid-template-columns: 1fr; } }
.search-grid-6 .form-control,
.search-grid-6 .form-select { width: 100%; }
.search-grid-6 .field-label {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.search-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; }

/* Shared "half-width" card — ~half the page, shrinks to fit on narrow screens.
   Reused by Cost Approval (bulk approval) and Image Capture so they stay consistent. */
.card-half { width: 100%; max-width: 600px; }

/* Compact search card — hugs its controls instead of spanning full width.
   Used on pages with only a few filter fields (e.g. Cost Approval). */
.search-card-compact { width: fit-content; max-width: 100%; }

/* Center the selection checkbox (header "select all" + body rows) in its narrow,
   borderless column so it isn't left-justified against the cell edge. */
/* Selection checkbox column: drop the wide default cell padding so the box can
   actually center in the narrow (46px) column, then center header + body. */
.cb-center.ag-header-cell,
.cb-center.ag-cell { padding-left: 0 !important; padding-right: 0 !important; }
/* Make the cell/header the centering container; the checkbox wrapper hugs its
   content (auto width) and gets centered, rather than left-justified. */
.cb-center.ag-cell {
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.cb-center.ag-cell .ag-cell-wrapper { width: auto; }
.cb-center .ag-selection-checkbox { margin: 0 !important; }
/* Header: AG's flex label-container pins the select-all to the left no matter how
   its flex is tweaked, so absolutely-center the checkbox within the header cell. */
.cb-center.ag-header-cell { position: relative; }
.cb-center .ag-header-select-all {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0 !important;
}

/* Bulk Approval form — space the stacked field rows so labels aren't squished. */
#bulkApprovalForm .form-group { margin-bottom: 14px; }

/* Keep a wide table contained within its card (scrolls instead of spilling past the
   rounded background) when the window is narrower than the table's columns. */
.search-card:has(> table.data-table) { overflow-x: auto; }

.sidebar-brand-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    flex: 1;
    overflow: hidden;
}
.sidebar-brand-link:hover { text-decoration: none; }

/* Make page-header a flex row so actions can sit on the right */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.bulk-count { color: var(--text-muted); font-size: 13px; }

.text-end { text-align: right; }


.role-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.role-employee { background-color: rgba(0, 75, 141, 0.15);  color: var(--puffer-blue); }
.role-admin    { background-color: rgba(240, 173, 78, 0.18); color: #c47100; }
.role-user     { background-color: rgba(108, 117, 125, 0.15); color: #495057; }
[data-theme="dark"] .role-employee { background-color: rgba(111, 177, 255, 0.18); color: #6fb1ff; }
[data-theme="dark"] .role-admin    { background-color: rgba(240, 173, 78, 0.22); color: #ffc983; }
[data-theme="dark"] .role-user     { background-color: rgba(154, 164, 178, 0.18); color: #cfd6e0; }

.chip {
    display: inline-block;
    background-color: var(--bg);
    border: 1px solid var(--border-soft);
    color: var(--text);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
}
.chip-lg { font-size: 13px; padding: 4px 12px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

/* Make Bootstrap form-switch theme-aware in dark mode */
[data-theme="dark"] .form-check-input { background-color: var(--input-bg); border-color: var(--input-border); }
[data-theme="dark"] .form-check-input:checked { background-color: var(--puffer-blue); border-color: var(--puffer-blue); }

/* =========================================================
   Service Contacts — card grid
   ========================================================= */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
}
.contact-card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 18px 18px 16px;
    box-shadow: var(--shadow-card);
}
.contact-card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.contact-avatar {
    width: 48px; height: 48px;
    border-radius: 50%;
    background-color: var(--puffer-blue);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    flex: 0 0 48px;
}
.contact-name { font-size: 15px; font-weight: 600; color: var(--text-strong); margin: 0; }
.contact-title { font-size: 12.5px; color: var(--text-muted); }
.contact-kv { grid-template-columns: 70px 1fr; font-size: 13px; margin-bottom: 14px; }
.contact-actions { display: flex; gap: 6px; }
.contact-actions .btn { flex: 1; }

/* =========================================================
   My Profile — hero + quick actions
   ========================================================= */
.profile-hero {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
}
.profile-avatar-large {
    width: 84px; height: 84px;
    border-radius: 50%;
    background-color: var(--puffer-blue);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 600;
    flex: 0 0 84px;
}
.profile-hero-body { flex: 1; min-width: 220px; }
.profile-name { font-size: 22px; font-weight: 600; color: var(--text-strong); margin: 0 0 6px; }
.profile-meta { display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; color: var(--text-muted); align-items: center; }
.profile-meta i { margin-right: 4px; opacity: 0.8; }
.profile-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.quick-actions { display: flex; flex-direction: column; gap: 6px; }
.quick-action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    border: 1px solid var(--border-soft);
    background-color: var(--bg);
    transition: background-color 0.12s, border-color 0.12s, transform 0.1s;
}
.quick-action:hover { background-color: var(--hover-bg); border-color: var(--puffer-blue); text-decoration: none; color: var(--text); }
.quick-action > i:first-child { color: var(--puffer-blue); font-size: 20px; width: 28px; text-align: center; }
.quick-action > div { flex: 1; }
.quick-action strong { display: block; font-size: 14px; color: var(--text-strong); }
.quick-action p { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.quick-action .chevron { color: var(--text-muted); font-size: 14px; }
.quick-action-danger > i:first-child { color: #c0392b; }
.quick-action-danger strong { color: #c0392b; }
[data-theme="dark"] .quick-action-danger > i:first-child { color: #ff9c95; }
[data-theme="dark"] .quick-action-danger strong { color: #ff9c95; }


.pref-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-soft);
}
.pref-row:last-child { border-bottom: 0; padding-bottom: 0; }
.pref-row:first-of-type { padding-top: 0; }
.pref-info { flex: 1; }
.pref-info strong { display: block; font-size: 14px; color: var(--text-strong); margin-bottom: 2px; }
.pref-info p { margin: 0; font-size: 12.5px; color: var(--text-muted); }
.pref-row .form-switch { padding-left: 0; }
.pref-row .form-check-input {
    width: 40px;
    height: 22px;
    margin: 0;
    cursor: pointer;
}


/* =========================================================
   Batch 4 — shared form patterns
   ========================================================= */
.form-narrow { max-width: 720px; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-grid .form-group-full { grid-column: 1 / -1; }
@media (max-width: 575.98px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .form-control,
.form-grid .form-select { width: 100%; height: 38px; }
.form-grid .field-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.field-hint { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.hint-success { color: #1e7e34; }
.hint-error   { color: #c0392b; }
[data-theme="dark"] .hint-success { color: #74d089; }
[data-theme="dark"] .hint-error   { color: #ff9c95; }
.req { color: #d9534f; font-weight: 600; }

/* Advised-cost Terms & Conditions acceptance: checkbox + text + link on one inline, wrapping row.
   The link is a sibling of the <label> (not inside it) so clicking it opens the page instead of
   toggling the checkbox. */
.ac-terms-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; font-size: 14px; }
.ac-terms-row label { display: inline-flex; align-items: baseline; gap: 6px; margin: 0; cursor: pointer; }
.ac-terms-row .form-check-input { position: static; margin: 0; flex: 0 0 auto; align-self: center; }

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-soft);
}


/* =========================================================
   Bulk Add — tabs + dropzone + preview
   ========================================================= */
.nav-tabs { border-bottom: 1px solid var(--border-soft); margin: 8px 0 14px; }
.nav-tabs .nav-link {
    color: var(--text-muted);
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-size: 13.5px;
    padding: 8px 14px;
    cursor: pointer;
}
.nav-tabs .nav-link.active {
    color: var(--puffer-blue);
    border-bottom-color: var(--puffer-blue);
    background: transparent;
}
[data-theme="dark"] .nav-tabs .nav-link.active { color: #6fb1ff; border-bottom-color: #6fb1ff; }

.bulk-tab textarea { font-family: 'Inter', monospace; font-size: 13px; }

.upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    border: 2px dashed var(--border-hard);
    border-radius: 10px;
    background-color: var(--bg);
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.12s, border-color 0.12s;
    text-align: center;
}
.upload-dropzone:hover { border-color: var(--puffer-blue); background-color: var(--hover-bg); }
.upload-dropzone i { font-size: 36px; color: var(--puffer-blue); margin-bottom: 8px; }
.upload-dropzone p { margin: 0 0 4px; font-size: 13px; }
.upload-input { display: none; }


/* =========================================================
   Change Password — strength meter + rules
   ========================================================= */
.password-input { position: relative; }
.password-input .form-control { padding-right: 36px; }
.password-toggle {
    position: absolute;
    top: 50%; right: 4px;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--text-muted);
    padding: 6px 10px;
    cursor: pointer;
}
.password-toggle:hover { color: var(--puffer-blue); }

.password-strength {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 4px;
}
.password-strength-bar {
    flex: 1;
    height: 6px;
    background-color: var(--border-soft);
    border-radius: 3px;
    overflow: hidden;
}
.password-strength-bar span {
    display: block;
    height: 100%;
    width: 0%;
    background-color: #d9534f;
    transition: width 0.3s, background-color 0.3s;
}
.password-strength-bar span[data-score="2"] { background-color: #f0ad4e; }
.password-strength-bar span[data-score="3"] { background-color: #5cb85c; }
.password-strength-bar span[data-score="4"] { background-color: #2a8a3a; }
.password-strength-label { font-size: 12px; color: var(--text-muted); }

.password-rules {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    font-size: 12px;
    color: var(--text-muted);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
}
.password-rules li::before { content: "○ "; }
.password-rules li.rule-met { color: #1e7e34; }
.password-rules li.rule-met::before { content: "✓ "; }
[data-theme="dark"] .password-rules li.rule-met { color: #74d089; }

/* =========================================================
   OTP digits (Add Phone)
   ========================================================= */
.otp-row {
    display: flex;
    gap: 10px;
    margin: 14px 0 4px;
}
.otp-digit {
    width: 50px;
    height: 56px;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-strong);
    border-radius: 8px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
}
.otp-digit:focus {
    outline: none;
    border-color: var(--puffer-blue);
    box-shadow: 0 0 0 3px rgba(0, 75, 141, 0.15);
}

/* Bootstrap alignment helpers used in a few new views */
.text-success { color: #1e7e34 !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-end     { text-align: right; }
.mb-3         { margin-bottom: 1rem; }
.mt-3         { margin-top: 1rem; }
.mt-4         { margin-top: 1.5rem; }

/* Search form */
.search-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-card);
}
/* ---------- Form fields: one unified height (38px) + text size (14px) everywhere ----------
   Inputs and selects across all pages share this size; textareas keep their natural height.
   Context rules below (search bars, form grids) reuse the same 38px so nothing looks off. */
.form-control:not(textarea),
.form-select { height: 38px; }
.form-control,
.form-select { font-size: 14px; }
.form-select:has(option[value=""]:checked) { color: #6c757d !important; }
.form-select option { color: #212529; }
.form-select option[value=""] { color: #6c757d; }

.search-criteria {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

/* Self-contained searchable dropdown (e.g. User Admin customer filter) */
.search-criteria .vt-combo { min-width: 360px; max-width: 520px; flex: 1 1 480px; }
.vt-combo { position: relative; }
/* Higher specificity than ".search-criteria .form-control { max-width: 240px }" so the input fills the
   wider combo instead of leaving empty space to its right. */
.search-criteria .vt-combo .form-control { width: 100%; max-width: none; min-width: 0; }
.vt-combo-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1080;
    margin: 2px 0 0;
    padding: 4px 0;
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    background: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 6px;
    box-shadow: var(--shadow-card);
}
.vt-combo-opt {
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.vt-combo-opt:hover { background: rgba(0, 75, 141, 0.10); }
.search-criteria .form-group { margin-bottom: 0; }
.search-criteria .form-control,
.search-criteria .form-select {
    font-size: 14px;
    height: 38px;
    padding: 4px 10px;
    min-width: 160px;
    max-width: 240px;
    border-radius: 6px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text);
}
.search-criteria .form-control:focus,
.search-criteria .form-select:focus {
    border-color: var(--puffer-blue);
    box-shadow: 0 0 0 3px rgba(0, 75, 141, 0.18);
}

/* ----- Dark-mode form field overrides (Bootstrap defaults need explicit overrides) ----- */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] textarea.form-control,
[data-theme="dark"] input.form-control {
    background-color: var(--input-bg) !important;
    color: var(--text-strong) !important;
    border-color: var(--input-border) !important;
}
[data-theme="dark"] .form-control::placeholder { color: var(--text-muted) !important; opacity: 1; }
/* Light chevron for the select dropdown arrow in dark mode */
[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='%23d8dee6' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") !important;
}
[data-theme="dark"] .form-select option { background-color: var(--bg-elevated); color: var(--text-strong); }

/* Bootstrap dropdown menu in dark mode (used by the layout switcher) */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-elevated);
    border-color: var(--border-soft);
    color: var(--text);
}
[data-theme="dark"] .dropdown-item { color: var(--text); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
    background-color: var(--hover-bg);
    color: var(--text-strong);
}
[data-theme="dark"] .dropdown-divider { border-top-color: var(--border-soft); }
.search-criteria-header {
    font-weight: 600;
    font-size: 12px;
    padding: 10px 0 6px;
    color: var(--text-muted);
    border-top: 1px dashed var(--border-soft);
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}


.btn-puffer {
    background-color: var(--puffer-blue);
    border-color: var(--puffer-blue);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.btn-puffer:hover { background-color: var(--puffer-blue-dark); border-color: var(--puffer-blue-dark); color: #fff; }

.btn-outline-secondary {
    color: var(--text);
    border-color: var(--border-hard);
}
.btn-outline-secondary:hover {
    background-color: var(--hover-bg);
    border-color: var(--border-hard);
    color: var(--text-strong);
}

/* Shared toolbar above every grid: "Total Records: X" flush-left at the grid's
   left edge, "Export to Excel" right beside it. Identical across Dashboard,
   Repair, Asset and Cost Approval (the gap controls all spacing). */
.results-meta { color: var(--text-muted); font-size: 13px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 12px 0 6px; }
.record-count { display: inline-block; margin: 0; }

/* No-rows overlay: friendly "press SEARCH" / "no results" prompt */
.grid-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 14px;
    text-align: center;
    padding: 24px;
}
.grid-empty-state i { font-size: 36px; color: var(--puffer-blue); opacity: 0.6; }
.grid-empty-state strong { color: var(--text); }
[data-theme="dark"] .grid-empty-state i { color: #6fb1ff; }

/* Page-jump control injected into AG Grid's bottom pagination strip
   (.ag-paging-panel is a flex row — Quartz floats native controls to the right). */
.ag-theme-quartz .ag-paging-panel { gap: 16px; }

.ag-page-jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: auto;        /* pushes native controls to the right */
    font-size: 12.5px;
    color: var(--text-muted);
}
.ag-page-jump-label {
    margin: 0;
    color: var(--text-muted);
    font-weight: 500;
}
.ag-page-jump-input {
    width: 62px;
    height: 28px;
    padding: 2px 6px;
    border: 1px solid var(--input-border);
    background-color: var(--input-bg);
    color: var(--text);
    border-radius: 4px;
    font-size: 12.5px;
    text-align: center;
}
.ag-page-jump-input:focus {
    border-color: var(--puffer-blue);
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 75, 141, 0.18);
}
.ag-page-jump-input:disabled { opacity: 0.55; cursor: not-allowed; }
.ag-page-jump-btn {
    height: 28px;
    padding: 0 12px;
    border: 1px solid var(--puffer-blue);
    background-color: var(--puffer-blue);
    color: white;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: background-color 0.12s;
}
.ag-page-jump-btn:hover:not(:disabled) {
    background-color: var(--puffer-blue-dark);
    border-color: var(--puffer-blue-dark);
}
.ag-page-jump-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.hidden { display: none !important; }
.required-description { font-size: 0.85em; color: var(--text-muted); }

/* ===================================================================
   Detail pages (Asset Detail, Repair Detail) — info panels + grids
   =================================================================== */
.detail-back { margin-bottom: 10px; font-size: 13px; }
.detail-back a { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); }
.detail-back a:hover { color: var(--puffer-blue); }
[data-theme="dark"] .detail-back a:hover { color: #6fb1ff; }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;   /* separate each block (matches the tracker→panel gap) */
}
/* Grid items default to min-width:auto and refuse to shrink below their content, so a long unbreakable
   value (email/URL) pushes the column past the viewport. Let them shrink. */
.detail-grid > * { min-width: 0; }
@media (max-width: 991.98px) { .detail-grid { grid-template-columns: 1fr; } }

/* Standalone panels (shipping, pre-test, advised cost, …) get the same gap.
   Panels nested inside a .detail-grid rely on the grid's gap instead. */
.detail-panel { margin-bottom: 18px; }
.detail-grid > .detail-panel { margin-bottom: 0; }

/* Repair Detail image galleries — at most 3 stations per row. */
.image-stations { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 991.98px) { .image-stations { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .image-stations { grid-template-columns: 1fr; } }
.detail-panel-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--puffer-blue);
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-soft);
}
[data-theme="dark"] .detail-panel-title { color: #6fb1ff; }
.detail-panel-title.mt-3 { margin-top: 18px; }

/* Definition list rendered as a two-column label/value grid */
.detail-dl {
    display: grid;
    grid-template-columns: minmax(140px, max-content) 1fr;
    gap: 6px 18px;
    margin: 0;
    font-size: 13px;
}
.detail-dl dt {
    color: var(--text-muted);
    font-weight: 600;
    overflow-wrap: anywhere;
}
.detail-dl dd {
    margin: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.detail-section-heading {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 22px 0 12px;
}

/* Section header row with a status badge (e.g. Images + current WIP station) */
/* Shared detail-page section header: heading on the left, inline actions next to it, and anything
   marked ms-auto (e.g. a status badge) pinned to the right. Items flow left-to-right (NOT
   space-between) so a right-pinned element stays put whether or not the inline actions are present. */
.detail-section-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
}
.detail-section-head .detail-section-heading { margin-bottom: 8px; }
.current-station-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--puffer-blue);
    background-color: rgba(0, 75, 141, 0.08);
    border: 1px solid rgba(0, 75, 141, 0.22);
    border-radius: 999px;
    padding: 4px 12px;
}
.current-station-badge strong { color: var(--text-strong); }
[data-theme="dark"] .current-station-badge { color: #6fb1ff; background-color: rgba(111,177,255,0.10); border-color: rgba(111,177,255,0.28); }
.current-station-badge.is-exception {
    color: #c0392b;
    background-color: rgba(217, 83, 79, 0.10);
    border-color: rgba(217, 83, 79, 0.30);
}
[data-theme="dark"] .current-station-badge.is-exception { color: #ff9c95; }

/* The image gallery card matching the current WIP station */
.detail-panel.is-current-station {
    border-color: var(--puffer-blue);
    box-shadow: 0 0 0 2px rgba(0, 75, 141, 0.18);
}
.current-pill {
    display: inline-block;
    margin-left: 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff;
    background-color: var(--puffer-blue);
    border-radius: 999px;
    padding: 1px 8px;
    vertical-align: middle;
}

/* AG Grids embedded on detail/list pages use auto-height, so no fixed height. */
.detail-grid-table { width: 100%; margin-bottom: 8px; }

/* Ship-date readout in the tracker header */
.tracker-shipdate { font-size: 18px; font-weight: 600; color: var(--text-strong); }

/* ----- Pre-test results ----- */
/* Two aligned columns for the detail panels. The shorter panels (Customer, Pre-test,
   Shipping, Advised Cost) stack down the left to balance the tall Repair Information
   card on the right — so panels line up and there's no dead space. */
.detail-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
    margin-bottom: 18px;
}
.detail-cols .detail-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.detail-cols .detail-panel { margin-bottom: 0; }   /* spacing comes from the column's flex gap */
@media (max-width: 991.98px) {
    .detail-cols { grid-template-columns: 1fr; }
    /* Stacked (single column): show the right column (Repair Information + Documents) first, above the
       left column (Customer Info + tracker), so the key info is what the user sees first when scrolling. */
    .detail-cols > .detail-col:nth-child(2) { order: -1; }
}

/* ----- Image lightbox (click a thumbnail to expand + comment) ----- */
.lightbox-stage {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    min-height: 240px;
    padding: 8px 52px;   /* room for the prev/next buttons */
}
.lightbox-img { display: flex; align-items: center; justify-content: center; max-width: 100%; }
.lightbox-img img { max-width: 100%; max-height: 60vh; object-fit: contain; border-radius: 6px; }
.lightbox-placeholder {
    width: 220px; height: 220px;
    display: flex; align-items: center; justify-content: center;
}
.lightbox-placeholder i { font-size: 64px; opacity: 0.45; color: var(--puffer-blue); }
[data-theme="dark"] .lightbox-placeholder i { color: #6fb1ff; }
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-soft);
    background: var(--bg-elevated);
    color: var(--text);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-card);
}
.lightbox-nav:hover { color: var(--puffer-blue); border-color: var(--puffer-blue); }
[data-theme="dark"] .lightbox-nav:hover { color: #6fb1ff; border-color: #6fb1ff; }
.lightbox-prev { left: 8px; }
.lightbox-next { right: 8px; }
/* Theme the Bootstrap image-lightbox modal with the app tokens so it follows light/dark. Without this the
   modal chrome (header + comments footer) stays Bootstrap's default WHITE, which glares in dark mode while
   the image stage sits dark. Scoped to #imageModal so other modals are untouched. */
#imageModal .modal-content { background-color: var(--bg-elevated); color: var(--text); border: 1px solid var(--border-hard); }
#imageModal .modal-header,
#imageModal .modal-footer { border-color: var(--border-soft); }
#imageModal .modal-title { color: var(--text-strong); }
/* Recolor the default (black) close glyph so it's visible on the dark surface. */
[data-theme="dark"] #imageModal .btn-close { filter: invert(1) grayscale(1) brightness(1.6); }

.lightbox-comments { margin-top: 14px; }
.lightbox-comments-foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.lightbox-comments-foot .approval-msg { margin: 0; }

/* Pre-test: compact test table + a short meta list below it. */
.pretest-table { width: auto; min-width: 320px; }
.pretest-table th, .pretest-table td { text-align: center; }
.pretest-table th:first-child, .pretest-table td:first-child { text-align: left; }
.pretest-meta { margin-top: 14px; }
.vv-pretest { border-collapse: collapse; font-size: 13px; min-width: 320px; }
.vv-pretest th, .vv-pretest td {
    border: 1px solid var(--border-soft);
    padding: 6px 14px;
    text-align: left;
}
.vv-pretest th {
    background-color: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}
.vv-pretest td:first-child { font-weight: 600; color: var(--text-muted); }

/* ----- Image galleries (placeholder thumbnails) ----- */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
}
/* Collapse a tall station to one row; JS shows the .gallery-toggle only when there's more than one
   row and caps max-height. scrollHeight still reports the full height, so it can measure when capped. */
.image-gallery.is-collapsed { overflow: hidden; }
.gallery-toggle {
    margin-top: 8px;
    background: none;
    border: none;
    padding: 2px 0;
    color: var(--puffer-blue);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}
.gallery-toggle:hover { text-decoration: underline; }
[data-theme="dark"] .gallery-toggle { color: #6fb1ff; }
.image-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    background-color: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 10px;
    text-align: center;
    padding: 6px;
    overflow: hidden;
    cursor: pointer;
}
.image-thumb i { font-size: 26px; opacity: 0.6; color: var(--puffer-blue); }
[data-theme="dark"] .image-thumb i { color: #6fb1ff; }
.image-thumb span { line-height: 1.2; overflow: hidden; }

/* Real photo fills the tile. */
.image-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}
.image-thumb img:hover { transform: scale(1.04); transition: transform 0.15s; }
/* Icon fallback shown by the img's onerror handler when a file is missing. */
.image-thumb .img-fallback {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* Cost Approval — bulk submit feedback message */
.approval-msg { margin-top: 10px; font-size: 13px; font-weight: 500; min-height: 18px; }
.approval-msg.approval-ok  { color: #1e7e34; }
.approval-msg.approval-err { color: #c0392b; }
[data-theme="dark"] .approval-msg.approval-ok  { color: #74d089; }
[data-theme="dark"] .approval-msg.approval-err { color: #ff9c95; }

/* ----- Search spinner (Asset Search loading state) ----- */
.search-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
}
.search-spinner-circle {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 3px solid var(--border-soft);
    border-top-color: var(--puffer-blue);
    animation: vt-spin 0.8s linear infinite;
}
@keyframes vt-spin { to { transform: rotate(360deg); } }

/* Loading state on the SEARCH button while a search is running */
.btn.is-loading { opacity: 0.75; cursor: progress; }

/* ----- Notifications (legacy flow) + shared checkbox lists ----- */
.form-narrow-wide { max-width: 640px; }
.notif-section-title {
    border-bottom: 1px solid var(--border-soft);
    padding-bottom: 6px;
    margin-bottom: 6px;
}
.notif-section-desc { font-size: 13px; margin: 0 0 12px; }
.notif-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    margin: 0;
    cursor: pointer;
    font-size: 14px;
}
.notif-check .form-check-input { margin: 0; flex: 0 0 auto; }
.notif-check .cell-input { max-width: 180px; }
.consent-notice {
    font-size: 11.5px;
    color: var(--text-muted);
    margin: 8px 0 0;
    max-width: 560px;
    line-height: 1.5;
}
/* Scrollable checklist (WIP stations, asset types, assigned applications) */
.checkbox-scroll {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--border-soft);
    border-radius: 8px;
    padding: 8px 12px;
    background-color: var(--bg);
}

/* ----- Notifications layout: full width + two-column rows (less scrolling) ----- */
.notif-form { max-width: 1100px; }
.notif-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}
.notif-2col > .search-card { margin-bottom: 0; }   /* the wrapper's gap handles spacing */
.notif-checks {
    display: grid;
    grid-template-columns: repeat(2, minmax(200px, 1fr));
    gap: 2px 18px;
}
@media (max-width: 767.98px) {
    .notif-2col { grid-template-columns: 1fr; }
    .notif-checks { grid-template-columns: 1fr; }
}

/* ----- Image Capture (legacy flow) ----- */
.capture-legacy .cap-field { margin-bottom: 14px; }
.cap-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cap-row .form-control,
.cap-row .form-select { max-width: 260px; }

/* Narrow screens (Zebra TC22 ~360px CSS width): keep the input + Scan button on ONE row. The input
   flex-shrinks to share the width instead of holding 260px and pushing the button to a second line. */
@media (max-width: 575.98px) {
    .cap-row { flex-wrap: nowrap; }
    .cap-row .form-control,
    .cap-row .form-select { flex: 1 1 auto; min-width: 0; max-width: none; }
    .cap-row .cap-scan { flex: 0 0 auto; }
}
.cap-status { font-size: 13px; font-weight: 500; }
.cap-status:empty { display: none; }   /* don't add a flex gap when there's no status text */
.cap-status.found    { color: #1e7e34; }
.cap-status.notfound { color: var(--text-muted); }
[data-theme="dark"] .cap-status.found { color: #74d089; }

/* Read-only resolved Asset ID field (looked up from the Job/CSD #), styled like a disabled input. */
.cap-asset-id {
    display: inline-block;
    min-width: 260px;
    padding: 6px 12px;
    font-size: 14px; font-weight: 600;
    border: 1px solid var(--border-soft); border-radius: 6px;
    background: var(--bg-subtle, #f3f4f6);
    color: var(--text-muted);
}
.cap-asset-id.found    { color: #1e7e34; }
.cap-asset-id.notfound { color: #b02a37; }
[data-theme="dark"] .cap-asset-id { background: rgba(255,255,255,.04); }
[data-theme="dark"] .cap-asset-id.found    { color: #74d089; }
[data-theme="dark"] .cap-asset-id.notfound { color: #f1949c; }
.cap-scan { white-space: nowrap; }

.cap-actions { display: flex; gap: 8px; margin-top: 6px; }

.cap-detail { display: flex; gap: 22px; flex-wrap: wrap; align-items: flex-start; }
.cap-detail-img {
    width: 200px; height: 200px;
    border: 1px solid var(--border-soft); border-radius: 8px;
    background-color: var(--bg);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.cap-detail-img img { width: 100%; height: 100%; object-fit: cover; }
.cap-detail-img i { font-size: 48px; color: var(--text-muted); }
.cap-detail-meta { flex: 1; min-width: 220px; max-width: 360px; }
.cap-detail-meta .form-control { max-width: 320px; }

/* Inline image-list rows: thumbnail + filename + comment, so a batch can be captioned without
   opening each image's detail view. Clicking the thumbnail still opens the large preview. */
#imageTable td { vertical-align: middle; }
.cap-thumb {
    width: 56px; height: 56px;
    border: 1px solid var(--border-soft); border-radius: 6px;
    background-color: var(--bg); background-size: cover; background-position: center;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.cap-thumb:hover { border-color: var(--puffer-blue); }
.cap-thumb i { color: var(--text-muted); font-size: 22px; }
.cap-row-name { font-size: 13px; word-break: break-all; margin-bottom: 4px; }
.cap-comment.form-control { max-width: 360px; }

/* Customer name beside a page title */
.header-customer {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-strong);
    white-space: nowrap;
}

/* "Export to Excel" hyperlink in the results-meta row (spacing handled by the row's gap) */
.export-link {
    margin-left: 0;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}
/* Only add separation when it follows a record count on the same line (Dashboard) */
.export-link i { margin-right: 0px; color: #1d6f42; }   /* Excel green */
[data-theme="dark"] .export-link i { color: #4caf78; }

/* Clear separation between the search card's button row and the results grid */
#repairGrid { margin-top: 0px; }
/* Asset Search "Advanced Search" toggle — breathing room from the fields grid above */
.advanced-toggle { margin: 14px 0 2px; }

/* Full-screen veil for blocking form submits (Repair / Cost Approval / User Admin) */
.vt-loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    background-color: rgba(15, 20, 28, 0.35);
    backdrop-filter: blur(1px);
    align-items: center;
    justify-content: center;
}
.vt-loading-overlay.show { display: flex; }
.vt-loading-box {
    display: flex;
    align-items: center;
    gap: 14px;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    padding: 20px 28px;
    box-shadow: var(--shadow-elevated);
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

/* ===================================================================
   Dashboard: view buttons + "Viewing:" label
   =================================================================== */
.dash-view-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.dash-viewing { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.dash-viewing strong { color: var(--puffer-blue); }
[data-theme="dark"] .dash-viewing strong { color: #6fb1ff; }

@media (max-width: 575.98px) {
    .dash-view-buttons { width: 100%; }
    .dash-view-buttons .btn { flex: 1 1 auto; }
}


/* ===================================================================
   AG Grid v32 Quartz theme overrides — Puffer-blue header + dark mode
   =================================================================== */
.ag-theme-quartz {
    --ag-font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --ag-font-size: 13px;
    --ag-background-color: var(--bg-elevated);
    --ag-foreground-color: var(--text);
    --ag-data-color: var(--text);
    --ag-secondary-foreground-color: var(--text-muted);
    --ag-odd-row-background-color: var(--bg);
    --ag-row-hover-color: var(--hover-bg);
    --ag-selected-row-background-color: rgba(0, 75, 141, 0.18);
    --ag-border-color: var(--border-soft);
    --ag-control-panel-background-color: var(--bg-elevated);
    --ag-subheader-background-color: var(--bg);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
}
/* NOTE: no `overflow: hidden` here. On an autoHeight grid that ALSO scrolls horizontally (e.g. Asset
   Search's ~12 columns), AG Grid under-measures its height by the horizontal scrollbar, so overflow:hidden
   clipped the bottom strip - the pagination pager. Instead of clipping, round the header top + pager bottom
   so the 10px corners still look right; the pager is never cut off. */
.ag-theme-quartz .ag-header { border-top-left-radius: 10px; border-top-right-radius: 10px; }
.ag-theme-quartz .ag-paging-panel { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; }
.ag-theme-quartz.grid-fit .ag-body-vertical-scroll { display: none; }

[data-theme="dark"] .ag-theme-quartz {
    --ag-background-color: #181f2a;
    --ag-foreground-color: #d8dee6;
    --ag-data-color: #d8dee6;
    --ag-secondary-foreground-color: #8e98a8;
    --ag-odd-row-background-color: #1e2632;
    --ag-row-hover-color: #2a313d;
    --ag-selected-row-background-color: rgba(111, 177, 255, 0.18);
    --ag-border-color: #2c3548;
    --ag-row-border-color: #232b39;
    --ag-control-panel-background-color: #181f2a;
    --ag-subheader-background-color: #1e2632;
    --ag-input-background-color: #1d2531;
    --ag-input-border-color: #2c3548;
    --ag-menu-background-color: #1e2632;
    --ag-tooltip-background-color: #1e2632;
    --ag-popup-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
    background-color: #181f2a;
}
/* Force the row and viewport backgrounds in dark — the theme variables alone don't reach
   every surface in the Quartz @layer cascade, so we double up with explicit selectors. */
[data-theme="dark"] .ag-theme-quartz .ag-root-wrapper,
[data-theme="dark"] .ag-theme-quartz .ag-root,
[data-theme="dark"] .ag-theme-quartz .ag-body,
[data-theme="dark"] .ag-theme-quartz .ag-body-viewport,
[data-theme="dark"] .ag-theme-quartz .ag-center-cols-viewport,
[data-theme="dark"] .ag-theme-quartz .ag-center-cols-container,
[data-theme="dark"] .ag-theme-quartz .ag-paging-panel {
    background-color: #181f2a !important;
    color: #d8dee6 !important;
}
[data-theme="dark"] .ag-theme-quartz .ag-row,
[data-theme="dark"] .ag-theme-quartz .ag-row-even { background-color: #181f2a !important; color: #d8dee6 !important; }
[data-theme="dark"] .ag-theme-quartz .ag-row-odd  { background-color: #1e2632 !important; color: #d8dee6 !important; }
[data-theme="dark"] .ag-theme-quartz .ag-row:hover { background-color: #2a313d !important; }
[data-theme="dark"] .ag-theme-quartz .ag-row-floating-filter,
[data-theme="dark"] .ag-theme-quartz .ag-header-row-floating-filter,
[data-theme="dark"] .ag-theme-quartz .ag-floating-filter {
    background-color: #1e2632 !important;
}
[data-theme="dark"] .ag-theme-quartz .ag-cell { color: #d8dee6 !important; }
[data-theme="dark"] .ag-theme-quartz .ag-row a { color: #6fb1ff !important; }
[data-theme="dark"] .ag-theme-quartz .ag-cell-focus { border-color: #6fb1ff !important; }
/* Filter popup menu in dark */
[data-theme="dark"] .ag-theme-quartz .ag-menu,
[data-theme="dark"] .ag-theme-quartz .ag-popup-child {
    background-color: #1e2632 !important;
    color: #d8dee6 !important;
    border-color: #2c3548 !important;
}
[data-theme="dark"] .ag-theme-quartz .ag-input-field-input {
    background-color: #1d2531 !important;
    color: #d8dee6 !important;
    border-color: #2c3548 !important;
}

.ag-theme-quartz .ag-header,
.ag-theme-quartz .ag-header-row,
.ag-theme-quartz .ag-header-cell,
.ag-theme-quartz .ag-header-group-cell {
    background-color: var(--puffer-blue) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.18) !important;
}

.ag-theme-quartz .ag-header-cell-text,
.ag-theme-quartz .ag-header-group-text {
    color: #ffffff !important;
    font-weight: 600;
}

.ag-theme-quartz .ag-header-icon,
.ag-theme-quartz .ag-header-cell-menu-button .ag-icon,
.ag-theme-quartz .ag-floating-filter-button-button,
.ag-theme-quartz .ag-sort-indicator-icon .ag-icon,
.ag-theme-quartz .ag-filter-icon .ag-icon {
    color: #ffffff !important;
    opacity: 0.92;
}

.ag-theme-quartz .ag-header-row-floating-filter,
.ag-theme-quartz .ag-floating-filter {
    background-color: var(--bg) !important;
}

/* Compact pagination footer. Quartz defaults the panel's min-height to --ag-row-height
   (~42px); override min-height + vertical padding to shrink just the footer. */
.ag-theme-quartz .ag-paging-panel {
    color: var(--text);
    border-top: 1px solid var(--border-soft);
    min-height: 42px;          /* trimmed from Quartz's default, but tall enough that the
                                  page-size <select> renders its value (0/auto collapsed it) */
    padding-top: 6px;
    padding-bottom: 6px;
}
.ag-theme-quartz .ag-row a { color: var(--puffer-blue); font-weight: 500; }
[data-theme="dark"] .ag-theme-quartz .ag-row a { color: #6fb1ff; }

#assetGrid { width: 100%; height: calc(100vh - 360px); min-height: 460px; }

/* ----- Combined header (title + sort + funnel filter icon in a single row) ----- */
/* Every grid uses the CombinedHeader (see wwwroot/js/vt-grid.js), which supplies
   its own padding — so we zero the header-cell padding across all grids. */
.ag-theme-quartz .ag-header-cell { padding: 0 !important; }
.combined-header {
    width: 100%;
    height: 100%;
    padding: 0 10px 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #ffffff;
    font-weight: 600;
    font-size: 12.5px;
    line-height: 1.5;   /* room for descenders — .ch-text clips with overflow:hidden */
    user-select: none;
    overflow: hidden;
}
.combined-header .ch-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.combined-header .ch-sort { color: #ffffff; font-size: 10px; opacity: 0.85; width: 10px; text-align: center; }
.combined-header .ch-menu {
    background: transparent;
    border: 0;
    color: #ffffff;
    opacity: 0.65;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    padding: 4px 4px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.combined-header .ch-menu:hover { opacity: 1; background-color: rgba(255, 255, 255, 0.12); }
.combined-header .ch-menu.active {
    opacity: 1;
    color: var(--puffer-accent);
    background-color: rgba(255, 255, 255, 0.10);
}
.combined-header .ch-menu i { display: block; }

/* ===== Click-to-toggle multi-select (vt-multiselect) ===== */
/* Replaces native <select multiple> so options toggle with a single click (no Ctrl). */
.vt-multiselect { position: relative; }
.vt-multiselect .vt-ms-toggle {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    cursor: pointer;
}
.vt-multiselect .vt-ms-toggle .vt-ms-label { color: #6c757d; }
.vt-multiselect.vt-ms-has-selection .vt-ms-toggle .vt-ms-label { color: var(--text, #212529); }
.vt-multiselect .vt-ms-menu {
    /* Size to the widest option so labels stay on ONE row (the Dashboard filter's parent is narrow, so a
       plain width:100% used to squeeze the menu and wrap "AUTOMATED VALVE" etc.). min-width:100% keeps it
       at least as wide as the toggle; the menu is absolutely positioned, so growing past the toggle is
       free. max-width caps a runaway long label (then it wraps). */
    width: max-content;
    min-width: 100%;
    max-width: 360px;
    max-height: 280px;
    overflow-y: auto;
}
.vt-multiselect .vt-ms-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    margin: 0;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
/* Keep each option's label on one line so the menu's max-content width reflects the full label. */
.vt-multiselect .vt-ms-option span { white-space: nowrap; }
.vt-multiselect .vt-ms-option:hover { background: var(--hover-bg, #f1f3f5); }
.vt-multiselect .vt-ms-option input { cursor: pointer; margin: 0; flex: 0 0 auto; }

/* Selected-item pills shown below the multiselect control */
.vt-ms-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.vt-ms-chips:empty { display: none; }
.vt-ms-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 4px 3px 10px;
    background: var(--puffer-blue);
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}
.vt-ms-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .25);
    color: #fff;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
}
.vt-ms-chip-x:hover { background: rgba(255, 255, 255, .45); }
/* "Clear all" pill - muted outline, distinct from the blue value pills */
.vt-ms-clear {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-hard);
    padding: 3px 11px;
    cursor: pointer;
}
.vt-ms-clear:hover { color: var(--puffer-blue); border-color: var(--puffer-blue); background: var(--hover-bg); }

/* Dedicated "active filters" strip inside a filter card, below the controls (pills render here instead
   of inline, so the toolbar controls stay aligned). flex:0 0 100% puts it on its own full-width row when
   it's a flex child (the dashboard filter bar); width:100% covers the block-child case (cost approval).
   Collapses to nothing when no filters are selected. */
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; flex: 0 0 100%; width: 100%; }
.active-filters:empty { display: none; }

/* =========================================================
   Help Center
   ========================================================= */
/* Trim the shared .content padding (24/40 top/bottom) on this page so the footer shows without
   so much scroll - ~46px tighter overall, weighted toward the bottom. */
.help-page { margin-top: -12px; margin-bottom: -34px; }

.help-hero {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    padding: 22px;
    margin-bottom: 22px;
}
.help-hero-intro { padding-right: 22px; }
.help-hero h3 { font-size: 16px; font-weight: 700; color: var(--text-strong); margin: 0 0 10px; }
.help-hero-lead { font-size: 13px; color: var(--text); margin: 0 0 6px; }
.help-hero-list { margin: 0; padding-left: 18px; color: var(--text-muted); font-size: 13px; line-height: 1.9; }

.help-feature {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 4px 18px;
    border-left: 1px solid var(--border-soft);
    color: var(--text);
}
.help-feature:hover { text-decoration: none; }
.help-feature:hover .help-feature-title { color: var(--puffer-blue-dark); }
.help-feature-icon {
    flex: 0 0 40px; width: 40px; height: 40px;
    border-radius: 8px;
    background-color: var(--hover-bg);
    color: var(--puffer-blue);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 20px;
}
.help-feature-title { font-size: 14.5px; font-weight: 600; color: var(--puffer-blue); margin-bottom: 4px; }
.help-feature-desc { font-size: 12.5px; color: var(--text-muted); margin: 0; line-height: 1.45; }

/* Video thumbnail with play overlay */
.help-thumb {
    position: relative;
    flex: 0 0 132px; width: 132px; aspect-ratio: 16 / 10;
    border-radius: 6px;
    overflow: hidden;
    background: linear-gradient(135deg, #1a2740, #324a6d);
    border: 1px solid var(--border-hard);
    display: inline-flex; align-items: center; justify-content: center;
}
.help-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.help-play {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 34px; height: 34px; border-radius: 50%;
    background-color: var(--puffer-blue);
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.help-feature-video .help-thumb { flex-basis: 120px; width: 120px; }

/* Two-column body: demos | guides */
.help-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 26px;
    align-items: start;
}
.help-section-title { font-size: 15px; font-weight: 700; color: var(--text-strong); margin: 4px 0 14px; }
.help-section-title-sm { margin-top: 26px; }

.help-video-list {
    display: flex; flex-direction: column;
    /* White box to match the How-To Guides / support card alongside it. */
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    padding: 4px 18px;
}
.help-video-card {
    display: flex; gap: 16px; align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text);
}
.help-video-card:last-child { border-bottom: 0; }
.help-video-card:hover { text-decoration: none; }
.help-video-card:hover .help-feature-title { color: var(--puffer-blue-dark); }
.help-video-text { min-width: 0; }

.help-guide-card {
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    box-shadow: var(--shadow-card);
    padding: 4px 18px;
}
.help-guide-row {
    display: flex; gap: 14px; align-items: flex-start;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text);
}
.help-guide-row:last-child { border-bottom: 0; }
.help-guide-row:hover { text-decoration: none; }
.help-guide-row:hover .help-guide-title { color: var(--puffer-blue-dark); }
.help-guide-icon {
    flex: 0 0 38px; width: 38px; height: 38px;
    border-radius: 8px;
    background-color: var(--hover-bg);
    color: var(--puffer-blue);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.help-guide-title { font-size: 14px; font-weight: 600; color: var(--puffer-blue); margin-bottom: 3px; }

.help-support-row {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
}
.help-support-row:last-child { border-bottom: 0; }
.help-support-label { font-weight: 600; color: var(--text-strong); }

/* Cards with no URL yet render disabled with a "Coming soon" badge. Position relative so the badge
   anchors to the card corner. */
.help-feature.is-disabled,
.help-video-card.is-disabled,
.help-guide-row.is-disabled { pointer-events: none; opacity: .7; position: relative; }

/* "Coming soon" badge shown on link-less help cards. */
.help-coming-soon {
    display: inline-block;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--hover-bg);
    border: 1px solid var(--border-soft);
    border-radius: 100px;
    padding: 2px 9px;
    margin-top: 6px;
    white-space: nowrap;
}
/* On the video/overview cards the badge floats top-right of the card instead of under the text. */
.help-feature-video .help-coming-soon,
.help-video-card .help-coming-soon {
    position: absolute; top: 10px; right: 12px; margin-top: 0;
}

/* Inline video player (lightbox) */
.help-modal {
    position: fixed; inset: 0; z-index: 1090;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.help-modal[hidden] { display: none; }
.help-modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); }
/* Grow with the screen, but never let the 16:9 box exceed the viewport height (the height term keeps
   it from spilling past the top/bottom on wide monitors). Caps at 1800px */
.help-modal-dialog { position: relative; width: min(92vw, 1800px, calc((100vh - 120px) * 16 / 9)); }
.help-modal-frame {
    position: relative; padding-top: 56.25%;   /* 16:9 */
    background: #000; border-radius: 8px; overflow: hidden;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
}
.help-modal-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.help-modal-close {
    position: absolute; top: -38px; right: -2px;
    background: none; border: 0; color: #fff;
    font-size: 30px; line-height: 1; cursor: pointer; padding: 0;
}
.help-modal-close:hover { color: #cfe0f2; }
body.help-modal-open { overflow: hidden; }

@media (max-width: 900px) {
    .help-hero { grid-template-columns: 1fr; }
    .help-hero-intro {
        padding-right: 0; padding-bottom: 16px; margin-bottom: 12px;
        border-bottom: 1px solid var(--border-soft);
    }
    .help-feature { border-left: 0; padding: 12px 0; }
    .help-columns { grid-template-columns: 1fr; }
}

