/* ======================================================
   ESTILOS COMPARTIDOS
   Paso 1 (datos.html), paso 2 (editor.html) y vista de datos (tabla.html).

   Todos los colores salen de las variables de :root ("tokens").
   El modo oscuro solo cambia esos valores (html[data-apariencia="oscuro"]);
   apariencia.js decide cuál aplicar (automático, claro u oscuro).
   ====================================================== */

:root {
  color-scheme: light;

  /* Superficies */
  --fondo: #f3f5f9;
  --panel: #ffffff;
  --panel-2: #f8fafc;          /* superficie un poco hundida: encabezados de tabla, notas */
  --velo: rgba(243, 245, 249, 0.86);

  /* Bordes */
  --borde: #e2e8f0;
  --borde-suave: #eef2f6;
  --borde-control: #cbd5e1;

  /* Texto */
  --texto: #0f172a;
  --texto-2: #334155;
  --suave: #64748b;
  --tenue: #94a3b8;

  /* Acciones */
  --primario: #0f172a;
  --primario-hover: #1e293b;
  --primario-texto: #ffffff;
  --secundario: #e9edf3;
  --secundario-hover: #dde3ec;
  --acento: #2563eb;
  --acento-hover: #1d4ed8;
  --acento-suave: #e3ecff;
  --acento-texto: #1e40af;

  /* Estados */
  --aviso: #b45309;
  --aviso-fondo: #fff4e5;
  --error: #b91c1c;
  --error-fondo: #fdecec;
  --exito: #15803d;
  --exito-fondo: #e3f7e9;
  --morado: #5b21b6;
  --morado-fondo: #ede9fe;
  --resaltado: #fde68a;

  /* Forma y movimiento */
  --radio: 10px;
  --radio-chico: 7px;
  --sombra-1: 0 1px 2px rgba(15, 23, 42, 0.06);
  --sombra-2: 0 2px 4px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.08);
  --sombra-3: 0 24px 64px rgba(15, 23, 42, 0.28);
  --anillo: 0 0 0 3px rgba(37, 99, 235, 0.28);
  --curva: cubic-bezier(0.2, 0.7, 0.2, 1);
  --rapido: 140ms;
  --medio: 240ms;

  --tipografia: Inter, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

