/* SchoolCore CMS — Phase 1 styles
   Colours are driven entirely by CSS custom properties injected from the
   Branding module (see Schoolcore_Branding::inline_css_vars). Never
   hard-code brand colours in this file. */

:root {
        --schoolcore-primary: #1E3A8A;
        --schoolcore-secondary: #3B82F6;
        --schoolcore-accent: #F59E0B;
        --schoolcore-bg: #F3F4F6;
        --schoolcore-surface: #FFFFFF;
        --schoolcore-text: #1F2937;
        --schoolcore-text-muted: #6B7280;
        --schoolcore-border: #E5E7EB;
        --schoolcore-danger: #DC2626;
        --schoolcore-success: #16A34A;
        --schoolcore-radius: 10px;
        --schoolcore-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.schoolcore-body {
        margin: 0;
        background: var(--schoolcore-bg);
        font-family: var(--schoolcore-font);
        color: var(--schoolcore-text);
        -webkit-font-smoothing: antialiased;
}

.schoolcore-app * {
        box-sizing: border-box;
}

/* ---------------------------------------------------------------
   Login screen
------------------------------------------------------------------ */
.schoolcore-login-screen {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 24px 0;
}

.schoolcore-login-card {
        width: 100%;
        max-width: 420px;
        background: var(--schoolcore-surface);
        border-radius: var(--schoolcore-radius);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18);
        padding: 32px 28px;
}

.schoolcore-login-brand {
        text-align: center;
        margin-bottom: 24px;
}

.schoolcore-login-logo {
        max-height: 64px;
        margin-bottom: 12px;
}

.schoolcore-login-school-name {
        margin: 0;
        font-size: 1.4rem;
        font-weight: 700;
        color: var(--schoolcore-text);
}

.schoolcore-role-tabs {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 22px;
}

.schoolcore-role-tab {
        border: 1px solid var(--schoolcore-border);
        background: var(--schoolcore-bg);
        color: var(--schoolcore-text-muted);
        padding: 10px 6px;
        border-radius: 8px;
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.15s ease;
}

.schoolcore-role-tab:hover {
        border-color: var(--schoolcore-secondary);
}

.schoolcore-role-tab.is-active {
        background: var(--schoolcore-primary);
        border-color: var(--schoolcore-primary);
        color: #fff;
}

.schoolcore-form {
        display: flex;
        flex-direction: column;
        gap: 16px;
}

.schoolcore-field {
        display: flex;
        flex-direction: column;
        gap: 6px;
}

.schoolcore-field-label {
        font-size: 0.85rem;
        font-weight: 600;
        color: var(--schoolcore-text-muted);
}

.schoolcore-field input[type="text"],
.schoolcore-field input[type="email"],
.schoolcore-field input[type="password"] {
        padding: 11px 12px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
        font-size: 1rem;
        width: 100%;
}

.schoolcore-field input:focus {
        outline: none;
        border-color: var(--schoolcore-secondary);
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.schoolcore-form-row-split {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
}

.schoolcore-checkbox {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 0.85rem;
        color: var(--schoolcore-text-muted);
}

.schoolcore-link-button {
        background: none;
        border: none;
        color: var(--schoolcore-secondary);
        font-size: 0.85rem;
        font-weight: 600;
        cursor: pointer;
        padding: 0;
}

.schoolcore-back-link {
        margin-top: 4px;
        text-align: center;
}

.schoolcore-btn {
        appearance: none;
        border: none;
        border-radius: 8px;
        padding: 12px 18px;
        font-size: 0.95rem;
        font-weight: 700;
        cursor: pointer;
        transition: transform 0.05s ease, opacity 0.15s ease;
}

.schoolcore-btn:active {
        transform: scale(0.98);
}

.schoolcore-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
}

.schoolcore-btn-primary {
        background: var(--schoolcore-primary);
        color: #fff;
}

.schoolcore-btn-primary:hover:not(:disabled) {
        background: var(--schoolcore-secondary);
}

.schoolcore-btn-ghost {
        background: transparent;
        border: 1px solid var(--schoolcore-border);
        color: var(--schoolcore-text);
        padding: 8px 14px;
        font-weight: 600;
}

.schoolcore-btn-block {
        width: 100%;
}

.schoolcore-form-error {
        background: #FEF2F2;
        border: 1px solid #FECACA;
        color: var(--schoolcore-danger);
        padding: 10px 12px;
        border-radius: 8px;
        font-size: 0.85rem;
}

.schoolcore-form-success {
        background: #F0FDF4;
        border: 1px solid #BBF7D0;
        color: var(--schoolcore-success);
        padding: 10px 12px;
        border-radius: 8px;
        font-size: 0.85rem;
}

