/* CrewTime base: tokens, resets, global foundations */
        :root {
            --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
            --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
            --dur-1: 120ms;
            --dur-2: 220ms;
            --dur-3: 420ms;
            --ring: 0 0 0 4px rgba(15, 23, 42, 0.08);
            --shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.08);
            --header-surface: #f3f6fb;
            --header-border: #d7e0ec;

            /* Design System Tokens */
            --space-1: 4px;
            --space-2: 8px;
            --space-3: 12px;
            --space-4: 16px;
            --space-5: 20px;
            --space-6: 24px;
            --space-8: 32px;
            --space-10: 40px;
            --space-12: 48px;

            --radius-sm: 8px;
            --radius-md: 12px;
            --radius-lg: 16px;
            --radius-xl: 20px;
            --radius-full: 9999px;

            --border-light: #e2e8f0;
            --border-medium: #cbd5e1;
            --border-dark: #94a3b8;

            --text-primary: #0f172a;
            --text-secondary: #475569;
            --text-tertiary: #475569;

            --surface: #ffffff;
            --surface-secondary: #f8fafc;
            --surface-hover: #f1f5f9;

            --shadow-xs: 0 2px 8px rgba(15, 23, 42, 0.04);
            --shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.06);
            --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.08);
            --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);
            --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.16);

            --z-base: 1;
            --z-dropdown: 100;
            --z-sticky: 200;
            --z-header: 300;
            --z-overlay: 400;
            --z-modal: 500;
            --z-toast: 600;

            --text-xs: 11px;
            --text-sm: 13px;
            --text-base: 15px;
            --text-lg: 18px;
            --text-xl: 22px;
            --text-2xl: 28px;
            --text-3xl: 36px;
        }

        html {
            scroll-behavior: auto;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .hidden {
            display: none !important;
        }

        /* Stability-first mode for low-power Chrome devices. */
        html.perf-lite *,
        html.perf-lite *::before,
        html.perf-lite *::after {
            animation: none !important;
            transition: none !important;
        }

        html.perf-lite .site-header,
        html.perf-lite .page-section,
        html.perf-lite .account-card,
        html.perf-lite .create-job-shell,
        html.perf-lite .jobs-table,
        html.perf-lite .job-summary-content,
        html.perf-lite .tool-card,
        html.perf-lite .toast {
            backdrop-filter: none !important;
            -webkit-backdrop-filter: none !important;
            box-shadow: none !important;
            filter: none !important;
        }

        html.perf-lite .jobs-table tbody tr {
            animation: none !important;
            opacity: 1 !important;
        }

        html.perf-lite body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
        }

        body {
            font-family: 'Plus Jakarta Sans', 'Space Grotesk', sans-serif;
            background: #ffffff;
            min-height: 100vh;
            color: #1a1a1a;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
            text-rendering: optimizeLegibility;
        }

        body.dark-mode {
            background: #0b0f14;
            color: #e5e7eb;
        }

        body.dark-mode .page-section,
        body.dark-mode .account-card,
        body.dark-mode .create-job-shell,
        body.dark-mode .jobs-table tbody tr,
        body.dark-mode .tool-card,
        body.dark-mode .summary-live-invoice,
        body.dark-mode .invoice-preview-card,
        body.dark-mode .calc-entry-panel,
        body.dark-mode .calc-estimate-panel,
        body.dark-mode .calc-section,
        body.dark-mode .saved-days-panel,
        body.dark-mode .job-summary-content,
        body.dark-mode .summary-kpi {
            background: rgba(15, 23, 42, 0.72);
            border-color: #243244;
            color: #e5e7eb;
            box-shadow:
                0 18px 34px rgba(2, 6, 23, 0.34),
                inset 0 1px 0 rgba(148, 163, 184, 0.14);
        }

        body.dark-mode .hero-subtitle,
        body.dark-mode .settings-note,
        body.dark-mode .account-info-label,
        body.dark-mode .account-email,
        body.dark-mode .job-day-row-date,
        body.dark-mode .job-day-detail-label {
            color: #94a3b8;
        }

        body.dark-mode h1,
        body.dark-mode h2,
        body.dark-mode h3,
        body.dark-mode .account-name,
        body.dark-mode .account-info-value,
        body.dark-mode .tool-card-content h3 {
            color: #f8fafc;
        }

        body.dark-mode input,
        body.dark-mode select,
        body.dark-mode textarea,
        body.dark-mode .settings-panel,
        body.dark-mode .checkbox-group,
        body.dark-mode .create-client-block,
        body.dark-mode .account-dropdown {
            background: #0f172a;
            border-color: #334155;
            color: #e5e7eb;
        }

        body.dark-mode .saved-days-summary {
            background: #0f172a;
            border-bottom-color: #334155;
            color: #e2e8f0;
        }

        body.dark-mode .saved-days-job {
            background: #1e293b;
            color: #e3efe9;
        }

        body.dark-mode .dropdown-item {
            color: #e5e7eb;
        }

        body.dark-mode .dropdown-header {
            border-bottom-color: #334155;
        }

        body.dark-mode .dropdown-user-name {
            color: #f8fafc;
        }

        body.dark-mode .dropdown-user-email {
            color: #94a3b8;
        }

        body.dark-mode .dropdown-item:hover {
            background: #1e293b;
        }

        body.dark-mode {
            --header-surface: #0f172a;
            --header-border: rgba(148, 163, 184, 0.24);
        }

        body.dark-mode .site-header {
            background: var(--header-surface);
            border-bottom: 1px solid var(--header-border);
        }

        body.dark-mode .header-nav-btn,
        body.dark-mode .mobile-search-btn,
        body.dark-mode .mobile-menu-btn,
        body.dark-mode .mobile-nav-item,
        body.dark-mode .account-subnav-btn {
            background: #1e293b;
            border-color: #334155;
            color: #e2e8f0;
        }

        body.dark-mode .header-nav-btn.active,
        body.dark-mode .mobile-nav-item.active,
        body.dark-mode .account-subnav-btn.active {
            background: #f8fafc;
            color: #0f172a;
            border-color: #f8fafc;
        }

        body.dark-mode .header-page-indicator {
            background: #111c31;
            border-bottom-color: #334155;
            color: #93a6bf;
        }

        body.dark-mode .mobile-nav-panel {
            border-color: #334155;
            background: rgba(15, 23, 42, 0.97);
            box-shadow: 0 14px 28px rgba(2, 6, 23, 0.5);
        }

        body.dark-mode .header-search {
            background: rgba(15, 23, 42, 0.98);
            border-color: #334155;
            color: #e2e8f0;
            box-shadow: none;
        }

        body.dark-mode .header-search::placeholder {
            color: #93a6bf;
        }

        body.dark-mode .header-search-results {
            background: rgba(15, 23, 42, 0.98);
            border-color: #334155;
            box-shadow: 0 14px 28px rgba(2, 6, 23, 0.5);
        }

        body.dark-mode .header-search-item {
            color: #e2e8f0;
        }

        body.dark-mode .header-search-item:hover,
        body.dark-mode .header-search-item.active {
            background: #1e293b;
        }

        body.dark-mode .header-search-item .meta,
        body.dark-mode .header-search-empty {
            color: #93a6bf;
        }

        body.dark-mode .logo {
            color: #f8fafc;
        }

        body.dark-mode .logo:hover {
            opacity: 0.85;
        }

        body.dark-mode .tool-card:hover {
            border-color: #3b4b63;
            box-shadow: 0 10px 24px rgba(2, 6, 23, 0.38);
        }

        body.dark-mode .tool-card-icon {
            background: #1e293b;
            color: #e2e8f0;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
        }

        body.dark-mode .tool-card-content p {
            color: #98a8bd;
        }

        body.dark-mode .tool-card-metric {
            color: #f8fafc;
        }

        body.dark-mode .tool-card-submetric {
            color: #8da0ba;
        }

        body.dark-mode .home-btn {
            background: #1e293b;
            color: #e2e8f0;
            border-color: #334155;
        }

        body.dark-mode .home-btn:hover {
            background: #273449;
        }

        body.dark-mode .job-summary-section .home-btn {
            background: rgba(15, 23, 42, 0.9);
            border-color: #334155;
            color: #e2e8f0;
        }

        body.dark-mode .auth-btn {
            background: #0f172a;
            color: #e2e8f0;
            border-color: #334155;
        }

        body.dark-mode .auth-btn:hover {
            background: #1e293b;
        }

        body.dark-mode .auth-btn.primary {
            background: #e2e8f0;
            color: #0f172a;
            box-shadow: none;
        }

        body.dark-mode .auth-btn.primary:hover {
            background: #f8fafc;
            box-shadow: none;
        }

        body.dark-mode .jobs-filter-select {
            background: #0f172a;
            color: #cbd5e1;
            border-color: #334155;
        }

        body.dark-mode .summary-expenses-card {
            background: #111827;
            border-color: #334155;
        }

        body.dark-mode .summary-expenses-title {
            color: #f8fafc;
        }

        body.dark-mode .summary-expenses-subtitle,
        body.dark-mode .summary-expense-empty {
            color: #94a3b8;
        }

        body.dark-mode .summary-expense-item {
            background: #0f172a;
            border-color: #334155;
            color: #e2e8f0;
        }

        body.dark-mode .summary-expenses-head {
            background: #0f172a;
            border-color: #334155;
            color: #94a3b8;
        }

        body.dark-mode .summary-expense-amount {
            color: #f8fafc;
        }

        body.dark-mode .summary-expense-remove {
            color: #94a3b8;
        }

        body.dark-mode .summary-expense-remove:hover {
            color: #f87171;
        }

        body.dark-mode .job-summary-total-row {
            color: #a5b4c7;
        }

        body.dark-mode .job-summary-total-row strong {
            color: #93c5fd;
        }


        .container {
            width: 100%;
            max-width: none;
            margin: 0;
            padding: 0 0 48px;
        }

        h1 {
            color: #000000;
            font-size: 46px;
            font-weight: 800;
            letter-spacing: -1.5px;
            line-height: 1.1;
        }

        .page-header {
            display: grid;
            gap: var(--space-2);
            margin-bottom: var(--space-5);
        }

        .page-header-centered {
            text-align: center;
            justify-items: center;
        }

        .page-title {
            margin: 0;
            font-size: clamp(28px, 4vw, 38px);
            line-height: 1.08;
            letter-spacing: -0.03em;
            color: var(--text-primary);
            font-weight: 800;
        }

        .page-subtitle {
            margin: 0;
            font-size: var(--text-base);
            line-height: 1.55;
            color: var(--text-tertiary);
            max-width: 62ch;
        }

        .btn-primary,
        .btn-secondary,
        .btn-ghost {
            border-radius: var(--radius-full);
            font-weight: 700;
            border: 1px solid transparent;
            transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease-in-out), border-color var(--dur-2) var(--ease-in-out), color var(--dur-2) var(--ease-in-out);
        }

        .btn-primary {
            background: linear-gradient(130deg, #0b1220 0%, #1e3a8a 50%, #0891b2 100%);
            border-color: rgba(15, 23, 42, 0.86);
            color: #f8fafc;
            box-shadow:
                0 16px 30px rgba(2, 6, 23, 0.24),
                inset 0 1px 0 rgba(255, 255, 255, 0.22);
        }

        .btn-primary:hover {
            transform: translateY(-2px);
            box-shadow:
                0 20px 34px rgba(2, 6, 23, 0.28),
                inset 0 1px 0 rgba(255, 255, 255, 0.24);
        }

        .btn-secondary {
            background: linear-gradient(130deg, rgba(255, 255, 255, 0.9), rgba(235, 247, 255, 0.78));
            border-color: rgba(191, 219, 254, 0.9);
            color: #0f172a;
            box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
        }

        .btn-secondary:hover {
            background: rgba(255, 255, 255, 0.9);
            border-color: rgba(148, 163, 184, 0.5);
            transform: translateY(-1px);
        }

        .btn-ghost {
            background: var(--surface-secondary);
            color: var(--text-primary);
            border-color: var(--border-light);
            box-shadow: var(--shadow-sm);
        }

        .btn-ghost:hover {
            background: var(--surface-hover);
            transform: translateY(-1px);
            box-shadow: var(--shadow-md);
        }

        .nav-back-btn {
            width: auto;
            margin: 0;
            padding: var(--space-2) var(--space-3);
            font-size: var(--text-sm);
            line-height: 1;
        }

        .site-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: var(--space-3) 5%;
            background: var(--header-surface);
            border-bottom: 1px solid var(--header-border);
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
            position: sticky;
            top: 0;
            z-index: var(--z-header);
            box-shadow: var(--shadow-sm);
        }

        .header-search-wrap {
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            width: min(480px, 40vw);
            z-index: calc(var(--z-header) + 10);
            padding: 4px;
            border-radius: 12px;
            background: rgba(255, 255, 255, 0.96);
            box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
        }

        .header-search {
            width: 100%;
            height: 40px;
            border: 1px solid var(--border-light);
            border-radius: var(--radius-md);
            background: var(--surface-secondary);
            color: var(--text-primary);
            font-size: var(--text-sm);
            font-weight: 600;
            padding: 0 var(--space-3);
            box-shadow: var(--shadow-sm);
            transition: border-color var(--dur-2) var(--ease-in-out), box-shadow var(--dur-2) var(--ease-in-out), background var(--dur-2) var(--ease-in-out);
        }

        .header-search:focus {
            outline: none;
            border-color: var(--text-primary);
            background: var(--surface);
            box-shadow: var(--ring), var(--shadow-md);
        }

        .header-search::placeholder {
            color: #7b8aa2;
            font-weight: 600;
        }

        .header-search-results {
            position: absolute;
            top: calc(100% + var(--space-2));
            left: 0;
            right: 0;
            background: var(--surface);
            border: 1px solid var(--border-light);
            border-radius: var(--radius-md);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }

        .header-search-item {
            width: 100%;
            border: none;
            background: transparent;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 12px;
            padding: 10px 12px;
            color: #0f172a;
            font-size: 13px;
            font-weight: 700;
            cursor: pointer;
            text-align: left;
        }

        .header-search-item:hover,
        .header-search-item.active {
            background: #eff5ff;
        }

        .header-search-item .meta {
            color: #64748b;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.4px;
            white-space: nowrap;
        }

        .header-search-empty {
            padding: 10px 12px;
            font-size: 12px;
            color: #64748b;
            font-weight: 700;
        }

        .logo {
            font-family: 'Space Grotesk', 'Plus Jakarta Sans', sans-serif;
            font-size: 21px;
            font-weight: 750;
            letter-spacing: -0.5px;
            color: #000000;
            cursor: pointer;
            transition: opacity 0.2s ease;
            border: none;
            background: transparent;
            padding: 0;
            line-height: 1;
            width: auto;
            margin-top: 0;
            box-shadow: none;
            display: inline-block;
            white-space: nowrap;
        }

