/* === UD 10 — design system ===============================================
   Estética: libro de texto académico moderno.
   - Tipografía: Source Serif 4 (titulares) + Inter (UI) + JetBrains Mono (código)
   - Color: papel cálido + tinta azul oscuro como único acento
   - Claro por defecto; oscuro con [data-theme="dark"]
============================================================================ */

:root {
  --bg:          #f7f4ee;
  --paper:       #ffffff;
  --ink:         #1a1a1d;
  --ink-soft:    #3b3b42;
  --muted:       #767680;
  --line:        #e4ddd0;
  --line-strong: #c9c1b2;
  --accent:      #1f3a8a;
  --accent-soft: #eef1fb;
  --ok:          #0f6f3f;
  --ok-soft:     #e0f0e6;
  --warn:        #8a5200;
  --warn-soft:   #fbeecf;
  --err:         #a22020;
  --err-soft:    #f8e0dc;
  --highlight:   #fff3c4;

  --serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 4px;
  --radius-lg: 10px;
  --maxw: 1180px;
  --maxw-reading: 760px;

  --shadow-card: 0 1px 2px rgba(31,58,138,0.04), 0 6px 18px -12px rgba(31,58,138,0.18);
}

[data-theme="dark"] {
  --bg:          #14151a;
  --paper:       #1c1e25;
  --ink:         #ececef;
  --ink-soft:    #c9c9d1;
  --muted:       #8b8b95;
  --line:        #2b2d36;
  --line-strong: #3a3c47;
  --accent:      #9eb4ff;
  --accent-soft: #1f2440;
  --ok:          #4ec08a;
  --ok-soft:     #1d2e25;
  --warn:        #e0a84a;
  --warn-soft:   #2e2416;
  --err:         #e07070;
  --err-soft:    #2e1a1a;
  --highlight:   #3a341a;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 6px 18px -12px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
h1 { font-size: clamp(1.8rem, 3.3vw, 2.4rem); line-height: 1.18; margin: 0 0 0.4em; }
h2 { font-size: clamp(1.35rem, 2.4vw, 1.7rem); line-height: 1.25; margin: 0 0 0.5em; }
h3 { font-size: 1.12rem; margin: 1.4em 0 0.4em; color: var(--ink); }
h4 { font-size: 0.95rem; font-weight: 600; margin: 1em 0 0.4em; }
p  { margin: 0 0 1em; color: var(--ink-soft); }

a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

code, kbd, .kbd {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 3px;
}
[data-theme="dark"] code,
[data-theme="dark"] kbd,
[data-theme="dark"] .kbd { background: var(--accent-soft); color: var(--accent); }

/* === LAYOUT ============================================================ */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none !important;
  color: inherit !important;
}
.brand-mark {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  color: var(--accent);
  font-style: italic;
  line-height: 1;
}
.brand-title { font-family: var(--serif); font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.brand-sub { font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }

.tabs-top {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  justify-content: center;
  min-width: 0;
}
.tabs-top a {
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}
.tabs-top a:hover { color: var(--ink); text-decoration: none; background: color-mix(in oklab, var(--paper) 60%, transparent); }
.tabs-top a.active { color: var(--accent); background: var(--accent-soft); }

/* === BREADCRUMBS ======================================================= */
.breadcrumbs {
  flex: 1;
  font-size: 13px;
  color: var(--muted);
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  min-width: 0;
}
.breadcrumbs a { color: var(--ink-soft); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); text-decoration: underline; }
.breadcrumbs span { color: var(--muted); }
.breadcrumbs .sep { opacity: 0.4; }

/* === SUBNAV DEL TEMA UD10 ============================================= */
.subnav-wrap {
  border-top: 1px solid var(--line);
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
}
.subnav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 4px 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav a {
  background: transparent;
  border: none;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s;
}
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a.active { color: var(--accent); border-bottom-color: var(--accent); }

