:root {
    --navy: #102b50;
    --navy-soft: #18466e;
    --gold: #e8ae40;
    --gold-soft: #fff3d9;
    --green: #078271;
    --green-soft: #e4f7f1;
    --red: #b64455;
    --red-soft: #fff0f2;
    --ink: #152f50;
    --muted: #667b92;
    --line: #d8e5ed;
    --surface: #ffffff;
    --canvas: #f4f8fb;
    --shadow: 0 18px 45px rgba(16, 43, 80, .08);
    font-family: Tahoma, Arial, sans-serif;
}

.member-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.member-security-guide,
.member-create-panel,
.member-list-panel {
    margin-top: 1.25rem;
}

.member-create-form {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 1rem;
    align-items: end;
}

.member-create-form .button {
    min-height: 3rem;
}

.member-list {
    display: grid;
    gap: 1rem;
}

.member-card {
    border: 1px solid var(--line);
    border-radius: 1rem;
    padding: 1rem;
    background: #f8fafc;
}

.member-card > header,
.member-card .title-line,
.member-edit-form {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.member-card > header {
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.member-card h3,
.member-card p {
    margin: 0;
}

.member-card p {
    margin-top: 0.35rem;
    color: var(--muted);
}

.member-edit-form {
    align-items: end;
    flex-wrap: wrap;
}

.member-edit-form .field {
    min-width: 13rem;
    flex: 1;
}

.member-protected-note {
    border: 1px dashed var(--line);
    border-radius: 0.8rem;
    padding: 0.8rem;
    color: var(--muted);
}

@media (max-width: 1050px) {
    .member-create-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .member-stats,
    .member-create-form {
        grid-template-columns: 1fr;
    }

    .member-card > header,
    .member-edit-form {
        align-items: stretch;
        flex-direction: column;
    }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); line-height: 1.7; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.container { width: min(1160px, calc(100% - 32px)); margin-inline: auto; }
.page-shell { padding: 42px 0 70px; }
.auth-page { background: linear-gradient(135deg, #eef2f5, #f8f4eb); min-height: 100vh; }
.auth-page .page-shell { display: flex; align-items: center; min-height: 100vh; }

.topbar { position: sticky; top: 0; z-index: 20; background: linear-gradient(110deg, var(--navy), #174f76); color: #fff; box-shadow: 0 10px 28px rgba(16, 43, 80, .17); }
.topbar-inner { min-height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand small { display: block; }
.brand small { color: #c9dce9; font-size: .76rem; }
.brand-mark { width: 44px; height: 44px; border-radius: 15px; background: linear-gradient(135deg, var(--gold), #f3ca68); color: var(--navy); display: inline-grid; place-items: center; font-weight: 900; font-size: 1.32rem; box-shadow: 0 8px 18px rgba(0,0,0,.14), inset 0 0 0 1px rgba(255,255,255,.42); }
.brand-mark-large { width: 64px; height: 64px; border-radius: 19px; font-size: 1.8rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.school-chip { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); padding: 6px 12px; border-radius: 999px; font-size: .82rem; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-name { color: #e2e8f0; font-size: .9rem; }

.alert { border-radius: 14px; padding: 14px 18px; margin-bottom: 22px; border: 1px solid; }
.alert ul { margin: 6px 0 0; padding-right: 20px; }
.alert-success { background: var(--green-soft); border-color: #a9d7c9; color: #155f4e; }
.alert-error { background: var(--red-soft); border-color: #e8b3ba; color: #87313a; }
.alert-warning { background: var(--gold-soft); border-color: #dfc889; color: #72531d; }

.eyebrow { color: var(--gold); font-weight: 800; font-size: .82rem; letter-spacing: .02em; }
h1, h2, h3, p { margin-top: 0; }
h1 { color: var(--navy); font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.35; margin-bottom: 12px; }
h2 { color: var(--navy); line-height: 1.4; }
p { color: var(--muted); }

.setup-wrap, .auth-wrap { display: grid; grid-template-columns: .85fr 1.35fr; gap: 34px; align-items: start; }
.auth-wrap { max-width: 930px; margin: auto; grid-template-columns: 1fr .85fr; align-items: center; }
.intro-card, .auth-brand { padding: 34px 14px; position: sticky; top: 28px; }
.security-note { display: grid; gap: 4px; padding: 18px; margin-top: 28px; background: rgba(255,255,255,.62); border: 1px solid rgba(180,139,60,.25); border-radius: 16px; }
.security-note span { color: var(--muted); font-size: .88rem; }
.form-card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.form-card { padding: 30px; }
.login-card { display: grid; gap: 19px; }
.form-section + .form-section { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 30px; }
.section-heading { display: flex; gap: 13px; margin-bottom: 23px; }
.section-heading h2 { margin-bottom: 2px; font-size: 1.25rem; }
.section-heading p { margin: 0; font-size: .9rem; }
.step-number { flex: 0 0 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--gold-soft); color: #8d6826; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field { display: grid; gap: 7px; color: var(--navy); font-weight: 700; font-size: .9rem; }
.field-wide { grid-column: 1 / -1; }
.field span small { color: var(--muted); font-weight: 400; }
.field input, .field select { width: 100%; border: 1px solid #cbd5e1; background: #fbfcfd; color: var(--ink); padding: 12px 13px; border-radius: 11px; outline: none; transition: .2s; }
.field input:focus, .field select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(180,139,60,.14); background: #fff; }
.field input:disabled { background: #eef2f6; color: #64748b; cursor: not-allowed; }
.field > small { color: var(--muted); font-weight: 400; font-size: .76rem; }
.checkbox-field { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: .88rem; }
.checkbox-field input { accent-color: var(--navy); width: 17px; height: 17px; }
.form-footnote { text-align: center; font-size: .78rem; margin: 0; }

.button { border: 0; border-radius: 11px; padding: 11px 18px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform .15s, opacity .15s; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--navy); color: #fff; }
.button-secondary { background: var(--gold-soft); color: #73551f; }
.button-danger { background: var(--red); color: #fff; }
.button-ghost { color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.25); }
.button-small { padding: 7px 12px; font-size: .82rem; }
.button-full { width: 100%; margin-top: 26px; padding: 14px; }

.content-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.content-heading h1 { margin-bottom: 5px; }
.content-heading p { margin-bottom: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 20px; display: grid; gap: 3px; }
.stat-card span, .stat-card small { color: var(--muted); }
.stat-card strong { color: var(--navy); font-size: 2rem; }
.stat-card .status-text { font-size: 1.25rem; margin-top: 8px; }
.panel { padding: 26px; position: relative; overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 22px; }
.panel-heading h2 { margin-bottom: 4px; }
.panel-heading p { margin: 0; }
.progress-badge { background: var(--green-soft); color: var(--green); padding: 6px 11px; border-radius: 999px; font-size: .8rem; font-weight: 800; }
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 14px; }
.service-card { border: 1px solid var(--line); border-radius: 18px; padding: 18px; min-height: 205px; display: flex; flex-direction: column; background: linear-gradient(145deg, #fff, #f8fbfc); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.service-card:hover { transform: translateY(-3px); box-shadow: 0 14px 27px rgba(16,43,80,.10); border-color: #9bcfc4; }
.service-card-active { border-color: #b9dfd5; background: linear-gradient(145deg, #fff, #f2fbf8); }
.service-card h3 { margin: 14px 0 7px; font-size: 1.03rem; }
.service-card p { font-size: .85rem; flex: 1; }
.service-number { color: var(--gold); font-weight: 800; font-size: .78rem; }
.service-link { color: var(--navy); font-weight: 800; font-size: .85rem; }
.service-muted { color: #94a3b8; font-size: .8rem; }

.school-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.school-card { border: 1px solid var(--line); border-radius: 18px; background: #fff; padding: 22px; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; box-shadow: var(--shadow); }
.school-card .button { grid-column: 1 / -1; }
.school-card-icon { width: 52px; height: 52px; border-radius: 15px; background: var(--gold-soft); color: #856323; display: grid; place-items: center; font-weight: 900; font-size: 1.2rem; }
.school-card h2 { margin-bottom: 1px; font-size: 1.15rem; }
.school-card p, .school-card small { margin: 0; color: var(--muted); }

.empty-state { max-width: 650px; margin: 70px auto; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 45px 25px; }
.error-code { display: block; color: var(--gold); font-size: 3rem; font-weight: 900; }
.placeholder-panel { text-align: center; max-width: 760px; margin-inline: auto; }
.success-icon { width: 58px; height: 58px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 1.7rem; font-weight: 900; }
.details-list { margin: 28px 0 0; display: grid; gap: 10px; text-align: right; }
.details-list > div { display: flex; justify-content: space-between; gap: 20px; padding: 12px 14px; background: #f7f9fb; border-radius: 11px; }
.details-list dt { color: var(--muted); }
.details-list dd { margin: 0; color: var(--navy); font-weight: 800; }

.settings-nav { display: flex; flex-wrap: wrap; gap: 10px; margin: -10px 0 24px; }
.settings-nav a { padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--navy); font-size: .86rem; font-weight: 800; }
.settings-section { margin-bottom: 24px; scroll-margin-top: 20px; }
.settings-section .panel-heading > div:first-child { position: relative; padding-right: 48px; }
.settings-section .panel-heading .step-number { position: absolute; right: 0; top: 0; }
.settings-section .panel-heading h2 { margin-bottom: 4px; }
.status-pill { display: inline-flex; align-items: center; white-space: nowrap; padding: 5px 10px; border-radius: 999px; background: #eef2f6; color: var(--muted); font-size: .76rem; font-weight: 800; }
.status-complete { background: var(--green-soft); color: var(--green); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 22px; }
.compact-form { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 13px; align-items: end; padding: 18px; border-radius: 15px; background: #f7f9fb; border: 1px solid #e7ecf1; }
.compact-form .button { min-height: 48px; }
.inline-empty { margin-top: 18px; padding: 20px; text-align: center; border: 1px dashed #cbd5e1; border-radius: 14px; color: var(--muted); }
.year-list { display: grid; gap: 16px; margin-top: 18px; }
.year-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #fcfdfe; }
.year-card-current { border-color: #a9d7c9; box-shadow: inset 4px 0 0 var(--green); }
.year-card-heading, .title-line, .term-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.year-card-heading h3, .title-line h3 { margin: 0; }
.year-card-heading p { margin: 4px 0 0; font-size: .82rem; }
.title-line { justify-content: flex-start; }
.term-list { display: grid; gap: 8px; margin: 17px 0; }
.term-row { padding: 11px 13px; border-radius: 11px; background: #fff; border: 1px solid #e7ecf1; }
.term-row strong, .term-row small { display: block; }
.term-row small, .muted-note { color: var(--muted); }
.muted-note { margin: 0; font-size: .85rem; }
.text-button { border: 0; background: transparent; cursor: pointer; font-weight: 800; padding: 5px; }
.text-button-danger { color: var(--red); }
.term-form { grid-template-columns: 1.2fr 1fr 1fr auto; padding: 14px; }
.days-fieldset { margin: 0 0 22px; padding: 0; border: 0; }
.days-fieldset legend { color: var(--navy); font-weight: 800; margin-bottom: 10px; }
.day-options { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-option { cursor: pointer; }
.day-option input { position: absolute; opacity: 0; pointer-events: none; }
.day-option span { display: block; padding: 10px 6px; text-align: center; border: 1px solid var(--line); border-radius: 11px; background: #fafbfc; color: var(--muted); font-weight: 800; font-size: .84rem; transition: .15s; }
.day-option input:checked + span { border-color: #9acdbc; background: var(--green-soft); color: var(--green); box-shadow: inset 0 0 0 1px #9acdbc; }
.day-option input:focus-visible + span { outline: 3px solid rgba(180,139,60,.25); }
.schedule-form-grid { grid-template-columns: repeat(5, 1fr); }
.period-preview { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; }
.period-preview h3 { margin-bottom: 12px; }
.period-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.period-item { display: grid; gap: 2px; padding: 11px 12px; border-radius: 11px; background: #f7f9fb; }
.period-item strong { color: var(--navy); font-size: .86rem; }
.period-item span { color: var(--muted); font-size: .8rem; text-align: right; }
.info-callout { margin-bottom: 18px; padding: 15px 17px; border: 1px solid #b9d9cf; border-radius: 14px; background: #f0f8f5; }
.info-callout strong { display: block; color: var(--green); margin-bottom: 2px; }
.info-callout p { margin: 0; font-size: .84rem; }
.profile-create-form { grid-template-columns: 1.4fr 1.4fr 1fr 1fr auto; }
.profile-list { display: grid; gap: 20px; margin-top: 20px; }
.schedule-profile-card { padding: 22px; border: 1px solid #ccd7e2; border-radius: 18px; background: #fcfdff; box-shadow: 0 10px 30px rgba(23, 37, 61, .05); }
.schedule-profile-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.schedule-profile-heading h3 { margin: 0; font-size: 1.2rem; }
.schedule-profile-heading p { margin: 5px 0 0; font-size: .86rem; }
.schedule-profile-heading small { color: var(--muted); }
.profile-settings-details { margin-top: 16px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.profile-settings-details summary { padding: 11px 14px; cursor: pointer; color: var(--navy); font-weight: 800; font-size: .84rem; }
.profile-edit-form { margin: 0 13px 13px; grid-template-columns: repeat(2, 1fr); }
.profile-enabled-field { align-self: center; color: var(--navy); font-weight: 800; }
.schedule-builder { margin-top: 18px; padding: 19px; border-radius: 15px; background: #f7f9fb; border: 1px solid #e2e8ef; }
.schedule-builder h4, .configured-days h4 { margin: 0 0 3px; color: var(--navy); }
.schedule-builder > p { margin: 0 0 16px; font-size: .84rem; }
.flexible-schedule-grid { grid-template-columns: repeat(4, 1fr); }
.breaks-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 16px; }
.break-card { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 0; padding: 14px; border: 1px solid #d9e1e9; border-radius: 13px; background: #fff; }
.break-card legend { padding: 0 7px; color: var(--navy); font-weight: 800; }
.break-card legend small { color: var(--muted); font-weight: 400; }
.form-actions-between { align-items: center; justify-content: space-between; gap: 16px; }
.form-actions-between small { color: var(--muted); max-width: 620px; }
.configured-days { margin-top: 22px; }
.configured-day-card { margin-top: 11px; padding: 15px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.configured-day-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.configured-day-heading strong, .configured-day-heading small { display: block; }
.configured-day-heading strong { color: var(--navy); }
.configured-day-heading small { color: var(--muted); }
.slot-timeline { display: flex; flex-wrap: wrap; gap: 7px; direction: rtl; }
.slot-chip { min-width: 102px; padding: 8px 10px; border-radius: 10px; display: grid; gap: 1px; border: 1px solid; }
.slot-chip strong { font-size: .75rem; }
.slot-chip span { font-size: .72rem; text-align: right; }
.slot-lesson { background: #f7f9fb; border-color: #d6dee7; color: var(--navy); }
.slot-break { background: var(--gold-soft); border-color: #e1c98f; color: #79591f; }
.slot-transition { min-width: 88px; background: var(--green-soft); border-color: #b6dacd; color: var(--green); }
.stage-create-form { grid-template-columns: 1fr 1.25fr 1.5fr auto; }
.profile-link-field { min-width: 0; margin: 0; padding: 10px 12px; border: 1px solid #cbd5e1; border-radius: 11px; background: #fff; display: flex; flex-wrap: wrap; gap: 7px 14px; }
.profile-link-field legend { padding: 0 5px; color: var(--navy); font-size: .82rem; font-weight: 800; }
.profile-link-field small { color: var(--muted); }
.profile-link-field .checkbox-field { color: var(--navy); }
.stage-list { display: grid; gap: 20px; margin-top: 20px; }
.stage-card { padding: 22px; border: 1px solid #ccd7e2; border-radius: 18px; background: #fcfdff; box-shadow: 0 10px 30px rgba(23, 37, 61, .05); }
.stage-card-heading, .grade-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.stage-card-heading h3 { margin: 0; }
.stage-card-heading p { margin: 4px 0 0; font-size: .84rem; }
.stage-card-heading small { color: var(--muted); }
.stage-card-heading small strong { color: var(--navy); }
.stage-edit-form { margin: 0 13px 13px; grid-template-columns: 1.2fr 1.5fr auto auto; }
.grade-tools { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: end; gap: 13px; margin-top: 18px; padding: 16px; border: 1px solid #e2e8ef; border-radius: 14px; background: #f7f9fb; }
.inline-create-form { display: grid; grid-template-columns: minmax(180px, 1fr) auto; align-items: end; gap: 11px; }
.grade-list { display: grid; gap: 13px; margin-top: 17px; }
.grade-card { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.grade-card-heading strong, .grade-card-heading small { display: block; }
.grade-card-heading strong { color: var(--navy); }
.grade-card-heading small { color: var(--muted); font-size: .76rem; }
.grade-edit-details { margin: 12px 0; padding: 0 12px 10px; border: 1px solid #e7ecf1; border-radius: 12px; background: #fafbfc; }
.grade-edit-details summary { padding: 9px 0; cursor: pointer; color: var(--navy); font-size: .8rem; font-weight: 800; }
.grade-edit-details .inline-create-form { grid-template-columns: 1fr auto auto; margin-bottom: 5px; }
.section-create-form { display: grid; grid-template-columns: 1.5fr .75fr auto; gap: 11px; align-items: end; padding: 14px; border-radius: 13px; background: #f7f9fb; }
.section-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
.section-item { padding: 10px 12px; border: 1px solid #e0e7ee; border-radius: 12px; background: #fcfdff; }
.section-item summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; color: var(--muted); font-size: .78rem; }
.section-item summary strong { color: var(--navy); }
.section-edit-form { display: grid; grid-template-columns: 1fr .75fr; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #e7ecf1; }
.section-edit-form .checkbox-field { align-self: center; }
.workforce-stats { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.whatsapp-callout { display: flex; align-items: center; gap: 14px; margin-bottom: 25px; padding: 16px 18px; border: 1px solid #9fd4bd; border-radius: 16px; background: #edf9f3; }
.whatsapp-callout p { margin: 2px 0 0; font-size: .84rem; }
.whatsapp-callout strong { color: #176646; }
.whatsapp-mark { flex: 0 0 43px; height: 43px; display: grid; place-items: center; border-radius: 50%; background: #23a765; color: #fff; font-size: 1.25rem; font-weight: 900; }
.import-safety-note { display: grid; gap: 2px; margin-bottom: 15px; padding: 13px 15px; border-right: 4px solid var(--gold); border-radius: 10px; background: #fffbf2; }
.import-safety-note strong { color: var(--navy); }
.import-safety-note span { color: var(--muted); font-size: .82rem; }
.import-upload-form { display: grid; grid-template-columns: 1fr 1.6fr auto auto; align-items: end; gap: 12px; padding: 18px; border: 1px solid #e2e8ef; border-radius: 15px; background: #f7f9fb; }
.import-preview { margin-top: 20px; padding: 19px; border: 1px solid #a9d7c9; border-radius: 16px; background: #fbfffd; }
.import-preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.import-preview-heading h3 { margin: 0; color: var(--navy); }
.import-preview-heading p { margin: 4px 0 0; font-size: .84rem; }
.mapping-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; margin: 18px 0; }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.preview-table { width: 100%; border-collapse: collapse; font-size: .8rem; white-space: nowrap; }
.preview-table th, .preview-table td { padding: 9px 11px; border-bottom: 1px solid #e7ecf1; text-align: right; }
.preview-table th { background: #f3f6f9; color: var(--navy); }
.import-history { margin-top: 20px; }
.import-history h3 { color: var(--navy); font-size: 1rem; }
.import-history-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 10px 12px; border-top: 1px solid #e7ecf1; font-size: .8rem; }
.import-history-row strong, .import-history-row small { display: block; }
.import-history-row small, .import-history-row > span { color: var(--muted); }
.subject-create-form { grid-template-columns: 1.5fr 1fr .8fr auto; }
.subject-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.subject-item { padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fcfdff; }
.subject-item summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; color: var(--muted); font-size: .78rem; }
.subject-item summary strong { color: var(--navy); }
.subject-edit-form { display: grid; gap: 9px; margin-top: 12px; padding-top: 12px; border-top: 1px solid #e7ecf1; }
.teacher-create-details { margin-bottom: 17px; border: 1px solid #cbd7e2; border-radius: 15px; background: #f9fbfd; }
.teacher-create-details > summary { padding: 13px 16px; cursor: pointer; color: var(--navy); font-weight: 800; }
.teacher-form { padding: 17px; border-top: 1px solid #e2e8ef; }
.teacher-basic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.teacher-relations-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; margin-top: 16px; }
.teacher-consent-row { display: grid; grid-template-columns: 1.2fr 1fr; gap: 15px; align-items: end; margin-top: 16px; }
.teacher-notes-field { min-width: 0; }
.teacher-list { display: grid; gap: 13px; }
.teacher-card { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.teacher-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.teacher-card-heading h3 { margin: 0; }
.teacher-card-heading p { margin: 4px 0 0; font-size: .84rem; }
.teacher-contact-summary { text-align: left; }
.teacher-contact-summary strong, .teacher-contact-summary small { display: block; }
.teacher-contact-summary strong { color: var(--navy); }
.teacher-contact-summary small { color: var(--muted); font-size: .74rem; }
.teacher-tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.teacher-tags span { padding: 4px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: .74rem; font-weight: 800; }
.teacher-tags .subject-tag { background: var(--gold-soft); color: #765820; }
.teacher-edit-details { margin-top: 13px; border-top: 1px solid #e7ecf1; }
.teacher-edit-details > summary { padding-top: 11px; cursor: pointer; color: var(--navy); font-size: .82rem; font-weight: 800; }
.teacher-edit-details .teacher-form { margin-top: 10px; border: 1px solid #e2e8ef; border-radius: 13px; background: #f9fbfd; }
.teacher-account-details { margin-top: 13px; border: 1px solid #c9ded6; border-radius: 13px; background: #f7fcfa; }
.teacher-account-details > summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 13px; cursor: pointer; color: var(--navy); font-size: .82rem; font-weight: 800; }
.teacher-account-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: end; gap: 10px; padding: 13px; border-top: 1px solid #dce9e4; }
.teacher-account-form > small { grid-column: 1 / -1; color: var(--muted); }
.teacher-account-current { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px; border-top: 1px solid #dce9e4; }
.teacher-account-current strong, .teacher-account-current small { display: block; }
.teacher-account-current small { margin-top: 3px; color: var(--muted); font-size: .74rem; }
.heading-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.curriculum-stats { margin-bottom: 18px; }
.curriculum-preset-panel { margin-bottom: 24px; }
.official-plan-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; padding: 20px; border: 1px solid #ddc68f; border-radius: 16px; background: #fffbf2; }
.official-plan-card.official-plan-applied { border-color: #a9d7c9; background: #f5fbf8; }
.official-plan-card h3 { margin: 10px 0 4px; color: var(--navy); }
.official-plan-card p { max-width: 820px; margin-bottom: 10px; font-size: .86rem; }
.official-plan-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.official-plan-facts span { padding: 7px 10px; border-radius: 10px; background: rgba(255,255,255,.8); border: 1px solid rgba(180,139,60,.2); color: var(--muted); font-size: .78rem; }
.official-plan-facts strong { color: var(--navy); }
.official-source-link { color: #765820; font-size: .78rem; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.curriculum-create-panel { margin-bottom: 24px; }
.curriculum-create-form { display: grid; grid-template-columns: 1.35fr 1.2fr .75fr .75fr 1.25fr auto; align-items: end; gap: 12px; padding: 18px; border: 1px solid #e2e8ef; border-radius: 15px; background: #f7f9fb; }
.curriculum-checkbox { min-height: 48px; padding: 0 4px; }
.curriculum-list-panel { display: grid; gap: 19px; }
.curriculum-list-panel > .panel-heading { margin-bottom: 3px; }
.curriculum-stage-card { padding: 19px; border: 1px solid #ccd7e2; border-radius: 18px; background: #fbfcfe; }
.curriculum-stage-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.curriculum-stage-heading h3, .curriculum-grade-heading h3 { margin: 0; color: var(--navy); }
.curriculum-stage-heading p, .curriculum-grade-heading p { margin: 3px 0 0; font-size: .8rem; }
.schedule-capacity-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.schedule-capacity-item { display: grid; gap: 1px; min-width: 220px; padding: 9px 12px; border: 1px solid; border-radius: 11px; font-size: .76rem; }
.schedule-capacity-item strong { color: var(--navy); }
.schedule-capacity-item span { color: var(--muted); }
.schedule-capacity-ok { border-color: #b4dacd; background: #f0f8f5; }
.schedule-capacity-warning { border-color: #e0c57d; background: #fff9eb; }
.curriculum-grade-card { margin-top: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.curriculum-grade-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.requirement-list { display: grid; gap: 10px; margin-top: 14px; }
.requirement-card { border: 1px solid #dce4eb; border-radius: 13px; background: #fcfdff; overflow: hidden; }
.requirement-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 15px; cursor: pointer; }
.requirement-card > summary strong, .requirement-card > summary small { display: block; }
.requirement-card > summary strong { color: var(--navy); }
.requirement-card > summary small { color: var(--muted); font-size: .75rem; }
.requirement-card > summary .official-requirement-label { color: var(--green); font-weight: 800; }
.requirement-body { padding: 15px; border-top: 1px solid #e5ebf0; background: #fff; }
.requirement-tools { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: end; padding: 13px; border-radius: 12px; background: #f7f9fb; }
.requirement-edit-form { display: grid; grid-template-columns: .65fr .65fr auto auto auto auto; gap: 10px; align-items: end; }
.requirement-side-actions { display: flex; align-items: center; gap: 8px; }
.assignment-list { display: grid; gap: 9px; margin-top: 13px; }
.assignment-row { display: grid; grid-template-columns: .65fr 1.4fr .55fr 1.2fr auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid #e2e8ef; border-radius: 12px; background: #fcfdff; }
.assignment-section-name { align-self: center; }
.assignment-section-name strong, .assignment-section-name small { display: block; }
.assignment-section-name strong { color: var(--navy); }
.assignment-section-name small { color: var(--muted); font-size: .75rem; }
.assignment-periods-field { max-width: 110px; }

.constraint-stats { grid-template-columns: repeat(4, 1fr); }
.constraint-time-callout { margin-top: 18px; }
.standby-callout { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 16px 18px; border: 1px solid #e0c57d; border-radius: 14px; background: #fff9eb; }
.standby-callout strong { display: block; color: #79591f; }
.standby-callout p { margin: 3px 0 0; font-size: .84rem; }
.standby-mark { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border-radius: 50%; color: #79591f; background: #f3e2b7; font-weight: 900; }
.constraint-rule-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.constraint-guide-item { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fbfcfe; }
.constraint-guide-item p { margin: 8px 0 0; font-size: .8rem; }
.rule-type-badge { display: inline-flex; align-items: center; width: fit-content; padding: 5px 9px; border-radius: 999px; font-size: .73rem; font-weight: 900; }
.rule-type-unavailable { color: #9e2f2f; background: #fdeaea; }
.rule-type-avoid { color: #79591f; background: #fff1c9; }
.rule-type-prefer { color: var(--green); background: var(--green-soft); }
.constraint-teacher-list { display: grid; gap: 20px; margin-top: 20px; }
.teacher-constraint-card { scroll-margin-top: 90px; }
.teacher-constraint-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.teacher-constraint-heading h2 { margin: 7px 0 0; }
.teacher-constraint-heading p { margin: 4px 0 0; font-size: .84rem; }
.teacher-constraint-tags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.teacher-constraint-tags span { padding: 5px 9px; border-radius: 999px; color: #79591f; background: var(--gold-soft); font-size: .72rem; font-weight: 800; }
.constraint-card-body { display: grid; gap: 18px; }
.constraint-policy-section, .constraint-rules-section { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #fbfcfe; }
.constraint-subheading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.constraint-subheading > div { display: flex; align-items: center; gap: 9px; }
.constraint-subheading h3 { margin: 0; color: var(--navy); }
.constraint-subheading small { color: var(--muted); }
.constraint-policy-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; }
.constraint-standby-field { min-height: 48px; }
.constraint-notes-field { grid-column: span 2; }
.constraint-rule-form { display: grid; grid-template-columns: 1fr .8fr .75fr .75fr .8fr 1.3fr auto; gap: 10px; align-items: end; }
.constraint-full-day-field { min-height: 48px; }
.constraint-rule-list { display: grid; gap: 8px; margin-top: 15px; }
.constraint-rule-row { display: grid; grid-template-columns: auto .65fr .8fr 1.4fr auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #dce4eb; border-radius: 11px; background: #fff; }
.constraint-rule-row > span:not(.rule-type-badge), .constraint-rule-row small { color: var(--muted); font-size: .78rem; }

.facility-stats { grid-template-columns: repeat(4, 1fr); }
.stat-card-warning { border-color: #e0c57d; background: #fffaf0; }
.facility-conflict-callout { margin-top: 18px; }
.facility-create-details { margin-bottom: 18px; border: 1px solid #ccd7e2; border-radius: 14px; background: #fbfcfe; }
.facility-create-details > summary { padding: 13px 16px; cursor: pointer; color: var(--navy); font-weight: 900; }
.facility-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; align-items: end; padding: 16px; border-top: 1px solid var(--line); }
.facility-stage-fieldset { grid-column: span 2; min-width: 0; margin: 0; padding: 12px 14px; border: 1px solid #d6dee7; border-radius: 12px; background: #fff; }
.facility-stage-fieldset legend { padding: 0 6px; color: var(--navy); font-size: .84rem; font-weight: 800; }
.facility-stage-fieldset legend small { color: var(--muted); font-weight: 400; }
.facility-stage-options { display: flex; flex-wrap: wrap; gap: 12px 18px; }
.facility-notes-field { grid-column: span 2; }
.facility-list { display: grid; gap: 11px; }
.facility-card { border: 1px solid #dce4eb; border-radius: 14px; background: #fcfdff; overflow: hidden; }
.facility-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; cursor: pointer; }
.facility-card > summary > div:first-child { display: flex; align-items: center; gap: 11px; }
.facility-card > summary strong, .facility-card > summary small { display: block; }
.facility-card > summary small { margin-top: 2px; color: var(--muted); font-size: .76rem; }
.facility-type-mark { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 12px; color: #79591f; background: var(--gold-soft); font-weight: 900; }
.facility-summary-status { text-align: left; }
.facility-edit-form { border-top: 1px solid var(--line); background: #fff; }
.facility-card > form:last-child, .facility-requirement-card > form:last-child { padding: 0 16px 14px; background: #fff; }
.facility-active-field { min-height: 48px; }
.facility-requirement-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: end; padding: 16px; border: 1px solid #dce4eb; border-radius: 14px; background: #fbfcfe; }
.facility-requirement-notes { grid-column: span 2; }
.facility-form-hint { margin: 8px 4px 0; font-size: .76rem; }
.facility-requirement-list { display: grid; gap: 11px; margin-top: 18px; }
.facility-requirement-card { border: 1px solid #dce4eb; border-radius: 14px; background: #fcfdff; overflow: hidden; }
.facility-requirement-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; cursor: pointer; }
.facility-requirement-card > summary > div { display: flex; align-items: center; gap: 10px; }
.facility-requirement-card > summary strong, .facility-requirement-card > summary small { display: block; }
.facility-requirement-card > summary small { margin-top: 3px; color: var(--muted); font-size: .76rem; }
.facility-requirement-uncovered { border-color: #e0c57d; background: #fffaf0; }
.requirement-priority, .availability-pill { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 900; }
.requirement-priority-required { color: #9e2f2f; background: #fdeaea; }
.requirement-priority-preferred { color: var(--green); background: var(--green-soft); }
.availability-ready { color: var(--green); background: var(--green-soft); }
.availability-missing { color: #79591f; background: #fff1c9; }
.facility-requirement-edit-form { border-width: 1px 0 0; border-radius: 0; background: #fff; }

.timetable-readiness-hero { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 22px; margin-bottom: 22px; padding: 22px; border: 1px solid; border-radius: 20px; box-shadow: var(--shadow); }
.readiness-hero-ready { border-color: #acd4c5; background: #f1f9f6; }
.readiness-hero-blocked { border-color: #e0c57d; background: #fffaf0; }
.readiness-score { display: grid; place-items: center; align-content: center; width: 92px; height: 92px; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--score) * 1%), #e6ebef 0); position: relative; }
.readiness-score::after { content: ''; position: absolute; inset: 8px; border-radius: 50%; background: #fff; }
.readiness-score strong, .readiness-score span { position: relative; z-index: 1; }
.readiness-score strong { color: var(--navy); font-size: 1.35rem; line-height: 1; }
.readiness-score span { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.timetable-readiness-hero h2 { margin: 8px 0 3px; }
.timetable-readiness-hero p { margin: 0; font-size: .84rem; }
.readiness-totals { display: grid; grid-template-columns: repeat(3, auto); gap: 8px; }
.readiness-totals span { display: grid; min-width: 72px; padding: 9px 11px; border-radius: 11px; background: rgba(255,255,255,.8); text-align: center; color: var(--muted); font-size: .72rem; }
.readiness-totals strong { color: var(--navy); font-size: 1.15rem; }
.timetable-readiness-panel, .timetable-draft-panel, .timetable-runs-panel { margin-top: 20px; }
.readiness-check-list { display: grid; gap: 10px; }
.readiness-check { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; padding: 13px 14px; border: 1px solid; border-radius: 13px; background: #fff; }
.readiness-check-ready { border-color: #b5dacc; }
.readiness-check-warning { border-color: #e5d198; background: #fffdf6; }
.readiness-check-blocker { border-color: #edc0c0; background: #fff8f8; }
.readiness-check-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-weight: 900; }
.readiness-check-ready .readiness-check-icon { color: var(--green); background: var(--green-soft); }
.readiness-check-warning .readiness-check-icon { color: #79591f; background: #fff1c9; }
.readiness-check-blocker .readiness-check-icon { color: #9e2f2f; background: #fdeaea; }
.readiness-check-title { display: flex; align-items: center; gap: 9px; }
.readiness-check-title h3 { margin: 0; font-size: .94rem; }
.readiness-check-title span { color: var(--muted); font-size: .7rem; font-weight: 800; }
.readiness-check p { margin: 3px 0 0; font-size: .78rem; }
.timetable-draft-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 12px; padding: 16px; border: 1px solid #b5dacc; border-radius: 14px; background: #f2faf7; }
.timetable-profile-selection { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; padding: 12px; border: 1px solid #d6e5df; border-radius: 12px; background: rgba(255,255,255,.75); }
.timetable-generation-locked { display: flex; align-items: center; gap: 13px; padding: 16px; border: 1px solid #e0c57d; border-radius: 14px; background: #fffaf0; }
.timetable-generation-locked > span { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: 50%; color: #79591f; background: #f3e2b7; font-size: .72rem; font-weight: 900; }
.timetable-generation-locked strong { color: #79591f; }
.timetable-generation-locked p { margin: 3px 0 0; font-size: .8rem; }
.timetable-run-list { display: grid; gap: 11px; }
.timetable-run-card { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 15px; border: 1px solid #dce4eb; border-radius: 14px; background: #fcfdff; }
.timetable-run-card h3 { margin: 6px 0 0; }
.timetable-run-card p { margin: 3px 0 0; font-size: .75rem; }
.run-status { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: .7rem; font-weight: 900; }
.run-status-draft { color: #79591f; background: #fff1c9; }
.run-status-generating { color: #245a8d; background: #e8f2fc; }
.run-status-completed, .run-status-published { color: var(--green); background: var(--green-soft); }
.run-status-failed { color: #9e2f2f; background: #fdeaea; }
.run-status-archived { color: var(--muted); background: #edf1f5; }
.run-snapshot-stats { display: flex; flex-wrap: wrap; gap: 7px; }
.run-snapshot-stats span { padding: 6px 9px; border-radius: 9px; color: var(--muted); background: #f0f3f6; font-size: .72rem; }
.timetable-run-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.timetable-run-actions form { margin: 0; }
.timetable-result-hero { display: flex; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 22px; padding: 22px; border: 1px solid #b5dacc; border-radius: 20px; background: #f2faf7; box-shadow: var(--shadow); }
.timetable-result-hero h2 { margin: 10px 0 3px; color: var(--navy); }
.timetable-result-hero p { margin: 0; font-size: .84rem; }
.timetable-conflicts-panel, .timetable-output-panel { margin-top: 20px; }
.timetable-conflict-list { display: grid; gap: 9px; }
.timetable-conflict { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid; border-radius: 12px; }
.timetable-conflict > span { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; font-weight: 900; }
.timetable-conflict strong { color: var(--navy); }
.timetable-conflict p { margin: 2px 0 0; font-size: .78rem; }
.timetable-conflict small { color: var(--muted); }
.timetable-conflict-blocker { border-color: #edc0c0; background: #fff8f8; }
.timetable-conflict-blocker > span { color: #9e2f2f; background: #fdeaea; }
.timetable-conflict-warning { border-color: #e5d198; background: #fffdf6; }
.timetable-conflict-warning > span { color: #79591f; background: #fff1c9; }
.generated-section-list { display: grid; gap: 14px; }
.generated-section-card { border: 1px solid #dce4eb; border-radius: 15px; background: #fcfdff; overflow: hidden; }
.generated-section-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 17px; cursor: pointer; }
.generated-section-card > summary strong, .generated-section-card > summary small { display: block; }
.generated-section-card > summary strong { color: var(--navy); }
.generated-section-card > summary small { margin-top: 3px; color: var(--muted); }
.generated-section-card > summary > span { color: #79591f; font-size: .76rem; font-weight: 900; }
.generated-week-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 10px; padding: 16px; border-top: 1px solid var(--line); background: #fff; overflow-x: auto; }
.generated-day-column { display: grid; align-content: start; gap: 8px; min-width: 150px; }
.generated-day-column h3 { margin: 0 0 3px; padding: 8px; border-radius: 9px; color: var(--navy); background: var(--gold-soft); text-align: center; font-size: .86rem; }
.generated-lesson-card { display: grid; gap: 2px; padding: 10px; border: 1px solid #dce4eb; border-radius: 10px; background: #fbfcfe; }
.generated-lesson-card > span { color: #9a6e1c; font-size: .66rem; font-weight: 900; }
.generated-lesson-card strong { color: var(--navy); font-size: .82rem; }
.generated-lesson-card small { color: var(--muted); font-size: .7rem; }
.generated-lesson-card em { width: fit-content; margin-top: 3px; padding: 3px 6px; border-radius: 7px; color: var(--green); background: var(--green-soft); font-size: .65rem; font-style: normal; font-weight: 800; }
.generated-day-empty { padding: 15px 8px; border: 1px dashed #d5dde5; border-radius: 9px; color: var(--muted); text-align: center; font-size: .72rem; }
.manual-edit-guide { display: flex; align-items: center; gap: 13px; margin: 0 0 20px; padding: 14px 16px; border: 1px solid #b5dacc; border-radius: 14px; background: #f2faf7; }
.manual-edit-guide > span { flex: 0 0 auto; padding: 6px 9px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: .72rem; font-weight: 900; }
.manual-edit-guide strong { color: var(--navy); }
.manual-edit-guide p { margin: 3px 0 0; font-size: .76rem; }
.generated-lesson-manual { border-color: #84c7b2; box-shadow: inset 0 0 0 1px rgba(38,128,99,.08); }
.manual-adjustment-note { width: fit-content; margin-top: 4px; padding: 3px 6px; border-radius: 7px; color: var(--green) !important; background: var(--green-soft); font-weight: 800; }
.lesson-move-control { margin-top: 6px; border-top: 1px dashed #dce4eb; }
.lesson-move-control > summary { padding-top: 7px; color: #79591f; cursor: pointer; font-size: .7rem; font-weight: 900; }
.lesson-move-control form { display: grid; gap: 7px; margin-top: 8px; }
.lesson-move-control label, .lesson-move-control label > span { display: grid; gap: 4px; }
.lesson-move-control label > span { color: var(--muted); font-size: .66rem; font-weight: 800; }
.lesson-move-control select { width: 100%; min-width: 0; padding: 7px; border: 1px solid #ccd7e1; border-radius: 8px; background: #fff; font-size: .68rem; }
.panel-heading-actions { display: flex; align-items: center; gap: 9px; }
.published-run-notice, .archived-run-notice { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; padding: 15px 17px; border: 1px solid; border-radius: 14px; }
.published-run-notice { border-color: #9fd0bd; background: #f1f9f6; }
.archived-run-notice { border-color: #d5dde5; background: #f6f8fa; }
.published-run-notice > span, .archived-run-notice > span { padding: 6px 9px; border-radius: 999px; font-size: .72rem; font-weight: 900; }
.published-run-notice > span { color: var(--green); background: var(--green-soft); }
.archived-run-notice > span { color: var(--muted); background: #e7ecf1; }
.published-run-notice strong, .archived-run-notice strong { color: var(--navy); }
.published-run-notice p, .archived-run-notice p { margin: 3px 0 0; font-size: .76rem; }
.comparison-picker-panel, .comparison-results-panel { margin-top: 20px; }
.comparison-picker-form { display: grid; gap: 14px; }
.comparison-run-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.comparison-run-options label { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #dce4eb; border-radius: 12px; background: #fbfcfe; cursor: pointer; }
.comparison-run-options label strong, .comparison-run-options label small { display: block; }
.comparison-run-options label small { margin-top: 3px; color: var(--muted); font-size: .72rem; }
.comparison-grid { display: grid; gap: 14px; overflow-x: auto; }
.comparison-card { min-width: 230px; padding: 16px; border: 1px solid #dce4eb; border-radius: 15px; background: #fcfdff; }
.comparison-card-recommended { border-color: #79bca6; background: #f5fbf8; box-shadow: inset 0 0 0 1px rgba(38,128,99,.08); }
.comparison-card-heading h2 { margin: 10px 0 3px; color: var(--navy); font-size: 1rem; }
.comparison-card-heading p { margin: 0; font-size: .72rem; }
.recommendation-badge { display: inline-flex; margin-inline-start: 5px; padding: 4px 7px; border-radius: 999px; color: var(--green); background: var(--green-soft); font-size: .65rem; font-weight: 900; }
.comparison-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.comparison-metrics div { display: grid; gap: 3px; padding: 9px; border-radius: 10px; background: #f0f3f6; }
.comparison-metrics span { color: var(--muted); font-size: .68rem; }
.comparison-metrics strong { color: var(--navy); font-size: .9rem; }
.comparison-metrics .metric-danger { background: #fdeaea; }
.comparison-metrics .metric-danger strong { color: #9e2f2f; }
.comparison-metrics .metric-ready { background: var(--green-soft); }
.comparison-metrics .metric-ready strong { color: var(--green); }
.comparison-card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.comparison-card-actions form { margin: 0; }
.timetable-export-panel { margin-top: 20px; }
.timetable-export-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 10px; }
.timetable-export-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid #dce4eb; border-radius: 13px; background: #fcfdff; }
.timetable-export-card strong, .timetable-export-card small { display: block; }
.timetable-export-card strong { color: var(--navy); }
.timetable-export-card small { margin-top: 4px; color: var(--muted); font-size: .7rem; }
.timetable-export-card > div:last-child { display: flex; flex-wrap: wrap; gap: 7px; }
.standby-stats { grid-template-columns: repeat(4, 1fr); }
.standby-priority-callout { margin: 20px 0; }
.standby-run-panel, .standby-roster-panel, .standby-absence-panel, .standby-history-panel { margin-top: 20px; }
.standby-run-actions { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.4fr); align-items: end; gap: 14px; }
.standby-run-picker, .standby-generate-form { display: flex; align-items: end; gap: 10px; padding: 14px; border: 1px solid #dce4eb; border-radius: 13px; background: #fbfcfe; }
.standby-run-picker .field, .standby-generate-form .field { flex: 1; }
.standby-roster-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 11px; }
.standby-slot-card { border: 1px solid #dce4eb; border-radius: 13px; background: #fcfdff; overflow: hidden; }
.standby-slot-card header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; color: var(--navy); background: var(--gold-soft); }
.standby-slot-card header span { color: #79591f; font-size: .72rem; direction: ltr; }
.standby-slot-card > div { display: grid; gap: 7px; padding: 11px; }
.standby-slot-card p { display: flex; align-items: center; gap: 9px; margin: 0; padding: 8px; border-radius: 9px; background: #f2f5f7; }
.standby-slot-card p span { min-width: 61px; color: var(--green); font-size: .7rem; font-weight: 900; }
.standby-slot-card p strong { color: var(--navy); font-size: .8rem; }
.standby-absence-form { display: grid; grid-template-columns: repeat(4, 1fr); align-items: end; gap: 12px; padding: 16px; border: 1px solid #b5dacc; border-radius: 14px; background: #f2faf7; }
.standby-full-day-field { min-height: 45px; }
.standby-absence-notes { grid-column: span 2; }
.standby-absence-list { display: grid; gap: 13px; }
.standby-absence-card { border: 1px solid #dce4eb; border-radius: 15px; background: #fcfdff; overflow: hidden; }
.standby-absence-card > header { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 15px 17px; }
.standby-absence-card h3 { margin: 7px 0 2px; color: var(--navy); }
.standby-absence-card header p { margin: 0; font-size: .75rem; }
.standby-absence-cancelled { opacity: .72; }
.standby-absence-note { margin: 0 17px 12px; padding: 9px 11px; border-radius: 9px; background: #f2f5f7; font-size: .75rem; }
.standby-substitution-list { display: grid; gap: 1px; border-top: 1px solid var(--line); background: var(--line); }
.standby-substitution-row { display: grid; grid-template-columns: minmax(200px, 1.3fr) minmax(160px, .8fr) minmax(240px, 1fr); align-items: center; gap: 12px; padding: 12px 16px; background: #fff; }
.standby-substitution-row > div:first-child strong, .standby-substitution-row > div:first-child small { display: block; }
.standby-substitution-row > div:first-child strong { color: var(--navy); }
.standby-substitution-row > div:first-child small { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.standby-assignment-result { display: grid; gap: 3px; }
.standby-assignment-result strong { color: var(--navy); font-size: .8rem; }
.standby-assignment-result small { color: var(--muted); font-size: .68rem; }
.substitution-status { width: fit-content; padding: 4px 7px; border-radius: 999px; font-size: .65rem; font-weight: 900; }
.substitution-status-assigned { color: var(--green); background: var(--green-soft); }
.substitution-status-uncovered { color: #9e2f2f; background: #fdeaea; }
.substitution-status-cancelled { color: var(--muted); background: #e7ecf1; }
.standby-manual-form { display: flex; align-items: center; gap: 7px; }
.standby-manual-form select { min-width: 145px; padding: 8px; border: 1px solid #ccd7e1; border-radius: 8px; background: #fff; }

@media (max-width: 900px) {
    .setup-wrap, .auth-wrap { grid-template-columns: 1fr; }
    .intro-card, .auth-brand { position: static; padding: 8px 0; }
    .service-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: 1fr; }
    .compact-form, .term-form { grid-template-columns: repeat(2, 1fr); }
    .day-options { grid-template-columns: repeat(4, 1fr); }
    .schedule-form-grid { grid-template-columns: repeat(2, 1fr); }
    .period-grid { grid-template-columns: repeat(3, 1fr); }
    .profile-create-form { grid-template-columns: repeat(2, 1fr); }
    .flexible-schedule-grid { grid-template-columns: repeat(2, 1fr); }
    .stage-create-form, .stage-edit-form { grid-template-columns: repeat(2, 1fr); }
    .grade-tools { grid-template-columns: 1fr; }
    .section-create-form { grid-template-columns: repeat(2, 1fr); }
    .import-upload-form, .mapping-grid, .teacher-basic-grid { grid-template-columns: repeat(2, 1fr); }
    .subject-list { grid-template-columns: repeat(2, 1fr); }
    .curriculum-create-form { grid-template-columns: repeat(2, 1fr); }
    .official-plan-card { grid-template-columns: 1fr; }
    .requirement-tools { grid-template-columns: 1fr; }
    .requirement-edit-form { grid-template-columns: repeat(3, 1fr); }
    .assignment-row { grid-template-columns: repeat(2, 1fr); }
    .constraint-stats { grid-template-columns: repeat(2, 1fr); }
    .constraint-rule-guide { grid-template-columns: 1fr; }
    .constraint-policy-form { grid-template-columns: repeat(2, 1fr); }
    .constraint-rule-form { grid-template-columns: repeat(2, 1fr); }
    .constraint-rule-row { grid-template-columns: repeat(2, 1fr); }
    .facility-stats { grid-template-columns: repeat(2, 1fr); }
    .facility-form, .facility-requirement-form { grid-template-columns: repeat(2, 1fr); }
    .timetable-readiness-hero { grid-template-columns: auto 1fr; }
    .standby-stats { grid-template-columns: repeat(2, 1fr); }
    .standby-absence-form { grid-template-columns: repeat(2, 1fr); }
    .standby-substitution-row { grid-template-columns: 1fr 1fr; }
    .standby-manual-form { grid-column: 1 / -1; }
    .readiness-totals { grid-column: 1 / -1; }
    .timetable-run-card { grid-template-columns: 1fr auto; }
    .generated-week-grid { grid-template-columns: repeat(5, minmax(155px, 1fr)); }
}

@media (max-width: 640px) {
    .container { width: min(100% - 22px, 1160px); }
    .page-shell { padding-top: 24px; }
    .form-card, .panel { padding: 20px; border-radius: 17px; }
    .form-grid, .school-grid, .service-grid { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
    .content-heading, .panel-heading { align-items: stretch; flex-direction: column; }
    .compact-form, .term-form, .schedule-form-grid { grid-template-columns: 1fr; }
    .profile-create-form, .profile-edit-form, .flexible-schedule-grid, .breaks-grid, .break-card { grid-template-columns: 1fr; }
    .stage-create-form, .stage-edit-form, .inline-create-form, .grade-edit-details .inline-create-form, .section-create-form, .section-edit-form, .section-list { grid-template-columns: 1fr; }
    .day-options { grid-template-columns: repeat(2, 1fr); }
    .period-grid { grid-template-columns: repeat(2, 1fr); }
    .year-card-heading { align-items: stretch; flex-direction: column; }
    .schedule-profile-heading, .form-actions-between { align-items: stretch; flex-direction: column; }
    .stage-card-heading, .grade-card-heading { align-items: stretch; flex-direction: column; }
    .import-upload-form, .mapping-grid, .subject-create-form, .subject-list, .teacher-basic-grid, .teacher-relations-grid, .teacher-consent-row { grid-template-columns: 1fr; }
    .import-preview-heading, .teacher-card-heading, .import-history-row { align-items: stretch; flex-direction: column; }
    .teacher-contact-summary { text-align: right; }
    .heading-actions { width: 100%; }
    .heading-actions .button { flex: 1; }
    .curriculum-create-form, .requirement-edit-form, .assignment-row { grid-template-columns: 1fr; }
    .official-plan-facts { display: grid; }
    .requirement-card > summary, .curriculum-grade-heading { align-items: stretch; flex-direction: column; }
    .requirement-side-actions { align-items: stretch; flex-direction: column; }
    .assignment-periods-field { max-width: none; }
    .constraint-stats, .constraint-policy-form, .constraint-rule-form, .constraint-rule-row { grid-template-columns: 1fr; }
    .standby-callout, .teacher-constraint-heading, .constraint-subheading { align-items: stretch; flex-direction: column; }
    .teacher-constraint-tags { justify-content: flex-start; }
    .constraint-notes-field { grid-column: auto; }
    .facility-stats, .facility-form, .facility-requirement-form { grid-template-columns: 1fr; }
    .facility-stage-fieldset, .facility-notes-field, .facility-requirement-notes { grid-column: auto; }
    .facility-card > summary, .facility-requirement-card > summary { align-items: stretch; flex-direction: column; }
    .facility-summary-status { text-align: right; }
    .facility-requirement-card > summary > div { align-items: flex-start; flex-direction: column; }
    .timetable-readiness-hero, .readiness-check, .timetable-draft-form, .timetable-run-card { grid-template-columns: 1fr; }
    .timetable-result-hero { align-items: stretch; flex-direction: column; }
    .timetable-conflict { grid-template-columns: auto 1fr; }
    .timetable-conflict small { grid-column: 2; }
    .timetable-run-actions { justify-content: flex-start; }
    .timetable-export-card { align-items: stretch; flex-direction: column; }
    .standby-stats, .standby-run-actions, .standby-absence-form, .standby-substitution-row { grid-template-columns: 1fr; }
    .standby-run-picker, .standby-generate-form, .standby-absence-card > header, .standby-manual-form { align-items: stretch; flex-direction: column; }
    .standby-absence-notes { grid-column: auto; }
    .readiness-score { margin: auto; }
    .readiness-totals { grid-template-columns: repeat(3, 1fr); }
    .readiness-check { align-items: flex-start; }
    .readiness-check > .text-button { justify-self: start; }
    .timetable-generation-locked { align-items: flex-start; }
    .topbar-inner { padding: 11px 0; align-items: flex-start; }
    .topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
    .user-name { display: none; }
    .brand strong { font-size: .9rem; }
    .school-chip { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* Visual contrast system: shared hierarchy for every platform and school workspace. */
:root {
    --ink: #12332c;
    --muted: #567067;
    --line: #c8ddd4;
    --canvas: #f3f8f5;
    --surface: #ffffff;
    --primary: #176653;
    --primary-dark: #103f35;
    --primary-soft: #e4f5ee;
    --instruction: #1e6498;
    --instruction-soft: #eaf4ff;
    --warning: #9a6810;
    --warning-soft: #fff5dc;
    --danger: #a9374a;
    --danger-soft: #fff0f3;
    --success: #147354;
    --success-soft: #e6f7ed;
}

body { color: var(--ink); }
h1, h2, h3, .field, .days-fieldset legend, .break-card legend { color: var(--ink); }
p, .muted-note, .field > small, .field span small { color: var(--muted); }

.content-heading {
    border-color: #bbd9cd;
    background: linear-gradient(112deg, #ffffff 12%, #edf8f3 100%);
    box-shadow: 0 12px 28px rgba(16, 63, 53, .06);
}
.content-heading::before { content: ''; position: absolute; right: 0; top: 0; width: 7px; height: 100%; background: linear-gradient(#d9aa47, #287b67); }
.content-heading h1 { color: #103f35; }
.eyebrow { color: #9a6810; }

.panel, .form-card, .stat-card, .school-card, .member-card, .year-card, .schedule-profile-card,
.platform-owner-card, .configured-day-card, .requirement-card, .facility-card, .grade-card,
.communication-message-card, .comparison-card, .official-plan-card {
    border-color: #c7ddd3;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(16, 63, 53, .07);
}
.panel::before { display: none; }
.panel-heading { padding-bottom: 16px; margin-bottom: 19px; border-bottom: 1px solid #dcebe4; }
.panel-heading h2 { color: #103f35; }
.panel-heading p { color: #567067; }

.step-number {
    width: 36px;
    height: 36px;
    background: #103f35;
    color: #ffffff;
    border: 2px solid #d9aa47;
    box-shadow: 0 4px 10px rgba(16, 63, 53, .16);
}
.progress-badge, .status-complete {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid #9fd8bd;
}
.status-pill { background: #edf3f0; color: #46665c; border: 1px solid #d3e2db; }

.alert, .info-callout, .import-safety-note, .communication-safety-callout, .facility-conflict-callout,
.constraint-time-callout, .manual-adjustment-note, .lesson-swap-note {
    position: relative;
    padding: 15px 18px 15px 20px;
    border-width: 1px;
    border-radius: 14px;
    line-height: 1.9;
}
.alert::before, .info-callout::before, .import-safety-note::before, .communication-safety-callout::before,
.facility-conflict-callout::before, .constraint-time-callout::before, .manual-adjustment-note::before,
.lesson-swap-note::before {
    content: '';
    position: absolute;
    right: 0;
    top: 12px;
    bottom: 12px;
    width: 4px;
    border-radius: 8px 0 0 8px;
    background: currentColor;
    opacity: .78;
}
.alert-success { background: var(--success-soft); border-color: #9fd8bd; color: #13583f; }
.alert-warning { background: var(--warning-soft); border-color: #e7bf66; color: #785009; }
.alert-error { background: var(--danger-soft); border-color: #e7a2ae; color: #8d2d3d; }
.info-callout, .import-safety-note, .communication-safety-callout, .constraint-time-callout {
    background: var(--instruction-soft);
    border-color: #9fc8ea;
    color: #195783;
}
.info-callout strong { color: #155583; }
.facility-conflict-callout, .manual-adjustment-note, .lesson-swap-note { background: var(--warning-soft); border-color: #e7bf66; color: #785009; }

.field { color: #163d34; }
.field input, .field select {
    border-color: #bcd3c9;
    background: #fbfefd;
    color: #13362d;
    box-shadow: inset 0 1px 0 rgba(16, 63, 53, .025);
}
.field input:hover, .field select:hover { border-color: #79ae9c; background: #ffffff; }
.field input:focus, .field select:focus {
    border-color: #176653;
    background: #ffffff;
    box-shadow: 0 0 0 4px rgba(23, 102, 83, .16);
}
.field input:disabled { border-color: #d5e2dc; background: #edf2ef; color: #61766e; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
    outline: 3px solid rgba(217, 170, 71, .55);
    outline-offset: 3px;
}

.button { min-height: 42px; border: 1px solid transparent; box-shadow: 0 4px 10px rgba(16, 63, 53, .08); }
.button-primary { background: linear-gradient(135deg, #103f35, #176653); color: #ffffff; }
.button-primary:hover { background: linear-gradient(135deg, #0c332b, #135944); }
.button-secondary { background: #fff1cf; border-color: #ebc86f; color: #684609; }
.button-secondary:hover { background: #ffe6a9; }
.button-danger { background: #ae3d4d; }
.button-danger:hover { background: #922f40; }
.button-ghost { box-shadow: none; }

.stat-card { border-top: 4px solid #287b67; }
.stat-card::after { background: #d9aa47; }
.stat-card span, .stat-card small { color: #567067; }
.stat-card strong { color: #103f35; }

.service-card { position: relative; border-color: #c8ddd4; background: #ffffff; box-shadow: none; }
.service-card::after { content: ''; position: absolute; right: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 4px; background: #cad9d2; }
.service-card:hover { border-color: #73ae99; box-shadow: 0 14px 28px rgba(16, 63, 53, .11); }
.service-card-active { border-color: #68ab91; background: linear-gradient(145deg, #ffffff, #ecf8f1); }
.service-card-active::after { background: #176653; }
.service-number { background: #fff1cf; color: #785009; }
.service-link { color: #176653; }
.service-muted { color: #71837c; }

.school-card { border-right: 5px solid #d9aa47; }
.school-card h2, .school-card p { color: #12332c; }
.school-card p, .school-card small { color: #567067; }
.school-card-icon { background: linear-gradient(135deg, #103f35, #176653); }

.compact-form, .schedule-builder, .period-item, .details-list > div, .account-summary-list > div,
.account-workspaces article, .account-session-list article, .term-row, .break-card, .profile-settings-details,
.platform-owner-actions form, .member-protected-note {
    border-color: #d0e1d9;
    background: #f8fcfa;
}
.account-summary-list > div:nth-child(4n + 1), .period-item:nth-child(4n + 1) { border-right: 4px solid #287b67; }
.account-summary-list > div:nth-child(4n + 2), .period-item:nth-child(4n + 2) { border-right: 4px solid #d9aa47; }
.account-summary-list > div:nth-child(4n + 3), .period-item:nth-child(4n + 3) { border-right: 4px solid #397bb4; }
.account-summary-list > div:nth-child(4n) { border-right: 4px solid #b94d5b; }
.account-summary-list dt, .details-list dt { color: #567067; }
.account-summary-list dd, .details-list dd { color: #12332c; }

.day-option span { border-color: #c5dbd1; background: #ffffff; color: #46665c; }
.day-option input:checked + span { border-color: #287b67; background: #e5f5ed; color: #13583f; box-shadow: inset 0 0 0 1px #287b67; }
.day-option input:focus-visible + span { outline-color: rgba(217, 170, 71, .62); }

.settings-nav a { border-color: #bdd6cb; background: #ffffff; color: #16463a; }
.settings-nav a:hover, .settings-nav a[aria-current='page'] { border-color: #287b67; background: #e6f6ee; color: #13583f; }
.year-card-current { border-color: #73b69a; box-shadow: inset 5px 0 0 #176653; }
.run-status-completed, .availability-ready, .readiness-check-ready, .communication-status-sent { background: var(--success-soft); color: #13583f; }
.run-status-failed, .availability-missing, .readiness-check-blocker, .communication-status-cancelled { background: var(--danger-soft); color: #8d2d3d; }
.run-status-generating, .run-status-draft, .readiness-check-warning, .communication-status-ready { background: var(--warning-soft); color: #785009; }

.topbar { box-shadow: 0 8px 22px rgba(10, 45, 37, .20); }
.school-chip { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .32); color: #f3fbf7; }
.user-name { color: #d8ebe3; }

/* Communication center */
.communication-stats { grid-template-columns: repeat(4, 1fr); }
.communication-safety-callout { margin-bottom: 22px; }
.communication-run-panel, .communication-list-panel { margin-top: 20px; }
.communication-run-tools { display: grid; grid-template-columns: minmax(260px, 1fr) auto; align-items: end; gap: 16px; }
.communication-run-picker { margin: 0; }
.communication-prepare-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.communication-prepare-actions form, .communication-message-actions form { margin: 0; }
.communication-message-list { display: grid; gap: 13px; }
.communication-message-card { padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #fcfdff; }
.communication-message-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.communication-message-card h3 { margin: 7px 0 2px; }
.communication-message-card p { margin: 0; font-size: .8rem; }
.communication-message-card > header > strong { color: var(--navy); font-size: .9rem; }
.communication-status { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.communication-status-ready { color: #79591f; background: #fff1c9; }
.communication-status-opened { color: #245a8d; background: #e8f2fc; }
.communication-status-sent { color: var(--green); background: var(--green-soft); }

/* Teacher portal and lesson swaps */
.teacher-portal-stats, .lesson-swap-stats { grid-template-columns: repeat(3, 1fr); }
.teacher-swap-guide, .lesson-swap-admin-guide { margin-bottom: 22px; }
.teacher-timetable-panel, .teacher-swaps-panel, .teacher-password-panel, .lesson-swap-management-panel { margin-top: 20px; }
.teacher-week-grid { grid-template-columns: repeat(5, minmax(185px, 1fr)); }
.lesson-swap-control { margin-top: 7px; border-top: 1px dashed #dce4eb; }
.lesson-swap-control > summary { padding-top: 7px; color: #79591f; cursor: pointer; font-size: .7rem; font-weight: 900; }
.lesson-swap-control form { display: grid; gap: 8px; margin-top: 8px; }
.lesson-swap-control label, .lesson-swap-control label > span { display: grid; gap: 4px; }
.lesson-swap-control label > span { color: var(--muted); font-size: .66rem; font-weight: 800; }
.lesson-swap-control select, .lesson-swap-control textarea { width: 100%; min-width: 0; padding: 7px; border: 1px solid #ccd7e1; border-radius: 8px; background: #fff; font: inherit; font-size: .68rem; }
.lesson-swap-list { display: grid; gap: 13px; }
.lesson-swap-card { padding: 17px; border: 1px solid #dce4eb; border-radius: 15px; background: #fcfdff; }
.lesson-swap-card-action { border-color: #d9bf7e; background: #fffdf7; box-shadow: inset 4px 0 0 #c89b3c; }
.lesson-swap-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 17px; }
.lesson-swap-card h3 { margin: 8px 0 2px; color: var(--navy); }
.lesson-swap-card header p { margin: 0; font-size: .75rem; }
.lesson-swap-card header > strong { color: var(--navy); font-size: .8rem; }
.lesson-swap-status { display: inline-flex; padding: 5px 9px; border-radius: 999px; color: var(--muted); background: #edf1f5; font-size: .7rem; font-weight: 900; }
.lesson-swap-status-pending_recipient { color: #245a8d; background: #e8f2fc; }
.lesson-swap-status-pending_admin { color: #79591f; background: #fff1c9; }
.lesson-swap-status-approved { color: var(--green); background: var(--green-soft); }
.lesson-swap-status-rejected_by_recipient, .lesson-swap-status-rejected_by_admin { color: #9e2f2f; background: #fdeaea; }
.lesson-swap-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.lesson-swap-pair > div { display: grid; gap: 3px; padding: 12px; border: 1px solid #e2e8ef; border-radius: 11px; background: #fff; }
.lesson-swap-pair strong { color: var(--navy); }
.lesson-swap-pair span { color: #79591f; font-size: .78rem; font-weight: 800; }
.lesson-swap-pair small { color: var(--muted); font-size: .72rem; }
.lesson-swap-note { margin: 10px 0 0; padding: 9px 11px; border-radius: 9px; background: #f2f5f7; font-size: .76rem; }
.lesson-swap-warnings { display: grid; gap: 5px; margin-top: 10px; }
.lesson-swap-warnings span { padding: 8px 10px; border-radius: 8px; color: #79591f; background: #fff1c9; font-size: .72rem; }
.lesson-swap-trail { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 12px; }
.lesson-swap-trail span { padding: 7px; border-radius: 8px; color: var(--muted); background: #edf1f5; text-align: center; font-size: .68rem; font-weight: 800; }
.lesson-swap-trail .trail-complete { color: var(--green); background: var(--green-soft); }
.lesson-swap-actions, .lesson-swap-admin-actions { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 13px; }
.lesson-swap-actions form, .lesson-swap-admin-actions form { display: flex; align-items: center; gap: 8px; margin: 0; }
.lesson-swap-actions input, .lesson-swap-admin-actions input { min-width: 210px; padding: 9px 10px; border: 1px solid #ccd7e1; border-radius: 9px; background: #fff; }
.teacher-password-form { display: grid; grid-template-columns: repeat(3, 1fr) auto; align-items: end; gap: 11px; padding: 16px; border: 1px solid #dce4eb; border-radius: 13px; background: #f7f9fb; }

@media (max-width: 900px) {
    .workforce-stats { grid-template-columns: repeat(2, 1fr); }
    .teacher-account-form, .teacher-password-form { grid-template-columns: repeat(2, 1fr); }
    .teacher-week-grid { grid-template-columns: repeat(5, minmax(170px, 1fr)); }
}

@media (max-width: 640px) {
    .workforce-stats, .teacher-portal-stats, .lesson-swap-stats, .teacher-account-form, .teacher-password-form, .lesson-swap-pair, .lesson-swap-trail { grid-template-columns: 1fr; }
    .teacher-account-current, .lesson-swap-card > header, .lesson-swap-actions form, .lesson-swap-admin-actions form { align-items: stretch; flex-direction: column; }
    .lesson-swap-actions, .lesson-swap-admin-actions { display: grid; }
    .lesson-swap-actions input, .lesson-swap-admin-actions input { min-width: 0; width: 100%; }
}
.communication-status-cancelled { color: var(--muted); background: #edf1f5; }
.communication-message-cancelled { opacity: .68; }
.communication-preview { margin: 14px 0; border: 1px solid #e2e8ef; border-radius: 12px; background: #fff; }
.communication-preview summary { padding: 10px 12px; cursor: pointer; color: var(--navy); font-size: .82rem; font-weight: 800; }
.communication-preview pre { margin: 0 12px 12px; padding: 14px; border-radius: 10px; background: #f4f7f9; color: var(--ink); font: inherit; font-size: .82rem; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; direction: rtl; }
.communication-message-card > footer { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.communication-message-card > footer small { color: var(--muted); }
.communication-message-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }

@media (max-width: 900px) {
    .communication-stats { grid-template-columns: repeat(2, 1fr); }
    .communication-run-tools { grid-template-columns: 1fr; }
    .communication-prepare-actions { justify-content: flex-start; }
}

@media (max-width: 640px) {
    .communication-stats { grid-template-columns: 1fr; }
    .communication-message-card > header,
    .communication-message-card > footer { align-items: stretch; flex-direction: column; }
    .communication-message-actions { justify-content: flex-start; }
}

.platform-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.platform-school-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.platform-separation-note,
.platform-lifecycle-panel,
.platform-create-panel,
.platform-schools-panel,
.platform-audit-panel,
.platform-members-panel { margin-top: 20px; }
.platform-create-form { display: grid; gap: 15px; }
.platform-create-form fieldset { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 17px; border: 1px solid var(--line); border-radius: 14px; background: #f8fafc; }
.platform-create-form legend { padding-inline: 8px; color: var(--navy); font-weight: 900; }
.platform-create-form > .button { justify-self: start; }
.platform-school-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.platform-school-card { display: grid; gap: 15px; padding: 17px; border: 1px solid var(--line); border-radius: 15px; background: #f8fafc; }
.platform-school-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.platform-school-card h3, .platform-school-card p { margin: 0; }
.platform-school-card p { color: var(--muted); font-size: .78rem; }
.platform-school-card dl { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; }
.platform-school-card dl > div { padding: 9px; border-radius: 9px; background: #fff; }
.platform-school-card dt { color: var(--muted); font-size: .7rem; }
.platform-school-card dd { margin: 2px 0 0; color: var(--navy); font-weight: 800; }
.platform-audit-list { display: grid; gap: 8px; }
.platform-audit-list article { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.platform-audit-list span, .platform-audit-list small { color: var(--muted); }
.platform-school-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.platform-school-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.platform-school-form .button { align-self: end; }
.platform-member-list { display: grid; gap: 8px; }
.platform-member-list article { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; }
.platform-member-list article > div { display: grid; gap: 2px; }
.platform-member-list span, .platform-member-list small { color: var(--muted); font-size: .76rem; }

@media (max-width: 1000px) {
    .platform-stats, .platform-school-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .platform-create-form fieldset { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .platform-school-columns { grid-template-columns: 1fr; }
}

/* Phase 6.6: subscription lifecycle and platform reminders */
.platform-reminder-list,
.platform-reminder-history {
    display: grid;
    gap: 9px;
}

.platform-reminder-list article,
.platform-reminder-history article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px;
    border: 1px solid #d8e2eb;
    border-radius: 11px;
    background: #f8fafc;
}

.platform-reminder-list article.is-warning,
.platform-reminder-history article.is-warning {
    border-color: #e4bd67;
    background: #fff8e8;
}

.platform-reminder-list article.is-urgent,
.platform-reminder-history article.is-urgent {
    border-color: #e5aaaa;
    background: #fff7f7;
}

.platform-reminder-history article.is-resolved {
    border-color: #a9d7c5;
    background: #f0faf6;
}

.platform-reminder-list article > div:first-child,
.platform-reminder-history article > div {
    display: grid;
    gap: 3px;
}

.platform-reminder-list span,
.platform-reminder-list small,
.platform-reminder-history small {
    color: var(--muted);
}

.platform-reminder-actions {
    display: flex;
    align-items: center;
    gap: 7px;
}

@media (max-width: 680px) {
    .platform-reminder-list article,
    .platform-reminder-history article,
    .platform-reminder-actions {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 680px) {
    .platform-stats, .platform-school-stats, .platform-create-form fieldset, .platform-school-grid, .platform-school-form { grid-template-columns: 1fr; }
    .platform-audit-list article, .platform-member-list article { align-items: stretch; grid-template-columns: 1fr; flex-direction: column; }
}
/* Phase 6.4: subscription access and platform owner operations */
.alert-warning {
    border: 1px solid #e4bd67;
    color: #74520c;
    background: #fff8e8;
}

.subscription-access-banner,
.platform-subscription-state {
    margin-bottom: 18px;
}

.subscription-access-warning,
.subscription-access-blocked {
    display: block;
    margin-top: 8px;
    line-height: 1.7;
    font-weight: 700;
}

.subscription-access-warning {
    color: #8b620b;
}

.subscription-access-blocked {
    color: #a33232;
}

.platform-owner-list {
    display: grid;
    gap: 14px;
}

.platform-owner-card {
    padding: 16px;
    border: 1px solid #d5dee8;
    border-radius: 14px;
    background: #f9fbfc;
}

.platform-owner-card > header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.platform-owner-card > header > div {
    display: grid;
    gap: 5px;
}

.platform-owner-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.platform-owner-actions form {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 13px;
    border: 1px solid #dce4ec;
    border-radius: 11px;
    background: #fff;
}

.platform-owner-actions h3,
.platform-owner-actions p {
    margin: 0;
}

.platform-owner-actions p,
.platform-owner-warning {
    color: #65748a;
    font-size: .78rem;
    line-height: 1.7;
}

.platform-owner-warning {
    display: block;
    margin-top: 12px;
    color: #8b620b;
}

@media (max-width: 900px) {
    .platform-owner-actions {
        grid-template-columns: 1fr;
    }
}

/* Phase 6.5: self-service account security */
.account-security-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.account-required-alert {
    margin-bottom: 20px;
}

.account-summary-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: 0;
}

.account-summary-list > div {
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
}

.account-summary-list dt {
    color: var(--muted);
    font-size: .76rem;
}

.account-summary-list dd {
    margin: 2px 0 0;
    color: var(--navy);
    font-weight: 800;
}

.account-password-form,
.account-workspaces,
.account-session-list {
    display: grid;
    gap: 11px;
}

.account-workspaces {
    margin-top: 18px;
}

.account-workspaces h3 {
    margin: 0;
}

.account-workspaces article,
.account-session-list article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fafc;
}

.account-workspaces article > div,
.account-session-list article > div {
    display: grid;
    gap: 2px;
}

.account-workspaces small,
.account-session-list small {
    color: var(--muted);
}

.account-sessions-panel {
    margin-top: 20px;
}

.account-sessions-panel > form {
    margin-top: 16px;
}

@media (max-width: 850px) {
    .account-security-grid,
    .account-summary-list {
        grid-template-columns: 1fr;
    }
}

/* Unified product identity: shared shell for platform, school, and staff views. */
:root {
    --navy: #18332f;
    --navy-soft: #24554d;
    --gold: #d9aa47;
    --gold-soft: #fff3d7;
    --green: #3c8373;
    --green-soft: #e7f4ef;
    --red: #b94d5b;
    --red-soft: #fff0f2;
    --ink: #18332f;
    --muted: #667d75;
    --line: #d5e3dc;
    --surface: #fff;
    --canvas: #f4f8f6;
    --shadow: 0 18px 45px rgba(24, 51, 47, .09);
    font-family: 'IBM Plex Sans Arabic', Tahoma, Arial, sans-serif;
}

body {
    background-color: var(--canvas);
    background-image:
        linear-gradient(rgba(24, 51, 47, .028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(24, 51, 47, .028) 1px, transparent 1px);
    background-size: 34px 34px;
}

.topbar {
    background: linear-gradient(115deg, #18332f, #24554d);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.topbar-inner { min-height: 80px; }
.brand-mark { background: linear-gradient(135deg, #d9aa47, #f4d37b); color: #18332f; }
.brand small { color: #c8ddd5; }
.button-primary { background: linear-gradient(135deg, #18332f, #24554d); }
.button-secondary { background: var(--gold-soft); color: #755716; }
.button-ghost:hover { background: rgba(255, 255, 255, .1); }

.page-shell { padding-top: 34px; }
.content-heading { position: relative; padding: 22px 24px; margin-bottom: 22px; border: 1px solid #d7e6df; border-radius: 20px; background: linear-gradient(115deg, #fff, #f0f8f4); overflow: hidden; }
.content-heading::after { content: ''; position: absolute; left: -35px; bottom: -65px; width: 150px; height: 150px; border: 1px solid #3c837333; border-radius: 50%; }
.content-heading > * { position: relative; z-index: 1; }
.eyebrow { color: #3c8373; }

.panel, .form-card, .stat-card, .school-card { border-color: #d5e3dc; box-shadow: 0 12px 32px rgba(24, 51, 47, .06); }
.panel::before { content: ''; display: block; width: 34px; height: 4px; margin-bottom: 16px; border-radius: 99px; background: linear-gradient(90deg, #3c8373, #d9aa47); }
.stat-card { position: relative; overflow: hidden; background: linear-gradient(145deg, #fff, #f9fcfa); }
.stat-card::after { content: ''; position: absolute; left: 0; top: 0; width: 4px; height: 100%; background: #3c8373; }
.stat-card strong { color: #18332f; }

.service-card { border-color: #d5e3dc; background: linear-gradient(145deg, #fff, #f6fbf8); }
.service-card-active { border-color: #b9dcd0; background: linear-gradient(145deg, #fff, #edf8f3); }
.service-number, .service-link { color: #3c8373; }
.service-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: #e7f4ef; font-size: .72rem; }
.step-number { background: #e7f4ef; color: #2d715f; }
.status-complete, .progress-badge { background: #e7f4ef; color: #2d715f; }
.field input:focus, .field select:focus { border-color: #3c8373; box-shadow: 0 0 0 3px rgba(60, 131, 115, .13); }
.school-card-icon { background: linear-gradient(135deg, #18332f, #3c8373); color: #fff; }

.product-footer { margin-top: 34px !important; background: #18332f !important; }
.product-footer span { color: #bde6d8 !important; }

@media (max-width: 640px) {
    .page-shell { padding-top: 20px; }
    .content-heading { padding: 18px; border-radius: 17px; }
    .topbar-inner { min-height: 70px; }
    .topbar-actions { gap: 7px; }
    .topbar-actions .button { padding: 6px 9px; }
}

/* V5 final cascade: intentional contrast is kept above legacy component styling. */
.content-heading { border-color: #bbd9cd; background: linear-gradient(112deg, #ffffff 12%, #edf8f3 100%); box-shadow: 0 12px 28px rgba(16, 63, 53, .06); }
.content-heading::before { content: ''; position: absolute; right: 0; top: 0; width: 7px; height: 100%; background: linear-gradient(#d9aa47, #287b67); }
.content-heading h1 { color: #103f35; }
.eyebrow { color: #9a6810; }

.panel, .form-card, .stat-card, .school-card, .member-card, .year-card, .schedule-profile-card,
.platform-owner-card, .configured-day-card, .requirement-card, .facility-card, .grade-card,
.communication-message-card, .comparison-card, .official-plan-card { border-color: #c7ddd3; background: #ffffff; box-shadow: 0 12px 30px rgba(16, 63, 53, .07); }
.panel::before { display: none; }
.panel-heading { padding-bottom: 16px; margin-bottom: 19px; border-bottom: 1px solid #dcebe4; }
.panel-heading h2 { color: #103f35; }
.step-number { width: 36px; height: 36px; background: #103f35; color: #ffffff; border: 2px solid #d9aa47; box-shadow: 0 4px 10px rgba(16, 63, 53, .16); }
.progress-badge, .status-complete { background: #e6f7ed; color: #147354; border: 1px solid #9fd8bd; }
.status-pill { background: #edf3f0; color: #46665c; border: 1px solid #d3e2db; }

.alert, .info-callout, .import-safety-note, .communication-safety-callout, .facility-conflict-callout,
.constraint-time-callout, .manual-adjustment-note, .lesson-swap-note { position: relative; padding: 15px 18px 15px 20px; border-width: 1px; border-radius: 14px; line-height: 1.9; }
.alert::before, .info-callout::before, .import-safety-note::before, .communication-safety-callout::before,
.facility-conflict-callout::before, .constraint-time-callout::before, .manual-adjustment-note::before,
.lesson-swap-note::before { content: ''; position: absolute; right: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 8px 0 0 8px; background: currentColor; opacity: .78; }
.alert-success { background: #e6f7ed; border-color: #9fd8bd; color: #13583f; }
.alert-warning { background: #fff5dc; border-color: #e7bf66; color: #785009; }
.alert-error { background: #fff0f3; border-color: #e7a2ae; color: #8d2d3d; }
.info-callout, .import-safety-note, .communication-safety-callout, .constraint-time-callout { background: #eaf4ff; border-color: #9fc8ea; color: #195783; }
.info-callout strong { color: #155583; }
.facility-conflict-callout, .manual-adjustment-note, .lesson-swap-note { background: #fff5dc; border-color: #e7bf66; color: #785009; }

.field { color: #163d34; }
.field input, .field select { border-color: #bcd3c9; background: #fbfefd; color: #13362d; box-shadow: inset 0 1px 0 rgba(16, 63, 53, .025); }
.field input:hover, .field select:hover { border-color: #79ae9c; background: #ffffff; }
.field input:focus, .field select:focus { border-color: #176653; background: #ffffff; box-shadow: 0 0 0 4px rgba(23, 102, 83, .16); }
.field input:disabled { border-color: #d5e2dc; background: #edf2ef; color: #61766e; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid rgba(217, 170, 71, .55); outline-offset: 3px; }

.button { min-height: 42px; border: 1px solid transparent; box-shadow: 0 4px 10px rgba(16, 63, 53, .08); }
.button-primary { background: linear-gradient(135deg, #103f35, #176653); color: #ffffff; }
.button-primary:hover { background: linear-gradient(135deg, #0c332b, #135944); }
.button-secondary { background: #fff1cf; border-color: #ebc86f; color: #684609; }
.button-secondary:hover { background: #ffe6a9; }
.button-danger { background: #ae3d4d; }
.button-danger:hover { background: #922f40; }

.stat-card { border-top: 4px solid #287b67; }
.stat-card::after { background: #d9aa47; }
.stat-card strong { color: #103f35; }
.service-card { position: relative; border-color: #c8ddd4; background: #ffffff; box-shadow: none; }
.service-card::after { content: ''; position: absolute; right: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 4px; background: #cad9d2; }
.service-card:hover { border-color: #73ae99; box-shadow: 0 14px 28px rgba(16, 63, 53, .11); }
.service-card-active { border-color: #68ab91; background: linear-gradient(145deg, #ffffff, #ecf8f1); }
.service-card-active::after { background: #176653; }
.service-number { background: #fff1cf; color: #785009; }
.service-link { color: #176653; }
.school-card { border-right: 5px solid #d9aa47; }

.compact-form, .schedule-builder, .period-item, .details-list > div, .account-summary-list > div,
.account-workspaces article, .account-session-list article, .term-row, .break-card, .profile-settings-details,
.platform-owner-actions form, .member-protected-note { border-color: #d0e1d9; background: #f8fcfa; }
.account-summary-list > div:nth-child(4n + 1), .period-item:nth-child(4n + 1) { border-right: 4px solid #287b67; }
.account-summary-list > div:nth-child(4n + 2), .period-item:nth-child(4n + 2) { border-right: 4px solid #d9aa47; }
.account-summary-list > div:nth-child(4n + 3), .period-item:nth-child(4n + 3) { border-right: 4px solid #397bb4; }
.account-summary-list > div:nth-child(4n) { border-right: 4px solid #b94d5b; }
.account-summary-list dt, .details-list dt { color: #567067; }
.account-summary-list dd, .details-list dd { color: #12332c; }
.day-option span { border-color: #c5dbd1; background: #ffffff; color: #46665c; }
.day-option input:checked + span { border-color: #287b67; background: #e5f5ed; color: #13583f; box-shadow: inset 0 0 0 1px #287b67; }
.settings-nav a { border-color: #bdd6cb; background: #ffffff; color: #16463a; }
.settings-nav a:hover, .settings-nav a[aria-current='page'] { border-color: #287b67; background: #e6f6ee; color: #13583f; }
.year-card-current { border-color: #73b69a; box-shadow: inset 5px 0 0 #176653; }
.run-status-completed, .availability-ready, .readiness-check-ready, .communication-status-sent { background: #e6f7ed; color: #13583f; }
.run-status-failed, .availability-missing, .readiness-check-blocker, .communication-status-cancelled { background: #fff0f3; color: #8d2d3d; }
.run-status-generating, .run-status-draft, .readiness-check-warning, .communication-status-ready { background: #fff5dc; color: #785009; }

/* Header and login copy must stay legible on dark brand surfaces. */
.topbar .school-chip { color: #ffffff; font-weight: 700; text-shadow: 0 1px 1px rgba(0, 0, 0, .18); }
.topbar .user-name { color: #f1fbf6; font-weight: 600; text-shadow: 0 1px 1px rgba(0, 0, 0, .18); }