.schoolcore-form-help {
        font-size: 0.85rem;
        color: var(--schoolcore-text-muted);
        margin: 0;
}

.schoolcore-owner-message {
        text-align: center;
        color: var(--schoolcore-text-muted);
        margin-bottom: 18px;
}

.schoolcore-owner-card .schoolcore-btn-block {
        display: block;
        text-align: center;
        text-decoration: none;
}

.schoolcore-owner-card .schoolcore-back-link {
        display: block;
        text-align: center;
        margin-top: 14px;
}

.schoolcore-login-footer {
        margin-top: 20px;
        color: var(--schoolcore-text-muted);
        font-size: 0.8rem;
        text-align: center;
}

/* ---------------------------------------------------------------
   Dashboard shell
------------------------------------------------------------------ */
.schoolcore-dashboard {
        display: flex;
        min-height: 100vh;
        background: var(--schoolcore-bg);
}

.schoolcore-sidebar {
        width: 250px;
        flex-shrink: 0;
        background: var(--schoolcore-primary);
        color: #fff;
        display: flex;
        flex-direction: column;
        position: relative;
        transition: transform 0.2s ease;
}

.schoolcore-sidebar-close {
        display: none;
        position: absolute;
        top: 10px;
        right: 10px;
        width: 34px;
        height: 34px;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.12);
        border: none;
        border-radius: 8px;
        color: #fff;
        font-size: 1.4rem;
        line-height: 1;
        cursor: pointer;
        z-index: 1;
}

.schoolcore-sidebar-close:hover {
        background: rgba(255, 255, 255, 0.22);
}

.schoolcore-sidebar-overlay {
        display: none;
}

.schoolcore-sidebar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 20px 44px 20px 18px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.schoolcore-sidebar-logo {
        max-height: 34px;
        border-radius: 4px;
}

.schoolcore-sidebar-school-name {
        font-weight: 700;
        font-size: 1rem;
        line-height: 1.2;
}

.schoolcore-sidebar-nav ul {
        list-style: none;
        margin: 0;
        padding: 12px 0;
}

.schoolcore-sidebar-nav a {
        display: block;
        padding: 11px 20px;
        color: rgba(255, 255, 255, 0.85);
        text-decoration: none;
        font-size: 0.9rem;
        font-weight: 500;
        border-left: 3px solid transparent;
}

.schoolcore-sidebar-nav li.is-active a,
.schoolcore-sidebar-nav a:hover {
        background: rgba(255, 255, 255, 0.08);
        border-left-color: var(--schoolcore-accent);
        color: #fff;
}

.schoolcore-main {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-width: 0;
}

.schoolcore-topbar {
        display: flex;
        align-items: center;
        gap: 14px;
        background: var(--schoolcore-surface);
        border-bottom: 1px solid var(--schoolcore-border);
        padding: 14px 22px;
}

.schoolcore-sidebar-toggle {
        display: none;
        background: none;
        border: none;
        font-size: 1.3rem;
        cursor: pointer;
}

.schoolcore-role-badge {
        background: var(--schoolcore-accent);
        color: #1F2937;
        font-size: 0.75rem;
        font-weight: 700;
        padding: 4px 10px;
        border-radius: 999px;
        text-transform: uppercase;
        letter-spacing: 0.03em;
}

.schoolcore-topbar-school-switch {
        display: flex;
        align-items: center;
        margin-left: 16px;
}

.schoolcore-topbar-school-switch select {
        padding: 4px 8px;
        border-radius: 6px;
        border: 1px solid var(--schoolcore-border, #D1D5DB);
        font-size: 0.85rem;
}

.schoolcore-topbar-user {
        margin-left: auto;
        display: flex;
        align-items: center;
        gap: 12px;
}

.schoolcore-user-name {
        font-weight: 600;
        font-size: 0.9rem;
}

.schoolcore-inline-form {
        display: inline;
}

.schoolcore-content {
        flex: 1;
        padding: 26px;
        overflow-x: auto;
}

.schoolcore-placeholder-panel {
        background: var(--schoolcore-surface);
        border: 1px solid var(--schoolcore-border);
        border-radius: var(--schoolcore-radius);
        padding: 28px;
        max-width: 640px;
}

.schoolcore-placeholder-panel h2 {
        margin-top: 0;
}

.schoolcore-footer {
        padding: 14px 22px;
        font-size: 0.8rem;
        color: var(--schoolcore-text-muted);
        border-top: 1px solid var(--schoolcore-border);
}

/* Any table rendered inside the app scrolls horizontally instead of
   breaking the layout, per the responsive-tables requirement. */
.schoolcore-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        border-collapse: collapse;
}

