/* --- CSS DESIGN SYSTEM FOR BUKU AJAR DIGITAL ABSENSI & PENILAIAN --- */
:root {
    --bg-main: #f8fafc;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-active: #334155;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Theme Accent Colors */
    --color-primary: #4f46e5;
    --color-primary-hover: #4338ca;
    --color-success: #10b981;
    --color-success-bg: #ecfdf5;
    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-info: #0284c7;
    --color-info-bg: #f0f9ff;
    --color-danger: #f43f5e;
    --color-danger-bg: #fff1f2;

    --border-color: #e2e8f0;
    --border-radius: 12px;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px -5px rgba(15, 23, 42, 0.12);
    --transition: all 0.2s 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-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14px;
    overflow-x: hidden;
}

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

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.brand-text h2 {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.5px;
    line-height: 1.2;
    color: #ffffff;
}

.brand-text span {
    font-size: 11px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-menu {
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: #cbd5e1;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    width: 100%;
}

.nav-item i {
    font-size: 18px;
    width: 22px;
    text-align: center;
    color: #94a3b8;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: var(--sidebar-hover);
    color: #ffffff;
}

.nav-item:hover i {
    color: #818cf8;
}

.nav-item.active {
    background: linear-gradient(90deg, #4f46e5, #6366f1);
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.35);
}

.nav-item.active i {
    color: #ffffff;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.school-badge {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 10px;
}

.school-badge i {
    font-size: 20px;
    color: #818cf8;
}

.school-badge strong {
    display: block;
    font-size: 13px;
}

.school-badge small {
    font-size: 11px;
    color: #94a3b8;
}

/* Main Content Styling */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 30px;
    min-width: 0;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    background: #ffffff;
    padding: 20px 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.header-title h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.class-selector-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-main);
    padding: 6px 14px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.class-selector-group label {
    font-weight: 600;
    color: var(--text-secondary);
}

/* Cards System */
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header.border-danger {
    border-left: 4px solid var(--color-danger);
}

.card-body {
    padding: 24px;
}

/* Tab Panels Navigation */
.tab-pane {
    display: none;
    animation: fadeIn 0.25s ease-in-out;
}

.tab-pane.active {
    display: block;
}

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

/* Stat Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.stat-card.primary::after { background: var(--color-primary); }
.stat-card.success::after { background: var(--color-success); }
.stat-card.warning::after { background: var(--color-warning); }
.stat-card.danger::after { background: var(--color-danger); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-card.primary .stat-icon { background: #e0e7ff; color: var(--color-primary); }
.stat-card.success .stat-icon { background: var(--color-success-bg); color: var(--color-success); }
.stat-card.warning .stat-icon { background: var(--color-warning-bg); color: var(--color-warning); }
.stat-card.danger .stat-icon { background: var(--color-danger-bg); color: var(--color-danger); }

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin: 4px 0;
}

.stat-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.progress-bar-container {
    height: 6px;
    background: #e2e8f0;
    border-radius: 10px;
    margin-top: 6px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--color-success);
    border-radius: 10px;
    transition: width 0.5s ease;
}

/* Dashboard Charts Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.chart-card canvas {
    max-height: 240px;
}

/* Form Controls & Buttons */
.form-control, .form-select {
    padding: 9px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    background-color: #ffffff;
    transition: var(--transition);
    outline: none;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.form-inline {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--color-success);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}

.btn-success:hover {
    background-color: #059669;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #64748b;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--bg-main);
    border-color: #cbd5e1;
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--color-danger);
    color: var(--color-danger);
}

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

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* Tables Styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th, .table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background-color: #f1f5f9;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
}

.table-hover tbody tr:hover {
    background-color: #f8fafc;
}

.table-bordered th, .table-bordered td {
    border: 1px solid var(--border-color);
}

/* Matrix Table Specifics */
.matrix-table-wrapper {
    overflow-x: auto;
    max-height: 520px;
}

