        :root {
            --primary-50: #f0f9ff;
            --primary-100: #e0f2fe;
            --primary-200: #bae6fd;
            --primary-300: #7dd3fc;
            --primary-400: #38bdf8;
            --primary-500: #0ea5e9;
            --primary-600: #0284c7;
            --primary-700: #0369a1;
            --primary-800: #075985;
            --primary-900: #0c4a6e;
            --accent-300: #fcd34d;
            --accent-400: #fbbf24;
            --accent-500: #f59e0b;
            --accent-600: #d97706;
            --slate-50: #f8fafc;
            --slate-100: #f1f5f9;
            --slate-200: #e2e8f0;
            --slate-300: #cbd5e1;
            --slate-400: #94a3b8;
            --slate-500: #64748b;
            --slate-600: #475569;
            --slate-700: #334155;
            --slate-800: #1e293b;
            --slate-900: #0f172a;
            --indigo-500: #6366f1;
            --indigo-600: #4f46e5;
            --indigo-700: #4338ca;
            --error: #dc2626;
            --radius-sm: 6px;
            --radius-base: 8px;
            --radius-lg: 12px;
            --radius-xl: 16px;
            --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
            --shadow-base: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
            --shadow-lg: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
            --shadow-xl: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
            --transition-fast: 0.15s ease;
            --transition-base: 0.25s ease;
        }

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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
            background: var(--slate-50);
            color: var(--slate-800);
            line-height: 1.5;
        }

        .admin-layout { display: flex; min-height: 100vh; }

        /* ===== SIDEBAR ===== */
        .admin-sidebar {
            width: 260px;
            background: var(--slate-900);
            color: white;
            display: flex;
            flex-direction: column;
            position: fixed;
            left: 0; top: 0; bottom: 0;
            z-index: 1000;
            transition: transform var(--transition-base);
        }

        .sidebar-header {
            padding: 1.5rem;
            border-bottom: 1px solid rgba(255,255,255,0.08);
        }

        .sidebar-brand {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            text-decoration: none;
            color: white;
        }

        .sidebar-brand img { width: auto; height: 48px; max-width: 56px; object-fit: contain; border-radius: var(--radius-base); }
        .sidebar-brand span { font-size: 1.125rem; font-weight: 700; }

        .sidebar-nav {
            flex: 1;
            padding: 1rem 0.75rem;
            overflow-y: auto;
            scrollbar-width: none;
            -ms-overflow-style: none;
        }
        .sidebar-nav::-webkit-scrollbar { width: 0; height: 0; }

        .nav-section { margin-bottom: 1.5rem; }
        .nav-section-title {
            font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
            color: var(--slate-500); padding: 0 0.75rem; margin-bottom: 0.5rem;
        }

        .nav-item {
            display: flex; align-items: center; gap: 0.75rem;
            padding: 0.625rem 0.875rem; border-radius: var(--radius-base);
            color: var(--slate-400); text-decoration: none; font-size: 0.875rem; font-weight: 500;
            cursor: pointer; transition: all var(--transition-fast);
            border: none; background: transparent; width: 100%; text-align: left;
        }
        .nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
        .nav-item.active {
            background: linear-gradient(135deg, var(--indigo-600), var(--indigo-700));
            color: white; box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
        }
        .nav-item i { width: 20px; text-align: center; font-size: 0.9375rem; }
        .platform-switch-link {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 0.75rem;
            border-radius: var(--radius-base);
            color: var(--accent-400);
            font-size: 0.8125rem;
            font-weight: 500;
            text-decoration: none;
            transition: all var(--transition-fast);
        }
        .platform-switch-link:hover { background: rgba(245,158,11,0.1); }

        .sidebar-footer {
            padding: 1rem 1.5rem;
            border-top: 1px solid rgba(255,255,255,0.08);
        }
        .sidebar-user {
            display: flex; align-items: center; gap: 0.75rem;
        }
        .sidebar-user-avatar {
            width: 36px; height: 36px; border-radius: 50%;
            background: linear-gradient(135deg, var(--indigo-500), var(--accent-500));
            display: flex; align-items: center; justify-content: center;
            font-weight: 600; font-size: 0.875rem;
        }
        .sidebar-user-info { flex: 1; min-width: 0; }
        .sidebar-user-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
        .sidebar-user-role { font-size: 0.75rem; color: var(--slate-500); }

        /* ===== MAIN ===== */
        .admin-main { flex: 1; margin-left: 260px; display: flex; flex-direction: column; }
        body.sidebar-collapsed .admin-sidebar { transform: translateX(-100%); }
        body.sidebar-collapsed .admin-main { margin-left: 0; }

        .admin-header {
            background: white; border-bottom: 1px solid var(--slate-200);
            padding: 0.875rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
            position: sticky; top: 0; z-index: 50;
        }
        .header-left { display: flex; align-items: center; gap: 1rem; }
        .mobile-toggle {
            display: none; background: none; border: none;
            color: var(--slate-600); font-size: 1.25rem; cursor: pointer; padding: 0.25rem;
        }
        .desktop-toggle { display: inline-flex; }
        .header-title { font-size: 1.25rem; font-weight: 700; color: var(--slate-800); }
        .header-right { display: flex; align-items: center; gap: 0.75rem; }
        .header-btn {
            width: 38px; height: 38px; border-radius: var(--radius-base);
            border: 1px solid var(--slate-200); background: white; color: var(--slate-500);
            display: flex; align-items: center; justify-content: center;
            cursor: pointer; transition: all var(--transition-fast); position: relative;
        }
        .header-btn:hover { background: var(--slate-50); border-color: var(--slate-300); color: var(--slate-700); }
        .header-badge {
            position: absolute; top: -2px; right: -2px;
            width: 18px; height: 18px; border-radius: 50%;
            background: var(--accent-500); color: white;
            font-size: 0.625rem; font-weight: 700;
            display: flex; align-items: center; justify-content: center;
            border: 2px solid white;
        }

        .admin-content {
            flex: 1; padding: 1.5rem; max-width: 1400px;
            background: linear-gradient(180deg, var(--slate-50) 0%, #f5f3ff 40%, var(--slate-50) 100%);
            min-height: 100vh;
        }

        /* ===== CARDS ===== */
        .card {
            background: white; border: 1px solid var(--slate-200);
            border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
            overflow: hidden; position: relative;
        }
        .card::before {
            content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
            background: linear-gradient(90deg, var(--indigo-500), var(--accent-400), transparent);
            opacity: 0.6;
        }
        .card-header {
            padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--slate-100);
            display: flex; align-items: center; justify-content: space-between;
        }
        .card-title { font-size: 1rem; font-weight: 600; color: var(--slate-800); }
        .card-body { padding: 1.5rem; }
        .card-body.p0 { padding: 0; }

        /* ===== STAT CARDS ===== */
        .stats-grid {
            display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; margin-bottom: 1.5rem;
        }
        .stat-card {
            background: white; border: 1px solid var(--slate-200);
            border-radius: var(--radius-lg); padding: 1.25rem;
            box-shadow: var(--shadow-sm); transition: all var(--transition-fast);
            cursor: pointer; position: relative; overflow: hidden;
        }
        .stat-card::before {
            content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
            background: linear-gradient(90deg, var(--indigo-500), var(--indigo-400));
            opacity: 0; transition: opacity var(--transition-fast);
        }
        .stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: var(--indigo-300); }
        .stat-card:hover::before { opacity: 1; }
        .stat-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
        .stat-label { font-size: 0.875rem; color: var(--slate-500); font-weight: 500; }
        .stat-icon {
            width: 40px; height: 40px; border-radius: var(--radius-base);
            display: flex; align-items: center; justify-content: center; font-size: 1.125rem;
        }
        .stat-icon.blue { background: var(--primary-50); color: var(--primary-600); }
        .stat-icon.green { background: #f0fdf4; color: #16a34a; }
        .stat-icon.yellow { background: #fffbeb; color: var(--accent-600); }
        .stat-icon.purple { background: #eef2ff; color: var(--indigo-600); }
        .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--slate-800); margin-bottom: 0.25rem; }
        .stat-change { font-size: 0.8125rem; font-weight: 500; }
        .stat-change.up { color: #16a34a; }
        .stat-change.down { color: #ea580c; }

        /* ===== QUICK ACTIONS ===== */
        .quick-actions {
            display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem;
        }
        .quick-action-btn {
            display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
            padding: 1.25rem; background: white; border: 1px solid var(--slate-200);
            border-radius: var(--radius-lg); color: var(--slate-600);
            font-size: 0.875rem; font-weight: 500; cursor: pointer;
            transition: all var(--transition-fast); text-decoration: none;
        }
        .quick-action-btn:hover {
            border-color: var(--indigo-400); color: var(--indigo-600);
            box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15); transform: translateY(-2px);
        }
        .quick-action-btn:hover i { color: var(--indigo-500); }
        .quick-action-btn i { font-size: 1.25rem; }

        /* ===== TABLES ===== */
        .data-table {
            width: 100%; border-collapse: collapse; font-size: 0.875rem;
        }
        .data-table th {
            text-align: left; padding: 0.875rem 1.25rem; font-weight: 600;
            color: var(--slate-500); background: var(--slate-50);
            border-bottom: 1px solid var(--slate-200); white-space: nowrap;
        }
        .data-table td {
            padding: 1rem 1.25rem; border-bottom: 1px solid var(--slate-100); vertical-align: middle;
        }
        .data-table tr:hover td { background: var(--slate-50); }
        .data-table tr:last-child td { border-bottom: none; }

        .lcl-rates-table-wrap {
            width: 100%;
            overflow-x: auto;
            scrollbar-gutter: stable;
        }
        .lcl-rates-table {
            min-width: 2260px !important;
            table-layout: fixed;
        }
        .lcl-rates-table th,
        .lcl-rates-table td {
            white-space: nowrap;
            vertical-align: middle;
        }
        .lcl-rates-table td {
            padding: 0.85rem 0.75rem;
        }
        .lcl-rates-table .lcl-text-cell {
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .lcl-rates-price-editor {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: 0.3rem;
        }
        .lcl-rates-price-editor input {
            width: 112px;
            min-width: 112px;
            text-align: right;
        }
        .lcl-rates-price-label,
        .lcl-rates-price-editor span {
            color: var(--slate-500);
            font-size: 0.75rem;
            white-space: nowrap;
        }
        .lcl-rates-table .lcl-time-input {
            min-width: 150px;
        }
        .lcl-rates-table .lcl-remarks-input {
            min-width: 220px;
        }
        .lcl-rate-pagination {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 0.75rem;
            padding: 0.75rem 1rem;
            border-top: 1px solid var(--slate-100);
            color: var(--slate-500);
            font-size: 0.8125rem;
            flex-wrap: wrap;
        }
        .lcl-rate-pagination-actions {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex-wrap: wrap;
        }
        .lcl-rate-pagination .btn {
            padding: 0.35rem 0.7rem;
        }

        /* ===== BADGES ===== */
        .badge {
            display: inline-flex; align-items: center; gap: 0.375rem;
            padding: 0.25rem 0.625rem; border-radius: 9999px;
            font-size: 0.75rem; font-weight: 600;
        }
        .badge-green { background: #dcfce7; color: #166534; }
        .badge-yellow { background: #fef9c3; color: #854d0e; }
        .badge-red { background: #fee2e2; color: #991b1b; }
        .badge-gray { background: var(--slate-100); color: var(--slate-600); }
        .badge-blue { background: var(--primary-50); color: var(--primary-700); }
        .badge-indigo { background: #eef2ff; color: var(--indigo-700); }

        /* ===== BUTTONS ===== */
        .btn {
            display: inline-flex; align-items: center; gap: 0.5rem;
            padding: 0.5rem 1rem; border-radius: var(--radius-base);
            font-size: 0.875rem; font-weight: 500; cursor: pointer;
            transition: all var(--transition-fast); border: none; text-decoration: none;
        }
        .btn-primary {
            background: linear-gradient(135deg, var(--indigo-500), var(--indigo-600));
            color: white;
        }
        .btn-primary:hover { box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35); transform: translateY(-1px); }
        .btn-outline { background: white; border: 1px solid var(--slate-200); color: var(--slate-600); }
        .btn-outline:hover { border-color: var(--slate-300); background: var(--slate-50); }
        .btn-ghost { background: transparent; color: var(--slate-500); }
        .btn-ghost:hover { background: var(--slate-100); color: var(--slate-700); }
        .btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
        .btn-icon { width: 32px; height: 32px; padding: 0; justify-content: center; }

        .admin-card {
            background: white;
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-sm);
            overflow: hidden;
        }
        .admin-card-header {
            padding: 1rem 1.25rem;
            border-bottom: 1px solid var(--slate-100);
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            flex-wrap: wrap;
        }
        .admin-card-title {
            font-size: 1rem;
            font-weight: 700;
            color: var(--slate-800);
            display: inline-flex;
            align-items: center;
            gap: .5rem;
        }
        .admin-card-body { padding: 1.25rem; }
        .admin-table {
            width: 100%;
            border-collapse: collapse;
            font-size: .875rem;
        }
        .admin-table th,
        .admin-table td {
            text-align: left;
            padding: .875rem 1rem;
            border-bottom: 1px solid var(--slate-100);
            vertical-align: middle;
        }
        .admin-table th {
            background: var(--slate-50);
            color: var(--slate-500);
            font-weight: 700;
            white-space: nowrap;
        }
        .admin-table tr:hover td { background: var(--slate-50); }
        .admin-stat-card {
            background: white;
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-lg);
            padding: 1.1rem;
            box-shadow: var(--shadow-sm);
        }
        .admin-stat-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: .75rem;
            margin-bottom: .75rem;
        }
        .admin-stat-title { font-size: .85rem; color: var(--slate-500); font-weight: 700; }
        .admin-stat-value { font-size: 1.7rem; font-weight: 800; color: var(--slate-900); }
        .admin-stat-change { font-size: .78rem; color: var(--slate-500); margin-top: .25rem; }
        .admin-stat-icon {
            width: 40px;
            height: 40px;
            border-radius: var(--radius-base);
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }
        .admin-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: .45rem;
            border: 1px solid transparent;
            border-radius: var(--radius-base);
            padding: .48rem .8rem;
            font-size: .82rem;
            font-weight: 700;
            cursor: pointer;
            transition: all var(--transition-fast);
            text-decoration: none;
            white-space: nowrap;
        }
        .admin-btn-primary { background: var(--indigo-600); color: white; }
        .admin-btn-primary:hover { background: var(--indigo-700); }
        .admin-btn-secondary { background: white; color: var(--slate-700); border-color: var(--slate-200); }
        .admin-btn-secondary:hover { background: var(--slate-50); border-color: var(--slate-300); }
        .admin-btn-danger { background: #dc2626; color: white; }
        .modal-overlay.active {
            opacity: 1;
            visibility: visible;
            pointer-events: auto;
        }
        .modal-overlay.active .modal-container { transform: scale(1); }
        .modal-content { padding: 1.25rem; }
        .admin-form-group {
            display: flex;
            flex-direction: column;
            gap: .4rem;
        }
        .admin-form-group label {
            font-size: .82rem;
            font-weight: 700;
            color: var(--slate-700);
        }
        .admin-form-group input,
        .admin-form-group select,
        .admin-form-group textarea {
            width: 100%;
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-base);
            padding: .55rem .7rem;
            font-size: .875rem;
            background: white;
            color: var(--slate-800);
        }
        .staff-account-toolbar,
        .staff-customer-toolbar {
            align-items: center;
        }
        .staff-account-filters,
        .staff-customer-search {
            display: flex;
            align-items: center;
            gap: .5rem;
            flex-wrap: wrap;
        }
        .staff-account-filters input,
        .staff-account-filters select,
        .staff-customer-search input,
        .staff-customer-search select {
            min-height: 36px;
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-base);
            padding: .45rem .65rem;
            font-size: .85rem;
        }
        .staff-customer-tabs {
            display: flex;
            align-items: center;
            gap: .5rem;
            flex-wrap: wrap;
            margin-bottom: 1rem;
        }
        .staff-customer-tabs .admin-btn.active { background: var(--indigo-600); color: white; border-color: var(--indigo-600); }
        .staff-customer-table-wrap { overflow-x: auto; }
        .staff-customer-table { min-width: 1160px; }
        .staff-customer-name { font-weight: 800; color: var(--slate-900); }
        .staff-customer-sub,
        .staff-customer-muted { font-size: .78rem; color: var(--slate-500); }
        .staff-customer-owner strong {
            display: block;
            color: var(--slate-800);
            font-size: .84rem;
            white-space: nowrap;
        }
        .staff-customer-owner span {
            display: block;
            margin-top: .1rem;
            color: var(--slate-500);
            font-size: .74rem;
            line-height: 1.35;
        }
        .staff-customer-source,
        .staff-customer-badge {
            display: inline-flex;
            align-items: center;
            width: fit-content;
            margin-top: .35rem;
            padding: .18rem .5rem;
            border-radius: 999px;
            font-size: .72rem;
            font-weight: 700;
            background: var(--slate-100);
            color: var(--slate-600);
        }
        .staff-customer-badge.alert { background: #fee2e2; color: #991b1b; }
        .staff-customer-badge.shipped { background: #dcfce7; color: #166534; }
        .staff-customer-badge.unshipped { background: #fef3c7; color: #92400e; }
        .staff-customer-owner-board {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: .75rem;
            margin: 0 0 1rem;
        }
        .staff-customer-owner-board-card {
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-base);
            background: white;
            padding: .8rem;
            display: flex;
            flex-direction: column;
            gap: .65rem;
            text-align: left;
            cursor: pointer;
            box-shadow: var(--shadow-sm);
        }
        .staff-customer-owner-board-card:hover { border-color: var(--primary-300); background: var(--slate-50); }
        .staff-customer-owner-board-card strong {
            display: block;
            color: var(--slate-900);
            font-size: .92rem;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .staff-customer-owner-board-card span {
            display: block;
            color: var(--slate-500);
            font-size: .78rem;
            margin-top: .16rem;
        }
        .staff-customer-owner-board-metrics {
            display: flex;
            flex-wrap: wrap;
            gap: .35rem;
        }
        .staff-customer-owner-board-metrics em {
            font-style: normal;
            padding: .18rem .42rem;
            border-radius: 999px;
            background: var(--slate-100);
            color: var(--slate-600);
            font-size: .72rem;
            font-weight: 700;
        }
        .staff-customer-owner-board-metrics em.alert { background: #fee2e2; color: #b91c1c; }
        .staff-customer-owner-log-wrap {
            margin-top: .9rem;
            border-top: 1px solid var(--slate-200);
            padding-top: .75rem;
        }
        .staff-customer-owner-log-title {
            font-weight: 800;
            color: var(--slate-800);
            font-size: .86rem;
            margin-bottom: .5rem;
        }
        .staff-customer-owner-log-list { display: grid; gap: .45rem; }
        .staff-customer-owner-log,
        .staff-customer-owner-log-empty {
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-base);
            background: var(--slate-50);
            padding: .55rem .65rem;
            font-size: .8rem;
        }
        .staff-customer-owner-log {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: .8rem;
        }
        .staff-customer-owner-log strong { color: var(--slate-800); }
        .staff-customer-owner-log span,
        .staff-customer-owner-log time,
        .staff-customer-owner-log-empty { color: var(--slate-500); }
        .staff-customer-owner-log span {
            display: block;
            margin-top: .12rem;
            font-size: .74rem;
        }
        .staff-customer-owner-log time {
            flex: 0 0 auto;
            font-size: .74rem;
        }
        .staff-customer-profit { font-weight: 800; }
        .profit-positive { color: #15803d; }
        .profit-negative { color: #b91c1c; }
        .staff-customer-orders-row td { background: var(--slate-50); }
        .staff-customer-orders {
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-base);
            background: white;
            padding: 1rem;
        }
        .staff-customer-profit-list,
        .staff-customer-profit-detail-grid {
            display: grid;
            gap: .75rem;
        }
        .staff-customer-profit-card {
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-base);
            padding: .9rem;
            background: white;
        }
        .staff-customer-profit-card-head,
        .staff-customer-profit-summary-row {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: .75rem;
            align-items: start;
        }
        .staff-customer-profit-summary-row {
            grid-template-columns: repeat(3, minmax(0, 1fr));
            margin-top: .75rem;
        }
        .staff-customer-profit-mini {
            border: 1px solid var(--slate-100);
            border-radius: var(--radius-base);
            padding: .65rem;
            background: var(--slate-50);
        }
        .staff-customer-profit-mini span,
        .staff-customer-profit-lines-title {
            display: block;
            font-size: .75rem;
            color: var(--slate-500);
            margin-bottom: .25rem;
        }
        .staff-customer-profit-line {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: .75rem;
            font-size: .82rem;
            padding: .25rem 0;
        }
        .staff-customer-profit-line.total {
            border-top: 1px solid var(--slate-200);
            margin-top: .25rem;
            padding-top: .5rem;
            font-weight: 800;
        }
        .staff-customer-empty-orders {
            color: var(--slate-500);
            padding: .5rem 0;
            font-size: .85rem;
        }
        .staff-modal-body { display: flex; flex-direction: column; gap: .75rem; }
        .staff-modal-form-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: .85rem;
        }
        .staff-modal-hint,
        .staff-modal-result {
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-base);
            background: var(--slate-50);
            color: var(--slate-600);
            padding: .65rem .75rem;
            font-size: .82rem;
        }
        .staff-account-role-chip {
            display: inline-flex;
            padding: .18rem .5rem;
            border-radius: 999px;
            background: #eef2ff;
            color: var(--indigo-700);
            font-size: .72rem;
            font-weight: 700;
            margin: .12rem;
        }

        /* ===== EMPTY STATE ===== */
        .empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--slate-400); }
        .empty-state i { font-size: 3rem; margin-bottom: 1rem; opacity: 0.4; }

        /* ===== SECTIONS ===== */
        .section-header {
            margin-bottom: 1.5rem; padding-bottom: 1rem;
            border-bottom: 1px solid var(--slate-200); position: relative;
        }
        .section-header::after {
            content: ''; position: absolute; bottom: -1px; left: 0;
            width: 80px; height: 2px;
            background: linear-gradient(90deg, var(--indigo-500), var(--indigo-400));
            border-radius: 2px;
        }
        .section-header h1 { font-size: 1.5rem; font-weight: 700; color: var(--slate-800); }
        .section-header p { color: var(--slate-500); margin-top: 0.25rem; }
        .demo-tag {
            display: inline-flex; align-items: center; gap: 0.375rem;
            padding: 0.25rem 0.625rem; background: var(--indigo-50);
            color: var(--indigo-700); border: 1px solid var(--indigo-200);
            border-radius: var(--radius-base); font-size: 0.75rem; font-weight: 600; margin-left: 0.75rem;
        }
        .platform-access-banner {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 1rem;
            margin-bottom: 1rem;
            padding: 0.75rem 1rem;
            border: 1px solid #bfdbfe;
            border-left: 3px solid var(--primary-500);
            border-radius: var(--radius-base);
            background: #eff6ff;
            color: var(--slate-700);
            font-size: 0.875rem;
        }
        .platform-access-banner strong { color: var(--primary-700); }
        .staff-return-btn {
            width: auto;
            padding: 0 0.75rem;
            gap: 0.45rem;
        }
        .staff-return-btn span { font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }

        /* ===== PAGE TRANSITIONS ===== */
        .page-section { display: none; animation: fadeIn 0.3s ease; }
        .page-section.active { display: block; }
        @keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

        /* ===== RESPONSIVE ===== */
        @media (max-width: 1024px) {
            .stats-grid { grid-template-columns: repeat(2, 1fr); }
            .quick-actions { grid-template-columns: repeat(2, 1fr); }
        }
        @media (max-width: 768px) {
            .admin-sidebar { transform: translateX(-100%); }
            .admin-sidebar.open { transform: translateX(0); }
            .admin-main { margin-left: 0; }
            .mobile-toggle { display: block; }
            .desktop-toggle { display: none; }
            .stats-grid { grid-template-columns: 1fr; }
            .quick-actions { grid-template-columns: repeat(2, 1fr); }
            .admin-content { padding: 1rem; }
        }

        /* Sidebar Overlay */
        .sidebar-overlay {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.45);
            z-index: 999;
            pointer-events: none;
            transition: opacity 0.3s ease;
            opacity: 0;
        }
        .sidebar-overlay.active {
            display: block;
            opacity: 1;
            pointer-events: auto;
        }

        /* ===== MODAL ===== */
        .modal-overlay {
            position: fixed; inset: 0;
            background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(4px);
            display: flex; align-items: center; justify-content: center;
            z-index: 2200; opacity: 0; visibility: hidden; pointer-events: none; transition: all 0.2s ease;
        }
        .modal-overlay.show { opacity: 1; visibility: visible; pointer-events: auto; }
        .modal-container {
            background: white; border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
            width: 100%; max-width: 560px; max-height: 90vh; overflow: hidden;
            display: flex; flex-direction: column;
            transform: scale(0.95); transition: transform 0.2s ease;
        }
        .modal-overlay.show .modal-container { transform: scale(1); }
        .modal-header {
            padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--slate-100);
            display: flex; align-items: center; justify-content: space-between;
        }
        .modal-header h3 { font-size: 1.125rem; font-weight: 600; }
        .modal-close {
            width: 32px; height: 32px; border-radius: var(--radius-base);
            border: none; background: var(--slate-100); color: var(--slate-500);
            cursor: pointer; display: flex; align-items: center; justify-content: center;
            transition: all var(--transition-fast);
        }
        .modal-close:hover { background: var(--slate-200); color: var(--slate-700); }
        .modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
        .modal-footer {
            padding: 1rem 1.5rem; border-top: 1px solid var(--slate-100);
            display: flex; justify-content: flex-end; gap: 0.75rem;
        }
        .platform-batch-modal {
            max-width: 1200px !important;
            width: 96vw !important;
            max-height: 92vh !important;
        }
        .batch-editor-wrap {
            margin-top: 0.75rem;
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-base);
            overflow: auto;
            max-height: 360px;
            background: #fff;
        }
        .batch-editor-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.8125rem;
        }
        .batch-editor-table th,
        .batch-editor-table td {
            border-bottom: 1px solid var(--slate-100);
            padding: 0.5rem;
            white-space: nowrap;
            vertical-align: middle;
        }
        .batch-editor-table th {
            position: sticky;
            top: 0;
            background: var(--slate-50);
            z-index: 2;
            font-weight: 600;
            color: var(--slate-600);
        }
        .batch-editor-table input,
        .batch-editor-table select {
            min-width: 92px;
            padding: 0.375rem 0.5rem;
            border: 1px solid var(--slate-200);
            border-radius: 6px;
            font-size: 0.8125rem;
        }
        .batch-editor-toolbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            margin-top: 0.75rem;
        }
        .batch-editor-toolbar-right {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
        }
        .rate-hub-filters {
            display: grid;
            grid-template-columns: 220px 1fr 140px 140px 140px auto;
            gap: 0.5rem;
            align-items: center;
            width: 100%;
        }
        .rate-hub-layout {
            display: flex;
            flex-direction: column;
            gap: 0.875rem;
            min-height: 660px;
        }
        .rate-hub-top-row {
            display: grid;
            grid-template-columns: minmax(220px, 28%) minmax(360px, 72%);
            gap: 0.875rem;
            align-items: stretch;
        }
        .rate-hub-panel {
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-lg);
            background: #fff;
            min-height: 0;
            display: flex;
            flex-direction: column;
        }
        .rate-hub-top-panel {
            min-height: 320px;
            max-height: 360px;
        }
        .rate-hub-detail-panel {
            min-height: 500px;
        }
        .rate-hub-panel-header {
            padding: 0.75rem 0.875rem;
            border-bottom: 1px solid var(--slate-100);
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 0.5rem;
        }
        .rate-hub-panel-title {
            font-weight: 600;
            color: var(--slate-700);
            font-size: 0.875rem;
        }
        .rate-hub-list {
            overflow: auto;
            padding: 0.5rem;
            flex: 1;
        }
        .rate-hub-list-item {
            border: 1px solid var(--slate-200);
            border-radius: 10px;
            padding: 0.625rem 0.75rem;
            margin-bottom: 0.5rem;
            cursor: pointer;
            transition: all var(--transition-fast);
            background: #fff;
        }
        .rate-hub-list-item:hover {
            border-color: var(--indigo-300);
            box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
        }
        .rate-hub-list-item.active {
            border-color: var(--indigo-500);
            background: #eef2ff;
        }
        .rate-hub-file-icon {
            width: 34px;
            height: 34px;
            border-radius: 8px;
            background: #ecfdf5;
            color: #047857;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            margin-right: 0.625rem;
            flex-shrink: 0;
        }
        .rate-detail-wrap {
            overflow: auto;
            flex: 1;
        }
        .sync-top-scrollbar {
            display: none;
            overflow-x: auto;
            overflow-y: hidden;
            border-bottom: 1px solid var(--slate-100);
            background: #f8fafc;
        }
        .sync-top-scrollbar-inner {
            height: 1px;
        }
        .rate-detail-table {
            width: 100%;
            min-width: 860px;
            border-collapse: collapse;
            font-size: 0.8125rem;
        }
        .rate-detail-table th,
        .rate-detail-table td {
            border-bottom: 1px solid var(--slate-100);
            padding: 0.4rem 0.45rem;
            white-space: nowrap;
        }
        .rate-detail-table th {
            position: sticky;
            top: 0;
            background: #f8fafc;
            z-index: 2;
        }
        .rate-detail-table input,
        .rate-detail-table select {
            min-width: 72px;
            padding: 0.3125rem 0.4rem;
            border: 1px solid var(--slate-200);
            border-radius: 6px;
            font-size: 0.8125rem;
        }
        .rate-check-col {
            width: 44px;
            text-align: center;
        }
        .rate-row-pending-delete {
            background: #f8fafc;
            opacity: 0.66;
        }
        .rate-pending-badge {
            display: inline-flex;
            align-items: center;
            padding: 0.1rem 0.4rem;
            border-radius: 9999px;
            font-size: 0.6875rem;
            color: #9a3412;
            background: #ffedd5;
            border: 1px solid #fed7aa;
        }
        .rate-detail-toolbar {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
            align-items: center;
        }
        @media (max-width: 1240px) {
            .rate-hub-top-row { grid-template-columns: 1fr; }
            .rate-hub-top-panel { max-height: none; min-height: 260px; }
            .rate-hub-detail-panel { min-height: 460px; }
            .rate-hub-filters {
                grid-template-columns: 1fr 1fr;
            }
        }

        /* ===== FORM ELEMENTS ===== */
        .form-group { margin-bottom: 1rem; }
        .form-label { display: block; font-size: 0.8125rem; font-weight: 500; color: var(--slate-600); margin-bottom: 0.375rem; }
        .form-input {
            width: 100%; padding: 0.5rem 0.75rem;
            border: 1px solid var(--slate-200); border-radius: var(--radius-base);
            font-size: 0.875rem; font-family: inherit;
            transition: all var(--transition-fast); background: white;
        }
        .form-input:focus { outline: none; border-color: var(--indigo-400); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1); }
        .form-select {
            width: 100%; padding: 0.5rem 0.75rem;
            border: 1px solid var(--slate-200); border-radius: var(--radius-base);
            font-size: 0.875rem; font-family: inherit; background: white; cursor: pointer;
        }
        .form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
        @media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

        /* ===== TOAST ===== */
        .toast-container {
            position: fixed; top: 1rem; right: 1rem; z-index: 3200;
            display: flex; flex-direction: column; gap: 0.5rem;
        }
        .toast {
            padding: 0.875rem 1.25rem; border-radius: var(--radius-lg);
            font-size: 0.875rem; font-weight: 500; box-shadow: var(--shadow-xl);
            animation: slideIn 0.3s ease; display: flex; align-items: center; gap: 0.5rem;
        }
        .toast-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
        .toast-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
        @keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

        /* ===== COMPANY CARD ===== */
        .company-meta { display: flex; align-items: center; gap: 0.75rem; }
        .company-avatar {
            width: 40px; height: 40px; border-radius: var(--radius-base);
            background: linear-gradient(135deg, var(--indigo-500), var(--primary-500));
            display: flex; align-items: center; justify-content: center;
            color: white; font-weight: 700; font-size: 0.875rem;
        }
        .company-info { display: flex; flex-direction: column; }
        .company-name { font-weight: 600; color: var(--slate-800); }
        .company-email { font-size: 0.8125rem; color: var(--slate-500); }

        /* ===== TABS ===== */
        .tabs { display: flex; gap: 0.25rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--slate-200); padding-bottom: 0; }
        .tab-btn {
            padding: 0.625rem 1rem; border: none; background: transparent;
            color: var(--slate-500); font-size: 0.875rem; font-weight: 500;
            cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
            transition: all var(--transition-fast);
        }
        .tab-btn:hover { color: var(--slate-700); }
        .tab-btn.active { color: var(--indigo-600); border-bottom-color: var(--indigo-500); }

        /* ===== AI TAB CONTENT ===== */
        .ai-tab-content { display: none; animation: fadeIn 0.3s ease; }
        .ai-tab-content.active { display: block; }

        /* ===== STAFF KNOWLEDGE BASE ===== */
        .staff-kb-toolbar {
            display: grid;
            grid-template-columns: minmax(260px, 2fr) minmax(140px, 0.9fr) minmax(160px, 1fr) minmax(170px, 1.1fr) 120px;
            gap: 1rem;
            align-items: end;
            margin-bottom: 1rem;
        }
        .staff-kb-list {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }
        .staff-kb-item {
            border: 1px solid var(--slate-200);
            border-radius: var(--radius-lg);
            background: white;
            padding: 1rem;
        }
        .staff-kb-item-head {
            display: grid;
            grid-template-columns: minmax(180px, 1.2fr) minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
            gap: 1rem;
            align-items: start;
        }
        .staff-kb-title {
            font-weight: 700;
            color: var(--slate-800);
            line-height: 1.45;
            word-break: normal;
            overflow-wrap: break-word;
        }
        .staff-kb-muted {
            color: var(--slate-500);
            font-size: 0.75rem;
            margin-top: 0.35rem;
        }
        .staff-kb-chip-row {
            display: flex;
            flex-wrap: wrap;
            gap: 0.35rem;
        }
        .staff-kb-chip {
            display: inline-flex;
            align-items: center;
            max-width: 100%;
            padding: 0.2rem 0.5rem;
            border-radius: 999px;
            background: var(--slate-100);
            color: var(--slate-700);
            font-size: 0.75rem;
            line-height: 1.3;
        }
        .staff-kb-chip.role {
            background: #e0f2fe;
            color: #075985;
        }
        .staff-kb-chip.status {
            background: #eef2ff;
            color: #3730a3;
        }
        .staff-kb-summary {
            color: var(--slate-600);
            line-height: 1.55;
            margin-top: 0.75rem;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }
        .staff-kb-actions {
            display: flex;
            gap: 0.4rem;
            flex-wrap: wrap;
        }
        .ai-question-toolbar {
            display: grid;
            grid-template-columns: minmax(240px, 1.5fr) minmax(140px, 0.8fr) minmax(140px, 0.8fr) 120px;
            gap: 0.875rem;
            align-items: end;
            margin-bottom: 1rem;
        }
        .ai-question-row {
            vertical-align: top;
        }
        .ai-question-text {
            max-width: 420px;
            white-space: normal;
            line-height: 1.45;
            color: var(--slate-800);
            overflow-wrap: anywhere;
        }
        .ai-question-preview {
            max-width: 360px;
            white-space: normal;
            line-height: 1.45;
            color: var(--slate-500);
            overflow-wrap: anywhere;
        }
        @media (max-width: 900px) {
            .staff-kb-toolbar {
                grid-template-columns: 1fr;
            }
            .staff-kb-item-head {
                grid-template-columns: 1fr;
            }
            .ai-question-toolbar {
                grid-template-columns: 1fr;
            }
        }