/* ==========================================================================
   Design tokens — validated palette (light default, dark via toggle/OS)
   ========================================================================== */
:root {
    color-scheme: light;
    --surface-1:      #fcfcfb;   /* card / chart surface */
    --page-plane:     #f9f9f7;   /* page background */
    --text-primary:   #0b0b0b;
    --text-secondary: #52514e;
    --text-muted:     #898781;
    --gridline:       #e1e0d9;
    --baseline:       #c3c2b7;
    --border:         rgba(11, 11, 11, 0.10);
    --border-strong:  rgba(11, 11, 11, 0.16);

    --brand:          #2a78d6;   /* categorical slot 1 (blue) */
    --brand-dark:     #184f95;
    --brand-wash:     #eaf1fb;

    --status-good:      #0ca30c;
    --status-good-wash: #e6f6e6;
    --status-warning:   #b8790a;  /* darkened from #fab219 for text/border use on light */
    --status-warning-wash: #fef3dd;
    --status-serious:   #c9542a;  /* darkened from #ec835a for text/border use on light */
    --status-serious-wash: #fbe6dd;
    --status-critical:      #d03b3b;
    --status-critical-wash: #fbe4e4;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(11,11,11,0.05);
    --shadow-md: 0 2px 8px rgba(11,11,11,0.06), 0 1px 2px rgba(11,11,11,0.05);
    --sidebar-w: 232px;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --page-plane:     #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --border-strong:  rgba(255, 255, 255, 0.16);

    --brand:          #3987e5;
    --brand-dark:     #86b6ef;
    --brand-wash:     #16273e;

    --status-good:      #0ca30c;
    --status-good-wash: #0f2410;
    --status-warning:   #e0a834;
    --status-warning-wash: #33270b;
    --status-serious:   #ec835a;
    --status-serious-wash: #33190f;
    --status-critical:      #e66767;
    --status-critical-wash: #341212;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --surface-1:      #1a1a19;
        --page-plane:     #0d0d0d;
        --text-primary:   #ffffff;
        --text-secondary: #c3c2b7;
        --text-muted:     #898781;
        --gridline:       #2c2c2a;
        --baseline:       #383835;
        --border:         rgba(255, 255, 255, 0.10);
        --border-strong:  rgba(255, 255, 255, 0.16);
        --brand:          #3987e5;
        --brand-dark:     #86b6ef;
        --brand-wash:     #16273e;
        --status-good:      #0ca30c;
        --status-good-wash: #0f2410;
        --status-warning:   #e0a834;
        --status-warning-wash: #33270b;
        --status-serious:   #ec835a;
        --status-serious-wash: #33190f;
        --status-critical:      #e66767;
        --status-critical-wash: #341212;
    }
}

/* Cross-document view transition -- a plain browser-native crossfade on
   every full-page navigation (a no-op, instant navigation on unsupported
   browsers). Presentation Mode relies on this for its "toggle" and
   drill-down feel; harmless everywhere else it applies too. */
@view-transition {
    navigation: auto;
}
@media (prefers-reduced-motion: reduce) {
    @view-transition {
        navigation: none;
    }
}

/* ==========================================================================
   Base
   ========================================================================== */
* { box-sizing: border-box; }

/* Safety net: an <img> with no explicit sizing rule (or one whose
   intrinsic file resolution is much larger than its rendered size)
   otherwise renders at its natural pixel width, which is exactly what
   overflows a phone viewport -- this can never make an image bigger than
   its container, only ever smaller. */
img { max-width: 100%; height: auto; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--page-plane);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.5rem; font-weight: 650; margin: 0 0 1.25rem; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; font-weight: 650; margin: 0 0 0.9rem; letter-spacing: -0.005em; }
h3 { font-size: 0.92rem; font-weight: 650; margin: 0 0 0.6rem; color: var(--text-secondary); }

/* ==========================================================================
   App shell: sidebar + topbar + content
   ========================================================================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--surface-1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1.1rem 1.25rem;
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}
.sidebar .brand .mark {
    width: 32px; height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}
.sidebar .brand .brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar .brand .brand-name { font-weight: 700; }
.sidebar .brand .brand-tag {
    font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--text-muted);
}

.sidebar nav { padding: 0.75rem 0.6rem; flex: 1; }
.sidebar .nav-section { margin-bottom: 1.1rem; }
.sidebar .nav-label {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); padding: 0 0.6rem; margin-bottom: 0.35rem;
}
.sidebar a.nav-link {
    display: flex; align-items: center; gap: 0.55rem;
    padding: 0.5rem 0.6rem; border-radius: var(--radius-sm);
    color: var(--text-secondary); font-size: 0.87rem; font-weight: 500;
    text-decoration: none; margin-bottom: 0.1rem;
}
.sidebar a.nav-link:hover { background: var(--brand-wash); color: var(--brand); text-decoration: none; }
.sidebar a.nav-link.active { background: var(--brand-wash); color: var(--brand); font-weight: 650; }
.sidebar a.nav-link .icon { width: 16px; text-align: center; flex-shrink: 0; opacity: 0.85; }
.nav-badge {
    margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.2rem; height: 1.2rem; padding: 0 0.3rem; border-radius: 999px;
    background: var(--status-critical); color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 1;
}

/* ==========================================================================
   Internal messaging (inbox, conversation, public board, popup)
   ========================================================================== */
.badge-count {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 1.35rem; height: 1.35rem; padding: 0 0.35rem; border-radius: 999px;
    background: var(--status-critical); color: #fff; font-size: 0.72rem; font-weight: 700;
}
.message-thread { display: flex; flex-direction: column; gap: 0.6rem; }
.message-bubble-row { display: flex; }
.message-bubble-row.mine { justify-content: flex-end; }
.message-bubble {
    max-width: 72%; background: var(--page-plane); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 0.55rem 0.75rem;
}
.message-bubble-row.mine .message-bubble { background: var(--brand-wash); border-color: transparent; }
.message-subject { font-weight: 650; font-size: 0.85rem; margin-bottom: 0.2rem; }
.message-body { white-space: pre-wrap; font-size: 0.88rem; line-height: 1.45; }
.message-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }
.seen-status { display: inline-flex; align-items: center; gap: 0.25rem; }
.seen-status.is-seen { color: var(--status-good); }

