:root {
    --navy: #071a3d;
    --navy-2: #102a5c;
    --turquoise: #13b9c5;
    --amber: #f6a800;
    --ink: #172033;
    --muted: #6f7b91;
    --line: #e5eaf2;
    --surface: #ffffff;
    --background: #f4f7fb;
    --success: #15805d;
    --danger: #c43c4d;
    --ui-accent: color-mix(in srgb, var(--navy) 32%, #2dd4bf);
    --radius: 18px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--background);
}

/* Teacher workspace */
.teacher-stats .stat { min-height: 122px; }
.teacher-stats .stat-value { font-size: 1.42rem; }
.teacher-payroll-stat { color: #fff; border: 0; background: linear-gradient(145deg, #173c64, #0e725f); }
.teacher-payroll-stat .stat-label { color: rgba(255,255,255,.72); }
.teacher-payroll-stat .stat-badge { color: #fff; background: rgba(255,255,255,.14); }
.teacher-access-label { font-size: 1.2rem !important; }
.eyebrow { display: block; margin-bottom: 7px; color: #0e7664; font-size: .67rem; font-weight: 900; letter-spacing: .14em; }
.teacher-editor { overflow: hidden; padding: 0; }
.teacher-editor-head { display: flex; justify-content: space-between; gap: 18px; padding: 24px 26px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #f5fbfb, #fff); }
.teacher-editor-head .card-subtitle { margin-bottom: 0; }
.teacher-form-section { display: grid; grid-template-columns: 54px minmax(0,1fr); gap: 18px; padding: 24px 26px; border-bottom: 1px solid var(--line); }
.teacher-section-number { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 13px; color: #0d745f; background: #e4f6f1; font-size: .76rem; font-weight: 900; }
.teacher-section-content h4 { margin: 7px 0 18px; font-size: 1rem; }
.teacher-help { margin: -10px 0 17px; color: var(--muted); font-size: .84rem; }
.teacher-editor > form > .form-actions { padding: 0 26px 24px; }
.salary-mode-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.salary-mode-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: .2s ease; }
.salary-mode-card:has(input:checked) { border-color: #0f8b72; background: #eefaf7; box-shadow: 0 0 0 3px rgba(15,139,114,.08); }
.salary-mode-card input { width: 18px; height: 18px; accent-color: #0f8b72; }
.salary-mode-card span { display: grid; gap: 3px; }
.salary-mode-card b { font-size: .9rem; }
.salary-mode-card small { color: var(--muted); font-size: .75rem; }
.teacher-salary-fields [hidden] { display: none; }
.teacher-salary-preview { display: flex; flex-direction: column; justify-content: center; min-height: 82px; padding: 13px 16px; border-radius: 13px; color: #fff; background: linear-gradient(135deg, #193f67, #136752); }
.teacher-salary-preview span, .teacher-salary-preview small { color: rgba(255,255,255,.69); font-size: .72rem; }
.teacher-salary-preview strong { margin: 3px 0; font-size: 1.15rem; }
.assignment-editor { display: grid; gap: 10px; margin-bottom: 12px; }
.assignment-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.35fr) 36px; gap: 10px; align-items: end; padding: 12px; border: 1px solid #e4ebf0; border-radius: 14px; background: #f9fbfc; }
.assignment-row .field { margin: 0; }
.assignment-remove { width: 36px; height: 43px; border: 0; border-radius: 10px; color: #a33b49; background: #ffedf0; font-size: 1.3rem; cursor: pointer; }
.notice { padding: 13px 15px; border-radius: 12px; font-size: .84rem; }
.notice-warn { color: #75540d; background: #fff5d9; }
.teacher-directory { margin-top: 18px; }
.teacher-directory-head { display: flex; justify-content: space-between; gap: 20px; }
.teacher-person { display: grid; grid-template-columns: 52px minmax(0,1fr); gap: 14px; padding: 19px 0; border-top: 1px solid var(--line); }
.teacher-avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: #fff; background: linear-gradient(145deg, #163e67, #109077); font-size: .8rem; font-weight: 900; }
.teacher-name-line { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.teacher-name-line > div:first-child { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.teacher-name-line strong { font-size: .98rem; }
.teacher-row-actions { display: flex; gap: 7px; }
.teacher-row-actions form { margin: 0; }
.teacher-meta { display: flex; flex-wrap: wrap; gap: 7px 13px; align-items: center; margin-top: 7px; color: var(--muted); font-size: .78rem; }
.teacher-pay { display: flex; flex-wrap: wrap; gap: 8px 13px; align-items: center; margin-top: 11px; padding: 10px 12px; border-radius: 11px; background: #f3f7fa; font-size: .78rem; }
.teacher-pay b { color: #184f75; }
.teacher-pay span { color: var(--muted); }
.teacher-pay strong { margin-left: auto; color: #0b725c; }
.teacher-assignments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.assignment-chip { display: flex; align-items: center; gap: 9px; padding: 8px 8px 8px 11px; border: 1px solid #dce8e5; border-radius: 11px; background: #f3faf8; }
.assignment-chip span { display: grid; gap: 2px; }
.assignment-chip b { font-size: .75rem; }
.assignment-chip small { color: var(--muted); font-size: .68rem; }
.assignment-chip form { margin: 0; }
.assignment-chip button { width: 24px; height: 24px; border: 0; border-radius: 7px; color: #9c3d49; background: #fff; cursor: pointer; }
.teacher-no-assignment { color: var(--muted); font-size: .78rem; font-style: italic; }
.app-pagination-wrap { margin-top: 20px; }
.app-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}
.app-pagination-summary { margin: 0; color: var(--muted); font-size: .76rem; }
.app-pagination-pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.app-page-link {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    flex: 0 0 36px;
    border: 1px solid #d9e3ea;
    border-radius: 10px;
    color: #214f73;
    background: #fff;
    font-size: .78rem;
    font-weight: 850;
    line-height: 1;
}
.app-page-link:hover { border-color: #9bc8dc; background: #eef8fc; }
.app-page-link.is-current { color: #fff; border-color: var(--primary); background: var(--primary); box-shadow: 0 7px 15px rgba(13, 116, 196, .2); }
.app-page-link.is-disabled { color: #a8b2bd; background: #f4f6f8; cursor: not-allowed; }
.supervision-cycle-picker { padding: 15px; border: 1px solid #dce9e6; border-radius: 13px; background: #f5fbf9; }
.supervision-cycle-picker[hidden] { display: none; }
.cycle-checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.cycle-checks label { cursor: pointer; }
.cycle-checks input { position: absolute; opacity: 0; pointer-events: none; }
.cycle-checks span { display: inline-flex; padding: 8px 11px; border: 1px solid #dce5e9; border-radius: 999px; color: #536477; background: #fff; font-size: .76rem; font-weight: 750; }
.cycle-checks input:checked + span { color: #0c705c; border-color: #79c8b8; background: #e6f8f3; }
.cycle-checks-compact { max-width: 370px; margin: 0 0 8px; }
.cycle-checks-compact span { padding: 5px 8px; font-size: .68rem; }
.staff-scope-form { min-width: 280px; }
.muted { color: var(--muted); }
.behavior-scope { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.behavior-stats { grid-template-columns: repeat(4,minmax(0,1fr)); }
.behavior-stats .stat-value { font-size: 1.35rem; }
.behavior-role-stat { color: #fff; border: 0; background: linear-gradient(145deg, #173d67, #0b765f); }
.behavior-role-stat .stat-label { color: rgba(255,255,255,.72); }
.behavior-report-card { display: grid; grid-template-columns: minmax(230px,.55fr) minmax(0,1.45fr); gap: 24px; }
.behavior-report-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 13px; }
.behavior-report-grid .field { margin: 0; }
.behavior-list { display: grid; gap: 14px; }
.behavior-case { position: relative; overflow: hidden; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.behavior-case::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #e2a938; }
.behavior-case.severity-low::before { background: #5bb28f; }
.behavior-case.severity-high::before { background: #d34b5c; }
.behavior-case-head { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 11px; align-items: center; }
.behavior-student-avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #17466a; background: #e9f1f7; font-size: .72rem; font-weight: 900; }
.behavior-case-head > div:nth-child(2) { display: grid; gap: 3px; }
.behavior-case-head small { color: var(--muted); font-size: .72rem; }
.behavior-status { padding: 6px 9px; border-radius: 999px; color: #7a5911; background: #fff2cf; font-size: .68rem; font-weight: 850; }
.behavior-status.status-resolved { color: #0d6e55; background: #e3f7f0; }
.behavior-status.status-guardian_contacted { color: #164e7b; background: #e7f2fc; }
.behavior-facts { display: flex; flex-wrap: wrap; gap: 15px; margin: 14px 0 9px 53px; color: var(--muted); font-size: .75rem; }
.behavior-facts span { display: flex; gap: 5px; }
.behavior-facts b { color: #405066; }
.behavior-description { margin: 0 0 0 53px; color: #344357; font-size: .86rem; line-height: 1.6; }
.behavior-decision { margin: 15px 0 0 53px; padding: 13px 15px; border-radius: 12px; background: #eef8f5; }
.behavior-decision span, .behavior-decision small { display: block; color: #638076; font-size: .7rem; }
.behavior-decision strong { display: block; margin: 3px 0; color: #0c6f59; font-size: .82rem; }
.behavior-decision p { margin: 5px 0; font-size: .82rem; }
.behavior-decision-form { margin: 15px 0 0 53px; padding: 14px; border: 1px dashed #cfdde3; border-radius: 13px; background: #fafcfd; }
.notify-parent-check { display: flex; align-items: center; gap: 9px; margin-top: 10px; color: #33465a; font-size: .8rem; font-weight: 700; cursor: pointer; }
.notify-parent-check input { width: 17px; height: 17px; accent-color: #0e7f68; }
.gradebook-rules { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin-bottom: 18px; }
.gradebook-rules span { padding: 11px 13px; border: 1px solid #dce7eb; border-radius: 12px; color: #5b6a7d; background: #fff; font-size: .78rem; }
.gradebook-rules b { color: #123f64; }
.results-filter-card { display: grid; grid-template-columns: minmax(260px,1fr) minmax(180px,.45fr) minmax(260px,.8fr); gap: 16px; align-items: end; margin-bottom: 18px; }
.results-filter-card form .field { margin: 0; }
.result-rule, .result-next { display: grid; gap: 3px; min-height: 70px; align-content: center; padding: 12px 14px; border-radius: 13px; background: #f3f8fa; }
.result-rule { color: #fff; background: linear-gradient(145deg, #153e68, #0d745e); }
.result-rule span, .result-rule small { color: rgba(255,255,255,.7); font-size: .7rem; }
.result-rule strong { font-size: 1.25rem; }
.result-next span { color: var(--muted); font-size: .7rem; }
.result-next strong { font-size: .83rem; }
.result-stats .stat-value { font-size: 1.35rem; }
.result-validated-stat { color: #fff; border: 0; background: linear-gradient(145deg, #1b426b, #106b59); }
.result-validated-stat .stat-label { color: rgba(255,255,255,.72); }
.results-explanation { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-bottom: 18px; }
.results-explanation > div { display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: #f5f8fa; }
.results-explanation b { font-size: .78rem; }
.results-explanation span { color: var(--muted); font-size: .74rem; line-height: 1.45; }
.result-list { display: grid; gap: 13px; }
.result-student { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; }
.result-student::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #d69b34; }
.result-student.result-pass::before { background: #21a079; }
.result-student-main { display: grid; grid-template-columns: 44px minmax(170px,1fr) 130px minmax(150px,.65fr); gap: 12px; align-items: center; padding: 15px 17px; }
.result-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #174970; background: #eaf1f7; font-size: .72rem; font-weight: 900; }
.result-student-main > div:nth-child(2) { display: grid; gap: 3px; }
.result-student-main > div:nth-child(2) small { color: var(--muted); font-size: .7rem; }
.result-average { display: grid; gap: 2px; }
.result-average strong { color: #173f62; font-size: 1.25rem; }
.result-average strong small { color: #8090a1; font-size: .72rem; }
.result-average > span { color: var(--muted); font-size: .68rem; }
.result-pass .result-average strong { color: #0d775d; }
.result-saved { display: grid; gap: 2px; padding: 8px 10px; border-radius: 10px; background: #eaf7f3; }
.result-saved span, .result-saved small { color: #66827a; font-size: .64rem; }
.result-saved strong { color: #0c6e58; font-size: .73rem; }
.promotion-form { display: grid; grid-template-columns: minmax(220px,1fr) minmax(220px,1fr) minmax(180px,.7fr) auto; gap: 10px; align-items: end; padding: 13px 17px 15px 72px; border-top: 1px solid var(--line); background: #fafcfd; }
.promotion-form .field { margin: 0; }
.promotion-form button { min-height: 43px; }
.promotion-target[hidden] { display: none; }
.result-no-grade { padding: 11px 17px 13px 72px; border-top: 1px solid var(--line); color: #93641b; background: #fff9e9; font-size: .76rem; }

@media (max-width: 760px) {
    .teacher-form-section { grid-template-columns: 1fr; padding: 20px; }
    .teacher-section-number { width: 34px; height: 34px; }
    .salary-mode-grid { grid-template-columns: 1fr; }
    .assignment-row { grid-template-columns: 1fr 36px; }
    .assignment-row .field:first-child { grid-column: 1 / -1; }
    .teacher-person { grid-template-columns: 1fr; }
    .teacher-name-line { flex-direction: column; }
    .teacher-pay strong { width: 100%; margin-left: 0; }
    .behavior-stats, .behavior-report-card, .behavior-report-grid { grid-template-columns: 1fr; }
    .behavior-case-head { grid-template-columns: 42px minmax(0,1fr); }
    .behavior-status { grid-column: 2; width: max-content; }
    .behavior-facts, .behavior-description, .behavior-decision, .behavior-decision-form { margin-left: 0; }
    .gradebook-rules, .results-filter-card, .results-explanation { grid-template-columns: 1fr; }
    .result-student-main { grid-template-columns: 44px minmax(0,1fr); }
    .result-average, .result-saved { grid-column: 2; }
    .promotion-form { grid-template-columns: 1fr; padding-left: 17px; }
    .result-no-grade { padding-left: 17px; }
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--background); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 24px 18px;
    color: #fff;
    background:
        radial-gradient(circle at 15% 8%, rgba(19,185,197,.24), transparent 24%),
        linear-gradient(180deg, var(--navy), #04112a);
    display: flex;
    flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 28px; }
.brand img { width: 54px; height: 54px; object-fit: cover; border-radius: 14px; background: #fff; }
.brand-monogram { flex: 0 0 auto; width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.35); border-radius: 15px; color: #fff; background: linear-gradient(145deg, var(--turquoise), var(--navy-2)); font-size: 1.35rem; font-weight: 900; }
.brand-monogram.large { width: 66px; height: 66px; border-radius: 18px; font-size: 1.65rem; }
.brand strong { display: block; letter-spacing: .07em; font-size: .95rem; }
.brand span { color: #9fb0d0; font-size: .75rem; }
.nav-title { padding: 0 12px 10px; color: #7890b8; font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; gap: 11px; padding: 12px 14px; margin-bottom: 5px; border-radius: 12px; color: #cad4e6; font-weight: 650; }
.nav-link:hover, .nav-link.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: rgba(255,255,255,.08); font-size: .78rem; }
.sidebar-user { margin-top: auto; padding: 14px; border-radius: 15px; background: rgba(255,255,255,.08); }
.sidebar-user strong, .sidebar-user span { display: block; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user span { margin-top: 3px; color: #9fb0d0; font-size: .78rem; }
.logout { border: 0; padding: 9px 0 0; color: #fff; background: none; cursor: pointer; font-weight: 700; }

.main { min-width: 0; }
.topbar { height: 78px; padding: 0 34px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.86); backdrop-filter: blur(16px); }
.topbar h1 { margin: 0; font-size: 1.1rem; }
.topbar p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.content { padding: 30px 34px 56px; max-width: 1500px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h2 { margin: 0 0 7px; font-size: clamp(1.45rem, 2.5vw, 2rem); letter-spacing: -.035em; }
.page-head p { margin: 0; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 10px 16px; border: 1px solid transparent; border-radius: 12px; cursor: pointer; font-weight: 750; }
.btn-primary { color: #fff; background: linear-gradient(135deg, var(--navy-2), var(--navy)); box-shadow: 0 8px 20px rgba(7,26,61,.16); }
.btn-secondary { color: var(--navy); border-color: var(--line); background: #fff; }
.btn-accent { color: #05233b; background: #c8f4f7; }
.btn-danger { color: var(--danger); border-color: #f3cbd1; background: #fff7f8; }
.btn-small { min-height: 34px; padding: 7px 11px; font-size: .82rem; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; margin-bottom: 24px; }
.stat, .card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 7px 28px rgba(20,36,68,.045); }
.stat { padding: 20px; }
.stat-top { display: flex; justify-content: space-between; gap: 14px; }
.stat-label { color: var(--muted); font-size: .82rem; font-weight: 700; }
.stat-value { display: block; margin-top: 9px; font-size: 1.9rem; font-weight: 850; letter-spacing: -.04em; }
.stat-badge { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: var(--navy); background: #e8fafb; font-weight: 900; }
.card { padding: 22px; }
.card + .card { margin-top: 18px; }
.card-title { margin: 0 0 4px; font-size: 1.06rem; }
.card-subtitle { margin: 0 0 20px; color: var(--muted); font-size: .86rem; }

.school-reset-zone { margin-top: 24px; padding: 24px; overflow: hidden; border: 1px solid #efc7ce; border-radius: var(--radius); background: linear-gradient(145deg, #fffafa, #fff); box-shadow: 0 8px 28px rgba(151, 41, 60, .06); }
.school-reset-intro { display: flex; align-items: flex-start; gap: 14px; }
.school-reset-icon { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; color: #fff; background: var(--danger); font-size: 1.15rem; font-weight: 950; }
.school-reset-intro small { color: var(--danger); font-size: .67rem; font-weight: 900; letter-spacing: .09em; text-transform: uppercase; }
.school-reset-intro h3 { margin: 5px 0 6px; font-size: 1.1rem; }
.school-reset-intro p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.school-reset-scope { margin: 20px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.school-reset-scope > div { padding: 16px; border: 1px solid #f1d6da; border-radius: 14px; background: #fff8f9; }
.school-reset-scope > div:last-child { border-color: #e2e8ee; background: #fff; }
.school-reset-scope strong { display: block; margin-bottom: 9px; font-size: .75rem; }
.school-reset-scope ul { margin: 0; padding-left: 18px; color: #6f7c8e; font-size: .7rem; line-height: 1.65; }
.school-reset-confirmation { border-top: 1px solid #f0d8dc; }
.school-reset-confirmation > summary { padding: 16px 2px 0; display: flex; align-items: center; justify-content: space-between; color: var(--danger); cursor: pointer; list-style: none; font-size: .76rem; font-weight: 850; }
.school-reset-confirmation > summary::-webkit-details-marker { display: none; }
.school-reset-confirmation > summary b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: #fff0f2; transition: transform .18s; }
.school-reset-confirmation[open] > summary b { transform: rotate(90deg); }
.school-reset-confirmation form { margin-top: 17px; padding-top: 17px; border-top: 1px solid #f3e2e5; }
.school-reset-warning { margin-bottom: 16px; padding: 12px 14px; border-radius: 11px; color: #8f3040; background: #fff0f2; font-size: .7rem; font-weight: 700; line-height: 1.55; }
.school-reset-confirmation code { color: #8f3040; font-size: .68rem; }
.school-reset-acknowledge { display: flex; align-items: flex-start; gap: 9px; color: #5e6b7d; font-size: .7rem; line-height: 1.5; }
.school-reset-acknowledge input { width: 17px; height: 17px; margin-top: 1px; flex: 0 0 auto; }
.school-reset-submit { margin-top: 16px; min-height: 45px; font-weight: 900; }

@media (max-width: 760px) {
    .school-reset-zone { padding: 18px; }
    .school-reset-scope { grid-template-columns: 1fr; }
    .school-reset-confirmation .form-grid { grid-template-columns: 1fr; }
}

.school-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.school-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; transition: transform .2s, box-shadow .2s; }
.school-card:hover { transform: translateY(-3px); box-shadow: 0 14px 36px rgba(20,36,68,.1); }
.school-cover { height: 8px; background: linear-gradient(90deg, var(--school-primary), var(--school-secondary), var(--school-accent)); }
.school-body { padding: 20px; }
.school-app-icon { width: 54px; height: 54px; border-radius: 15px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--school-primary), var(--school-secondary)); font-size: 1.2rem; font-weight: 900; }
.school-title { margin: 15px 0 4px; font-size: 1.05rem; }
.school-meta { color: var(--muted); font-size: .82rem; }
.school-counts { display: flex; gap: 18px; margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.school-counts strong { color: var(--ink); font-size: .95rem; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { min-width: 0; }
.field-full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 7px; color: #3b465b; font-size: .8rem; font-weight: 750; }
.field input, .field select, .field textarea {
    width: 100%;
    padding: 0 13px;
    color: var(--ink);
    border: 1px solid #dce3ed;
    border-radius: 11px;
    outline: none;
    background: #fff;
}
.field input, .field select { height: 44px; }
.field textarea { min-height: 100px; padding-top: 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--turquoise); box-shadow: 0 0 0 3px rgba(19,185,197,.12); }
.field input[type="color"] { padding: 4px; }
.hint { display: block; margin-top: 6px; color: var(--muted); font-size: .74rem; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 13px; color: var(--muted); background: #f8fafc; font-size: .75rem; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
td { padding: 13px; border-top: 1px solid var(--line); font-size: .86rem; }
.pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; color: #13684e; background: #e4f7f0; font-size: .72rem; font-weight: 800; }
.pill-draft { color: #805600; background: #fff1c6; }

.alert { margin-bottom: 18px; padding: 14px 16px; border-radius: 13px; font-size: .88rem; }
.alert-success { color: #0b684b; border: 1px solid #bce8d9; background: #e9faf4; }
.alert-error { color: #9b2f3d; border: 1px solid #f0c2c9; background: #fff0f2; }
.alert ul { margin: 0; padding-left: 18px; }
.empty { padding: 38px; color: var(--muted); text-align: center; border: 1px dashed #ccd5e2; border-radius: 15px; background: #fbfcfe; }
.compact-head { margin-top: 8px; margin-bottom: 16px; }
.compact-head h2 { font-size: 1.25rem; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.module-card { min-width: 0; padding: 17px; display: flex; align-items: center; gap: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: 0 6px 22px rgba(20,36,68,.035); transition: transform .18s, border-color .18s, box-shadow .18s; }
.module-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--turquoise) 45%, var(--line)); box-shadow: 0 12px 28px rgba(20,36,68,.08); }
.module-icon { flex: 0 0 auto; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; color: var(--navy); background: color-mix(in srgb, var(--turquoise) 15%, white); font-size: .72rem; font-weight: 900; letter-spacing: .03em; }
.module-card strong, .module-card p { display: block; margin: 0; }
.module-card strong { font-size: .9rem; }
.module-card p { margin-top: 5px; color: var(--muted); font-size: .76rem; }
.instance-card { display: flex; align-items: center; justify-content: space-between; gap: 24px; color: #fff; border: 0; background: radial-gradient(circle at 85% 20%, var(--turquoise), transparent 28%), linear-gradient(140deg, var(--navy), #07152f); }
.instance-card h3 { margin: 14px 0 5px; }
.instance-card p { margin: 0; color: rgba(255,255,255,.66); font-size: .82rem; }
.instance-meta { display: grid; grid-template-columns: auto auto; gap: 5px 14px; min-width: 200px; }
.instance-meta span { color: rgba(255,255,255,.6); font-size: .72rem; }
.instance-meta strong { font-size: .82rem; }
.search-bar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 17px; }
.search-bar input { flex: 1; min-width: 190px; height: 42px; padding: 0 13px; border: 1px solid #dce3ed; border-radius: 11px; }
.search-bar select { min-width: 230px; height: 42px; padding: 0 36px 0 13px; border: 1px solid #dce3ed; border-radius: 11px; background: #fff; color: var(--navy); }
.import-drop { padding: 24px; border: 1px dashed #a7cbd2; border-radius: 15px; background: #f4fcfd; }
.import-drop input { margin: 13px 0; max-width: 100%; }
.code { padding: 4px 7px; border-radius: 7px; color: #174166; background: #edf4fa; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .77rem; }
.filter-bar { display: flex; align-items: end; gap: 14px; }
.filter-bar .field { min-width: 220px; }
.status-select { min-width: 130px; height: 36px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.score-input { width: 110px; height: 38px; padding: 0 10px; border: 1px solid #dce3ed; border-radius: 9px; }
.assessment-summary { margin-top: 22px; padding: 18px; display: grid; grid-template-columns: 1fr auto; border-radius: 14px; background: #f4fbfc; }
.assessment-summary strong, .assessment-summary span { display: block; }
.assessment-summary span { margin-top: 5px; color: var(--muted); font-size: .78rem; }
.assessment-summary b { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 1.3rem; }
.feed-item { padding: 16px 0; border-top: 1px solid var(--line); }
.feed-item:first-of-type { border-top: 0; }
.feed-item h4 { margin: 10px 0 5px; }
.feed-item p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.feed-item small { display: block; margin-top: 9px; color: #93a0b3; }
.finance-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.finance-stats .stat-value { font-size: 1.35rem; }
.stat-income { color: var(--success); }
.stat-expense, .expense-amount { color: var(--danger); }
.finance-net { color: #fff; border-color: transparent; background: linear-gradient(145deg, #137255, #0b5640); }
.finance-net .stat-label, .finance-net small { color: rgba(255,255,255,.75); }
.finance-net small { display: block; margin-top: 8px; font-size: .7rem; }
.finance-net-negative { background: linear-gradient(145deg, #bd4352, #8f2735); }
.finance-entry-grid { margin-bottom: 18px; }
.expense-card { border-top: 4px solid var(--amber); }
.pill-expense { color: #8a3a45; background: #fff0f2; }
.table-note { display: block; margin-top: 4px; color: var(--muted); }
.finance-form { grid-template-columns: 1.2fr 1.2fr .7fr .8fr; }
.payment-form { display: flex; gap: 5px; min-width: 390px; }
.payment-form input, .payment-form select { width: 100px; height: 34px; padding: 0 7px; border: 1px solid var(--line); border-radius: 8px; }
.receipt-links { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; }
.subsection { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.access-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }
.access-counts span { padding: 18px; border-radius: 14px; color: var(--muted); background: #f7f9fc; text-align: center; font-size: .8rem; }
.access-counts b { display: block; margin-bottom: 4px; color: var(--ink); font-size: 1.5rem; }
.account-password-reset summary { color: var(--navy); cursor: pointer; font-size: .76rem; font-weight: 800; }
.account-password-reset form { min-width: 210px; margin-top: 9px; display: grid; gap: 7px; }
.account-password-reset input { width: 100%; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; }
.account-password-card { max-width: 620px; }
.login-help { margin-top: 20px; padding: 14px; border-radius: 12px; color: var(--muted); background: #f5f8fb; font-size: .78rem; line-height: 1.5; }
.sidebar-account-link { color: rgba(255,255,255,.62); font-size: .64rem; text-decoration: underline; text-underline-offset: 2px; }

.payroll-period-input { height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; color: var(--navy); background: #fff; font: inherit; font-weight: 750; }
.payroll-flow { margin-bottom: 22px; padding: 16px 20px; display: flex; align-items: center; justify-content: center; gap: 14px; border: 1px solid #dfe8ef; border-radius: 16px; background: #f8fbfd; }
.payroll-flow > div { display: flex; align-items: center; gap: 9px; }
.payroll-flow > div > b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--navy); font-size: .72rem; }
.payroll-flow span, .payroll-flow strong, .payroll-flow small { display: block; }
.payroll-flow strong { font-size: .75rem; }
.payroll-flow small { margin-top: 2px; color: var(--muted); font-size: .62rem; }
.payroll-flow > i { color: #9aabb9; font-style: normal; }
.payroll-stats { margin-bottom: 22px; }
.payroll-row { padding: 18px 0; display: grid; grid-template-columns: 1.25fr .8fr .65fr 1.35fr; align-items: center; gap: 18px; border-top: 1px solid var(--line); }
.payroll-row:first-of-type { border-top: 0; }
.payroll-teacher { display: flex; align-items: center; gap: 11px; }
.payroll-avatar { width: 39px; height: 39px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 12px; color: var(--navy); background: #e7f3f5; font-size: .72rem; font-weight: 900; }
.payroll-teacher strong, .payroll-teacher small, .payroll-contract span, .payroll-contract small, .payroll-amount small { display: block; }
.payroll-teacher small, .payroll-contract small, .payroll-amount small, .payroll-actions > small { margin-top: 4px; color: var(--muted); font-size: .68rem; }
.payroll-contract span { font-size: .78rem; font-weight: 750; }
.payroll-amount strong { display: block; margin: 4px 0 6px; color: var(--navy); font-size: 1rem; }
.payroll-status { display: inline-block; padding: 4px 7px; border-radius: 7px; font-size: .62rem; font-weight: 850; }
.payroll-status-draft { color: #6e7580; background: #eef1f4; }
.payroll-status-declared { color: #805b05; background: #fff1c6; }
.payroll-status-approved { color: #245b87; background: #e7f2fc; }
.payroll-status-paid { color: #087256; background: #e4f7f0; }
.payroll-actions { display: grid; gap: 8px; }
.payroll-edit-form, .payroll-pay-form { display: flex; align-items: end; flex-wrap: wrap; gap: 7px; }
.payroll-edit-form label { color: var(--muted); font-size: .6rem; font-weight: 750; }
.payroll-edit-form input, .payroll-pay-form input, .payroll-pay-form select { width: 115px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: .7rem; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.row-actions form { margin: 0; }

.portal-hero { margin-bottom: 18px; padding: 28px 30px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-radius: 22px; color: #fff; background: radial-gradient(circle at 80% 10%, rgba(30,203,198,.25), transparent 34%), linear-gradient(135deg, var(--navy), #102943); box-shadow: 0 20px 45px rgba(18,42,69,.16); }
.portal-hero h2 { margin: 7px 0 9px; font-size: clamp(1.65rem, 3vw, 2.5rem); line-height: 1.08; }
.portal-hero p { margin: 0; max-width: 650px; color: rgba(255,255,255,.72); }
.portal-person { min-width: 260px; padding: 15px; display: flex; align-items: center; gap: 12px; border: 1px solid rgba(255,255,255,.16); border-radius: 16px; background: rgba(255,255,255,.08); backdrop-filter: blur(10px); }
.portal-person > span { width: 44px; height: 44px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 13px; color: var(--navy); background: #fff; font-size: .75rem; font-weight: 900; }
.portal-person small, .portal-person strong, .portal-person em { display: block; }
.portal-person small { color: rgba(255,255,255,.58); font-size: .6rem; text-transform: uppercase; letter-spacing: .07em; }
.portal-person strong { margin-top: 3px; font-size: .82rem; }
.portal-person em { margin-top: 3px; color: rgba(255,255,255,.7); font-size: .68rem; font-style: normal; }
.portal-selector { margin-bottom: 18px; padding: 12px 16px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.portal-selector label { color: var(--muted); font-size: .72rem; font-weight: 800; }
.portal-selector select { min-width: 260px; height: 38px; padding: 0 34px 0 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--navy); }
.portal-metrics { margin-bottom: 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.portal-metrics article { padding: 17px; display: flex; align-items: center; gap: 12px; border: 1px solid #e4eaf0; border-radius: 16px; background: #fff; box-shadow: 0 10px 25px rgba(32,56,80,.05); }
.portal-metrics article > span { width: 36px; height: 36px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 11px; color: #087256; background: #e6f7f2; font-size: .64rem; font-weight: 900; }
.portal-metrics small, .portal-metrics strong { display: block; }
.portal-metrics small { color: var(--muted); font-size: .66rem; }
.portal-metrics strong { margin-top: 4px; font-size: 1.1rem; }
.portal-metrics .portal-metric-alert > span { color: #a34a13; background: #fff0df; }
.portal-schedule-card { margin-bottom: 20px; overflow: hidden; }
.portal-week { display: grid; grid-template-columns: repeat(6, minmax(145px, 1fr)); gap: 9px; overflow-x: auto; }
.portal-day { min-width: 145px; overflow: hidden; border: 1px solid #e4e9ee; border-radius: 14px; background: #fafcfd; }
.portal-day > header { padding: 11px; border-bottom: 1px solid #e8edf1; }
.portal-day > header span { color: var(--turquoise); font-size: .56rem; font-weight: 900; letter-spacing: .08em; }
.portal-day > header strong, .portal-day > header small { display: block; }
.portal-day > header strong { margin-top: 3px; font-size: .78rem; }
.portal-day > header small { margin-top: 3px; color: var(--muted); font-size: .57rem; }
.portal-day > div { padding: 7px; display: grid; gap: 7px; }
.portal-day-today { border-color: color-mix(in srgb, var(--turquoise) 55%, white); background: #f4ffff; box-shadow: inset 0 3px 0 var(--turquoise); }
.portal-session { position: relative; padding: 10px; overflow: hidden; border: 1px solid #e5eaf0; border-radius: 11px; background: #fff; }
.portal-session time { display: block; color: #147d78; font-size: .62rem; font-weight: 900; }
.portal-session time i { margin: 0 3px; color: #9aa7b4; font-style: normal; }
.portal-session strong, .portal-session span, .portal-session small { display: block; }
.portal-session strong { margin-top: 7px; font-size: .7rem; line-height: 1.25; }
.portal-session span { margin-top: 4px; color: #38556f; font-size: .62rem; font-weight: 750; }
.portal-session small { margin-top: 3px; color: var(--muted); font-size: .57rem; }
.portal-session em { position: absolute; top: 8px; right: 8px; padding: 3px 5px; border-radius: 5px; color: #805b05; background: #fff1c6; font-size: .5rem; font-style: normal; }
.portal-day-empty { padding: 18px 4px; color: #adb6c0; text-align: center; font-size: .62rem; }
.portal-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.portal-attendance { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.portal-attendance div { padding: 14px 8px; border-radius: 12px; background: #f5f8fa; text-align: center; }
.portal-attendance strong, .portal-attendance span { display: block; }
.portal-attendance strong { font-size: 1.25rem; }
.portal-attendance span { margin-top: 4px; color: var(--muted); font-size: .61rem; }
.portal-grade-list, .portal-homework-list, .portal-news-list { margin-top: 13px; display: grid; gap: 8px; }
.portal-grade-list > div, .portal-homework-list > div, .portal-news-list > div, .portal-route-grid article { padding: 10px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line); }
.portal-grade-list span strong, .portal-grade-list span small, .portal-homework-list span strong, .portal-homework-list span small, .portal-news-list strong, .portal-news-list small, .portal-route-grid strong, .portal-route-grid small { display: block; }
.portal-grade-list span small, .portal-homework-list span small, .portal-news-list small, .portal-route-grid small { margin-top: 3px; color: var(--muted); font-size: .62rem; line-height: 1.35; }
.portal-grade-list b { color: var(--navy); font-size: .75rem; white-space: nowrap; }
.portal-homework-list time { width: 38px; height: 38px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 10px; color: #805b05; background: #fff1c6; font-size: .65rem; font-weight: 900; }
.portal-homework-list > div { justify-content: flex-start; }
.portal-news-list > div { justify-content: flex-start; }
.portal-news-list > div > span, .portal-route-grid article > span { width: 32px; height: 32px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 9px; color: var(--navy); background: #eaf2f8; font-size: .57rem; font-weight: 900; }
.portal-news-list .portal-news-notification > span { color: #fff; background: var(--danger); }
.portal-route-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.portal-route-grid article { padding: 14px; justify-content: flex-start; border: 1px solid var(--line); border-radius: 13px; }
.schedule-admin-pill { margin: 2px; padding: 5px 6px 5px 9px; display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; color: var(--navy); background: #eef3f8; font-size: .63rem; }
.schedule-admin-pill form { display: inline-flex; }
.schedule-admin-pill button { width: 20px; height: 20px; display: grid; place-items: center; border: 0; border-radius: 50%; color: var(--danger); background: #fff; cursor: pointer; font-weight: 900; }
.route-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.route-card { margin: 0 !important; }
.route-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.route-head h3 { margin: 10px 0 4px; }
.route-head p { margin: 0; color: var(--muted); font-size: .78rem; }
.route-head > b { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; color: var(--navy); background: color-mix(in srgb, var(--turquoise) 15%, white); }
.student-chips { min-height: 50px; margin: 18px 0; display: flex; flex-wrap: wrap; gap: 7px; }
.student-chips span { padding: 7px 9px; border-radius: 9px; color: #41506a; background: #f0f4f8; font-size: .72rem; }
.student-chips em { color: var(--muted); font-size: .8rem; }
.student-finance-stats .stat-value { font-size: 1.35rem; }
.student-payment-status { font-size: 1.1rem !important; }
.student-file-grid { align-items: stretch; }
.student-file-grid > .card { margin: 0; }
.billing-profile-card { border-top: 4px solid var(--turquoise); }
.billing-section-label { margin-top: 18px; padding: 12px 0 8px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; border-bottom: 2px solid color-mix(in srgb, var(--turquoise) 28%, white); }
.billing-section-label span { color: var(--navy); font-size: .82rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.billing-section-label small { color: var(--muted); font-size: .7rem; }
.billing-section-label-once { margin-top: 30px; border-bottom-color: color-mix(in srgb, var(--accent) 38%, white); }
.billing-section-label-once span { color: #8a5a00; }
.billing-line { min-height: 78px; padding: 15px 0; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.billing-line-main { padding-top: 4px; }
.billing-line strong, .billing-line span, .billing-check small { display: block; }
.billing-line > div > span, .billing-check small { margin-top: 4px; color: var(--muted); font-size: .74rem; }
.billing-check { display: flex !important; align-items: center; gap: 11px; }
.billing-check input, .billing-active input { width: 19px; height: 19px; accent-color: var(--turquoise); }
.billing-amount { display: flex !important; align-items: center; gap: 7px; }
.billing-amount input { width: 108px; height: 36px; padding: 0 9px; text-align: right; border: 1px solid #dce3ed; border-radius: 9px; }
.billing-amount b { color: var(--muted); font-size: .76rem; }

/* Keep compact money fields clean: browsers otherwise stack native number arrows. */
.billing-profile-card input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
}
.billing-profile-card input[type="number"]::-webkit-inner-spin-button,
.billing-profile-card input[type="number"]::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}
.billing-total { margin-top: 18px; padding: 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-radius: 14px; color: #fff; background: linear-gradient(135deg, var(--navy-2), var(--navy)); }
.billing-total span { color: rgba(255,255,255,.7); font-size: .78rem; }
.billing-total strong { font-size: 1.35rem; }
.billing-total-once { background: linear-gradient(135deg, #8f5f05, #c68912); }
.billing-active { margin-top: 20px; padding: 15px; display: flex; align-items: flex-start; gap: 11px; border-radius: 13px; background: #f2fbfc; }
.billing-active strong, .billing-active small { display: block; }
.billing-active small { margin-top: 4px; color: var(--muted); font-size: .74rem; }
.parent-access-note p { color: var(--muted); font-size: .8rem; line-height: 1.5; }
.student-save-bar { position: sticky; z-index: 5; bottom: 14px; margin: 18px 0; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.94); box-shadow: 0 14px 36px rgba(20,36,68,.12); backdrop-filter: blur(12px); }
.student-save-bar span { color: var(--muted); font-size: .8rem; }

.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; }
.login-visual { position: relative; overflow: hidden; padding: 58px; color: #fff; background:
    radial-gradient(circle at 80% 10%, rgba(19,185,197,.5), transparent 28%),
    radial-gradient(circle at 12% 85%, rgba(246,168,0,.25), transparent 22%),
    linear-gradient(145deg, #061737, #0d2e61); }
.login-visual::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 430px; height: 430px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; box-shadow: 0 0 0 58px rgba(255,255,255,.035), 0 0 0 118px rgba(255,255,255,.025); }
.login-brand { display: flex; align-items: center; gap: 14px; }
.login-brand img { width: 66px; height: 66px; border-radius: 17px; object-fit: cover; background: #fff; }
.login-brand strong { display: block; letter-spacing: .08em; }
.login-brand span { color: #aac0df; font-size: .82rem; }
.login-copy { position: relative; z-index: 1; max-width: 620px; margin-top: 18vh; }
.login-copy h1 { margin: 0 0 20px; font-size: clamp(2.5rem, 5vw, 4.5rem); line-height: .98; letter-spacing: -.055em; }
.login-copy p { max-width: 520px; color: #c1cde0; font-size: 1.04rem; line-height: 1.7; }
.login-panel { display: grid; place-items: center; padding: 36px; }
.login-box { width: min(430px, 100%); }
.login-box h2 { margin: 0 0 8px; font-size: 2rem; letter-spacing: -.04em; }
.login-box > p { margin: 0 0 28px; color: var(--muted); }
.login-box .field { margin-bottom: 16px; }
.login-box .btn { width: 100%; margin-top: 8px; min-height: 48px; }
.demo-access { margin-top: 24px; padding: 14px; border: 1px solid #d9e5f0; border-radius: 12px; color: #56657d; background: #f8fbfe; font-size: .78rem; line-height: 1.6; }
.mobile-title { display: none; }

/* Executive workspace */
body { background: #f2f4f7; }
.app-shell { grid-template-columns: 286px minmax(0, 1fr); }
.sidebar { padding: 20px 16px 16px; overflow: hidden; background: radial-gradient(circle at 18% 0, color-mix(in srgb, var(--ui-accent) 22%, transparent), transparent 23%), linear-gradient(180deg, #0b1b35 0%, #071326 100%); }
.brand { min-height: 68px; padding: 0 7px 17px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img, .brand-monogram { width: 46px; height: 46px; border-radius: 13px; }
.brand strong { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; letter-spacing: .025em; }
.brand span { margin-top: 3px; font-size: .66rem; }
.sidebar-nav { min-height: 0; flex: 1; margin: 15px -4px 12px 0; padding-right: 7px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.14) transparent; }
.nav-group + .nav-group { margin-top: 17px; }
.nav-title { padding: 0 10px 7px; color: #687e9f; font-size: .62rem; letter-spacing: .14em; }
.nav-link { min-height: 41px; margin-bottom: 3px; padding: 7px 10px; border: 1px solid transparent; border-radius: 11px; color: #9fb0ca; font-size: .78rem; font-weight: 650; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-link.active { color: #fff; border-color: rgba(255,255,255,.09); background: linear-gradient(90deg, color-mix(in srgb, var(--ui-accent) 28%, transparent), rgba(255,255,255,.055)); box-shadow: inset 3px 0 0 var(--ui-accent); }
.nav-icon { width: 28px; height: 28px; border-radius: 8px; color: #cfe9ec; background: rgba(255,255,255,.07); font-size: .59rem; letter-spacing: .04em; }
.nav-link.active .nav-icon { color: #05233b; background: #b8f1f3; }
.sidebar-user { padding: 11px; display: grid; grid-template-columns: 36px minmax(0, 1fr) 25px; align-items: center; gap: 9px; border: 1px solid rgba(255,255,255,.08); border-radius: 13px; background: rgba(255,255,255,.045); }
.sidebar-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: #082039; background: linear-gradient(145deg, #d7fbfc, var(--ui-accent)); font-size: .78rem; font-weight: 900; }
.sidebar-user-copy { min-width: 0; }
.sidebar-user-copy strong { color: #fff; font-size: .72rem; }
.sidebar-user-copy span { color: #8195b2; font-size: .62rem; }
.sidebar-user form { margin: 0; }
.logout { width: 25px; height: 25px; padding: 0; display: grid; place-items: center; border-radius: 7px; color: #93a5be; background: rgba(255,255,255,.06); }
.topbar { height: 74px; padding: 0 30px; border: 0; border-bottom: 1px solid #e7eaf0; background: rgba(255,255,255,.9); }
.topbar h1 { font-size: 1rem; }
.topbar p { font-size: .7rem; }
.topbar-tools { display: flex; align-items: center; gap: 9px; }
.today-chip { padding: 7px 10px; border: 1px solid #e4e8ee; border-radius: 9px; color: #66748a; background: #fff; font-size: .7rem; font-weight: 700; text-transform: capitalize; }
.content { max-width: 1580px; padding: 26px 30px 58px; }

.dashboard-hero { position: relative; isolation: isolate; min-height: 270px; overflow: hidden; padding: 35px 40px; display: grid; grid-template-columns: minmax(0, 1fr) 235px; align-items: center; gap: 35px; border-radius: 26px; color: #fff; background: radial-gradient(circle at 84% 22%, color-mix(in srgb, var(--ui-accent) 72%, transparent), transparent 25%), linear-gradient(130deg, #102b55 0%, #07182f 72%); box-shadow: 0 24px 50px rgba(7,24,47,.18); }
.dashboard-hero::after { content: ""; position: absolute; z-index: -1; width: 330px; height: 330px; right: -110px; bottom: -230px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; box-shadow: 0 0 0 46px rgba(255,255,255,.03), 0 0 0 92px rgba(255,255,255,.02); }
.dashboard-eyebrow { display: inline-flex; padding: 6px 10px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: #b7e9ed; background: rgba(255,255,255,.06); font-size: .64rem; font-weight: 850; letter-spacing: .13em; text-transform: uppercase; }
.dashboard-hero h2 { margin: 17px 0 10px; max-width: 720px; font-size: clamp(2rem, 3.4vw, 3.35rem); line-height: 1.03; letter-spacing: -.055em; }
.dashboard-hero p { margin: 0; color: #aebbd0; font-size: .85rem; }
.dashboard-hero-actions { margin-top: 25px; display: flex; align-items: center; gap: 17px; }
.dashboard-primary-action { min-height: 42px; padding: 10px 14px; display: inline-flex; align-items: center; gap: 18px; border-radius: 11px; color: #092039; background: #fff; font-size: .75rem; font-weight: 850; }
.dashboard-primary-action b { color: var(--ui-accent); font-size: 1.1rem; }
.dashboard-hero-actions > span { color: #8597b3; font-size: .65rem; }
.hero-progress { display: grid; justify-items: center; gap: 10px; }
.progress-ring { width: 148px; aspect-ratio: 1; padding: 11px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#b9f5f5 calc(var(--progress) * 1%), rgba(255,255,255,.12) 0); box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.progress-ring > div { width: 100%; height: 100%; display: grid; place-content: center; border-radius: 50%; background: #0c2447; text-align: center; }
.progress-ring strong, .progress-ring span { display: block; }
.progress-ring strong { font-size: 1.85rem; letter-spacing: -.04em; }
.progress-ring span { margin-top: 2px; color: #99abc5; font-size: .62rem; text-transform: uppercase; letter-spacing: .09em; }
.hero-progress small { color: #a8b7cd; font-size: .65rem; }

.dashboard-period-card { margin-top: 20px; padding: 18px 20px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.dashboard-period-card > div { min-width: 230px; }
.dashboard-period-card > div > span { color: var(--turquoise); font-size: .61rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.dashboard-period-card h3 { margin: 5px 0 0; font-size: 1rem; }
.dashboard-period-card p { max-width: 620px; margin: 6px 0 0; color: #8490a1; font-size: .65rem; line-height: 1.5; }
.dashboard-period-filter { min-width: 520px; display: grid; grid-template-columns: 130px minmax(155px, 1fr) auto; align-items: end; gap: 9px; }
.dashboard-period-filter .field { margin: 0; }
.dashboard-period-filter label { font-size: .61rem; }
.dashboard-period-filter input,
.dashboard-period-filter select { min-height: 40px; }
.dashboard-period-filter .btn { min-height: 40px; white-space: nowrap; }

.executive-metrics { margin: 20px 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.executive-metric { min-width: 0; min-height: 126px; padding: 17px; display: flex; align-items: flex-start; gap: 12px; border: 1px solid #e4e8ee; border-radius: 18px; background: #fff; box-shadow: 0 7px 22px rgba(22,36,61,.035); }
.metric-symbol { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #27425f; background: #eef3f8; font-size: .57rem; font-weight: 900; }
.executive-metric > div { min-width: 0; }
.executive-metric small, .executive-metric strong, .executive-metric em { display: block; }
.executive-metric small { color: #7a8799; font-size: .66rem; font-weight: 750; }
.executive-metric strong { margin-top: 7px; overflow: hidden; color: #18253a; font-size: clamp(1.15rem, 1.8vw, 1.6rem); letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.executive-metric strong i { color: #8b97a8; font-size: .65rem; font-style: normal; }
.executive-metric em { margin-top: 5px; overflow: hidden; color: #9aa5b4; font-size: .58rem; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.metric-income .metric-symbol { color: #087054; background: #dcf7ed; }
.metric-expense .metric-symbol { color: #a63848; background: #ffeaed; }
.metric-salary .metric-symbol { color: #80600b; background: #fff3ce; }
.metric-net { color: #fff; border-color: transparent; background: linear-gradient(145deg, #12634d, #0d4c3c); }
.metric-net small, .metric-net strong, .metric-net em, .metric-net strong i { color: #fff; }
.metric-net em { opacity: .65; }
.metric-net .metric-symbol { color: #fff; background: rgba(255,255,255,.13); }
.metric-net-negative { background: linear-gradient(145deg, #a63a4a, #7f2937); }

.dashboard-analysis-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .7fr); gap: 16px; margin-bottom: 16px; }
.dashboard-card { padding: 22px; border: 1px solid #e2e7ed; border-radius: 21px; background: #fff; box-shadow: 0 9px 28px rgba(22,36,61,.04); }
.dashboard-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dashboard-card-head span, .dashboard-card-head h3 { display: block; margin: 0; }
.dashboard-card-head span { color: #8a96a7; font-size: .62rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.dashboard-card-head h3 { margin-top: 5px; font-size: 1.05rem; letter-spacing: -.025em; }
.dashboard-card-head > a { color: #48647e; font-size: .67rem; font-weight: 800; }
.chart-legend { display: flex; gap: 13px; }
.chart-legend span { display: flex; align-items: center; gap: 5px; color: #7b8798; font-size: .6rem; font-weight: 650; letter-spacing: 0; text-transform: none; }
.chart-legend i { width: 7px; height: 7px; display: block; border-radius: 3px; }
.legend-income { background: var(--ui-accent); }
.legend-expense { background: #f0b429; }
.cashflow-chart { height: 200px; margin: 22px 4px 0; padding: 0 8px; display: grid; grid-template-columns: repeat(6, 1fr); align-items: stretch; gap: 14px; border-bottom: 1px solid #e7ebf0; background: repeating-linear-gradient(to bottom, transparent, transparent 49px, #f0f2f5 50px); }
.cashflow-month { min-width: 0; display: grid; grid-template-rows: 1fr 24px; align-items: end; }
.cashflow-bars { height: 170px; display: flex; align-items: flex-end; justify-content: center; gap: 5px; }
.cashflow-bars i { width: min(18px, 35%); min-height: 5px; border-radius: 5px 5px 1px 1px; transition: height .3s; }
.cashflow-income { background: linear-gradient(180deg, #5ad2d8, var(--ui-accent)); }
.cashflow-expense { background: linear-gradient(180deg, #ffd66d, #e9a919); }
.cashflow-month > span { color: #8b97a7; font-size: .62rem; text-align: center; text-transform: capitalize; }
.cashflow-summary { margin-top: 17px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.cashflow-summary span, .cashflow-summary strong { display: block; }
.cashflow-summary span { color: #8c98a8; font-size: .6rem; }
.cashflow-summary strong { margin-top: 3px; font-size: .9rem; }
.cashflow-summary a, .dashboard-inline-link { color: #2e5a78; font-size: .66rem; font-weight: 850; }
.school-today-card .dashboard-card-head > b { padding: 8px 9px; border-radius: 10px; color: #087054; background: #e1f7ef; font-size: .85rem; }
.today-progress { height: 8px; margin: 24px 0 18px; overflow: hidden; border-radius: 999px; background: #edf1f5; }
.today-progress i { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, var(--ui-accent), #69d8dd); }
.today-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.today-metrics div { padding: 13px; border-radius: 13px; background: #f5f7f9; }
.today-metrics strong, .today-metrics span { display: block; }
.today-metrics strong { font-size: 1.1rem; }
.today-metrics span { margin-top: 3px; color: #8490a1; font-size: .59rem; }
.dashboard-inline-link { display: inline-block; margin-top: 20px; }
.operational-today-card { margin-top: 16px; }

.payment-status-card { margin-top: 16px; }
.payment-status-columns { margin-top: 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.payment-column { min-width: 0; }
.payment-column + .payment-column { padding-left: 22px; border-left: 1px solid #e6eaf0; }
.payment-column-title { margin-bottom: 5px; padding-bottom: 11px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #edf0f4; }
.payment-column-title span { display: flex; align-items: center; gap: 7px; font-size: .7rem; font-weight: 850; }
.payment-column-title i { width: 8px; height: 8px; display: block; border-radius: 50%; background: #28a77d; }
.payment-column-due .payment-column-title i { background: #df596a; }
.payment-column-title > b { min-width: 28px; height: 25px; display: grid; place-items: center; border-radius: 8px; color: #667488; background: #f0f3f6; font-size: .68rem; }
.payment-person { min-width: 0; padding: 10px 0; display: grid; grid-template-columns: 33px minmax(0, 1fr) auto; align-items: center; gap: 9px; border-bottom: 1px solid #f0f2f5; }
.person-avatar { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; color: #244361; background: #eaf2f8; font-size: .62rem; font-weight: 900; }
.payment-person div { min-width: 0; }
.payment-person strong, .payment-person small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payment-person strong { font-size: .7rem; }
.payment-person small { margin-top: 3px; color: #8d99a9; font-size: .58rem; }
.payment-person > b { color: #15805d; font-size: .65rem; }
.payment-column-due .payment-person > b { color: #c33e50; }
.dashboard-empty { padding: 24px 10px; color: #8e9aaa; font-size: .68rem; text-align: center; }
.dashboard-empty-success { color: #15805d; }

.install-page { min-height: 100vh; display: grid; grid-template-columns: minmax(330px, .8fr) minmax(560px, 1.2fr); background: #f4f7fb; }
.install-intro { position: sticky; top: 0; height: 100vh; overflow: hidden; padding: 55px; color: #fff; background:
    radial-gradient(circle at 85% 15%, rgba(19,185,197,.48), transparent 27%),
    radial-gradient(circle at 10% 88%, rgba(246,168,0,.22), transparent 24%),
    linear-gradient(150deg, #071a3d, #0e3167); }
.install-intro::after { content: ""; position: absolute; width: 420px; height: 420px; right: -230px; bottom: -180px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 64px rgba(255,255,255,.025), 0 0 0 128px rgba(255,255,255,.018); }
.install-intro img { width: 76px; height: 76px; margin-bottom: 65px; border-radius: 20px; object-fit: cover; background: #fff; }
.install-intro > span { display: block; color: #8bdbe1; font-size: .76rem; font-weight: 850; letter-spacing: .15em; }
.install-intro h1 { max-width: 520px; margin: 16px 0 20px; font-size: clamp(2.4rem, 4vw, 4rem); line-height: 1.02; letter-spacing: -.055em; }
.install-intro > p { max-width: 540px; color: #becbe0; line-height: 1.7; }
.install-points { position: relative; z-index: 1; margin-top: 55px; display: grid; gap: 14px; }
.install-points div { display: flex; align-items: center; gap: 14px; color: #dce4f0; }
.install-points b { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; color: #fff; background: rgba(255,255,255,.1); font-size: .72rem; }
.install-form { padding: 50px clamp(28px, 6vw, 80px) 70px; }
.install-form form { max-width: 820px; margin: 0 auto; }
.install-submit { width: 100%; min-height: 52px; margin-top: 20px; }

@media (max-width: 1050px) {
    .stats, .school-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .finance-net { grid-column: 1 / -1; }
    .grid-2 { grid-template-columns: 1fr; }
    .executive-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-net { grid-column: 1 / -1; }
    .dashboard-analysis-grid { grid-template-columns: 1fr; }
    .dashboard-period-card { align-items: stretch; flex-direction: column; }
    .dashboard-period-filter { width: 100%; min-width: 0; }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { position: static; width: auto; height: auto; padding: 14px 16px; flex-direction: row; align-items: center; gap: 8px; }
    .brand { padding: 0; margin-right: auto; }
    .brand img { width: 42px; height: 42px; }
    .brand span, .nav-title, .sidebar-user, .nav-link span:not(.nav-icon) { display: none; }
    .sidebar { overflow-x: auto; }
    .sidebar-nav, .nav-group { display: flex; align-items: center; }
    .sidebar-nav { flex: 0 0 auto; margin: 0; padding: 0; overflow: visible; }
    .nav-group + .nav-group { margin: 0; }
    .nav-link { margin: 0; padding: 7px; }
    .nav-icon { width: 32px; height: 32px; }
    .topbar { display: none; }
    .content { padding: 22px 16px 42px; }
    .mobile-title { display: block; margin-bottom: 18px; font-weight: 850; }
    .stats, .school-grid, .form-grid, .grid-3 { grid-template-columns: 1fr; }
    .module-grid { grid-template-columns: 1fr; }
    .instance-card { align-items: flex-start; flex-direction: column; }
    .filter-bar { align-items: stretch; flex-direction: column; }
    .filter-bar .field { min-width: 0; }
    .search-bar input, .search-bar select { width: 100%; min-width: 0; }
    .finance-form, .access-counts, .route-grid { grid-template-columns: 1fr; }
    .payroll-flow { align-items: stretch; flex-direction: column; }
    .payroll-flow > i { display: none; }
    .payroll-row { grid-template-columns: 1fr; }
    .portal-hero { align-items: flex-start; flex-direction: column; }
    .portal-person { width: 100%; min-width: 0; }
    .portal-metrics, .portal-detail-grid, .portal-route-grid { grid-template-columns: 1fr; }
    .portal-selector { align-items: stretch; flex-direction: column; }
    .portal-selector select { width: 100%; min-width: 0; }
    .billing-line { align-items: flex-start; flex-direction: column; }
    .billing-section-label { align-items: flex-start; flex-direction: column; gap: 4px; }
    .billing-amount { width: 100%; }
    .billing-amount input { flex: 1; width: auto; }
    .student-save-bar { align-items: stretch; flex-direction: column; }
    .field-full { grid-column: auto; }
    .page-head { flex-direction: column; }
    .dashboard-hero { min-height: 0; padding: 27px 23px; grid-template-columns: 1fr; }
    .dashboard-hero h2 { font-size: 2.15rem; }
    .hero-progress { display: none; }
    .dashboard-hero-actions { align-items: flex-start; flex-direction: column; }
    .dashboard-period-filter { grid-template-columns: 1fr; }
    .dashboard-period-filter .btn { width: 100%; }
    .executive-metrics { grid-template-columns: 1fr; }
    .metric-net { grid-column: auto; }
    .executive-metric { min-height: 105px; }
    .dashboard-card { padding: 18px; }
    .cashflow-chart { height: 170px; gap: 7px; overflow-x: auto; }
    .cashflow-bars { height: 140px; }
    .cashflow-summary { align-items: flex-start; flex-direction: column; }
    .payment-status-columns { grid-template-columns: 1fr; }
    .payment-column + .payment-column { padding: 18px 0 0; border-top: 1px solid #e6eaf0; border-left: 0; }
    .chart-legend { display: none; }
    .login-page { display: block; background: var(--background); }
    .login-visual { min-height: 270px; padding: 30px 24px; }
    .login-copy { margin-top: 55px; }
    .login-copy h1 { font-size: 2.5rem; }
    .login-copy p { display: none; }
    .login-panel { padding: 28px 20px 45px; }
    .install-page { display: block; }
    .install-intro { position: relative; height: auto; padding: 32px 24px 42px; }
    .install-intro img { width: 60px; height: 60px; margin-bottom: 34px; }
    .install-intro h1 { font-size: 2.25rem; }
    .install-points { display: none; }
    .install-form { padding: 30px 16px 50px; }
}

/* Accounting cockpit */
.accounting-page-head { align-items: end; }
.accounting-eyebrow { display: inline-block; margin-bottom: 9px; color: #17838a; font-size: .63rem; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.accounting-summary { margin-bottom: 16px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; }
.accounting-stat { min-width: 0; min-height: 128px; padding: 17px; display: flex; align-items: flex-start; gap: 12px; border: 1px solid #e2e7ed; border-radius: 18px; background: #fff; box-shadow: 0 8px 24px rgba(22,36,61,.035); }
.accounting-stat-icon { flex: 0 0 auto; width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; color: #365069; background: #edf2f6; font-size: .55rem; font-weight: 950; }
.accounting-stat > div { min-width: 0; }
.accounting-stat small, .accounting-stat strong, .accounting-stat em { display: block; }
.accounting-stat small { color: #7c899a; font-size: .64rem; font-weight: 800; }
.accounting-stat strong { margin-top: 8px; overflow: hidden; color: #17263a; font-size: clamp(1.05rem, 1.55vw, 1.4rem); letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.accounting-stat strong i { color: #8491a3; font-size: .62rem; font-style: normal; }
.accounting-stat em { margin-top: 7px; overflow: hidden; color: #9aa5b3; font-size: .57rem; font-style: normal; line-height: 1.35; }
.accounting-stat-income .accounting-stat-icon { color: #087054; background: #dcf7ed; }
.accounting-stat-due .accounting-stat-icon { color: #a63547; background: #ffeaed; }
.accounting-stat-planned .accounting-stat-icon { color: #285e91; background: #e9f3fd; }
.accounting-stat-expense .accounting-stat-icon { color: #8b620d; background: #fff3ce; }
.accounting-stat-net { color: #fff; border-color: transparent; background: linear-gradient(145deg, #12634d, #0d4c3c); }
.accounting-stat-net small, .accounting-stat-net strong, .accounting-stat-net em, .accounting-stat-net strong i { color: #fff; }
.accounting-stat-net em { opacity: .65; }
.accounting-stat-net .accounting-stat-icon { color: #fff; background: rgba(255,255,255,.13); }
.accounting-stat-net-negative { background: linear-gradient(145deg, #a63a4a, #7f2937); }

.finance-workspace-grid { margin-bottom: 16px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr); align-items: start; gap: 16px; }
.finance-action-card { min-height: 0; }
.finance-action-badge { padding: 7px 9px; border-radius: 9px; color: #126d56; background: #e2f7ef; font-size: .59rem; text-transform: uppercase; letter-spacing: .05em; }
.finance-expense-badge { color: #946515; background: #fff3d5; }
.finance-action-copy { margin: 13px 0 18px; color: #8490a1; font-size: .68rem; line-height: 1.5; }
.finance-quick-form, .finance-expense-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.finance-quick-form .btn, .finance-expense-form .btn { min-height: 44px; }
.field label small { color: #97a2b0; font-weight: 600; }
.finance-action-empty { margin-top: 12px; padding: 11px; border-radius: 10px; color: #718094; background: #f3f6f8; font-size: .65rem; text-align: center; }
.finance-more-fields { border: 1px solid #e6eaf0; border-radius: 11px; background: #fafbfc; }
.finance-more-fields summary { padding: 12px 13px; color: #667589; cursor: pointer; font-size: .68rem; font-weight: 800; }
.finance-more-grid { padding: 4px 12px 12px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.student-payment-form { position: relative; }
.student-payment-search { position: relative; z-index: 8; }
.student-payment-search > label, .payment-invoice-field > label { margin-bottom: 8px; display: flex; align-items: center; gap: 7px; color: #35455a; font-size: .7rem; font-weight: 850; }
.student-payment-search > label b, .payment-invoice-field > label b, .student-payment-inputs label > b { width: 21px; height: 21px; display: inline-grid; place-items: center; border-radius: 7px; color: #fff; background: #127c84; font-size: .58rem; }
.student-search-control { height: 47px; display: grid; grid-template-columns: 35px minmax(0, 1fr) 34px; align-items: center; border: 1px solid #d7e0e9; border-radius: 12px; background: #fff; box-shadow: 0 5px 15px rgba(22,36,61,.035); }
.student-search-control:focus-within { border-color: #40b3b9; box-shadow: 0 0 0 3px rgba(19,185,197,.11); }
.student-search-control > span { color: #508198; font-size: 1.25rem; text-align: center; }
.student-search-control input { width: 100%; height: 43px; padding: 0; border: 0; outline: 0; color: #17263a; background: transparent; font-size: .75rem; }
.student-search-control input::-webkit-search-cancel-button { display: none; }
.student-search-control button { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 8px; color: #7e8b9b; background: #eef2f5; cursor: pointer; }
.student-search-results { position: absolute; top: calc(100% + 7px); left: 0; right: 0; max-height: 390px; overflow-y: auto; padding: 6px; border: 1px solid #dfe5eb; border-radius: 13px; background: #fff; box-shadow: 0 20px 45px rgba(13,31,55,.18); }
.student-search-result { width: 100%; min-width: 0; padding: 10px; display: grid; grid-template-columns: 35px minmax(0, 1fr) auto; align-items: center; gap: 9px; border: 0; border-radius: 10px; color: #17263a; background: transparent; cursor: pointer; text-align: left; }
.student-search-result:hover { background: #f1f8f9; }
.student-search-result > span { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 10px; color: #255872; background: #e7f1f6; font-size: .58rem; font-weight: 950; }
.student-search-result > div { min-width: 0; }
.student-search-result strong, .student-search-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.student-search-result strong { font-size: .68rem; }
.student-search-result small { margin-top: 3px; color: #8794a5; font-size: .55rem; }
.student-search-result > b { padding: 5px 7px; border-radius: 7px; font-size: .52rem; white-space: nowrap; }
.student-result-ready { color: #087256; background: #e4f7f0; }
.student-result-missing { color: #9b6810; background: #fff2cf; }
.student-search-no-result { padding: 22px 12px; color: #8c98a7; font-size: .65rem; text-align: center; }

.student-payment-empty { min-height: 205px; margin-top: 14px; padding: 24px; display: grid; place-items: center; align-content: center; gap: 7px; border: 1px dashed #ccd6df; border-radius: 14px; color: #718094; background: #fafbfc; text-align: center; }
.student-payment-empty[hidden], .student-no-pricing[hidden] { display: none; }
.student-payment-empty > span { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: #2d6678; background: #e5f4f5; font-size: .65rem; font-weight: 950; }
.student-payment-empty strong { color: #3a4c61; font-size: .76rem; }
.student-payment-empty small { max-width: 430px; font-size: .62rem; line-height: 1.55; }
.student-payment-panel { margin-top: 14px; }
.selected-student-head { padding: 13px; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid #dce8ea; border-radius: 13px; background: linear-gradient(135deg, #f3fbfb, #f9fbfc); }
.selected-student-head > span { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; color: #174f68; background: #d9eff1; font-size: .64rem; font-weight: 950; }
.selected-student-head > div { min-width: 0; }
.selected-student-head strong, .selected-student-head small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-student-head strong { font-size: .74rem; }
.selected-student-head small { margin-top: 4px; color: #7c8b9c; font-size: .58rem; }
.selected-student-head > a { color: #28708a; font-size: .56rem; font-weight: 850; }
.student-account-summary { margin: 10px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.student-account-summary > div { min-width: 0; padding: 10px; border-radius: 10px; background: #f3f6f8; }
.student-account-summary small, .student-account-summary strong { display: block; }
.student-account-summary small { color: #7f8d9e; font-size: .5rem; }
.student-account-summary strong { margin-top: 4px; overflow: hidden; color: #26394e; font-size: .68rem; text-overflow: ellipsis; white-space: nowrap; }
.student-account-summary .student-account-due { background: #ffedf0; }
.student-account-summary .student-account-due small, .student-account-summary .student-account-due strong { color: #ae3b4c; }
.student-fee-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.student-fee-group { min-width: 0; overflow: hidden; border: 1px solid #e2e7eb; border-radius: 13px; background: #fff; }
.student-fee-group-annual { border-color: #efdca9; background: #fffdf8; }
.student-fee-group-head { padding: 11px 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid #e9edf0; background: #f8fafb; }
.student-fee-group-annual .student-fee-group-head { border-bottom-color: #f1e5c6; background: #fff7e5; }
.student-fee-group-head span, .student-fee-group-head strong { display: block; }
.student-fee-group-head span { color: #8190a1; font-size: .48rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.student-fee-group-annual .student-fee-group-head span { color: #a27218; }
.student-fee-group-head strong { margin-top: 3px; font-size: .67rem; }
.student-fee-group-head > b { color: #1c5965; font-size: .62rem; white-space: nowrap; }
.student-fee-group-annual .student-fee-group-head > b { color: #95660d; }
.student-fee-lines { padding: 7px 11px; }
.student-fee-line { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 9px; border-bottom: 1px solid #eef1f3; }
.student-fee-line:last-child { border-bottom: 0; }
.student-fee-line > span { min-width: 0; display: flex; align-items: center; gap: 6px; font-size: .57rem; }
.student-fee-line > span i { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 5px; color: #087256; background: #e2f6ef; font-size: .48rem; font-style: normal; font-weight: 950; }
.student-fee-line > b { color: #35495f; font-size: .55rem; white-space: nowrap; }
.student-fee-line-off > span, .student-fee-line-off > b { color: #a0a9b4; }
.student-fee-line-off > span i { color: #a5adb7; background: #f0f2f4; }
.student-fee-line-off > b { font-size: .49rem; font-weight: 700; }
.student-no-pricing { margin-top: 10px; padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 13px; border: 1px solid #efd698; border-radius: 11px; color: #765516; background: #fff7df; }
.student-no-pricing strong, .student-no-pricing small { display: block; }
.student-no-pricing strong { font-size: .62rem; }
.student-no-pricing small { margin-top: 3px; font-size: .53rem; line-height: 1.4; }
.student-no-pricing > a { flex: 0 0 auto; padding: 7px 9px; border-radius: 8px; color: #805a0d; background: #ffe9ac; font-size: .54rem; font-weight: 900; }
.payment-invoice-field { margin-top: 13px; }
.payment-invoice-field select { width: 100%; height: 44px; padding: 0 12px; border: 1px solid #d9e1e8; border-radius: 11px; color: #26394e; background: #fff; font-size: .67rem; }
.selected-invoice-details { margin-top: 9px; padding: 12px; border: 1px solid #dce6eb; border-radius: 12px; background: #f8fafb; }
.selected-invoice-details > div:first-child span, .selected-invoice-details > div:first-child strong, .selected-invoice-details > div:first-child small { display: block; }
.selected-invoice-details > div:first-child span { color: #187681; font-size: .49rem; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.selected-invoice-details > div:first-child strong { margin-top: 4px; font-size: .68rem; }
.selected-invoice-details > div:first-child small { margin-top: 3px; color: #8b97a6; font-size: .53rem; }
.selected-invoice-breakdown { margin-top: 9px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.selected-invoice-breakdown > span { padding: 6px 7px; display: flex; align-items: center; justify-content: space-between; gap: 7px; border-radius: 7px; background: #fff; font-size: .52rem; }
.selected-invoice-breakdown i { overflow: hidden; color: #738195; font-style: normal; text-overflow: ellipsis; white-space: nowrap; }
.selected-invoice-breakdown b { color: #34495e; white-space: nowrap; }
.selected-invoice-details > p { margin: 9px 0 0; padding-top: 9px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #e2e7eb; }
.selected-invoice-details > p span { color: #738195; font-size: .55rem; }
.selected-invoice-details > p strong { color: #b13b4d; font-size: .75rem; }
.student-payment-inputs { margin-top: 11px; }
.student-payment-submit { width: 100%; margin-top: 12px; min-height: 45px; }

.monthly-ledger-card { margin-bottom: 16px; padding: 0; overflow: hidden; }
.monthly-ledger-head { padding: 21px 22px 18px; }
.ledger-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; }
.ledger-legend span { display: flex; align-items: center; gap: 5px; color: #718094; font-size: .59rem; font-weight: 750; letter-spacing: 0; text-transform: none; }
.ledger-legend i { width: 8px; height: 8px; display: block; border-radius: 3px; }
.legend-paid { background: #33a47e; }
.legend-due { background: #dc5668; }
.legend-partial { background: #e8ae32; }
.legend-scheduled { background: #7aa6ce; }
.accounting-filters { padding: 14px 22px; display: flex; align-items: end; gap: 10px; border-top: 1px solid #edf0f3; border-bottom: 1px solid #e7ebef; background: #f8fafb; }
.accounting-filters .field { flex: 0 0 180px; }
.accounting-filters .accounting-search { flex: 1 1 270px; }
.accounting-filters label { font-size: .65rem; }
.accounting-filters input, .accounting-filters select { height: 39px; font-size: .7rem; }
.accounting-filters .btn { min-height: 39px; padding: 8px 12px; font-size: .68rem; }
.ledger-empty { margin: 22px; }
.ledger-table-wrap { width: 100%; overflow: auto; scrollbar-color: #cbd5df #f5f7f9; }
.ledger-table { min-width: 1340px; table-layout: fixed; }
.ledger-table th { height: 52px; padding: 9px 5px; color: #7b8798; background: #fff; font-size: .59rem; text-align: center; letter-spacing: .02em; }
.ledger-table th small { display: block; margin-top: 2px; color: #adb5c0; font-size: .52rem; }
.ledger-table td { height: 68px; padding: 8px 4px; background: #fff; text-align: center; }
.ledger-table tbody tr:hover td { background: #fafcfd; }
.ledger-table .ledger-student-column { position: sticky; z-index: 2; left: 0; width: 245px; padding-left: 18px; text-align: left; box-shadow: 8px 0 12px rgba(22,36,61,.025); }
.ledger-table thead .ledger-student-column { z-index: 3; }
.ledger-student-column > a { min-width: 0; display: flex; align-items: center; gap: 9px; }
.ledger-avatar { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: #234663; background: #eaf2f7; font-size: .57rem; font-weight: 950; }
.ledger-student-column > a > span:last-child { min-width: 0; }
.ledger-student-column strong, .ledger-student-column small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-student-column strong { font-size: .68rem; }
.ledger-student-column small { margin-top: 3px; color: #8b97a6; font-size: .55rem; }
.ledger-table .ledger-monthly-column { width: 88px; }
.ledger-monthly-column strong, .ledger-monthly-column small { display: block; }
.ledger-monthly-column strong { font-size: .68rem; }
.ledger-monthly-column small { margin-top: 2px; color: #929eac; font-size: .51rem; }
.ledger-configure { display: inline-flex; padding: 6px 7px; border-radius: 8px; color: #35637f; background: #edf4f8; font-size: .53rem; font-weight: 850; line-height: 1.25; }
.ledger-configure:hover { color: #0b6b72; background: #e1f5f6; }
.ledger-table th:not(.ledger-student-column):not(.ledger-monthly-column):not(.ledger-total-column),
.ledger-table td:not(.ledger-student-column):not(.ledger-monthly-column):not(.ledger-total-column) { width: 78px; }
.ledger-table .ledger-total-column { width: 105px; }
.ledger-current-month { background: #f2fbfc !important; box-shadow: inset 1px 0 #d7eff1, inset -1px 0 #d7eff1; }
.month-cell { width: 65px; min-height: 43px; margin: auto; padding: 6px 3px; display: grid; place-content: center; gap: 2px; border: 0; border-radius: 10px; font: inherit; text-align: center; }
button.month-cell { cursor: pointer; transition: transform .16s, box-shadow .16s; }
button.month-cell:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(22,36,61,.12); }
.month-cell strong, .month-cell small { display: block; }
.month-cell strong { font-size: .55rem; }
.month-cell small { font-size: .52rem; opacity: .75; }
.month-paid { color: #087256; background: #e4f7f0; }
.month-due { color: #ac3547; background: #ffebee; }
.month-partial { color: #8a5e08; background: #fff2cb; }
.month-scheduled { color: #3d6c96; background: #eaf3fb; }
.month-empty { color: #a7b0bc; background: #f3f5f7; }
.ledger-total-column strong, .ledger-total-column small { display: block; }
.ledger-total-column strong { font-size: .68rem; }
.ledger-total-column small { margin-top: 3px; color: #939eac; font-size: .51rem; }
.ledger-balance-due { color: #bb3d4e; }
.ledger-balance-clear { color: #15805d; }
.finance-pagination { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-top: 1px solid #edf0f3; color: #8490a1; font-size: .59rem; }
.finance-pagination > div { display: flex; align-items: center; gap: 7px; }
.finance-pagination a, .finance-pagination strong, .finance-page-disabled { padding: 6px 8px; border-radius: 7px; }
.finance-pagination a { color: #285c7a; background: #edf4f8; font-weight: 850; }
.finance-pagination strong { color: #35485e; background: #f3f5f7; }
.finance-page-disabled { color: #b0b8c2; background: #f6f7f8; }

.finance-journals-grid { margin-bottom: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 16px; }
.finance-journal-card { padding: 0; overflow: hidden; }
.finance-journal-card .dashboard-card-head { padding: 20px 20px 15px; }
.finance-journal-card .dashboard-card-head > b { min-width: 29px; height: 27px; display: grid; place-items: center; border-radius: 8px; color: #617186; background: #eef2f5; font-size: .65rem; }
.finance-journal-list { border-top: 1px solid #edf0f3; }
.finance-journal-row { min-width: 0; min-height: 66px; padding: 10px 16px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto 24px; align-items: center; gap: 10px; border-bottom: 1px solid #eff2f4; }
.finance-journal-row > div { min-width: 0; }
.finance-journal-row strong, .finance-journal-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finance-journal-row strong { font-size: .66rem; }
.finance-journal-row small { margin-top: 4px; color: #8d99a8; font-size: .55rem; }
.journal-date, .journal-invoice-icon { width: 35px; height: 38px; display: grid; place-content: center; border-radius: 9px; color: #536a81; background: #edf2f6; font-size: .7rem; font-weight: 900; text-align: center; }
.journal-date small { margin: 0; font-size: .48rem; text-transform: uppercase; }
.journal-expense { color: #bd3e50; font-size: .65rem; }
.journal-delete { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 7px; color: #b44453; background: #fff0f2; cursor: pointer; }
.finance-invoice-row { grid-template-columns: 36px minmax(0, 1fr) auto auto 35px; }
.journal-invoice-icon { color: #246172; background: #e5f6f7; font-size: .48rem; }
.finance-invoice-row > b { font-size: .63rem; }
.journal-status { padding: 5px 7px; border-radius: 7px; font-size: .53rem; font-weight: 850; }
.journal-status-paid { color: #087256; background: #e4f7f0; }
.journal-status-due { color: #ac3547; background: #ffebee; }
.journal-status-partial { color: #8a5e08; background: #fff2cb; }
.journal-status-scheduled { color: #3d6c96; background: #eaf3fb; }
.journal-receipt { color: #315d78; font-size: .55rem; font-weight: 850; }
.journal-receipt-empty { color: #a1abb7; text-align: center; }

.manual-invoice-card { margin-top: 0 !important; }
.manual-invoice-card > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
.manual-invoice-card > summary::-webkit-details-marker { display: none; }
.manual-invoice-card > summary small, .manual-invoice-card > summary strong { display: block; }
.manual-invoice-card > summary small { color: #8b97a7; font-size: .57rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.manual-invoice-card > summary strong { margin-top: 4px; font-size: .78rem; }
.manual-invoice-card > summary b { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: #315d78; background: #edf3f7; }
.manual-invoice-card[open] > summary b { transform: rotate(45deg); }
.manual-invoice-card > p { margin: 18px 0; color: #7f8c9e; font-size: .68rem; }

@media (max-width: 1180px) {
    .accounting-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .accounting-stat-net { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
    .finance-workspace-grid, .finance-journals-grid { grid-template-columns: 1fr; }
    .accounting-filters { align-items: stretch; flex-wrap: wrap; }
    .accounting-filters .field { flex: 1 1 210px; }
}

@media (max-width: 760px) {
    .accounting-page-head { align-items: flex-start; }
    .accounting-summary { grid-template-columns: 1fr; }
    .accounting-stat, .accounting-stat-net { grid-column: auto; min-height: 105px; }
    .finance-quick-form, .finance-expense-form, .finance-more-grid { grid-template-columns: 1fr; }
    .student-search-result { grid-template-columns: 35px minmax(0, 1fr); }
    .student-search-result > b { display: none; }
    .selected-student-head { grid-template-columns: 40px minmax(0, 1fr); }
    .selected-student-head > a { grid-column: 2; }
    .student-account-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .student-fee-groups, .selected-invoice-breakdown { grid-template-columns: 1fr; }
    .student-no-pricing { align-items: flex-start; flex-direction: column; }
    .accounting-filters { display: grid; grid-template-columns: 1fr; }
    .accounting-filters .field { width: 100%; }
    .monthly-ledger-head { align-items: flex-start; flex-direction: column; }
    .ledger-table .ledger-student-column { width: 210px; }
    .finance-journal-row { grid-template-columns: 34px minmax(0, 1fr) auto 22px; }
    .finance-invoice-row { grid-template-columns: 34px minmax(0, 1fr) auto; }
    .finance-invoice-row .journal-status { grid-column: 2; width: max-content; }
    .finance-invoice-row .journal-receipt { grid-column: 3; grid-row: 2; }
}

/* Keep premium cards above the shared base card colors declared earlier. */
.teacher-stats .teacher-payroll-stat,
.behavior-stats .behavior-role-stat,
.result-stats .result-validated-stat {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(145deg, #173d67, #0d745e);
}
.teacher-stats .teacher-payroll-stat .stat-label,
.behavior-stats .behavior-role-stat .stat-label,
.result-stats .result-validated-stat .stat-label { color: rgba(255,255,255,.72); }
.teacher-stats .teacher-payroll-stat .stat-badge { color: #fff; background: rgba(255,255,255,.14); }
.teacher-editor.card { padding: 0; }

/* Responsive application shell */
.mobile-menu-toggle,
.sidebar-close,
.sidebar-overlay { display: none; }

@media (max-width: 980px) {
    body.menu-open { overflow: hidden; }
    .app-shell { display: block; min-height: 100dvh; }
    .main { width: 100%; min-height: 100dvh; }
    .sidebar {
        position: fixed;
        z-index: 1000;
        inset: 0 auto 0 0;
        width: min(86vw, 320px);
        height: 100dvh;
        padding: max(18px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
        display: flex;
        align-items: stretch;
        flex-direction: column;
        gap: 0;
        overflow: hidden;
        transform: translateX(-105%);
        transition: transform .24s ease;
        box-shadow: 22px 0 55px rgba(2, 12, 27, .28);
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-close {
        position: absolute;
        z-index: 2;
        top: max(18px, env(safe-area-inset-top));
        right: 15px;
        width: 38px;
        height: 38px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(255,255,255,.12);
        border-radius: 11px;
        color: #fff;
        background: rgba(255,255,255,.08);
        cursor: pointer;
        font-size: 1.35rem;
    }
    .sidebar .brand {
        min-height: 62px;
        margin: 0;
        padding: 0 48px 16px 6px;
    }
    .sidebar .brand img,
    .sidebar .brand-monogram { width: 44px; height: 44px; }
    .sidebar .brand span,
    .sidebar .nav-title,
    .sidebar .nav-link span:not(.nav-icon) { display: block; }
    .sidebar .sidebar-nav {
        min-height: 0;
        flex: 1 1 auto;
        margin: 14px -4px 12px 0;
        padding-right: 7px;
        display: block;
        overflow-x: hidden;
        overflow-y: auto;
    }
    .sidebar .nav-group { display: block; }
    .sidebar .nav-group + .nav-group { margin-top: 20px; }
    .sidebar .nav-link { margin: 0 0 5px; padding: 10px 12px; }
    .sidebar .sidebar-user { margin-top: auto; display: grid; }
    .sidebar-overlay {
        position: fixed;
        z-index: 990;
        inset: 0;
        width: 100%;
        height: 100%;
        border: 0;
        background: rgba(3, 12, 25, .58);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        backdrop-filter: blur(3px);
    }
    .sidebar-overlay.is-visible { display: block; opacity: 1; pointer-events: auto; }
    .topbar {
        position: sticky;
        z-index: 100;
        top: 0;
        height: 70px;
        padding: 10px max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
        display: flex;
        justify-content: flex-start;
        gap: 12px;
        box-shadow: 0 5px 18px rgba(22,36,61,.05);
    }
    .topbar > div:not(.topbar-tools) { min-width: 0; }
    .topbar h1,
    .topbar p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .topbar-tools { margin-left: auto; flex: 0 0 auto; }
    .mobile-menu-toggle {
        width: 42px;
        height: 42px;
        padding: 0;
        display: grid;
        flex: 0 0 auto;
        place-content: center;
        gap: 4px;
        border: 1px solid var(--line);
        border-radius: 12px;
        color: var(--navy);
        background: #fff;
        cursor: pointer;
        box-shadow: 0 5px 14px rgba(22,36,61,.06);
    }
    .mobile-menu-toggle span { width: 18px; height: 2px; display: block; border-radius: 999px; background: currentColor; }
    .content { width: 100%; max-width: none; padding: 24px 22px 48px; }
    .mobile-title { display: none; }
    .portal-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .portal-detail-grid { grid-template-columns: 1fr; }
    .portal-week { padding-bottom: 8px; scroll-snap-type: x proximity; }
    .portal-day { scroll-snap-align: start; }
}

@media (max-width: 900px) {
    .grid-3 { grid-template-columns: 1fr; }
    .teacher-form-section { grid-template-columns: 1fr; }
    .teacher-section-number { width: 35px; height: 35px; }
    .teacher-person { grid-template-columns: 1fr; }
    .teacher-name-line { flex-direction: column; }
    .teacher-pay strong { width: 100%; margin-left: 0; }
    .behavior-stats,
    .behavior-report-card,
    .behavior-report-grid,
    .gradebook-rules,
    .results-filter-card,
    .results-explanation { grid-template-columns: 1fr; }
    .result-student-main { grid-template-columns: 44px minmax(0, 1fr); }
    .result-average,
    .result-saved { grid-column: 2; }
    .promotion-form { grid-template-columns: 1fr; padding-left: 17px; }
    .result-no-grade { padding-left: 17px; }
    .login-page { display: block; background: var(--background); }
    .login-visual { min-height: 250px; padding: 30px 28px; }
    .login-copy { margin-top: 48px; }
    .login-copy h1 { font-size: clamp(2rem, 8vw, 3rem); }
    .login-copy p { display: none; }
    .login-panel { padding: 32px 22px 48px; }
    .install-page { display: block; }
    .install-intro { position: relative; height: auto; padding: 36px 28px 44px; }
    .install-points { display: none; }
    .install-form { padding: 32px 22px 52px; }
}

@media (max-width: 640px) {
    :root { --radius: 15px; }
    body { overflow-x: hidden; }
    .topbar { height: 64px; padding-inline: 12px; gap: 9px; }
    .topbar h1 { font-size: .92rem; }
    .topbar p { font-size: .63rem; }
    .topbar-tools .today-chip { display: none; }
    .topbar-tools .pill { max-width: 115px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .58rem; }
    .mobile-menu-toggle { width: 40px; height: 40px; }
    .content { padding: 18px max(12px, env(safe-area-inset-right)) calc(38px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
    .page-head { gap: 14px; margin-bottom: 18px; }
    .page-head h2 { font-size: 1.55rem; }
    .page-head p { font-size: .78rem; line-height: 1.5; }
    .page-head > .form-actions,
    .accounting-page-head > .form-actions,
    .payroll-page-head > .form-actions { width: 100%; margin-top: 2px; }
    .form-actions { flex-wrap: wrap; }
    .page-head > .form-actions .btn { flex: 1 1 145px; }
    .card,
    .dashboard-card { padding: 16px; border-radius: 16px; }
    .stat { padding: 16px; }
    .stats,
    .school-grid,
    .form-grid,
    .grid-2,
    .module-grid,
    .finance-form,
    .access-counts,
    .route-grid { grid-template-columns: 1fr; gap: 12px; }
    .grid-2 > * { min-width: 0; }
    input,
    select,
    textarea { max-width: 100%; font-size: 16px; }
    .field input,
    .field select { height: 46px; }
    .btn { min-height: 44px; }
    .empty { padding: 28px 14px; }
    .app-pagination { align-items: stretch; flex-direction: column; }
    .app-pagination-summary { text-align: center; }
    .app-pagination-pages { justify-content: center; }
    .app-page-link { width: 34px; height: 34px; flex-basis: 34px; }
    .table-wrap {
        max-width: 100%;
        margin-inline: -4px;
        padding-bottom: 7px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }
    .table-wrap > table:not(.ledger-table) { min-width: 700px; }
    th { padding: 10px; font-size: .67rem; }
    td { padding: 11px 10px; font-size: .78rem; }
    .search-bar { display: grid; grid-template-columns: 1fr; }
    .search-bar input,
    .search-bar select,
    .search-bar .btn { width: 100%; min-width: 0; }
    .student-save-bar {
        bottom: calc(8px + env(safe-area-inset-bottom));
        padding: 12px;
        border-radius: 14px;
    }
    .student-save-bar .btn { width: 100%; }
    .billing-line { gap: 10px; }
    .billing-amount input { min-width: 0; }
    .teacher-editor-head { align-items: flex-start; flex-direction: column; padding: 18px; }
    .teacher-form-section { padding: 18px; }
    .teacher-editor > form > .form-actions { padding: 0 18px 18px; }
    .assignment-row { grid-template-columns: 1fr 38px; }
    .assignment-row .field:first-child { grid-column: 1 / -1; }
    .salary-mode-grid { grid-template-columns: 1fr; }
    .teacher-row-actions { width: 100%; flex-wrap: wrap; }
    .teacher-row-actions .btn { flex: 1; }
    .portal-hero { padding: 22px 18px; border-radius: 18px; }
    .portal-hero h2 { font-size: 1.75rem; }
    .portal-hero p { font-size: .75rem; line-height: 1.5; }
    .portal-metrics { grid-template-columns: 1fr; }
    .portal-schedule-card { padding: 14px; }
    .portal-week {
        grid-template-columns: none;
        grid-auto-flow: column;
        grid-auto-columns: minmax(190px, 78vw);
        overscroll-behavior-inline: contain;
    }
    .portal-day { min-width: 0; }
    .portal-attendance { grid-template-columns: 1fr; }
    .payroll-period-input { width: 100%; }
    .payroll-edit-form,
    .payroll-pay-form { align-items: stretch; flex-direction: column; }
    .payroll-edit-form label,
    .payroll-edit-form input,
    .payroll-pay-form input,
    .payroll-pay-form select,
    .payroll-actions .btn { width: 100%; }
    .finance-pagination { align-items: stretch; flex-direction: column; }
    .finance-pagination > div { justify-content: space-between; }
    .payment-form { min-width: 0; flex-wrap: wrap; }
    .payment-form input,
    .payment-form select { flex: 1 1 120px; width: auto; }
    .dashboard-hero { padding: 24px 18px; border-radius: 18px; }
    .dashboard-hero h2 { font-size: 1.85rem; }
    .dashboard-card-head { flex-wrap: wrap; }
    .cashflow-chart { margin-inline: -4px; padding-inline: 3px; }
    .login-visual { min-height: 215px; padding: 24px 18px; }
    .login-brand span { font-size: .68rem; }
    .login-copy { margin-top: 34px; }
    .login-copy h1 { margin-bottom: 0; font-size: 2rem; }
    .login-panel { padding: 26px 16px 42px; }
    .login-box h2 { font-size: 1.7rem; }
    .install-intro { padding: 28px 18px 36px; }
    .install-intro h1 { font-size: 2rem; }
    .install-form { padding: 26px 14px 44px; }
}

.parent-student-filter { margin-bottom: 10px; }
.parent-student-options {
    max-height: 260px;
    overflow: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    border: 1px solid #dfe7f1;
    border-radius: 16px;
    background: #f8fafd;
}
.parent-student-options > label {
    display: flex;
    gap: 9px;
    align-items: center;
    padding: 10px;
    border: 1px solid #e5ebf3;
    border-radius: 13px;
    background: #fff;
    cursor: pointer;
}
.parent-student-options > label:has(input:checked) {
    border-color: var(--turquoise);
    background: color-mix(in srgb, var(--turquoise) 8%, white);
}
.parent-student-options input { width: 18px; height: 18px; flex: 0 0 auto; }
.parent-student-options span,
.parent-student-options strong,
.parent-student-options small { display: block; }
.parent-student-options strong { font-size: .82rem; }
.parent-student-options small { margin-top: 2px; color: #718096; font-size: .7rem; }
.parent-link-form {
    display: grid;
    grid-template-columns: 1fr 1fr .65fr auto;
    gap: 12px;
    align-items: end;
    margin: 18px 0;
    padding: 16px;
    border-radius: 18px;
    background: #f7f9fc;
}
.parent-family-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.parent-family-list > article { padding: 15px; border: 1px solid #e2e8f1; border-radius: 18px; }
.parent-family-list article > header { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.parent-family-list article > header > span {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--navy), var(--turquoise));
    font-weight: 900;
}
.parent-family-list header div,
.parent-family-list header strong,
.parent-family-list header small { display: block; min-width: 0; }
.parent-family-list header small { color: #718096; font-size: .72rem; }
.parent-family-list article > div { display: grid; gap: 6px; }
.parent-family-list article > div form {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 9px 11px;
    border-radius: 12px;
    background: #f6f8fb;
}
.parent-family-list form span,
.parent-family-list form strong,
.parent-family-list form small { display: block; }
.parent-family-list form strong { font-size: .78rem; }
.parent-family-list form small { color: #7a8798; font-size: .68rem; }
.parent-family-list form button {
    width: 27px;
    height: 27px;
    border: 0;
    border-radius: 50%;
    color: #b33e51;
    background: #fcecef;
    cursor: pointer;
    font-size: 1.1rem;
}
.parent-family-list form button:disabled { opacity: .35; cursor: not-allowed; }
@media (max-width: 900px) {
    .parent-link-form { grid-template-columns: 1fr 1fr; }
    .parent-family-list { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .parent-student-options { grid-template-columns: 1fr; }
    .parent-link-form { grid-template-columns: 1fr; }
    .parent-link-form .btn { width: 100%; }
}

.student-photo-editor {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 18px;
    align-items: center;
    margin: 20px 0 24px;
    padding: 18px;
    border: 1px solid #dfe7f1;
    border-radius: 22px;
    background: linear-gradient(135deg, #f7faff, #eef5ff);
}
.student-photo-preview {
    width: 112px;
    height: 112px;
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 4px solid #fff;
    border-radius: 28px;
    color: #fff;
    background: linear-gradient(145deg, var(--navy), var(--turquoise));
    box-shadow: 0 12px 28px rgba(23, 50, 83, .18);
    font-size: 2rem;
    font-weight: 900;
}
.student-photo-preview img,
.portal-person > span.has-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.student-photo-editor strong { display: block; margin-bottom: 5px; font-size: 1.05rem; }
.student-photo-editor p { margin: 0 0 12px; color: #68778b; font-size: .84rem; line-height: 1.55; }
.student-photo-remove { display: block; margin-top: 11px; color: #a33b4c; font-size: .78rem; font-weight: 800; }
.portal-person > span.has-photo { padding: 0; overflow: hidden; }
@media (max-width: 640px) {
    .student-photo-editor { grid-template-columns: 82px minmax(0, 1fr); padding: 14px; }
    .student-photo-preview { width: 82px; height: 82px; border-radius: 22px; }
}

/* Secure files, timetable images and QR pickup */
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: .68rem; line-height: 1.45; }
.homework-feed-item > div { width: 100%; }
.homework-feed-item > div > small { display: block; margin-top: 7px; color: var(--muted); line-height: 1.5; }
.attachment-list { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-list a {
    min-width: 0;
    padding: 9px 11px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    column-gap: 9px;
    align-items: center;
    border: 1px solid #d9e7ee;
    border-radius: 11px;
    color: #244e6e;
    background: #f7fbfd;
}
.attachment-list a > span { width: 34px; height: 34px; grid-row: 1 / 3; display: grid; place-items: center; border-radius: 9px; color: #0c6f63; background: #dff6f0; font-size: .58rem; font-weight: 900; }
.attachment-list a > b { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .72rem; }
.attachment-list a > small { color: var(--muted); font-size: .6rem; }
.expense-proof-field { padding: 12px; border: 1px dashed #bbd6df; border-radius: 12px; background: #f7fbfd; }
.journal-attachments { margin-top: 7px; display: flex; flex-wrap: wrap; gap: 5px; }
.journal-attachments a { max-width: 230px; overflow: hidden; padding: 4px 7px; border-radius: 7px; color: #176d65; background: #e9f8f4; text-overflow: ellipsis; white-space: nowrap; font-size: .58rem; font-weight: 800; }

.timetable-plan-section { margin-top: 18px; }
.section-split-head { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.timetable-plan-layout { display: grid; grid-template-columns: minmax(280px, .7fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }
.timetable-plan-form { padding: 17px; display: grid; gap: 12px; border: 1px solid #dce7ed; border-radius: 15px; background: #f8fafc; }
.plan-scope-field[hidden] { display: none; }
.timetable-plan-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.timetable-plan-card { min-width: 0; overflow: hidden; display: flex; flex-direction: column; border: 1px solid #dfe8ed; border-radius: 15px; background: #fff; }
.timetable-plan-preview { height: 175px; display: block; overflow: hidden; background: #eef3f6; }
.timetable-plan-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.timetable-plan-card > div { min-width: 0; padding: 14px; }
.timetable-plan-card h4 { margin: 9px 0 5px; font-size: .9rem; }
.timetable-plan-card p { margin: 0 0 7px; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.timetable-plan-card > div > small { color: var(--muted); font-size: .6rem; }
.timetable-plan-card > form { padding: 0 14px 14px; }

.portal-plan-card { margin-top: 18px; }
.portal-plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.portal-plan-grid > a { min-width: 0; overflow: hidden; border: 1px solid #dfe7ec; border-radius: 14px; color: var(--ink); background: #fff; }
.portal-plan-grid img { width: 100%; height: 145px; display: block; object-fit: cover; background: #eef3f6; }
.portal-plan-grid a > span { padding: 11px 12px; display: block; }
.portal-plan-grid strong, .portal-plan-grid small { display: block; }
.portal-plan-grid strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
.portal-plan-grid small { margin-top: 4px; color: var(--muted); font-size: .62rem; }
.portal-homework-files { margin-top: 7px; display: flex !important; flex-wrap: wrap; gap: 5px; }
.portal-homework-files a { padding: 4px 7px; border-radius: 7px; color: #176d65; background: #e7f7f3; font-size: .6rem; font-weight: 800; }

.pickup-command-grid { display: grid; grid-template-columns: minmax(290px, .7fr) minmax(0, 1.3fr); gap: 18px; align-items: start; }
.pickup-gate-card { text-align: center; }
.pickup-gate-card .dashboard-card-head { text-align: left; }
.pickup-qr-frame { width: fit-content; margin: 18px auto; padding: 15px; border: 1px solid #d8e6eb; border-radius: 20px; background: #fff; box-shadow: 0 14px 35px rgba(17, 45, 76, .1); }
.pickup-qr-frame canvas { width: 280px; max-width: 100%; height: auto; display: block; }
.pickup-gate-card > p { max-width: 420px; margin: 0 auto 16px; color: var(--muted); font-size: .72rem; line-height: 1.55; }
.pickup-qr-fallback { padding: 25px; color: var(--danger); font-size: .72rem; }
.pickup-request-list { display: grid; gap: 10px; }
.pickup-request { padding: 12px; display: flex; align-items: center; gap: 11px; border: 1px solid #dfe7ec; border-radius: 13px; background: #fff; }
.pickup-status-waiting { border-color: #f2d18a; background: #fffaf0; }
.pickup-status-acknowledged { border-color: #95d6c7; background: #f1fbf8; }
.pickup-avatar { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: #fff; background: linear-gradient(145deg, #0c496e, #12a9a5); font-size: .68rem; font-weight: 900; }
.pickup-request-copy { min-width: 0; flex: 1; }
.pickup-request-copy strong, .pickup-request-copy small, .pickup-request-copy time { display: block; }
.pickup-request-copy strong { font-size: .78rem; }
.pickup-request-copy small { margin-top: 3px; color: var(--muted); font-size: .64rem; }
.pickup-request-copy time { margin-top: 5px; color: #96700d; font-size: .58rem; font-weight: 800; }
.pickup-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.pickup-actions form { margin: 0; }
.pickup-history-card { margin-top: 18px; }
.parent-pickup-copy { color: var(--muted); font-size: .72rem; line-height: 1.55; }
.pickup-parent-status { padding: 14px; display: flex; align-items: center; gap: 11px; border: 1px solid #f0ce80; border-radius: 13px; background: #fff9eb; }
.pickup-parent-status > span { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; color: #8a650c; background: #ffe9ad; font-weight: 900; }
.pickup-parent-status strong, .pickup-parent-status small { display: block; }
.pickup-parent-status strong { font-size: .76rem; }
.pickup-parent-status small { margin-top: 4px; color: var(--muted); font-size: .62rem; }
.pickup-scanner { margin-top: 13px; padding: 12px; border: 1px solid #d8e5ea; border-radius: 14px; background: #071a3d; text-align: center; }
.pickup-scanner[hidden] { display: none; }
.pickup-scanner video { width: 100%; max-height: 330px; display: block; border-radius: 10px; background: #000; object-fit: cover; }
.pickup-scanner p { margin: 9px 0; color: #d9e6f5; font-size: .68rem; }

@media (max-width: 900px) {
    .timetable-plan-layout,
    .pickup-command-grid { grid-template-columns: 1fr; }
    .portal-plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .attachment-list { display: grid; grid-template-columns: 1fr; }
    .attachment-list a > b, .journal-attachments a { max-width: 100%; }
    .timetable-plan-gallery,
    .portal-plan-grid { grid-template-columns: 1fr; }
    .timetable-plan-preview,
    .portal-plan-grid img { height: 190px; }
    .pickup-request { align-items: flex-start; flex-wrap: wrap; }
    .pickup-request-copy { min-width: calc(100% - 56px); }
    .pickup-actions { width: 100%; justify-content: stretch; }
    .pickup-actions form { flex: 1 1 120px; }
    .pickup-actions .btn { width: 100%; }
    .pickup-qr-frame { width: 100%; padding: 10px; }
}

@media print {
    body:has(.pickup-gate-card) .sidebar,
    body:has(.pickup-gate-card) .topbar,
    body:has(.pickup-gate-card) .page-head,
    body:has(.pickup-gate-card) .pickup-waiting-card,
    body:has(.pickup-gate-card) .pickup-history-card,
    body:has(.pickup-gate-card) .alert { display: none !important; }
    body:has(.pickup-gate-card) .app-shell,
    body:has(.pickup-gate-card) .main,
    body:has(.pickup-gate-card) .content,
    body:has(.pickup-gate-card) .pickup-command-grid { display: block; width: 100%; padding: 0; background: #fff; }
    body:has(.pickup-gate-card) .pickup-gate-card { max-width: 520px; margin: 30px auto; border: 0; box-shadow: none; }
    body:has(.pickup-gate-card) .pickup-gate-card .btn { display: none; }
}

/* Timetable sessions dashboard and A4 exports */
.section-kicker {
    display: block;
    margin-bottom: 7px;
    color: var(--turquoise);
    font-size: .61rem;
    font-weight: 900;
    letter-spacing: .12em;
}
.timetable-dashboard { overflow: hidden; }
.timetable-dashboard-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}
.timetable-dashboard-head h3 { margin: 0; color: var(--navy); font-size: 1.25rem; }
.timetable-dashboard-head p { margin: 6px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.timetable-dashboard-actions {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}
.timetable-dashboard-actions form { min-width: 210px; }
.timetable-dashboard-actions label { display: block; margin-bottom: 5px; color: var(--muted); font-size: .61rem; font-weight: 800; }
.timetable-dashboard-actions select { min-height: 39px; }
.classroom-schedule-tabs {
    margin: 20px -2px 0;
    padding: 2px 2px 8px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: thin;
}
.classroom-schedule-tabs a {
    min-width: 126px;
    padding: 10px 12px;
    border: 1px solid #dce7ed;
    border-radius: 12px;
    color: var(--ink);
    background: #f8fafc;
}
.classroom-schedule-tabs strong,
.classroom-schedule-tabs span { display: block; }
.classroom-schedule-tabs strong { font-size: .72rem; }
.classroom-schedule-tabs span { margin-top: 4px; color: var(--muted); font-size: .58rem; }
.classroom-schedule-tabs a.active {
    border-color: var(--navy);
    color: #fff;
    background: linear-gradient(140deg, var(--navy), #176893);
    box-shadow: 0 8px 18px rgba(16, 57, 93, .16);
}
.classroom-schedule-tabs a.active span { color: #cce4ef; }
.timetable-metrics {
    margin: 13px 0 17px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
}
.timetable-metrics article {
    min-width: 0;
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e0e8ed;
    border-radius: 13px;
    background: #fbfcfd;
}
.timetable-metrics article > span {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 10px;
    color: #116a66;
    background: #def4ef;
    font-size: .58rem;
    font-weight: 900;
}
.timetable-metrics small,
.timetable-metrics strong { display: block; }
.timetable-metrics small { overflow: hidden; color: var(--muted); font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.timetable-metrics strong { margin-top: 3px; font-size: .95rem; }
.weekly-timetable-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #d9e4ea;
    border-radius: 14px;
}
.weekly-timetable {
    width: 100%;
    min-width: 930px;
    border-collapse: collapse;
    table-layout: fixed;
    background: #fff;
}
.weekly-timetable th,
.weekly-timetable td { border-right: 1px solid #e2e9ed; border-bottom: 1px solid #e2e9ed; }
.weekly-timetable tr:last-child th,
.weekly-timetable tr:last-child td { border-bottom: 0; }
.weekly-timetable th:last-child,
.weekly-timetable td:last-child { border-right: 0; }
.weekly-timetable thead th {
    padding: 12px 8px;
    color: #fff;
    background: var(--navy);
    font-size: .67rem;
    letter-spacing: .02em;
}
.weekly-timetable .weekly-time-column { width: 80px; }
.weekly-timetable tbody .weekly-time-column {
    padding: 10px 7px;
    color: var(--navy);
    background: #f1f6f8;
    text-align: center;
}
.weekly-time-column strong,
.weekly-time-column span { display: block; }
.weekly-time-column strong { font-size: .7rem; }
.weekly-time-column span { margin-top: 3px; color: var(--muted); font-size: .58rem; }
.weekly-timetable td { height: 78px; padding: 5px; vertical-align: top; }
.weekly-session {
    position: relative;
    min-height: 66px;
    padding: 8px 29px 8px 9px;
    overflow: hidden;
    border-left: 3px solid var(--turquoise);
    border-radius: 8px;
    background: #edf8f6;
}
.weekly-session + .weekly-session { margin-top: 5px; }
.weekly-session strong,
.weekly-session span,
.weekly-session small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weekly-session strong { color: var(--navy); font-size: .67rem; }
.weekly-session span { margin-top: 4px; color: #45637a; font-size: .57rem; }
.weekly-session small { margin-top: 3px; color: var(--muted); font-size: .54rem; }
.weekly-session form { position: absolute; top: 6px; right: 6px; }
.weekly-session button {
    width: 20px;
    height: 20px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 50%;
    color: var(--danger);
    background: #fff;
    cursor: pointer;
    font-weight: 900;
}
.timetable-empty { display: grid; gap: 6px; }
.timetable-empty strong { color: var(--navy); }
.academics-setup-grid { margin-top: 18px; align-items: start; }
.assignments-card { margin-top: 18px; }

@media (max-width: 980px) {
    .timetable-dashboard-head { flex-direction: column; }
    .timetable-dashboard-actions { width: 100%; justify-content: flex-start; }
    .timetable-dashboard-actions form { flex: 1 1 240px; }
    .timetable-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .timetable-dashboard { padding-inline: 13px; }
    .timetable-dashboard-actions { align-items: stretch; flex-direction: column; }
    .timetable-dashboard-actions form,
    .timetable-dashboard-actions .btn { width: 100%; }
    .timetable-metrics { grid-template-columns: 1fr; }
    .weekly-timetable { min-width: 820px; }
    .classroom-schedule-tabs a { min-width: 112px; }
}

/* Connected pointage, payroll and transport */
.pointage-card { margin-bottom: 18px; overflow: hidden; }
.pointage-live {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 80px minmax(120px, 1fr) minmax(180px, .8fr);
    align-items: center;
    gap: 16px;
    padding: 18px;
    border: 1px solid #dbe7ed;
    border-radius: 18px;
    background: linear-gradient(135deg, #f7fbfd, #edf8f5);
}
.pointage-state span,
.pointage-state strong,
.pointage-state small { display: block; }
.pointage-state span { color: var(--muted); font-size: .61rem; font-weight: 900; letter-spacing: .12em; }
.pointage-state span.is-done { color: #16836f; }
.pointage-state strong { margin: 5px 0 2px; color: var(--navy); font-size: 1.55rem; }
.pointage-state small { color: var(--muted); }
.pointage-line { height: 2px; background: linear-gradient(90deg, var(--turquoise), #c8dce5); }
.pointage-live form { justify-self: end; }
.pointage-complete {
    display: inline-flex;
    padding: 10px 14px;
    border-radius: 12px;
    color: #0c715e;
    background: #dff5ed;
    font-weight: 800;
}
.pointage-month { margin: 12px 3px 0; color: var(--muted); font-size: .72rem; }
.pointage-month strong { color: var(--ink); }

.companion-route-grid { display: grid; gap: 16px; margin-top: 16px; }
.companion-route {
    overflow: hidden;
    border: 1px solid #dce6eb;
    border-radius: 18px;
    background: #fff;
}
.companion-route > header {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: #fff;
    background: linear-gradient(135deg, var(--navy), #145f85);
}
.companion-route > header > span {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: var(--navy);
    background: var(--turquoise);
    font-size: .62rem;
    font-weight: 900;
}
.companion-route > header strong,
.companion-route > header small { display: block; }
.companion-route > header small { margin-top: 3px; color: #d1e4ed; }
.companion-route > header b { padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.12); font-size: .67rem; }
.companion-roster { display: grid; }
.companion-student {
    display: grid;
    grid-template-columns: minmax(210px, .9fr) 1.6fr;
    align-items: center;
    gap: 14px;
    padding: 13px 15px;
    border-bottom: 1px solid #e4ebef;
}
.companion-student:last-child { border-bottom: 0; }
.companion-student-name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.companion-student-name > span,
.transport-roster-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 11px;
    color: #176b65;
    background: #dcf3ee;
    font-size: .62rem;
    font-weight: 900;
}
.companion-student-name strong,
.companion-student-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.companion-student-name small { margin-top: 3px; color: var(--muted); font-size: .62rem; }
.transport-step-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.transport-step-actions button {
    width: 100%;
    min-height: 34px;
    padding: 6px 7px;
    border: 1px solid #cfdce3;
    border-radius: 9px;
    color: #33536b;
    background: #f8fafb;
    cursor: pointer;
    font-size: .58rem;
    font-weight: 800;
}
.transport-step-actions button:hover { border-color: var(--turquoise); background: #edf9f6; }
.transport-step-actions button.is-complete {
    border-color: #9bd4c8;
    color: #08715e;
    background: #dff5ee;
    cursor: default;
}

.student-transport-card.has-route { border-top: 4px solid var(--turquoise); }
.student-transport-route { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 15px; color: #fff; background: linear-gradient(135deg, var(--navy), #156185); }
.student-transport-route > span { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--navy); background: var(--turquoise); font-size: .62rem; font-weight: 900; }
.student-transport-route strong,
.student-transport-route small { display: block; }
.student-transport-route small { margin-top: 3px; color: #d4e7ee; }
.student-transport-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 11px; }
.student-transport-details > div { padding: 10px 12px; border: 1px solid #e0e8ed; border-radius: 12px; background: #f9fbfc; }
.student-transport-details small,
.student-transport-details strong { display: block; }
.student-transport-details small { color: var(--muted); font-size: .58rem; text-transform: uppercase; }
.student-transport-details strong { margin-top: 4px; font-size: .74rem; }
.transport-driver { margin: 10px 2px 0; color: var(--muted); font-size: .67rem; }
.teacher-payslip-list { display: grid; }
.teacher-payslip-list > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid #e5ebef; }
.teacher-payslip-list > div:last-child { border-bottom: 0; }
.teacher-payslip-list strong,
.teacher-payslip-list small { display: block; }
.teacher-payslip-list small { margin-top: 3px; color: var(--muted); }

.transport-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.transport-summary article { display: flex; align-items: center; gap: 12px; padding: 15px; border: 1px solid #dfe8ec; border-radius: 16px; background: #fff; }
.transport-summary article > span { width: 40px; height: 40px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; color: #146f68; background: #ddf4ef; font-size: .62rem; font-weight: 900; }
.transport-summary small,
.transport-summary strong { display: block; }
.transport-summary small { color: var(--muted); font-size: .62rem; }
.transport-summary strong { margin-top: 3px; font-size: 1.12rem; }
.transport-create-card { margin-bottom: 18px; }
.route-grid-detailed { grid-template-columns: 1fr; }
.route-head small { display: block; margin-top: 4px; color: var(--muted); }
.transport-roster-admin { display: grid; margin: 15px 0; border: 1px solid #e0e8ed; border-radius: 14px; overflow: hidden; }
.transport-roster-admin > div {
    display: grid;
    grid-template-columns: 36px minmax(190px, 1fr) 70px 70px auto;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #e5ecef;
}
.transport-roster-admin > div:last-child { border-bottom: 0; }
.transport-roster-admin strong,
.transport-roster-admin small,
.transport-times strong,
.transport-times small { display: block; }
.transport-roster-admin small,
.transport-times small { color: var(--muted); font-size: .58rem; }
.transport-times strong { margin-top: 3px; font-size: .7rem; }
.transport-assignment-form { padding: 16px; border-radius: 15px; background: #f5f9fa; }
.transport-assignment-form h4 { margin: 0 0 12px; color: var(--navy); }

.student-exit-meta { display: block; min-width: 120px; margin-top: 4px; color: var(--muted); font-size: .55rem; }
.student-exit-menu { position: relative; }
.student-exit-menu summary { list-style: none; cursor: pointer; white-space: nowrap; }
.student-exit-menu summary::-webkit-details-marker { display: none; }
.student-exit-menu form {
    position: absolute;
    z-index: 20;
    right: 0;
    top: calc(100% + 6px);
    width: 260px;
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid #dce5ea;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 42, 65, .18);
}
.student-exit-menu label { display: grid; gap: 4px; color: var(--muted); font-size: .59rem; }
.student-exit-menu input,
.student-exit-menu select { width: 100%; min-height: 34px; padding: 6px 8px; border: 1px solid #d7e1e6; border-radius: 8px; }

@media (max-width: 980px) {
    .pointage-live { grid-template-columns: 1fr 40px 1fr; }
    .pointage-live form { grid-column: 1 / -1; justify-self: stretch; }
    .pointage-live form .btn,
    .pointage-complete { width: 100%; justify-content: center; text-align: center; }
    .companion-student { grid-template-columns: 1fr; }
    .transport-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .pointage-live { grid-template-columns: 1fr 18px 1fr; gap: 8px; padding: 13px; }
    .pointage-state strong { font-size: 1.25rem; }
    .pointage-state small { font-size: .55rem; }
    .transport-step-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .companion-route > header { grid-template-columns: 38px 1fr; }
    .companion-route > header b { grid-column: 1 / -1; text-align: center; }
    .transport-summary { grid-template-columns: 1fr; }
    .transport-roster-admin { overflow-x: auto; }
    .transport-roster-admin > div { min-width: 670px; }
    .student-transport-details { grid-template-columns: 1fr; }
    .teacher-payslip-list > div { align-items: stretch; flex-direction: column; }
    .student-exit-menu form { position: fixed; inset: auto 12px 12px; width: auto; }
}