/* ---------------------------------------------------------------
   Responsive breakpoints
------------------------------------------------------------------ */
@media (max-width: 900px) {
        .schoolcore-sidebar {
                position: fixed;
                top: 0;
                left: 0;
                bottom: 0;
                width: 270px;
                max-width: 82vw;
                z-index: 50;
                transform: translateX(-100%);
                transition: transform 0.2s ease;
                overflow-y: auto;
        }

        .schoolcore-dashboard.is-sidebar-open .schoolcore-sidebar {
                transform: translateX(0);
        }

        .schoolcore-sidebar-toggle {
                display: inline-block;
        }

        .schoolcore-sidebar-close {
                display: flex;
        }

        .schoolcore-sidebar-overlay {
                display: block;
                position: fixed;
                inset: 0;
                background: rgba(17, 24, 39, 0.5);
                z-index: 45;
                opacity: 0;
                pointer-events: none;
                transition: opacity 0.2s ease;
        }

        .schoolcore-dashboard.is-sidebar-open .schoolcore-sidebar-overlay {
                opacity: 1;
                pointer-events: auto;
        }
}

body.schoolcore-body-locked {
        overflow: hidden;
}

@media (max-width: 480px) {
        .schoolcore-role-tabs {
                grid-template-columns: 1fr 1fr;
        }

        .schoolcore-login-card {
                padding: 24px 18px;
        }

        .schoolcore-content {
                padding: 16px;
        }
}

/* ---------------------------------------------------------------
   Administrator panels (Phase 2)
------------------------------------------------------------------ */
.schoolcore-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 10px;
        margin-bottom: 18px;
}

.schoolcore-panel-header-actions {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
}

.schoolcore-panel-title {
        margin: 0 0 18px;
        font-size: 1.3rem;
}

.schoolcore-panel-header .schoolcore-panel-title {
        margin-bottom: 0;
}

.schoolcore-stat-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 14px;
        margin-bottom: 22px;
}

.schoolcore-stat-card {
        background: var(--schoolcore-surface);
        border: 1px solid var(--schoolcore-border);
        border-radius: var(--schoolcore-radius);
        padding: 18px;
        display: flex;
        flex-direction: column;
        gap: 4px;
}

.schoolcore-stat-value {
        font-size: 1.8rem;
        font-weight: 800;
        color: var(--schoolcore-primary);
}

.schoolcore-stat-label {
        font-size: 0.8rem;
        color: var(--schoolcore-text-muted);
        font-weight: 600;
}

.schoolcore-card {
        background: var(--schoolcore-surface);
        border: 1px solid var(--schoolcore-border);
        border-radius: var(--schoolcore-radius);
        padding: 20px;
        margin-bottom: 20px;
}

.schoolcore-card h3 {
        margin-top: 0;
}

.schoolcore-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.88rem;
}

.schoolcore-table th,
.schoolcore-table td {
        text-align: left;
        padding: 10px 8px;
        border-bottom: 1px solid var(--schoolcore-border);
        white-space: normal;
}

.schoolcore-table th {
        color: var(--schoolcore-text-muted);
        font-weight: 600;
        font-size: 0.78rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
}

.schoolcore-actions-cell {
        display: flex;
        gap: 10px;
        flex-wrap: wrap;
}

.schoolcore-badge {
        display: inline-block;
        padding: 3px 9px;
        border-radius: 999px;
        font-size: 0.72rem;
        font-weight: 700;
}

.schoolcore-badge-success {
        background: #DCFCE7;
        color: #15803D;
}

.schoolcore-badge-danger {
        background: #FEE2E2;
        color: #B91C1C;
}

.schoolcore-badge-info {
        background: #DBEAFE;
        color: #1D4ED8;
}

.schoolcore-notice {
        border-radius: 8px;
        padding: 14px 16px;
        font-size: 0.88rem;
}

.schoolcore-notice-info {
        background: #EFF6FF;
        border: 1px solid #BFDBFE;
        color: #1E40AF;
}

.schoolcore-notice-success {
        background: #ECFDF5;
        border: 1px solid #A7F3D0;
        color: #065F46;
}

.schoolcore-link-danger {
        color: var(--schoolcore-danger);
}

.schoolcore-form-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 14px;
        margin-bottom: 14px;
}

.schoolcore-field textarea {
        padding: 10px 12px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
        font-family: inherit;
        font-size: 1rem;
        width: 100%;
        resize: vertical;
}

.schoolcore-field select {
        padding: 10px 12px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
        font-size: 1rem;
        width: 100%;
        background: #fff;
}

