/* Explorar: índice a la izquierda, portada u objeto a la derecha. Todo con prefijo ex-. */
.ex-marco { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
.ex-principal { min-width: 0; }

/* índice */
.ex-indice-caja { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; min-width: 0; }
.ex-indice-caja > summary { display: none; }
.ex-indice { background: var(--hoja); border: 1px solid var(--raya); border-radius: var(--r); display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 24px); }
.ex-indice-cab { padding: 10px 10px 8px; border-bottom: 1px solid var(--raya-2); display: flex; flex-direction: column; gap: 6px; }
.ex-busca { width: 100%; padding: 6px 8px; border: 1px solid var(--raya); border-radius: var(--r); background: var(--hoja-2); }
.ex-busca:focus-visible { outline-offset: 0; }
.ex-filtro { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--tinta-2); }
.ex-indice-cuerpo { overflow-y: auto; padding: 4px 6px 10px; min-height: 0; }
.ex-sin-resultados { padding: 10px 12px; font-size: 12.5px; }
.ex-familia { margin-top: 10px; }
.ex-fam { display: flex; align-items: center; gap: 7px; font: 600 11.5px/1 var(--texto); color: var(--tinta-3); text-transform: none; letter-spacing: .02em; padding: 4px 6px 4px; }
details.ex-grupo, details.ex-acceso { border-top: 0; }
details.ex-grupo > summary, details.ex-acceso > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; padding: 5px 6px; border-radius: var(--r); font-size: 13px; font-weight: 600; font-family: var(--titulo); }
details.ex-grupo > summary::-webkit-details-marker, details.ex-acceso > summary::-webkit-details-marker { display: none; }
details.ex-grupo > summary:hover, details.ex-acceso > summary:hover { background: var(--hoja-2); }
.ex-g-t::before { content: '+'; display: inline-block; width: 12px; font: 500 12px/1 var(--cifra); color: var(--tinta-3); }
details[open] > summary > .ex-g-t::before { content: '−'; }
.ex-g-n { font: 500 11px/1.8 var(--cifra); color: var(--tinta-3); }
.ex-items { display: flex; flex-direction: column; padding: 0 0 4px 14px; }
.ex-item { display: grid; grid-template-columns: 11px minmax(0, 1fr) auto; gap: 7px; align-items: center; padding: 4px 6px; border-radius: var(--r); color: var(--tinta-2); text-decoration: none; font-size: 13px; }
.ex-item[hidden], details[hidden], .ex-familia[hidden] { display: none; }
.ex-item:hover { background: var(--hoja-2); color: var(--tinta); }
.ex-item.es-actual { background: var(--tinta); color: var(--hoja); }
.ex-item.es-actual .tenue { color: inherit; opacity: .7; }
.ex-item-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-item-c { font-size: 11px; }
details.ex-acceso { margin-top: 14px; border-top: 1px solid var(--raya-2); padding-top: 6px; }
details.ex-acceso > .ex-acceso-nota { padding: 2px 6px 6px; font-size: 12px; }
details.ex-acceso details.ex-grupo { margin-left: 6px; }