html[data-apariencia="oscuro"] {
  color-scheme: dark;

  --fondo: #0b1120;
  --panel: #111a2c;
  --panel-2: #0e1626;
  --velo: rgba(11, 17, 32, 0.86);

  --borde: #1f2b40;
  --borde-suave: #18233a;
  --borde-control: #2c3a55;

  --texto: #e6ebf3;
  --texto-2: #c3cddb;
  --suave: #93a1b6;
  --tenue: #64748b;

  --primario: #e6ebf3;
  --primario-hover: #ffffff;
  --primario-texto: #0b1120;
  --secundario: #1b2639;
  --secundario-hover: #24324a;
  --acento: #4f8cff;
  --acento-hover: #74a5ff;
  --acento-suave: rgba(79, 140, 255, 0.16);
  --acento-texto: #a9c6ff;

  --aviso: #fbbf24;
  --aviso-fondo: rgba(251, 191, 36, 0.12);
  --error: #f87171;
  --error-fondo: rgba(248, 113, 113, 0.12);
  --exito: #4ade80;
  --exito-fondo: rgba(74, 222, 128, 0.12);
  --morado: #c4b5fd;
  --morado-fondo: rgba(167, 139, 250, 0.16);
  --resaltado: rgba(250, 204, 21, 0.32);

  --sombra-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sombra-2: 0 2px 4px rgba(0, 0, 0, 0.25), 0 10px 28px rgba(0, 0, 0, 0.35);
  --sombra-3: 0 24px 64px rgba(0, 0, 0, 0.6);
  --anillo: 0 0 0 3px rgba(79, 140, 255, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--tipografia);
  background: var(--fondo);
  color: var(--texto);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

/* Al cambiar de claro a oscuro, los colores se funden en lugar de saltar (solo durante el cambio) */
html.cambiando-apariencia *, html.cambiando-apariencia *::before, html.cambiando-apariencia *::after {
  transition: background-color var(--medio) ease, border-color var(--medio) ease, color var(--medio) ease,
    box-shadow var(--medio) ease !important;
}

/* ---------- Movimiento ---------- */

/* Al pasar de una página a otra (paso 1 → paso 2) la barra se queda y el contenido se funde */
@view-transition { navigation: auto; }
.barra { view-transition-name: barra; }
::view-transition-old(root) { animation: 160ms ease both desvanecer; }
::view-transition-new(root) { animation: 220ms var(--curva) both aparecer; }

@keyframes aparecer { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes desvanecer { to { opacity: 0; } }
@keyframes salir { to { opacity: 0; transform: translateX(12px); height: 0; margin: 0; padding-top: 0; padding-bottom: 0; } }
@keyframes entrar-dialogo { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes brillo { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.aparece { animation: aparecer var(--medio) var(--curva) both; }

/* Quien pidió a su sistema "reducir movimiento" no ve animaciones */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ---------- Barra superior con los pasos ---------- */

.barra {
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 20px; flex: 0 0 auto;
  background: var(--panel); border-bottom: 1px solid var(--borde);
  position: relative; z-index: 4;
}
.marca { font-weight: 800; font-size: 16px; color: var(--texto); text-decoration: none; white-space: nowrap; letter-spacing: -0.01em; }
.marca::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 3px; background: linear-gradient(135deg, var(--acento), #8b5cf6); vertical-align: 1px; }
.pasos { display: flex; align-items: center; gap: 6px; }
.paso {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
  color: var(--suave); text-decoration: none;
  transition: background-color var(--rapido) ease, color var(--rapido) ease;
}
.paso b {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--borde-suave); color: var(--suave); font-size: 12px;
}
.paso.actual { background: var(--acento-suave); color: var(--acento-texto); }
.paso.actual b { background: var(--acento); color: #fff; }
.paso.hecho b { background: var(--exito-fondo); color: var(--exito); }
a.paso:hover { background: var(--secundario); color: var(--texto); }
.pasos .flecha { color: var(--tenue); }
.barra .acciones { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* Interruptores de la barra: apariencia (claro/oscuro) y estilo del panel de datos */
.interruptor {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px;
  border: 1px solid var(--borde); border-radius: 999px; background: var(--panel);
  color: var(--texto-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background-color var(--rapido) ease, border-color var(--rapido) ease, transform var(--rapido) var(--curva);
}
.interruptor:hover { background: var(--secundario); }
.interruptor:active { transform: scale(0.97); }
.interruptor .icono { font-size: 14px; line-height: 1; }
.segmentado { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--secundario); gap: 2px; }
.segmentado button {
  border: none; background: none; color: var(--suave); font: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; cursor: pointer;
  transition: background-color var(--rapido) ease, color var(--rapido) ease, box-shadow var(--rapido) ease;
}
.segmentado button[aria-pressed="true"] { background: var(--panel); color: var(--texto); box-shadow: var(--sombra-1); }

/* ---------- Controles ---------- */

h2.titulo-seccion { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--suave); margin: 0 0 10px; }
.ayuda { font-size: 12px; color: var(--suave); margin: -4px 0 10px; line-height: 1.5; }
label.campo { display: block; font-size: 13px; margin-bottom: 10px; }
label.campo > span { display: block; margin-bottom: 5px; color: var(--texto-2); font-weight: 500; }
input[type=text], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--texto);
  border: 1px solid var(--borde-control); border-radius: var(--radio-chico); background: var(--panel);
  transition: border-color var(--rapido) ease, box-shadow var(--rapido) ease, background-color var(--rapido) ease;
}
input[type=text]:hover, input[type=url]:hover, input[type=search]:hover, select:hover, textarea:hover { border-color: var(--tenue); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acento); box-shadow: var(--anillo); }
button:focus-visible, a:focus-visible, .info:focus-visible { outline: none; box-shadow: var(--anillo); }
input::placeholder, textarea::placeholder { color: var(--tenue); }
input[type=checkbox], input[type=range] { accent-color: var(--acento); }
textarea { resize: vertical; min-height: 50px; }
.fila { display: flex; gap: 8px; }
.fila > * { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-bottom: 8px; cursor: pointer; color: var(--texto-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 600;
  border: none; border-radius: var(--radio-chico); cursor: pointer;
  background: var(--primario); color: var(--primario-texto); text-decoration: none; text-align: center;
  transition: background-color var(--rapido) ease, transform var(--rapido) var(--curva), box-shadow var(--rapido) ease, opacity var(--rapido) ease;
}
.btn:hover { background: var(--primario-hover); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.985); }
.btn.ancho { display: flex; width: 100%; margin-bottom: 8px; }
.btn.secundario { background: var(--secundario); color: var(--texto); }
.btn.secundario:hover { background: var(--secundario-hover); }
.btn.acento { background: var(--acento); color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.3); }
.btn.acento:hover { background: var(--acento-hover); box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3); }
.btn.grande { padding: 12px 18px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-texto { border: none; background: none; color: var(--acento); cursor: pointer; font: inherit; font-size: 12px; padding: 2px 4px; border-radius: 4px; }
.btn-texto:hover { text-decoration: underline; }
.btn-texto.peligro { color: var(--error); }

.aviso { font-size: 12px; line-height: 1.5; padding: 9px 11px; border-radius: var(--radio-chico); margin-bottom: 8px; animation: aparecer var(--medio) var(--curva) both; }
.aviso.info { background: var(--acento-suave); color: var(--acento-texto); }
.aviso.advertencia { background: var(--aviso-fondo); color: var(--aviso); }
.aviso.error { background: var(--error-fondo); color: var(--error); }
.aviso.exito { background: var(--exito-fondo); color: var(--exito); }

.chip { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--borde-suave); color: var(--texto-2); margin: 0 4px 4px 0; }
.chip.verde { background: var(--exito-fondo); color: var(--exito); }
.chip.azul { background: var(--acento-suave); color: var(--acento-texto); }
.chip.ambar { background: var(--aviso-fondo); color: var(--aviso); }

