/* Herramientas internas (promotora y estado): barra, PIN, botones, insignias de estado, diálogos
   y avisos. Solo variables de base.css, planas y sin sombras. Lo usan /promotora/ y /estado/. */

body.operacion { background: var(--gris-fondo); }

.app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.solo-lector {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------ barra superior */

.barra {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
  padding: 12px 20px; background: var(--blanco); border-bottom: 1px solid var(--gris-borde);
}
.barra-titulo { display: flex; flex-direction: column; gap: 2px; }
.barra h1 { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.1; }
.barra-sub { font-size: 14px; font-weight: 600; color: var(--gris-texto); }
.barra-acciones { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.conexion.esperando { background: var(--gris-fondo); color: var(--gris-texto); }

/* ------------------------------------------------------------ botones */

.boton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 8px 20px;
  border: 2px solid var(--azul); border-radius: var(--radio-boton);
  background: var(--azul); color: var(--blanco);
  font-size: 15px; font-weight: 700; line-height: 1.2; text-align: center;
  touch-action: manipulation;
}
.boton-secundario { background: var(--blanco); color: var(--azul); }
.boton-ok { background: var(--ok); border-color: var(--ok); color: var(--blanco); }
.boton-peligro { background: var(--error); border-color: var(--error); color: var(--blanco); }
.boton-grande { min-height: 56px; padding: 12px 28px; font-size: 17px; }
.boton.armado { background: var(--error); border-color: var(--error); color: var(--blanco); }
.boton:disabled { opacity: .5; }
.boton:focus-visible, .pin-tecla:focus-visible { outline: 3px solid var(--negro); outline-offset: 2px; }

/* ------------------------------------------------------------ PIN */

.pin {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh; padding: 24px 16px;
  background: var(--amarillo);
}
.pin-panel {
  width: min(420px, 100%); padding: 36px 28px 28px;
  background: var(--blanco); border-radius: var(--radio-panel); text-align: center;
}
.pin-titulo { margin: 0; font-size: 30px; font-weight: 800; }
.pin-subtitulo { margin: 8px 0 0; font-weight: 600; color: var(--gris-texto); }
/* Hasta 8 puntos (PIN de 4 a 8 dígitos): el hueco se achica en pantallas angostas. */
.pin-puntos { display: flex; justify-content: center; gap: clamp(8px, 3vw, 18px); margin: 28px 0 8px; }
.pin-punto { width: 22px; height: 22px; border-radius: 50%; border: var(--contorno); }
.pin-punto.lleno { background: var(--azul); }
.pin-mensaje { min-height: 1.5em; margin: 8px 0 0; font-weight: 600; }
.pin-mensaje.error { color: var(--error); }
.pin-teclado { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
.pin-tecla {
  min-height: 72px; border: var(--contorno); border-radius: var(--radio-caja);
  background: var(--blanco); color: var(--negro);
  font-size: 28px; font-weight: 700; touch-action: manipulation;
}
.pin-tecla:active:not(:disabled) { background: var(--azul); color: var(--blanco); }
.pin-tecla:disabled { opacity: .5; }
.pin-tecla-chica { font-size: 16px; color: var(--azul); }

/* ------------------------------------------------------------ totales */

.totales { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.total {
  display: flex; flex-direction: column; align-items: center; min-width: 92px;
  padding: 6px 14px; border-radius: var(--radio-caja); background: var(--gris-fondo);
}
.total-valor { font-size: 24px; font-weight: 800; line-height: 1.1; }
.total-etiqueta { font-size: 12px; font-weight: 700; color: var(--gris-texto); text-transform: uppercase; letter-spacing: .03em; }
.total-presente { background: var(--ok-fondo); }
.total-presente .total-valor { color: var(--ok); }
.total-ausente { background: var(--error-fondo); }
.total-ausente .total-valor { color: var(--error); }
.total-llamada .total-valor { color: var(--azul); }

/* ------------------------------------------------------------ insignias de estado
   El estado siempre va con su etiqueta de texto; el color solo acompaña. */

.insignia {
  display: inline-block; padding: 2px 10px;
  border: 1px solid currentColor; border-radius: var(--radio-boton);
  background: var(--blanco); color: var(--gris-texto);
  font-size: 13px; font-weight: 700; line-height: 1.4; white-space: nowrap;
}
.insignia-grande { padding: 4px 14px; font-size: 15px; }
.insignia-reservada { color: var(--negro); border-color: var(--gris-borde); }
.insignia-presente { color: var(--ok); }
.insignia-llamada { background: var(--azul); border-color: var(--azul); color: var(--blanco); }
.insignia-atendida { color: var(--gris-texto); }
.insignia-ausente { color: var(--error); }
.insignia-ok { color: var(--ok); }
.insignia-alerta { color: var(--alerta); background: var(--alerta-fondo); }
.insignia-error { color: var(--error); background: var(--error-fondo); }

/* ------------------------------------------------------------ bandas de aviso */

.banda { padding: 10px 20px; font-weight: 600; }
.banda-alerta { background: var(--alerta-fondo); color: var(--alerta); }
.banda-error { background: var(--error-fondo); color: var(--error); }

.cargando { margin: 0; padding: 32px 20px; font-weight: 600; color: var(--gris-texto); text-align: center; }

/* ------------------------------------------------------------ diálogos */

.dialogo {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px);
  padding: 0; border: none; border-radius: var(--radio-caja);
  background: var(--blanco); color: var(--negro);
}
/* Velo para separar el diálogo del fondo: es un fondo plano, no una sombra. Va literal (negro al 45%)
   porque ::backdrop no hereda las variables de :root en Chrome anterior a la 122. */
.dialogo::backdrop { background: rgb(0 0 0 / 45%); }
.dialogo-cuerpo { padding: 24px; outline: none; }
.dialogo h2 { margin: 0; font-size: 24px; font-weight: 800; }

/* ------------------------------------------------------------ avisos flotantes */

.avisos {
  position: fixed; left: 50%; bottom: 20px; z-index: 50; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  width: min(560px, calc(100vw - 32px)); pointer-events: none;
}
.aviso {
  padding: 12px 18px; border-radius: var(--radio-caja);
  background: var(--negro); color: var(--blanco); font-weight: 600;
}
.aviso-ok { background: var(--ok); }
.aviso-error { background: var(--error); }

/* Teléfono: título y acciones en una fila, los totales debajo en una sola fila pareja. */
@media (max-width: 640px) {
  .barra { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 10px 12px; gap: 8px 10px; }
  .barra h1 { font-size: 19px; }
  .barra-acciones { gap: 8px; margin-left: 0; }
  .barra-acciones .boton { min-height: 40px; padding: 6px 14px; }
  .barra .totales { grid-column: 1 / -1; grid-row: 2; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
  .total { min-width: 0; padding: 4px 4px; border-radius: 14px; }
  .total-valor { font-size: 19px; }
  .total-etiqueta { font-size: 9px; letter-spacing: 0; }
  .conexion { padding: 5px 10px; font-size: 13px; }
}
