/* ============================================================
   ZENQOR TECHNOLOGIES - custom.css (CLEAN STYLESHEET v2.2)
   ============================================================ */

body { 
    font-family: 'Inter', sans-serif; 
    background: #f8fafc;
    text-rendering: optimizeLegibility;
}

[v-cloak] { 
    display: none !important; 
}

/* Login splash: logo-led 3D welcome effect */
.login-splash {
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 38%, rgba(45, 212, 191, 0.24), transparent 22rem),
        radial-gradient(circle at 12% 88%, rgba(231, 111, 81, 0.17), transparent 24rem),
        linear-gradient(135deg, #111827, #18212f 58%, #0f3f3a);
}

.splash-logo-stage {
    position: relative;
    z-index: 2;
    perspective: 1000px;
}

.splash-logo-card {
    display: flex;
    width: min(19rem, 74vw);
    aspect-ratio: 16 / 9;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 1.1rem;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 28px 54px rgba(0, 0, 0, 0.36), 0 0 46px rgba(45, 212, 191, 0.22);
    transform-style: preserve-3d;
    animation: splash-logo-float 3.8s ease-in-out infinite;
}

.splash-logo-card::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(118deg, rgba(255, 255, 255, 0.54), transparent 35%, transparent 68%, rgba(15, 118, 110, 0.16));
}

.splash-logo-image {
    width: 82%;
    height: 82%;
    object-fit: contain;
    transform: translateZ(28px);
}

.splash-orbit {
    position: absolute;
    left: 50%;
    top: 7.5rem;
    z-index: 1;
    width: 23rem;
    height: 23rem;
    border: 1px solid rgba(94, 234, 212, 0.26);
    border-radius: 50%;
    transform: translateX(-50%) rotateX(68deg);
    /* The splash is only a loading overlay. Keeping this ornament static avoids
       reporting its transient transform as a layout shift during session restore. */
    animation: none;
}

.splash-orbit-two {
    width: 17rem;
    height: 17rem;
    border-color: rgba(251, 191, 36, 0.2);
    animation-direction: reverse;
    animation-duration: 6s;
}

.splash-progress {
    width: 11rem;
    height: 0.22rem;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.splash-progress span {
    display: block;
    width: 46%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #14b8a6, #5eead4, #fbbf24);
    animation: splash-progress 1.2s ease-in-out infinite;
}

@keyframes splash-logo-float {
    0%, 100% { transform: rotateX(5deg) rotateY(-7deg) translateY(0); }
    50% { transform: rotateX(-4deg) rotateY(8deg) translateY(-12px); }
}

@keyframes splash-orbit-spin {
    to { transform: translateX(-50%) rotateX(68deg) rotateZ(360deg); }
}

@keyframes splash-progress {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(290%); }
}

@media (prefers-reduced-motion: reduce) {
    .splash-logo-card,
    .splash-orbit,
    .splash-progress span { animation: none; }
}

/* Lencana Tab & Menu Aktif Sidebar */
.sidebar-item-active {
    background-color: #0F766E;
    color: #FFFFFF;
    font-weight: 700;
    box-shadow: none;
    border-left: 4px solid #E76F51;
    pointer-events: auto;
}

/* Client Portal — distinct accent so client sessions read visually apart from internal staff sessions */
.client-portal-theme {
    border-right-color: #1D4ED8;
}
.client-portal-theme .sidebar-item-active {
    background-color: #1D4ED8;
    border-left-color: #93C5FD;
}

/* ============================================================
   PORTAL UI POLISH — consistent, calm and accessible surfaces
   ============================================================ */
@media screen {
    #app {
        min-height: 100vh;
    }

    #app main {
        background-image: radial-gradient(circle at 100% 0, rgba(15, 118, 110, 0.1), transparent 28rem), linear-gradient(180deg, #f8fafc 0, #f1f5f9 100%);
    }

    .dark #app main {
        background-image: radial-gradient(circle at 100% 0, rgba(45, 212, 191, 0.08), transparent 28rem), linear-gradient(180deg, #0f172a 0, #0b1220 100%);
    }

    #app input,
    #app select,
    #app textarea {
        transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
    }

    #app input:hover,
    #app select:hover,
    #app textarea:hover {
        border-color: #94a3b8;
    }

    #app input:focus-visible,
    #app select:focus-visible,
    #app textarea:focus-visible,
    #app button:focus-visible,
    #app a:focus-visible {
        outline: 3px solid rgba(15, 118, 110, 0.28);
        outline-offset: 2px;
    }

    #app button {
        transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease, color 160ms ease;
    }

    #app button:not(:disabled):active {
        transform: translateY(1px);
    }

    #app .rounded-2xl {
        border-radius: 0.7rem;
    }

    #app .rounded-xl {
        border-radius: 0.45rem;
    }

    #app .rounded-lg {
        border-radius: 0.3rem;
    }

    #app .bg-white.rounded-2xl,
    #app .dark\:bg-slate-800.rounded-2xl {
        box-shadow: 0 6px 22px rgba(15, 23, 42, 0.06);
    }

    #app .bg-white.rounded-2xl {
        border-color: #d7e0e8;
    }

    .dark #app .dark\:bg-slate-800.rounded-2xl {
        border-color: #334155;
        box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
    }

    #app table thead {
        position: sticky;
        top: 0;
        z-index: 10;
    }

    #app table tbody tr {
        transition: background-color 150ms ease;
    }

    #app table thead tr {
        background: #e2e8f0;
        color: #334155;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        font-size: 0.68rem;
    }

    .dark #app table thead tr {
        background: #1e293b;
        color: #cbd5e1;
    }

    #app table tbody tr:hover {
        background: #f0fdfa !important;
    }

    .dark #app table tbody tr:hover {
        background: #1e293b !important;
    }

    #app label {
        color: #475569;
        letter-spacing: 0.025em;
    }

    .dark #app label {
        color: #cbd5e1;
    }

    #app .fixed.inset-0 > .bg-white,
    #app .fixed.inset-0 > .dark\:bg-slate-800 {
        box-shadow: 0 24px 64px rgba(15, 23, 42, 0.25);
    }

    .sidebar-item-active {
        background-image: linear-gradient(90deg, #0f766e, #14b8a6);
    }

    .sidebar-item-active i {
        color: #fbbf24;
    }

    @media (max-width: 767px) {
        #app main {
            background-image: none;
        }

        #app header {
            padding-top: 0.7rem;
            padding-bottom: 0.7rem;
        }

        #app .overflow-x-auto {
            -webkit-overflow-scrolling: touch;
        }

        #app table th,
        #app table td {
            white-space: nowrap;
        }

        #app .fixed.inset-0 {
            padding: 0.75rem;
        }
    }
}

/* Modern corporate portal visual language */
@media screen {
    #app aside {
        background: linear-gradient(180deg, #18212f 0%, #111827 100%) !important;
        border-right-color: rgba(20, 184, 166, 0.35) !important;
    }

    #app aside > div:first-child {
        border-bottom-color: rgba(255, 255, 255, 0.14) !important;
        position: relative;
    }

    #app aside > div:first-child::before {
        content: '';
        position: absolute;
        left: 1rem;
        right: 1rem;
        bottom: -1px;
        height: 2px;
        background: linear-gradient(90deg, #0f766e, #2dd4bf);
    }

    #app header {
        border-bottom: 3px solid #0f766e !important;
        box-shadow: 0 1px 6px rgba(15, 23, 42, 0.08);
    }

    #app .bg-brand-dark {
        background-color: #18212f;
    }

    #app .hover\:bg-brand-blue:hover {
        background-color: #0f766e;
    }

    #app .bg-brand-gold {
        background-color: #e76f51;
    }

    #app .text-brand-gold {
        color: #c2412d;
    }

    #app .border-brand-gold {
        border-color: #e76f51;
    }


    #app input,
    #app select,
    #app textarea {
        border-color: #cbd5e1;
        background-color: #ffffff;
    }

    #app input:focus,
    #app select:focus,
    #app textarea:focus {
        border-color: #0f766e;
        box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
    }

    .dark #app input,
    .dark #app select,
    .dark #app textarea {
        background-color: #253247;
    }
}

/* Penyesuaian Bar Skrol (Scrollbar styling) */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: #0D172A;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #D4AF37;
}

/* ============================================================
   PENETAPAN MOD CETAKAN & EKSPORT PDF (A4 PRINT / HTML2PDF)
   ============================================================ */
