/* ==========================================================
   ALICE Design System — alice.css
   Decision 011: No CSS framework. Single handwritten file.
   Decision 010: Okabe-Ito aligned palette. Triple-signal status.
   ========================================================== */

/* 1. CSS Reset */
*, *::before, *::after {
    box-sizing: border-box;
}

/* 2. CSS Custom Properties */
:root {
    --alice-blue: #185FA5;
    --alice-amber: #EF9F27;
    --alice-teal: #1D9E75;
    --alice-warning: #BA7517;
    --alice-gray: #888780;
    --alice-surface: #FFFFFF;
    --alice-bg: #F5F5F2;
    --alice-text: #1A1A1A;
    --alice-text-secondary: #555550;
    --alice-text-tertiary: #888880;
    --alice-border: #E0DFD8;
    --alice-border-strong: #C0BFB8;
    --alice-focus: #185FA5;

    /* Tints for status badges */
    --alice-teal-tint: #E6F5EF;
    --alice-amber-tint: #FFF5E0;
    --alice-gray-tint: #F0EFEC;
    --alice-blue-tint: #E8F0FA;

    --alice-border-secondary: #D0CFc8;
    --alice-border-tertiary: #E8E7E0;

    /* Radii */
    --radius-md: 6px;
    --radius-lg: 10px;

    /* Map path / inactive elements */
    --alice-map-path:  #888880;
    --alice-map-muted: #C0BFB8;

    /* Hyperlink color */
    --link-color: #7ab8f5;   /* light blue, readable on navy, WCAG AA */

    /* Font stacks */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ── STANDARD (default) ─── already in :root ─────────── */
/* --alice-blue:    #185FA5  */
/* --alice-amber:   #EF9F27  */
/* --alice-teal:    #1D9E75  */
/* --alice-warning: #BA7517  */
/* --alice-gray:    #888780  */

/* ── DARK MODE ───────────────────────────────────── */
/* html.th-X selectors mirror body.th-X for the FOUC-prevention
   inline script in base.html, which sets the class on
   <html> before <body> is parsed. CSS variables cascade from
   the root, so all `body.th-X .child` compound rules elsewhere
   keep working unchanged. */
html.th-dark,
body.th-dark {
  --alice-blue:         #85B7EB;
  --alice-amber:        #EF9F27;
  --alice-teal:         #5DCAA5;
  --alice-warning:      #FAC775;
  --alice-gray:         #B4B2A9;
  --alice-surface:      #1E1E1E;
  --alice-bg:           #121212;
  --alice-text:         #E8E6E0;
  --alice-text-secondary:#A8A6A0;
  --alice-text-tertiary: #888880;
  --alice-border:       #3A3A38;
  --alice-border-strong:#555550;
  --alice-teal-tint:    #1A2E26;
  --alice-amber-tint:   #2E2618;
  --alice-gray-tint:    #2A2A28;
  --alice-blue-tint:    #1A2436;
  --alice-map-path:     #888880;
  --alice-map-muted:    #555550;
  --link-color:         #85B7EB;
}

/* ── LIGHT MODE ──────────────────────────────────── */
html.th-light,
body.th-light {
  --alice-blue:          #185FA5;
  --alice-amber:         #EF9F27;
  --alice-teal:          #1D9E75;
  --alice-surface:       #FFFFFF;
  --alice-bg:            #F5F5F2;
  --alice-text:          #1A1A1A;
  --alice-text-secondary:#555550;
  --alice-border:        #E0DFD8;
  --alice-border-strong: #C0BFB8;
  --alice-teal-tint:     #E6F5EF;
  --alice-amber-tint:    #FFF5E0;
  --alice-gray-tint:     #F0EFEC;
  --alice-blue-tint:     #E8F0FA;
  --alice-map-path:      #444440;
  --alice-map-muted:     #C0BFB8;
  --link-color:          #185FA5;
}

/* ── HIGH CONTRAST (theme) ──────────────────────────── */
html.th-hico,
body.th-hico {
  --alice-blue:          #0000EE;
  --alice-amber:         #FFDD00;
  --alice-teal:          #006600;
  --alice-warning:       #CC4400;
  --alice-gray:          #555555;
  --alice-surface:       #FFFFFF;
  --alice-bg:            #F0F0F0;
  --alice-text:          #000000;
  --alice-text-secondary:#111111;
  --alice-text-tertiary: #333333;
  --alice-border:        #000000;
  --alice-border-strong: #000000;
  --alice-border-secondary: #000000;
  --alice-border-tertiary:  #444444;
  --alice-map-path:      #000000;
  --alice-map-muted:     #888888;
  --alice-focus:         #0000EE;
  --link-color:          #0000EE;
  /* Light tints — explicit so they do NOT leak from the
     prefers-color-scheme: dark @media block, which would otherwise
     override them with very dark values (#1A2436 etc.) leaving
     black text unreadable on hover/active states. */
  --alice-blue-tint:     #DDEEFF;
  --alice-teal-tint:     #DDFFDD;
  --alice-amber-tint:    #FFF7CC;
  --alice-gray-tint:     #EEEEEE;
}

/* High contrast: heavier borders everywhere */
body.th-hico .card,
body.th-hico .nav,
body.th-hico .form-input,
body.th-hico .status-badge {
  border-width: 2px;
  border-color: var(--alice-border);
}

/* ── DEUTERANOPIA (accessibility overlay) ───────────── */
html.th-deut,
body.th-deut {
  --alice-blue:    #0072B2;   /* sky blue — unambiguous   */
  --alice-amber:   #F0E442;   /* yellow — distinct from blue */
  --alice-teal:    #009E73;   /* bluish green              */
  --alice-warning: #E69F00;   /* orange-gold               */
  --alice-focus:   #0072B2;
  --link-color:    #56B4E9;
}

/* ── PROTANOPIA (accessibility overlay) ─────────────── */
html.th-prot,
body.th-prot {
  --alice-blue:    #0072B2;
  --alice-amber:   #F0E442;
  --alice-teal:    #009E73;
  --alice-warning: #E69F00;
  --alice-focus:   #0072B2;
  --link-color:    #56B4E9;
}

/* ── TRITANOPIA (accessibility overlay) ─────────────── */
html.th-trit,
body.th-trit {
  --alice-blue:    #D55E00;   /* vermilion — distinct for trit */
  --alice-amber:   #CC79A7;   /* reddish purple                */
  --alice-teal:    #009E73;   /* green — unaffected            */
  --alice-warning: #D55E00;
  --alice-focus:   #009E73;
  --link-color:    #CC79A7;
}

/* ── HYPERLINK COLORS ───────────────────────────────── */
a {
  color: var(--link-color, #7ab8f5);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

/*
 * WCAG AA contrast verification (4.5:1 body text, 3:1 large/UI):
 *
 * Standard:      #1A1A1A on #F5F5F2 = 14.5:1 ✓   Nav: #555550 on #FFFFFF = 7.2:1 ✓
 *                Btn: #FFFFFF on #185FA5 = 5.7:1 ✓  Error: #C13030 on #FFF0F0 = 5.1:1 ✓
 * Deuteranopia:  #1A1A1A on #F5F5F2 = 14.5:1 ✓   Btn: #FFFFFF on #0072B2 = 4.9:1 ✓
 * Protanopia:    #1A1A1A on #F5F5F2 = 14.5:1 ✓   Btn: #FFFFFF on #0072B2 = 4.9:1 ✓
 * Tritanopia:    #1A1A1A on #F5F5F2 = 14.5:1 ✓   Btn: #FFFFFF on #D55E00 = 4.6:1 ✓
 * High Contrast: #000000 on #F0F0F0 = 18.1:1 ✓   Btn: #FFFFFF on #0000EE = 8.6:1 ✓
 *                Focus: #0000EE outline = 8.6:1 ✓
 *
 * Badge text on badge tint backgrounds all exceed 4.5:1 in all themes.
 */

/* 3. Dark mode overrides — applied only when the user has not
   chosen an explicit theme. The :not() guard prevents OS=dark
   from briefly flashing dark colors on a user who has stored
   "th-light" in localStorage (the FOUC-prevention head script
   in base.html sets the class on <html> before first paint). */
@media (prefers-color-scheme: dark) {
    html:not(.th-dark):not(.th-light):not(.th-hico):not(.th-deut):not(.th-prot):not(.th-trit) {
        --alice-blue: #85B7EB;
        --alice-amber: #EF9F27;
        --alice-teal: #5DCAA5;
        --alice-warning: #FAC775;
        --alice-gray: #B4B2A9;
        --alice-surface: #1E1E1E;
        --alice-bg: #121212;
        --alice-text: #E8E6E0;
        --alice-text-secondary: #A8A6A0;
        --alice-text-tertiary: #888880;
        --alice-border: #3A3A38;
        --alice-border-strong: #555550;

        --alice-teal-tint: #1A2E26;
        --alice-amber-tint: #2E2618;
        --alice-gray-tint: #2A2A28;
        --alice-blue-tint: #1A2436;
    }
}

/* 4. Typography */
body {
    font-family: var(--font-sans);
    background-color: var(--alice-bg);
    color: var(--alice-text);
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

h1, h2, h3 {
    color: var(--alice-text);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

.wordmark,
.nav__wordmark,
.login-wordmark {
    font-family: Georgia, "Times New Roman", serif;
    font-weight: normal;
    font-style: normal;
    color: var(--alice-text);
    letter-spacing: 0.05em;
}

/* 5. Layout utilities */
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

/* 6. Navigation */
.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background-color: var(--alice-surface);
    border-bottom: 1px solid var(--alice-border);
}

.nav__wordmark {
    font-size: 1.5rem;
}

.nav__links {
    display: flex;
    gap: 1.5rem;
}

.nav__link {
    text-decoration: none;
    color: var(--alice-text-secondary);
    font-size: 0.9rem;
    padding: 0.25rem 0;
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.nav__link:hover {
    color: var(--alice-text);
}

.nav__link--active {
    color: var(--alice-text);
    border-bottom: 2px solid var(--alice-amber);
    font-weight: 600;
}

.nav__user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.nav__user-name {
    color: var(--alice-text-secondary);
}

.nav__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: var(--alice-blue);
    color: var(--alice-surface);
    font-size: 0.75rem;
    font-weight: 600;
}

/* 7. Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--alice-text);
}

.form-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    background-color: var(--alice-surface);
    color: var(--alice-text);
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--alice-blue);
    box-shadow: 0 0 0 2px var(--alice-blue-tint);
}

.form-error {
    color: #C13030;
    background-color: #FFF0F0;
    border: 1px solid #C13030;
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

@media (prefers-color-scheme: dark) {
    html:not(.th-dark):not(.th-light):not(.th-hico):not(.th-deut):not(.th-prot):not(.th-trit) .form-error {
        color: #FF8A8A;
        background-color: #2E1A1A;
        border-color: #FF8A8A;
    }
}

.btn-primary {
    display: inline-block;
    width: auto;
    max-width: var(--btn-max-width, 300px);
    padding: 0.65rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--alice-surface);
    background-color: var(--alice-blue);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-secondary {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    color: var(--alice-text-secondary);
    background-color: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
}

.btn-secondary:hover {
    border-color: var(--alice-blue);
    color: var(--alice-blue);
}

/* 8. Cards */
.card {
    background-color: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: 8px;
    padding: 1.25rem;
}

.card__tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--alice-blue);
    background-color: var(--alice-blue-tint);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    margin-bottom: 0.5rem;
}

.card__title {
    margin: 0.5rem 0 0.35rem;
    font-size: 1.05rem;
}

.card__meta {
    font-size: 0.85rem;
    color: var(--alice-text-secondary);
    margin: 0 0 0.75rem;
}

.card__actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.card__actions .btn-primary {
    width: auto;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
}

/* ── Hub cards ─────────────────────────────────────
   Tighter sibling of .card for *section landings* one
   level below the main /admin grid. The size delta is
   intentional: it teaches "depth = density" so users
   feel they have descended into a subsystem (e.g.
   /admin/max, /admin/system) without reading the URL.
   Use .hub-grid as the container and .hub-card for
   each routing tile; .hub-card__summary and
   .hub-card__cta style the body and the trailing
   "Manage →" / "Edit →" link. */
.hub-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    max-width: 1100px;
}

.hub-card {
    display: block;
    border: 1px solid var(--alice-border);
    border-radius: 8px;
    padding: 18px 20px;
    background: var(--alice-surface);
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.hub-card:hover {
    border-color: var(--alice-teal);
    transform: translateY(-1px);
    text-decoration: none;
}

.hub-card h2 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.hub-card__summary {
    margin: 0 0 12px;
    color: var(--alice-text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.hub-card__cta {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--alice-teal);
}

/* Warning-tinted hub card — color-only modifier, mirrors
   .card--warn for the destructive/special action on a sub-hub
   (e.g. Calculus on /admin/opus/{id}). */
.hub-card--warn {
    border-color: var(--alice-warning);
    background: var(--alice-amber-tint);
}
.hub-card--warn:hover {
    border-color: var(--alice-warning);
    filter: brightness(0.97);
}

/* 9. Progress bar */
.progress-track {
    height: 6px;
    background-color: var(--alice-gray-tint);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background-color: var(--alice-teal);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-label {
    font-size: 0.8rem;
    color: var(--alice-text-secondary);
    margin-top: 0.25rem;
    display: inline-block;
}

/* 10. Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-complete {
    background-color: var(--alice-teal-tint);
    color: var(--alice-teal);
}

.status-complete .status-dot {
    background-color: var(--alice-teal);
}

.status-next {
    background-color: var(--alice-amber-tint);
    color: var(--alice-warning);
}

.status-next .status-dot {
    background-color: var(--alice-amber);
}

/* Syllabus "Read" status dropdown — styled to look like the
   status-badge pill at rest, with a dropdown on click. */
select.syllabus-status-select {
    appearance: none;
    -webkit-appearance: none;
    background-color: var(--alice-amber-tint);
    color: var(--alice-warning);
    border: none;
    border-radius: 12px;
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23BA7517'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 20px;
}
select.syllabus-status-select:focus {
    outline: 2px solid var(--alice-focus);
    outline-offset: 1px;
}

.status-skipped {
    background-color: var(--alice-gray-tint);
    color: var(--alice-gray);
}

.status-skipped .status-dot {
    background-color: var(--alice-gray);
}

.status-inprogress {
    background-color: var(--alice-blue-tint);
    color: var(--alice-blue);
}

.status-inprogress .status-dot {
    background-color: var(--alice-blue);
}

/* 11. Activity table */
.activity-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.75rem;
}

.activity-table th,
.activity-table td {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--alice-border);
    font-size: 0.9rem;
}

.activity-table th {
    font-weight: 600;
    color: var(--alice-text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.activity-table tbody tr:hover {
    background-color: var(--alice-blue-tint);
}

/* 12. Login page */
.login-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: var(--alice-bg);
}

.login-card {
    background-color: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: 10px;
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 340px;
    text-align: center;
}

.login-wordmark {
    font-size: 2rem;
    margin-bottom: 0.2rem;
}

.login-tagline {
    font-size: 0.8rem;
    color: var(--alice-text-secondary);
    font-style: italic;
    margin: 0 0 0.75rem;
}

.login-divider {
    height: 2px;
    background-color: var(--alice-amber);
    margin: 0 auto 1rem;
    width: 40%;
    border-radius: 1px;
}

.login-card .form-group {
    text-align: left;
}

.login-card .btn-primary {
    width: 100%;
    max-width: none;
    margin-top: 0.5rem;
}

/* 13. Language selector */
.lang-toggle {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
}

.lang-btn {
    background: none;
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: var(--alice-text-secondary);
    cursor: pointer;
    font-family: inherit;
}

.lang-btn:hover,
.lang-btn.active,
.lang-btn.lang-btn--active {
    border-color: var(--alice-blue);
    color: var(--alice-blue);
}

/* Accessibility notice */
.a11y-notice {
    margin-top: 2rem;
    font-size: 0.78rem;
    color: var(--alice-text-secondary);
    text-align: center;
    font-style: italic;
}

.subtitle {
    color: var(--alice-text-secondary);
    margin-top: -0.5rem;
}

/* ── Accessibility: Skip link ─────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--alice-blue);
  color: #fff;
  font-size: 14px;
  border-radius: 0 0 4px 4px;
  text-decoration: none;
  transition: top 0.1s;
}
.skip-link:focus {
  top: 0;
}

/* ── Accessibility: Focus indicators ──────────────── */
/* Visible focus indicator — applies to all interactive elements */
:focus-visible {
  outline: 3px solid var(--alice-focus, var(--alice-blue));
  outline-offset: 2px;
}

/* Never suppress focus outlines */
:focus:not(:focus-visible) {
  outline: none;
}

/* Screen-reader-only utility class */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Gear button ───────────────────────────────── */
.nav__gear {
  background: none;
  border: 0.5px solid var(--alice-border);
  border-radius: var(--radius-md);
  color: var(--alice-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  transition: color 0.15s, border-color 0.15s;
}
.nav__gear:hover {
  color: var(--alice-text);
  border-color: var(--alice-border-strong);
}
.nav__gear:focus-visible {
  outline: 3px solid var(--alice-focus, var(--alice-blue));
  outline-offset: 2px;
}

/* ── Theme panel ───────────────────────────────── */
.theme-panel {
  position: fixed;
  top: 60px;
  right: 1rem;
  z-index: 500;
  width: 220px;
  background: var(--alice-surface);
  border: 0.5px solid var(--alice-border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 1rem;
}
.theme-panel--hidden {
  display: none;
}
.theme-panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.theme-panel__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--alice-text-secondary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.theme-panel__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--alice-text-tertiary);
  font-size: 14px;
  padding: 2px 4px;
  line-height: 1;
}
.theme-panel__options {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.theme-option {
  width: 100%;
  padding: 7px 10px;
  text-align: left;
  font-size: 13px;
  font-family: var(--font-sans);
  color: var(--alice-text);
  background: none;
  border: 0.5px solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.1s;
}
.theme-option:hover {
  background: var(--alice-bg);
}
.theme-option--active {
  background: var(--alice-bg);
  border-color: var(--alice-blue);
  color: var(--alice-blue);
  font-weight: 500;
}
.theme-option:focus-visible {
  outline: 3px solid var(--alice-focus, var(--alice-blue));
  outline-offset: 2px;
}
.theme-panel__note {
  margin-top: 0.75rem;
  font-size: 11px;
  color: var(--alice-text-tertiary);
  text-align: center;
}

/* ── Site shell and top nav ─────────────────────────── */
.site-shell {
  width: 100%;
  background: var(--alice-surface);
  border-bottom: 1px solid var(--alice-border);
}

/* (topnav rules moved to SPECS12 block below) */

.nav-logo {
  display: flex; align-items: center;
  flex-shrink: 0; margin-right: 24px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px; font-weight: 700;
  color: var(--alice-text); text-decoration: none; letter-spacing: .02em;
}

.nav-links {
  flex: 1;
  display: flex; align-items: stretch; justify-content: center;
  gap: 2px;
}
.nav-link {
  display: flex; align-items: center;
  font-size: 11px; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--alice-text-secondary); text-decoration: none;
  padding: 0 12px;
  border-bottom: 2px solid transparent;
  transition: color .18s, border-color .18s;
  cursor: pointer; background: none; border-top: none;
  border-left: none; border-right: none;
}
.nav-link:hover, .nav-link.active {
  color: var(--alice-text); border-bottom-color: var(--alice-amber);
}

.nav-user {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; margin-left: 24px;
  font-size: 12px; color: var(--alice-text-secondary);
}
.nav-role-badge {
  font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--alice-blue);
  background: var(--alice-blue-tint);
  border: 1px solid var(--alice-blue);
  border-radius: 10px; padding: 2px 8px;
}
body.th-dark .nav-role-badge {
  background: #CCCCCC;
  /* On the light-grey badge background the dark theme's pale
     --alice-blue (#85B7EB) is illegible. Force the original deep
     blue for both text and border so the badge stays readable. */
  color: #0F3D6B;
  border-color: #0F3D6B;
}

/* ── SPECS27: Impersonation banner + UI ─────────────── */
.impersonation-banner {
    background: #ffe082;
    color: #5d4037;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 2px solid #ffb300;
    font-size: 13px;
    /* Locked at the top so the warning never scrolls out of view.
       Sits just below the topnav when the topnav itself is locked. */
    position: sticky;
    top: 0;
    z-index: 499;
    box-shadow: 0 1px 8px rgba(0,0,0,0.08);
}
body.nav-locked .impersonation-banner {
    top: 44px;
}
body.th-dark .impersonation-banner {
    background: #ff9800;
    color: #1a1a1a;
}
body.th-hico .impersonation-banner {
    background: #ff00ff;
    color: #ffffff;
}
.impersonation-banner__form {
    margin: 0;
    flex-shrink: 0;
}

/* Brighter top menu while impersonating, per theme */
body.impersonating .topnav {
    background: #fff8e1;
    border-bottom: 2px solid #ffb300;
}
body.th-dark.impersonating .topnav {
    background: #4a3010;
}
body.th-hico.impersonating .topnav {
    background: #1a001a;
}

/* Impersonation start icon and popup */
.nav-imp-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.nav-imp-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    color: var(--alice-blue);
    display: inline-flex;
    align-items: center;
}
.nav-imp-toggle:hover { color: var(--alice-text); }
.nav-imp-popup {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 1000;
    min-width: 320px;
    max-width: 420px;
    background: var(--alice-bg);
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 8px;
}
.nav-imp-popup.hidden { display: none; }
.nav-imp-popup input[type="text"] {
    width: 100%;
    padding: 6px 8px;
    margin-bottom: 6px;
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    box-sizing: border-box;
}
.nav-imp-result-form {
    margin: 0;
}
.nav-imp-result {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 12px;
    border-radius: 4px;
    color: var(--alice-text);
}
.nav-imp-result:hover {
    background: var(--alice-blue-tint);
}

/* Return arrow next to role badge while impersonating */
.nav-imp-return-form {
    display: inline;
    margin: 0 0 0 4px;
}
.nav-imp-return {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--alice-blue);
    padding: 2px 6px;
    font-size: 16px;
    line-height: 1;
}
.nav-imp-return:hover {
    color: var(--alice-text);
}

