/* /temarios y /temario/<slug> (opos/temarios.py). Solo lo propio: cabecera, «Ahora», temas, examen, leyes e histórico;
   pestañas, chips, paneles, plegables y la tarjeta de la alerta (.siguiente) son de app.css */
.tm-cab { max-width: 62em; }
.tm-eyebrow { display: flex; gap: 6px; align-items: center; margin: 0 0 6px; color: var(--accent); font-weight: 700; font-size: 13.5px; letter-spacing: .02em; text-transform: uppercase; }
.tm-intro { font-size: 16.5px; line-height: 1.55; margin: 8px 0 0; max-width: 62em; }
.tm-chips { list-style: none; margin: 14px 0 0; padding: 0; }
.tm-chips .chip { font-size: 13.5px; padding: 5px 11px; white-space: normal; }
.tm-chips a.chip:hover { text-decoration: none; filter: brightness(.96); }
.tm-chips a.chip { position: relative; }
.tm-chips a.chip::after { content: ""; position: absolute; inset: -8px -3px; }   /* zona táctil 25 → 41 en el móvil */
.tm-fuente { margin: 12px 0 0; }
.tm-tabs { margin-top: 22px; }
.tm-tabs .s { display: none; }
/* en el móvil, las cinco pestañas en una fila: «Plazas» en vez de «Plazas por año» y, a ≤480 px, sin los números
   (los temas ya salen en los chips de arriba). La regla general de app.css las pasaba a dos filas */
@media (max-width: 640px) {
  .tabs.tm-tabs:not(.tabs-grid):has(> :nth-child(5)) { flex-wrap: nowrap; }
  .tm-tabs .l { display: none; }
  .tm-tabs .s { display: inline; }
}
@media (max-width: 480px) { .tm-tabs .count.num { display: none; } }
.tm-h { font-size: 17px; margin: 4px 0 10px; }
.tm-col > .tm-h ~ .tm-h { margin-top: 22px; }