details { font-size: 13px; margin-bottom: 8px; }
details summary { cursor: pointer; color: var(--texto-2); margin-bottom: 8px; }
details[open] > *:not(summary) { animation: aparecer var(--medio) var(--curva) both; }

/* Esqueleto de carga: bloques que brillan mientras llegan los datos */
.esqueleto { display: grid; gap: 12px; }
.esqueleto span {
  display: block; height: 14px; border-radius: 6px;
  background: linear-gradient(90deg, var(--borde-suave) 25%, var(--secundario) 50%, var(--borde-suave) 75%);
  background-size: 200% 100%; animation: brillo 1.4s linear infinite;
}
.esqueleto .grande { height: 220px; border-radius: var(--radio); }
.esqueleto .corto { width: 40%; }
.esqueleto .medio { width: 70%; }

/* Barras de desplazamiento discretas */
* { scrollbar-width: thin; scrollbar-color: var(--borde-control) transparent; }


/* ======================================================
   PASO 1: DATOS
   ====================================================== */

.paso-datos {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 340px minmax(0, 1fr) 360px; gap: 0;
}
.columna { min-height: 0; overflow-y: auto; padding: 18px 20px 40px; }
.columna.explorar { background: var(--panel); border-right: 1px solid var(--borde); }
.columna.seleccion { background: var(--panel); border-left: 1px solid var(--borde); display: flex; flex-direction: column; }
.columna h2.titulo-columna { font-size: 15px; margin: 0 0 4px; letter-spacing: -0.01em; }
.columna .circulo { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primario); color: var(--primario-texto); font-size: 12px; margin-right: 6px; }

