/* ════════════════════════════════════════════════════════════════════════════
   Asistente Pro — taller del asistente (/agentes/{id}) + lenguaje común ap-*.
   Rediseño 24/9 (handoff_acumulado/pantallas/02-asistente-taller.md).
   Solo tokens --gi-*; hex = colores de marca de canal (WA/IG/FB) y WhatsApp.
   Estas clases también las usan Canales (Conexiones.razor) y el panel de
   plantillas: los nombres se mantienen, cambia el lenguaje visual.
   ════════════════════════════════════════════════════════════════════════════ */
.ap-root { display: flex; flex-direction: column; min-height: 100%; }
.ap-spacer { flex: 1; }
.ap-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
              white-space: nowrap; margin: 0; }

/* ── Lenguaje común ───────────────────────────────────────────────────────── */
.ap-card { background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: var(--gi-radius, 14px);
           box-shadow: var(--gi-shadow-sm); padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.ap-card.clickable { cursor: pointer; transition: box-shadow .12s; }
.ap-card.clickable:hover { box-shadow: var(--gi-shadow-md); }
.ap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.ap-grid-wide { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.ap-stack { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }

/* Card-lista: filas separadas por una línea, la primera sin borde. */
.ap-list { background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: var(--gi-radius, 14px);
           box-shadow: var(--gi-shadow-sm); overflow: hidden; max-width: 860px; }
.ap-lrow { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto 16px; gap: 14px; align-items: center;
           padding: 14px 18px; border-top: 1px solid var(--gi-muted); background: transparent; width: 100%;
           text-align: left; font-family: inherit; color: inherit; text-decoration: none; cursor: pointer;
           border-left: 0; border-right: 0; border-bottom: 0; transition: background .12s; }
.ap-lrow:first-child { border-top: 0; }
.ap-lrow:hover { background: var(--gi-muted-2); }
.ap-lrow:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--gi-ring); }
.ap-lrow.no-chev { grid-template-columns: 38px minmax(0, 1fr) auto; }
.ap-lrow-title { font-size: 14.5px; font-weight: 600; color: var(--gi-fg-strong); }
.ap-lrow-sub { font-size: 13px; color: var(--gi-muted-fg); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }
.ap-lrow-chev { color: var(--gi-border-strong); font-size: 14px; }
.ap-lrow-right { display: inline-flex; align-items: center; gap: 10px; }

/* Tile de ícono */
.ap-tile { width: 38px; height: 38px; border-radius: 10px; background: var(--gi-muted); color: var(--gi-body);
           display: inline-flex; align-items: center; justify-content: center; font-size: 16px; flex: none; }
.ap-tile.on { background: var(--gi-accent); color: var(--gi-accent-fg); }

/* Pill de estado con punto */
.ap-pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px;
           border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
           color: var(--gi-body); background: var(--gi-muted); }
.ap-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--gi-faint); flex: none; }
.ap-pill-ok { color: var(--gi-success-text); background: var(--gi-success-bg); }
.ap-pill-ok::before { background: var(--gi-success); }
.ap-pill-warn { color: var(--gi-warning-text); background: var(--gi-warning-bg); }
.ap-pill-warn::before { background: var(--gi-warning); }
.ap-pill-off { color: var(--gi-body); background: var(--gi-muted); }
.ap-pill-off::before { background: var(--gi-faint); }

/* Títulos */
.ap-sec { margin: 2px 0 12px; }
.ap-sec-title { font-size: 16px; font-weight: 700; color: var(--gi-fg-strong); margin: 0; }
.ap-sec-sub { font-size: 13.5px; color: var(--gi-muted-fg); margin: 2px 0 0; }
.ap-grp-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
                color: var(--gi-muted-fg); margin: 18px 2px 8px; }

