/* estilos.css — el sistema de diseño de la app base: los TOKENS (colores, letra, espacios, radios) y los componentes.
   Todas las pantallas lo cargan primero; después, /api/marca.css pone el color de la marca (lo genera el servidor).

   Reglas de la casa (romperlas es un defecto):
   · Ningún color, tamaño ni espacio suelto: todo sale de un token de :root.
   · La CSP es style-src 'self': nada de style="…" ni elemento.style. Lo que cambia, cambia con clases.
   · Letras del sistema (San Francisco en Apple, Segoe en Windows, Roboto en Android): nada se carga de fuera.
   · Celular primero: todo se diseña a 360 px y crece. Nada se sale de lado.
   · Sin cara de IA: nada de degradados de colores, emojis como íconos ni tarjetas todas iguales. */

/* ─── 1. Los tokens ──────────────────────────────────────────────────────────────────────────────────────────── */
:root {
  /* La marca (la reemplaza /api/marca.css con el color que escoja el dueño, ya con el contraste revisado). */
  --acento: #2f5d50;            /* rellena: botón principal. Blanco encima: 7.2 a 1 */
  --acento-hondo: #264c41;      /* al pasar encima o tocar */
  --acento-tinta: #2f5d50;      /* texto de color sobre el fondo */
  --acento-tinte: #eaefed;      /* fondo de lo elegido */
  --acento-anillo: rgba(47, 93, 80, 0.35);   /* el anillo del foco (teclado) */
  --sobre-acento: #ffffff;

  /* Neutros cálidos */
  --tinta: #1f2328;             /* texto: 15.4 a 1 sobre --papel */
  --tinta-2: #4a4f57;           /* secundario: 8.2 a 1 */
  --tenue: #5d626a;             /* lo de menos peso: 5.2 a 1 sobre --relleno y sobre el tinte de cualquier marca (nada más claro) */
  --fondo: #f6f5f1;             /* el fondo de la página */
  --papel: #ffffff;             /* tarjetas, paneles y campos */
  --relleno: #eeede8;           /* botón gris, filas alternas */
  --linea: #dedcd4;
  --linea-fuerte: #c9c6bc;

  /* Estados: tinta sobre su tinte (4.5 a 1 o más) */
  --verde: #1d6b3a;   --verde-tinte: #e5f2e9;
  --rojo: #ad2a22;    --rojo-tinte: #fbeae8;
  --ambar: #8a5200;   --ambar-tinte: #fbf0dc;
  --azul: #1f5b9e;    --azul-tinte: #e7eff9;

  /* La letra */
  --letra: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --letra-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --t-chica: 0.875rem;          /* 14 px: nada más chico que esto */
  --t-normal: 1.0625rem;        /* 17 px: el cuerpo */
  --t-media: 1.25rem;
  --t-grande: 1.625rem;
  --t-enorme: 2.125rem;
  --interlinea: 1.5;

  /* Espacios (de 4 en 4) y formas */
  --e1: 0.25rem; --e2: 0.5rem; --e3: 0.75rem; --e4: 1rem; --e5: 1.5rem; --e6: 2rem; --e7: 3rem;
  --radio: 10px;
  --radio-grande: 14px;
  --sombra: 0 1px 2px rgba(31, 35, 40, 0.06), 0 2px 8px rgba(31, 35, 40, 0.05);
  --alto-control: 3rem;         /* 48 px: se toca con el dedo */
  --ancho-lectura: 40rem;
  --ancho-panel: 64rem;
  --menu-ancho: 15rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --tinta: #eceae4; --tinta-2: #c4c1b8; --tenue: #a3a097;
    --fondo: #16181b; --papel: #1f2226; --relleno: #2a2e33; --linea: #353a40; --linea-fuerte: #4a5058;
    --verde: #7fd29b; --verde-tinte: #183424; --rojo: #f19a91; --rojo-tinte: #3a1d1a;
    --ambar: #e9b766; --ambar-tinte: #352a14; --azul: #9cc3f2; --azul-tinte: #182a40;
    --sombra: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

/* ─── 2. La base ─────────────────────────────────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }                 /* hidden SIEMPRE esconde */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fondo); color: var(--tinta); font-family: var(--letra); font-size: var(--t-normal);
  line-height: var(--interlinea); overflow-x: clip; overflow-wrap: anywhere;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--e3); letter-spacing: -0.01em; }