#migas { font-size: 12px; color: var(--suave); margin: 10px 0 8px; line-height: 1.6; }
#migas a { color: var(--acento); cursor: pointer; text-decoration: none; }
#migas a:hover { text-decoration: underline; }
.lista-catalogo { border: 1px solid var(--borde-suave); border-radius: var(--radio); overflow: hidden; }
.lista-catalogo > * { animation: aparecer var(--medio) var(--curva) both; animation-delay: calc(var(--i, 0) * 16ms); }
.lista-catalogo .item {
  display: block; width: 100%; text-align: left; padding: 9px 11px;
  border: none; border-bottom: 1px solid var(--borde-suave); background: var(--panel);
  font: inherit; font-size: 13px; cursor: pointer; color: var(--texto); line-height: 1.38;
  transition: background-color var(--rapido) ease, box-shadow var(--rapido) ease;
}
.lista-catalogo .item:last-child { border-bottom: none; }
.lista-catalogo .item:hover { background: var(--panel-2); }
.lista-catalogo .item.activo { background: var(--acento-suave); box-shadow: inset 3px 0 0 var(--acento); }
.lista-catalogo .item.tema::before { content: "▸ "; color: var(--tenue); }
.lista-catalogo .item small { display: block; color: var(--suave); font-size: 11px; margin-top: 2px; }
.lista-catalogo .item .chip { margin: 4px 4px 0 0; }
.lista-catalogo .vacio { padding: 14px; font-size: 12px; color: var(--suave); }

