@import url('https://fonts.googleapis.com/css2?family=Kantumruuy+Pro:ital,wght@0,300..700;1,300..700&family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --font-main: 'Kantumruuy Pro', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Color Palette */
    --bg-primary: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --bg-surface-elevated: rgba(51, 65, 85, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    
    --accent: #06b6d4;
    --accent-glow: rgba(6, 182, 212, 0.3);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --success-border: rgba(16, 185, 129, 0.3);
    
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --warning-border: rgba(245, 158, 11, 0.3);
    
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --danger-border: rgba(239, 68, 68, 0.3);

    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px var(--primary-glow);
}

/* Light Theme overrides */
body.light-theme {
    --bg-primary: #f1f5f9;
    --bg-surface: rgba(255, 255, 255, 0.85);
    --bg-surface-elevated: rgba(241, 245, 249, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --text-main: #0f172a;
    --text-muted: #475569;
    --text-dim: #94a3b8;
    --shadow-soft: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-main);
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Header & Navigation */
.navbar {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 1;
    min-width: 0;
}

.brand-logo {
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}

.admin-logo-img {
    width: 46px;
    height: 46px;
    background: transparent;
    border: none;
    padding: 0;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
    flex-shrink: 0;
}

.modal-brand-logo {
    width: 44px;
    height: 44px;
    background: transparent;
    border: none;
    padding: 0;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.35));
    flex-shrink: 0;
}

.brand-text {
    min-width: 0;
}

.brand-text h1 {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(90deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.light-theme .brand-text h1 {
    background: linear-gradient(90deg, #0f172a, var(--primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text p {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.theme-toggle-btn {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle-btn:hover {
    transform: scale(1.08);
    border-color: var(--primary);
}

.live-clock-badge {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.clock-date {
    display: inline;
}

.clock-time {
    display: inline;
    font-variant-numeric: tabular-nums;
}

/* Main Container & Layout */
.app-container {
    max-width: 1200px;
    width: 100%;
    margin: 1.5rem auto;
    padding: 0 1rem 3rem 1rem;
    flex: 1;
}

/* Navigation Tabs */
.tabs-header {
    display: flex;
    gap: 8px;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    padding: 6px;
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.tab-btn {
    flex: 1;
    min-width: 120px;
    padding: 12px 18px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.92rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #ffffff;
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Tab Views */
.tab-content {
    display: none;
    animation: fadeIn 0.35s ease-out;
}

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

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

/* Glass Card */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    margin-bottom: 1.5rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-main);
}

.card-title i {
    color: var(--primary);
}

/* Attendance Scanner Section */
.scanner-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}

.scanner-box {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #000;
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-glow);
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Scan Mode Toggle (Check-In / Check-Out) */
.scan-mode-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 1.2rem;
    background: var(--bg-surface-elevated);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.scan-mode-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.scan-mode-btn.active.check-in {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.scan-mode-btn.active.check-out {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* Grand Khmer Live Date & Time Banner */
.khmer-datetime-banner {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(6, 182, 212, 0.08));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px -4px rgba(99, 102, 241, 0.2);
    position: relative;
    overflow: hidden;
}

.khmer-datetime-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary), var(--accent));
}

.datetime-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.datetime-icon-pulse {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.25));
    border: 1px solid rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(6, 182, 212, 0.25);
}

.datetime-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.datetime-date-khmer {
    font-size: 0.96rem;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.2px;
}

body.light-theme .datetime-date-khmer {
    color: #0f172a;
}

.datetime-time-khmer {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 7px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 12px rgba(6, 182, 212, 0.35);
}

body.light-theme .datetime-time-khmer {
    color: var(--primary);
}

.datetime-badge-live {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.4);
    color: #10b981;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.live-blink-circle {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #10b981;
    animation: livePulse 1.5s infinite ease-in-out;
}

@keyframes livePulse {
    0% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 4px #10b981; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px #10b981; }
    100% { transform: scale(0.9); opacity: 0.6; box-shadow: 0 0 4px #10b981; }
}

/* Compact Khmer Live Location Banner (Placed Above Camera) */
.khmer-location-banner {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(16, 185, 129, 0.08));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    box-shadow: 0 6px 20px -4px rgba(6, 182, 212, 0.2);
    position: relative;
    overflow: hidden;
}

.khmer-location-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent), #10b981);
}

.location-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.location-icon-pulse {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.25), rgba(16, 185, 129, 0.2));
    border: 1px solid rgba(6, 182, 212, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 0 14px rgba(6, 182, 212, 0.25);
}