.table-matrix th {
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-matrix td {
    text-align: center;
}

/* Attendance Status Radio Buttons / Pill Group */
.status-pill-group {
    display: flex;
    justify-content: center;
    gap: 6px;
}

.status-btn {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #ffffff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-btn[data-status="H"]:hover, .status-btn[data-status="H"].active {
    background-color: var(--color-success);
    color: #ffffff;
    border-color: var(--color-success);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.status-btn[data-status="S"]:hover, .status-btn[data-status="S"].active {
    background-color: var(--color-warning);
    color: #ffffff;
    border-color: var(--color-warning);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.status-btn[data-status="I"]:hover, .status-btn[data-status="I"].active {
    background-color: var(--color-info);
    color: #ffffff;
    border-color: var(--color-info);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3);
}

.status-btn[data-status="A"]:hover, .status-btn[data-status="A"].active {
    background-color: var(--color-danger);
    color: #ffffff;
    border-color: var(--color-danger);
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.3);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    display: inline-block;
}

.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger); }

/* Sub Tabs */
.sub-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 8px;
}

.sub-tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
}

.sub-tab-btn.active {
    background-color: #e0e7ff;
    color: var(--color-primary);
}

.sub-tab-content {
    display: none;
    padding-top: 15px;
}

.sub-tab-content.active {
    display: block;
}

.action-card {
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: #f8fafc;
}

.action-card h4 {
    font-size: 14px;
    margin-bottom: 6px;
}

.action-card p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

/* Notification Toast */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: 10px;
    background: #0f172a;
    color: #ffffff;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUp 0.3s ease;
}

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

.mt-20 { margin-top: 20px; }
.mb-15 { margin-bottom: 15px; }
.mb-10 { margin-bottom: 10px; }
.w-100 { width: 100%; }
.text-danger { color: var(--color-danger); }
.text-success { color: var(--color-success); }
.text-muted { color: var(--text-muted); }

/* Custom Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeInModal 0.2s ease-out;
}

.modal-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    animation: slideUpModal 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
}

.modal-close-btn:hover {
    color: var(--color-danger);
}

.modal-body {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUpModal {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Editable Table Cells */
.editable-absensi-cell, .editable-score-cell {
    cursor: pointer;
    position: relative;
    transition: var(--transition);
}

.editable-absensi-cell:hover, .editable-score-cell:hover {
    background-color: #e2e8f0 !important;
    outline: 2px dashed var(--color-primary);
    outline-offset: -2px;
}

.editable-absensi-cell::after, .editable-score-cell::after {
    content: "✏️";
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    opacity: 0;
    transition: var(--transition);
}

.editable-absensi-cell:hover::after, .editable-score-cell:hover::after {
    opacity: 0.7;
}

/* Inline Inputs */
.table-inline-input {
    width: 80px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 700;
    border: 2px solid var(--color-primary);
    border-radius: 6px;
    text-align: center;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
    outline: none;
}

