/* KAIA · Conectar Telegram (etapa 2 · P4, ESPEC-ETAPA2.md §11.6). Prefijo tg-. Autosuficiente: vale en cualquier página, con o sin dashboard.css.
   Claro en todas las páginas, como los diálogos de sesión (kaia-sesion.css). Sin desborde a 390 px. */
:root {
  --tg-papel: #ffffff; --tg-tinta: #111418; --tg-tinta-2: #4a5159; --tg-linea: #d9dde2; --tg-suave: #f6f7f9;
  --tg-verde: #1f8a4c; --tg-ambar: #d98a00; --tg-mal: #b3261e; --tg-acento: #2a6df4; --tg-fondo: rgba(11, 13, 15, .52);
}
html.tg-bloqueo { overflow: hidden; }

/* El botón de la barra y el acceso de la portada */
.tg-b { display: inline-flex; align-items: center; gap: 6px; position: relative; }
.tg-b svg { width: 16px; height: 16px; flex: none; }
.tg-punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; background: transparent; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .85); }
.tg-punto[hidden] { display: none; }
.tg-punto-verde { background: var(--tg-verde); }
.tg-punto-ambar { background: var(--tg-ambar); }
.tg-acceso {
  position: fixed; right: 16px; bottom: 16px; z-index: 60; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  font: 600 13px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: #fff; background: #1b1f24; border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 100px; cursor: pointer; box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
}
.tg-acceso:hover { background: #2a3038; }

/* La franja de la portada */
.tg-franja {
  position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; box-sizing: border-box;
  margin: 0; padding: 12px clamp(16px, 5.8vw, 88px); color: var(--tg-tinta); background: #eef3ff; border-bottom: 1px solid #c8d6f7;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.tg-franja-t { margin: 0; flex: 1 1 260px; min-width: 0; }
.tg-franja-acc { display: flex; gap: 8px; flex-wrap: wrap; }

/* El cajón */
.tg-fondo { position: fixed; inset: 0; z-index: 9000; display: flex; justify-content: flex-end; background: var(--tg-fondo); }
.tg-cajon {
  box-sizing: border-box; display: flex; flex-direction: column; width: 100%; max-width: 480px; height: 100%; overflow-y: auto; overflow-x: hidden; padding: 22px 22px 28px;
  color: var(--tg-tinta); background: var(--tg-papel); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-shadow: -18px 0 48px rgba(0, 0, 0, .22); overflow-wrap: anywhere;
}
.tg-cajon *, .tg-cajon *::before, .tg-cajon *::after { box-sizing: border-box; }
.tg-cab { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tg-h { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.tg-entradilla { margin: 6px 0 18px; color: var(--tg-tinta-2); }
.tg-cuerpo { min-width: 0; }
.tg-cargando, .tg-vacio { margin: 0; color: var(--tg-tinta-2); }
.tg-lista { display: grid; gap: 12px; }
.tg-tarjeta { min-width: 0; padding: 16px; background: var(--tg-suave); border: 1px solid var(--tg-linea); border-radius: 14px; }
.tg-titulo { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.tg-desc { margin: 0 0 10px; color: var(--tg-tinta-2); font-size: 13px; }
.tg-estado { margin: 0 0 6px; }
.tg-etiqueta { display: inline-block; padding: 3px 10px; font-size: 12px; font-weight: 600; border-radius: 100px; background: #e6e9ed; color: var(--tg-tinta); }
.tg-et-conectado { background: #dcf3e4; color: #12603a; }
.tg-et-conectado_sin_codigo, .tg-et-falta_codigo { background: #fdf0d2; color: #7a4f00; }
.tg-et-no_disponible { background: #e6e9ed; color: var(--tg-tinta-2); }
.tg-detalle { margin: 6px 0 0; font-size: 13px; }
.tg-motivo { color: var(--tg-tinta-2); }
.tg-nota { margin: 8px 0 0; font-size: 12px; color: var(--tg-tinta-2); }
.tg-nota code { padding: 1px 5px; background: #e6e9ed; border-radius: 4px; word-break: break-all; }
.tg-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tg-confirmar { margin: 12px 0 0; font-weight: 500; }

/* Botones */
.tg-btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 16px; font-family: inherit; font-weight: 600; font-size: 13.5px; line-height: 1.2; text-decoration: none;
  color: var(--tg-tinta); background: var(--tg-papel); border: 1px solid var(--tg-linea); border-radius: 10px; cursor: pointer; max-width: 100%;
}
.tg-btn:hover { border-color: var(--tg-tinta-2); }
.tg-btn[disabled] { opacity: .55; cursor: default; }
.tg-btn-primario { color: #fff; background: var(--tg-tinta); border-color: var(--tg-tinta); }
.tg-btn-primario:hover { border-color: var(--tg-tinta); background: #2a3038; }
.tg-btn-peligro { color: #fff; background: var(--tg-mal); border-color: var(--tg-mal); }
.tg-btn-sec { margin-top: 10px; }
.tg-cerrar { min-width: 40px; padding: 4px 10px; font-size: 22px; line-height: 1; border-color: transparent; background: transparent; }
.tg-volver { min-height: 36px; margin: 0 0 12px; padding: 4px 10px; border-color: transparent; background: transparent; color: var(--tg-tinta-2); }
.tg-enlace { color: var(--tg-acento); }
a.tg-enlace { display: inline; min-height: 0; padding: 0; border: 0; background: none; font: inherit; font-weight: 500; text-decoration: underline; }

/* Formularios */
.tg-form { margin-top: 12px; }
.tg-check { display: flex; align-items: flex-start; gap: 10px; margin: 0 0 12px; padding: 12px; font-size: 13px; background: var(--tg-suave); border: 1px solid var(--tg-linea); border-radius: 10px; cursor: pointer; }
.tg-check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; }
.tg-check span { min-width: 0; }
.tg-consejo { margin: 0 0 12px; font-size: 12.5px; color: var(--tg-tinta-2); }
.tg-campo { display: block; margin: 0 0 12px; }
.tg-campo-t { display: block; margin-bottom: 4px; font-size: 12.5px; color: var(--tg-tinta-2); }
.tg-input { display: block; width: 100%; min-width: 0; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--tg-tinta); background: var(--tg-papel); border: 1px solid var(--tg-linea); border-radius: 9px; }
.tg-form-codigo .tg-input { letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.tg-fila { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tg-dias-fila { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tg-dia { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; font-size: 13px; border: 1px solid var(--tg-linea); border-radius: 100px; cursor: pointer; }
.tg-error { margin: 8px 0; color: var(--tg-mal); font-size: 13px; }
.tg-error[hidden], .tg-ok[hidden] { display: none; }
.tg-ok { margin: 8px 0; color: #12603a; font-size: 13px; }
.tg-exito { margin: 0 0 8px; font-size: 16px; font-weight: 600; }

/* Los pasos y el QR */
.tg-pasos { margin: 8px 0 14px; padding-left: 20px; }
.tg-pasos li { margin-bottom: 8px; }
.tg-qr-fila { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 6px 0 12px; }
.tg-qr { display: block; width: 208px; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--tg-linea); border-radius: 10px; padding: 8px; }
.tg-espera { margin: 4px 0 12px; padding: 8px 12px; font-size: 13px; background: var(--tg-suave); border-radius: 8px; color: var(--tg-tinta-2); }
.tg-espera-ok { background: #dcf3e4; color: #12603a; font-weight: 600; }
.tg-espera-mal { background: #fbe4e2; color: var(--tg-mal); }

.tg-cajon :focus-visible, .tg-acceso:focus-visible, .tg-franja :focus-visible, .tg-b:focus-visible { outline: 2px solid var(--tg-acento); outline-offset: 2px; }

/* Celular: el cajón ocupa toda la pantalla y la barra solo muestra el ícono */
@media (max-width: 640px) {
  .tg-b .tg-b-txt { display: none; }
  .tg-cajon { max-width: 100%; padding: 16px 16px 24px; box-shadow: none; }
  .tg-h { font-size: 20px; }
  .tg-fila { grid-template-columns: 1fr; }
  .tg-acciones .tg-btn, .tg-franja-acc .tg-btn { flex: 1 1 auto; }
  .tg-acceso { right: 12px; bottom: 12px; padding: 0 14px; }
  .tg-franja { padding: 12px 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .tg-cajon { animation: tg-entra .18s ease-out; }
  @keyframes tg-entra { from { transform: translateX(24px); opacity: .6; } to { transform: none; opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) { .tg-cajon { animation: none; } }
.tg-abrir-movil{display:flex;width:100%;min-height:48px;margin:14px 0 8px}.tg-qr{width:246px!important;height:246px!important;max-width:100%;object-fit:contain;background:#fff;image-rendering:pixelated}.tg-captura{margin:14px 0;padding:12px;border:1px solid var(--tg-linea);border-radius:12px;background:var(--tg-suave)}.tg-captura input[type=file]{display:block;max-width:100%;width:100%;font-size:16px;margin-top:8px}.tg-form-codigo input{font-size:16px;min-height:48px}
