/*
 * Estilos propios de la app de teoría. Los tokens de diseño, botones,
 * cabecera, modal de configuración y el shell (body + sidebar + grid
 * desktop) viven en /shared/*.css.  Aquí solo van reglas específicas
 * de las vistas de teoría (breadcrumb, admin-bar, grid de tarjetas,
 * visor de markdown, etc.).
 */

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ── Breadcrumb ──────────────────────────────────────────────────────── */
.bc {
  background: var(--card);
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--sub);
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.bc a { color: var(--pri); font-weight: 500; }
.bc a:hover { text-decoration: underline; }
.bc-sep { color: var(--border); margin: 0 4px; }
.bc-current { color: var(--text); font-weight: 600; }

/* ── Admin bar ───────────────────────────────────────────────────────── */
.admin-bar {
  padding: 10px 24px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px;
}
.admin-bar-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.admin-hint { color: var(--sub); font-size: 12px; margin-left: auto; }
/* Admin-bar botones más compactos que el resto de la app. */
.admin-bar .btn {
  min-height: 34px; padding: 0.35rem 0.75rem;
  font-size: 0.85rem; font-weight: 500;
}
/* Fila de selección: sale bajo la fila de subir/carpeta/markdown cuando se
 * entra en modo selección. La contra-visual es una línea sutil para
 * separarla de la fila principal sin peso. */
.seleccion-bar {
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.seleccion-bar[hidden] { display: none; }
.seleccion-count { font-weight: 700; font-size: 13px; margin-right: 4px; }

/* ── Grid ────────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  padding: 24px;
}
.card {
  position: relative;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 14px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  text-align: center;
  transition: transform .15s, box-shadow .15s, border-color .15s;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  min-height: 140px;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--pri);
}
/* Cada carpeta hereda un matiz distinto ciclando entre 5 acentos: */
.card.folder { background: linear-gradient(160deg, var(--accent-soft) 0%, var(--card) 70%); }
.card.folder:nth-child(5n+2) { background: linear-gradient(160deg, var(--sky-soft) 0%, var(--card) 70%); }
.card.folder:nth-child(5n+3) { background: linear-gradient(160deg, var(--lavender-soft) 0%, var(--card) 70%); }
.card.folder:nth-child(5n+4) { background: linear-gradient(160deg, var(--coral-soft) 0%, var(--card) 70%); }
.card.folder:nth-child(5n)   { background: linear-gradient(160deg, var(--leaf-soft) 0%, var(--card) 70%); }
.card.file { background: var(--card); }
.card.visto {
  background: linear-gradient(160deg, var(--ok-light) 0%, var(--card) 70%);
  border-color: var(--ok);
}
.card-emoji { font-size: 44px; line-height: 1; }
.card-name {
  font-size: 14px; font-weight: 600;
  word-break: break-word; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-height: 1.4;
}
.card-meta { font-size: 12px; color: var(--sub); }
.visto-tick {
  position: absolute; top: 8px; right: 40px;
  width: 26px; height: 26px;
  border-radius: 50%;
  padding: 0;
  border: 2px solid var(--border);
  background: var(--card);
  color: transparent;
  font-size: 15px; font-weight: 800;
  line-height: 22px; text-align: center;
  cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s, color .12s;
  z-index: 2;
}

/* Kebab (tres puntos verticales) en la esquina superior derecha de cada
 * tarjeta: dispara el mismo menú contextual que el long-press y el
 * click-derecho. En ficheros convive con el visto-tick a su izquierda;
 * en carpetas ocupa la esquina en solitario y solo se muestra si el
 * usuario puede gestionar (para no exponer un botón sin acciones). */
.card-kebab {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--txt-soft);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 3;
  transition: background .12s, color .12s, transform .1s;
}
.card-kebab:hover,
.card-kebab[aria-expanded="true"] {
  background: var(--pri-soft);
  color: var(--pri-d);
}
[data-theme="dark"] .card-kebab:hover,
[data-theme="dark"] .card-kebab[aria-expanded="true"] { color: var(--pri); }
.card-kebab:active { transform: scale(0.92); }
.card-kebab svg { pointer-events: none; }
/* En modo selección múltiple el kebab no aplica: el click de la tarjeta
 * marca/desmarca y el menú saturaría la UI. */
body.en-seleccion .card-kebab { display: none; }
.visto-tick:hover { transform: scale(1.08); border-color: var(--ok); }
.visto-tick.off:hover .visto-tick-check::before {
  content: "✓"; color: var(--ok); opacity: .5;
}
.visto-tick.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.visto-tick.on:hover { background: var(--pri-d); border-color: var(--pri-d); }
.visto-tick-check { display: block; line-height: 22px; }
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--sub);
}
.empty-ico { font-size: 48px; margin-bottom: 10px; }