.message-popup-overlay {
    position: fixed; inset: 0; background: rgba(11,11,11,0.45); z-index: 1000;
    display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.message-popup {
    background: var(--surface-1); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    max-width: 440px; width: 100%; max-height: 80vh; overflow-y: auto; padding: 1.1rem 1.3rem;
}
.message-popup-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.message-popup-list { display: flex; flex-direction: column; gap: 0.5rem; }
.message-popup-item {
    display: flex; flex-direction: column; gap: 0.15rem; padding: 0.55rem 0.7rem;
    border-radius: var(--radius-sm); border: 1px solid var(--border); text-decoration: none; color: inherit;
}
.message-popup-item:hover { background: var(--page-plane); text-decoration: none; }
.message-popup-sender { font-weight: 650; font-size: 0.83rem; color: var(--text-primary); }
.message-popup-preview { font-size: 0.8rem; color: var(--text-secondary); }
@media (prefers-reduced-motion: no-preference) {
    .message-popup { animation: message-popup-in 0.16s ease-out; }
}
@keyframes message-popup-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-loading-overlay {
    position: fixed; inset: 0; z-index: 2000;
    display: none; align-items: center; justify-content: center; flex-direction: column; gap: 0.85rem;
    background: color-mix(in srgb, var(--page-plane) 82%, transparent);
}
.page-loading-overlay.visible { display: flex; }
.page-loading-spinner {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid var(--border-strong); border-top-color: var(--brand);
    animation: page-loading-spin 0.7s linear infinite;
}
.page-loading-text { color: var(--text-secondary); font-size: 0.85rem; font-weight: 650; text-align: center; max-width: 280px; }
@keyframes page-loading-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .page-loading-spinner { animation: none; }
}

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

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1.75rem;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}
.topbar .crumbs { font-size: 0.83rem; color: var(--text-muted); }
.topbar .crumbs a { color: var(--text-secondary); }
.topbar .crumbs .sep { margin: 0 0.4rem; color: var(--baseline); }
.topbar .user-menu { display: flex; align-items: center; gap: 0.75rem; font-size: 0.83rem; }
.topbar .user-menu .who { color: var(--text-secondary); }
.topbar .user-menu .role-pill {
    background: var(--brand-wash); color: var(--brand);
    padding: 0.15rem 0.55rem; border-radius: 999px; font-weight: 650; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.03em;
}
.topbar .user-menu .online-count {
    display: flex; align-items: center; gap: 0.35rem;
    color: var(--text-secondary); font-size: 0.78rem;
}
.topbar .user-menu .online-dot {
    width: 7px; height: 7px; border-radius: 50%; background: var(--status-good);
    box-shadow: 0 0 0 var(--status-good-wash);
    animation: online-dot-pulse 2s ease-in-out infinite;
}
@keyframes online-dot-pulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--status-good) 45%, transparent); }
    50% { box-shadow: 0 0 0 4px transparent; }
}
@media (prefers-reduced-motion: reduce) {
    .topbar .user-menu .online-dot { animation: none; }
}

/* Super-Admin-only "who's online" dropdown -- everyone else just sees the
   plain .online-count text; this turns it into a button that opens a
   small popover, same open/close mechanics as .helpbot-panel but anchored
   under the topbar element instead of floating at a fixed screen corner. */
.online-panel-wrap { position: relative; }
.online-count-btn {
    background: none; border: none; padding: 0; cursor: pointer; font-family: inherit;
}
.online-count-btn:hover .online-count { color: var(--text-primary); }
.online-panel {
    display: none; position: absolute; top: calc(100% + 0.5rem); right: 0; z-index: 1000;
    width: 300px; max-width: calc(100vw - 2.5rem); max-height: 70vh; overflow-y: auto;
    background: var(--surface-1); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    text-align: left;
}
.online-panel.open { display: block; }
.online-panel-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--border);
}
.online-panel-header strong { font-size: 0.85rem; }
.online-panel-body { padding: 0.5rem 0.6rem; display: flex; flex-direction: column; gap: 0.3rem; }
.online-user-row {
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.45rem 0.5rem; border-radius: var(--radius-sm);
}
.online-user-row:hover { background: var(--page-plane); }
.online-user-dot {
    flex-shrink: 0; margin-top: 0.35rem; width: 7px; height: 7px; border-radius: 50%;
    background: var(--status-good);
}
.online-user-info { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }
.online-user-name { font-weight: 650; font-size: 0.83rem; color: var(--text-primary); }
.online-user-meta { font-size: 0.74rem; color: var(--text-muted); }

.topbar form { display: inline; }
.topbar button.link, .topbar a.link {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 0.83rem; padding: 0; text-decoration: none;
}
.topbar button.link:hover, .topbar a.link:hover { color: var(--text-primary); text-decoration: underline; }

.theme-toggle {
    width: 30px; height: 30px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: var(--surface-1);
    cursor: pointer; font-size: 0.95rem; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    padding: 0;
}
.theme-toggle:hover { border-color: var(--border-strong); }

.lang-switch { display: flex; gap: 0.3rem; align-items: center; }
.lang-switch a {
    font-size: 0.76rem; font-weight: 600; padding: 0.25rem 0.5rem; border-radius: var(--radius-sm);
    color: var(--text-secondary); text-decoration: none; border: 1px solid transparent;
}
.lang-switch a:hover { background: var(--page-plane); color: var(--text-primary); }
.lang-switch a.active { background: var(--brand-wash); color: var(--brand-dark); border-color: var(--brand); }

/* Guest pages (login, forgot/reset password, parent share view) -- an
   inline bar instead of two independently fixed-position corner buttons,
   so it reads as one deliberate header instead of loose floating controls
   and can never overlap page content on a narrow viewport. */
.guest-topbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.6rem;
    padding: 1.25rem 0 0;
}

.container { max-width: 1180px; margin: 0 auto; padding: 1.75rem; width: 100%; }
@media (max-width: 480px) {
    .container { padding: 1.1rem; }
}

.app-footer {
    margin-top: 2rem; padding-top: 1.1rem; border-top: 1px solid var(--gridline);
    font-size: 0.78rem; color: var(--text-muted); text-align: center;
}
.app-footer a { color: inherit; }

