:root {
    --theme-page-background: var(--app-page-background, #F3F4F6);
    --theme-page-foreground: var(--app-page-foreground, #111827);
    --theme-navigation-background: var(--app-navigation, #FFFFFF);
    --theme-navigation-foreground: var(--app-navigation-foreground, #111827);
    --theme-navigation-hover: var(--app-navigation-hover, #F3F4F6);
    --theme-surface: #FFFFFF;
    --theme-surface-raised: #FFFFFF;
    --theme-surface-muted: #F9FAFB;
    --theme-surface-subtle: #F3F4F6;
    --theme-text-strong: #111827;
    --theme-text: #374151;
    --theme-text-muted: #6B7280;
    --theme-text-faint: #9CA3AF;
    --theme-border: #D1D5DB;
    --theme-border-soft: #E5E7EB;
    --theme-border-faint: #F3F4F6;
    --theme-shadow: rgba(15, 23, 42, 0.08);
    --theme-overlay: rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --theme-page-background: #0B0F14;
    --theme-page-foreground: #E5E7EB;
    --theme-navigation-background: #0F151E;
    --theme-navigation-foreground: #E5E7EB;
    --theme-navigation-hover: #1A2432;
    --theme-surface: #111827;
    --theme-surface-raised: #151E2B;
    --theme-surface-muted: #0F1722;
    --theme-surface-subtle: #1A2432;
    --theme-text-strong: #F3F4F6;
    --theme-text: #D1D5DB;
    --theme-text-muted: #9CA3AF;
    --theme-text-faint: #6B7280;
    --theme-border: #3A4657;
    --theme-border-soft: #2A3545;
    --theme-border-faint: #202B39;
    --theme-shadow: rgba(0, 0, 0, 0.34);
    --theme-overlay: rgba(0, 0, 0, 0.7);
}

body {
    background: var(--theme-page-background);
    color: var(--theme-page-foreground);
    transition: background-color 0.18s ease, color 0.18s ease;
}
.app-navigation {
    background: var(--theme-navigation-background);
    color: var(--theme-navigation-foreground);
    border-color: var(--theme-border-soft) !important;
}
.app-navigation .app-brand,
.app-navigation .nav-link,
.app-navigation .app-account-link,
.app-navigation .fa-bars,
.app-navigation .fa-user-circle {
    color: var(--theme-navigation-foreground);
}
.app-navigation .nav-link:hover,
.app-navigation .app-brand:hover {
    background: var(--theme-navigation-hover);
}

[data-theme-selector] {
    min-height: 44px;
}
.bg-blue-600 { background-color: var(--app-primary, #2563EB) !important; }
.bg-blue-600.text-white { color: var(--app-primary-foreground, #FFFFFF) !important; }
.hover\:bg-blue-700:hover { background-color: var(--app-primary-hover, #1D4ED8) !important; }
.text-blue-600 { color: var(--app-primary, #2563EB) !important; }
.border-blue-600, .border-t-blue-600 { border-color: var(--app-primary, #2563EB) !important; }

.theme-selector {
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 9px;
    border: 1px solid var(--theme-border-soft);
    border-radius: 8px;
    background: color-mix(in srgb, var(--theme-surface) 88%, transparent);
    color: var(--theme-text);
    cursor: pointer;
}
.theme-selector:focus-within {
    border-color: var(--app-primary, #2563EB);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-primary, #2563EB) 18%, transparent);
}
.theme-selector-icon {
    color: var(--theme-text-muted);
    font-size: 0.8rem;
}
.theme-selector select {
    min-height: 38px;
    padding: 0 20px 0 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
}
.theme-selector select option {
    background: var(--theme-surface);
    color: var(--theme-text-strong);
}

/* Login */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 72px 24px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 50% 45%, rgba(37, 99, 235, 0.08), transparent 34rem),
        #080B0F;
}
.login-theme-control {
    position: fixed;
    top: 18px;
    right: 20px;
    z-index: 10;
}
.login-theme-control .theme-selector {
    background: rgba(17, 24, 39, 0.88);
    border-color: #2A3545;
    color: #E5E7EB;
    backdrop-filter: blur(10px);
}
.login-theme-control .theme-selector-icon { color: #9CA3AF; }
.login-theme-control .theme-selector select option {
    background: #111827;
    color: #E5E7EB;
}
.login-shell {
    width: min(920px, 100%);
    min-height: 540px;
    display: grid;
    grid-template-columns: minmax(0, 42%) minmax(0, 58%);
    overflow: hidden;
    border: 1px solid #202A37;
    border-radius: 16px;
    background: var(--theme-surface);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.42);
}
.login-information {
    position: relative;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 42px 30px;
    overflow: hidden;
    color: #E5E7EB;
    background-color: #111821;
    background-image: radial-gradient(rgba(96, 165, 250, 0.16) 1px, transparent 1px);
    background-size: 22px 22px;
}
.login-information::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(145deg, transparent 25%, rgba(8, 11, 15, 0.58));
}
.login-information > * {
    position: relative;
    z-index: 1;
}
.login-brand {
    min-height: 68px;
    display: flex;
    align-items: center;
    margin-bottom: 26px;
}
.login-brand img {
    max-width: 230px;
    max-height: 68px;
    object-fit: contain;
}
.login-fallback-logo {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--app-primary, #60A5FA);
    font-size: 1.8rem;
}
.login-information h1 {
    max-width: 320px;
    margin: 0;
    color: #F9FAFB;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.25;
}
.login-information-intro {
    max-width: 320px;
    margin: 8px 0 0;
    color: #8FA0B5;
    font-size: 0.78rem;
    line-height: 1.6;
}
.login-feature-list {
    display: grid;
    gap: 14px;
    margin: 32px 0 0;
    padding: 0;
    list-style: none;
    color: #A9B7C8;
    font-size: 0.8rem;
}
.login-feature-list li {
    display: flex;
    align-items: center;
    gap: 10px;
}
.login-feature-list i {
    color: color-mix(in srgb, var(--app-primary, #60A5FA) 75%, #FFFFFF);
    font-size: 0.72rem;
}
.login-authorized-note {
    margin: 0;
    color: #526174;
    font-size: 0.68rem;
}
.login-form-panel {
    min-width: 0;
    display: flex;
    align-items: center;
    background: var(--theme-surface);
}
.login-form-content {
    width: min(100%, 390px);
    margin: 0 auto;
    padding: 44px 36px;
}
.login-form-heading {
    margin-bottom: 26px;
}
.login-form-heading h2 {
    margin: 0;
    color: var(--theme-text-strong);
    font-size: 1.45rem;
    font-weight: 750;
    letter-spacing: -0.015em;
}
.login-form-heading p {
    margin: 6px 0 0;
    color: var(--theme-text-muted);
    font-size: 0.8rem;
}
.login-messages { margin-bottom: 18px; }
.login-alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 12px;
    border: 1px solid #F5D38A;
    border-radius: 6px;
    background: #FEF3C7;
    color: #92400E;
    font-size: 0.78rem;
}
html[data-theme="dark"] .login-alert {
    border-color: #704D18;
    background: #34240F;
    color: #FCD58A;
}
.login-form .form-group { margin-bottom: 16px; }
.login-input-wrap {
    position: relative;
}
.login-input-wrap > i {
    position: absolute;
    left: 12px;
    top: 50%;
    z-index: 1;
    transform: translateY(-50%);
    color: var(--theme-text-faint);
    font-size: 0.78rem;
    pointer-events: none;
}
.login-input {
    min-height: 44px;
    padding-left: 37px !important;
}
.login-password-input { padding-right: 44px !important; }
.login-password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--theme-text-faint);
    cursor: pointer;
}
.login-password-toggle:hover {
    background: var(--theme-surface-subtle);
    color: var(--theme-text);
}
.login-password-toggle:focus-visible {
    outline: 2px solid var(--app-primary, #2563EB);
    outline-offset: 1px;
}
.login-remember {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--theme-text);
    font-size: 0.78rem;
    cursor: pointer;
}
.login-remember input {
    width: 17px;
    height: 17px;
    accent-color: var(--app-primary, #2563EB);
}
.login-submit {
    width: 100%;
    min-height: 44px !important;
    margin-top: 10px;
    box-shadow: 0 6px 14px color-mix(in srgb, var(--app-primary, #2563EB) 24%, transparent);
}

/* HTMX Progress Bar */
#htmx-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--app-primary, #2563EB), var(--app-primary-focus, #60A5FA));
    z-index: 9999;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px color-mix(in srgb, var(--app-primary, #2563EB) 45%, transparent);
}

/* ── Django Form Widget Classes (set via widget attrs in forms.py) ── */
.form-input, .form-select, .form-textarea {
    display: block;
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--theme-border);
    border-radius: 6px;
    font-size: 0.8125rem;
    background: var(--theme-surface);
    color: var(--theme-text-strong);
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}
.login-title-compact { display: none; }
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--app-primary, #2563EB);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-primary, #2563EB) 18%, transparent);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--theme-text-faint); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-group { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--theme-text);
    margin-bottom: 5px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-error { color: #DC2626; font-size: 0.75rem; margin-top: 4px; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--theme-border-soft);
}
.color-input { min-height: 42px; padding: 4px; cursor: pointer; }
.part-combobox { position: relative; }
.part-options {
    position: absolute;
    z-index: 70;
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    margin-top: 4px;
    background: var(--theme-surface-raised);
    border: 1px solid var(--theme-border);
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15,23,42,0.16);
}
.part-option {
    display: flex;
    width: 100%;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border: 0;
    border-bottom: 1px solid var(--theme-border-faint);
    background: var(--theme-surface-raised);
    color: var(--theme-text-strong);
    text-align: left;
    cursor: pointer;
}
.part-option:last-child { border-bottom: 0; }
.part-option:hover, .part-option-active {
    background: color-mix(in srgb, var(--app-primary, #2563EB) 12%, var(--theme-surface));
}
.part-option span { display: block; }
.part-option strong { font-size: 0.78rem; }
.part-option span span { color: var(--theme-text); font-size: 0.75rem; margin-top: 2px; }
.part-option small { color: var(--theme-text-muted); font-size: 0.7rem; text-align: right; }
.part-options-empty { padding: 14px; color: var(--theme-text-muted); font-size: 0.75rem; text-align: center; }

/* ── Modal ── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--theme-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
    animation: fadeIn 0.15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideDown { from { transform: translateY(-6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-6px); } }

.modal-content {
    background: var(--theme-surface-raised);
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.12), 0 4px 10px rgba(0,0,0,0.06);
    animation: slideUp 0.2s ease;
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid var(--theme-border-soft);
}
.modal-title { font-size: 1rem; font-weight: 600; color: var(--theme-text-strong); }
.modal-close {
    background: none; border: none;
    font-size: 1.375rem; color: #9CA3AF; cursor: pointer;
    line-height: 1; padding: 2px 6px; border-radius: 4px;
    transition: all 0.15s;
}
.modal-close:hover { color: var(--theme-text-strong); background: var(--theme-surface-subtle); }
.modal-body { padding: 20px 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 24px;
    border-top: 1px solid var(--theme-border-soft);
    background: var(--theme-surface-muted);
    border-radius: 0 0 12px 12px;
}

/* ── Alert fade-out animation ── */
.alert-dismiss-btn { background: none; border: none; cursor: pointer; opacity: 0.5; font-size: 1.125rem; line-height: 1; padding: 0 4px; transition: opacity 0.15s; }
.alert-dismiss-btn:hover { opacity: 1; }
.alert.fade-out { animation: fadeOut 0.25s ease forwards; }

/* ── Low stock row ── */
tr.low-stock-row td { background: #FFF7F7 !important; }
tr.low-stock-row:hover td { background: #FEE2E2 !important; }

/* ── Mobile card view (data-label pattern) ── */
@media (max-width: 640px) {
    .mobile-card-view thead { display: none; }
    .mobile-card-view tr {
        display: block;
        border: 1px solid var(--theme-border-soft);
        border-radius: 8px;
        margin-bottom: 10px;
        background: var(--theme-surface);
        padding: 12px;
    }
    .mobile-card-view td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
        border-bottom: 1px solid var(--theme-border-faint);
        font-size: 0.8125rem;
    }
    .mobile-card-view td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--theme-text-muted);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        flex-shrink: 0;
        margin-right: 8px;
    }
    .mobile-card-view td:last-child { border-bottom: none; }
    .form-row { grid-template-columns: 1fr; }
}

/* ── Chat ── */
.chat-container { display: flex; flex-direction: column; height: 100vh; background: var(--theme-surface-muted); }
.chat-messages { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.chat-welcome { text-align: center; padding: 48px 20px; color: var(--theme-text-muted); }
.chat-welcome h2 { font-size: 1.125rem; color: var(--theme-text); margin-bottom: 8px; font-weight: 600; }
.chat-prompts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chat-prompt { padding: 7px 14px; background: var(--theme-surface); border: 1px solid var(--theme-border-soft); border-radius: 20px; font-size: 0.8125rem; color: var(--theme-text-muted); cursor: pointer; transition: all 0.15s; }
.chat-prompt:hover { background: color-mix(in srgb, var(--app-primary, #2563EB) 10%, var(--theme-surface)); border-color: var(--app-primary, #2563EB); color: var(--app-primary, #2563EB); }
.chat-input { flex: 1; border: 1px solid var(--theme-border); border-radius: 8px; padding: 8px 12px; font-size: 0.875rem; outline: none; transition: border-color 0.15s; background: var(--theme-surface); color: var(--theme-text-strong); }
.chat-input:focus { border-color: var(--app-primary, #2563EB); box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-primary, #2563EB) 15%, transparent); }
.chat-send-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--app-primary, #2563EB); color: var(--app-primary-foreground, #fff); border: none; border-radius: 8px; font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: background 0.15s; flex-shrink: 0; }
.chat-send-btn:hover { background: var(--app-primary-hover, #1D4ED8); }
.message-bubble { max-width: 680px; padding: 10px 14px; border-radius: 12px; font-size: 0.875rem; line-height: 1.5; white-space: pre-wrap; }
.message-user { background: var(--app-primary, #2563EB); color: var(--app-primary-foreground, #fff); align-self: flex-end; border-bottom-right-radius: 4px; }
.message-assistant { background: var(--theme-surface); color: var(--theme-text-strong); align-self: flex-start; border-bottom-left-radius: 4px; border: 1px solid var(--theme-border-soft); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }

/* ── Utilities used in Django templates ── */
.text-muted  { color: var(--theme-text-muted); }
.text-danger { color: #DC2626; }
.text-success { color: #16A34A; }
.text-center { text-align: center; }
small { font-size: 0.75rem; color: var(--theme-text-muted); display: block; margin-top: 3px; }

/* ── Shared responsive application shell ── */
.nav-item { display: flex; align-items: stretch; }
.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 14px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--theme-text-muted);
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s;
}
.nav-link:hover { color: var(--theme-navigation-foreground); }
.nav-link-active { color: var(--app-primary, #2563EB); border-bottom-color: var(--app-primary, #2563EB); }
.mobile-menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 20px;
    color: var(--theme-text);
    font-size: 0.875rem;
    font-weight: 500;
}
.mobile-menu-link i { width: 18px; color: var(--theme-text-muted); }
.mobile-menu-link:hover { background: var(--theme-surface-muted); color: var(--app-primary, #2563EB); }

.technician-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    height: calc(68px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    background: color-mix(in srgb, var(--theme-surface) 96%, transparent);
    border-top: 1px solid var(--theme-border-soft);
    box-shadow: 0 -6px 20px rgba(15,23,42,0.08);
}
.technician-bottom-nav a {
    min-height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--theme-text-muted);
    font-size: 0.68rem;
    font-weight: 600;
}
.technician-bottom-nav a i { font-size: 1rem; }
.technician-bottom-nav a.active { color: var(--app-primary, #2563EB); }
.technician-bottom-nav a:nth-child(2) i {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--app-primary, #2563EB);
    color: var(--app-primary-foreground, white);
    font-size: 1.25rem;
    margin-top: -16px;
    box-shadow: 0 5px 12px color-mix(in srgb, var(--app-primary, #2563EB) 30%, transparent);
}

.btn-primary, .btn-secondary {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
}
.btn-primary { color: var(--app-primary-foreground, #fff); background: var(--app-primary, #2563EB); border: 1px solid var(--app-primary, #2563EB); }
.btn-primary:hover { background: var(--app-primary-hover, #1D4ED8); }
.btn-secondary { color: var(--theme-text); background: var(--theme-surface); border: 1px solid var(--theme-border); }
.btn-secondary:hover { background: var(--theme-surface-muted); }

.report-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}
.report-heading h1 { font-size: 1.5rem; font-weight: 700; color: var(--theme-text-strong); }
.report-eyebrow { color: var(--app-primary, #2563EB); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.report-stat {
    background: var(--theme-surface);
    border: 1px solid var(--theme-border-soft);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.report-stat strong { display: block; color: var(--theme-text-strong); font-size: 1.3rem; line-height: 1.2; }
.report-stat span { display: block; color: var(--theme-text-muted); font-size: 0.72rem; margin-top: 4px; }
.report-link-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border-soft);
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
    transition: transform 0.15s, box-shadow 0.15s;
}
.report-link-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,23,42,0.08); }
.report-link-card i { font-size: 1.1rem; margin-top: 2px; }
.report-link-card h2 { color: var(--theme-text-strong); font-size: 0.9rem; font-weight: 650; }
.report-link-card p { color: var(--theme-text-muted); font-size: 0.75rem; margin-top: 3px; }
.report-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    align-items: end;
    padding: 14px;
    margin-bottom: 16px;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border-soft);
    border-radius: 12px;
}
.report-table-wrap {
    overflow-x: auto;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border-soft);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}

.work-card {
    display: block;
    background: var(--theme-surface);
    border: 1px solid var(--theme-border-soft);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 2px rgba(15,23,42,0.04);
}
.work-card:hover { border-color: #BFDBFE; box-shadow: 0 5px 16px rgba(15,23,42,0.07); }
.timeline-item { position: relative; padding-left: 30px; padding-bottom: 20px; }
.timeline-item::before {
    content: "";
    position: absolute;
    left: 8px;
    top: 18px;
    bottom: -4px;
    width: 1px;
    background: var(--theme-border-soft);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
    position: absolute;
    left: 0;
    top: 2px;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: #DBEAFE;
    border: 4px solid #EFF6FF;
}

@media (max-width: 767px) {
    .technician-input, .form-input, .form-select, .form-textarea { font-size: 16px; min-height: 44px; }
    .form-textarea { min-height: 96px; }
    .form-actions {
        position: sticky;
        bottom: 68px;
        z-index: 20;
        margin-left: -16px;
        margin-right: -16px;
        margin-bottom: -16px;
        padding: 12px 16px;
        background: color-mix(in srgb, var(--theme-surface) 96%, transparent);
        box-shadow: 0 -4px 12px rgba(15,23,42,0.06);
    }
    .form-actions > * { min-height: 44px; flex: 1; }
    .report-heading { flex-direction: column; }
    .report-heading > div:last-child { width: 100%; }
    .report-heading .btn-primary, .report-heading .btn-secondary { flex: 1; }
    .report-stat { padding: 12px; }
    .report-stat strong { font-size: 1.05rem; }
    .chat-messages { padding: 16px 12px; }
    .message-bubble { max-width: 88%; }
}

/* Dark-mode mappings for existing server-rendered utility classes */
html[data-theme="dark"] .bg-white { background-color: var(--theme-surface) !important; }
html[data-theme="dark"] .bg-gray-50 { background-color: var(--theme-surface-muted) !important; }
html[data-theme="dark"] .bg-gray-100 { background-color: var(--theme-surface-subtle) !important; }
html[data-theme="dark"] .hover\:bg-gray-50:hover,
html[data-theme="dark"] .hover\:bg-gray-100:hover { background-color: var(--theme-surface-subtle) !important; }

html[data-theme="dark"] .text-gray-900,
html[data-theme="dark"] .text-gray-800 { color: var(--theme-text-strong) !important; }
html[data-theme="dark"] .text-gray-700,
html[data-theme="dark"] .text-gray-600 { color: var(--theme-text) !important; }
html[data-theme="dark"] .text-gray-500,
html[data-theme="dark"] .text-gray-400 { color: var(--theme-text-muted) !important; }
html[data-theme="dark"] .text-gray-300 { color: var(--theme-text-faint) !important; }

html[data-theme="dark"] .border-gray-100,
html[data-theme="dark"] .border-gray-200 { border-color: var(--theme-border-soft) !important; }
html[data-theme="dark"] .border-gray-300 { border-color: var(--theme-border) !important; }
html[data-theme="dark"] .divide-gray-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--theme-border-soft) !important;
}

html[data-theme="dark"] .bg-blue-50 { background-color: #12233B !important; }
html[data-theme="dark"] .bg-blue-100 { background-color: #173259 !important; }
html[data-theme="dark"] .text-blue-700,
html[data-theme="dark"] .text-blue-800,
html[data-theme="dark"] .text-blue-900 { color: #93C5FD !important; }
html[data-theme="dark"] .border-blue-100 { border-color: #244A78 !important; }

html[data-theme="dark"] .bg-green-50 { background-color: #10271B !important; }
html[data-theme="dark"] .text-green-600,
html[data-theme="dark"] .text-green-700,
html[data-theme="dark"] .text-green-800 { color: #86EFAC !important; }
html[data-theme="dark"] .border-green-50 { border-color: #205C38 !important; }

html[data-theme="dark"] .bg-amber-50 { background-color: #32220E !important; }
html[data-theme="dark"] .bg-amber-200 { background-color: #8B5B18 !important; }
html[data-theme="dark"] .text-amber-600,
html[data-theme="dark"] .text-amber-700,
html[data-theme="dark"] .text-amber-800,
html[data-theme="dark"] .text-amber-900 { color: #FCD58A !important; }
html[data-theme="dark"] .border-amber-50,
html[data-theme="dark"] .border-amber-100 { border-color: #704D18 !important; }

html[data-theme="dark"] .bg-red-50 { background-color: #311517 !important; }
html[data-theme="dark"] .text-red-600,
html[data-theme="dark"] .text-red-700,
html[data-theme="dark"] .text-red-800 { color: #FCA5A5 !important; }
html[data-theme="dark"] .border-red-50,
html[data-theme="dark"] .border-red-200 { border-color: #763238 !important; }

html[data-theme="dark"] .bg-purple-50 { background-color: #251638 !important; }
html[data-theme="dark"] .bg-purple-200 { background-color: #67419A !important; }
html[data-theme="dark"] .text-purple-600,
html[data-theme="dark"] .text-purple-700,
html[data-theme="dark"] .text-purple-900 { color: #D8B4FE !important; }
html[data-theme="dark"] .border-purple-50,
html[data-theme="dark"] .border-purple-100 { border-color: #5B3583 !important; }

html[data-theme="dark"] .bg-sky-50 { background-color: #112838 !important; }
html[data-theme="dark"] .text-sky-600,
html[data-theme="dark"] .text-sky-700,
html[data-theme="dark"] .text-sky-800 { color: #7DD3FC !important; }
html[data-theme="dark"] .border-sky-50 { border-color: #24536C !important; }

html[data-theme="dark"] table th {
    background: var(--theme-surface-muted);
    color: var(--theme-text-muted);
    border-color: var(--theme-border-soft);
}
html[data-theme="dark"] table td {
    color: var(--theme-text);
    border-color: var(--theme-border-faint);
}
html[data-theme="dark"] tbody tr:hover td {
    background: var(--theme-surface-subtle);
}
html[data-theme="dark"] tr.low-stock-row td { background: #251719 !important; }
html[data-theme="dark"] tr.low-stock-row:hover td { background: #342023 !important; }
html[data-theme="dark"] .timeline-dot {
    background: #244A78;
    border-color: #12233B;
}
html[data-theme="dark"] ::selection {
    background: color-mix(in srgb, var(--app-primary, #2563EB) 50%, transparent);
    color: #FFFFFF;
}

@media (max-width: 767px) {
    .theme-selector {
        min-height: 44px;
        padding-left: 10px;
        padding-right: 10px;
    }
    .theme-selector select { min-height: 44px; }
    .login-page {
        align-items: flex-start;
        padding: 72px 12px 24px;
    }
    .login-theme-control {
        top: 12px;
        right: 12px;
    }
    .login-shell {
        min-height: 0;
        grid-template-columns: 1fr;
        border-radius: 14px;
    }
    .login-information {
        min-height: 144px;
        padding: 24px;
        justify-content: center;
    }
    .login-information > div {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        column-gap: 16px;
        align-items: center;
    }
    .login-brand {
        grid-row: 1 / span 2;
        min-height: 0;
        margin: 0;
    }
    .login-brand img {
        max-width: 116px;
        max-height: 48px;
    }
    .login-fallback-logo {
        width: 50px;
        height: 50px;
        border-radius: 11px;
        font-size: 1.3rem;
    }
    .login-information h1 {
        font-size: 1.05rem;
    }
    .login-information-intro {
        margin-top: 4px;
        font-size: 0.72rem;
        line-height: 1.45;
    }
    .login-feature-list,
    .login-authorized-note {
        display: none;
    }
    .login-form-content {
        width: 100%;
        padding: 30px 24px 34px;
    }
}

@media (max-width: 390px) {
    .login-information {
        min-height: 124px;
        padding: 20px;
    }
    .login-information-intro { display: none; }
    .login-information h1 { align-self: center; }
    .login-form-content { padding: 26px 20px 30px; }
}

/* Fixed light login presentation based on the approved reference */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    background: #0C0D10;
    color: #1F2937;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-size: 13px;
    line-height: 1.5;
}
.login-page,
.login-page * {
    box-sizing: border-box;
}
.login-shell {
    width: 860px;
    max-width: 100%;
    height: 540px;
    min-height: 540px;
    display: flex;
    grid-template-columns: none;
    overflow: hidden;
    border: 0;
    border-radius: 16px;
    background: transparent;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.login-information {
    position: relative;
    width: 360px;
    height: 540px;
    min-height: 540px;
    flex: 0 0 360px;
    padding: 44px 40px 32px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: #111214;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.055) 1px, transparent 1px);
    background-size: 22px 22px;
    color: #E8EAEE;
}
.login-information::after {
    content: "";
    position: absolute;
    top: -150px;
    right: -185px;
    width: 450px;
    height: 340px;
    inset: -150px -185px auto auto;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, rgba(75, 123, 190, 0.22) 0%, transparent 70%);
}
.login-information > div {
    position: relative;
    z-index: 1;
}
.login-brand {
    width: 280px;
    height: 66px;
    min-height: 66px;
    margin: 0 0 24px;
    display: flex;
    align-items: center;
}
.login-brand img {
    max-width: 280px;
    max-height: 66px;
    object-fit: contain;
}
.login-fallback-logo {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #4B7BBE;
    font-size: 1.7rem;
}
.login-information h1 {
    width: 280px;
    max-width: none;
    margin: 0 0 6px;
    color: #E8EAEE;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.5;
}
.login-information-intro {
    width: 280px;
    max-width: none;
    margin: 0 0 36px;
    color: #5A6070;
    font-size: 12px;
    line-height: 1.4;
}
.login-feature-list {
    width: 280px;
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 0;
    color: #7A8090;
    font-size: 12px;
    line-height: 1.3;
}
.login-feature-list li {
    min-height: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.login-feature-list i {
    width: 14px;
    color: #4B7BBE;
    font-size: 11px;
    text-align: center;
}
.login-authorized-note {
    position: relative;
    z-index: 1;
    width: 280px;
    margin: 32px 0 0;
    color: #333840;
    font-size: 10px;
    line-height: 1.5;
}
.login-form-panel {
    width: 500px;
    height: 540px;
    min-width: 0;
    flex: 0 0 500px;
    display: flex;
    align-items: center;
    padding: 48px 44px;
    background: #FFFFFF;
    color: #1F2937;
}
.login-form-content {
    width: 320px;
    max-width: 320px;
    margin: 0 auto;
    padding: 0;
}
.login-form-heading {
    margin: 0 0 28px;
}
.login-form-heading h2 {
    margin: 0 0 5px;
    color: #111214;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.5;
    letter-spacing: 0;
}
.login-form-heading p {
    margin: 0;
    color: #7A8494;
    font-size: 13px;
    line-height: 1.5;
}
.login-messages {
    margin: 0 0 16px;
}
.login-alert {
    min-height: 36px;
    display: flex;
    align-items: center;
    padding: 8px 14px;
    border: 1px solid #FFEEBA;
    border-radius: 4px;
    background: #FFF3CD;
    color: #856404;
    font-size: 12px;
    line-height: 1.5;
}
.login-form .form-group {
    margin: 0 0 18px;
}
.login-page .form-label {
    margin: 0 0 7px;
    color: #374151;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}
.login-input-wrap {
    position: relative;
    width: 320px;
    height: 38px;
}
.login-input-wrap > i {
    position: absolute;
    left: 12px;
    top: 50%;
    z-index: 1;
    width: 15px;
    transform: translateY(-50%);
    color: #9CA3AF;
    font-size: 13px;
    text-align: center;
    pointer-events: none;
}
.login-page .login-input {
    width: 320px;
    height: 38px;
    min-height: 38px;
    padding: 10px 12px 10px 36px !important;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: #F9FAFB;
    color: #111214;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-size: 13px;
    line-height: normal;
}
.login-page .login-input:focus {
    border-color: #4B7BBE;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(75, 123, 190, 0.12);
}
.login-page .login-input::placeholder {
    color: #C1C8D4;
}
.login-page .login-input:-webkit-autofill {
    -webkit-text-fill-color: #111214;
    box-shadow: 0 0 0 1000px #F9FAFB inset;
    transition: background-color 9999s ease-out;
}
.login-page .login-input:-webkit-autofill:focus {
    box-shadow: 0 0 0 1000px #FFFFFF inset, 0 0 0 3px rgba(75, 123, 190, 0.12);
}
.login-page .login-password-input {
    padding-right: 40px !important;
}
.login-password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 23px;
    height: 23px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #9CA3AF;
    font-size: 13px;
    cursor: pointer;
}
.login-password-toggle:hover {
    background: #F3F4F6;
    color: #6B7280;
}
.login-password-toggle:focus-visible {
    outline: 2px solid #4B7BBE;
    outline-offset: 1px;
}
.login-remember {
    position: relative;
    width: 320px;
    min-height: 19px;
    height: 19px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 22px;
    color: #5A6370;
    font-size: 12.5px;
    line-height: 1.5;
    cursor: pointer;
}
.login-remember input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    opacity: 0;
}
.login-check-box {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    background: #F9FAFB;
    color: #FFFFFF;
    font-size: 9px;
}
.login-check-box i { opacity: 0; }
.login-remember input:checked + .login-check-box {
    border-color: #4B7BBE;
    background: #4B7BBE;
}
.login-remember input:checked + .login-check-box i { opacity: 1; }
.login-remember input:focus-visible + .login-check-box {
    border-color: #4B7BBE;
    box-shadow: 0 0 0 3px rgba(75, 123, 190, 0.12);
}
.login-submit,
.login-page .btn-primary {
    width: 320px;
    height: 38px;
    min-height: 38px !important;
    margin: 0;
    padding: 11px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #4B7BBE 0%, #3A6090 100%);
    color: #FFFFFF;
    font-family: Inter, system-ui, -apple-system, sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    line-height: normal;
    box-shadow: 0 2px 12px rgba(75, 123, 190, 0.35);
}
.login-submit:hover,
.login-page .btn-primary:hover {
    background: linear-gradient(135deg, #5487C8 0%, #416DA3 100%);
}

@media (max-width: 767px) {
    .login-page {
        align-items: center;
        padding: 24px 12px;
    }
    .login-shell {
        width: 100%;
        height: auto;
        min-height: 0;
        flex-direction: column;
    }
    .login-information {
        width: 100%;
        height: 285px;
        min-height: 285px;
        flex: 0 0 285px;
        padding: 32px 28px 24px;
    }
    .login-information > div {
        display: block;
    }
    .login-brand {
        width: 100%;
        height: 66px;
        min-height: 66px;
        margin-bottom: 24px;
    }
    .login-brand img {
        max-width: 100%;
        max-height: 66px;
    }
    .login-fallback-logo {
        width: 64px;
        height: 64px;
        border-radius: 12px;
        font-size: 1.7rem;
    }
    .login-information h1,
    .login-information-intro,
    .login-authorized-note {
        width: 100%;
    }
    .login-information h1 {
        font-size: 22px;
        line-height: 1.5;
    }
    .login-title-full { display: none; }
    .login-title-compact { display: inline; }
    .login-information-intro {
        display: block;
        margin: 0 0 36px;
        font-size: 12px;
        line-height: 1.4;
    }
    .login-feature-list {
        display: none;
    }
    .login-authorized-note {
        display: block;
        margin-top: 32px;
    }
    .login-form-panel {
        width: 100%;
        height: auto;
        min-height: 0;
        flex: 0 0 auto;
        padding: 32px 28px;
    }
    .login-form-content,
    .login-input-wrap,
    .login-page .login-input,
    .login-remember,
    .login-submit,
    .login-page .btn-primary {
        width: 100%;
        max-width: none;
    }
    .login-form-content {
        margin: 0;
        padding: 0;
    }
    .login-page .login-input {
        height: 38px;
        min-height: 38px;
        font-size: 13px;
    }
}
