/* Panel de Gaara · siempre oscuro. Mismos tokens y misma estructura que el CRM v2 (docs/diseno/crm-v2/DISENO.md),
   con otro acento (verde agua, no el índigo del CRM) para no confundirlos. Un acento para actuar y navegar;
   cuatro colores de estado, siempre con texto; un color por agente, solo en su icono. Sin tema claro. */

@font-face {
  font-family: 'Geist';
  src: url('/fonts/geist-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ============================ Tokens ============================ */
:root {
  color-scheme: dark;
  --fondo: #0C1114;
  --superficie: #141B1F;
  --superficie-2: #1C262B;
  --superficie-3: #27343B;
  --borde: #253139;
  --borde-fuerte: #364651;
  --tinta: #ECF2F3;
  --tinta-2: #B2C0C5;
  --tinta-3: #8A9BA2;
  --acento: #5EE0C8;
  --acento-fondo: #2FD3B7;
  --acento-hover: #4FE6CE;
  --acento-suave: #123A34;
  --sobre-acento: #04211C;
  --verde: #5BD6A0;   --verde-suave: #12301F;
  --ambar: #F2B544;   --ambar-suave: #35290F;
  --rojo: #FF8A80;    --rojo-suave: #3A1A1A;
  --azul: #7DB3FF;    --azul-suave: #13284A;
  --agente-tinta: 62%;
  --agente-fondo: 26%;
  --sombra-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --foco: #5EE0C8;
  --radio: 16px;
  --radio-m: 12px;
  --lateral: 240px;
}

/* ============================ Base ============================ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--fondo); }
body {
  margin: 0; min-height: 100vh; background: var(--fondo); color: var(--tinta);
  font-family: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px; line-height: 1.5; font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
h1, h2, h3, p { overflow-wrap: break-word; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--foco); outline-offset: 2px; border-radius: 6px; }
h1:focus, main:focus { outline: none; }
.num { font-variant-numeric: tabular-nums; }
.texto-2 { color: var(--tinta-2); }
.texto-3 { color: var(--tinta-3); }
.visualmente-oculto { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.saltar { position: absolute; left: 12px; top: -80px; z-index: 200; padding: 10px 16px; border-radius: 12px; background: var(--acento-fondo); color: var(--sobre-acento); font-weight: 600; text-decoration: none; }
.saltar:focus { top: 12px; }
.icono { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ============================ Carcasa ============================ */
.marca { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--tinta); text-decoration: none; border-radius: 12px; }
.marca-logo { width: 32px; height: 32px; border-radius: 10px; background: var(--acento-fondo); color: var(--sobre-acento); display: grid; place-items: center; flex: none; }
.marca-logo svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.marca-nombre { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }

.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 12px; border: 0; background: none;
  color: var(--tinta-2); font-weight: 500; text-decoration: none; cursor: pointer; transition: background-color .15s, color .15s;
}
.nav-item:hover { background: var(--superficie-2); color: var(--tinta); }
.nav-item[aria-current="page"], .nav-mas.activo { color: var(--acento); font-weight: 600; }
.nav-mas { display: none; }
.insignia { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--acento-fondo); color: var(--sobre-acento); font-size: 12.5px; font-weight: 700; display: inline-grid; place-items: center; margin-left: auto; font-variant-numeric: tabular-nums; }
.pie-lateral { margin: 0; font-size: 13px; color: var(--tinta-3); }

@media (min-width: 1024px) {
  body { display: grid; grid-template-columns: var(--lateral) minmax(0, 1fr); }
  .lateral { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; padding: 20px 12px 16px; background: var(--superficie); border-right: 1px solid var(--borde); }
  .marca { padding: 4px 8px 18px; }
  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav-item[aria-current="page"] { background: var(--acento-suave); }
  .pie-lateral { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid var(--borde); }
  main { padding: 32px 40px 56px; min-width: 0; }
  #vista { max-width: 1240px; margin: 0 auto; }
}
@media (max-width: 1023.98px) {
  body { font-size: 16px; }
  .lateral { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; min-height: 56px; padding: max(8px, env(safe-area-inset-top)) 16px 8px; background: var(--fondo); border-bottom: 1px solid var(--borde); }
  .pie-lateral { display: none; }
  .nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--superficie); border-top: 1px solid var(--borde); }
  .nav-item { flex-direction: column; justify-content: center; gap: 2px; min-height: 58px; padding: 0; font-size: 12px; }
  .nav-item:hover { background: none; }
  .nav-item .icono { width: 24px; height: 24px; padding: 4px 16px; box-sizing: content-box; border-radius: 999px; transition: background-color .15s; }
  .nav-item[aria-current="page"] .icono, .nav-mas.activo .icono { background: var(--acento-suave); }
  .insignia { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; min-width: 20px; height: 20px; font-size: 12px; }
  .nav-extra { display: none; }
  .nav-mas { display: flex; }
  main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); min-width: 0; }
}