h1 { font-size: var(--t-grande); }
h2 { font-size: var(--t-media); }
h3 { font-size: var(--t-normal); }
p { margin: 0 0 var(--e3); }
a { color: var(--acento-tinta); text-underline-offset: 0.15em; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--acento-anillo); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
.saltar { position: absolute; left: -9999px; }
.saltar:focus { left: var(--e3); top: var(--e3); background: var(--papel); padding: var(--e2) var(--e3); z-index: 10; }
.solo-lector { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tenue { color: var(--tenue); }
.chico { font-size: var(--t-chica); }
.mono { font-family: var(--letra-mono); letter-spacing: 0.02em; }

/* ─── 3. Botones y campos ────────────────────────────────────────────────────────────────────────────────────── */
.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e2); min-height: var(--alto-control);
  padding: 0 var(--e5); border: 1px solid transparent; border-radius: var(--radio); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: background-color 0.15s;
}
.boton-primario { background: var(--acento); color: var(--sobre-acento); }
.boton-primario:hover { background: var(--acento-hondo); }
.boton-secundario { background: var(--papel); color: var(--tinta); border-color: var(--linea-fuerte); }
.boton-secundario:hover { background: var(--relleno); }
.boton-peligro { background: var(--papel); color: var(--rojo); border-color: var(--rojo); }
.boton-texto { background: none; border: none; color: var(--acento-tinta); padding: 0 var(--e2); min-height: 2.5rem; }
.boton-ancho { width: 100%; }
.boton:disabled { opacity: 0.55; cursor: progress; }
.botones { display: flex; flex-wrap: wrap; gap: var(--e3); margin-top: var(--e4); }

.campo { display: flex; flex-direction: column; gap: var(--e1); margin-bottom: var(--e4); }
.campo-etiqueta { font-weight: 600; font-size: var(--t-chica); color: var(--tinta-2); }
.campo-ayuda { font-size: var(--t-chica); color: var(--tenue); margin: 0; }
.control {
  width: 100%; min-height: var(--alto-control); padding: var(--e2) var(--e3); border: 1px solid var(--linea-fuerte);
  border-radius: var(--radio); background: var(--papel); color: var(--tinta); font: inherit;
}
.control:focus { border-color: var(--acento); outline: 3px solid var(--acento-anillo); outline-offset: 0; }
textarea.control { min-height: 7rem; resize: vertical; }
.control-color { width: 4rem; padding: var(--e1); }
.campo-con-boton { display: flex; gap: var(--e2); }
.campo-con-boton .control { flex: 1; min-width: 0; }

/* ─── 4. Mensajes ────────────────────────────────────────────────────────────────────────────────────────────── */
.mensaje { padding: var(--e3) var(--e4); border-radius: var(--radio); border: 1px solid transparent; margin: 0 0 var(--e4); }
.mensaje-error { background: var(--rojo-tinte); color: var(--rojo); border-color: currentColor; }
.mensaje-bien { background: var(--verde-tinte); color: var(--verde); border-color: currentColor; }
.mensaje-aviso { background: var(--ambar-tinte); color: var(--ambar); border-color: currentColor; }
.mensaje-info { background: var(--azul-tinte); color: var(--azul); border-color: currentColor; }
.mensaje strong { display: block; }
.flotante {
  position: fixed; left: 50%; bottom: var(--e5); transform: translateX(-50%); max-width: calc(100% - 2rem);
  background: var(--tinta); color: var(--fondo); padding: var(--e3) var(--e5); border-radius: var(--radio); z-index: 20;
  box-shadow: var(--sombra);
}

