/* ------------------------------------------------------------------ */
/*  Degree Audit · Phase-1 stylesheet                                 */
/* ------------------------------------------------------------------ */
:root {
    --c-bg: #f4f6fb;
    --c-surface: #ffffff;
    --c-surface-2: #f8fafc;
    --c-border: #e2e8f0;
    --c-text: #0f172a;
    --c-muted: #64748b;
    --c-primary: #1f4ed8;
    --c-primary-strong: #1e40af;
    --c-accent: #0ea5e9;
    --c-success: #16a34a;
    --c-warning: #d97706;
    --c-error: #dc2626;
    --c-info: #2563eb;
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --shadow-1: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 12px rgba(15, 23, 42, .04);
    color-scheme: light;
}

[data-theme="dark"] {
    --c-bg: #0b1120;
    --c-surface: #131c2e;
    --c-surface-2: #1c2740;
    --c-border: #243049;
    --c-text: #e2e8f0;
    --c-muted: #94a3b8;
    --c-primary: #3b82f6;
    --c-primary-strong: #2563eb;
    --c-accent: #38bdf8;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 6px 18px rgba(0, 0, 0, .35);
    color-scheme: dark;
}
[data-theme="dark"] body { background: var(--c-bg); color: var(--c-text); }
[data-theme="dark"] .sidebar { background: #060b18; }
[data-theme="dark"] .topbar { background: var(--c-surface); border-bottom-color: var(--c-border); color: var(--c-text); }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea {
    background: var(--c-surface); color: var(--c-text); border-color: var(--c-border);
}
[data-theme="dark"] .badge { background: #243049; color: #cbd5e1; }
[data-theme="dark"] .badge-active, [data-theme="dark"] .badge-eligible { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .badge-near { background: #78350f; color: #fde68a; }
[data-theme="dark"] .badge-not_eligible, [data-theme="dark"] .badge-suspended,
[data-theme="dark"] .badge-withdrawn { background: #7f1d1d; color: #fecaca; }
[data-theme="dark"] .badge-info { background: #1e3a8a; color: #bfdbfe; }
[data-theme="dark"] .alert-info { background: rgba(59,130,246,.12); color: #bfdbfe; border-left-color: #3b82f6; }
[data-theme="dark"] .alert-warning { background: rgba(217,119,6,.18); color: #fde68a; border-left-color: #d97706; }
[data-theme="dark"] .alert-error { background: rgba(220,38,38,.18); color: #fecaca; border-left-color: #dc2626; }
[data-theme="dark"] .table tr:hover td { background: rgba(59,130,246,.08); }
[data-theme="dark"] .qr-frame { background: #fff; }                     /* QR codes need white bg to scan */
[data-theme="dark"] .recovery-list li { background: var(--c-surface-2); }
[data-theme="dark"] .secret-display { background: var(--c-surface-2); border-color: var(--c-border); color: var(--c-text); }
[data-theme="dark"] .notif-unread { background: rgba(59,130,246,.10); }
[data-theme="dark"] .timeline-svg text { fill: #cbd5e1; }
[data-theme="dark"] .timeline-svg line[stroke="#e5e7eb"] { stroke: #243049; }
[data-theme="dark"] .readiness-meter { background: var(--c-surface-2); border-color: var(--c-border); }
[data-theme="dark"] .readiness-label { color: #f1f5f9; text-shadow: 0 0 6px rgba(0,0,0,0.6); }
[data-theme="dark"] .bar-fill { background: var(--c-primary); }
[data-theme="dark"] .dept-divider td { background: var(--c-surface-2); }
    --shadow-1: 0 1px 2px rgba(15,23,42,.06), 0 1px 1px rgba(15,23,42,.04);
    --shadow-2: 0 8px 24px rgba(15,23,42,.08);
    --space: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--c-text);
    background: var(--c-bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--c-muted); }

/* App shell */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
    background: #0b1220; color: #cbd5e1;
    padding: 24px 16px; display: flex; flex-direction: column;
    overflow-y: auto;
}
.brand {
    display: flex; align-items: center; gap: 10px;
    color: #fff; font-weight: 600;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    letter-spacing: -0.01em;
}
.brand-name { font-size: 17px; }
.brand-mark { background: var(--c-primary); width: 32px; height: 32px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
    color: #cbd5e1;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    line-height: 1.25;
    transition: background .12s, color .12s;
}
.nav-item:hover { background: rgba(255,255,255,.07); text-decoration: none; color: #fff; }
.nav-item .nav-icon { flex-shrink: 0; opacity: .75; transition: opacity .12s; }
.nav-item:hover .nav-icon { opacity: 1; }
.nav-item-active {
    background: rgba(59,130,246,.18);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--c-primary);
}
.nav-item-active .nav-icon { opacity: 1; color: #93c5fd; }
.nav-item-active:hover { background: rgba(59,130,246,.24); }
.nav-item .nav-label { flex: 1; min-width: 0; }
.nav-section { color: #64748b; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 16px 10px 6px; }

/* legacy — kept for the auth pages' "cancel" link in MFA challenge view */
.btn-link { background: none; border: none; color: #cbd5e1; cursor: pointer; padding: 6px 0; font: inherit; }
.btn-link:hover { color: #fff; }

/* Sidebar footer: theme + sign-out arrow with name/role underneath */
.sidebar-footer { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.sidebar-user { padding: 0 4px; }
.sidebar-user-name { color: #f1f5f9; font-weight: 600; font-size: 14px; line-height: 1.3; }
.sidebar-user-role {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #93c5fd;
    background: rgba(59,130,246,.12);
    border: 1px solid rgba(59,130,246,.25);
    border-radius: 999px;
    letter-spacing: .02em;
}
.icon-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,.12);
    color: #cbd5e1;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--r-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.icon-btn .theme-icon-dark { display: none; }
[data-theme="dark"] .icon-btn .theme-icon-dark { display: inline-block; }
[data-theme="dark"] .icon-btn .theme-icon-light { display: none; }
.signout-btn { margin-left: auto; }

.main { display: flex; flex-direction: column; }
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 28px; background: var(--c-surface); border-bottom: 1px solid var(--c-border);
    gap: 12px;
}
.page-title {
    margin: 0; font-size: 20px;
    flex: 1; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-pill { background: var(--c-surface-2); color: var(--c-muted); padding: 6px 10px; border-radius: 999px; font-size: 13px; }
.content { padding: 24px 28px; }

/* Cards */
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 20px; box-shadow: var(--shadow-1); margin-bottom: 20px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card .stat-label { color: var(--c-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat-card .stat-foot { color: var(--c-muted); font-size: 12px; margin-top: 6px; }
/* Clickable KPI tiles (dashboard) — same look as .stat-card, but with
   hover/focus affordances and no text-decoration since the whole card
   is the click target. */
a.stat-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
a.stat-card-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .08);
    border-color: var(--c-primary);
    text-decoration: none;
}
a.stat-card-link:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
}
a.stat-card-link::after {
    content: "→";
    float: right;
    color: var(--c-muted);
    font-size: 14px;
    transition: transform .12s ease, color .12s ease;
}
a.stat-card-link:hover::after { color: var(--c-primary); transform: translateX(3px); }

/* Department roster — collapsible advisor block on /department */
.dept-advisor-block { border: 1px solid var(--c-border); border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; background: var(--c-surface); }
.dept-advisor-block summary { cursor: pointer; list-style: none; }
.dept-advisor-block summary::-webkit-details-marker { display: none; }
.dept-advisor-block summary > .badge { margin-left: 8px; }
.dept-advisor-block[open] { border-color: var(--c-primary); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px,1fr)); gap: 20px; }

/* Forms */
label { display: block; font-size: 13px; color: var(--c-muted); margin-bottom: 12px; }
input[type=email], input[type=password], input[type=text], input[type=search], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: var(--r-sm);
    font-size: 14px; background: #fff; color: var(--c-text);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--c-primary); outline-offset: 1px; border-color: var(--c-primary); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px;
    border-radius: var(--r-sm); border: 1px solid var(--c-border); background: var(--c-surface);
    font-size: 14px; cursor: pointer; min-height: 40px; }
.btn-primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn-primary:hover { background: var(--c-primary-strong); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; min-height: 34px; }
.toolbar { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.toolbar input[type=search] { max-width: 360px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--c-border); font-size: 14px; }
.table th { color: var(--c-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table tr:hover td { background: var(--c-surface-2); }
.empty { color: var(--c-muted); text-align: center; padding: 24px; }

/* Badges */
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--c-surface-2); color: var(--c-muted); }
.badge-active, .badge-eligible { background: #dcfce7; color: #166534; }
.badge-near { background: #fef3c7; color: #92400e; }
.badge-not_eligible, .badge-suspended, .badge-withdrawn { background: #fee2e2; color: #991b1b; }
.badge-probation { background: #fef3c7; color: #92400e; }
.badge-graduated { background: #dbeafe; color: #1e40af; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 16px; border: 1px solid transparent; font-size: 14px; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

/* Auth */
.auth-page { background: linear-gradient(135deg,#1f4ed8 0%, #0ea5e9 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { background: #fff; padding: 32px; border-radius: var(--r-lg); width: 100%; max-width: 400px; box-shadow: var(--shadow-2); }
.auth-card h1 { margin: 0 0 20px; font-size: 22px; }
.auth-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; color: var(--c-primary); font-weight: 600; }
.auth-links { margin-top: 16px; font-size: 13px; }

/* Errors page */
.error-page { background: var(--c-bg); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.error-card { background: #fff; padding: 40px; border-radius: var(--r-lg); text-align: center; box-shadow: var(--shadow-2); max-width: 480px; }
.error-card h1 { font-size: 56px; margin: 0; color: var(--c-primary); }
.trace { background: #0b1220; color: #cbd5e1; padding: 12px; border-radius: var(--r-sm); font-size: 12px; max-height: 240px; overflow: auto; text-align: left; }

/* Audit summary */
.audit-summary header { display: flex; justify-content: space-between; align-items: center; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px,1fr)); gap: 12px; margin-top: 16px; }
.kpis div { background: var(--c-surface-2); padding: 12px; border-radius: var(--r-sm); }
.kpi-label { color: var(--c-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; display: block; }
.kpi-value { font-size: 22px; font-weight: 600; margin-top: 4px; display: block; }
.course-list { list-style: none; padding: 0; margin: 0; }
.course-list li { padding: 8px 0; border-bottom: 1px solid var(--c-border); font-size: 14px; }
.course-tick { display: inline-block; width: 16px; color: var(--c-success); font-weight: 700; }
.course-tick.muted { color: var(--c-muted); }

/* Planner launcher cards */
.planner-launcher-card { display: block; text-decoration: none; color: inherit; transition: transform .12s ease, box-shadow .12s ease; }
.planner-launcher-card:hover { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15,23,42,.08); text-decoration: none; }
[data-theme="dark"] .planner-launcher-card:hover { box-shadow: 0 8px 20px rgba(0,0,0,.4); }

/* Bell popover */
.bell-wrap { position: relative; }
.bell { background: transparent; border: none; cursor: pointer; }
.bell-pop {
    position: absolute; right: 0; top: calc(100% + 8px);
    width: 360px; max-width: 90vw;
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r-md); box-shadow: 0 18px 40px rgba(15,23,42,.18);
    z-index: 1000; overflow: hidden;
}
[data-theme="dark"] .bell-pop { box-shadow: 0 18px 40px rgba(0,0,0,.55); }
.bell-pop[hidden] { display: none; }
.bell-pop > header { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--c-border); }
.bell-pop-body { max-height: 60vh; overflow: auto; }
.bell-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--c-border); color: var(--c-text); text-decoration: none; }
.bell-item:last-child { border-bottom: none; }
.bell-item:hover { background: var(--c-surface-2); text-decoration: none; }
.bell-item.unread { background: rgba(59,130,246,.06); }
[data-theme="dark"] .bell-item.unread { background: rgba(59,130,246,.10); }
.bell-item-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-bottom: 4px; }

/* Hamburger + mobile sidebar */
.hamburger {
    display: none;
    background: transparent; border: 1px solid var(--c-border);
    color: var(--c-text); padding: 6px 10px; border-radius: var(--r-sm);
    cursor: pointer; align-items: center; justify-content: center;
}
.hamburger:hover { background: var(--c-surface-2); }
.sidebar-close-btn {
    display: none; position: absolute; top: 12px; right: 12px;
    background: transparent; border: none; color: #cbd5e1;
    font-size: 28px; line-height: 1; cursor: pointer; padding: 4px 10px;
}
.sidebar-close-btn:hover { color: #fff; }
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .hamburger { display: inline-flex; flex: 0 0 auto; }
    .sidebar-close-btn { display: block; }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: 280px; max-width: 86vw;
        z-index: 1100; transform: translateX(-100%); transition: transform .22s ease;
        box-shadow: 0 0 30px rgba(0,0,0,.35);
        overflow-y: auto; -webkit-overflow-scrolling: touch;
    }
    body.sidebar-open { overflow: hidden; }       /* lock background scroll */
    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open::after {
        content: ''; position: fixed; inset: 0; background: rgba(15,23,42,.4);
        z-index: 1090;
    }
    /* Keep the floating chat launcher out of the way when the drawer is
       open — otherwise it sits on top of the backdrop and looks broken. */
    body.sidebar-open .chat-launcher,
    body.sidebar-open .chat-panel { display: none !important; }
    .topbar { padding: 14px 18px; gap: 12px; }
    .page-title { font-size: 18px; }
    .demo-bar, .impersonation-bar { flex-wrap: wrap; }
    .topbar-meta { gap: 8px; flex: 0 0 auto; }
}
@media (max-width: 540px) {
    .topbar-meta .qs-trigger span { display: none; }   /* shrink "Search" → just the icon on phones */
    .topbar-meta .qs-trigger kbd { display: none; }
    .topbar { padding: 10px 12px; }
    .page-title { font-size: 16px; }
    .bell-pop { width: 92vw; right: -8px; }
    .content { padding: 16px 14px; }
    .chat-toggle { padding: 10px 14px 10px 12px; bottom: 14px; right: 14px; }
    .chat-toggle-label { display: none; }              /* tight phones: icon-only launcher */
    .chat-panel { width: calc(100vw - 16px); right: 8px; bottom: 8px;
                  max-height: calc(100vh - 16px); }
}

/* SuperAdmin "view as" banner */
.impersonation-bar {
    background: #f59e0b; color: #1f2937;
    padding: 10px 18px; display: flex; gap: 14px;
    align-items: center; justify-content: space-between;
    font-size: 13px;
    border-bottom: 1px solid #b45309;
}
.impersonation-bar .btn { background: #1f2937; color: #fff; border-color: #1f2937; }
.impersonation-bar .btn:hover { background: #0f172a; color: #fff; }

/* Audit log */
.audit-filter { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 12px; margin-top: 8px; }
.audit-json { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 4px; padding: 8px; font-size: 11px; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 4px 0 0; }
.badge-risk-info     { background: #e0f2fe; color: #0369a1; }
.badge-risk-low      { background: #dcfce7; color: #166534; }
.badge-risk-medium   { background: #fef3c7; color: #92400e; }
.badge-risk-high     { background: #fee2e2; color: #991b1b; }
.badge-risk-critical { background: #7f1d1d; color: #fee2e2; }
[data-theme="dark"] .badge-risk-info     { background: #0c4a6e; color: #bae6fd; }
[data-theme="dark"] .badge-risk-low      { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .badge-risk-medium   { background: #78350f; color: #fde68a; }
[data-theme="dark"] .badge-risk-high     { background: #7f1d1d; color: #fecaca; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

/* Bulk-action toolbar (admin tables) */
.bulk-bar {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    background: var(--c-surface); border: 1px solid var(--c-border);
    border-radius: var(--r-sm); padding: 10px 14px; margin: 0 0 12px;
    box-shadow: var(--shadow-1);
}
.bulk-bar[hidden] { display: none; }

/* Empty-state cells */
.table .empty { padding: 32px 16px; }
.table .empty .btn { margin: 0 4px; }

/* Shortcut help */
.shortcut-table { width: 100%; border-collapse: collapse; }
.shortcut-table td { padding: 6px 4px; font-size: 14px; vertical-align: middle; }
.shortcut-table td:first-child { width: 130px; white-space: nowrap; }
.shortcut-table kbd { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 4px; padding: 1px 6px; font-size: 11px; color: var(--c-muted); margin-right: 2px; }

/* Quick-search palette (Ctrl/⌘+K) */
.qs-trigger {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--c-surface-2); border: 1px solid var(--c-border);
    color: var(--c-muted); padding: 6px 12px; border-radius: var(--r-sm);
    cursor: pointer; font: inherit; font-size: 13px;
}
.qs-trigger:hover { background: var(--c-bg); color: var(--c-text); }
.qs-trigger kbd { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 4px;
    padding: 1px 6px; font-size: 11px; color: var(--c-muted); }

.qs-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.45);
    display: none; align-items: flex-start; justify-content: center;
    padding-top: 12vh; z-index: 9998;
}
[data-theme="dark"] .qs-overlay { background: rgba(0,0,0,.65); }
.qs-overlay.open { display: flex; }
.qs-panel {
    width: min(620px, 92vw); background: var(--c-surface);
    border: 1px solid var(--c-border); border-radius: var(--r-md);
    box-shadow: 0 24px 60px rgba(15,23,42,.25);
    overflow: hidden;
}
.qs-input-row {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--c-border);
    color: var(--c-muted);
}
.qs-input-row input {
    flex: 1; border: none; background: transparent; outline: none;
    color: var(--c-text); font-size: 15px;
}
.qs-input-row kbd { background: var(--c-surface-2); border: 1px solid var(--c-border);
    border-radius: 4px; padding: 1px 6px; font-size: 11px; color: var(--c-muted); }
.qs-results { max-height: 56vh; overflow: auto; }
.qs-row {
    display: grid; grid-template-columns: 80px 1fr auto; gap: 12px;
    align-items: baseline; padding: 10px 16px;
    border-bottom: 1px solid var(--c-border); color: var(--c-text);
    text-decoration: none;
}
.qs-row:last-child { border-bottom: none; }
.qs-row:hover, .qs-row.active { background: var(--c-surface-2); text-decoration: none; }
.qs-type {
    display: inline-block; text-align: center; font-size: 10px;
    text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px;
    border-radius: 4px; background: var(--c-surface-2); color: var(--c-muted);
}
.qs-type-student { background: #dbeafe; color: #1e40af; }
.qs-type-course  { background: #dcfce7; color: #166534; }
.qs-type-plan    { background: #fef3c7; color: #92400e; }
[data-theme="dark"] .qs-type-student { background: #1e3a8a; color: #bfdbfe; }
[data-theme="dark"] .qs-type-course  { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .qs-type-plan    { background: #78350f; color: #fde68a; }
.qs-label { font-weight: 500; }
.qs-sublabel { color: var(--c-muted); font-size: 12px; }
.qs-empty { padding: 18px 16px; color: var(--c-muted); font-size: 13px; text-align: center; }

/* Topbar bell + notifications */
.topbar-meta { display: flex; align-items: center; gap: 12px; }
.bell { position: relative; text-decoration: none; font-size: 18px; line-height: 1; padding: 6px; border-radius: var(--r-sm); display: inline-flex; align-items: center; justify-content: center; }
.bell:hover { background: var(--c-surface-2); }
.bell-badge { position: absolute; top: -2px; right: -4px; background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; line-height: 1; padding: 2px 5px; border-radius: 999px; min-width: 16px; text-align: center; }

.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.notif { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-sm); padding: 0; }
.notif-unread { border-left: 3px solid #3b82f6; background: #f0f9ff; }
.notif-row { margin: 0; padding: 0; }
.notif-link { display: block; width: 100%; text-align: left; padding: 10px 12px; background: none; border: none; cursor: pointer; font: inherit; color: inherit; }
.notif-link:hover { background: rgba(59,130,246,.06); }
.notif header { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.notif p { margin: 0; font-size: 13px; color: var(--c-muted); white-space: pre-wrap; }

/* Timeline */
.timeline-svg { width: 100%; height: auto; max-height: 360px; display: block; }
.readiness-meter { position: relative; height: 28px; background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 999px; overflow: hidden; }
.readiness-fill { background: linear-gradient(90deg, #3b82f6 0%, #16a34a 100%); height: 100%; transition: width .4s ease; }
.readiness-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #0f172a; text-shadow: 0 0 6px rgba(255,255,255,0.7); }

/* Transcript */
.transcript { max-width: 920px; margin: 0 auto; }
.transcript-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.transcript-meta { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.transcript-meta th { text-align: left; color: var(--c-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 10px; width: 1%; white-space: nowrap; }
.transcript-meta td { padding: 6px 14px 6px 4px; font-size: 14px; }
.transcript-term { margin: 18px 0; }
.transcript-term h3 { margin: 0 0 6px; font-size: 14px; }
@media print {
    .sidebar, .topbar, .planner-toolbar, .toolbar, button, .btn { display: none !important; }
    .app-shell { display: block; }
    .main, .content { padding: 0 !important; }
    .card { box-shadow: none; border: none; }
}

/* Curriculum board */
.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 14px; margin-top: 16px; }
.board-col { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 12px; min-height: 320px; }
.board-col header { margin-bottom: 8px; }
.board-col header h3 { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.board-col header p { margin: 4px 0 0; font-size: 11px; color: var(--c-muted); text-transform: uppercase; letter-spacing: .04em; }
.board-zone { list-style: none; margin: 0; padding: 0; min-height: 240px; display: flex; flex-direction: column; gap: 6px; }
.board-zone .course-card { padding: 8px 10px; }
.board-zone .empty { padding: 16px; text-align: center; }

/* Planner drag states */
.drag-over { outline: 2px dashed #3b82f6; outline-offset: -4px; background: rgba(59,130,246,.06); }
.drag-reject { outline: 2px dashed #dc2626; outline-offset: -4px; background: rgba(220,38,38,.06); cursor: not-allowed; }
.drag-clone { box-shadow: 0 8px 24px rgba(15,23,42,.18); border-radius: var(--r-sm); }
.dragging { opacity: 0.4; }
.has-conflict { box-shadow: inset 3px 0 0 #dc2626; }
.overload { color: #dc2626; font-weight: 700; }
.course-card { touch-action: none; } /* let pointer fallback own scrolling on a card */

/* Planner comments */
.semester header > div { display: flex; align-items: center; gap: 8px; }
.semester-approved { border-color: #16a34a; box-shadow: inset 4px 0 0 #16a34a; }
.semester-rejected { border-color: #dc2626; box-shadow: inset 4px 0 0 #dc2626; }
.semester-locked { background: repeating-linear-gradient(45deg, #f8fafc, #f8fafc 6px, #f1f5f9 6px, #f1f5f9 12px); opacity: .85; }
.semester-locked header h4 { color: #475569; }
.dropzone-locked { pointer-events: none; }
.dropzone-locked.drag-over, .dropzone-locked.drag-reject { background: transparent; outline-color: transparent; }
.course-card-locked { cursor: not-allowed; opacity: .85; background: #fff; border-color: #e2e8f0; }
.comment-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.comment { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-sm); padding: 8px 12px; font-size: 13px; }
.comment header { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.comment p { margin: 0; white-space: pre-wrap; }
.comment-approved { border-left: 3px solid #16a34a; }
.comment-rejected { border-left: 3px solid #dc2626; }
.comment-form-toggle { margin-top: 12px; }
.comment-form-toggle summary { cursor: pointer; color: var(--c-muted); font-size: 13px; }
.comment-form { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea { width: 100%; padding: 8px; border: 1px solid var(--c-border); border-radius: var(--r-sm); font: inherit; resize: vertical; }
.comment-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* MFA */
.qr-frame { display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-sm); margin: 12px 0; }
.qr-frame svg { display: block; max-width: 240px; height: auto; }
.secret-display { display: inline-block; padding: 8px 12px; background: var(--c-surface-2); border: 1px dashed var(--c-border); border-radius: var(--r-sm); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 14px; letter-spacing: .04em; }
.recovery-list { list-style: none; padding: 0; margin: 16px 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 8px; }
.recovery-list li { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: var(--r-sm); padding: 10px 12px; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; letter-spacing: .08em; }
.checkbox { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 14px; }
.btn-danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover { background: #b91c1c; }
.badge-inactive, .badge-Disabled { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; border-left: 4px solid #f59e0b; }

/* Reports */
.bar { background: var(--c-surface-2); border: 1px solid var(--c-border); border-radius: 999px; height: 10px; min-width: 120px; overflow: hidden; }
.bar-fill { background: var(--c-accent, #3b82f6); height: 100%; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { padding: 6px 0; border-bottom: 1px dashed var(--c-border); font-size: 14px; }
.link-list li:last-child { border-bottom: none; }

/* Group breakdown */
.group-block { border: 1px solid var(--c-border); border-radius: var(--r-sm); margin-bottom: 10px; background: var(--c-surface-2); }
.group-block.group-ok { border-left: 4px solid var(--c-success); }
.group-block.group-pending { border-left: 4px solid var(--c-warning); }
.group-block > summary {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 14px;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.group-block > summary::-webkit-details-marker { display: none; }
.group-block > summary::before {
    content: "▸";
    color: var(--c-muted);
    font-size: 10px;
    transition: transform .12s ease;
    flex-shrink: 0;
}
.group-block[open] > summary::before { transform: rotate(90deg); }
.group-block > summary:hover { background: rgba(15,23,42,.03); border-radius: var(--r-sm); }
[data-theme="dark"] .group-block > summary:hover { background: rgba(255,255,255,.04); }
.group-block > summary h4 { margin: 0; font-size: 14px; flex: 1; }
.group-block > .course-list,
.group-block > .group-children { padding: 0 14px 12px; }
.group-meta { color: var(--c-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.group-summary { color: var(--c-text); font-size: 13px; }
.group-children { margin-top: 8px; padding-left: 16px !important; border-left: 2px solid var(--c-border); }

.audit-toggle-all { display: flex; gap: 6px; flex-wrap: wrap; }

/* Floating KPI strip: a slim, fixed-position copy of the .kpis row
   that appears at the top of the viewport once the in-card KPIs
   scroll out of view. Driven by IntersectionObserver in audit.php. */
.audit-kpi-strip {
    position: fixed;
    top: 0;
    left: var(--sidebar-width, 240px);
    right: 0;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
    padding: 10px 22px;
    display: flex;
    gap: 24px;
    align-items: center;
    z-index: 20;
    transform: translateY(-100%);
    transition: transform .15s ease;
    box-shadow: 0 1px 4px rgba(15,23,42,.04);
    font-size: 13px;
}
.audit-kpi-strip.is-visible { transform: translateY(0); }
.audit-kpi-strip .kpi-pair { display: inline-flex; gap: 6px; align-items: baseline; white-space: nowrap; }
.audit-kpi-strip .kpi-pair strong { font-size: 14px; }
.audit-kpi-strip .kpi-pair span { color: var(--c-muted); font-size: 12px; }
.audit-kpi-strip .badge { margin-left: auto; }
@media (max-width: 900px) { .audit-kpi-strip { left: 0; padding: 8px 14px; gap: 14px; font-size: 12px; overflow-x: auto; } }

@media (max-width: 720px) {
    .kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .kpis .kpi-value { font-size: 18px; }
    .group-block > summary { gap: 6px; padding: 9px 10px; }
    .group-block > summary h4 { font-size: 13px; flex-basis: 100%; }
    .group-meta, .group-summary { font-size: 11px; }
    .group-block > .course-list,
    .group-block > .group-children { padding: 0 10px 10px; }
    .audit-summary header { flex-direction: column; align-items: flex-start; }
    .audit-summary header > div:nth-child(2) { flex-wrap: wrap; gap: 6px; width: 100%; }
    .audit-summary header > div:nth-child(2) .btn-sm { font-size: 12px; padding: 5px 9px; }
    .audit-toggle-all .btn-sm { padding: 4px 8px; font-size: 12px; }
    .audit-breakdown > header { flex-direction: column; align-items: stretch; }
    .grid-2 { grid-template-columns: 1fr; gap: 12px; }
    .audit-section-header { margin: 14px 0 6px !important; }
}
@media (max-width: 480px) {
    .kpis { grid-template-columns: 1fr 1fr; }
    .kpis .kpi-value { font-size: 16px; }
    .group-block > summary .badge { margin-left: auto; }
}

/* Planner */
.planner-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.planner { display: grid; grid-template-columns: 280px 1fr; gap: 20px; }
.planner-pool { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 16px; max-height: 70vh; overflow: auto; }
.planner-pool h3 { margin-top: 0; font-size: 14px; }
.course-pool, .dropzone { list-style: none; margin: 0; padding: 0; min-height: 80px; }
.planner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 16px; }
.semester { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 14px; min-height: 200px; }
.semester header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.semester h4 { margin: 0; font-size: 14px; }
.credit-meter { font-size: 12px; color: var(--c-muted); }
.dropzone { padding: 8px; border-radius: var(--r-sm); transition: background .12s ease, outline-color .12s ease; outline: 2px dashed transparent; outline-offset: -4px; }
.dropzone.drag-over { background: #eef4ff; outline-color: var(--c-primary); }
.course-card {
    display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
    background: #fff; border: 1px solid var(--c-border); border-radius: var(--r-sm);
    padding: 8px 10px; margin-bottom: 6px; cursor: grab; font-size: 13px; box-shadow: var(--shadow-1);
}
.course-card:active { cursor: grabbing; }
.course-card.dragging { opacity: .4; }
.course-card.placed { background: var(--c-surface-2); }
.course-card .course-code { font-weight: 600; color: var(--c-primary); }
.course-card .course-credits { color: var(--c-muted); font-size: 12px; }
.course-card.has-conflict { border-color: var(--c-error); background: #fef2f2; }
.course-card.has-warning { border-color: #d97706; background: #fffbeb; }
.course-card.has-error { border-color: var(--c-error); background: #fef2f2; cursor: pointer; }
.course-card.has-error::after {
    content: "click to request override";
    grid-column: 1 / -1; display: block;
    font-size: 11px; color: #991b1b; margin-top: 4px;
}

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline-item { padding: 10px 0; border-bottom: 1px solid var(--c-border); display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.timeline-item:last-child { border-bottom: none; }
.timeline-step { font-weight: 600; color: var(--c-muted); }
.timeline-role { color: var(--c-text); font-weight: 500; }
.timeline-notes { width: 100%; color: var(--c-muted); font-size: 13px; margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--c-border); }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-cancelled { background: #f1f5f9; color: #475569; }

@media (max-width: 880px) {
    .app-shell { grid-template-columns: 1fr; }
    /* The earlier @media(max-width:900px) block puts the sidebar into a
       slide-out drawer (transform translateX off-screen, .sidebar-open
       slides it back in). Don't display:none it here or the hamburger
       button has nothing to reveal. */
    .planner { grid-template-columns: 1fr; gap: 12px; }
    .planner-pool { max-height: 280px; }
    .planner-toolbar { flex-wrap: wrap; gap: 8px; }
    .planner-toolbar > * { flex: 1 1 auto; }
    .planner-grid { grid-template-columns: 1fr !important; gap: 12px; }
}
@media (max-width: 480px) {
    .planner-toolbar h2 { font-size: 17px; }
    .planner-pool { padding: 12px; }
    .planner-pool h3 { font-size: 13px; }
}

/* ------------------------------------------------------------------ */
/*  Degree-plan drag-and-drop editor (admin / chair).                  */
/* ------------------------------------------------------------------ */
.plan-editor-card { display: block; }
.plan-editor {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
    margin-top: 12px;
    align-items: start;
}
.plan-pool {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 12px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 64px);
    overflow: auto;
}
.plan-pool h4 { margin: 0 0 8px; font-size: 14px; }
.plan-pool input[type="search"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    font-size: 13px;
    margin-bottom: 8px;
    background: var(--c-surface);
    color: var(--c-text);
}
.pool-zone {
    list-style: none;
    margin: 0;
    padding: 6px;
    min-height: 80px;
    border-radius: var(--r-sm);
    transition: background .12s ease, outline-color .12s ease;
    outline: 2px dashed transparent;
    outline-offset: -4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.pool-zone.drag-over { background: rgba(59,130,246,.08); outline-color: var(--c-primary); }

.plan-editor-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--c-border);
    margin-bottom: 10px;
}
.plan-editor-tabs button {
    background: transparent;
    border: 0;
    padding: 8px 14px;
    cursor: pointer;
    color: var(--c-muted);
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}
.plan-editor-tabs button.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }
.plan-editor-tabs button:hover { color: var(--c-text); }

.plan-editor-board {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}
.plan-editor-empty { padding: 24px; text-align: center; }
.plan-lane {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-md);
    padding: 10px;
    display: flex;
    flex-direction: column;
    min-height: 120px;
}
.plan-lane.plan-lane-muted { background: var(--c-surface-2); }
.plan-lane > header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--c-border);
}
.plan-lane > header h4 { margin: 0; font-size: 13px; }
.plan-lane > header .muted { font-size: 11px; }
.plan-lane-zone {
    list-style: none;
    margin: 0;
    padding: 4px;
    min-height: 60px;
    border-radius: var(--r-sm);
    flex: 1;
    transition: background .12s ease, outline-color .12s ease;
    outline: 2px dashed transparent;
    outline-offset: -4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.plan-lane-zone.drag-over { background: rgba(59,130,246,.10); outline-color: var(--c-primary); }

.plan-card {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 6px 8px;
    cursor: grab;
    font-size: 13px;
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    touch-action: none;
    user-select: none;
}
.plan-card:hover { border-color: var(--c-primary); }
.plan-card:active { cursor: grabbing; }
.plan-card.dragging { opacity: .4; }
.plan-card strong { color: var(--c-primary); font-size: 12px; }
.plan-card-title { color: var(--c-text); flex: 1 1 100%; font-size: 12px; }
.plan-card-pool { background: var(--c-surface); }

[data-theme="dark"] .plan-pool { background: var(--c-surface-2); }
[data-theme="dark"] .plan-lane { background: var(--c-surface); }
[data-theme="dark"] .plan-lane.plan-lane-muted { background: var(--c-surface-2); }
[data-theme="dark"] .plan-card { background: var(--c-surface-2); }

[data-theme="dark"] .pool-zone.drag-over,
[data-theme="dark"] .plan-lane-zone.drag-over {
    background: rgba(59,130,246,.18);
}

@media (max-width: 880px) {
    .plan-editor { grid-template-columns: 1fr; }
    .plan-pool { position: static; max-height: 320px; }
}

/* Per-term group boxes — advisors see "core / required / elective" splits. */
.term-group-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin: 8px 0 4px;
}
.term-group-box {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: var(--r-sm);
    padding: 8px 10px;
}
.term-group-box.term-group-box-ungrouped { border-left-color: var(--c-muted); }
.term-group-box > header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--c-border);
}
.term-group-box > header strong { font-size: 13px; }
.term-group-box > header .muted { font-size: 11px; }
.term-group-box .course-list li { padding: 4px 0; font-size: 13px; border-bottom: none; }
[data-theme="dark"] .term-group-box { background: var(--c-surface); }

/* By-requirement-group breakdown — mirror of plan-term blocks. */
.plan-group-block {
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: var(--r-md);
    padding: 12px 14px;
    margin: 10px 0;
    background: var(--c-surface);
}
.plan-group-block.plan-group-block-ungrouped { border-left-color: var(--c-muted); }
.plan-group-block > header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--c-border);
}
.group-term-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin-top: 6px;
}
.group-term-box {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 8px 10px;
}
.group-term-box.group-term-box-unscheduled { border-style: dashed; }
.group-term-box > header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 4px;
    padding-bottom: 4px;
    border-bottom: 1px dashed var(--c-border);
    font-size: 13px;
}
.group-term-box > header .muted { font-size: 11px; }
.group-term-box .course-list li { padding: 4px 0; font-size: 13px; border-bottom: none; }
[data-theme="dark"] .plan-group-block { background: var(--c-surface-2); }
[data-theme="dark"] .group-term-box { background: var(--c-surface); }

/* Course chips — used in every "box" on the plan show page (per-term group
   boxes, per-group term boxes, and the unscheduled trailer). */
.course-chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 6px;
    margin: 6px 0 2px;
}
.course-chip {
    display: flex;
    flex-direction: column;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: var(--r-sm);
    padding: 6px 8px 5px;
    transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease;
    min-width: 0;
}
.course-chip:hover {
    border-color: var(--c-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-1);
}
.course-chip-code {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    color: var(--c-primary);
    text-transform: uppercase;
}
.course-chip-title {
    font-size: 12px;
    color: var(--c-text);
    line-height: 1.25;
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.course-chip-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.course-chip-cr {
    font-size: 10px;
    color: var(--c-muted);
    background: var(--c-surface-2);
    padding: 1px 6px;
    border-radius: 999px;
    border: 1px solid var(--c-border);
}
.course-chip-tag {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--c-warning);
    background: rgba(217,119,6,.10);
    padding: 1px 6px;
    border-radius: 999px;
}
.course-chip.is-elective { border-left-color: var(--c-warning); border-style: dashed; }
.course-chip.is-elective .course-chip-code { color: var(--c-warning); }

[data-theme="dark"] .course-chip { background: var(--c-surface-2); }
[data-theme="dark"] .course-chip-cr { background: var(--c-surface); }
[data-theme="dark"] .course-chip-tag { background: rgba(217,119,6,.18); color: #fde68a; }

/* ------------------------------------------------------------------ */
/*  What-if simulator + plan-switcher comparison columns.              */
/* ------------------------------------------------------------------ */
.what-if-compare { align-items: start; }
.wi-metrics {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin: 4px 0 8px;
}
.wi-metric {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 8px 10px;
}
.wi-metric-label { color: var(--c-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.wi-metric-value { font-size: 16px; font-weight: 600; margin-top: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wi-delta { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 999px; }
.wi-delta-good { background: rgba(22,163,74,.12); color: var(--c-success); }
.wi-delta-bad  { background: rgba(220,38,38,.12); color: var(--c-error); }
.wi-groups, .wi-missing { list-style: none; padding: 0; margin: 0; }
.wi-groups li, .wi-missing li {
    padding: 6px 8px;
    border-bottom: 1px solid var(--c-border);
    font-size: 13px;
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.wi-groups li:last-child, .wi-missing li:last-child { border-bottom: none; }
.wi-group.wi-group-ok { border-left: 3px solid var(--c-success); padding-left: 6px; }
.wi-group.wi-group-pending { border-left: 3px solid var(--c-warning); padding-left: 6px; }

[data-theme="dark"] .wi-metric { background: var(--c-surface); }

/* ------------------------------------------------------------------ */
/*  Chair capacity-planning table.                                     */
/* ------------------------------------------------------------------ */
.capacity-summary {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin: 10px 0;
}
.capacity-stat {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    padding: 10px 12px;
}
.capacity-stat-warn { border-left: 3px solid var(--c-warning); }
.capacity-stat-label { color: var(--c-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.capacity-stat-value { font-size: 22px; font-weight: 700; margin-top: 4px; color: var(--c-text); }
.capacity-bar {
    position: relative;
    height: 22px;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    overflow: hidden;
    min-width: 160px;
}
.capacity-bar-fill {
    position: absolute; inset: 0 auto 0 0;
    background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
    opacity: .85;
}
.capacity-bar-count {
    position: relative;
    z-index: 1;
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--c-text);
}
[data-theme="dark"] .capacity-stat { background: var(--c-surface); }
[data-theme="dark"] .capacity-bar  { background: var(--c-surface-2); }
[data-theme="dark"] .capacity-bar-count { color: #f1f5f9; text-shadow: 0 0 6px rgba(0,0,0,0.55); }

/* ------------------------------------------------------------------ */
/*  Admin directory: groups landing + paginated list.                  */
/* ------------------------------------------------------------------ */
.view-toggle {
    display: inline-flex;
    border: 1px solid var(--c-border);
    border-radius: var(--r-sm);
    overflow: hidden;
}
.view-toggle-btn {
    padding: 6px 12px;
    font-size: 13px;
    color: var(--c-muted);
    background: var(--c-surface);
    text-decoration: none;
    border-right: 1px solid var(--c-border);
}
.view-toggle-btn:last-child { border-right: 0; }
.view-toggle-btn:hover { color: var(--c-text); text-decoration: none; }
.view-toggle-btn.active { background: var(--c-primary); color: #fff; }

.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 8px;
}
.group-card {
    display: block;
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    border-left: 3px solid var(--c-primary);
    border-radius: var(--r-md);
    padding: 12px 14px;
    text-decoration: none;
    color: var(--c-text);
    transition: border-color .12s ease, transform .12s ease, box-shadow .12s ease;
}
.group-card:hover {
    border-color: var(--c-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-1);
    text-decoration: none;
}
.group-card-muted { border-left-color: var(--c-muted); }
.group-card-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}
.group-card-head strong { font-size: 14px; }
.group-card-total {
    font-size: 22px;
    font-weight: 700;
    color: var(--c-primary);
    line-height: 1;
}
.group-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 12px;
    color: var(--c-muted);
    align-items: center;
}
.group-card-meta .badge { font-size: 11px; padding: 2px 6px; }

.filter-card form label { font-size: 12px; color: var(--c-muted); display: block; }
.filter-card form input,
.filter-card form select { width: 100%; }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--c-border);
}
.pagination .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }

[data-theme="dark"] .group-card { background: var(--c-surface); }
[data-theme="dark"] .view-toggle-btn { background: var(--c-surface-2); }

/* Demo-mode banner — only visible when APP_DEMO=true. Sits at the top of
   every authenticated page so prospects always know which user they're
   currently signed in as and can hop back to the role picker. */
.demo-bar {
    background: linear-gradient(90deg, #0ea5e9, #6366f1);
    color: #fff;
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    box-shadow: 0 1px 4px rgba(15,23,42,.12);
}
.demo-bar code { background: rgba(255,255,255,.18); padding: 1px 6px; border-radius: 4px; }
.demo-bar .btn {
    background: #fff; color: #0f172a; border: 0;
    padding: 4px 10px; border-radius: 6px; font-weight: 600;
}
.demo-bar .btn:hover { background: #e0f2fe; }

/* ------------------------------------------------------------------ */
/*  Conversational advisor — floating chat panel.                      */
/* ------------------------------------------------------------------ */
.chat-launcher {
    position: fixed; bottom: 22px; right: 22px; z-index: 1500;
}
.chat-tip {
    position: absolute; bottom: calc(100% + 12px); right: 0;
    width: 280px; max-width: calc(100vw - 32px);
    background: var(--c-surface); color: var(--c-text);
    border: 1px solid var(--c-border); border-radius: 10px;
    padding: 12px 14px; font-size: 12px; line-height: 1.45;
    box-shadow: 0 12px 32px rgba(15,23,42,.22);
    opacity: 0; pointer-events: none; transform: translateY(4px);
    transition: opacity .12s ease, transform .12s ease;
}
.chat-tip::after {
    content: ''; position: absolute; bottom: -6px; right: 26px;
    width: 10px; height: 10px; background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    border-bottom: 1px solid var(--c-border);
    transform: rotate(45deg);
}
.chat-tip strong { display: block; margin-bottom: 4px; }
.chat-tip p { margin: 0; }
.chat-launcher:hover .chat-tip,
.chat-launcher:focus-within .chat-tip {
    opacity: 1; transform: translateY(0);
}
body:has(.chat-panel.open) .chat-tip { display: none; }
.chat-toggle {
    z-index: 1500;
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    color: #fff;
    border: 0;
    border-radius: 999px;
    padding: 12px 18px 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 10px 28px rgba(99,102,241,.35);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
}
.chat-toggle:hover { transform: translateY(-2px); box-shadow: 0 14px 32px rgba(99,102,241,.45); }
.chat-toggle-label { line-height: 1; }

.chat-panel {
    position: fixed;
    bottom: 22px;
    right: 22px;
    width: min(420px, calc(100vw - 32px));
    max-height: min(640px, calc(100vh - 60px));
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(15,23,42,.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 1500;
}
.chat-panel.open { display: flex; }
.chat-panel.open ~ .chat-launcher, body:has(.chat-panel.open) .chat-launcher { display: none; }
.chat-head {
    background: linear-gradient(135deg, #6366f1, #0ea5e9);
    color: #fff;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.chat-head strong { font-size: 14px; }
.chat-head .muted { color: rgba(255,255,255,.78) !important; }
.chat-close, .chat-clear {
    background: rgba(255,255,255,.18); color: #fff; border: 0;
    width: 26px; height: 26px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.chat-close:hover, .chat-clear:hover { background: rgba(255,255,255,.28); }
.chat-head-actions { display: flex; gap: 6px; }

.chat-consent {
    margin: 12px 14px 0; padding: 12px 14px; border-radius: 10px;
    background: #fffbe6; border: 1px solid #fde68a; color: #713f12;
    font-size: 12px; line-height: 1.5;
}
.chat-consent-body { margin: 0 0 10px; }
.chat-consent-body strong { color: #92400e; text-transform: capitalize; }
.chat-consent-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chat-consent-actions .btn { font-size: 12px; padding: 6px 10px; }

.chat-log {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--c-surface-2);
}
.chat-msg {
    max-width: 88%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    position: relative;
}
.chat-msg-body strong { color: var(--c-primary); }
.chat-msg-user {
    align-self: flex-end;
    background: var(--c-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.chat-msg-user .chat-msg-body strong { color: #e0e7ff; }
.chat-msg-assistant {
    align-self: flex-start;
    background: var(--c-surface);
    color: var(--c-text);
    border: 1px solid var(--c-border);
    border-bottom-left-radius: 4px;
}
.chat-msg-tag {
    position: absolute;
    top: -8px;
    left: 10px;
    background: var(--c-accent);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 999px;
}

.chat-suggest {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 14px 0;
    background: var(--c-surface);
}
.chat-suggest button {
    background: var(--c-surface-2);
    border: 1px solid var(--c-border);
    color: var(--c-muted);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    cursor: pointer;
}
.chat-suggest button:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

.chat-form {
    display: flex;
    gap: 6px;
    padding: 10px 14px;
    border-top: 1px solid var(--c-border);
    background: var(--c-surface);
}
.chat-form textarea {
    flex: 1;
    resize: none;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 13px;
    border: 1px solid var(--c-border);
    border-radius: 8px;
    min-height: 36px;
    max-height: 100px;
    background: var(--c-surface);
    color: var(--c-text);
}
.chat-status {
    font-size: 11px;
    padding: 0 14px 8px;
    background: var(--c-surface);
    min-height: 14px;
}
.chat-status[data-kind="busy"]  { color: var(--c-warning); }
.chat-status[data-kind="error"] { color: var(--c-error); }
.chat-status[data-kind="ok"]    { color: var(--c-success); }

[data-theme="dark"] .chat-panel { box-shadow: 0 24px 60px rgba(0,0,0,.55); }
[data-theme="dark"] .chat-msg-assistant { background: var(--c-surface-2); }

@media (max-width: 540px) {
    .chat-panel { right: 0; bottom: 0; width: 100vw; max-height: 90vh; border-radius: 14px 14px 0 0; }
}

/* ------------------------------------------------------------------ */
/*  Auto-scheduler: weekly grid + schedule-option cards.               */
/* ------------------------------------------------------------------ */
.schedule-list { display: grid; gap: 16px; }
.schedule-card { margin: 0; }

.weekly-grid {
    display: grid;
    grid-template-columns: 48px repeat(5, 1fr);
    gap: 4px;
    margin-top: 6px;
}
.weekly-grid-hours { display: flex; flex-direction: column; padding-top: 22px; }
.weekly-grid-hour {
    height: var(--row-height);
    font-size: 10px;
    color: var(--c-muted);
    text-align: right;
    padding-right: 4px;
    border-top: 1px solid var(--c-border);
}
.weekly-grid-col { background: var(--c-surface-2); border-radius: var(--r-sm); overflow: hidden; }
.weekly-grid-col-head {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 4px 0;
    border-bottom: 1px solid var(--c-border);
    background: var(--c-surface);
}
.weekly-grid-col-body {
    position: relative;
    height: var(--grid-height);
}
.weekly-grid-hour-line {
    height: var(--row-height);
    border-top: 1px dashed var(--c-border);
}
.weekly-grid-hour-line:first-child { border-top: 0; }
.weekly-grid-block {
    position: absolute;
    left: 4px; right: 4px;
    border-radius: 4px;
    color: #fff;
    padding: 2px 6px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(15,23,42,.15);
}
.weekly-grid-block-code { font-size: 10px; font-weight: 700; letter-spacing: .04em; }
[data-theme="dark"] .weekly-grid-col-head { background: var(--c-surface-2); }

/* ------------------------------------------------------------------ */
/*  Accreditation — curriculum map heat-grid                          */
/* ------------------------------------------------------------------ */
.curriculum-map { border-collapse: collapse; width: max-content; min-width: 100%; }
.curriculum-map th, .curriculum-map td { border: 1px solid var(--c-border); padding: 0; text-align: center; vertical-align: middle; }
.curriculum-map .cm-corner   { background: var(--c-surface-2); padding: 6px 10px; min-width: 220px; text-align: left; font-weight: 600; }
.curriculum-map .cm-courseh  { background: var(--c-surface-2); padding: 6px 4px; min-width: 50px; height: 110px; }
.curriculum-map .cm-courseh span { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12px; font-weight: 600; }
.curriculum-map .cm-plo      { text-align: left; padding: 8px 10px; min-width: 220px; background: var(--c-surface); }
.curriculum-map .cm-cell     { width: 64px; height: 44px; transition: background-color .12s ease; }
.curriculum-map .cm-cell-empty { background: var(--c-surface); }
.curriculum-map .cm-cell-I   { background: #dbeafe; }
.curriculum-map .cm-cell-R   { background: #fef3c7; }
.curriculum-map .cm-cell-M   { background: #dcfce7; }
.curriculum-map .cm-select   { background: transparent; border: 0; width: 100%; height: 100%; cursor: pointer; font-weight: 700; }
.curriculum-map .cm-cell-I .cm-select { color: #1e40af; }
.curriculum-map .cm-cell-R .cm-select { color: #92400e; }
.curriculum-map .cm-cell-M .cm-select { color: #166534; }
[data-theme="dark"] .curriculum-map .cm-cell-I { background: #1e3a8a; }
[data-theme="dark"] .curriculum-map .cm-cell-R { background: #78350f; }
[data-theme="dark"] .curriculum-map .cm-cell-M { background: #14532d; }
[data-theme="dark"] .curriculum-map .cm-cell-I .cm-select,
[data-theme="dark"] .curriculum-map .cm-cell-R .cm-select,
[data-theme="dark"] .curriculum-map .cm-cell-M .cm-select { color: #f8fafc; }

/* ------------------------------------------------------------------ */
/*  Priority inbox — "What needs your attention" on the dashboard     */
/* ------------------------------------------------------------------ */
.priority-inbox { padding: 18px 20px; }
.priority-inbox-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.priority-inbox-head h3 { margin: 0; }
.priority-inbox-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.priority-inbox-item { border-radius: 8px; transition: background-color .12s ease; }
.priority-inbox-item:hover { background: var(--c-surface-2); }
.priority-inbox-link { display: flex; align-items: center; gap: 12px; padding: 10px 12px; color: inherit; text-decoration: none; }
.priority-inbox-link:hover { text-decoration: none; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.priority-high   .priority-dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.18); }
.priority-medium .priority-dot { background: #d97706; box-shadow: 0 0 0 3px rgba(217,119,6,.18); }
.priority-low    .priority-dot { background: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.18); }
.priority-inbox-text { flex: 1; min-width: 0; font-size: 14px; }
.priority-inbox-text strong { color: var(--c-text); }
.priority-inbox-group { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0; }
.priority-inbox-arrow { color: var(--c-muted); flex-shrink: 0; transition: transform .12s ease, color .12s ease; }
.priority-inbox-item:hover .priority-inbox-arrow { color: var(--c-primary); transform: translateX(3px); }
[data-theme="dark"] .priority-inbox-item:hover { background: var(--c-surface-2); }
.brand-logo { width: 32px; height: 32px; border-radius: 8px; object-fit: contain; background: #fff; padding: 2px; }

/* ------------------------------------------------------------------ */
/*  Navigation aids — breadcrumbs, workflow stepper, glossary tooltip */
/* ------------------------------------------------------------------ */
.breadcrumbs { margin: 0 0 14px; font-size: 12px; color: var(--c-muted); }
.breadcrumbs ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.breadcrumbs li { display: inline-flex; align-items: center; }
.breadcrumbs li + li::before { content: "›"; margin-right: 10px; color: var(--c-border); }
.breadcrumbs a { color: var(--c-muted); }
.breadcrumbs a:hover { color: var(--c-primary); text-decoration: none; }
.breadcrumbs li[aria-current="page"] { color: var(--c-text); font-weight: 600; }

/* Workflow stepper used in the accreditation flow */
.workflow-stepper { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; align-items: stretch; gap: 0; }
.workflow-stepper .ws-step { display: flex; align-items: center; flex: 1 1 auto; min-width: 120px; }
.workflow-stepper .ws-step + .ws-step::before { content: ""; height: 2px; width: 16px; background: var(--c-border); align-self: center; }
.workflow-stepper .ws-step a, .workflow-stepper .ws-step > span { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; text-decoration: none; color: var(--c-muted); border: 1px solid var(--c-border); background: var(--c-surface); font-size: 13px; }
.workflow-stepper .ws-step a:hover { border-color: var(--c-primary); color: var(--c-primary); text-decoration: none; }
.workflow-stepper .ws-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--c-surface-2); color: var(--c-muted); font-size: 12px; font-weight: 700; }
.workflow-stepper .ws-current > span,
.workflow-stepper .ws-current { font-weight: 600; }
.workflow-stepper .ws-current > span { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.workflow-stepper .ws-current .ws-num { background: rgba(255,255,255,.25); color: #fff; }
.workflow-stepper .ws-done a, .workflow-stepper .ws-done > span { color: var(--c-success); border-color: rgba(22,163,74,.4); }
.workflow-stepper .ws-done .ws-num { background: rgba(22,163,74,.18); color: var(--c-success); }

/* Glossary inline tooltip — keyboard- and touch-friendly */
.glossary-term { position: relative; border-bottom: 1px dotted var(--c-muted); cursor: help; }
.glossary-term:focus { outline: 2px solid var(--c-primary); outline-offset: 2px; }
.glossary-popup { position: absolute; bottom: calc(100% + 6px); left: 0; min-width: 240px; max-width: 360px; background: #0f172a; color: #f1f5f9; padding: 8px 10px; border-radius: 6px; font-size: 12px; line-height: 1.4; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .12s ease; z-index: 30; }
.glossary-term:hover .glossary-popup,
.glossary-term:focus .glossary-popup,
.glossary-term:focus-within .glossary-popup { opacity: 1; }
.glossary-popup strong { color: #93c5fd; }

/* ------------------------------------------------------------------ */
/*  Sidebar — collapsible nav groups                                  */
/* ------------------------------------------------------------------ */
.nav-group { margin-top: 4px; }
.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 12px 10px 4px; user-select: none; color: #64748b; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::before { content: "▸"; font-size: 9px; transition: transform .12s ease; color: #475569; }
.nav-group[open] > summary::before { transform: rotate(90deg); }
.nav-group > summary:hover { color: #cbd5e1; }
.nav-group-body { display: flex; flex-direction: column; gap: 2px; padding-left: 0; }

/* ------------------------------------------------------------------ */
/*  Curriculum map — mobile friendliness (sticky first column)        */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
    .curriculum-map .cm-corner,
    .curriculum-map .cm-plo {
        position: sticky;
        left: 0;
        z-index: 2;
        background: var(--c-surface);
        min-width: 150px;
        box-shadow: 1px 0 0 var(--c-border);
    }
    .curriculum-map .cm-corner { background: var(--c-surface-2); }
    .curriculum-map .cm-cell { width: 48px; height: 40px; }
    .curriculum-map .cm-courseh { height: 90px; min-width: 40px; }
    .curriculum-map .cm-courseh span { font-size: 11px; }
}
[data-theme="dark"] .curriculum-map .cm-plo { background: var(--c-surface); }

/* ------------------------------------------------------------------ */
/*  Responsive tables — let cards scroll on phones                    */
/* ------------------------------------------------------------------ */
.card .table { min-width: 100%; }
@media (max-width: 768px) {
    /* Any card whose direct child is a wide table becomes horizontally
       scrollable below the standard tablet breakpoint. Keeps the rest of
       the card's content (h3, intro p) full-width. */
    .card > .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card > .table > thead,
    .card > .table > tbody { display: table; width: 100%; min-width: 540px; }
    /* Forms that use grid-template-columns:repeat(3,1fr) inline collapse
       to a single column below 768. */
    form[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

/* ------------------------------------------------------------------ */
/*  Toast — flash success / error messages after a redirect           */
/* ------------------------------------------------------------------ */
.da-toast { position: fixed; bottom: 24px; right: 24px; max-width: 420px; display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 8px; background: #0f172a; color: #f1f5f9; box-shadow: 0 12px 32px rgba(0,0,0,.25);
    z-index: 1000; transform: translateY(0); animation: da-toast-in .18s ease; }
.da-toast-notice { border-left: 4px solid #16a34a; }
.da-toast-error  { border-left: 4px solid #dc2626; }
.da-toast-icon   { font-size: 18px; }
.da-toast-notice .da-toast-icon { color: #4ade80; }
.da-toast-error  .da-toast-icon { color: #f87171; }
.da-toast-body   { flex: 1; font-size: 13px; line-height: 1.4; }
.da-toast-close  { background: transparent; border: 0; color: #94a3b8; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 8px; min-height: 0; }
.da-toast-close:hover { color: #fff; }
.da-toast.da-toast-leaving { transform: translateY(40px); opacity: 0; transition: transform .18s ease, opacity .18s ease; }
@keyframes da-toast-in { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Inline-progress button state for #4 (loading on long ops) */
.btn[aria-busy="true"] { pointer-events: none; opacity: 0.75; position: relative; }
.btn[aria-busy="true"]::after {
    content: ""; width: 12px; height: 12px; border-radius: 50%; margin-left: 8px;
    border: 2px solid currentColor; border-right-color: transparent; animation: da-spin .7s linear infinite;
}
@keyframes da-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ */
/*  Modal (used by global confirm dialog)                             */
/* ------------------------------------------------------------------ */
.da-modal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(15,23,42,.55); z-index: 2000; padding: 16px; }
.da-modal[hidden] { display: none; }
.da-modal-panel { background: var(--c-surface); color: var(--c-text); border-radius: 12px; box-shadow: 0 24px 64px rgba(0,0,0,.35); padding: 22px 24px; max-width: 440px; width: 100%; }
.da-modal-title { margin: 0 0 8px; font-size: 18px; }
.da-modal-body { margin: 0 0 18px; color: var(--c-muted); font-size: 14px; line-height: 1.5; }
.da-modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* Visible focus-ring on every interactive control (a11y). Uses :focus-visible
   so mouse clicks don't show the ring; keyboard / programmatic focus do. */
.btn:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
.glossary-term:focus-visible {
    outline: 2px solid var(--c-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ------------------------------------------------------------------ */
/*  Form grid utilities — replaces ad-hoc inline styles on <form>     */
/* ------------------------------------------------------------------ */
.form-grid       { display: grid; gap: 10px; }
.form-grid-2col  { grid-template-columns: 1fr 2fr; }
.form-grid-3col  { grid-template-columns: repeat(3, 1fr); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 768px) {
    .form-grid-2col, .form-grid-3col { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/*  Inline editor inside a list item — used on plan show page         */
/*  (edit group, edit track) and anywhere we want a compact form      */
/*  that auto-collapses on narrow screens.                            */
/* ------------------------------------------------------------------ */
.plan-editor {
    margin: 8px 0 4px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    align-items: end;
}
.plan-editor label { display: block; font-size: 12px; color: var(--c-muted); }
.plan-editor label > input,
.plan-editor label > select,
.plan-editor label > textarea {
    width: 100%;
    box-sizing: border-box;
    font: inherit;
}
.plan-editor .full { grid-column: 1 / -1; }
.plan-editor .section-divider {
    grid-column: 1 / -1;
    border-top: 1px dashed #cbd5e1;
    padding-top: 8px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.plan-editor .check-row {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    align-items: flex-start;
    font-size: 12px;
    line-height: 1.4;
    color: var(--c-text);
}
.plan-editor .check-row input { width: auto; margin-top: 2px; }
.plan-editor .actions {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
@media (max-width: 540px) {
    .plan-editor {
        grid-template-columns: 1fr;
        padding: 10px;
    }
    .plan-editor .actions .btn { flex: 1 1 auto; }
}
/* The summary button that toggles a .plan-editor open should feel
   like the rest of the action row, not the tiny default <summary>. */
details > summary.btn { list-style: none; cursor: pointer; }
details > summary.btn::-webkit-details-marker { display: none; }
details[open] > summary.btn::after { content: " ▴"; opacity: 0.6; }
details:not([open]) > summary.btn::after { content: " ▾"; opacity: 0.6; }

/* ------------------------------------------------------------------ */
/*  Empty-state — consistent "nothing here yet" block with CTA        */
/* ------------------------------------------------------------------ */
.empty-state { padding: 28px 20px; text-align: center; color: var(--c-muted); }
.empty-state-icon { font-size: 28px; opacity: 0.55; margin-bottom: 6px; display: block; }
.empty-state-title { margin: 0 0 4px; color: var(--c-text); font-size: 15px; font-weight: 600; }
.empty-state-body { margin: 0 auto 12px; max-width: 36em; font-size: 13px; line-height: 1.5; }
.empty-state .btn { font-size: 13px; }

/* Required-field marker — every <label> that contains a required form
   control gets a red asterisk prefix. Uses :has() (Chrome 105+, Firefox 121+,
   Safari 15.4+); on older browsers labels appear unmarked but submission
   still blocks via the native required validation. */
label:has(input:required, select:required, textarea:required)::before {
    content: '* ';
    color: #dc2626;
    font-weight: 700;
}

/* Chart tooltip — wired in app.js, triggered by any [data-tip] element */
.chart-tooltip {
    position: fixed; pointer-events: none; z-index: 9999;
    background: #0f172a; color: #f8fafc;
    padding: 6px 10px; border-radius: 6px;
    font-size: 12px; line-height: 1.4;
    box-shadow: 0 4px 12px rgba(15,23,42,.35);
    max-width: 280px; white-space: pre-wrap;
    transition: opacity .08s ease;
}
[data-tip] { cursor: default; }
svg [data-tip] { cursor: pointer; }

/* ------------------------------------------------------------------ */
/*  Plan-editor: drag-and-drop group reordering                       */
/* ------------------------------------------------------------------ */
ul[data-groups-reorder] { list-style: none; padding-left: 0; }
ul[data-groups-reorder] > li[data-group-id] {
    position: relative;
    padding: 10px 12px 10px 36px;
    margin: 6px 0;
    background: var(--c-surface, #fff);
    border: 1px solid var(--c-border, #e2e8f0);
    border-radius: 8px;
    cursor: grab;
    transition: box-shadow .12s, transform .12s;
}
ul[data-groups-reorder] > li[data-group-id]:hover { box-shadow: 0 1px 2px rgba(15,23,42,.06); }
ul[data-groups-reorder] > li[data-group-id]::before {
    content: "⋮⋮";
    position: absolute;
    left: 12px;
    top: 12px;
    color: var(--c-muted, #94a3b8);
    font-weight: 700;
    letter-spacing: -1px;
    font-size: 14px;
    line-height: 1;
}
ul[data-groups-reorder] > li[data-group-id].drag-source {
    opacity: 0.4;
    cursor: grabbing;
}
ul[data-groups-reorder] > li[data-group-id].drag-over {
    border-color: var(--c-primary, #1f4ed8);
    box-shadow: 0 0 0 2px rgba(31,78,216,.18);
}
.reorder-status {
    display: inline-block;
    margin: 0 0 8px;
    padding: 3px 10px;
    font-size: 12px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569;
}
.reorder-status.is-busy { background: #dbeafe; color: #1e40af; }
.reorder-status.is-ok   { background: #dcfce7; color: #166534; }
.reorder-status.is-err  { background: #fee2e2; color: #991b1b; }

/* ------------------------------------------------------------------ */
/*  Long-table polish: sticky headers + client-side filter row        */
/* ------------------------------------------------------------------ */
.table-wrap { max-height: 70vh; overflow-y: auto; border: 1px solid var(--c-border, #e2e8f0); border-radius: 8px; }
.table-wrap > .table { border: 0; }
.table-wrap > .table thead th {
    position: sticky;
    top: 0;
    background: var(--c-surface, #fff);
    z-index: 2;
    box-shadow: 0 1px 0 var(--c-border, #e2e8f0);
}
.table-quickfilter {
    display: flex; gap: 10px; align-items: center;
    margin: 0 0 10px; padding: 6px 10px;
    background: var(--c-surface, #fff);
    border: 1px solid var(--c-border, #e2e8f0);
    border-radius: 8px;
}
.table-quickfilter input {
    flex: 1; border: 0; outline: 0; padding: 6px 4px; font-size: 14px; background: transparent;
}
.table-quickfilter .count { font-size: 12px; color: var(--c-muted, #64748b); white-space: nowrap; }
.table-quickfilter .clear {
    border: 0; background: transparent; cursor: pointer; color: var(--c-muted, #64748b);
    font-size: 16px; padding: 2px 6px;
}
.table-quickfilter .clear:hover { color: var(--c-text, #0f172a); }
tr.is-filtered-out { display: none; }

/* ------------------------------------------------------------------ */
/*  Accessibility: skip-to-main link (visible only on focus)          */
/* ------------------------------------------------------------------ */
.skip-link {
    position: absolute;
    top: -40px;
    left: 12px;
    background: var(--c-primary, #1f4ed8);
    color: #fff;
    padding: 8px 14px;
    border-radius: 0 0 8px 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    z-index: 9999;
    transition: top .15s;
}
.skip-link:focus { top: 0; outline: 3px solid #fde68a; outline-offset: -3px; }

/* ------------------------------------------------------------------ */
/*  Sortable table-header indicators                                  */
/* ------------------------------------------------------------------ */
.th-sortable { cursor: pointer; user-select: none; position: relative; }
.th-sortable:hover { color: var(--c-text, #0f172a); }
.th-sort-indicator {
    display: inline-block;
    width: 0; height: 0;
    margin-left: 6px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    opacity: .35;
    border-top: 5px solid currentColor;
    vertical-align: middle;
}
.th-sortable.is-sort-asc .th-sort-indicator {
    border-top: 0;
    border-bottom: 5px solid currentColor;
    opacity: 1;
}
.th-sortable.is-sort-desc .th-sort-indicator {
    opacity: 1;
}
.th-sortable:focus-visible { outline: 2px solid var(--c-primary, #1f4ed8); outline-offset: -2px; }

/* ------------------------------------------------------------------ */
/*  Inline-editable capacity cell (admin/offerings index)             */
/* ------------------------------------------------------------------ */
/* Offering delivery-mode badges                                       */
/* ------------------------------------------------------------------ */
.mode-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: 1.5;
    white-space: nowrap;
    border: 1px solid transparent;
}
.mode-badge.mode-in-person { background: #eef2ff; color: #3730a3; border-color: #c7d2fe; }
.mode-badge.mode-online    { background: #ecfeff; color: #155e75; border-color: #a5f3fc; }
.mode-badge.mode-hybrid    { background: #fef3c7; color: #92400e; border-color: #fde68a; }

/* ------------------------------------------------------------------ */
.capacity-cell { white-space: nowrap; }
.capacity-cell .capacity-enrolled { font-variant-numeric: tabular-nums; }
.capacity-cell .capacity-sep { margin: 0 4px; color: var(--c-muted, #94a3b8); }
.capacity-cell .capacity-input {
    width: 64px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    font: inherit;
    font-variant-numeric: tabular-nums;
    text-align: right;
    transition: border-color .12s, background .12s;
}
.capacity-cell:hover .capacity-input,
.capacity-cell .capacity-input:focus {
    border-color: var(--c-border, #cbd5e1);
    background: var(--c-surface, #fff);
    outline: none;
}
.capacity-cell .capacity-input:focus { border-color: var(--c-primary, #1f4ed8); }
.capacity-cell .capacity-input:disabled { opacity: 0.6; }
.capacity-status {
    display: inline-block;
    margin-left: 6px;
    font-size: 11px;
    color: var(--c-muted, #64748b);
    min-width: 0;
}
.capacity-status.is-busy { color: #1e40af; }
.capacity-status.is-ok   { color: #166534; }
.capacity-status.is-err  { color: #991b1b; }
