/* Pestaña YouTube (13-oct-2026, docs/MEDICION-YOUTUBE.md §7): cohorte por pieza, sus registros y el
   recorrido observado de cada persona. El sistema «flow» del panel, sin colores nuevos: el índigo solo
   en las marcas de dato y el rojo y el ámbar solo en estados. Nada por debajo de 14 px. */
#view-youtube { font-size: 15px; }

/* Cabecera: el estado de las tres fuentes a la izquierda y el modelo de atribución a la derecha. */
.yt-cabeza { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; }
.yt-fuentes { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--ink-2); }
.yt-fuente { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 100%; }
.yt-fuente-error { flex-basis: 100%; color: var(--down-ink); overflow-wrap: anywhere; }
.yt-modelo .chip { min-height: 38px; }
/* La web aún sin leer con éxito: un estado (ámbar), no un error del panel. Explica los «—» de la tabla. */
.yt-aviso { margin: 0 0 14px; padding: 10px 14px; font-size: 14px; line-height: 1.5; color: var(--warn-ink); background: var(--warn-wash);
  border: 1px solid var(--warn-line); border-radius: var(--radius-sm); overflow-wrap: anywhere; }

/* La cohorte: la frase dice qué se cuenta y la barra, cuánta gente ha tenido ya 30 días para comprar. */
.yt-cohorte { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 16px 18px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.yt-cohorte p { margin: 0; flex: 1 1 420px; font-size: 16px; line-height: 1.5; color: var(--ink-2); }
.yt-cohorte b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.yt-madurez { position: relative; flex: 0 0 160px; height: 8px; border-radius: 0 4px 4px 0; background: var(--line); overflow: hidden; }
.yt-madurez > span { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 0 4px 4px 0; }

/* La tabla. Cada pieza va en su <tbody>; sus colocaciones, en el siguiente, ocultas hasta desplegarlas.
   La primera columna se queda fija al desplazar en horizontal: sin ella no se sabe de qué pieza es la cifra. */
.yt-tabla table { min-width: 1080px; }
/* Las cabeceras se parten en dos líneas antes que ensanchar la tabla; las de grupo (citas vencidas y
   oportunidades) van centradas sobre sus columnas. Las cifras, con menos aire a los lados. */
.yt-tabla thead th { white-space: normal; vertical-align: bottom; line-height: 1.3; }
.yt-tabla thead th.num, .yt-tabla tbody td.num, .yt-tabla tfoot td.num { padding-left: 10px; padding-right: 10px; }
.yt-tabla thead th.yt-grupo-cab { text-align: center; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.yt-tabla .yt-tasa { min-width: 112px; }
.yt-tabla tbody th, .yt-tabla tfoot th { padding: 10px 14px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.yt-tabla tbody td, .yt-tabla tfoot td { vertical-align: top; }
.yt-tabla thead tr:first-child th:first-child { position: sticky; left: 0; z-index: 2; }
.yt-pieza { position: sticky; left: 0; z-index: 1; min-width: 240px; max-width: 320px; white-space: normal; font-weight: 400; background: var(--surface); }
.yt-titulo { display: block; font-weight: 600; line-height: 1.35; color: var(--ink); overflow-wrap: anywhere; }
a.yt-titulo { text-decoration: none; }
a.yt-titulo::after { content: " ↗"; font-weight: 400; color: var(--muted); }
a.yt-titulo:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.yt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.yt-codigo { font-family: var(--code); font-size: 14px; color: var(--ink-2); background: var(--line-2); border-radius: 6px; padding: 1px 6px; }
/* El enlace de la descripción del vídeo: lo que se pega en YouTube, a la vista y a un botón de copiarse.
   La raíz va apagada y es lo primero que se recorta; el nombre corto (video1), lo último. Un clic
   en el enlace lo selecciona entero, por si hay que copiarlo a mano. */
.yt-enlace { display: flex; align-items: center; gap: 8px; margin-top: 8px; min-width: 0; }
.yt-enlace-url { display: inline-flex; min-width: 0; padding: 3px 8px; font-family: var(--code); font-size: 14px; line-height: 1.45;
  color: var(--accent-ink); background: var(--accent-wash); border: 1px solid var(--accent-line); border-radius: var(--radius-xs);
  user-select: all; -webkit-user-select: all; cursor: text; }
.yt-enlace-raiz { flex: 0 1 auto; min-width: 2ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.yt-enlace-slug { flex: none; max-width: calc(100% - 2ch); overflow: hidden; text-overflow: ellipsis; font-weight: 650; white-space: nowrap; }
/* Ancho fijo para «Copiar» y «Copiado»: el enlace no salta al cambiar el texto. */
.yt-copiar { flex: none; min-width: 84px; min-height: 32px; padding: 0 12px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-xs); cursor: pointer;
  transition: color .15s var(--ease), border-color .15s var(--ease); }
.yt-copiar:hover { color: var(--accent-ink); border-color: var(--accent-line); }
.yt-copiar[data-estado="ok"] { color: var(--ok-ink); border-color: var(--ok-line); background: var(--ok-wash); }
.yt-copiar[data-estado="mal"] { color: var(--warn-ink); border-color: var(--warn-line); background: var(--warn-wash); }
.yt-copiar:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.yt-copia-campo { position: fixed; top: 0; left: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.yt-desplegar { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; margin-top: 6px; padding: 0; border: 0; background: transparent;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--accent-ink); cursor: pointer; }
.yt-desplegar::before { content: "▸"; transition: transform .15s var(--ease); }
.yt-desplegar[aria-expanded="true"]::before { transform: rotate(90deg); }
.yt-n, button.yt-n { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.yt-sub { margin-top: 3px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.yt-tabla .cellbar i { width: 48px; }
.yt-sitio th, .yt-sitio td { font-size: 14px; color: var(--ink-2); background: var(--surface-2); }
.yt-sitio th { position: sticky; left: 0; padding-left: 30px; font-weight: 500; }
.yt-tabla tfoot th, .yt-tabla tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line); border-bottom: 0; padding: 10px 14px; }
.yt-tabla tfoot th { position: sticky; left: 0; }
.yt-tabla tfoot td { white-space: nowrap; }
.yt-def { margin-top: 18px; }
.yt-def summary { display: flex; align-items: center; gap: 6px; min-height: 38px; font-size: 14px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; list-style: none; }
.yt-def summary::-webkit-details-marker { display: none; }
.yt-def summary::before { content: "▸"; transition: transform .15s var(--ease); }
.yt-def[open] summary::before { transform: rotate(90deg); }
.yt-def .eq-glos { margin-top: 8px; }
#view-youtube .errbox { margin-bottom: 14px; }
#view-youtube[aria-busy="true"] .yt-tabla { opacity: .55; transition: opacity .2s; }

/* Los registros de una cifra y el recorrido de una persona: <dialog> encima de todo. */
.yt-dialogo { width: min(1040px, calc(100vw - 32px)); max-width: 1040px; color: var(--ink); }
.yt-dialogo::backdrop { background: rgba(17, 19, 24, .38); }
#yt-recorrido { width: min(660px, calc(100vw - 32px)); max-width: 660px; }
.yt-resumen { margin: 0 0 10px; }
.yt-registros td { white-space: normal; vertical-align: top; }
.yt-registros td:last-child, .yt-cuando { white-space: nowrap; }
.yt-paginas { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 12px; }
.yt-paginas .btn, .yt-acciones .btn { min-height: 40px; }
.yt-acciones { margin: 4px 0 8px; }

/* Recorrido observado: una línea de tiempo con la hora, la fuente y la precisión de cada cosa. */
.yt-rec-sec { margin-top: 16px; }
.yt-eventos { display: grid; gap: 12px; margin: 0; padding: 0 0 0 18px; list-style: none; border-left: 2px solid var(--line); }
.yt-evento { position: relative; display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 2px 12px; font-size: 14px; }
.yt-evento::before { content: ""; position: absolute; left: -25px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.yt-ev-cuando { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.yt-ev-que { overflow-wrap: anywhere; }
.yt-ev-detalle { display: block; color: var(--muted); }
.yt-ev-fuente { grid-column: 2; color: var(--muted); }
.yt-precision { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 14px; background: var(--line-2); color: var(--ink-2); }
.yt-precision-aproximada { background: var(--warn-wash); color: var(--warn-ink); }
.yt-precision-observada { background: var(--accent-wash); color: var(--accent-ink); }
.yt-vsl { margin-top: 8px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.yt-vsl-cab { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.yt-vsl .lj-k { min-width: 128px; }
.yt-vsl-barra { position: relative; display: inline-block; width: 96px; height: 8px; margin-right: 10px; vertical-align: middle;
  border-radius: 0 4px 4px 0; background: var(--line); overflow: hidden; }
.yt-vsl-barra > span { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; }
.yt-vsl-cob > span { background: var(--accent); }
.yt-vsl-max > span { background: var(--ink-2); opacity: .45; }
.yt-huecos { margin: 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.yt-huecos li + li { margin-top: 4px; }

/* Salud: el bloque de YouTube usa la tarjeta de los demás bloques. */
.health-tile .ht-sub { margin: 12px 0 4px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
[data-bloque="youtube"] .hint + .ht-row { margin-top: 8px; }
.health-tile .yt-incidencia.health-err { justify-content: flex-start; margin: 4px 0; }
.health-tile .yt-incidencia .ht-k { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.yt-salud-error { color: var(--down-ink); overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .yt-cabeza { flex-direction: column; align-items: stretch; }
  .yt-modelo { align-self: flex-start; }
  .yt-madurez { flex-basis: 100%; }
  .yt-pieza { min-width: 140px; max-width: 150px; }
  .yt-enlace { flex-wrap: wrap; }
  .yt-enlace-url { max-width: 100%; }
  .yt-evento { grid-template-columns: 1fr; }
  .yt-ev-fuente { grid-column: 1; }
  .yt-vsl .lj-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .yt-desplegar::before, .yt-def summary::before, #view-youtube[aria-busy="true"] .yt-tabla, .yt-copiar { transition: none; }
}