@media print {
    body { 
        background-color: white !important; 
        color: black !important;
        margin: 0 !important; 
        padding: 0 !important; 
        -webkit-print-color-adjust: exact !important; 
        print-color-adjust: exact !important; 
    }
    .no-print { 
        display: none !important; 
    }
    .print-only { 
        display: block !important; 
    }
    
    .print-container {
        position: absolute; 
        left: 0; 
        top: 0; 
        width: 100%;
        background: white; 
        padding: 0; 
        margin: 0;
        box-shadow: none !important;
    }

    .print-table th { 
        background-color: #0B1E36 !important; 
        color: white !important; 
        -webkit-print-color-adjust: exact !important; 
        print-color-adjust: exact !important; 
    }
    .print-header-border { 
        border-bottom: 2px solid #D4AF37 !important; 
    }
    .print-total-box { 
        background-color: #0B1E36 !important; 
        color: white !important; 
        -webkit-print-color-adjust: exact !important; 
        print-color-adjust: exact !important; 
    }
    .print-logo-container {
        background: #000000 !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

.print-only { 
    display: none; 
}

/* Logo Syarikat pada Dokumen & Cetakan */
.print-logo-container {
    width: 46mm;
    height: 18mm;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000000;
    border-radius: 4px;
}

.print-logo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Approved claim PDF: compact one-page layout */
.claim-print-logo {
    width: 42mm;
    height: 16mm;
    object-fit: contain;
    object-position: center;
    flex: 0 0 auto;
}

@media print {
    .claim-print {
        width: 190mm !important;
        padding: 8mm 10mm !important;
        box-sizing: border-box;
        font-size: 10px !important;
    }
    .claim-print .mb-6 { margin-bottom: 4mm !important; }
    .claim-print .mb-5 { margin-bottom: 3mm !important; }
    .claim-print .pb-5 { padding-bottom: 3mm !important; }
    .claim-print .p-4 { padding: 3mm !important; }
    .claim-print .gap-5 { gap: 3mm !important; }
    .claim-print h1 { font-size: 17px !important; }
    .claim-print h3 { font-size: 10px !important; }
    .claim-print .text-lg { font-size: 14px !important; }
    .claim-print img.max-h-56 {
        max-height: 38mm !important;
        max-width: 100% !important;
        object-fit: contain;
    }
}

/* ============================================================
   GAYA KANVAS PAYSLIP (A4 LANDSCAPE 297mm x 210mm)
   ============================================================ */
.payslip-paper {
    background: white; 
    color: black; 
    width: 297mm; 
    min-height: 205mm; 
    padding: 10mm 14mm; 
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    font-size: 11px; 
    box-sizing: border-box; 
    display: flex; 
    flex-direction: column;
    margin: 0 auto; 
    overflow: hidden; 
    page-break-inside: avoid;
}
.payslip-header {
    display: flex; 
    justify-content: space-between; 
    align-items: flex-start;
    border-bottom: 2px solid #0B1E36; 
    padding-bottom: 8px; 
    margin-bottom: 10px; 
    width: 100%;
}
.company-brand { 
    display: flex; 
    gap: 12px; 
    align-items: flex-start; 
    width: 62%; 
}
.company-brand img { 
    width: 38mm; 
    height: 16mm; 
    object-fit: cover; 
    object-position: center; 
    overflow: hidden; 
    background: #000000; 
    border-radius: 4px; 
}
.company-brand-text h1 { 
    font-size: 18px; 
    margin-bottom: 2px; 
    text-transform: uppercase; 
    color: #0B1E36; 
    font-weight: 800; 
}
.company-brand-text p { 
    font-size: 10px; 
    color: #334155; 
    margin-bottom: 1px; 
    white-space: pre-wrap; 
    line-height: 1.35; 
    font-weight: 500; 
}
.payslip-title { 
    width: 36%; 
    text-align: right; 
    display: flex; 
    flex-direction: column; 
}
.payslip-title h2 { 
    font-size: 22px; 
    margin-bottom: 4px; 
    color: #D4AF37; 
    letter-spacing: 2px; 
    font-weight: 800; 
}
.payslip-title p { 
    font-size: 11px; 
    margin-bottom: 2px; 
    color: #1E293B; 
    font-weight: 600; 
}

/* Jadual Maklumat Pekerja */
.info-table-container { 
    width: 100%; 
    margin-bottom: 12px; 
}
.info-table { 
    width: 100%; 
    border-collapse: collapse; 
    table-layout: fixed; 
}
.info-table th, .info-table td { 
    padding: 6px 8px; 
    border: 1px solid #CBD5E1; 
    text-align: left; 
    font-size: 11px; 
    vertical-align: middle; 
}
.info-table th { 
    background-color: #F1F5F9 !important; 
    width: 15%; 
    font-weight: 700; 
    color: #0B1E36; 
}
.info-table td { 
    width: 18%; 
    color: #1E293B; 
    font-weight: 600; 
}

/* Seksyen Pecahan Gaji & Potongan */
.salary-breakdown { 
    display: flex; 
    flex-direction: row !important; 
    gap: 16px; 
    margin-bottom: 10px; 
    width: 100%; 
}
.salary-col { 
    flex: 1; 
    width: calc(50% - 8px); 
    display: flex; 
    flex-direction: column; 
}
.calc-table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-bottom: 8px; 
    table-layout: fixed; 
}
.calc-table th, .calc-table td { 
    border: 1px solid #CBD5E1; 
    padding: 6px 8px; 
    color: #1E293B; 
    font-size: 11px; 
    vertical-align: middle; 
}
.calc-table thead th { 
    background: #0B1E36 !important; 
    color: white !important; 
    text-align: left; 
    font-weight: 700; 
}
.calc-table tfoot th, .calc-table tfoot td { 
    background: #E2E8F0 !important; 
    font-weight: 800; 
    color: #0B1E36; 
}
.calc-table td.amount, .calc-table th.amount { 
    text-align: right; 
    font-family: 'Courier New', monospace; 
    font-size: 12px; 
    font-weight: 700; 
    width: 35%; 
}

/* Kotak Gaji Bersih (Net Pay Section) */
.net-pay-section { 
    border: 2px solid #0B1E36; 
    padding: 8px 12px; 
    background: #F8FAFC !important; 
    margin-top: auto; 
    border-radius: 4px; 
}
.net-pay-table { 
    width: 100%; 
    font-size: 12px; 
}
.net-pay-table .final-net td { 
    font-size: 15px; 
    font-weight: 800; 
    color: #0B1E36; 
}
.net-pay-table .amount { 
    text-align: right; 
    font-family: 'Courier New', monospace; 
    color: #1E3A8A; 
    font-weight: 800; 
}

/* Seksyen Sumbangan Statutory (EPF / SOCSO / EIS) */
.contributions-section { 
    width: 100%; 
    margin-bottom: 8px; 
}
.contrib-grid { 
    display: flex; 
    flex-direction: row !important; 
    gap: 16px; 
    width: 100%; 
}
.contrib-col { 
    flex: 1; 
    width: calc(50% - 8px); 
}
.contrib-col h3 { 
    font-size: 11px; 
    margin-bottom: 4px; 
    color: #0B1E36; 
    border-bottom: 2px solid #0B1E36; 
    padding-bottom: 2px; 
    font-weight: 800; 
    text-transform: uppercase; 
}
.contrib-table { 
    width: 100%; 
    border-collapse: collapse; 
    table-layout: fixed; 
}
.contrib-table th, .contrib-table td { 
    border: 1px solid #CBD5E1; 
    padding: 5px 8px; 
    color: #1E293B; 
    font-size: 10px; 
    vertical-align: middle; 
}
.contrib-table th { 
    background: #F1F5F9 !important; 
    text-align: left; 
    font-weight: 700; 
    color: #0B1E36; 
}
.contrib-table td:first-child { 
    width: 44%; 
    font-weight: 600; 
}
.contrib-table td.amount, .contrib-table th.amount { 
    text-align: right; 
    font-family: 'Courier New', monospace; 
    width: 28%; 
    font-weight: 700; 
}

/* Kaki Halaman Elektronik */
.electronic-footer { 
    margin-top: auto; 
    text-align: center; 
    font-size: 10px; 
    color: #64748B; 
    font-style: italic; 
    border-top: 1px dashed #CBD5E1; 
    padding-top: 6px; 
    width: 100%; 
}

/* Format rasmi borang: input maklumat dipaparkan dalam huruf besar. */
input[type="text"],
input[type="search"],
textarea,
select {
    text-transform: uppercase;
}

input[type="email"],
input[type="password"],
input[type="url"] {
    text-transform: none;
}

/* Project Activities: structured responsive workflow and summary layout. */
.project-summary-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
}

.project-summary-card {
    min-width: 0;
    border-top: 3px solid #0F766E;
}

.project-board-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
    gap: 14px;
    width: 100%;
}

/* Board card meta is now a compact 2x2 grid by default; full metadata is available in View Details. */

@media (max-width: 1450px) {
    .project-board-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1024px) {
    .project-summary-grid,
    .project-board-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .project-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-summary-card:last-child {
        grid-column: 1 / -1;
    }

    .project-board-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ============================================================
   ZENQOR DESIGN SYSTEM (ZQ) — v1
   ============================================================
   Foundation layer for the enterprise UI modernization. Additive only:
   nothing existing references these classes yet, so shipping this adds
   zero visual/behavioral risk. Modules are migrated to it incrementally.

   Tokens live as CSS custom properties so light/dark and any future
   palette tweak is a one-place edit instead of hunting `dark:` variants
   across index.html. Brand colors match the existing Tailwind
   `brand.*` config in index.html — not reinvented, just made reusable
   outside Tailwind's utility-class context (this project loads Tailwind
   via the browser CDN build, so `@apply` isn't available here; these
   are hand-written CSS rules instead).
   ============================================================ */

:root {
    /* Brand + surface */
    --zq-primary: #18212F;         /* brand-dark */
    --zq-primary-hover: #0f151e;
    --zq-accent: #0F766E;          /* brand-blue */
    --zq-accent-hover: #0c5b55;
    --zq-gold: #E76F51;            /* brand-gold */
    --zq-surface: #ffffff;
    --zq-surface-alt: #f8fafc;     /* slate-50 */
    --zq-surface-elevated: #ffffff;
    --zq-border: #e2e8f0;          /* slate-200 */
    --zq-text: #1e293b;            /* slate-800 */
    --zq-text-muted: #556274;      /* slate-500, darkened: #64748b lands at 4.47:1
                                      on the slate-50 page surface, just under AA */
    --zq-text-on-primary: #ffffff;

    /* Status (never color-only — every badge below also carries a dot + label) */
    --zq-success: #065f46;
    --zq-success-bg: #d1fae5;
    --zq-warning: #b45309;
    --zq-warning-bg: #fffbeb;
    --zq-error: #991b1b;
    --zq-error-bg: #fee2e2;
    --zq-info: #1d4ed8;
    --zq-info-bg: #eff6ff;
    --zq-neutral: #475569;
    --zq-neutral-bg: #f1f5f9;

    /* Radius scale — deliberately restrained, no pill-everything */
    --zq-radius-sm: 6px;
    --zq-radius-md: 8px;
    --zq-radius-lg: 12px;
    --zq-radius-full: 9999px;

    /* Shadow scale — subtle only */
    --zq-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --zq-shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);

    /* Spacing aliases (mirrors Tailwind's default 4/8/12/16/20/24/32/40/48/64 scale,
       already used via p-1..p-16 utilities — kept here only for hand-written rules
       in this file that don't go through a Tailwind class). */
    --zq-space-1: 4px;  --zq-space-2: 8px;  --zq-space-3: 12px; --zq-space-4: 16px;
    --zq-space-5: 20px; --zq-space-6: 24px; --zq-space-8: 32px; --zq-space-10: 40px;
    --zq-space-12: 48px; --zq-space-16: 64px;

    --zq-transition: 180ms ease;
}

