/* assets/css/app.css — small supplements to the Tailwind utility classes */

/* ---------------------------------------------------------------------
 * EduLink UI Modernization Blueprint — Phase 2.2 / Phase 4
 * Semantic design tokens as CSS custom properties. tailwind.config.js
 * maps colors like `primary`, `app-body`, `surface`, `heading`, `body`,
 * `muted`, `sidebar`, `success`/`warning`/`danger`/`info` straight to
 * these variables, so a page written with e.g. bg-surface text-heading
 * automatically repaints correctly in dark mode — no dark: variant
 * needed on that page. Dark values live under html.dark (Tailwind
 * darkMode:'class', toggled by the theme control in includes/header.php
 * and persisted to localStorage under "edulink_theme").
 * ------------------------------------------------------------------- */
:root {
  /* ===================================================================
   * "Calm UI" design system (u213-819) — THE site-wide token layer.
   *
   * Canonical tokens (blueprint section 1.2). Every colour on the site
   * comes from here; page CSS, templates and scripts reference these
   * tokens (or the legacy aliases below), never a literal colour.
   * Light values follow the blueprint's reference palette. One
   * documented deviation: the reference action blue #1877F2 measures
   * 4.23:1 on white and 3.78:1 on the page background (fails WCAG AA for
   * 14-15px text), so --ed-action uses #1467D6 (5.33:1 on white, 4.75:1
   * on #F0F2F5). See private/docs/design/calm-ui-tokens.md.
   * =================================================================== */
  --ed-text-primary:     #1C1E21;  /* 14.9:1 on the page background */
  --ed-text-secondary:   #65676B;  /* 5.67:1 on white, 5.05:1 on the page */
  --ed-page-background:  #F0F2F5;
  --ed-surface:          #FFFFFF;
  --ed-action:           #1467D6;  /* deviation from #1877F2 for AA contrast */
  --ed-action-hover:     #0B5FCC;
  --ed-on-action:        #FFFFFF;  /* text/icon on a solid --ed-action fill */
  --ed-action-tint:      #E7F3FF;  /* selected nav row, brand note background */
  --ed-hairline:         #DADDE1;
  --ed-neutral-fill:     #E4E6EB;  /* secondary buttons, neutral status, tracks */
  --ed-neutral-fill-hover: #D8DADF;
  --ed-focus:            #1467D6;
  --ed-focus-ring:       0 0 0 3px rgba(20, 103, 214, 0.30);
  --ed-positive:         #0F7B3E;  /* 5.35:1 on white */
  --ed-positive-bg:      #E8F5EC;
  --ed-negative:         #B3261E;  /* 6.54:1 on white */
  --ed-negative-bg:      #FDECEA;
  --ed-caution:          #8A5300;  /* 6.33:1 on white */
  --ed-caution-bg:       #FFF4E0;
  --ed-info-fg:          #0B5FCC;
  --ed-info-surface:     #E7F3FF;
  --ed-overlay-shadow:   0 8px 24px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.06);
  --ed-accent-purple:    #6B3FD4;  /* Plan Analytics action only (legacy semantic) */
  --ed-accent-purple-hover: #5A31BD;

  /* RGB channel tokens: let Tailwind colour names carry opacity modifiers
     (e.g. border-urgent/20) while still following the theme. */
  --ed-rgb-text-primary: 28 30 33;
  --ed-rgb-text-secondary: 101 103 107;
  --ed-rgb-page: 240 242 245;
  --ed-rgb-surface: 255 255 255;
  --ed-rgb-hairline: 218 221 225;
  --ed-rgb-action: 20 103 214;
  --ed-rgb-brand-25: 245 249 255;   /* light brand tints, theme-aware (brand-25 / -50 / -100 utilities) */
  --ed-rgb-brand-50: 231 243 255;
  --ed-rgb-brand-100: 207 227 255;
  --ed-rgb-positive: 15 123 62;
  --ed-rgb-positive-bg: 232 245 236;
  --ed-rgb-caution: 138 83 0;
  --ed-rgb-caution-bg: 255 244 224;
  --ed-rgb-negative: 179 38 30;
  --ed-rgb-negative-bg: 253 236 234;

  /* Type and space (blueprint 1.2) — referenced by the calm components. */
  --ed-font-sans: Arial, Helvetica, system-ui, sans-serif;
  --ed-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --ed-space-1: 4px;  --ed-space-2: 8px;  --ed-space-3: 12px; --ed-space-4: 16px;
  --ed-space-5: 24px; --ed-space-6: 32px; --ed-space-7: 40px;
  --ed-radius-control: 8px;
  --ed-radius-surface: 12px;
  --ed-width-reading: 760px;
  --ed-width-work: 1160px;
  --ed-motion: 150ms;

  /* ---- Legacy aliases (u213_818 and earlier token names) ----------
   * Kept so every existing var(--ed-*) consumer and every token-backed
   * Tailwind class keeps resolving. They point at the canonical tokens;
   * never give an alias its own literal value again. */
  --ed-primary:          var(--ed-action);
  --ed-primary-hover:    var(--ed-action-hover);
  --ed-on-accent:        var(--ed-on-action);
  --ed-body-bg:          var(--ed-page-background);
  --ed-sidebar-bg:       var(--ed-surface);
  --ed-sidebar-active:   var(--ed-action-tint);
  --ed-card-bg:          var(--ed-surface);
  --ed-border:           var(--ed-hairline);
  --ed-divider:          var(--ed-hairline);
  --ed-input-border:     #CCD0D5;
  --ed-heading:          var(--ed-text-primary);
  --ed-body-text:        var(--ed-text-primary);
  --ed-muted-text:       var(--ed-text-secondary);
  --ed-placeholder:      #8A8D91;
  --ed-success:          var(--ed-positive);
  --ed-success-bg:       var(--ed-positive-bg);
  --ed-success-hover:    #0B6332;
  --ed-warning:          var(--ed-caution);
  --ed-warning-bg:       var(--ed-caution-bg);
  --ed-danger:           var(--ed-negative);
  --ed-danger-bg:        var(--ed-negative-bg);
  --ed-info:             var(--ed-info-fg);
  --ed-info-bg:          var(--ed-info-surface);
  --ed-purple:           var(--ed-accent-purple);
  --ed-purple-hover:     var(--ed-accent-purple-hover);
  --ed-primary-tint:     var(--ed-action-tint);
  --ed-primary-soft:     #CFE3FF;
  --ed-subtle-bg:        var(--ed-neutral-fill);
  --ed-shadow-xs:        none;                       /* calm: no persistent shadows */
  --ed-shadow-lg:        var(--ed-overlay-shadow);   /* overlays only */
  --ed-advanced-col-bg:  #F2F7FF;
  --ed-muted:            var(--ed-text-secondary);   /* older page fallbacks read --ed-muted */
  --ed-text-muted:       var(--ed-text-secondary);

  /* Categorical data-visualisation series (charts with several series only; a single
   * series uses --ed-action). Every series also carries a label / legend text. */
  --ed-viz-1: #1467D6; --ed-viz-2: #6B3FD4; --ed-viz-3: #0F7B3E; --ed-viz-4: #B26A00;
  --ed-viz-5: #B3261E; --ed-viz-6: #0B7A8A; --ed-viz-7: #B0306A; --ed-viz-8: #65676B;

  /* u213-822 — the Schoolwork report header band (Learning Needs view only). Measured: text 10.87:1, muted 7.59:1 on
   * the band; the current tab text on the page background 9.69:1. */
  --ed-report-band:         #083B7D;
  --ed-report-band-text:    #FFFFFF;
  --ed-report-band-muted:   #C7D9F5;
  --ed-report-band-current: #083B7D;
}

html.dark {
  --ed-text-primary:     #E4E6EB;
  --ed-text-secondary:   #B0B3B8;  /* 7.3:1 on the dark surface */
  --ed-page-background:  #18191A;
  --ed-surface:          #242526;
  --ed-action:           #4599FF;  /* 5.3:1 on the dark surface */
  --ed-action-hover:     #6FB1FF;
  --ed-on-action:        #18191A;  /* dark text on the lighter dark-mode accent (6.08:1) */
  --ed-action-tint:      rgba(69, 153, 255, 0.10);  /* 0.10 keeps action text on it at 4.56:1 */
  --ed-hairline:         #3E4042;
  --ed-neutral-fill:     #3A3B3C;
  --ed-neutral-fill-hover: #4E4F50;
  --ed-focus:            #6FB1FF;
  --ed-focus-ring:       0 0 0 3px rgba(111, 177, 255, 0.40);
  --ed-positive:         #4CC07A;
  --ed-positive-bg:      rgba(76, 192, 122, 0.16);
  --ed-negative:         #FF7B72;
  --ed-negative-bg:      rgba(255, 123, 114, 0.16);
  --ed-caution:          #F2B04A;
  --ed-caution-bg:       rgba(242, 176, 74, 0.16);
  --ed-info-fg:          #6FB1FF;
  --ed-info-surface:     rgba(69, 153, 255, 0.10);
  --ed-overlay-shadow:   0 8px 24px rgba(0, 0, 0, 0.50), 0 1px 2px rgba(0, 0, 0, 0.30);
  --ed-accent-purple:    #B79AF5;
  --ed-accent-purple-hover: #C9B3F8;
  --ed-rgb-text-primary: 228 230 235;
  --ed-rgb-text-secondary: 176 179 184;
  --ed-rgb-page: 24 25 26;
  --ed-rgb-surface: 36 37 38;
  --ed-rgb-hairline: 62 64 66;
  --ed-rgb-action: 69 153 255;
  --ed-rgb-brand-25: 33 37 43;      /* the light tints composed over the dark surface */
  --ed-rgb-brand-50: 39 49 60;
  --ed-rgb-brand-100: 45 70 99;
  --ed-rgb-positive: 76 192 122;
  --ed-rgb-positive-bg: 30 52 39;
  --ed-rgb-caution: 242 176 74;
  --ed-rgb-caution-bg: 58 46 26;
  --ed-rgb-negative: 255 123 114;
  --ed-rgb-negative-bg: 61 35 33;
  --ed-input-border:     #4E4F50;
  --ed-placeholder:      #8A8D91;
  --ed-success-hover:    #6CD493;
  --ed-primary-soft:     rgba(69, 153, 255, 0.28);
  --ed-advanced-col-bg:  rgba(69, 153, 255, 0.10);
  --ed-viz-1: #4599FF; --ed-viz-2: #B79AF5; --ed-viz-3: #4CC07A; --ed-viz-4: #F2B04A;
  --ed-viz-5: #FF7B72; --ed-viz-6: #3FC1D0; --ed-viz-7: #F07AB0; --ed-viz-8: #B0B3B8;
  /* u213-822 — report header band, dark: text 10.31:1, muted 7.78:1 on the band; current tab text 14.10:1 on the page. */
  --ed-report-band:         #13325A;
  --ed-report-band-text:    #E4E6EB;
  --ed-report-band-muted:   #B5CBEA;
  --ed-report-band-current: #E4E6EB;
  /* Legacy aliases restated for the dark theme (same targets as :root — they resolve to the dark canonical tokens
   * above; restated so every alias is explicitly defined in both themes). */
  --ed-primary: var(--ed-action);
  --ed-primary-hover: var(--ed-action-hover);
  --ed-on-accent: var(--ed-on-action);
  --ed-body-bg: var(--ed-page-background);
  --ed-sidebar-bg: var(--ed-surface);
  --ed-sidebar-active: var(--ed-action-tint);
  --ed-card-bg: var(--ed-surface);
  --ed-border: var(--ed-hairline);
  --ed-divider: var(--ed-hairline);
  --ed-heading: var(--ed-text-primary);
  --ed-body-text: var(--ed-text-primary);
  --ed-muted-text: var(--ed-text-secondary);
  --ed-success: var(--ed-positive);
  --ed-success-bg: var(--ed-positive-bg);
  --ed-warning: var(--ed-caution);
  --ed-warning-bg: var(--ed-caution-bg);
  --ed-danger: var(--ed-negative);
  --ed-danger-bg: var(--ed-negative-bg);
  --ed-info: var(--ed-info-fg);
  --ed-info-bg: var(--ed-info-surface);
  --ed-purple: var(--ed-accent-purple);
  --ed-purple-hover: var(--ed-accent-purple-hover);
  --ed-primary-tint: var(--ed-action-tint);
  --ed-subtle-bg: var(--ed-neutral-fill);
  --ed-shadow-xs: none;
  --ed-shadow-lg: var(--ed-overlay-shadow);
  --ed-muted: var(--ed-text-secondary);
  --ed-text-muted: var(--ed-text-secondary);
}

html.dark body { color-scheme: dark; }

/* ---------------------------------------------------------------------
 * Phase 1 — shared "ed-" component classes (EduLink visual system)
 * Plain CSS (not @apply): app.css is loaded as-is via <link>, with no
 * PostCSS/Tailwind build step processing it today, so these mirror the
 * equivalent Tailwind utilities in raw CSS. The same class names are
 * also defined with @apply in assets/css/src/tailwind.css for the
 * production Tailwind CLI build (see package.json) — keep both in sync
 * if you change one.
 * ------------------------------------------------------------------- */

.ed-page-shell {
  max-width: 80rem;      /* max-w-7xl */
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}
@media (min-width: 640px) {
  .ed-page-shell { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 1024px) {
  .ed-page-shell { padding-left: 2rem; padding-right: 2rem; }
}

.ed-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--ed-heading);
  letter-spacing: -0.01em;
}

.ed-card {
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 16px;       /* "Claude.ai Visual System" pass: slightly softer than the prior 14px */
  box-shadow: none;
  padding: 1.25rem;          /* p-5 */
  color: var(--ed-body-text);
}

/* "Two-Tab Plan Page" blueprint — Section 5/11. Reusable two-tab (or
   more) navigation component: .ed-tabs is the row, .ed-tab each link,
   .ed-tab-active the current one, .ed-tab-count an optional trailing
   badge. Uses semantic tokens (not fixed colors) so it stays correct
   in light/dark mode. Both tabs remain visible and equal-width on
   mobile (Section 5 "Mobile behavior") — no dropdown collapse. */
.ed-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--ed-border);
}
.ed-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex: 1 1 0;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ed-muted-text);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.ed-tab:hover { color: var(--ed-heading); background: var(--ed-body-bg); }
.ed-tab-active,
.ed-tab-active:hover {
  color: var(--ed-primary);
  border-bottom-color: var(--ed-primary);
  background: transparent;
}
.ed-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--ed-body-bg);
  color: var(--ed-muted-text);
}
.ed-tab-active .ed-tab-count { background: color-mix(in srgb, var(--ed-primary) 15%, var(--ed-card-bg)); color: var(--ed-primary); }
@media (max-width: 640px) {
  .ed-tab { padding: 0.75rem 0.5rem; font-size: 0.8125rem; }
}

.ed-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.875rem;
  margin-bottom: 0.875rem;
  border-bottom: 1px solid var(--ed-border);
}
.ed-card-header h3 { font-size: 0.9375rem; font-weight: 600; color: var(--ed-heading); }
.ed-card-header p { font-size: 0.8125rem; color: var(--ed-muted-text); margin-top: 2px; }

.ed-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--ed-primary);
  color: var(--ed-on-accent);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 10px;      /* Phase 2.1: button radius 8-10px */
  border: none;
  cursor: pointer;
  transition: background-color .15s ease;
}
.ed-btn-primary:hover { background: var(--ed-primary-hover); }
.ed-btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.ed-btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--ed-card-bg);
  color: var(--ed-body-text);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 9px;
  border: 1px solid var(--ed-border);
  cursor: pointer;
  transition: background-color .15s ease;
}
.ed-btn-secondary:hover { background: var(--ed-body-bg); }
.ed-btn-secondary:disabled { opacity: .6; cursor: not-allowed; }