/* Ficha del indicador */
.columna.ficha { padding: 24px 28px 48px; }
.ficha-vacia { height: 100%; display: grid; place-items: center; text-align: center; color: var(--suave); }
.ficha-vacia p { max-width: 380px; line-height: 1.65; }
.ficha-vacia::before { content: "◔"; display: block; font-size: 40px; color: var(--tenue); margin-bottom: 4px; }
.ficha-encabezado { animation: aparecer var(--medio) var(--curva) both; }
.ficha-encabezado h1 { font-size: 23px; margin: 0 0 6px; line-height: 1.25; letter-spacing: -0.015em; }
.ficha-encabezado .ruta { font-size: 12px; color: var(--suave); margin-bottom: 10px; line-height: 1.5; }
.tarjeta {
  background: var(--panel); border: 1px solid var(--borde); border-radius: var(--radio);
  padding: 16px 18px; margin-bottom: 16px; box-shadow: var(--sombra-1);
}
#ficha-detalle > .tarjeta { animation: aparecer 320ms var(--curva) both; }
#ficha-detalle > .tarjeta:nth-child(2) { animation-delay: 40ms; }
#ficha-detalle > .tarjeta:nth-child(3) { animation-delay: 80ms; }
#ficha-detalle > .tarjeta:nth-child(4) { animation-delay: 120ms; }
#ficha-detalle > .tarjeta:nth-child(5) { animation-delay: 160ms; }
.tarjeta h3 { font-size: 13px; margin: 0 0 10px; color: var(--texto-2); }
#vista-previa { width: 100%; height: 260px; }
.resumen { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px 18px; }
.resumen .dato small { display: block; font-size: 11px; color: var(--suave); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 3px; }
.resumen .dato div { font-size: 14px; font-weight: 600; }
table.datos { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.datos th { text-align: left; font-size: 11px; color: var(--suave); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; padding: 7px 8px; border-bottom: 1px solid var(--borde); }
table.datos td { padding: 7px 8px; border-bottom: 1px solid var(--borde-suave); }
table.datos tbody tr { transition: background-color var(--rapido) ease; }
table.datos tbody tr:hover { background: var(--panel-2); }
table.datos td.numero, table.datos th.numero { text-align: right; }
.notas p { font-size: 13px; line-height: 1.6; margin: 0 0 10px; white-space: pre-line; color: var(--texto-2); }
.agregar { position: sticky; bottom: -48px; background: linear-gradient(transparent, var(--fondo) 30%); padding: 18px 0 0; }
.agregar .tarjeta { display: flex; gap: 12px; align-items: flex-end; border-color: var(--acento-suave); background: var(--panel); margin: 0; box-shadow: var(--sombra-2); }
.agregar label.campo { flex: 1; margin: 0; }

/* Selección */
#lista-seleccion { flex: 1; }
.serie-elegida {
  border: 1px solid var(--borde); border-radius: var(--radio); padding: 12px; margin-bottom: 10px; background: var(--panel);
  box-shadow: var(--sombra-1); overflow: hidden;
}
.serie-elegida.entrando { animation: aparecer 320ms var(--curva) both; }
.serie-elegida.saliendo { animation: salir 200ms ease forwards; }
.serie-elegida .cabeza { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.serie-elegida .cabeza .num { flex: 0 0 auto; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--acento-suave); color: var(--acento-texto); font-size: 11px; font-weight: 700; }
.serie-elegida .cabeza .nombre { flex: 1; font-size: 13px; font-weight: 600; line-height: 1.35; }
.serie-elegida .cabeza .nombre small { display: block; font-weight: 400; color: var(--suave); font-size: 11px; margin-top: 2px; }
.serie-elegida label.campo { margin-bottom: 8px; font-size: 12px; }
.seleccion-vacia { border: 1px dashed var(--borde-control); border-radius: var(--radio); padding: 20px; text-align: center; color: var(--suave); font-size: 13px; line-height: 1.6; }
.pie-seleccion { border-top: 1px solid var(--borde); padding-top: 14px; margin-top: 8px; }


/* ======================================================
   PASO 2: GRÁFICA
   ====================================================== */

.paso-grafica { flex: 1; min-height: 0; display: grid; grid-template-columns: 340px 1fr; }
#panel { background: var(--panel); border-right: 1px solid var(--borde); overflow-y: auto; padding: 16px 20px 40px; }
#info { font-size: 12px; color: var(--suave); margin-bottom: 10px; }
.seccion { border-top: 1px solid var(--borde-suave); padding: 14px 0 6px; }
.seccion:first-of-type { border-top: none; padding-top: 4px; }
.botones { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.opcion {
  flex: 1; padding: 8px 4px; font: inherit; font-size: 13px; cursor: pointer;
  border: 1px solid var(--borde-control); background: var(--panel); color: var(--texto); border-radius: var(--radio-chico);
  transition: background-color var(--rapido) ease, color var(--rapido) ease, border-color var(--rapido) ease, transform var(--rapido) var(--curva);
}
.opcion:hover:not(:disabled):not(.activa) { background: var(--panel-2); border-color: var(--tenue); }
.opcion:active:not(:disabled) { transform: scale(0.97); }
.opcion.activa { background: var(--primario); color: var(--primario-texto); border-color: var(--primario); }
.opcion:disabled { opacity: 0.4; cursor: not-allowed; }
.lista { max-height: 260px; overflow-y: auto; border: 1px solid var(--borde-suave); border-radius: var(--radio-chico); margin-bottom: 10px; }
.renglon { display: flex; align-items: center; gap: 8px; padding: 5px 8px; font-size: 13px; border-bottom: 1px solid var(--borde-suave); transition: background-color var(--rapido) ease; }
.renglon:hover { background: var(--panel-2); }
.renglon label { flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; min-width: 0; }
.renglon input[type=color] { width: 28px; height: 22px; border: none; padding: 0; background: none; cursor: pointer; }
.mini { border: none; background: none; color: var(--suave); cursor: pointer; font-size: 13px; }

#muestras { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
#muestras input[type=color] {
  width: 34px; height: 34px; padding: 0; border: 2px solid var(--panel); border-radius: 9px;
  box-shadow: 0 0 0 1px var(--borde-control); cursor: pointer; background: none;
  transition: transform var(--rapido) var(--curva);
}
#muestras input[type=color]:hover { transform: translateY(-2px); }
#muestras input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
#muestras input[type=color]::-webkit-color-swatch { border: none; border-radius: 7px; }
#muestras button { width: 34px; height: 34px; border: 1px dashed var(--borde-control); border-radius: 9px; background: var(--panel); cursor: pointer; color: var(--suave); font-size: 16px; }

.nota { border: 1px solid var(--borde-suave); border-radius: var(--radio-chico); padding: 8px; margin-bottom: 8px; background: var(--panel-2); animation: aparecer var(--medio) var(--curva) both; }
.nota .fila { margin-top: 6px; align-items: center; }
.quitar { flex: 0 0 auto !important; border: none; background: none; color: var(--error); cursor: pointer; font-size: 12px; }
#estado-video { font-size: 12px; color: var(--aviso); min-height: 16px; }

#escenario { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 14px; overflow: hidden; min-height: 0; }
#marco {
  width: 100%; height: 500px; background: var(--panel); border-radius: var(--radio); overflow: hidden;
  box-shadow: var(--sombra-2); animation: aparecer 360ms var(--curva) both;
  /* Sin transición de tamaño: la gráfica mide el marco en el momento de ajustarse */
}
#grafica { width: 100%; height: 100%; }
#reproductor { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 900px; }
#reproductor button {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primario); color: var(--primario-texto); font-size: 15px;
  transition: transform var(--rapido) var(--curva), background-color var(--rapido) ease;
}
#reproductor button:hover { transform: scale(1.06); }
#reproductor button:active { transform: scale(0.94); }
#reproductor button.secundario { background: var(--secundario); color: var(--texto); }
#linea-tiempo { flex: 1; }
#periodo-actual { font-weight: 600; min-width: 70px; text-align: right; font-variant-numeric: tabular-nums; }