html.dark {
    --zq-primary: #1f2b3d;
    --zq-primary-hover: #16202e;
    --zq-accent: #14b8a6;
    --zq-accent-hover: #0d9488;
    --zq-surface: #1e293b;         /* slate-800 */
    --zq-surface-alt: #0f172a;     /* slate-900 */
    --zq-surface-elevated: #253247;
    --zq-border: #334155;          /* slate-700 */
    --zq-text: #f1f5f9;
    --zq-text-muted: #94a3b8;
    --zq-text-on-primary: #ffffff;

    --zq-success: #a7f3d0;   --zq-success-bg: #064e3b;
    --zq-warning: #fbbf24;   --zq-warning-bg: rgba(217, 119, 6, 0.14);
    --zq-error: #fecaca;     --zq-error-bg: #450a0a;
    --zq-info: #60a5fa;      --zq-info-bg: rgba(37, 99, 235, 0.14);
    --zq-neutral: #cbd5e1;   --zq-neutral-bg: rgba(148, 163, 184, 0.14);

    --zq-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.28);
    --zq-shadow-md: 0 4px 14px rgba(0, 0, 0, 0.32);
}

/* ---- Dark-mode contrast corrections (WCAG 2 AA, 4.5:1 for body text) ----
   These brand colours are tuned for light surfaces. Reused unchanged on the
   dark palette they land between 2.5:1 and 4:1, so each gets a lightened
   counterpart that keeps the same hue. Ratios are measured against the
   surfaces the colour actually appears on (slate-800 cards through brand-bg). */
html.dark #app .text-brand-gold { color: #f0a07f; }          /* was #c2412d — 3.2:1 -> 6.9:1 */
/* The payslip total panel is bg-brand-dark in BOTH themes, so its gold text
   needs the light variant even while the rest of the page is in light mode. */
#app .bg-brand-dark .text-brand-gold { color: #f0a07f; }
html.dark #app .text-red-600    { color: #fca5a5; }          /* was #dc2626 — 2.8:1 -> 7.0:1 */
html.dark #app .text-red-500    { color: #fca5a5; }          /* was #ef4444 — 4.0:1 -> 7.0:1 */
html.dark #app .text-slate-400  { color: #94a3b8; }          /* pin muted grey at slate-400 */