/* ─── 5. Las pantallas sin sesión (entrar, restablecer, primer acceso) ───────────────────────────────────────── */
.publica { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; padding: var(--e5) var(--e4); }
.publica-marca { display: flex; align-items: center; gap: var(--e3); margin: var(--e5) 0 var(--e6); font-weight: 700; font-size: var(--t-media); color: var(--tinta); text-decoration: none; }
.publica-marca img { height: 2.5rem; width: auto; }
.caja { width: 100%; max-width: 26rem; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-grande); padding: var(--e5); box-shadow: var(--sombra); }
.caja + .caja { margin-top: var(--e4); }
.caja-pie { margin-top: var(--e4); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--e2); }
.publica-pie { margin-top: auto; padding-top: var(--e6); font-size: var(--t-chica); color: var(--tenue); text-align: center; }
.secreto {
  display: block; font-family: var(--letra-mono); font-size: var(--t-media); background: var(--relleno); border-radius: var(--radio);
  padding: var(--e3) var(--e4); margin: var(--e2) 0 var(--e3); user-select: all; overflow-wrap: anywhere;
}
.qr-imagen { display: block; width: 13.75rem; height: 13.75rem; max-width: 100%; margin: var(--e2) 0 var(--e3); border-radius: var(--radio); background: #fff; }
.mensaje-listo { white-space: pre-wrap; background: var(--relleno); border-radius: var(--radio); padding: var(--e4); font-size: var(--t-chica); margin: 0 0 var(--e3); }
.lectura { max-width: var(--ancho-lectura); }
.logo-vista { display: block; max-height: 4rem; width: auto; margin-bottom: var(--e3); }

/* ─── 6. El panel ────────────────────────────────────────────────────────────────────────────────────────────── */
.panel { min-height: 100vh; min-height: 100dvh; }
.barra {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--e3); padding: var(--e2) var(--e4);
  background: var(--papel); border-bottom: 1px solid var(--linea);
}
.barra-marca { display: flex; align-items: center; gap: var(--e2); font-weight: 700; color: var(--tinta); text-decoration: none; margin-right: auto; min-width: 0; }
.barra-marca img { height: 2rem; width: auto; }
.barra-marca span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.boton-menu { min-height: 2.75rem; padding: 0 var(--e3); }
.menu { background: var(--papel); border-bottom: 1px solid var(--linea); padding: var(--e2); }
.menu ul { list-style: none; margin: 0; padding: 0; }
.menu a {
  display: flex; align-items: center; gap: var(--e3); min-height: var(--alto-control); padding: 0 var(--e3); border-radius: var(--radio);
  color: var(--tinta); text-decoration: none; font-weight: 500;
}
.menu a:hover { background: var(--relleno); }
.menu a[aria-current='page'] { background: var(--acento-tinte); color: var(--acento-tinta); font-weight: 650; }
.menu-cifra { margin-left: auto; min-width: 1.5rem; padding: 0 var(--e2); border-radius: 999px; background: var(--acento); color: var(--sobre-acento); font-size: var(--t-chica); text-align: center; }
.icono { width: 1.375rem; height: 1.375rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.contenido { padding: var(--e5) var(--e4) var(--e7); max-width: var(--ancho-panel); }
.encabezado { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--e3); margin-bottom: var(--e5); }
.encabezado h1 { margin: 0; }
.aviso-version { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); background: var(--azul-tinte); color: var(--azul); padding: var(--e2) var(--e4); }

@media (min-width: 56rem) {
  .panel { display: grid; grid-template-columns: var(--menu-ancho) 1fr; grid-template-rows: auto 1fr; }
  .barra, .aviso-version { grid-column: 1 / -1; }
  .boton-menu { display: none; }
  .menu, .menu[hidden] { display: block !important; border-bottom: none; border-right: 1px solid var(--linea); padding: var(--e4) var(--e3); }
  .contenido { padding: var(--e6) var(--e6) var(--e7); }
}