.location-banner-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.location-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.location-main-label {
    font-size: 0.92rem;
    font-weight: 700;
    color: #f8fafc;
}

body.light-theme .location-main-label {
    color: #0f172a;
}

.location-sub-row {
    font-size: 0.84rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.loc-divider {
    color: var(--text-dim);
}

.loc-coords-mini {
    font-size: 0.78rem;
    color: var(--text-dim);
}

.btn-refresh-gps {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    color: var(--accent);
    padding: 7px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.btn-refresh-gps:hover {
    background: rgba(6, 182, 212, 0.18);
    border-color: var(--accent);
    transform: translateY(-1px);
}


#teacher-login-reader,
#student-scanner-reader,
#reader {
    width: 100% !important;
    border: none !important;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#teacher-login-reader video,
#student-scanner-reader video,
#reader video {
    width: 100% !important;
    height: auto !important;
    max-height: 380px;
    object-fit: cover !important;
    border-radius: var(--radius-md);
}

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

.btn-icon-mini {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon-mini:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
    color: #fff;
}

.camera-select-wrap {
    margin-bottom: 10px;
}

.camera-dropdown {
    width: 100%;
    padding: 8px 12px;
    font-size: 0.85rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-main);
}

.camera-prompt-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    gap: 12px;
}

.camera-prompt-box i {
    font-size: 2.5rem;
    color: var(--warning);
}

.camera-prompt-box p {
    font-size: 0.9rem;
    line-height: 1.5;
}


.scan-overlay-info {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid var(--glass-border);
    z-index: 10;
}

.gps-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 600;
}

.gps-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--warning);
    box-shadow: 0 0 10px var(--warning);
}

.gps-dot.active {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

.gps-dot.error {
    background: var(--danger);
    box-shadow: 0 0 10px var(--danger);
}

/* Manual Code Entry & Location Details */
.manual-box {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    box-sizing: border-box;
    display: block;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.6);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #fff;
}

/* Geo Info Card Display */
.location-info-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
}

.info-row .label {
    color: var(--text-muted);
}