.schoolcore-field input[type="color"] {
        width: 60px;
        height: 40px;
        padding: 2px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
}

.schoolcore-field-create-only {
        transition: none;
}

.schoolcore-checkbox-grid {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 8px 14px;
        max-height: 220px;
        overflow-y: auto;
        padding: 10px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
}

.schoolcore-assign-row {
        display: grid;
        grid-template-columns: 1fr 1fr auto;
        gap: 8px;
        align-items: center;
        margin-bottom: 8px;
}

.schoolcore-assign-row select {
        padding: 8px 10px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
}

/* ---------------------------------------------------------------
   Modals
------------------------------------------------------------------ */
.schoolcore-modal {
        position: fixed;
        inset: 0;
        background: rgba(17, 24, 39, 0.55);
        display: flex;
        align-items: flex-start;
        justify-content: center;
        overflow-y: auto;
        padding: 40px 16px;
        z-index: 100;
}

/* Without this, the [hidden] attribute set by JS (modal.hidden = true) is
   silently overridden by the "display: flex" rule above, since author
   styles beat the browser's built-in [hidden]{display:none} rule. That
   made every modal appear immediately on page load instead of waiting
   for its trigger button to be clicked. */
.schoolcore-modal[hidden] {
        display: none;
}

.schoolcore-modal-dialog {
        background: var(--schoolcore-surface);
        border-radius: var(--schoolcore-radius);
        padding: 26px;
        width: 100%;
        max-width: 520px;
        position: relative;
}

.schoolcore-modal-dialog h3 {
        margin-top: 0;
}

.schoolcore-modal-close {
        position: absolute;
        top: 14px;
        right: 16px;
        background: none;
        border: none;
        font-size: 1.4rem;
        line-height: 1;
        cursor: pointer;
        color: var(--schoolcore-text-muted);
}

.schoolcore-modal-dialog .schoolcore-form {
        gap: 14px;
}

.schoolcore-status-toggle {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
}

.schoolcore-status-option {
        display: flex;
        align-items: center;
        gap: 4px;
        font-size: 0.85rem;
        cursor: pointer;
}

#bulk-import-results {
        margin-top: 16px;
        max-height: 260px;
        overflow-y: auto;
}

/* ---------------------------------------------------------------
   Results & Performance (Phase 4)
------------------------------------------------------------------ */
.results-matrix-cell,
.results-grid-marks-input,
.submission-grade-input {
        padding: 6px 8px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 6px;
        font-size: 0.85rem;
}

#results-import-results,
#results-matrix-container,
#results-grid-container,
#performance-container {
        max-height: 480px;
        overflow-y: auto;
}

.schoolcore-perf-bar-track {
        width: 120px;
        height: 8px;
        background: var(--schoolcore-bg);
        border-radius: 999px;
        overflow: hidden;
}

.schoolcore-perf-bar-fill {
        height: 100%;
        background: var(--schoolcore-secondary);
        border-radius: 999px;
}

/* ---------------------------------------------------------------
   Performance bars — Student/Parent self-vs-class-average view (Phase 5)
------------------------------------------------------------------ */
.schoolcore-perf-row {
        padding: 10px 0;
        border-bottom: 1px solid var(--schoolcore-border);
}

.schoolcore-perf-row:last-child {
        border-bottom: none;
}

.schoolcore-perf-label {
        display: block;
        font-weight: 600;
        font-size: 0.85rem;
        color: var(--schoolcore-text-muted);
        margin-bottom: 6px;
}

.schoolcore-perf-bars {
        display: flex;
        flex-direction: column;
        gap: 6px;
}

.schoolcore-perf-bar-line {
        display: grid;
        grid-template-columns: 80px 1fr 40px;
        align-items: center;
        gap: 8px;
}

.schoolcore-perf-bar-tag {
        font-size: 0.78rem;
        color: var(--schoolcore-text-muted);
}

.schoolcore-perf-bar-value {
        font-size: 0.8rem;
        font-weight: 700;
        text-align: right;
}

.schoolcore-perf-bar-line .schoolcore-perf-bar-track {
        width: 100%;
}

.schoolcore-perf-bar-self {
        background: var(--schoolcore-primary);
}

.schoolcore-perf-bar-avg {
        background: var(--schoolcore-accent);
}

/* ---------------------------------------------------------------
   Notifications (Phase 6)
------------------------------------------------------------------ */
.schoolcore-notification-row {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        padding: 12px 0;
        border-bottom: 1px solid var(--schoolcore-border);
}

.schoolcore-notification-row:last-child {
        border-bottom: none;
}