/* ─── 7. Tarjetas, listas y tablas ───────────────────────────────────────────────────────────────────────────── */
.tarjeta { background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-grande); padding: var(--e5); margin-bottom: var(--e4); }
.tarjeta-destacada { border-color: var(--ambar); background: var(--ambar-tinte); }
.tarjeta h2 { margin-bottom: var(--e2); }
.rejilla { display: grid; gap: var(--e4); }
@media (min-width: 40rem) { .rejilla-2 { grid-template-columns: 1fr 1fr; } }
.pasos { list-style: none; margin: 0; padding: 0; }
.paso { display: flex; gap: var(--e3); padding: var(--e3) 0; border-top: 1px solid var(--linea); }
.paso:first-child { border-top: none; }
.paso-marca { flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; border: 2px solid var(--linea-fuerte); display: grid; place-items: center; font-size: var(--t-chica); font-weight: 700; }
.paso-listo .paso-marca { background: var(--verde); border-color: var(--verde); color: var(--papel); }
.paso-texto { flex: 1; min-width: 0; }
.paso-texto p { margin: 0; }
.lista { list-style: none; margin: 0; padding: 0; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-grande); overflow: hidden; }
.fila { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2) var(--e4); padding: var(--e4); border-top: 1px solid var(--linea); }
.fila:first-child { border-top: none; }
.fila-principal { flex: 1 1 14rem; min-width: 0; }
.fila-principal p { margin: 0; }
.fila-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); }
.fila-nueva { background: var(--acento-tinte); }
.insignia { display: inline-block; padding: 0 var(--e2); border-radius: 999px; font-size: var(--t-chica); font-weight: 600; background: var(--relleno); color: var(--tinta-2); }
.insignia-verde { background: var(--verde-tinte); color: var(--verde); }
.insignia-ambar { background: var(--ambar-tinte); color: var(--ambar); }
.insignia-rojo { background: var(--rojo-tinte); color: var(--rojo); }
.tabla-envoltura { overflow-x: auto; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--radio-grande); }
.tabla { width: 100%; border-collapse: collapse; font-size: var(--t-chica); }
.tabla th, .tabla td { text-align: left; padding: var(--e2) var(--e3); border-top: 1px solid var(--linea); vertical-align: top; }
.tabla th { border-top: none; color: var(--tinta-2); font-weight: 600; }
.filtros { display: grid; gap: var(--e3); margin-bottom: var(--e4); }
@media (min-width: 40rem) { .filtros { grid-template-columns: repeat(4, 1fr); align-items: end; } }

/* ─── 8. Estados: cargando, vacío, error y sin señal ─────────────────────────────────────────────────────────── */
.estado { padding: var(--e6) var(--e4); text-align: center; color: var(--tinta-2); }
.estado p { margin: 0 auto var(--e3); max-width: 28rem; }
.cargando::before {
  content: ''; display: block; width: 1.75rem; height: 1.75rem; margin: 0 auto var(--e3); border-radius: 50%;
  border: 3px solid var(--linea); border-top-color: var(--acento); animation: girar 0.8s linear infinite;
}
@keyframes girar { to { transform: rotate(360deg); } }

/* ─── 9. Tenerla como app: la bienvenida y el menú (public/panel/instalar.js) ────────────────────────────────── */
/* La columna de la derecha del panel: la bienvenida arriba y el contenido abajo. La bienvenida no tapa nada: empuja la
   pantalla y se cierra con la ✕. */