.cargando {
  position: fixed; inset: 56px 0 0 0; display: grid; place-items: center; background: var(--velo);
  font-size: 14px; color: var(--suave); z-index: 5; backdrop-filter: blur(2px);
}
.cargando::before {
  content: ""; width: 26px; height: 26px; margin-bottom: 10px; border-radius: 50%;
  border: 3px solid var(--borde-control); border-top-color: var(--acento); animation: girar 0.8s linear infinite;
}
.cargando { grid-template-rows: auto auto; align-content: center; }
@keyframes girar { to { transform: rotate(360deg); } }

/* Resultados del catálogo: título con contexto, ruta resumida y palabras resaltadas */
.lista-catalogo .item .contexto { color: var(--suave); font-weight: 400; }
.lista-catalogo .item .titulo-item { font-weight: 600; }
.lista-catalogo .item .ruta-item {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--tenue); font-size: 11px; margin-top: 3px;
}
.lista-catalogo mark { background: var(--resaltado); color: inherit; padding: 0 1px; border-radius: 3px; }
.grupo-resultados {
  position: sticky; top: -18px; z-index: 1;
  padding: 8px 11px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--texto-2); background: var(--panel-2); border-bottom: 1px solid var(--borde-suave);
}
.grupo-resultados span { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--suave); }
.resumen-busqueda { font-size: 12px; color: var(--suave); margin: 8px 0 6px; line-height: 1.5; }
.lista-catalogo .distintivos { margin: 4px 0 1px; }
.chip.distintivo { background: var(--morado-fondo); color: var(--morado); font-weight: 700; font-size: 12px; }

.barra-grafica { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; max-width: 1400px; min-height: 32px; font-size: 13px; color: var(--suave); }
.barra-grafica b { color: var(--texto); }
.barra-grafica .btn { padding: 6px 12px; }


/* ======================================================
   VISTA DE DATOS (tabla.html)
   ====================================================== */

.titulo-barra { font-size: 14px; font-weight: 600; color: var(--suave); }
.paso-tabla { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pestanas { display: flex; gap: 4px; padding: 10px 24px 0; background: var(--panel); border-bottom: 1px solid var(--borde); overflow-x: auto; flex: 0 0 auto; }
.pestana {
  border: 1px solid transparent; border-bottom: none; background: none; cursor: pointer;
  padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 600; color: var(--suave);
  border-radius: var(--radio-chico) var(--radio-chico) 0 0; white-space: nowrap; margin-bottom: -1px;
  transition: color var(--rapido) ease, background-color var(--rapido) ease;
}
.pestana:hover { color: var(--texto); }
.pestana.activa { background: var(--fondo); border-color: var(--borde); color: var(--texto); }
.contenido-tabla { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 28px 48px; }
.contenido-tabla > * { max-width: 1400px; animation: aparecer var(--medio) var(--curva) both; }
.herramientas { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.herramientas select, .herramientas input { width: auto; min-width: 180px; }
.herramientas .ayuda { margin: 0; }
.tabla-contenedor { max-height: 70vh; overflow: auto; border: 1px solid var(--borde-suave); border-radius: var(--radio-chico); }
.tabla-contenedor table.datos thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 2; }
table.datos th.ordenable { cursor: pointer; user-select: none; }
table.datos th.ordenable:hover { color: var(--texto); }
table.datos td.exacto { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; white-space: nowrap; }
table.datos.ancha th { white-space: nowrap; }
table.datos.ancha th small { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--tenue); }
table.datos .fija { position: sticky; left: 0; background: var(--panel); z-index: 1; }
table.datos thead .fija { z-index: 3; background: var(--panel-2); }
.pie-tabla { font-size: 12px; color: var(--suave); padding: 10px; }
.subtitulo-ficha { margin-top: 16px !important; }
.texto-ficha { font-size: 13px; line-height: 1.6; white-space: pre-line; color: var(--texto-2); margin: 0 0 8px; }
pre.json {
  max-height: 60vh; overflow: auto; margin: 0; padding: 14px; border-radius: var(--radio-chico);
  background: #0b1120; color: #e2e8f0; font-size: 12px; line-height: 1.5; border: 1px solid var(--borde);
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--borde-suave); padding: 1px 5px; border-radius: 4px; word-break: break-all; }