/* ── Bookmark nav icon (jump to last visited lesson) ── */
.nav-bookmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
}
.nav-bookmark svg {
    display: block;
}
.nav-bookmark--disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

/* ── Role switcher popup ───────────────────────────── */
.nav-role-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nav-role-badge--switchable {
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-role-badge--switchable:hover {
  background: var(--alice-blue);
  color: var(--alice-bg);
}
.nav-role-arrow {
  font-size: 9px;
  line-height: 1;
}
.nav-role-popup {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 1000;
  min-width: 220px;
  background: var(--alice-bg);
  border: 1px solid var(--alice-border);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 4px 0;
}
.nav-role-popup.hidden { display: none; }
.nav-role-popup form { margin: 0; }
.nav-role-popup-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--alice-text);
  cursor: pointer;
}
.nav-role-popup-item:hover {
  background: var(--alice-blue-tint);
}
.nav-role-popup-item.active {
  font-weight: 700;
  color: var(--alice-blue);
}
body.th-hico .nav-role-badge {
  background: #FFFFFF;
}
body.th-hico .capstone-card {
  background: #EEEEEE;
}
body.th-hico .capstone-card--active {
  background: #FFFFFF;
}
.nav-email {
  font-size: 12px; color: var(--alice-text-secondary);
}

/* ── Burger button ─────────────────────────────────── */
.burger-btn {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: none; border: 1px solid var(--alice-border);
  border-radius: 6px; cursor: pointer; color: var(--alice-text-secondary);
  transition: color .18s, border-color .18s;
}
.burger-btn:hover { color: var(--alice-text); border-color: var(--alice-border-strong); }
.burger-btn svg { pointer-events: none; }

/* ── Burger panel ──────────────────────────────────── */
.burger-panel {
  position: absolute; top: 44px; right: 0; z-index: 300;
  background: var(--alice-surface);
  border: 1px solid var(--alice-border);
  border-radius: 0 0 8px 8px;
  min-width: 220px; padding: 12px 0;
  box-shadow: -4px 4px 24px rgba(0,0,0,.15);
}
.burger-panel.hidden { display: none; }
.burger-section {
  padding: 6px 16px 2px;
  font-size: 9px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--alice-text-tertiary);
}
.burger-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; font-size: 13px; color: var(--alice-text-secondary);
  cursor: pointer; background: none; border: none; width: 100%;
  text-align: left; text-decoration: none;
  transition: background .12s;
  font-family: inherit;
}
.burger-item:hover { background: var(--alice-bg); }
.burger-divider {
  height: 1px; background: var(--alice-border); margin: 6px 0;
}

/* ── Content container ─────────────────────────────── */
.content-container {
  max-width: var(--content-max-width, 960px);
  margin: 0 auto; padding: 0 16px;
}

/* ── Login shell ───────────────────────────────────── */
.login-shell {
  min-height: calc(100vh - 44px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
}

/* ── Cookie notice ─────────────────────────────────── */
.cookie-notice {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 400;
  background: var(--alice-surface);
  border-top: 1px solid var(--alice-border);
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; font-size: 13px; color: var(--alice-text-secondary);
}
.cookie-notice__text { margin: 0; }
.cookie-notice__ok {
  flex-shrink: 0; padding: 6px 18px;
  background: var(--alice-blue); border: none; border-radius: 6px;
  color: #fff; font-size: 13px; cursor: pointer;
}

/* ── Responsive: collapse nav links into burger ────── */
@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-user .nav-role-badge { display: none; }
}

