/* eSkoolio — Modern UI Kit (light + dark theme via CSS variables) */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@500;600&family=Inter:wght@400;500&display=swap');
@import url('https://unpkg.com/@tabler/icons-webfont@latest/dist/tabler-icons.min.css');

:root[data-theme="light"] {
    --bg: #F6F4F1;
    --surface: #FFFFFF;
    --text: #2B2622;
    --text-muted: #666d78;
    --border: #E4DED2;
    --primary: #F95C4B;
    --primary-hover: #E14A3A;
    --success: #16a34a;
    --warn: #d97706;
    --danger: #dc2626;
    --sidebar-bg: #14151A;
    --sidebar-text: #E4DED2;
}

:root[data-theme="dark"] {
    --bg: #0f1117;
    --surface: #1a1d29;
    --text: #e5e7eb;
    --text-muted: #9ca3af;
    --border: #2d313f;
    --primary: #F95C4B;
    --primary-hover: #E14A3A;
    --success: #4ade80;
    --warn: #fbbf24;
    --danger: #f87171;
    --sidebar-bg: #14151A;
    --sidebar-text: #9ca3af;
}

* { box-sizing: border-box; }

input, select, button, textarea { font-family: inherit; }

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    transition: background 0.2s ease, color 0.2s ease;
}

h1, h2, h3, .brand {
    font-family: 'Poppins', sans-serif;
}

.content a:not([class]) { color: var(--primary); }
.content a:not([class]):hover { color: var(--primary-hover); }

/* Auth page */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
    width: 360px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}
.auth-header { text-align: center; }
.auth-icon { font-size: 72px; line-height: 1; color: var(--primary); display: block; margin-bottom: 8px; }
.auth-card h1 { margin: 0 0 4px; color: var(--primary); }
.auth-card .subtitle { color: var(--text-muted); margin-bottom: 24px; font-size: 14px; }
.auth-card label { display: block; margin: 12px 0 4px; font-size: 13px; color: var(--text-muted); }
.auth-card input {
    width: 100%; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.auth-card button {
    width: 100%; margin-top: 20px; padding: 12px; border: none; border-radius: 8px;
    background: var(--primary); color: white; font-weight: 600; cursor: pointer;
}
.auth-card button:hover { background: var(--primary-hover); }
.alert-error { background: #fee2e2; color: #991b1b; padding: 10px; border-radius: 8px; font-size: 13px; }

/* Login page (public/login.php) — split-screen: coral brand panel + form.
   Distinct from .auth-card above, which change-password.php and
   superadmin/login.php still use for their single-card layout. */
.login-page { margin: 0; min-height: 100vh; }
.login-split { display: flex; min-height: 100vh; }

.login-brand {
    position: relative;
    flex: 0 0 45%;
    max-width: 560px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    overflow: hidden;
}
.login-brand::before,
.login-brand::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
    pointer-events: none;
}
.login-brand::before { width: 320px; height: 320px; top: -120px; right: -100px; }
.login-brand::after { width: 220px; height: 220px; bottom: -80px; left: -60px; background: rgba(255, 255, 255, 0.08); }

.login-brand-content { position: relative; z-index: 1; max-width: 360px; }
.login-brand-mark { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.login-brand-mark a { display: block; line-height: 0; }
.login-brand-logo-white { display: block; height: 40px; width: auto; filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.18)); }
.login-brand-tagline { font-family: 'Inter', sans-serif; font-size: 15px; line-height: 1.6; color: rgba(255, 255, 255, 0.85); margin: 0 0 48px; }

.login-brand-features { display: flex; gap: 24px; flex-wrap: wrap; }
.login-brand-feature { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255, 255, 255, 0.9); }
.login-brand-feature i { font-size: 18px; }

.login-form-panel {
    flex: 1;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    padding: 32px;
}
.login-form-wrap { width: 100%; max-width: 340px; }
.login-form-logo { display: block; height: 32px; width: auto; margin: 0 0 32px; }
.login-form-heading { display: flex; align-items: center; gap: 10px; margin: 0 0 6px; }
.login-heading-icon { display: block; height: 32px; width: 32px; flex-shrink: 0; }
.login-form-wrap h2 { font-family: 'Poppins', sans-serif; margin: 0; font-size: 26px; color: var(--text); }
.login-subtitle { color: var(--text-muted); font-size: 14px; margin: 0 0 28px; }

