/* ============================================================
   E-SPMB - DESKTOP & CORE STYLESHEET
   SD Muhammadiyah Serut
   ============================================================ */

:root {
    --primary: #059669;
    --primary-soft: #ecfdf5;
    --primary-mid: #10b981;
    --secondary: #065f46;
    --emerald: #10b981;
    --emerald-soft: #ecfdf5;
    --amber: #d97706;
    --amber-soft: #fffbeb;
    --sky: #0ea5e9;
    --sky-soft: #f0f9ff;
    --danger: #dc2626;
    --bg: #f1f5f9;
    --bg-body: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-main: #0f172a;
    --text-color: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.09);
    --sidebar-width: 248px;
    --sidebar-bg: #0d2d20;
    --sidebar-bg-alt: #071a12;
    --sidebar-text: rgba(255,255,255,0.72);
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ===== LOADING SCREEN ===== */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--sidebar-bg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    transition: opacity 0.35s ease;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    width: 52px;
    height: 52px;
    background: rgba(255,255,255,0.1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255,255,255,0.15);
}

.loading-logo i {
    color: #6ee7b7;
    font-size: 28px;
}

.loading-ring {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,0.12);
    border-top-color: #6ee7b7;
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

.loading-text {
    color: rgba(255,255,255,0.9);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

.loading-sub {
    color: rgba(255,255,255,0.45);
    font-size: 0.78rem;
    margin-top: -12px;
}

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

/* ===== HEADER ===== */
.header {
    background: var(--surface);
    padding: 0 28px;
    height: 60px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: var(--shadow-sm);
}

.btn-back-portal {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: all 0.18s;
    flex-shrink: 0;
}

.btn-back-portal:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #a7f3d0;
}

.btn-back-portal i { font-size: 17px; }

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-badge {
    width: 36px;
    height: 36px;
    background: var(--secondary);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-badge i {
    color: #6ee7b7;
    font-size: 18px;
}

.logo-text h1 {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.2px;
    line-height: 1.2;
}

.logo-text p {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}

.header-divider {
    width: 1px;
    height: 24px;
    background: var(--border);
    margin: 0 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.header-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all 0.18s;
}

.header-link:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #a7f3d0;
}

.header-link i { font-size: 15px; }

.refresh-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.18s;
    position: relative;
    z-index: 999999 !important;
    pointer-events: auto !important;
}

.refresh-btn:hover {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: #a7f3d0;
}

.refresh-btn i { font-size: 17px; }

.refresh-btn.spinning i {
    animation: spin 0.7s linear infinite;
}

.refresh-btn#settingsBtn:hover {
    background: var(--amber-soft);
    color: var(--amber);
    border-color: #fcd34d;
}

/* ===== LIVE BADGE ===== */
.live-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-soft);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #a7f3d0;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.75); }
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0;
}

/* ===== HERO STAT ===== */
.hero-bar {
    background: var(--secondary);
    border-radius: var(--radius-lg);
    padding: 28px 36px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 6px 24px rgba(6,79,58,0.28);
}

.hero-left {
    flex: 1;
    z-index: 2;
}

.hero-right {
    text-align: right;
    z-index: 2;
    background: rgba(255,255,255,0.08);
    padding: 18px 22px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.12);
    min-width: 200px;
}

.hero-bar::before {
    content: '';
    position: absolute;
    right: -60px;
    top: -60px;
    width: 280px;
    height: 280px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}

.hero-info h2 {
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255,255,255,0.6);
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.hero-total {
    font-size: 3.6rem;
    font-weight: 900;
    color: white;
    line-height: 1;
    letter-spacing: -2px;
}

.hero-total span {
    font-size: 1.2rem;
    font-weight: 600;
    opacity: 0.6;
    margin-left: 4px;
}

.hero-sub {
    font-size: 0.82rem;
    color: rgba(255,255,255,0.6);
    margin: 8px 0 16px;
    font-weight: 500;
}

.hero-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    z-index: 1;
}

.hero-chip {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--radius-sm);
    padding: 8px 16px;
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.hero-chip .num {
    font-size: 1.25rem;
    font-weight: 900;
}

/* ===== STAT CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.stat-card {
    background: var(--surface);
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
    cursor: default;
    border-top: 3px solid transparent;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
}

.stat-card:nth-child(1) { border-top-color: var(--primary); }
.stat-card:nth-child(2) { border-top-color: #10b981; }
.stat-card:nth-child(3) { border-top-color: var(--amber); }
.stat-card:nth-child(4) { border-top-color: var(--sky); }

.stat-icon {
    display: none !important;
}

.stat-icon i { display: none !important; }

.stat-info {
    display: flex;
    flex-direction: column-reverse;
    gap: 4px;
}

.stat-info h3 {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.8px;
    color: var(--text);
    margin: 0;
}

.stat-info p {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin: 0;
}

/* ===== MAIN CARD ===== */
.main-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    min-width: 220px;
    flex: 1;
    max-width: 320px;
}