/* ── Modales locales (renombrar / borrar) ─────────────────────────────
 * .modal (overlay), .modal-card (caja glassmorph) y .modal-actions
 * viven en shared/modal.css: iguales que en landing y tests.
 * Aquí solo quedan reglas específicas del markup de teoría dentro
 * de la caja. */

.modal .modal-card h3 { font-size: 1.05rem; margin: 0 0 0.75rem; color: var(--txt); font-weight: 700; }
.modal .modal-card p { font-size: 0.9rem; color: var(--txt-soft); margin: 0 0 1rem; word-break: break-word; }
/* Inputs coherentes con /tests/: mismo radius (--radius), padding y foco.
 * Antes teoría usaba 8px + outline verde y en tests eran 16px con halo:
 * salían visualmente distintos entre las dos apps. */
.modal .modal-card input, .modal .modal-card select {
  width: 100%; padding: 0.6rem 0.8rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.95rem; margin-bottom: 0.9rem;
  background: var(--bg-panel); color: var(--txt);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.modal .modal-card input:focus, .modal .modal-card select:focus {
  outline: none;
  border-color: var(--pri);
  box-shadow: 0 0 0 4px var(--pri-glow);
}

/* La cabecera del modal la pinta <ap-modal> con .modal-header. */

.small { font-size: 12.5px; }
.muted { color: var(--sub); }

/* ── Visor / editor de markdown ──────────────────────────────────────── */
.md-view {
  position: fixed; inset: 0;
  background: var(--bg);
  color: var(--txt);
  display: flex; flex-direction: column;
  z-index: 500;
}
.md-view.hidden { display: none; }
.md-view-header {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 14px;
  padding-top: calc(8px + env(safe-area-inset-top, 0));
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border-bottom: 1px solid var(--glass-border);
  flex-wrap: nowrap;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}
@media (min-width: 720px) {
  .md-view-header { gap: 8px; padding: 10px 22px; }
}

/* Botones icon-only del visor: sutiles, cuadrados y del mismo tamaño
 * que las esquinas de un tap de dedo (36-40 px). Sin fondo por defecto. */
.md-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border: 0; background: transparent;
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  flex: 0 0 auto;
  transition: background 0.15s, color 0.15s, transform 0.1s;
  padding: 0;
}
.md-icon svg { width: 20px; height: 20px; }
.md-icon:hover { background: var(--bg-soft); }
.md-icon:active { transform: scale(0.92); }
.md-icon.active {
  background: var(--pri-soft);
  color: var(--pri-d);
}
[data-theme="dark"] .md-icon.active { color: var(--pri); }
.md-icon.md-back { color: var(--sub); }
.md-icon.md-back:hover { color: var(--text); }

/* Wrapper del kebab "Más" con menú flotante. */
.md-mas-wrap { position: relative; }
.md-mas-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  z-index: 20;
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.20);
  display: flex; flex-direction: column;
}
.md-mas-menu.hidden { display: none; }
.md-mas-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border: 0; background: transparent;
  border-radius: 8px;
  color: var(--text); font-family: inherit;
  font-size: 0.95rem; text-align: left;
  cursor: pointer;
}
.md-mas-item svg { width: 18px; height: 18px; flex: 0 0 auto; }
.md-mas-item:hover { background: var(--pri-soft); color: var(--pri-d); }
[data-theme="dark"] .md-mas-item:hover { color: var(--pri); }

.md-title {
  font-weight: 700; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0; max-width: 100%;
  margin-left: 2px;
}
.md-flex { flex: 1 1 auto; min-width: 0; }
.md-status {
  font-size: 12px; color: var(--sub);
  padding: 4px 8px; border-radius: 8px;
  background: var(--bg-soft);
}
.md-status.dirty { color: var(--accent-d); background: var(--accent-soft); }
[data-theme="dark"] .md-status.dirty { color: var(--accent); }
.md-status.saved { color: var(--ok); background: var(--ok-light); }
/* Botones de edición (guardar, cancelar, vista previa): son iconos con
 * el mismo tamaño que los del lector para no romper la línea del header.
 * Solo el guardar recibe un tinte suave para que sea el foco visual
 * (equivalente al viejo botón verde, pero contenido). */
