:root {
            /* Colors */
            --accent: #007AFF;
            --blue-lt: #E5F1FF;
            --surface: #FFFFFF;
            --surface2: #F5F7FA;
            --surface-hover: #E2E7EE;
            --sep: #E2E7EE;
            --label: #1C2B3A;
            --label4: #8A9BAE;
            --green: #34C759;
            --red: #FF3B30;
            --orange: #FF9500;
            --bg: #F0F2F5;

            /* Radius - more rounded */
            --r-sm: 8px;
            --r-md: 12px;
            --r-lg: 18px;
            --r-xl: 24px;

            /* Spacing */
            --sp-xs: 4px;
            --sp-sm: 8px;
            --sp-md: 16px;
            --sp-lg: 24px;
            --sp-xl: 32px;
        }

        :root.dark {
            --label: #F5F5F7;
            --label4: #8A9BAE;
            --bg: #111111;
            --surface: #1C1C1E;
            --surface2: #2C2C2E;
            --surface-hover: #3A3A3C;
            --sep: #3A3A3C;
        }

        * {
            box-sizing: border-box;
            margin: 0;
            padding: 0;
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
            -webkit-font-smoothing: antialiased;
        }

        body {
            background-color: var(--bg);
            color: var(--label);
            display: flex;
            height: 100vh;
            overflow: hidden;
        }

        /* Typography */
        h1,
        h2,
        h3 {
            font-weight: 600;
        }

        h1 {
            font-size: 24px;
            margin-bottom: var(--sp-md);
        }

        h2 {
            font-size: 20px;
            margin-bottom: var(--sp-sm);
        }

        p {
            font-size: 14px;
            line-height: 1.5;
            color: var(--label);
        }

        .text-muted {
            color: var(--label4);
        }

        .theme-btn {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            padding: 0;
            cursor: pointer;
            border: 2px solid transparent;
            transition: transform 0.2s;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        .theme-btn:hover {
            transform: scale(1.1);
        }

        /* Layout */
        .sidebar {
            width: 250px;
            background-color: var(--surface);
            border-right: 1px solid var(--sep);
            display: flex;
            flex-direction: column;
            padding: var(--sp-md);
        }

        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            padding: var(--sp-lg);
        }

        /* Views */
        .view {
            display: none;
            max-width: 1000px;
            margin: 0 auto;
            width: 100%;
            padding-bottom: 50px;
        }

        .view.active {
            display: block;
            animation: fadeIn 0.3s ease-out;
        }

        @keyframes fadeIn {
            from {
                opacity: 0;
                transform: translateY(5px);
            }

            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        /* Sidebar Nav */
        .nav-item {
            display: flex;
            align-items: center;
            padding: 10px 12px;
            border-radius: var(--r-md);
            margin-bottom: 4px;
            cursor: pointer;
            color: var(--label);
            font-weight: 500;
            font-size: 15px;
            transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
            text-decoration: none;
        }

        .nav-item:hover {
            background-color: var(--surface2);
            transform: translateX(4px);
        }

        .nav-item.active {
            background-color: var(--blue-lt);
            color: var(--accent);
            transform: translateX(4px);
        }

        .brand {
            font-size: 18px;
            font-weight: 700;
            margin-bottom: var(--sp-xl);
            display: flex;
            align-items: center;
            gap: 8px;
            color: var(--accent);
        }

        /* UI Components */
        /* Buttons */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 8px 16px;
            border-radius: var(--r-md);
            font-size: 14px;
            font-weight: 600;
            cursor: pointer;
            border: none;
            transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
            gap: 8px;
            font-family: inherit;
        }

        .btn:hover:not(:disabled) {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        }

        .btn:active:not(:disabled) {
            transform: translateY(1px);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
        }

        .btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        .btn-filled {
            background-color: var(--accent);
            color: white;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        }

        .btn-filled:hover:not(:disabled) {
            opacity: 0.95;
            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
        }

        .btn-plain {
            background-color: transparent;
            border: 1px solid var(--sep);
            color: var(--label);
        }

        .btn-plain:hover:not(:disabled) {
            background-color: var(--surface2);
            border-color: transparent;
        }

        .btn-success {
            background-color: var(--green);
            color: white;
        }

        .btn-danger {
            background-color: var(--red);
            color: white;
        }

        .btn-sm {
            padding: 4px 10px;
            font-size: 12px;
            border-radius: var(--r-sm);
        }

        /* Badges */
        .badge {
            display: inline-block;
            padding: 4px 8px;
            border-radius: var(--r-sm);
            font-size: 12px;
            font-weight: 600;
        }

        .b-paid {
            background-color: rgba(52, 199, 89, 0.15);
            color: #248A3D;
        }

        .b-open {
            background-color: rgba(255, 149, 0, 0.15);
            color: #B26800;
        }

        .b-draft {
            background-color: var(--surface-hover);
            color: var(--label);
        }

        .b-er {
            background-color: var(--blue-lt);
            color: var(--accent);
        }

        /* Forms */
        .form-group {
            margin-bottom: var(--sp-md);
        }

        .form-label {
            display: block;
            font-size: 13px;
            font-weight: 600;
            margin-bottom: 6px;
            color: var(--label);
        }

        .form-control {
            width: 100%;
            padding: 10px 12px;
            border-radius: var(--r-md);
            border: 1px solid var(--sep);
            font-size: 15px;
            background-color: var(--surface);
            color: var(--label);
            transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
            font-family: inherit;
        }

        .form-control:hover:not(:focus) {
            border-color: var(--label4);
        }

        .form-control:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px var(--blue-lt);
        }

        /* Grid */
        .grid-2 {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: var(--sp-md);
        }

        .grid-3 {
            display: grid;
            grid-template-columns: 1fr 1fr 1fr;
            gap: var(--sp-md);
        }

        /* Cards */
        .card {
            background-color: var(--surface);
            border-radius: var(--r-lg);
            border: 1px solid var(--sep);
            padding: var(--sp-lg);
            box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
            margin-bottom: var(--sp-md);
            transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        .card:hover {
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
            transform: translateY(-2px);
        }

        /* Tables & Lists */
        tbody tr {
            transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
        }

        tbody tr:hover {
            background-color: var(--surface2);
            transform: scale(1.005);
        }

        /* Dashboard KPI */
        .kpi-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: var(--sp-md);
            margin-bottom: var(--sp-lg);
        }

        .kpi-card {
            padding: var(--sp-md);
            background: var(--surface);
            border-radius: var(--r-md);
            border: 1px solid var(--sep);
        }

        .kpi-value {
            font-size: 28px;
            font-weight: 700;
            margin-top: 8px;
        }

        .kpi-label {
            font-size: 13px;
            color: var(--label4);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 600;
        }

        /* Toggles */
        .tp {
            position: relative;
            display: inline-block;
            width: 44px;
            height: 24px;
            vertical-align: middle;
        }

        .tp input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .tp-track {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: var(--sep);
            transition: .3s;
            border-radius: 24px;
        }

        .tp-track:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 2px;
            bottom: 2px;
            background-color: white;
            transition: .3s;
            border-radius: 50%;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }

        .tp input:checked+.tp-track {
            background-color: var(--green);
        }

        .tp input:checked+.tp-track:before {
            transform: translateX(20px);
        }

        /* Sheets (Slide-in right) */
        .sheet-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.4);
            z-index: 900;
            display: none;
            backdrop-filter: blur(2px);
        }

        .sheet-overlay.active {
            display: block;
            animation: fadeInOverlay 0.2s;
        }

        @keyframes fadeInOverlay {
            from {
                opacity: 0;
            }

            to {
                opacity: 1;
            }
        }

        .sheet {
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%) scale(0.95);
            opacity: 0;
            width: 500px;
            max-width: 90vw;
            max-height: 90vh;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            z-index: 1000;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
            border-radius: var(--r-xl);
            display: flex;
            flex-direction: column;
            pointer-events: none;
            transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.2), opacity 0.2s ease-out;
        }

        .sheet-wide {
            width: 800px;
        }

        .sheet.active {
            transform: translate(-50%, -50%) scale(1);
            opacity: 1;
            pointer-events: auto;
        }

        .sheet-header {
            padding: var(--sp-md) var(--sp-lg);
            border-bottom: 1px solid var(--sep);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .sheet-content {
            padding: var(--sp-lg);
            overflow-y: auto;
            flex: 1;
        }

        .sheet-footer {
            padding: var(--sp-md) var(--sp-lg);
            border-top: 1px solid var(--sep);
            display: flex;
            justify-content: flex-end;
            gap: 10px;
            background: var(--surface);
            margin-top: auto;
        }

        /* Toast */
        #toast-container {
            position: fixed;
            bottom: 20px;
            right: 20px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            z-index: 2000;
        }

        .toast {
            min-width: 250px;
            padding: 12px 16px;
            border-radius: var(--r-md);
            color: white;
            font-size: 14px;
            font-weight: 500;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            animation: slideIn 0.3s ease-out;
            display: flex;
            align-items: center;
            gap: 10px;
            background-color: var(--label);
        }

        .toast.success {
            background-color: var(--green);
        }

        .toast.error {
            background-color: var(--red);
        }

        @keyframes slideIn {
            from {
                transform: translateX(100%);
                opacity: 0;
            }

            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        /* Spacer */
        .flex-grow {
            flex: 1;
        }

        /* Utilities */
        .color-preview {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            display: inline-block;
            vertical-align: middle;
            border: 2px solid white;
            box-shadow: 0 0 0 1px var(--sep);
        }