.footer-credits { max-width: 640px; margin: 0 auto; }
.footer-credits-heading {
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--text-secondary); margin: 0 0 0.75rem;
}
.footer-credits-cols { display: flex; gap: 2.25rem; justify-content: center; flex-wrap: wrap; text-align: left; }
.footer-credits-col { min-width: 210px; }
.footer-credits-label {
    font-size: 0.68rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase;
    color: var(--brand-dark); margin: 0 0 0.45rem;
}
.footer-credit { margin: 0 0 0.45rem; line-height: 1.3; }
.footer-credit:last-child { margin-bottom: 0; }
.footer-credit .name { display: block; font-weight: 600; color: var(--text-secondary); }
.footer-credit .title { display: block; font-size: 0.72rem; color: var(--text-muted); }

@media (max-width: 480px) {
    .footer-credits-cols { flex-direction: column; align-items: center; text-align: center; gap: 1rem; }
}

.attention-pulse { animation: attention-glow 2.2s ease-in-out infinite; }
@keyframes attention-glow {
    0%, 100% { color: var(--text-primary); text-shadow: none; }
    50% { color: var(--brand); text-shadow: 0 0 10px var(--brand-wash); }
}
@media (prefers-reduced-motion: reduce) {
    .attention-pulse { animation: none; color: var(--brand); }
}

.card-attention {
    border-color: var(--brand);
    animation: card-attention-glow 2.4s ease-in-out infinite;
}
@keyframes card-attention-glow {
    0%, 100% { background: var(--surface-1); box-shadow: var(--shadow-sm); }
    50% { background: var(--brand-wash); box-shadow: 0 0 0 3px var(--brand-wash), var(--shadow-sm); }
}
@media (prefers-reduced-motion: reduce) {
    .card-attention { animation: none; background: var(--brand-wash); }
}

/* Sidebar nav-link spotlight -- calls attention to a specific feature (e.g.
   a newly-launched tool) with a soft pulsing ring, same expanding-then-
   fading technique as .online-dot's pulse, plus a small pulsing "New"
   badge pinned to the row's end (same slot .nav-badge's unread count
   uses). Pauses on hover so it doesn't fight the user's own attention once
   they're right on it, and drops to a static highlight under
   prefers-reduced-motion, same fallback pattern as .attention-pulse/
   .card-attention above. */
.sidebar a.nav-link.nav-link-spotlight {
    animation: nav-spotlight-ring 2s ease-in-out infinite;
}
.sidebar a.nav-link.nav-link-spotlight:hover { animation-play-state: paused; }
@keyframes nav-spotlight-ring {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 40%, transparent); }
    50% { box-shadow: 0 0 0 5px transparent; }
}
.nav-link-spotlight .nav-new-badge {
    margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
    padding: 0.1rem 0.4rem; border-radius: 999px;
    background: var(--brand); color: #fff; font-size: 0.62rem; font-weight: 700;
    letter-spacing: 0.03em; text-transform: uppercase; line-height: 1.4;
    animation: nav-new-badge-pulse 2s ease-in-out infinite;
}
@keyframes nav-new-badge-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
    .sidebar a.nav-link.nav-link-spotlight { animation: none; box-shadow: 0 0 0 2px var(--brand-wash); }
    .nav-link-spotlight .nav-new-badge { animation: none; }
}

/* Mobile: collapse sidebar */
@media (max-width: 880px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: relative; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
    .sidebar .nav-section { margin-bottom: 0; }
    .sidebar .nav-label { display: none; }
}

/* ==========================================================================
   Cards, flash, badges
   ========================================================================== */
.card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.35rem 1.5rem;
    margin-bottom: 1.25rem;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.9rem;
}
.card-header h2 { margin: 0; }

.flash {
    padding: 0.7rem 1rem; border-radius: var(--radius-md); margin-bottom: 1rem;
    font-size: 0.87rem; display: flex; align-items: center; gap: 0.5rem;
    border: 1px solid transparent;
}
.flash.error { background: var(--status-critical-wash); color: var(--status-critical); border-color: color-mix(in srgb, var(--status-critical) 25%, transparent); }
.flash.success { background: var(--status-good-wash); color: var(--status-good); border-color: color-mix(in srgb, var(--status-good) 25%, transparent); }

.notice-banner {
    padding: 0.6rem 1rem; font-size: 0.83rem; text-align: center;
    background: var(--status-warning-wash); color: var(--status-warning);
    border-bottom: 1px solid color-mix(in srgb, var(--status-warning) 25%, transparent);
    animation: notice-banner-glow 2.4s ease-in-out infinite;
}
.notice-banner strong { font-weight: 700; }

/* Impersonation ("log in as", App\Core\Auth::isImpersonating()) --
   deliberately styled nothing like .notice-banner (different color, its
   own sticky position) so an admin can never mistake it for routine site
   chrome: this is "you are acting as someone else's account right now". */
