:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --sidebar-bg: linear-gradient(165deg, #4f46e5 0%, #6d28d9 52%, #4338ca 100%);
    --sidebar-bg-2: rgba(255, 255, 255, 0.08);
    --sidebar-hover: rgba(255, 255, 255, 0.14);
    --sidebar-active: rgba(255, 255, 255, 0.22);
    --sidebar-text: rgba(255, 255, 255, 0.88);
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --bg: #f1f5f9;
    --white: #ffffff;
    --success: #059669;
    --success-bg: #ecfdf5;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --warning: #d97706;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    --sidebar-w: 250px;
}

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

body {
    font-family: "Tajawal", "Segoe UI", system-ui, -apple-system, "Tahoma", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.main-sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset-inline-start: 0;
    top: 0; bottom: 0;
    z-index: 1040;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    background: var(--sidebar-bg-2);
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.brand-mark {
    width: 40px; height: 40px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.brand-text strong { display: block; color: #fff; font-size: 15px; }
.brand-text small { color: #94a3b8; font-size: 11px; }
.brand-logo {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: #fff;
    padding: 4px;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-nav { flex: 1; padding: 12px 10px; }
.sidebar-nav .nav { gap: 2px; }
.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 8px;
    color: var(--sidebar-text);
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
}
.sidebar-nav .nav-link i { font-size: 17px; flex-shrink: 0; width: 20px; text-align: center; }
.sidebar-nav .nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.sidebar-nav .nav-link:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-nav .nav-link.active { background: var(--sidebar-active); color: #fff; box-shadow: 0 2px 8px rgba(79,70,229,0.35); }

.sidebar-footer { padding: 10px; border-top: 1px solid rgba(255,255,255,0.06); }
.sidebar-footer .nav-link { color: var(--sidebar-text); }
.sidebar-footer .badge { margin-inline-start: auto; }
.logout-form { margin: 0; }
.logout-form .nav-link {
    width: 100%;
    background: none; border: none; font: inherit;
    cursor: pointer; text-align: start;
}
.logout-form .nav-link:hover { background: var(--error); color: #fff; }

.main-panel {
    flex: 1;
    margin-inline-start: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

.main-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 10px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.header-start { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title { font-size: 18px; font-weight: 700; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.sidebar-toggle { display: none; }

.btn-icon {
    width: 40px; height: 40px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff; color: var(--text);
    font-size: 18px;
}
.btn-icon:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }

.lang-switcher { width: auto; padding: 6px 10px; }
.lang-switcher-fixed { position: fixed; top: 14px; inset-inline-end: 16px; z-index: 50; }

.user-menu .user-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 8px; border-radius: 10px;
}
.user-menu .user-chip:hover { background: var(--bg); text-decoration: none; }
.avatar {
    width: 36px; height: 36px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; flex-shrink: 0;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-xl { width: 96px; height: 96px; font-size: 34px; }
.avatar-initials { background: var(--primary-light); color: var(--primary); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 13px; color: var(--text); }
.user-meta small { color: var(--muted); font-size: 11px; }
.user-menu .bi-chevron-down { color: var(--muted); font-size: 12px; }

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

/* ---------- Cards ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-header h2, .card-header h3 { font-size: 15px; font-weight: 700; margin: 0; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }

/* ---------- Stat widgets ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex; align-items: center; gap: 14px;
}
.stat .stat-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: var(--primary); background: var(--primary-light);
    flex-shrink: 0;
}
.stat .value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; }

/* ---------- Tables (legacy .data shim) ---------- */
.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
table.data th {
    text-align: start;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    white-space: nowrap;
}
table.data td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:hover td { background: #f8fafc; }
table.data .actions { display: flex; gap: 6px; }

/* ---------- Badges / pills (legacy shim) ---------- */
.pill { display: inline-block; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-green { background: var(--success-bg); color: var(--success); }
.pill-red { background: var(--error-bg); color: var(--error); }
.pill-yellow { background: #fffbeb; color: var(--warning); }
.pill-gray { background: #f1f5f9; color: var(--muted); }
.pill-blue { background: var(--primary-light); color: var(--primary); }
.pill-orange { background: #fff7ed; color: #ea580c; }

/* Dynamic pills rendered as `badge pill-*` (color decided in PHP) */
.badge.pill-green { background: var(--success); color: #fff; }
.badge.pill-red { background: var(--error); color: #fff; }
.badge.pill-yellow { background: var(--warning); color: #fff; }
.badge.pill-blue { background: var(--primary); color: #fff; }
.badge.pill-gray { background: #64748b; color: #fff; }
.badge.pill-orange { background: #ea580c; color: #fff; }

/* Contracts & e-signatures */
.contract-document,
.contract-preview {
    font-family: 'Tajawal', system-ui, 'Segoe UI', sans-serif;
    line-height: 1.9;
    color: #1a1a1a;
}
.contract-document h1,
.contract-document h2,
.contract-preview h1,
.contract-preview h2 {
    color: #1a3c6e;
    line-height: 1.4;
}
.contract-document ul,
.contract-preview ul {
    margin-inline-start: 1.25rem;
}
.signature-wrap {
    background: #fff;
    width: 100%;
    max-width: 420px;
}
.signature-pad {
    width: 100%;
    height: 180px;
    display: block;
    touch-action: none;
    cursor: crosshair;
}
.sig {
    display: inline-block;
    height: 64px;
    width: auto;
    max-width: 100%;
    vertical-align: bottom;
    object-fit: contain;
}

/* Student search autocomplete */
.student-results {
    position: relative;
    z-index: 20;
    margin-top: 4px;
}
.student-result {
    display: block;
    width: 100%;
    text-align: start;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-top: none;
    background: #fff;
    cursor: pointer;
}
.student-result:first-child {
    border-top: 1px solid #e2e8f0;
}
.student-result:hover {
    background: #f1f5f9;
}
.student-result.empty {
    cursor: default;
    color: var(--muted);
}
.pill-pink { background: #fdf2f8; color: #db2777; }
.badge.pill-pink { background: #db2777; color: #fff; }
.stat-sub { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---------- Searchable select widget (select2-style) ---------- */
.ss { position: relative; }
.ss-input { width: 100%; cursor: pointer; padding-right: 30px; }
[dir="rtl"] .ss-input { padding-right: 12px; padding-left: 30px; }
.ss-caret {
    position: absolute; top: 50%; right: 12px; transform: translateY(-50%);
    color: var(--muted); font-size: 12px; pointer-events: none; transition: transform 0.12s ease;
}
[dir="rtl"] .ss-caret { right: auto; left: 12px; }
.ss.open .ss-caret { transform: translateY(-50%) rotate(180deg); }
.ss-menu {
    position: absolute; z-index: 1080; left: 0; right: 0; top: calc(100% + 2px);
    background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12); max-height: 260px; overflow-y: auto;
    display: none; padding: 4px;
}
.ss-option { padding: 9px 12px; cursor: pointer; font-size: 14px; border-radius: 6px; }
.ss-option:hover, .ss-option.active { background: var(--primary-light); color: var(--primary); }
.ss-empty { padding: 10px 12px; color: var(--muted); font-size: 13px; }

/* ---------- Forms (legacy shim for raw inputs) ---------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
label.field-label { font-size: 12px; font-weight: 600; color: #374151; }
.field-hint { font-size: 11px; color: var(--muted); line-height: 1.4; }
input, select, textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
textarea { min-height: 80px; resize: vertical; }

/* ---------- Buttons (compatible with Bootstrap .btn) ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: none;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-light); }
.btn-danger { background: var(--error); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #047857; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-link {
    background: none; border: none; color: var(--primary);
    font-size: 12px; cursor: pointer; padding: 4px;
}
.btn-link.danger { color: var(--error); }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; border: 1px solid transparent; }
.alert-error, .alert-danger { background: #fdecec; color: #b42318; border-color: #f5c2c2; }
.alert-success { background: #e8f7ee; color: #087443; border-color: #b6e6c9; }
.alert-warning { background: #fff6e6; color: #9a6700; border-color: #ffe1a8; }
.alert ul.errors { margin-bottom: 0; }

/* ---------- Search / toolbar ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input[type="search"], .toolbar input, .toolbar select { width: auto; }

/* ---------- Pagination ---------- */
.pagination { display: flex; gap: 6px; padding: 14px 20px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 5px 11px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--text);
}
.pagination a:hover { background: var(--primary-light); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .info { color: var(--muted); margin-inline-end: auto; }

/* ---------- Attendance ---------- */
.attendance-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.attendance-row:last-child { border-bottom: none; }
.attendance-row .student-info { flex: 1; }
.attendance-row select { width: 160px; }
.attendance-row input.remark { flex: 1; width: auto; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 20px; background: var(--white); flex-wrap: wrap; }
.tabs a {
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--primary); }

/* ---------- Timetable week board ---------- */
.tt-board { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; }
.tt-day { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.tt-day-head { background: #eef2ff; color: #312e81; font-weight: 700; text-align: center; padding: 8px; font-size: 13px; }
.tt-day-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 130px; }
.tt-lesson { position: relative; border-radius: 8px; padding: 8px 10px; border: 1px solid rgba(0,0,0,0.06); }
.tt-subject { font-weight: 700; font-size: 13px; color: #111827; padding-inline-end: 22px; }
.tt-time { font-size: 11px; color: #374151; }
.tt-meta { font-size: 11px; color: #4b5563; }
.tt-remove-form { position: absolute; top: 4px; inset-inline-end: 4px; margin: 0; }
.tt-remove { border: none; background: rgba(255,255,255,0.7); color: #b91c1c; width: 22px; height: 22px; line-height: 1; border-radius: 50%; cursor: pointer; font-size: 16px; padding: 0; }
.tt-remove:hover { background: #fee2e2; }
.tt-empty { color: #9ca3af; text-align: center; font-size: 12px; margin: auto; }
@media (max-width: 992px) { .tt-board { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 576px) { .tt-board { grid-template-columns: 1fr; } }

/* ---------- Timetable matrix (section page) ---------- */
.tt-matrix { width: 100%; border-collapse: separate; border-spacing: 6px; }
.tt-matrix th, .tt-matrix td { vertical-align: top; }
.tt-matrix thead th { background: #eef2ff; color: #312e81; font-weight: 700; font-size: 12px; text-align: center; padding: 8px 6px; border-radius: 8px; }
.tt-matrix .tt-corner { background: transparent; }
.tt-matrix .tt-daycell { background: #f8fafc; font-weight: 700; color: #1f2937; text-align: center; width: 96px; border-radius: 8px; font-size: 13px; }
.tt-slot { background: #fff; border: 1px dashed #e5e7eb; border-radius: 8px; min-height: 64px; padding: 6px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; transition: border-color .15s, background .15s; }
.tt-slot:hover { border-color: var(--primary); background: #f5f3ff; }
.tt-cell-lesson { text-align: start; border: 1px solid rgba(0,0,0,0.06); border-radius: 8px; padding: 6px 8px; cursor: pointer; width: 100%; background: #e7f1ff; }
.tt-cell-lesson:hover { filter: brightness(.97); }
.tt-cell-empty { color: #9ca3af; font-size: 18px; text-align: center; margin: auto; width: 100%; }
.tt-slot .tt-subject { font-weight: 700; font-size: 12px; color: #111827; }
.tt-slot .tt-time { font-size: 10px; color: #374151; }
.tt-slot .tt-meta { font-size: 10px; color: #4b5563; }
.tt-add-row { margin-top: 10px; }
@media (max-width: 1100px) { .tt-matrix-wrap { overflow-x: auto; } .tt-matrix { min-width: 880px; } }

/* ---------- Login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #4f46e5, #4338ca); }
.login-box {
    background: var(--white);
    border-radius: 14px;
    padding: 40px;
    width: 400px;
    max-width: 92vw;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}
.login-box .brand-mark { margin-bottom: 16px; }
.login-box h1 { font-size: 20px; margin-bottom: 4px; }
.login-box p.sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.empty-state { text-align: center; color: var(--muted); padding: 40px; }
.cred-file-note { background: #fffbeb; border: 1px solid #fde68a; color: var(--warning); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; margin-bottom: 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 768px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Fee types cards grid ---------- */
.fee-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.fee-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.fee-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.fee-name { font-size: 15px; }
.fee-amount { font-size: 20px; font-weight: 700; color: var(--text); }
.fee-amount .muted { font-size: 13px; font-weight: 500; }
.fee-meta { display: flex; gap: 8px; }
.fee-card-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ---------- Guardian / enrollment wizard ---------- */
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 24px; }
.step { flex: 1; text-align: center; padding: 10px; border-radius: 8px; background: #f1f5f9; color: var(--muted); font-size: 13px; font-weight: 600; }
.step.active { background: var(--primary); color: #fff; }
.step.completed { background: var(--success); color: #fff; }
.portal-box { max-width: 920px; margin: 40px auto; padding: 36px 40px; background: #fff; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.08); text-align: center; }
.portal-box .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.portal-box form { text-align: start; }
[dir="rtl"] .portal-box form { text-align: end; }
.portal-box--wide { max-width: 1180px; }
.portal-box--wide .form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ref-box { display: inline-block; margin: 16px 0; padding: 14px 28px; font-size: 24px; font-weight: 800; letter-spacing: 1px; border: 2px dashed var(--primary); border-radius: 12px; color: var(--primary); }
.review-table td { vertical-align: top; }
.decision-form { border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
#guardian-results { min-height: 0; }
#guardian-form-block { transition: opacity .2s; }

/* ---------- Finance ---------- */
.status-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.total-row { border-top: 2px solid var(--border); }
.total-row td { font-weight: 600; }

/* ---------- Responsive sidebar ---------- */
@media (max-width: 992px) {
    .main-sidebar {
        inset-inline-start: calc(var(--sidebar-w) * -1);
        transition: inset-inline-start 0.25s ease;
        box-shadow: 0 0 30px rgba(0,0,0,0.3);
    }
    body.sidebar-open .main-sidebar { inset-inline-start: 0; }
    .main-panel { margin-inline-start: 0; }
    .sidebar-toggle { display: inline-flex; }
    .user-meta { display: none; }
    .user-menu .bi-chevron-down { display: none; }
}

/* ---------- Print (invoices, lists) ---------- */
@media print {
    body { background: #fff; }
    .main-sidebar, .main-header, .alert, .toolbar, .pagination,
    .logout-form, .lang-switcher, .user-menu, .sidebar-toggle, .print-hide { display: none !important; }
    .wrapper { display: block; }
    .main-panel { margin: 0 !important; }
    .content { padding: 0 !important; }
    .card { border: none; box-shadow: none; margin: 0 0 16px; page-break-inside: avoid; }
    .card-header { border-bottom: 1px solid #000; }
    .table-wrap { overflow: visible; }
    table.data th, table.data td { border-color: #999; }
    a { color: #000; text-decoration: none; }
    .print-show { display: block !important; }
}
/* ============================================================
   Public school website (site-body, hero, services, news, footer)
   ============================================================ */
.site-body { background: #fff; display: block; }
.site-content { min-height: 60vh; }

/* Hero */
.hero {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 60%, #312e81 100%);
    color: #fff;
    padding: 72px 0;
}
.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 13px;
    margin-bottom: 16px;
}
.hero-title { font-size: 2.4rem; font-weight: 800; line-height: 1.2; margin-bottom: 16px; }
.hero-lead { font-size: 1.05rem; opacity: 0.92; max-width: 620px; margin-bottom: 24px; }
.hero-actions .btn { margin-bottom: 8px; }
.hero-art {
    width: 220px; height: 220px; margin: 0 auto;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    display: flex; align-items: center; justify-content: center;
    font-size: 96px; color: rgba(255,255,255,0.9);
}

/* Section headings */
.section-title { font-size: 1.7rem; font-weight: 800; color: #111827; }
.section-sub { color: #6b7280; font-size: 0.95rem; }

/* Services */
.service-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 26px 22px;
    height: 100%;
    transition: transform .15s, box-shadow .15s;
}
.service-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(0,0,0,0.08); }
.service-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: #4f46e5; background: #eef2ff;
    margin-bottom: 14px;
}
.service-card h5 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }

/* News cards */
.news-card {
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    overflow: hidden;
    height: 100%;
    color: inherit;
    transition: transform .15s, box-shadow .15s;
}
.news-card:hover { transform: translateY(-4px); box-shadow: 0 12px 28px rgba(0,0,0,0.08); text-decoration: none; color: inherit; }
.news-thumb {
    height: 170px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    display: flex; align-items: center; justify-content: center;
    font-size: 56px; color: #6366f1;
    overflow: hidden;
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.news-body { padding: 18px; }
.news-date { font-size: 12px; color: #6b7280; }
.news-title { font-size: 1.1rem; font-weight: 700; margin: 6px 0; line-height: 1.35; }
.news-excerpt { font-size: 0.9rem; color: #6b7280; margin-bottom: 10px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.read-more { font-size: 0.85rem; font-weight: 600; color: #4f46e5; }

/* CTA band */
.cta { background: #111827; color: #fff; padding: 56px 0; }
.cta h2 { font-weight: 800; }

/* Article detail */
.article-title { font-size: 2rem; font-weight: 800; color: #111827; }
.article-lead { font-size: 1.1rem; color: #374151; font-weight: 500; }
.article-body { font-size: 1rem; line-height: 1.8; color: #1f2937; white-space: pre-wrap; }

/* Footer */
.site-footer { background: #0f172a; color: #cbd5e1; padding: 48px 0 18px; margin-top: 0; }
.site-footer h5, .site-footer h6 { color: #fff; }
.footer-links { margin: 0; }
.footer-links a { color: #cbd5e1; text-decoration: none; font-size: 0.9rem; line-height: 2; }
.footer-links a:hover { color: #fff; text-decoration: underline; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); margin-top: 28px; padding-top: 16px; text-align: center; color: #94a3b8; }

/* Inner page hero (About / Contact / Gallery) */
.page-hero {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 60%, #312e81 100%);
    color: #fff;
    padding: 48px 0;
}
.page-hero .hero-title { font-size: 2rem; }

/* Info card (About pillars / Contact info) */
.info-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 20px 22px;
    height: 100%;
}
.info-card h4, .info-card h6 { font-weight: 700; margin-bottom: 8px; }

/* Gallery */
.gallery-item {
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 18px rgba(0,0,0,0.06);
    background: #fff;
}
.gallery-item img { width: 100%; height: 200px; object-fit: cover; display: block; }
.gallery-item figcaption {
    padding: 12px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    text-align: center;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/fonts/tajawal/tajawal-400-0.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../vendor/fonts/tajawal/tajawal-400-1.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../vendor/fonts/tajawal/tajawal-500-2.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../vendor/fonts/tajawal/tajawal-500-3.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../vendor/fonts/tajawal/tajawal-700-4.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../vendor/fonts/tajawal/tajawal-700-5.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Inline action buttons (tables) ---------- */
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; display: inline-flex; }

/* ---------- Public site logo ---------- */
.site-logo { height: 34px; width: auto; border-radius: 8px; background: #fff; padding: 3px; }

/* ---------- Sidebar active highlight ---------- */
.sidebar-nav .nav-link.active {
    box-shadow: inset 3px 0 0 rgba(255, 255, 255, 0.85);
}

/* ---------- Printable documents (invoice / payments) ---------- */
.print-toolbar { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 16px; }
.printable { background: #fff; color: #111; padding: 28px; border-radius: 12px; max-width: 820px; margin: 0 auto; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08); }
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid var(--primary); padding-bottom: 14px; margin-bottom: 18px; }
.doc-brand { display: flex; gap: 12px; align-items: center; }
.doc-logo { height: 60px; width: auto; border-radius: 10px; background: #fff; padding: 4px; }
.doc-title { font-size: 20px; margin: 0; color: var(--primary-dark, #3730a3); }
.doc-sub { font-size: 12px; color: #555; margin-top: 2px; display: flex; gap: 12px; flex-wrap: wrap; }
.doc-meta { text-align: end; font-size: 13px; }
.doc-badge { display: inline-block; background: var(--primary); color: #fff; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 12px; margin-bottom: 6px; }
.doc-row { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; margin-bottom: 16px; }
.doc-label { color: #777; margin-inline-end: 6px; }
.doc-section { margin: 18px 0 8px; font-size: 15px; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.doc-table th, .doc-table td { border-bottom: 1px solid #e5e7eb; padding: 8px 10px; text-align: start; }
.doc-table .num { text-align: end; }
.doc-table tfoot td { font-weight: 600; border-top: 2px solid #d1d5db; }
.doc-foot { margin-top: 22px; text-align: center; font-size: 11px; color: #999; }

@media print {
    body { background: #fff !important; }
    .no-print, .main-sidebar, .main-header, .sidebar-toggle, .print-toolbar { display: none !important; }
    .wrapper, .main-panel, .content { display: block !important; margin: 0 !important; padding: 0 !important; }
    .printable { box-shadow: none; border-radius: 0; max-width: 100%; padding: 0; }
}

/* ---------- Settings tabs ---------- */
.tab-nav { display: flex; gap: 6px; background: #f1f5f9; padding: 6px; border-radius: 12px; margin-bottom: 18px; }
.tab-link { flex: 1; border: none; background: transparent; padding: 10px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; color: #475569; transition: background .15s, color .15s; }
.tab-link.active { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }
.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---------- Toggle switch ---------- */
.switch-row { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; }
.switch .slider:before { content: ""; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider:before { transform: translateX(20px); }
.switch-title { font-weight: 700; }
.switch-sub { font-size: 12px; color: #64748b; }
hr.my-3 { margin: 18px 0; border: none; border-top: 1px solid var(--border, #e5e7eb); }

/* ---------- Parent portal hero ---------- */
.parent-hero {
    position: relative;
    border-radius: 16px;
    min-height: 180px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}
.parent-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.25));
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 28px 32px;
    color: #fff;
}
.parent-hero-greeting { margin: 0; font-size: 14px; opacity: 0.85; }
.parent-hero-name { margin: 4px 0; font-size: 30px; font-weight: 800; }
.parent-hero-sub { margin: 0; font-size: 13px; opacity: 0.8; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }

/* ---------- Dashboard quick-access ---------- */
.quick-access { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.qa-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; background: #fff; border: 1px solid var(--border, #e5e7eb); border-radius: 12px; color: #334155; text-decoration: none; font-size: 13px; font-weight: 600; transition: .15s; }
.qa-btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 4px 12px rgba(79, 70, 229, .12); transform: translateY(-2px); }
.qa-btn i { font-size: 22px; }

/* ---------- Sidebar collapsible groups ---------- */
.nav-group { margin-bottom: 2px; }
.nav-group-toggle {
    width: 100%;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 14px 18px 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    cursor: pointer;
    border-radius: 8px;
}
.nav-group-toggle:hover { color: #fff; }
.nav-group-toggle .chev { font-size: 12px; transition: transform .18s ease; flex-shrink: 0; }
.nav-group.collapsed .nav-group-toggle .chev { transform: rotate(-90deg); }
[dir="rtl"] .nav-group.collapsed .nav-group-toggle .chev { transform: rotate(90deg); }
.nav-group-items { list-style: none; margin: 0; padding: 0; }
.nav-group.collapsed .nav-group-items { display: none; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px; }
.modal-box { background: #fff; border-radius: 14px; width: 520px; max-width: 94vw; max-height: 92vh; overflow: auto; box-shadow: 0 24px 50px rgba(0,0,0,.25); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #eef2f7; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { border: none; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: #6b7280; }
.modal-box form { padding: 18px 20px 20px; }
.modal-box .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-box .form-group { display: flex; flex-direction: column; gap: 6px; }

/* ---------- Mini student list ---------- */
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 4px; border-bottom: 1px solid #f1f5f9; }
.mini-list li:last-child { border-bottom: none; }
.mini-list a { font-weight: 600; color: #312e81; text-decoration: none; }
.mini-list a:hover { text-decoration: underline; }

/* ---------- Legendary lesson modal ---------- */
.modal-box.is-lesson { overflow: hidden; padding: 0; }
.modal-box.is-lesson .modal-head { padding: 16px 20px; border-bottom: 1px solid #eef2f7; }
.modal-box.is-lesson form { padding: 18px 20px 20px; }
.lesson-accent { height: 6px; width: 100%; background: #e7f1ff; transition: background .15s; }
.lm-head-left { display: flex; align-items: center; gap: 10px; }
.lm-dot { width: 14px; height: 14px; border-radius: 50%; background: #e7f1ff; transition: background .15s; flex-shrink: 0; }
.modal-box.is-lesson .field-label { font-weight: 600; color: #374151; }

/* ---------- Roles & Permissions workspace ---------- */
.rp { --rp-primary:#6d4aff; --rp-ps:#f0ebff; --rp-blue:#3b82f6; --rp-green:#22a06b; --rp-orange:#f59e0b; --rp-red:#ef4444; }
.rp .page-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; }
.rp .page-head h1 { margin:0; font-size:27px; }
.rp .page-head p { margin:6px 0 0; color:var(--muted); font-size:13px; }
.rp .head-icon { width:50px; height:50px; border-radius:15px; background:var(--rp-ps); display:grid; place-items:center; color:var(--rp-primary); font-size:24px; }
.rp .rp-stats { display:grid; grid-template-columns:repeat(4,1fr); gap:13px; margin-bottom:16px; }
.rp .stat { background:#fff; border:1px solid var(--border); border-radius:17px; padding:15px; display:flex; gap:12px; align-items:center; }
.rp .stat i { width:44px; height:44px; border-radius:14px; display:grid; place-items:center; font-style:normal; background:var(--rp-ps); color:var(--rp-primary); }
.rp .stat:nth-child(2) i { background:#eaf2ff; color:var(--rp-blue); }
.rp .stat:nth-child(3) i { background:#e9f7f0; color:var(--rp-green); }
.rp .stat:nth-child(4) i { background:#fff3e2; color:var(--rp-orange); }
.rp .stat small { color:var(--muted); display:block; }
.rp .stat strong { display:block; font-size:22px; margin-top:3px; }
.rp .rp-workspace { display:grid; grid-template-columns:340px 1fr; gap:15px; align-items:start; }
.rp .panel { background:#fff; border:1px solid var(--border); border-radius:18px; overflow:hidden; }
.rp .panel-head { padding:15px; border-bottom:1px solid var(--border); }
.rp .panel-row { display:flex; align-items:center; justify-content:space-between; gap:8px; }
.rp .panel h2 { margin:0; font-size:16px; }
.rp .panel p { margin:4px 0 0; color:var(--muted); font-size:11px; }
.rp .smallbtn { border:1px solid var(--border); background:#fff; border-radius:10px; padding:8px 10px; font-weight:800; font-size:11px; text-decoration:none; display:inline-block; cursor:pointer; }
.rp .smallbtn.primarybtn { background:var(--rp-primary); color:#fff; border-color:var(--rp-primary); }
.rp .role-search, .rp .perm-search { padding:11px 14px 0; }
.rp .role-search input, .rp .perm-search input { width:100%; height:40px; border:1px solid var(--border); border-radius:11px; padding:0 11px; outline:0; }
.rp .roles { padding:10px 12px 14px; display:flex; flex-direction:column; gap:7px; max-height:660px; overflow:auto; }
.rp .role { border:1px solid var(--border); border-radius:14px; padding:11px; display:flex; align-items:center; gap:9px; text-decoration:none; color:inherit; }
.rp .role.active { border-color:var(--rp-primary); box-shadow:0 0 0 2px rgba(109,74,255,.08); }
.rp .role-icon { width:40px; height:40px; border-radius:13px; background:var(--rp-ps); color:var(--rp-primary); display:grid; place-items:center; font-weight:900; flex:0 0 auto; }
.rp .role-copy { flex:1; min-width:0; }
.rp .role-copy strong { font-size:13px; display:block; }
.rp .role-copy span { font-size:10px; color:var(--muted); display:block; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.rp .badge { font-size:10px; background:#f5f6fa; padding:5px 8px; border-radius:999px; white-space:nowrap; }
.rp .perm-head { padding:15px; border-bottom:1px solid var(--border); }
.rp .role-info { display:flex; gap:12px; padding:12px 15px; border-bottom:1px solid var(--border); flex-wrap:wrap; }
.rp .role-info .form-group { flex:1; min-width:200px; margin:0; }
.rp .toolbar { display:flex; gap:8px; margin-top:10px; }
.rp .toolbar .perm-search { padding:0; flex:1; }
.rp .table-wrap { overflow:auto; }
.rp table { width:100%; border-collapse:collapse; min-width:680px; }
.rp th, .rp td { padding:12px 10px; border-bottom:1px solid var(--border); text-align:center; font-size:12px; }
.rp th:first-child, .rp td:first-child { text-align:start; }
.rp thead th { background:#fbfcff; color:#687080; }
.rp .perm-name { display:flex; gap:8px; align-items:center; font-weight:800; }
.rp .mi { width:28px; height:28px; border-radius:9px; background:#f3f5fa; display:grid; place-items:center; flex:0 0 auto; }
.rp .check { appearance:none; -webkit-appearance:none; width:20px; height:20px; border:1.5px solid #cbd1dd; border-radius:6px; display:inline-grid; place-items:center; background:#fff; cursor:pointer; vertical-align:middle; }
.rp .check:checked:after { content:'✓'; color:#fff; font-weight:900; font-size:12px; }
.rp .check.view:checked { background:var(--rp-blue); border-color:var(--rp-blue); }
.rp .check.add:checked { background:var(--rp-orange); border-color:var(--rp-orange); }
.rp .check.edit:checked { background:var(--rp-green); border-color:var(--rp-green); }
.rp .check.delete:checked { background:var(--rp-red); border-color:var(--rp-red); }
.rp .lv { color:var(--rp-blue); } .rp .la { color:var(--rp-orange); } .rp .le { color:var(--rp-green); } .rp .ld { color:var(--rp-red); }
.rp .special-perms { display:flex; flex-wrap:wrap; gap:10px 16px; }
.rp .special-perms .sp { display:flex; gap:6px; align-items:center; font-size:12px; font-weight:600; }
.rp .perm-foot { padding:13px 15px; display:flex; justify-content:space-between; align-items:center; gap:10px; border-top:1px solid var(--border); }
.rp .actions { display:flex; gap:8px; }
.rp .save { border:0; background:var(--rp-primary); color:#fff; border-radius:11px; padding:10px 15px; font-weight:900; cursor:pointer; }
.rp .reset { border:1px solid var(--border); background:#fff; border-radius:11px; padding:10px 13px; font-weight:800; text-decoration:none; color:var(--text); cursor:pointer; }
.rp .toast { position:fixed; left:22px; bottom:22px; background:#1f2430; color:#fff; padding:11px 15px; border-radius:12px; opacity:0; transform:translateY(8px); transition:.2s; font-size:12px; z-index:1000; }
.rp .toast.show { opacity:1; transform:none; }
@media (max-width:1050px) { .rp .rp-stats { grid-template-columns:repeat(2,1fr); } .rp .rp-workspace { grid-template-columns:300px 1fr; } }
@media (max-width:820px) { .rp .rp-workspace { grid-template-columns:1fr; } .rp .roles { max-height:320px; } }
@media (max-width:560px) { .rp .rp-stats { grid-template-columns:1fr; } .rp .perm-foot { align-items:stretch; flex-direction:column; } .rp .actions { width:100%; } .rp .actions button, .rp .actions a { flex:1; text-align:center; } }

/* Mobile responsiveness for parent portal documents & signatures */
@media (max-width: 768px) {
    .doc-head { flex-wrap: wrap; gap: 12px; }
    .doc-brand { flex-wrap: wrap; }
    .doc-meta { text-align: start; }
    .doc-title { font-size: 18px; }
    .contract-document { overflow-x: auto; }
    .signature-wrap { max-width: 100%; }
    .content { padding: 16px; }
    .card-header { flex-wrap: wrap; gap: 10px; }
}



.form-group.has-error input,
.form-group.has-error select {
    border-color: #e55353;
    background: #fff5f5;
}
.form-group.has-error label.field-label {
    color: #e55353;
}

/* Bus-card QR preview (student file) */
.bus-card-preview { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.bus-card-qr { width: 170px; height: 170px; border: 1px dashed var(--border,#dbe2ea); border-radius: 14px; padding: 6px; background: #fff; display: flex; align-items: center; justify-content: center; }
.bus-card-qr img { width: 100%; height: 100%; }
.bus-card-qr-missing { color: var(--muted,#64748b); font-size: 13px; text-align: center; }
.bus-card-meta { min-width: 210px; }
.bus-card-token { display: inline-block; max-width: 300px; overflow-wrap: anywhere; background: var(--bg-soft,#f1f5f9); padding: 4px 8px; border-radius: 6px; font-size: 12px; }
@media (max-width: 620px) { .bus-card-preview { justify-content: center; text-align: center; } }

/* Printable student cards (section batch) */
.sc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding: 20px; }
.sc-card { position: relative; background: #fff; border-radius: 18px; box-shadow: 0 10px 30px rgba(15,42,67,.18); overflow: hidden; border: 1px solid #e2d9c8; max-width: 380px; }
.sc-card-top { background: linear-gradient(135deg, #0f2a43 0%, #1c4a6e 100%); color: #fff; padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.sc-card-top .logo { width: 44px; height: 44px; border-radius: 50%; background: #fff; object-fit: contain; padding: 4px; }
.sc-card-top h3 { margin: 0; font-size: 15px; font-weight: 800; }
.sc-card-top small { display: block; opacity: .82; font-size: 11px; margin-top: 2px; }
.sc-card-top .sc-badge { margin-inline-start: auto; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 700; }
.sc-card-body { padding: 16px; display: flex; gap: 14px; }
.sc-card-avatar { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; background: var(--bg-soft,#eef2f7); border: 3px solid #0f2a43; }
.sc-card-avatar-initials { display: flex; align-items: center; justify-content: center; width: 76px; height: 76px; border-radius: 50%; background: linear-gradient(135deg,#0f2a43,#1c4a6e); color: #fff; font-size: 26px; font-weight: 800; }
.sc-card-info { flex: 1; min-width: 0; }
.sc-card-info .sc-name { font-size: 17px; font-weight: 800; margin: 0 0 2px; }
.sc-card-info dl { margin: 6px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 12px; }
.sc-card-info dt { color: var(--muted,#64748b); font-weight: 600; }
.sc-card-info dd { margin: 0; font-weight: 700; }
.sc-card-qr { text-align: center; padding: 0 14px 10px; }
.sc-card-qr img { width: 128px; height: 128px; border: 1px dashed var(--border,#dbe2ea); border-radius: 10px; padding: 4px; background: #fff; }
.sc-card-qr .sc-token { font-family: monospace; font-size: 11px; color: var(--muted,#475569); background: var(--bg-soft,#f1f5f9); border-radius: 6px; padding: 3px 6px; display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.sc-card-foot { background: #f8f5ee; border-top: 1px solid #e2d9c8; padding: 8px 14px; font-size: 11px; color: #6b6355; display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; text-align: center; }
.sc-card-foot i { margin-inline-end: 4px; }
.sc-print-bar { position: sticky; top: 0; z-index: 10; background: #fff; padding: 12px 20px; display: flex; gap: 10px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border,#e2e8f0); flex-wrap: wrap; }
.sc-print-bar .btn { text-decoration: none; }
@media print {
    .sc-print-bar { display: none; }
    body { background: #fff; }
    .sc-cards { padding: 0; gap: 0; grid-template-columns: repeat(2, 1fr); }
    .sc-card { box-shadow: none; border-radius: 10px; page-break-inside: avoid; break-inside: avoid; }
    @page { margin: 10mm; }
}

/* ---- PWA splash screen ---- */
.pwa-splash {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 38%, #123a5e 0%, #0f2a43 55%, #0b2033 100%);
    transition: opacity .35s ease;
}
.pwa-splash-leave { opacity: 0; pointer-events: none; }
.pwa-splash-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.pwa-splash-logo {
    width: 112px;
    height: auto;
    max-width: 38vw;
    animation: pwa-splash-in .5s ease both;
    filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .35));
}
.pwa-splash-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, .25);
    border-top-color: #f5b436;
    animation: pwa-splash-spin .9s linear infinite;
}
@keyframes pwa-splash-in {
    from { opacity: 0; transform: scale(.85); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes pwa-splash-spin {
    to { transform: rotate(360deg); }
}

/* Assign-student panel on the bus detail page */
.assign-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
}
.assign-card .assign-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-dark);
}
.assign-card .assign-card-head i { font-size: 15px; }
.assign-card .assign-card-body { padding: 16px; }
.assign-card .assign-card-body .form-grid { margin-bottom: 12px; }
.assign-card .assign-card-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