/* White on teal-500 is only 2.5:1. brand-blue carries the same hue at 5.5:1. */
html.dark .zq-btn-secondary { background: #0f766e; }
html.dark .zq-btn-secondary:hover:not(:disabled) { background: #0c5b55; }

/* White on emerald-600 is 3.8:1; emerald-700 reaches 5.5:1. Set here rather than
   by swapping the utility class in the markup — the built tailwind.css ships
   bg-emerald-600 only, so bg-emerald-700 would leave no background at all.
   Every bg-emerald-600 in this app carries white text. */
.zq-btn-success { background: #047857; }
.zq-btn-success:hover:not(:disabled) { background: #065f46; }
#app .bg-emerald-600 { background-color: #047857; }
#app .bg-emerald-600:hover { background-color: #065f46; }

/* Light mode: slate-300/400 are 1.5:1 and 2.6:1 greys on the white workspace
   surfaces. Scoped to the content region because the sidebar keeps its own dark
   palette in both themes, where those same greys are already legible. */
html:not(.dark) #main-content .text-slate-300,
html:not(.dark) #main-content .text-slate-400 { color: #556274; }

/* Required-field asterisks and warning labels: red-500/600 sit at 3.4-3.8:1 on
   the light surfaces they mark up. red-700 clears AA while reading the same. */
html:not(.dark) #app .text-red-500,
html:not(.dark) #app .text-red-600 { color: #b91c1c; }

/* `#app label` (0,1,1) outranks the .zq-btn-* colour rules (0,1,0), so the four
   file pickers styled as buttons rendered the label grey on the button fill —
   2.1:1 on the primary variant. Restate each variant at label specificity. */
#app label.zq-btn-primary,
#app label.zq-btn-secondary,
#app label.zq-btn-success { color: #ffffff; }
#app label.zq-btn-outline { color: var(--zq-text); }
#app label.zq-btn-ghost { color: var(--zq-text-muted); }
#app label.zq-btn-destructive { color: var(--zq-error); }
#app label.zq-btn-info { color: var(--zq-info); }

/* Remaining light-mode body text below AA: emerald-600 is 3.4:1 on the tinted
   attachment panel, and slate-500 lands at 4.47:1 on the off-white workspace. */
html:not(.dark) #main-content .text-emerald-600 { color: #047857; }
html:not(.dark) #main-content .text-slate-500 { color: #556274; }

/* ---- Typography scale (compact, enterprise — no oversized headings) ---- */
.zq-text-page-title    { font-size: 1.25rem; line-height: 1.35; font-weight: 800; letter-spacing: -0.01em; color: var(--zq-text); }
.zq-text-section-title { font-size: 1rem;    line-height: 1.4;  font-weight: 800; color: var(--zq-text); }
.zq-text-card-title    { font-size: 0.875rem; line-height: 1.4; font-weight: 800; color: var(--zq-text); }
.zq-text-body          { font-size: 0.8125rem; line-height: 1.55; color: var(--zq-text); }
.zq-text-small         { font-size: 0.6875rem; line-height: 1.5; color: var(--zq-text-muted); }
.zq-text-label         { font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--zq-text-muted); }
.zq-text-caption       { font-size: 0.625rem; line-height: 1.4; color: var(--zq-text-muted); }

/* ---- Button system ---- */
.zq-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 14px; border-radius: var(--zq-radius-md);
    font-size: 0.75rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent;
    cursor: pointer; transition: background-color var(--zq-transition), border-color var(--zq-transition),
        color var(--zq-transition), box-shadow var(--zq-transition), opacity var(--zq-transition);
    user-select: none;
}
.zq-btn:focus-visible { outline: 2px solid var(--zq-accent); outline-offset: 2px; }
.zq-btn:disabled, .zq-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.zq-btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.zq-btn.is-loading::after {
    content: ''; position: absolute; width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: zq-spin 0.6s linear infinite;
}
/* .is-loading forces the button's own `color` to transparent (to hide the
   label) — a plain `color: inherit` on ::after would inherit that same
   transparent value and make the spinner itself invisible too, so each
   variant restores its own normal (pre-loading) foreground color here,
   independent of the forced-transparent label. */
.zq-btn-primary.is-loading::after,
.zq-btn-secondary.is-loading::after,
.zq-btn-destructive:hover.is-loading::after,
.zq-btn-info:hover.is-loading::after { color: #ffffff; }
.zq-btn-outline.is-loading::after { color: var(--zq-text); }
.zq-btn-ghost.is-loading::after { color: var(--zq-text-muted); }
.zq-btn-destructive.is-loading::after { color: var(--zq-error); }
.zq-btn-info.is-loading::after { color: var(--zq-info); }
.zq-btn-primary  { background: var(--zq-primary); color: var(--zq-text-on-primary); }
.zq-btn-primary:hover:not(:disabled)  { background: var(--zq-primary-hover); }
.zq-btn-primary:active:not(:disabled) { transform: translateY(0.5px); }
.zq-btn-secondary { background: var(--zq-accent); color: #ffffff; }
.zq-btn-secondary:hover:not(:disabled) { background: var(--zq-accent-hover); }
.zq-btn-outline  { background: transparent; border-color: var(--zq-border); color: var(--zq-text); }
.zq-btn-outline:hover:not(:disabled)  { background: var(--zq-surface-alt); }
.zq-btn-ghost    { background: transparent; color: var(--zq-text-muted); }
.zq-btn-ghost:hover:not(:disabled)    { background: var(--zq-surface-alt); color: var(--zq-text); }
.zq-btn-destructive { background: var(--zq-error-bg); color: var(--zq-error); }
.zq-btn-destructive:hover:not(:disabled) { background: var(--zq-error); color: #ffffff; }
.zq-btn-info { background: var(--zq-info-bg); color: var(--zq-info); }
.zq-btn-info:hover:not(:disabled) { background: var(--zq-info); color: #ffffff; }
/* Solid variant (not the light-bg treatment .zq-btn-info/.zq-btn-destructive
   use) to match the "approve" action's existing solid-emerald convention
   used across Claims/Vouchers/Signed Documents before this pass. */
.zq-btn-success { background: var(--zq-success); color: #ffffff; }
.zq-btn-success:hover:not(:disabled) { background: #047857; }
.zq-btn-success.is-loading::after { color: #ffffff; }
.zq-btn-sm   { height: 30px; padding: 0 10px; font-size: 0.6875rem; }
.zq-btn-icon { height: 32px; width: 32px; padding: 0; border-radius: var(--zq-radius-sm); }
.zq-btn-icon.zq-btn-sm { height: 28px; width: 28px; }

@keyframes zq-spin { to { transform: rotate(360deg); } }

/* ---- Status badge (dot + label — never color-only) ---- */
.zq-badge {
    display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px;
    border-radius: var(--zq-radius-full); font-size: 0.625rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap;
}
.zq-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.zq-badge-success { background: var(--zq-success-bg); color: var(--zq-success); }
.zq-badge-warning  { background: var(--zq-warning-bg); color: var(--zq-warning); }
.zq-badge-error    { background: var(--zq-error-bg);   color: var(--zq-error); }
.zq-badge-info     { background: var(--zq-info-bg);    color: var(--zq-info); }
.zq-badge-neutral  { background: var(--zq-neutral-bg); color: var(--zq-neutral); }

/* ---- Card ---- */
.zq-card {
    background: var(--zq-surface); border: 1px solid var(--zq-border);
    border-radius: var(--zq-radius-lg); box-shadow: var(--zq-shadow-sm);
}

/* ---- Page header (breadcrumb / title / description / primary action) ---- */
.zq-page-header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--zq-space-4); margin-bottom: var(--zq-space-6); }
.zq-page-header-desc { margin-top: 2px; font-size: 0.75rem; color: var(--zq-text-muted); }

/* ---- Sidebar nav item (was an 18x-duplicated inline Tailwind string —
   .sidebar-item-active above already handles the active-state look and
   is left untouched; this only replaces the repeated static layout
   classes every nav <button> carried) ---- */
.zq-nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; border-radius: var(--zq-radius-lg);
    text-align: left; transition: background-color var(--zq-transition), color var(--zq-transition);
}

/* ---- Dashboard KPI card (Step 9) — compact label/value/context/icon
   card used across the executive dashboard's KPI grid. Value font-size
   stays a per-instance Tailwind class (text-xl vs text-lg) since the
   currency-value cards deliberately run one size smaller to avoid
   wrapping — this only tokenizes the shared shape/spacing/hover. ---- */
.zq-kpi-card {
    min-width: 0; border-radius: var(--zq-radius-lg); border: 1px solid var(--zq-border);
    background: var(--zq-surface-alt); padding: 14px;
    transition: border-color var(--zq-transition), box-shadow var(--zq-transition), transform var(--zq-transition);
}
.zq-kpi-card:hover { border-color: var(--zq-accent); box-shadow: var(--zq-shadow-sm); transform: translateY(-1px); }
.zq-kpi-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.zq-kpi-card-value { margin-top: 8px; font-weight: 900; line-height: 1; color: var(--zq-text); }
.zq-kpi-card-label { margin-top: 8px; font-size: 0.625rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; line-height: 1.3; color: var(--zq-text-muted); }
.zq-kpi-card-context { margin-top: 4px; font-size: 0.625rem; font-weight: 700; }

/* ---- Form field system (Step 10) — one canonical control look shared by
   text/email/phone/number/date <input> (the visual treatment doesn't vary
   by `type`, so one class covers all of them), <select> and <textarea>.
   Audit found 40+ near-duplicate ad-hoc class strings (p-2 vs p-2.5 vs
   px-3 py-2.5, rounded-lg vs rounded-xl, border-slate-200 vs -300, mixed
   focus treatments) — this replaces them with one consistent control. ---- */
.zq-label {
    display: block; margin-bottom: 6px; font-size: 0.6875rem; font-weight: 700;
    color: var(--zq-text-muted); text-transform: uppercase; letter-spacing: 0.02em;
}
.zq-label-required { color: var(--zq-error); margin-left: 2px; font-weight: 800; }

.zq-input, .zq-select, .zq-textarea {
    width: 100%; border-radius: var(--zq-radius-md); border: 1px solid var(--zq-border);
    background: var(--zq-surface); color: var(--zq-text); padding: 9px 12px; font-size: 0.75rem;
    transition: border-color var(--zq-transition), box-shadow var(--zq-transition);
}
html.dark .zq-input, html.dark .zq-select, html.dark .zq-textarea { background: var(--zq-surface-elevated); }
.zq-input::placeholder, .zq-textarea::placeholder { color: var(--zq-text-muted); opacity: 1; }
.zq-input:focus, .zq-select:focus, .zq-textarea:focus {
    outline: none; border-color: var(--zq-accent); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.15);
}
html.dark .zq-input:focus, html.dark .zq-select:focus, html.dark .zq-textarea:focus { box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.22); }
.zq-input:disabled, .zq-select:disabled, .zq-textarea:disabled,
.zq-input:read-only, .zq-textarea:read-only {
    background: var(--zq-surface-alt); color: var(--zq-text-muted); cursor: not-allowed;
}
.zq-textarea { resize: vertical; min-height: 80px; }
.zq-input.is-invalid, .zq-select.is-invalid, .zq-textarea.is-invalid { border-color: var(--zq-error); }
/* Used where a field's border deliberately draws attention to a payee/
   third-party sub-section (not a validation error) — kept as its own
   modifier so it can't be confused with .is-invalid. */
.zq-input-flag, .zq-select-flag { border-color: #f59e0b; }
html.dark .zq-input-flag, html.dark .zq-select-flag { border-color: #b45309; }
.zq-input.is-invalid:focus, .zq-select.is-invalid:focus, .zq-textarea.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }

.zq-help-text { margin-top: 4px; font-size: 0.6875rem; color: var(--zq-text-muted); }
.zq-error-text { margin-top: 4px; font-size: 0.6875rem; font-weight: 700; color: var(--zq-error); }
.zq-success-text { margin-top: 4px; font-size: 0.6875rem; font-weight: 700; color: var(--zq-success); }

/* ---- Alert banner (Step 15) — a centered inline error/message banner,
   for form-level (not per-field) errors: "wrong password", "link
   expired", a failed submit. Was hand-rolled identically at 4+ call
   sites. .zq-error-text stays for per-field messages under a single
   input; this is for a standalone block above/below a form. ---- */
.zq-alert {
    min-height: 42px; box-sizing: border-box; display: flex; align-items: center; justify-content: center;
    text-align: center; font-size: 0.75rem; line-height: 1.35; font-weight: 700; padding: 10px 12px;
    border: 1px solid transparent; border-radius: var(--zq-radius-md);
}
.zq-alert-error { background: var(--zq-error-bg); border-color: currentColor; color: var(--zq-error); }
.zq-alert-success { background: var(--zq-success-bg); border-color: currentColor; color: var(--zq-success); }

/* Auth errors reserve their own line from the first paint. This prevents the
   sign-in choices and form submit controls from jumping when a request fails. */
.zq-alert-slot { min-height: 42px; }
.zq-alert-slot > .zq-alert { margin: 0; }

/* ---- Error state (Step 15) — same shell as .zq-loading-state /
   .zq-empty-state (that shared shape is defined once, further down, via a
   combined selector); only the error tint is set here. For a failed-to-
   load panel (network/Firestore error) with room for a retry action. ---- */
.zq-error-state-icon { font-size: 1.5rem; color: var(--zq-error); }
.zq-error-state-text { font-size: 0.75rem; font-weight: 700; color: var(--zq-error); }

.zq-checkbox, .zq-radio {
    height: 16px; width: 16px; border: 1px solid var(--zq-border); accent-color: var(--zq-accent); cursor: pointer;
    border-radius: 4px;
}
.zq-radio { border-radius: 50%; }
.zq-checkbox:focus-visible, .zq-radio:focus-visible { outline: 2px solid var(--zq-accent); outline-offset: 2px; }

/* ---- Form structure — section grouping + action bar ---- */
.zq-form-section + .zq-form-section { padding-top: var(--zq-space-5); border-top: 1px solid var(--zq-border); margin-top: var(--zq-space-5); }
.zq-form-section-title { font-size: 0.6875rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; color: var(--zq-text-muted); margin-bottom: var(--zq-space-3); }
.zq-form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: var(--zq-space-5); padding-top: var(--zq-space-4); border-top: 1px solid var(--zq-border); }

/* ---- Modal system (Step 11) — one shell shared by every dialog.
   Audit found 27 separate `fixed inset-0 ... flex items-center
   justify-center bg-slate-9xx/6x backdrop-blur-sm` overlays, each with
   its own one-off max-w-*, radius and shadow. This is the shell only;
   each modal keeps its own v-if condition, close handler, form and
   submit handler exactly as before — only the surrounding classes
   change. Sizes: .zq-modal-sm (confirmations), default (most forms),
   .zq-modal-lg / .zq-modal-xl (long forms, e.g. HR Employee). ---- */
.zq-modal-overlay {
    position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px);
    animation: zq-overlay-in 160ms ease;
}
.zq-modal {
    width: 100%; max-width: 28rem; max-height: 90vh; display: flex; flex-direction: column;
    overflow: hidden; background: var(--zq-surface); border-radius: var(--zq-radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    animation: zq-modal-in 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes zq-overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes zq-modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@media (prefers-reduced-motion: reduce) {
    .zq-modal-overlay, .zq-modal, .zq-drawer { animation: none; }
}
.zq-modal-sm { max-width: 24rem; }
.zq-modal-lg { max-width: 42rem; }
.zq-modal-xl { max-width: 56rem; }
.zq-modal-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
    padding: 18px 20px; border-bottom: 1px solid var(--zq-border); flex-shrink: 0;
}
.zq-modal-title { font-size: 1rem; font-weight: 800; color: var(--zq-text); line-height: 1.3; }
.zq-modal-description { margin-top: 2px; font-size: 0.75rem; color: var(--zq-text-muted); }
.zq-modal-close {
    display: inline-flex; align-items: center; justify-content: center; height: 32px; width: 32px;
    border-radius: var(--zq-radius-md); color: var(--zq-text-muted); flex-shrink: 0; background: transparent;
    transition: background-color var(--zq-transition), color var(--zq-transition);
}
.zq-modal-close:hover { background: var(--zq-surface-alt); color: var(--zq-text); }
/* Branded variant — used by a few project-context workflow modals that
   show a project-ref badge; keeps the header on-brand instead of every
   modal defaulting to a plain light header. */
.zq-modal-header-brand { background: var(--zq-primary); color: #fff; border-bottom-color: transparent; }
.zq-modal-header-brand .zq-modal-title { color: #fff; }
.zq-modal-header-brand .zq-modal-close { color: rgba(255,255,255,0.7); }
.zq-modal-header-brand .zq-modal-close:hover { background: rgba(255,255,255,0.15); color: #fff; }
.zq-modal-body { padding: 20px; overflow-y: auto; flex: 1 1 auto; }
.zq-modal-footer {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px;
    padding: 14px 20px; border-top: 1px solid var(--zq-border); flex-shrink: 0;
}

/* ---- Confirmation dialogs — compact icon+title+message body, reuses
   .zq-modal-sm/.zq-modal-footer for the shell. ---- */
.zq-confirm-icon {
    display: flex; align-items: center; justify-content: center; height: 40px; width: 40px;
    border-radius: 50%; flex-shrink: 0;
}
.zq-confirm-icon.is-danger { background: var(--zq-error-bg); color: var(--zq-error); }
.zq-confirm-icon.is-warning { background: var(--zq-warning-bg); color: var(--zq-warning); }
.zq-confirm-icon.is-info { background: var(--zq-info-bg); color: var(--zq-info); }

/* ---- Drawer — slide-in from the right, for quick read-mostly
   inspection panels (record/detail views), not multi-step workflows. ---- */
.zq-drawer-overlay {
    position: fixed; inset: 0; z-index: 60; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(2px);
    display: flex; justify-content: flex-end;
}
.zq-drawer {
    width: 100%; max-width: 32rem; height: 100%; max-height: 100vh; display: flex; flex-direction: column;
    background: var(--zq-surface); box-shadow: -12px 0 40px rgba(0, 0, 0, 0.2);
    animation: zq-drawer-in 220ms ease;
}
@keyframes zq-drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.zq-drawer-lg { max-width: 42rem; }

/* ---- Empty state (Step 13) — one shell for every "no data" / "no
   results" message, full-size for a table/page section or .-compact for
   a card/widget. Structure:
   <div class="zq-empty-state"><i class="zq-empty-state-icon fa-solid ..."></i>
     <p class="zq-empty-state-title">Title</p>
     <p class="zq-empty-state-text">One short explanatory sentence.</p>
     <div class="zq-empty-state-action"><button class="zq-btn ...">...</button></div>
   </div>
   The icon is decorative (aria-hidden) — title + text alone must carry the
   full meaning, so screen readers and icon-less scanning both work. ---- */
.zq-empty-state, .zq-loading-state, .zq-error-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; gap: var(--zq-space-2); padding: var(--zq-space-8) var(--zq-space-4);
    border: 1px dashed var(--zq-border); border-radius: var(--zq-radius-lg); background: var(--zq-surface-alt);
}
.zq-error-state { border-color: var(--zq-error); background: var(--zq-error-bg); }
.zq-empty-state-compact { padding: var(--zq-space-5) var(--zq-space-3); gap: var(--zq-space-1); }
.zq-empty-state-icon {
    font-size: 1.5rem; color: var(--zq-text-muted); opacity: 0.6; margin-bottom: var(--zq-space-1);
}
.zq-empty-state-compact .zq-empty-state-icon { font-size: 1.125rem; margin-bottom: 0; }
.zq-empty-state-title { font-size: 0.8125rem; font-weight: 800; color: var(--zq-text); }
.zq-empty-state-compact .zq-empty-state-title { font-size: 0.75rem; }
.zq-empty-state-text { max-width: 32rem; font-size: 0.75rem; line-height: 1.5; color: var(--zq-text-muted); }
.zq-empty-state-compact .zq-empty-state-text { font-size: 0.6875rem; }
.zq-empty-state-action { margin-top: var(--zq-space-2); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--zq-space-2); }

/* ---- Loading state (Step 14) — shares its shell with .zq-empty-state /
   .zq-error-state (combined selector above); for the "waiting on
   Firestore/Storage" panels that were previously copy-pasted verbatim in
   three places. Icon is expected to be `.fa-spin` itself. ---- */
.zq-loading-state-icon { font-size: 1.25rem; color: var(--zq-text-muted); }
.zq-loading-state-text { font-size: 0.75rem; font-weight: 700; color: var(--zq-text-muted); }

/* ---- Data table — subtle dividers, no per-cell borders, consistent row/cell
   rhythm across every table in the app. Structure (unchanged): <table
   class="zq-table"><thead><tr><th>...<tbody><tr>...<td>. Row-action buttons
   use .zq-btn-icon inside a .zq-table-actions wrapper for 2-3 actions;
   tables with 4+ actions get a real three-dot menu component in a later
   pass instead of cramming more icon buttons into the row. ---- */
.zq-table { width: 100%; text-align: left; border-collapse: collapse; }
.zq-table thead th {
    padding: 10px 12px; font-size: 0.6875rem; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--zq-text-muted); border-bottom: 1px solid var(--zq-border);
    white-space: nowrap;
}
.zq-table tbody td { padding: 12px; font-size: 0.75rem; color: var(--zq-text); vertical-align: middle; }
.zq-table tbody tr { border-bottom: 1px solid var(--zq-border); transition: background-color var(--zq-transition); }
.zq-table tbody tr:last-child { border-bottom: none; }
.zq-table tbody tr:hover { background: var(--zq-surface-alt); }
.zq-table-actions { display: flex; align-items: center; justify-content: center; gap: 4px; }
.zq-table-empty td { padding: var(--zq-space-8) var(--zq-space-4); text-align: center; color: var(--zq-text-muted); }

/* ============================================================
   PORTAL EXPERIENCE REFRESH
   A shared composition layer for staff and client sessions. This is visual
   only: role checks, routes, data and permissions continue to be handled by
   app.js exactly as before.
   ============================================================ */
@media screen {
    #app .zq-main {
        background: #f4f7fb;
        isolation: isolate;
    }

    .dark #app .zq-main {
        background: #0b1220;
    }

    #app .zq-staff-main {
        background-image:
            radial-gradient(circle at 86% -8%, rgba(20, 184, 166, 0.12), transparent 26rem),
            linear-gradient(180deg, #f8fafc 0%, #f2f6fa 100%);
    }

    #app .zq-client-main {
        background-image:
            radial-gradient(circle at 90% -5%, rgba(59, 130, 246, 0.12), transparent 25rem),
            radial-gradient(circle at 3% 18%, rgba(20, 184, 166, 0.08), transparent 20rem),
            linear-gradient(180deg, #f8fafc 0%, #eff5f8 100%);
    }

    .dark #app .zq-staff-main,
    .dark #app .zq-client-main {
        background-image: radial-gradient(circle at 90% -8%, rgba(45, 212, 191, 0.08), transparent 26rem), linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
    }

    #app .zq-sidebar {
        background: linear-gradient(180deg, #111c2c 0%, #0c1523 100%) !important;
        border-right: 1px solid rgba(148, 163, 184, 0.16) !important;
        box-shadow: 14px 0 36px rgba(15, 23, 42, 0.10) !important;
    }

    #app .zq-sidebar > div:first-child {
        min-height: 76px;
        padding: 16px !important;
        background: rgba(255, 255, 255, 0.025);
    }

    #app .zq-sidebar > div:first-child::before {
        left: 16px;
        right: 16px;
        background: linear-gradient(90deg, #14b8a6, #60a5fa);
        opacity: 0.8;
    }

    #app .zq-sidebar nav {
        padding: 14px 10px;
    }

    #app .zq-sidebar nav > div > p {
        letter-spacing: 0.14em;
        color: #718096;
    }

    #app .zq-nav-item {
        min-height: 40px;
        padding: 10px 12px;
        border: 1px solid transparent;
        border-radius: 10px;
        color: #aab8cb;
    }

    #app .zq-nav-item:hover {
        background: rgba(148, 163, 184, 0.10) !important;
        border-color: rgba(148, 163, 184, 0.10);
        color: #f8fafc !important;
    }

    #app .sidebar-item-active,
    #app .client-portal-theme .sidebar-item-active {
        background: linear-gradient(110deg, rgba(15, 118, 110, 0.98), rgba(20, 184, 166, 0.92)) !important;
        border: 1px solid rgba(153, 246, 228, 0.22) !important;
        border-left: 1px solid rgba(153, 246, 228, 0.30) !important;
        box-shadow: 0 7px 16px rgba(15, 118, 110, 0.23);
        color: #ffffff !important;
    }

    #app .client-portal-theme .sidebar-item-active {
        background: linear-gradient(110deg, #1d4ed8, #2563eb) !important;
        box-shadow: 0 7px 16px rgba(37, 99, 235, 0.25);
    }

    #app .zq-topbar {
        min-height: 72px;
        border-bottom: 1px solid rgba(203, 213, 225, 0.9) !important;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
    }

    .dark #app .zq-topbar {
        border-bottom-color: rgba(71, 85, 105, 0.72) !important;
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
    }

    #app .zq-topbar > div:first-child > button {
        height: 40px;
        width: 40px;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #ffffff;
        box-shadow: var(--zq-shadow-sm);
    }

    .dark #app .zq-topbar > div:first-child > button {
        border-color: #475569;
        background: #1e293b;
    }

    #app .zq-topbar input {
        min-height: 40px;
        border: 1px solid transparent;
        background: #f1f5f9;
        box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.08);
    }

    #app .zq-topbar input:focus {
        background: #ffffff;
        border-color: rgba(20, 184, 166, 0.72);
    }

    .dark #app .zq-topbar input {
        background: #263449;
    }

    #app .zq-dashboard,
    #app .zq-client-workspace {
        padding-top: 28px;
        padding-bottom: 40px;
    }

    #app .zq-dashboard > .zq-card,
    #app .zq-client-workspace > .zq-card,
    #app .zq-staff-dashboard > .zq-card {
        border-color: rgba(203, 213, 225, 0.92);
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.055);
    }

    .dark #app .zq-dashboard > .zq-card,
    .dark #app .zq-client-workspace > .zq-card,
    .dark #app .zq-staff-dashboard > .zq-card {
        border-color: #334155;
    }

    #app .zq-staff-dashboard > div:first-child,
    #app .zq-client-overview > div:first-child {
        padding: 2px 0 4px;
    }

    #app .zq-staff-dashboard .zq-text-page-title,
    #app .zq-client-overview h2 {
        font-size: clamp(1.35rem, 2vw, 1.75rem);
        letter-spacing: -0.035em;
    }

    #app .zq-kpi-card {
        min-height: 132px;
        border-color: rgba(203, 213, 225, 0.92);
        background: rgba(255, 255, 255, 0.92);
        box-shadow: 0 6px 18px rgba(15, 23, 42, 0.035);
    }

    #app .zq-kpi-card:hover {
        border-color: rgba(20, 184, 166, 0.55);
        box-shadow: 0 12px 24px rgba(15, 118, 110, 0.10);
    }

    .dark #app .zq-kpi-card {
        border-color: #334155;
        background: rgba(30, 41, 59, 0.9);
    }

    #app .project-summary-card {
        min-height: 118px;
        border: 1px solid rgba(203, 213, 225, 0.88) !important;
        border-top: 3px solid #14b8a6 !important;
        border-radius: 12px !important;
        background: rgba(255, 255, 255, 0.86) !important;
        box-shadow: 0 5px 15px rgba(15, 23, 42, 0.035);
    }

    .dark #app .project-summary-card {
        background: rgba(30, 41, 59, 0.92) !important;
        border-color: #334155 !important;
    }

    #app .zq-client-hero {
        min-height: 210px;
        border-radius: 20px !important;
        background:
            radial-gradient(circle at 88% 20%, rgba(96, 165, 250, 0.26), transparent 21rem),
            radial-gradient(circle at 18% 105%, rgba(45, 212, 191, 0.18), transparent 18rem),
            linear-gradient(120deg, #142033 0%, #172a40 52%, #0f3f3a 100%) !important;
        box-shadow: 0 18px 42px rgba(15, 23, 42, 0.20) !important;
    }

    #app .zq-client-hero h2 {
        max-width: 720px;
        font-size: clamp(1.7rem, 3vw, 2.5rem);
        line-height: 1.08;
        letter-spacing: -0.045em;
    }

    #app .zq-client-hero button,
    #app .zq-client-identity button {
        min-height: 44px;
    }

    #app .zq-client-identity {
        border-radius: 16px !important;
        background: linear-gradient(145deg, #16263a, #102f38) !important;
        box-shadow: 0 12px 25px rgba(15, 23, 42, 0.15) !important;
    }

    #app .zq-client-workspace > .grid > button,
    #app .zq-client-workspace > section + .grid > button {
        min-height: 92px;
        border-color: rgba(203, 213, 225, 0.9);
        background: rgba(255, 255, 255, 0.93);
    }

    .dark #app .zq-client-workspace > .grid > button,
    .dark #app .zq-client-workspace > section + .grid > button {
        border-color: #334155;
        background: rgba(30, 41, 59, 0.90);
    }

    #app .zq-client-workspace .zq-table thead th,
    #app .zq-dashboard .zq-table thead th {
        background: #edf4f5;
        color: #47606a;
    }

    .dark #app .zq-client-workspace .zq-table thead th,
    .dark #app .zq-dashboard .zq-table thead th {
        background: #1d3340;
        color: #cbd5e1;
    }

    @media (max-width: 767px) {
        #app .zq-topbar { min-height: 62px; }
        #app .zq-dashboard,
        #app .zq-client-workspace { padding-top: 16px; padding-bottom: 28px; }
        #app .zq-client-hero { min-height: auto; border-radius: 16px !important; }
        #app .zq-client-hero h2 { font-size: 1.55rem; }
        #app .zq-client-workspace > .grid > button,
        #app .zq-client-workspace > section + .grid > button { min-height: 80px; }
    }
}

