:root {
            --primary: #1a6b4a;
            --primary-dark: #145539;
            --primary-light: #e8f5ee;
            --sidebar-bg: #0f3d2b;
            --sidebar-text: #c5ddd1;
            --sidebar-active: #1a6b4a;
            --sidebar-hover: rgba(255,255,255,0.08);
            --bg: #f4f6f8;
            --card-bg: #ffffff;
            --text: #1a1a2e;
            --text-muted: #6b7280;
            --border: #e5e7eb;
            --error: #dc3545;
            --error-bg: #fef2f2;
            --success: #16a34a;
            --warning: #f59e0b;
            --info: #3b82f6;
            --badge-new: #3b82f6;
            --badge-contacted: #f59e0b;
            --badge-converted: #16a34a;
            --badge-lost: #dc3545;
            --sidebar-width: 240px;
            --header-height: 56px;
        }

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

        body {
            font-family: 'Inter', system-ui, -apple-system, sans-serif;
            background: var(--bg);
            color: var(--text);
            line-height: 1.5;
            -webkit-font-smoothing: antialiased;
        }

        a {
            color: var(--primary);
            text-decoration: none;
        }

        a:focus-visible,
        button:focus-visible,
        input:focus-visible,
        select:focus-visible {
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        /* ---- Login screen ---- */
        .login-overlay {
            position: fixed;
            inset: 0;
            background: var(--bg);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 9999;
        }

        .login-overlay[hidden] {
            display: none;
        }

        .login-card {
            background: var(--card-bg);
            border-radius: 12px;
            padding: 40px 32px;
            width: 100%;
            max-width: 400px;
            box-shadow: 0 4px 24px rgba(0,0,0,0.08);
            text-align: center;
        }

        .login-card h1 {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--primary-dark);
            margin-bottom: 8px;
        }

        .login-card p {
            color: var(--text-muted);
            margin-bottom: 24px;
            font-size: 1rem;
        }

        .login-card .form-group {
            text-align: left;
            margin-bottom: 16px;
        }

        .login-card label {
            display: block;
            font-size: 1rem;
            font-weight: 500;
            margin-bottom: 6px;
            color: var(--text);
        }

        .login-card input {
            width: 100%;
            padding: 10px 12px;
            border: 1px solid var(--border);
            border-radius: 8px;
            font-size: 1rem;
            font-family: inherit;
            transition: border-color 0.15s;
        }

        .login-card input:focus {
            border-color: var(--primary);
        }

        .login-card .login-error {
            color: var(--error);
            font-size: 1rem;
            margin-bottom: 12px;
            min-height: 1.2em;
        }

        .login-card button {
            width: 100%;
            padding: 10px 16px;
            background: var(--primary);
            color: #fff;
            border: none;
            border-radius: 8px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            font-family: inherit;
            transition: background 0.15s;
        }

        .login-card button:hover {
            background: var(--primary-dark);
        }

        .login-card button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .login-card .btn-secondary {
            margin-top: 8px;
            background: #fff;
            color: var(--primary);
            border: 1px solid var(--primary);
        }

        .login-card .login-success {
            margin-top: 12px;
            color: var(--primary);
            text-align: center;
            font-weight: 600;
        }

        .login-card .brand-mark {
            margin: 0 auto 16px;
        }

        /* ---- Layout shell ---- */
        .app-wrapper {
            display: flex;
            min-height: 100vh;
        }

        .app-wrapper[hidden] {
            display: none;
        }

        /* ---- Sidebar ---- */
        .sidebar {
            width: var(--sidebar-width);
            background: var(--sidebar-bg);
            color: var(--sidebar-text);
            display: flex;
            flex-direction: column;
            position: fixed;
            top: 0;
            left: 0;
            bottom: 0;
            z-index: 100;
            transition: transform 0.25s ease;
        }

        .sidebar-brand {
            padding: 16px 20px;
            display: flex;
            align-items: center;
            gap: 10px;
            border-bottom: 1px solid rgba(255,255,255,0.1);
        }

        .sidebar-brand-icon {
            width: 32px;
            height: 32px;
            background: var(--primary);
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .sidebar-brand-icon svg {
            width: 18px;
            height: 18px;
            color: #fff;
        }

        .sidebar-brand-text {
            font-weight: 700;
            font-size: 1rem;
            color: #fff;
        }

        .sidebar-nav {
            flex: 1;
            padding: 12px 8px;
            list-style: none;
        }

        .sidebar-nav li {
            margin-bottom: 2px;
        }

        .sidebar-nav button {
            width: 100%;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            border: none;
            border-radius: 8px;
            background: transparent;
            color: var(--sidebar-text);
            font-size: 1rem;
            font-family: inherit;
            cursor: pointer;
            transition: background 0.15s, color 0.15s;
            text-align: left;
        }

        .sidebar-nav button:hover {
            background: var(--sidebar-hover);
            color: #fff;
        }

        .sidebar-nav button.active {
            background: var(--sidebar-active);
            color: #fff;
            font-weight: 600;
        }

        .sidebar-nav button svg {
            width: 18px;
            height: 18px;
            flex-shrink: 0;
        }

        .sidebar-footer {
            padding: 12px 8px;
            border-top: 1px solid rgba(255,255,255,0.1);
        }

        .sidebar-footer button {
            width: 100%;
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 12px;
            border: none;
            border-radius: 8px;
            background: transparent;
            color: var(--sidebar-text);
            font-size: 1rem;
            font-family: inherit;
            cursor: pointer;
            transition: background 0.15s;
        }

        .sidebar-footer button:hover {
            background: rgba(220,53,69,0.15);
            color: #f87171;
        }

        .sidebar-footer button svg {
            width: 18px;
            height: 18px;
        }

        /* ---- Main content ---- */
        .main-content {
            flex: 1;
            margin-left: var(--sidebar-width);
            min-width: 0;
            min-height: 100vh;
        }

        .topbar {
            height: var(--header-height);
            background: var(--card-bg);
            border-bottom: 1px solid var(--border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24px;
            position: sticky;
            top: 0;
            z-index: 50;
        }

        .topbar-left {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .hamburger-btn {
            display: none;
            width: 44px;
            height: 44px;
            align-items: center;
            justify-content: center;
            background: none;
            border: none;
            cursor: pointer;
            padding: 10px;
            color: var(--text);
        }

        .hamburger-btn svg {
            width: 24px;
            height: 24px;
        }

        .topbar h2 {
            font-size: 1.125rem;
            font-weight: 600;
        }

        .topbar-right {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 1rem;
            color: var(--text-muted);
        }

        .status-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--success);
            display: inline-block;
        }

        .page-content {
            padding: 24px;
            max-width: 1440px;
        }

        /* ---- Stat cards ---- */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 16px;
            margin-bottom: 32px;
        }

        .stat-card {
            background: var(--card-bg);
            border-radius: 10px;
            padding: 20px;
            border: 1px solid var(--border);
        }

        .stat-card-value {
            font-size: 2rem;
            font-weight: 700;
            color: var(--primary-dark);
            line-height: 1.2;
        }

        .stat-card-label {
            font-size: 1rem;
            color: var(--text-muted);
            margin-top: 4px;
        }

        /* ---- Tables ---- */
        .table-section {
            background: var(--card-bg);
            border-radius: 10px;
            border: 1px solid var(--border);
            overflow: hidden;
        }

        .table-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 16px 20px;
            border-bottom: 1px solid var(--border);
            flex-wrap: wrap;
            gap: 12px;
        }

        .table-header h3 {
            font-size: 1rem;
            font-weight: 600;
        }

        .table-filters {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .table-filters select {
            padding: 6px 10px;
            border: 1px solid var(--border);
            border-radius: 6px;
            font-size: 1rem;
            font-family: inherit;
            background: var(--card-bg);
            color: var(--text);
        }

        .table-scroll {
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            font-size: 1rem;
        }

        thead {
            background: #f9fafb;
        }

        th {
            text-align: left;
            padding: 10px 16px;
            font-weight: 600;
            font-size: 1rem;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            white-space: nowrap;
            border-bottom: 1px solid var(--border);
        }

        td {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border);
            vertical-align: middle;
        }

        tbody tr:hover {
            background: #f9fafb;
        }

        tbody tr:last-child td {
            border-bottom: none;
        }

        .empty-row td {
            text-align: center;
            color: var(--text-muted);
            padding: 32px 16px;
            font-style: italic;
        }

        /* ---- Badges ---- */
        .badge {
            display: inline-block;
            padding: 3px 10px;
            border-radius: 9999px;
            font-size: 1rem;
            font-weight: 600;
            line-height: 1.4;
            white-space: nowrap;
        }

        .badge-new {
            background: #dbeafe;
            color: #1d4ed8;
        }

        .badge-contacted {
            background: #fef3c7;
            color: #92400e;
        }

        .badge-converted {
            background: #d1fae5;
            color: #065f46;
        }

        .badge-lost {
            background: #fee2e2;
            color: #991b1b;
        }

        .badge-active {
            background: #d1fae5;
            color: #065f46;
        }

        .badge-pending {
            background: #fef3c7;
            color: #92400e;
        }

        .badge-suspended {
            background: #fee2e2;
            color: #991b1b;
        }

        /* ---- Action buttons ---- */
        .btn {
            display: inline-flex;
            align-items: center;
            gap: 4px;
            padding: 6px 12px;
            border: none;
            border-radius: 6px;
            font-size: 1rem;
            font-weight: 600;
            font-family: inherit;
            cursor: pointer;
            transition: background 0.15s, opacity 0.15s;
            white-space: nowrap;
        }

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

        .btn-activate {
            background: #d1fae5;
            color: #065f46;
        }

        .btn-activate:hover:not(:disabled) {
            background: #a7f3d0;
        }

        .btn-suspend {
            background: #fee2e2;
            color: #991b1b;
        }

        .btn-suspend:hover:not(:disabled) {
            background: #fecaca;
        }

        /* ---- Pagination ---- */
        .pagination {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 20px;
            border-top: 1px solid var(--border);
            font-size: 1rem;
            color: var(--text-muted);
            flex-wrap: wrap;
            gap: 8px;
        }

        .pagination-controls {
            display: flex;
            gap: 4px;
        }

        .pagination-controls button {
            padding: 6px 12px;
            border: 1px solid var(--border);
            border-radius: 6px;
            background: var(--card-bg);
            color: var(--text);
            font-size: 1rem;
            font-family: inherit;
            cursor: pointer;
            transition: background 0.15s;
        }

        .pagination-controls button:hover:not(:disabled) {
            background: var(--bg);
        }

        .pagination-controls button:disabled {
            opacity: 0.4;
            cursor: not-allowed;
        }

        .pagination-controls button.active-page {
            background: var(--primary);
            color: #fff;
            border-color: var(--primary);
        }

        /* ---- Loading / error states ---- */
        .loading-spinner {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 48px;
            color: var(--text-muted);
            gap: 8px;
            font-size: 1rem;
        }

        .spinner {
            width: 20px;
            height: 20px;
            border: 2px solid var(--border);
            border-top-color: var(--primary);
            border-radius: 50%;
            animation: spin 0.6s linear infinite;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        .error-banner {
            background: var(--error-bg);
            color: var(--error);
            padding: 12px 16px;
            border-radius: 8px;
            font-size: 1rem;
            margin-bottom: 16px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .error-banner[hidden] {
            display: none;
        }

        /* ---- Expandable row ---- */
        .expand-row td {
            padding: 0;
            border-bottom: 1px solid var(--border);
        }

        .expand-content {
            padding: 16px 20px;
            background: #f9fafb;
            font-size: 1rem;
        }

        .expand-content dl {
            display: grid;
            grid-template-columns: 140px 1fr;
            gap: 6px 12px;
        }

        .expand-content dt {
            font-weight: 600;
            color: var(--text-muted);
        }

        .expand-content dd {
            color: var(--text);
            word-break: break-word;
        }

        /* ---- Sidebar overlay (mobile) ---- */
        .sidebar-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.4);
            z-index: 99;
        }

        .sidebar-overlay.visible {
            display: block;
        }

        /* ---- Responsive ---- */
        @media (max-width: 1023px) {
            .sidebar {
                transform: translateX(-100%);
            }

            .sidebar.open {
                transform: translateX(0);
            }

            .main-content {
                margin-left: 0;
            }

            .hamburger-btn {
                display: inline-flex;
            }

            .page-content {
                padding: 16px;
            }

            .stats-grid {
                grid-template-columns: repeat(2, 1fr);
            }
        }

        @media (max-width: 767px) {
            .stats-grid {
                grid-template-columns: 1fr;
            }

            .table-header {
                flex-direction: column;
                align-items: flex-start;
            }
        }

        /* ---- Skip to content ---- */
        .skip-link {
            position: absolute;
            top: -100px;
            left: 0;
            background: var(--primary);
            color: #fff;
            padding: 8px 16px;
            z-index: 10000;
            border-radius: 0 0 8px 0;
            font-size: 1rem;
        }

        .skip-link:focus {
            top: 0;
        }

        /* ---- Visually hidden (screen reader only) ---- */
        .sr-only {
            position: absolute;
            width: 1px;
            height: 1px;
            padding: 0;
            margin: -1px;
            overflow: hidden;
            clip: rect(0,0,0,0);
            white-space: nowrap;
            border: 0;
        }