/* ── Breadcrumb ────────────────────────────────────── */
.breadcrumb {
  font-size: 12px;
  color: var(--alice-text-secondary);
  margin-bottom: 1.25rem;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--alice-text-secondary);
                text-decoration: none; }
.breadcrumb a:hover { color: var(--alice-text); }
.breadcrumb__sep { color: var(--alice-gray); }
.breadcrumb__current { color: var(--alice-text); }
body.nav-locked .breadcrumb {
    position: sticky;
    top: 44px;
    z-index: 490;
    background: var(--alice-bg);
}

/* ── Category selector ─────────────────────────────── */
.category-selector { margin-bottom: 1.5rem; }
.category-selector__label {
  font-size: 12px; font-weight: 500;
  color: var(--alice-text-secondary);
  letter-spacing: 0.06em; text-transform: uppercase;
  margin-bottom: 0.6rem;
}
.category-selector__options {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.category-btn {
  padding: 4px 10px; font-size: 11px;
  font-family: var(--font-sans);
  color: var(--alice-text); background: none;
  border: 0.5px solid var(--alice-border-secondary);
  border-radius: var(--radius-md); cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.category-btn:hover { background: var(--alice-bg); }
.category-btn--active {
  background: var(--alice-bg);
  border: 1.5px solid var(--alice-blue);
  color: var(--alice-blue); font-weight: 500;
}
.category-btn:focus-visible {
  outline: 3px solid var(--alice-focus, var(--alice-blue));
  outline-offset: 2px;
}

/* ── Map container ─────────────────────────────────── */
.map-container {
  border: 0.5px solid var(--alice-border-tertiary);
  border-radius: var(--radius-lg);
  overflow: hidden; margin-bottom: 1rem;
  background: var(--alice-surface);
}
.map-controls { display: flex; gap: 8px;
                margin-bottom: 0.75rem; }

/* ── Map legend (moved to SPECS13 block below) ────── */

/* ── Syllabus table ────────────────────────────────── */
.syllabus-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.syllabus-table th {
  font-size: 11px; font-weight: 500;
  color: var(--alice-text-tertiary);
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 8px 12px; text-align: left;
  border-bottom: 0.5px solid var(--alice-border-tertiary);
}
.syllabus-table td {
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--alice-border-tertiary);
  color: var(--alice-text); vertical-align: middle;
}
.syllabus-table tr:last-child td { border-bottom: none; }
.syllabus-table tr:hover td { background: var(--alice-bg); }

/* ── Admin table ────────────────────────────────── */
.admin-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.admin-table th {
  font-size: 11px; font-weight: 500;
  color: var(--alice-text-tertiary);
  text-transform: uppercase; letter-spacing: .06em;
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--alice-border);
}
.admin-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--alice-border-tertiary, var(--alice-border));
  vertical-align: middle;
}
.admin-table tr:hover td { background: var(--alice-bg); }

/* ── Admin form ─────────────────────────────────── */
.admin-form { max-width: 900px; }
.form-row {
  display: grid; grid-template-columns: 180px 1fr;
  gap: 8px; align-items: start; margin-bottom: 14px;
}

/* Search bar: input fills space, button fixed width, right-aligned */
.search-bar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 14px;
}
.search-bar .form-input { flex: 1; }
.search-bar .btn-primary,
.search-bar .btn-secondary { flex-shrink: 0; }

/* Action bar: right-aligned row of buttons below tables */
.action-bar {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 12px;
}

/* ── Split columns (HISPANIA/BRITANNIA pattern) ─── */
.lingua-split {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.lingua-col-header {
  font-size: 11px; font-weight: 700;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--alice-amber); margin-bottom: 12px;
}

/* ── Permission matrix ──────────────────────────── */
.matrix-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.matrix-table th { padding: 6px 10px; text-align: left;
                   background: var(--alice-bg); }
.matrix-table .fasciculus-row td {
  background: var(--alice-blue-tint);
  font-weight: 600; font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; padding: 4px 10px;
  color: var(--alice-blue);
}
.matrix-table td { padding: 5px 10px;
  border-bottom: 1px solid var(--alice-border-tertiary, var(--alice-border)); }

/* ── Badge ──────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 10px; font-size: 10px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
}
.badge-systema  { background: var(--alice-blue-tint); color: var(--alice-blue); }
.badge-hospes   { background: var(--alice-amber-tint); color: var(--alice-warning); }
.badge-start    { background: var(--alice-teal-tint); color: var(--alice-teal); }
.badge-end      { background: var(--alice-amber-tint); color: var(--alice-amber); }

/* ── Flash message ──────────────────────────────── */
.flash-msg {
  padding: 10px 16px; border-radius: 6px; font-size: 13px;
  margin-bottom: 16px;
}
.flash-msg.ok { background: var(--alice-teal-tint);
                border: 1px solid var(--alice-teal);
                color: var(--alice-teal); }