/* cabecera del objeto */
.ex-cab { display: flex; flex-direction: column; gap: 6px; padding: 4px 0 14px; border-bottom: 1px solid var(--raya); }
.ex-cab-tipo { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--tinta-2); flex-wrap: wrap; }
.ex-nombre { font-size: 26px; line-height: 1.12; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.ex-desc { color: var(--tinta-2); max-width: 78ch; }
.ex-salud { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 500; }
.ex-cab-pie { display: flex; justify-content: space-between; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 6px; }
.ex-acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.ex-acciones a.boton { text-decoration: none; color: inherit; display: inline-flex; }
.ex-portada-cab { border-bottom: 0; padding-bottom: 0; }

/* cuerpo */
.ex-cuerpo { padding-top: 6px; display: flex; flex-direction: column; gap: 0; min-width: 0; }
.ex-cuerpo > .seccion:first-child, .ex-cuerpo > .ex-texto:first-child { margin-top: 14px; }
.ex-cuerpo .seccion { margin-top: 22px; }
.ex-cuerpo .seccion > .seccion-cabeza h2 { font-size: 15px; }
.ex-texto { margin-top: 14px; max-width: 78ch; display: flex; flex-direction: column; gap: 8px; }
.ex-parrafo { color: var(--tinta); }
.ex-cuerpo > dl.datos { margin-top: 14px; }
.ex-cuerpo > .cifras { margin-top: 14px; }
.ex-largo { overflow-wrap: anywhere; }
.ex-nota { font-size: 12px; margin-top: 8px; }
.ex-sub { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--raya-2); }
.ex-sub h3, .ex-hist h4 { font-size: 13px; margin-bottom: 6px; color: var(--tinta-2); }
.ex-mas { margin-top: 26px; }
.ex-aviso { margin-top: 14px; padding: 9px 12px; border: 1px solid var(--raya); border-radius: var(--r); background: var(--hoja-2); font-size: 13px; }
.ex-parte { margin-bottom: 8px; padding: 8px 12px; border-left: 3px solid var(--raya); background: var(--hoja-2); }
.ex-pre { max-height: 480px; }