.login-form label { display: block; margin: 14px 0 6px; font-size: 13px; color: var(--text-muted); }
.login-form label:first-of-type { margin-top: 0; }
.login-form input {
    width: 100%; padding: 11px 14px; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px;
}
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249, 92, 75, 0.12); }
.login-form button {
    width: 100%; margin-top: 22px; padding: 12px; border: none; border-radius: 10px;
    background: var(--primary); color: #fff; font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 14px; cursor: pointer;
}
.login-form button:hover { background: var(--primary-hover); }

.login-hint { font-size: 13px; color: var(--text-muted); margin: 16px 0 0; text-align: center; }

.login-divider { display: flex; align-items: center; gap: 12px; margin: 28px 0 12px; color: var(--text-muted); font-size: 12px; }
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.login-footer { text-align: center; color: var(--text-muted); font-size: 12px; margin: 4px 0 0; }

.login-legal-links { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 0; }
.login-legal-links a { color: var(--text-muted); font-size: 11.5px; text-decoration: none; }
.login-legal-links a:hover { color: var(--primary); text-decoration: underline; }

@media (max-width: 768px) {
    .login-split { flex-direction: column; }
    .login-brand {
        flex: 0 0 auto; max-width: none; width: 100%;
        padding: 32px 24px; text-align: center;
    }
    .login-brand::before { width: 200px; height: 200px; top: -80px; right: -60px; }
    .login-brand::after { display: none; }
    .login-brand-content { max-width: none; text-align: center; }
    .login-brand-mark { justify-content: center; gap: 12px; margin-bottom: 16px; }
    .login-brand-logo-white { height: 30px; }
    .login-brand-tagline { font-size: 13px; margin-bottom: 20px; }
    .login-brand-features { justify-content: center; gap: 18px; }
    .login-form-panel { padding: 32px 24px; }
    .login-form-logo { margin-bottom: 24px; }
}

@media (max-width: 480px) {
    .login-brand { display: none; }
}

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