.flash-msg.err { background: #FFF0F0;
                 border: 1px solid #C13030;
                 color: #C13030; }

/* ── Untranslated labels (legacy, kept for non-`t()` link callers) ── */
.untranslated-label {
  color: var(--alice-warning);
  text-decoration: underline dashed;
  cursor: pointer;
}

/* ── ALT+click label editing (EDIT_LINGUA mode) ──────
   The t() helper wraps every body-context label in
   <span class="alice-label" data-nuntius="CODE"> when edit_lingua is
   active. alice.js toggles the body.alt-down class while Alt is held
   so affordances appear only then, and on click with Alt held it
   navigates to /admin/nuntius/CODE without firing the underlying
   hyperlink/htmx action. */
.alice-label[data-nuntius] { cursor: inherit; }
.alice-label--missing[data-nuntius] {
  color: var(--alice-warning);
  text-decoration: underline dashed;
}
body.alt-down .alice-label[data-nuntius] {
  outline: 1px dashed var(--alice-warning);
  outline-offset: 2px;
  cursor: alias;
  background: rgba(186, 117, 23, 0.08);
}

/* Edit-lingua toggle in topnav: small pencil icon + iOS-style switch.
   Visible only to EDIT_LINGUA holders; aria-pressed mirrors cookie state. */
.nav-edit-lingua {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0 4px;
  cursor: pointer;
  color: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-edit-lingua svg { width: 14px; height: 14px; }
.nav-edit-lingua:hover svg { color: var(--alice-warning); }
.nav-edit-lingua-switch {
  display: inline-flex;
  align-items: center;
  width: 26px;
  height: 14px;
  background: var(--alice-border);
  border-radius: 7px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.nav-edit-lingua-switch::before {
  content: "";
  position: absolute;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.nav-edit-lingua[aria-pressed="true"] .nav-edit-lingua-switch {
  background: var(--alice-warning);
}
.nav-edit-lingua[aria-pressed="true"] .nav-edit-lingua-switch::before {
  left: 14px;
}
.nav-edit-lingua[aria-pressed="true"] svg { color: var(--alice-warning); }

/* ── Markdown preview ──────────────────────────── */
.md-preview {
  margin-top: 6px; padding: 10px 14px;
  background: var(--alice-bg);
  border: 1px solid var(--alice-border);
  border-radius: 6px;
  font-size: 13px; color: var(--alice-text);
  line-height: 1.6; min-height: 40px;
}
.md-preview h1,.md-preview h2,.md-preview h3 {
  color: var(--alice-text); margin-bottom: 8px;
}
.md-preview code {
  background: var(--alice-bg);
  padding: 1px 5px; border-radius: 3px;
}

/* ── Calculus card ─────────────────────────────── */
.action-card--calculus {
  border-color: var(--alice-warning);
  background: var(--alice-amber-tint);
}
.action-card--calculus:hover {
  opacity: .9;
}
/* Warning-tinted variant of the standard .card (used by the
   Calculus action on the admin opus actions page). Inherits all
   .card padding/border-radius/sizing — only the colors change. */
.card--warn {
  border-color: var(--alice-warning);
  background: var(--alice-amber-tint);
}
.card--warn:hover {
  filter: brightness(0.97);
}
.card-meta {
  font-size: 12px;
  color: var(--alice-text-secondary);
  margin-top: 8px;
  margin-bottom: 0;
}
.btn-calculus {
  background: var(--alice-warning); color: #fff;
  border: none; padding: 8px 20px; border-radius: 6px;
  font-weight: 600; cursor: pointer;
}
.modal-warn {
  color: var(--alice-warning); font-size: 12px; margin-top: 8px;
}

/* ── Modal ─────────────────────────────────────── */
.modal {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000; display: flex;
  align-items: center; justify-content: center;
  background: rgba(0,0,0,.5);
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--alice-surface);
  border: 1px solid var(--alice-border);
  border-radius: 10px; padding: 2rem;
  max-width: 480px; width: 90%;
}
.modal-actions {
  display: flex; gap: 8px; margin-top: 1rem;
}

/* ── NUNTIUS body ──────────────────────────────── */
.nuntius-body {
  line-height: 1.7; font-size: 15px;
}
.nuntius-body h1,.nuntius-body h2,.nuntius-body h3 {
  margin-top: 1.5rem; margin-bottom: 0.5rem;
}

/* ── Edge editor ───────────────────────────────── */
.edge-editor {
  margin-top: 1rem;
  border: 1px solid var(--alice-border);
  border-radius: 8px; padding: 1rem;
}
.edge-editor__hint {
  color: var(--alice-text-secondary);
  font-size: 13px; font-style: italic;
}

/* 14. Responsive overrides */
@media (max-width: 480px) {
    .nav__links {
        display: none;
    }

    .grid-2col {
        grid-template-columns: 1fr;
    }

    .col-course {
        display: none;
    }

    .login-card {
        margin: 1rem;
    }
}

/* ── Submission text display ─────────────────── */
.submission-text {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px; padding: 10px 14px;
  font-size: 13px; color: rgba(255,255,255,.8);
  line-height: 1.6; white-space: pre-wrap;
  max-height: 200px; overflow-y: auto;
  margin-bottom: 10px;
}

/* ── Tessera share view ──────────────────────── */
.tessera-notice {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 10px;
  background: rgba(212,168,67,.15);
  border: 1px solid rgba(212,168,67,.3);
  font-size: 11px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 16px;
}

/* ── Status pill ─────────────────────────────── */
.pill {
  display: inline-block; padding: 2px 8px;
  border-radius: 10px; font-size: 11px;
  font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase;
}
.pill-ok  { background:rgba(0,120,100,.25); color:#4dd; }
.pill-warn{ background:rgba(212,168,67,.2);  color:var(--gold); }
.pill-err { background:rgba(232,75,31,.2);   color:var(--orange); }

/* ── Lingua tabs ─────────────────────────────────── */
.lingua-tabs { margin-top: 1.5rem; }

.lingua-tab-bar {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--alice-border);
  margin-bottom: 0;
  position: sticky;
  top: 0;
  background: var(--alice-bg);
  z-index: 50;
  padding-top: 4px;
}
body.nav-locked .lingua-tab-bar {
  /* --lingua-tab-top is computed by alice.js (updateNavOffsets);
     falls back to 44px if no breadcrumb is present on the page. */
  top: var(--lingua-tab-top, 44px);
}
.lingua-tab-btn {
  padding: 6px 14px; font-size: 12px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  background: none; border: 1px solid transparent;
  border-bottom: none; border-radius: 4px 4px 0 0;
  cursor: pointer; color: var(--alice-text-secondary);
  transition: color .15s, background .15s;
  margin-bottom: -1px;
}
.lingua-tab-btn:hover { color: var(--alice-text); }
.lingua-tab-btn.active {
  background: var(--alice-surface);
  border-color: var(--alice-border);
  border-bottom-color: var(--alice-surface);
  color: var(--alice-blue); font-weight: 700;
}
.lingua-panel {
  background: var(--alice-surface);
  border: 1px solid var(--alice-border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 20px;
}
.lingua-panel.hidden { display: none; }

.lingua-add-section {
  margin-top: 1.5rem;
  padding: 16px;
  border: 1px dashed var(--alice-border);
  border-radius: 6px;
}
.lingua-add-section h3 {
  margin-top: 0; font-size: 13px;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--alice-text-secondary);
}

/* ── Chip input ──────────────────────────────────── */
.chip-input { display: flex; flex-direction: column; gap: 8px; }
.chip-list {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  background: rgba(0,85,164,.1);
  border: 1px solid var(--alice-blue);
  border-radius: 4px; font-size: 12px;
}
.chip-label {
  color: var(--alice-blue); text-decoration: none; max-width: 300px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip-label:hover { text-decoration: underline; }
.chip-remove {
  background: none; border: none; cursor: pointer;
  color: var(--alice-text-secondary); font-size: 12px;
  padding: 0 2px; line-height: 1;
}
.chip-remove:hover { color: var(--alice-text); }
.chip-entry { max-width: 480px; }

/* ── Button alignment (admin forms) ─────────────── */
.form-actions {
  display: flex; justify-content: flex-end;
  margin-top: 16px;
}
.form-actions--bordered {
  padding-top: 12px;
  border-top: 1px solid var(--alice-border);
}
.form-actions .btn-primary,
.form-actions .btn-secondary,
.form-actions .btn-danger,
.admin-btn,
.admin-table .btn-primary,
.admin-table .btn-secondary,
.admin-table .btn-danger {
  max-width: var(--btn-max-width, 300px);
  width: auto;
  display: inline-block;
  margin-left: 8px;
}

/* ── Tall textarea ─────────────────────────── */
.form-textarea.tall { min-height: 200px; }

/* ── Lesson page progress chips ────────────── */
.pagina-progress {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 1rem; font-size: 12px;
}
.progress-chip {
  padding: 3px 10px; border-radius: 10px;
  font-weight: 600; letter-spacing: .04em;
}
.progress-graded {
  background: rgba(0,120,100,.12);
  color: var(--alice-teal); border: 1px solid var(--alice-teal);
}
.progress-read {
  background: rgba(212,168,67,.12);
  color: var(--alice-amber); border: 1px solid var(--alice-amber);
}
.progress-pending {
  background: rgba(128,128,128,.12);
  color: var(--alice-gray); border: 1px solid var(--alice-gray);
}

/* ── Lesson page tab bar ──────────────────── */
.pagina-tab-bar {
  display: flex; gap: 2px; flex-wrap: wrap;
  margin-bottom: 0;
  /* Bottom border lives on .tab-bar-row so it spans the full width
     including the progress widget on the right. */
}
.pagina-tab-btn {
  padding: 8px 18px; font-size: 13px; font-weight: 400;
  background: none; border: 1px solid transparent;
  border-bottom: none; border-radius: 4px 4px 0 0;
  cursor: pointer; color: var(--alice-text-secondary);
  transition: color .15s; margin-bottom: -1px;
  display: flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.pagina-tab-btn:hover { color: var(--alice-text); }
.pagina-tab-btn.active {
  background: var(--alice-surface);
  border-color: var(--alice-border);
  border-bottom-color: var(--alice-surface);
  color: var(--alice-blue); font-weight: 700;
}
.tab-count {
  background: var(--alice-amber);
  color: var(--alice-surface);
  border-radius: 10px; font-size: 10px;
  padding: 1px 6px; font-weight: 700;
}
.tab-count-quiet {
  background: var(--alice-teal);
  color: var(--alice-surface);
  border-radius: 10px; font-size: 10px;
  padding: 1px 6px; font-weight: 700;
}
.ctx-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  margin-right: 8px;
  border-radius: 4px;
  vertical-align: middle;
  user-select: none;
}
.ctx-pill svg { display: block; width: 22px; height: 22px; }
.ctx-pill--opus  { background: var(--alice-teal-tint);  color: var(--alice-teal); }
.ctx-pill--lexia { background: var(--alice-amber-tint); color: var(--alice-warning); }
.asset-row.conflict {
  border-color: var(--alice-amber) !important;
  box-shadow: 0 0 0 2px var(--alice-amber-tint);
}
.asset-conflict-banner {
  background: var(--alice-amber-tint);
  color: var(--alice-warning);
  padding: 0.4rem 0.75rem;
  border-radius: 4px;
  font-size: 0.85em;
  margin-top: 0.5rem;
  display: flex; gap: 0.5rem; align-items: center;
}
.asset-reader-row > summary { list-style: none; }
.asset-reader-row > summary::-webkit-details-marker { display: none; }
.asset-reader-row > summary:hover { background: var(--alice-bg, #f5f5f2); }
.asset-reader-row[open] > summary { border-bottom: 1px solid var(--alice-border, #e0dfd8); }
.asset-add-details { margin-bottom: 0.75rem; }
.asset-add-toggle {
  display: flex; align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--alice-bg, #f5f5f2);
  border: 1px solid var(--alice-border, #e0dfd8);
  border-radius: 6px;
  font-weight: 600; font-size: 0.9em;
  color: var(--alice-blue);
  cursor: pointer; list-style: none;
}
.asset-add-toggle::-webkit-details-marker { display: none; }
.asset-add-details[open] > .asset-add-toggle {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  margin-bottom: 0;
}
.asset-add-details[open] > form {
  border: 1px solid var(--alice-border, #e0dfd8);
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 0.75rem;
}

/* ── Lesson page panels (SPECS28: card treatment) ── */
.pagina-panel {
  background: var(--alice-surface);
  border: 1px solid var(--alice-border);
  border-top: none;          /* the active tab supplies the top edge */
  border-radius: 0 0 8px 8px;
  padding: 20px 22px;
  min-height: 200px;
}
.pagina-panel.hidden { display: none; }
.pagina-tag {
  font-size: 14px; color: var(--alice-text-secondary);
  font-style: italic; margin-bottom: 1rem;
}
.pagina-content { font-size: 15px; line-height: 1.7; }
.pagina-content h1,
.pagina-content h2,
.pagina-content h3 { margin-top: 1.5rem; }
/* Responsive images — never overflow the content container */
.pagina-content img {
    max-width: 100%;
    height: auto;
}
/* Manual-course screenshots: border only for alice_manual images */
.pagina-content img[src*="alice_manual"] {
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    margin: 12px 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

/* ── Collapsible SLO/Assessment ───────────── */
.pagina-collapsible {
  margin-top: 1.5rem;
  border: 1px solid var(--alice-border);
  border-radius: 6px; overflow: hidden;
}
.pagina-collapsible summary {
  padding: 10px 14px; cursor: pointer;
  font-weight: 600; font-size: 14px;
  background: var(--alice-bg);
  list-style: none; user-select: none;
}
.pagina-collapsible summary::-webkit-details-marker { display: none; }
.pagina-collapsible summary::before {
  content: '+ '; color: var(--alice-blue);
}
.pagina-collapsible[open] summary::before { content: '- '; }
.pagina-collapsible-body {
  padding: 14px; font-size: 14px; line-height: 1.6;
}

/* ── Asset notice ─────────────────────────── */
.pagina-asset-notice {
  font-size: 12px; color: var(--alice-text-secondary);
  background: rgba(212,168,67,.08);
  border: 1px solid var(--alice-amber);
  border-radius: 4px; padding: 6px 12px;
  margin-bottom: 12px; display: inline-block;
}

/* ── PDF embed ────────────────────────────── */
.pdf-embed-wrapper { margin-bottom: 20px; }
.pdf-embed {
  width: 100%; height: 600px; border: 1px solid var(--alice-border);
  border-radius: 4px;
}

/* ── Video embed ──────────────────────────── */
.video-embed-wrapper {
  position: relative; padding-bottom: 56.25%;
  height: 0; overflow: hidden; margin-bottom: 20px;
  border-radius: 6px;
}
.video-embed {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%; border: none;
}

/* ── Map inline ───────────────────────────── */
.pagina-map-container {
  width: 100%; height: 520px;
  border: 1px solid var(--alice-border);
  border-radius: 6px; overflow: hidden;
  margin-bottom: 12px;
}

/* ── Survey embed ─────────────────────────── */
.survey-embed {
  width: 100%; height: 700px;
  border: 1px solid var(--alice-border); border-radius: 4px;
}

/* ── Submission form ──────────────────────── */
.pagina-submission {
  margin-top: 2rem; padding-top: 1.5rem;
  border-top: 1px solid var(--alice-border);
}
.pagina-existing-submission {
  background: var(--alice-bg);
  border: 1px solid var(--alice-border);
  border-radius: 6px; padding: 12px;
  margin-bottom: 12px; font-size: 13px;
}
.pagina-existing-submission pre {
  margin: 0; white-space: pre-wrap; word-break: break-word;
}

/* ── Next lessons ─────────────────────────── */
.pagina-next-section {
  margin-top: 0.75rem;
  padding-top: 0;
}
.pagina-next-list {
  display: flex; flex-direction: column; gap: 8px; margin-top: 8px;
}
.pagina-next-link {
  display: block; padding: 10px 14px;
  background: var(--alice-surface);
  border: 1px solid var(--alice-border);
  border-radius: 6px; text-decoration: none;
  color: var(--alice-text); font-size: 14px;
  transition: border-color .15s, background .15s;
}
.pagina-next-link:hover {
  border-color: var(--alice-blue);
  background: rgba(0,85,164,.06);
  color: var(--alice-blue);
}
.pagina-empty {
  color: var(--alice-text-secondary); font-style: italic;
  font-size: 14px;
}

/* ── Capstone list ────────────────────────── */
.capstone-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.capstone-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--alice-border);
  border-radius: 6px; background: var(--alice-surface);
}
.cap-status { flex-shrink: 0; margin-top: 2px; }
.cap-body   { flex: 1; min-width: 0; }
.cap-title  {
  font-size: 15px; font-weight: 600;
  color: var(--alice-text); text-decoration: none;
  display: block; margin-bottom: 2px;
}
.cap-title:hover {
  color: var(--alice-blue); text-decoration: underline;
}
.cap-known-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  color: var(--alice-teal); margin-left: 6px;
}
.cap-tag {
  font-size: 13px; color: var(--alice-text-secondary);
  margin: 4px 0 8px; line-height: 1.4;
}
.cap-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.cap-action-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: var(--alice-blue);
  text-decoration: underline; padding: 0;
}
.cap-action-btn:hover { color: var(--alice-amber); }

/* ── Course page tab bar ──────────────────── */
.crs-tab-bar {
  display: flex; gap: 2px;
  margin-bottom: 0;       /* card attaches directly */
  /* Bottom border lives on .tab-bar-row so it spans the full row width. */
}
.crs-tab-btn {
  padding: 8px 20px; font-size: 13px; font-weight: 400;
  background: none; border: 1px solid transparent;
  border-bottom: none; border-radius: 4px 4px 0 0;
  cursor: pointer; color: var(--alice-text-secondary);
  margin-bottom: -1px; transition: color .15s;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.crs-tab-btn:hover { color: var(--alice-text); }
.crs-tab-btn.active {
  background: var(--alice-surface);
  border-color: var(--alice-border);
  border-bottom-color: var(--alice-surface);
  color: var(--alice-blue); font-weight: 700;
}
/* SPECS28: course panels are cards attached under the active tab */
.crs-panel {
  background: var(--alice-surface);
  border: 1px solid var(--alice-border);
  border-top: none;        /* the active tab supplies the top edge */
  border-radius: 0 0 8px 8px;
  padding: 20px 22px;
  min-height: 200px;
}
.crs-panel.hidden { display: none; }

/* ── Public home page grid ───────────────────────── */
.home-public-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 1.5rem;
}
@media (max-width: 640px) {
  .home-public-grid { grid-template-columns: 1fr; }
}

.home-panel {
  background: var(--alice-surface);
  border: 1px solid var(--alice-border);
  border-radius: 8px;
  padding: 20px 22px;
  display: flex; flex-direction: column; gap: 10px;
}
.home-panel__title {
  font-size: 13px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--alice-text-secondary);
  margin: 0;
}
.home-panel__body {
  flex: 1; font-size: 14px; line-height: 1.6;
  color: var(--alice-text);
}
.home-panel__body p { margin: 6px 0 0; }
.home-panel__body h1,
.home-panel__body h2,
.home-panel__body h3 {
  font-size: 15px; font-weight: 700;
  color: var(--alice-text); margin: 0 0 6px;
}
.home-panel__more {
  display: inline-block; font-size: 13px;
  color: var(--alice-blue); text-decoration: none;
  align-self: flex-start;
}
.home-panel__more:hover { text-decoration: underline; }
.home-panel__empty {
  font-size: 13px; color: var(--alice-text-secondary);
  font-style: italic; margin: 0;
}

/* ── Textarea and preview fixes ──────────────────── */
.lingua-panel textarea,
.lingua-panel .form-textarea {
  width: 100%;
  box-sizing: border-box;
}
.md-preview:empty { display: none; }

/* ── Nuntius body content ───────────────────────────────────────────── */

.nuntius-body img {
    height: 60px;
    width: auto;
    vertical-align: middle;
    margin-right: 0.6rem;
}

.nuntius-body p {
    margin-block: 0.75rem;
}

.nuntius-body p:has(img) {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nuntius-body a {
    color: var(--alice-blue);
}

.nuntius-body a:hover {
    text-decoration: underline;
}

.nuntius-body hr {
    border: none;
    border-top: 1px solid var(--alice-border);
    margin-block: 1.5rem;
}

/* ── Asset list (PDF / Video tab) ───────────────────────────── */

.asset-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.asset-list-btn {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.asset-list-btn:hover,
.asset-list-btn.active {
    border-color: var(--alice-blue);
    background: var(--alice-blue-tint);
}

.asset-list-btn[aria-expanded="true"] {
    border-color: var(--alice-blue);
}

.asset-list-icon {
    flex-shrink: 0;
    font-size: 1.1rem;
    line-height: 1.4;
}

.asset-list-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--alice-text);
    line-height: 1.4;
}

.asset-list-desc {
    display: block;
    font-size: 0.8rem;
    color: var(--alice-text-secondary);
    margin-top: 2px;
    font-weight: 400;
}

/* ── Asset viewer ────────────────────────────────────────────── */

.asset-viewer {
    margin-top: 12px;
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    overflow: hidden;
}

.asset-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--alice-surface);
    border-bottom: 1px solid var(--alice-border);
}

.asset-viewer-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--alice-text);
}

.asset-viewer-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    color: var(--alice-text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
}

.asset-viewer-close:hover {
    background: var(--alice-bg);
    color: var(--alice-text);
}

/* ── AI Agent sidebar ────────────────────────────────────────── */

.agent-toggle-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--alice-blue);
    color: #fff;
    border: none;
    border-radius: 24px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
    transition: background 0.15s, box-shadow 0.15s;
}