.theme-toggle {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.theme-toggle:hover { background: var(--paper); color: var(--ink); }

.page {
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 40px 24px 72px;
  flex: 1;
}

/* === HERO (landings) ================================================== */
.hero {
  padding: 8px 0 40px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 40px;
}
.hero-eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
  font-weight: 500;
}
.hero h1 { margin-bottom: 16px; max-width: 22ch; }
.hero-lead {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 62ch;
  line-height: 1.6;
  margin: 0;
}

/* === COURSE SECTIONS ================================================== */
.course-section { margin-top: 48px; }
.course-header {
  display: grid;
  grid-template-columns: minmax(0, 220px) 1fr;
  gap: 40px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}
@media (max-width: 720px) {
  .course-header { grid-template-columns: 1fr; gap: 8px; }
}
.course-label {
  font-family: var(--sans);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-weight: 500;
  padding-top: 6px;
}
.course-title {
  font-size: 1.55rem;
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 600;
}
.course-desc { color: var(--ink-soft); margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.6; }

/* === UNIT / ASIGNATURA CARDS ========================================= */
.unit-card {
  display: flex; flex-direction: column;
  min-height: 140px;
}
.unit-card[data-locked="true"] { cursor: default; opacity: 0.55; }
.unit-card[data-locked="true"]:hover { border-color: var(--line); transform: none; box-shadow: var(--shadow-card); }
.unit-num {
  font-family: var(--serif);
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.unit-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 8px;
  color: var(--ink);
}
.unit-desc {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 12px;
  flex: 1;
}
.unit-tag {
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.unit-tag.active { color: var(--accent); }

.card.asignatura {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;
  gap: 10px 18px;
  padding: 22px 24px;
  min-height: 150px;
}
.card.asignatura .asig-mark {
  grid-row: 1 / span 2;
  font-family: var(--serif);
  font-size: 52px;
  color: var(--accent);
  line-height: 0.85;
  align-self: start;
  padding-top: 4px;
  opacity: 0.9;
}
.card.asignatura h3 {
  margin: 0;
  font-size: 1.25rem;
}
.card.asignatura > div {
  display: flex; flex-direction: column; gap: 6px;
}
.card.asignatura .chip {
  grid-column: 2;
  justify-self: start;
  align-self: end;
}

/* === PANEL (sección / bloque de contenido) ============================ */
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}
.panel > h2:first-child { margin-top: 0; }
.panel > h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  margin-top: 0;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.panel > h3 {
  font-family: var(--serif);
  color: var(--accent);
  font-size: 1.08rem;
  margin-top: 1.8em;
}
.panel p, .panel li {
  font-family: var(--sans);
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.7;
}
.panel p strong, .panel li strong { color: var(--ink); font-weight: 600; }
.panel ol, .panel ul { padding-left: 22px; margin: 0 0 1em; }
.panel ol li, .panel ul li { margin-bottom: 6px; }

/* === HINT (pie de ayuda) =============================================== */
.hint {
  color: var(--muted);
  font-size: 13.5px;
  margin: 6px 0 0;
  line-height: 1.55;
}

/* === GRID ============================================================== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* === CARD (landing, listas, ejemplos clickables) ====================== */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.2s;
  text-decoration: none !important;
  color: inherit !important;
  display: flex; flex-direction: column;
  min-height: 110px;
  position: relative;
  box-shadow: var(--shadow-card);
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -8px rgba(31,58,138,0.3);
}
.card h3 {
  font-family: var(--serif);
  font-size: 1.08rem;
  margin: 0 0 8px;
  color: var(--ink);
}
.card p {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
  flex: 1;
}