/* Sign-in gateway: separates internal and client access before credentials
   are requested, while retaining the existing authentication flow. */
.zq-auth-landing {
    max-width: 880px !important;
}

.zq-auth-landing > .text-center {
    margin-bottom: 2rem !important;
}

.zq-auth-choice {
    position: relative;
    min-height: 246px;
    overflow: hidden;
    border-radius: 18px !important;
    box-shadow: 0 18px 38px rgba(3, 11, 24, 0.20) !important;
}

.zq-auth-choice::after {
    content: '';
    position: absolute;
    right: -3rem;
    bottom: -4rem;
    width: 11rem;
    height: 11rem;
    border-radius: 50%;
    opacity: 0.8;
    transition: transform 220ms ease;
}

.zq-auth-choice:hover::after {
    transform: scale(1.14);
}

.zq-auth-choice-staff::after { background: rgba(20, 184, 166, 0.14); }
.zq-auth-choice-client::after { background: rgba(96, 165, 250, 0.16); }

.zq-auth-choice > * { position: relative; z-index: 1; }

.zq-auth-choice:hover {
    border-color: rgba(45, 212, 191, 0.55) !important;
    box-shadow: 0 24px 44px rgba(3, 11, 24, 0.28) !important;
}

@media (max-width: 640px) {
    .zq-auth-choice { min-height: 0; }
}