.agent-toggle-btn:hover {
    opacity: 0.9;
    box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}

.agent-toggle-label {
    white-space: nowrap;
}

.agent-panel {
    position: fixed;
    top: 0;
    /* 10 px clear of the viewport so the panel's internal scrollbar
       never gets shoved under the browser scrollbar. */
    right: 10px;
    width: 420px;
    min-width: 320px;
    max-width: 1200px;
    height: 100vh;
    background: var(--alice-surface);
    /* Hard border on every side — the panel now floats inside the
       viewport so the right border is visible too. */
    border: 2px solid var(--alice-border);
    box-shadow: -6px 0 24px rgba(0,0,0,0.18);
    z-index: 400;
    display: flex;
    flex-direction: column;
    /* No width transition — it would fight the drag-to-resize handler. */
}

/* When nav-lock is active the topnav (44px) + breadcrumb become sticky.
   Push the panel down by the combined height so the tab bar / close X
   aren't occluded. alice.js publishes the sum on <body> as
   --lingua-tab-top; we default to 0 when the JS hasn't run yet. */
body.nav-locked .agent-panel {
    top: var(--lingua-tab-top, 0px);
    height: calc(100vh - var(--lingua-tab-top, 0px));
}

/* Left-edge drag handle for live resize. */
.agent-panel-resizer {
    position: absolute;
    top: 0;
    left: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    background: transparent;
    z-index: 401;
}
.agent-panel-resizer:hover,
.agent-panel-resizer:active {
    background: linear-gradient(
        to right, transparent, var(--alice-blue) 45%,
        var(--alice-blue) 55%, transparent);
    opacity: 0.35;
}

.agent-panel.hidden {
    display: none;
}

.agent-panel-header {
    display: flex;
    align-items: center;
    /* Title only; close button moved to the tab bar. Tighter padding
       so the header doesn't steal vertical space from the chat area. */
    padding: 8px 12px 6px;
    flex-shrink: 0;
}

.agent-panel-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--alice-text);
}

.agent-panel-newchat,
.agent-panel-close {
    background: var(--alice-bg);
    border: 1px solid var(--alice-border);
    cursor: pointer;
    line-height: 1;
    color: var(--alice-text);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background 0.12s ease, color 0.12s ease,
                border-color 0.12s ease;
}

/* New-chat sits next to the close X; push the pair to the right edge
   of the tab bar via margin-left:auto on the first of the two. */
.agent-panel-newchat {
    margin-left: auto;
    margin-right: 4px;
}

.agent-panel-close {
    font-size: 1.15rem;
    font-weight: 700;
}

.agent-panel-newchat:hover {
    background: var(--alice-blue);
    color: #fff;
    border-color: var(--alice-blue);
}

.agent-panel-close:hover {
    background: #b00;
    color: #fff;
    border-color: #b00;
}

.agent-panel-newchat:focus-visible,
.agent-panel-close:focus-visible {
    outline: 2px solid var(--alice-blue);
    outline-offset: 2px;
}

.agent-messages {
    flex: 1;
    overflow-y: auto;
    /* Match .agent-form padding so the right edge of agent bubbles
       lines up with the right edge of the input textarea below. */
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.agent-msg {
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
    word-break: break-word;
}

.agent-msg--user {
    background: var(--alice-blue);
    color: #fff;
    align-self: flex-end;
    max-width: 88%;           /* questions stay compact + right-aligned */
    border-bottom-right-radius: 2px;
}

.agent-msg--agent {
    background: var(--alice-bg);
    color: var(--alice-text);
    border: 1px solid var(--alice-border);
    /* Stretch full column width so the right edge lines up with the
       input textarea's right edge below. */
    align-self: stretch;
    max-width: none;
    border-bottom-left-radius: 2px;
}

.agent-msg--thinking {
    background: var(--alice-bg);
    color: var(--alice-text-secondary);
    border: 1px solid var(--alice-border);
    align-self: flex-start;
    font-style: italic;
}

.agent-msg--error {
    background: rgba(200,0,0,0.08);
    color: #b00;
    border: 1px solid rgba(200,0,0,0.2);
    align-self: flex-start;
}

.agent-form {
    padding: 12px;
    border-top: 1px solid var(--alice-border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    /* Anchored at bottom of tab panel via flex parent (.agent-tab-panel
       is column flex, .agent-messages has flex:1). */
}

/* ── Per-round flaw cards (Phase A live FOO visibility) ─────────
   Each round opens with a header band and stacks one collapsible
   <details> per critic / reviewer / verifier / harmonizer that
   returns. End-of-round summary card appears under the stack. */
.agent-round-box {
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    margin: 8px 0;
    background: var(--alice-bg);
}
.agent-round-head {
    padding: 6px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--alice-text-secondary);
    border-bottom: 1px solid var(--alice-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.agent-round-actions {
    text-transform: none;
    font-weight: 500;
    letter-spacing: 0;
    font-size: 0.72rem;
}
.agent-round-actions a {
    color: var(--alice-blue);
    text-decoration: none;
}
.agent-round-actions a:hover { text-decoration: underline; }
.agent-flaws-card {
    border-bottom: 1px solid var(--alice-border);
    padding: 6px 10px;
}
.agent-flaws-card:last-child { border-bottom: none; }
.agent-flaws-card[open] { background: rgba(0,0,0,0.015); }
.agent-flaws-head {
    cursor: pointer;
    font-size: 0.85rem;
    list-style: none;
}
.agent-flaws-head::-webkit-details-marker { display: none; }
.agent-flaws-badge {
    display: inline-block;
    padding: 1px 6px;
    margin-left: 4px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
}
.agent-flaws-badge--substantive {
    background: rgba(200, 0, 0, 0.10); color: #b00;
}
.agent-flaws-badge--minor {
    background: rgba(245, 158, 11, 0.12); color: #b45309;
}
.agent-flaws-badge--ok {
    background: rgba(22, 163, 74, 0.10); color: #16a34a;
}
.agent-flaws-body {
    margin-top: 6px;
    font-size: 0.82rem;
    line-height: 1.45;
}
.agent-flaws-summary { margin: 4px 0 8px 0; }
.agent-flaws-section { margin: 4px 0; }
.agent-flaws-section-head {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--alice-text-secondary);
    text-transform: uppercase;
    letter-spacing: .04em;
}
.agent-flaws-section ul { margin: 4px 0 4px 16px; padding: 0; }
/* Prose card body — reasoner / writer / planner / etc. The
   server has already truncated; we just need to wrap nicely. */
.agent-prose {
    margin: 4px 0 0 0;
    padding: 6px 8px;
    font-family: inherit;
    font-size: 0.82rem;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--alice-bg);
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    max-height: 320px;
    overflow-y: auto;
}
.agent-flaws-flag {
    margin: 6px 0 0 0;
    color: var(--alice-warning);
    font-weight: 600;
    font-size: 0.78rem;
}
.agent-round-summary {
    padding: 6px 10px;
    font-size: 0.82rem;
    background: var(--alice-surface);
    border-top: 1px solid var(--alice-border);
}

/* Cancel button shares the send-btn slot but signals destructive
   action with a red tint. Visible only while a /agent/stream call
   is in flight (toggled by JS on submit/finish). */
.agent-cancel-btn {
    background: rgba(176, 0, 0, 0.08);
    border-color: rgba(176, 0, 0, 0.35);
    color: #b00;
}
.agent-cancel-btn:hover {
    background: rgba(176, 0, 0, 0.18);
}

/* Opus-level AI Agent shortcut on /opus/{id}. Sits next to the
   chorus selector in the title row. Links to /opus/{id}/chat. */
.opus-agent-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--alice-border);
    border-radius: 50%;
    color: var(--alice-text-secondary);
    margin-left: 8px;
    text-decoration: none;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.opus-agent-link:hover {
    background: var(--alice-blue-tint);
    color: var(--alice-blue);
    border-color: var(--alice-blue);
}

/* ── Per-call modifiers strip (single/multi + reasoning slider) ── */
.agent-modifiers {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 6px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--alice-text-secondary);
}
.agent-mod-toggle {
    display: inline-flex;
    border: 1px solid var(--alice-border);
    border-radius: 999px;
    overflow: hidden;
}
.agent-mod-btn {
    background: transparent;
    border: none;
    padding: 3px 12px;
    font-size: 0.78rem;
    color: var(--alice-text-secondary);
    cursor: pointer;
}
.agent-mod-btn.active {
    background: var(--alice-blue);
    color: #fff;
}
.agent-mod-slider {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.agent-mod-label {
    font-weight: 600;
}
.agent-mod-slider input[type="range"] {
    width: 110px;
}
.agent-mod-level {
    display: inline-block;
    min-width: 48px;
    font-variant: small-caps;
    letter-spacing: .04em;
}

/* Wrapper establishes a positioning context for the floating send
   button. The wrapper's height grows with the textarea as the learner
   drags the resize grip, so the button tracks the textarea's bottom
   edge automatically. */
.agent-input-wrap {
    position: relative;
    display: block;
    width: 100%;
}

.agent-input {
    width: 100%;
    font-size: 0.9rem;
    /* Native resize grip would conflict with the floating send button
       hugging the right edge; panel height is driven by the side-panel
       drag handle instead. */
    resize: none;
    min-height: 96px;
    max-height: 40vh;
    line-height: 1.45;
    box-sizing: border-box;
    /* Right gutter reserves space for the floating send button so the
       last line of text never collides with it. */
    padding-right: 44px;
}

.agent-send-btn {
    position: absolute;
    /* 10 px from the textarea's right edge, tucked against the bottom. */
    right: 10px;
    bottom: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--alice-blue);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: background 0.12s ease, transform 0.12s ease;
}
.agent-send-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}
.agent-send-btn:active {
    transform: translateY(0);
}
.agent-send-btn:focus-visible {
    outline: 2px solid var(--alice-blue);
    outline-offset: 2px;
}
.agent-send-btn svg {
    margin-left: -1px;  /* optical nudge so the arrow looks centered */
}

@media (max-width: 600px) {
    .agent-panel { width: 100vw; }
    .agent-toggle-label { display: none; }
}

/* ── MAX agent panel: tabs, status line, history ────────────── */

.agent-tab-bar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px 0 12px;
    border-bottom: 1px solid var(--alice-border);
    flex-shrink: 0;
}
.agent-tab-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.agent-tab-panel.hidden { display: none; }

.agent-status {
    display: flex;
    align-items: center;
    gap: 8px;
}
.agent-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--alice-border);
    border-top-color: var(--alice-blue);
    border-radius: 50%;
    animation: agent-spin 0.9s linear infinite;
    display: inline-block;
    flex-shrink: 0;
}
@keyframes agent-spin { to { transform: rotate(360deg); } }
.agent-status-round {
    color: var(--alice-text-secondary);
    font-size: 0.78rem;
}

.agent-msg-chip {
    margin-top: 6px;
    padding: 2px 8px;
    font-size: 0.72rem;
    color: var(--alice-text-secondary);
    background: transparent;
    border-top: 1px dashed var(--alice-border);
    padding-top: 6px;
}

.agent-msg .lexia-link {
    color: var(--alice-blue);
    text-decoration: underline;
}

.agent-config-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}
.agent-config-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}
.agent-config-label {
    width: 110px;
    font-size: 0.8rem;
    color: var(--alice-text-secondary);
    flex-shrink: 0;
}
.agent-config-label--link {
    color: var(--link-color);
    text-decoration: none;
    cursor: pointer;
}
.agent-config-label--link:hover { text-decoration: underline; }