/* Sticky Columns for Matrix Tables */
.table-matrix .sticky-col-no {
    position: sticky;
    left: 0;
    z-index: 6;
    background: #ffffff;
}
.table-matrix thead th.sticky-col-no {
    z-index: 16;
    background: #f1f5f9;
}
.table-matrix .sticky-col-nisn {
    position: sticky;
    left: 50px;
    z-index: 6;
    background: #ffffff;
}
.table-matrix thead th.sticky-col-nisn {
    z-index: 16;
    background: #f1f5f9;
}
.table-matrix .sticky-col-name {
    position: sticky;
    left: 160px;
    z-index: 6;
    background: #ffffff;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}
.table-matrix thead th.sticky-col-name {
    z-index: 16;
    background: #f1f5f9;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

/* Responsive Grid Utility Classes */
.responsive-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.responsive-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.responsive-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

@media (max-width: 992px) {
    .responsive-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .responsive-grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .responsive-grid-4,
    .responsive-grid-3,
    .responsive-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
}

/* ==========================================================
   SUPABASE CLOUD SYNC & STATUS STYLES
   ========================================================== */
.btn-cloud {
    background: #ffffff;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 9999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-cloud:hover {
    border-color: var(--color-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.cloud-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.cloud-badge.status-connected {
    color: #059669;
}

.cloud-badge.status-syncing {
    color: #2563eb;
}

.cloud-badge.status-unconfigured {
    color: #d97706;
}

.cloud-badge.status-offline,
.cloud-badge.status-error {
    color: #e11d48;
}

/* Supabase Setup Modal Specifics */
.supabase-modal-box {
    max-width: 580px !important;
}

.cloud-guide-banner {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 18px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    font-size: 13px;
    color: #166534;
}

.cloud-guide-banner i {
    font-size: 18px;
    margin-top: 2px;
    color: #15803d;
}

.supabase-status-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.supabase-status-alert.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.supabase-status-alert.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.supabase-status-alert.alert-danger {
    background: #fff1f2;
    border: 1px solid #fecdd3;
    color: #9f1239;
}

/* ==========================================================
   MOBILE RESPONSIVE SYSTEM
   ========================================================== */

/* Header left group for hamburger & title */
.header-left-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Mobile Hamburger Toggle Button */
.mobile-menu-btn {
    display: none;
    background: #f1f5f9;
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-primary);
    transition: var(--transition);
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background: #e2e8f0;
    color: var(--color-primary);
}

/* Mobile Sidebar Close Button */
.mobile-sidebar-close {
    display: none;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 26px;
    cursor: pointer;
    margin-left: auto;
    line-height: 1;
    padding: 0 4px;
}

.mobile-sidebar-close:hover {
    color: #ffffff;
}

/* Dark Backdrop Overlay for Mobile Drawer */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(3px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Tablet Breakpoint (<= 992px) */
@media (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px !important;
    }

    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* Smartphone Breakpoint (<= 768px) */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: inline-flex !important;
    }

    .mobile-sidebar-close {
        display: block !important;
    }

    /* Off-Canvas Sidebar */
    .sidebar {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 290px !important;
        max-width: 85vw !important;
        transform: translateX(-100%) !important;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        z-index: 999 !important;
        box-shadow: 10px 0 35px rgba(0, 0, 0, 0.35) !important;
    }

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

    /* Main Content Fullwidth on Mobile */
    .main-content {
        margin-left: 0 !important;
        padding: 12px 10px !important;
        width: 100% !important;
    }

    /* Mobile Top Header */
    .top-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
        padding: 14px 14px !important;
        margin-bottom: 16px !important;
    }

    .header-left-group {
        width: 100%;
        justify-content: flex-start;
    }

    .header-title h1 {
        font-size: 17px !important;
        line-height: 1.3 !important;
    }

    .header-title p {
        font-size: 11.5px !important;
    }

    .header-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        width: 100% !important;
        justify-content: space-between !important;
    }

    .class-selector-group {
        flex: 1 1 auto !important;
        min-width: 130px !important;
        padding: 4px 10px !important;
        font-size: 12px !important;
    }

    .class-selector-group select {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }

    .btn-cloud {
        padding: 5px 10px !important;
        font-size: 11px !important;
    }

    #btn-quick-backup {
        padding: 5px 10px !important;
        font-size: 11.5px !important;
    }

    /* Mobile Stats Cards */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        margin-bottom: 14px !important;
    }

    .stat-card {
        padding: 12px 10px !important;
        gap: 10px !important;
    }

    .stat-icon {
        width: 38px !important;
        height: 38px !important;
        font-size: 16px !important;
        border-radius: 8px !important;
    }

    .stat-value {
        font-size: 18px !important;
    }

    .stat-label {
        font-size: 11px !important;
    }

    .stat-desc {
        font-size: 10px !important;
    }

    /* Forms on Mobile */
    .form-inline {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .form-group {
        width: 100% !important;
    }

    .card-header {
        padding: 12px 14px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px !important;
    }

    .card-body {
        padding: 12px !important;
    }

    /* Touch-friendly Tables */
    .table-responsive {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin-bottom: 10px !important;
        border-radius: 8px !important;
    }

    .table th, .table td {
        padding: 8px 8px !important;
        font-size: 11.5px !important;
    }

    /* Mobile Modals */
    .modal-card {
        width: 96vw !important;
        max-width: 96vw !important;
        padding: 16px !important;
        margin: 8px !important;
        border-radius: 12px !important;
    }
}