/* ============================ Cabecera de sección ============================ */
.vista-cabeza { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; margin-bottom: 20px; }
.vista-titulos { min-width: 0; }
.vista-cabeza h1 { margin: 0; font-size: 30px; line-height: 36px; font-weight: 650; letter-spacing: -0.022em; }
.vista-sub { margin: 4px 0 0; color: var(--tinta-2); }
@media (max-width: 1023.98px) {
  .vista-cabeza { margin-bottom: 16px; }
  .vista-cabeza h1 { font-size: 26px; line-height: 32px; }
  .vista-sub { font-size: 14.5px; }
}
.aviso { margin: 0 0 16px; padding: 12px 16px; border-radius: var(--radio-m); background: var(--ambar-suave); color: var(--ambar); font-weight: 550; }
.aviso-suave, .aviso-mensajes { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0 0 16px; padding: 10px 16px; border-radius: var(--radio-m); background: var(--acento-suave); color: var(--acento); font-weight: 550; text-decoration: none; }
.aviso-mensajes span { flex: 1; min-width: 0; }
.aviso-suave .icono, .aviso-mensajes .icono { width: 20px; height: 20px; }
.volver { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; margin-bottom: 4px; }

/* ============================ Piezas ============================ */
.rejilla { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); list-style: none; padding: 0; margin: 0; }
@media (min-width: 900px) { .rejilla { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .rejilla-tarjetas { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.caja { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 20px; box-shadow: var(--sombra-1); min-width: 0; }
.caja-cabeza { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.caja-titulos { min-width: 0; }
.caja-titulo { margin: 0; font-size: 16px; line-height: 22px; font-weight: 600; letter-spacing: -0.01em; }
.caja-sub { margin: 2px 0 0; font-size: 13.5px; line-height: 19px; color: var(--tinta-3); }
.vacio { margin: 0; color: var(--tinta-3); font-size: 14.5px; }
.nota-pie { margin: 12px 0 0; font-size: 13px; line-height: 19px; color: var(--tinta-3); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.cuerpo-texto { margin: 8px 0 0; color: var(--tinta-2); }
.cuerpo-texto b { color: var(--tinta); font-weight: 600; }
.atenuado { opacity: .85; }
.enlace { color: var(--acento); text-decoration: none; overflow-wrap: anywhere; }
.enlace:hover { text-decoration: underline; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; line-height: 18px; font-weight: 550; white-space: nowrap; background: var(--superficie-2); color: var(--tinta-2); }
.chip-punto { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.chip-icono { width: 14px; height: 14px; }
.chip-neutro .chip-punto { display: none; }
.chip-verde { background: var(--verde-suave); color: var(--verde); }
.chip-ambar { background: var(--ambar-suave); color: var(--ambar); }
.chip-rojo { background: var(--rojo-suave); color: var(--rojo); }
.chip-azul { background: var(--azul-suave); color: var(--azul); }
.chip-acento { background: var(--acento-suave); color: var(--acento); }

.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radio-m); border: 1px solid transparent; background: var(--superficie-2); color: var(--tinta); font-weight: 600; font-size: 15px; line-height: 1.2; text-decoration: none; cursor: pointer; text-align: center; transition: background-color .15s, border-color .15s, color .15s; }
.boton .icono { width: 20px; height: 20px; }
.boton-secundario { background: var(--superficie); border-color: var(--borde-fuerte); }
.boton-secundario:hover { background: var(--superficie-2); }
.boton-texto { background: none; color: var(--acento); padding: 0 8px; margin: 4px 0 -4px -8px; }
.boton-texto:hover { text-decoration: underline; }
.boton[disabled] { opacity: .45; cursor: not-allowed; }

.cifra { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; margin: 0 0 12px; }
.cifra-valor { font-size: 40px; line-height: 44px; font-weight: 650; letter-spacing: -0.03em; }
.cifra-de { font-size: 18px; line-height: 24px; color: var(--tinta-3); font-weight: 550; }
.metro { height: 8px; border-radius: 999px; background: var(--superficie-3); overflow: hidden; }
.metro > i { display: block; height: 100%; background: var(--acento-fondo); border-radius: inherit; transition: width .4s ease; }

.agente-icono { display: inline-grid; place-items: center; flex: none; border-radius: 50%; color: color-mix(in oklab, var(--c) var(--agente-tinta), white); background: color-mix(in oklab, var(--c) var(--agente-fondo), var(--superficie)); }
.agente-icono-s { width: 28px; height: 28px; }
.agente-icono-s .icono { width: 16px; height: 16px; }
.agente-icono-m { width: 40px; height: 40px; }
.agente-icono-m .icono { width: 22px; height: 22px; }
.agente-icono-l { width: 52px; height: 52px; }
.agente-icono-l .icono { width: 27px; height: 27px; }

.lista-filas { list-style: none; margin: 0; padding: 0; }
.fila { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--borde); }
.fila:first-child { border-top: 0; padding-top: 2px; }
.fila-icono { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--superficie-2); color: var(--tinta-2); flex: none; }
.fila-icono .icono { width: 18px; height: 18px; }
.fila-cuerpo { min-width: 0; }
.fila-texto { margin: 0; font-weight: 550; font-size: 14.5px; line-height: 20px; }
.fila-detalle { margin: 2px 0 0; font-size: 13px; line-height: 19px; color: var(--tinta-3); overflow-wrap: anywhere; }
.fila-min { font-size: 13px; color: var(--tinta-2); white-space: nowrap; padding-top: 1px; }
.fila-hora { font-size: 14px; font-weight: 650; color: var(--tinta-2); padding-top: 1px; min-width: 44px; }
.fila-casilla { border-top: 1px solid var(--borde); }
.fila-casilla:first-child { border-top: 0; }
.lista-puntos { margin: 0; padding-left: 20px; color: var(--tinta-2); display: grid; gap: 8px; }

.casilla { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; font-weight: 550; margin-top: 8px; }
.fila-casilla .casilla { margin-top: 0; }
.casilla input { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--acento-fondo); cursor: pointer; }
.casilla input:checked + span { color: var(--tinta-3); text-decoration: line-through; }

/* Mensajes */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filtro { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 8px; border-radius: 999px; border: 1px solid var(--borde-fuerte); background: var(--superficie); color: var(--tinta-2); font-weight: 550; cursor: pointer; }
.filtro:first-child { padding-left: 16px; }
.filtro:hover { background: var(--superficie-2); color: var(--tinta); }
.filtro[aria-pressed="true"] { background: var(--acento-suave); border-color: var(--acento); color: var(--acento); font-weight: 650; }
.recuento { margin: 0 0 12px; font-size: 13.5px; color: var(--tinta-3); }
.mensajes { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.mensaje { display: block; }
.mensaje[data-leido="true"] { background: transparent; box-shadow: none; }
.mensaje[data-leido="false"] { border-color: var(--borde-fuerte); }
.mensaje-cabeza { display: flex; align-items: center; gap: 12px; }
.mensaje-quien { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14.5px; }
.mensaje-quien time { font-size: 13px; }
.mensaje-asunto { margin: 12px 0 0; font-size: 16px; line-height: 22px; font-weight: 600; }

/* Programa */
.tarjeta-enlace { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 12px; text-decoration: none; min-height: 44px; }
.tarjeta-enlace:hover { border-color: var(--borde-fuerte); background: var(--superficie-2); }
.tarjeta-enlace .fila-cuerpo { display: flex; flex-direction: column; }
.flecha { color: var(--tinta-3); }
.pestanas { display: flex; gap: 4px; padding: 4px; margin-bottom: 16px; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio-m); }
.pestana { flex: 1; min-height: 44px; border: 0; border-radius: 9px; background: none; color: var(--tinta-2); font-weight: 600; cursor: pointer; }
.pestana:hover { background: var(--superficie-2); color: var(--tinta); }
.pestana[aria-selected="true"] { background: var(--acento-suave); color: var(--acento); }

.ruta { margin: 2px 0 0; font-size: 12px; line-height: 17px; color: var(--tinta-3); opacity: .85; overflow-wrap: anywhere; }

/* Rutina */
.habito { padding: 12px 0; border-top: 1px solid var(--borde); }
.habito:first-child { border-top: 0; padding-top: 2px; }
.habito-cabeza { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.semana { list-style: none; margin: 10px 0 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.dia { min-height: 44px; border-radius: 10px; background: var(--superficie-2); color: var(--tinta-3); display: grid; place-items: center; font-size: 13px; font-weight: 600; position: relative; }
.dia .icono { width: 16px; height: 16px; position: absolute; right: 3px; top: 3px; }
.dia.hecho { background: var(--verde-suave); color: var(--verde); }

/* Gym */
.tendencia { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; align-items: end; text-align: center; }
.tendencia-col { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.barras { height: 120px; width: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
.barra { width: 40%; max-width: 22px; border-radius: 6px 6px 2px 2px; }
.barra-carga { background: var(--acento-fondo); }
.barra-comidas { background: var(--ambar); }
.leyenda { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 0; font-size: 13px; color: var(--tinta-2); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.muestra { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Equipo y Más */
.agente-cab { display: flex; align-items: center; gap: 12px; }
.agente-tarjeta .nota-pie { margin-top: 14px; }
.mas-lista { display: grid; gap: 12px; }
.mas-enlace { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 56px; text-decoration: none; }
.mas-enlace:hover { background: var(--superficie-2); }

.pantalla-aviso { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; background: var(--fondo); color: var(--tinta); }
.pantalla-aviso .logo { width: 56px; height: 56px; padding: 14px; border-radius: 16px; background: var(--acento-fondo); color: var(--sobre-acento); margin-bottom: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pantalla-aviso h1 { margin: 0; font-size: 24px; line-height: 30px; font-weight: 650; letter-spacing: -0.015em; }
.pantalla-aviso p { margin: 0; max-width: 34ch; color: var(--tinta-2); }
.pantalla-aviso a { color: var(--acento); font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