.schoolcore-notification-row.is-unread {
        background: #EFF6FF;
        margin: 0 -12px;
        padding: 12px;
        border-radius: 8px;
        border-bottom-color: transparent;
}

.schoolcore-notification-row p {
        margin: 4px 0;
        font-size: 0.88rem;
}

.schoolcore-notification-row .notification-mark-read-btn {
        flex-shrink: 0;
        white-space: nowrap;
}

/* ---------------------------------------------------------------
   Responsive refinements (Phase 6)
------------------------------------------------------------------ */
@media (max-width: 700px) {
        .schoolcore-perf-bar-line {
                grid-template-columns: 60px 1fr 36px;
                gap: 6px;
        }

        .schoolcore-assign-row {
                grid-template-columns: 1fr;
                gap: 6px;
        }

        .schoolcore-checkbox-grid {
                grid-template-columns: 1fr;
        }

        .schoolcore-actions-cell {
                flex-direction: column;
                align-items: flex-start;
                gap: 6px;
        }

        .schoolcore-modal-dialog {
                padding: 20px 16px;
                max-width: 100%;
        }

        .schoolcore-panel-header {
                flex-direction: column;
                align-items: flex-start;
        }

        .schoolcore-notification-row {
                flex-direction: column;
        }

        .schoolcore-stat-grid {
                grid-template-columns: repeat(2, 1fr);
        }
}

@media (max-width: 420px) {
        .schoolcore-stat-grid {
                grid-template-columns: 1fr;
        }

        .schoolcore-form-grid {
                grid-template-columns: 1fr;
        }
}

/* ---------------------------------------------------------------
   Admin Attendance correction + Results "By Subject" pivot (Phase 6.1)
------------------------------------------------------------------ */
.schoolcore-table select {
        padding: 6px 8px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 6px;
        font-size: 0.85rem;
        background: #fff;
}

.schoolcore-pivot-average-row td {
        background: var(--schoolcore-bg);
        border-top: 2px solid var(--schoolcore-border);
}

.results-pivot-total {
        font-weight: 700;
        color: var(--schoolcore-primary);
}

/* ---------------------------------------------------------------
   Sidebar language switcher (bottom of every dashboard's sidebar)
------------------------------------------------------------------ */
.schoolcore-sidebar-nav {
        flex: 1;
}

.schoolcore-sidebar-language {
        padding: 14px 18px;
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
}

.schoolcore-sidebar-language-label {
        font-size: 0.75rem;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.65);
        text-transform: uppercase;
        letter-spacing: 0.03em;
}

.schoolcore-sidebar-language select {
        background: rgba(255, 255, 255, 0.12);
        color: #fff;
        border: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 6px;
        padding: 5px 8px;
        font-size: 0.82rem;
        max-width: 130px;
}

.schoolcore-sidebar-language select:disabled {
        opacity: 0.6;
}

.schoolcore-sidebar-language select option {
        color: #1F2937;
        background: #fff;
}

/* ---------------------------------------------------------------
 * Phase 2 — Parent->Student search input (inline) + wide Exam Report
 * ------------------------------------------------------------ */

/* Inline search field inside the parent modal: visually grouped with the
   checkbox grid below it rather than being its own card. */
.schoolcore-field-search-inline {
        display: block;
        margin: 8px 0 12px;
        padding: 0;
        border: 0;
        background: transparent;
}
.schoolcore-field-search-inline .schoolcore-field-label {
        display: block;
        font-size: 0.78rem;
        color: var(--schoolcore-text-muted);
        margin-bottom: 4px;
}
.schoolcore-field-search-inline input[type="search"] {
        width: 100%;
        padding: 8px 10px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 6px;
        font-size: 0.9rem;
        background: var(--schoolcore-surface);
}

/* Class-wide Exam Report — Student × Subject × Exam Type matrix.
   The table can get very wide; wrap it in a scrollable container so
   the dashboard layout never breaks on smaller screens. */
.schoolcore-report-wide-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-top: 10px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
}

.schoolcore-report-wide {
        min-width: 100%;
        white-space: nowrap;
}

.schoolcore-report-wide th,
.schoolcore-report-wide td {
        text-align: center;
        padding: 8px 10px;
        white-space: nowrap;
}

.schoolcore-report-wide thead th {
        border-bottom: 1px solid var(--schoolcore-border);
        background: var(--schoolcore-surface);
}

.schoolcore-report-wide thead tr:nth-child(2) th {
        font-size: 0.72rem;
        text-transform: none;
}

/* First two columns (Student / Student ID) stay left-aligned and sticky
   on horizontal scroll so the row identity is always visible. */