.columna { min-width: 0; }
.instalar {
  position: relative; display: flex; align-items: flex-start; gap: var(--e3); margin: var(--e4) var(--e4) 0; max-width: var(--ancho-lectura);
  padding: var(--e4) var(--e7) var(--e4) var(--e4); background: var(--papel); border: 1px solid var(--linea);
  border-radius: var(--radio-grande); box-shadow: var(--sombra);
}
.instalar-icono { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 22.5%; }
.instalar-cuerpo { flex: 1; min-width: 0; }
.instalar .instalar-titulo { margin: 0 0 var(--e1); font-size: var(--t-normal); }
.instalar-lema { margin: 0 0 var(--e3); color: var(--tinta-2); }
.instalar-paso { margin: 0 0 var(--e2); }
.instalar-nota { margin: 0 0 var(--e2); color: var(--tenue); font-size: var(--t-chica); }
/* El botón de Compartir dibujado como lo pinta Safari: azul, en su cuadrito gris. */
.instalar-dibujo {
  display: inline-grid; place-items: center; width: 1.75rem; height: 1.75rem; margin: 0 var(--e1); vertical-align: middle;
  border-radius: var(--e2); background: var(--relleno); color: var(--azul);
}
.instalar-dibujo .icono { width: 1.125rem; height: 1.125rem; stroke-width: 2; }
/* «Archivo» y «Agregar al Dock»: como los nombres del menú de la Mac. */
.instalar-tecla {
  display: inline-block; padding: 0 var(--e2); border: 1px solid var(--linea-fuerte); border-radius: var(--e2); background: var(--relleno);
  font-size: var(--t-chica); font-weight: 600; white-space: nowrap;
}
.instalar-boton { width: 100%; margin: var(--e1) 0; }
.instalar-avisos { margin-top: var(--e3); padding-top: var(--e3); border-top: 1px solid var(--linea); }
.instalar-titulo + .instalar-avisos { margin-top: var(--e2); padding-top: 0; border-top: 0; }   /* ya instalada: solo los avisos */
.instalar-estado { margin: var(--e2) 0 0; color: var(--tinta-2); font-size: var(--t-chica); }
.instalar-estado-bien { color: var(--verde); font-weight: 600; }
/* La ✕: 48 px, se toca con el dedo. */
.instalar-cerrar {
  position: absolute; top: var(--e1); right: var(--e1); display: grid; place-items: center; width: var(--alto-control); height: var(--alto-control);
  padding: 0; border: 0; border-radius: 50%; background: none; color: var(--tinta-2); cursor: pointer;
}
.instalar-cerrar:hover { background: var(--relleno); }
/* En el menú: «Instalar la app» y «Prender los avisos en este aparato», arriba de «Salir» y con la forma de sus enlaces. */
.menu-boton {
  display: flex; align-items: center; gap: var(--e3); width: 100%; min-height: var(--alto-control); padding: 0 var(--e3); border: 0;
  border-radius: var(--radio); background: none; color: var(--tinta); font: inherit; font-weight: 500; text-align: left; cursor: pointer;
}
.menu-boton:hover { background: var(--relleno); }
@media (min-width: 40rem) {
  .instalar { gap: var(--e4); }
  .instalar-icono { width: 3.5rem; height: 3.5rem; }
  .instalar-boton { width: auto; margin-right: var(--e2); }
}
@media (min-width: 56rem) {
  .instalar { margin: var(--e6) var(--e6) 0; }
}
/* La de Inicio va con las demás tarjetas de la pantalla y no trae ✕. */
.instalar.instalar-en-inicio { margin: 0 0 var(--e4); max-width: none; padding: var(--e5); }

/* Foto personal y punto de presencia; las iniciales siguen disponibles sin imagen. */
.perfil-avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; flex: none; background: var(--relleno); color: var(--tinta-2); font-size: .875rem; font-weight: 650; vertical-align: middle; }
.perfil-avatar img { display: block; width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.perfil-avatar-pequeno { width: 1.5rem; height: 1.5rem; font-size: .75rem; }
.perfil-avatar-grande { width: 5rem; height: 5rem; font-size: 1.75rem; }
.perfil-punto { position: absolute; right: -1px; bottom: -1px; width: .65rem; height: .65rem; border-radius: 50%; background: var(--tenue); border: 2px solid var(--papel); }
.perfil-en-linea .perfil-punto { background: var(--verde); }
.perfil-foto-forma .perfil-avatar-grande { margin-bottom: var(--e3); }
