    :root {
        --bg-primary: #F5F0EB;
        --bg-card: #FFFFFF;
        --accent: #a40000;
        --accent-hover: #8a0000;
        --text-primary: #1a1a1a;
        --text-body: #555555;
        --text-muted: #999999;
        --border: #e5ded4;
        --sidebar-width: 260px;
        --topbar-height: 64px;
        --radius: 10px;
        --success: #2e7d32;
        --warning: #b8860b;
        --danger: #a40000;
        --bg-secondary: #f5f0eb;
        --bg-hover: rgba(0,0,0,0.03);
        --login-error-bg: #fdecea;
        --table-hover-bg: #faf8f5;
        --table-selected-bg: #fdf1f1;
        --badge-pending-bg: #fdf3d9;
        --badge-approved-bg: #e5f3e6;
        --badge-rejected-bg: #fdecea;
        --badge-null-bg: #eeeeee;
        --badge-kategori-bg: #f1e6e6;
        --wa-bg: #e6f6ec;
        --wa-color: #1e9e4f;
        --bulk-toolbar-bg: #fff4f4;
        --bulk-toolbar-border: #f0c9c9;
        --positive-color: #2f7a3f;
        --success-border: #4caf50;
        --danger-hover-bg: #fdecea;
        --chart-grid: rgba(0,0,0,0.04);
        --chart-bar-bg: rgba(180,180,180,0.28);
        --surface-elevated: #FFFFFF;
        --surface-elevated-strong: #FFFFFF;
        --border-elevated: #e5ded4;
        --border-subtle: #eee7df;
        --shadow-elevated: 0 4px 14px rgba(63,36,24,.08);
        --shadow-modal: 0 12px 40px rgba(0,0,0,.20);
        --outline-hover-bg: #FFFFFF;
        --disabled-bg: #f5f0eb;
        --primary-disabled-bg: #b85a5a;
        --primary-disabled-text: #ffffff;
    }

    [data-theme="dark"] {
        --bg-primary: #171311;
        --bg-card: #241e1b;
        --accent: #f87171;
        --accent-hover: #fb8a8a;
        --text-primary: #f7f3ef;
        --text-body: #ded6d0;
        --text-muted: #b8aca4;
        --border: #4a3d36;
        --success: #86efac;
        --warning: #fcd34d;
        --danger: #fca5a5;
        --bg-secondary: #2e2622;
        --bg-hover: rgba(255,255,255,0.08);
        --login-error-bg: #4a2424;
        --table-hover-bg: #332a25;
        --table-selected-bg: #4a2528;
        --badge-pending-bg: #4a3a18;
        --badge-approved-bg: #1e3a29;
        --badge-rejected-bg: #4a2424;
        --badge-null-bg: #3a3532;
        --badge-kategori-bg: #4a2929;
        --wa-bg: #193a29;
        --wa-color: #86efac;
        --bulk-toolbar-bg: #422426;
        --bulk-toolbar-border: #73383d;
        --positive-color: #86efac;
        --success-border: #6ee7b7;
        --danger-hover-bg: #4a2424;
        --chart-grid: rgba(255,255,255,0.12);
        --chart-bar-bg: rgba(220,220,220,0.35);
        --surface-elevated: #2d2521;
        --surface-elevated-strong: #342b26;
        --border-elevated: #66544a;
        --border-subtle: #3f342e;
        --shadow-elevated: 0 6px 18px rgba(0,0,0,.30);
        --shadow-modal: 0 16px 42px rgba(0,0,0,.48);
        --outline-hover-bg: #3a2f29;
        --disabled-bg: #29221f;
        --primary-disabled-bg: #71383b;
        --primary-disabled-text: #fff7f5;
        --medal-1-bg: #59481f;
        --medal-1-border: #d6ad36;
        --medal-1-text: #fff4c2;
        --medal-2-bg: #3f444b;
        --medal-2-border: #b8bec7;
        --medal-2-text: #f1f3f5;
        --medal-3-bg: #5a3a24;
        --medal-3-border: #c27b35;
        --medal-3-text: #ffe0bd;
    }

    html.theme-transitioning,
    html.theme-transitioning body,
    html.theme-transitioning body * {
        transition:
            background-color 240ms ease,
            color 240ms ease,
            border-color 240ms ease,
            box-shadow 240ms ease;
    }

    html.theme-transitioning #labelOverlay,
    html.theme-transitioning #labelOverlay * {
        transition: none !important;
    }

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

    body {
        font-family: 'Plus Jakarta Sans', sans-serif;
        background: var(--bg-primary);
        color: var(--text-primary);
        min-height: 100vh;
    }

    /* ============ LOGIN VIEW ============ */
    #loginView {
        min-height: 100vh;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 24px;
    }

    .login-card {
        background: var(--bg-card);
        border-radius: var(--radius);
        padding: 48px 40px;
        width: 100%;
        max-width: 400px;
        box-shadow: 0 4px 24px rgba(0,0,0,0.06);
        border: 1px solid var(--border);
    }

    .login-logo {
        font-size: 13px;
        font-weight: 700;
        letter-spacing: 0.5px;
        color: var(--accent);
        text-transform: uppercase;
        margin-bottom: 8px;
    }

    .login-card h1 {
        font-size: 24px;
        font-weight: 800;
        margin-bottom: 6px;
    }

    .login-card .subtitle {
        font-size: 14px;
        color: var(--text-muted);
        margin-bottom: 32px;
    }

    .form-group { margin-bottom: 18px; }

    .form-group label {
        display: block;
        font-size: 12px;
        font-weight: 600;
        letter-spacing: 0.3px;
        text-transform: uppercase;
        color: var(--text-body);
        margin-bottom: 6px;
    }

    .form-group input {
        width: 100%;
        padding: 12px 14px;
        border: 1px solid var(--border);
        border-radius: 8px;
        font-family: inherit;
        font-size: 14px;
        background: var(--bg-primary);
        transition: border-color 0.15s;
    }

    .form-group input:focus {
        outline: none;
        border-color: var(--accent);
    }

    .btn-primary {
        width: 100%;
        padding: 13px;
        background: var(--accent);
        color: #fff;
        border: none;
        border-radius: 8px;
        font-family: inherit;
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        transition: background 0.15s;
        margin-top: 8px;
    }

    .btn-primary:hover { background: var(--accent-hover); }
    .btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

    .login-error {
        background: var(--login-error-bg);
        color: var(--danger);
        font-size: 13px;
        padding: 10px 12px;
        border-radius: 6px;
        margin-bottom: 16px;
        display: none;
    }

    .login-error.show { display: block; }

    /* ============ APP SHELL ============ */
    #appShell {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 100vh;
        background: var(--surface-elevated);
        border-right: 1px solid var(--border-elevated);
        display: flex;
        flex-direction: column;
        z-index: 100;
        transition: transform 0.2s ease;
    }

    .sidebar-header {
        padding: 24px 20px;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-header .brand {
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        color: var(--accent);
        margin-bottom: 2px;
    }

    .sidebar-header .brand-sub {
        font-size: 15px;
        font-weight: 800;
    }

    .sidebar-nav {
        flex: 1;
        overflow-y: auto;
        padding: 16px 12px;
    }

    .nav-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 11px 12px;
        border-radius: 8px;
        color: var(--text-body);
        text-decoration: none;
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        margin-bottom: 2px;
        transition: background 0.12s, color 0.12s;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
    }

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

    .nav-item:hover { background: var(--bg-primary); color: var(--text-primary); }

    .nav-item.active {
        background: var(--accent);
        color: #fff;
    }

    .nav-divider {
        height: 1px;
        background: var(--border);
        margin: 12px 8px;
    }

    .sidebar-footer {
        padding: 16px 20px;
        border-top: 1px solid var(--border);
    }

    .user-info {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        background: var(--accent);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 14px;
        flex-shrink: 0;
    }

    .user-details { overflow: hidden; }
    .user-details .name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .user-details .role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }

    .btn-logout {
        width: 100%;
        padding: 9px;
        background: none;
        border: 1px solid var(--border);
        border-radius: 8px;
        font-family: inherit;
        font-size: 13px;
        font-weight: 600;
        color: var(--text-body);
        cursor: pointer;
        transition: all 0.15s;
    }

    .btn-logout:hover { border-color: var(--accent); color: var(--accent); }

    /* ============ MAIN CONTENT ============ */
    .main-content {
        margin-left: var(--sidebar-width);
        min-height: 100vh;
    }

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

    .topbar-title { font-size: 18px; font-weight: 800; }

    .topbar-right { display: flex; align-items: center; gap: 16px; }

    .hamburger {
        display: none;
        background: none;
        border: none;
        cursor: pointer;
        padding: 6px;
    }

    .hamburger svg { width: 22px; height: 22px; }

    .notif-btn {
        position: relative;
        background: var(--surface-elevated);
        border: 1px solid var(--border-elevated);
        border-radius: 8px;
        width: 38px;
        height: 38px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: border-color 0.15s;
    }

    .notif-btn:hover { border-color: var(--accent); background: var(--outline-hover-bg); }
    .notif-btn svg { width: 18px; height: 18px; color: var(--text-body); }

    .notif-badge {
        position: absolute;
        top: -5px;
        right: -5px;
        background: var(--accent);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        min-width: 17px;
        height: 17px;
        border-radius: 9px;
        display: none;
        align-items: center;
        justify-content: center;
        padding: 0 4px;
        border: 2px solid var(--bg-card);
    }

    .notif-badge.show { display: flex; }

    .notif-dropdown {
        position: absolute;
        top: calc(var(--topbar-height) + 4px);
        right: 28px;
        width: 320px;
        max-height: 400px;
        overflow-y: auto;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: 0 8px 24px rgba(0,0,0,0.1);
        display: none;
        z-index: 60;
    }

    .notif-dropdown.show { display: block; }

    .notif-dropdown-header {
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
        font-size: 13px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
    }

    .notif-mark-all {
        background: none;
        border: none;
        color: var(--accent);
        font-size: 11.5px;
        font-weight: 600;
        cursor: pointer;
        padding: 4px 6px;
    }
    .notif-mark-all:hover { text-decoration: underline; }

    .notif-list-scroll { max-height: 360px; overflow-y: auto; }

    .notif-item {
        padding: 12px 16px;
        border-bottom: 1px solid var(--border);
        cursor: pointer;
        position: relative;
    }
    .notif-item:hover { background: var(--bg-hover); }
    .notif-item.unread { background: rgba(164,0,0,0.05); }
    .notif-item.unread::before {
        content: '';
        position: absolute;
        left: 5px; top: 18px;
        width: 6px; height: 6px;
        border-radius: 50%;
        background: var(--accent);
    }
    .notif-item .what { font-size: 12.5px; line-height: 1.4; padding-left: 10px; }
    .notif-item .when { font-size: 11px; color: var(--text-muted); margin-top: 3px; padding-left: 10px; }

    .notif-empty {
        padding: 32px 16px;
        text-align: center;
        color: var(--text-muted);
        font-size: 13px;
    }

    .view-container { padding: 28px; }

    .view-placeholder {
        background: var(--bg-card);
        border: 1px dashed var(--border);
        border-radius: var(--radius);
        padding: 64px 24px;
        text-align: center;
    }

    .view-placeholder .icon-wrap {
        width: 56px;
        height: 56px;
        background: var(--bg-primary);
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        margin: 0 auto 16px;
    }

    .view-placeholder .icon-wrap svg { width: 26px; height: 26px; color: var(--accent); }

    .view-placeholder h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
    .view-placeholder p { font-size: 13px; color: var(--text-muted); max-width: 340px; margin: 0 auto; }

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

    .stat-card {
        background: var(--surface-elevated);
        border: 1px solid var(--border-elevated);
        border-radius: var(--radius);
        padding: 20px;
        box-shadow: var(--shadow-elevated);
    }

    .stat-card .label {
        font-size: 12px;
        color: var(--text-muted);
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        margin-bottom: 8px;
    }

    .stat-card .value {
        font-size: 28px;
        font-weight: 800;
    }

    .stat-card .value.accent { color: var(--accent); }

    .chart-card {
        background: var(--surface-elevated);
        border: 1px solid var(--border-elevated);
        border-radius: 14px;
        padding: 24px 28px;
        box-shadow: 0 2px 12px rgba(0,0,0,0.05);
        margin-top: 20px;
        box-shadow: var(--shadow-elevated);
    }

    .chart-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 20px;
    }

    .chart-card-title {
        font-size: 15px;
        font-weight: 700;
        color: var(--text-primary);
    }

    .chart-card-delta {
        font-size: 12.5px;
        color: var(--text-muted);
        margin-top: 4px;
    }

    .chart-card-delta.positive {
        color: var(--positive-color);
        font-weight: 600;
    }

    .chart-card-delta.negative {
        color: var(--text-muted);
        font-weight: 600;
    }

    .chart-toggle {
        display: flex;
        background: var(--bg-primary);
        border-radius: 999px;
        padding: 3px;
        gap: 2px;
    }

    .chart-toggle-btn {
        border: none;
        background: transparent;
        padding: 6px 14px;
        border-radius: 999px;
        font-size: 12.5px;
        font-weight: 600;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .chart-toggle-btn.active {
        background: var(--accent);
        color: #fff;
    }

    .chart-card-body {
        position: relative;
        height: 280px;
    }

    .chart-card-body canvas {
        width: 100% !important;
        max-height: 100%;
    }

    @media (max-width: 768px) {
        .chart-card-header {
            flex-direction: column;
            align-items: flex-start;
        }

        .chart-toggle {
            width: 100%;
            justify-content: space-between;
        }

        .chart-card-body {
            height: 260px;
        }
    }

    /* ============ DATA VIEW (Peserta / Verifikasi / Lolos Kurasi) ============ */
    .toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
        margin-bottom: 16px;
    }

    .search-box {
        position: relative;
        flex: 1;
        min-width: 200px;
    }

    .search-box svg {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        width: 16px;
        height: 16px;
        color: var(--text-muted);
        pointer-events: none;
    }

    .search-box input {
        width: 100%;
        padding: 10px 12px 10px 36px;
        border: 1px solid var(--border-elevated);
        border-radius: 8px;
        font-family: inherit;
        font-size: 13px;
        background: var(--surface-elevated);
        box-shadow: var(--shadow-elevated);
    }

    .search-box input:focus { outline: none; border-color: var(--accent); }

    .filter-select, .filter-date {
        padding: 10px 12px;
        border: 1px solid var(--border-elevated);
        border-radius: 8px;
        font-family: inherit;
        font-size: 13px;
        background: var(--surface-elevated);
        box-shadow: var(--shadow-elevated);
        color: var(--text-primary);
        cursor: pointer;
    }

    .filter-date { cursor: text; }

    .btn-sm {
        padding: 9px 14px;
        border-radius: 8px;
        font-family: inherit;
        font-size: 13px;
        font-weight: 600;
        cursor: pointer;
        border: 1px solid var(--border-elevated);
        background: var(--surface-elevated);
        color: var(--text-body);
        display: inline-flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
        transition: all 0.15s;
    }

    .btn-sm:hover { border-color: var(--accent); color: var(--accent); }
    .btn-sm:hover { background: var(--outline-hover-bg); box-shadow: var(--shadow-elevated); }
    .btn-sm svg { width: 14px; height: 14px; }

    .btn-sm.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
    .btn-sm.primary:hover { background: var(--accent-hover); }

    .btn-sm.danger-outline { color: var(--danger); border-color: var(--border); }
    .btn-sm.danger-outline:hover { border-color: var(--danger); background: var(--danger-hover-bg); }

    .btn-sm:disabled { opacity: 0.72; cursor: not-allowed; background: var(--disabled-bg); }
    .btn-sm.primary:disabled {
        background: var(--primary-disabled-bg);
        border-color: var(--primary-disabled-bg);
        color: var(--primary-disabled-text);
        opacity: 1;
    }
    .btn-sm:disabled:hover { border-color: var(--border-elevated); color: var(--text-body); }
    .btn-sm.primary:disabled:hover {
        background: var(--primary-disabled-bg);
        border-color: var(--primary-disabled-bg);
        color: var(--primary-disabled-text);
    }

    .active-filter-count {
        background: var(--accent);
        color: #fff;
        font-size: 10px;
        font-weight: 700;
        border-radius: 8px;
        padding: 1px 6px;
        margin-left: 4px;
    }

    /* Bulk toolbar */
    .bulk-toolbar {
        display: none;
        align-items: center;
        gap: 10px;
        background: var(--bulk-toolbar-bg);
        border: 1px solid var(--bulk-toolbar-border);
        border-radius: 8px;
        padding: 10px 14px;
        margin-bottom: 14px;
        flex-wrap: wrap;
    }

    .bulk-toolbar.show { display: flex; }

    .bulk-toolbar .count { font-size: 13px; font-weight: 700; color: var(--accent); margin-right: auto; }

    /* Table */
    .table-wrap {
        background: var(--surface-elevated);
        border: 1px solid var(--border-elevated);
        border-radius: var(--radius);
        overflow: hidden;
        box-shadow: var(--shadow-elevated);
    }

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

    table.data-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 13px;
        min-width: 920px;
    }

    table.data-table th {
        text-align: left;
        padding: 12px 14px;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        color: var(--text-muted);
        border-bottom: 1px solid var(--border);
        background: var(--bg-primary);
        white-space: nowrap;
        user-select: none;
    }

    table.data-table th.sortable { cursor: pointer; }
    table.data-table th.sortable:hover { color: var(--accent); }
    table.data-table th .sort-arrow { margin-left: 4px; opacity: 0.4; }
    table.data-table th.sort-active .sort-arrow { opacity: 1; color: var(--accent); }

    table.data-table td {
        padding: 12px 14px;
        border-bottom: 1px solid var(--border);
        vertical-align: middle;
        max-width: 220px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    table.data-table tbody tr:last-child td { border-bottom: none; }
    table.data-table tbody tr:hover { background: var(--table-hover-bg); }
    table.data-table tbody tr.row-selected { background: var(--table-selected-bg); }

    .row-name { font-weight: 700; cursor: pointer; }
    .row-name:hover { color: var(--accent); text-decoration: underline; }
    .row-kode { font-family: monospace; font-size: 12px; color: var(--text-muted); }

    .badge {
        display: inline-block;
        padding: 3px 9px;
        border-radius: 20px;
        font-size: 11px;
        font-weight: 700;
        white-space: nowrap;
    }

    .badge-pending { background: var(--badge-pending-bg); color: var(--warning); }
    .badge-approved { background: var(--badge-approved-bg); color: var(--success); }
    .badge-rejected { background: var(--badge-rejected-bg); color: var(--danger); }
    .badge-null { background: var(--badge-null-bg); color: var(--text-muted); }
    .badge-kategori { background: var(--badge-kategori-bg); color: var(--accent); }

    .wa-icon-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        border-radius: 7px;
        background: var(--wa-bg);
        color: var(--wa-color);
        border: none;
        cursor: pointer;
        transition: transform 0.1s;
    }

    .wa-icon-btn:hover { transform: scale(1.08); }
    .wa-icon-btn svg { width: 16px; height: 16px; }
    .wa-icon-btn.disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

    .row-actions { display: flex; gap: 6px; align-items: center; }

    .checkbox-cell { width: 36px; }
    input[type="checkbox"].row-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }

    .empty-row td {
        text-align: center;
        padding: 48px 20px;
        color: var(--text-muted);
        font-size: 13px;
    }

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

    .pagination-controls { display: flex; align-items: center; gap: 6px; }

    .page-btn {
        width: 30px;
        height: 30px;
        border-radius: 6px;
        border: 1px solid var(--border-elevated);
        background: var(--surface-elevated);
        cursor: pointer;
        font-size: 12px;
        font-weight: 600;
        color: var(--text-body);
    }

    .page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
    .page-btn:hover:not(:disabled) { background: var(--outline-hover-bg); box-shadow: var(--shadow-elevated); }
    .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
    .page-btn.current { background: var(--accent); color: #fff; border-color: var(--accent); }

    /* Modal */
    .modal-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 300;
        align-items: flex-start;
        justify-content: center;
        padding: 40px 16px;
        overflow-y: auto;
    }

    .modal-overlay.show { display: flex; }

    .modal-box {
        background: var(--surface-elevated-strong);
        border: 1px solid var(--border-elevated);
        border-radius: var(--radius);
        width: 100%;
        max-width: 720px;
        box-shadow: var(--shadow-modal);
        margin-bottom: 40px;
    }

    .modal-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        padding: 22px 26px;
        border-bottom: 1px solid var(--border);
    }

    .modal-head h2 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }
    .modal-head .sub { font-size: 12px; color: var(--text-muted); font-family: monospace; }

    .modal-close {
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-muted);
        padding: 4px;
        border-radius: 6px;
    }

    .modal-close:hover { background: var(--bg-primary); color: var(--text-primary); }
    .modal-close svg { width: 20px; height: 20px; }

    .modal-body { padding: 22px 26px; max-height: 60vh; overflow-y: auto; }

    .modal-tabs { display: flex; gap: 4px; padding: 0 26px; border-bottom: 1px solid var(--border); }

    .modal-tab {
        padding: 12px 4px;
        margin-right: 20px;
        font-size: 13px;
        font-weight: 700;
        color: var(--text-muted);
        cursor: pointer;
        border-bottom: 2px solid transparent;
        background: none;
        border-top: none; border-left: none; border-right: none;
    }

    .modal-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

    .field-group { margin-bottom: 20px; }
    .field-group h4 {
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.4px;
        color: var(--accent);
        font-weight: 800;
        margin-bottom: 10px;
    }

    .field-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 12px 16px;
    }

    .field-item .k { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 2px; }
    .field-item .v { font-size: 13px; color: var(--text-primary); word-break: break-word; }
    .field-item .v.empty { color: var(--text-muted); font-style: italic; }
    .field-item.full { grid-column: 1 / -1; }

    .modal-footer {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
        padding: 18px 26px;
        border-top: 1px solid var(--border);
    }

    .audit-item {
        padding: 10px 0;
        border-bottom: 1px solid var(--border);
        font-size: 12px;
    }
    .audit-item:last-child { border-bottom: none; }
    .audit-item .who { font-weight: 700; }
    .audit-item .when { color: var(--text-muted); float: right; }
    .audit-item .what { color: var(--text-body); margin-top: 2px; }

    .json-diff-block {
        background: var(--bg-secondary);
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 12px;
        font-size: 11.5px;
        font-family: 'SFMono-Regular', Consolas, monospace;
        white-space: pre-wrap;
        word-break: break-word;
        max-height: 260px;
        overflow-y: auto;
    }

    select.assign-select,
    input.assign-select,
    textarea.assign-select {
        padding: 9px 10px;
        border-radius: 8px;
        border: 1px solid var(--border-elevated);
        font-family: inherit;
        font-size: 13px;
        background: var(--surface-elevated);
        color: var(--text-primary);
        box-shadow: none;
    }

    select.assign-select:focus,
    input.assign-select:focus,
    textarea.assign-select:focus {
        outline: none;
        border-color: var(--accent);
        box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
    }

    .loading-cell { text-align: center; padding: 40px; color: var(--text-muted); font-size: 13px; }
    .text-muted { color: var(--text-muted); }

    @media (max-width: 640px) {
        .modal-body { max-height: 50vh; }
        .field-grid { grid-template-columns: 1fr 1fr; }
    }

    /* Toast */
    #toastContainer {
        position: fixed;
        bottom: 24px;
        right: 24px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        z-index: 200;
    }

    .toast {
        background: var(--text-primary);
        color: #fff;
        padding: 13px 18px;
        border-radius: 8px;
        font-size: 13px;
        font-weight: 600;
        box-shadow: 0 4px 16px rgba(0,0,0,0.2);
        display: flex;
        align-items: center;
        gap: 10px;
        min-width: 260px;
        animation: toastIn 0.25s ease;
    }

    .toast.success { border-left: 3px solid var(--success-border); }
    .toast.error { border-left: 3px solid var(--accent); }

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

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        z-index: 90;
    }

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

    .theme-toggle {
        display: inline-flex;
        align-items: center;
        gap: 7px;
        min-height: 34px;
        padding: 5px 9px;
        border: 1px solid var(--border);
        border-radius: 999px;
        background: var(--bg-card);
        color: var(--text-body);
        font: inherit;
        font-size: 12px;
        font-weight: 700;
        cursor: pointer;
    }

    .theme-toggle:hover {
        border-color: var(--accent);
        color: var(--accent);
    }

    .theme-toggle-track {
        position: relative;
        width: 29px;
        height: 16px;
        border-radius: 999px;
        background: var(--border);
        transition: background .15s ease;
    }

    .theme-toggle-track::after {
        content: '';
        position: absolute;
        top: 2px;
        left: 2px;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        background: var(--bg-card);
        transition: transform .15s ease;
    }

    [data-theme="dark"] .theme-toggle-track {
        background: var(--accent);
    }

    [data-theme="dark"] .theme-toggle-track::after {
        transform: translateX(13px);
    }

    [data-theme="dark"] .sidebar-nav-group + .sidebar-nav-group {
        background: #2b231f;
    }

    [data-theme="dark"] .winner-bento {
        background: var(--bg-card);
    }

    #labelOverlay {
        color-scheme: light;
    }

    #labelOverlay .label-paper {
        background: #fff;
    }

    [data-theme="dark"] #detailModalOverlay input:not([type="hidden"]),
    [data-theme="dark"] #detailModalOverlay select,
    [data-theme="dark"] #detailModalOverlay textarea {
        background: var(--bg-card) !important;
        color: var(--text-primary) !important;
        border-color: var(--border) !important;
    }

    [data-theme="dark"] #detailModalOverlay .roasting-readonly,
    [data-theme="dark"] #detailModalOverlay #kaAuthUid,
    [data-theme="dark"] #detailModalOverlay #kaEmail {
        background: var(--bg-secondary) !important;
    }

    /* ============ RESPONSIVE ============ */
    @media (max-width: 900px) {
        .sidebar {
            transform: translateX(-100%);
        }
        .sidebar.open { transform: translateX(0); }
        .main-content { margin-left: 0; }
        .hamburger { display: flex; align-items: center; justify-content: center; }
        .topbar { padding: 0 16px; }
        .view-container { padding: 18px; }
        .notif-dropdown { right: 16px; width: calc(100vw - 32px); }
        .theme-toggle-label { display: none; }
    }