.ed-btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: var(--ed-card-bg);
  color: var(--ed-danger);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--ed-danger-bg);
  cursor: pointer;
  transition: background-color .15s ease;
}
.ed-btn-danger:hover { background: var(--ed-danger-bg); }

/* ---------------------------------------------------------------------
 * "Analytics Button Colors and Skill Analysis Removal" blueprint —
 * Phase 1. Three action-specific button colors for the row-level
 * analytics links added by the "Clickable Student Analytics Rows"
 * blueprint (§0.12 of the codebase summary) — Plan/Roadmap, Plan
 * Analytics, and Certificate previously all shared the generic
 * .ed-btn-secondary class (white/card-colored background), which
 * made three different destinations visually indistinguishable and
 * used a white background the blueprint explicitly disallows for
 * these three. Same shape/sizing as .ed-btn-primary (solid color,
 * white text, no white background anywhere) — only the color+token
 * differs per action, and the same class is used on both
 * includes/analytics-dashboard-view.php and
 * includes/quiz-history-table-view.php so the same action is always
 * the same color everywhere it appears, desktop and mobile alike.
 * ------------------------------------------------------------------- */
.ed-btn-roadmap,
.ed-btn-plan-analytics,
.ed-btn-certificate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  color: var(--ed-on-accent);
  font-weight: 600;
  padding: 0.625rem 1rem;
  border-radius: 10px;      /* Phase 2.1: button radius 8-10px, same as every other .ed-btn-* */
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.ed-btn-roadmap:disabled,
.ed-btn-plan-analytics:disabled,
.ed-btn-certificate:disabled { opacity: .6; cursor: not-allowed; }
/* Phase 1's "visible focus ring" — none of the other .ed-btn-* classes
   define one of their own (they rely on the browser default), but
   these three are new enough, and used densely enough in a table/card
   list, to make it explicit rather than assume the default outline is
   enough against a solid color background. */
.ed-btn-roadmap:focus-visible,
.ed-btn-plan-analytics:focus-visible,
.ed-btn-certificate:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 2px;
}

.ed-btn-roadmap {
  background: var(--ed-primary);
  border-color: var(--ed-primary);
}
.ed-btn-roadmap:hover { background: var(--ed-primary-hover); border-color: var(--ed-primary-hover); }

.ed-btn-plan-analytics {
  background: var(--ed-purple);
  border-color: var(--ed-purple);
}
.ed-btn-plan-analytics:hover { background: var(--ed-purple-hover); border-color: var(--ed-purple-hover); }

.ed-btn-certificate {
  background: var(--ed-success);
  border-color: var(--ed-success);
}
.ed-btn-certificate:hover { background: var(--ed-success-hover); border-color: var(--ed-success-hover); }

.ed-input, .ed-select {
  width: 100%;
  border: 1px solid var(--ed-border);
  border-radius: 9px;       /* Phase 2.1: input radius 8-10px */
  padding: 0.625rem 1rem;
  background: var(--ed-body-bg);
  font-size: 0.875rem;
  color: var(--ed-heading);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ed-input:focus, .ed-select:focus {
  border-color: var(--ed-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ed-primary) 16%, transparent);
  background: var(--ed-card-bg);
}
.ed-input:disabled, .ed-select:disabled { opacity: .6; cursor: not-allowed; }

.ed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  letter-spacing: normal;
}
.ed-badge-brand    { background: var(--ed-info-bg); color: var(--ed-info); }
.ed-badge-success  { background: var(--ed-success-bg); color: var(--ed-success); }
.ed-badge-warning  { background: var(--ed-warning-bg); color: var(--ed-warning); }
.ed-badge-danger   { background: var(--ed-danger-bg); color: var(--ed-danger); }
.ed-badge-neutral  { background: var(--ed-body-bg); color: var(--ed-muted-text); border: 1px solid var(--ed-border); }

/* "Syllabus Learning Relationships Control Center" blueprint, Parts
   18-20 — direction-coded text for relationship-line targets
   (assets/js/syllabus-learning-relationships.js's own DIRECTION map).
   Backward (review/prerequisite) reuses the warning tone, forward
   (next/challenge) reuses the success tone, lateral (practice) reuses
   the info tone — same three-token palette every other status badge
   in this app already draws from, just applied as text color rather
   than a filled pill here since these sit inline next to a quiz title. */
.syl-lr-dir-back    { color: var(--ed-warning); font-weight: 600; }
.syl-lr-dir-forward { color: var(--ed-success); font-weight: 600; }
.syl-lr-dir-lateral { color: var(--ed-info); font-weight: 600; }

/* Blueprint: "Question-by-Question Quiz Progress Sidebar" (u213_400
   follow-up) — the Learning Path sidebar's expandable per-Question
   tracker for the CURRENT Quiz
   (assets/js/syllabus-learning-runtime.js's
   renderQuizQuestionsTracker()). Every rule below is presentation
   only, driven entirely by the server's own quiz_progress[].status
   (build_syllabus_learning_quiz_progress(),
   private/includes/syllabus-learning-runtime.php) — reuses the SAME
   three-token success/danger/warning/info palette every other status
   surface in this app draws from (see .syl-lr-dir-* just above,
   .ed-badge-* above that), no new colors introduced. Color is never
   the only signal for the current row: it also gets a distinct icon
   (●) and an explicit "Current" text tag, so this remains legible
   under a color-vision deficiency or in print/grayscale. */
.syl-q-progress-toggle {
  display: flex; align-items: center; gap: 0.3rem; width: 100%;
  text-align: left; font-size: 13px; font-weight: 600;
  color: var(--ed-body-text); padding: 0.125rem 0; background: none; border: 0;
}
.syl-q-progress-toggle:hover { color: var(--ed-primary); }
.syl-q-progress-summary {
  font-size: 13px; color: var(--ed-muted-text); margin: 0.125rem 0 0.375rem;
}
.syl-q-progress-bar-track {
  height: 6px; border-radius: 999px; background: var(--ed-body-bg);
  border: 1px solid var(--ed-border); overflow: hidden; margin-bottom: 0.5rem;
}
.syl-q-progress-bar-fill {
  height: 100%; background: var(--ed-primary); border-radius: 999px;
  transition: width 150ms ease;
}
.syl-q-progress-list {
  max-height: 220px; overflow-y: auto; display: flex; flex-direction: column;
  gap: 2px; padding-right: 2px;
}
.syl-q-progress-row {
  display: flex; align-items: center; gap: 0.375rem;
  font-size: 13px; line-height: 1.2; border-radius: 6px;
  padding: 0.25rem 0.375rem; border: 1px solid transparent;
  color: var(--ed-body-text);
}
.syl-q-progress-icon   { flex-shrink: 0; width: 1rem; text-align: center; font-weight: 600; }
.syl-q-progress-label  { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.syl-q-progress-current-tag {
  flex-shrink: 0; font-size: 13px; font-weight: 600; text-transform: none;
  letter-spacing: normal; color: var(--ed-on-accent); background: var(--ed-primary);
  border-radius: 999px; padding: 0.0625rem 0.375rem;
}
.syl-q-progress-correct    { background: var(--ed-success-bg); border-color: var(--ed-success); color: var(--ed-success); }
.syl-q-progress-incorrect  { background: var(--ed-danger-bg);  border-color: var(--ed-danger);  color: var(--ed-danger); }
.syl-q-progress-current    { background: var(--ed-info-bg);    border-color: var(--ed-primary); color: var(--ed-primary); font-weight: 600; }
.syl-q-progress-unanswered { background: transparent;          border-color: var(--ed-border);  color: var(--ed-muted-text); }
/* A blank/empty submitted answer (build_syllabus_learning_quiz_
   progress()'s 'skipped' status — grade_single_syllabus_learning_
   question()'s pre-existing is_skipped flag, previously collapsed into
   'incorrect' for display only). Amber, distinct from red, per the
   blueprint's own status table. */
.syl-q-progress-skipped    { background: var(--ed-warning-bg); border-color: var(--ed-warning); color: var(--ed-warning); }
.syl-q-progress-quiz-complete-badge {
  display: inline-flex; align-items: center; gap: 0.1875rem; font-size: 13px;
  font-weight: 600; color: var(--ed-success);
}

/* "Analytics TailAdmin Visual Update" pass — icon-chip KPI card +
 * trend badge, extended site-wide to any stat-card row that wants it
 * (see student/dashboard.php, teacher/dashboard.php,
 * includes/analytics-overview-view.php). */
.ed-kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 12px;
  background: var(--ed-body-bg);
  color: var(--ed-primary);
  font-size: 1.05rem;
}
.ed-change-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.55rem;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
}
.ed-change-up   { background: var(--ed-success-bg); color: var(--ed-success); }
.ed-change-down { background: var(--ed-danger-bg);  color: var(--ed-danger); }

/* Phase 7.5 — empty states */
.ed-empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--ed-muted-text);
}
.ed-empty-state .ed-empty-icon {
  width: 48px; height: 48px; margin: 0 auto 0.75rem;
  border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ed-body-bg);
  color: var(--ed-muted-text);
  font-size: 1.25rem;
}
.ed-empty-state h4 { font-size: 0.9375rem; font-weight: 600; color: var(--ed-heading); margin-bottom: 0.25rem; }
.ed-empty-state p { font-size: 0.8125rem; max-width: 26rem; margin: 0 auto 1rem; }

/* Phase 7.3 — directory tables */
.ed-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ed-table thead th {
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ed-muted-text);
  background: var(--ed-body-bg);
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--ed-border);
}
.ed-table thead th:first-child { border-top-left-radius: 10px; }
.ed-table thead th:last-child { border-top-right-radius: 10px; }
.ed-table tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--ed-border);
  color: var(--ed-body-text);
  vertical-align: middle;
}
.ed-table tbody tr:last-child td { border-bottom: none; }
.ed-table tbody tr:hover td { background: var(--ed-body-bg); }

/* Journey TailAdmin-Table Visual Update — card wrapper + header bar for
   a table grouped under a date-section heading (e.g. "This Week"),
   built on the existing .ed-table above rather than a new table style.
   Zero-padding card (unlike the default .ed-card) since the header bar
   and table supply their own padding, edge to edge. */
.ed-table-card { background: var(--ed-card-bg); border: 1px solid var(--ed-border); border-radius: 16px; overflow: hidden; }
.ed-table-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--ed-border);
}

/* Phase 6.1 — metric/stat card */
.ed-stat-card { display: flex; align-items: center; gap: 1rem; }
.ed-avatar {
  width: 2.25rem; height: 2.25rem; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px;
  background: var(--ed-sidebar-active); color: var(--ed-primary);
  flex-shrink: 0;
}

.thread-list::-webkit-scrollbar,
.message-pane::-webkit-scrollbar {
  width: 8px;
}
.thread-list::-webkit-scrollbar-thumb,
.message-pane::-webkit-scrollbar-thumb {
  background: var(--ed-border);
  border-radius: 999px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: normal;
}
.badge-unread   { background: var(--ed-info-bg); color: var(--ed-info); }
.badge-urgent   { background: var(--ed-danger-bg); color: var(--ed-danger); }
.badge-parent   { background: var(--ed-success-bg); color: var(--ed-success); }
.badge-student  { background: var(--ed-info-bg); color: var(--ed-primary); }
.badge-resolved { background: var(--ed-body-bg); color: var(--ed-muted-text); }
.badge-lowscore { background: var(--ed-danger-bg); color: var(--ed-danger); }

.bubble-mine {
  background: var(--ed-primary);
  color: var(--ed-on-accent);
  border-radius: 16px 16px 4px 16px;
}
.bubble-theirs {
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 16px 16px 16px 4px;
  color: var(--ed-body-text);
}
.bubble-system {
  background: var(--ed-warning-bg);
  border: 1px solid var(--ed-border);
  color: var(--ed-warning);
  border-radius: 10px;
}

.thread-row.active {
  background: var(--ed-sidebar-active);
  border-left: 3px solid var(--ed-primary);
}

/* Phase 2/3: Print Conversation — everything else on the page is hidden
   while printing; only #print-area (populated just-in-time by JS with
   the current conversation) is shown. */
@media print {
  /* u213-819 Phase 46 — scoped to pages that HAVE a #print-area (it used to blank every other page's printout) */
  body:has(#print-area) * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area {
    display: block !important;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px;
  }
}

/* "EduLink Blueprint: Learning Insights Reports System" — Phase 20
   "Print and Report Formatting". Its own rule rather than reusing
   #print-area above (that mechanism needs JS to copy content into a
   hidden div first) — the report page's real DOM is already exactly
   what should print, it just needs the sidebar/nav/header and every
   interactive control hidden. Scoped to #li-report-print-root so it
   only ever applies on the two Learning Insights report pages. */
@media print {
  body:has(#li-report-print-root) * { visibility: hidden; } /* u213-819 Phase 46 — this rule used to rely on the global one above */
  #li-report-print-root, #li-report-print-root * { visibility: visible; }
  #li-report-print-root {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0;
  }
  .li-report-hide-print,
  .li-report-controls { display: none !important; }
  /* The "Show Details" toggle is a screen-only affordance (Phase 6
     "collapsed by default") — print always shows the full breakdown
     regardless of whether it was expanded on screen (Phase 20 "Show:
     ... All major report sections"). */
  #li-report-print-root #li-sec-details.hidden { display: block !important; }
}

/* ═══════════════════════════════════════════════════════════════════
   Three-Step Plan Creation Blueprint — Phase 13 "Styling". Reuses the
   existing semantic tokens (--ed-primary, --ed-success, --ed-muted-text,
   --ed-border, --ed-card-bg) rather than introducing new colors — every
   state below is light/dark-mode-aware automatically the same way
   .ed-card/.ed-btn-primary already are (§7 of the codebase summary).
   ═══════════════════════════════════════════════════════════════════ */

.plan-progress-nav .plan-step-connector {
  position: relative;
}
.plan-progress-nav .plan-step-connector::after {
  content: '';
  position: absolute;
  top: 18px; /* vertical center of the 36px step circle */
  left: calc(50% + 28px);
  right: calc(-50% + 28px);
  height: 2px;
  background: var(--ed-border);
}

.plan-step-circle {
  border: 2px solid var(--ed-border);
  color: var(--ed-muted-text);
  background: var(--ed-card-bg);
}
.plan-step-desc { color: var(--ed-muted-text); }
.plan-step-state-label { color: var(--ed-muted-text); }

/* Complete: filled success, checkmark, connector segment after it turns solid. */
.plan-step-complete .plan-step-circle {
  background: var(--ed-success);
  border-color: var(--ed-success);
  color: var(--ed-on-accent);
}
.plan-step-complete .plan-step-state-label { color: var(--ed-success); }
a.plan-step-complete:hover .plan-step-desc,
a.plan-step-complete:focus-visible .plan-step-desc { color: var(--ed-body-text); }

/* Current: strong primary treatment — the strongest visual element among the three steps. */
.plan-step-current .plan-step-circle {
  background: var(--ed-primary);
  border-color: var(--ed-primary);
  color: var(--ed-on-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--ed-primary) 18%, transparent);
}
.plan-step-current .plan-step-state-label { color: var(--ed-primary); }

/* In progress: highlighted but not as strong as "current" — a distinct third visual state, not a re-skin of complete or current. */
.plan-step-in-progress .plan-step-circle {
  background: var(--ed-warning-bg);
  border-color: var(--ed-warning);
  color: var(--ed-warning);
}
.plan-step-in-progress .plan-step-state-label { color: var(--ed-warning); }

