/* ==========================================================================
   Demo comercial: chatbot con IA para WhatsApp · Ensamble
   Tokens y criterios de docs/MARCA.md y src/styles/global.css:
   tinta azul-negra + una sola pieza naranja, Archivo (ancho 115 % en titulares).
   Contrastes medidos (WCAG 2.2): tinta/blanco 18,7:1 · tinta 600/blanco 9,3:1 ·
   tinta 500/blanco 6,0:1 · tinta/naranja 5,2:1 · naranja 700/naranja 100 4,9:1 ·
   verde 800/verde 100 6,5:1 · rojo 700/rojo 100 5,5:1 · tinta 300/tinta 850 7,7:1.
   ========================================================================== */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('fonts/archivo-latin-wdth.woff2') format('woff2-variations'),
    url('fonts/archivo-latin-wdth.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308,
    U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url('fonts/archivo-latin-ext-wdth.woff2') format('woff2-variations'),
    url('fonts/archivo-latin-ext-wdth.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329,
    U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;

  --ink-950: #0b1220;
  --ink-900: #111a2c;
  --ink-850: #141d2f;
  --ink-800: #1c2740;
  --ink-750: #26314a;
  --ink-700: #2a3654;
  --ink-600: #3e475a;
  --ink-500: #5a6377;
  --ink-400: #8e98ad;
  --ink-300: #a7b0c2;
  --ink-250: #c9d0db;
  --ink-200: #dde2ea;
  --ink-100: #edf0f5;
  --ink-50: #f4f6f9;

  --orange-700: #b83c0c;
  --orange-600: #c2410c;
  --orange-500: #ea5418;
  --orange-450: #ff6b2c;
  --orange-400: #ff7a3d;
  --orange-200: #ffd3bf;
  --orange-100: #ffe9df;
  --orange-50: #fff5f0;

  --green-800: #166534;
  --green-700: #15803d;
  --green-100: #dcfce7;
  --red-700: #b42318;
  --red-100: #fee4e2;

  --bg: var(--ink-100);
  --surface: #ffffff;
  --text: var(--ink-950);
  --text-2: var(--ink-600);
  --text-3: var(--ink-500);
  --border: var(--ink-200);
  --border-strong: var(--ink-250);
  --accent: var(--orange-500);
  --focus: var(--orange-500);

  --chat-fondo: var(--ink-50);
  --burbuja-propia: var(--orange-100);

  --font: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Roboto Mono', Menlo, Consolas, 'Liberation Mono', monospace;

  --radius-s: 10px;
  --radius-m: 16px;
  --shadow-1: 0 1px 2px rgb(11 18 32 / 0.05), 0 2px 10px rgb(11 18 32 / 0.04);
  --shadow-2: 0 2px 4px rgb(11 18 32 / 0.05), 0 14px 40px rgb(11 18 32 / 0.12);
  --shadow-3: 0 30px 80px rgb(11 18 32 / 0.28);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --gutter: 20px;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  font-weight: 400;
  font-stretch: 100%;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.cabecera {
  grid-row: 1;
}
.pestanas {
  grid-row: 2;
}
.paneles {
  grid-row: 3;
}
.guiones {
  grid-row: 4;
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  -webkit-tap-highlight-color: transparent;
}
p,
ul,
ol,
dl,
figure {
  margin: 0;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
::selection {
  background: var(--orange-100);
  color: var(--ink-950);
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.ico {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ico-relleno {
  fill: currentColor;
  stroke: none;
}
.saltar {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  background: var(--ink-950);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-s);
  font-weight: 600;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}
.saltar:focus {
  top: 12px;
}
.tnum {
  font-variant-numeric: tabular-nums;
}

/* ---------- Botones ---------- */
.btn {
  --btn-bg: var(--ink-950);
  --btn-fg: #fff;
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-s);
  border: 1.5px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 650;
  font-stretch: 106%;
  font-size: 14px;
  line-height: 1.2;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease),
    transform 0.15s var(--ease);
}
.btn:active:not(:disabled) {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn--sm {
  min-height: 38px;
  padding: 7px 13px;
  font-size: 13.5px;
}
.btn--primary {
  --btn-bg: var(--orange-500);
  --btn-fg: var(--ink-950);
}
.btn--primary:hover:not(:disabled) {
  --btn-bg: var(--orange-450);
  box-shadow: 0 6px 18px rgb(234 84 24 / 0.26);
}
.btn--ghost {
  --btn-bg: #fff;
  --btn-fg: var(--ink-950);
  --btn-border: var(--border-strong);
}
.btn--ghost:hover:not(:disabled) {
  --btn-border: var(--ink-950);
}
.btn--dark:hover:not(:disabled) {
  --btn-bg: var(--ink-800);
}
.btn .ico {
  width: 17px;
  height: 17px;
}
.btn.esta-ocupado .ico {
  animation: girar 0.9s linear infinite;
}

/* ---------- Cabecera ---------- */
.cabecera {
  position: relative;
  z-index: 6;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 10px var(--gutter);
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.cabecera-marca {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.cabecera-logo {
  display: block;
  width: 108px;
  height: auto;
  flex: none;
}
.cabecera-sep {
  width: 1px;
  height: 26px;
  background: var(--border-strong);
  flex: none;
}
.cabecera-texto {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.cabecera-titulo {
  margin: 0;
  font-size: 1.06rem;
  font-weight: 740;
  font-stretch: 115%;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}
.insignias {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.insignia {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 9px 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--ink-50);
  color: var(--ink-600);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}
.insignia::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-400);
  flex: none;
}
.insignia--real {
  background: var(--green-100);
  border-color: #bbf7d0;
  color: var(--green-800);
}
.insignia--real::before {
  background: #16a34a;
}
.insignia--fija {
  background: var(--orange-50);
  border-color: var(--orange-200);
  color: var(--orange-700);
}
.insignia--fija::before {
  background: var(--orange-500);
}
.cabecera-controles {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.selector-negocio {
  display: block;
  min-width: 0;
}
.selector-negocio select {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  max-width: 300px;
  min-height: 38px;
  padding: 7px 36px 7px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: #fff
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b1220' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 11px center / 16px;
  font-size: 13.5px;
  font-weight: 650;
  color: var(--ink-950);
  text-overflow: ellipsis;
  cursor: pointer;
}
.selector-negocio select:hover:not(:disabled) {
  border-color: var(--ink-400);
}
.selector-negocio select:focus-visible {
  outline: none;
  border-color: var(--ink-950);
  box-shadow: 0 0 0 4px rgb(234 84 24 / 0.25);
}

/* ---------- Pestañas (solo móvil) ---------- */
.pestanas {
  display: none;
}
.pestana {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 46px;
  padding: 8px 4px;
  white-space: nowrap;
  border: 0;
  background: none;
  color: var(--ink-600);
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
}
.pestana .ico {
  width: 16px;
  height: 16px;
}
.pestana[aria-selected='true'] {
  color: var(--ink-950);
  box-shadow: inset 0 -3px 0 var(--accent);
}
.pestana-aviso {
  position: absolute;
  top: 9px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--orange-500);
  box-shadow: 0 0 0 2px #fff;
}

/* ---------- Paneles ---------- */
.paneles {
  display: grid;
  grid-template-columns: minmax(320px, 356px) minmax(0, 2fr) minmax(300px, 1fr);
  gap: 16px;
  min-height: 0;
  padding: 14px var(--gutter);
}
.panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.panel-cab {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px 11px;
  border-bottom: 1px solid var(--border);
}
.panel-cab-texto {
  min-width: 0;
}
.panel-titulo {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 1rem;
  font-weight: 720;
  font-stretch: 112%;
  letter-spacing: -0.008em;
  line-height: 1.2;
}
.panel-titulo::before {
  content: '';
  width: 16px;
  height: 5px;
  border-radius: 1px;
  background: var(--accent);
  flex: none;
}
.panel-titulo-nota {
  font-weight: 500;
  font-stretch: 100%;
  color: var(--text-3);
}
.panel-sub {
  margin: 3px 0 0 25px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text-3);
  text-wrap: pretty;
}

/* ---------- Panel 1: teléfono ---------- */
.panel--telefono {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
.panel-cab--suelta {
  border: 0;
  padding: 2px 4px 10px;
}
.dispositivo {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 356px;
  max-height: 860px;
  margin: 0 auto;
  padding: 9px;
  border-radius: 46px;
  background: var(--ink-950);
  box-shadow: inset 0 0 0 1.5px var(--ink-750), 0 24px 60px -20px rgb(11 18 32 / 0.5), 0 2px 6px rgb(11 18 32 / 0.18);
}
.pantalla {
  position: relative;
  isolation: isolate;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 37px;
  background: var(--chat-fondo);
}
.barra-estado {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 8px 24px 0 30px;
  background: #fff;
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink-950);
}
.barra-estado::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 9px;
  transform: translateX(-50%);
  width: 86px;
  height: 24px;
  border-radius: 14px;
  background: var(--ink-950);
}
.barra-iconos {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.barra-iconos .ico {
  width: 15px;
  height: 15px;
  stroke-width: 2.4;
}
.barra-iconos .ico--bateria {
  width: 20px;
  height: 20px;
  stroke-width: 1.8;
}
.chat-cab {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 9px 6px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.chat-cab-volver {
  display: grid;
  place-items: center;
  color: var(--orange-600);
}
.chat-cab-volver .ico {
  width: 24px;
  height: 24px;
}
.avatar {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink-100);
  color: var(--ink-700);
  font-size: 13.5px;
  font-weight: 700;
  font-stretch: 108%;
  letter-spacing: 0.02em;
}
.avatar--negocio {
  background: var(--ink-800);
  color: #fff;
}
.chat-cab-texto {
  flex: 1;
  min-width: 0;
}
.chat-cab-nombre {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-cab-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-3);
}
.chat-cab-sub.esta-escribiendo {
  color: var(--orange-600);
  font-weight: 600;
}
.chat-cab-iconos {
  display: inline-flex;
  gap: 16px;
  color: var(--orange-600);
}
.chat-cab-iconos .ico {
  width: 21px;
  height: 21px;
}
.chat-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 8px;
  background-color: var(--chat-fondo);
  background-image: linear-gradient(to right, rgb(11 18 32 / 0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(11 18 32 / 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}
.chat-log:focus-visible {
  outline-offset: -3px;
}
.chat-aviso {
  align-self: center;
  max-width: 94%;
  margin: 2px 0 10px;
  padding: 7px 12px;
  border-radius: 10px;
  background: #fff7f2;
  border: 1px solid var(--orange-100);
  color: var(--ink-600);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  text-wrap: pretty;
}
.chat-nuevos {
  position: absolute;
  right: 14px;
  bottom: 128px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--ink-950);
  color: #fff;
  font-size: 12.5px;
  font-weight: 650;
  box-shadow: var(--shadow-2);
  cursor: pointer;
}
.chat-nuevos .ico {
  width: 15px;
  height: 15px;
}

/* ---------- Mensajes (teléfono y bandeja) ---------- */
.separador-dia {
  align-self: center;
  margin: 10px 0 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: #fff;
  color: var(--ink-600);
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 0.5px rgb(11 18 32 / 0.12);
}
.msj {
  position: relative;
  display: flex;
  flex-direction: column;
  max-width: 84%;
  margin-top: 2px;
}
.msj--nuevo-lado {
  margin-top: 9px;
}
.msj--propio {
  align-self: flex-end;
  align-items: flex-end;
}
.msj--ajeno {
  align-self: flex-start;
  align-items: flex-start;
}
.msj--interactivo {
  width: min(84%, 292px);
}
.msj--interactivo .burbuja {
  width: 100%;
}
.msj.es-nuevo {
  animation: msj-entra 0.28s var(--ease) both;
}
.burbuja {
  position: relative;
  max-width: 100%;
  padding: 6px 8px 7px 9px;
  border-radius: 10px;
  background: #fff;
  color: var(--ink-950);
  font-size: 14.5px;
  line-height: 1.4;
  box-shadow: 0 1px 0.5px rgb(11 18 32 / 0.13);
  overflow-wrap: anywhere;
}
.msj--propio .burbuja {
  background: var(--burbuja-propia);
}
.msj--cola.msj--propio .burbuja {
  border-top-right-radius: 3px;
}
.msj--cola.msj--ajeno .burbuja {
  border-top-left-radius: 3px;
}
.burbuja-cuerpo {
  position: relative;
}
.burbuja-texto {
  white-space: pre-wrap;
}
.burbuja-texto strong {
  font-weight: 700;
}
.burbuja-texto code {
  font-family: var(--mono);
  font-size: 0.9em;
}
.burbuja-texto a {
  color: var(--orange-700);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}
.burbuja-espacio {
  display: inline-block;
  width: 58px;
  height: 1px;
}
.burbuja-espacio--estado {
  width: 78px;
}
.burbuja-meta {
  position: absolute;
  right: -1px;
  bottom: -3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  line-height: 1;
  color: var(--ink-500);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.burbuja-meta--sola {
  position: static;
  display: flex;
  justify-content: flex-end;
  margin-top: 3px;
}
.palomitas {
  width: 17px;
  height: 11px;
  stroke-width: 1.7;
}
.palomitas--leido {
  color: var(--orange-600);
  stroke-width: 2;
}
.palomitas--pendiente {
  width: 12px;
  height: 12px;
  stroke-width: 2;
}
.palomitas--fallo {
  width: 14px;
  height: 14px;
  color: var(--red-700);
}
.burbuja-autor {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 2px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-600);
}
.burbuja-autor .ico {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}
.burbuja-autor--operador {
  color: var(--orange-700);
}
.etiqueta-plantilla {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 3px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.etiqueta-plantilla .ico {
  width: 12px;
  height: 12px;
}
.cita {
  display: block;
  margin: 0 0 5px;
  padding: 4px 8px 5px;
  border-left: 3px solid var(--orange-500);
  border-radius: 6px;
  background: rgb(11 18 32 / 0.05);
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--ink-600);
}
.cita-autor {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--orange-700);
}
.cita-texto {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.respuesta-tipo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 4px;
  color: var(--ink-500);
  vertical-align: -2px;
}
.respuesta-tipo .ico {
  width: 14px;
  height: 14px;
}
.adjunto {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(210px, 100%);
  margin: 0 0 4px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgb(11 18 32 / 0.05);
}
.adjunto-ico {
  position: relative;
  width: 30px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: end center;
  padding-bottom: 5px;
  border-radius: 4px 9px 4px 4px;
  background: #fff;
  border: 1px solid var(--border-strong);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--ink-600);
}
.adjunto-ico--pdf {
  color: var(--red-700);
}
.adjunto-texto {
  min-width: 0;
  display: grid;
}
.adjunto-nombre {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.adjunto-meta {
  font-size: 11.5px;
  color: var(--ink-500);
}
.mapa {
  position: relative;
  height: 108px;
  margin: 0 0 6px;
  border-radius: 8px;
  background-color: #e9eef4;
  background-image: linear-gradient(28deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%),
    linear-gradient(-62deg, transparent 47%, #fff 47%, #fff 52%, transparent 52%),
    linear-gradient(to right, rgb(11 18 32 / 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(11 18 32 / 0.05) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 18px 18px, 18px 18px;
  display: grid;
  place-items: center;
}
.mapa .ico {
  width: 30px;
  height: 30px;
  color: var(--orange-600);
  fill: #fff;
  stroke-width: 2.2;
}
.imagen-ph {
  height: 130px;
  margin: 0 0 6px;
  border-radius: 8px;
  background: var(--ink-100);
  display: grid;
  place-items: center;
  color: var(--ink-500);
}
.imagen-ph .ico {
  width: 34px;
  height: 34px;
  stroke-width: 1.6;
}
.msj-botones {
  display: grid;
  gap: 2px;
  width: 100%;
  margin-top: 2px;
}
.msj-boton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 8px 12px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  color: var(--orange-600);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  box-shadow: 0 1px 0.5px rgb(11 18 32 / 0.13);
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}
.msj-boton .ico {
  width: 16px;
  height: 16px;
}
.msj-boton:hover:not(:disabled) {
  background: var(--orange-50);
}
.msj-boton:disabled {
  cursor: default;
  color: var(--ink-500);
}
.msj-boton.es-elegido {
  color: var(--orange-700);
  background: var(--orange-50);
}
.burbuja-lista {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: calc(100% + 17px);
  margin: 8px -8px -7px -9px;
  padding: 10px 12px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  background: transparent;
  color: var(--orange-600);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.burbuja-lista:hover:not(:disabled) {
  background: var(--orange-50);
}
.burbuja-lista:disabled {
  cursor: default;
  color: var(--ink-500);
}
.burbuja-lista .ico {
  width: 17px;
  height: 17px;
}
.msj-opciones {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.msj-opcion {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-600);
}
.msj-opcion .ico {
  width: 12px;
  height: 12px;
}
.msj-lista-detalle {
  margin-top: 6px;
  font-size: 12.5px;
}
.msj-lista-detalle summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--orange-700);
  width: fit-content;
}
.msj-lista-detalle ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--ink-600);
}
.msj-fallo {
  margin-top: 3px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--red-700);
}
.msj-fallo button {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.escribiendo {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}
.escribiendo i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink-400);
  animation: parpadeo 1.1s infinite;
}
.escribiendo i:nth-child(2) {
  animation-delay: 0.15s;
}
.escribiendo i:nth-child(3) {
  animation-delay: 0.3s;
  background: var(--orange-500);
}