/* Ahora: dos columnas en escritorio (convocatorias y requisitos | alerta y repaso) */
.tm-ahora { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-areas: "conv lado" "req lado"; gap: 0 22px; align-items: start; }
.tm-col-conv { grid-area: conv; }
.tm-col-req { grid-area: req; margin-top: 22px; }
.tm-lado { grid-area: lado; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 84px; }
.tm-alerta { margin: 0; flex-direction: column; align-items: stretch; }
.tm-alerta .btn { width: 100%; }
.tm-mini { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; color: var(--text); }
.tm-mini b { color: var(--accent); }
.tm-mini:hover { text-decoration: none; border-color: var(--accent); }
.tm-convs { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tm-conv { display: flex; flex-direction: column; gap: 7px; padding: 14px 16px; color: var(--text); }
.tm-conv:hover { text-decoration: none; border-color: var(--accent); }
.tm-conv.abierta { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.tm-conv-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.tm-conv-t { font-weight: 650; line-height: 1.4; margin: 0; }
.tm-conv-ir { color: var(--accent); font-weight: 650; }
.tm-oficial p { margin: 0 0 10px; }
.tm-oficial p:last-child { margin: 0; }
.tm-req { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.tm-req li { display: flex; gap: 9px; align-items: flex-start; line-height: 1.45; }
.tm-req .ico { color: var(--ok); flex: none; margin-top: 3px; }
.tm-cita { display: inline-block; font-size: 12.5px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 0 6px; margin-left: 2px; white-space: nowrap; }
.tm-plazo { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }

/* Temario: bloques plegables y temas */
.tm-nota { margin: 0 0 4px; color: var(--muted); }
.tm-bloque > summary { justify-content: space-between; }
.tm-bloque > summary .tm-bloque-n { flex: 1; }
.tm-bloque > summary .count { font-size: 12.5px; font-weight: 700; background: var(--surface-2); color: var(--muted); padding: 1px 9px; border-radius: 999px; white-space: nowrap; }
.tm-bloque[open] > summary .count { background: var(--accent-soft); color: var(--accent); }
.tm-bloque + .tm-bloque { margin-top: 10px; }
.tm-temas { list-style: none; margin: 0; padding: 4px 0; }
.tm-temas li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 12px 18px; scroll-margin-top: 90px; }
.tm-temas li + li { border-top: 1px solid var(--line); }
.tm-temas li:target { background: var(--accent-soft); }
.tm-n { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.tm-tema p { margin: 0; line-height: 1.5; font-size: 15px; color: var(--muted); }
.tm-tema p b { color: var(--text); font-weight: 700; }
.tm-tema .tm-leyes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tm-ley { font-size: 12.5px; }
a.tm-ley { background: var(--accent-soft); color: var(--accent); }
a.tm-ley:hover { text-decoration: none; filter: brightness(.96); }
.tm-ley { white-space: normal; }

/* Examen */
.tm-lead { font-size: 16.5px; line-height: 1.55; margin: 0 0 4px; max-width: 62em; }
.tm-facts { margin-top: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tm-facts .fact .v { white-space: normal; }
.tm-facts .fact .v.t { font-size: 15px; font-weight: 600; line-height: 1.4; }
.tm-ejercicios { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.tm-ejercicios h3 { margin: 0 0 10px; font-size: 17px; }
.tm-kv { grid-template-columns: 110px 1fr; font-size: 15px; gap: 8px 14px; }
.tm-calif { margin: 16px 0 6px; line-height: 1.5; }

/* Leyes */
.tm-repasar { display: flex; gap: 12px 20px; align-items: center; flex-wrap: wrap; padding: 16px 18px; margin: 0 0 14px; border-radius: var(--radius); background: var(--accent-soft); }
.tm-repasar p { margin: 0; flex: 1 1 260px; }
.tm-leyes-lista { list-style: none; margin: 0 0 10px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tm-leyes-lista li { display: flex; flex-direction: column; gap: 3px; padding: 12px 15px; }
.tm-refs { color: var(--accent); font-weight: 600; margin-top: 2px; }
.tm-otras-h { margin-top: 18px; font-size: 15.5px; }
.tm-otras-leyes { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; line-height: 1.5; }

/* Plazas por año */
.tm-hist { overflow-x: auto; }
.tm-hist .table td, .tm-hist .table th { font-variant-numeric: tabular-nums; vertical-align: middle; }
.tm-hist .table th[scope=row] { white-space: nowrap; color: var(--text); }
.tm-hist td:nth-child(2) { min-width: 170px; }
.tm-barra { display: inline-block; vertical-align: middle; width: 90px; height: 8px; margin-right: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.tm-barra > span { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.tm-hist-notas { margin: 12px 0 6px; padding-left: 20px; line-height: 1.5; color: var(--muted); }
.tm-hist-notas b { color: var(--text); }

.tm-faq { margin-top: 26px; }
.tm-faq-dl dt { font-weight: 700; margin-top: 12px; }
.tm-faq-dl dt:first-child { margin-top: 0; }
.tm-faq-dl dd { margin: 4px 0 0; line-height: 1.5; }
.tm-otras { margin-top: 10px; }
.tm-otras > summary .count { margin-left: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.tm-otras-todos { margin: 0 0 8px; }
.tm-otras .enl.cols { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.tm-otras .enl a { font-weight: 550; padding-block: 11px; }   /* 40 px de zona táctil (también en línea, en el móvil) */

/* /temarios: buscador y grupos arriba; cada grupo, un panel (como «Por comunidad» o /sueldos) con filas compactas
   (nombre; ámbito y temas; plazas de la última convocatoria) en dos columnas en escritorio y una en el móvil */
.tm-filtro { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin: 18px 0 0; }
.tm-buscar { flex: 1 1 280px; max-width: 460px; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-s); }
.tm-buscar:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
.tm-buscar .ico { flex: none; color: var(--muted); }
.tm-buscar input { border: 0; padding: 10px 0; box-shadow: none; background: none; }
.tm-buscar input:focus { box-shadow: none; outline: none; }
.segment.tm-grupos { display: inline-flex; margin: 0; overflow: visible; }
.tm-grupos a { gap: 6px; white-space: nowrap; }
.tm-cuenta { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.tm-vacio { margin: 18px 0 0; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); }
.tm-vacio:empty { display: none; }
.tm-grupo[hidden], .tm-filas li[hidden], .no-js .tm-buscar { display: none; }   /* sin JavaScript, sin buscador (no haría nada) */
.tm-grupo-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 28px 0 10px; font-size: var(--fs-lg); }
.tm-grupo-h small { font-family: var(--sans, inherit); font-size: var(--fs-sm); font-weight: 500; color: var(--muted); }
/* separadores entre filas: cada fila lleva su raya arriba y sube 1 px; el panel recorta la de la primera fila de cada
   columna (también cuando el buscador esconde filas: la primera visible tampoco la enseña) */
.tm-filas { list-style: none; margin: 0; padding: 0 18px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 36px; overflow: hidden; }
.tm-filas li { border-top: 1px solid var(--line); margin-top: -1px; min-width: 0; }
/* en cada fila de la rejilla, las dos celdas miden lo mismo: el nombre arriba y ámbito/plazas pegados abajo, así las dos
   columnas quedan a la par aunque un nombre ocupe dos líneas */
.tm-fila { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr; gap: 3px 14px; height: 100%; padding: 12px 2px; color: var(--text); min-height: 44px; }
.tm-fila:hover { text-decoration: none; }
.tm-fila:focus-visible { outline-offset: -2px; }   /* el panel recorta por fuera */
.tm-fila:hover b { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.tm-fila b { grid-column: 1 / -1; font-size: var(--fs-base); line-height: 1.3; color: var(--text); }
.tm-fila-meta { font-size: var(--fs-sm); color: var(--muted); min-width: 0; align-self: end; }
.tm-fila-l { display: contents; }
.tm-fila-plazas { font-size: var(--fs-sm); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; align-self: end; }
.tm-pedir { margin-top: 22px; }

@media (max-width: 900px) {
  .tm-ahora { grid-template-columns: minmax(0, 1fr); grid-template-areas: "conv" "lado" "req"; }
  .tm-lado { position: static; margin-top: 14px; }
}
@media (max-width: 640px) {
  .tm-facts { grid-template-columns: 1fr; }
  .tm-facts .fact { display: block; }
  .tm-facts .fact .v, .tm-facts .fact .v.t { text-align: left; font-size: 15px; font-weight: 600; margin-top: 3px; }
}
@media (max-width: 760px) {
  .tm-filas { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .tm-filtro { margin-top: 14px; }
  .tm-buscar { flex-basis: 100%; max-width: none; }
  .segment.tm-grupos { display: flex; width: 100%; }
  .tm-grupos a { flex: 1 1 auto; padding: 8px 6px; }
  .tm-grupo-h { margin-top: 20px; }
  .tm-filas { padding: 0 14px; }
  /* fila de dos líneas: el nombre y, debajo, ámbito · temas · plazas (sin «grupo estimado»: lo dice la ficha) */
  .tm-fila { display: block; padding: 11px 0; line-height: 1.4; overflow: hidden; }
  .tm-fila b { display: block; }
  /* ámbito · temas · plazas: si las plazas bajan de línea, su «·» sale por la izquierda y la fila (overflow) lo recorta;
     nunca queda al principio de la línea */
  .tm-fila-l { display: flex; flex-wrap: wrap; margin-left: -1.1em; font-size: var(--fs-sm); }
  .tm-fila-meta, .tm-fila-plazas { display: inline; margin-left: 1.1em; position: relative; text-align: left; }
  .tm-fila-meta + .tm-fila-plazas::before { content: "·"; position: absolute; left: -.75em; }
  .tm-est { display: none; }
  .tm-leyes-lista { grid-template-columns: 1fr; gap: 8px; }
  .tm-leyes-lista li { padding: 10px 13px; }
  .tm-leyes-lista li > .muted { display: none; }   /* en el móvil, solo el nombre corto y los temas */
  .tm-intro, .tm-lead { font-size: 15px; line-height: 1.5; }
  .tm-chips { margin-top: 10px; }
  .tm-chips .chip { font-size: 12.5px; padding: 3px 9px; border-radius: var(--r-md); }   /* el del examen va a dos líneas: mejor que un óvalo */
  .tm-cab h1 { font-size: 24px; }
  .tm-temas li { grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 11px 12px; }
  .tm-n { width: 28px; height: 28px; font-size: 13px; border-radius: 8px; }
  .tm-tema p { font-size: 14.5px; }
  .tm-kv { grid-template-columns: 1fr; gap: 2px; }
  .tm-kv dd { margin-bottom: 8px; }
  .tm-repasar .btn { width: 100%; }
  /* plazas por año: una tarjeta por convocatoria, cada dato con su rótulo */
  .tm-hist .table, .tm-hist tbody, .tm-hist tr, .tm-hist th, .tm-hist td { display: block; width: auto; }
  .tm-hist thead { display: none; }
  .tm-hist tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
  .tm-hist tr:first-child { border-top: 0; }
  .tm-hist .table th[scope=row] { grid-column: 1 / -1; padding: 0; border: 0; }
  .tm-hist .table td { padding: 0; border: 0; min-width: 0; font-size: 15px; }
  .tm-hist td::before { content: attr(data-l); display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
  .tm-hist td:nth-child(2) { grid-column: 1 / -1; min-width: 0; }
  .tm-barra { width: 120px; }
}

/* «Avísame si cambian sus leyes» (opos/temario_avisos.py): otra alerta distinta de la de convocatorias, y se nota */
.siguiente.tm-avisos-leyes { background: var(--surface); border-color: var(--line); }
.tm-avisos-leyes h2 .ico { color: var(--accent); }