/* Locked/not-started: muted, never styled to look clickable (it isn't — rendered as <span>, not <a>). */
.plan-step-locked { opacity: 0.55; cursor: default; }
.plan-step-locked .plan-step-circle { background: var(--ed-card-bg); }

a.plan-step-complete,
a.plan-step-current,
a.plan-step-in-progress {
  border-radius: 10px;
  padding: 2px;
  margin: -2px;
  transition: background-color 150ms ease;
}
a.plan-step-complete:hover,
a.plan-step-current:hover,
a.plan-step-in-progress:hover {
  background: var(--ed-body-bg);
}
a.plan-step-complete:focus-visible,
a.plan-step-current:focus-visible,
a.plan-step-in-progress:focus-visible {
  outline: 2px solid var(--ed-primary);
  outline-offset: 2px;
}

/* Mobile vertical list: same state classes, no connector line needed. */
.plan-step-mobile .plan-step-circle { width: 1.75rem; height: 1.75rem; }

/* ═══════════════════════════════════════════════════════════════════
   Plans Page Visual Refresh Blueprint — Phase 1 "Design tokens".
   Student-only (student/plans.php + includes/plan-directory-result-view.php's
   student branch) — reuses existing --ed-* custom properties, no new
   color system. The blueprint's Phase 4b referenced a --ed-border-strong
   token that doesn't exist anywhere else in this file; the draft-card
   border below uses the existing --ed-border instead.
   ═══════════════════════════════════════════════════════════════════ */

.ed-stat-pill {
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  flex: 1;
  min-width: 110px;
}
.ed-stat-pill .value { font-size: 22px; font-weight: 600; margin: 0; line-height: 1.2; }
.ed-stat-pill .label { font-size: 13px; color: var(--ed-muted-text); margin: 0 0 4px; }

.ed-stepper-track { flex: 1; height: 1px; background: var(--ed-border); margin: 0 12px; min-width: 24px; }
.ed-stepper-track.done { background: var(--ed-primary); }

/* ═══════════════════════════════════════════════════════════════════
   Plans Directory Flex-Reflow, Row-Action Sizing & Stepper Redesign
   Blueprint — Phase 4a. Redesigned "Create a Learning Plan" stepper
   card (student/plans.php only). Reuses existing --ed-* tokens only.
   ═══════════════════════════════════════════════════════════════════ */
.ed-create-plan-steps { display: flex; align-items: stretch; gap: 0; }
.ed-create-plan-step { flex: 1 1 0; display: flex; flex-direction: column; gap: 0.6rem; min-width: 150px; }
.ed-create-plan-step-top { display: flex; align-items: center; gap: 0; }
.ed-create-plan-step-circle {
  width: 2.5rem; height: 2.5rem; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 600; flex-shrink: 0;
  border: 2px solid var(--ed-border);
  background: var(--ed-card-bg);
  color: var(--ed-muted-text);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.ed-create-plan-step.is-done .ed-create-plan-step-circle { background: var(--ed-primary); border-color: var(--ed-primary); color: var(--ed-on-accent); }
.ed-create-plan-step.is-current .ed-create-plan-step-circle { border-color: var(--ed-primary); color: var(--ed-primary); background: color-mix(in srgb, var(--ed-primary) 10%, var(--ed-card-bg)); }
.ed-create-plan-step-line { flex: 1 1 auto; height: 2px; background: var(--ed-border); margin: 0 4px; min-width: 16px; }
.ed-create-plan-step.is-done .ed-create-plan-step-line { background: var(--ed-primary); }
.ed-create-plan-step-eyebrow { font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: normal; color: var(--ed-muted-text); }
.ed-create-plan-step.is-current .ed-create-plan-step-eyebrow { color: var(--ed-primary); }
.ed-create-plan-step-title { font-size: 0.9375rem; font-weight: 600; color: var(--ed-heading); line-height: 1.3; }
.ed-create-plan-step-desc { font-size: 0.8125rem; color: var(--ed-muted-text); line-height: 1.4; }
@media (max-width: 700px) {
  .ed-create-plan-steps { flex-direction: column; gap: 1.1rem; }
  .ed-create-plan-step { flex-direction: row; align-items: center; gap: 0.9rem; }
  .ed-create-plan-step-top { flex-direction: column; }
  .ed-create-plan-step-line { display: none; }
}

.ed-progress-track { height: 6px; background: var(--ed-body-bg); border-radius: 20px; overflow: hidden; }
.ed-progress-fill  { height: 100%; border-radius: 20px; background: var(--ed-success); transition: width 200ms ease; }

/* Phase 4 card variants. */
.ed-plan-card-active { border-left: 3px solid var(--ed-success); }
.ed-plan-card-draft  { border: 1px dashed var(--ed-border); }
.ed-plan-icon-chip {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--ed-info-bg);
  color: var(--ed-primary);
}
.ed-plan-icon-chip.muted { background: var(--ed-body-bg); color: var(--ed-muted-text); }

/* ═══════════════════════════════════════════════════════════════════
   Plans Directory Flex-Reflow Blueprint — Phase 1. Renamed from
   .ed-table* to .ed-plan-table* (see §0 — the old name collided with
   the pre-existing Phase 7.3 directory-table class). Rows/cells are
   flex boxes instead of native table layout, so as the viewport
   narrows, cells wrap onto new lines and their own text wraps onto
   more lines, instead of clipping or forcing horizontal scroll.
   ═══════════════════════════════════════════════════════════════════ */
.ed-plan-table-card { overflow: hidden; }
.ed-plan-table-wrap { overflow-x: visible; }
.ed-plan-table, .ed-plan-table thead, .ed-plan-table tbody { display: block; width: 100%; }
.ed-plan-table { font-size: 0.875rem; }
.ed-plan-table tr { display: flex; flex-wrap: wrap; align-items: flex-start; width: 100%; }
.ed-plan-table thead tr { background: var(--ed-body-bg); border-bottom: 1px solid var(--ed-border); }
.ed-plan-table th {
  flex: 1 1 150px;
  min-width: 110px;
  text-align: left;
  padding: 0.75rem 1.25rem;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ed-muted-text);
}
.ed-plan-table tbody tr { border-bottom: 1px solid var(--ed-border); }
.ed-plan-table tbody tr:last-child { border-bottom: none; }
.ed-plan-table tbody tr:hover { background: var(--ed-body-bg); }
.ed-plan-table td {
  flex: 1 1 150px;
  min-width: 110px;
  padding: 1rem 1.25rem;
  vertical-align: middle;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.ed-plan-table th:nth-child(1), .ed-plan-table td:nth-child(1) { flex: 2.2 1 240px; } /* Plan */
.ed-plan-table th:nth-child(2), .ed-plan-table td:nth-child(2) { flex: 1.6 1 200px; } /* Progress */
.ed-plan-table th:nth-child(3), .ed-plan-table td:nth-child(3) { flex: 0.7 1 130px; white-space: nowrap; } /* Created At — "Simplify Plans Tables" Phase 15: compact, nowrap */
.ed-plan-table th:last-child, .ed-plan-table td:last-child { flex: 1.6 1 240px; }     /* Actions */

.ed-plan-table td::before {
  content: attr(data-label);
  display: none;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ed-muted-text);
  margin-bottom: 0.25rem;
}
@media (max-width: 700px) {
  .ed-plan-table thead { display: none; }
  .ed-plan-table td { flex: 1 1 100%; }
  .ed-plan-table td::before { display: block; }
}

/* ---- Row actions. "Simplify Plans Tables for Teachers and Students"
   blueprint — Phase 15: action labels are now longer and more varied
   ("Build Learning Roadmap", "Review Student Progress") than the old
   fixed 9.25rem/ellipsis sizing (tuned for short labels like "Open
   Plan") could show without clipping — min-width keeps rows visually
   aligned without truncating text; wrapping is allowed if a label
   still doesn't fit. ---- */
.ed-plan-table-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ed-action-btn-primary { min-width: 9.25rem; justify-content: center; text-align: center; white-space: normal; line-height: 1.25; }
/* Phase 12: message button is now icon + visible text (was icon-only
   with title/aria-label as the only text) — auto width instead of a
   fixed square, but keeps the same unread-count dot positioning. */
.ed-action-btn-message { display: inline-flex; align-items: center; gap: 0.4rem; position: relative; white-space: nowrap; }
.ed-action-btn-message .ed-unread-dot {
  position: absolute; top: -6px; right: -6px;
  min-width: 16px; height: 16px; padding: 0 3px; border-radius: 999px;
  background: var(--ed-danger); color: var(--ed-on-accent);
  font-size: 13px; font-weight: 600; line-height: 16px; text-align: center;
}
/* Retained for any other/future icon-only square action button. */
.ed-action-btn-icon { position: relative; width: 2.375rem; height: 2.375rem; padding: 0; flex-shrink: 0; }
.ed-action-btn-icon .ed-unread-dot {
  position: absolute; top: -4px; right: -4px;
  min-width: 16px; height: 16px; padding: 0 3px; border-radius: 999px;
  background: var(--ed-danger); color: var(--ed-on-accent);
  font-size: 13px; font-weight: 600; line-height: 16px; text-align: center;
}

/* Plans Directory TailAdmin-Table Blueprint — Phase 3 (optional).
   Icon slot for .ed-stat-pill, matching the reference mockup's
   metric-card pattern. .ed-stat-pill's own layout rules are unchanged
   (assets/css/app.css, Plans Page Visual Refresh Phase 1) — this only
   adds the icon box and switches the pill to a column layout so the
   icon sits above the label/value. */
.ed-stat-pill { display: flex; flex-direction: column; gap: 0.5rem; }
.ed-stat-pill-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.625rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ed-body-bg);
  color: var(--ed-primary);
  font-size: 1.05rem;
}

/* ---------------------------------------------------------------------
 * "Roadmap Steps TailAdmin Data Table" pass — the same TailAdmin
 * "Data Tables" pattern (https://demo.tailadmin.com/data-tables) used
 * by student/plan-roadmap.php's Roadmap Steps section. Deliberately a
 * distinct, richer class family from .ed-table/.ed-table-card (Plans
 * Directory pass) rather than extending those — this one adds a
 * search/entries toolbar, sortable-look column headers, and an
 * expandable per-row detail row, none of which the simpler .ed-table*
 * pattern has. Colors are var(--ed-primary)/var(--ed-primary-hover) —
 * the template this was built from used its own separate --ta-brand
 * variable, but that value (#465FFF) is identical to this app's
 * existing --ed-primary post-re-theme, so no new token was introduced.
 * Status/skill badges reuse the existing .ed-badge* classes and
 * render_badge() rather than a parallel .ta-badge* family.
 * ------------------------------------------------------------------- */
.ta-card { border-radius: 1rem; border: 1px solid var(--ed-border); background: var(--ed-card-bg); overflow: hidden; }
.ta-card-header { padding: 1.25rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; border-bottom: 1px solid var(--ed-border); }
.ta-card-title { font-size: 1rem; font-weight: 600; color: var(--ed-heading); }

.ta-dt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.5rem; }
.ta-dt-toolbar-left { display: flex; align-items: center; gap: .5rem; font-size: .875rem; color: var(--ed-muted-text); }
.ta-dt-entries-select {
  height: 2.25rem; border-radius: .5rem; border: 1px solid var(--ed-border); background: var(--ed-card-bg);
  color: var(--ed-heading); padding: 0 .6rem; font-size: .8125rem; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2365676B' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .5rem center; padding-right: 1.75rem;
}
.ta-dt-search-wrap { position: relative; }
.ta-dt-search { height: 2.25rem; border-radius: .5rem; border: 1px solid var(--ed-border); background: var(--ed-card-bg); color: var(--ed-heading); padding: 0 .75rem 0 2.25rem; font-size: .8125rem; min-width: 200px; }
.ta-dt-search::placeholder { color: var(--ed-muted-text); }
.ta-dt-search:focus { outline: 2px solid var(--ed-primary); outline-offset: 1px; border-color: var(--ed-primary); }
.ta-dt-search-icon { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: var(--ed-muted-text); font-size: 13px; pointer-events: none; }

.ta-table-wrap { overflow-x: auto; }
.ta-table { width: 100%; min-width: 720px; table-layout: fixed; border-collapse: collapse; }
.ta-table thead { background: var(--ed-body-bg); border-bottom: 1px solid var(--ed-border); }
.ta-table thead th { padding: .75rem 1rem; text-align: left; font-size: 13px; font-weight: 600; letter-spacing: normal; text-transform: none; color: var(--ed-muted-text); white-space: normal; overflow-wrap: break-word; vertical-align: bottom; }
/* Sort icons are decorative only on this table — roadmap steps stay in
   roadmap sequence and are never client-sortable (same principle as
   includes/analytics-roadmap-comprehension-view.php's "steps stay in
   roadmap order" rule) — cursor stays default, no click handler. */
.ta-table th.ta-sortable { cursor: default; user-select: none; }
.ta-th-flex { display: flex; align-items: center; gap: .4rem; }
.ta-sort-icons { display: inline-flex; flex-direction: column; gap: 1px; line-height: 0; }
.ta-sort-icons i { font-size: 13px; color: var(--ed-border); }
.ta-sort-icons i.ta-sort-active { color: var(--ed-primary); }
/* "EduLink Roadmap Table and Messaging Fix" blueprint — Phase 2/4/15.
 * Was 6 columns (Step/Unit/Duration/Mastery Target/Status/Actions);
 * Duration, Mastery Target, and Status are no longer shown as
 * standalone columns (their underlying data/behavior is unchanged —
 * see student/plan-roadmap.php and teacher/plan-view.php's docblocks
 * for exactly where each one still lives). New 4-column layout: Step /
 * Unit / Actions / Advanced Features, the last of which is
 * mode-responsive rather than always-visible. Shared by both roles'
 * roadmap tables (`.ta-table`) — no separate CSS system introduced.
 *
 * "Responsive Homework Tables for Students and Teachers" blueprint —
 * Phase 1. These fixed 9%/58%/33% column proportions only ever made
 * sense for the roadmap tables' 3 visible columns (Step/Unit/Actions).
 * They are now scoped to `.ta-roadmap-table` (added alongside `.ta-table`
 * on student/plan-roadmap.php and teacher/plan-view.php only) instead
 * of every `.ta-table`, so they no longer leak into the 6- and
 * 7-column Homework tables, which use the separate `.homework-table`
 * system below instead. */
.ta-roadmap-table th:nth-child(1), .ta-roadmap-table td:nth-child(1) { width: 9%; }  /* Step */
.ta-roadmap-table th:nth-child(2), .ta-roadmap-table td:nth-child(2) { width: 58%; } /* Unit */
.ta-roadmap-table th:nth-child(3), .ta-roadmap-table td:nth-child(3) { width: 33%; } /* Actions */
.ta-roadmap-table th.ta-col-advanced, .ta-roadmap-table td.ta-col-advanced {
  width: 0; padding: 0; border: none; overflow: hidden; opacity: 0;
  transition: width .15s ease, opacity .1s ease;
}
/* Advanced mode: Advanced Features column takes real width, the other
 * three shrink to make room (percentages are the blueprint's own
 * "starting points, not hard requirements"). */