/* ---------- Sugerencias y redactor del teléfono ---------- */
.chat-sugerencias {
  flex: none;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 6px 10px 2px;
  scrollbar-width: none;
  scroll-padding-inline: 10px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 10px, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 10px, #000 calc(100% - 22px), transparent 100%);
}
.chat-sugerencias::-webkit-scrollbar {
  display: none;
}
.sugerencia {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--orange-200);
  background: #fff;
  color: var(--orange-700);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease);
}
.sugerencia:hover {
  background: var(--orange-50);
  border-color: var(--orange-400);
}
.sugerencia:focus-visible {
  outline-offset: -1px;
}
.chat-redactor {
  position: relative;
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding: 6px 8px 24px;
}
.chat-campo {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  padding: 2px 4px 2px 2px;
  border: 1.5px solid transparent;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 1px 0.5px rgb(11 18 32 / 0.13);
}
.chat-campo:focus-within {
  border-color: var(--ink-950);
  box-shadow: 0 0 0 3px rgb(234 84 24 / 0.25);
}
.chat-adjuntar {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink-500);
  cursor: pointer;
}
.chat-adjuntar:hover,
.chat-adjuntar[aria-expanded='true'] {
  color: var(--orange-600);
  background: var(--orange-50);
}
.chat-adjuntar .ico {
  width: 20px;
  height: 20px;
}
.chat-redactor textarea {
  flex: 1;
  min-width: 0;
  max-height: 112px;
  padding: 8px 8px 8px 2px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink-950);
}
.chat-redactor textarea::placeholder {
  color: var(--ink-500);
}
.chat-enviar {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--orange-500);
  color: var(--ink-950);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.chat-enviar:hover:not([aria-disabled='true']) {
  background: var(--orange-450);
}
.chat-enviar:active:not([aria-disabled='true']) {
  transform: scale(0.95);
}
.chat-enviar[aria-disabled='true'] {
  background: var(--ink-200);
  color: var(--ink-500);
  cursor: default;
}
.chat-enviar .ico {
  width: 20px;
  height: 20px;
}
.barra-inicio {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: 118px;
  height: 4px;
  border-radius: 2px;
  background: var(--ink-950);
  opacity: 0.85;
  pointer-events: none;
}
.menu-adjuntos {
  position: absolute;
  left: 8px;
  bottom: calc(100% + 2px);
  z-index: 6;
  width: min(260px, calc(100% - 16px));
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-2);
}
.menu-adjuntos-titulo {
  margin: 0;
  padding: 6px 8px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--orange-50);
}
.menu-item:focus-visible {
  outline-offset: -2px;
}
.menu-item .adjunto-ico {
  width: 26px;
  height: 32px;
  font-size: 7.5px;
}
.menu-item span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hoja de lista (mensajes tipo lista) */
.hoja-fondo {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgb(11 18 32 / 0.38);
  animation: aparecer 0.2s var(--ease);
}
.hoja {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
  max-height: 80%;
  display: flex;
  flex-direction: column;
  border-radius: 18px 18px 0 0;
  background: #fff;
  box-shadow: 0 -10px 30px rgb(11 18 32 / 0.22);
  animation: hoja-sube 0.26s var(--ease);
}
.hoja-cab {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid var(--border);
}
.hoja-cerrar {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--ink-50);
  cursor: pointer;
}
.hoja-titulo {
  flex: 1;
  margin: 0;
  padding-right: 44px;
  font-size: 15.5px;
  font-weight: 700;
  text-align: center;
}
.hoja-cuerpo {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.hoja-opciones {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 0 6px;
}
.hoja-seccion {
  margin: 0;
  padding: 0;
  border: 0;
}
.hoja-seccion-titulo {
  display: block;
  padding: 12px 18px 4px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--orange-700);
}
.hoja-opcion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  cursor: pointer;
}
.hoja-opcion:hover {
  background: var(--ink-50);
}
.hoja-opcion input {
  appearance: none;
  -webkit-appearance: none;
  order: 2;
  width: 21px;
  height: 21px;
  flex: none;
  display: grid;
  place-items: center;
  margin: 0;
  border: 2px solid var(--ink-400);
  border-radius: 50%;
  cursor: pointer;
}
.hoja-opcion input::before {
  content: '';
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--orange-600);
  transform: scale(0);
  transition: transform 0.15s var(--ease);
}
.hoja-opcion input:checked {
  border-color: var(--orange-600);
}
.hoja-opcion input:checked::before {
  transform: scale(1);
}
.hoja-opcion-texto {
  flex: 1;
  min-width: 0;
  display: grid;
}
.hoja-opcion-titulo {
  font-size: 15px;
  font-weight: 550;
}
.hoja-opcion-desc {
  font-size: 12.5px;
  color: var(--ink-500);
}
.hoja-pie {
  flex: none;
  padding: 10px 14px 26px;
  border-top: 1px solid var(--border);
}
.hoja-enviar {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--orange-500);
  color: var(--ink-950);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.hoja-enviar:disabled {
  background: var(--ink-200);
  color: var(--ink-500);
  cursor: default;
}