/* Extra Small Phones (<= 480px) */
@media (max-width: 480px) {
    .header-actions {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    .class-selector-group, .btn-cloud, #btn-quick-backup {
        width: 100% !important;
        justify-content: center !important;
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ==========================================================
   MOBILE BOTTOM NAVIGATION & FLOATING FAB
   ========================================================== */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    z-index: 950;
    justify-content: space-around;
    align-items: center;
    padding: 0 6px;
}

.mobile-nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-secondary);
    font-size: 10.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    flex: 1;
}

.mobile-nav-item i {
    font-size: 18px;
    transition: var(--transition);
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: var(--color-primary);
}

.mobile-nav-item.active i {
    transform: translateY(-2px);
}

/* Floating Save Button on Mobile */
.floating-mobile-save {
    position: fixed;
    bottom: 78px;
    right: 16px;
    z-index: 940;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: #ffffff;
    border: none;
    border-radius: 9999px;
    padding: 12px 20px;
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.45);
    transition: var(--transition);
}

.floating-mobile-save:active {
    transform: scale(0.96);
}

.mobile-student-meta {
    display: none;
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex !important;
    }

    .main-content {
        padding-bottom: 85px !important;
    }

    /* Sub-tabs horizontal scroll on mobile */
    .sub-tabs {
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 6px !important;
        gap: 6px !important;
    }

    .sub-tab-btn {
        flex-shrink: 0 !important;
        font-size: 13px !important;
        padding: 6px 12px !important;
    }

    /* Action buttons full-width stack on mobile */
    .action-buttons {
        width: 100% !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }

    .action-buttons .btn {
        flex: 1 1 auto !important;
        justify-content: center !important;
        font-size: 13px !important;
        padding: 8px 12px !important;
    }

    /* Enhanced Touch-Friendly Buttons for Mobile Attendance */
    .status-btn {
        width: 40px !important;
        height: 38px !important;
        font-size: 13.5px !important;
        font-weight: 800 !important;
        border-radius: 8px !important;
    }

    .status-pill-group {
        gap: 6px !important;
    }

    /* Hide standalone NISN column on mobile to make Attendance fit perfectly */
    .col-nisn,
    #tbody-absensi-harian td.col-nisn,
    .table thead th.col-nisn {
        display: none !important;
    }

    /* Show student NISN & Gender as subtle subtitle under name */
    .mobile-student-meta {
        display: block !important;
        font-size: 11px !important;
        color: #64748b !important;
        font-weight: 500 !important;
        margin-top: 2px !important;
        line-height: 1.2 !important;
    }

    .col-no {
        width: 32px !important;
        padding: 8px 4px !important;
        text-align: center !important;
    }

    .col-name {
        padding: 8px 6px !important;
        font-size: 13px !important;
    }

    .col-status {
        padding: 6px 4px !important;
        text-align: center !important;
    }

    .absensi-note-input {
        min-width: 120px !important;
        font-size: 12px !important;
        padding: 6px 8px !important;
    }

    /* Sticky student name column on horizontal table scroll */
    #tbody-absensi-harian td.col-name,
    .table thead th.col-name {
        position: sticky;
        left: 0;
        background: #ffffff;
        z-index: 3;
        box-shadow: 2px 0 6px rgba(0, 0, 0, 0.05);
    }
    .table thead th.col-name {
        background: #f1f5f9;
        z-index: 5;
    }

    /* Mobile Matrix Table: Hide NISN, pin No & Name compactly */
    .table-matrix .sticky-col-nisn,
    .table-matrix thead th.sticky-col-nisn {
        display: none !important;
    }

    .table-matrix .sticky-col-no,
    .table-matrix thead th.sticky-col-no {
        width: 34px !important;
        min-width: 34px !important;
        left: 0 !important;
    }

    .table-matrix .sticky-col-name,
    .table-matrix thead th.sticky-col-name {
        left: 34px !important;
        max-width: 125px !important;
        min-width: 120px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        box-shadow: 2px 0 6px rgba(0, 0, 0, 0.08) !important;
    }

    /* Mobile Form Control font-size to prevent iOS zoom */
    .form-control,
    .form-select {
        font-size: 14px !important;
    }
}