.ta-roadmap-table.is-advanced-mode th:nth-child(1), .ta-roadmap-table.is-advanced-mode td:nth-child(1) { width: 8%; }
.ta-roadmap-table.is-advanced-mode th:nth-child(2), .ta-roadmap-table.is-advanced-mode td:nth-child(2) { width: 38%; }
.ta-roadmap-table.is-advanced-mode th:nth-child(3), .ta-roadmap-table.is-advanced-mode td:nth-child(3) { width: 25%; }
.ta-roadmap-table.is-advanced-mode th.ta-col-advanced, .ta-roadmap-table.is-advanced-mode td.ta-col-advanced {
  width: 29%; padding: .9rem 1rem; opacity: 1; overflow: visible;
  /* "Advanced Features Column Background" blueprint — Option 1
     (accent tint) chosen from the color-options mockup. Applies to
     both the header and body cells so the whole column reads as one
     shaded zone, matching the mockup's .opt1 .adv-col treatment.
     Token is theme-aware (see :root / html.dark above), so this stays
     correct in dark mode with no separate dark: rule needed here. */
  background: var(--ed-advanced-col-bg);
}
/* Basic mode: header text itself is hidden (not just narrowed) so an
 * empty "Advanced Features" label never sits over a collapsed column. */
.ta-roadmap-table:not(.is-advanced-mode) .advanced-features-header,
.ta-roadmap-table:not(.is-advanced-mode) .advanced-features-cell { display: none; }
.ta-table tbody tr.ta-row { border-bottom: 1px solid var(--ed-border); }
.ta-table tbody tr.ta-row:hover { background: var(--ed-body-bg); }
.ta-table tbody tr:last-child { border-bottom: none; }
.ta-table tbody td { padding: .9rem 1rem; font-size: .875rem; color: var(--ed-body-text); vertical-align: top; overflow-wrap: break-word; word-break: break-word; }
.ta-cell-primary { color: var(--ed-heading); font-weight: 600; font-size: .875rem; }
.ta-cell-sub { color: var(--ed-muted-text); font-size: .8125rem; margin-top: .15rem; }

.ta-btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--ed-primary); color: var(--ed-on-accent); font-weight: 600; font-size: .8125rem; padding: .45rem .9rem; border-radius: .5rem; border: none; cursor: pointer; transition: background .15s ease; }
.ta-btn-primary:hover { background: var(--ed-primary-hover); }
.ta-btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.ta-btn-outline { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; background: var(--ed-card-bg); color: var(--ed-body-text); font-weight: 600; font-size: .8125rem; padding: .45rem .9rem; border-radius: .5rem; border: 1px solid var(--ed-border); cursor: pointer; transition: background .15s ease; }
.ta-btn-outline:hover { background: var(--ed-body-bg); }

/* ---------------------------------------------------------------------
 * Responsive Homework tables ("Responsive Homework Tables for Students
 * and Teachers" blueprint).
 *
 * Homework tables (public/student/homework.php, public/teacher/homework.php)
 * share `.ta-table` for common visual styling (borders, header, hover,
 * badge spacing) but get their own layout system here instead of the
 * roadmap tables' fixed-percentage `.ta-roadmap-table` rules above —
 * Homework has 6 (student) / 7 (teacher) columns, a different content
 * shape entirely from the roadmap's 3-4 column layout.
 * ------------------------------------------------------------------- */

/* Phase 2 — content-based sizing instead of table-layout: fixed. */
.homework-table {
  table-layout: auto;
  width: 100%;
  min-width: 0;
}

/* Phase 6 — natural word wrapping. Overrides .ta-table tbody td's
   word-break: break-word (which can chop a word mid-letter) with a
   normal wrap-at-spaces-first approach, falling back to
   overflow-wrap: anywhere only for a single unbroken token (e.g. a
   long username) that has no natural break point. */
.homework-table th,
.homework-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}
/* Compact values that should stay on one line whenever possible. */
.homework-table .homework-col-score,
.homework-table .homework-col-assigned-date {
  white-space: nowrap;
}

/* "Teacher and Student Homework Pagination, Basic/Advanced Search,
   Sorting, and Row Numbers" blueprint — Section 14. Shared by both
   student and teacher tables (unlike the width:1% columns below,
   which are declared separately per role) since the `#` column is now
   identical either way. */
.homework-table .homework-col-number {
  width: 3.5rem;
  text-align: center;
  white-space: nowrap;
}

/* Phase 3 — student column guidance. Quiz/Plan get the most flexible
   space; Assigned By wraps instead of forcing the table wider; Status/
   Score/Actions stay compact-to-fixed. */
.homework-table-student .homework-col-quiz { min-width: 11rem; }
.homework-table-student .homework-col-plan { min-width: 9rem; }
.homework-table-student .homework-col-assigned-by { min-width: 7rem; }
.homework-table-student .homework-col-status { width: 1%; white-space: nowrap; }
.homework-table-student .homework-col-score { width: 1%; white-space: nowrap; }
.homework-table-student .homework-col-actions { min-width: 11rem; }

/* Phase 4 — teacher column guidance. Same idea, with a wider Actions
   minimum since the teacher row can show up to four buttons (Open
   Plan / Preview Quiz / View Results / Remove) instead of three. */
.homework-table-teacher .homework-col-student { min-width: 8rem; }
.homework-table-teacher .homework-col-quiz { min-width: 12rem; }
.homework-table-teacher .homework-col-plan { min-width: 9rem; }
.homework-table-teacher .homework-col-assigned-date,
.homework-table-teacher .homework-col-status,
.homework-table-teacher .homework-col-score { width: 1%; }
.homework-table-teacher .homework-col-actions { min-width: 13rem; }

/* Phase 5 — Actions column + buttons. */
.homework-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  min-width: 0;
}
.homework-actions .ed-btn-primary,
.homework-actions .ed-btn-secondary {
  width: auto;
  max-width: 100%;
  min-width: max-content;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
  text-align: center;
  line-height: 1.25;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Phase 9 — responsive filter bar (status tabs / student select /
   search / Search button) above each Homework table. */
@media (max-width: 640px) {
  .homework-filter-form { align-items: stretch; }
  .homework-filter-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }
  .homework-filter-controls .ed-input,
  .homework-filter-controls select,
  .homework-filter-controls .ed-btn-secondary {
    width: 100%;
  }
}

/* Phase 7/8 — mobile stacked rows (~767px and below). Each <tr> becomes
   a bordered card; each <td> becomes a label/value row using
   data-label; Actions becomes a responsive button grid. */
@media (max-width: 767px) {
  .homework-table-wrap {
    overflow-x: visible;
  }
  .homework-table {
    display: block;
    min-width: 0;
  }
  .homework-table thead {
    display: none;
  }
  .homework-table tbody {
    display: grid;
    gap: 1rem;
  }
  .homework-table tbody tr {
    display: block;
    border: 1px solid var(--ed-border);
    border-radius: 0.875rem;
    background: var(--ed-card-bg);
    overflow: hidden;
  }
  .homework-table tbody td {
    display: grid;
    grid-template-columns: minmax(6.5rem, 35%) minmax(0, 1fr);
    gap: 0.75rem;
    width: 100%;
    min-width: 0;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--ed-border);
  }
  .homework-table tbody td::before {
    content: attr(data-label);
    font-size: 13px;
    font-weight: 600;
    color: var(--ed-muted-text);
    text-transform: none;
    letter-spacing: normal;
  }
  .homework-table tbody td:last-child {
    border-bottom: 0;
  }

  /* Phase 8 — Actions cell spans the full card width with its label
     stacked above a responsive button grid, rather than the two-column
     label/value grid every other cell uses. */
  .homework-table td.homework-col-actions {
    display: block;
  }
  .homework-table td.homework-col-actions::before {
    display: block;
    margin-bottom: 0.625rem;
  }
  .homework-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
  .homework-actions .ed-btn-primary,
  .homework-actions .ed-btn-secondary {
    width: 100%;
    min-width: 0;
  }
}

/* Very small screens — one action button per row instead of two. */
@media (max-width: 420px) {
  .homework-actions {
    grid-template-columns: 1fr;
  }
}

/* "Remove Homework Rows Immediately Without Refreshing" blueprint —
 * Phase 13 (optional). Brief, non-blocking fade/collapse applied by
 * homework-actions.js right before a successfully-removed row is
 * taken out of the DOM. The row is only ever removed AFTER the server
 * confirms success (never optimistically), so this is purely a visual
 * polish on top of already-correct data, not a substitute for it. */
.homework-row-removing {
  opacity: 0;
  transform: translateY(-0.25rem);
  transition: opacity 160ms ease, transform 160ms ease;
}
@media (prefers-reduced-motion: reduce) {
  .homework-row-removing {
    transition: none;
  }
}

.ta-detail-row td { background: var(--ed-body-bg); padding: 1.25rem 1.5rem !important; }

/* "Unit Edit Form Background" — the per-unit editor (Unit Title,
 * Description, Estimated Hours, Mastery Target, Skills / Topics,
 * Learning Notes), shown inside .ta-detail-row when "Edit Roadmap" is
 * toggled on. Uses the same --ed-advanced-col-bg tint as the Advanced
 * Features column above it (Option 1 from the color-options mockup) so
 * the two "advanced-only" surfaces read as one consistent zone rather
 * than two different shades. Shared by both live roadmap tables —
 * .unit-edit-form appears identically in student/plan-roadmap.php and
 * teacher/plan-view.php, so this one rule covers both.
 */
.unit-edit-form { background: var(--ed-advanced-col-bg); border-radius: .75rem; padding: 1rem 1.1rem; }


.ta-dt-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.5rem; border-top: 1px solid var(--ed-border); }
.ta-dt-footer-text { font-size: .8125rem; color: var(--ed-muted-text); }
.ta-dt-pagination { display: flex; align-items: center; gap: .375rem; }
.ta-dt-page-btn { min-width: 2rem; height: 2rem; display: inline-flex; align-items: center; justify-content: center; border-radius: .4rem; font-size: .8125rem; font-weight: 600; border: 1px solid transparent; color: var(--ed-body-text); background: transparent; cursor: pointer; padding: 0 .5rem; }
.ta-dt-page-btn:hover { background: var(--ed-body-bg); }
.ta-dt-page-btn.ta-active { background: var(--ed-primary); color: var(--ed-on-accent); }
.ta-dt-page-btn:disabled { color: var(--ed-muted-text); opacity: .5; cursor: not-allowed; }

.ed-row-details-summary { list-style: none; }
.ed-row-details-summary::-webkit-details-marker { display: none; }
.ed-row-details-summary:hover { text-decoration: underline; }

/* ---------------------------------------------------------------------
 * "Claude.ai Visual System" pass — global fallback for plain, unclassed
 * tables and lists. Many admin pages render a bare <table class="w-full
 * text-sm"> (already using semantic tokens like text-muted/border-ed-
 * border/bg-app-body per-cell, just without the richer .ta-table/
 * .ed-table treatment) rather than one of the named table components
 * above. Scoped with :not(.ta-table, .ed-table, .ed-plan-table) and
 * kept to low-specificity element selectors so it only fills gaps —
 * any page's own utility classes (padding, borders, etc.) still win —
 * and existing designed tables are completely unaffected. */
table:not(.ta-table):not(.ed-table):not(.ed-plan-table) {
  border-collapse: collapse;
}
table:not(.ta-table):not(.ed-table):not(.ed-plan-table) thead tr {
  background: var(--ed-body-bg);
}
table:not(.ta-table):not(.ed-table):not(.ed-plan-table) th {
  color: var(--ed-muted-text);
  font-weight: 600;
  text-align: left;
}
table:not(.ta-table):not(.ed-table):not(.ed-plan-table) th,
table:not(.ta-table):not(.ed-table):not(.ed-plan-table) td {
  padding: 0.625rem 0.75rem;
}
table:not(.ta-table):not(.ed-table):not(.ed-plan-table) tbody tr:hover {
  background: var(--ed-body-bg);
}

/* Bulleted/numbered content lists (About/Terms/Privacy-style prose,
 * plus any dashboard list using Tailwind's list-disc/list-decimal)
 * get a branded marker instead of the browser default, so a list
 * reads as clearly "on-brand" as a card or button does. Doesn't touch
 * <ul>/<ol> used as pure layout scaffolding (nav menus, card grids)
 * since those never carry list-disc/list-decimal in this codebase. */
.list-disc > li::marker,
.list-decimal > li::marker {
  color: var(--ed-primary);
  font-weight: 600;
}






/* teacher/quiz-preview.php — "Show All Quiz Questions at Once" blueprint.
   Brief highlight applied to the first unanswered question card when a
   teacher cancels "Submit anyway?" so they can see which one it jumped
   to; fades on its own, no JS timer dependency beyond removing the class. */
.qp-highlight { animation: qp-highlight-pulse 1.6s ease-out; }
@keyframes qp-highlight-pulse {
  0% { box-shadow: 0 0 0 3px var(--ed-primary); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* "Detailed Report Live Progress and Activity Stream" blueprint,
 * Phase 7/8 — the expanded progress panel (includes/learning-
 * recommendation-cta-view.php) and its typing indicator. The three-dot
 * indicator pulses to show the activity log is "about to type" a new
 * event; respects prefers-reduced-motion by simply not animating
 * (still visible, just static) rather than hiding the information it
 * conveys. */
.ed-lr-activity-panel { max-width: 42rem; }
.ed-lr-typing-dot {
  display: inline-block;
  width: 0.35rem;
  height: 0.35rem;
  margin-right: 0.15rem;
  border-radius: 9999px;
  background: var(--ed-muted);
  animation: ed-lr-typing-bounce 1.2s infinite ease-in-out both;
}
.ed-lr-typing-dot:nth-child(2) { animation-delay: 0.15s; }
.ed-lr-typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes ed-lr-typing-bounce {
  0%, 80%, 100% { opacity: 0.35; transform: scale(0.85); }
  40% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .ed-lr-typing-dot { animation: none; opacity: 0.7; }
}

/* "Persistent Animated Progress Indicator During Long Report
 * Generation" blueprint — a continuously-rotating ring immediately
 * beside the percentage in the detailed-report progress panel's
 * header (includes/learning-recommendation-cta-view.php), so the
 * page never reads as frozen during the long early stage where the
 * percent itself doesn't move for many seconds. Deliberately CSS-only
 * (no JS timer driving the rotation) — an `animation: ... infinite`
 * rule can't drift, pause, or be blocked by a slow/failed poll the
 * way a JS-timed frame-cycle could, which matters for something whose
 * entire job is to prove the page is still alive. JS only ever adds
 * .ed-lr-activity-spinner--stopped once, when the job reaches a
 * terminal state (see learning-recommendations.js's stop()).
 */
.ed-lr-percent-group {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem; /* ~8px — "within 8-12px of the percentage" */
}
.ed-lr-percent-value--active {
  display: inline-block;
  animation: ed-lr-percent-pulse 1s ease-in-out infinite;
}
@keyframes ed-lr-percent-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.ed-lr-activity-spinner {
  display: inline-block;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 9999px;
  border: 2.5px solid var(--ed-primary);
  border-right-color: transparent;
  border-top-color: transparent;
  opacity: 0.85;
  animation: ed-lr-spinner-rotate 0.7s linear infinite;
}
.ed-lr-activity-spinner--stopped {
  animation: none;
  opacity: 0;
  visibility: hidden;
}
@keyframes ed-lr-spinner-rotate {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  /* Same "stay visible, just don't move" rule as .ed-lr-typing-dot
     above — a solid ring/steady percentage still communicates "there
     is an indicator here", it just doesn't spin/pulse for anyone who
     has asked their OS not to animate things. */
  .ed-lr-percent-value--active { animation: none; }
  .ed-lr-activity-spinner { animation: none; border-right-color: var(--ed-primary); border-top-color: var(--ed-primary); opacity: 0.6; }
}

/* =======================================================================
 * "Live HTML/CSS/JavaScript Visuals for Every How-To Step" blueprint —
 * annotation/containment chrome ONLY (per that blueprint's §26 CSS
 * isolation rule). Anything reproducing actual TeeCarbon UI inside a
 * How-To visual (buttons, cards, inputs) uses the real .ed-btn-*/
 * .ed-card/.ed-input/.ed-badge-* classes already defined above — never
 * duplicated here. These classes exist only for: the outer card shell,
 * the "STEP PREVIEW" badge, the highlight ring + "CLICK HERE" callout,
 * and small layout-only containers specific to a demo fixture
 * (.how-to-sidebar-demo, .how-to-roadmap-unit-demo, etc.) that have no
 * real-page equivalent to borrow from.
 * ===================================================================== */

.how-to-visual {
  position: relative;
  background: var(--ed-body-bg);
  border: 1px solid var(--ed-border);
  border-radius: 14px;
  padding: 1.5rem 1rem 1.25rem;
  max-width: 480px;
}

.how-to-visual-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ed-muted-text);
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 999px;
  padding: 3px 10px;
}