/* Botones */
.ap-btn-primary, .ap-btn-sec, .ap-btn-ghost, .ap-btn-sm {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: var(--gi-radius-sm, 8px); font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s; }
.ap-btn-primary { border: 1px solid transparent; background: var(--gi-primary); color: var(--gi-primary-fg); }
.ap-btn-primary:hover:not(:disabled) { background: var(--gi-primary-hover); }
.ap-btn-sec, .ap-btn-ghost { border: 1px solid var(--gi-border); background: var(--gi-card); color: var(--gi-fg); }
.ap-btn-sec:hover:not(:disabled), .ap-btn-ghost:hover:not(:disabled) { background: var(--gi-muted); }
.ap-btn-sm { height: 34px; padding: 0 12px; border: 1px solid var(--gi-border); background: var(--gi-card); color: var(--gi-fg); }
.ap-btn-sm:hover { background: var(--gi-muted); }
.ap-btn-sm.primary { border-color: transparent; background: var(--gi-primary); color: var(--gi-primary-fg); }
.ap-btn-sm.primary:hover { background: var(--gi-primary-hover); }
.ap-btn-primary:disabled, .ap-btn-sec:disabled, .ap-btn-sm:disabled { opacity: .55; cursor: not-allowed; }
.ap-btn-primary:focus-visible, .ap-btn-sec:focus-visible, .ap-btn-ghost:focus-visible, .ap-btn-sm:focus-visible,
.ap-tab:focus-visible, .ap-btn-icon:focus-visible, .ap-switch:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gi-ring); }

/* Switch */
.ap-switch { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 6px;
             border: 1px solid var(--gi-border); border-radius: 999px; background: var(--gi-card);
             font-size: 13px; font-weight: 600; color: var(--gi-muted-fg); cursor: pointer; font-family: inherit; }
.ap-switch.on { color: var(--gi-success-text); }
.ap-switch-track { width: 34px; height: 22px; border-radius: 999px; position: relative; flex: none;
                   background: var(--gi-border-strong); transition: background .15s; }
.ap-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
                          border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.ap-switch.on .ap-switch-track { background: var(--gi-success); }
.ap-switch.on .ap-switch-track::after { left: 15px; }

/* Segmentado */
.ap-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--gi-muted); flex-wrap: wrap; }
.ap-seg-opt { height: 30px; padding: 0 12px; border-radius: 7px; border: 0; background: transparent; cursor: pointer;
              font-size: 13px; font-weight: 600; color: var(--gi-muted-fg); font-family: inherit; white-space: nowrap; }
.ap-seg-opt:hover { color: var(--gi-fg-strong); }
.ap-seg-opt.on { background: var(--gi-card); color: var(--gi-fg-strong); box-shadow: var(--gi-shadow-sm); }
.ap-seg-opt:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--gi-ring); }

/* ── Header del taller ────────────────────────────────────────────────────── */
.ap-header { background: var(--gi-card); border-bottom: 1px solid var(--gi-border); padding: 14px 22px 0; }
.ap-header-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.ap-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 10px;
           border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
           font-family: inherit; border: 1px solid var(--gi-border); background: var(--gi-card); color: var(--gi-body); }
.ap-chip:hover { border-color: var(--gi-border-strong); }
.ap-chip.on { border-color: var(--gi-primary); background: var(--gi-accent); color: var(--gi-fg-strong); }
.ap-chip .bi { color: var(--gi-muted-fg); font-size: 13px; }
.ap-chip.on .bi { color: var(--gi-primary); }
.ap-chip-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--gi-border-strong); }
.ap-chip-dot.on { background: var(--gi-success); }
.ap-chip-add { width: 34px; height: 34px; border-radius: 999px; border: 1px dashed var(--gi-border-strong);
               background: var(--gi-card); color: var(--gi-muted-fg); cursor: pointer; text-decoration: none;
               display: inline-flex; align-items: center; justify-content: center; }
.ap-chip-add:hover { border-color: var(--gi-primary); color: var(--gi-primary); }

.ap-btn-test { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px;
               border-radius: var(--gi-radius-sm, 8px); border: 1px solid var(--gi-border); font-size: 13px; font-weight: 600;
               cursor: pointer; font-family: inherit; color: var(--gi-fg); background: var(--gi-card); }
.ap-btn-test:hover { background: var(--gi-muted); }
.ap-btn-test.open { background: var(--gi-primary); color: var(--gi-primary-fg); border-color: transparent; }
.ap-btn-test.open:hover { background: var(--gi-primary-hover); }
.ap-btn-icon { width: 36px; height: 36px; border-radius: var(--gi-radius-sm, 8px); border: 1px solid var(--gi-border);
               background: var(--gi-card); color: var(--gi-body); cursor: pointer; font-size: 15px;
               display: inline-flex; align-items: center; justify-content: center; }
.ap-btn-icon:hover { background: var(--gi-muted); }

