/* ════════════════════════════════════════════════════════════════════════════
   Asistente Pro — workspace single-page /agentes
   Destino: Gestion_Integraciones.Server/wwwroot/css/asistente-pro.css
   Referencia: "Asistente Pro.dc.html". Solo tokens --gi-*; hex = colores de
   marca de canal / semánticos por tab.
   ════════════════════════════════════════════════════════════════════════════ */
.ap-root { display: flex; flex-direction: column; min-height: 100%; }

/* ── Header ───────────────────────────────────────────────────────────────── */
.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: 12px; flex-wrap: wrap; }
.ap-spacer { flex: 1; }

.ap-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ap-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 8px;
           border-radius: 999px; font-size: 12.5px; font-weight: 500; cursor: pointer;
           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(--brand, #E0714E); font-weight: 700;
              background: var(--brand-subtle, rgba(224,113,78,.1));
              color: var(--brand-dark, #C25438); }
.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, #10B981); }
.ap-chip-add { width: 32px; height: 32px; border-radius: 999px; border: 1px dashed var(--gi-border-strong);
               background: var(--gi-card); color: var(--gi-muted-fg); cursor: pointer;
               display: inline-flex; align-items: center; justify-content: center; }
.ap-chip-add:hover { border-color: var(--brand); color: var(--brand); }

/* Switch (Activo/Pausado y toggles de habilidad) */
.ap-switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12px;
             font-weight: 600; color: var(--gi-body); cursor: pointer; }
.ap-switch-track { width: 34px; height: 20px; border-radius: 999px; position: relative;
                   background: var(--gi-border-strong); transition: background .15s; }
.ap-switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px;
                          height: 16px; border-radius: 50%; background: #fff;
                          box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.ap-switch.on .ap-switch-track { background: var(--gi-success, #10B981); }
.ap-switch.on .ap-switch-track::after { left: 16px; }

.ap-btn-test { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
               border-radius: 10px; border: none; font-size: 12.5px; font-weight: 700;
               cursor: pointer; font-family: inherit; color: #fff;
               background: var(--brand, #E0714E); box-shadow: var(--gi-shadow-sm); }
.ap-btn-test.open { background: var(--gi-fg-strong); }
.ap-btn-icon { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--gi-border);
               background: var(--gi-card); color: var(--gi-muted-fg); cursor: pointer; font-size: 15px; }
.ap-btn-icon:hover { background: var(--gi-muted); }

/* Menú ⋯ */
.ap-menu-wrap { position: relative; }
.ap-menu { position: absolute; right: 0; top: 40px; z-index: 30; width: 230px;
           background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: 12px;
           box-shadow: var(--gi-shadow-lg, 0 10px 30px rgba(15,23,42,.15)); padding: 6px;
           display: flex; flex-direction: column; gap: 2px; }
.ap-menu-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px;
                border-radius: 8px; font-size: 12.5px; color: var(--gi-body); cursor: pointer;
                border: none; background: none; font-family: inherit; text-align: left; }
.ap-menu-item:hover { background: var(--gi-muted); }
.ap-menu-item.danger { color: #DC2626; }
.ap-menu-item.danger:hover { background: var(--gi-danger-bg); }
.ap-menu-sep { height: 1px; background: var(--gi-border); margin: 4px 6px; }

/* Tabs */
.ap-tabs { display: flex; gap: 2px; margin-top: 12px; flex-wrap: wrap; }
.ap-tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border: none;
          background: none; cursor: pointer; font-family: inherit; font-size: 12.5px;
          font-weight: 500; color: var(--gi-body); border-bottom: 2px solid transparent; }
.ap-tab:hover { color: var(--gi-fg-strong); }
.ap-tab.active { font-weight: 700; color: var(--brand-dark, #C25438);
                 border-bottom-color: var(--brand, #E0714E); }
.ap-tab-dot { width: 6px; height: 6px; border-radius: 50%; background: #F59E0B; display: inline-block; }
/* colores de ícono por tab */
.ap-tab-canales .bi { color: #0284c7; } .ap-tab-habilidades .bi { color: #F59E0B; }
.ap-tab-personalidad .bi { color: #EC4899; } .ap-tab-respuestas .bi { color: #7C3AED; }
.ap-tab-operacion .bi { color: #10B981; }
@media (max-width: 640px) {
  .ap-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .ap-tabs::-webkit-scrollbar { 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; }

.ap-card { background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: 12px;
           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: 720px; }

/* Resumen */
.ap-hero { display: flex; align-items: center; gap: 14px; background: var(--gi-card);
           border: 1px solid var(--gi-border); border-radius: 14px; padding: 16px 18px; margin-bottom: 16px; }
.ap-hero-emoji { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center;
                 justify-content: center; font-size: 24px; flex: none;
                 background: var(--brand-subtle, rgba(224,113,78,.1)); }
.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-success, #10B981); }

.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: 12px; font-weight: 600; color: var(--brand, #E0714E); margin-top: auto; }
.ap-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700;
           padding: 1px 8px; border-radius: 999px; }
.ap-pill-ok { color: var(--gi-success-text); background: var(--gi-success-bg); }
.ap-pill-warn { color: var(--gi-warning-text); background: var(--gi-warning-bg); }
.ap-pill-off { color: var(--gi-body); background: var(--gi-muted); }

/* Canales */
.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; }
.ap-chan-ico { width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center;
               justify-content: center; font-size: 18px; color: #fff; flex: none; }
.ap-chan-ico.whatsapp { background: #25D366; } .ap-chan-ico.instagram { background: #E1306C; }
.ap-chan-ico.facebook { background: #1877F2; } .ap-chan-ico.haceloapp { background: var(--brand, #E0714E); }
.ap-chan-name { font-size: 13px; font-weight: 700; color: var(--gi-fg-strong); }
.ap-chan-detail { font-size: 11.5px; color: var(--gi-muted-fg); }
.ap-btn-sm { padding: 6px 12px; border-radius: 8px; border: 1px solid var(--gi-border);
             background: var(--gi-card); color: var(--gi-body); font-size: 12px; font-weight: 600;
             cursor: pointer; font-family: inherit; }
.ap-btn-sm:hover { background: var(--gi-muted); }

/* Habilidades */
.ap-skill.off { opacity: .6; }
.ap-skill-ico { width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center;
                justify-content: center; font-size: 14px; }
.ap-skill-name { font-size: 13px; font-weight: 700; color: var(--gi-fg-strong); }
.ap-skill-desc { font-size: 12px; color: var(--gi-muted-fg); line-height: 1.4; }

/* Personalidad */
.ap-sec-title { font-size: 13px; font-weight: 700; color: var(--gi-fg-strong); }
.ap-tone { padding: 6px 12px; border-radius: 999px; font-size: 12px; cursor: pointer; font-family: inherit;
           border: 1px solid var(--gi-border); background: var(--gi-card); color: var(--gi-body); }
.ap-tone.on { border-color: var(--brand); background: var(--brand-subtle); color: var(--brand-dark); font-weight: 700; }
              color: var(--gi-body); line-height: 1.5; background: var(--gi-muted-2); min-height: 60px; }
.ap-btn-dashed { align-self: flex-start; padding: 6px 11px; border-radius: 8px; border: 1px dashed var(--gi-border-strong);
                 background: var(--gi-card); color: var(--gi-muted-fg); font-size: 12px; cursor: pointer; font-family: inherit; }

/* 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-kpi-n { font-size: 22px; font-weight: 800; color: var(--gi-fg-strong); }
.ap-kpi-sub { font-size: 11.5px; color: var(--gi-muted-fg); }

/* ── 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; }
.ap-back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px 6px 8px; border-radius: 8px;
           border: 1px solid var(--gi-border); background: var(--gi-card); color: var(--gi-body);
           font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.ap-back:hover { background: var(--gi-muted-2); }
.ap-crumb { font-size: 12px; color: var(--gi-faint); }
.ap-panel-title { font-size: 13px; font-weight: 700; color: var(--gi-fg-strong); }
.ap-saved { margin-left: auto; font-size: 11.5px; color: var(--gi-success, #10B981); font-weight: 600; }
.ap-panel-body { background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: 12px;
                 padding: 18px; max-width: 680px; display: flex; flex-direction: column; gap: 12px; }
.ap-panel-foot { display: flex; gap: 8px; justify-content: flex-end; }
.ap-btn-primary { padding: 8px 14px; border-radius: 9px; border: none; background: var(--brand, #E0714E);
                  color: #fff; font-size: 12.5px; font-weight: 700; cursor: pointer; font-family: inherit; }
.ap-btn-primary:hover { background: var(--brand-dark, #C25438); }
.ap-btn-ghost { padding: 8px 14px; border-radius: 9px; border: 1px solid var(--gi-border); background: var(--gi-card);
                color: var(--gi-body); font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }

/* ── 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 { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--gi-border); }
.ap-test-title { font-size: 12.5px; font-weight: 700; color: var(--gi-fg-strong); }
.ap-test-live { font-size: 10.5px; color: var(--gi-success, #10B981); font-weight: 600; }
.ap-test-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--gi-success, #10B981);
                  display: inline-block; animation: ap-pulse 2s infinite; }
@keyframes ap-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.ap-test-body { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 8px;
                background: var(--gi-muted-2); overflow-y: auto; }
.ap-msg { max-width: 86%; padding: 8px 11px; border-radius: 12px; font-size: 12.5px; line-height: 1.45; }
.ap-msg-bot { align-self: flex-start; background: var(--gi-card); color: var(--gi-fg); border-bottom-left-radius: 3px; }
.ap-msg-user { align-self: flex-end; background: var(--brand, #E0714E); color: #fff; border-bottom-right-radius: 3px; }
.ap-test-foot { padding: 10px 12px; border-top: 1px solid var(--gi-border); display: flex; gap: 8px; }
.ap-test-input { flex: 1; height: 36px; border: 1px solid var(--gi-border); border-radius: 9px; padding: 0 12px;
                 font-size: 12.5px; font-family: inherit; background: var(--gi-card); color: var(--gi-fg); }
.ap-test-send { width: 36px; height: 36px; border-radius: 9px; border: none; background: var(--brand, #E0714E);
                color: #fff; cursor: pointer; }
@media (max-width: 1100px) {
  .ap-test { position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 94vw); z-index: 51;
             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: 50; }
}

/* ── Taller (9/9): el panel de detalle entra deslizándose y ESC vuelve; la
   solapa Personalidad son tres cards + "Avanzado" plegable. ─────────────── */
.ad-content.ap-panel-inline { animation: ap-slide .18s ease-out; }
.ad-content:focus { outline: none; }

/* ── Header del taller (9/9, referencia "Asistente Pro") ──────────────────── */
.ap-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);
              white-space: nowrap; margin: 0; }
.ap-header-row { margin-bottom: 4px; }
.ap-chip .bi { color: var(--brand, #E0714E); font-size: 13px; }
/* Abierto = fondo "fuerte" (oscuro en claro, claro en oscuro): el texto toma el color de la card, que es el opuesto. */
.ap-btn-test.open { color: var(--gi-card, #fff); }
.ap-menu-danger { color: #b91c1c; }
.ap-tab .bi { font-size: 13px; }
.ap-tab-resumen .bi { color: var(--gi-muted-fg); }

/* ── Habilidades como grid de cards: las filas del editor del Studio (.ss2-row)
   se acomodan en un grid y cada una se viste de card. Todo lo que no es una
   fila (cabecera, búsqueda, títulos de sección, grupos, pie) ocupa el ancho. ── */
.ap-skills .ss2-stage { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.ap-skills .ss2-stage > :not(.ss2-row) { grid-column: 1 / -1; }
.ap-skills .ss2-grp-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.ap-skills .ss2-sect { margin: 6px 0 -4px; }
.ap-skills .ss2-row { background: var(--gi-card); border: 1px solid var(--gi-border); border-radius: 12px;
                      padding: 14px; margin: 0; gap: 8px 10px; grid-template-columns: 30px minmax(0, 1fr) auto;
                      align-items: start; transition: box-shadow .12s, opacity .12s; }
.ap-skills .ss2-row:hover { background: var(--gi-card); box-shadow: 0 6px 18px rgba(15, 23, 42, .08); }
.ap-skills .ss2-row:not(.ss2-grp-head):not(:has(.ss2-sw.is-on)) { opacity: .6; }
.ap-skills .ss2-row:not(.ss2-grp-head):not(:has(.ss2-sw.is-on)):hover { opacity: 1; }
.ap-skills .ss2-row-ico { width: 30px; height: 30px; border-radius: 8px; background: var(--gi-muted-2);
                          display: inline-flex; align-items: center; justify-content: center; font-size: 14px; }
.ap-skills .ss2-row-desc { max-width: none; }
.ap-skills .ss2-act { border: 1px solid var(--gi-border); border-radius: 7px; padding: 5px 10px;
                      text-decoration: none; background: var(--gi-card); font-size: 11.5px; color: var(--gi-body); }
.ap-skills .ss2-act:hover:not(:disabled) { background: var(--gi-muted-2); }
.ap-skills .ss2-grp { border-top: 0; }
.ap-skills .ss2-grp-head { background: transparent; border: 0; padding: 6px 0; }
.ap-skills .ss2-grp-head:hover { box-shadow: none; }
.ap-skills .ss2-foot { display: none; }

/* ── Diseño de respuestas: cards ───────────────────────────────────────────── */
.rd-cards .rd-card { padding: 14px; display: flex; flex-direction: column; gap: 8px; cursor: pointer;
                     text-align: left; font-family: inherit; transition: box-shadow .12s; }
.rd-cards .rd-card:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, .08); }
.rd-card-head { display: flex; align-items: center; gap: 8px; }
.rd-card-head .bi { color: #7C3AED; }
.rd-card-empty .ap-design-preview { display: none; }
.rd-card-add { align-items: center; justify-content: center; flex-direction: row; gap: 8px;
               border-style: dashed; color: var(--gi-muted-fg); font-size: 12.5px; font-weight: 600; min-height: 90px; }
.rd-card-add:hover { color: var(--brand); border-color: var(--brand); }

/* ── Operación: KPIs ───────────────────────────────────────────────────────── */
.ap-kpi { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.ap-kpi-head { display: flex; align-items: center; gap: 8px; }
.ap-op-links { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.ap-op-links .ap-btn-ghost { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }

/* ── Resumen: card del asistente + checklist ──────────────────────────────── */
.ap-card.ap-hero-card { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 18px;
                        padding: 16px 18px; margin-bottom: 16px; text-align: left; }
.ap-hero-emoji .bi { color: var(--brand, #E0714E); }
.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: 0 6px 18px rgba(15, 23, 42, .08); }
.ap-check-head { display: flex; align-items: center; gap: 8px; }
.ap-check-head .bi { font-size: 15px; }
/* El interruptor es un <button>: sin el borde/fondo gris por defecto del navegador. */
.ap-switch { border: none; background: transparent; padding: 0; font-family: inherit; cursor: pointer; color: var(--gi-body); }