.sidebar {
    width: 220px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
}
.sidebar .brand { font-size: 20px; font-weight: 700; color: white; margin-bottom: 32px; display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 28px; height: 28px; border-radius: 7px; object-fit: cover; }
.brand-wordmark { height: 22px; width: auto; display: block; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar nav a {
    color: var(--sidebar-text); text-decoration: none; padding: 10px 12px;
    border-radius: 8px; font-size: 14px;
}
.sidebar nav a:hover, .sidebar nav a.active { background: rgba(255,255,255,0.08); color: white; }

.sidebar nav .nav-group { display: flex; flex-direction: column; }
.sidebar nav .nav-group-header {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    width: 100%; background: transparent; border: none; cursor: pointer; text-align: left;
    font-family: inherit; color: var(--sidebar-text); font-size: 12px; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.04em; opacity: 0.65;
    padding: 10px 12px 6px; margin-top: 8px;
}
.sidebar nav .nav-group:first-of-type .nav-group-header { margin-top: 0; }
.sidebar nav .nav-group-header:hover { opacity: 0.9; }
.sidebar nav .nav-group-chevron { font-size: 14px; transition: transform 0.15s ease; flex-shrink: 0; }
.sidebar nav .nav-group.is-collapsed .nav-group-chevron { transform: rotate(-90deg); }
.sidebar nav .nav-group-links { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav .nav-group.is-collapsed .nav-group-links { display: none; }
.sidebar nav .nav-group-links a { padding-left: 24px; font-size: 13px; }

.theme-toggle {
    background: transparent; border: 1px solid var(--border); color: var(--sidebar-text);
    padding: 10px; border-radius: 8px; cursor: pointer; font-size: 13px;
}

.role-switch-form { margin-bottom: 12px; }
.role-switch-label {
    display: block; color: var(--sidebar-text); font-size: 12px;
    opacity: 0.75; margin-bottom: 4px;
}
.role-switch-form select {
    width: 100%; background: transparent; border: 1px solid var(--border);
    color: var(--sidebar-text); padding: 8px; border-radius: 8px; font-size: 13px;
}
.role-switch-form select option { color: #111; }

.content { flex: 1; padding: 32px; }

.topbar {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px; font-size: 14px; color: var(--text-muted);
}
.logout-link { color: var(--danger); text-decoration: none; }

.topbar-search { margin: 0 16px; flex: 1; max-width: 320px; }
.topbar-search input {
    width: 100%; padding: 8px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 13px;
}

.sidebar-toggle-btn {
    display: none;
    background: transparent; border: 1px solid var(--border); color: var(--text);
    border-radius: 8px; width: 36px; height: 36px; font-size: 18px;
    align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0;
}

.sidebar-backdrop { display: none; }

/* Mobile nav: off-canvas sidebar */
@media (max-width: 768px) {
    .sidebar-toggle-btn { display: inline-flex; order: 1; }

    .sidebar {
        position: fixed;
        top: 0; left: 0; bottom: 0;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 2px 0 16px rgba(0,0,0,0.3);
        overflow-y: auto;
        width: 260px;
    }
    .sidebar.is-open { transform: translateX(0); }

    .sidebar-backdrop {
        display: block;
        position: fixed; inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0; visibility: hidden;
        transition: opacity 0.2s ease;
    }
    .sidebar-backdrop.is-visible { opacity: 1; visibility: visible; }

    body.no-scroll { overflow: hidden; }

    .content { padding: 16px; }

    .topbar {
        flex-wrap: wrap;
        row-gap: 10px;
        column-gap: 8px;
    }
    .topbar a { order: 2; font-size: 13px; }
    .topbar-welcome {
        order: 3;
        flex: 1 1 100%;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
        font-size: 13px;
    }
    .topbar-search { order: 4; flex: 1 1 100%; margin: 0; max-width: none; }
}

h1 { font-size: 24px; margin-bottom: 20px; }

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card, .widget, .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.stat-card {
    display: flex; flex-direction: column; gap: 4px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    animation: stat-card-in 0.35s ease backwards;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.10); }
.grid-4 .stat-card:nth-child(1) { animation-delay: 0ms; }
.grid-4 .stat-card:nth-child(2) { animation-delay: 60ms; }
.grid-4 .stat-card:nth-child(3) { animation-delay: 120ms; }
.grid-4 .stat-card:nth-child(4) { animation-delay: 180ms; }
.grid-4 .stat-card:nth-child(5) { animation-delay: 240ms; }
@keyframes stat-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.stat-value { font-size: 28px; font-weight: 700; color: var(--primary); }
.stat-label { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.stat-label i { font-size: 14px; color: var(--text-muted); }
.stat-warn .stat-value { color: var(--warn); }

.section-heading { display: flex; align-items: center; gap: 8px; }
.section-heading i { color: var(--text-muted); font-size: 0.85em; }
.chart-card h3.section-heading i { font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
    .stat-card { animation: none; transition: none; }
    .stat-card:hover { transform: none; }
}

.widget h3 { margin-top: 0; font-size: 15px; color: var(--text-muted); }
.widget ul { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.widget ul li { padding: 6px 0; border-bottom: 1px solid var(--border); }

.child-card { margin-bottom: 24px; }

.badge {
    padding: 2px 8px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-present, .badge-paid, .badge-active, .badge-approved { background: #dcfce7; color: var(--success); }
.badge-absent, .badge-overdue, .badge-inactive, .badge-rejected, .badge-urgent { background: #fee2e2; color: var(--danger); }
.badge-late, .badge-partial, .badge-unpaid, .badge-pending, .badge-draft { background: #fef3c7; color: var(--warn); }
.badge-graduated, .badge-teacher { background: #fde3df; color: var(--primary); }
.badge-staff, .badge-inquiry { background: #f3f4f6; color: var(--text-muted); }
.badge-tested { background: #fef3c7; color: var(--warn); }
.badge-admitted { background: #ede9fe; color: #6d28d9; }
.badge-enrolled { background: #dcfce7; color: var(--success); }
.badge-method { background: #f3f4f6; color: var(--text-muted); margin-left: 4px; }

.hint { color: var(--text-muted); font-size: 14px; }

/* Dashboard charts (admin/principal overview) */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}
.chart-card h3 {
    margin: 0 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
}
.chart-card-full { grid-column: 1 / -1; }
.chart-canvas-wrap { position: relative; width: 100%; }
.chart-empty-state { padding: 32px 16px; margin-bottom: 0; }
.chart-empty-state .empty-state-icon { font-size: 32px; margin-bottom: 10px; }
.chart-empty-state p { margin: 0; }

.chart-legend { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 16px; }
.chart-legend-item {
    display: flex; align-items: center; gap: 8px;
    font-size: 13px; color: var(--text);
}
.chart-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.chart-legend-value { color: var(--text-muted); font-size: 12px; }

/* Fee collection progress ring stat card */
.stat-card-ring { flex-direction: row; align-items: center; gap: 14px; }
.progress-ring-fill { transition: stroke-dashoffset 0.4s ease; }
.progress-ring-value { display: block; }
@media (prefers-reduced-motion: reduce) {
    .progress-ring-fill { transition: none; }
}

/* Teacher dashboard — today's attendance rollup + per-class cards */
.task-list { list-style: none; padding: 0; margin: 0; }
.task-row {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 10px 16px;
    padding: 10px 0; border-bottom: 1px solid var(--border);
}
.task-row:last-child { border-bottom: none; }
.task-row-label { font-weight: 600; font-size: 14px; }
.task-row-status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.task-row-pending { color: var(--warn); font-weight: 600; }

.class-card { display: flex; flex-direction: column; }
.class-card-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.class-card-header h3 { margin: 0; font-size: 17px; }
.class-card-attendance { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.class-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: auto; }
.class-card-actions .btn-link { margin-left: 0; }

/* Empty states — icon + message + optional CTA, used on list/table pages with no data yet */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 64px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 20px;
}
.empty-state-icon { font-size: 48px; line-height: 1; color: var(--text-muted); margin-bottom: 16px; }
.empty-state p { margin: 0 0 16px; color: var(--text-muted); font-size: 14px; }
.empty-state .btn, .empty-state .btn-primary, .empty-state .btn-secondary, .empty-state .btn-danger, .empty-state .btn-link { margin: 0; }

.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 16px; }
.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-warning { background: #fef3c7; color: #92400e; }

button, .btn, .btn-primary, .btn-secondary, .btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px; border-radius: 8px;
    font-weight: 600; font-size: 14px; line-height: 1.2;
    cursor: pointer; text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

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

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

.btn-danger {
    border: none;
    background: var(--danger); color: white;
}
.btn-danger:hover { filter: brightness(0.92); }

button:active, .btn:active, .btn-primary:active, .btn-secondary:active, .btn-danger:active { transform: translateY(1px); }
button:disabled, .btn:disabled, .btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled {
    opacity: 0.6; cursor: not-allowed; transform: none;
}

.btn-sm {
    padding: 6px 12px; font-size: 13px; border-radius: 6px; gap: 6px;
}

.toolbar {
    display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 14px;
}
.toolbar label { color: var(--text-muted); }
.toolbar input[type="date"] {
    padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
}
.btn-link { color: var(--primary); text-decoration: none; margin-left: auto; }

/* Select dropdowns (Part B) — Stone border, custom arrow, Coral focus ring,
   sized to line up with adjacent .btn-* controls in filter bars. */
select:not([multiple]) {
    -webkit-appearance: none; -moz-appearance: none; appearance: none;
    padding: 10px 34px 10px 14px; border-radius: 8px;
    border: 1px solid var(--border); background-color: var(--surface); color: var(--text);
    font-size: 14px; line-height: 1.2; cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23666d78' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select:not([multiple])::-ms-expand { display: none; }
select:not([multiple]):hover { border-color: var(--primary); }
select:not([multiple]):focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(249, 92, 75, 0.12); }
select:not([multiple]):disabled { opacity: 0.6; cursor: not-allowed; }
:root[data-theme="dark"] select:not([multiple]) {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.table {
    width: 100%; border-collapse: collapse; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
    margin-bottom: 20px;
}
.table th, .table td {
    padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px;
}
.table th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.table tbody tr:last-child td { border-bottom: none; }

.pagination {
    display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
    margin: 4px 0 24px; font-size: 14px;
}
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 32px; height: 32px; padding: 0 8px; border-radius: 8px;
}
.pagination a { color: var(--text); text-decoration: none; border: 1px solid var(--border); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .pagination-current {
    background: var(--primary); color: white; font-weight: 600; border: 1px solid var(--primary);
}
.pagination .pagination-disabled { color: var(--text-muted); opacity: 0.5; }
.pagination .pagination-ellipsis { color: var(--text-muted); border: none; min-width: auto; }

.status-cell { text-align: center; }
.status-cell input[type="radio"] { display: none; }
.status-cell label {
    display: inline-block; cursor: pointer; opacity: 0.35; border: 1px solid transparent;
}
.status-cell input[type="radio"]:checked + label { opacity: 1; border-color: currentColor; }
.status-cell label { width: 70px; text-align: center; }

/* School branding upload (superadmin school-detail page) */
.branding-preview { margin: 8px 0 12px; }
.branding-preview img {
    max-width: 100%; border-radius: 8px; border: 1px solid var(--border);
    display: block;
}
.branding-preview:not(.branding-preview-banner) img { max-height: 80px; width: auto; }
.branding-preview-banner img { max-height: 140px; object-fit: cover; width: 100%; }

/* Dashboard header banner (school-user dashboards) */
.dashboard-banner {
    margin-bottom: 24px; border-radius: 12px; overflow: hidden;
    height: 160px;
}
.dashboard-banner img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.dashboard-banner-fallback {
    width: 100%; height: 100%; position: relative; overflow: hidden;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
}
.dashboard-banner-fallback::before,
.dashboard-banner-fallback::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.10);
    pointer-events: none;
}
.dashboard-banner-fallback::before { width: 260px; height: 260px; top: -110px; right: -70px; }
.dashboard-banner-fallback::after { width: 180px; height: 180px; bottom: -90px; left: -40px; background: rgba(255, 255, 255, 0.08); }

/* Generic form styling for card-based forms (student form, etc.) */
.card form label { display: block; margin: 14px 0 4px; font-size: 13px; color: var(--text-muted); }
.card form label:first-child { margin-top: 0; }
.card form input[type="text"],
.card form input[type="date"],
.card form input[type="file"],
.card form input[type="number"] {
    width: 100%; padding: 10px 12px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 14px;
}
.card form select { width: 100%; background-color: var(--bg); }

.row-actions { display: flex; align-items: center; gap: 12px; }
.row-actions form { margin: 0; }

.link-btn {
    background: none; border: none; padding: 0; font: inherit; cursor: pointer;
    color: var(--danger); text-decoration: none;
}
.link-btn:hover { background: none; text-decoration: underline; }

/* Superadmin (platform-owner) layer — same UI kit, distinct accent so a
   screenshot or accidental navigation makes it obvious this isn't a
   regular school view. */
:root[data-theme="light"] { --superadmin-accent: #4338CA; }
:root[data-theme="dark"] { --superadmin-accent: #818CF8; }

.superadmin-shell .sidebar { background: #1B1330; border-right: 3px solid var(--superadmin-accent); }
.superadmin-shell .sidebar nav a:hover,
.superadmin-shell .sidebar nav a.active { background: rgba(129, 140, 248, 0.18); color: white; }
.superadmin-shell .content { position: relative; }
.superadmin-shell h1 { color: var(--superadmin-accent); }
.superadmin-shell .stat-value { color: var(--superadmin-accent); }

.superadmin-badge {
    display: inline-block; background: var(--superadmin-accent); color: white;
    font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
    padding: 3px 8px; border-radius: 6px; margin-left: 8px; vertical-align: middle;
}
.superadmin-shell .auth-icon,
.superadmin-shell .auth-card h1 { color: var(--superadmin-accent); }
.superadmin-shell button, .superadmin-shell .btn, .superadmin-shell .btn-primary { background: var(--superadmin-accent); }
.superadmin-shell button:hover, .superadmin-shell .btn:hover, .superadmin-shell .btn-primary:hover { background: #372AA3; }
.superadmin-shell .btn-link { color: var(--superadmin-accent); }
.superadmin-shell .btn-secondary:hover { border-color: var(--superadmin-accent); color: var(--superadmin-accent); }
.superadmin-shell select:not([multiple]):focus { border-color: var(--superadmin-accent); box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.16); }

.badge-trial { background: #ede9fe; color: #6d28d9; }
.badge-suspended, .badge-cancelled { background: #fee2e2; color: var(--danger); }

/* List search box — client-side filter above a .list-card group */
.list-search { margin-bottom: 16px; }
.list-search input {
    width: 100%; max-width: 360px; padding: 10px 14px; border-radius: 8px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 14px;
}

/* List cards — horizontal row card used to replace plain tables on list
   pages (students, staff, payroll, ...). Reuses the .card surface/border. */
.list-cards { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.list-card {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 20px;
}
.list-card-hidden { display: none; }

.avatar-initials {
    flex-shrink: 0;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--primary); color: white;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 15px;
}

.list-card-main { flex: 1; min-width: 0; }
.list-card-title { font-weight: 600; font-size: 15px; }
.list-card-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

.list-card-side {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end;
}
.list-card-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.list-card-meta { color: var(--text-muted); font-size: 13px; text-align: right; }

@media (max-width: 640px) {
    .list-card { flex-wrap: wrap; }
    .list-card-side { justify-content: flex-start; width: 100%; padding-left: 60px; }
}

/* Timetable grid (builder + view) */
.tt-table { table-layout: fixed; }
.tt-table th, .tt-table td { vertical-align: top; }
.tt-table .tt-period-col { width: 90px; }
.tt-cell { padding: 8px !important; }
.tt-cell-view { text-align: center; }

/* Day headers + period labels — Stone-tinted band, bolder Poppins so they
   read as grid anchors rather than plain text. */
.tt-table th,
.tt-table .tt-period-col {
    background: var(--bg);
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
}
.tt-table th { letter-spacing: 0.02em; }
.tt-table thead th { border-bottom: 2px solid var(--border); }

/* Today's day column (timetable-view.php only — .tt-today-col is never
   rendered by timetable-builder.php) gets a subtle coral wash so a viewer
   spots today's schedule at a glance. */
.tt-today-col { background: rgba(249, 92, 75, 0.05); }
th.tt-today-col { background: rgba(249, 92, 75, 0.10); color: var(--primary); }

/* Filled slot "chip" — shared look for the read-only view page and the
   drag-and-drop builder cell, keyed off .tt-slot-filled / .is-filled so no
   JS changes are needed for it to apply on drop. */
.tt-slot-content { border-radius: 8px; padding: 8px; }
.tt-slot-filled,
.tt-drop-content.is-filled {
    background: rgba(249, 92, 75, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.10), inset 0 0 0 1px rgba(249, 92, 75, 0.14);
    border-radius: 8px;
}
.tt-drop-content.is-filled { cursor: grab; }
.tt-drop-content.is-filled:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14), inset 0 0 0 1px rgba(249, 92, 75, 0.22);
}
.tt-drop-content.is-filled:active { cursor: grabbing; }

.tt-subject {
    width: 100%; padding: 6px 8px; border-radius: 6px; margin-bottom: 4px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px;
}
.tt-teacher {
    width: 100%; padding: 6px 8px; border-radius: 6px; margin-bottom: 4px;
    border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px;
}
.tt-times { display: flex; gap: 4px; }
.tt-times input[type="time"] {
    width: 100%; padding: 4px 6px; border-radius: 6px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font-size: 12px;
}
.tt-empty-slot { color: var(--text-muted); font-size: 13px; }
.tt-slot-subject { font-family: 'Poppins', sans-serif; font-weight: 500; font-size: 14px; color: var(--text); }
.tt-slot-teacher { font-family: 'Inter', sans-serif; font-weight: 400; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.tt-slot-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Drag-and-drop builder layout (timetable + exam date sheet) */
.dnd-builder-layout { display: flex; gap: 20px; align-items: flex-start; }
.dnd-main { flex: 1; min-width: 0; }

.subject-palette {
    width: 240px; flex-shrink: 0;
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 16px; position: sticky; top: 16px;
}
.subject-palette h3 { margin: 0 0 4px; font-size: 15px; color: var(--text-muted); }
.subject-palette .hint { display: block; margin-bottom: 12px; }
.subject-chip-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

.subject-chip {
    display: flex; flex-direction: column; gap: 2px;
    padding: 8px 10px; border-radius: 10px;
    background: var(--bg); border: 1.5px solid var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: grab; user-select: none; transition: box-shadow 0.15s ease, transform 0.1s ease;
}
.subject-chip:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
    transform: translateY(-1px);
}
.subject-chip:active { cursor: grabbing; }
.subject-chip.is-dragging { opacity: 0.5; }
.subject-chip.is-armed {
    box-shadow: 0 0 0 2px var(--primary), 0 4px 10px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}
.subject-chip-name { font-weight: 600; font-size: 13px; color: var(--text); }
.subject-chip-teacher { font-size: 11px; color: var(--text-muted); }

.dnd-armed-hint {
    font-size: 12px; color: var(--primary); font-weight: 600;
    margin-bottom: 10px; display: none;
}
.dnd-armed-hint.is-visible { display: block; }

.tt-trash-zone {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px; border-radius: 8px; border: 1.5px dashed var(--border);
    color: var(--text-muted); font-size: 12px; text-align: center;
}
.tt-trash-zone.is-drag-over { border-color: var(--danger); color: var(--danger); background: #fee2e2; }

.tt-drop-cell { position: relative; transition: background 0.1s ease; }
.tt-drop-cell.is-drag-over { background: #fde3df; }
.tt-drop-content {
    min-height: 44px; border-radius: 6px; padding: 4px;
    display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.tt-drop-content.is-filled { align-items: flex-start; }
.tt-clear-btn {
    position: absolute; top: 4px; right: 4px; width: 18px; height: 18px;
    border: none; border-radius: 50%; background: var(--border); color: var(--text);
    font-size: 11px; line-height: 1; cursor: pointer; padding: 0;
    display: flex; align-items: center; justify-content: center;
}
.tt-clear-btn:hover { background: var(--danger); color: white; }

.tt-conflict-warning {
    display: none; margin-top: 4px; padding: 3px 6px; border-radius: 5px;
    background: #fef3c7; color: #92400e; font-size: 10px; line-height: 1.3;
}
.tt-conflict-warning.is-visible { display: block; }

@media (max-width: 640px) {
    .dnd-builder-layout { flex-direction: column; }
    .subject-palette { width: 100%; position: static; }
    .subject-chip-list { flex-direction: row; flex-wrap: wrap; }
    .subject-chip { flex: 1 1 140px; }
}

/* Exam date sheet calendar */
.exam-calendar-grid {
    display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr));
    gap: 8px; margin-bottom: 16px;
}
.exam-calendar-cell {
    background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
    padding: 8px; min-height: 90px; display: flex; flex-direction: column; gap: 4px;
}
.exam-calendar-date { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.exam-calendar-date .is-today { color: var(--primary); }
.exam-calendar-subjects { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.exam-calendar-subject-tag {
    position: relative; background: #fde3df; color: var(--primary);
    border-radius: 6px; padding: 4px 18px 4px 6px; font-size: 11px; font-weight: 600;
}
.exam-calendar-subject-tag .tt-clear-btn { top: 2px; right: 2px; }

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

/* Toast notifications (public/assets/js/app.js) */
.toast-container {
    position: fixed; top: 20px; right: 20px; z-index: 2000;
    display: flex; flex-direction: column; gap: 10px;
    max-width: 360px;
}
.toast {
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-left: 4px solid var(--primary);
    border-radius: 10px; padding: 12px 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
    font-size: 13px; line-height: 1.4;
    animation: toast-in 0.25s ease;
}
.toast.is-leaving { animation: toast-out 0.2s ease forwards; }
.toast > i { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.toast-message { flex: 1; }
.toast-close {
    background: none; border: none; padding: 0; margin: 0; flex-shrink: 0;
    font-size: 16px; line-height: 1; color: var(--text-muted); cursor: pointer;
}
.toast-close:hover { background: none; color: var(--text); }
.toast-success { border-left-color: var(--success); }
.toast-success > i { color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-error > i { color: var(--danger); }
.toast-warn { border-left-color: var(--warn); }
.toast-warn > i { color: var(--warn); }
.toast-info > i { color: var(--primary); }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(24px); }
    to { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(24px); }
}
@media (prefers-reduced-motion: reduce) {
    .toast, .toast.is-leaving { animation: none; }
}
@media (max-width: 480px) {
    .toast-container { left: 16px; right: 16px; top: 16px; max-width: none; }
}

/* Shared button/link loading spinner (Part B) */
.btn-spinner {
    display: inline-block; width: 13px; height: 13px; margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: currentColor;
    border-radius: 50%; vertical-align: -2px;
    animation: btn-spin 0.6s linear infinite;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .btn-spinner { animation: none; }
}

/* Required-field indicator (Part D) */
.required-mark { color: var(--danger); margin-left: 2px; }

/* First-run onboarding checklist (Part C, admin dashboard) */
.onboarding-card { max-width: 640px; margin: 0 auto; text-align: center; padding: 40px 32px; }
.onboarding-card .empty-state-icon { color: var(--primary); }
.onboarding-card h2 { margin: 0 0 6px; font-family: 'Poppins', sans-serif; }
.onboarding-steps {
    list-style: none; padding: 0; margin: 24px 0 0; text-align: left;
    display: flex; flex-direction: column; gap: 10px;
}
.onboarding-step {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
    text-decoration: none; color: var(--text); transition: border-color 0.15s ease, transform 0.15s ease;
}
.onboarding-step:hover { border-color: var(--primary); transform: translateX(2px); }
.onboarding-step-num {
    flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
    background: var(--primary); color: #fff; font-weight: 700; font-size: 13px;
    display: flex; align-items: center; justify-content: center;
}
.onboarding-step-label { flex: 1; font-weight: 600; font-size: 14px; }
.onboarding-step i.ti-chevron-right { color: var(--text-muted); }

/* Branded 404 page (public/404.php) */
.error-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: #14151A; padding: 24px;
}
.error-card { text-align: center; max-width: 420px; }
.error-logo { height: 32px; width: auto; margin: 0 auto 32px; display: block; }
.error-code { font-family: 'Poppins', sans-serif; font-weight: 700; font-size: 72px; color: var(--primary); line-height: 1; margin: 0; }
.error-title { font-family: 'Poppins', sans-serif; color: #fff; margin: 8px 0 8px; font-size: 22px; }
.error-text { color: #9ca3af; font-size: 14px; margin: 0 0 28px; }
.error-card .btn { margin-top: 4px; }

/* Student/Staff Profile pages (student-profile.php, staff-profile.php) */
.profile-header {
    display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.profile-header-avatar {
    width: 64px; height: 64px; font-size: 22px; flex-shrink: 0;
}
.profile-header-main { flex: 1; min-width: 200px; }
.profile-header-main h1 { margin: 0 0 4px; font-size: 22px; }
.profile-header-meta { color: var(--text-muted); font-size: 14px; margin-bottom: 8px; }
.profile-header-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-header-actions { flex-shrink: 0; display: flex; gap: 10px; flex-wrap: wrap; }

.profile-nav {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
}
.profile-nav a {
    padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border);
    color: var(--text); text-decoration: none; font-size: 13px;
}
.profile-nav a:hover { border-color: var(--primary); color: var(--primary); }

.profile-section { scroll-margin-top: 16px; margin-bottom: 24px; }
.profile-section h2 { margin-top: 0; }