.search-box input {
    width: 100%;
    height: 38px;
    padding: 0 12px 0 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    outline: none;
    font-size: 0.82rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 500;
    transition: 0.18s;
    background: white;
    color: var(--text);
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5,150,105,0.1);
}

.search-box i {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 16px;
}

.filter-select-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    height: 38px;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.filter-select-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5,150,105,0.1);
}

.filter-select-wrapper i {
    font-size: 16px;
    color: #64748b;
}

.filter-select-wrapper select {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    outline: none;
    cursor: pointer;
    padding-right: 4px;
}

#syncBadge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 38px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    background: #f8fafc;
    color: #334155;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.18s;
    user-select: none;
}

#syncBadge:hover {
    background: #f1f5f9;
    border-color: var(--border-strong);
}

#syncDot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    display: inline-block;
}

#syncBadge i {
    font-size: 14px;
    color: #64748b;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 12px;
    height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.78rem;
    color: #334155;
    transition: all 0.18s;
    font-family: 'Plus Jakarta Sans', sans-serif;
    white-space: nowrap;
}

.action-btn i {
    font-size: 16px;
    color: #64748b;
}

.action-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: var(--text);
}

.action-btn.primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.action-btn.primary i {
    color: white;
}

.action-btn.primary:hover {
    background: var(--secondary);
    border-color: var(--secondary);
}

/* ===== TABLE ===== */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 780px;
}

thead tr {
    background: #0d2d20;
}

th {
    padding: 12px 14px;
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255,255,255,0.85);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
    text-align: center;
}

th .sort-icon {
    color: rgba(255,255,255,0.4) !important;
    font-size: 13px;
    margin-left: 3px;
}

td {
    padding: 11px 14px;
    font-size: 0.86rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-color);
}

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

tbody tr { transition: background 0.12s; }