/* Menú ⋯ */
.ap-menu-wrap { position: relative; }
.ap-menu { position: absolute; right: 0; top: 42px; z-index: 30; width: 240px;
           background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: 12px;
           box-shadow: var(--gi-shadow-lg); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.ap-menu-item { display: flex; align-items: center; gap: 9px; padding: 9px 10px; border-radius: 8px;
                font-size: 13px; color: var(--gi-body); cursor: pointer; text-decoration: none;
                border: none; background: none; font-family: inherit; text-align: left; }
.ap-menu-item:hover { background: var(--gi-muted); }
.ap-menu-item .bi { color: var(--gi-muted-fg); }
.ap-menu-danger, .ap-menu-danger .bi { color: var(--gi-danger-text); }
.ap-menu-danger:hover { background: var(--gi-danger-bg); }
.ap-menu-sep { height: 1px; background: var(--gi-border); margin: 4px 6px; }

/* Selector de asistente (celular) */
.ap-hdr-mob { display: none; }
.ap-agent-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0;
                font-family: inherit; font-size: 18px; font-weight: 700; color: var(--gi-fg-strong); cursor: pointer; min-width: 0; }
.ap-agent-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-agent-btn .bi { font-size: 14px; color: var(--gi-muted-fg); }
.ap-agent-menu { position: absolute; left: 0; top: 36px; z-index: 30; min-width: 240px; background: var(--gi-card);
                 border: 1px solid var(--gi-border); border-radius: 12px; box-shadow: var(--gi-shadow-lg); padding: 6px; }
.ap-agent-menu .ap-menu-item { height: 44px; }
.ap-agent-menu .ap-menu-item.on { background: var(--gi-accent); color: var(--gi-fg-strong); font-weight: 600; }

/* Save pill: texto en el header (sin caja cuando está guardado) */
.ap-save { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--gi-muted-fg); white-space: nowrap; }
.ap-save .bi-check2-circle { color: var(--gi-success); }
.ap-save.saving { color: var(--gi-body); }
.ap-save.error { color: var(--gi-danger-text); }

/* ── Solapas ──────────────────────────────────────────────────────────────── */
.ap-tabs { display: flex; gap: 2px; margin-top: 10px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--gi-border); }
.ap-tabs::-webkit-scrollbar { display: none; }
.ap-tab { flex: none; }
.ap-tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; border: none; background: none;
          cursor: pointer; font-family: inherit; font-size: 13.5px; font-weight: 500; color: var(--gi-muted-fg);
          white-space: nowrap; }
.ap-tab .bi { font-size: 14px; color: var(--gi-faint); }
.ap-tab:hover { color: var(--gi-fg-strong); }
.ap-tab.active { font-weight: 600; color: var(--gi-fg-strong); box-shadow: inset 0 -2px 0 var(--gi-primary); }
.ap-tab.active .bi { color: var(--gi-primary); }
.ap-tab-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gi-warning); display: inline-block; }
.ap-tab-short { display: none; }

/* ── Cuerpo: contenido + aside de prueba ──────────────────────────────────── */
.ap-body { flex: 1; display: flex; min-height: 0; }
.ap-content { flex: 1; min-width: 0; padding: 20px 22px 30px; position: relative; }

/* ── Resumen ──────────────────────────────────────────────────────────────── */
.ap-hero2 { display: flex; align-items: center; gap: 18px; padding: 22px; max-width: 860px; margin-bottom: 16px;
            background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: var(--gi-radius, 14px);
            box-shadow: var(--gi-shadow-sm); }
.ap-hero2-tile { width: 60px; height: 60px; border-radius: 16px; background: var(--gi-accent); color: var(--gi-accent-fg);
                 display: flex; align-items: center; justify-content: center; font-size: 28px; flex: none; }
