/* Consola del técnico (/tecnico) */

.error {
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

/* ───────── Acceso ───────── */
.vista-acceso {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 24px 16px;
}

.acceso {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 400px;
}

.acceso img {
  border-radius: 12px;
}

.acceso .etiqueta {
  margin-top: 16px;
}

.acceso h1 {
  font-size: 40px;
}

.formulario {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 24px;
}

.formulario .etiqueta {
  margin-top: 8px;
}

.formulario .boton {
  margin-top: 16px;
}

/* ───────── Panel ───────── */
.nav-estado {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--muted-light);
  font-size: 13px;
  white-space: nowrap;
}

.punto {
  width: 8px;
  height: 8px;
  border: 1px solid var(--page-bg);
  border-radius: 50%;
}

.nav-estado.vivo .punto {
  background: var(--page-bg);
}

.nav-nombre {
  overflow: hidden;
  max-width: 160px;
  color: var(--page-bg);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .nav-nombre,
  .nav-estado #nav-estado-texto {
    display: none;
  }
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 128px 16px 96px;
}

@media (min-width: 768px) {
  .panel {
    padding: 152px 40px 120px;
  }
}

.cabecera h1 {
  margin-top: 16px;
  font-size: 40px;
}

@media (min-width: 768px) {
  .cabecera h1 {
    font-size: 48px;
  }
}

.entradilla {
  margin-top: 12px;
  color: var(--muted);
  font-size: 18px;
}

.rejilla {
  display: grid;
  gap: 24px;
}

@media (min-width: 900px) {
  .rejilla {
    grid-template-columns: 1fr 1fr;
  }
}

.panel .tarjeta {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
}

@media (min-width: 768px) {
  .panel .tarjeta {
    padding: 32px;
  }
}

.panel .tarjeta h2 {
  font-size: 24px;
}

.panel .tarjeta > .boton {
  align-self: flex-start;
}

.cabecera-tarjeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.fila-codigo,
.fila-copiar {
  display: flex;
  gap: 12px;
}

.fila-codigo .campo,
.fila-copiar .campo {
  flex: 1;
  min-width: 0;
}

@media (max-width: 480px) {
  .fila-codigo,
  .fila-copiar {
    flex-direction: column;
  }
}

.campo-codigo {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}

.invitacion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lista-equipos {
  display: flex;
  flex-direction: column;
  padding: 0;
  list-style: none;
}

.lista-equipos li + li {
  border-top: 1px solid var(--line);
}

.equipo-boton {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 16px;
  width: 100%;
  min-height: 64px;
  padding: 14px 16px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.2s;
}

.equipo-boton:hover:not(:disabled) {
  background: var(--soft-card-2);
}

.equipo-boton:disabled {
  cursor: default;
}

