/* Asistencia en Slot — base compartida por todas las pantallas (tokens, tipografías, barra,
   botones, formularios, avisos y diálogos). Se carga aparte de app.css para que la pantalla del
   jugador no descargue los estilos del portal del personal con datos móviles (AGENTS.md §4.3).

   Misma estética que FS: tokens, tipografías, banda con línea de sala y tema oscuro opcional
   salen de C:\dev\fs\public\assets\css\tokens.css. */

/* ------------------------------------------------------------ tipografías propias */
@font-face { font-family: "Oswald"; font-style: normal; font-weight: 200 700; font-display: swap; src: url("../fonts/oswald-variable-latin.woff2") format("woff2"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("../fonts/source-sans-3-variable-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-mono-500-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-mono-600-latin.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/ibm-plex-mono-700-latin.woff2") format("woff2"); }

/* ------------------------------------------------------------ tokens: tema claro */
:root {
  color-scheme: light;

  --banda:         #101826;
  --acento-fuerte: #1a3fa8;
  --acento:        #1d4ed8;
  --acento-hover:  #2856cc;
  --acento-suave:  #e7ecfb;
  --acento-banda:  #7fb0ff;
  --sala-cabecera: rgba(255, 255, 255, .8);

  --fondo:        #f1f0ec;
  --fondo-panel:  #ffffff;
  --fondo-suave:  #f8f7f4;
  --fondo-hover:  #eae8e2;

  --texto:        #14181f;
  --texto-suave:  #57534c;
  --texto-tenue:  #6b665d;

  --borde:        #e2ded5;
  --borde-fuerte: #ccc7bd;
  --borde-medio:  #9c9488;

  --verde:      #177244;
  --verde-bg:   #e4f2e9;
  --ambar:      #8a5a00;
  --ambar-bg:   #f8efdc;
  --rojo:       #b3261e;
  --rojo-bg:    #fbeae7;
  --violeta:    #6d28a8;
  --violeta-bg: #f0e9fa;
  --gris-bg:    #eae8e2;

  --sombra: 0 1px 2px rgba(20, 24, 31, .05);
  --radio: 4px;
  --radio-chico: 3px;

  --fuente:         "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fuente-display: "Oswald", "Arial Narrow", system-ui, sans-serif;
  --fuente-mono:    "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

/* ------------------------------------------------------------ tokens: tema oscuro */
:root[data-tema="oscuro"] {
  color-scheme: dark;
  --banda:         #070c13;
  --acento-fuerte: #2d62e0;
  --acento:        #7fb0ff;
  --acento-hover:  #3f70e0;
  --acento-suave:  #16233a;

  --fondo:        #0d1219;
  --fondo-panel:  #151d28;
  --fondo-suave:  #1b2532;
  --fondo-hover:  #222d3b;

  --texto:        #e9edf3;
  --texto-suave:  #9fabbb;
  --texto-tenue:  #7c8899;

  --borde:        #29333f;
  --borde-fuerte: #3a4654;
  --borde-medio:  #66748a;

  --verde:      #5cc98d;
  --verde-bg:   #133023;
  --ambar:      #e5aa4a;
  --ambar-bg:   #2a2111;
  --rojo:       #f28b83;
  --rojo-bg:    #2c1513;
  --violeta:    #c7a0ed;
  --violeta-bg: #2b1f3d;
  --gris-bg:    #222d3b;

  --sombra: 0 1px 2px rgba(0, 0, 0, .35);
}

/* ------------------------------------------------------------ el acento de cada sala */
:root[data-sala="rebisco"] { --acento: #10776e; --acento-fuerte: #0f635c; --acento-hover: #1a847b; --acento-suave: #e7fbf9; --acento-banda: #6fd8cd; --sala-cabecera: #78b8b0; }
:root[data-sala="biyemas"] { --acento: #2d1dd8; --acento-fuerte: #261aa8; --acento-hover: #3628cc; --acento-suave: #e9e7fb; --acento-banda: #8a7fff; --sala-cabecera: #d5968c; }
:root[data-sala="kandiko"] { --acento: #0b6e99; --acento-fuerte: #0a5d82; --acento-hover: #12779f; --acento-suave: #e4f3fa; --acento-banda: #6cc4ea; --sala-cabecera: #8fb9cc; }

:root[data-tema="oscuro"][data-sala="rebisco"] { --acento: #6fd8cd; --acento-fuerte: #138077; --acento-hover: #15837a; --acento-suave: #163a37; }
:root[data-tema="oscuro"][data-sala="biyemas"] { --acento: #8a7fff; --acento-fuerte: #3c2de0; --acento-hover: #4c3fe0; --acento-suave: #19163a; }
:root[data-tema="oscuro"][data-sala="kandiko"] { --acento: #6cc4ea; --acento-fuerte: #0f7fae; --acento-hover: #1489b8; --acento-suave: #10303d; }

/* ============================================================ BASE */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
  font-family: var(--fuente);
  font-size: 15px;
  line-height: 1.5;
  color: var(--texto);
  background: var(--fondo);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 {
  margin: 0;
  line-height: 1.25;
  font-weight: 650;
  font-family: var(--fuente-display);
  letter-spacing: .01em;
  text-wrap: balance;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.05rem; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
[hidden] { display: none !important; }
.num { font-family: var(--fuente-mono); font-variant-numeric: tabular-nums; }
.mono { font-family: var(--fuente-mono); }
.tenue { color: var(--texto-tenue); }
.chico { font-size: .86rem; }
.icono { display: inline-flex; flex: none; }
.icono svg { width: 26px; height: 26px; }
.enlace {
  align-self: flex-start; padding: 2px 0; border: 0; background: none; cursor: pointer;
  color: var(--acento); font: inherit; font-size: .9rem; font-weight: 600;
}
.enlace:hover { text-decoration: underline; }

/* Franja de entorno: sólo fuera de producción, igual que en FS. */
.franja-entorno {
  background: var(--rojo);
  color: #fff;
  text-align: center;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 8px;
}

/* Sin conexión con el servidor (cola.js). Fija arriba, por encima de todo. */
.franja-conexion {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; gap: 4px 12px;
  padding: 10px 16px; border-bottom: 3px solid var(--ambar);
  background: var(--ambar-bg); color: var(--ambar); box-shadow: var(--sombra);
  text-align: center;
}
.franja-conexion b { font-family: var(--fuente-display); font-size: 1.15rem; font-weight: 600; letter-spacing: .03em; }

/* ============================================================ CABECERA (la banda) */
.barra {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  min-height: 54px;
  padding: 6px 18px;
  background: var(--banda);
  color: #fff;
  box-shadow: var(--sombra);
  border-bottom: 3px solid var(--acento);
}
.barra .espacio { flex: 1; }
.marca {
  color: #fff;
  font-family: var(--fuente-display);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
}
.marca b { font-weight: 400; color: rgba(255, 255, 255, .65); }

/* La sala, pegada a la marca y encerrada entre dos barras finas, como en FS. */
.sala-marca {
  display: flex;
  align-items: center;
  margin-left: -4px;
  padding: 0 11px;
  border-left: 1px solid rgba(255, 255, 255, .25);
  border-right: 1px solid rgba(255, 255, 255, .25);
  font-family: var(--fuente-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--sala-cabecera);
  white-space: nowrap;
}
.sala-marca:empty { display: none; }
.sala-marca select {
  background: transparent;
  color: inherit;
  border: 0;
  border-bottom: 2px solid var(--sala-cabecera);
  border-radius: 0;
  padding: 0 0 1px;
  font: inherit;
  letter-spacing: inherit;
  text-transform: uppercase;
  cursor: pointer;
}
.sala-marca select:hover { border-bottom-color: #fff; color: #fff; }
.sala-marca select option { color: var(--texto); background: var(--fondo-panel); letter-spacing: normal; }

.usuario-chip { color: #fff; font-size: .88rem; white-space: nowrap; }

.barra .btn,
.barra .btn.sec {
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #fff;
}
.barra .btn:hover { background: rgba(255, 255, 255, .2); }
.barra :focus-visible { outline-color: #fff; }

/* ============================================================ BOTONES */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.4;
  border: 1px solid var(--acento-fuerte);
  border-radius: var(--radio-chico);
  background: var(--acento-fuerte);
  color: #fff;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--acento-hover); border-color: var(--acento-hover); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.sec { background: var(--fondo-panel); border-color: var(--borde-fuerte); color: var(--texto); }
.btn.sec:hover { background: var(--fondo-hover); }
.btn.peligro { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.btn.peligro:hover { background: #92201a; border-color: #92201a; }
.btn:disabled { background: var(--gris-bg); border-color: var(--borde); color: var(--texto-tenue); cursor: not-allowed; }
.btn:disabled:active { transform: none; }
.btn.bloque { display: flex; width: 100%; }
.btn.grande { min-height: 54px; padding: 14px 16px; font-size: 1.1rem; }
.btn.mini { min-height: 32px; padding: 4px 10px; font-size: .82rem; }

/* ============================================================ FORMULARIOS */
.campo { display: flex; flex-direction: column; gap: 4px; }
.campo label { font-size: .85rem; font-weight: 600; color: var(--texto-suave); }
input[type="text"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], input[type="file"], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--borde-fuerte);
  border-radius: var(--radio-chico);
  background: var(--fondo-panel);
  color: var(--texto);
}
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-suave); }
.check { display: flex; gap: 8px; align-items: center; font-size: .92rem; }
.check input { width: 18px; height: 18px; accent-color: var(--acento-fuerte); }

/* ============================================================ ETIQUETAS DE ESTADO */
.pill {
  display: inline-block;
  font-size: .8rem;
  font-weight: 650;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  background: var(--gris-bg);
  color: var(--texto-suave);
}
.pill.pendiente  { background: var(--rojo-bg);     color: var(--rojo); }
.pill.tomado     { background: var(--ambar-bg);    color: var(--ambar); }
.pill.atendiendo { background: var(--acento-suave); color: var(--acento); }
.pill.resuelto   { background: var(--verde-bg);    color: var(--verde); }
.pill.derivado   { background: var(--violeta-bg);  color: var(--violeta); }

.espera {
  display: inline-block;
  min-width: 3.4em;
  text-align: center;
  font-family: var(--fuente-mono);
  font-weight: 700;
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
  padding: 2px 7px;
  border-radius: var(--radio-chico);
  background: var(--verde-bg);
  color: var(--verde);
}
.espera.ambar { background: var(--ambar-bg); color: var(--ambar); }
.espera.rojo  { background: var(--rojo);     color: #fff; }

/* ============================================================ AVISOS (los flash de FS) */
.avisos {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 200; width: min(92vw, 440px); pointer-events: none;
}
.aviso {
  padding: 10px 14px;
  border-radius: var(--radio-chico);
  border: 1px solid var(--borde);
  border-left: 4px solid var(--acento);
  background: var(--fondo-panel);
  color: var(--texto);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  font-size: .92rem;
}
.aviso.ok    { background: var(--verde-bg); border-color: var(--verde); color: var(--verde); }
.aviso.error { background: var(--rojo-bg);  border-color: var(--rojo);  color: var(--rojo); }
@media (prefers-reduced-motion: no-preference) {
  .aviso { animation: aviso-entra .18s ease-out both; }
  .aviso.aviso-saliendo { animation: aviso-sale .18s ease-in forwards; }
  @keyframes aviso-entra { from { opacity: 0; transform: translateY(8px); } }
  @keyframes aviso-sale { to { opacity: 0; transform: translateY(6px); } }
}

/* ============================================================ DIÁLOGOS */
dialog {
  width: min(460px, calc(100vw - 32px));
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--borde);
  border-radius: var(--radio);
  background: var(--fondo-panel);
  color: var(--texto);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .28);
}
dialog::backdrop { background: rgba(10, 16, 26, .55); }
.dialogo { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.dialogo h2 { font-size: 1.15rem; }
.dialogo-pie { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.dialogo-pie .btn { flex: 0 1 auto; }

@media (max-width: 700px) {
  .barra { gap: 10px; padding: 6px 14px; }
  .marca, .sala-marca { font-size: 1rem; }
  .usuario-chip { display: none; }
}