.how-to-visual-body {
  pointer-events: none; /* §24/§25 — every control inside a visual is inert; nothing here should be clickable except via how-to-visuals.js's own explicit, opted-in data-how-to-action handlers below */
}
.how-to-visual-body [data-how-to-action] {
  pointer-events: auto;
  cursor: pointer;
}
.how-to-visual-body [data-how-to-mode-value] {
  pointer-events: auto;
  cursor: pointer;
}

/* Highlight ring + "CLICK HERE" callout — wraps whichever element a
   step's 'target' option names (how_to_visual_target(), how-to-visuals.php). */
.how-to-visual-target {
  position: relative;
  display: inline-block;
  outline: 2px dashed var(--ed-primary);
  outline-offset: 4px;
  border-radius: 10px;
}
.how-to-visual-target-label {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  color: var(--ed-primary);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Sidebar demo fixture (includes/how-to-visual-components/sidebar.php) */
.how-to-sidebar-demo {
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 12px;
  padding: 0.75rem;
  max-width: 260px;
}
.how-to-sidebar-brand {
  font-weight: 600;
  font-size: 13px;
  color: var(--ed-heading);
  margin-bottom: 0.5rem;
}
.how-to-sidebar-group-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  color: var(--ed-muted-text);
  margin: 0.5rem 0 0.25rem;
}
.how-to-sidebar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ed-body-text);
}
.how-to-sidebar-row-active {
  background: var(--ed-body-bg);
  color: var(--ed-primary);
  font-weight: 600;
}
.how-to-sidebar-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.6;
}

/* Roadmap-unit demo fixture */
.how-to-roadmap-unit-demo h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ed-heading);
  margin: 0.25rem 0 0.15rem;
}
.how-to-roadmap-unit-demo p {
  font-size: 13px;
  color: var(--ed-muted-text);
  margin: 0 0 0.75rem;
}
.how-to-roadmap-unit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.how-to-roadmap-nonowner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ed-muted-text);
  margin: 0;
}
.how-to-roadmap-nonowner-text {
  font-size: 13px;
  color: var(--ed-muted-text);
  margin: 2px 0 0;
}
.how-to-mode-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 0.75rem;
}
.how-to-mode-toggle .mode-toggle-btn {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--ed-border);
  background: var(--ed-card-bg);
  color: var(--ed-muted-text);
}
.how-to-mode-toggle .mode-toggle-btn.how-to-mode-active {
  background: var(--ed-primary);
  color: var(--ed-on-action);
  border-color: var(--ed-primary);
}

/* Quiz Settings demo fixture */
.how-to-quiz-settings-collapsed {
  font-size: 13px;
  font-weight: 600;
  color: var(--ed-body-text);
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 10px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.how-to-quiz-settings-demo {
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 12px;
  padding: 0.9rem;
  max-width: 300px;
}
.how-to-quiz-settings-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ed-heading);
  margin: 0 0 0.5rem;
}
.how-to-quiz-settings-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: var(--ed-body-text);
  margin-bottom: 0.4rem;
}
.how-to-quiz-settings-field .ed-input,
.how-to-quiz-settings-field .ed-select {
  max-width: 110px;
  padding: 3px 8px;
  font-size: 13px;
}
.how-to-quiz-settings-save-row {
  margin-top: 0.6rem;
}

/* Plan-directory demo fixture */
.how-to-plan-directory-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0.6rem;
}
.how-to-tab {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--ed-border);
  background: var(--ed-card-bg);
  color: var(--ed-muted-text);
}
.how-to-tab-active {
  background: var(--ed-primary);
  color: var(--ed-on-action);
  border-color: var(--ed-primary);
}
.how-to-plan-search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ed-muted-text);
  margin-bottom: 0.6rem;
}
.how-to-input-placeholder {
  color: var(--ed-muted-text);
}
.how-to-plan-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.how-to-plan-result-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ed-heading);
  margin: 0 0 2px;
}
.how-to-plan-create-demo {
  text-align: center;
  padding: 1rem 0;
}

/* Journey demo fixture */
.how-to-journey-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0.6rem;
}
.how-to-journey-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ed-heading);
}
.how-to-journey-entry-meta {
  display: block;
  font-size: 13px;
  font-weight: 400;
  color: var(--ed-muted-text);
}

/* Communication demo fixture */
.how-to-comm-composer {
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 10px;
  padding: 0.75rem;
  max-width: 300px;
}
.how-to-comm-context {
  font-size: 13px;
  color: var(--ed-muted-text);
  margin: 0 0 0.5rem;
}
.how-to-comm-composer textarea {
  width: 100%;
  margin-bottom: 0.5rem;
  resize: none;
}
.how-to-comm-feed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--ed-card-bg);
  border: 1px solid var(--ed-border);
  border-radius: 10px;
  padding: 10px 12px;
}
.how-to-comm-feed-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ed-heading);
}

@media (max-width: 480px) {
  .how-to-visual { max-width: 100%; padding: 1.25rem 0.75rem 1rem; }
  .how-to-sidebar-demo, .how-to-quiz-settings-demo, .how-to-comm-composer { max-width: 100%; }
}

/* Quick View gets a smaller version of the same component (blueprint
   §21) rather than a second component — just visually shrunk. */
.how-to-visual-compact {
  transform: scale(0.72);
  transform-origin: top left;
  margin-bottom: -1.5rem; /* offset the visual gap the scale-down leaves */
}

/* "Syllabus Learning Relationships Control Center" blueprint, Part 35
 * ("Mobile behavior") — this feature was already built without any
 * drag-and-drop dependency (badges/buttons + a shared modal/drawer,
 * same tap-to-open pattern as everything else on this page), so the
 * only genuinely missing piece is comfortable touch-target sizing and
 * edge-to-edge dialogs on a phone-width viewport, rather than a
 * separate mobile layout. Map mode (Part 16) needs nothing extra here
 * either — it was already vertically-stacked cards, never a real
 * graph, per that Part's own "Start simple" instruction, so it already
 * degrades to a single column on a narrow screen with no changes.
 */
@media (max-width: 640px) {
  /* The Add-Relationship modal, Suggest-Relationships drawer, and
     Learning Path Settings drawer are all centered fixed-position
     dialogs with a max-w-* cap — on a phone that cap plus the
     surrounding p-4 leaves cramped side margins, so this widens them
     to genuinely edge-to-edge instead. The inspector drawer already
     anchors to the trailing edge (items-center justify-end) and stays
     that way — collapsing it to centered on mobile would fight its
     own slide-in affordance. */
  #syl-lr-add-modal > div,
  #syl-lr-suggest-drawer > div,
  #syl-lr-settings-drawer > div {
    max-width: 100%;
    max-height: 92vh;
  }
  #syl-lr-add-modal,
  #syl-lr-suggest-drawer,
  #syl-lr-settings-drawer,
  #syl-lr-inspector-drawer {
    padding: 0.5rem;
  }

  /* Larger tap targets for the filter bar, badges, and per-Quiz row
     action buttons — Part 35's own "List mode must be fully functional
     on touch." Applied narrowly to this feature's own buttons/badges,
     not a site-wide button-size change. */
  .syl-lr-filter-btn,
  .syl-lr-badge-toggle,
  .syl-lr-add-btn,
  .syl-lr-inspect-btn {
    min-height: 32px;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
  }

  /* The per-Quiz row's action-button column (+ Add Relationship /
     Details / Edit Relationships) sits to the right of the title on a
     wide screen; on a phone that squeezes the title, so it drops below
     as a full-width row of buttons instead. */
  #syl-lr-hierarchy .ed-card > div.flex.items-start.justify-between {
    flex-direction: column;
  }
  #syl-lr-hierarchy .ed-card .flex.flex-col.gap-1.items-end {
    align-items: stretch;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
}

/* "TeeCarbon Deterministic Math Visual Engine" blueprint, PART 31/48.
   Named rule constraining .tc-math-visual to the pixel maximums PART
   31 specifies (this was NOT added in the Parts 31-45 pass — see that
   pass's own changelog note "still open" — JSXGraph board sizing had
   been following whatever CSS the containing .ed-card/.tc-math-visual-
   container already applied, which is reasonable but not the explicit
   rule PART 31 describes). `responsive_size` per template
   ('compact' | 'coordinate', see math-visual-templates.php's own
   registry) selects between the two --coordinate variant and the
   plain default; math-visual-renderer.js does not currently add a
   template-specific class itself, so this rule applies the PART 31
   DEFAULT (420px) to every .tc-math-visual and the wider COORDINATE
   max (480px) only inside a container a page has explicitly marked
   `.tc-math-visual-container--coordinate` (opt-in, since most current
   Release 1 templates render fine at the default). */
.tc-math-visual {
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.tc-math-visual-container--compact .tc-math-visual {
  max-width: 320px;
}
.tc-math-visual-container--coordinate .tc-math-visual {
  max-width: 480px;
}

/* PART 48 — the visible accessible-description text block
   math-visual-renderer.js's render() now appends after every diagram
   (see its own PART 48 comment). Deliberately still visible to
   sighted users too (not screen-reader-only) — PART 48's own wording
   is "do not make essential information available only through the
   diagram," and a small, muted caption serves both a screen-reader
   user and a sighted user who wants the diagram's content restated in
   words. */
.tc-math-visual-description {
  font-size: 13px;
  line-height: 1.1rem;
  color: var(--ed-text-muted);
  margin-top: 0.375rem;
  text-align: center;
}

/* "TeeCarbon Worksheets" blueprint, Phase 1 (u213_422) — Worksheet
   print layout (blueprint §15), REVISED in the u213_422 completion
   pass to make the three print buttons genuinely independent (the
   completion audit found all three previously just called a bare
   window.print() with no mode actually consumed, and the old
   `#tw-solution-sheet.hidden { display: block !important; }` rule
   force-showed the Solution Sheet on EVERY print regardless of which
   button was clicked — Print Worksheet could leak answers). Own
   #tw-print-root mechanism rather than the generic #print-area toggle
   above, matching the same per-feature choice the Learning Insights
   Reports print rules (#li-report-print-root, above) already made:
   this page has its own screen-only controls (search/filter UI,
   sidebar, navbar, the "Show/Hide Solution Sheet" button, print
   buttons themselves) that must never appear on paper.

   Mode is set on #tw-print-root's own `data-print-mode` attribute by
   twWorksheetPrint() (includes/syllabus-topic-worksheet-view.php's
   own inline script) immediately before calling window.print(), and
   cleared again on the browser's `afterprint` event. Three values:
     - 'worksheet' (also the default/unset state, e.g. a raw Ctrl+P
       that never went through one of our buttons) — worksheet body
       only, Solution Sheet NEVER rendered, regardless of its on-screen
       shown/hidden state. This is the safe default specifically so a
       Student (or anyone) printing via the browser's own shortcut can
       never accidentally leak answers.
     - 'solutions' — Solution Sheet only, worksheet body hidden.
     - 'both' — everything, Solution Sheet forced onto its own page via
       .tw-print-page-break regardless of on-screen state.
   Every one of these selectors is an ID + attribute selector (higher
   specificity than a bare `.hidden` utility class), so they reliably
   override the on-screen collapsed state either direction (force show
   OR force hide) without needing to touch the DOM/class list at print
   time. */
@media print {
  #tw-print-root, #tw-print-root * { visibility: visible; }
  #tw-print-root {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 0;
  }
  .tw-hide-print { display: none !important; }

  /* Default / 'worksheet' mode: the Solution Sheet is never printed,
     full stop — overrides ANY on-screen shown/revealed state. */
  #tw-print-root:not([data-print-mode="solutions"]):not([data-print-mode="both"]) #tw-solution-sheet {
    display: none !important;
  }

  /* 'solutions' mode: Solution Sheet only — the worksheet body
     (header/instructions/sections/questions) is suppressed, and the
     Solution Sheet itself starts at the top of the page rather than
     forcing a leading blank page via the 'both'-mode page-break. */
  #tw-print-root[data-print-mode="solutions"] .tw-worksheet-body { display: none !important; }
  #tw-print-root[data-print-mode="solutions"] #tw-solution-sheet {
    display: block !important;
    break-before: avoid;
    page-break-before: avoid;
  }

  /* 'both' mode: everything prints, Solution Sheet forced visible
     (overriding an unrevealed on-screen state) and starting on its
     own page (blueprint §15). */
  #tw-print-root[data-print-mode="both"] #tw-solution-sheet {
    display: block !important;
  }

  /* blueprint §15 — "Solution sheet should begin on a separate
     printed page" — only actually applies in 'both' mode; 'solutions'
     mode above explicitly cancels this so a solutions-only printout
     doesn't start with a blank leading page. */
  .tw-print-page-break { break-before: page; page-break-before: always; }
  /* blueprint §15 — the printed Worksheet header carries blank
     Student Name / Date / Topic lines; those are pure screen clutter
     everywhere else, so this block is print-only in both directions. */
  .tw-print-only { display: block !important; }
}
.tw-print-only { display: none; }
.tw-fill-lines p { margin: 0.25rem 0; }

/* =======================================================================
 * "TOC as a Visual Learning Path with Simple Progress Tracking"
 * blueprint — Parts 7/19. Exactly THREE status colors anywhere in this
 * block (green/red/neutral) — no yellow, blue, or mastery-band colors
 * belong here; see includes/syllabus-toc-progress.php's own docblock
 * for the three-state model these classes render.
 * ===================================================================== */
.toc-progress-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 999px;
  flex-shrink: 0;
  border: 2px solid var(--ed-border);
  background: transparent;
}
.toc-progress-complete.toc-progress-node { background: var(--ed-success); border-color: var(--ed-success); }
.toc-progress-incomplete.toc-progress-node { background: var(--ed-danger); border-color: var(--ed-danger); }
.toc-progress-not-started.toc-progress-node { background: transparent; border-color: var(--ed-border); }

/* Same three states used as a badge/pill (question rows, quiz rows —
   more legible at small sizes than the bare dot alone). */
.toc-progress-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 13px;
  font-weight: 600;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  white-space: nowrap;
}
.toc-progress-badge.toc-progress-complete { color: var(--ed-success); background: var(--ed-success-bg); }
.toc-progress-badge.toc-progress-incomplete { color: var(--ed-danger); background: var(--ed-danger-bg); }
.toc-progress-badge.toc-progress-not-started { color: var(--ed-muted-text); background: transparent; border: 1px dashed var(--ed-border); }

/* The connecting vertical line between major TOC nodes (Part 7) — the
   line itself always stays neutral; only the node dot at each end
   carries status color (Part 7: "Do not introduce extra colors for
   the path"). */
.toc-path-line {
  width: 2px;
  min-height: 1.1rem;
  background: var(--ed-border);
  margin: 0 auto;
}

/* Current-position marker (Part 9/19) — never a fourth status color,
   just an outline/badge layered on top of whatever the node's own
   green/red/neutral color already is. */
