/* =============================================================================
   Sistema público de MiOposición: primitivas visuales compartidas
   -----------------------------------------------------------------------------
   Capa común de las páginas públicas de exploración: /organismos/ y sus
   directorios, /territorios/, /empleo-publico/ y los hubs de comunidad y
   provincia. Aquí solo vive lo que es GENERAL del producto (superficies,
   cabecera, marcas, panel de cifras, navegación contextual, tarjetas de ruta,
   de territorio y de resumen, chips, barra de filtros). Lo propio de un
   dominio vive en su hoja: organismos-components.css (tarjeta de organismo,
   tarjeta de tipo, navegación del directorio de organismos).

   Prefijo `mo-` = MiOposición (no «organismos»): no colisiona con las clases
   heredadas de app-premium.css. Esta hoja es autocontenida: no depende de
   clases de otros dominios (.organism-*), solo de los tokens globales de
   app-premium.css (--text, --muted, --border, --primary, --shadow-sm...).

   Índice: TOKENS · SURFACES · HERO · MARKS · STATS · NAVIGATION · CARDS ·
           FILTERS · RESPONSIVE
   ========================================================================== */

/* ============================== TOKENS =================================== */
:root {
  /* Paleta de tonos (700: texto AA sobre blanco y sobre su propio tinte). */
  --tone-navy: #1e3a8a;
  --tone-blue: #1a56db;
  --tone-cyan: #0e7490;
  --tone-green: #047857;
  --tone-violet: #6d28d9;
  --tone-amber: #b45309;
  --tone-red: #be123c;
  --tone-slate: #475569;

  /* Tipos de contenido (mismos colores que las fichas: organism-metric--*).
     `-text` = tono AA para texto; el base, para puntos, iconos y bordes. */
  --metric-oposiciones: #1e63ff;
  --metric-oposiciones-text: #1550c2;
  --metric-bolsas: #079d72;
  --metric-bolsas-text: #057a58;
  --metric-examenes: #7c3aed;
  --metric-examenes-text: #6d28d9;
  --metric-oep: #ea6c0b;
  --metric-oep-text: #a8480a;
  --metric-organismos: #64748b;
  --metric-organismos-text: #475569;

  /* Superficies. */
  --mo-surface: #fff;
  --mo-surface-tinted: linear-gradient(145deg, rgba(30, 99, 255, .045), #fff 42%);
  --mo-sheet-border: rgba(30, 99, 255, .12);
  --mo-card-border: rgba(15, 23, 42, .09);
  --mo-card-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  --mo-card-shadow-hover: 0 10px 24px rgba(2, 17, 48, .08);
  --mo-panel-shadow: 0 12px 30px rgba(2, 17, 48, .05);

  --mo-link: #1747c8;
  --mo-focus: 0 0 0 3px #fff, 0 0 0 6px rgba(30, 99, 255, .55);
  --mo-section-gap: 28px;
}

/* Tono (tipo de organismo, hub, contenido): una sola variable --tone. */
.mo-tone--navy { --tone: var(--tone-navy); }
.mo-tone--blue { --tone: var(--tone-blue); }
.mo-tone--cyan { --tone: var(--tone-cyan); }
.mo-tone--green { --tone: var(--tone-green); }
.mo-tone--violet { --tone: var(--tone-violet); }
.mo-tone--amber { --tone: var(--tone-amber); }
.mo-tone--red { --tone: var(--tone-red); }
.mo-tone--slate { --tone: var(--tone-slate); }
.mo-tone--oposiciones { --tone: var(--metric-oposiciones-text); }
.mo-tone--bolsas { --tone: var(--metric-bolsas-text); }
.mo-tone--examenes { --tone: var(--metric-examenes-text); }
.mo-tone--oep { --tone: var(--metric-oep-text); }

/* Icono (sprite inline, core/includes/mo_icon.html) + icon box. */
.mo-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Mismo tratamiento que .organism-metric__icon de la ficha. */
.mo-icon-box {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid currentColor;
  border-radius: 11px;
  background: color-mix(in srgb, currentColor 9%, white);
  color: var(--tone, var(--tone-blue));
}

.mo-icon-box .mo-icon { width: 21px; height: 21px; }
.mo-icon-box--sm { width: 34px; height: 34px; border-radius: 10px; }
.mo-icon-box--sm .mo-icon { width: 19px; height: 19px; }
.mo-icon-box--lg { width: 52px; height: 52px; border-radius: 14px; }
.mo-icon-box--lg .mo-icon { width: 26px; height: 26px; }

.mo-eyebrow {
  margin: 0;
  color: var(--primary, #1e63ff);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Punto de tono (opciones de filtro, leyendas). */
.mo-tone-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--tone, #94a3b8);
  vertical-align: 1px;
}

/* ============================== SURFACES ================================= */
/* Pila vertical de secciones de una página: un único ritmo entre bloques. */
.mo-stack { display: grid; gap: var(--mo-section-gap); margin-bottom: var(--mo-section-gap); }
.mo-stack > * { min-width: 0; margin-top: 0; margin-bottom: 0; }

/* Hoja de sección: superficie blanca (o tintada) con borde azul suave. */
.mo-sheet {
  min-width: 0;
  padding: 24px 28px 28px;
  scroll-margin-top: calc(var(--header-height, 72px) + 16px);
  background: var(--mo-surface);
  border: 1px solid var(--mo-sheet-border);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
}

/* Compat: hojas que todavía combinan .organism-section.card (índice de
   organismos): mismo padding/radio que la hoja y sin realce de .card:hover. */
.mo-sheet.organism-section { padding: 24px 28px 28px; border-radius: 20px; }
.mo-sheet.card:hover { border-color: var(--mo-sheet-border); box-shadow: var(--shadow-sm); }

.mo-sheet--tinted,
.mo-sheet--tinted.organism-section { background: var(--mo-surface-tinted); }

/* Cabecera de sección: icon box + eyebrow + H2 + intro (+ enlace lateral). */
.mo-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 16px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(30, 99, 255, .1);
}

.mo-section-head > .mo-icon-box {
  width: 44px;
  height: 44px;
  border-color: rgba(30, 99, 255, .13);
  border-radius: 13px;
  background: rgba(30, 99, 255, .1);
  color: var(--primary, #1e63ff);
}

/* El texto nunca se estrecha por el enlace lateral: si no caben, el enlace
   baja a su propia línea (alineado con el texto). */
.mo-section-head__text { flex: 1 1 0; min-width: min(200px, 100%); }

.mo-section-head .mo-section-head__title {
  margin: 2px 0 6px;
  color: var(--text, #0f172a);
  font-size: clamp(21px, 1rem + .6vw, 26px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -.01em;
}

.mo-section-head__intro {
  max-width: 68ch;
  margin: 0;
  color: var(--text-secondary, #3b4356);
  font-size: 15px;
  line-height: 1.55;
}

.mo-section-head__aside { flex: none; align-self: center; }

/* Variante sin filete (secciones cortas, p. ej. «Practicar»). */
.mo-section-head--flat { margin-bottom: 16px; padding-bottom: 0; border-bottom: 0; }

.mo-subheading {
  margin: 22px 0 12px;
  color: var(--text-secondary, #3b4356);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.mo-subheading:first-child { margin-top: 0; }

/* Título de un bloque sin cabecera de sección completa (H2). */
.mo-block-title {
  margin: 0 0 14px;
  color: var(--text, #0f172a);
  font-size: clamp(19px, .9rem + .5vw, 22px);
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -.01em;
}

/* Preguntas frecuentes: <details>/<summary> nativo (sin JS, contenido
   siempre en el HTML). */
.mo-faq details { border-top: 1px solid var(--border, #e2e8f0); }
.mo-faq details:last-of-type { border-bottom: 0; }

.mo-sheet.mo-faq { padding: 20px 24px 14px; }
.mo-faq .mo-section-head { margin-bottom: 8px; }

.mo-faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
  padding: 10px 2px;
  color: var(--text, #0f172a);
  font-size: 15.5px;
  font-weight: 750;
  line-height: 1.4;
  cursor: pointer;
  list-style: none;
}

.mo-faq summary::-webkit-details-marker { display: none; }

.mo-faq summary::after {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-right: 2px solid var(--muted, #64748b);
  border-bottom: 2px solid var(--muted, #64748b);
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.mo-faq details[open] > summary::after { transform: rotate(-135deg); }
.mo-faq summary:hover { color: var(--mo-link); }
.mo-faq summary:focus-visible { outline: none; border-radius: 6px; box-shadow: var(--mo-focus); }

.mo-faq details > p {
  max-width: 75ch;
  margin: 0 2px 16px;
  color: var(--text-secondary, #3b4356);
  font-size: 15px;
  line-height: 1.6;
}

.mo-faq details > p a { color: var(--mo-link); font-weight: 700; }

/* Enlaces de cierre de página (vuelta en la jerarquía). */
.mo-more-links { display: flex; flex-wrap: wrap; gap: 4px 24px; }

/* Franja compacta (cierre «Seguir explorando»): etiqueta + píldoras. */
.mo-sheet--band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 14px 20px;
  background: var(--mo-surface-tinted);
}

.mo-sheet--band .mo-subheading { margin: 0; }
.mo-filter-pill__arrow { display: inline-grid; margin-left: 2px; color: var(--muted, #64748b); }
.mo-filter-pill__arrow .mo-icon { width: 14px; height: 14px; }
.mo-filter-pill:hover .mo-filter-pill__arrow { color: var(--mo-link); }

/* Sección sin superficie propia (provincias): cabecera sobre el fondo de la
   página y tarjetas individuales. */
.mo-province-section .mo-section-head { margin-bottom: 16px; }
.mo-province-section .mo-territory-grid { margin-bottom: 0; }

/* Texto de apoyo breve dentro de una hoja (nunca prosa larga). */
.mo-prose { max-width: 72ch; margin: 0; color: var(--text-secondary, #3b4356); font-size: 15px; line-height: 1.6; }
.mo-prose + .mo-prose { margin-top: 10px; }
.mo-prose a { color: var(--mo-link); font-weight: 700; }

/* =============================== HERO ==================================== */
/* Cabecera común (directorios, territorios, empleo público): marca en el
   hueco del logo (96 px), badges, H1 de la escala común (--mo-title-lg,
   app-premium.css), acciones y panel de cifras a la derecha; zona inferior
   opcional de navegación contextual. Include: core/includes/mo_hero.html. */
.mo-hero {
  padding: 18px 0 calc(var(--mo-section-gap) - 8px);
  background:
    radial-gradient(circle at 70% 12%, rgba(30, 99, 255, .07), transparent 32%),
    linear-gradient(180deg, rgba(248, 250, 253, .98), rgba(239, 246, 255, .6));
  border-bottom: 1px solid rgba(30, 99, 255, .1);
}

.mo-hero__breadcrumbs { margin-bottom: 10px; }
.mo-hero__breadcrumbs .breadcrumbs__link { overflow-wrap: anywhere; }

.mo-hero__card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 18px 36px;
  align-items: center;
  padding: 24px 30px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(2, 17, 48, .07);
}

/* Sin panel de cifras: el texto ocupa toda la tarjeta. */
.mo-hero__card--solo { grid-template-columns: minmax(0, 1fr); }

.mo-hero__identity {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  min-width: 0;
}

.mo-hero__text { min-width: 0; }

.mo-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.mo-badges span,
.mo-badges a {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(30, 99, 255, .1);
  /* #145cff: el azul de marca un punto más oscuro para AA con 12 px. */
  color: #145cff;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.mo-badges a:hover { background: rgba(30, 99, 255, .18); text-decoration: underline; text-underline-offset: 2px; }
.mo-badges a:focus-visible { outline: none; box-shadow: var(--mo-focus); }

.mo-hero .mo-hero__title {
  margin: 10px 0;
  color: var(--text, #0f172a);
  font-size: var(--mo-title-lg);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -.025em;
  text-wrap: balance;
}

.mo-hero .mo-hero__lead {
  max-width: 640px;
  margin: 0;
  color: var(--text-secondary, #3b4356);
  font-size: 16px;
  line-height: 1.6;
}

.mo-hero .mo-hero__lead + .mo-hero__lead { margin-top: 8px; }

.mo-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

/* Zona inferior de la tarjeta: navegación contextual (tipos de un hub de
   organismos, secciones de un territorio). Etiqueta en la misma línea que
   las píldoras en escritorio: la cabecera no crece una fila por la etiqueta. */
.mo-hero__context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  grid-column: 1 / -1;
  min-width: 0;
  margin: 2px -30px -24px;
  padding: 12px 30px 14px;
  border-top: 1px solid rgba(30, 99, 255, .1);
  border-radius: 0 0 20px 20px;
  background: linear-gradient(180deg, rgba(239, 246, 255, .7), rgba(248, 250, 253, .9));
}

.mo-hero__context { align-items: flex-start; }
.mo-hero__context .mo-subheading { flex: none; margin: 0; padding-top: 8px; }
.mo-hero__context > ul { flex: 1 1 0; gap: 6px; min-width: 0; }
.mo-hero__context .mo-filter-pill { min-height: 32px; padding: 3px 11px; font-size: 13px; gap: 7px; }

/* =============================== MARKS =================================== */
/* Marca de la cabecera: bandera/escudo del territorio en caja blanca
   (object-fit: contain, horizontal o vertical sin deformar) o icono del
   tipo/sección en icon box grande con su tono. Include: mo_mark.html. */
.mo-mark {
  display: grid;
  flex: none;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 16px;
}

.mo-mark--simbolo {
  padding: 12px;
  border: 1px solid var(--border, #e2e8f0);
  background: #fff;
}

.mo-mark--simbolo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.mo-mark.mo-icon-box .mo-icon { width: 44px; height: 44px; stroke-width: 1.6; }

/* Identidad visual en tarjetas: mismo cuadrado para escudos verticales y
   logos/banderas horizontales (object-fit: contain). */
.mo-logo {
  display: grid;
  flex: none;
  place-items: center;
  width: 56px;
  height: 56px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 14px;
  background: #fff;
}

.mo-logo img {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

/* Fallback: icono con su tono (sin iniciales). */
.mo-logo .mo-icon-box {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

.mo-logo .mo-icon-box .mo-icon { width: 26px; height: 26px; }
.mo-logo.has-img .mo-icon-box { display: none; }

/* =============================== STATS =================================== */
/* Panel de cifras: filas icon box + cifra + etiqueta (como la ficha de
   organismo). Include: mo_stat_panel.html. Las filas no son enlaces: la
   navegación va en las acciones y en la franja contextual. */
.mo-stat-aside { display: grid; align-self: center; min-width: 0; }

.mo-stat-panel {
  display: grid;
  align-self: start;
  padding: 6px 16px;
  border: 1px solid rgba(30, 99, 255, .12);
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: var(--mo-panel-shadow);
}

.mo-stat-panel .mo-stat-panel__title {
  margin: 6px 0 0;
  color: var(--text-secondary, #3b4356);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  line-height: 1.3;
  text-transform: uppercase;
}

.mo-stat-list { margin: 0; padding: 0; list-style: none; }
.mo-stat-list li + li { border-top: 1px solid var(--border, #e2e8f0); }

.mo-stat {
  display: grid;
  grid-template-columns: 34px max-content minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 5px 0;
  color: var(--text, #0f172a);
}

.mo-stat > .mo-icon-box { width: 34px; height: 34px; border-radius: 10px; color: var(--tone); }
.mo-stat > .mo-icon-box .mo-icon { width: 19px; height: 19px; }

.mo-stat__value {
  color: var(--text, #0f172a);
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mo-stat__label {
  color: var(--text-secondary, #3b4356);
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

/* Fila navegable: la FILA ENTERA es el enlace (icono + cifra + etiqueta +
   chevron). Realce discreto; el foco se ve siempre. Solo filas con destino
   (lo decide el presentador: `url` en el stat). */
.mo-stat--link {
  grid-template-columns: 34px max-content minmax(0, 1fr) 16px;
  margin: 0 -10px;
  padding: 5px 10px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  transition: background-color .15s ease;
}

.mo-stat--link:hover { background: rgba(30, 99, 255, .05); }
.mo-stat--link:hover .mo-stat__label { color: var(--mo-link); }
.mo-stat--link:focus-visible { outline: none; box-shadow: var(--mo-focus); }
.mo-stat__chevron { display: grid; place-items: center; color: #94a3b8; }
.mo-stat__chevron .mo-icon { width: 16px; height: 16px; }
.mo-stat--link:hover .mo-stat__chevron { color: var(--mo-link); }

/* Cifra 0: dato visible para comparar, sin interacción ni énfasis. */
.mo-stat--empty .mo-stat__value,
.mo-stat--empty .mo-stat__label { color: var(--muted, #64748b); }
.mo-stat--empty > .mo-icon-box { opacity: .55; }

/* Tono del icono por métrica: organismos/territorio neutros; procesos con
   los colores de contenido de todo el sitio; plazo abierto en cian (estado). */
.mo-stat--organismos { --tone: var(--tone-slate); }
.mo-stat--oposiciones { --tone: var(--metric-oposiciones); }
.mo-stat--bolsas { --tone: var(--metric-bolsas); }
.mo-stat--examenes { --tone: var(--metric-examenes); }
.mo-stat--oep { --tone: var(--metric-oep); }
.mo-stat--territorio { --tone: var(--tone-slate); }
.mo-stat--plazo { --tone: var(--tone-cyan); }

/* «Actualizado el…» fuera del panel, como en la ficha. */
.mo-updated {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 2px 0;
  padding-left: 16px;
  color: var(--text-secondary, #3b4356);
  font-size: 12px;
  font-weight: 600;
}

.mo-updated__icon { display: inline-flex; flex: none; }
.mo-updated__icon .mo-icon { width: 15px; height: 15px; }

/* ============================ NAVIGATION ================================= */
/* Píldoras (facetas, secciones de un territorio, filtros activos). Con
   punto de tono por defecto; --all / --plain sin punto. */
.mo-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mo-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--mo-card-border);
  border-radius: 999px;
  background: #fff;
  color: var(--text, #0f172a);
  font-size: 13.5px;
  font-weight: 650;
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
}

.mo-filter-pill::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tone, #94a3b8);
}

.mo-filter-pill--all::before,
.mo-filter-pill--plain::before { display: none; }
.mo-filter-pill__count { color: var(--muted, #64748b); font-size: 12.5px; font-weight: 700; }
.mo-filter-pill:hover { border-color: color-mix(in srgb, var(--tone, #1e63ff) 45%, white); }
.mo-filter-pill:focus-visible { outline: none; box-shadow: var(--mo-focus); }

.mo-filter-pill[aria-current="true"],
.mo-filter-pill[aria-current="page"] {
  border-color: var(--tone, var(--mo-link));
  background: color-mix(in srgb, var(--tone, #1e63ff) 8%, white);
  color: var(--tone, var(--mo-link));
}

/* Píldora con icono (navegación de secciones de un territorio). */
.mo-filter-pill .mo-icon { width: 16px; height: 16px; color: var(--tone, var(--muted, #64748b)); }

/* Enlace secundario con flecha (acción textual, no botón). */
.mo-link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  color: var(--mo-link);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.mo-link-arrow .mo-icon { width: 16px; height: 16px; transition: transform .15s ease; }
.mo-link-arrow:hover { text-decoration: underline; text-underline-offset: 3px; }
.mo-link-arrow:hover .mo-icon { transform: translateX(3px); }
.mo-link-arrow:focus-visible { outline: none; border-radius: 6px; box-shadow: var(--mo-focus); }

/* Tarjeta de ruta: un destino de navegación (icono + nombre + descripción
   breve + chevron). Toda la tarjeta es el enlace. Include: mo_route_card.html. */
.mo-route-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mo-route-grid > li { display: flex; min-width: 0; }

.mo-route-card {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 14px;
  min-width: 0;
  min-height: 76px;
  padding: 14px 14px 14px 16px;
  background: #fff;
  border: 1px solid var(--mo-card-border);
  border-radius: 14px;
  box-shadow: var(--mo-card-shadow);
  color: var(--text, #0f172a);
  text-decoration: none;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}

.mo-route-card:hover {
  border-color: color-mix(in srgb, var(--tone, #1e63ff) 30%, white);
  box-shadow: var(--mo-card-shadow-hover);
  transform: translateY(-2px);
}

.mo-route-card:focus-visible { outline: none; box-shadow: var(--mo-focus); }

.mo-route-card__body { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }

.mo-route-card__name {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.mo-route-card__desc {
  color: var(--muted, #64748b);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.mo-route-card__arrow {
  display: grid;
  flex: none;
  place-items: center;
  color: #94a3b8;
  transition: color .15s ease, transform .15s ease;
}

.mo-route-card__arrow .mo-icon { width: 16px; height: 16px; }
.mo-route-card:hover .mo-route-card__arrow { color: var(--tone, var(--mo-link)); transform: translateX(2px); }

/* Variante compacta (sección secundaria, p. ej. «Practicar»). */
.mo-route-grid--compact .mo-route-card { min-height: 60px; padding: 10px 12px; }
.mo-route-grid--compact .mo-route-card__name { font-size: 14px; }

/* =============================== CARDS =================================== */
.mo-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mo-card-grid > li { display: flex; min-width: 0; }

/* Rejilla de provincias: columnas de al menos 300 px que se reparten el
   ancho (3 en escritorio grande, 2 en tablet, 1 en móvil). auto-fill
   conserva las columnas vacías: una sola provincia ocupa SU columna
   (~360-390 px), alineada a la izquierda, sin estirarse a todo el ancho. */
.mo-card-grid--fixed {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  justify-content: start;
}
.mo-territory-grid { margin-bottom: var(--mo-section-gap); }
.mo-sheet .mo-territory-grid { margin-bottom: 0; }

/* Chips de métrica (oposiciones/bolsas/exámenes/ofertas/organismos). */
.mo-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mo-metric {
  --metric: var(--metric-organismos);
  --metric-text: var(--metric-organismos-text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 4px 9px;
  border: 1px solid color-mix(in srgb, var(--metric) 22%, white);
  border-radius: 999px;
  background: color-mix(in srgb, var(--metric) 8%, white);
  color: var(--metric-text);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, border-color .15s ease;
}

.mo-metric::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--metric);
}

.mo-metric--oposiciones { --metric: var(--metric-oposiciones); --metric-text: var(--metric-oposiciones-text); }
.mo-metric--bolsas { --metric: var(--metric-bolsas); --metric-text: var(--metric-bolsas-text); }
.mo-metric--examenes { --metric: var(--metric-examenes); --metric-text: var(--metric-examenes-text); }
.mo-metric--oep { --metric: var(--metric-oep); --metric-text: var(--metric-oep-text); }
.mo-metric--organismos { --metric: var(--metric-organismos); --metric-text: var(--metric-organismos-text); }

a.mo-metric:hover {
  border-color: color-mix(in srgb, var(--metric) 45%, white);
  background: color-mix(in srgb, var(--metric) 14%, white);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.mo-metric:focus-visible { outline: none; box-shadow: var(--mo-focus); }

/* Cero: dato presente pero sin destino -- gris, sin interacción. */
.mo-metric.is-empty {
  border-color: rgba(15, 23, 42, .07);
  background: #f5f7fb;
  color: var(--muted, #64748b);
  font-weight: 600;
}

.mo-metric.is-empty::before { background: #cbd5e1; }

/* Estado (p. ej. «47 con plazo abierto»): información viva, distinta de las
   métricas históricas -- contorno + punto, sin tinte de contenido. */
.mo-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 3px 11px;
  border: 1px solid rgba(14, 116, 144, .35);
  border-radius: 999px;
  background: #fff;
  color: #155e75;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.mo-status-pill::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0e7490;
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .15);
}

a.mo-status-pill:hover { background: #ecfeff; text-decoration: underline; text-underline-offset: 2px; }
a.mo-status-pill:focus-visible { outline: none; box-shadow: var(--mo-focus); }

/* Sin procesos abiertos ahora: mismo sitio, sin punto vivo. */
.mo-status-pill.is-idle { border-color: rgba(15, 23, 42, .12); color: var(--muted, #64748b); }
.mo-status-pill.is-idle::before { background: #cbd5e1; box-shadow: none; }

.mo-count-pill.mo-count-pill--muted {
  border-color: rgba(15, 23, 42, .1);
  background: #f5f7fb;
  color: var(--muted, #64748b);
}

/* Recuento secundario (no clicable). */
.mo-count-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border: 1px solid rgba(30, 99, 255, .14);
  border-radius: 999px;
  background: rgba(30, 99, 255, .07);
  color: var(--mo-link);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Tarjeta de territorio (comunidad en /territorios/ y en /empleo-publico/,
   provincia en el hub de su comunidad). No es un enlace: lo son la
   bandera/nombre, cada métrica y cada provincia. Include: mo_territory_card. */
.mo-territory-card {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--mo-card-border);
  border-radius: 16px;
  box-shadow: var(--mo-card-shadow);
  transition: border-color .18s ease, box-shadow .18s ease;
}

.mo-territory-card:hover,
.mo-territory-card:focus-within {
  border-color: rgba(30, 99, 255, .22);
  box-shadow: var(--mo-card-shadow-hover);
}

.mo-territory-card__head { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.mo-territory-card__main { flex: 1 1 auto; min-width: 0; }

.mo-territory-card__title {
  margin: 0;
  color: var(--text, #0f172a);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.mo-territory-card__title a { color: inherit; text-decoration: none; }
.mo-territory-card__title a:hover { color: var(--mo-link); text-decoration: underline; text-underline-offset: 3px; }
.mo-territory-card__title a:focus-visible { outline: none; border-radius: 4px; box-shadow: var(--mo-focus); }

.mo-territory-card__meta {
  margin: 4px 0 0;
  color: var(--muted, #64748b);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.mo-territory-card .mo-metrics { margin-top: auto; }
.mo-territory-card .mo-logo img { width: 46px; height: 34px; }
/* Escudo (provincia sin bandera oficial): vertical, sin proporción de bandera. */
.mo-territory-card .mo-logo--escudo img { width: 34px; height: 46px; }
.mo-mark--escudo { padding: 8px; }
.mo-territory-card__status { margin-top: 8px; }

.mo-territory-card__provincias {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mo-territory-card__provincias a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 3px 10px;
  border: 1px solid rgba(15, 23, 42, .1);
  border-radius: 999px;
  background: #fff;
  color: var(--text-secondary, #3b4356);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.mo-territory-card__provincias a:hover { border-color: var(--mo-link); color: var(--mo-link); }
.mo-territory-card__provincias a:focus-visible { outline: none; box-shadow: var(--mo-focus); }

.mo-territory-card__foot {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(15, 23, 42, .06);
}

/* Tarjeta de resumen de un tipo de proceso en un ámbito («Oposiciones en
   Galicia»): estado vivo (plazo abierto) destacado, total histórico aparte,
   acción al listado. Include: mo_summary_card.html. */
.mo-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mo-summary-grid > li { display: flex; min-width: 0; }

/* Sin altura igualada: una tarjeta vacía no se estira hasta la de al lado. */
.mo-summary-grid { align-items: start; }

.mo-summary-card {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 20px 22px;
  background: var(--mo-surface-tinted);
  border: 1px solid var(--mo-sheet-border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.mo-summary-card__head { display: flex; align-items: center; gap: 12px; }
.mo-summary-card__head .mo-icon-box { color: var(--tone); }

.mo-summary-card__title {
  margin: 0;
  color: var(--text, #0f172a);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.25;
}

.mo-summary-card__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin: 0;
}

.mo-summary-card__total {
  color: var(--text-secondary, #3b4356);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.mo-summary-card__text { margin: 0; color: var(--text-secondary, #3b4356); font-size: 14.5px; line-height: 1.55; }
.mo-summary-card__foot { margin-top: auto; }

/* Estado vacío compacto: «0 registradas» + frase, sin CTA. */
.mo-summary-card--empty {
  gap: 10px;
  padding: 16px 20px;
  background: #fff;
  box-shadow: none;
}

.mo-summary-card--empty .mo-summary-card__head .mo-icon-box { opacity: .6; }
.mo-summary-card--empty .mo-summary-card__title { color: var(--text-secondary, #3b4356); font-size: 17px; }

/* ============================== FILTERS ================================== */
/* Barra de filtros horizontal sobre resultados a ancho completo (directorios
   de organismos). Parámetros GET + .filter-multi y su script. */
.mo-filterbar {
  margin: 20px 0 16px;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid var(--mo-sheet-border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.mo-filterbar__label {
  display: block;
  margin: 0 0 5px;
  color: var(--text-secondary, #3b4356);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.mo-filterbar__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 250px);
  align-items: end;
  gap: 14px;
}

.mo-filterbar__search-field { position: relative; }

.mo-filterbar__search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  display: grid;
  color: var(--muted, #64748b);
  transform: translateY(-50%);
  pointer-events: none;
}

.mo-filterbar__search-icon .mo-icon { width: 18px; height: 18px; }

.mo-filterbar .mo-filterbar__search-field input {
  min-height: 46px;
  padding-left: 42px;
  font-size: 15px;
}

.mo-filterbar .mo-filterbar__order select { min-height: 46px; }

.mo-filterbar__filters { margin-top: 12px; }

/* En escritorio los filtros siempre están abiertos: el conmutador sobra. */
.mo-filterbar__toggle { display: none; }

.mo-filterbar__grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.mo-filterbar__grid > .filter-multi { flex: 1 1 190px; min-width: 0; }
.mo-filterbar .filter-multi__trigger { min-height: 44px; min-width: 0; }

/* «Más filtros»: <details> nativo con los checkboxes en un panel
   desplegable en escritorio; en flujo en móvil. */
.mo-filterbar__more { position: relative; flex: none; }

.mo-filterbar__more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--input-border, #e2e8f0);
  border-radius: 12px;
  background: #fff;
  color: var(--text, #0f172a);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.mo-filterbar__more-toggle::-webkit-details-marker { display: none; }

.mo-filterbar__more-toggle::after {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-right: 2px solid var(--muted, #64748b);
  border-bottom: 2px solid var(--muted, #64748b);
  transform: rotate(45deg);
  transition: transform .15s ease;
}

.mo-filterbar__more[open] > .mo-filterbar__more-toggle::after { margin-top: 3px; transform: rotate(-135deg); }
.mo-filterbar__more-toggle:hover { border-color: rgba(30, 99, 255, .25); }
.mo-filterbar__more-toggle:focus-visible { outline: none; box-shadow: var(--mo-focus); }

.mo-filterbar .mo-filterbar__checks {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 45;
  width: 300px;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .12);
}

.mo-filterbar .mo-filterbar__checks .organismos-filter-check { min-height: 32px; }

.mo-filterbar__actions { flex: none; }
.mo-filterbar__actions .btn { min-height: 44px; padding: 0 18px; white-space: nowrap; }

/* Filtros activos: chips que quitan un filtro cada uno (server-side). */
.mo-active-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border, #e2e8f0);
}

.mo-active-filters__label {
  margin: 0;
  color: var(--text-secondary, #3b4356);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.mo-filter-pill--remove { --tone: var(--mo-link); }
.mo-filter-pill--remove::before { display: none; }
.mo-filter-pill__x { margin-left: 2px; color: var(--muted, #64748b); font-size: 16px; line-height: 1; }
.mo-filter-pill--remove:hover .mo-filter-pill__x { color: var(--mo-link); }

.mo-active-filters__clear {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--mo-link);
  font-size: 14px;
  font-weight: 700;
}

/* Cabecera de resultados: un solo título, recuento secundario. */
.mo-results { margin-bottom: var(--mo-section-gap); }

.mo-results__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 12px;
}

.mo-results .mo-results__title {
  margin: 0;
  color: var(--text, #0f172a);
  font-size: 20px;
  font-weight: 800;
  line-height: 1.3;
}

.mo-results__count {
  margin: 0;
  color: var(--muted, #64748b);
  font-size: 14px;
  font-weight: 600;
}

/* ============================= RESPONSIVE ================================ */
@media (max-width: 1100px) {
  .mo-route-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .mo-hero__card { grid-template-columns: 1fr; padding: 22px 24px; }
  .mo-hero__context { margin: 2px -24px -22px; padding: 12px 24px 14px; }
}

@media (max-width: 760px) {
  :root { --mo-section-gap: 20px; }

  .mo-sheet,
  .mo-sheet.organism-section { padding: 20px 18px 22px; border-radius: 18px; }
  .mo-section-head { gap: 12px; margin-bottom: 18px; padding-bottom: 16px; }
  .mo-section-head > .mo-icon-box { width: 40px; height: 40px; border-radius: 12px; }
  .mo-section-head__intro { font-size: 14.5px; }
  .mo-section-head__aside { flex: 1 1 100%; align-self: flex-start; padding-left: 52px; }

  .mo-summary-grid { grid-template-columns: 1fr; }
  .mo-summary-card { padding: 18px; }

  /* Barra de filtros: [Buscar] a todo el ancho; debajo [Filtros (N)] y
     [Ordenar] en la misma fila (el <details> ocupa la fila y su summary solo
     la mitad izquierda; al abrirse, el panel se despliega a todo el ancho). */
  .mo-filterbar { padding: 14px; }
  .mo-filterbar__form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .mo-filterbar__top { display: contents; }
  .mo-filterbar__search { grid-column: 1 / -1; grid-row: 1; }
  .mo-filterbar__order { position: relative; z-index: 1; grid-column: 2; grid-row: 2; align-self: start; }
  .mo-filterbar__order .mo-filterbar__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .mo-filterbar .mo-filterbar__order select { min-height: 44px; }
  .mo-filterbar .mo-filterbar__search-field input { font-size: 16px; }
  .mo-filterbar__filters { grid-column: 1 / -1; grid-row: 2; margin-top: 0; }
  .mo-filterbar__filters > .mo-filterbar__toggle { width: calc(50% - 5px); }
  .mo-filterbar__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    border: 1px solid var(--input-border, #e2e8f0);
    border-radius: 12px;
    background: #fff;
    color: var(--text, #0f172a);
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
  }
  .mo-filterbar__toggle::-webkit-details-marker { display: none; }
  .mo-filterbar__toggle:focus-visible { outline: none; box-shadow: var(--mo-focus); }
  .mo-filterbar__filters[open] > .mo-filterbar__toggle { margin-bottom: 12px; }
  .mo-filterbar__grid { flex-direction: column; align-items: stretch; }
  .mo-filterbar__grid > .filter-multi { flex: none; }
  .mo-filterbar__more-toggle { width: 100%; justify-content: space-between; }
  .mo-filterbar .mo-filterbar__checks { position: static; width: auto; margin-top: 8px; box-shadow: none; }
  .mo-filterbar__actions .btn { width: 100%; }
}

@media (max-width: 640px) {
  .mo-hero { padding-top: 12px; }
  .mo-hero__card { padding: 20px 18px; border-radius: 18px; }
  .mo-hero__context { display: block; margin: 2px -18px -20px; padding: 12px 18px 14px; border-radius: 0 0 18px 18px; }
  .mo-hero__context .mo-subheading { margin-bottom: 8px; }
  /* En móvil la franja contextual va en una sola fila desplazable: el hero
     no crece con cada píldora y el contenido queda más arriba. */
  .mo-hero__context .mo-filter-pills {
    flex-wrap: nowrap;
    margin: 0 -18px;
    padding: 2px 18px 6px;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .mo-hero__context .mo-filter-pill { flex: none; white-space: nowrap; }
  .mo-hero__identity { flex-direction: column; gap: 14px; }
  .mo-mark { width: 76px; height: 76px; border-radius: 14px; }
  .mo-mark--simbolo { padding: 10px; }
  .mo-mark.mo-icon-box .mo-icon { width: 36px; height: 36px; }
  .mo-hero .mo-hero__title { margin: 8px 0; }
  .mo-hero .mo-hero__lead { font-size: 15.5px; }
  .mo-hero__actions .btn { flex: 1 1 auto; justify-content: center; }
  .mo-stat-panel { box-shadow: none; }

  .mo-route-grid { grid-template-columns: 1fr; }
  .mo-territory-card { padding: 16px; }
  .mo-logo { width: 48px; height: 48px; border-radius: 12px; }
  .mo-logo img { width: 38px; height: 38px; }
  .mo-territory-card .mo-logo img { width: 40px; height: 30px; }
  .mo-territory-card .mo-logo--escudo img { width: 30px; height: 40px; }
}

@media (max-width: 380px) {
  .mo-sheet,
  .mo-sheet.organism-section { padding: 18px 14px 20px; }
  .mo-section-head { flex-direction: column; }
  .mo-section-head__aside { padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .mo-metric,
  .mo-link-arrow .mo-icon,
  .mo-territory-card,
  .mo-filter-pill,
  .mo-route-card,
  .mo-route-card__arrow,
  .mo-stat--link,
  .mo-faq summary::after,
  .mo-filterbar__more-toggle::after { transition: none; }
  .mo-route-card:hover,
  .mo-route-card:hover .mo-route-card__arrow,
  .mo-link-arrow:hover .mo-icon { transform: none; }
}