/* === BOTONES =========================================================== */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary,
.btn:not(.ghost):not(.sm) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn.primary:hover,
.btn:not(.ghost):not(.sm):hover { background: color-mix(in oklab, var(--accent) 85%, black); color: #fff; border-color: var(--accent); }
.btn.ghost {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
}
.btn.ghost:hover { color: var(--accent); border-color: var(--accent); background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }

/* === CHIP ============================================================== */
.chip {
  display: inline-block;
  font-family: var(--sans);
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
  margin-right: 6px;
  border: none;
}
.chip.ok   { background: var(--ok-soft);   color: var(--ok);   }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.err  { background: var(--err-soft);  color: var(--err);  }

/* === INPUTS / LABELS =================================================== */
input[type="text"], input[type="number"], select, textarea {
  font: inherit;
  font-family: var(--mono);
  font-size: 14px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  min-width: 120px;
  line-height: 1.4;
}
textarea { font-family: var(--mono); line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
label {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  margin-right: 6px;
  display: inline-block;
  margin-bottom: 4px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 12px;
}

/* === TEORÍA / TRUCOS (callouts) ======================================== */
.theory {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 16px 20px;
  border-radius: 0 8px 8px 0;
  margin: 18px 0;
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  line-height: 1.65;
}
.theory h4 {
  margin: 0 0 8px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}
.theory p, .theory li {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
  line-height: 1.7;
}
.theory ol, .theory ul { padding-left: 22px; margin: 6px 0 10px; }
.theory ul.clean, ul.clean { list-style: none; padding-left: 0; }
.theory ul.clean li, ul.clean li { margin: 6px 0; color: var(--ink-soft); }
.theory table { margin-top: 10px; }

/* === TABLE ============================================================= */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-family: var(--sans);
  font-size: 14.5px;
}
.table th, .table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink-soft);
}
.table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
}
.theory .table th { color: var(--accent); }

/* === DETAILS / SUMMARY ================================================= */
details {
  margin: 14px 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
details > summary {
  cursor: pointer;
  color: var(--accent);
  padding: 4px 0;
  list-style: none;
  font-weight: 500;
  font-size: 14px;
  user-select: none;
}
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: "▸";
  display: inline-block;
  transition: transform 0.15s;
  margin-right: 6px;
}
details[open] > summary::before { transform: rotate(90deg); }