/* ---------- Panel 2: bandeja ---------- */
.panel--bandeja {
  container: bandeja / inline-size;
}
.bandeja-contador {
  flex: none;
  margin: 1px 0 0;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--orange-200);
  background: var(--orange-50);
  color: var(--orange-700);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.bandeja-cuerpo {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}
.bandeja-lista-caja {
  min-height: 0;
  overflow-y: auto;
}
.panel--bandeja[data-vista='lista'] .bandeja-detalle {
  display: none;
}
.panel--bandeja[data-vista='detalle'] .bandeja-lista-caja {
  display: none;
}
@container bandeja (max-width: 599px) {
  .bandeja-detalle {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .detalle-contexto {
    max-height: none;
    overflow: visible;
  }
  .detalle-hilo {
    flex: none;
    min-height: 200px;
    overflow: visible;
  }
  .detalle-pie {
    position: sticky;
    bottom: 0;
    z-index: 3;
    margin-top: auto;
    background: #fff;
    box-shadow: 0 -8px 18px -10px rgb(11 18 32 / 0.18);
  }
  .detalle-acciones {
    gap: 4px;
    padding: 8px 12px 2px;
  }
  .accion {
    min-height: 32px;
    padding: 5px 7px;
    font-size: 11.5px;
    gap: 4px;
  }
  .accion .ico {
    width: 14px;
    height: 14px;
  }
  .detalle-redactor {
    padding: 6px 12px 2px;
  }
  .detalle-nota {
    padding: 2px 12px 8px;
  }
  .detalle-cab,
  .detalle-contexto,
  .detalle-hilo {
    padding-inline: 12px;
  }
}
@container bandeja (min-width: 600px) {
  .bandeja-cuerpo {
    grid-template-columns: 248px minmax(0, 1fr);
  }
  .panel--bandeja .bandeja-lista-caja {
    display: block !important;
    border-right: 1px solid var(--border);
    background: #fcfcfd;
  }
  .panel--bandeja .bandeja-detalle {
    display: flex !important;
  }
  .detalle-volver {
    display: none !important;
  }
}
.bandeja-lista {
  list-style: none;
  margin: 0;
  padding: 6px;
  display: grid;
  gap: 2px;
}
.bandeja-vacia {
  padding: 22px 14px;
  color: var(--text-3);
  font-size: 13.5px;
  text-align: center;
}
.conv {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px 10px 10px 9px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s var(--ease);
}
.conv:hover {
  background: var(--ink-50);
}
.conv[aria-current='true'] {
  background: var(--orange-50);
}
.conv[aria-current='true']::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.conv:focus-visible {
  outline-offset: -3px;
}
.conv.es-destacada {
  animation: destello 1.4s var(--ease) 2;
}
.conv-cuerpo {
  min-width: 0;
  display: grid;
  gap: 1px;
}
.conv-fila {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.conv-nombre {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 650;
}
.conv-hora {
  flex: none;
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.conv-hora.tiene-pendientes {
  color: var(--orange-700);
  font-weight: 650;
}
.conv-ultimo {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--text-2);
}
.conv-no-leidos {
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--orange-500);
  color: var(--ink-950);
  font-size: 11.5px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.conv-pie {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
}
.conv-tu {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 650;
  color: var(--text-3);
}
.conv-tu .ico {
  width: 13px;
  height: 13px;
}
.simular {
  position: relative;
}
.simular-chevron {
  width: 14px !important;
  height: 14px !important;
  margin-left: -2px;
  transition: transform 0.2s var(--ease);
}
.simular-boton[aria-expanded='true'] .simular-chevron {
  transform: rotate(180deg);
}
.simular-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 6px);
  z-index: 8;
  width: min(310px, calc(100vw - 40px));
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-2);
}
.simular-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 1px 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.simular-item:hover,
.simular-item:focus-visible {
  background: var(--orange-50);
}
.simular-item:focus-visible {
  outline-offset: -2px;
}
.simular-item .ico {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--orange-600);
}
.simular-item strong {
  font-size: 13px;
  font-weight: 650;
  color: var(--ink-950);
}
.simular-item span {
  grid-column: 2;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3);
}
.estado {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1.45;
  white-space: nowrap;
}
.estado .ico {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}
.estado--bot {
  background: var(--ink-100);
  color: var(--ink-700);
  border-color: var(--ink-200);
}
.estado--espera_humano {
  background: var(--orange-100);
  color: var(--orange-700);
  border-color: var(--orange-200);
}
.estado--humano {
  background: var(--green-100);
  color: var(--green-800);
  border-color: #bbf7d0;
}
.estado--cerrada {
  background: #fff;
  color: var(--ink-500);
  border-color: var(--border-strong);
}
.estado--espera_humano.late::after {
  content: '';
  width: 6px;
  height: 6px;
  margin-left: 1px;
  border-radius: 50%;
  background: var(--orange-500);
  animation: latido 1.6s ease-in-out infinite;
}