/* ---- Search & filter toolbar system (Step 12) — one consistent shell for
   every record-list toolbar (search + filter selects/pills + sort +
   export + primary action), plus a shared segmented-control for the
   period/view/scope toggles that were previously hand-duplicated per
   module (Daily/Weekly/Monthly/Yearly, Board/List, All/My Projects, etc).
   Structure: <div class="zq-toolbar"><div class="zq-toolbar-main">search +
   filters</div><div class="zq-toolbar-actions">export / add</div></div> ---- */
.zq-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: var(--zq-space-3); margin-bottom: var(--zq-space-4);
}
.zq-toolbar-main { display: flex; flex-wrap: wrap; align-items: center; gap: var(--zq-space-2); flex: 1 1 auto; min-width: 0; }
.zq-toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--zq-space-2); flex-shrink: 0; }

/* Search input with a leading icon, sharing .zq-input's border/focus look. */
.zq-search { position: relative; min-width: 0; flex: 1 1 220px; max-width: 320px; }
.zq-search-input.zq-input { padding-left: 34px; }
.zq-search-input.zq-input:not(:placeholder-shown) ~ .zq-search-clear { display: inline-flex; }
.zq-search-icon {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    color: var(--zq-text-muted); font-size: 0.75rem; pointer-events: none;
}
.zq-search-clear {
    display: none; position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    height: 22px; width: 22px; align-items: center; justify-content: center;
    border-radius: var(--zq-radius-sm); color: var(--zq-text-muted); background: transparent;
}
.zq-search-clear:hover { background: var(--zq-surface-alt); color: var(--zq-text); }

/* Filter/sort selects — reuse .zq-select's look, sized for a toolbar
   rather than a full-width form field. */
.zq-filter-select.zq-select { width: auto; min-width: 140px; }

/* Standalone filter toggle buttons (e.g. a single "Needs Attention Only"
   switch) — pill-shaped, with an active state that isn't color alone
   (bold weight + a real border color change), so state reads without
   relying on hue. */
.zq-filter-button {
    display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px;
    border-radius: var(--zq-radius-full); border: 1px solid var(--zq-border); background: var(--zq-surface);
    color: var(--zq-text-muted); font-size: 0.6875rem; font-weight: 700; white-space: nowrap;
    transition: background-color var(--zq-transition), color var(--zq-transition), border-color var(--zq-transition);
}
.zq-filter-button:hover { background: var(--zq-surface-alt); color: var(--zq-text); }
.zq-filter-button.is-active {
    background: var(--zq-warning-bg); color: var(--zq-warning); border-color: var(--zq-warning); font-weight: 800;
}
.zq-filter-button:focus-visible, .zq-filter-chip:focus-visible, .zq-segmented-control button:focus-visible {
    outline: 2px solid var(--zq-accent); outline-offset: 2px;
}

/* Filter chips — a row of mutually-exclusive pill options inside a shared
   track (module-type filters, doc type/status pills). Visually distinct
   from .zq-segmented-control's contiguous-block look: chips keep their
   own rounded pill shape and gap, which reads better for option sets with
   more than 3-4 choices. */
.zq-filter-chip-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 4px; border-radius: var(--zq-radius-lg); border: 1px solid var(--zq-border); background: var(--zq-surface-alt); }
.zq-filter-chip {
    display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--zq-radius-full);
    font-size: 0.6875rem; font-weight: 700; color: var(--zq-text-muted); background: transparent; white-space: nowrap;
    transition: background-color var(--zq-transition), color var(--zq-transition);
}
.zq-filter-chip:hover { color: var(--zq-text); }
.zq-filter-chip.is-active { background: var(--zq-primary); color: var(--zq-text-on-primary); }
/* Semantic exception — used only where the underlying states are
   genuinely success/danger (e.g. Paid/Unpaid), not a generic selection. */
.zq-filter-chip.is-active.is-success { background: var(--zq-success-bg); color: var(--zq-success); }
.zq-filter-chip.is-active.is-danger { background: var(--zq-error-bg); color: var(--zq-error); }

/* Small numeric badge on a filter trigger showing how many are active. */
.zq-filter-count {
    display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: var(--zq-radius-full); background: var(--zq-accent); color: #fff; font-size: 0.625rem; font-weight: 800;
}

/* One-click reset back to a filter's existing default value(s). */
.zq-filter-reset {
    display: inline-flex; align-items: center; gap: 4px; font-size: 0.6875rem; font-weight: 700;
    color: var(--zq-text-muted); background: transparent; padding: 0 4px; height: 32px;
}
.zq-filter-reset:hover:not(:disabled) { color: var(--zq-error); }
.zq-filter-reset:disabled { color: var(--zq-text-muted); opacity: 0.5; cursor: not-allowed; }

/* Segmented control — a single bordered strip of mutually-exclusive
   options (period toggles, view-mode/scope switches). Fixed track/button
   heights keep the strip from jumping size when the active label changes
   selection to selection. */
.zq-segmented-control {
    display: inline-flex; align-items: stretch; padding: 3px; border-radius: var(--zq-radius-lg);
    background: var(--zq-surface-alt); border: 1px solid var(--zq-border); gap: 2px;
}
.zq-segmented-control button {
    display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 12px;
    border-radius: var(--zq-radius-md); font-size: 0.6875rem; font-weight: 700; color: var(--zq-text-muted);
    background: transparent; white-space: nowrap; transition: background-color var(--zq-transition), color var(--zq-transition);
}
.zq-segmented-control button:hover:not(.is-active) { color: var(--zq-text); }
.zq-segmented-control button.is-active {
    background: var(--zq-primary); color: var(--zq-text-on-primary); font-weight: 800; box-shadow: var(--zq-shadow-sm);
}

/* ---- Theme compatibility layer ----
   Most page markup declares a paired `dark:` utility. This safeguard covers
   the remaining legacy utilities that do not have a dark counterpart, so a
   dark surface can never retain low-contrast light-mode text, borders or
   cards. Explicit `dark:` choices still win and remain available for true
   semantic exceptions (success, warning, error and information states). */
html.dark #app .text-slate-500:not([class*="dark:text-"]),
html.dark #app .text-slate-600:not([class*="dark:text-"]) { color: var(--zq-text-muted); }
html.dark #app .text-slate-700:not([class*="dark:text-"]),
html.dark #app .text-slate-800:not([class*="dark:text-"]),
html.dark #app .text-slate-900:not([class*="dark:text-"]),
html.dark #app .text-brand-dark:not([class*="dark:text-"]) { color: var(--zq-text); }
html.dark #app .text-brand-blue:not([class*="dark:text-"]) { color: #2dd4bf; }