/* Friendly-redirect banner shown on the home page when /opus/{id}
   bounces a user back from an inaccessible/missing course. Tinted
   callout — themes via existing CSS variables. */
.home-notice {
    margin: 0 0 1rem;
    padding: 12px 16px;
    border: 1px solid var(--alice-border);
    border-left: 4px solid var(--alice-warning);
    border-radius: 6px;
    background: var(--alice-amber-tint);
    color: var(--alice-text);
    font-size: 0.92rem;
    line-height: 1.5;
}
.home-notice[data-kind="opus_missing"] {
    border-left-color: var(--alice-gray);
    background: var(--alice-gray-tint);
}

.agent-config-row .form-select,
.agent-config-row .form-input {
    flex: 1;
    min-width: 0;
}
.agent-config-orphan {
    margin: 10px 0;
    padding: 8px 12px;
    background: rgba(217,119,6,0.12);
    color: #b45309;
    border: 1px solid rgba(217,119,6,0.25);
    border-radius: 6px;
    font-size: 0.78rem;
}
.agent-config-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--alice-border);
}
.agent-config-header {
    padding: 8px 10px;
    margin-bottom: 10px;
    background: var(--alice-bg);
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--alice-text);
}
.agent-config-status { font-size: 0.78rem; color: var(--alice-text-secondary); }
.agent-config-status.ok  { color: #16a34a; }
.agent-config-status.err { color: #b00; }

.agent-viz-wrap {
    flex-shrink: 0;
    border-bottom: 1px solid var(--alice-border);
    background: var(--alice-bg);
}
.agent-viz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 10px;
    font-size: 0.72rem;
    color: var(--alice-text-secondary);
    border-bottom: 1px solid var(--alice-border);
}
.agent-viz-title {
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.agent-viz-close {
    background: none;
    border: none;
    color: var(--alice-text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 6px;
    line-height: 1;
}
.agent-viz-close:hover { color: var(--alice-text); }
.agent-viz-cy {
    width: 100%;
    height: 140px;
}

.agent-raw-json {
    flex: 1;
    overflow: auto;
    margin: 0;
    padding: 12px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--alice-text);
    background: var(--alice-bg);
    border: none;
}

.agent-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.agent-history-empty {
    color: var(--alice-text-secondary);
    font-style: italic;
    padding: 12px;
    text-align: center;
}
.agent-history-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    background: var(--alice-bg);
}
.agent-history-title {
    font-weight: 600;
    color: var(--alice-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.agent-history-pill {
    display: inline-block;
    padding: 1px 7px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-radius: 10px;
}
.agent-history-pill--opus {
    background: rgba(147, 51, 234, 0.12);
    color: #9333ea;
}
.agent-history-title:hover { text-decoration: underline; }
.agent-history-preview {
    color: var(--alice-text-secondary);
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.agent-history-meta {
    color: var(--alice-text-secondary);
    font-size: 0.72rem;
}
.agent-history-delete {
    align-self: flex-end;
    padding: 4px 10px;
    font-size: 0.78rem;
    background: transparent;
    color: var(--alice-text-secondary);
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    cursor: pointer;
}
.agent-history-delete:hover {
    background: var(--alice-bg);
    color: var(--alice-text);
}
/* Admin-only hard-delete variant. Tinted red so it never gets
   confused with the soft-delete (Hide) button next to it. */
.agent-history-hard-delete {
    margin-left: 6px;
    color: #b00;
    border-color: rgba(176, 0, 0, 0.35);
}
.agent-history-hard-delete:hover {
    background: rgba(176, 0, 0, 0.08);
    color: #b00;
}

/* Hidden threads: collapsed <details> bands below active threads. */
.agent-history-hidden {
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    background: transparent;
    font-size: 0.8rem;
    color: var(--alice-text-secondary);
}
.agent-history-hidden-summary {
    cursor: pointer;
    padding: 6px 10px;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.agent-history-hidden-summary::-webkit-details-marker { display: none; }
.agent-history-hidden-summary::before {
    content: '\25B6';
    font-size: 0.6rem;
    transition: transform 0.15s ease;
    display: inline-block;
    flex-shrink: 0;
}
.agent-history-hidden[open] > .agent-history-hidden-summary::before {
    transform: rotate(90deg);
}
.agent-history-hidden-body {
    padding: 6px 10px 10px;
    border-top: 1px dashed var(--alice-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.agent-history-unhide {
    align-self: flex-end;
    padding: 4px 10px;
    font-size: 0.78rem;
    background: transparent;
    color: var(--alice-blue);
    border: 1px solid var(--alice-blue);
    border-radius: 4px;
    cursor: pointer;
}
.agent-history-unhide:hover {
    background: var(--alice-blue);
    color: #fff;
}

/* ── Capstone cards (SPECS11) ───────────────────────────────── */

.capstone-card {
    border: 1px solid var(--alice-border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--alice-surface);
    transition: border-color 0.15s;
}

.capstone-card--active {
    border-color: var(--alice-blue);
    background: var(--alice-blue-tint);
}

.capstone-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.capstone-star {
    font-size: 1.3rem;
    color: var(--alice-amber);
    flex-shrink: 0;
}

.capstone-star--empty {
    color: var(--alice-text-secondary);
}

.capstone-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.capstone-card-tag {
    font-size: 0.82rem;
    color: var(--alice-text-secondary);
    margin: 0 0 10px 0;
}

.capstone-card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.capstone-active-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--alice-blue);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.btn-ghost {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--alice-text-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    text-decoration: underline;
}

.btn-ghost:hover { color: var(--alice-text); }

/* ── Syllabus (SPECS11) ─────────────────────────────────────── */

.syllabus-no-capstone {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--alice-text-secondary);
}

.syllabus-tag {
    display: block;
    font-size: 0.78rem;
    color: var(--alice-text-secondary);
    margin-top: 2px;
}

/* ── Map inline container (SPECS11) ─────────────────────────── */

.map-container-inline {
    width: 100%;
    height: 540px;
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    margin-top: 12px;
}

/* ── Category selector (SPECS11) ────────────────────────────── */

.category-selector {
    margin-bottom: 12px;
}

.category-selector__label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--alice-text-secondary);
    margin-bottom: 6px;
}

.category-selector__options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* ── Cytoscape map cursor (SPECS11) ─────────────────────────── */

#cy canvas {
    cursor: default;
}

/* ── Map controls bar ────────────────────────────────────────── */

.map-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.map-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--alice-text-secondary);
}
.legend-sep {
    color: var(--alice-border);
    font-size: 14px;
    margin: 0 2px;
}
.legend-icon {
    font-size: 16px;
    font-weight: bold;
    color: var(--alice-text);
    line-height: 1;
}

.map-ctrl-btns {
    display: flex;
    align-items: center;
    gap: 6px;
}

.map-ctrl-btn {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--alice-text-secondary);
    transition: border-color 0.12s, color 0.12s;
}

.map-ctrl-btn:hover {
    border-color: var(--alice-blue);
    color: var(--alice-text);
}

.map-ctrl-btn--active {
    background: var(--alice-blue-tint);
    border-color: var(--alice-blue);
    color: var(--alice-blue);
}

.map-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    background: none; border: none; cursor: pointer; padding: 0;
}
.map-toggle-label {
    font-size: 11px; font-weight: 600;
    color: var(--alice-text-secondary);
}
.map-toggle-track {
    display: inline-flex; align-items: center;
    width: 32px; height: 18px;
    background: var(--alice-border); border-radius: 9px;
    flex-shrink: 0; transition: background 0.2s;
    position: relative;
}
.map-toggle--on .map-toggle-track { background: var(--alice-blue); }
.map-toggle-thumb {
    position: absolute; left: 2px;
    width: 14px; height: 14px; border-radius: 50%;
    background: #fff; transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.map-toggle--on .map-toggle-thumb { left: 16px; }

.map-font-ctrl {
    display: inline-flex;
    border: 1px solid var(--alice-border);
    border-radius: 12px;
    overflow: hidden;
    background: var(--alice-surface);
}
.map-font-btn {
    width: 26px; height: 26px;
    border: none; background: none;
    cursor: pointer;
    font-size: 15px; font-weight: 600; line-height: 1;
    color: var(--alice-text-secondary);
    display: flex; align-items: center; justify-content: center;
}
.map-font-btn:hover { color: var(--alice-text); background: var(--alice-blue-tint); }
.map-font-btn + .map-font-btn { border-left: 1px solid var(--alice-border); }

/* ── EasyMDE overrides for ALICE theme ───────────────────────── */

.EasyMDEContainer {
    border-radius: var(--radius-md);
    border-color: var(--alice-border);
}

.EasyMDEContainer .CodeMirror {
    background: var(--alice-surface);
    color: var(--alice-text);
    border-color: var(--alice-border);
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 13px;
}

.EasyMDEContainer .editor-toolbar {
    background: var(--alice-bg);
    border-color: var(--alice-border);
}

.EasyMDEContainer .editor-toolbar button {
    color: var(--alice-text-secondary);
}

.EasyMDEContainer .editor-toolbar button:hover,
.EasyMDEContainer .editor-toolbar button.active {
    background: var(--alice-blue-tint);
    border-color: var(--alice-border);
    color: var(--alice-blue);
}

.EasyMDEContainer .editor-preview {
    background: var(--alice-surface);
    color: var(--alice-text);
    border-color: var(--alice-border);
}

/* ── Top navigation (SPECS12) ──────────────────────────────── */

.topnav {
    display: flex;
    align-items: stretch;
    height: 44px;
    background: var(--alice-surface);
    border-bottom: 1px solid var(--alice-border);
    z-index: 200;
    top: 0;
}

.topnav--locked {
    position: sticky;
    top: 0;
    z-index: 500;
    box-shadow: 0 1px 8px rgba(0,0,0,0.08);
}

.topnav-inner {
    display: flex;
    align-items: center;
    width: 100%;
    max-width: var(--content-max-width, 1200px);
    margin: 0 auto;
    padding: 0 16px;
    gap: 0;
    position: relative;
}

.topnav-wordmark {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--alice-text);
    text-decoration: none;
    margin-right: 24px;
    flex-shrink: 0;
}

.topnav-links {
    display: flex;
    align-items: stretch;
    flex: 1;
    gap: 0;
}

.nav-scroll-top {
    background: transparent;
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    color: var(--alice-text-secondary);
    cursor: pointer;
    line-height: 0;
    padding: 4px 8px;
    margin-right: 8px;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nav-scroll-top:hover {
    color: var(--alice-text);
    border-color: var(--alice-text-secondary);
}
.nav-scroll-top.hidden { display: none; }

.topnav-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
    font-size: 12px;
    color: var(--alice-text-secondary);
}

/* ── Burger category (collapsible, SPECS12) ───────────────── */

.burger-category {
    border-bottom: 1px solid var(--alice-border);
}

.burger-category:last-of-type { border-bottom: none; }

.burger-category-header {
    padding: 8px 16px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--alice-text-secondary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
}

.burger-category-header::-webkit-details-marker { display: none; }

.burger-category-header::after {
    content: '+';
    font-size: 13px;
    font-weight: 400;
    color: var(--alice-text-secondary);
    transition: transform 0.15s;
}

.burger-category[open] .burger-category-header::after {
    content: '\2212';
}

.burger-category-body {
    padding-bottom: 4px;
}

.burger-sublabel {
    padding: 4px 16px 2px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--alice-text-secondary);
}

/* ── Burger toggle (nav lock switch, SPECS12) ─────────────── */

.burger-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.burger-toggle-track {
    display: inline-flex;
    align-items: center;
    width: 32px;
    height: 18px;
    background: var(--alice-border);
    border-radius: 9px;
    flex-shrink: 0;
    transition: background 0.2s;
    position: relative;
}

.burger-toggle--on .burger-toggle-track {
    background: var(--alice-blue);
}

.burger-toggle-thumb {
    position: absolute;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.burger-toggle--on .burger-toggle-thumb {
    left: 16px;
}

/* ── Burger footer (SPECS12) ──────────────────────────────── */

.burger-footer {
    border-top: 1px solid var(--alice-border);
    padding-top: 4px;
    margin-top: 4px;
}

.burger-item--danger {
    color: var(--alice-warning);
}

.burger-item--active {
    font-weight: 700;
    color: var(--alice-blue);
}

/* ── Mobile: hide desktop nav links, show burger nav (SPECS12) ── */

@media (max-width: 640px) {
    .topnav-links { display: none; }
    .burger-category--mobile { display: block; }
}

@media (min-width: 641px) {
    .burger-category--mobile { display: none; }
}

/* ── Syllabus START/END row indicators (SPECS14) ───────────── */

.syllabus-row--capstone {
    background: rgba(239, 159, 39, 0.05);
}

.syllabus-row--start {
    background: rgba(29, 158, 117, 0.05);
}

.syllabus-start-mark {
    color: var(--alice-teal);
    font-size: 0.85rem;
    flex-shrink: 0;
}

.syllabus-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.syllabus-tag {
    display: block;
    font-size: 0.78rem;
    color: var(--alice-text-secondary);
    margin-top: 2px;
}

/* ── Pagina title bar (SPECS14) ──────────────────────────────── */

.pagina-title-bar {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--alice-border);
}