/* Ayuda "i": la explicación aparece al pasar el mouse, al tocar o con el teclado */
.info {
  display: inline-grid; place-items: center;
  width: 15px; height: 15px; margin-left: 5px; vertical-align: 1px;
  border: 1px solid var(--tenue); border-radius: 50%;
  color: var(--suave); font-size: 10px; font-weight: 700; font-style: normal;
  text-transform: none; letter-spacing: 0; cursor: help;
  transition: border-color var(--rapido) ease, color var(--rapido) ease, background-color var(--rapido) ease;
}
.info:hover, .info:focus { border-color: var(--acento); color: var(--acento); background: var(--acento-suave); }
.burbuja-ayuda {
  position: fixed; z-index: 100; max-width: 300px; padding: 10px 12px; border-radius: var(--radio-chico);
  background: #0f172a; color: #f1f5f9; box-shadow: var(--sombra-3); border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px; line-height: 1.55; pointer-events: none; animation: aparecer 160ms var(--curva) both;
}
small.explicacion { display: block; margin-top: 5px; font-size: 11px; line-height: 1.5; color: var(--suave); }

/* Ventana de compartir */
dialog {
  border: 1px solid var(--borde); border-radius: 14px; padding: 22px 24px; width: min(560px, calc(100vw - 32px));
  background: var(--panel); color: var(--texto); box-shadow: var(--sombra-3);
}
dialog[open] { animation: entrar-dialogo 260ms var(--curva) both; }
dialog::backdrop { background: rgba(2, 6, 23, 0.5); backdrop-filter: blur(3px); animation: aparecer 200ms ease both; }
dialog h2 { font-size: 18px; margin: 0 0 8px; }
.copiable { display: flex !important; gap: 6px; align-items: flex-start; }
.copiable input, .copiable textarea { flex: 1; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.copiable .btn { flex: 0 0 auto; }
.acciones-dialogo { display: flex; justify-content: flex-end; margin-top: 12px; }
#estado-exportar { font-size: 12px; min-height: 16px; color: var(--suave); }
#estado-exportar.error { color: var(--error); }
.cargando { transition: opacity var(--medio) ease; }
.cargando.listo { opacity: 0; }
.cargando.detenido::before { display: none; }

/* ======================================================
   ENTRAR / INVITACIÓN
   ====================================================== */

.acceso { flex: 1; display: grid; place-items: center; padding: 24px 16px 64px; }
.tarjeta-acceso { width: min(420px, 100%); padding: 28px 28px 22px; animation: aparecer 360ms var(--curva) both; }
.tarjeta-acceso h1 { font-size: 22px; margin: 0 0 8px; letter-spacing: -0.015em; }
.tarjeta-acceso .ayuda { margin: 0 0 18px; }
.tarjeta-acceso .pie-acceso { margin: 12px 0 0; text-align: center; }
.tarjeta-acceso input[readonly] { opacity: 0.75; }

/* Tu cuenta en la barra */
.interruptor.cuenta { cursor: default; gap: 8px; }
.interruptor.cuenta .inicial {
  display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--acento); color: #fff; font-size: 11px; font-weight: 800;
}
input[type=password] {
  width: 100%; padding: 8px 10px; font: inherit; font-size: 13px; color: var(--texto);
  border: 1px solid var(--borde-control); border-radius: var(--radio-chico); background: var(--panel);
}