.schoolcore-report-wide thead th:first-child,
.schoolcore-report-wide thead th:nth-child(2),
.schoolcore-report-wide tbody td:first-child,
.schoolcore-report-wide tbody td:nth-child(2) {
        text-align: left;
        position: sticky;
        left: 0;
        background: var(--schoolcore-surface);
        z-index: 1;
}
.schoolcore-report-wide thead th:first-child,
.schoolcore-report-wide thead th:nth-child(2) {
        z-index: 2;
}

.schoolcore-report-wide tbody tr:hover td {
        background: rgba(0, 0, 0, 0.02);
}

/* Dashes for missing marks are styled subtly so they don't look like zeros. */
.schoolcore-report-wide td {
        color: var(--schoolcore-text);
}

@media (max-width: 720px) {
        .schoolcore-report-wide th,
        .schoolcore-report-wide td {
                padding: 6px 7px;
                font-size: 0.78rem;
        }
}

/* ---------------------------------------------------------------
 * Phase 3 — School Logo above dashboard title (in content area)
 * ------------------------------------------------------------ */

/*
 * The logo block sits between the panel opening <div> and the
 * <h2 class="schoolcore-panel-title">. When no logo is configured,
 * the partial outputs nothing — so the layout snaps directly to
 * the title with zero leftover space. This is the "graceful fallback"
 * required by the spec.
 */
.schoolcore-content-brand {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        margin: 0 0 14px;
        padding: 0;
}

.schoolcore-content-logo {
        max-height: 80px;
        width: auto;
        max-width: 100%;
        display: block;
        object-fit: contain;
        border-radius: 6px;
}

/* On tablet, scale down slightly so the logo doesn't dominate the
   panel header area. */
@media (max-width: 900px) {
        .schoolcore-content-logo {
                max-height: 64px;
        }
}

/* On phone, scale down further. The logo still appears above the title,
   but takes less of the narrow vertical viewport. */
@media (max-width: 480px) {
        .schoolcore-content-brand {
                margin-bottom: 10px;
        }
        .schoolcore-content-logo {
                max-height: 52px;
        }
}

/* ---------------------------------------------------------------
 * Finance & Cashier module
 * ------------------------------------------------------------ */

.schoolcore-finance-header {
        flex-wrap: wrap;
        gap: 10px;
}

.schoolcore-finance-paid {
        color: #065F46;
}

.schoolcore-finance-unpaid {
        color: #991B1B;
}

.schoolcore-finance-stats .schoolcore-stat-value {
        font-size: 1.35rem;
}

.schoolcore-finance-activity {
        margin-top: 18px;
}

.schoolcore-finance-activity-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 24px;
}

.schoolcore-finance-chart h3 {
        margin-top: 0 0 12px;
        font-size: 0.95rem;
}

.schoolcore-finance-bar {
        height: 14px;
        border-radius: 7px;
        background: #FEE2E2;
        overflow: hidden;
        border: 1px solid #FECACA;
}

.schoolcore-finance-bar-paid {
        height: 100%;
        background: #10B981;
        transition: width 0.4s ease;
}

.schoolcore-finance-bar-legend {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-top: 10px;
        font-size: 0.85rem;
}

.schoolcore-finance-dot {
        display: inline-block;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        margin-right: 6px;
        vertical-align: baseline;
}

.schoolcore-finance-dot-paid {
        background: #10B981;
}

.schoolcore-finance-dot-unpaid {
        background: #EF4444;
}

.schoolcore-finance-activity-list {
        list-style: none;
        margin: 0;
        padding: 0;
        font-size: 0.88rem;
}

.schoolcore-finance-activity-list li {
        padding: 5px 0;
        border-bottom: 1px dotted var(--schoolcore-border);
}

.schoolcore-finance-activity-list li:last-child {
        border-bottom: 0;
}

/* Wide payment tables scroll horizontally on small screens instead of
   breaking the dashboard layout. */
.schoolcore-finance-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
}

.schoolcore-finance-table-wrap table {
        margin: 0;
        min-width: 640px;
}

.schoolcore-finance-class-actions {
        margin-bottom: 8px;
}

.schoolcore-finance-fee-banner {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
        background: #EFF6FF;
        border: 1px solid #BFDBFE;
        border-radius: 8px;
        margin-bottom: 14px;
        flex-wrap: wrap;
}

.schoolcore-finance-fee-label {
        font-size: 0.82rem;
        color: var(--schoolcore-text-muted);
        text-transform: uppercase;
        letter-spacing: 0.04em;
}

.schoolcore-finance-fee-value {
        font-size: 1.1rem;
        font-weight: 700;
        color: var(--schoolcore-primary);
}