.md-icon.md-save {
  background: var(--pri-soft);
  color: var(--pri-d);
}
.md-icon.md-save:hover { background: var(--pri); color: #fff; }
[data-theme="dark"] .md-icon.md-save { color: var(--pri); }
[data-theme="dark"] .md-icon.md-save:hover { color: #14241D; }

/* ── Barra de búsqueda in-page (aparece bajo el header al pulsar 🔍) ── */
.md-find {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  animation: md-find-in 0.16s ease both;
}
.md-find.hidden { display: none; }
.md-find input[type="search"] {
  flex: 1; min-width: 0;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--txt);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.md-find input[type="search"]:focus {
  border-color: var(--pri);
  box-shadow: 0 0 0 4px var(--pri-glow);
}
.md-find-count {
  font-size: 12px; color: var(--sub);
  padding: 4px 8px; border-radius: 8px;
  background: var(--bg-soft);
  min-width: 42px; text-align: center;
  flex: 0 0 auto;
}
@keyframes md-find-in {
  from { transform: translateY(-6px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Coincidencias de búsqueda y subrayado del usuario ─────────────── */
.md-render mark.md-hit {
  background: var(--accent-soft);
  color: var(--accent-d);
  border-radius: 3px;
  padding: 0 2px;
}
[data-theme="dark"] .md-render mark.md-hit { color: var(--accent); }
.md-render mark.md-hit.current {
  background: var(--accent);
  color: #3B2A0F;
  box-shadow: 0 0 0 2px var(--accent-soft);
}
[data-theme="dark"] .md-render mark.md-hit.current { color: #14241D; }
.md-render mark.md-user-hl {
  background: var(--accent-soft);
  color: inherit;
  border-radius: 3px;
  padding: 0 2px;
  cursor: pointer;
  border-bottom: 2px solid var(--accent);
}
.md-render mark.md-user-hl:hover {
  filter: brightness(0.94);
}

/* Cuando el modo subrayar está activo, cambia el cursor sobre el render. */
.md-body.hl-mode .md-render {
  cursor: text;
  outline: 2px dashed var(--accent);
  outline-offset: -6px;
}
/* Con el modo subrayado activo, el color de selección del navegador
 * confunde: se ve como si el texto estuviera "marcado para copiar" antes
 * de que el mouseup convierta la selección en un subrayado real. Usamos
 * el mismo tinte ámbar del subrayado para que la transición visual sea
 * fluida (no "azul selección" → "ámbar subrayado"). No afecta al resto
 * de la app: fuera del render en modo hl-mode, la selección se ve igual
 * que siempre. */
.md-body.hl-mode .md-render ::selection {
  background: var(--accent-soft);
  color: inherit;
}
.md-body.hl-mode .md-render ::-moz-selection {
  background: var(--accent-soft);
  color: inherit;
}

.md-body {
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  /* Fondo cálido tipo "papel" para que la lectura no sea un bloque de
   * blanco plano. En claro es marfil con leves tintes; en oscuro respeta
   * el tono bosque de los tokens. */
  background:
    radial-gradient(80% 40% at 100% 0%, var(--accent-soft) 0%, transparent 60%),
    radial-gradient(70% 40% at 0% 100%, var(--sky-soft) 0%, transparent 60%),
    var(--bg-soft);
}
[data-theme="dark"] .md-body {
  background:
    radial-gradient(80% 40% at 100% 0%, rgba(244, 208, 63, 0.06) 0%, transparent 60%),
    radial-gradient(70% 40% at 0% 100%, rgba(111, 211, 232, 0.05) 0%, transparent 60%),
    var(--bg);
}
.md-body.editing { grid-template-columns: 1fr 1fr; }
.md-editor {
  display: none;
  width: 100%; height: 100%;
  padding: 20px 22px;
  border: 0; outline: none; resize: none;
  background: var(--card-alt); color: var(--txt);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem; line-height: 1.6;
  border-right: 1px solid var(--border);
}
.md-body.editing .md-editor { display: block; }

/* .md-render vive en un carril centrado con ancho legible (~72ch) en
 * escritorio, para que el texto no se estire de borde a borde. En móvil
 * ocupa todo el ancho disponible. El fondo tipo papel + sombra suave lo
 * separa del entorno y evita la sensación de "texto plano sobre blanco". */
.md-render {
  overflow: auto;
  padding: 1.35rem 1.15rem 3.5rem;
  background: transparent;
  color: var(--txt);
  line-height: 1.7;
  font-size: 1rem;
  font-family: -apple-system, "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
}
.md-render > * {
  max-width: 72ch;
  margin-left: auto;
  margin-right: auto;
}
/* En modo edición lado a lado, no centramos porque cada mitad ya es estrecha. */
.md-body.editing .md-render > * { max-width: none; }
.md-body.editing .md-render { border-left: 0; }
.md-body.preview-only .md-editor { display: none; }
.md-body.preview-only { grid-template-columns: 1fr; }

/* Solo pantallas anchas: editor y preview lado a lado. En móvil se
 * alternan con el botón "Vista previa" para que el textarea sea usable. */
@media (max-width: 720px) {
  .md-body.editing { grid-template-columns: 1fr; }
  .md-body.editing .md-render { display: none; }
  .md-body.editing.show-preview .md-editor { display: none; }
  .md-body.editing.show-preview .md-render { display: block; }
}

/* Contenido markdown renderizado */
.md-render h1, .md-render h2, .md-render h3, .md-render h4 {
  margin: 1.6em 0 0.55em; line-height: 1.25;
  color: var(--txt);
  letter-spacing: -0.01em;
  font-weight: 700;
}
.md-render > *:first-child { margin-top: 0.25rem; }
.md-render h1 {
  font-size: 1.75em;
  border-bottom: 2px solid var(--pri-soft);
  padding-bottom: 0.25em;
  color: var(--pri-d);
}
[data-theme="dark"] .md-render h1 { color: var(--pri); }
.md-render h2 {
  font-size: 1.35em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.2em;
}
.md-render h3 { font-size: 1.15em; color: var(--pri-d); }
[data-theme="dark"] .md-render h3 { color: var(--pri); }
.md-render h4 { font-size: 1em; color: var(--txt-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.md-render p { margin: 0.75em 0; }
.md-render a { color: var(--pri-d); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
[data-theme="dark"] .md-render a { color: var(--pri); }
.md-render a:hover { text-decoration-thickness: 2px; }
.md-render ul, .md-render ol { padding-left: 1.5em; margin: 0.7em 0; }
.md-render li { margin: 0.3em 0; }
.md-render li::marker { color: var(--pri); }
.md-render blockquote {
  border-left: 4px solid var(--pri);
  background: linear-gradient(90deg, var(--pri-soft), transparent 90%);
  color: var(--txt);
  margin: 1em 0; padding: 0.6em 1em;
  border-radius: 8px;
  font-style: italic;
}
.md-render code {
  background: var(--pri-soft);
  color: var(--pri-d);
  padding: 0.1em 0.4em; border-radius: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  font-weight: 500;
}
[data-theme="dark"] .md-render code { color: var(--pri); }
.md-render pre {
  background: var(--bg-panel);
  padding: 0.9em 1em; border-radius: 10px;
  overflow: auto; margin: 1em 0;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.md-render pre code {
  background: transparent; padding: 0;
  font-size: 0.88em; color: var(--txt);
  font-weight: normal;
}
.md-render hr { border: 0; border-top: 1px dashed var(--border); margin: 1.75em 0; }
.md-render table {
  border-collapse: collapse; margin: 1em 0;
  width: 100%;
  background: var(--bg-panel);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.md-render th, .md-render td {
  border: 1px solid var(--border);
  padding: 0.5em 0.75em; text-align: left;
}
.md-render th {
  background: var(--pri-soft);
  color: var(--pri-d);
  font-weight: 700;
}
[data-theme="dark"] .md-render th { color: var(--pri); }
.md-render tr:nth-child(even) td { background: var(--bg-soft); }
.md-render img {
  max-width: 100%; height: auto;
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin: 0.5em 0;
}
.md-render strong { color: var(--txt); font-weight: 700; }
.md-render em { color: var(--txt); }

/* Ajuste tipográfico por breakpoint: en móvil 16px (suficiente para no
 * activar zoom en iOS), en escritorio 17-18px para lectura larga. */
@media (min-width: 720px) {
  .md-render {
    padding: 1.75rem 1.5rem 4rem;
    font-size: 1.05rem;
    line-height: 1.75;
  }
}
@media (min-width: 1100px) {
  .md-render {
    padding: 2.25rem 2rem 5rem;
    font-size: 1.1rem;
  }
}

/* ── Menú contextual ─────────────────────────────────────────────────── */
.ctx-menu {
  position: fixed; z-index: 9998;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; min-width: 180px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  color: var(--text);
}
.ctx-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 6px;
  font-size: 13px; cursor: pointer;
}
.ctx-item:hover { background: var(--pri-soft); }
.ctx-item.danger:hover { background: var(--danger-light); color: var(--danger); }
.ctx-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Buscador de teoría (modal cliente-side) ─────────────────────────── */
#teoria-buscar .modal-card {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
#teoria-buscar .modal-body { flex: 1; min-height: 0; overflow: hidden; }
#teoria-buscar input[type="search"] { margin-top: 4px; }
.teoria-buscar-results {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
.teoria-buscar-results li { margin: 0; }
.teoria-buscar-res {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0;
  padding: 10px 8px; border-radius: 8px;
  color: var(--text);
  font-family: inherit; font-size: 0.95rem;
  cursor: pointer; text-align: left;
}
.teoria-buscar-res:hover { background: var(--pri-soft); }
.teoria-buscar-nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Lista de marcadores (favoritos por documento) ─────────────────── */
#teoria-marcadores .modal-card {
  width: min(560px, 100%);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}
#teoria-marcadores .modal-body { flex: 1; min-height: 0; overflow: hidden; padding-top: 0.75rem; }
.teoria-marcadores-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.teoria-marcadores-lista li {
  display: flex; align-items: stretch; gap: 0.4rem;
  padding: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.teoria-marcadores-lista li:hover {
  transform: translateY(-1px);
  border-color: var(--pri);
  box-shadow: var(--shadow);
}
.teoria-marc-item {
  flex: 1;
  display: grid;
  grid-template-columns: 38px 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.75rem;
  row-gap: 0.1rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  background: transparent; border: 0;
  border-radius: var(--radius);
  color: var(--text);
  font-family: inherit; font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  min-width: 0;
}
.teoria-marc-item > span[aria-hidden="true"] {
  grid-column: 1; grid-row: 1 / span 2;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px;
  border-radius: 12px;
  font-size: 1.35rem;
  background: var(--accent-soft);
  color: var(--accent-d);
}
[data-theme="dark"] .teoria-marc-item > span[aria-hidden="true"] { color: var(--accent); }
.teoria-marc-nombre {
  grid-column: 2; grid-row: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 700;
  color: var(--text);
}
.teoria-marc-ruta {
  grid-column: 2; grid-row: 2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--sub);
  font-size: 0.8rem;
}
.teoria-marc-quitar {
  color: var(--sub);
  margin: auto 0.35rem auto 0;
  border-radius: 10px;
}
.teoria-marc-quitar:hover { color: var(--danger); background: var(--danger-light); }

/* ── Fase 5b: modal de oposición ─────────────────────────────── */
.teoria-op-list {
  list-style: none; padding: 0; margin: 0.75rem 0 0;
  display: flex; flex-direction: column; gap: 6px;
  max-height: 55vh; overflow-y: auto;
}
.teoria-op-list .check-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  width: 100%;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.teoria-op-list .check-item:hover { border-color: var(--pri); background: var(--pri-soft); }
.teoria-op-list .check-item[aria-current="true"] {
  border-color: var(--pri);
  background: var(--pri-soft);
}
.teoria-op-list .check-item strong { font-size: 0.98rem; }

/* Variante multi (con checkbox nativo dentro de un <label>). */
.teoria-op-list .check-item-multi {
  flex-direction: row; align-items: center; gap: 12px;
}
.teoria-op-list .check-item-multi input[type="checkbox"] {
  width: 18px; height: 18px; margin: 0; flex: 0 0 auto;
  accent-color: var(--pri);
}
.teoria-op-list .check-item-multi .check-item-body {
  display: flex; flex-direction: column; gap: 3px; min-width: 0;
}

/* ── Modo selección múltiple ─────────────────────────────────────────── */
.card-check {
  position: absolute; top: 8px; left: 8px;
  z-index: 3;
}
.card-check[hidden] { display: none; }
.card-check input[type="checkbox"] {
  width: 20px; height: 20px; margin: 0;
  accent-color: var(--pri); cursor: pointer;
}
body.en-seleccion .card-check { display: block; }
body.en-seleccion .card { cursor: pointer; }
body.en-seleccion .visto-tick { pointer-events: none; opacity: .5; }
.card.seleccionada {
  outline: 2px solid var(--pri);
  outline-offset: 2px;
  background: var(--pri-soft);
}


/* La cabecera "Home" (saludo + gamif) vive ahora en shared/app-shell.css
 * como #ap-user-home-header — es un elemento compartido entre tests y
 * teoría, preservado por el router SPA al saltar de una app a otra. */


/* ════════════════ DESKTOP (>= 900 px) ════════════════
 * El grid body + topbar + sidebar lo pinta shared/app-shell.css: coloca
 * #app-content en grid-area: main. Aquí solo ajustamos el padding
 * horizontal para que cuadre con /tests/ y damos un ancho legible al
 * contenido de teoría en pantallas muy anchas. */
@media (min-width: 900px) {
  #app-content {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - var(--topbar-h));
  }
  .grid { padding: 1.5rem; }
  .bc, .admin-bar { padding-left: 1.5rem; padding-right: 1.5rem; }
}