.impersonation-banner {
    display: flex; align-items: center; justify-content: center; gap: 1rem; flex-wrap: wrap;
    padding: 0.6rem 1.25rem; font-size: 0.85rem;
    background: var(--status-critical); color: #fff;
    position: sticky; top: 0; z-index: 900;
}
.impersonation-banner form { margin: 0; }
.impersonation-banner button {
    background: rgba(255,255,255,0.18); color: #fff; border: 1px solid rgba(255,255,255,0.45);
    padding: 0.25rem 0.9rem; border-radius: var(--radius-sm); font-weight: 700; cursor: pointer;
}
.impersonation-banner button:hover { background: rgba(255,255,255,0.32); }
@keyframes notice-banner-glow {
    0%, 100% { box-shadow: inset 0 0 0 rgba(0,0,0,0); }
    50% { box-shadow: inset 0 0 18px color-mix(in srgb, var(--status-warning) 35%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
    .notice-banner { animation: none; }
}
@media print {
    .notice-banner { display: none; }
}

.suggestion {
    padding: 0.75rem 1rem; border-radius: var(--radius-md); margin-bottom: 0.6rem;
    font-size: 0.87rem; border: 1px solid transparent; display: flex; gap: 0.6rem; align-items: flex-start;
}
.suggestion .sev {
    font-size: 0.66rem; font-weight: 750; text-transform: uppercase; letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem; border-radius: 999px; flex-shrink: 0; margin-top: 0.05rem;
}
.suggestion.CRITICAL { background: var(--status-critical-wash); border-color: color-mix(in srgb, var(--status-critical) 25%, transparent); }
.suggestion.CRITICAL .sev { background: var(--status-critical); color: #fff; }
.suggestion.WARNING { background: var(--status-warning-wash); border-color: color-mix(in srgb, var(--status-warning) 30%, transparent); }
.suggestion.WARNING .sev { background: var(--status-warning); color: #1a1200; }
.suggestion.INFO { background: var(--brand-wash); border-color: color-mix(in srgb, var(--brand) 25%, transparent); }
.suggestion.INFO .sev { background: var(--brand); color: #fff; }
.suggestion .msg { color: var(--text-primary); }

/* ==========================================================================
   Dashboard "Smart Insights" -- a single ranked feed of rule-based alerts
   (own-school compliance nudges + SuggestionEngine's threshold rules),
   replacing what used to be three separate .card-attention boxes plus a
   standalone suggestions list. Severity drives color the same way
   .suggestion above does; GOOD is the "nothing needs your attention"
   reassurance state, not used by anything else on the page.
   ========================================================================== */
.insights-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.insights-panel-head h2 { display: flex; align-items: center; gap: 0.45rem; }
.insights-panel-note { font-size: 0.78rem; color: var(--text-muted); max-width: 32rem; }

.insight-feed { display: flex; flex-direction: column; gap: 0.6rem; }
.insight-card {
    display: flex; gap: 0.85rem; align-items: flex-start;
    padding: 0.85rem 1rem; border-radius: var(--radius-lg); border: 1px solid var(--border);
    background: var(--surface-1); box-shadow: var(--shadow-sm);
    text-decoration: none; color: inherit;
}
a.insight-card { transition: transform 0.12s ease, box-shadow 0.12s ease; }
a.insight-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
@media (prefers-reduced-motion: reduce) {
    a.insight-card:hover { transform: none; }
}
.insight-icon {
    flex-shrink: 0; width: 2.15rem; height: 2.15rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 1.05rem;
    background: var(--page-plane); color: var(--text-muted);
}
.insight-card.is-critical { border-color: color-mix(in srgb, var(--status-critical) 30%, var(--border)); }
.insight-card.is-critical .insight-icon { background: var(--status-critical-wash); color: var(--status-critical); }
.insight-card.is-warning { border-color: color-mix(in srgb, var(--status-warning) 30%, var(--border)); }
.insight-card.is-warning .insight-icon { background: var(--status-warning-wash); color: var(--status-warning); }
.insight-card.is-info .insight-icon { background: var(--brand-wash); color: var(--brand-dark); }
.insight-card.is-good { border-color: color-mix(in srgb, var(--status-good) 30%, var(--border)); background: var(--status-good-wash); }
.insight-card.is-good .insight-icon { background: var(--surface-1); color: var(--status-good); }

/* 'urgent' insights (App\Http\Controllers\DashboardController -- currently
   only the Marks Entry Anomaly nudge) get a visibly louder treatment than
   a plain .is-critical card: this means report cards are actively wrong
   right now, not just a number to improve, so on a page with several
   CRITICAL cards it still needs to be the one that catches a Principal's
   eye first. Pulsing background/border (same technique as .card-attention
   elsewhere in this file) plus a small icon wobble; both drop to a static
   highlight under prefers-reduced-motion, same fallback every other
   animation in this file already uses. */
.insight-card.is-urgent {
    border-color: var(--status-critical);
    border-width: 2px;
    animation: insight-urgent-glow 1.8s ease-in-out infinite;
}
.insight-card.is-urgent .insight-icon {
    background: var(--status-critical); color: #fff;
    animation: insight-urgent-wobble 1.8s ease-in-out infinite;
}
@keyframes insight-urgent-glow {
    0%, 100% { background: var(--status-critical-wash); box-shadow: 0 0 0 0 color-mix(in srgb, var(--status-critical) 45%, transparent); }
    50% { background: color-mix(in srgb, var(--status-critical) 16%, var(--surface-1)); box-shadow: 0 0 0 5px transparent; }
}
@keyframes insight-urgent-wobble {
    0%, 22%, 100% { transform: rotate(0deg); }
    5% { transform: rotate(-14deg); }
    11% { transform: rotate(14deg); }
    16% { transform: rotate(-8deg); }
}
@media (prefers-reduced-motion: reduce) {
    .insight-card.is-urgent { animation: none; background: var(--status-critical-wash); }
    .insight-card.is-urgent .insight-icon { animation: none; }
}
.insight-body { flex: 1; min-width: 0; }
.insight-title { font-weight: 650; font-size: 0.92rem; color: var(--text-primary); }
.insight-detail { font-size: 0.82rem; color: var(--text-muted); margin-top: 0.2rem; }
.insight-cta { font-size: 0.78rem; color: var(--brand-dark); font-weight: 650; margin-top: 0.4rem; display: inline-block; }

table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--gridline); }
th {
    color: var(--text-muted); font-weight: 650; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.04em;
}
tbody tr:hover td { background: var(--page-plane); }
td { font-variant-numeric: tabular-nums; }
td:first-child, th:first-child { font-variant-numeric: normal; }

.form-group { margin-bottom: 1rem; }
label { display: block; font-size: 0.82rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--text-secondary); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], select, textarea {
    width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font-size: 0.87rem; background: var(--surface-1); color: var(--text-primary);
    font-family: inherit;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand); }

button, .btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: var(--brand); color: #fff; border: none;
    padding: 0.55rem 1.05rem; border-radius: var(--radius-sm);
    font-size: 0.85rem; font-weight: 600; cursor: pointer;
    font-family: inherit;
}
button:hover, .btn:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn-danger { background: var(--status-critical); }
.btn-danger:hover { filter: brightness(0.9); }
.btn-secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: var(--page-plane); color: var(--text-primary); }

.badge {
    display: inline-block; padding: 0.18rem 0.55rem; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
}
.badge-P { background: var(--status-good-wash); color: var(--status-good); }
.badge-Q { background: var(--brand-wash); color: var(--brand-dark); }
.badge-C1, .badge-C2, .badge-C3, .badge-S1, .badge-S2, .badge-NEEDS_CREDIT, .badge-NOT_P { background: var(--status-warning-wash); color: var(--status-warning); }
.badge-T1, .badge-T2 { background: var(--status-serious-wash); color: var(--status-serious); }
.badge-F { background: var(--status-critical-wash); color: var(--status-critical); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.8rem; }
.stat-tile {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 0.95rem 1.05rem;
}
.stat-tile .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.stat-tile .label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
a.stat-tile-link { text-decoration: none; color: inherit; display: block; }
a.stat-tile-link .stat-tile { transition: border-color 0.12s, box-shadow 0.12s; }
a.stat-tile-link:hover .stat-tile { border-color: var(--brand); box-shadow: var(--shadow-md); }