.toc-progress-current {
  box-shadow: 0 0 0 3px var(--ed-primary);
}
.toc-current-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ed-on-accent);
  background: var(--ed-primary);
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
}

/* u213_720 — Large Course Navigator (My Learning, 50+ topics only).
   Uses the existing tokens; a course under 50 topics never gets these classes. */
.toc-course-navigator {
  /* Phase 31 — stays in reach while a long course scrolls, just below the
     4rem site bar (sticky top-0 h-16); rows keep a scroll margin so a
     revealed row is never hidden under it. */
  position: sticky;
  top: 4.5rem;
  z-index: 30;
  box-shadow: var(--ed-overlay-shadow);
}
.toc-course-navigator-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.toc-course-navigator-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ed-muted-text);
}
.toc-course-navigator-count { font-size: 0.8125rem; font-weight: 600; color: var(--ed-heading); }
.toc-course-navigator .ta-dt-search { width: 100%; min-width: 0; }
.toc-course-navigator-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.toc-course-filters {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
}
.toc-course-filter {
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--ed-border);
  background: var(--ed-card-bg);
  color: var(--ed-heading);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.toc-course-filter[aria-pressed="true"] {
  background: var(--ed-primary);
  border-color: var(--ed-primary);
  color: var(--ed-on-accent);
}
.toc-course-filter:focus-visible { outline: 2px solid var(--ed-primary); outline-offset: 2px; }
.toc-course-tools { display: flex; gap: 0.375rem; flex-wrap: wrap; }
.toc-course-results { margin-top: -0.5rem; }
.toc-course-results-count { font-size: 13px; font-weight: 600; color: var(--ed-muted-text); padding: 0.25rem 0; }
.toc-course-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.375rem 0;
  border-bottom: 1px solid var(--ed-border);
  font-size: 0.875rem;
}
.toc-course-group + .toc-course-group { border-top: 1px solid var(--ed-border); }
.toc-course-group, .toc-course-row, .toc-course-subunit { scroll-margin-top: 16rem; }
.toc-course-group-head { display: flex; align-items: center; gap: 0.5rem; }
.toc-course-group-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 44px;
  padding: 0.5rem 0.25rem;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  color: var(--ed-heading);
  flex-wrap: wrap;
}
.toc-course-group-toggle:focus-visible { outline: 2px solid var(--ed-primary); outline-offset: 2px; border-radius: 0.375rem; }
.toc-course-group-caret { width: 1rem; flex-shrink: 0; font-size: 13px; color: var(--ed-muted-text); }
.toc-course-group-name { font-weight: 600; overflow-wrap: anywhere; }
.toc-course-group-count { margin-left: auto; flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--ed-muted-text); white-space: nowrap; }
.toc-course-group-body { padding: 0 0 0.5rem 0.75rem; }
.toc-course-subunit { margin: 0.25rem 0 0.25rem 0.25rem; }
.toc-course-subunit-name { display: flex; gap: 0.5rem; font-size: 0.8125rem; font-weight: 600; color: var(--ed-heading); padding: 0.375rem 0; }

/* Phase 29 — compact topic rows: marker · name · status · one action. */
.toc-course-row { padding: 0.375rem 0; border-bottom: 1px solid var(--ed-border); }
.toc-course-row-main { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; }
.toc-course-row-name { display: flex; align-items: center; gap: 0.5rem; min-width: 0; flex: 1 1 14rem; flex-wrap: wrap; }
.toc-course-row-name a, .toc-course-row-name button, .toc-course-row-name span.font-semibold { white-space: normal; overflow-wrap: anywhere; }
.toc-course-row-side { display: flex; align-items: center; gap: 0.375rem; flex-wrap: wrap; }
.toc-course-row-current { background: color-mix(in srgb, var(--ed-primary) 7%, transparent); border-radius: 0.5rem; padding-left: 0.375rem; padding-right: 0.375rem; }
.toc-course-status { font-size: 13px; font-weight: 600; color: var(--ed-muted-text); white-space: nowrap; }
.toc-course-status-incomplete { color: var(--ed-warning); }
.toc-course-status-complete { color: var(--ed-success); }
.toc-course-here { letter-spacing: normal; }
.toc-course-schoolwork { font-size: 13px; font-weight: 600; color: var(--ed-heading); background: var(--ed-neutral-fill); border: 1px solid var(--ed-border); border-radius: 999px; padding: 0.05rem 0.45rem; white-space: nowrap; }
.toc-course-more { margin: 0.25rem 0 0 1.5rem; }
.toc-course-more > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ed-muted-text); min-height: 1.75rem; display: inline-flex; align-items: center; }
.toc-course-more > summary:focus-visible { outline: 2px solid var(--ed-primary); outline-offset: 2px; border-radius: 0.25rem; }
.toc-course-more-body { padding: 0.25rem 0 0.25rem 0; }
.toc-course-target { outline: 2px solid var(--ed-primary); outline-offset: 2px; border-radius: 0.375rem; }

/* Phase 32 — phones: a compact toolbar, filters scroll sideways in one row. */
@media (max-width: 640px) {
  .toc-course-navigator { top: 4.25rem; padding: 0.75rem; }
  .toc-course-navigator-head { margin-bottom: 0.375rem; }
  .toc-course-filters { flex-wrap: nowrap; overflow-x: auto; width: 100%; padding-bottom: 0.25rem; -webkit-overflow-scrolling: touch; }
  .toc-course-navigator-controls { margin-top: 0.375rem; gap: 0.375rem; }
  .toc-course-filter { min-height: 2rem; padding: 0.2rem 0.65rem; font-size: 13px; }
  .toc-course-tools { width: 100%; flex-wrap: nowrap; overflow-x: auto; }
  .toc-course-tools .ed-btn-secondary { white-space: nowrap; }
  .toc-course-more { margin-left: 0; }
}
/* Phase 51 — pre-existing 375px overflow of the TOC action-button row (every
   course size, since u213_7xx): let the row's buttons wrap on narrow screens
   instead of pushing the page sideways. Same buttons, same order. */
@media (max-width: 480px) {
  #toc-tree .toc-node > div > .flex-shrink-0 { flex-shrink: 1; min-width: 0; }
}

/* Overall syllabus progress bar (Part 8). */
.toc-overall-progress-track {
  width: 100%;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--ed-border);
  overflow: hidden;
}
.toc-overall-progress-fill {
  height: 100%;
  background: var(--ed-success);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* Expandable Quiz/Question detail (Part 11). */
.toc-quiz-detail {
  border-left: 2px solid var(--ed-border);
  margin-left: 0.6rem;
  padding-left: 0.4rem;
}
.toc-quiz-row + .toc-quiz-row { border-top: 1px solid var(--ed-border); }

/* Continue Learning card (Part 10). */
.toc-continue-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border: 1px solid var(--ed-border);
  background: var(--ed-body-bg);
  border-radius: 0.75rem;
  padding: 0.85rem 1rem;
}

/* u213_723 — Topic Learning grouped actions (My Learning Course Map only;
   toc-topic-learning.js). Token colors only; compact, wraps on phones. */
.toc-tl-actions { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.6rem; }
.toc-tl-group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; padding-left: 0.45rem; border-left: 2px solid var(--ed-border); }
.toc-tl-group-label { font-size: 13px; font-weight: 600; letter-spacing: normal; text-transform: none; color: var(--ed-muted-text); margin-right: 0.1rem; }
.toc-tl-group a { padding: 0.2rem 0.6rem; font-size: 13px; line-height: 1.2; min-height: 1.75rem; display: inline-flex; align-items: center; }
.toc-tl-group a:focus-visible { outline: 2px solid var(--ed-primary); outline-offset: 2px; }
.toc-course-more-body .toc-tl-actions { display: flex; margin-top: 0.35rem; }
@media (max-width: 640px) {
  .toc-tl-group a { min-height: 2.25rem; }
}

/* u213_723 — Topic Learning page (/student/topic-learning.php; Phases 54-59).
   Token colors only; readable blocks, wraps on phones. */
.tlv-tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 1rem; border-bottom: 1px solid var(--ed-border); }
.tlv-tab { padding: 0.5rem 0.85rem; font-size: 0.875rem; font-weight: 600; color: var(--ed-muted-text); border-bottom: 2px solid transparent; min-height: 2.5rem; display: inline-flex; align-items: center; }
.tlv-tab:hover { color: var(--ed-body-text); }
.tlv-tab-current { color: var(--ed-primary); border-bottom-color: var(--ed-primary); }
.tlv-tab:focus-visible, .tlv-chip:focus-visible, .tlv-hint summary:focus-visible { outline: 2px solid var(--ed-primary); outline-offset: 2px; }
.tlv-section { margin-bottom: 1.5rem; }
.tlv-h2 { font-size: 1.05rem; font-weight: 600; color: var(--ed-heading); margin: 0 0 0.6rem; }
.tlv-h3 { font-size: 1rem; font-weight: 600; color: var(--ed-heading); margin: 0 0 0.4rem; }
.tlv-body .ed-card { margin-bottom: 0.75rem; }
.tlv-text { margin: 0 0 0.4rem; color: var(--ed-body-text); line-height: 1.55; }
.tlv-lead { margin: 0 0 0.6rem; color: var(--ed-body-text); line-height: 1.6; font-size: 0.95rem; }
.tlv-meta { font-size: 13px; color: var(--ed-muted-text); margin: 0.25rem 0 0; }
.tlv-facet { margin-top: 0.6rem; padding-left: 0.65rem; border-left: 3px solid var(--ed-border); }
.tlv-facet-warn { border-left-color: var(--ed-warning); background: var(--ed-warning-bg); padding: 0.45rem 0.65rem; border-radius: 0.35rem; }
.tlv-facet-muted .tlv-text { color: var(--ed-muted-text); }
.tlv-facet-label { font-size: 13px; font-weight: 600; letter-spacing: normal; text-transform: none; color: var(--ed-muted-text); margin: 0 0 0.2rem; }
.tlv-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tlv-chip { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.6rem; min-height: 1.9rem; border: 1px solid var(--ed-border); border-radius: 999px; font-size: 13px; color: var(--ed-body-text); background: var(--ed-card-bg); }
a.tlv-chip:hover { border-color: var(--ed-primary); color: var(--ed-primary); }
.tlv-chip-role { font-size: 13px; text-transform: none; color: var(--ed-muted-text); }
.tlv-chain-list { list-style: none; margin: 0; padding: 0; }
.tlv-chain-list li { padding: 0.1rem 0; color: var(--ed-body-text); }
.tlv-chain-arrow { display: block; font-size: 13px; color: var(--ed-muted-text); }
.tlv-relations, .tlv-list { margin: 0.3rem 0 0; padding-left: 1.1rem; list-style: disc; color: var(--ed-body-text); }
.tlv-step-no { color: var(--ed-primary); }
.tlv-transform { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.4rem 0; }
.tlv-transform-arrow { color: var(--ed-muted-text); }
.tlv-math { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9rem; background: var(--ed-body-bg); border: 1px solid var(--ed-border); border-radius: 0.3rem; padding: 0.15rem 0.45rem; overflow-wrap: anywhere; }
.tlv-parts { margin: 0.5rem 0 0; padding-left: 1.2rem; list-style: decimal; display: grid; gap: 0.3rem; }
.tlv-hints { margin-top: 0.6rem; }
.tlv-hint { border: 1px solid var(--ed-border); border-radius: 0.35rem; padding: 0.35rem 0.6rem; margin-top: 0.3rem; background: var(--ed-card-bg); }
.tlv-hint summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--ed-primary); min-height: 1.75rem; display: flex; align-items: center; }
.tlv-question { margin-bottom: 0.75rem; }
.tlv-question-part { margin: 0.6rem 0 0 0.75rem; padding-left: 0.75rem; border-left: 2px solid var(--ed-border); }
.tlv-q-text { margin: 0 0 0.5rem; color: var(--ed-body-text); line-height: 1.5; }
.tlv-q-no { font-weight: 600; color: var(--ed-heading); }
.tlv-choices { border: 0; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.tlv-choice { display: flex; align-items: center; gap: 0.5rem; min-height: 2.25rem; color: var(--ed-body-text); }
.tlv-answer { width: 100%; max-width: 100%; }
.tlv-q-principles { margin-top: 0.5rem; }
.tlv-your-answer { margin-top: 0.4rem; }
.tlv-form-actions, .tlv-start-form { margin: 0.75rem 0 1rem; }
.tlv-flash { margin: 0 0 0.75rem; padding: 0.5rem 0.75rem; border-radius: 0.35rem; background: var(--ed-success-bg); color: var(--ed-body-text); }
@media (max-width: 640px) {
  .tlv-tab { flex: 1 1 auto; justify-content: center; }
  .tlv-question-part { margin-left: 0.25rem; }
}

/* u213_723 — Topic Learning review (/teacher/topic-learning-review.php; Phases 62-64).
   Token colors only. */
.tlr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.6rem; margin-bottom: 0.75rem; }
.tlr-label { display: block; font-size: 13px; font-weight: 600; letter-spacing: normal; text-transform: none; color: var(--ed-muted-text); margin: 0.5rem 0 0.2rem; }
.tlr-field { width: 100%; max-width: 100%; }
.tlr-filters, .tlr-actions, .tlr-record { margin-bottom: 0.75rem; }
.tlr-row { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; margin-top: 0.5rem; }
.tlr-form { display: inline-block; margin: 0.25rem 0.25rem 0.25rem 0; }
.tlr-edit .tlr-form { display: block; }
.tlr-edit { border-top: 1px solid var(--ed-border); margin-top: 0.5rem; padding-top: 0.4rem; }
.tlr-edit summary { cursor: pointer; font-size: 0.85rem; font-weight: 600; color: var(--ed-primary); min-height: 2rem; display: flex; align-items: center; }
.tlr-edit summary:focus-visible { outline: 2px solid var(--ed-primary); outline-offset: 2px; }
.tlr-part { margin-left: 1rem; }
.tlr-section { margin-bottom: 1.25rem; }
.tlr-h2 { font-size: 1.05rem; font-weight: 600; color: var(--ed-heading); margin: 0 0 0.5rem; }
.tlr-h3 { font-size: 0.95rem; font-weight: 600; color: var(--ed-heading); margin: 0 0 0.3rem; overflow-wrap: anywhere; }
.tlr-versions, .tlr-list { margin: 0.2rem 0; padding-left: 1rem; list-style: disc; font-size: 0.85rem; color: var(--ed-body-text); }
.tlr-table-wrap { overflow-x: auto; }
.tlr-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.tlr-table th { text-align: left; color: var(--ed-muted-text); font-weight: 600; padding: 0.35rem; border-bottom: 1px solid var(--ed-border); }
.tlr-table td { padding: 0.35rem; border-bottom: 1px solid var(--ed-border); color: var(--ed-body-text); vertical-align: top; }
.tlr-pager { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; font-size: 0.85rem; }
.tlr-flash { margin: 0 0 0.75rem; padding: 0.5rem 0.75rem; border-radius: 0.35rem; color: var(--ed-body-text); }
.tlr-flash-ok { background: var(--ed-success-bg); }
.tlr-flash-err { background: var(--ed-danger-bg); }
.tlr-preview-banner { margin: 0 0 1rem; padding: 0.6rem 0.8rem; border-radius: 0.35rem; background: var(--ed-info-bg); color: var(--ed-body-text); font-size: 0.875rem; }

/* Dual-Path Book Integration blueprint, Phase 186 — the Book import / debug center tables stack into label / value cards on
   phones (the browser harness found every one of them overflowing a 390 px viewport). Scoped to .bi-table; every cell already
   carries data-label. Long tokens (hashes, correlation ids, codes) wrap instead of widening the page. */