.pagina-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--alice-text);
    line-height: 1.2;
}

.pagina-title-link {
    color: inherit;
    text-decoration: none;
    border-bottom: 2px solid var(--alice-amber);
    padding-bottom: 1px;
}

.pagina-title-link:hover { color: var(--alice-blue); }

.pagina-subtitle {
    font-size: 0.85rem;
    color: var(--alice-text-secondary);
    margin: 0;
}

/* ── Content tab edit button (SPECS14) ───────────────────────── */

.pagina-content-actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

/* ── Assessment tab with survey (SPECS14) ────────────────────── */

.pagina-assess-content + .pagina-submission,
.pagina-assess-content + .survey-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--alice-border);
}

.survey-section--with-submission {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--alice-border);
}

/* ── Segmented progress bar (SPECS15) ──────────────────────── */

.progress-bar-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
    /* Smaller floor so the tab bar has room on a single row even
       on narrower viewports. The wrap still grows to fit its
       labels, but we keep them compact via the smaller font sizes
       below. */
    min-width: 140px;
    flex-shrink: 0;
}

.progress-bar-track {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--alice-bg);
    border: 1px solid var(--alice-border);
}

.progress-seg {
    height: 100%;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.progress-seg--graded    { background: var(--alice-teal); }
.progress-seg--submitted { background: var(--alice-amber); }
.progress-seg--read      { background: var(--alice-blue); }
.progress-seg--pending   { background: var(--alice-gray); }

.progress-labels {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 8px;
    white-space: nowrap;
}

.progress-label {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Each label color tracks its bar segment. Note that we use
   --alice-amber (NOT --alice-warning) for "submitted" so the label
   matches the bar segment colour in every theme — and crucially in
   tritanopia, where --alice-warning collapses to the same vermilion
   as --alice-blue (used by "read"), making the two columns
   indistinguishable. With --alice-amber the submitted label stays
   the reddish-purple #CC79A7 in trit, distinct from the read label. */
.progress-label--graded    { color: var(--alice-teal); }
.progress-label--submitted { color: var(--alice-amber); }
.progress-label--read      { color: var(--alice-blue); }
.progress-label--pending   { color: var(--alice-gray); }

.progress-label-text {
    font-size: 7px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.progress-label-sep {
    color: var(--alice-gray);
    font-size: 8px;
}

/* ── Tab bar row (tabs + progress on same line) ──────────────── */

.tab-bar-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 0;
    border-bottom: 1px solid var(--alice-border);
}

.tab-bar-progress {
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .progress-labels { display: none; }
    .progress-bar-track { height: 8px; }
    .progress-bar-wrap { min-width: 80px; }
}

/* ── Inline asset table (SPECS15) ──────────────────────────── */

.asset-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--alice-text-secondary);
    margin: 12px 0 8px 0;
    padding-top: 8px;
    border-top: 1px solid var(--alice-border);
}

.asset-inline-table {
    width: 100%;
    margin-bottom: 8px;
}

.asset-url-cell {
    max-width: 240px;
    overflow: hidden;
}

.asset-url-link {
    font-size: 11px;
    color: var(--alice-blue);
    word-break: break-all;
}

.asset-actions {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

.btn-ghost--danger {
    color: var(--alice-warning);
}

.btn-ghost--danger:hover {
    color: var(--alice-text);
    background: rgba(186, 117, 23, 0.08);
}

.asset-empty {
    font-size: 12px;
    color: var(--alice-text-secondary);
    font-style: italic;
    margin: 4px 0 8px 0;
}

.asset-add-details {
    margin-top: 8px;
}

.asset-add-summary {
    font-size: 12px;
    font-weight: 600;
    color: var(--alice-blue);
    cursor: pointer;
    padding: 4px 0;
    list-style: none;
    user-select: none;
}

.asset-add-summary::-webkit-details-marker { display: none; }

.asset-add-form {
    margin-top: 8px;
    padding: 12px;
    background: var(--alice-bg);
    border: 1px solid var(--alice-border);
    border-radius: 6px;
}

.asset-edit-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 16px;
}

.asset-editing {
    background: var(--alice-amber-tint);
}

/* ── Nuntius protected column (SPECS15) ────────────────────── */

.nuntius-col-protected {
    width: 80px;
    text-align: center;
}

.protected-check {
    color: var(--alice-teal);
    font-size: 1rem;
    font-weight: 700;
}

/* ── Admin collapsible sections ─────────────────────── */
.admin-section {
    margin: 8px 0;
}
.admin-section > summary {
    cursor: pointer;
    user-select: none;
    padding: 6px 0;
    list-style: none;
}
.admin-section > summary::-webkit-details-marker { display: none; }
.admin-section > summary h2,
.admin-section > summary h3 {
    font-size: 14px;
}
.admin-section > summary::before {
    content: '\25B6';
    display: inline-block;
    width: 16px;
    font-size: 10px;
    transition: transform 0.15s;
}
.admin-section[open] > summary::before {
    transform: rotate(90deg);
}

/* ── Reorder & action buttons right-aligned ─────────── */
.reorder-buttons {
    white-space: nowrap;
    text-align: right;
}
.admin-table .btn-ghost.btn-sm {
    padding: 2px 6px;
    font-size: 13px;
    min-width: 0;
}

/* ── Muted default-text column ──────────────────────── */
.text-muted {
    color: var(--alice-text-secondary);
    font-size: 12px;
}

/* ── Rubric editor (visual + JSON side by side) ─────── */
.rubric-editor {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 4px;
}
.rubric-editor-visual {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.rubric-band-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    background: var(--alice-bg);
}
.rubric-band-row-top {
    display: flex;
    align-items: center;
    gap: 4px;
}
.rubric-band-row .rubric-label {
    flex: 1;
}
.rubric-desc {
    width: 100%;
    font-size: 12px;
    padding: 4px 6px;
    resize: vertical;
}
.rubric-band-row input[type="number"] {
    width: 60px;
    padding: 4px;
    font-size: 12px;
}
.rubric-band-row input[type="text"] {
    flex: 1;
    padding: 4px;
    font-size: 12px;
}
.rubric-editor-json textarea {
    width: 100%;
    height: 100%;
    resize: vertical;
}

/* ── Inbox tabs (SPECS26) ───────────────────────────── */
.inbox-tab-bar {
    display: flex;
    flex-direction: row;
    gap: 4px;
    margin: 12px 0 0 0;
    border-bottom: 1px solid var(--alice-border);
}
.inbox-tab-bar .pagina-tab-btn {
    flex: 0 0 auto;
}
.inbox-panel--hidden {
    display: none;
}

/* ── Home inbox card (SPECS26) ──────────────────────── */
/* SPECS28 fix: Grading page assessment cards. Each item lives in
   its own card so the page reads as a stack of independent units. */
.grade-card {
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: 8px;
    padding: 18px 22px;
    margin-bottom: 18px;
}
.grade-card-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--alice-border);
}
.grade-card-title {
    margin: 0;
    font-size: 16px;
}
.grade-prompt,
.grade-response {
    margin-bottom: 14px;
}

/* Prompt and Response visual boxes on the grading page.
   Each gets a distinct background so the assessor can
   instantly tell what is the prompt vs. the nauta's work. */
.grade-prompt-box,
.grade-response-box {
    margin-bottom: 16px;
    border-radius: 6px;
    overflow: hidden;
}
.grade-section-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 6px 14px;
    margin: 0;
}
.grade-section-content {
    padding: 12px 14px;
    font-size: 14px;
    line-height: 1.6;
}
.grade-section-ts {
    float: right;
    font-size: 10px;
    font-weight: 400;
    opacity: 0.7;
}

/* Prompt: darker/muted background — this is reference material */
.grade-prompt-box .grade-section-label {
    background: var(--alice-bg);
    color: var(--alice-text-secondary);
    border-bottom: 1px solid var(--alice-border);
}
.grade-prompt-box .grade-section-content {
    background: var(--alice-surface);
    color: var(--alice-text);
    border: 1px solid var(--alice-border);
    border-top: none;
    border-radius: 0 0 6px 6px;
}

/* Response: surface background — the nauta's work */
.grade-response-box .grade-section-label {
    background: var(--alice-blue-tint);
    color: var(--alice-blue);
    border-bottom: 1px solid var(--alice-border);
}
.grade-response-box .grade-section-content {
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-top: none;
    border-radius: 0 0 6px 6px;
}

/* Previous feedback: teal header — assessor's prior comments */
.grade-feedback-box .grade-section-label {
    background: var(--alice-teal-tint);
    color: var(--alice-teal);
    border-bottom: 1px solid var(--alice-border);
}
.grade-feedback-box .grade-section-content {
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-top: none;
    border-radius: 0 0 6px 6px;
}

/* "Previous feedback" callout. Uses a left-border accent on the
   surface color (same as the rest of the card) so the text remains
   readable in every theme. The previous .feedback-block rule painted
   over text in dark mode. */
.grade-prior-feedback {
    margin: 14px 0;
}
.grade-prior-feedback-block {
    border-left: 3px solid var(--alice-blue);
    background: var(--alice-bg);
    color: var(--alice-text);
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 0 4px 4px 0;
}
.grade-prior-feedback-block p {
    margin: 0 0 4px 0;
}

/* SPECS28: Reusable inbox panel (used at home, opus, and pagina).
   The tab bar sits on the page background; only the table + pagination
   are wrapped in a card so the active tab visually attaches to it. */
.inbox-panel-component {
    margin: 1.5rem 0;
}
.inbox-panel-scope {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: var(--alice-text-secondary);
}
.inbox-content-card {
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-top: none;       /* the active tab supplies the top edge */
    border-radius: 0 0 8px 8px;
    padding: 16px 18px;
    margin-top: 0;          /* sit just below the tab bar so its
                               border-bottom remains visible as a
                               horizontal divider, except where the
                               active tab punches into it via -2px
                               margin-bottom on the button */
}
/* Bare-mode wrapper used when the macro is rendered inside an
   already-card panel (opus and pagina detail). No background or
   border — the outer panel supplies the card. */
.inbox-content-bare {
    margin: 0;
}
.inbox-table {
    margin-top: 0;
}
.inbox-sort-link {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}
.inbox-sort-link:hover {
    color: var(--alice-blue);
}
.inbox-pagination {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    justify-content: center;
}
.inbox-page-status {
    font-size: 12px;
    color: var(--alice-text-secondary);
    padding: 0 8px;
}
.inbox-page-disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
/* Sticky-top "assess in progress" rows: amber tint + accent stripe so
   an assessor's drafted-but-unfinalized work is impossible to miss
   among unclaimed pending-grade rows. */
.inbox-table tr.inbox-row-resume {
    background: var(--alice-amber-tint);
    box-shadow: inset 3px 0 0 var(--alice-amber);
}
.inbox-table tr.inbox-row-resume:hover {
    background: var(--alice-amber-tint);
    filter: brightness(0.97);
}
.inbox-table tr.inbox-row-resume .resume-hint {
    color: var(--alice-warning);
    font-weight: 600;
}

/* ── Student assessments (SPECS26) ──────────────────── */
.student-assessments {
    margin: 16px 0;
}
.assessment-card {
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    padding: 14px 16px;
    margin-bottom: 14px;
    background: var(--alice-bg);
}
.assessment-next-round-header {
    background: var(--alice-blue-tint);
    color: var(--alice-blue);
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 10px 16px;
    margin: 20px 0 14px 0;
    border-radius: 6px 6px 0 0;
    border: 1px solid var(--alice-border);
    border-bottom: none;
}
.assessment-card-head {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--alice-border);
    padding-bottom: 6px;
}
.assessment-title {
    margin: 0;
    font-size: 16px;
}
.assessment-slo {
    font-size: 12px;
}
.assessment-prompt {
    margin-bottom: 12px;
}
.assessment-form {
    margin-top: 8px;
}
.assessment-response-readonly,
.assessment-feedback {
    margin-top: 10px;
}
.feedback-block {
    border-left: 3px solid var(--alice-blue);
    padding: 6px 10px;
    margin-bottom: 8px;
    background: var(--alice-blue-tint);
}
.assessment-submit-all {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px solid var(--alice-border);
}