html.dark #app .bg-white:not([class*="dark:bg-"]) { background-color: var(--zq-surface); }
html.dark #app .bg-slate-50:not([class*="dark:bg-"]) { background-color: var(--zq-surface-alt); }
html.dark #app .bg-slate-100:not([class*="dark:bg-"]) { background-color: var(--zq-neutral-bg); }
html.dark #app .border-slate-100:not([class*="dark:border-"]),
html.dark #app .border-slate-200:not([class*="dark:border-"]),
html.dark #app .border-slate-300:not([class*="dark:border-"]) { border-color: var(--zq-border); }

/* ============================================================
   PROFESSIONAL WORKSPACE SYSTEM
   The portal behaves like a familiar business application: quiet page
   surfaces, compact information hierarchy and a small, intentional accent
   palette. This layer applies equally to Staff and Client views.
   ============================================================ */

/* A conventional sign-in screen — no watermark or oversized feature cards. */
.zq-auth-shell {
    background: #f1f5f9 !important;
}
.zq-auth-shell > .pointer-events-none { display: none !important; }
.zq-auth-landing {
    max-width: 820px !important;
    padding: 32px;
    border: 1px solid #dbe3ec;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.10);
}
.zq-auth-landing > .text-center { margin-bottom: 24px !important; }
.zq-auth-landing > .text-center h1 { color: #0f172a !important; font-size: 1.55rem; }
.zq-auth-landing > .text-center p { color: #64748b !important; }
.zq-auth-landing > .text-center span {
    margin-top: 10px !important;
    border-color: #bfe7e1 !important;
    background: #ecfdf5 !important;
    color: #0f766e !important;
}
.zq-auth-choice {
    min-height: 188px;
    padding: 22px !important;
    border: 1px solid #dbe3ec !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: none !important;
}
.zq-auth-choice::after { display: none; }
.zq-auth-choice:hover {
    transform: translateY(-2px) !important;
    border-color: #5eead4 !important;
    box-shadow: 0 8px 20px rgba(15, 118, 110, 0.08) !important;
}
.zq-auth-choice h2 { color: #0f172a !important; }
.zq-auth-choice p { color: #64748b !important; }
.zq-auth-choice-staff > div { background: #0f766e !important; }
.zq-auth-choice-client > div { background: #2563eb !important; color: #ffffff !important; }
.dark .zq-auth-shell { background: #0f172a !important; }
.dark .zq-auth-landing {
    border-color: #334155;
    background: #1e293b;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.26);
}
.dark .zq-auth-landing > .text-center h1 { color: #f8fafc !important; }
.dark .zq-auth-landing > .text-center p { color: #94a3b8 !important; }
.dark .zq-auth-choice { border-color: #475569 !important; background: #263449 !important; }
.dark .zq-auth-choice h2 { color: #f8fafc !important; }
.dark .zq-auth-choice p { color: #cbd5e1 !important; }

/* Shared staff/client application shell. */
#app .zq-main {
    background: #f6f8fb;
}
.dark #app .zq-main { background: #111827; }
#app .zq-topbar {
    min-height: 66px;
    border-bottom-color: #e2e8f0 !important;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03) !important;
}
.dark #app .zq-topbar {
    border-bottom-color: #334155 !important;
    box-shadow: 0 1px 0 rgba(148, 163, 184, 0.08) !important;
}
#app .zq-topbar input { border-radius: 8px; }
#app .zq-sidebar {
    background: #172033 !important;
    box-shadow: none !important;
}
#app .zq-sidebar > div:first-child { min-height: 70px; padding: 14px 16px !important; }
#app .zq-sidebar nav { padding: 12px 10px; }
#app .zq-nav-item { min-height: 40px; padding: 9px 11px; border-radius: 8px; }
#app .sidebar-item-active,
#app .client-portal-theme .sidebar-item-active {
    background: #0f766e !important;
    border-left-color: #5eead4 !important;
    box-shadow: none !important;
}
#app .client-portal-theme .sidebar-item-active {
    background: #2563eb !important;
    border-left-color: #bfdbfe !important;
}

/* Staff dashboard: an operational header, followed by compact cards. */
#app .zq-staff-dashboard > div:first-child {
    margin-bottom: 2px;
    padding: 2px 0 10px;
}
#app .zq-staff-dashboard .zq-text-page-title { font-size: 1.45rem; letter-spacing: -0.025em; }
#app .zq-kpi-card {
    min-height: 124px;
    border: 1px solid #dbe3ec;
    border-radius: 12px;
    background: #ffffff;
    box-shadow: none;
}
#app .zq-kpi-card:hover { border-color: #99d9d0; box-shadow: 0 8px 18px rgba(15, 118, 110, 0.07); }
.dark #app .zq-kpi-card { border-color: #334155; background: #1e293b; }

/* Client workspace: a standard page header, account summary and data cards. */
#app .zq-client-workspace { max-width: 1280px; padding-top: 24px; padding-bottom: 32px; }
#app .zq-client-hero {
    min-height: 154px;
    border: 1px solid #dbe3ec !important;
    border-left: 4px solid #0f766e !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: none !important;
}
#app .zq-client-hero > div:first-child { display: none; }
#app .zq-client-hero h2,
#app .zq-client-hero .text-white,
#app .zq-client-hero .text-slate-200,
#app .zq-client-hero .text-slate-300 { color: #0f172a !important; }
#app .zq-client-hero h2 { font-size: 1.6rem; letter-spacing: -0.025em; }
#app .zq-client-hero .bg-white\/10 { background: #f1f5f9 !important; }
#app .zq-client-hero .border-white\/20,
#app .zq-client-hero .border-white\/25 { border-color: #cbd5e1 !important; }
#app .zq-client-hero button:first-child { background: #f8fafc !important; color: #334155 !important; }
#app .zq-client-hero button:last-child { background: #0f766e !important; color: #ffffff !important; border-color: #0f766e !important; }
.dark #app .zq-client-hero {
    border-color: #334155 !important;
    border-left-color: #2dd4bf !important;
    background: #1e293b !important;
}
.dark #app .zq-client-hero h2,
.dark #app .zq-client-hero .text-white,
.dark #app .zq-client-hero .text-slate-200,
.dark #app .zq-client-hero .text-slate-300 { color: #f8fafc !important; }
.dark #app .zq-client-hero .bg-white\/10 { background: #263449 !important; }
.dark #app .zq-client-hero .border-white\/20,
.dark #app .zq-client-hero .border-white\/25 { border-color: #475569 !important; }
.dark #app .zq-client-hero button:first-child { background: #263449 !important; color: #e2e8f0 !important; }

#app .zq-client-identity {
    border: 1px solid #dbe3ec !important;
    border-radius: 12px !important;
    background: #ffffff !important;
    box-shadow: none !important;
}
#app .zq-client-identity .text-white,
#app .zq-client-identity .text-slate-300 { color: #334155 !important; }
#app .zq-client-identity .border-white\/15,
#app .zq-client-identity .border-white\/20 { border-color: #e2e8f0 !important; }
#app .zq-client-identity .bg-white\/10 { background: #eff6ff !important; }
.dark #app .zq-client-identity { border-color: #334155 !important; background: #1e293b !important; }
.dark #app .zq-client-identity .text-white,
.dark #app .zq-client-identity .text-slate-300 { color: #e2e8f0 !important; }

#app .zq-client-workspace > .grid > section:last-child > div,
#app .zq-client-workspace > .grid > section:last-child > div:nth-child(n) {
    min-height: 124px;
    border-color: #dbe3ec !important;
    border-radius: 12px;
    box-shadow: none;
}
.dark #app .zq-client-workspace > .grid > section:last-child > div { border-color: #334155 !important; }
#app .zq-client-workspace > section + .grid > button {
    min-height: 86px;
    border-color: #dbe3ec !important;
    border-radius: 12px;
    box-shadow: none;
}
#app .zq-client-workspace > section + .grid > button:hover { transform: translateY(-1px); background: #f8fafc; }
.dark #app .zq-client-workspace > section + .grid > button { border-color: #334155 !important; }
.dark #app .zq-client-workspace > section + .grid > button:hover { background: #263449; }
#app .zq-client-workspace > div.bg-white {
    border-color: #dbe3ec !important;
    border-radius: 12px !important;
    box-shadow: none !important;
}
.dark #app .zq-client-workspace > div.bg-white { border-color: #334155 !important; }

@media (max-width: 767px) {
    .zq-auth-landing { padding: 22px; border-radius: 12px; }
    .zq-auth-choice { min-height: 0; }
    #app .zq-client-workspace { padding-top: 16px; }
    #app .zq-client-hero { min-height: 0; border-radius: 10px !important; }
    #app .zq-client-hero h2 { font-size: 1.35rem; }

    /* Keep the primary controls comfortably tappable without enlarging dense
       tables or status chips. The same selectors cover the Client and Staff
       workspace headers, where touch navigation is most frequent. */
    #app .zq-topbar > div:first-child > button,
    #app .zq-client-hero button,
    #app .zq-page-header .zq-btn,
    #app .zq-modal-footer .zq-btn {
        min-height: 42px;
    }
}

/* Keep the portal entry experience aligned with the dark ZENQOR product
   identity. The light workspace treatment begins after the user signs in. */