/* Detalle */
.bandeja-detalle {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.detalle-vacio {
  margin: auto;
  max-width: 300px;
  padding: 28px 18px;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
  line-height: 1.5;
}
.detalle-vacio .ico {
  width: 30px;
  height: 30px;
  margin: 0 auto 10px;
  display: block;
  color: var(--ink-400);
  stroke-width: 1.6;
}
.detalle-vacio strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink-950);
  font-size: 14.5px;
}
.detalle-cab {
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.detalle-volver {
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.detalle-volver:hover {
  border-color: var(--ink-950);
}
.detalle-quien {
  flex: 1;
  min-width: 120px;
}
.detalle-nombre {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  font-stretch: 106%;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detalle-tel {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.detalle-etiquetas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.ventana {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--ink-50);
  color: var(--ink-600);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  white-space: nowrap;
}
.ventana .ico {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}
.ventana--abierta .ico {
  color: var(--green-700);
}
.ventana--cerrada {
  background: var(--red-100);
  border-color: #fecdca;
  color: var(--red-700);
}
.detalle-contexto {
  flex: none;
  display: grid;
  gap: 8px;
  max-height: 38%;
  overflow-y: auto;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  overscroll-behavior: contain;
}
.detalle-contexto:empty {
  display: none;
}
.traspaso {
  padding: 9px 12px 10px;
  border: 1px solid var(--orange-200);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: var(--orange-50);
}
.traspaso-cab {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--orange-700);
}
.traspaso-cab .ico {
  width: 15px;
  height: 15px;
}
.traspaso-cab time {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-500);
}
.traspaso-motivo {
  margin: 4px 0 2px;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink-950);
}
.traspaso-resumen {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-600);
  white-space: pre-line;
  text-wrap: pretty;
}
.urgente {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid #fecdca;
  border-radius: 999px;
  background: var(--red-100);
  color: var(--red-700);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
  text-transform: none;
}
.alerta-equipo {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #fecdca;
  border-radius: 8px;
  background: var(--red-100);
  color: var(--red-700);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.4;
}
.alerta-equipo .ico {
  width: 15px;
  height: 15px;
  margin-top: 1px;
}
.traspaso-resumen.es-plegado {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.traspaso-mas {
  margin-top: 2px;
  padding: 2px 0;
  border: 0;
  background: none;
  color: var(--orange-700);
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}
.traspaso--historico {
  background: #fff;
  border-color: var(--border);
  border-left-color: var(--ink-300);
}
.traspaso--historico .traspaso-cab {
  color: var(--ink-500);
}
.datos-titulo {
  margin: 0 0 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.datos {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.dato {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--ink-50);
  font-size: 12.5px;
}
.dato dt {
  color: var(--text-3);
  font-weight: 600;
}
.dato dd {
  margin: 0;
  min-width: 0;
  color: var(--ink-950);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.dato.es-nuevo {
  animation: destello 1.4s var(--ease) 1;
}
.detalle-hilo {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 12px;
  background: #fff;
}
.detalle-hilo:focus-visible {
  outline-offset: -3px;
}
.detalle-hilo .msj {
  max-width: 88%;
}
.detalle-hilo .msj--interactivo {
  width: min(88%, 300px);
}
.detalle-hilo .burbuja {
  font-size: 13.5px;
  box-shadow: none;
}
.detalle-hilo .msj--ajeno .burbuja {
  border: 1px solid var(--border);
}
.detalle-hilo .msj--propio .burbuja {
  background: var(--ink-100);
}
.detalle-hilo .msj--operador .burbuja {
  background: var(--orange-100);
}
.detalle-hilo .msj--sistema .burbuja {
  background: #fff;
  border: 1px dashed var(--ink-250);
}
.detalle-hilo .separador-dia {
  background: var(--ink-50);
  box-shadow: none;
}
.detalle-hilo .escribiendo-msj .burbuja {
  background: var(--ink-100);
}
.nota-sistema {
  align-self: center;
  max-width: 92%;
  margin: 8px 0;
  padding: 4px 10px;
  border-radius: 8px;
  background: var(--ink-50);
  color: var(--ink-600);
  font-size: 12px;
  text-align: center;
}
.detalle-pie {
  flex: none;
}
.pie-alerta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin: 8px 14px 0;
  padding: 8px 10px;
  border: 1px solid #fecdca;
  border-radius: 10px;
  background: var(--red-100);
  color: var(--red-700);
}
.pie-alerta > .ico {
  width: 16px;
  height: 16px;
}
.pie-alerta.es-nuevo {
  animation: destello 1.2s var(--ease) 2;
}
.pie-alerta-texto {
  flex: 1;
  min-width: 180px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.4;
}
.pie-alerta-accion {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--ink-950);
  color: #fff;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.pie-alerta-accion:hover {
  background: var(--ink-800);
}
.pie-alerta-accion .ico {
  width: 15px;
  height: 15px;
}
.detalle-acciones {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 9px 14px 2px;
  border-top: 1px solid var(--border);
}
.acciones-sep {
  width: 1px;
  height: 22px;
  margin: 0 2px;
  background: var(--border-strong);
}
.accion {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1.5px solid var(--border-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink-950);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.accion .ico {
  width: 15px;
  height: 15px;
}
.accion:hover:not(:disabled) {
  border-color: var(--ink-950);
}
.accion--principal {
  border-color: var(--ink-950);
  background: var(--ink-950);
  color: #fff;
}
.accion--principal:hover:not(:disabled) {
  background: var(--ink-800);
}
.accion--resaltada {
  border-color: var(--orange-500);
  background: var(--orange-500);
  color: var(--ink-950);
}
.accion--resaltada:hover:not(:disabled) {
  border-color: var(--orange-450);
  background: var(--orange-450);
}
.accion--demo {
  border-style: dashed;
  color: var(--ink-600);
}
.accion:disabled {
  opacity: 0.5;
  cursor: default;
}
.accion.esta-ocupado .ico {
  animation: girar 0.9s linear infinite;
}
.detalle-redactor {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 14px 4px;
}
.detalle-redactor textarea {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 104px;
  padding: 9px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: #fff;
  resize: none;
  font-size: 14px;
  line-height: 1.35;
}
.detalle-redactor textarea:hover {
  border-color: var(--ink-400);
}
.detalle-redactor textarea:focus {
  outline: none;
  border-color: var(--ink-950);
  box-shadow: 0 0 0 3px rgb(234 84 24 / 0.22);
}
.detalle-redactor .btn {
  min-height: 40px;
}
.detalle-nota {
  flex: none;
  margin: 0;
  padding: 2px 14px 10px;
  font-size: 12px;
  color: var(--text-3);
}
.detalle-nota--alerta {
  color: var(--red-700);
  font-weight: 600;
}

/* ---------- Panel 3: bajo el capó ---------- */
.panel--traza {
  background: var(--ink-950);
  border-color: var(--ink-950);
  color: #fff;
  --focus: var(--orange-400);
}
.panel--traza .panel-cab {
  border-color: var(--ink-800);
}
.panel--traza .panel-titulo {
  color: #fff;
}
.panel--traza .panel-sub {
  color: var(--ink-300);
}
.traza-controles {
  flex: none;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ink-800);
}
.traza-filtro {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 3px;
}
.traza-filtro-etiqueta {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-300);
}
.traza-filtro select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-height: 34px;
  padding: 5px 30px 5px 10px;
  border: 1px solid var(--ink-700);
  border-radius: 8px;
  background: var(--ink-850)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E")
    no-repeat right 9px center / 14px;
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}
.traza-filtro select option {
  background: var(--ink-850);
  color: #fff;
}
.btn-oscuro {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 12px;
  border: 1px solid var(--ink-700);
  border-radius: 8px;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-oscuro:hover {
  border-color: #fff;
}
.btn-oscuro .ico {
  width: 15px;
  height: 15px;
}
.traza-resumen {
  flex: none;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--ink-800);
  font-size: 12px;
  color: var(--ink-300);
}
.traza-resumen:empty {
  display: none;
}
.traza-resumen strong {
  color: #fff;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.traza-lista {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  scrollbar-color: var(--ink-700) transparent;
}
.traza-lista:focus-visible {
  outline-offset: -3px;
}
.traza-vacia {
  padding: 26px 14px;
  color: var(--ink-300);
  font-size: 13.5px;
  line-height: 1.55;
  text-align: center;
  text-wrap: pretty;
}
.traza-vacia .ico {
  display: block;
  width: 28px;
  height: 28px;
  margin: 0 auto 10px;
  color: var(--orange-400);
}
.turno {
  flex: none;
  border: 1px solid var(--ink-750);
  border-radius: 12px;
  background: var(--ink-900);
  overflow: hidden;
}
.turno.es-nuevo {
  animation: msj-entra 0.3s var(--ease) both;
}
.turno-cab {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: none;
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.turno-cab:hover {
  background: rgb(255 255 255 / 0.03);
}
.turno-cab:focus-visible {
  outline-offset: -3px;
}
.turno-titulo {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.turno-sub {
  display: block;
  font-size: 12px;
  color: var(--ink-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.turno-latencia {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgb(255 122 61 / 0.14);
  color: var(--orange-400);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.turno-latencia.en-curso {
  background: rgb(255 255 255 / 0.08);
  color: var(--ink-300);
}
.turno-latencia.con-error {
  background: rgb(248 113 113 / 0.14);
  color: #f87171;
}
.turno-chevron {
  color: var(--ink-300);
  transition: transform 0.2s var(--ease);
}
.turno-cab[aria-expanded='true'] .turno-chevron {
  transform: rotate(180deg);
}
.turno-mini {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 12px 10px;
}
.turno-mini span {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: rgb(255 255 255 / 0.06);
  background: color-mix(in srgb, var(--tono) 16%, transparent);
  color: var(--tono);
}
.turno-mini .ico {
  width: 12px;
  height: 12px;
}
.pasos {
  list-style: none;
  margin: 0;
  padding: 0 12px 10px;
}
.paso {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  padding: 6px 0;
}
.paso::before {
  content: '';
  position: absolute;
  left: 12.5px;
  top: 34px;
  bottom: -4px;
  width: 1px;
  background: var(--ink-750);
}
.paso:last-child::before {
  display: none;
}
.paso.es-nuevo {
  animation: paso-entra 0.35s var(--ease) both;
}
.paso-ico {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgb(255 255 255 / 0.06);
  background: color-mix(in srgb, var(--tono) 16%, transparent);
  color: var(--tono);
}
.paso-ico .ico {
  width: 15px;
  height: 15px;
}
.paso-cuerpo {
  min-width: 0;
}
.paso-fila {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.paso-nombre {
  font-size: 13px;
  font-weight: 650;
  color: #fff;
}
.paso-ms {
  flex: none;
  font-size: 12px;
  color: var(--ink-300);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.paso-detalle {
  margin: 1px 0 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: #c3cad8;
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.paso-barra {
  position: relative;
  height: 4px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--ink-800);
  overflow: hidden;
}
.paso-barra i {
  position: absolute;
  top: 0;
  bottom: 0;
  min-width: 3px;
  border-radius: 2px;
  background: var(--tono);
}
.paso-datos {
  margin-top: 4px;
}
.paso-datos summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  padding: 2px 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--orange-400);
  cursor: pointer;
  list-style: none;
}
.paso-datos summary::-webkit-details-marker {
  display: none;
}
.paso-datos summary .ico {
  width: 13px;
  height: 13px;
  transition: transform 0.2s var(--ease);
}
.paso-datos[open] summary .ico {
  transform: rotate(90deg);
}
.paso-explica {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-300);
}
.paso-datos pre {
  margin: 6px 0 2px;
  padding: 8px 10px;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--ink-750);
  border-radius: 8px;
  background: var(--ink-950);
  color: #c3cad8;
  font: 11.5px/1.55 var(--mono);
  white-space: pre;
  tab-size: 2;
}
.json-clave {
  color: #7dd3fc;
}
.json-texto {
  color: #86efac;
}
.json-num {
  color: var(--orange-400);
}
.json-bool {
  color: #c4b5fd;
}
.json-nulo {
  color: var(--ink-400);
}
.paso--webhook_recibido,
.paso--envio {
  --tono: #7dd3fc;
}
.paso--firma_valida,
.paso--reanuda_bot {
  --tono: #4ade80;
}
.paso--firma_invalida,
.paso--error,
.paso.es-alerta {
  --tono: #f87171;
}
.paso--duplicado,
.paso--herramienta {
  --tono: #fcd34d;
}
.paso--estado_conversacion,
.paso--ventana_24h {
  --tono: #a7b0c2;
}
.paso--enmascarado,
.paso--plantilla {
  --tono: #c4b5fd;
}
.paso--busqueda {
  --tono: #5eead4;
}
.paso--modelo {
  --tono: #ff7a3d;
}
.paso--control_cifras {
  --tono: #86efac;
}
.paso--traspaso,
.paso--pausa_bot {
  --tono: #fdba74;
}
.paso--otro {
  --tono: #a7b0c2;
}
.paso--descartada {
  --tono: #fcd34d;
}

/* ---------- Guiones ---------- */
.guiones {
  position: relative;
  z-index: 6;
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 30px -14px rgb(11 18 32 / 0.16);
}
.guiones-barra {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 8px var(--gutter);
}
.guiones-alternar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: #fff;
  color: var(--ink-950);
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}
.guiones-alternar:hover {
  border-color: var(--ink-950);
}
.guiones-alternar .ico {
  width: 17px;
  height: 17px;
}
.guiones-chevron {
  transition: transform 0.2s var(--ease);
}
.guiones-alternar[aria-expanded='true'] .guiones-chevron {
  transform: rotate(180deg);
}
.guiones-estado {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
}
.guiones-estado strong {
  color: var(--ink-950);
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
}
.guiones-progreso {
  flex: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--ink-50);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.guiones-nota {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-600);
}
.guiones-nota b {
  color: var(--orange-700);
  font-weight: 700;
}
.atajo {
  margin-left: 2px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgb(11 18 32 / 0.12);
  font: 650 11px/1.4 var(--font);
  letter-spacing: 0.02em;
}
.guiones-cuerpo {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  max-height: min(32vh, 290px);
  border-top: 1px solid var(--border);
}
.guiones-pestanas {
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 2px;
  padding: 8px;
  border-right: 1px solid var(--border);
}
.guion-pestana {
  display: grid;
  gap: 1px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  cursor: pointer;
}
.guion-pestana:hover {
  background: var(--ink-50);
}
.guion-pestana[aria-selected='true'] {
  background: var(--orange-50);
  box-shadow: inset 3px 0 0 var(--accent);
}
.guion-pestana strong {
  font-size: 13.5px;
  font-weight: 650;
}
.guion-pestana span {
  font-size: 12px;
  color: var(--text-3);
}
.guiones-panel {
  min-height: 0;
  overflow-y: auto;
  padding: 12px 18px 16px;
}
.guiones-panel:focus-visible {
  outline-offset: -3px;
}
.guion-cab {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.guion-desc {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-2);
  text-wrap: pretty;
}
.guion-reiniciar {
  flex: none;
  border: 0;
  background: none;
  padding: 2px 0;
  color: var(--orange-700);
  font-size: 12.5px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
}
.pasos-guion {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 8px;
}
.paso-guion {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  height: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.paso-guion:hover:not(:disabled) {
  border-color: var(--ink-950);
}
.paso-guion:disabled {
  cursor: progress;
}
.paso-guion.es-siguiente {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(234 84 24 / 0.14);
}
.paso-guion.es-hecho {
  background: var(--ink-50);
}
.paso-guion-num {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink-100);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.paso-guion-num .ico {
  width: 15px;
  height: 15px;
  stroke-width: 2.6;
}
.es-hecho .paso-guion-num {
  background: var(--green-100);
  color: var(--green-800);
}
.es-siguiente .paso-guion-num {
  background: var(--orange-500);
  color: var(--ink-950);
}
.esta-ocupado .paso-guion-num .ico {
  animation: girar 0.9s linear infinite;
}
.paso-guion-cuerpo {
  min-width: 0;
  display: grid;
  gap: 2px;
}
.paso-guion-tipo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.paso-guion-tipo .ico {
  width: 13px;
  height: 13px;
}
.paso-guion-texto {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-950);
  overflow-wrap: anywhere;
}
.paso-guion-nota {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-2);
}