/* ── Per-opus default rubric editor ─────────────────── */
.rubric-default-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.rubric-default-table th,
.rubric-default-table td {
    padding: 4px 6px;
    text-align: left;
    border-bottom: 1px solid var(--alice-border);
}
.rubric-default-table th {
    font-weight: 600;
    color: var(--alice-text-secondary);
}
.rubric-default-table input[type="number"] {
    width: 50px;
    padding: 4px;
}
.rubric-default-table input[type="text"] {
    width: 100%;
    padding: 4px;
}

/* ── Item translation card ──────────────────────────── */
.item-lang-card {
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--alice-bg);
}
.item-lang-card-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 12px;
}
.item-lang-card-type {
    font-weight: 700;
    color: var(--alice-blue);
    background: var(--alice-blue-tint);
    border: 1px solid var(--alice-blue);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 10px;
}
.item-lang-card-slo {
    color: var(--alice-text-secondary);
}
.item-lang-default,
.item-lang-translated,
.item-lang-choices,
.item-lang-rubric {
    margin-bottom: 10px;
}
.default-prompt {
    font-size: 12px;
    color: var(--alice-text-secondary);
    background: var(--alice-bg);
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    padding: 6px 8px;
    white-space: pre-wrap;
    font-family: inherit;
    margin: 0;
}
.choices-trans-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.choices-trans-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.choice-default {
    min-width: 120px;
    font-size: 12px;
}
.rubric-trans-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.rubric-trans-table th,
.rubric-trans-table td {
    padding: 4px 8px;
    text-align: left;
    border-bottom: 1px solid var(--alice-border);
}
.rubric-trans-table th {
    font-weight: 600;
    color: var(--alice-text-secondary);
}

/* ── Choices editor (radio/checkbox items) ──────────── */
.choices-editor {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.choices-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.choice-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.choice-id {
    font-family: monospace;
    font-size: 11px;
    color: var(--alice-text-secondary);
    min-width: 28px;
}
.choice-row .form-input {
    flex: 1;
}
.choices-row.hidden { display: none; }

/* ── Compact rubric display in translation lists ────── */
.rubric-bands-mini {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}
.rubric-band-tag {
    font-size: 11px;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--alice-bg);
    border: 1px solid var(--alice-border);
}

/* ── Pagina-empty paragraph ─────────────────────────── */
.pagina-empty {
    font-size: 12px;
    color: var(--alice-text-secondary);
    font-style: italic;
    margin: 4px 0 8px 0;
}

/* ── BONUM panel (SPECS29) ──────────────────────────── */
.bonum-panel {
    margin: 1rem 0;
}
.bonum-empty {
    font-size: 13px;
    color: var(--alice-text-secondary);
    font-style: italic;
    padding: 16px 0;
}
.bonum-add-form {
    background: var(--alice-bg);
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.bonum-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.bonum-add-file {
    flex: 0 0 auto;
    font-size: 13px;
    color: var(--alice-text);
}
.bonum-add-title {
    flex: 1 1 200px;
    min-width: 0;
}
.bonum-add-desc {
    width: 100%;
}
.bonum-add-hint {
    margin: 0;
    font-size: 11px;
    color: var(--alice-text-secondary);
}
.bonum-group-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--alice-text-secondary);
    margin: 18px 0 6px 0;
    font-weight: 700;
}
.bonum-group-title:first-child {
    margin-top: 0;
}
.bonum-table {
    width: 100%;
    margin-bottom: 8px;
}
.bonum-link {
    color: var(--alice-blue);
    text-decoration: none;
    font-weight: 500;
}
.bonum-link:hover {
    text-decoration: underline;
}
.bonum-desc {
    font-size: 11px;
    color: var(--alice-text-secondary);
    margin-top: 2px;
    max-width: 480px;
}
.bonum-type-pill {
    display: inline-block;
    padding: 1px 7px;
    background: rgba(0, 85, 164, .12);
    color: var(--alice-blue);
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.bonum-actions {
    text-align: right;
    white-space: nowrap;
}
.bonum-pagina-link {
    color: var(--alice-blue);
    text-decoration: none;
    font-size: 12px;
}
.bonum-pagina-link:hover { text-decoration: underline; }
.bonum-pagina-opuswide {
    font-size: 11px;
    color: var(--alice-text-secondary);
    font-style: italic;
}

/* ── Admin summary cards (used by bonum/usage.html) ─── */
.admin-summary-row {
    display: flex;
    gap: 16px;
    margin: 16px 0 24px 0;
    flex-wrap: wrap;
}
.admin-summary-card {
    flex: 1 1 160px;
    min-width: 140px;
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    padding: 16px 20px;
}
.admin-summary-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--alice-text-secondary);
    margin-bottom: 6px;
}
.admin-summary-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--alice-text);
}
.admin-help {
    color: var(--alice-text-secondary);
    font-size: 13px;
    max-width: 720px;
    margin: 8px 0 16px 0;
}

/* ── Warning / danger buttons (admin destructive ops) ──
   Styled to match .btn-secondary (light bordered button) with
   amber/red accents on text + border, instead of solid fills.
   This keeps the action row visually consistent with the
   neutral Manage button while still signalling severity. */
.btn-warn {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    color: var(--alice-amber);
    background-color: var(--alice-surface);
    border: 1px solid var(--alice-amber);
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
    transition: background-color .15s;
}
.btn-warn:hover {
    background-color: var(--alice-amber-tint);
}
.btn-danger {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    font-size: 0.85rem;
    color: #c0392b;
    background-color: var(--alice-surface);
    border: 1px solid #c0392b;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font-family: inherit;
    transition: background-color .15s;
}
.btn-danger:hover {
    background-color: rgba(192, 57, 43, 0.08);
}
.btn-warn.btn-sm,
.btn-danger.btn-sm {
    padding: 0.25rem 0.65rem;
    font-size: 0.78rem;
}

/* ── Site footer (every page) ─────────────────────── */
.alice-footer {
    margin-top: 48px;
    padding: 16px 0;
    border-top: 1px solid var(--alice-border);
    background: var(--alice-bg);
    color: var(--alice-text-secondary);
    font-size: 12px;
}
.alice-footer__inner {
    max-width: var(--content-max-width, 960px);
    margin: 0 auto;
    padding: 0 16px;
    text-align: center;
}

/* ── Admin opus list: visually separate destructive column ──
   Constructive actions (Manage) sit in their own narrow column;
   destructive actions (Archive, Delete) live in the rightmost
   column, marked with a thick left border and a faint warning
   tint so a careless cursor can't accidentally drift across the
   boundary. */
.opus-admin-table th.opus-destructive-col,
.opus-admin-table td.opus-destructive-col {
    border-left: 3px double #c0392b;
    background: rgba(192, 57, 43, 0.04);
    padding-left: 14px;
}
.opus-admin-table th.opus-destructive-col {
    color: #c0392b;
}

/* ── Opus delete modal (SPECS-admin destructive) ── */
.opus-delete-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.opus-delete-modal.hidden {
    display: none;
}
.opus-delete-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}
.opus-delete-modal__box {
    position: relative;
    background: var(--alice-surface);
    color: var(--alice-text);
    border: 2px solid var(--alice-warning, #c0392b);
    border-radius: 8px;
    padding: 24px 28px;
    max-width: 540px;
    width: calc(100% - 32px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    max-height: 90vh;
    overflow-y: auto;
}

/* ── Dense N×N matrix grids on /admin/opus/{id}/matrix ──
   Each matrix is wrapped in a bordered scroll container, with
   explicit visible gridlines so every cell is clearly delimited. */
.matrix-grid-wrap {
    overflow-x: auto;
    margin-bottom: 12px;
    border: 2px solid #888780;
    border-radius: 6px;
    background: var(--alice-surface);
    padding: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.matrix-grid {
    border-collapse: collapse;
    font-size: 11px;
    font-family: var(--font-sans);
    border: 1px solid #888780;
}
.matrix-grid th,
.matrix-grid td {
    border: 1px solid #b8b8b0;
    padding: 3px 6px;
    text-align: center;
    min-width: 32px;
    height: 22px;
    white-space: nowrap;
}
.matrix-grid thead th,
.matrix-grid tbody th {
    background: var(--alice-bg);
    color: var(--alice-text-secondary);
    font-weight: 600;
    border-color: #888780;
    position: sticky;
    z-index: 1;
}
.matrix-grid thead th { top: 0; }
.matrix-grid tbody th { left: 0; }
.matrix-corner {
    z-index: 2 !important;
    top: 0;
    left: 0;
}
.matrix-cell-set {
    background: var(--alice-blue-tint);
    color: var(--alice-blue);
    font-weight: 600;
}
.matrix-cell-diag {
    background: var(--alice-bg);
    color: var(--alice-text-secondary);
}
.matrix-cell-inf {
    color: #a8a6a0;
    background: var(--alice-surface);
    font-style: italic;
}
.matrix-flat-details {
    margin: 0 0 24px 0;
}
.matrix-flat-details summary {
    cursor: pointer;
    color: var(--alice-text-secondary);
    font-size: 12px;
    padding: 4px 0;
    user-select: none;
}
.matrix-flat-details summary:hover {
    color: var(--alice-blue);
}
.matrix-flat-details[open] summary {
    margin-bottom: 8px;
}

/* ── Chorus membership dual-pane ──────────────────── */
.chorus-dual-pane {
    display: flex;
    gap: 0;
    margin-top: 16px;
    align-items: flex-start;
}
.chorus-pane {
    flex: 1 1 0;
    min-width: 0;
}
.chorus-pane h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--alice-text-secondary);
}
.chorus-table-scroll {
    max-height: 480px;
    overflow-y: auto;
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    background: var(--alice-surface);
}
.chorus-table-scroll .admin-table {
    margin: 0;
    font-size: 12px;
}
.chorus-actions-col {
    flex: 0 0 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 0 8px;
    min-height: 200px;
}
.chorus-action-btn {
    width: 80px;
    text-align: center;
}
.chorus-sortable {
    cursor: pointer;
    user-select: none;
}
.chorus-sortable:hover {
    color: var(--alice-blue);
}
@media (max-width: 768px) {
    .chorus-dual-pane { flex-direction: column; }
    .chorus-actions-col {
        flex-direction: row;
        min-height: auto;
        padding: 8px 0;
    }
}

/* ── Grading summary (assessor, Received tab) ────── */
.grading-summary {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--alice-border);
}
.grading-summary-table {
    width: auto;
    min-width: 320px;
    font-size: 13px;
}
.grading-badge {
    display: inline-block;
    min-width: 22px;
    text-align: center;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 12px;
}
.grading-badge--ungraded {
    background: var(--alice-amber);
    color: #1a1a1a;
}
.grading-badge--zero {
    color: var(--alice-text-secondary);
}
.grading-filter-note {
    font-size: 12px;
    color: var(--alice-text-secondary);
    margin: 8px 0 0 0;
    font-style: italic;
}

/* ── Global in-app confirm modal ──────────────────── */
.alice-confirm {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.alice-confirm.hidden { display: none; }
.alice-confirm__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.alice-confirm__box {
    position: relative;
    background: var(--alice-surface);
    color: var(--alice-text);
    border: 1px solid var(--alice-border);
    border-radius: 8px;
    padding: 24px 28px;
    max-width: 420px;
    width: calc(100% - 32px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}
.alice-confirm__box p {
    margin: 0 0 16px 0;
    font-size: 14px;
    line-height: 1.5;
}
.alice-confirm__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Assessor dashboard (Home page) ───────────────── */
.assessor-dashboard {
    margin: 16px 0 24px 0;
    background: var(--alice-surface);
    border: 1px solid var(--alice-border);
    border-radius: 6px;
    overflow: hidden;
}
.assessor-dashboard__header {
    background: var(--alice-teal-tint);
    color: var(--alice-teal);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 10px 16px;
    border-bottom: 1px solid var(--alice-border);
}
.assessor-dashboard .admin-table {
    margin: 0;
    font-size: 13px;
}

/* ── Chorus selector (title-level dropdown) ──────── */
.title-chorus-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.title-chorus-row h1 {
    margin: 0;
}
.chorus-selector-form {
    flex-shrink: 0;
    margin: 0;
}
.chorus-selector-select {
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid var(--alice-border);
    border-radius: 4px;
    background: var(--alice-surface);
    color: var(--alice-text);
    cursor: pointer;
    font-family: inherit;
}
.chorus-selector-badge {
    font-size: 12px;
    padding: 3px 10px;
    border: 1px solid var(--alice-border);
    border-radius: 10px;
    background: var(--alice-bg);
    color: var(--alice-text-secondary);
    white-space: nowrap;
}
.chorus-role-line {
    font-size: 11px;
    color: var(--alice-text-secondary);
    margin-top: 4px;
    line-height: 1.4;
}
.chorus-role-line strong {
    color: var(--alice-text);
    font-weight: 600;
}
