* { box-sizing: border-box; }
body { margin: 0; background: #edf2f8; color: #182944; font-family: 'Noto Sans Gujarati', system-ui, sans-serif; line-height: 1.6; }
main { width: min(1150px, 94%); margin: 32px auto; }
.auth { max-width: 520px; }
.card { padding: 24px; background: #fff; border: 1px solid #d9e2ef; border-radius: 14px; margin-bottom: 20px; box-shadow: 0 8px 25px #1829440b; }
h1, h2 { color: #203e78; margin-top: 0; }
label { display: block; font-weight: 600; margin-top: 12px; }
input, select, button { font: inherit; }
input, select { display: block; width: 100%; padding: 10px; border: 1px solid #b5c3d5; border-radius: 6px; background: #fff; }
button, .button { display: inline-block; background: #245da8; color: #fff; border: 0; padding: 10px 16px; border-radius: 7px; cursor: pointer; text-decoration: none; margin-top: 12px; }
button:disabled { opacity: .55; cursor: wait; }
.secondary { background: #54657d; }
.danger { background: #a62e35; }
a { color: #245da8; }
.message { padding: 12px; border-radius: 7px; background: #e2eafa; white-space: pre-line; }
.message:empty { display: none; }
.message.error { background: #ffe5e4; color: #8f2020; }
.muted { color: #55657b; font-size: .92em; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.stats { font-size: 1.1em; padding: 14px; background: #e5edfa; border-radius: 8px; margin-bottom: 18px; }
.badge { display: inline-block; border-radius: 20px; padding: 3px 12px; background: #e5edfa; font-weight: 700; }
.pending { background: #fff0bd; }
.active { background: #d7f0df; }
.blocked, .expired { background: #ffdfdc; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
[hidden] { display: none !important; }
@media (max-width: 600px) { .card { padding: 16px; } main { margin: 18px auto; } }

/* Login and Super Admin use a shared school-themed palette. */
body[data-page="login"], body[data-page="admin"] { background: #eef4f8; }
body[data-page="login"] { background: linear-gradient(135deg, #e6f0f8, #edf7f3); }
.eyebrow { display: block; color: #147477; font-size: .75rem; font-weight: 800; letter-spacing: .08em; }
.login-layout { max-width: 1080px; display: grid; grid-template-columns: 1fr 1fr; min-height: 650px; margin: 5vh auto; border-radius: 24px; overflow: hidden; background: #fff; box-shadow: 0 22px 70px #193e611a; border: 1px solid #d4e2ed; }
.login-brand { padding: 44px; color: #fff; background: linear-gradient(155deg, #183b5e, #155d6b); position: relative; border-bottom: 5px solid #dbb562; }
.brand-mark { display: grid; place-items: center; width: 58px; height: 58px; background: #ffffff18; border: 1px solid #b4ccd1; border-radius: 16px; font-size: 2rem; font-weight: 800; margin-bottom: 26px; }
.login-brand .eyebrow, .admin-hero .eyebrow { color: #f4d698; }
.login-brand h1 { color: #fff; font-size: clamp(2rem, 4vw, 3.1rem); margin: 14px 0; line-height: 1.4; }
.brand-description { color: #d9e9ee; font-size: 1.1rem; }
.login-features { list-style: none; padding: 0; display: grid; gap: 20px; margin: 32px 0; }
.login-features li { padding-left: 15px; border-left: 3px solid #dbb562; }
.login-features strong, .login-features span { display: block; }
.login-features span, .brand-footer { color: #d0e1e8; font-size: .85rem; }
.brand-footer { margin: 28px 0 0; }
.login-content { padding: 42px; align-self: center; min-width: 0; }
.login-content .card { padding: 0; border: 0; border-radius: 0; box-shadow: none; margin: 0; }
.login-content h2 { font-size: 1.8rem; margin: 8px 0; }
.login-content input { min-height: 48px; background: #f8fafc; }
.login-content button[type="submit"] { width: 100%; background: #147477; min-height: 48px; margin-top: 24px; font-weight: 700; }
.register-invite { border-top: 1px solid #dce6ee; margin-top: 26px; padding-top: 20px; text-align: center; }
.register-invite span { display: block; color: #52677c; }
.login-content .secondary { color: #244967; background: #e8eff6; }
.login-help { background: #f1f5fa; padding: 14px; border-radius: 8px; color: #52677c; font-size: .8rem; margin-top: 24px; }
.login-content .message { margin-bottom: 20px; }
.admin-layout { max-width: 1250px; }
.admin-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 30px; border-radius: 18px; color: #e0ecf3; background: linear-gradient(120deg, #193e61, #176575); border-bottom: 4px solid #dbb562; margin-bottom: 24px; }
.admin-hero h1 { color: #fff; margin: 8px 0; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.admin-hero p { margin: 0; }
.hero-link { background: #ffffff17; border: 1px solid #93b8c6; white-space: nowrap; margin: 0; }
.admin-layout > .message:not(:empty) { margin-bottom: 20px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { border: 1px solid #d8e4ed; border-radius: 12px; padding: 16px; background: #fff; min-width: 0; overflow-wrap: anywhere; }
.metric-label { display: block; color: #50677d; font-size: .85rem; }
.metric-value { display: block; font-size: 1.6rem; color: #193e61; font-weight: 800; margin: 5px 0; }
.metric-detail { display: block; color: #54697e; font-size: .8rem; }
.metric.teal { border-top: 3px solid #147d80; }
.metric.gold { border-top: 3px solid #dab35e; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.section-heading h2 { margin: 4px 0 0; font-size: 1.3rem; }
.resource-panel { margin-top: 20px; }
.resource-panel .metric { background: #f5f9fc; }
.resource-panel .metric-grid { margin-top: 16px; margin-bottom: 12px; }
.resource-explanation { font-size: .82rem; color: #536a7d; background: #edf4f8; padding: 12px; border-radius: 8px; margin-bottom: 0; }
.usage-bar { width: 100%; height: 7px; display: block; appearance: none; border: 0; border-radius: 20px; overflow: hidden; margin: 10px 0; background: #dce7ed; }
.usage-bar::-webkit-progress-bar { background: #dce7ed; }
.usage-bar::-webkit-progress-value { background: #187d80; }
.usage-bar::-moz-progress-bar { background: #187d80; }
.school-toolbar { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 16px; align-items: end; }
.school-toolbar label { margin-top: 0; min-width: 0; }
.school-toolbar input, .school-toolbar select { min-height: 46px; }
.school-toolbar button { min-height: 46px; margin: 0; }
.school-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.school-card { margin: 0; border-top: 4px solid #1c6878; min-width: 0; overflow-wrap: anywhere; }
.school-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.school-heading h2 { font-size: 1.15rem; margin: 0; }
.school-heading .badge { flex-shrink: 0; font-size: .75rem; }
.school-contact { margin: 12px 0; color: #50677b; font-size: .9rem; }
.school-contact span { display: block; }
.school-facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; font-size: .82rem; }
.school-facts span { background: #eef4f9; padding: 5px 9px; border-radius: 6px; }
.school-storage { background: #f2f8f7; border: 1px solid #d4e6e0; padding: 14px; border-radius: 10px; margin: 16px 0; }
.school-storage h3 { margin: 0 0 8px; color: #195e59; font-size: .95rem; }
.school-storage dl { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: .85rem; margin: 0; }
.school-storage dt, .school-storage dd { margin: 0; }
.school-storage dd { font-weight: 700; text-align: right; }
.school-storage .muted { font-size: .75rem; margin: 10px 0 0; }
.school-controls { border-top: 1px solid #dce5ed; padding-top: 14px; margin-top: 14px; }
.school-controls summary { cursor: pointer; color: #244f74; font-weight: 700; padding: 10px 0; min-height: 44px; }
.school-settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.school-settings > button { grid-column: 1 / -1; }
.school-card input, .school-card select { min-width: 0; max-width: 100%; }
body[data-page="login"] input:focus-visible, body[data-page="admin"] input:focus-visible,
body[data-page="admin"] select:focus-visible { outline: 3px solid #77b9c3; outline-offset: 2px; border-color: #147d80; }
body[data-page="login"] button:focus-visible, body[data-page="admin"] button:focus-visible,
.school-controls summary:focus-visible { outline: 3px solid #b28530; outline-offset: 3px; }
@media (max-width: 850px) {
    .login-layout { max-width: 580px; display: block; margin: 20px auto; min-height: 0; }
    .login-brand { padding: 26px; }
    .login-brand h1 br { display: none; }
    .login-brand h1 { font-size: 1.8rem; }
    .brand-mark { width: 44px; height: 44px; font-size: 1.5rem; margin-bottom: 16px; }
    .brand-description { margin-bottom: 0; font-size: .95rem; }
    .brand-description br { display: none; }
    .login-features, .brand-footer { display: none; }
    .login-content { padding: 28px; }
    .school-grid { grid-template-columns: 1fr; }
}
@media (max-width: 550px) {
    .login-layout { border-radius: 16px; margin: 12px auto; }
    .login-brand, .login-content { padding: 22px; }
    .login-brand .eyebrow { font-size: .65rem; }
    .login-content h2 { font-size: 1.5rem; }
    .admin-hero { padding: 22px 18px; flex-direction: column; align-items: flex-start; }
    .hero-link { padding: 8px 14px; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .metric { padding: 12px; }
    .metric-value { font-size: 1.25rem; }
    .school-toolbar { grid-template-columns: 1fr; gap: 12px; }
    .school-settings { grid-template-columns: 1fr; }
    .school-heading { flex-direction: column; }
    .school-storage { padding: 12px; }
    .school-storage dl { grid-template-columns: minmax(0, 1fr) auto; }
}

/* Toast and confirmation modal styles live in responsive.css (injected on every page by server.js) */

/* 3. EMPTY STATE: moved to responsive.css (injected on every page by server.js) */

/* 4. BREADCRUMBS: moved to responsive.css (injected on every page by server.js) */

/* 5. WHATSAPP SKELETON LOADER: moved to responsive.css (injected on every page by server.js) */

/* 6. SKELETON PAGE LOADER: moved to responsive.css (injected on every page by server.js) */

/* 7. MOBILE STICKY SAVE (For Marks Entry) */
@media (max-width: 700px) {
    .mobile-sticky-save {
        position: sticky;
        bottom: 0;
        z-index: 100;
        box-shadow: 0 -4px 15px rgba(0,0,0,0.2);
        border-top: 2px solid #f4b942;
        background: #fff;
        padding: 10px 8px;
    }
}