.schoolcore-finance-summary {
        display: grid;
        grid-template-columns: 130px 1fr;
        gap: 8px 12px;
        margin: 0 0 14px;
        padding: 0;
}

.schoolcore-finance-summary dt {
        font-size: 0.8rem;
        color: var(--schoolcore-text-muted);
        padding: 4px 0;
}

.schoolcore-finance-summary dd {
        margin: 0;
        padding: 4px 0;
        font-size: 0.9rem;
        border-bottom: 1px dotted var(--schoolcore-border);
}

/* Multiple-payment picker */
.schoolcore-finance-multi-results {
        max-height: 240px;
        overflow-y: auto;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
        padding: 6px;
}

.schoolcore-finance-add-list {
        display: flex;
        flex-direction: column;
        gap: 4px;
}

.schoolcore-finance-add-row {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        text-align: left;
        padding: 8px 10px;
        background: var(--schoolcore-surface);
        border: 1px solid var(--schoolcore-border);
        border-radius: 6px;
        cursor: pointer;
        font-size: 0.85rem;
        transition: background 0.15s ease, border-color 0.15s ease;
}

.schoolcore-finance-add-row:hover {
        background: #EFF6FF;
        border-color: var(--schoolcore-secondary);
}

.schoolcore-finance-add-row.is-selected {
        background: #ECFDF5;
        border-color: #10B981;
}

.schoolcore-finance-add-code {
        font-weight: 600;
        min-width: 64px;
}

.schoolcore-finance-add-name {
        flex: 1;
}

.schoolcore-finance-add-class {
        color: var(--schoolcore-text-muted);
        font-size: 0.8rem;
}

.schoolcore-finance-selected-list {
        max-height: 220px;
        overflow-y: auto;
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
        padding: 6px;
}

.schoolcore-finance-selected-row {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 7px 10px;
        border-bottom: 1px dotted var(--schoolcore-border);
        font-size: 0.87rem;
}

.schoolcore-finance-selected-row:last-child {
        border-bottom: 0;
}

.schoolcore-finance-selected-row > span:first-child {
        flex: 1;
}

.schoolcore-finance-selected-price {
        font-weight: 600;
        white-space: nowrap;
}

.schoolcore-finance-totals {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        margin: 14px 0;
        padding: 12px 14px;
        background: var(--schoolcore-surface);
        border: 1px solid var(--schoolcore-border);
        border-radius: 8px;
        font-size: 0.92rem;
        flex-wrap: wrap;
}

/* ---------------------------------------------------------------
 * Receipt — on-screen rendering inside the modal.
 * (The print window injects its own stylesheet in finance.js, so what
 * you see here only affects the dashboard preview.)
 * ------------------------------------------------------------ */
.schoolcore-receipt {
        max-width: 460px;
        margin: 0 auto;
        background: #fff;
        border: 1px solid #333;
        padding: 26px;
        font-family: Georgia, "Times New Roman", serif;
        color: #111;
}

.schoolcore-receipt-head {
        text-align: center;
        border-bottom: 2px solid #333;
        padding-bottom: 14px;
        margin-bottom: 16px;
}

.schoolcore-receipt-logo {
        max-height: 64px;
        display: block;
        margin: 0 auto 8px;
}

.schoolcore-receipt-school {
        margin: 0;
        font-size: 1.15rem;
        letter-spacing: 0.02em;
}

.schoolcore-receipt-title {
        margin-top: 6px;
        font-size: 0.8rem;
        letter-spacing: 0.14em;
        color: #444;
}

.schoolcore-receipt-meta {
        display: flex;
        justify-content: space-between;
        font-size: 0.85rem;
        margin-bottom: 14px;
        flex-wrap: wrap;
        gap: 6px;
}

.schoolcore-receipt-label {
        color: #555;
        margin-right: 4px;
}

.schoolcore-receipt-fields {
        margin: 0;
}

.schoolcore-receipt-fields dt {
        float: left;
        clear: left;
        width: 42%;
        font-size: 0.82rem;
        color: #555;
        padding: 3px 0;
}

.schoolcore-receipt-fields dd {
        margin-left: 44%;
        font-size: 0.88rem;
        padding: 3px 0;
        border-bottom: 1px dotted #ccc;
}

.schoolcore-receipt-heading {
        font-size: 0.8rem;
        letter-spacing: 0.1em;
        color: #444;
        margin: 0 0 8px;
}

.schoolcore-receipt-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.85rem;
}

.schoolcore-receipt-table td {
        padding: 5px 4px;
        vertical-align: top;
        border-bottom: 1px dotted #ccc;
}