.logo:hover {
    opacity: 0.7;
    background: transparent;
    box-shadow: none;
    transform: none;
}

#logo-home-btn:hover,
#logo-home-btn:focus-visible {
    background: transparent !important;
    box-shadow: none !important;
    color: inherit;
}

        .header-nav {
            display: flex;
            align-items: center;
            gap: 8px;
            margin-left: 12px;
        }

        .header-nav-btn {
            border: 1px solid #d6dbe3;
            background: rgba(255, 255, 255, 0.88);
            color: #0f172a;
            border-radius: 999px;
            padding: 8px 12px;
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            line-height: 1;
            transition: background var(--dur-2) var(--ease-in-out), border-color var(--dur-2) var(--ease-in-out), transform var(--dur-2) var(--ease-out);
        }

        .header-nav-btn:hover {
            background: #eef2f7;
            border-color: #c7d2e2;
            transform: translateY(-1px);
        }

        .header-nav-btn.active {
            background: #e8f1ff;
            color: #0f172a;
            border-color: #c5ddd2;
        }

        .header-page-indicator {
            position: sticky;
            top: 66px;
            z-index: 250;
            margin: 0;
            padding: 8px 5%;
            font-size: 12px;
            text-transform: uppercase;
            letter-spacing: 0.7px;
            font-weight: 700;
            color: #64748b;
            background: #eef3fa;
            border-bottom: 1px solid #d7e0ec;
            backdrop-filter: none;
            -webkit-backdrop-filter: none;
        }

        .visually-hidden {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
            border: 0;
        }

        .page-section {
            background: #ffffff;
            border: none;
            border-radius: 0;
            padding: 56px 5% 24px;
            box-shadow: none;
            margin-top: 0;
            position: relative;
            transform: translateZ(0);
        }

        .section-enter {
            animation: sectionEnter 200ms var(--ease-out) both;
        }

        .section-enter > .ct-page-head,
        .section-enter > .ct-controls-card,
        .section-enter > .ct-grid,
        .section-enter > .ct-list,
        .section-enter > .ct-card-grid,
        .section-enter > .ct-content-area,
        .section-enter > .ct-page-body,
        .section-enter > [class*="analytics"],
        .section-enter > .ct-date-pills-row {
            animation: sectionChildIn 200ms var(--ease-out) both;
        }

        .section-enter > :nth-child(1) { animation-delay: 0ms; }
        .section-enter > :nth-child(2) { animation-delay: 40ms; }
        .section-enter > :nth-child(3) { animation-delay: 80ms; }
        .section-enter > :nth-child(4) { animation-delay: 110ms; }
        .section-enter > :nth-child(5) { animation-delay: 130ms; }

        @keyframes sectionEnter {
            from {
                opacity: 0;
            }
            to {
                opacity: 1;
            }
        }

        @keyframes sectionChildIn {
            from {
                opacity: 0;
                transform: translateY(6px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .tools-section.tools-animate .tool-card {
            animation: cardIn var(--dur-2) var(--ease-out) both;
        }

        .tools-section .tool-card {
            transform: translateY(6px);
            opacity: 0;
        }

        .tools-section.tools-animate .tool-card:nth-child(1) { animation-delay: 0ms; }
        .tools-section.tools-animate .tool-card:nth-child(2) { animation-delay: 35ms; }
        .tools-section.tools-animate .tool-card:nth-child(3) { animation-delay: 70ms; }
        .tools-section.tools-animate .tool-card:nth-child(4) { animation-delay: 105ms; }
        .tools-section.tools-animate .tool-card:nth-child(5) { animation-delay: 140ms; }
        .tools-section.tools-animate .tool-card:nth-child(6) { animation-delay: 175ms; }

        @keyframes cardIn {
            from {
                opacity: 0;
                transform: translateY(6px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @media (prefers-reduced-motion: reduce) {
            .section-enter,
            .section-enter > *,
            .tools-section.tools-animate .tool-card {
                animation: none !important;
                opacity: 1 !important;
                transform: none !important;
            }
        }

        /* Global checkbox polish */
        body input[type="checkbox"] {
            appearance: none !important;
            -webkit-appearance: none !important;
            width: 11px !important;
            height: 11px !important;
            margin: 0;
            border: 1.5px solid #334155 !important;
            border-radius: 3px !important;
            background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%) !important;
            box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
            display: inline-grid;
            place-content: center;
            vertical-align: middle;
            cursor: pointer;
        }

        body input[type="checkbox"]::before {
            content: "";
            width: 3px;
            height: 6px;
            border-right: 1.6px solid #0f172a;
            border-bottom: 1.6px solid #0f172a;
            transform: rotate(45deg) scale(0);
            transform-origin: center;
            transition: transform 120ms ease-in-out;
        }

        body input[type="checkbox"]:checked {
            border-color: #0f172a !important;
            background: linear-gradient(180deg, #ffffff 0%, #e8eef7 100%) !important;
        }

        body input[type="checkbox"]:checked::before {
            transform: rotate(45deg) scale(1);
        }

        body input[type="checkbox"]:focus-visible {
            outline: 2px solid rgba(59, 130, 246, 0.28);
            outline-offset: 1px;
        }