/* ---------- Diálogos ---------- */
.dialogo {
  width: min(1060px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 20px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-3);
}
.dialogo[open] {
  display: flex;
  flex-direction: column;
  animation: dialogo-entra 0.24s var(--ease);
}
.dialogo::backdrop {
  background: rgb(11 18 32 / 0.55);
}
.dialogo--chico {
  width: min(540px, calc(100vw - 32px));
}
.dialogo--chico form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.dialogo-cab {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 12px;
}
.antetitulo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  font-stretch: 112%;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.antetitulo::before {
  content: '';
  width: 22px;
  height: 6px;
  border-radius: 1px;
  background: var(--accent);
}
.dialogo-titulo {
  margin: 6px 0 0;
  font-size: 1.55rem;
  font-weight: 740;
  font-stretch: 115%;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-wrap: balance;
}
.dialogo--chico .dialogo-titulo {
  font-size: 1.25rem;
}
.dialogo-cerrar {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: #fff;
  cursor: pointer;
}
.dialogo-cerrar:hover {
  border-color: var(--ink-950);
}
.dialogo-cuerpo {
  min-height: 0;
  overflow-y: auto;
  padding: 4px 24px 22px;
}
.dialogo-texto {
  margin: 0 0 14px;
  color: var(--text-2);
  font-size: 14px;
}
.dialogo-pie {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 24px 20px;
  border-top: 1px solid var(--border);
}
.campo-etiqueta {
  display: block;
  margin-bottom: 6px;
  font-size: 13.5px;
  font-weight: 650;
}
.campo-texto {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: #fff;
  font-size: 14.5px;
  line-height: 1.45;
  resize: vertical;
}
.campo-texto:focus {
  outline: none;
  border-color: var(--ink-950);
  box-shadow: 0 0 0 4px rgb(234 84 24 / 0.22);
}
.arquitectura {
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background-color: var(--ink-50);
  background-image: linear-gradient(to right, rgb(11 18 32 / 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(11 18 32 / 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}
.arq {
  display: block;
  width: 100%;
  height: auto;
}
.arq--angosta {
  display: none;
  max-width: 420px;
  margin: 0 auto;
}
.arq text {
  font-family: var(--font);
}
.arq-nodo rect {
  fill: #fff;
  stroke: var(--ink-250);
  stroke-width: 1.5;
}
.arq-nodo--suave rect {
  stroke-dasharray: 5 4;
}
.arq-t {
  font-size: 13.5px;
  font-weight: 700;
  fill: var(--ink-950);
}
.arq-s {
  font-size: 11.5px;
  fill: var(--ink-600);
}
.arq-etq {
  font-size: 11px;
  font-weight: 600;
  fill: var(--ink-500);
}
.arq-etq--clara {
  fill: var(--ink-300);
}
.arq-ico {
  fill: none;
  stroke: var(--orange-600);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.arq-servidor {
  fill: var(--ink-950);
}
.arq-servidor-t {
  font-size: 15px;
  font-weight: 740;
  font-stretch: 112%;
  fill: #fff;
}
.arq-servidor-s {
  font-size: 11.5px;
  font-weight: 500;
  fill: var(--ink-300);
}
.arq-bloque rect {
  fill: var(--ink-800);
  stroke: var(--ink-700);
  stroke-width: 1;
}
.arq-bt {
  font-size: 12.5px;
  font-weight: 700;
  fill: #fff;
}
.arq-bs {
  font-size: 11px;
  fill: #c3cad8;
}
.arq-bloque--pieza rect {
  fill: var(--orange-500);
  stroke: var(--orange-500);
}
.arq-bloque--pieza .arq-bt,
.arq-bloque--pieza .arq-bs {
  fill: var(--ink-950);
}
.arq-linea {
  fill: none;
  stroke: var(--ink-400);
  stroke-width: 1.6;
}
.arq-linea--punteada {
  stroke-dasharray: 4 4;
}
.arq-punta,
.arq-punta-clara {
  fill: var(--ink-400);
}
.como-lista {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  counter-reset: paso;
}
.como-lista li {
  position: relative;
  padding-left: 40px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-2);
  counter-increment: paso;
  text-wrap: pretty;
}
.como-lista li::before {
  content: counter(paso);
  position: absolute;
  left: 0;
  top: 0;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink-950);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.como-lista li:nth-child(4)::before {
  background: var(--orange-500);
  color: var(--ink-950);
}
.como-lista strong {
  color: var(--ink-950);
  font-weight: 650;
}
.como-nota {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-s);
  background: var(--orange-50);
  font-size: 13.5px;
  color: var(--ink-700);
}
.como-nota:empty {
  display: none;
}

/* ---------- Avisos ---------- */
.avisos {
  position: fixed;
  z-index: 60;
  top: 70px;
  right: 16px;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.aviso {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 10px 11px 14px;
  border-radius: 12px;
  background: var(--ink-950);
  color: #fff;
  box-shadow: var(--shadow-2);
  font-size: 13.5px;
  line-height: 1.4;
  animation: aviso-entra 0.25s var(--ease);
}
.aviso > .ico {
  margin-top: 1px;
  color: var(--orange-400);
}
.aviso--exito > .ico {
  color: #4ade80;
}
.aviso--error {
  background: #fff;
  color: var(--ink-950);
  border: 1px solid #fecdca;
  border-left: 4px solid var(--red-700);
}
.aviso--error > .ico {
  color: var(--red-700);
}
.aviso-texto {
  flex: 1;
  min-width: 0;
}
.aviso-accion {
  flex: none;
  border: 0;
  background: none;
  padding: 0 4px;
  color: var(--orange-400);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.aviso--error .aviso-accion {
  color: var(--orange-700);
}
.aviso-cerrar {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  opacity: 0.75;
  cursor: pointer;
}
.aviso-cerrar:hover {
  opacity: 1;
}
.aviso-cerrar .ico {
  width: 15px;
  height: 15px;
}
.conexion {
  position: fixed;
  z-index: 55;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 32px);
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-1);
  font-size: 13px;
  color: var(--ink-600);
}
.conexion--ok {
  border-color: #bbf7d0;
  color: var(--green-800);
}
.conexion--ok .giro {
  display: none;
}
.giro {
  width: 14px;
  height: 14px;
  flex: none;
  border: 2px solid var(--ink-250);
  border-top-color: var(--orange-500);
  border-radius: 50%;
  animation: girar 0.9s linear infinite;
}
.aviso-archivo {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--ink-950);
  color: #fff;
  box-shadow: var(--shadow-3);
  font-size: 14px;
  line-height: 1.55;
  opacity: 0;
  visibility: hidden;
  animation: aparecer-tarde 0.3s 2.5s forwards;
}
.aviso-archivo code {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgb(255 255 255 / 0.12);
  font-family: var(--mono);
  font-size: 0.92em;
}

/* ---------- Animaciones ---------- */
@keyframes girar {
  to {
    transform: rotate(360deg);
  }
}
@keyframes parpadeo {
  0%,
  80%,
  100% {
    opacity: 0.25;
  }
  40% {
    opacity: 1;
  }
}
@keyframes latido {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}
@keyframes msj-entra {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes paso-entra {
  from {
    opacity: 0;
    transform: translateX(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes destello {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgb(234 84 24 / 0);
  }
  30% {
    box-shadow: 0 0 0 3px rgb(234 84 24 / 0.45);
  }
}
@keyframes aparecer {
  from {
    opacity: 0;
  }
}
@keyframes hoja-sube {
  from {
    transform: translateY(100%);
  }
}
@keyframes dialogo-entra {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
}
@keyframes aviso-entra {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}
@keyframes aparecer-tarde {
  to {
    opacity: 1;
    visibility: visible;
  }
}

/* ---------- Escritorio: aplicación de una sola pantalla ---------- */
@media (min-width: 1180px) {
  body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
}
@media (min-width: 1180px) and (max-width: 1359px) {
  .paneles {
    grid-template-columns: minmax(310px, 336px) minmax(0, 1.8fr) minmax(280px, 1fr);
    gap: 12px;
    padding-inline: 14px;
  }
  .cabecera,
  .guiones-barra {
    padding-inline: 14px;
  }
}
@media (min-width: 1180px) and (max-height: 760px) {
  .panel-sub {
    display: none;
  }
}

/* ---------- Tableta: dos columnas y «Bajo el capó» debajo ---------- */
@media (min-width: 760px) and (max-width: 1179px) {
  .paneles {
    grid-template-columns: minmax(300px, 340px) minmax(0, 1fr);
    gap: 14px;
  }
  .panel--telefono,
  .panel--bandeja {
    height: clamp(600px, calc(100dvh - 150px), 880px);
  }
  .panel--traza {
    grid-column: 1 / -1;
    height: 600px;
  }
  .guiones {
    position: sticky;
    bottom: 0;
  }
}

/* ---------- Móvil: pestañas ---------- */
@media (max-width: 759px) {
  :root {
    --gutter: 12px;
  }
  body {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
  }
  .cabecera {
    gap: 8px;
    padding: 8px 12px 10px;
  }
  .cabecera-marca {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px 10px;
  }
  .cabecera-texto {
    display: contents;
  }
  .cabecera-logo {
    width: 80px;
  }
  .cabecera-sep {
    height: 20px;
  }
  .cabecera-titulo {
    flex: 1;
    min-width: 0;
    font-size: 0.86rem;
    font-stretch: 108%;
    line-height: 1.2;
  }
  .insignias {
    flex-basis: 100%;
  }
  .insignia-extra {
    display: none;
  }
  .cabecera-controles {
    order: 2;
    width: 100%;
  }
  .selector-negocio {
    flex: 1;
  }
  .selector-negocio select {
    max-width: none;
  }
  .cabecera-controles .btn {
    padding-inline: 10px;
  }
  .cabecera-controles .btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .insignias {
    gap: 4px;
  }
  .insignia {
    padding: 1px 7px 1px 6px;
    font-size: 11px;
  }
  .pestanas {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: #fff;
    border-bottom: 1px solid var(--border);
  }
  .pestana {
    font-size: 13px;
  }
  .panel--bandeja .panel-cab {
    padding-block: 8px;
  }
  .panel--bandeja .panel-titulo {
    font-size: 0.95rem;
  }
  .paneles {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 0;
  }
  .panel {
    display: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .panel.es-activo {
    display: flex;
  }
  .panel-cab {
    padding: 10px 12px 9px;
  }
  .panel-sub {
    display: none;
  }
  .panel--telefono .panel-cab {
    display: none;
  }
  .dispositivo {
    max-width: none;
    max-height: none;
    padding: 0;
    border-radius: 0;
    background: none;
    box-shadow: none;
  }
  .pantalla {
    border-radius: 0;
  }
  .barra-estado,
  .barra-inicio {
    display: none;
  }
  .chat-redactor {
    padding-bottom: 8px;
  }
  .chat-nuevos {
    bottom: 104px;
  }
  .hoja-pie {
    padding-bottom: 14px;
  }
  .traza-controles,
  .traza-resumen {
    padding-inline: 12px;
  }
  .traza-lista {
    padding: 10px;
  }
  .guiones-barra {
    gap: 8px;
    min-height: 54px;
    padding: 7px 12px;
  }
  .guiones-alternar {
    padding-inline: 10px;
  }
  .guiones-estado {
    font-size: 12.5px;
  }
  .guiones-estado strong,
  .guiones-nota {
    display: none;
  }
  .atajo {
    display: none;
  }
  .guiones-siguiente {
    padding-inline: 12px;
  }
  .guiones-cuerpo {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    max-height: 58dvh;
  }
  .guiones-pestanas {
    display: flex;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    scrollbar-width: thin;
  }
  .guion-pestana {
    flex: none;
    width: auto;
    max-width: 220px;
  }
  .guion-pestana span {
    display: none;
  }
  .guion-pestana[aria-selected='true'] {
    box-shadow: inset 0 -3px 0 var(--accent);
  }
  .guiones-panel {
    padding: 12px;
  }
  .pasos-guion {
    grid-template-columns: minmax(0, 1fr);
  }
  .dialogo-cab {
    padding: 16px 16px 10px;
  }
  .dialogo-cuerpo {
    padding: 4px 16px 18px;
  }
  .dialogo-pie {
    padding: 12px 16px 16px;
  }
  .dialogo-titulo {
    font-size: 1.3rem;
  }
  .arquitectura {
    padding: 10px 8px;
  }
  .arq--ancha {
    display: none;
  }
  .arq--angosta {
    display: block;
  }
  .avisos {
    top: auto;
    bottom: 70px;
    right: 16px;
  }
  .conexion {
    top: auto;
    bottom: 70px;
  }
}

@media (max-width: 400px) {
  .guiones-siguiente span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