.info-row .val {
    font-weight: 600;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-success {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.badge-secondary {
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.stat-icon.blue { background: rgba(99, 102, 241, 0.2); color: var(--primary); }
.stat-icon.green { background: var(--success-bg); color: var(--success); }
.stat-icon.purple { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.stat-icon.amber { background: var(--warning-bg); color: var(--warning); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger); }


.stat-info h3 {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-info p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Table Styling */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.custom-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.custom-table th {
    background: var(--bg-surface-elevated);
    padding: 14px 16px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
    white-space: nowrap;
}

.custom-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--text-main);
    vertical-align: middle;
}

.custom-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Modal Popup */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-backdrop.active {
    display: flex;
    animation: fadeIn 0.25s ease-out;
}

.modal-box {
    background: var(--bg-primary);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 1.5rem;
    box-shadow: var(--shadow-soft);
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

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

/* QR Card Badge Print Layout */
.qr-badge-card {
    text-align: center;
    background: #fff;
    color: #0f172a;
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    margin: 1rem 0;
}

.qr-badge-card h3 {
    font-size: 1.1rem;
    margin-top: 8px;
    color: #0f172a;
}

.qr-badge-card p {
    font-size: 0.85rem;
    color: #475569;
}

#qrcode-render {
    display: flex;
    justify-content: center;
    margin: 12px 0;
}

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

.toast {
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    box-shadow: var(--shadow-soft);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(50px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 4px solid var(--success); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.danger { border-left: 4px solid var(--danger); }

/* Teacher Login View & Active Session Banner Styles */
.view-screen {
    display: none;
    animation: fadeIn 0.35s ease-out;
}

.view-screen.active {
    display: block;
}

.login-hero-card {
    max-width: 900px;
    margin: 0 auto;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.login-icon-badge {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #fff;
    margin: 0 auto 1rem auto;
    box-shadow: var(--shadow-glow);
}

.login-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-notice {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.login-notice code {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

/* Active Teacher Banner */
.active-teacher-banner {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(51, 65, 85, 0.9));
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.teacher-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.teacher-avatar {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--success), #059669);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    color: #fff;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.teacher-details h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.teacher-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.session-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--success);
    background: var(--success-bg);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-bottom: 4px;
}

.session-badge i {
    font-size: 0.5rem;
    animation: pulseDot 1.5s infinite;
}

@keyframes pulseDot {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Scan Type Selector (QR vs Face AI) */
.scan-type-toggle {
    display: inline-flex;
    gap: 8px;
    background: var(--bg-surface-elevated);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.scan-type-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.scan-type-btn.active {
    background: linear-gradient(135deg, var(--accent), #0284c7);
    color: #fff;
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* Face AI Scanner HUD */
.face-hud-box {
    position: relative;
    overflow: hidden;
    background: #000;
    width: 100%;
    min-height: 320px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.face-hud-box video {
    width: 100% !important;
    height: 100% !important;
    max-height: 380px;
    object-fit: cover !important;
    transform: scaleX(-1); /* Mirror view for natural feel */
}

.face-hud-box canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    transform: scaleX(-1);
}

/* Face Target Reticle & Guides */
.face-target-reticle {
    position: absolute;
    width: 220px;
    height: 260px;
    border: 1px dashed rgba(6, 182, 212, 0.4);
    border-radius: 40px;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.15);
}

.reticle-corner {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--accent);
    border-style: solid;
}

.reticle-corner.top-left { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-top-left-radius: 12px; }
.reticle-corner.top-right { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-top-right-radius: 12px; }
.reticle-corner.bottom-left { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-bottom-left-radius: 12px; }
.reticle-corner.bottom-right { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-bottom-right-radius: 12px; }

.face-scan-beam {
    position: absolute;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--accent), #38bdf8, transparent);
    box-shadow: 0 0 15px var(--accent);
    animation: scanBeamAnim 2.2s ease-in-out infinite alternate;
}

@keyframes scanBeamAnim {
    0% { top: 10%; opacity: 0.3; }
    50% { opacity: 1; }
    100% { top: 90%; opacity: 0.3; }
}

.face-oval-guide {
    font-size: 4rem;
    color: rgba(255, 255, 255, 0.12);
}

.face-recognition-hud {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.hud-status {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.hud-status.match-success {
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
    border-color: var(--success);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

/* Face Registration Modal Styles */
.face-reg-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.face-reg-preview-box {
    width: 100%;
    max-width: 380px;
    height: 280px;
    background: #000;
    border-radius: var(--radius-lg);
    border: 2px solid var(--accent);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
}

.face-reg-preview-box video,
.face-reg-preview-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.face-reg-preview-box .reg-guide {
    position: absolute;
    font-size: 5rem;
    color: rgba(6, 182, 212, 0.2);
    pointer-events: none;
}

.face-reg-info {
    text-align: center;
}

.face-reg-info h4 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.face-reg-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Avatar Thumbnails in Data Tables */
.avatar-thumb {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--accent);
    vertical-align: middle;
}

.avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--text-muted);
    vertical-align: middle;
}

/* Admin Portal Bar & Toggle */
.admin-toggle-btn {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: var(--primary);
    padding: 6px 14px;
    font-size: 0.85rem;
    font-weight: 600;
}

.admin-toggle-btn:hover {
    background: var(--primary);
    color: #fff;
}

.admin-top-bar {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.95), rgba(51, 65, 85, 0.95));
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-soft);
}

.admin-top-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-top-title i {
    font-size: 2rem;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.admin-top-title h2 {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.admin-top-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==========================================
   MOBILE & RESPONSIVE DESIGN (SMARTPHONE OPTIMIZATION)
   ========================================== */

.scan-type-toggle {
    display: flex;
    gap: 8px;
    background: var(--bg-surface-elevated);
    padding: 5px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    margin-bottom: 1.2rem;
}

.scan-type-btn {
    flex: 1;
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.88rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.25s ease;
}

.scan-type-btn.active {
    background: linear-gradient(135deg, var(--accent), #0284c7);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

/* Single Clean Unified 1-Row Camera Toolbar */
.camera-controls-unified-row {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 0.85rem;
    flex-wrap: nowrap;
    width: 100%;
}

.camera-dropdown-compact {
    flex: 1.5;
    min-width: 0;
    padding: 0 10px;
    font-size: 0.82rem;
    height: 38px;
    line-height: 38px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    cursor: pointer;
    box-sizing: border-box;
}

.btn-snap-faceid-compact {
    flex: 1.1;
    min-width: 0;
    white-space: nowrap;
    padding: 0 10px;
    font-size: 0.82rem;
    font-weight: 600;
    height: 38px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border-radius: 10px;
    border: 1px solid rgba(6, 182, 212, 0.4);
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.22), rgba(99, 102, 241, 0.22));
    color: #f8fafc;
    cursor: pointer;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

body.light-theme .btn-snap-faceid-compact {
    color: var(--primary);
}

.btn-snap-faceid-compact:hover {
    background: linear-gradient(135deg, var(--accent), var(--primary));
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.35);
}

.btn-icon-mini {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.btn-icon-mini:hover {
    background: rgba(6, 182, 212, 0.25);
    border-color: var(--accent);
    color: var(--accent);
}

.manual-admin-box {
    border-top: 1px solid var(--glass-border);
    padding-top: 0.85rem;
    margin-top: 0.5rem;
}

.manual-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
}

@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 0.75rem;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .brand {
        gap: 8px;
        flex-shrink: 1;
        min-width: 0;
    }

    .brand-logo {
        width: 32px;
        height: 32px;
        background: transparent;
        border: none;
        padding: 0;
        flex-shrink: 0;
    }

    .brand-text h1 {
        font-size: 0.88rem;
        line-height: 1.2;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .brand-text p {
        font-size: 0.62rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-controls {
        gap: 6px;
        flex-shrink: 0;
    }

    .live-clock-badge {
        padding: 4px 8px;
        font-size: 0.72rem;
        border-radius: 20px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .clock-date {
        display: none;
    }

    .admin-toggle-btn {
        padding: 4px 9px;
        font-size: 0.74rem;
        white-space: nowrap;
        border-radius: 9px;
        flex-shrink: 0;
    }

    .theme-toggle-btn {
        width: 30px;
        height: 30px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }

    .app-container {
        margin: 0.5rem auto;
        padding: 0 0.5rem 2rem 0.5rem;
    }

    .glass-card {
        padding: 0.9rem;
        border-radius: 16px;
        margin-bottom: 1rem;
    }

    .card-title {
        font-size: 0.98rem;
        margin-bottom: 0.75rem;
    }

    .scan-mode-selector {
        gap: 6px;
        padding: 4px;
        margin-bottom: 0.75rem;
        border-radius: 12px;
    }

    .scan-mode-btn {
        padding: 9px 8px;
        font-size: 0.82rem;
        gap: 5px;
        border-radius: 8px;
    }

    .scan-mode-btn i {
        font-size: 0.88rem;
    }

    .scan-type-toggle {
        padding: 4px;
        gap: 6px;
        margin-bottom: 0.85rem;
        border-radius: 12px;
    }

    .scan-type-btn {
        padding: 8px 6px;
        font-size: 0.8rem;
        gap: 5px;
        border-radius: 8px;
    }

    .scanner-box {
        min-height: 260px;
        border-radius: 16px;
    }

    .camera-dropdown {
        font-size: 0.78rem;
        padding: 6px 8px;
    }

    .hud-status {
        font-size: 0.74rem;
        padding: 4px 10px;
    }

    .gps-indicator {
        font-size: 0.74rem;
    }

    .location-info-card {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .info-row {
        font-size: 0.8rem;
    }

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

    .stat-card {
        padding: 0.8rem;
    }

    .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .stat-info h3 {
        font-size: 1.2rem;
    }

    .stat-info p {
        font-size: 0.72rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        padding: 0.45rem 0.5rem;
        gap: 6px;
        flex-wrap: nowrap;
    }

    .brand {
        gap: 6px;
        flex-shrink: 1;
        min-width: 0;
    }

    .brand-logo {
        width: 28px;
        height: 28px;
        background: transparent;
        border: none;
        padding: 0;
        flex-shrink: 0;
    }

    .brand-text h1 {
        font-size: 0.8rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .brand-text p {
        display: none;
    }

    .nav-controls {
        gap: 4px;
        flex-shrink: 0;
    }

    .live-clock-badge {
        font-size: 0.65rem;
        padding: 3px 6px;
        gap: 3px;
        white-space: nowrap;
    }

    .admin-toggle-btn {
        font-size: 0.68rem;
        padding: 3px 7px;
        gap: 3px;
        white-space: nowrap;
    }

    .theme-toggle-btn {
        width: 26px;
        height: 26px;
        font-size: 0.72rem;
    }

    .scan-mode-btn {
        font-size: 0.78rem;
        padding: 8px 4px;
    }

    .scan-type-btn {
        font-size: 0.78rem;
        padding: 7px 4px;
    }

    .khmer-datetime-banner {
        padding: 0.65rem 0.8rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .datetime-left {
        width: 100%;
        gap: 8px;
    }

    .datetime-icon-pulse {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .datetime-date-khmer {
        font-size: 0.78rem;
        line-height: 1.3;
    }

    .datetime-time-khmer {
        font-size: 0.85rem;
        line-height: 1.3;
    }

    .datetime-badge-live {
        align-self: flex-end;
        margin-top: -24px;
        padding: 2px 7px;
        font-size: 0.64rem;
    }

    .khmer-location-banner {
        padding: 0.65rem 0.8rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .location-banner-left {
        width: 100%;
        gap: 8px;
    }

    .location-icon-pulse {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .location-main-label {
        font-size: 0.78rem;
    }

    .location-sub-row {
        font-size: 0.74rem;
    }

    .btn-refresh-gps {
        align-self: flex-end;
        margin-top: -24px;
        padding: 3px 8px;
        font-size: 0.68rem;
    }

    .camera-controls-unified-row {
        gap: 5px;
        align-items: stretch;
    }

    .camera-dropdown-compact {
        font-size: 0.74rem;
        padding: 0 6px;
        height: 36px;
        line-height: 36px;
        border-radius: 9px;
        flex: 1.4;
    }

    .btn-snap-faceid-compact {
        font-size: 0.74rem;
        padding: 0 8px;
        height: 36px;
        border-radius: 9px;
        gap: 4px;
        flex: 1.1;
    }

    .btn-icon-mini {
        width: 36px;
        height: 36px;
        border-radius: 9px;
        font-size: 0.85rem;
    }
}

/* ============================================================== */
/* DAILY ATTENDANCE ACCORDION WITH PULL-DOWN / DROPDOWN BUTTONS   */
/* ============================================================== */

.daily-accordion-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.daily-accordion-item {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.daily-accordion-item:hover {
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.15);
}

.daily-accordion-item.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.04);
}

.daily-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    user-select: none;
    gap: 12px;
}

.daily-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.daily-teacher-avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    object-fit: cover;
    border: 2px solid var(--primary);
    flex-shrink: 0;
}

.daily-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(168, 85, 247, 0.2));
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.daily-teacher-info {
    min-width: 0;
    flex: 1;
}

.daily-teacher-name {
    font-weight: 700;
    font-size: 0.96rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.daily-teacher-code {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: monospace;
}

.daily-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.daily-badge-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.accordion-chevron-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.daily-accordion-item.active .accordion-chevron-btn {
    transform: rotate(180deg);
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.daily-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), padding 0.35s ease;
    padding: 0 16px;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid transparent;
}

.daily-accordion-item.active .daily-accordion-body {
    max-height: 600px;
    padding: 14px 16px 16px 16px;
    border-top: 1px solid var(--glass-border);
}

.daily-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.daily-detail-box {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.daily-detail-label {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.daily-detail-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
}

.daily-detail-value.success { color: var(--success); }
.daily-detail-value.danger { color: var(--danger); }
.daily-detail-value.warning { color: var(--warning); }

.daily-empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.daily-empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.8rem;
    color: var(--primary);
    opacity: 0.6;
}

@media (max-width: 640px) {
    .daily-accordion-header {
        padding: 12px 14px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .daily-header-left {
        width: 100%;
    }
    .daily-header-right {
        width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-top: 8px;
        border-top: 1px dashed rgba(255, 255, 255, 0.08);
    }
    .daily-badge-group {
        display: flex;
        gap: 5px;
        flex-wrap: wrap;
        flex: 1;
    }
    .daily-badge-group .badge {
        font-size: 0.72rem !important;
        padding: 3px 8px;
    }
    .accordion-chevron-btn {
        width: 30px;
        height: 30px;
    }
    .daily-accordion-item.active .daily-accordion-body {
        max-height: 1000px;
        padding: 12px 14px 14px 14px;
    }
}

/* ============================================================== */
/* MODERN ADMIN DASHBOARD & TAB DESIGN SYSTEM                     */
/* ============================================================== */

.admin-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 12px;
    padding: 1rem 1.4rem;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.95));
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(16px);
}

.admin-title-wrap h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-title-wrap h2 i {
    color: var(--primary);
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.admin-title-wrap p {
    font-size: 0.86rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Modern Tab Navigation Pills */
.admin-tabs {
    display: flex;
    gap: 10px;
    background: rgba(15, 23, 42, 0.85);
    padding: 8px 12px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 1.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3), inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.admin-tabs::-webkit-scrollbar {
    display: none;
}

.admin-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    border-radius: var(--radius-full);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.admin-tab-btn i {
    font-size: 1.05rem;
    transition: transform 0.25s ease;
}

.admin-tab-btn:hover {
    color: #ffffff;
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.admin-tab-btn:hover i {
    transform: scale(1.18);
}

.admin-tab-btn.active {
    background: linear-gradient(135deg, #4f46e5, #6366f1) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.5) !important;
}

.admin-tab-btn[data-tab="teachers-tab"].active {
    background: linear-gradient(135deg, #0284c7, #06b6d4) !important;
    box-shadow: 0 4px 18px rgba(6, 182, 212, 0.5) !important;
}

.admin-tab-btn[data-tab="settings-tab"].active {
    background: linear-gradient(135deg, #7c3aed, #a855f7) !important;
    box-shadow: 0 4px 18px rgba(168, 85, 247, 0.5) !important;
}

/* Stat Grid Cards for Logs Tab */
.admin-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 1.5rem;
}

.admin-stat-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.admin-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.25);
}

.admin-stat-card.stat-total {
    border-left: 4px solid #6366f1;
}

.admin-stat-card.stat-morning {
    border-left: 4px solid #f59e0b;
}

.admin-stat-card.stat-afternoon {
    border-left: 4px solid #38bdf8;
}

.admin-stat-card.stat-ontime {
    border-left: 4px solid #10b981;
}

.admin-stat-card.stat-absent {
    border-left: 4px solid #ef4444;
}

.admin-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.admin-stat-card.stat-total .admin-stat-icon {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.admin-stat-card.stat-morning .admin-stat-icon {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.admin-stat-card.stat-afternoon .admin-stat-icon {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}

.admin-stat-card.stat-ontime .admin-stat-icon {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.admin-stat-card.stat-absent .admin-stat-icon {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.admin-stat-info {
    display: flex;
    flex-direction: column;
}

.admin-stat-value {
    font-size: 1.45rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.1;
    font-family: 'Outfit', sans-serif;
}

.admin-stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 3px;
    font-weight: 500;
}

/* Manual Attendance Entry Card */
.manual-check-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(6, 182, 212, 0.04)) !important;
    border: 1px solid rgba(99, 102, 241, 0.3) !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.manual-check-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

/* Search Box in Teacher Management */
.teacher-search-wrapper {
    position: relative;
    max-width: 260px;
    width: 100%;
}

.teacher-search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
}

.teacher-search-input {
    width: 100%;
    padding: 7px 12px 7px 34px !important;
    font-size: 0.85rem !important;
    border-radius: var(--radius-full) !important;
    background: rgba(15, 23, 42, 0.6) !important;
}

/* Shift Settings Time Cards */
.shift-schedule-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.shift-schedule-card {
    padding: 14px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    transition: all 0.2s ease;
}

.shift-schedule-card.shift-morning-box {
    border-color: rgba(245, 158, 11, 0.3);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), rgba(15, 23, 42, 0.5));
}

.shift-schedule-card.shift-afternoon-box {
    border-color: rgba(56, 189, 248, 0.3);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.06), rgba(15, 23, 42, 0.5));
}

@media (max-width: 768px) {
    .shift-schedule-grid {
        grid-template-columns: 1fr;
    }
    .admin-stat-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ========================================================= */
/* ULTRA-PREMIUM ADMIN DASHBOARD STYLES                      */
/* ========================================================= */

.admin-hero-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4), 0 0 25px rgba(99, 102, 241, 0.15);
    position: relative;
    overflow: hidden;
}

.admin-hero-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.admin-hero-card-content {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-hero-profile {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-hero-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #ffffff;
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.admin-hero-title h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.admin-hero-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Elevated Metric Cards */
.admin-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 1.5rem;
}

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

@media (max-width: 576px) {
    .admin-metrics-grid {
        grid-template-columns: 1fr;
    }
}

.metric-card-elevated {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.metric-card-elevated:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.25);
}

.metric-card-elevated.card-total {
    border-color: rgba(99, 102, 241, 0.35);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(30, 41, 59, 0.7) 100%);
}

.metric-card-elevated.card-morning {
    border-color: rgba(245, 158, 11, 0.35);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12) 0%, rgba(30, 41, 59, 0.7) 100%);
}

.metric-card-elevated.card-afternoon {
    border-color: rgba(56, 189, 248, 0.35);
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(30, 41, 59, 0.7) 100%);
}

.metric-card-elevated.card-ontime {
    border-color: rgba(16, 185, 129, 0.35);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(30, 41, 59, 0.7) 100%);
}

.metric-icon-box {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.metric-card-elevated.card-total .metric-icon-box {
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.metric-card-elevated.card-morning .metric-icon-box {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.metric-card-elevated.card-afternoon .metric-icon-box {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.metric-card-elevated.card-ontime .metric-icon-box {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
}

.metric-card-elevated.card-absent .metric-icon-box {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.metric-val-large {
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.metric-lbl-sub {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Modern Tab Pill Navigation */
.admin-tab-nav-modern {
    display: flex;
    gap: 8px;
    background: rgba(15, 23, 42, 0.6);
    padding: 6px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.admin-tab-nav-modern .admin-tab-btn {
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    white-space: nowrap;
}

.admin-tab-nav-modern .admin-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.admin-tab-nav-modern .admin-tab-btn.active {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Modern Table Enhancements */
.custom-table th {
    background: rgba(30, 41, 59, 0.85);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 12px 14px;
}

.custom-table td {
    padding: 12px 14px;
    font-size: 0.88rem;
    vertical-align: middle;
}

.custom-table tbody tr {
    transition: background 0.15s ease;
}

.custom-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.08);
}

/* ============================================================== */
/* ATTENDANCE SUMMARY & REPORT STYLES (WEEKLY / MONTHLY / YEARLY) */
/* ============================================================== */

.summary-filter-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 1.5rem;
}

.summary-period-pills {
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    flex-wrap: wrap;
}

.period-pill-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.period-pill-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
}

.period-pill-btn.active {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.summary-range-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(168, 85, 247, 0.08));
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    margin-bottom: 1.2rem;
}

.summary-range-title {
    font-size: 0.94rem;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-range-meta {
    font-size: 0.84rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 6-Card Summary Metrics Grid */
.summary-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 1.5rem;
}

.summary-metric-card {
    background: var(--bg-surface);
    backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-soft);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}

.summary-metric-card.card-primary { border-left: 4px solid var(--primary); }
.summary-metric-card.card-success { border-left: 4px solid var(--success); }
.summary-metric-card.card-warning { border-left: 4px solid var(--warning); }
.summary-metric-card.card-danger { border-left: 4px solid var(--danger); }
.summary-metric-card.card-info { border-left: 4px solid #06b6d4; }
.summary-metric-card.card-accent { border-left: 4px solid var(--accent); }

.summary-metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.card-primary .summary-metric-icon { background: rgba(99, 102, 241, 0.15); color: #818cf8; }
.card-success .summary-metric-icon { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.card-warning .summary-metric-icon { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.card-danger .summary-metric-icon { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.card-info .summary-metric-icon { background: rgba(6, 182, 212, 0.15); color: #22d3ee; }
.card-accent .summary-metric-icon { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

.summary-metric-content {
    display: flex;
    flex-direction: column;
}

.summary-metric-val {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.1;
}

.summary-metric-lbl {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.summary-metric-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    opacity: 0.85;
}

/* Progress bar for attendance rate */
.attendance-rate-container {
    width: 100%;
    min-width: 100px;
}

.rate-bar-track {
    height: 7px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}

.rate-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.rate-bar-fill.high { background: linear-gradient(90deg, #10b981, #34d399); }
.rate-bar-fill.medium { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.rate-bar-fill.low { background: linear-gradient(90deg, #ef4444, #f87171); }

/* Printable Official Report Styles */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .navbar, .admin-hero-card, .admin-tab-nav-modern, .summary-filter-toolbar, .btn, button, .camera-controls-mini {
        display: none !important;
    }
    #admin-dashboard-view, #summary-tab, .tab-content.active {
        display: block !important;
    }
    .glass-card, .metric-card-elevated, .summary-metric-card {
        background: #ffffff !important;
        border: 1px solid #cccccc !important;
        box-shadow: none !important;
        color: #000000 !important;
    }
    .custom-table th, .custom-table td {
        border: 1px solid #dddddd !important;
        color: #000000 !important;
    }
    .print-only-header {
        display: block !important;
    }
}

.print-only-header {
    display: none;
    text-align: center;
    margin-bottom: 20px;
}

/* ============================================================== */
/* MOBILE RESPONSIVENESS & TOUCH OPTIMIZATIONS (TABLETS & PHONES)  */
/* ============================================================== */

@media screen and (max-width: 768px) {
    body {
        font-size: 14px;
        overflow-x: hidden;
        width: 100%;
    }

    .container, .main-container {
        padding: 0.6rem 0.5rem;
        max-width: 100%;
    }

    /* Navbar on Mobile */
    .navbar {
        padding: 0.5rem 0.75rem;
        gap: 8px;
        flex-wrap: wrap;
    }

    .brand {
        gap: 8px;
    }

    .brand-logo-img {
        width: 36px !important;
        height: 36px !important;
    }

    .brand-text h1 {
        font-size: 0.88rem !important;
        line-height: 1.2;
        margin: 0;
    }

    .brand-text p {
        font-size: 0.68rem !important;
        display: none; /* Hide subtitle on small screens to save space */
    }

    .nav-controls {
        gap: 6px;
    }

    .live-clock-badge {
        font-size: 0.76rem !important;
        padding: 4px 8px !important;
    }

    /* Hero Banner on Mobile */
    .admin-hero-card {
        padding: 12px 14px !important;
        border-radius: var(--radius-md) !important;
    }

    .admin-hero-title {
        font-size: 1.05rem !important;
    }

    .admin-hero-subtitle {
        font-size: 0.75rem !important;
    }

    /* Modern Tabs on Mobile (Scrollable horizontally with smooth touch) */
    .admin-tab-nav-modern {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 4px;
        gap: 6px;
        margin-bottom: 1rem;
    }

    .admin-tab-nav-modern::-webkit-scrollbar {
        display: none;
    }

    .admin-tab-nav-modern .admin-tab-btn {
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 0.82rem;
        border-radius: 8px;
    }

    /* Period Selector Pills on Mobile (Horizontal touch-scrollable) */
    .summary-period-pills {
        display: flex;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 3px;
        width: 100%;
    }

    .summary-period-pills::-webkit-scrollbar {
        display: none;
    }

    .period-pill-btn {
        flex-shrink: 0;
        padding: 6px 10px;
        font-size: 0.78rem;
    }

    /* Metric Cards Grid (2 per row on phone = 3 equal rows) */
    .admin-stat-grid, 
    .metric-cards-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 1rem !important;
    }

    .admin-stat-card,
    .metric-card-elevated {
        padding: 10px 12px !important;
        border-radius: var(--radius-sm) !important;
    }

    .admin-stat-icon,
    .metric-icon-box {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
    }

    .admin-stat-value,
    .metric-val-large {
        font-size: 1.25rem !important;
    }

    .admin-stat-label,
    .metric-lbl {
        font-size: 0.72rem !important;
    }

    /* Summary Tab on Mobile */
    .summary-filter-toolbar {
        padding: 10px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .summary-filter-toolbar > div {
        width: 100%;
        justify-content: space-between;
    }

    .summary-metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .summary-metric-card {
        padding: 10px 12px !important;
    }

    .summary-metric-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 1rem !important;
    }

    .summary-metric-val {
        font-size: 1.2rem !important;
    }

    .summary-range-banner {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 6px !important;
        padding: 8px 12px !important;
    }

    /* Teacher Portal Mobile Enhancements */
    .teacher-profile-card {
        padding: 12px !important;
    }

    .teacher-actions-grid {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .teacher-actions-grid .btn {
        padding: 14px !important;
        font-size: 0.98rem !important;
    }

    /* Tables on Mobile */
    .table-responsive {
        border-radius: var(--radius-sm);
        border: 1px solid var(--glass-border);
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -2px;
    }

    .custom-table th, 
    .custom-table td {
        padding: 8px 10px !important;
        font-size: 0.8rem !important;
        white-space: nowrap;
    }

    /* Modals on Mobile */
    .modal-box {
        width: 95% !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
        padding: 14px 12px !important;
        border-radius: var(--radius-md) !important;
        margin: auto;
    }

    .modal-header h3 {
        font-size: 1rem !important;
    }

    /* Forms on Mobile */
    .form-group label {
        font-size: 0.8rem !important;
    }

    .form-control, .form-select, input[type="text"], input[type="password"], input[type="date"], select {
        padding: 8px 10px !important;
        font-size: 0.86rem !important;
    }

    /* Buttons */
    .btn {
        padding: 8px 14px;
        font-size: 0.84rem;
    }
}

@media screen and (max-width: 480px) {
    /* Ultra-compact for small phones (iPhone SE / 360px) */
    .school-title-group h1 {
        font-size: 0.8rem !important;
    }

    .admin-stat-grid,
    .metric-cards-grid,
    .summary-metrics-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .admin-stat-card,
    .metric-card-elevated,
    .summary-metric-card {
        padding: 8px 10px !important;
    }

    .admin-stat-value,
    .metric-val-large,
    .summary-metric-val {
        font-size: 1.1rem !important;
    }

    .period-pill-btn {
        padding: 5px 8px;
        font-size: 0.74rem;
    }

    .btn-refresh-gps {
        font-size: 0.72rem !important;
        padding: 3px 8px !important;
    }
}

/* Teacher Portal Action Buttons (1 single row) */
.teacher-portal-action-btns {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

@media (max-width: 600px) {
    .teacher-portal-action-btns {
        width: 100%;
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }

    .teacher-portal-action-btns .btn {
        padding: 7px 8px !important;
        font-size: 0.8rem !important;
        justify-content: center !important;
        white-space: nowrap !important;
    }
}