.zq-auth-shell { background: #101827 !important; }
.zq-auth-landing {
    border-color: rgba(71, 85, 105, 0.82);
    background: #172235;
    box-shadow: 0 22px 52px rgba(0, 0, 0, 0.26);
}
.zq-auth-landing > .text-center h1 { color: #f8fafc !important; }
.zq-auth-landing > .text-center p { color: #a8b6c8 !important; }
.zq-auth-landing > .text-center span {
    border-color: rgba(45, 212, 191, 0.28) !important;
    background: rgba(20, 184, 166, 0.12) !important;
    color: #5eead4 !important;
}
.zq-auth-choice {
    border-color: #334155 !important;
    background: #1e293b !important;
}
.zq-auth-choice h2 { color: #f8fafc !important; }
.zq-auth-choice p { color: #a8b6c8 !important; }
.zq-auth-choice > span { color: #5eead4 !important; }
.zq-auth-choice:hover {
    border-color: #2dd4bf !important;
    background: #223047 !important;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.20) !important;
}

/* Print is always a light document, regardless of the active portal theme.
   This rule intentionally sits after all dark-mode compatibility rules. */
@media print {
    html.dark,
    html.dark body,
    html.dark #app {
        background: #ffffff !important;
        color: #0f172a !important;
    }
    html.dark #app .print-container {
        background: #ffffff !important;
        color: #0f172a !important;
    }
    html.dark #app .print-container .text-brand-dark,
    html.dark #app .print-container .text-slate-800,
    html.dark #app .print-container .text-slate-900 { color: #0f172a !important; }
    html.dark #app .print-container .text-slate-700 { color: #334155 !important; }
    html.dark #app .print-container .text-slate-500,
    html.dark #app .print-container .text-slate-600 { color: #64748b !important; }
    html.dark #app .print-container .text-brand-blue { color: #0f766e !important; }
    html.dark #app .print-container .text-brand-gold { color: #b45309 !important; }
    html.dark #app .print-container .text-emerald-700 { color: #047857 !important; }
    html.dark #app .print-container .bg-white { background-color: #ffffff !important; }
    html.dark #app .print-container .bg-slate-50 { background-color: #f8fafc !important; }
    html.dark #app .print-container .border-slate-200,
    html.dark #app .print-container .border-slate-300,
    html.dark #app .print-container .border-slate-400 { border-color: #cbd5e1 !important; }
    html.dark #app .print-container .print-table th,
    html.dark #app .print-container .print-total-box,
    html.dark #app .print-container .text-white {
        color: #ffffff !important;
    }
    html.dark #app .print-container .print-table th,
    html.dark #app .print-container .print-total-box {
        background-color: #0b1e36 !important;
    }
}

/* Quotation & invoice workspace — explicit paired surfaces prevent a stale
   Tailwind build from leaving a light panel inside the dark workspace. */
#app .zq-document-editor {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
}
.dark #app .zq-document-editor {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.26);
}

#app .zq-party-selector,
#app .zq-payment-details {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}
.dark #app .zq-party-selector,
.dark #app .zq-payment-details {
    border-color: #475569;
    background: #162235;
}
.zq-party-selector-title,
.zq-document-section-heading {
    color: #0f172a;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.zq-party-selector-title i { color: #0f766e; }
.zq-party-selector-help {
    margin-top: 4px;
    color: #64748b;
    font-size: 0.6875rem;
}
.dark #app .zq-party-selector-title,
.dark #app .zq-document-section-heading { color: #f8fafc; }
.dark #app .zq-party-selector-title i { color: #2dd4bf; }
.dark #app .zq-party-selector-help { color: #cbd5e1; }

#app .zq-party-selector-summary {
    border: 1px solid #dbe3ec;
    border-radius: 8px;
    background: #ffffff;
    color: #475569;
}
#app .zq-party-selector-summary span:first-child { color: #0f172a; }
.dark #app .zq-party-selector-summary {
    border-color: #475569;
    background: #253247;
    color: #cbd5e1;
}
.dark #app .zq-party-selector-summary span:first-child { color: #f8fafc; }

/* Premium workspace navigation: the sidebar is deliberately subdued so the
   selected module carries the visual emphasis, with a clear role distinction
   between internal staff (teal) and the Client Portal (blue). */
#app .zq-sidebar {
    background:
        radial-gradient(circle at 10% -4%, rgba(45, 212, 191, 0.16), transparent 19rem),
        linear-gradient(180deg, #17243a 0%, #121d30 48%, #0c1525 100%) !important;
    border-right-color: rgba(148, 163, 184, 0.20) !important;
    box-shadow: 16px 0 38px rgba(2, 8, 23, 0.26) !important;
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
}
#app .client-portal-theme {
    background:
        radial-gradient(circle at 10% -4%, rgba(96, 165, 250, 0.18), transparent 19rem),
        linear-gradient(180deg, #182541 0%, #111c32 48%, #0b1426 100%) !important;
}
#app .zq-sidebar-brand {
    min-height: 84px !important;
    padding: 17px 16px !important;
    position: relative;
    background: linear-gradient(125deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.015)) !important;
    border-bottom-color: rgba(148, 163, 184, 0.16) !important;
    flex-shrink: 0;
}
#app .zq-sidebar-brand::before {
    left: 16px !important;
    right: 16px !important;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, #2dd4bf 0%, #60a5fa 55%, transparent 100%) !important;
    opacity: 0.85 !important;
}
#app .client-portal-theme .zq-sidebar-brand::before {
    background: linear-gradient(90deg, #60a5fa 0%, #818cf8 55%, transparent 100%) !important;
}
#app .zq-sidebar-logo {
    width: 38px;
    height: 38px;
    padding: 5px !important;
    border-color: rgba(251, 191, 36, 0.30) !important;
    box-shadow: 0 8px 18px rgba(2, 8, 23, 0.32);
}
#app .zq-sidebar-logo img { max-height: 26px; }
#app .zq-sidebar-brand-copy h1 {
    letter-spacing: 0.035em !important;
    font-size: 0.78rem !important;
}
#app .zq-sidebar-brand-copy p {
    margin-top: 3px;
    color: #f4a261 !important;
    letter-spacing: 0.15em !important;
}
#app .client-portal-theme .zq-sidebar-brand-copy p { color: #fca5a5 !important; }
#app .zq-sidebar-collapse {
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 9px;
    background: rgba(15, 23, 42, 0.34);
    color: #94a3b8;
    font-size: 0.7rem;
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
#app .zq-sidebar-collapse:hover {
    transform: translateX(-1px);
    border-color: rgba(94, 234, 212, 0.48);
    background: rgba(45, 212, 191, 0.12);
    color: #e2e8f0;
}
#app .client-portal-theme .zq-sidebar-collapse:hover {
    border-color: rgba(147, 197, 253, 0.52);
    background: rgba(96, 165, 250, 0.14);
}
#app .zq-sidebar-nav {
    padding: 16px 12px !important;
    /* A zero flex basis reserves the available middle lane for menu items,
       rather than allowing their content height to swallow the footer. */
    flex: 1 1 0 !important;
    height: 0;
    min-height: 0;
    overflow-y: scroll !important;
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-color: rgba(125, 145, 171, 0.92) rgba(15, 23, 42, 0.20);
    scrollbar-gutter: stable;
    scrollbar-width: auto;
}
#app .zq-sidebar-nav::-webkit-scrollbar { width: 10px; }
#app .zq-sidebar-nav::-webkit-scrollbar-track {
    margin: 6px 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.20);
}
#app .zq-sidebar-nav::-webkit-scrollbar-thumb {
    border: 2px solid rgba(15, 23, 42, 0.20);
    border-radius: 999px;
    background: rgba(125, 145, 171, 0.92);
    background-clip: padding-box;
}
#app .zq-sidebar-nav::-webkit-scrollbar-thumb:hover { background-color: #cbd5e1; }
#app .zq-sidebar-nav > div { margin-top: 8px; }
#app .zq-sidebar-nav > div > p {
    margin: 0 7px 8px;
    color: #7f91ab !important;
    font-size: 0.59rem !important;
    letter-spacing: 0.17em !important;
}
#app .zq-nav-item {
    position: relative;
    min-height: 44px !important;
    padding: 9px 11px !important;
    border: 1px solid transparent !important;
    border-radius: 11px !important;
    color: #b7c5d7 !important;
    overflow: hidden;
    transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease !important;
}
#app .zq-nav-item::after {
    content: '';
    position: absolute;
    inset: 7px auto 7px 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: transparent;
    transition: background-color 160ms ease;
}
#app .zq-nav-item > i:first-child {
    display: inline-flex;
    width: 27px !important;
    height: 27px;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(148, 163, 184, 0.09);
    color: #9fb0c7;
    transition: background-color 160ms ease, color 160ms ease;
}
#app .zq-nav-item:hover {
    transform: translateX(2px);
    border-color: rgba(148, 163, 184, 0.18) !important;
    background: rgba(148, 163, 184, 0.12) !important;
    color: #f8fafc !important;
}
#app .zq-nav-item:hover > i:first-child {
    background: rgba(45, 212, 191, 0.14);
    color: #5eead4;
}
#app .client-portal-theme .zq-nav-item:hover > i:first-child {
    background: rgba(96, 165, 250, 0.16);
    color: #93c5fd;
}
#app .sidebar-item-active,
#app .client-portal-theme .sidebar-item-active {
    transform: none !important;
    background: linear-gradient(105deg, #0e766d 0%, #12958c 100%) !important;
    border-color: rgba(153, 246, 228, 0.30) !important;
    border-left-color: rgba(153, 246, 228, 0.30) !important;
    box-shadow: 0 8px 19px rgba(6, 78, 73, 0.30) !important;
    color: #ffffff !important;
}
#app .client-portal-theme .sidebar-item-active {
    background: linear-gradient(105deg, #1d4ed8 0%, #3567e9 100%) !important;
    border-color: rgba(191, 219, 254, 0.32) !important;
    box-shadow: 0 8px 19px rgba(30, 64, 175, 0.30) !important;
}
#app .sidebar-item-active::after { background: #f8fafc; }
#app .sidebar-item-active > i:first-child,
#app .client-portal-theme .sidebar-item-active > i:first-child {
    background: rgba(255, 255, 255, 0.16);
    color: #fef3c7;
}
#app .zq-sidebar-footer {
    padding: 14px 12px 16px !important;
    border-top-color: rgba(148, 163, 184, 0.16) !important;
    background: rgba(2, 8, 23, 0.15);
    flex-shrink: 0;
}
#app .zq-sidebar-signout {
    min-height: 42px;
    border: 1px solid rgba(251, 113, 133, 0.18);
    border-radius: 11px !important;
    background: rgba(190, 24, 93, 0.13) !important;
    color: #fda4af !important;
}
#app .zq-sidebar-signout:hover {
    border-color: rgba(251, 113, 133, 0.46);
    background: #be123c !important;
    color: #fff1f2 !important;
    box-shadow: 0 8px 18px rgba(159, 18, 57, 0.22);
}
@media (max-width: 767px) {
    #app .zq-sidebar { box-shadow: 18px 0 42px rgba(2, 8, 23, 0.48) !important; }
    #app .zq-sidebar-brand { min-height: 78px !important; }
    #app .zq-sidebar-nav { padding-top: 13px !important; }
}