/* ==========================================================
   TEACHER ACCESS PROTECTION & LOCK SCREEN STYLES
   ========================================================== */
.auth-lock-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at 50% 40%, #1e293b 0%, #090d16 100%);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow-y: auto;
}

.auth-lock-card {
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 24px;
    padding: 30px 24px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    color: #ffffff;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7), 0 0 40px rgba(79, 70, 229, 0.25);
    animation: zoomInLock 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes zoomInLock {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.auth-lock-icon {
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #ffffff;
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.5);
}

.auth-lock-card h2 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 3px;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.auth-lock-sub {
    font-size: 11.5px;
    color: #94a3b8;
    font-weight: 600;
    letter-spacing: 1px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.auth-lock-info {
    font-size: 12px;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.06);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    line-height: 1.4;
}

.pin-input-group {
    position: relative;
    margin-bottom: 12px;
}

#auth-pin-input {
    width: 100%;
    padding: 12px 42px 12px 16px;
    font-size: 22px;
    letter-spacing: 6px;
    text-align: center;
    background: rgba(30, 41, 59, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-weight: 800;
    outline: none;
    transition: var(--transition);
}

#auth-pin-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
    background: rgba(30, 41, 59, 1);
}

.btn-pin-eye {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

.btn-pin-eye:hover {
    color: #ffffff;
}

.auth-error-msg {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: #fb7185;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
}

.auth-error-msg.shake {
    animation: shakeErr 0.4s ease;
}

@keyframes shakeErr {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

.auth-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.keypad-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    height: 48px;
    font-size: 19px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.keypad-btn:hover, .keypad-btn:active {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0.96);
}

.keypad-btn.keypad-action {
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-size: 16px;
}

.auth-options {
    margin-bottom: 14px;
    display: flex;
    justify-content: center;
}

.remember-device-label {
    font-size: 12px;
    color: #94a3b8;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.remember-device-label input {
    cursor: pointer;
}

.btn-auth-submit {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-auth-submit:hover {
    background: linear-gradient(135deg, #4338ca, #3730a3);
    transform: translateY(-1px);
}

.auth-guest-option {
    margin-top: 12px;
}

.btn-guest-link {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-guest-link:hover {
    color: #ffffff;
}

.auth-footer-hint {
    margin-top: 14px;
    font-size: 11px;
    color: #64748b;
}

.auth-status-badge {
    display: flex;
    align-items: center;
}

/* Read-Only Notice Banner */
.read-only-notice {
    background: #fffbeb;
    border: 1px solid #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #92400e;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 12.5px;
}

/* Strict Read-Only Mode CSS Locks */
body.is-read-only #btn-save-absensi,
body.is-read-only #btn-save-penilaian,
body.is-read-only #btn-floating-save-absensi,
body.is-read-only #btn-set-all-hadir,
body.is-read-only #btn-add-single-siswa,
body.is-read-only #btn-add-batch-siswa,
body.is-read-only #btn-save-identitas,
body.is-read-only #btn-save-kesiswaan,
body.is-read-only #btn-save-piket,
body.is-read-only #btn-save-wali,
body.is-read-only #btn-save-homevisit,
body.is-read-only #btn-save-new-pin,
body.is-read-only #single-input-group,
body.is-read-only #batch-input-group,
body.is-read-only .btn-danger-outline {
    display: none !important;
}

body.is-read-only .status-btn {
    pointer-events: none !important;
    opacity: 0.85 !important;
    cursor: not-allowed !important;
}

body.is-read-only .editable-absensi-cell,
body.is-read-only .editable-score-cell {
    pointer-events: none !important;
    cursor: default !important;
}

body.is-read-only .editable-absensi-cell::after,
body.is-read-only .editable-score-cell::after {
    display: none !important;
}

body.is-read-only input:not(#auth-pin-input),
body.is-read-only textarea {
    pointer-events: none !important;
    background-color: #f8fafc !important;
    color: #334155 !important;
    cursor: not-allowed !important;
    user-select: none !important;
}