/* Term-over-term trend chips -- color means "is this good news", not
   "did the number go up": a rising T1/F count uses .trend-bad even though
   the arrow points up, so directors read color as judgment and the arrow
   as direction, matching how App\Http\Controllers\DashboardController's
   categoryTrend() computes "favorable" independently of raw sign. */
.trend-chip {
    display: inline-flex; align-items: center; gap: 0.2rem;
    font-size: 0.72rem; font-weight: 700; padding: 0.08rem 0.45rem; border-radius: 999px;
    white-space: nowrap;
}
.trend-chip.trend-good { background: var(--status-good-wash); color: var(--status-good); }
.trend-chip.trend-bad { background: var(--status-critical-wash); color: var(--status-critical); }
.trend-chip.trend-flat { background: var(--page-plane); color: var(--text-muted); }
.stat-tile .trend-chip { margin-top: 0.35rem; }

/* ==========================================================================
   Login page -- a clear hierarchy: brand hero, then the login card as the
   one unambiguous focal point beside a secondary "getting started" column
   (tip + help video), with What's New as its own quieter section below.
   ========================================================================== */
.login-shell { max-width: 980px; margin: 1.5rem auto 3.5rem; padding: 0 1.5rem; }

.login-hero {
    text-align: center; margin: 1.5rem 0 2.5rem;
    padding-bottom: 2rem; border-bottom: 1px solid var(--gridline);
}
.login-hero .crest-row {
    display: flex; align-items: center; justify-content: center; gap: clamp(0.5rem, 3vw, 1rem); margin-bottom: 0.7rem;
}
/* Fluid, not a hard breakpoint jump: scales smoothly with viewport width
   instead of being full desktop size right up until 480px and then
   snapping smaller, so nothing looks oversized at in-between widths
   (large phones, small tablets, a phone in landscape). */
.login-hero .crest { height: clamp(36px, 11vw, 58px); width: auto; object-fit: contain; }
.login-hero .crest-wide { height: clamp(28px, 8.5vw, 46px); }
.login-hero .crest-row a { display: inline-flex; line-height: 0; transition: opacity 0.12s ease; }
.login-hero .crest-row a:hover, .login-hero .crest-row a:focus-visible { opacity: 0.75; }
.login-hero .province-tag {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--brand-dark); margin: 0 0 0.45rem;
}
.login-hero h1 { font-size: 1.65rem; margin-bottom: 0.35rem; }
.login-hero-subtitle { color: var(--text-muted); font-size: 0.92rem; margin: 0; }

.login-grid {
    display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 440px);
    justify-content: center; align-items: start; gap: 2.25rem;
}
.login-primary, .login-secondary { display: flex; flex-direction: column; }
.login-secondary { gap: 1.25rem; }

.login-card { border-top: 3px solid var(--brand); padding: 1.65rem 1.75rem 1.5rem; }
.login-card h2 { font-size: 1.1rem; }
.login-forgot-link { margin: 1.1rem 0 0; text-align: center; font-size: 0.85rem; }
.login-forgot-link a { color: var(--text-secondary); }

.login-tip {
    display: flex; align-items: flex-start; gap: 0.6rem;
    background: var(--brand-wash); color: var(--brand-dark); border-radius: var(--radius-md);
    padding: 0.85rem 1rem; font-size: 0.82rem; line-height: 1.5;
}
.login-tip-icon { font-size: 1.05rem; line-height: 1.4; flex-shrink: 0; }