tbody tr:nth-child(even)  { background: #f8fafc; }
tbody tr:nth-child(odd)   { background: #ffffff; }
tbody tr:hover            { background: rgba(5,150,105,0.04) !important; }

/* Row Checkbox */
.row-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

@keyframes slide-down {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== ACTION BUTTONS IN TABLE ===== */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    outline: none;
    transition: all 0.15s;
    background: transparent;
    color: var(--text-muted);
}

.btn-icon i { font-size: 16px; }

.btn-icon.status {
    color: var(--amber);
    background: var(--amber-soft);
    border-color: #fde68a;
}
.btn-icon.status:hover {
    background: var(--amber);
    color: white;
    border-color: var(--amber);
}

.btn-icon.view {
    color: #2563eb;
    background: #eff6ff;
    border-color: #bfdbfe;
}
.btn-icon.view:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

.btn-icon.print {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #a7f3d0;
}
.btn-icon.print:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-icon.delete {
    color: var(--danger);
    background: #fff5f5;
    border-color: #fecaca;
}
.btn-icon.delete:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

/* ===== TABLE CELLS ===== */
.no-col { width: 48px; }

.no-badge {
    width: 26px;
    height: 26px;
    background: #f1f5f9;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
}

.name-cell {
    font-weight: 600;
    color: var(--text);
}

.name-cell small {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 1px;
}

.time-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1px;
    line-height: 1.25;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.time-cell .time-date {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
}

.time-cell .time-hour {
    font-size: 0.69rem;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
    white-space: nowrap;
}

.gender-badge {
    display: inline-flex;
    align-items: center;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    justify-content: center;
}

.gender-l     { background: #dbeafe; color: #1d4ed8; }
.gender-p     { background: #fce7f3; color: #9d174d; }
.gender-unknown { background: #f1f5f9; color: #64748b; }

/* ===== STATUS PILLS ===== */
.status-pill {
    padding: 3px 9px;
    border-radius: 5px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    display: inline-block;
}

.status-utama {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.status-cadangan {
    background: var(--amber-soft);
    color: #78350f;
    border: 1px solid #fcd34d;
}

.status-cadangan_prioritas,
.status-cadangan-prioritas {
    background: #fef9c3;
    color: #713f12;
    border: 1px solid #fde047;
    font-weight: 700;
}

.status-inden {
    background: var(--sky-soft);
    color: #075985;
    border: 1px solid #7dd3fc;
}

/* ===== DETAIL BUTTON ===== */
.btn-detail {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 6px 11px;
    border-radius: 6px;
    border: 1px solid #a7f3d0;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.76rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
    transition: all 0.18s;
}

.btn-detail:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-detail i { font-size: 14px; }

/* ===== TABLE FOOTER ===== */
.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0 0;
    margin-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 56px 20px;
}

.empty-icon {
    width: 60px;
    height: 60px;
    background: #f1f5f9;
    border-radius: var(--radius-md);
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon i {
    font-size: 28px;
    color: #94a3b8;
}

.empty-state h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 860px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
}

.modal-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.btn-close {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all 0.18s;
    flex-shrink: 0;
}

.btn-close:hover {
    background: #fff5f5;
    color: var(--danger);
    border-color: #fecaca;
}

.detail-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin: 20px 0 12px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--border);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.detail-item label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}

.detail-item p {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    word-break: break-word;
}

.detail-item.col-span-2 { grid-column: span 2; }

.detail-item input,
.detail-item select,
.detail-item textarea {
    width: 100%;
    padding: 8px 11px;
    border-radius: 7px;
    border: 1px solid var(--border);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    background: white;
    box-sizing: border-box;
    transition: border-color 0.18s, box-shadow 0.18s;
    color: var(--text);
}

.detail-item input:focus,
.detail-item select:focus,
.detail-item textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(5,150,105,0.1);
}

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

/* ===== COLUMN MAPPING MODAL ===== */
.map-modal {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.55);
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.map-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.map-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 14px;
    font-size: 0.84rem;
}

.map-table th {
    background: #f8fafc;
    padding: 9px 12px;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.map-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.map-table select {
    width: 100%;
    padding: 6px 9px;
    border-radius: 6px;
    border: 1px solid var(--border);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    outline: none;
    transition: 0.18s;
    background: #f8fafc;
    color: var(--text);
}

.map-table select:focus {
    border-color: var(--primary);
    background: white;
}

.preview-row td {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-family: 'DM Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.map-badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 0.66rem;
    font-weight: 700;
}

.map-badge.req { background: #fee2e2; color: #991b1b; }
.map-badge.opt { background: #f1f5f9; color: var(--text-muted); }

.sheet-tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.sheet-tab {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.76rem;
    transition: 0.15s;
    color: var(--text-muted);
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.sheet-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: #0f172a;
    color: white;
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.84rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toast-in 0.25s ease, toast-out 0.3s ease 2.7s forwards;
    max-width: 300px;
    border-left: 3px solid transparent;
}

.toast.success { border-left-color: var(--emerald); }
.toast.error   { border-left-color: var(--danger); }

.toast i { font-size: 16px; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
    from { opacity: 1; }
    to   { opacity: 0; pointer-events: none; }
}

/* ===== SIDEBAR ===== */
#sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 150;
}

#sidebarOverlay.open { display: block; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    overflow-y: auto;
    z-index: 200;
    transition: transform 0.28s var(--ease);
    border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 18px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar .brand-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6ee7b7;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.1);
}

.sidebar .brand-icon i { font-size: 18px; }

.sidebar .brand-text h1 {
    color: white;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar .brand-text p {
    color: var(--sidebar-text);
    font-size: 10px;
    margin-top: 1px;
}

.sidebar-menu {
    padding: 10px 8px 20px;
}

.menu-category {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.28);
    padding: 14px 10px 4px;
    text-transform: uppercase;
}

.sidebar-menu .nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border-radius: 7px;
    margin-bottom: 1px;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: background 0.14s, color 0.14s;
    font-size: 12.5px;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-menu .nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: white;
}

.sidebar-menu .nav-item:active {
    transform: scale(0.99);
}

.sidebar-menu .nav-item.active {
    background: rgba(16,185,129,0.15);
    color: #6ee7b7;
    font-weight: 600;
    border-left: 2px solid #6ee7b7;
    padding-left: 9px;
}

.sidebar-menu .nav-item.active .material-icons-round {
    color: #6ee7b7;
    opacity: 1;
}

.sidebar-menu .nav-item .material-icons-round {
    font-size: 17px;
    flex-shrink: 0;
    opacity: 0.75;
}

.sidebar-menu .back-btn {
    color: rgba(110,231,183,0.75);
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    border-radius: 0;
    padding-bottom: 10px;
    text-decoration: none;
}