.equipo-nombre {
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipo-detalle {
  grid-column: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.equipo-codigo {
  grid-row: 1 / span 2;
  grid-column: 2;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.equipo-codigo small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.tabla-caja {
  overflow-x: auto;
}

.tabla {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 14px;
}

.tabla th {
  padding: 0 12px 12px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: left;
  text-transform: uppercase;
}

.tabla td {
  padding: 12px 12px 12px 0;
  border-bottom: 1px solid var(--soft-card);
  vertical-align: top;
}

.tabla td.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Capas (esperando, avisos sobre el visor) */
.capa,
.visor-capa {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgb(250 249 245 / 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.visor-capa {
  position: absolute;
  z-index: 5;
  border-radius: 24px;
}

.capa-tarjeta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 440px;
  padding: 40px 32px;
  border-radius: 32px;
  background: var(--white-card);
  box-shadow: var(--sombra-panel);
  text-align: center;
}

.capa-tarjeta h2 {
  font-size: 24px;
}

.capa-tarjeta .boton {
  margin-top: 12px;
}

.pulso {
  width: 12px;
  height: 12px;
  margin-bottom: 8px;
  border-radius: 50%;
  background: var(--black);
  animation: pulso 1.4s ease-in-out infinite;
}

@keyframes pulso {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.25;
    transform: scale(0.7);
  }
}

/* ───────── Sesión ───────── */
.vista-sesion {
  position: fixed;
  inset: 0;
  background: var(--panel-bg);
}

.barra {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 32px);
  height: 56px;
  padding: 0 8px 0 18px;
  overflow-x: auto;
  transform: translateX(-50%);
  border-radius: 9999px;
  background: rgb(24 24 24 / 0.94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: var(--page-bg);
  scrollbar-width: none;
}

.barra::-webkit-scrollbar {
  display: none;
}

.barra-equipo {
  flex: 0 1 auto;
  overflow: hidden;
  min-width: 56px;
  max-width: 180px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.barra-sep {
  flex: none;
  width: 1px;
  height: 24px;
  margin: 0 8px;
  background: rgb(250 249 245 / 0.16);
}

.barra-select {
  flex: none;
  height: 36px;
  padding: 0 30px 0 14px;
  border: 1px solid rgb(250 249 245 / 0.2);
  border-radius: 9999px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23bdbab2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--page-bg);
  font: 600 12px/1 var(--fuente);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.barra-select option {
  background: var(--white-card);
  color: var(--text);
  text-transform: none;
}

.barra-select + .barra-select,
.barra-select + .barra-boton {
  margin-left: 6px;
}

.barra-boton,
.boton-icono {
  position: relative;
  display: inline-grid;
  flex: none;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.barra-boton:hover {
  background: rgb(250 249 245 / 0.12);
}

.barra-boton[aria-pressed='true'],
.barra-boton[aria-expanded='true'],
.barra-boton.activo {
  background: var(--page-bg);
  color: var(--black);
}

.barra-boton:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.boton-icono:hover {
  background: var(--soft-card);
}

.insignia {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border: 2px solid var(--black);
  border-radius: 9999px;
  background: var(--page-bg);
  color: var(--black);
  font-size: 10px;
  font-weight: 700;
  line-height: 12px;
  text-align: center;
}

.barra-medidas {
  flex: none;
  margin-right: 10px;
  color: var(--muted-light);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.barra .boton {
  flex: none;
}

.menu {
  position: fixed;
  top: 80px;
  left: 50%;
  z-index: 45;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100% - 32px));
  padding: 8px;
  transform: translateX(-50%);
  border: 1px solid var(--soft-card);
  border-radius: 24px;
  background: var(--white-card);
  box-shadow: var(--sombra-panel);
}

.menu button {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font: 600 14px/1.3 var(--fuente);
  text-align: left;
  cursor: pointer;
}

.menu button span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.menu button:hover:not(:disabled) {
  background: var(--soft-card-2);
}

.menu button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.menu-interruptor {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  padding: 12px 14px 8px;
  border-top: 1px solid var(--soft-card);
  font-size: 14px;
}

.menu-interruptor input {
  width: 18px;
  height: 18px;
  accent-color: var(--black);
}

.visor {
  position: absolute;
  inset: 88px 16px 16px;
  display: grid;
  place-items: center;
  overflow: auto;
  border-radius: 24px;
  outline: none;
  transition: right 0.3s var(--curva);
}

.visor.con-lateral {
  right: 392px;
}

.visor:not(.ajustado) {
  place-items: start;
}

.visor:focus-visible {
  box-shadow: inset 0 0 0 2px var(--black);
}

#lienzo {
  display: block;
  background: var(--soft-card);
  box-shadow: var(--sombra-panel);
  cursor: default;
  touch-action: none;
}

.soltar {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  border: 2px dashed var(--black);
  border-radius: 24px;
  background: rgb(250 249 245 / 0.85);
  pointer-events: none;
}

.soltar p {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.lateral {
  position: absolute;
  top: 88px;
  right: 16px;
  bottom: 16px;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: 360px;
  max-width: calc(100% - 32px);
  border: 1px solid var(--soft-card);
  border-radius: 32px;
  background: var(--white-card);
  box-shadow: var(--sombra-panel);
}

.lateral-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 12px 24px;
}

.lateral-cabecera h2 {
  font-size: 20px;
}

.lateral-seccion {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 4px 24px 24px;
  overflow-y: auto;
}

.lateral-chat {
  padding-bottom: 16px;
}

.chat-lista {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.chat-lista:empty::before {
  content: 'Escribe al cliente. Lo verá en su pantalla.';
  color: var(--muted);
  font-size: 14px;
}

.chat-mensaje {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-mensaje small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.7;
}

.chat-mensaje.de-tecnico {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  background: var(--black);
  color: var(--page-bg);
}

.chat-mensaje.de-cliente {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: var(--soft-card);
}

.chat-mensaje.de-sistema {
  align-self: center;
  max-width: 100%;
  padding: 4px 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chat-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.chat-form .campo {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  resize: none;
}

.chat-form .boton {
  width: 44px;
  padding: 0;
}

.info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  margin: 0;
  font-size: 14px;
}

.info dt {
  color: var(--muted);
}

.info dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.botonera {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.clip-remoto {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--soft-card);
}

.clip-remoto .boton {
  align-self: flex-start;
}

.clip-texto {
  max-height: 180px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-radius: 8px;
  background: var(--soft-card-2);
  font: 13px/1.45 ui-monospace, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.lateral-seccion > .boton {
  align-self: flex-start;
}

.lista-archivos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.archivo {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  padding: 12px;
  border-radius: 16px;
  background: var(--soft-card-2);
  font-size: 14px;
}

.archivo .icono {
  grid-row: 1 / span 3;
  margin-top: 2px;
}

.archivo-nombre {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archivo-estado {
  color: var(--muted);
  font-size: 13px;
}

.archivo progress {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  border: 0;
  border-radius: 2px;
  background: var(--line);
  accent-color: var(--black);
}

.archivo progress::-webkit-progress-bar {
  border-radius: 2px;
  background: var(--line);
}

.archivo progress::-webkit-progress-value {
  border-radius: 2px;
  background: var(--black);
}

.archivo progress::-moz-progress-bar {
  background: var(--black);
}

@media (max-width: 860px) {
  .visor.con-lateral {
    right: 16px;
  }
}

/* Ventanas estrechas: la barra prescinde primero de las medidas y del texto de «Desconectar» */
@media (max-width: 1300px) {
  .barra-medidas {
    display: none;
  }
}

@media (max-width: 1100px) {
  .barra .boton .texto-boton {
    display: none;
  }

  .barra {
    gap: 2px;
  }

  .barra .boton {
    width: 36px;
    padding: 0;
  }

  .barra-boton {
    width: 32px;
    height: 32px;
  }

  .barra-sep {
    margin: 0 4px;
  }

  .barra-select {
    max-width: 112px;
    padding: 0 24px 0 10px;
    background-position: right 8px center;
  }
}

@media (max-width: 760px) {
  .barra-equipo,
  .barra-equipo + .barra-sep {
    display: none;
  }

  .barra {
    padding-left: 8px;
  }
}

/* ───────── v1.1: segundo factor, grabación con permiso, archivos recibidos ───────── */
.acceso-2fa {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.campo-2fa {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
}

/* Esperando el permiso del cliente para grabar: el botón late (sin color, Lumio) */
.barra-boton.esperando {
  animation: pulso 1.4s ease-in-out infinite;
}

/* Grabando: punto blanco fijo sobre el botón invertido */
.barra-boton.grabando::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--page-bg);
  border-radius: 50%;
  background: var(--black);
}

.archivo .boton {
  grid-column: 2;
  justify-self: start;
  margin-top: 6px;
}

/* Entrada con la sesión del CRM */
.marco-oculto { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; }
.aviso-crm {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--soft-card-2, #f4f3ef);
  color: var(--text, #1b1b1b);
  font-size: 14px;
  line-height: 1.5;
}
