/* Shared application finish. Document dimensions and print styles stay in their own templates. */
:root {
    --ui-primary: #2458c5;
    --ui-primary-hover: #1b449d;
    --ui-ink: #182c49;
    --ui-muted: #596c84;
    --ui-border: #dbe4ef;
    --ui-canvas: #f3f6fb;
    --ui-surface: #fff;
    --ui-radius: 14px;
    --ui-shadow: 0 4px 20px rgb(24 44 73 / 4%);
}

@media screen {
    body.school-app, body.school-login, body.school-document {
        color: var(--ui-ink);
        background-color: var(--ui-canvas);
        font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
        line-height: 1.55;
        -webkit-font-smoothing: antialiased;
    }
    body.school-app .main {
        margin-left: 260px;
        width: calc(100% - 260px);
        min-width: 0;
        min-height: 100vh;
    }
    body.school-app .main:not(.dashboard-page) {
        padding: 98px clamp(18px, 2.5vw, 40px) 36px;
        background: var(--ui-canvas);
    }
    body.school-app .main.payroll-page { max-width: none; }
    body.school-app .main :where(div, section, article, form, fieldset) { min-width: 0; }
    body.school-app .main .app-table-scroll {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        border-radius: 10px;
    }
    body.school-app.nav-collapsed .main { margin-left: 0; width: 100%; }
    body.school-app .main:not(.dashboard-page) :is(h1, h2, h3) {
        color: var(--ui-ink);
        line-height: 1.25;
        overflow-wrap: anywhere;
    }
    body.school-app .main:not(.dashboard-page) h1 {
        font-size: clamp(24px, 2.2vw, 32px);
        font-weight: 750;
        letter-spacing: -.7px;
    }
    body.school-app .main:not(.dashboard-page) h2 { font-size: 20px; letter-spacing: -.3px; }
    body.school-app .main:not(.dashboard-page) h3 { font-size: 16px; }
    body.school-app .main:not(.dashboard-page) :is(.muted, .card-subtitle, .report-context, .page-subtitle) {
        color: var(--ui-muted);
        font-size: 14px;
        line-height: 1.65;
    }
    body.school-app .main:not(.dashboard-page) :is(.topbar, .page-head, .staff-hero) {
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        gap: 18px;
        padding: 24px;
        margin-bottom: 24px;
        border: 1px solid var(--ui-border);
        border-radius: var(--ui-radius);
        background: var(--ui-surface);
        box-shadow: var(--ui-shadow);
    }
    body.school-app .main:not(.dashboard-page) :is(.topbar, .page-head, .staff-hero) p { margin: 6px 0 0; }
    body.school-app .main:not(.dashboard-page) :is(.card, .panel, .controls, .filter-card, .form-card, .table-card,
        .rc-card, .cf-card, .premium-panel-card) {
        border: 1px solid var(--ui-border);
        border-radius: var(--ui-radius);
        background: var(--ui-surface);
        box-shadow: var(--ui-shadow);
    }
    body.school-app .main:not(.dashboard-page) .card { padding: 24px; margin-bottom: 24px; }
    body.school-app .main:not(.dashboard-page) :is(.actions, .form-actions, .topbar-actions, .form-buttons, .workflow-actions) {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: 10px;
    }
    body.school-app .main label { color: #344965; font-size: 13px; font-weight: 650; }
    body.school-app .main:not(.dashboard-page) :is(input, select, textarea):not([type=hidden]):not([type=checkbox]):not([type=radio]):not([type=submit]):not([type=button]) {
        width: 100%;
        max-width: 100%;
        min-height: 44px;
        padding: 11px 13px;
        border: 1px solid #c8d5e5;
        border-radius: 9px;
        background: #fcfdff;
        color: var(--ui-ink);
        font-size: 14px;
        line-height: 1.4;
        box-shadow: none;
    }
    body.school-app .main:not(.dashboard-page) :is(input[type=checkbox], input[type=radio]) {
        width: 18px;
        height: 18px;
        min-height: 0;
        margin: 0;
        accent-color: var(--ui-primary);
        flex-shrink: 0;
    }
    body.school-app .main input[type=file] { padding: 9px; }
    body.school-app .main input::file-selector-button {
        padding: 7px 12px;
        margin-right: 12px;
        border: 0;
        border-radius: 6px;
        background: #eaf0fc;
        color: #244b91;
        font: inherit;
        cursor: pointer;
    }
    body.school-app .main textarea { min-height: 100px; resize: vertical; }
    body.school-app .main:not(.dashboard-page) :is(input, select, textarea):disabled { background: #edf1f6; color: #6b798b; cursor: not-allowed; }
    body.school-app .main:not(.dashboard-page) :is(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
    body.school-document :is(a, button):focus-visible {
        outline: 3px solid #83a8f5;
        outline-offset: 3px;
    }
    body.school-app .main:not(.dashboard-page) :is(.btn, .cf-btn, .rc-btn, .fd-btn, .fs-btn, .fb-btn, .tm-btn, .cl-btn, .bk-btn, .btn-premium-action) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        min-height: 42px;
        padding: 10px 16px;
        border: 1px solid transparent;
        border-radius: 9px;
        background: var(--ui-primary);
        color: #fff;
        font-size: 13px;
        font-weight: 650;
        line-height: 1.4;
        text-decoration: none;
        cursor: pointer;
        box-shadow: none;
        transition: background-color .15s, box-shadow .15s;
    }
    body.school-app .main:not(.dashboard-page) :is(.btn, .cf-btn, .rc-btn, .fd-btn, .fs-btn, .fb-btn, .tm-btn, .cl-btn, .bk-btn):hover {
        filter: brightness(.96);
        box-shadow: 0 3px 8px rgb(24 44 73 / 10%);
    }
    body.school-app .main:not(.dashboard-page) :is(.btn.secondary, .btn-secondary, .btn-light, .btn-cancel, .cf-btn-light,
        .rc-btn-light, .fd-btn-light, .fs-btn-light, .fb-btn-light, .tm-btn-light, .cl-btn-light, .bk-btn-light) {
        background: #eef3fc;
        color: #2a4a7b;
        border-color: #d8e3f3;
    }
    body.school-app .main:not(.dashboard-page) :is(.btn-danger, .btn.danger, .btn-delete, .btn-suspend, .rc-btn-danger) {
        background: #b52d45;
        color: #fff;
    }
    body.school-app .main:not(.dashboard-page) :is(.btn-success, .btn-green, .btn-activate) { background: #147a60; color: #fff; }
    body.school-app .main button:disabled { opacity: .55; cursor: not-allowed; }
    body.school-app .main:not(.dashboard-page) :is(.table-wrap, .table-responsive, .table-responsive-shell, .rc-table-wrap) {
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        border-radius: 10px;
    }
    body.school-app .main:not(.dashboard-page) table { width: 100%; border-collapse: collapse; font-size: 13px; }
    body.school-app .main:not(.dashboard-page) table :is(th, td) { padding: 14px 16px; border-bottom: 1px solid #e6ecf4; vertical-align: middle; }
    body.school-app .main:not(.dashboard-page) table thead th {
        background: #eef3fa;
        color: #415674;
        font-size: 11px;
        font-weight: 750;
        letter-spacing: .6px;
        text-transform: uppercase;
        white-space: nowrap;
    }
    body.school-app .main:not(.dashboard-page) table tbody td { color: #304560; }
    body.school-app .main:not(.dashboard-page) table tbody tr:hover { background: #f8faff; }
    body.school-app .main:not(.dashboard-page) table tfoot :is(th, td) { background: #eef3fa; color: var(--ui-ink); font-weight: 750; }
    body.school-app .main:not(.dashboard-page) :is(.amount, .stat strong, .summary-card strong, .rc-stat-value) { font-variant-numeric: tabular-nums; }
    body.school-app .main:not(.dashboard-page) :is(.stat, .stat-card, .summary-card, .rc-stat, .kpi-card) {
        border: 1px solid var(--ui-border);
        border-radius: 12px;
        box-shadow: var(--ui-shadow);
    }
    body.school-app .main:not(.dashboard-page) :is(.badge.paid, .badge.active) { background: #e6f4ed; color: #176348; }
    body.school-app .main .badge.partial { background: #fff3d9; color: #815413; }
    body.school-app .main:not(.dashboard-page) :is(.badge.unpaid, .badge.inactive) { background: #edf0f5; color: #526078; }
    body.school-app .main:not(.dashboard-page) :is(.alert-success, .alert.success) { background: #edf8f2; border: 1px solid #c8e6d5; color: #1b664b; }
    body.school-app .main:not(.dashboard-page) :is(.alert-error, .alert.error, .notice.danger) { background: #fff1f3; border: 1px solid #efc8d0; color: #9b2b42; }
    body.school-app .main .notice:not(.danger) { background: #edf3ff; border: 1px solid #d5e2fc; color: #34547f; }
    body.school-app .main.payroll-page details { padding: 18px; border: 1px solid var(--ui-border); border-radius: 10px; background: #f9fbfe; }
    body.school-app .main.payroll-page .staff-section .step { background: #eaf0fc; color: #2c57a8; }
    body.school-app .main.payroll-page .staff-photo-panel { background: #f6f9fe; border-color: #c6d5e9; }
    body.school-app .main .staff-savebar { margin-top: 24px; }
    body.school-app .main .empty { padding: 36px 20px; color: var(--ui-muted); text-align: center; }

    /* Documents share screen controls while their saved/printed layouts stay intact. */
    body.school-document :is(.fi-actions, .pr-actions, .toolbar, .actions) { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
    body.school-document :is(.fi-btn, .pr-btn, .toolbar button, .toolbar .actions a, .actions button, .actions a) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-height: 42px;
        padding: 10px 16px;
        border: 1px solid #d4e0f2;
        border-radius: 9px;
        background: var(--ui-primary);
        color: white;
        font: 600 14px/1.4 ui-sans-serif, system-ui, sans-serif;
        text-decoration: none;
        cursor: pointer;
    }
    body.school-document :is(.fi-invoice, .pr-receipt, .statement) { box-shadow: 0 12px 44px rgb(24 44 73 / 9%); }
    body.school-login .login-card { box-shadow: 0 20px 70px rgb(24 44 73 / 12%); border: 1px solid var(--ui-border); }
}

@media screen and (max-width: 768px) {
    body.school-app .main { margin-left: 0; width: 100%; }
    body.school-app .main:not(.dashboard-page) { padding: 88px 14px 24px; }
    body.school-app .main:not(.dashboard-page) :is(.topbar, .page-head, .staff-hero) { padding: 18px; align-items: flex-start; }
    body.school-app .main:not(.dashboard-page) .card { padding: 18px; }
    body.school-app .main:not(.dashboard-page) :is(.grid, .form-grid) { grid-template-columns: minmax(0, 1fr); }
    body.school-app .main:not(.dashboard-page) table :is(th, td) { padding: 12px; }
    body.school-app .main.payroll-page .stats { gap: 10px; }
    body.school-app .app-header { gap: 8px; }
    body.school-app .app-header input { min-width: 0; width: min(42vw, 220px); }
    body.school-app .main .staff-savebar { align-items: stretch; }
    body.school-document .toolbar { align-items: flex-start; }
    body.school-document .statement { padding: 20px 14px; }
    body.school-document .statement table { font-size: 12px; table-layout: fixed; width: 100%; }
    body.school-document .statement :is(th, td) { padding: 9px 5px; overflow-wrap: anywhere; }
}

@media print {
    .app-table-scroll { overflow: visible !important; max-width: none !important; border-radius: 0 !important; }
}

@media (prefers-reduced-motion: reduce) {
    body.school-app *, body.school-login *, body.school-document * { transition: none !important; animation: none !important; }
}