.schoolcore-receipt-num {
        width: 22px;
        color: #555;
}

.schoolcore-receipt-sub {
        display: block;
        font-size: 0.72rem;
        color: #666;
}

.schoolcore-receipt-amount {
        text-align: right;
        white-space: nowrap;
}

.schoolcore-receipt-total {
        display: flex;
        justify-content: space-between;
        border-top: 2px solid #333;
        margin-top: 14px;
        padding-top: 10px;
        font-size: 1rem;
}

.schoolcore-receipt-recorded {
        font-size: 0.82rem;
        margin-top: 14px;
}

.schoolcore-receipt-paid {
        font-weight: bold;
        letter-spacing: 0.08em;
        color: #065F46;
}

.schoolcore-receipt-footer {
        margin-top: 22px;
        padding-top: 12px;
        border-top: 1px solid #ccc;
        font-size: 0.72rem;
        color: #666;
        text-align: center;
}

/* Responsive finance layout: keep every action reachable on phones. */
@media (max-width: 720px) {
        .schoolcore-finance-header {
                flex-direction: column;
                align-items: stretch;
        }

        .schoolcore-finance-header .schoolcore-panel-header-actions {
                display: flex;
                flex-direction: column;
                gap: 8px;
        }

        .schoolcore-finance-header .schoolcore-panel-header-actions .schoolcore-btn {
                width: 100%;
        }

        .schoolcore-finance-summary {
                grid-template-columns: 110px 1fr;
        }

        .schoolcore-finance-totals {
                flex-direction: column;
                align-items: flex-start;
        }

        .schoolcore-receipt {
                padding: 16px;
        }
}

/* ---------------------------------------------------------------
 * Phase 1.3 — Announcement card actions + stats table
 * ------------------------------------------------------------ */

.schoolcore-announcement-card .schoolcore-announcement-actions {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-top: 10px;
        padding-top: 10px;
        border-top: 1px solid var(--schoolcore-border);
}

.schoolcore-btn-sm {
        padding: 5px 10px;
        font-size: 0.82rem;
}

/* Statistics table — emphasise the Total row */
.schoolcore-stats-table {
        margin-top: 10px;
}

.schoolcore-stats-table .schoolcore-stats-totals td {
        border-top: 2px solid var(--schoolcore-border);
        background: var(--schoolcore-surface);
}

.schoolcore-stats-table .schoolcore-stats-totals td:first-child {
        text-transform: uppercase;
        font-size: 0.78rem;
        letter-spacing: 0.03em;
        color: var(--schoolcore-text-muted);
}

/* ---------------------------------------------------------------
 * Phase 1 — Administrator Students: Class → Students structure
 * ------------------------------------------------------------ */

.schoolcore-recent-students {
        margin-bottom: 18px;
}

.schoolcore-recent-students h3 {
        margin-top: 0;
        margin-bottom: 12px;
}

.schoolcore-class-detail-header {
        display: flex;
        align-items: center;
        gap: 16px;
        margin-bottom: 14px;
}

.schoolcore-class-detail-header h3 {
        margin: 0;
}

/* ---------------------------------------------------------------
 * Searchable combobox (used by Admin Attendance class selector)
 * ------------------------------------------------------------ */

/*
 * The combobox is a wrapper around a native <select> + a search <input>.
 * The search input filters the <option>s in real time. Clicking the
 * search input also expands the native dropdown so the admin can both
 * type-to-filter and click-to-browse.
 *
 * Layout: input on top, native select below (hidden until focus). When
 * the search input is focused, the select drops down via its own
 * `size` attribute being set, which shows the options as a list box.
 */
.schoolcore-combobox {
        position: relative;
        display: flex;
        flex-direction: column;
        gap: 4px;
}

.schoolcore-combobox-input {
        width: 100%;
        padding: 8px 10px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 6px;
        font-size: 0.9rem;
        background: var(--schoolcore-surface);
}

.schoolcore-combobox-input:focus {
        outline: none;
        border-color: var(--schoolcore-primary);
        box-shadow: 0 0 0 2px rgba(30, 58, 138, 0.15);
}

.schoolcore-combobox-select {
        width: 100%;
        padding: 8px 10px;
        border: 1px solid var(--schoolcore-border);
        border-radius: 6px;
        font-size: 0.9rem;
        background: var(--schoolcore-surface);
        max-height: 220px;
}

/* When the combobox is "expanded" (search input focused), the select
   shows as a list box rather than a dropdown so filtered options are
   visible alongside the search input. */
.schoolcore-combobox.is-expanded .schoolcore-combobox-select {
        size: 6;
}