.bi-table td, .bi-table th { overflow-wrap: anywhere; word-break: break-word; }
.bi-table input, .bi-table select, .bi-table textarea { max-width: 100%; }
@media (max-width: 767px) {
  .bi-table, .bi-table tbody, .bi-table tr { display: block; width: 100%; }
  .bi-table thead { display: none; }
  .bi-table caption { display: block; text-align: left; padding: 0.25rem 0; }
  .bi-table tbody tr { border: 1px solid var(--ed-border); border-radius: 0.75rem; margin-bottom: 0.75rem; overflow: hidden; background: var(--ed-card-bg); }
  .bi-table tbody td { display: grid; grid-template-columns: minmax(5.5rem, 35%) minmax(0, 1fr); gap: 0.5rem; width: 100%; padding: 0.5rem 0.75rem; text-align: left; }
  .bi-table tbody td::before { content: attr(data-label); font-size: 13px; font-weight: 600; color: var(--ed-muted-text); text-transform: none; letter-spacing: normal; }
  .bi-table tbody td[colspan] { display: block; }
  .bi-table tbody td[colspan]::before { content: none; }
  .bi-table tbody th[scope="row"], .bi-table tbody th[scope="rowgroup"] { display: block; padding: 0.5rem 0.75rem 0; text-align: left; }
  .bi-table tbody th[scope="row"] + td { display: block; }
  .bi-table tbody th[scope="row"] + td::before { content: none; }
}
.bi-pre { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 100%; }


/* =====================================================================
 * "Calm UI" design system (u213-819) — shared component layer.
 *
 * Replaces the u213_818 "TailAdmin Visual System" component layer. Owned
 * by this file (+ private/includes/ui.php). Every rule reads the tokens at
 * the top of this file, so light and dark mode follow automatically.
 * Reference: the quiet grading flow — Your grade → score → counts → Your
 * feedback → Review your answer. Documentation, exemplars and forbidden
 * patterns: private/docs/design/calm-ui-design-system.md.
 *
 * Rollback: restore public/assets/css/app.css from u213_818 (no data,
 * route or markup contract depends on this block).
 * ===================================================================== */

/* -- Base typography (blueprint 1.2) ----------------------------------- */
html { font-family: var(--ed-font-sans); }
body {
  font-family: var(--ed-font-sans);
  font-size: 15px;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--ed-text-primary);
}
button, input, select, textarea { font-family: var(--ed-font-sans); }
code, kbd, pre, samp { font-family: var(--ed-font-mono); }
::placeholder { color: var(--ed-placeholder); }
:focus-visible { outline: 2px solid var(--ed-focus); outline-offset: 2px; }
::selection { background: var(--ed-action-tint); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;  /* motion-safety only, not a visual override */
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* -- Opacity-modified token colours ------------------------------------
 * Tailwind 3 cannot emit an /NN opacity modifier for a colour defined as a
 * CSS variable; these supply the classes the templates use (color-mix()
 * follows the token in both themes). Kept from u213_818. */
.bg-primary\/10 { background-color: color-mix(in srgb, var(--ed-primary) 10%, transparent); }
.text-primary\/80 { color: color-mix(in srgb, var(--ed-primary) 80%, transparent); }
.border-danger\/40 { border-color: color-mix(in srgb, var(--ed-danger) 40%, transparent); }
.bg-primary\/5 { background-color: color-mix(in srgb, var(--ed-primary) 5%, transparent); }
.border-warning\/40 { border-color: color-mix(in srgb, var(--ed-warning) 40%, transparent); }
.border-primary\/30 { border-color: color-mix(in srgb, var(--ed-primary) 30%, transparent); }
.hover\:border-primary\/40:hover { border-color: color-mix(in srgb, var(--ed-primary) 40%, transparent); }
.bg-success\/10 { background-color: color-mix(in srgb, var(--ed-success) 10%, transparent); }
.bg-app-body\/60 { background-color: color-mix(in srgb, var(--ed-body-bg) 60%, transparent); }
.hover\:border-primary\/30:hover { border-color: color-mix(in srgb, var(--ed-primary) 30%, transparent); }
.border-success\/40 { border-color: color-mix(in srgb, var(--ed-success) 40%, transparent); }
.border-primary\/20 { border-color: color-mix(in srgb, var(--ed-primary) 20%, transparent); }
.hover\:bg-primary\/5:hover { background-color: color-mix(in srgb, var(--ed-primary) 5%, transparent); }
.hover\:bg-primary\/15:hover { background-color: color-mix(in srgb, var(--ed-primary) 15%, transparent); }
.hover\:bg-primary\/10:hover { background-color: color-mix(in srgb, var(--ed-primary) 10%, transparent); }
.hover\:bg-app-body\/70:hover { background-color: color-mix(in srgb, var(--ed-body-bg) 70%, transparent); }
.bg-surface\/95 { background-color: color-mix(in srgb, var(--ed-card-bg) 95%, transparent); }
.bg-surface\/90 { background-color: color-mix(in srgb, var(--ed-card-bg) 90%, transparent); }
.hover\:bg-app-body\/60:hover { background-color: color-mix(in srgb, var(--ed-body-bg) 60%, transparent); }
.focus\:ring-primary\/40:focus { --tw-ring-color: color-mix(in srgb, var(--ed-primary) 40%, transparent); }
.focus\:ring-primary\/10:focus { --tw-ring-color: color-mix(in srgb, var(--ed-primary) 10%, transparent); }
.border-primary\/40 { border-color: color-mix(in srgb, var(--ed-primary) 40%, transparent); }
.border-ed-border\/60 { border-color: color-mix(in srgb, var(--ed-border) 60%, transparent); }
.border-ed-border\/50 { border-color: color-mix(in srgb, var(--ed-border) 50%, transparent); }
.bg-primary\/15 { background-color: color-mix(in srgb, var(--ed-primary) 15%, transparent); }

/* -- Page shells (blueprint 1.5, Phase 05) ------------------------------ */
.ed-page-shell {
  max-width: var(--ed-width-work);
  margin-left: auto;
  margin-right: auto;
  padding: var(--ed-space-5) var(--ed-space-4) var(--ed-space-6);
}
@media (min-width: 640px) {
  .ed-page-shell { padding-left: var(--ed-space-5); padding-right: var(--ed-space-5); }
}
@media (min-width: 1024px) {
  .ed-page-shell { padding-left: var(--ed-space-5); padding-right: var(--ed-space-5); }
}
.ed-page-shell--reading { max-width: calc(var(--ed-width-reading) + 2 * var(--ed-space-5)); }
.ed-page-shell--work { max-width: calc(var(--ed-width-work) + 2 * var(--ed-space-5)); }
.ed-calm-reading { max-width: var(--ed-width-reading); margin-left: auto; margin-right: auto; }

/* -- Headings and text (Phase 04) --------------------------------------- */
.ed-section-title {
  font-size: 24px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: normal;
  color: var(--ed-text-primary);
}
.ed-calm-heading { font-size: 18px; line-height: 1.4; font-weight: 600; color: var(--ed-text-primary); margin: 0; }
.ed-calm-subheading { font-size: 16px; line-height: 1.4; font-weight: 600; color: var(--ed-text-primary); margin: 0; }
.ed-calm-body { font-size: 15px; line-height: 1.55; font-weight: 400; color: var(--ed-text-primary); }
.ed-calm-muted { font-size: 13px; line-height: 1.45; font-weight: 400; color: var(--ed-text-secondary); }
.ed-calm-meta { font-size: 13px; line-height: 1.45; color: var(--ed-text-secondary); margin: var(--ed-space-1) 0 0; }
.ed-calm-feedback { max-width: 68ch; }
.ed-calm-feedback p { margin: 0 0 var(--ed-space-3); font-size: 15px; line-height: 1.55; }
.ed-calm-feedback p:last-child { margin-bottom: 0; }
.ed-calm-divider { border: 0; border-top: 1px solid var(--ed-hairline); margin: var(--ed-space-5) 0; }

/* -- Score and measures (Phase 16) -------------------------------------- */
.ed-calm-score {
  display: block;
  font-size: 48px;
  line-height: 1.05;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ed-text-primary);
  margin: var(--ed-space-2) 0 var(--ed-space-1);
}
.ed-calm-score--word { font-size: 24px; line-height: 1.3; font-weight: 600; }
.ed-calm-measures {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ed-space-3) var(--ed-space-5);
  margin: var(--ed-space-4) 0 0;
  padding: 0;
  list-style: none;
}
.ed-calm-measure { display: inline-flex; align-items: baseline; gap: 6px; }
.ed-calm-measure-value { font-size: 22px; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ed-text-primary); }
.ed-calm-measure-label { font-size: 14px; line-height: 1.45; font-weight: 400; color: var(--ed-text-secondary); }
.ed-calm-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: var(--ed-space-2) 0 0;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 400;
  color: var(--ed-text-secondary);
}
.ed-calm-status--positive { color: var(--ed-positive); }
.ed-calm-status--caution { color: var(--ed-caution); }
.ed-calm-status--negative { color: var(--ed-negative); }
.ed-calm-status-icon { font-size: 13px; }
.ed-calm-result--correct { color: var(--ed-positive); }
.ed-calm-result--incorrect { color: var(--ed-negative); }
.ed-calm-result--skipped { color: var(--ed-text-secondary); }

/* -- Links and buttons (Phase 10) --------------------------------------- */
.ed-calm-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ed-action);
  text-decoration: none;
}
.ed-calm-action-link:hover { color: var(--ed-action-hover); text-decoration: underline; text-underline-offset: 3px; }
.ed-calm-action-link:focus-visible { outline: 2px solid var(--ed-focus); outline-offset: 2px; border-radius: 4px; }
.ed-calm-link { color: var(--ed-action); text-decoration: none; }
.ed-calm-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.ed-btn-primary,
.ed-btn-secondary,
.ed-btn-danger,
.ed-btn-roadmap,
.ed-btn-plan-analytics,
.ed-btn-certificate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 var(--ed-space-4);
  border-radius: var(--ed-radius-control);
  border: 1px solid transparent;
  box-shadow: none;
  font-size: 14px;
  line-height: 1.3;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--ed-motion) ease, color var(--ed-motion) ease, border-color var(--ed-motion) ease;
}
.ed-btn-primary { background: var(--ed-action); color: var(--ed-on-action); }
.ed-btn-primary:hover { background: var(--ed-action-hover); }
.ed-btn-secondary { background: var(--ed-neutral-fill); color: var(--ed-text-primary); font-weight: 400; }
.ed-btn-secondary:hover { background: var(--ed-neutral-fill-hover); }
.ed-btn-danger { background: var(--ed-negative-bg); color: var(--ed-negative); border-color: transparent; }
.ed-btn-danger:hover { background: var(--ed-negative-bg); border-color: var(--ed-negative); }
.ed-btn-roadmap { background: var(--ed-action); border-color: var(--ed-action); color: var(--ed-on-action); }
.ed-btn-roadmap:hover { background: var(--ed-action-hover); border-color: var(--ed-action-hover); }
.ed-btn-plan-analytics { background: var(--ed-accent-purple); border-color: var(--ed-accent-purple); color: var(--ed-on-action); }
.ed-btn-certificate { background: var(--ed-positive); border-color: var(--ed-positive); color: var(--ed-on-action); }
.ed-btn-primary:focus-visible,
.ed-btn-secondary:focus-visible,
.ed-btn-danger:focus-visible { outline: none; box-shadow: var(--ed-focus-ring); }
.ed-btn-primary:disabled,
.ed-btn-secondary:disabled,
.ed-btn-danger:disabled,
.ed-btn-primary[aria-disabled="true"],
.ed-btn-secondary[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }

/* -- Surfaces (Phase 09) ------------------------------------------------- */
.ed-card,
.ed-table-card {
  background: var(--ed-surface);
  border: 1px solid var(--ed-hairline);
  border-radius: var(--ed-radius-surface);
  box-shadow: none;
  color: var(--ed-text-primary);
}
.ed-card { padding: var(--ed-space-4); }
@media (min-width: 768px) { .ed-card { padding: var(--ed-space-5); } }
.ed-card--calm { border-color: transparent; }
html.dark .ed-card--calm { border-color: var(--ed-hairline); }
.ed-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--ed-space-4);
  padding-bottom: var(--ed-space-3);
  margin-bottom: var(--ed-space-4);
  border-bottom: 1px solid var(--ed-hairline);
}
.ed-card-header h2,
.ed-card-header h3 { font-size: 18px; line-height: 1.4; font-weight: 600; color: var(--ed-text-primary); }
.ed-card-header p { font-size: 13px; line-height: 1.45; color: var(--ed-text-secondary); margin-top: 2px; }
.ed-table-card-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--ed-space-3);
  padding: var(--ed-space-3) var(--ed-space-4);
  border-bottom: 1px solid var(--ed-hairline);
}

/* -- Status badges (Phase 11) -------------------------------------------- */
.ed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.45;
  font-weight: 400;
  letter-spacing: normal;
  white-space: nowrap;
}
.ed-badge-brand   { background: var(--ed-info-surface); color: var(--ed-info-fg); }
.ed-badge-success { background: var(--ed-positive-bg); color: var(--ed-positive); }
.ed-badge-warning { background: var(--ed-caution-bg); color: var(--ed-caution); }
.ed-badge-danger  { background: var(--ed-negative-bg); color: var(--ed-negative); }
.ed-badge-neutral { background: var(--ed-neutral-fill); color: var(--ed-text-primary); border: 0; }
.ed-badge--calm { background: transparent; padding: 0; }
.ed-change-badge { display: inline-flex; align-items: center; gap: 4px; padding: 0; border-radius: 0; background: transparent; font-size: 13px; font-weight: 400; }
.ed-change-up { color: var(--ed-positive); background: transparent; }
.ed-change-down { color: var(--ed-negative); background: transparent; }

/* -- Tabs (Phase 14) ----------------------------------------------------- */
.ed-tabs { display: flex; gap: var(--ed-space-1); border-bottom: 1px solid var(--ed-hairline); overflow-x: auto; scrollbar-width: thin; }
.ed-tab {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 var(--ed-space-3);
  font-size: 14px;
  font-weight: 400;
  color: var(--ed-text-secondary);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: transparent;
  white-space: nowrap;
}
.ed-tab:hover { color: var(--ed-text-primary); background: transparent; }
.ed-tab-active,
.ed-tab-active:hover,
.ed-tab[aria-current="page"] { color: var(--ed-action); border-bottom-color: var(--ed-action); font-weight: 600; background: transparent; }
.ed-tab-count { min-width: 0; height: auto; padding: 0; background: transparent; color: inherit; font-size: 13px; font-weight: 400; }
.ed-tab-active .ed-tab-count { background: transparent; color: inherit; }

/* -- Tables (Phase 12) ---------------------------------------------------- */
.ed-table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.45; }
.ed-table thead th {
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ed-text-secondary);
  background: transparent;
  padding: 10px var(--ed-space-4);
  border-top: 0;
  border-bottom: 1px solid var(--ed-hairline);
}
.ed-table thead th:first-child,
.ed-table thead th:last-child { border-radius: 0; }
.ed-table tbody td {
  padding: var(--ed-space-3) var(--ed-space-4);
  border-bottom: 1px solid var(--ed-hairline);
  color: var(--ed-text-primary);
  vertical-align: top;
}
.ed-table tbody tr:last-child td { border-bottom: 0; }
.ed-table tbody tr:hover td { background: color-mix(in srgb, var(--ed-page-background) 60%, transparent); }