.login-video-card h2 {
    font-size: 0.92rem; font-weight: 650; text-align: center; margin: 0 0 0.85rem;
    color: var(--text-secondary);
}
.login-video-frame {
    position: relative; width: 100%; padding-top: 56.25%; border-radius: var(--radius-md);
    overflow: hidden; box-shadow: var(--shadow-md); background: var(--surface-1);
}
.login-video-frame iframe, .login-video-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.login-video-frame video { object-fit: contain; background: #000; }

.login-manual-card { padding: 1.15rem 1.3rem; }
.login-manual-head { display: flex; align-items: flex-start; gap: 0.75rem; margin-bottom: 0.9rem; }
.login-manual-icon { font-size: 1.7rem; line-height: 1; flex-shrink: 0; }
.login-manual-head h2 { font-size: 1rem; margin: 0 0 0.3rem; color: var(--text-primary); }
.login-manual-head p { margin: 0; font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }
.login-manual-actions { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.btn-manual-open {
    display: inline-flex; align-items: center; gap: 0.4rem; font-weight: 650; font-size: 0.88rem;
    padding: 0.55rem 1rem; border-radius: var(--radius-md); background: var(--brand); color: #fff;
    text-decoration: none; box-shadow: var(--shadow-sm); transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-manual-open:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.login-manual-share { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; }
.btn-share-whatsapp, .btn-share-copy {
    display: inline-flex; align-items: center; justify-content: center; width: 2.15rem; height: 2.15rem;
    border-radius: 50%; border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary);
    font-size: 1.05rem; cursor: pointer; text-decoration: none; transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.btn-share-whatsapp:hover { background: #25d366; border-color: #25d366; color: #fff; }
.btn-share-copy:hover { background: var(--brand-wash); border-color: var(--brand); color: var(--brand-dark); }
.btn-share-copy.is-copied { background: var(--status-good-wash, var(--brand-wash)); color: var(--status-good, var(--brand)); border-color: currentColor; }

.login-whatsnew { margin-top: 2rem; }
.login-whatsnew h2 { text-align: center; }
.whatsnew-list {
    list-style: none; margin: 0; padding: 0;
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.65rem 1.75rem;
}
.whatsnew-list li {
    position: relative; padding-left: 1.5rem;
    font-size: 0.85rem; line-height: 1.55; color: var(--text-secondary);
}
.whatsnew-list li::before {
    content: '\2713'; position: absolute; left: 0; top: 0.05rem;
    color: var(--status-good); font-weight: 700; font-size: 0.82rem;
}

@media (max-width: 820px) {
    .login-grid { grid-template-columns: minmax(0, 420px); justify-items: center; }
    .login-primary, .login-secondary { width: 100%; max-width: 420px; }
}

/* Forgot/reset password -- the same hero, but just one centered card
   (no secondary column) since there's nothing else to show there. */
.login-single { display: flex; justify-content: center; }
.login-single .login-card { width: 100%; max-width: 400px; }

/* Phones: tighter shell/card padding (every extra rem of padding is
   viewport width the form doesn't get) and What's New forced to one
   column -- its auto-fit(minmax(260px,...)) grid would otherwise force a
   column wider than the viewport itself on anything under ~360px, causing
   the whole page to scroll sideways. Crest sizing is fluid (clamp(), above)
   so it doesn't need a breakpoint override here. */
@media (max-width: 480px) {
    .login-shell { padding: 0 0.85rem; margin-top: 0.75rem; }
    .login-hero { margin: 0.75rem 0 1.5rem; padding-bottom: 1.25rem; }
    .login-hero h1 { font-size: 1.3rem; }
    .login-hero-subtitle { font-size: 0.85rem; }
    .login-card, .login-video-card, .login-whatsnew { padding: 1.15rem 1.1rem; }
    .login-tip { padding: 0.7rem 0.85rem; }
    .login-grid { gap: 1.25rem; }
    .login-secondary { gap: 1rem; }
    .whatsnew-list { grid-template-columns: 1fr; gap: 0.6rem; }
    .guest-topbar { justify-content: center; padding-top: 0.9rem; }
}

.actions { display: flex; gap: 0.6rem; align-items: center; }
.text-muted { color: var(--text-muted); font-size: 0.85rem; }

/* ==========================================================================
   Cluster builder (clusters/create.php) -- checkbox + table driven, no
   drag-and-drop (HTML5 drag events have no reliable touch equivalent, so a
   tap-and-check model works the same on a phone/tablet as a mouse).
   ========================================================================== */
.pool-group { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; margin-bottom: 0.6rem; }
.pool-group summary {
    cursor: pointer; padding: 0.5rem 0.65rem; font-weight: 600; font-size: 0.83rem;
    background: var(--page-plane); list-style: none; display: flex; align-items: center; gap: 0.4rem;
}
.pool-group summary::-webkit-details-marker { display: none; }
.pool-group summary::before { content: '\25B8'; display: inline-block; transition: transform 0.12s; }
.pool-group[open] summary::before { transform: rotate(90deg); }
.cluster-table-wrap { max-height: 50vh; overflow: auto; border-top: 1px solid var(--border); }
.pool-group .cluster-table-wrap { border-top: 1px solid var(--border); max-height: 40vh; }
.cluster-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.cluster-table th, .cluster-table td { padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--gridline); text-align: left; white-space: nowrap; }
.cluster-table th { position: sticky; top: 0; background: var(--surface-1); font-size: 0.72rem; color: var(--text-muted); font-weight: 650; z-index: 1; }
.cluster-table td.row-check, .cluster-table th:first-child { width: 2rem; text-align: center; }
.cluster-table td.row-name { white-space: normal; min-width: 160px; }
.cluster-table tbody tr:hover { background: var(--page-plane); }
.cluster-table tbody:empty::after { content: 'No students yet -- check some in Available and use "Add Checked".'; }
.cluster-table tr.cat-hidden { display: none; }
.cat-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin: 0.6rem 0; }
.cat-filter-item { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }
.cluster-bin {
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 0.8rem; margin-bottom: 0.8rem;
}
.cluster-bin-header { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.cluster-bin-header input[type=text] { flex: 1 1 160px; font-weight: 600; padding: 0.4rem 0.55rem; }
.cluster-bin-header .bin-count { white-space: nowrap; font-size: 0.78rem; }
.cluster-bin-header .actions button { padding: 0.3rem 0.6rem; font-size: 0.74rem; }
@media (max-width: 700px) {
    .cluster-table th, .cluster-table td { padding: 0.4rem; font-size: 0.78rem; }
}

/* ==========================================================================
   Grade sheet (classes/{id}/gradesheet) -- spreadsheet-style marks grid
   ========================================================================== */
.gradesheet-wrap { overflow: auto; max-width: 100%; max-height: 74vh; border: 1px solid var(--border); border-radius: var(--radius-md); }
.gradesheet { width: auto; border-collapse: separate; border-spacing: 0; white-space: nowrap; font-size: 0.78rem; }
.gradesheet th, .gradesheet td { border-bottom: 1px solid var(--gridline); border-right: 1px solid var(--gridline); padding: 0.3rem 0.4rem; text-align: center; }
.gradesheet thead th { position: sticky; top: 0; background: var(--page-plane); z-index: 2; text-transform: none; letter-spacing: 0; font-size: 0.74rem; }
.gradesheet thead tr:first-child th { top: 0; }
.gradesheet thead tr:last-child th { top: 27px; }
.gradesheet .subject-group-header { font-weight: 700; }
.gradesheet th.sticky-col, .gradesheet td.sticky-col {
    position: sticky; left: 0; z-index: 1; background: var(--surface-1);
    text-align: left; min-width: 170px; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.gradesheet thead th.sticky-col { z-index: 3; }
.gradesheet tbody tr:nth-child(even) td { background: var(--page-plane); }
.gradesheet tbody tr:nth-child(even) td.sticky-col { background: var(--page-plane); }
.gradesheet tbody tr:hover td { background: var(--brand-wash); }
.gradesheet tbody tr:hover td.sticky-col { background: var(--brand-wash); }
.gradesheet input[type=number] {
    width: 52px; padding: 0.2rem 0.25rem; font-size: 0.78rem; text-align: center;
    border: 1px solid transparent; background: transparent;
}
.gradesheet input[type=number]:hover { border-color: var(--border-strong); }
.gradesheet input[type=number]:focus { border-color: var(--brand); background: var(--surface-1); }
.gradesheet select {
    width: 50px; padding: 0.15rem 0.1rem; font-size: 0.7rem; text-align: center;
    border: 1px solid transparent; background: transparent;
}
.gradesheet select:hover { border-color: var(--border-strong); }
.gradesheet select:focus { border-color: var(--brand); background: var(--surface-1); }
.gradesheet td.computed { color: var(--text-secondary); font-weight: 600; background: var(--brand-wash); }
.gradesheet tbody tr:nth-child(even) td.computed { background: var(--brand-wash); }

/* ==========================================================================
   Bar chart component (server-rendered, no JS)
   ========================================================================== */
.barchart { display: flex; flex-direction: column; gap: 0.55rem; }
.barchart .bar-row { display: grid; grid-template-columns: 150px 1fr 56px; align-items: center; gap: 0.7rem; }
.barchart .bar-label {
    font-size: 0.82rem; color: var(--text-secondary); text-align: right;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.barchart .bar-track {
    background: var(--gridline); border-radius: 4px; height: 20px; position: relative; overflow: hidden;
}
.barchart .bar-fill {
    height: 100%; border-radius: 4px 4px 4px 4px;
    min-width: 3px;
}
.barchart .bar-fill.status-good { background: var(--status-good); }
.barchart .bar-fill.status-warning { background: var(--status-warning); }
.barchart .bar-fill.status-serious { background: var(--status-serious); }
.barchart .bar-fill.status-critical { background: var(--status-critical); }
.barchart .bar-fill.status-neutral { background: var(--brand); }
.barchart .bar-value {
    font-size: 0.82rem; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-primary);
}
.chart-legend { display: flex; gap: 1.1rem; flex-wrap: wrap; margin-top: 0.9rem; padding-top: 0.85rem; border-top: 1px solid var(--gridline); }
.chart-legend .item { display: flex; align-items: center; gap: 0.4rem; font-size: 0.76rem; color: var(--text-secondary); }
.chart-legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

@media (max-width: 640px) {
    .barchart .bar-row { grid-template-columns: 90px 1fr 48px; }
}

/* ==========================================================================
   Stacked bar chart (part-to-whole category breakdown)
   ========================================================================== */
.stackedbars { display: flex; flex-direction: column; gap: 0.55rem; }
.stacked-row { display: grid; grid-template-columns: 150px 1fr 44px; align-items: center; gap: 0.7rem; }
.stacked-label {
    font-size: 0.82rem; color: var(--text-secondary); text-align: right;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stacked-track {
    display: flex; height: 20px; border-radius: 4px; overflow: hidden;
    background: var(--gridline);
}
.stacked-segment { height: 100%; border-right: 2px solid var(--surface-1); }
.stacked-segment:last-child { border-right: none; }
.stacked-segment.status-good { background: var(--status-good); }
.stacked-segment.status-warning { background: var(--status-warning); }
.stacked-segment.status-serious { background: var(--status-serious); }
.stacked-segment.status-critical { background: var(--status-critical); }
.stacked-total { font-size: 0.82rem; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--text-primary); }

@media (max-width: 640px) {
    .stacked-row { grid-template-columns: 90px 1fr 40px; }
}

/* ==========================================================================
   Student progress chart -- warm, encouraging framing (not a status/concern
   chart like the director-facing bar charts above; deliberately uses a
   friendlier tiered palette instead of red-for-fail)
   ========================================================================== */
.student-banner {
    background: linear-gradient(135deg, var(--brand-wash), var(--status-good-wash));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.1rem;
    font-size: 0.95rem;
}
.student-banner .headline { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.2rem; }
.student-banner .sub { color: var(--text-secondary); }

/* Subject "trophy card" grid -- one tinted, iconed card per subject */
.subject-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.9rem;
}
.subject-card {
    border-radius: var(--radius-lg);
    padding: 1rem 1.05rem 0.9rem;
    border: 1px solid var(--border);
    background: var(--surface-1);
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.subject-card-top { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.55rem; }
.subject-icon { font-size: 1.3rem; line-height: 1; }
.subject-name { font-size: 0.83rem; font-weight: 650; color: var(--text-primary); }

.subject-mark { display: flex; align-items: baseline; gap: 0.4rem; margin-bottom: 0.55rem; }
.subject-mark-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.subject-mark-emoji { font-size: 1.15rem; }

.subject-progress { height: 8px; border-radius: 999px; background: var(--gridline); overflow: hidden; margin-bottom: 0.6rem; }
.subject-progress-fill { height: 100%; border-radius: 999px; }

.subject-tier-label { font-size: 0.76rem; font-weight: 700; margin-bottom: 0.15rem; }
.subject-next-step { font-size: 0.78rem; color: var(--text-secondary); line-height: 1.35; }

.tier-card-outstanding { background: linear-gradient(160deg, #eafce9, var(--surface-1) 60%); }
.tier-card-outstanding .subject-mark-value, .tier-card-outstanding .subject-tier-label { color: #0ca30c; }
.tier-card-outstanding .subject-progress-fill { background: linear-gradient(90deg, #0ca30c, #3ac93a); }

.tier-card-great { background: linear-gradient(160deg, #e3faf1, var(--surface-1) 60%); }
.tier-card-great .subject-mark-value, .tier-card-great .subject-tier-label { color: #17966b; }
.tier-card-great .subject-progress-fill { background: linear-gradient(90deg, #17966b, #1baf7a); }

.tier-card-good { background: linear-gradient(160deg, #eaf1fb, var(--surface-1) 60%); }
.tier-card-good .subject-mark-value, .tier-card-good .subject-tier-label { color: #2a78d6; }
.tier-card-good .subject-progress-fill { background: linear-gradient(90deg, #2a78d6, #5598e7); }

.tier-card-close { background: linear-gradient(160deg, #fdf3df, var(--surface-1) 60%); }
.tier-card-close .subject-mark-value, .tier-card-close .subject-tier-label { color: #b87c00; }
.tier-card-close .subject-progress-fill { background: linear-gradient(90deg, #d99000, #eda100); }

.tier-card-practicing { background: linear-gradient(160deg, #fce7dc, var(--surface-1) 60%); }
.tier-card-practicing .subject-mark-value, .tier-card-practicing .subject-tier-label { color: #c14f1f; }
.tier-card-practicing .subject-progress-fill { background: linear-gradient(90deg, #d65a26, #eb6834); }

.tier-card-starting { background: linear-gradient(160deg, #fbe6ee, var(--surface-1) 60%); }
.tier-card-starting .subject-mark-value, .tier-card-starting .subject-tier-label { color: #c13d72; }
.tier-card-starting .subject-progress-fill { background: linear-gradient(90deg, #d1447d, #e87ba4); }

/* Dark mode: the pastel tint gradients above are light-surface hex values
   that would wash out on a dark card, so dark mode gets flat surface cards
   with just a colored left accent instead of a full tinted gradient. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .subject-card { background: var(--surface-1); border-left: 3px solid transparent; }
    :root:not([data-theme="light"]) .tier-card-outstanding { border-left-color: #0ca30c; }
    :root:not([data-theme="light"]) .tier-card-great { border-left-color: #1baf7a; }
    :root:not([data-theme="light"]) .tier-card-good { border-left-color: #3987e5; }
    :root:not([data-theme="light"]) .tier-card-close { border-left-color: #e0a834; }
    :root:not([data-theme="light"]) .tier-card-practicing { border-left-color: #eb6834; }
    :root:not([data-theme="light"]) .tier-card-starting { border-left-color: #e87ba4; }
}
:root[data-theme="dark"] .subject-card { background: var(--surface-1); border-left: 3px solid transparent; }
:root[data-theme="dark"] .tier-card-outstanding { border-left-color: #0ca30c; }
:root[data-theme="dark"] .tier-card-great { border-left-color: #1baf7a; }
:root[data-theme="dark"] .tier-card-good { border-left-color: #3987e5; }
:root[data-theme="dark"] .tier-card-close { border-left-color: #e0a834; }
:root[data-theme="dark"] .tier-card-practicing { border-left-color: #eb6834; }
:root[data-theme="dark"] .tier-card-starting { border-left-color: #e87ba4; }

/* ==========================================================================
   School & Parallel Class Details report
   ========================================================================== */
.report-summary-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1.1rem;
}
.report-summary-head .eyebrow {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
    color: var(--brand-dark); margin: 0 0 0.25rem;
}
.report-summary-head h1 { margin-bottom: 0.2rem; }
.report-summary-head .sub { color: var(--text-muted); font-size: 0.87rem; }
.year-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: var(--brand-wash); color: var(--brand-dark);
    padding: 0.3rem 0.75rem; border-radius: 999px; font-weight: 700; font-size: 0.82rem;
}

.stat-tile.stat-accent .value { color: var(--brand-dark); }
.stat-tile.stat-good .value { color: var(--status-good); }
.stat-tile.stat-critical .value { color: var(--status-critical); }
.stat-tile .sublabel { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.15rem; }

.school-cell { display: flex; align-items: center; gap: 0.7rem; }
.school-avatar {
    width: 38px; height: 38px; border-radius: var(--radius-md); flex-shrink: 0;
    background: var(--brand-wash); color: var(--brand-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1rem; letter-spacing: -0.02em;
}
.school-name-block { min-width: 0; }
.school-name { font-weight: 650; color: var(--text-primary); line-height: 1.3; }
.school-census { font-size: 0.74rem; color: var(--text-muted); }

.location-stack { line-height: 1.45; }
.location-division { color: var(--text-primary); font-size: 0.85rem; }
.location-zone { font-size: 0.76rem; color: var(--text-muted); }

.contact-stack { display: flex; flex-direction: column; gap: 0.3rem; }
.contact-row { display: flex; align-items: center; gap: 0.45rem; font-size: 0.8rem; color: var(--text-secondary); }
.contact-row .icon { width: 14px; text-align: center; opacity: 0.7; flex-shrink: 0; font-size: 0.85rem; }
.contact-row.is-empty { color: var(--text-muted); }

.status-pill {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.74rem; font-weight: 700;
}
.status-pill.is-submitted { background: var(--status-good-wash); color: var(--status-good); }
.status-pill.is-pending { background: var(--status-critical-wash); color: var(--status-critical); }
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-date { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.3rem; }

.class-summary-toggle {
    display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
    background: var(--page-plane); border: 1px solid var(--border); border-radius: 999px;
    padding: 0.32rem 0.8rem; font-size: 0.78rem; font-weight: 650; color: var(--text-primary);
    list-style: none; user-select: none;
}
.class-summary-toggle::-webkit-details-marker { display: none; }
.class-summary-toggle::before {
    content: '\25B8'; display: inline-block; font-size: 0.68rem; color: var(--text-muted);
    transition: transform 0.12s ease;
}
details[open] > .class-summary-toggle { border-color: var(--brand); color: var(--brand-dark); }
details[open] > .class-summary-toggle::before { transform: rotate(90deg); }
.class-summary-toggle:hover { border-color: var(--brand); color: var(--brand-dark); }

/* A fixed-column grid (not flex-wrap) so the expanded list forms a
   compact rectangular block instead of a single tall column -- flex-wrap
   only wraps when a row runs out of width, but inside a table cell that
   width is often too narrow for even two chips to sit side by side,
   producing a very tall single-file stack that inflates the whole row's
   height. The panel wrapper visually groups the expanded list as one
   self-contained block instead of loose chips floating in the cell. */
.class-chip-panel {
    margin-top: 0.65rem; padding: 0.6rem 0.65rem;
    background: var(--page-plane); border: 1px solid var(--border); border-radius: var(--radius-md);
    max-width: 300px;
}
.class-chip-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
.class-chip {
    display: flex; align-items: baseline; justify-content: space-between; gap: 0.3rem;
    background: var(--brand-wash); color: var(--brand-dark);
    border-radius: var(--radius-sm); padding: 0.28rem 0.55rem; font-size: 0.78rem; font-weight: 650;
}
.class-chip .count { color: var(--text-muted); font-weight: 500; font-size: 0.74rem; white-space: nowrap; }

.no-data-dash { color: var(--text-muted); }

.report-table-wrap { overflow-x: auto; }
.report-table-wrap table { min-width: 780px; }
/* Top-align cells instead of the browser's default vertical-center --
   without this, a row containing one much-taller cell (e.g. the expanded
   Parallel Classes panel above) visually centers every other cell's
   content in the middle of that inflated row height, making the row look
   broken/disconnected rather than just tall. */
.report-table-wrap table td { vertical-align: top; }

.pagination-summary { font-size: 0.8rem; color: var(--text-muted); }

@media (max-width: 900px) {
    .contact-stack { font-size: 0.76rem; }
}

/* ==========================================================================
   Radar / skill-wheel chart
   ========================================================================== */
.radar-wrap { display: flex; justify-content: center; padding: 0.5rem 0 0.25rem; }
.radar-svg { width: 100%; max-width: 460px; height: auto; }
.radar-label { font-size: 13px; fill: var(--text-secondary); font-weight: 600; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
.radar-ring-label { font-size: 10px; fill: var(--text-muted); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