/* === EJERCICIO (con pasos desplegables) =============================== */
.exercise {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.exercise header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 10px;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: none;
  padding-bottom: 0;
}
.exercise header strong {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--ink);
  font-size: 1.05rem;
}
.exercise .statement {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--ink);
  margin: 8px 0 14px;
  line-height: 1.5;
}
.exercise .steps {
  display: none;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.exercise.open .steps { display: block; }
.exercise .steps ol {
  padding-left: 22px;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.7;
  font-family: var(--serif);
}
.exercise .steps li { margin-bottom: 10px; }
.exercise .steps p strong { color: var(--ink); }

/* === PLOT ============================================================== */
.plot {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  margin-top: 14px;
  overflow: hidden;
}
.plot svg { display: block; margin: 0 auto; background: var(--paper); }
.plot svg text { fill: var(--ink-soft); font-family: var(--sans); }
.plot svg .tick line { stroke: var(--line); }
.plot svg path.domain { stroke: var(--line-strong); }
[data-theme="dark"] .plot svg .y.axis line.origin,
[data-theme="dark"] .plot svg .x.axis line.origin { stroke: var(--ink-soft); }

/* === RESULT ============================================================ */
.result {
  padding: 12px 16px;
  border-radius: 8px;
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 15.5px;
  color: var(--ink);
  line-height: 1.6;
  border: 1px solid var(--line);
  background: var(--paper);
}
.result.ok   { background: var(--ok-soft);   border-color: color-mix(in oklab, var(--ok) 35%, transparent); }
.result.err  { background: var(--err-soft);  border-color: color-mix(in oklab, var(--err) 35%, transparent); }
.result.info { background: var(--accent-soft); border-color: color-mix(in oklab, var(--accent) 30%, transparent); }
.result strong { color: var(--ink); font-weight: 600; }

/* === CHIPS / badges diversos =========================================== */
.badge {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  background: var(--paper);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  border: 1px solid var(--line);
}

/* === LISTAS LIMPIAS ==================================================== */
ul.clean {
  list-style: none;
  padding-left: 0;
}
ul.clean li {
  margin: 6px 0;
  color: var(--ink-soft);
  padding-left: 2px;
}

/* === FOOTER ============================================================ */
.footer {
  border-top: 1px solid var(--line);
  margin-top: 40px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: transparent;
}
.footer a { color: var(--ink-soft); }

/* === MATHJAX =========================================================== */
mjx-container { color: var(--ink); }
mjx-container[display="true"] { margin: 0.6em 0 !important; }

/* === Responsive ======================================================== */
@media (max-width: 720px) {
  .brand-title { font-size: 13px; }
  .brand-sub { font-size: 10px; }
  .tabs-top { justify-content: flex-start; }
  .tabs-top a { padding: 6px 10px; font-size: 13px; }
  .panel { padding: 22px 20px; }
  .exercise { padding: 18px 20px; }
  .page { padding: 28px 16px 60px; }
}

@media (max-width: 480px) {
  .topbar-inner { padding: 12px 16px; gap: 12px; }
  .brand { gap: 8px; }
  .brand-mark { font-size: 24px; }
  .theme-toggle { padding: 5px 10px; font-size: 12px; }
}

/* === KIND-CODED PANELS (teoría / ejercicio / examen / interactivo / referencia) === */
.panel--theory      { border-left: 4px solid #6b88d8; }
.panel--exercise    { border-left: 4px solid #2c7a5b; }
.panel--exam        { border-left: 4px solid #b33a6b; }
.panel--interactive { border-left: 4px solid #0e7490; }
.panel--reference   { border-left: 4px solid #c08a1f; }

[data-theme="dark"] .panel--theory      { border-left-color: #9eb4ff; }
[data-theme="dark"] .panel--exercise    { border-left-color: #34d399; }
[data-theme="dark"] .panel--exam        { border-left-color: #f0abfc; }
[data-theme="dark"] .panel--interactive { border-left-color: #67e8f9; }
[data-theme="dark"] .panel--reference   { border-left-color: #fcd34d; }

/* === TOC (índice) ====================================================== */
.panel.toc { padding-bottom: 16px; }
.toc-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 4px 18px;
}
.toc-list .toc-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; margin: 0;
  border-bottom: 1px dashed var(--line);
  font-family: var(--sans);
  font-size: 14.5px;
}
.toc-list .toc-item a {
  color: var(--ink-soft);
  text-decoration: none;
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.toc-list .toc-item a:hover { color: var(--accent); text-decoration: underline; }
.toc-chip {
  display: inline-block;
  font-family: var(--sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  flex-shrink: 0;
  min-width: 86px;
  text-align: center;
}
.toc-item--theory      .toc-chip { color: #4a63b3; background: #eef1fb; }
.toc-item--exercise    .toc-chip { color: #1f5d44; background: #e6f3ec; }
.toc-item--exam        .toc-chip { color: #8a2a52; background: #fbe8f0; }
.toc-item--interactive .toc-chip { color: #0e7490; background: #e0f4f7; }
.toc-item--reference   .toc-chip { color: #8a6010; background: #fbf0d9; }

[data-theme="dark"] .toc-item--theory      .toc-chip { color: #9eb4ff; background: rgba(158,180,255,0.12); }
[data-theme="dark"] .toc-item--exercise    .toc-chip { color: #34d399; background: rgba(52,211,153,0.12); }
[data-theme="dark"] .toc-item--exam        .toc-chip { color: #f0abfc; background: rgba(240,171,252,0.12); }
[data-theme="dark"] .toc-item--interactive .toc-chip { color: #67e8f9; background: rgba(103,232,249,0.12); }
[data-theme="dark"] .toc-item--reference   .toc-chip { color: #fcd34d; background: rgba(252,211,77,0.12); }

@media (max-width: 640px) {
  .toc-list { grid-template-columns: 1fr; }
  .toc-chip { min-width: 76px; font-size: 10px; }
}