/* efecto: bien visible, sin colores de salud */
.ex-efecto { display: inline-block; padding: 1px 9px; border-radius: 99px; font: 600 12px/1.6 var(--texto); white-space: nowrap; border: 1.5px solid var(--tinta); }
.ex-efecto.es-lee { color: var(--tinta); background: none; }
.ex-efecto.es-escribe { color: var(--hoja); background: var(--tinta); }
.ex-efecto-grande { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.ex-efecto-grande .ex-efecto { font-size: 15px; padding: 3px 14px; }
.ex-ruta-grande { font-size: 14px; overflow-wrap: anywhere; min-width: 0; }
.ex-valores { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ex-valores code, .ex-esquema li { font: 12px/1.5 var(--cifra); }
.ex-valores code { background: var(--hoja-2); border: 1px solid var(--raya-2); border-radius: 2px; padding: 0 5px; }

/* esquema compacto */
.ex-esquema { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 14px; }
.ex-esquema li { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; border-bottom: 1px solid var(--raya-2); min-width: 0; }
.ex-esquema li b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.ex-esquema li .tenue { white-space: nowrap; }

/* enlaces de las tablas */
a.ex-enlace { color: var(--acento); font-family: var(--cifra); font-size: 12px; text-decoration: none; }
a.ex-enlace:hover { text-decoration: underline; }
a.ex-ref { text-decoration: none; }
a.ex-ref:hover { border-color: var(--acento); color: var(--acento); }
.ex-grupos details.plegable { border-top: 1px solid var(--raya-2); }
.ex-recurso { font: 600 13px/1.4 var(--cifra); }
.ex-fila-sel td { background: var(--acento-suave); }
.ex-clave { font-family: var(--cifra); font-size: 12px; }
.ex-pag { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; font-size: 12.5px; }
.ex-pag .boton[disabled] { opacity: .45; cursor: default; }

/* historia de un expediente */
.ex-hist { margin-bottom: 14px; }
.ex-hist-cab { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 9px 14px; border-bottom: 1px solid var(--raya-2); }
.ex-hist-cab h3 { font: 600 14px/1.3 var(--cifra); overflow-wrap: anywhere; }
.ex-hist-cuerpo { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; padding: 12px 14px 14px; }
.ex-linea-v { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--raya); display: flex; flex-direction: column; gap: 12px; }
.ex-linea-v li { position: relative; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.ex-linea-v li::before { content: ''; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--hoja); border: 2px solid var(--pulso); }
.ex-linea-v li.ex-fin::before { background: var(--pulso); }
.ex-linea-v li.ex-fin.abierto::before { background: var(--bien); border-color: var(--bien); }
.ex-linea-v li.ex-hueco::before { border-style: dashed; border-color: var(--nada); }
.ex-linea-v time { font: 11.5px/1.4 var(--cifra); color: var(--tinta-3); }
.ex-datos-paso { font-size: 12px; }

/* conexión */
.ex-tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.ex-tarjeta { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.ex-tarjeta h3 { font-size: 15px; }
.ex-tarjeta dl.datos { width: 100%; }

/* portada */
.ex-tipos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.ex-fam-tarjeta { background: var(--hoja); border: 1px solid var(--raya); border-radius: var(--r); padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 2px; align-items: stretch; }
.ex-fam-tarjeta h3 { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--tinta-2); margin-bottom: 4px; }
.ex-tipo { display: flex; align-items: baseline; gap: 8px; background: none; border: 0; border-top: 1px solid var(--raya-2); padding: 6px 2px; text-align: left; border-radius: 0; flex-wrap: wrap; }
.ex-tipo b { font-size: 18px; font-weight: 500; min-width: 3ch; text-align: right; }
.ex-tipo:hover { background: var(--hoja-2); }
.ex-tipo.es-actual { background: var(--acento-suave); }
.ex-empezar { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ex-empezar li { display: flex; gap: 6px 4px; flex-wrap: wrap; align-items: center; }

/* buscar y filtrar filas, «ver lo que ve» */
.ex-filtros { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ex-barra { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.ex-campo { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--tinta-2); min-width: 0; }
.ex-campo input, .ex-campo select { min-height: 32px; padding: 4px 8px; border: 1px solid var(--raya); border-radius: var(--r); background: var(--hoja-2); min-width: 0; max-width: 100%; }
.ex-barra .ex-campo:first-child { flex: 1 1 220px; }
.ex-barra .boton { min-height: 32px; }
.ex-como-barra { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; }
.ex-como-barra .ex-campo select { min-width: 190px; }
.ex-tarjetas-f { display: flex; flex-wrap: wrap; gap: 6px; }
a.ex-enlace-txt { color: var(--acento); font-size: 12.5px; padding: 6px 0; text-decoration: none; }
a.ex-enlace-txt:hover { text-decoration: underline; }
.ex-como { padding: 10px 14px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.ex-como-pie { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 12.5px; }
.ex-check { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; }
tr.ex-oculta td { color: var(--tinta-3); }
tr.ex-oculta.rayado { background: repeating-linear-gradient(135deg, var(--esperado-suave) 0 1.5px, transparent 1.5px 6px); }
.ex-clave-celda { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ex-clave { min-height: 24px; text-align: left; overflow-wrap: anywhere; }
.ex-hist-acc { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ex-pasos { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.ex-pasos li { padding: 2px 9px; border: 1px solid var(--raya); border-radius: 99px; font: 12px/1.6 var(--cifra); color: var(--tinta-3); }
.ex-pasos li.es-actual { background: var(--tinta); color: var(--hoja); border-color: var(--tinta); }
.ex-botones { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.ex-hist-acc .boton { min-height: 28px; }
.ex-casos-filtro { max-width: 100%; overflow-x: auto; }
.ex-lista-f { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ex-clave-ficha { font: 12px/1.5 var(--cifra); background: var(--hoja-2); border: 1px solid var(--raya-2); border-radius: 2px; padding: 0 5px; margin-right: 4px; }
.ex-acciones { align-items: center; }


@media (max-width: 900px) {
  .ex-marco { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .ex-indice-caja { position: static; max-height: none; }
  .ex-indice-caja > summary { display: flex; gap: 6px; align-items: baseline; list-style: none; cursor: pointer; padding: 9px 12px; background: var(--hoja); border: 1px solid var(--raya); border-radius: var(--r); font-weight: 600; font-family: var(--titulo); min-width: 0; }
  .ex-indice-caja > summary::-webkit-details-marker { display: none; }
  .ex-indice-caja > summary > .tenue { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ex-indice-caja[open] > summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .ex-indice { max-height: 60vh; border-top: 0; border-radius: 0 0 var(--r) var(--r); }
  .ex-nombre { font-size: 22px; }
  .ex-hist-cuerpo { grid-template-columns: minmax(0, 1fr); }
  .ex-cab-pie { align-items: flex-start; }
}

/* Cuota de uso de un sistema: quién ha gastado, en una línea que se parte */
.ex-gastan { display: inline-flex; flex-wrap: wrap; gap: 2px 10px; }
.ex-gasta { white-space: nowrap; }
.ex-cuota-sub { display: block; font-size: 12px; }

/* Lo que llega de datos reales: un texto largo o un objeto en una celda, o un valor sin espacios, no ensanchan la página */
.ex-celda-obj, .ex-celda-larga { display: inline-block; max-width: 38ch; white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.ex-celda-obj { font: 12px/1.5 var(--cifra); }
.ex-objeto dd, .ex-hist dd, .ex-hist-cuerpo li, .ex-como p { overflow-wrap: anywhere; min-width: 0; }
.ex-hist-cuerpo > div { min-width: 0; }
.ex-hist .tabla-caja { max-width: 100%; }
.ex-decisiones { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ex-decisiones code { font: 12px/1.5 var(--cifra); background: var(--hoja-2); border: 1px solid var(--raya-2); border-radius: 2px; padding: 0 5px; }
.ex-principal .vacio { overflow-wrap: anywhere; }
.ex-hist { overflow-x: auto; }

/* Pestañas por contenido y maestro-detalle: la fila abierta va al lado de la tabla en ancho, y encima en estrecho */
.ex-pestanas { max-width: 100%; overflow-x: auto; }
.ex-pestanas .segmentos button { white-space: nowrap; }
.ex-md-tabla { min-width: 0; }
.ex-md.con-ficha { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.ex-md.con-ficha > .ex-md-ficha { order: -1; min-width: 0; }
.ex-md-ficha .ex-hist { margin-bottom: 0; }
.ex-md-ficha .ex-hist-cuerpo { grid-template-columns: minmax(0, 1fr); }
.ex-principal { container-type: inline-size; }
/* la ficha de la fila va al lado solo si a la tabla le quedan ~520 px; si no, encima */
@container (min-width: 976px) {
  .ex-md.con-ficha { grid-template-columns: minmax(0, 1fr) 440px; align-items: start; }
  .ex-md.con-ficha > .ex-md-ficha { order: 0; position: sticky; top: 8px; }
  /* con la ficha al lado la tabla es estrecha: una línea por fila (el texto entero, en su title) y sin las columnas de fechas */
  .ex-md.con-ficha .ex-celda-obj, .ex-md.con-ficha .ex-celda-larga { display: block; max-width: 26ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ex-md.con-ficha .ex-clave-celda { white-space: nowrap; flex-wrap: nowrap; }
  .ex-md.con-ficha .ex-col-ancha { display: none; }
}



/* Una fila de la tabla junto a la ficha no crece por un texto largo: una línea con elipsis (el completo está en su title) */


/* Con un objeto abierto no hay índice: un enlace pequeño lleva a la portada, que lo trae */
.ex-marco.con-objeto { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.ex-volver { justify-self: start; font-size: 12.5px; color: var(--acento); text-decoration: none; padding: 2px 0; }
.ex-volver:hover { text-decoration: underline; text-underline-offset: 2px; }

/* «Resumen» es la ficha del objeto, sin su marco lateral */
.ex-cuerpo .ficha-bloque, .ex-cuerpo .ficha-plegados { padding-left: 0; padding-right: 0; }
.ex-cuerpo .ficha-causa { margin-left: 0; margin-right: 0; }
.ex-cuerpo .ficha-desc { display: block; }
/* La ficha en página: una columna (el orden del DOM: ficha, lo propio del objeto, pulso y demás); con sitio, dos */
.ficha-pagina { display: grid; grid-template-columns: minmax(0, 1fr); }
.ficha-pagina > .fp-izq, .ficha-pagina > .fp-der { min-width: 0; }
.ficha-pagina .pulso { width: 100%; max-width: 480px; height: auto; }
@container (min-width: 960px) {
  .ficha-pagina { grid-template-columns: minmax(0, 1fr) minmax(380px, 420px); gap: 0 32px; align-items: start; }
  .ficha-pagina .fp-der > .ficha-bloque:first-child { padding-top: 0; }
  .ficha-pagina .fp-der .ficha-bloque { padding-left: 0; padding-right: 0; }
}
.ficha-pagina .fp-izq > dl.datos { margin-top: 14px; }