.sidebar-badge {
    background: rgba(245,158,11,0.18);
    color: #fbbf24;
    border: 1px solid rgba(245,158,11,0.32);
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: auto;
    letter-spacing: 0.2px;
    display: inline-flex;
    align-items: center;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text);
    padding: 6px;
    border-radius: 8px;
    transition: background 0.15s;
}

.mobile-toggle:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.mobile-toggle i { font-size: 22px; }

.datetime-container div:first-child {
    font-size: 11px;
    color: var(--text-muted);
}

.live-time {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ===== CONTENT AREA ===== */
.content-area {
    flex: 1;
    padding: 22px;
}

/* ===== PRINT MEDIA ===== */
@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body>*:not(#printTemplate) { display: none !important; }

    .loading-screen,
    .toast-container,
    .header,
    .container,
    .modal,
    .sidebar,
    #sidebarOverlay {
        display: none !important;
    }

    #printTemplate {
        display: block !important;
        position: static !important;
        width: 100% !important;
        height: auto !important;
        padding: 8mm 12mm !important;
        margin: 0 !important;
        background: white !important;
        color: black !important;
        font-family: 'Times New Roman', serif !important;
        font-size: 8.5pt !important;
        line-height: 1.1 !important;
        box-shadow: none !important;
        border: none !important;
    }

    @page {
        size: A4 portrait;
        margin: 0;
    }
}

/* ============================================================
   TABEL PENDAFTAR — perapian (class menggantikan style inline di tabel.js)
   ============================================================ */
td.col-center { text-align: center; }
td.col-left   { text-align: left; }

.no-col .no-badge,
td.col-center .no-badge { margin: 0 auto; cursor: help; }
.no-badge.is-empty { opacity: 0.5; }

/* Waktu daftar: rata kiri */
.time-cell { align-items: flex-start; }

/* Nama + baris meta */
.name-cell { display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.name-main { font-weight: 700; line-height: 1.3; }
.name-meta {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
    font-size: 0.72rem; color: var(--text-muted);
}
.reg-no { font-family: 'DM Mono', monospace; font-weight: 600; }

/* Label kecil seragam (sumber data / Firebase) */
.tag {
    display: inline-block; padding: 1px 7px; border-radius: 4px;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.2px; line-height: 1.5;
    cursor: help; white-space: nowrap;
}
.tag-src { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.tag-fb  { background: var(--amber-soft); color: #92400e; border: 1px solid #fcd34d; }

/* Chip daftar ganda */
.multi-year-chip {
    display: inline-flex; align-items: center; gap: 4px; margin-top: 2px;
    padding: 2px 8px; border-radius: 4px; cursor: pointer;
    font-size: 0.66rem; font-weight: 700; line-height: 1.3;
    background: #fef3c7; color: #92400e; border: 1px solid #fcd34d;
    transition: background 0.15s;
}
.multi-year-chip:hover { background: #fde68a; }
.multi-year-chip i { font-size: 13px; }

/* Asal sekolah: rata kiri, maks 2 baris */
.school-cell {
    font-size: 0.82rem; color: var(--text-muted); min-width: 130px; max-width: 220px;
}
.school-cell { overflow-wrap: anywhere; }

/* Status + catatan */
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.status-cell .status-pill { white-space: nowrap; cursor: default; }
.status-note {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
    max-width: 180px; font-size: 0.68rem; font-weight: 600; line-height: 1.3;
    color: var(--text-muted);
}
.status-note i { font-size: 12px; vertical-align: -2px; margin-right: 3px; }
.status-note.note-batal     { color: #dc2626; }
.status-note.note-cadangan,
.status-note.note-prioritas { color: #b45309; }
.status-note.note-inden     { color: #1d4ed8; }
.status-note.note-khusus    { color: #059669; }
.status-note.note-muted     { color: var(--text-muted); font-weight: 500; }

/* Tombol aksi */
.action-cell { display: flex; justify-content: center; gap: 6px; }
.btn-icon.restore {
    color: var(--emerald); background: var(--emerald-soft); border-color: #a7f3d0;
}
.btn-icon.restore:hover { background: var(--emerald); color: white; border-color: var(--emerald); }

.clamp-2 { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }

/* Pembatas antar kolom tabel pendaftar */
.table-wrap table:not(.map-table) th,
.table-wrap table:not(.map-table) td {
    border-right: 1px solid #e2e8f0;
}
.table-wrap table:not(.map-table) th {
    border-right-color: rgba(255,255,255,0.12);
}
.table-wrap table:not(.map-table) th:last-child,
.table-wrap table:not(.map-table) td:last-child {
    border-right: none;
}

/* Badge "Normal — Supabase Primary" disembunyikan (desktop & HP) */
#egressStatusBadge { display: none !important; }