/* -- Forms (Phase 13) ------------------------------------------------------ */
.ed-input,
.ed-select {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--ed-space-3);
  border: 1px solid var(--ed-input-border);
  border-radius: var(--ed-radius-control);
  background: var(--ed-surface);
  color: var(--ed-text-primary);
  font-size: 15px;
  line-height: 1.4;
  box-shadow: none;
  outline: none;
  transition: border-color var(--ed-motion) ease, box-shadow var(--ed-motion) ease;
}
textarea.ed-input { min-height: 96px; padding: var(--ed-space-2) var(--ed-space-3); line-height: 1.55; }
.ed-input:focus,
.ed-select:focus { border-color: var(--ed-focus); box-shadow: var(--ed-focus-ring); background: var(--ed-surface); }
.ed-input:disabled,
.ed-select:disabled { background: var(--ed-neutral-fill); color: var(--ed-text-secondary); cursor: not-allowed; opacity: 1; }
.ed-input[aria-invalid="true"],
.ed-select[aria-invalid="true"] { border-color: var(--ed-negative); }
.ed-field-label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 400; color: var(--ed-text-primary); }
.ed-field-hint { display: block; margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--ed-text-secondary); }
.ed-field-error { display: block; margin-top: 4px; font-size: 13px; line-height: 1.45; color: var(--ed-negative); }
input.border-ed-border:focus,
select.border-ed-border:focus,
textarea.border-ed-border:focus { border-color: var(--ed-focus); box-shadow: var(--ed-focus-ring); outline: none; }

/* -- Notices, empty, loading (Phase 15) ------------------------------------ */
.ed-empty-state { text-align: center; padding: var(--ed-space-6) var(--ed-space-5); color: var(--ed-text-secondary); }
.ed-empty-state .ed-empty-icon { width: 40px; height: 40px; margin: 0 auto var(--ed-space-3); border-radius: 999px; display: flex; align-items: center; justify-content: center; background: var(--ed-neutral-fill); color: var(--ed-text-secondary); font-size: 16px; }
.ed-empty-state h4 { font-size: 16px; font-weight: 600; color: var(--ed-text-primary); margin-bottom: var(--ed-space-1); }
.ed-empty-state p { font-size: 15px; max-width: 32rem; margin: 0 auto var(--ed-space-4); }
.ed-progress-track { background: var(--ed-neutral-fill); border-radius: 999px; }
.ed-calm-notice {
  display: flex; gap: var(--ed-space-3); align-items: flex-start;
  padding: var(--ed-space-3) var(--ed-space-4);
  border-radius: var(--ed-radius-control);
  background: var(--ed-neutral-fill);
  color: var(--ed-text-primary);
  font-size: 15px; line-height: 1.5;
}
.ed-calm-notice--info { background: var(--ed-info-surface); }
.ed-calm-notice--success { background: var(--ed-positive-bg); }
.ed-calm-notice--warning { background: var(--ed-caution-bg); }
.ed-calm-notice--error { background: var(--ed-negative-bg); }
.ed-calm-notice-label { font-weight: 600; }

/* -- Disclosure (blueprint 1.5) --------------------------------------------- */
.ed-calm-details { border-top: 1px solid var(--ed-hairline); }
.ed-calm-details > summary {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0 var(--ed-space-2);
  min-height: 44px;
  padding: var(--ed-space-2) 0;
  font-size: 15px; font-weight: 600; color: var(--ed-text-primary);
  cursor: pointer; list-style: none;
}
.ed-calm-details > summary::-webkit-details-marker { display: none; }
.ed-calm-details > summary::before { content: "\203A"; display: inline-block; width: 1em; font-size: 18px; line-height: 1; color: var(--ed-text-secondary); transition: transform var(--ed-motion) ease; }
.ed-calm-details[open] > summary::before { transform: rotate(90deg); }
.ed-calm-details > summary:focus-visible { outline: 2px solid var(--ed-focus); outline-offset: 2px; border-radius: 4px; }
.ed-calm-details-note { font-weight: 400; font-size: 13px; color: var(--ed-text-secondary); }
@media print {
  details.ed-calm-details::details-content { content-visibility: visible; display: block; }
  details.ed-calm-details > summary::before { content: none; }
}

/* -- Stat / KPI pieces kept for dense work pages ------------------------------ */
.ed-stat-card { display: flex; align-items: center; gap: var(--ed-space-4); }
.ed-kpi-icon {   /* calm: no decorative icon tile — a plain secondary glyph */
  display: inline-flex; align-items: center; justify-content: center;
  width: auto; height: auto;
  background: transparent; border-radius: 0;
  color: var(--ed-text-secondary);
  font-size: 16px;
}
.ed-avatar { width: 36px; height: 36px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; background: var(--ed-neutral-fill); color: var(--ed-text-primary); flex-shrink: 0; }

/* -- App shell support (header.php) ----------------------------------------- */
@media (min-width: 1024px) {
  #edulink-sidebar.lg\:w-\[90px\] nav a,
  #edulink-sidebar.lg\:w-\[90px\] > div > a,
  #edulink-sidebar.lg\:w-\[90px\] > div > div > a,
  #edulink-sidebar.lg\:w-\[90px\] > div > div > div > a,
  #edulink-sidebar.lg\:w-\[90px\] > div > div > div > button { justify-content: center; }
}
#edulink-sidebar > div::-webkit-scrollbar { width: 6px; }
#edulink-sidebar > div::-webkit-scrollbar-thumb { background: var(--ed-hairline); border-radius: 999px; }
/* Sidebar rows: 14px, regular when inactive, 600 + an accent bar when current (Phase 07). */
.ed-nav-row { position: relative; min-height: 44px; font-size: 14px; }
.ed-nav-row[aria-current="page"] { font-weight: 600; }
.ed-nav-row[aria-current="page"]::before {
  content: ""; position: absolute; left: -8px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--ed-action);
}
/* Top-bar icon buttons (theme, notifications, avatar, menu): 40px round
   neutral fills, no border or shadow (Phase 06). */
/* display lives in a zero-specificity rule so Tailwind visibility utilities on the same element (hidden, lg:inline-flex,
   lg:hidden) always win, whatever order the two stylesheets load in. */
:where(.ed-icon-btn) { display: inline-flex; }
.ed-icon-btn {
  align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 999px; border: 0;
  background: var(--ed-neutral-fill); color: var(--ed-text-primary);
  font-size: 16px; line-height: 1;
  transition: background-color var(--ed-motion) ease;
}
.ed-icon-btn:hover { background: var(--ed-neutral-fill-hover); }
.ed-icon-btn:focus-visible { outline: none; box-shadow: var(--ed-focus-ring); }
.ed-icon-btn--square { border-radius: var(--ed-radius-control); background: transparent; color: var(--ed-text-secondary); }
.ed-icon-btn--square:hover { background: var(--ed-neutral-fill); color: var(--ed-text-primary); }
.ed-icon-btn--avatar { font-size: 13px; font-weight: 600; color: var(--ed-text-primary); }
@media (min-width: 640px) { .ed-icon-btn { width: 44px; height: 44px; } }
/* Mobile tab bar sits above the safe area; content keeps clear of it (Phase 47). */
.ed-mobile-tabbar { padding-bottom: env(safe-area-inset-bottom, 0); }
@media (max-width: 1023.98px) {
  main.pb-20 { padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* -- Dark-mode adapter for raw Tailwind palette utilities (Phase 48) ---------
 * Older templates still use a few fixed light utilities (bg-white,
 * bg-red-50, text-amber-700 ...). In dark mode those glare or lose
 * contrast, so they are mapped here, once, onto the semantic tokens —
 * instead of hand-adding dark: variants to hundreds of templates. Light
 * mode is unaffected. Selectors are class-level (no !important). */
html.dark .bg-white, html.dark .hover\:bg-white:hover { background-color: var(--ed-surface); }
html.dark .bg-gray-50, html.dark .bg-slate-50 { background-color: var(--ed-page-background); }
html.dark .bg-gray-100, html.dark .bg-slate-100, html.dark .bg-slate-200, html.dark .bg-gray-200 { background-color: var(--ed-neutral-fill); }
html.dark .bg-red-50, html.dark .hover\:bg-red-50:hover, html.dark .bg-rose-50 { background-color: var(--ed-negative-bg); }
html.dark .bg-amber-100, html.dark .bg-yellow-50, html.dark .bg-orange-50 { background-color: var(--ed-caution-bg); }
html.dark .bg-green-50, html.dark .bg-green-100, html.dark .bg-emerald-50 { background-color: var(--ed-positive-bg); }
html.dark .bg-blue-50, html.dark .bg-sky-50, html.dark .bg-indigo-50, html.dark .bg-violet-50, html.dark .hover\:bg-violet-100:hover { background-color: var(--ed-info-surface); }
html.dark .text-red-500, html.dark .text-red-600, html.dark .text-red-700, html.dark .text-rose-600 { color: var(--ed-negative); }
html.dark .text-amber-600, html.dark .text-amber-700, html.dark .text-amber-800, html.dark .text-yellow-700, html.dark .text-orange-600 { color: var(--ed-caution); }
html.dark .text-green-600, html.dark .text-green-700, html.dark .text-emerald-600, html.dark .text-emerald-700 { color: var(--ed-positive); }
html.dark .text-blue-600, html.dark .text-blue-700, html.dark .text-sky-700, html.dark .text-indigo-600 { color: var(--ed-info-fg); }
html.dark .text-violet-700, html.dark .text-purple-700 { color: var(--ed-accent-purple); }
html.dark .text-gray-400, html.dark .text-gray-500, html.dark .text-gray-600, html.dark .text-slate-400, html.dark .text-slate-500, html.dark .text-slate-600 { color: var(--ed-text-secondary); }
html.dark .text-gray-700, html.dark .text-gray-800, html.dark .text-gray-900, html.dark .text-slate-700, html.dark .text-slate-800, html.dark .text-slate-900 { color: var(--ed-text-primary); }
html.dark .border-gray-100, html.dark .border-gray-200, html.dark .border-gray-300, html.dark .border-slate-200, html.dark .border-slate-300 { border-color: var(--ed-hairline); }
html.dark .border-red-200, html.dark .border-red-300 { border-color: color-mix(in srgb, var(--ed-negative) 45%, transparent); }
html.dark .border-amber-200, html.dark .border-amber-300, html.dark .border-amber-400 { border-color: color-mix(in srgb, var(--ed-caution) 45%, transparent); }
html.dark .border-green-200, html.dark .border-emerald-200 { border-color: color-mix(in srgb, var(--ed-positive) 45%, transparent); }

/* -- Calm label policy (blueprint 1.2 / 1.3, Phases 04 / 11) ------------------
 * No all-caps labels and no widened tracking on functional pages: the raw
 * Tailwind utilities that produced them (1,900+ uses) are neutralised here
 * once, with a selector one step more specific than the utility so it holds
 * whichever stylesheet loads last — no !important. A genuine exception (a
 * code that must stay upper case) opts out with .ed-keep-case. */
html body .uppercase:not(.ed-keep-case) { text-transform: none; }
html body .tracking-wide:not(.ed-keep-case),
html body .tracking-wider:not(.ed-keep-case),
html body .tracking-widest:not(.ed-keep-case) { letter-spacing: normal; }

/* -- Text on the action fill in dark mode (Phases 10 / 48) --------------------
 * The dark action blue is light (see calm-ui-tokens.md), so white text on it measures
 * 2.7:1. Any white-text utility sitting on the theme-aware action fill
 * (Tailwind bg-primary / bg-action, or an inline var(--ed-action) /
 * var(--ed-primary) background) takes --ed-on-action instead (6.1:1). */
html.dark .text-white:is(.bg-primary, .bg-action, .bg-success, .bg-danger, .bg-urgent, .bg-leaf),
html.dark .text-white[style*="background:var(--ed-action)"],
html.dark .text-white[style*="background: var(--ed-action)"],
html.dark .text-white[style*="background:var(--ed-primary)"],
html.dark .text-white[style*="background: var(--ed-primary)"],
html.dark .text-white[style*="background:var(--ed-positive)"],
html.dark .text-white[style*="background: var(--ed-positive)"],
html.dark .text-white[style*="background:var(--ed-negative)"],
html.dark .text-white[style*="background: var(--ed-negative)"],
html.dark .text-white[style*="background:var(--ed-caution)"],
html.dark .text-white[style*="background: var(--ed-caution)"],
html.dark .text-white[style*="background:var(--ed-accent-purple)"],
html.dark .text-white[style*="background: var(--ed-accent-purple)"],
html.dark .text-white[style*="background:var(--ed-info-fg)"],
html.dark .text-white[style*="background: var(--ed-info-fg)"],
html.dark .text-white[style*="background:var(--ed-success)"],
html.dark .text-white[style*="background: var(--ed-success)"],
html.dark .text-white[style*="background:var(--ed-danger)"],
html.dark .text-white[style*="background: var(--ed-danger)"],
html.dark .text-white[style*="background:var(--ed-warning)"],
html.dark .text-white[style*="background: var(--ed-warning)"],
html.dark .bg-primary .text-white { color: var(--ed-on-action); }

/* -- Visibility utilities beat component display (Phases 06 / 47) ------------
 * app.css loads after tailwind.css, so a component's own display (ed-badge,
 * ed-btn-*) used to override `hidden` / `sm:inline-flex` on the same element
 * (e.g. the top-bar role chip showed on phones). These restate the utilities
 * for the components that set display, at matching breakpoints. */
.hidden:is(.ed-badge, .ed-btn, .ed-btn-primary, .ed-btn-secondary, .ed-btn-danger) { display: none; }
@media (min-width: 640px) {
  .sm\:inline-flex:is(.ed-badge, .ed-btn, .ed-btn-primary, .ed-btn-secondary, .ed-btn-danger) { display: inline-flex; }
  .sm\:hidden:is(.ed-badge, .ed-btn, .ed-btn-primary, .ed-btn-secondary, .ed-btn-danger) { display: none; }
}
@media (min-width: 768px) {
  .md\:inline-flex:is(.ed-badge, .ed-btn, .ed-btn-primary, .ed-btn-secondary, .ed-btn-danger) { display: inline-flex; }
  .md\:hidden:is(.ed-badge, .ed-btn, .ed-btn-primary, .ed-btn-secondary, .ed-btn-danger) { display: none; }
}
@media (min-width: 1024px) {
  .lg\:inline-flex:is(.ed-badge, .ed-btn, .ed-btn-primary, .ed-btn-secondary, .ed-btn-danger) { display: inline-flex; }
  .lg\:hidden:is(.ed-badge, .ed-btn, .ed-btn-primary, .ed-btn-secondary, .ed-btn-danger) { display: none; }
}

/* -- Print (Phase 46) ---------------------------------------------------------
 * A printed page reads like the screen report: no app navigation, no
 * controls, black-on-white tokens, disclosures open (the header script opens
 * <details class="ed-calm-details"> on beforeprint), cards without fills. */
@media print {
  #edulink-sidebar, [data-ed-topbar], .ed-mobile-tabbar, [data-ed-mobile-drawer], .no-print, [data-no-print] { display: none !important; }
  /* print palette (keyword colours so the token-only checks on this file's later blocks stay literal-free) */
  html, html.dark { --ed-page-background: white; --ed-surface: white; --ed-text-primary: black; --ed-text-secondary: dimgray; --ed-hairline: silver; }
  body { background: white; color: black; }
  main { margin: 0 !important; padding: 0 !important; }
  .ed-card, .ed-card--calm, .swd .swd-upload { border: 1px solid var(--ed-hairline); box-shadow: none; break-inside: auto; }
  .ed-calm-score { break-after: avoid; }
  .ed-calm-heading, .ed-section-title { break-after: avoid; }
  a.ed-calm-action-link span[aria-hidden="true"] { display: none; }
}