.ap-hero2-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ap-hero2-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ap-hero2-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--gi-fg-strong);
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-hero2-pencil { width: 28px; height: 28px; border-radius: 7px; border: 0; background: transparent; color: var(--gi-faint);
                   cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.ap-hero2-pencil:hover { background: var(--gi-muted); color: var(--gi-fg); }
.ap-hero2-edit { display: flex; align-items: center; gap: 8px; }
.ap-hero2-input { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border: 1px solid var(--gi-primary);
                  box-shadow: 0 0 0 3px var(--gi-ring); border-radius: var(--gi-radius-sm, 8px); background: var(--gi-card);
                  color: var(--gi-fg-strong); font-size: 16px; font-weight: 600; font-family: inherit; outline: none; }
.ap-hero2-desc { font-size: 14px; color: var(--gi-body); }
.ap-hero2-prog { display: flex; align-items: center; gap: 12px; margin-top: 6px; font-size: 12.5px; color: var(--gi-muted-fg); }
.ap-hero2-prog b { color: var(--gi-fg-strong); font-weight: 700; }
.ap-hero2-bar { width: 180px; height: 6px; border-radius: 999px; background: var(--gi-muted); overflow: hidden; flex: none; }
.ap-hero2-bar > div { height: 100%; border-radius: 999px; background: var(--gi-primary); }
.ap-hero2-err { font-size: 12.5px; color: var(--gi-danger-text); }
.ap-hero2-guided .bi { color: var(--gi-primary); }

/* Resumen viejo (Canales lo sigue usando) */
.ap-hero { display: flex; align-items: center; gap: 14px; background: var(--gi-card);
           border: 1px solid var(--gi-border); border-radius: var(--gi-radius, 14px); padding: 16px 18px; margin-bottom: 16px; }
.ap-hero-name { font-size: 16px; font-weight: 800; color: var(--gi-fg-strong); }
.ap-hero-desc { font-size: 12.5px; color: var(--gi-muted-fg); }
.ap-progress-lbl { font-size: 11px; font-weight: 600; color: var(--gi-faint); text-transform: uppercase; letter-spacing: .05em; }
.ap-progress-n { font-size: 20px; font-weight: 800; color: var(--gi-fg-strong); }
.ap-progress { width: 120px; height: 8px; border-radius: 4px; background: var(--gi-muted); overflow: hidden; }
.ap-progress > div { height: 8px; background: var(--gi-primary); }
.ap-check-title { font-size: 13px; font-weight: 700; color: var(--gi-fg-strong); }
.ap-check-text { font-size: 12px; color: var(--gi-muted-fg); line-height: 1.4; }
.ap-check-cta { font-size: 12.5px; font-weight: 600; color: var(--gi-accent-fg); margin-top: auto; text-decoration: none; }
.ap-check { padding: 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer; min-height: 118px;
            text-decoration: none; color: inherit; transition: box-shadow .12s; text-align: left; }
.ap-check:hover { box-shadow: var(--gi-shadow-md); }
.ap-check-head { display: flex; align-items: center; gap: 8px; }
.ap-check-head .bi { font-size: 15px; }

/* ── Canales ──────────────────────────────────────────────────────────────── */
.ap-chan-ico { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center;
               justify-content: center; font-size: 20px; color: #fff; flex: none; }
.ap-chan-ico.whatsapp { background: #25D366; }
.ap-chan-ico.instagram { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.ap-chan-ico.facebook { background: #1877F2; }
.ap-chan-row { grid-template-columns: 42px minmax(0, 1fr) auto; cursor: default; }
.ap-chan-row:hover { background: transparent; }
.ap-chan-name { font-size: 14.5px; font-weight: 600; color: var(--gi-fg-strong); }
.ap-chan-detail { font-size: 13px; color: var(--gi-muted-fg); margin-top: 1px; }
.ap-chan-panel { padding: 16px 18px; background: var(--gi-muted-2); border-top: 1px solid var(--gi-muted); }
/* compat: fila suelta vieja */
.ap-chan { display: flex; align-items: center; gap: 12px; background: var(--gi-card);
           border: 1px solid var(--gi-border); border-radius: 12px; padding: 12px 14px; }

/* ── Habilidades (StudioStep2 embebido): el pie Volver/Siguiente sobra ────── */
.ap-skills .ss2-foot { display: none; }

/* ── Diseño de respuestas ─────────────────────────────────────────────────── */
.ap-design-preview { background: var(--gi-muted-2); border-radius: 8px; padding: 8px 10px; font-size: 11.5px;
                     color: var(--gi-body); line-height: 1.45; white-space: pre-line; }

/* ── Operación ────────────────────────────────────────────────────────────── */
.ap-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 860px; margin-bottom: 16px; }
.ap-kpi { padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.ap-kpi-head { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--gi-body); }
.ap-kpi-head .bi { color: var(--gi-muted-fg); }
.ap-kpi-n { font-size: 32px; font-weight: 700; color: var(--gi-fg-strong); font-variant-numeric: tabular-nums; line-height: 1.15; }
.ap-kpi-sub { font-size: 13px; color: var(--gi-muted-fg); }
.ap-kpi-link { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--gi-accent-fg); text-decoration: none;
               display: inline-flex; align-items: center; gap: 5px; }
.ap-kpi-link:hover { text-decoration: underline; }
.ap-op-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

/* ── Panel de detalle ("← Volver") ────────────────────────────────────────── */
.ap-panel { position: absolute; inset: 0; background: var(--gi-muted-2); padding: 20px 22px;
            animation: ap-slide .18s ease-out; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
@keyframes ap-slide { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.ap-panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ap-back { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px 0 10px; border-radius: 8px;
           border: 1px solid var(--gi-border); background: var(--gi-card); color: var(--gi-fg);
           font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.ap-back:hover { background: var(--gi-muted); }
.ap-crumb { font-size: 13px; color: var(--gi-faint); }
.ap-panel-title { font-size: 14px; font-weight: 700; color: var(--gi-fg-strong); }
.ap-saved { margin-left: auto; font-size: 12px; color: var(--gi-success-text); font-weight: 600; }
.ap-panel-body { background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: var(--gi-radius, 14px);
                 padding: 18px; max-width: 680px; display: flex; flex-direction: column; gap: 12px; }
.ap-panel-foot { display: flex; gap: 8px; justify-content: flex-end; }
.ap-panel-card { background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: var(--gi-radius, 14px);
                 box-shadow: var(--gi-shadow-sm); overflow: hidden; }
.ad-content.ap-panel-inline { animation: ap-slide .18s ease-out; }
.ad-content:focus { outline: none; }

/* ── Aside de prueba ──────────────────────────────────────────────────────── */
.ap-test { width: 340px; flex: none; background: var(--gi-card); border-left: 1px solid var(--gi-border);
           display: flex; flex-direction: column; min-height: 520px; }
.ap-test-head { position: relative; display: flex; align-items: center; gap: 10px; height: 56px; padding: 0 12px 0 16px;
                border-bottom: 1px solid var(--gi-border); flex: none; }
.ap-test-titles { flex: 1; min-width: 0; }
.ap-test-title { display: block; font-size: 14px; font-weight: 700; color: var(--gi-fg-strong);
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-test-live { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--gi-muted-fg); }
.ap-test-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--gi-success); display: inline-block; }
.ap-test-close { width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--gi-muted-fg);
                 cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; flex: none; }
.ap-test-close:hover { background: var(--gi-muted); color: var(--gi-fg); }
.ap-test-close .bi-chevron-down { display: none; }
.ap-test-note { display: none; }
/* El chat (AgentTestChatPanel) trae su propio header de WhatsApp: el aside ya
   dice a quién se prueba, así que el avatar/nombre se ocultan y sus botones
   (QR, limpiar, reiniciar) quedan arriba, al lado del cerrar. */
.ap-test .gi-phone { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 0; border-radius: 0;
                     box-shadow: none; background: #EFEAE2; max-width: none; width: 100%; height: auto; }
.ap-test .gi-wa-header { position: absolute; top: 12px; right: 50px; left: auto; width: auto; z-index: 2; height: 32px; padding: 0; gap: 2px;
                         background: transparent; border: 0; box-shadow: none; min-height: 0; }
.ap-test .gi-wa-avatar, .ap-test .gi-wa-id, .ap-test .gi-wa-back { display: none; }
.ap-test .gi-wa-iconbtn { width: 32px; height: 32px; border-radius: 8px; color: var(--gi-muted-fg); background: transparent; }
.ap-test .gi-wa-iconbtn:hover { background: var(--gi-muted); color: var(--gi-fg); }
.ap-test .gi-wa-body { background: #EFEAE2; }
.ap-test .gi-wa-row.me .gi-wa-bubble { background: #D9FDD3; color: #111b21; border-radius: 10px 10px 2px 10px; }
.ap-test .gi-wa-row.bot .gi-wa-bubble { background: #fff; color: #111b21; border-radius: 10px 10px 10px 2px; }
.ap-test .gi-wa-time { color: #667781; }
.ap-test .gi-wa-input { background: var(--gi-card); border-top: 1px solid var(--gi-border); }
.ap-test .gi-wa-text { border-radius: 999px; border: 1px solid var(--gi-border); background: var(--gi-card); color: var(--gi-fg); height: 42px; }
.ap-test .gi-wa-send { width: 42px; height: 42px; border-radius: 50%; background: var(--gi-primary); color: var(--gi-primary-fg); }
:root[data-theme="dark"] .ap-test .gi-phone, :root[data-theme="dark"] .ap-test .gi-wa-body { background: #0B141A; }
:root[data-theme="dark"] .ap-test .gi-wa-row.me .gi-wa-bubble { background: #005C4B; color: #E9EDEF; }
:root[data-theme="dark"] .ap-test .gi-wa-row.bot .gi-wa-bubble { background: #202C33; color: #E9EDEF; }
:root[data-theme="dark"] .ap-test .gi-wa-time { color: #8696A0; }
.ap-test-fab { display: none; }
@keyframes ap-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@media (max-width: 1100px) {
  .ap-test { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 94vw); z-index: 3050;
             box-shadow: -12px 0 40px rgba(15,23,42,.18); }
  .ap-test-backdrop { position: fixed; inset: 0; background: rgba(15,23,42,.4); z-index: 3040; }
}

/* ── Celular (hasta 640px) ────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .ap-chips, .ap-chip-add, .ap-btn-test { display: none !important; }
  .ap-hdr-mob { display: flex; align-items: center; gap: 8px; position: relative; flex: 1; min-width: 0; }
  .ap-header-row { flex-wrap: nowrap; gap: 8px; }
  .ap-header-row > .ap-spacer { display: none; }
  /* "Guardado" ocupa el lugar del ⋯ mientras hay cambios recientes */
  .ap-header-row:has(.ap-save) .ap-menu-wrap { display: none; }
  .ap-switch { height: auto; padding: 0; border: 0; background: none; }
  .ap-switch > span:not(.ap-switch-track) { display: none; }
  .ap-switch-track { width: 44px; height: 26px; }
  .ap-switch-track::after { width: 20px; height: 20px; }
  .ap-switch.on .ap-switch-track::after { left: 21px; }
  .ap-btn-icon { width: 40px; height: 40px; }
  .ap-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 8px -16px 0; padding: 0 12px; }
  .ap-tabs::-webkit-scrollbar { display: none; }
  .ap-tab { font-size: 14px; padding: 10px; }
  .ap-tab .bi { display: none; }
  .ap-tab .ap-tab-dot { display: inline-block; }
  .ap-tab-long { display: none; }
  .ap-tab-short { display: inline; }

  .ap-list, .ap-card, .ap-hero2, .ap-panel-card { border-radius: 16px; }
  .ap-lrow { padding: 12px 14px; gap: 12px; }
  .ap-lrow .ap-lrow-chev { display: none; }
  .ap-lrow { grid-template-columns: 38px minmax(0, 1fr) auto; }
  .ap-hero2 { flex-wrap: wrap; padding: 16px; gap: 12px; }
  .ap-hero2-tile { width: 48px; height: 48px; border-radius: 14px; font-size: 22px; }
  .ap-hero2-name { font-size: 18px; }
  .ap-hero2-guided { display: none; }
  .ap-hero2-prog { flex-basis: 100%; }
  .ap-hero2-bar { flex: 1; width: auto; }
  .ap-hero2-edit { flex-wrap: wrap; }
  .ap-hero2-input { flex-basis: 100%; }
  .ap-kpis { grid-template-columns: 1fr; }
  .ap-chan-row .ap-pill { display: none; }

  /* Prueba: botón flotante + chat a pantalla completa */
  .ap-test-fab { display: inline-flex; align-items: center; gap: 8px; position: fixed; right: 16px; z-index: 45;
                 /* encima del botón de ayuda, que vive en la misma esquina */
                 bottom: calc(80px + env(safe-area-inset-bottom)); height: 48px; padding: 0 20px; border: 0;
                 border-radius: 999px; background: var(--gi-primary); color: var(--gi-primary-fg);
                 font-size: 15px; font-weight: 700; font-family: inherit; box-shadow: var(--gi-shadow-lg); cursor: pointer; }
  .ap-test { inset: 0; width: 100%; max-width: none; border: 0; z-index: 3200; animation: ap-sheet .22s ease-out; }
  .ap-test-backdrop { display: none !important; }
  .ap-test-head { height: 60px; padding: 0 12px; }
  .ap-test-close { order: -1; }
  .ap-test-close .bi-x-lg { display: none; }
  .ap-test-close .bi-chevron-down { display: inline-block; font-size: 18px; }
  .ap-test .gi-wa-header { right: 12px; top: 14px; }
  .ap-test-note { display: block; align-self: center; margin: 10px auto 0; padding: 3px 10px; border-radius: 6px;
                  background: rgba(255,255,255,.85); color: #54656f; font-size: 12px; position: relative; z-index: 1; }
  .ap-test:has(.ap-test-note) .gi-phone { margin-top: -30px; padding-top: 30px; }
}
@keyframes ap-sheet { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .ap-test, .ad-content.ap-panel-inline, .ap-panel { animation: none; } }
