:root{
  --ai-bg:#f4f6fb;
  --ai-bg2:#eef2f8;
  --ai-surface:#ffffff;
  --ai-surface2:#f8fafc;
  --ai-text:#0f172a;
  --ai-muted:#64748b;
  --ai-soft:#e2e8f0;
  --ai-border:rgba(15,23,42,.10);
  --ai-border2:rgba(15,23,42,.16);
  --ai-brand:#d63384;
  --ai-brand2:#6d2f88;
  --ai-deep:#06063f;
  --ai-ok:#16a34a;
  --ai-warn:#d97706;
  --ai-danger:#dc2626;
  --ai-info:#2563eb;
  --ai-shadow:0 24px 70px rgba(15,23,42,.10);
  --ai-shadow2:0 14px 38px rgba(15,23,42,.08);
  --ai-radius:28px;
}

*{box-sizing:border-box}

html,
body{
  height:100%;
}

body{
  margin:0;
  overflow:hidden;
  background:
    radial-gradient(circle at 20% 0%, rgba(214,51,132,.10), transparent 34%),
    radial-gradient(circle at 95% 12%, rgba(109,47,136,.10), transparent 30%),
    linear-gradient(180deg,var(--ai-bg),var(--ai-bg2));
  color:var(--ai-text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

button,
textarea,
select{
  font:inherit;
}

button{
  cursor:pointer;
}

.aiCoreShell{
  height:100vh;
  display:grid;
  grid-template-columns:320px minmax(0,1fr);
  overflow:hidden;
}

.aiCoreSidebar{
  height:100vh;
  padding:24px;
  background:
    radial-gradient(circle at top left, rgba(214,51,132,.28), transparent 28%),
    linear-gradient(180deg,#08084f,#050533);
  color:#fff;
  display:flex;
  flex-direction:column;
  gap:18px;
  overflow:hidden;
}

.aiCoreBrand{
  display:flex;
  align-items:center;
  gap:14px;
}

.aiCoreLogo{
  width:54px;
  height:54px;
  border-radius:20px;
  display:grid;
  place-items:center;
  font-weight:1000;
  letter-spacing:.02em;
  background:linear-gradient(135deg,var(--ai-brand),var(--ai-brand2));
  box-shadow:0 18px 42px rgba(214,51,132,.28);
}

.aiCoreBrand strong,
.aiCoreBrand span{
  display:block;
}

.aiCoreBrand strong{
  font-size:17px;
}

.aiCoreBrand span{
  margin-top:3px;
  font-size:13px;
  color:rgba(255,255,255,.66);
}

.aiCorePanel{
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.11);
  border-radius:24px;
  padding:16px;
  display:grid;
  gap:10px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06);
}

.aiCorePanel label,
.aiCorePanelTitle,
.aiCoreEyebrow{
  font-size:12px;
  font-weight:950;
  text-transform:uppercase;
  letter-spacing:.11em;
}

.aiCorePanel label,
.aiCorePanelTitle{
  color:rgba(255,255,255,.70);
}

.aiCoreEyebrow{
  color:var(--ai-muted);
}

.aiCorePanel select{
  width:100%;
  border:1px solid rgba(255,255,255,.14);
  border-radius:16px;
  padding:13px 14px;
  background:#fff;
  color:#111827;
  outline:none;
}

.aiCorePanel select:focus,
.aiCoreComposer textarea:focus{
  border-color:rgba(214,51,132,.50);
  box-shadow:0 0 0 4px rgba(214,51,132,.10);
}

.aiCorePrimaryBtn{
  border:0;
  border-radius:999px;
  padding:13px 18px;
  color:#fff;
  font-weight:950;
  background:linear-gradient(135deg,var(--ai-brand),var(--ai-brand2));
  box-shadow:0 18px 38px rgba(214,51,132,.25);
}

.aiCorePrimaryBtn:disabled{
  opacity:.62;
  cursor:not-allowed;
}

.aiCoreGhostBtn{
  border:1px solid var(--ai-border);
  background:rgba(255,255,255,.80);
  color:var(--ai-text);
  border-radius:999px;
  padding:11px 14px;
  font-weight:850;
  box-shadow:0 10px 26px rgba(15,23,42,.05);
}

.aiCoreThreadsPanel{
  min-height:0;
  flex:1;
  overflow:hidden;
}

.aiCoreThreads{
  min-height:0;
  overflow:auto;
  display:grid;
  gap:10px;
  padding-right:4px;
}

.aiCoreThreadItem{
  display:block;
  width:100%;
  border:1px solid rgba(255,255,255,.09);
  text-align:left;
  padding:13px 14px;
  border-radius:18px;
  background:rgba(255,255,255,.08);
  color:rgba(255,255,255,.90);
  cursor:pointer;
  transition:.18s ease;
}

.aiCoreThreadItem:hover{
  transform:translateY(-1px);
  background:rgba(255,255,255,.12);
}

.aiCoreThreadItem.isActive{
  background:#fff;
  color:#111827;
  box-shadow:0 18px 36px rgba(0,0,0,.20);
}

.aiCoreThreadItem strong{
  display:block;
  font-size:14px;
  line-height:1.28;
}

.aiCoreThreadItem span{
  display:block;
  margin-top:5px;
  font-size:12px;
  opacity:.68;
}

.aiCoreFooterNav{
  display:grid;
  gap:8px;
}

.aiCoreFooterNav a{
  color:rgba(255,255,255,.72);
  text-decoration:none;
  padding:11px 13px;
  border-radius:16px;
}

.aiCoreFooterNav a:hover{
  background:rgba(255,255,255,.10);
  color:#fff;
}

.aiCoreMain{
  min-width:0;
  height:100vh;
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  gap:18px;
  padding:26px 28px;
  overflow:hidden;
}

.aiCoreTopbar{
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
}

.aiCoreTopbar p{
  margin:0 0 7px;
  color:var(--ai-muted);
  font-size:12px;
  font-weight:950;
  text-transform:uppercase;
  letter-spacing:.12em;
}

.aiCoreTopbar h1{
  margin:0;
  font-size:36px;
  line-height:1;
  letter-spacing:-.04em;
}

.aiCoreTopbarActions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:12px;
  min-width:0;
}

.aiCoreUser{
  max-width:360px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  border:1px solid var(--ai-border);
  border-radius:999px;
  padding:13px 18px;
  background:rgba(255,255,255,.82);
  box-shadow:0 12px 30px rgba(15,23,42,.05);
  font-weight:850;
}

.aiCoreWorkspace{
  min-height:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) 340px;
  gap:18px;
}

.aiCoreShell.isInsightClosed .aiCoreWorkspace{
  grid-template-columns:minmax(0,1fr);
}

.aiCoreShell.isInsightClosed .aiCoreInsight{
  display:none;
}

.aiCoreConversationCard,
.aiCoreInsight,
.aiCoreComposer{
  border:1px solid var(--ai-border);
  background:rgba(255,255,255,.86);
  box-shadow:var(--ai-shadow);
  backdrop-filter:blur(18px);
}

.aiCoreConversationCard{
  min-width:0;
  min-height:0;
  border-radius:var(--ai-radius);
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  overflow:hidden;
}

.aiCoreThreadHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:18px 22px;
  border-bottom:1px solid var(--ai-border);
  background:rgba(255,255,255,.70);
}

.aiCoreThreadHeader h2{
  margin:4px 0 0;
  font-size:18px;
  letter-spacing:-.02em;
}

.aiCoreStatusPill{
  border-radius:999px;
  padding:8px 11px;
  background:rgba(22,163,74,.10);
  color:#166534;
  font-size:12px;
  font-weight:950;
}

.aiCoreStatusPill.isLoading{
  background:rgba(217,119,6,.13);
  color:#92400e;
}

.aiCoreMessages{
  min-height:0;
  overflow:auto;
  padding:28px;
  scroll-behavior:smooth;
}

.aiCoreEmpty{
  min-height:100%;
  display:grid;
  place-items:center;
  text-align:center;
  padding:50px 24px;
  color:var(--ai-muted);
}

.aiCoreEmptyIcon{
  width:64px;
  height:64px;
  border-radius:24px;
  display:grid;
  place-items:center;
  margin:0 auto 18px;
  color:#fff;
  font-weight:1000;
  background:linear-gradient(135deg,var(--ai-brand),var(--ai-brand2));
  box-shadow:0 18px 38px rgba(214,51,132,.20);
}

.aiCoreEmpty h2{
  margin:0;
  color:var(--ai-text);
  font-size:25px;
  letter-spacing:-.035em;
}

.aiCoreEmpty p{
  max-width:640px;
  margin:12px auto 0;
  font-size:15px;
  line-height:1.65;
}

.aiCoreMessage{
  display:grid;
  grid-template-columns:44px minmax(0,1fr);
  gap:14px;
  margin:0 auto 22px;
  max-width:1100px;
}

.aiCoreMessage.isUser{
  grid-template-columns:minmax(0,1fr) 44px;
}

.aiCoreMessage.isUser .aiCoreAvatar{
  grid-column:2;
}

.aiCoreMessage.isUser .aiCoreBubble{
  grid-column:1;
  grid-row:1;
  justify-self:end;
  max-width:780px;
  background:linear-gradient(135deg,#0b0b68,#080842);
  color:#fff;
  border-color:rgba(255,255,255,.08);
}

.aiCoreMessage.isAssistant .aiCoreBubble{
  width:min(100%,980px);
}

.aiCoreAvatar{
  width:44px;
  height:44px;
  border-radius:16px;
  display:grid;
  place-items:center;
  font-size:13px;
  font-weight:1000;
  color:#fff;
  background:linear-gradient(135deg,var(--ai-brand),var(--ai-brand2));
  box-shadow:0 14px 28px rgba(214,51,132,.18);
}

.aiCoreMessage.isAssistant .aiCoreAvatar{
  color:var(--ai-brand2);
  background:#fff;
  border:1px solid var(--ai-border);
  box-shadow:0 12px 26px rgba(15,23,42,.06);
}

.aiCoreBubble{
  min-width:0;
  border:1px solid var(--ai-border);
  border-radius:24px;
  padding:18px 20px;
  background:rgba(255,255,255,.94);
  box-shadow:var(--ai-shadow2);
}

.aiCoreMeta{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:10px;
  font-size:12px;
  color:var(--ai-muted);
}

.aiCoreMeta strong{
  color:inherit;
  font-weight:1000;
}

.aiCoreMessage.isUser .aiCoreMeta{
  color:rgba(255,255,255,.72);
}

.aiCoreModelBadge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  border-radius:999px;
  padding:4px 8px;
  background:rgba(100,116,139,.10);
  color:var(--ai-muted);
  font-weight:850;
}

.aiCoreContent{
  font-size:15.5px;
  line-height:1.75;
}

.aiCoreContent p{
  margin:0 0 13px;
}

.aiCoreContent p:last-child{
  margin-bottom:0;
}

.aiCoreContent h1,
.aiCoreContent h2,
.aiCoreContent h3,
.aiCoreContent h4{
  margin:18px 0 10px;
  line-height:1.25;
  letter-spacing:-.025em;
}

.aiCoreContent h1{font-size:26px}
.aiCoreContent h2{font-size:22px}
.aiCoreContent h3{font-size:18px}

.aiCoreContent ul,
.aiCoreContent ol{
  margin:10px 0 14px;
  padding-left:24px;
}

.aiCoreContent li{
  margin:5px 0;
}

.aiCoreContent code{
  border:1px solid rgba(15,23,42,.10);
  border-radius:8px;
  padding:2px 6px;
  background:#f1f5f9;
  color:#be185d;
  font-size:.92em;
}

.aiCoreContent pre{
  overflow:auto;
  border-radius:18px;
  border:1px solid rgba(15,23,42,.10);
  padding:16px;
  background:#0f172a;
  color:#e2e8f0;
  line-height:1.55;
}

.aiCoreContent pre code{
  padding:0;
  border:0;
  background:transparent;
  color:inherit;
}

.aiCoreStructured{
  display:grid;
  gap:16px;
}

.aiCoreAnswerTitle{
  display:grid;
  gap:6px;
  padding:16px;
  border-radius:20px;
  background:linear-gradient(135deg,rgba(214,51,132,.08),rgba(109,47,136,.08));
  border:1px solid rgba(214,51,132,.14);
}

.aiCoreAnswerTitle h3{
  margin:0;
  font-size:19px;
}

.aiCoreAnswerTitle p{
  margin:0;
  color:var(--ai-muted);
}

.aiCoreStatsGrid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(150px,1fr));
  gap:10px;
}

.aiCoreStatCard{
  border:1px solid var(--ai-border);
  border-radius:18px;
  padding:14px;
  background:#fff;
}

.aiCoreStatCard span{
  display:block;
  color:var(--ai-muted);
  font-size:12px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.07em;
}

.aiCoreStatCard strong{
  display:block;
  margin-top:6px;
  font-size:22px;
  letter-spacing:-.03em;
}

.aiCoreTableWrap{
  width:100%;
  overflow:auto;
  border:1px solid var(--ai-border);
  border-radius:20px;
  background:#fff;
}

.aiCoreTable{
  width:100%;
  min-width:560px;
  border-collapse:collapse;
}

.aiCoreTable th,
.aiCoreTable td{
  padding:12px 14px;
  border-bottom:1px solid rgba(15,23,42,.08);
  text-align:left;
  vertical-align:top;
}

.aiCoreTable th{
  background:#f8fafc;
  color:#334155;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.07em;
  font-weight:1000;
}

.aiCoreTable tr:last-child td{
  border-bottom:0;
}

.aiCoreChart{
  border:1px solid var(--ai-border);
  border-radius:22px;
  padding:16px;
  background:#fff;
}

.aiCoreChart h4{
  margin:0 0 14px;
}

.aiCoreBarChart{
  display:grid;
  gap:10px;
}

.aiCoreBarRow{
  display:grid;
  grid-template-columns:150px minmax(0,1fr) 70px;
  align-items:center;
  gap:10px;
}

.aiCoreBarLabel{
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
  color:#334155;
  font-size:13px;
  font-weight:850;
}

.aiCoreBarTrack{
  height:12px;
  border-radius:999px;
  background:#e2e8f0;
  overflow:hidden;
}

.aiCoreBarFill{
  display:block;
  height:100%;
  border-radius:999px;
  width:var(--bar-value);
  background:linear-gradient(135deg,var(--ai-brand),var(--ai-brand2));
}

.aiCoreBarValue{
  color:var(--ai-muted);
  font-size:13px;
  font-weight:900;
  text-align:right;
}

.aiCoreSectionList{
  border:1px solid var(--ai-border);
  border-radius:20px;
  padding:14px 16px;
  background:#fff;
}

.aiCoreSectionList h4{
  margin:0 0 10px;
}

.aiCoreSectionList ul{
  margin:0;
  padding-left:20px;
}

.aiCoreWarningBox{
  border:1px solid rgba(217,119,6,.22);
  border-radius:18px;
  padding:13px 15px;
  color:#92400e;
  background:rgba(217,119,6,.09);
}

.aiCoreMessageActions{
  display:flex;
  align-items:center;
  gap:8px;
  margin-top:14px;
  opacity:.92;
}

.aiCoreMiniBtn{
  border:1px solid var(--ai-border);
  background:#fff;
  color:var(--ai-muted);
  border-radius:999px;
  padding:7px 10px;
  font-size:12px;
  font-weight:850;
}

.aiCoreMiniBtn:hover{
  color:var(--ai-text);
  border-color:var(--ai-border2);
}

.aiCoreInsight{
  min-width:0;
  min-height:0;
  overflow:auto;
  border-radius:var(--ai-radius);
  padding:20px;
}

.aiCoreInsightHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:18px;
}

.aiCoreInsight h2{
  margin:4px 0 0;
  font-size:24px;
  letter-spacing:-.035em;
}

.aiCoreLiveDot{
  width:11px;
  height:11px;
  border-radius:999px;
  background:var(--ai-ok);
  box-shadow:0 0 0 6px rgba(22,163,74,.12);
  margin-top:8px;
}

.aiCoreTraceGrid{
  display:grid;
  gap:10px;
  margin:0;
}

.aiCoreTraceGrid div{
  border:1px solid var(--ai-border);
  border-radius:18px;
  padding:12px;
  background:#fff;
}

.aiCoreTraceGrid dt{
  margin:0 0 6px;
  color:var(--ai-muted);
  font-size:11px;
  font-weight:950;
  text-transform:uppercase;
  letter-spacing:.08em;
}

.aiCoreTraceGrid dd{
  margin:0;
  font-weight:950;
  word-break:break-word;
}

.aiCoreInsightBlock{
  margin-top:20px;
}

.aiCoreInsightBlock h3{
  margin:0 0 10px;
  font-size:18px;
}

.aiCoreSources{
  display:grid;
  gap:10px;
  color:var(--ai-muted);
}

.aiCoreSource{
  border:1px solid var(--ai-border);
  border-radius:18px;
  padding:12px;
  background:#fff;
}

.aiCoreSourceTop{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}

.aiCoreSourceBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  padding:4px 8px;
  background:rgba(124,58,237,.09);
  color:#6d28d9;
  font-size:10px;
  font-weight:950;
  letter-spacing:.07em;
  text-transform:uppercase;
}

.aiCoreSourceType_endpoint .aiCoreSourceBadge{
  background:rgba(14,116,144,.10);
  color:#0e7490;
}

.aiCoreSourceType_document .aiCoreSourceBadge{
  background:rgba(37,99,235,.10);
  color:#1d4ed8;
}

.aiCoreSourceType_flow .aiCoreSourceBadge{
  background:rgba(22,163,74,.10);
  color:#15803d;
}

.aiCoreSourceType_model .aiCoreSourceBadge{
  background:rgba(147,51,234,.10);
  color:#7e22ce;
}

.aiCoreSourceEmpty{
  border-style:dashed;
  background:rgba(248,250,252,.75);
}

.aiCoreSource strong{
  display:block;
  color:var(--ai-text);
}

.aiCoreSource span{
  display:block;
  margin-top:8px;
  font-size:12px;
}

.aiCoreSource quote{
  display:block;
  margin-top:8px;
  color:#334155;
  font-size:13px;
  line-height:1.45;
}

.aiCoreApproval{
  color:#92400e;
}

.aiCoreComposer{
  border-radius:26px;
  padding:14px;
}

.aiCorePromptChips{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:10px;
}

.aiCorePromptChips button{
  border:1px solid var(--ai-border);
  border-radius:999px;
  padding:8px 11px;
  background:#fff;
  color:var(--ai-muted);
  font-size:12px;
  font-weight:850;
}

.aiCorePromptChips button:hover{
  color:var(--ai-text);
  border-color:rgba(214,51,132,.28);
  background:rgba(214,51,132,.05);
}

.aiCoreComposerBox{
  border:1px solid var(--ai-border);
  border-radius:22px;
  background:#fff;
  overflow:hidden;
}

.aiCoreComposer textarea{
  width:100%;
  min-height:84px;
  max-height:210px;
  resize:none;
  outline:none;
  border:0;
  padding:16px 17px;
  color:var(--ai-text);
  background:#fff;
  line-height:1.55;
}

.aiCoreComposerFooter{
  border-top:1px solid var(--ai-border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:12px 14px;
}

.aiCoreComposerFooter span{
  color:var(--ai-muted);
  font-size:12px;
}

@media (max-width:1180px){
  .aiCoreWorkspace{
    grid-template-columns:minmax(0,1fr);
  }

  .aiCoreInsight{
    display:none;
  }

  .aiCoreShell:not(.isInsightClosed) .aiCoreInsight{
    display:block;
    position:fixed;
    z-index:50;
    right:20px;
    top:96px;
    bottom:20px;
    width:min(380px,calc(100vw - 40px));
  }
}

@media (max-width:860px){
  body{
    overflow:auto;
  }

  .aiCoreShell{
    height:auto;
    min-height:100vh;
    display:block;
  }

  .aiCoreSidebar{
    position:relative;
    height:auto;
    border-radius:0 0 28px 28px;
  }

  .aiCoreMain{
    height:auto;
    min-height:100vh;
    padding:18px;
  }

  .aiCoreTopbar{
    align-items:flex-start;
    flex-direction:column;
  }

  .aiCoreTopbarActions{
    width:100%;
    justify-content:space-between;
  }

  .aiCoreConversationCard{
    min-height:70vh;
  }

  .aiCoreMessages{
    padding:18px;
  }

  .aiCoreMessage,
  .aiCoreMessage.isUser{
    grid-template-columns:1fr;
  }

  .aiCoreAvatar{
    display:none;
  }

  .aiCoreMessage.isUser .aiCoreBubble{
    grid-column:auto;
    grid-row:auto;
  }

  .aiCoreBarRow{
    grid-template-columns:1fr;
  }

  .aiCoreBarValue{
    text-align:left;
  }
}




/* ========================================================= 
   Ajuste UX: conversación ocupa todo + controles internos
   ========================================================= */

.aiCoreShell{
  grid-template-columns: 320px minmax(0, 1fr) !important;
}

.aiCoreMain{
  height: 100vh !important;
  padding: 10px 18px 10px 18px !important;
  gap: 0 !important;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) !important;
  overflow: hidden !important;
}

/* El topbar externo ya no existe, pero por seguridad lo ocultamos */
.aiCoreTopbar{
  display: none !important;
}

/* Workspace ocupa todo el alto disponible */
.aiCoreWorkspace{
  min-height: 0 !important;
  height: 100% !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 340px !important;
  gap: 14px !important;
}

/* Conversation ahora es la pantalla principal completa */
.aiCoreConversationCard{
  height: 100% !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  overflow: hidden !important;
  border-radius: 26px !important;
}

/* Header interno compacto */
.aiCoreThreadHeader{
  padding: 11px 18px !important;
  min-height: 58px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 14px !important;
}

.aiCoreThreadHeader h2{
  margin-top: 2px !important;
  font-size: 17px !important;
  line-height: 1.15 !important;
}

.aiCoreEyebrow{
  font-size: 10px !important;
}

/* Acciones arriba a la derecha dentro de Conversation */
.aiCoreThreadActions{
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  flex: 0 0 auto !important;
}

/* Botón trazabilidad igual de compacto que Listo */
.aiCoreTracePill{
  border: 0 !important;
  border-radius: 999px !important;
  padding: 6px 10px !important;
  background: rgba(15,23,42,.06) !important;
  color: #0f172a !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

.aiCoreTracePill:hover{
  background: rgba(214,51,132,.10) !important;
  color: var(--ai-brand2) !important;
}

.aiCoreStatusPill{
  padding: 6px 10px !important;
  font-size: 11px !important;
  line-height: 1 !important;
}

/* Mensajes con máximo espacio útil */
.aiCoreMessages{
  height: 100% !important;
  min-height: 0 !important;
  padding: 12px 18px 10px !important;
  overflow-y: auto !important;
}

/* Composer integrado, compacto y dentro de Conversation */
.aiCoreComposer{
  border: 0 !important;
  border-top: 1px solid var(--ai-border) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: rgba(255,255,255,.94) !important;
  padding: 8px 10px 10px !important;
  backdrop-filter: blur(16px) !important;
}

.aiCoreComposerBox{
  border-radius: 18px !important;
  background: #fff !important;
  box-shadow: 0 12px 28px rgba(15,23,42,.07) !important;
}

.aiCoreComposer textarea{
  min-height: 40px !important;
  height: 40px !important;
  max-height: 86px !important;
  padding: 9px 13px !important;
  line-height: 1.35 !important;
  font-size: 14px !important;
}

.aiCoreComposerFooter{
  padding: 6px 8px !important;
  min-height: 36px !important;
  gap: 8px !important;
  align-items: center !important;
}

/* Ocultamos el texto informativo, mantenemos el ID para JS */
.aiCoreStatusText{
  display: none !important;
}

.aiCorePromptChips{
  display: flex !important;
  align-items: center !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  margin: 0 !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.aiCorePromptChips button{
  padding: 6px 10px !important;
  font-size: 11px !important;
  line-height: 1 !important;
  border-radius: 999px !important;
  white-space: nowrap !important;
}

.aiCoreComposer .aiCorePrimaryBtn{
  padding: 8px 15px !important;
  font-size: 13px !important;
  flex: 0 0 auto !important;
}

/* Sidebar: usuario más prolijo en el brand */
.aiCoreBrand{
  align-items: center !important;
}

.aiCoreBrand strong{
  max-width: 210px !important;
  display: block !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 15px !important;
}

.aiCoreBrand span{
  font-size: 12px !important;
}

/* Trazabilidad oculta por defecto */
.aiCoreShell.isInsightClosed .aiCoreWorkspace{
  grid-template-columns: minmax(0, 1fr) !important;
}

.aiCoreShell.isInsightClosed .aiCoreInsight{
  display: none !important;
}

/* Cuando se abre trazabilidad, sigue compacta */
.aiCoreInsight{
  height: 100% !important;
  min-height: 0 !important;
  border-radius: 24px !important;
}


/* =========================================================
   Ajuste UX: cards de conversación más compactas y legibles
   ========================================================= */

.aiCoreMessages{
  padding: 14px 22px 12px !important;
}

.aiCoreMessage{
  gap: 10px !important;
  margin-bottom: 14px !important;
  max-width: 1040px !important;
}

.aiCoreMessage.isAssistant .aiCoreBubble{
  width: min(100%, 940px) !important;
}

.aiCoreMessage.isUser .aiCoreBubble{
  max-width: 720px !important;
}

.aiCoreAvatar{
  width: 36px !important;
  height: 36px !important;
  border-radius: 13px !important;
  font-size: 12px !important;
}

.aiCoreBubble{
  border-radius: 18px !important;
  padding: 13px 16px !important;
}

.aiCoreMeta{
  margin-bottom: 7px !important;
  gap: 6px !important;
  font-size: 11px !important;
}

.aiCoreModelBadge{
  padding: 3px 7px !important;
  font-size: 11px !important;
}

.aiCoreContent{
  font-size: 14.5px !important;
  line-height: 1.58 !important;
}

.aiCoreContent p{
  margin-bottom: 9px !important;
}

.aiCoreContent h1,
.aiCoreContent h2,
.aiCoreContent h3,
.aiCoreContent h4{
  margin: 12px 0 7px !important;
}

.aiCoreAnswerTitle{
  padding: 12px 14px !important;
  border-radius: 16px !important;
  gap: 4px !important;
}

.aiCoreAnswerTitle h3{
  font-size: 17px !important;
}

.aiCoreAnswerTitle p{
  font-size: 13.5px !important;
  line-height: 1.45 !important;
}

.aiCoreStructured{
  gap: 11px !important;
}

.aiCoreTableWrap{
  border-radius: 16px !important;
}

.aiCoreTable{
  min-width: 520px !important;
}

.aiCoreTable th,
.aiCoreTable td{
  padding: 9px 11px !important;
  font-size: 13.5px !important;
  line-height: 1.42 !important;
}

.aiCoreTable th{
  font-size: 11px !important;
}

.aiCoreStatsGrid{
  gap: 8px !important;
}

.aiCoreStatCard{
  border-radius: 15px !important;
  padding: 11px 12px !important;
}

.aiCoreStatCard span{
  font-size: 10.5px !important;
}

.aiCoreStatCard strong{
  margin-top: 4px !important;
  font-size: 18px !important;
}

.aiCoreChart{
  border-radius: 17px !important;
  padding: 12px !important;
}

.aiCoreChart h4{
  margin-bottom: 10px !important;
  font-size: 15px !important;
}

.aiCoreBarChart{
  gap: 8px !important;
}

.aiCoreBarRow{
  grid-template-columns: 130px minmax(0,1fr) 58px !important;
  gap: 8px !important;
}

.aiCoreBarLabel,
.aiCoreBarValue{
  font-size: 12px !important;
}

.aiCoreSectionList{
  border-radius: 16px !important;
  padding: 11px 13px !important;
}

.aiCoreSectionList h4{
  margin-bottom: 7px !important;
  font-size: 15px !important;
}

.aiCoreSectionList li{
  margin: 3px 0 !important;
}

.aiCoreWarningBox{
  border-radius: 15px !important;
  padding: 10px 12px !important;
}

.aiCoreMessageActions{
  margin-top: 10px !important;
}

.aiCoreMiniBtn{
  padding: 6px 9px !important;
  font-size: 11px !important;
}



/* =========================================================
   Ajuste UX: conversación más compacta y tabla renderizada limpia
   ========================================================= */

.aiCoreMessages{
  padding: 10px 18px 10px !important;
}

.aiCoreMessage{
  gap: 8px !important;
  margin-bottom: 10px !important;
  max-width: 980px !important;
}

.aiCoreMessage.isAssistant .aiCoreBubble{
  width: min(100%, 900px) !important;
}

.aiCoreMessage.isUser .aiCoreBubble{
  max-width: 640px !important;
}

.aiCoreAvatar{
  width: 32px !important;
  height: 32px !important;
  border-radius: 12px !important;
  font-size: 11px !important;
}

.aiCoreBubble{
  border-radius: 16px !important;
  padding: 10px 13px !important;
}

.aiCoreMeta{
  margin-bottom: 5px !important;
  gap: 5px !important;
  font-size: 10.5px !important;
  line-height: 1.2 !important;
}

.aiCoreModelBadge{
  padding: 3px 7px !important;
  font-size: 10.5px !important;
  line-height: 1.1 !important;
}

.aiCoreContent{
  font-size: 13.8px !important;
  line-height: 1.48 !important;
}

.aiCoreContent p{
  margin-bottom: 7px !important;
}

.aiCoreStructured{
  gap: 8px !important;
}

.aiCoreAnswerTitle{
  padding: 10px 12px !important;
  border-radius: 14px !important;
  gap: 3px !important;
}

.aiCoreAnswerTitle h3{
  font-size: 15.5px !important;
  line-height: 1.25 !important;
}

.aiCoreAnswerTitle p{
  font-size: 13px !important;
  line-height: 1.38 !important;
}

.aiCoreTableWrap{
  border-radius: 14px !important;
  max-height: 360px !important;
  overflow: auto !important;
}

.aiCoreTable{
  min-width: 520px !important;
}

.aiCoreTable th,
.aiCoreTable td{
  padding: 7px 9px !important;
  font-size: 13px !important;
  line-height: 1.34 !important;
}

.aiCoreTable th{
  font-size: 10.5px !important;
}

.aiCoreStatsGrid{
  gap: 7px !important;
}

.aiCoreStatCard{
  border-radius: 13px !important;
  padding: 9px 10px !important;
}

.aiCoreStatCard span{
  font-size: 10px !important;
}

.aiCoreStatCard strong{
  margin-top: 3px !important;
  font-size: 16px !important;
}

.aiCoreChart{
  border-radius: 15px !important;
  padding: 10px !important;
}

.aiCoreSectionList{
  border-radius: 14px !important;
  padding: 9px 11px !important;
}

.aiCoreSectionList h4{
  margin-bottom: 5px !important;
  font-size: 14px !important;
}

.aiCoreSectionList li{
  margin: 2px 0 !important;
}

.aiCoreMessageActions{
  margin-top: 7px !important;
}

.aiCoreMiniBtn{
  padding: 5px 8px !important;
  font-size: 10.5px !important;
}





/* =========================================================
   Ajuste UX final: conversación full-space + mensajes compactos
   ========================================================= */

/* El área principal ya no desperdicia espacio alrededor */
.aiCoreMain{
  padding: 6px 8px !important;
  gap: 0 !important;
  height: 100vh !important;
  grid-template-rows: minmax(0, 1fr) !important;
  overflow: hidden !important;
}

/* Workspace ocupa todo el alto y ancho disponible */
.aiCoreWorkspace{
  height: 100% !important;
  min-height: 0 !important;
  gap: 8px !important;
}

/* Si trazabilidad está cerrada, conversation toma todo el ancho */
.aiCoreShell.isInsightClosed .aiCoreWorkspace{
  grid-template-columns: minmax(0, 1fr) !important;
}

/* Card principal ocupa todo el espacio útil */
.aiCoreConversationCard{
  height: 100% !important;
  min-height: 0 !important;
  width: 100% !important;
  border-radius: 22px !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  overflow: hidden !important;
}

/* Header más compacto */
.aiCoreThreadHeader{
  min-height: 48px !important;
  padding: 8px 16px !important;
}

.aiCoreThreadHeader h2{
  font-size: 16px !important;
  line-height: 1.1 !important;
  margin-top: 1px !important;
}

.aiCoreEyebrow{
  font-size: 9.5px !important;
  line-height: 1 !important;
}

.aiCoreThreadActions{
  gap: 6px !important;
}

.aiCoreTracePill,
.aiCoreStatusPill{
  padding: 5px 9px !important;
  font-size: 10.5px !important;
  line-height: 1 !important;
}

/* El área de mensajes gana más espacio vertical */
.aiCoreMessages{
  height: 100% !important;
  min-height: 0 !important;
  padding: 10px 14px 8px !important;
  overflow-y: auto !important;
}

/* Cada mensaje usa más ancho */
.aiCoreMessage{
  max-width: 1320px !important;
  width: 100% !important;
  gap: 8px !important;
  margin-bottom: 9px !important;
}

/* Card IA más ancha */
.aiCoreMessage.isAssistant .aiCoreBubble{
  width: min(100%, 1180px) !important;
  max-width: 1180px !important;
}

/* Card usuario también más ancha, pero no exagerada */
.aiCoreMessage.isUser .aiCoreBubble{
  max-width: 860px !important;
}

/* Avatar más pequeño para ganar espacio */
.aiCoreAvatar{
  width: 30px !important;
  height: 30px !important;
  min-width: 30px !important;
  border-radius: 11px !important;
  font-size: 10.5px !important;
}

/* Cards más compactas en altura */
.aiCoreBubble{
  border-radius: 15px !important;
  padding: 9px 12px !important;
}

/* Metadata compacta */
.aiCoreMeta{
  margin-bottom: 4px !important;
  gap: 5px !important;
  font-size: 10.5px !important;
  line-height: 1.1 !important;
}

.aiCoreModelBadge{
  padding: 2px 7px !important;
  font-size: 10.5px !important;
  line-height: 1.1 !important;
}

/* Texto más compacto sin perder legibilidad */
.aiCoreContent{
  font-size: 13.6px !important;
  line-height: 1.42 !important;
}

.aiCoreContent p{
  margin-bottom: 6px !important;
}

/* Bloques estructurados más compactos */
.aiCoreStructured{
  gap: 7px !important;
}

/* Card de título/resumen más baja */
.aiCoreAnswerTitle{
  padding: 9px 11px !important;
  border-radius: 13px !important;
  gap: 2px !important;
}

.aiCoreAnswerTitle h3{
  font-size: 15px !important;
  line-height: 1.2 !important;
}

.aiCoreAnswerTitle p{
  font-size: 12.8px !important;
  line-height: 1.32 !important;
}

/* Estadísticas más compactas */
.aiCoreStatsGrid{
  gap: 6px !important;
}

.aiCoreStatCard{
  padding: 8px 10px !important;
  border-radius: 12px !important;
}

.aiCoreStatCard span{
  font-size: 9.8px !important;
}

.aiCoreStatCard strong{
  margin-top: 2px !important;
  font-size: 15px !important;
}

/* Tablas con más ancho y menos altura */
.aiCoreTableWrap{
  width: 100% !important;
  max-height: 330px !important;
  border-radius: 13px !important;
  overflow: auto !important;
}

.aiCoreTable{
  width: 100% !important;
  min-width: 720px !important;
}

.aiCoreTable th,
.aiCoreTable td{
  padding: 6px 8px !important;
  font-size: 12.8px !important;
  line-height: 1.28 !important;
}

.aiCoreTable th{
  font-size: 10px !important;
}

/* Listas más compactas */
.aiCoreSectionList{
  padding: 8px 10px !important;
  border-radius: 13px !important;
}

.aiCoreSectionList h4{
  margin-bottom: 4px !important;
  font-size: 13.5px !important;
}

.aiCoreSectionList ul{
  margin: 0 !important;
  padding-left: 18px !important;
}

.aiCoreSectionList li{
  margin: 1px 0 !important;
}

/* Advertencias compactas */
.aiCoreWarningBox{
  padding: 8px 10px !important;
  border-radius: 13px !important;
}

/* Botones de acciones compactos */
.aiCoreMessageActions{
  margin-top: 6px !important;
}

.aiCoreMiniBtn{
  padding: 4px 8px !important;
  font-size: 10.5px !important;
}

/* Composer más compacto para dejar más conversación visible */
.aiCoreComposer{
  padding: 6px 8px 8px !important;
}

.aiCoreComposerBox{
  border-radius: 16px !important;
}

.aiCoreComposer textarea{
  min-height: 36px !important;
  height: 36px !important;
  max-height: 76px !important;
  padding: 8px 12px !important;
  font-size: 13.5px !important;
  line-height: 1.3 !important;
}

.aiCoreComposerFooter{
  min-height: 32px !important;
  padding: 5px 7px !important;
}

.aiCorePromptChips{
  gap: 5px !important;
}

.aiCorePromptChips button{
  padding: 5px 9px !important;
  font-size: 10.5px !important;
}

.aiCoreComposer .aiCorePrimaryBtn{
  padding: 7px 14px !important;
  font-size: 12.5px !important;
}


/* =========================================================
   Sidebar UX moderno: usuario dropdown + más espacio al historial
   ========================================================= */

.aiCoreSidebar{
  padding: 16px 16px 14px !important;
  gap: 12px !important;
  overflow: hidden !important;
}

.aiCoreUserMenu{
  position: relative;
}

.aiCoreUserMenuBtn{
  width: 100%;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 20px;
  background: rgba(255,255,255,.06);
  color: #fff;
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 54px minmax(0,1fr) 18px;
  align-items: center;
  gap: 12px;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
}

.aiCoreUserMenuBtn:hover{
  background: rgba(255,255,255,.09);
}

.aiCoreUserInitials{
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  border-radius: 18px !important;
  font-size: 22px !important;
  font-weight: 1000 !important;
}

.aiCoreUserMeta{
  min-width: 0;
}

.aiCoreUserMeta strong{
  display: block;
  font-size: 14px;
  line-height: 1.2;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.aiCoreUserMeta span{
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: rgba(255,255,255,.72);
}

.aiCoreUserMenuChevron{
  justify-self: end;
  color: rgba(255,255,255,.70);
  font-size: 12px;
  line-height: 1;
}

.aiCoreUserDropdown{
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 30;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.10);
  background: #17175f;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  overflow: hidden;
}

.aiCoreUserDropdown a{
  display: block;
  padding: 12px 14px;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.2;
}

.aiCoreUserDropdown a:hover{
  background: rgba(255,255,255,.08);
}

.aiCoreQuickPanel{
  padding: 14px !important;
  gap: 9px !important;
  border-radius: 22px !important;
}

.aiCoreQuickPanel label{
  font-size: 11px !important;
  letter-spacing: .10em !important;
  margin-bottom: 1px !important;
}

.aiCoreQuickPanel select{
  padding: 12px 13px !important;
  border-radius: 16px !important;
}

.aiCoreQuickPanel .aiCorePrimaryBtn{
  margin-top: 2px !important;
  padding: 12px 14px !important;
  font-size: 14px !important;
}

.aiCoreThreadsPanel{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 14px !important;
  border-radius: 22px !important;
}

.aiCoreThreadsPanel .aiCorePanelTitle{
  margin-bottom: 8px !important;
}

.aiCoreThreads{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow: auto !important;
  padding-right: 4px !important;
  display: grid !important;
  gap: 10px !important;
}

.aiCoreThreadItem{
  padding: 12px 13px !important;
  border-radius: 18px !important;
}

.aiCoreThreadItem strong{
  font-size: 13.5px !important;
  line-height: 1.25 !important;
}

.aiCoreThreadItem span{
  font-size: 11px !important;
  margin-top: 4px !important;
  line-height: 1.25 !important;
  word-break: break-word !important;
}

.aiCoreFooterNav{
  margin-top: auto !important;
  display: grid !important;
  gap: 0 !important;
}

.aiCoreFooterNav a{
  display: block;
  text-align: left;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 16px;
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.92);
  padding: 12px 14px;
  text-decoration: none;
  font-size: 14px;
  line-height: 1.2;
}

.aiCoreFooterNav a:hover{
  background: rgba(255,255,255,.10);
  color: #fff;
}



/* =========================================================
   Sidebar + modal nueva conversación
   ========================================================= */

.aiCoreSidebar{
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  height: 100% !important;
  gap: 12px !important;
}

.aiCoreQuickPanelCompact{
  padding: 12px !important;
  border-radius: 20px !important;
}

.aiCoreStartThreadBtn{
  width: 100% !important;
  padding: 13px 14px !important;
  font-size: 15px !important;
}

.aiCoreThreadsPanel{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 14px !important;
  border-radius: 22px !important;
}

.aiCoreThreads{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: grid !important;
  gap: 10px !important;
  padding-right: 4px !important;
}

/* Modal */
.aiCoreModalOverlay{
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2,6,23,.48);
  backdrop-filter: blur(10px);
}

.aiCoreModalOverlay[hidden]{
  display: none !important;
}

.aiCoreModalCard{
  width: min(460px, 100%);
  border-radius: 26px;
  background: #fff;
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 30px 90px rgba(0,0,0,.28);
  overflow: hidden;
}

.aiCoreModalHeader{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid rgba(15,23,42,.08);
}

.aiCoreModalHeader h2{
  margin: 4px 0 0;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -.03em;
  color: #0f172a;
}

.aiCoreModalClose{
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  color: #0f172a;
  font-size: 22px;
  line-height: 1;
  font-weight: 800;
}

.aiCoreModalClose:hover{
  background: rgba(214,51,132,.10);
  color: var(--ai-brand2);
}

.aiCoreModalBody{
  display: grid;
  gap: 10px;
  padding: 18px 22px;
}

.aiCoreModalBody label{
  color: #64748b;
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .10em;
}

.aiCoreModalBody select{
  width: 100%;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 50px;
  padding: 13px 14px;
  background: #fff;
  color: #0f172a;
  outline: none;
}

.aiCoreModalBody select:focus{
  border-color: rgba(214,51,132,.45);
  box-shadow: 0 0 0 4px rgba(214,51,132,.10);
}

.aiCoreModalFooter{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px 20px;
  border-top: 1px solid rgba(15,23,42,.08);
}

.aiCoreModalFooter .aiCorePrimaryBtn,
.aiCoreModalFooter .aiCoreSecondaryBtn{
  padding: 11px 16px !important;
  font-size: 14px !important;
}

.aiCoreModalFooter .aiCoreSecondaryBtn{
  border: 1px solid rgba(15,23,42,.10);
  background: #f8fafc;
  color: #0f172a;
}

.aiCoreModalFooter .aiCoreSecondaryBtn:hover{
  background: #f1f5f9;
}



/* =========================================================
   Refinamiento UX: modal premium + scrollbars sutiles
   ========================================================= */

/* Botón X de la modal: centrado, limpio y moderno */
.aiCoreModalClose{
  width: 38px !important;
  height: 36px !important;
  min-width: 38px !important;
  min-height: 36px !important;
  border: 0 !important;
  border-radius: 999px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  background: #f1f5f9 !important;
  color: #0f172a !important;
  box-shadow: none !important;
  line-height: 1 !important;
}

.aiCoreModalClose span{
  display: block !important;
  transform: translateY(0px) !important;
  font-size: 28px !important;
  line-height: 1 !important;
  font-weight: 700 !important;
  font-family: Arial, Helvetica, sans-serif !important;
}

.aiCoreModalClose:hover{
  background: rgba(214,51,132,.10) !important;
  color: var(--ai-brand2) !important;
}

/* Botón Cancelar con la misma familia visual que Crear conversación */
.aiCoreModalFooter .aiCoreSecondaryBtn,
#aiCoreCancelNewThread{
  border-radius: 999px !important;
  border: 1px solid rgba(15,23,42,.10) !important;
  background: #f8fafc !important;
  color: #0f172a !important;
  padding: 12px 18px !important;
  min-height: 46px !important;
  font-size: 14px !important;
  font-weight: 850 !important;
  line-height: 1 !important;
  box-shadow: 0 10px 24px rgba(15,23,42,.05) !important;
}

.aiCoreModalFooter .aiCoreSecondaryBtn:hover,
#aiCoreCancelNewThread:hover{
  background: #eef2f7 !important;
  border-color: rgba(15,23,42,.16) !important;
}

/* Botón Crear conversación alineado con Cancelar */
.aiCoreModalFooter .aiCorePrimaryBtn,
#aiCoreNewThread{
  border-radius: 999px !important;
  min-height: 46px !important;
  padding: 12px 20px !important;
  line-height: 1 !important;
}

/* Footer de modal más equilibrado */
.aiCoreModalFooter{
  align-items: center !important;
  gap: 12px !important;
}

/* Scrollbars sutiles estilo plataformas modernas */
.aiCoreThreads,
.aiCoreMessages,
.aiCoreInsight,
.aiCoreTableWrap{
  scrollbar-width: thin !important;
  scrollbar-color: rgba(255,255,255,.22) transparent !important;
}

/* Scrollbar en zonas claras */
.aiCoreMessages,
.aiCoreInsight,
.aiCoreTableWrap{
  scrollbar-color: rgba(15,23,42,.18) transparent !important;
}

/* Chrome / Edge / Safari */
.aiCoreThreads::-webkit-scrollbar,
.aiCoreMessages::-webkit-scrollbar,
.aiCoreInsight::-webkit-scrollbar,
.aiCoreTableWrap::-webkit-scrollbar{
  width: 8px !important;
  height: 8px !important;
}

.aiCoreThreads::-webkit-scrollbar-track,
.aiCoreMessages::-webkit-scrollbar-track,
.aiCoreInsight::-webkit-scrollbar-track,
.aiCoreTableWrap::-webkit-scrollbar-track{
  background: transparent !important;
}

.aiCoreThreads::-webkit-scrollbar-thumb,
.aiCoreMessages::-webkit-scrollbar-thumb,
.aiCoreInsight::-webkit-scrollbar-thumb,
.aiCoreTableWrap::-webkit-scrollbar-thumb{
  border-radius: 999px !important;
  border: 2px solid transparent !important;
  background-clip: padding-box !important;
}

/* Thumb del historial sobre sidebar oscuro */
.aiCoreThreads::-webkit-scrollbar-thumb{
  background-color: rgba(255,255,255,.22) !important;
}

/* Thumb del área clara */
.aiCoreMessages::-webkit-scrollbar-thumb,
.aiCoreInsight::-webkit-scrollbar-thumb,
.aiCoreTableWrap::-webkit-scrollbar-thumb{
  background-color: rgba(15,23,42,.18) !important;
}

.aiCoreThreads::-webkit-scrollbar-thumb:hover{
  background-color: rgba(255,255,255,.34) !important;
}

.aiCoreMessages::-webkit-scrollbar-thumb:hover,
.aiCoreInsight::-webkit-scrollbar-thumb:hover,
.aiCoreTableWrap::-webkit-scrollbar-thumb:hover{
  background-color: rgba(15,23,42,.28) !important;
}

/* Quita flechas/botones feos del scrollbar en Chromium */
.aiCoreThreads::-webkit-scrollbar-button,
.aiCoreMessages::-webkit-scrollbar-button,
.aiCoreInsight::-webkit-scrollbar-button,
.aiCoreTableWrap::-webkit-scrollbar-button{
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}




/* =========================================================
   Sidebar: conversaciones en una sola section moderna
   ========================================================= */

.aiCoreConversationHub{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 14px !important;
  border-radius: 24px !important;
  gap: 12px !important;
  overflow: hidden !important;
}

.aiCoreConversationHubHeader{
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

.aiCoreConversationHubHeader > div{
  min-width: 0 !important;
}

.aiCoreConversationHubHeader .aiCorePanelTitle{
  display: block !important;
  color: rgba(255,255,255,.82) !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  letter-spacing: .11em !important;
  text-transform: uppercase !important;
  line-height: 1.1 !important;
}

.aiCoreConversationHubHeader small{
  display: block !important;
  margin-top: 4px !important;
  color: rgba(255,255,255,.50) !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
}

.aiCoreStartThreadIconBtn{
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 14px !important;
  display: grid !important;
  place-items: center !important;
  background: rgba(255,255,255,.08) !important;
  color: #fff !important;
  font-size: 24px !important;
  line-height: 1 !important;
  font-weight: 800 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06) !important;
}

.aiCoreStartThreadIconBtn:hover{
  background: rgba(255,255,255,.13) !important;
  transform: translateY(-1px) !important;
}

.aiCoreConversationHub .aiCoreStartThreadBtn{
  width: 100% !important;
  padding: 12px 14px !important;
  border-radius: 999px !important;
  font-size: 14px !important;
  line-height: 1 !important;
}

.aiCoreConversationHubDivider{
  height: 1px !important;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,.12),
    transparent
  ) !important;
  margin: 2px 0 !important;
}

.aiCoreConversationHub .aiCoreThreads{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  display: grid !important;
  align-content: start !important;
  gap: 10px !important;
  padding-right: 4px !important;
}

/* Cards del historial más limpias dentro de la nueva section */
.aiCoreConversationHub .aiCoreThreadItem{
  border-radius: 18px !important;
  padding: 13px 14px !important;
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(255,255,255,.08) !important;
}

.aiCoreConversationHub .aiCoreThreadItem:hover{
  background: rgba(255,255,255,.12) !important;
  transform: translateY(-1px) !important;
}

.aiCoreConversationHub .aiCoreThreadItem.isActive{
  background: #fff !important;
  color: #111827 !important;
  border-color: transparent !important;
  box-shadow: 0 16px 34px rgba(0,0,0,.20) !important;
}

.aiCoreConversationHub .aiCoreThreadItem strong{
  font-size: 13.5px !important;
  line-height: 1.25 !important;
}

.aiCoreConversationHub .aiCoreThreadItem span{
  margin-top: 5px !important;
  font-size: 11.5px !important;
  line-height: 1.25 !important;
  opacity: .65 !important;
}




/* =========================================================
   Refinamiento UX: botón + como acción única de nueva conversación
   ========================================================= */

.aiCoreConversationHub{
  gap: 10px !important;
}

.aiCoreConversationHubHeader{
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

.aiCoreConversationHubHeader > div{
  min-width: 0 !important;
}

.aiCoreStartThreadIconBtn{
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 14px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.04)) !important;
  color: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 24px rgba(0,0,0,.18) !important;
  transition:
    transform .18s ease,
    background .18s ease,
    box-shadow .18s ease,
    border-color .18s ease !important;
}

.aiCoreStartThreadIconBtn span{
  display: block !important;
  font-size: 28px !important;
  line-height: 1 !important;
  font-weight: 700 !important;
  transform: translateY(-1px) !important;
  font-family: Arial, Helvetica, sans-serif !important;
}

.aiCoreStartThreadIconBtn:hover{
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.08)) !important;
  border-color: rgba(255,255,255,.20) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 14px 28px rgba(0,0,0,.22) !important;
  transform: translateY(-1px) !important;
}

.aiCoreStartThreadIconBtn:active{
  transform: translateY(0) scale(.98) !important;
}

.aiCoreStartThreadIconBtn:focus-visible{
  outline: none !important;
  box-shadow:
    0 0 0 3px rgba(255,255,255,.10),
    0 0 0 6px rgba(214,51,132,.20) !important;
}

.aiCoreConversationHubDivider{
  margin: 0 !important;
}




/* =========================================================
   Fix final: botón + centrado, redondeado y funcional
   ========================================================= */

.aiCoreStartThreadIconBtn{
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  max-width: 40px !important;
  max-height: 40px !important;

  border-radius: 50px !important;
  border: 1px solid rgba(255,255,255,.16) !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  padding: 0 !important;
  margin: 0 !important;

  background:
    linear-gradient(180deg, rgba(255,255,255,.13), rgba(255,255,255,.06)) !important;

  color: #fff !important;
  cursor: pointer !important;

  font-size: 0 !important;
  line-height: 0 !important;
  text-align: center !important;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 12px 28px rgba(0,0,0,.18) !important;

  transition:
    transform .16s ease,
    background .16s ease,
    border-color .16s ease,
    box-shadow .16s ease !important;
}

.aiCoreStartThreadIconBtn span{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  width: 100% !important;
  height: 100% !important;

  margin-top: 2px !important;
  padding: 0 !important;

  color: #fff !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 28px !important;
  font-weight: 700 !important;
  line-height: 1 !important;

  transform: translateY(-1px) !important;
  pointer-events: none !important;
}

.aiCoreStartThreadIconBtn:hover{
  background:
    linear-gradient(180deg, rgba(255,255,255,.20), rgba(255,255,255,.10)) !important;
  border-color: rgba(255,255,255,.24) !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.10),
    0 16px 34px rgba(0,0,0,.22) !important;
  transform: translateY(-1px) !important;
}

.aiCoreStartThreadIconBtn:active{
  transform: translateY(0) scale(.97) !important;
}

.aiCoreStartThreadIconBtn:focus-visible{
  outline: none !important;
  box-shadow:
    0 0 0 3px rgba(255,255,255,.13),
    0 0 0 6px rgba(214,51,132,.22),
    0 16px 34px rgba(0,0,0,.22) !important;
}





/* =========================================================
   Historial: fecha legible formato Paraguay
   ========================================================= */

.aiCoreThreadItem span{
  color: rgba(255,255,255,.58) !important;
  font-size: 12px !important;
  line-height: 1.25 !important;
  letter-spacing: .01em !important;
}

.aiCoreThreadItem.isActive span{
  color: rgba(15,23,42,.58) !important;
}





/* =========================================================
   Historial: menú contextual moderno
   ========================================================= */

.aiCoreThreadItem.isPinned{
  border-color: rgba(214,51,132,.32) !important;
  background:
    linear-gradient(135deg, rgba(214,51,132,.16), rgba(255,255,255,.07)) !important;
}

.aiCoreThreadItem.isPinned strong::before{
  content: "📌 ";
  font-size: 12px;
}

.aiCoreThreadContextMenu{
  position: fixed;
  z-index: 500;
  width: 230px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(15,23,42,.96);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: 0 24px 70px rgba(0,0,0,.34);
  backdrop-filter: blur(16px);
}

.aiCoreThreadContextMenu[hidden]{
  display: none !important;
}

.aiCoreThreadContextMenu button{
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  color: rgba(255,255,255,.92);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
}

.aiCoreThreadContextMenu button:hover{
  background: rgba(255,255,255,.09);
}

.aiCoreThreadContextMenu button span{
  width: 18px;
  display: inline-grid;
  place-items: center;
  font-size: 13px;
}

.aiCoreThreadContextDanger{
  color: #fecaca !important;
}

.aiCoreThreadContextDanger:hover{
  background: rgba(220,38,38,.18) !important;
  color: #fff !important;
}

.aiCoreThreadContextDivider{
  height: 1px;
  margin: 6px 4px;
  background: rgba(255,255,255,.10);
}

.aiCoreThreadContextMenu [data-thread-action="pin"][hidden],
.aiCoreThreadContextMenu [data-thread-action="unpin"][hidden]{
  display: none !important;
}




/* =========================================================
   Menú contextual: íconos SVG premium
   ========================================================= */

.aiCoreThreadContextMenu button{
  min-height: 40px !important;
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
}

.aiCoreThreadContextMenu button span{
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  color: currentColor !important;
}

.aiCoreThreadContextMenu button svg{
  width: 18px !important;
  height: 18px !important;
  display: block !important;
  flex: 0 0 auto !important;
}

.aiCoreThreadContextMenu button:hover svg{
  transform: translateY(-.5px) !important;
}

.aiCoreThreadContextDanger svg{
  color: currentColor !important;
}


/* =========================================================
   Dropdown usuario: cerrar sesión con POST seguro
   ========================================================= */

.aiCoreLogoutForm{
  margin: 0 !important;
  padding: 0 !important;
}

.aiCoreLogoutBtn{
  width: 100% !important;
  border: 0 !important;
  border-radius: 0 !important;
  display: block !important;
  padding: 12px 14px !important;
  background: transparent !important;
  color: #fff !important;
  text-align: left !important;
  text-decoration: none !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
  cursor: pointer !important;
}

.aiCoreLogoutBtn:hover{
  background: rgba(255,255,255,.08) !important;
}





/* =========================================================
   Login DTP AI Core
   ========================================================= */

.aiCoreLoginBody{
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(214,51,132,.22), transparent 32%),
    radial-gradient(circle at 84% 20%, rgba(109,47,136,.18), transparent 34%),
    linear-gradient(135deg, #050533 0%, #08084f 46%, #f4f6fb 46%, #eef2f8 100%);
  color: #0f172a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.aiCoreLoginShell{
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.aiCoreLoginCard{
  width: min(460px, 100%);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 32px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 34px 100px rgba(15,23,42,.22);
  backdrop-filter: blur(22px);
  padding: 28px;
}

.aiCoreLoginBrand{
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.aiCoreLoginLogo{
  width: 58px;
  height: 58px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 1000;
  letter-spacing: .02em;
  background: linear-gradient(135deg, #d63384, #6d2f88);
  box-shadow: 0 18px 42px rgba(214,51,132,.28);
}

.aiCoreLoginBrand strong,
.aiCoreLoginBrand span{
  display: block;
}

.aiCoreLoginBrand strong{
  font-size: 18px;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.aiCoreLoginBrand span{
  margin-top: 4px;
  color: #64748b;
  font-size: 13px;
}

.aiCoreLoginIntro{
  margin-bottom: 22px;
}

.aiCoreLoginIntro span{
  display: inline-flex;
  margin-bottom: 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.aiCoreLoginIntro h1{
  margin: 0;
  color: #0f172a;
  font-size: 34px;
  line-height: 1;
  letter-spacing: -.045em;
}

.aiCoreLoginIntro p{
  margin: 12px 0 0;
  color: #64748b;
  font-size: 14.5px;
  line-height: 1.6;
}

.aiCoreLoginAlert{
  margin-bottom: 16px;
  border: 1px solid rgba(220,38,38,.18);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(220,38,38,.08);
  color: #991b1b;
  font-size: 13.5px;
  font-weight: 750;
}

.aiCoreLoginForm{
  display: grid;
  gap: 10px;
}

.aiCoreLoginForm label{
  margin-top: 4px;
  color: #334155;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .10em;
  text-transform: uppercase;
}

.aiCoreLoginInputWrap input{
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(15,23,42,.12);
  border-radius: 17px;
  padding: 0 14px;
  background: #fff;
  color: #0f172a;
  outline: none;
  font-size: 15px;
  box-shadow: 0 10px 24px rgba(15,23,42,.04);
}

.aiCoreLoginInputWrap input:focus{
  border-color: rgba(214,51,132,.45);
  box-shadow:
    0 0 0 4px rgba(214,51,132,.10),
    0 12px 28px rgba(15,23,42,.06);
}

.aiCoreLoginSubmit{
  width: 100%;
  min-height: 50px;
  margin-top: 12px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  background: linear-gradient(135deg, #d63384, #6d2f88);
  color: #fff;
  font-size: 15px;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 18px 38px rgba(214,51,132,.25);
}

.aiCoreLoginSubmit:hover{
  transform: translateY(-1px);
  box-shadow: 0 22px 46px rgba(214,51,132,.30);
}

.aiCoreLoginSubmit:active{
  transform: translateY(0) scale(.99);
}

.aiCoreLoginFooter{
  margin-top: 30px;
  padding-top: 16px;
  border-top: 1px solid rgba(15,23,42,.08);
  color: #64748b;
  font-size: 12.5px;
  text-align: center;
}

@media (max-width: 720px){
  .aiCoreLoginBody{
    overflow: auto;
    background:
      radial-gradient(circle at 20% 0%, rgba(214,51,132,.20), transparent 36%),
      linear-gradient(180deg, #06063f 0%, #08084f 34%, #eef2f8 34%, #f4f6fb 100%);
  }

  .aiCoreLoginShell{
    padding: 18px;
  }

  .aiCoreLoginCard{
    border-radius: 26px;
    padding: 22px;
  }

  .aiCoreLoginIntro h1{
    font-size: 30px;
  }
}



/* =========================================================
   DTP AI Core · Flow Builder IA
   ========================================================= */

.aiCoreShell.isAutomationMode .aiCoreConversationCard{
  border-color: rgba(214,51,132,.26) !important;
  box-shadow:
    0 24px 70px rgba(15,23,42,.10),
    0 0 0 4px rgba(214,51,132,.06) !important;
}

.aiCoreFlowModePill{
  border: 0 !important;
  border-radius: 999px !important;
  padding: 6px 10px !important;
  background: rgba(15,23,42,.06) !important;
  color: #0f172a !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
}

.aiCoreFlowModePill[aria-pressed="true"]{
  background: rgba(214,51,132,.12) !important;
  color: var(--ai-brand2) !important;
}

.aiCoreAutomationChip{
  border-color: rgba(214,51,132,.28) !important;
  background: rgba(214,51,132,.07) !important;
  color: var(--ai-brand2) !important;
  font-weight: 950 !important;
}

.aiCoreFlowCard{
  display: grid;
  gap: 14px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 22px;
  padding: 14px;
  background:
    radial-gradient(circle at top left, rgba(214,51,132,.08), transparent 34%),
    #fff;
  box-shadow: 0 14px 34px rgba(15,23,42,.07);
}

.aiCoreFlowHeader{
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(248,250,252,.86);
  border: 1px solid rgba(15,23,42,.08);
}

.aiCoreFlowHeader span{
  display: inline-flex;
  color: var(--ai-muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.aiCoreFlowHeader h3{
  margin: 5px 0 6px;
  font-size: 18px;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.aiCoreFlowHeader p{
  margin: 0;
  color: var(--ai-muted);
  font-size: 13px;
  line-height: 1.5;
}

.aiCoreFlowStatusStack{
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 6px;
}

.aiCoreFlowStatus{
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.aiCoreFlowStatus.isEnabled,
.aiCoreFlowStatus.isOk{
  background: rgba(22,163,74,.10);
  color: #166534;
}

.aiCoreFlowStatus.isDisabled{
  background: rgba(100,116,139,.10);
  color: #475569;
}

.aiCoreFlowStatus.isWarning{
  background: rgba(217,119,6,.12);
  color: #92400e;
}

.aiCoreFlowGraph{
  overflow-x: auto;
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 4px 2px 8px;
}

.aiCoreFlowTimelineItem{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.aiCoreFlowNodeMini{
  width: 190px;
  min-height: 104px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 18px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15,23,42,.05);
}

.aiCoreFlowNodeMini span{
  display: inline-flex;
  margin-bottom: 8px;
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(15,23,42,.06);
  color: var(--ai-muted);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.aiCoreFlowNodeMini strong{
  display: block;
  color: var(--ai-text);
  font-size: 13px;
  line-height: 1.25;
}

.aiCoreFlowNodeMini small{
  display: block;
  margin-top: 8px;
  color: var(--ai-muted);
  font-size: 11px;
}

.aiCoreFlowNodeMini[data-node-type="trigger"]{
  border-color: rgba(37,99,235,.20);
  background: rgba(37,99,235,.04);
}

.aiCoreFlowNodeMini[data-node-type="integration_write"],
.aiCoreFlowNodeMini[data-node-type="approval"]{
  border-color: rgba(217,119,6,.24);
  background: rgba(217,119,6,.05);
}

.aiCoreFlowNodeMini[data-node-type="output"]{
  border-color: rgba(22,163,74,.22);
  background: rgba(22,163,74,.05);
}

.aiCoreFlowArrow{
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(214,51,132,.10);
  color: var(--ai-brand2);
  font-weight: 1000;
}

.aiCoreFlowWarnings{
  border: 1px solid rgba(217,119,6,.20);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(217,119,6,.07);
  color: #92400e;
}

.aiCoreFlowWarnings strong{
  display: block;
  margin-bottom: 6px;
}

.aiCoreFlowWarnings ul{
  margin: 0;
  padding-left: 18px;
}

.aiCoreFlowFooter{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-top: 1px solid rgba(15,23,42,.08);
  padding-top: 12px;
}

.aiCoreFlowFooter > div{
  min-width: 92px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 15px;
  padding: 8px 10px;
  background: #fff;
}

.aiCoreFlowFooter strong,
.aiCoreFlowFooter span{
  display: block;
}

.aiCoreFlowFooter strong{
  font-size: 16px;
  line-height: 1;
}

.aiCoreFlowFooter span{
  margin-top: 4px;
  color: var(--ai-muted);
  font-size: 10.5px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.aiCoreFlowToggleBtn{
  margin-left: auto;
  background: linear-gradient(135deg, var(--ai-brand), var(--ai-brand2)) !important;
  color: #fff !important;
  border: 0 !important;
}



/* =========================================================
   UX robusta: hilos de flujo vs chats normales
   ========================================================= */

.aiCoreFlowModePill{
  min-width: auto !important;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 6px 10px !important;
  background: rgba(15,23,42,.06) !important;
  color: #334155 !important;
  font-size: 11px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

.aiCoreFlowModePill[aria-pressed="true"]{
  background: rgba(214,51,132,.11) !important;
  color: var(--ai-brand2) !important;
}

.aiCoreFlowModePill.isLocked{
  background: rgba(109,47,136,.12) !important;
  color: var(--ai-brand2) !important;
}

.aiCoreShell.isFlowLocked .aiCoreConversationCard{
  border-color: rgba(214,51,132,.28) !important;
}

.aiCoreShell.isFlowLocked .aiCoreComposerBox{
  box-shadow:
    0 12px 28px rgba(15,23,42,.07),
    0 0 0 3px rgba(214,51,132,.06) !important;
}

.aiCoreThreadItemTop{
  display: grid;
  gap: 7px;
}

.aiCoreThreadTypeBadge{
  width: fit-content;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 10px;
  font-style: normal;
  font-weight: 950;
  line-height: 1;
  letter-spacing: .02em;
}

.aiCoreThreadTypeBadge.isEnabled{
  background: rgba(22,163,74,.13);
  color: #bbf7d0;
}

.aiCoreThreadTypeBadge.isDisabled{
  background: rgba(214,51,132,.15);
  color: #fbcfe8;
}

.aiCoreThreadItem.isActive .aiCoreThreadTypeBadge.isEnabled{
  background: rgba(22,163,74,.12);
  color: #166534;
}

.aiCoreThreadItem.isActive .aiCoreThreadTypeBadge.isDisabled{
  background: rgba(214,51,132,.12);
  color: #9d174d;
}

.aiCoreThreadItem.isFlowThread{
  border-color: rgba(214,51,132,.20) !important;
  background:
    linear-gradient(135deg, rgba(214,51,132,.12), rgba(255,255,255,.07)) !important;
}

.aiCoreThreadItem.isFlowThread.isActive{
  background: #fff !important;
  color: #111827 !important;
}

.aiCoreThreadItem.isFlowEnabled{
  box-shadow: inset 3px 0 0 rgba(22,163,74,.75) !important;
}

.aiCoreThreadItem.isFlowDisabled{
  box-shadow: inset 3px 0 0 rgba(214,51,132,.70) !important;
}

.aiCoreFlowStatus.isNeutral{
  background: rgba(100,116,139,.10);
  color: #475569;
}

.aiCoreFlowToggleBtn{
  min-width: 150px;
}




/* =========================================================
   Flow Builder IA · readiness, faltantes y checklist
   ========================================================= */

.aiCoreFlowReadiness,
.aiCoreFlowMissing,
.aiCoreFlowChecklist{
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 18px;
  padding: 12px 14px;
  background: #fff;
}

.aiCoreFlowReadiness{
  display: grid;
  gap: 10px;
}

.aiCoreFlowReadiness > div:first-child{
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.aiCoreFlowReadiness strong,
.aiCoreFlowMissing strong,
.aiCoreFlowChecklist strong{
  color: var(--ai-text);
  font-size: 13px;
}

.aiCoreFlowReadiness span{
  color: var(--ai-muted);
  font-size: 12px;
  font-weight: 850;
}

.aiCoreFlowReadinessBar{
  height: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15,23,42,.08);
}

.aiCoreFlowReadinessBar i{
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--ai-brand), var(--ai-brand2));
}

.aiCoreFlowMissing{
  border-color: rgba(217,119,6,.20);
  background: rgba(217,119,6,.06);
}

.aiCoreFlowMissing ul,
.aiCoreFlowChecklist ol{
  margin: 8px 0 0;
  padding-left: 18px;
}

.aiCoreFlowMissing li,
.aiCoreFlowChecklist li{
  margin: 7px 0;
  color: #334155;
  font-size: 13px;
  line-height: 1.45;
}

.aiCoreFlowMissing small,
.aiCoreFlowChecklist small,
.aiCoreFlowChecklist span{
  display: block;
  margin-top: 3px;
  color: #64748b;
  font-size: 12px;
}

.aiCoreFlowRunBtn{
  background: rgba(15,23,42,.06) !important;
  color: #334155 !important;
  border: 1px solid rgba(15,23,42,.10) !important;
}

.aiCoreFlowRunBtn:hover{
  background: rgba(15,23,42,.09) !important;
}


/* =========================================================
   Apps dinámicas alimentadas por Flow Builder
   ========================================================= */

.aiCoreFlowCapability{
  display: grid;
  gap: 14px;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 24px;
  padding: 16px;
  background:
    radial-gradient(circle at top left, rgba(214,51,132,.08), transparent 34%),
    #fff;
  box-shadow: 0 18px 44px rgba(15,23,42,.08);
}

.aiCoreFlowCapabilityHeader{
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 20px;
  background: rgba(248,250,252,.92);
  border: 1px solid rgba(15,23,42,.08);
}

.aiCoreFlowCapabilityHeader span{
  display: inline-flex;
  color: var(--ai-muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: .09em;
}

.aiCoreFlowCapabilityHeader h3{
  margin: 5px 0 6px;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.aiCoreFlowCapabilityHeader p{
  margin: 0;
  color: var(--ai-muted);
  font-size: 13px;
  line-height: 1.5;
}

.aiCoreFlowCapabilityStatus{
  height: fit-content;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 11px;
  text-transform: uppercase;
}

.aiCoreFlowCapabilityStatus.isReady{
  background: rgba(22,163,74,.10);
  color: #166534;
}

.aiCoreFlowCapabilityStatus.isWarning{
  background: rgba(217,119,6,.12);
  color: #92400e;
}

.aiCoreDynamicGrid{
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.aiCoreDynamicWidget{
  grid-column: span 12;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 20px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15,23,42,.045);
}

.aiCoreDynamicKpi{
  grid-column: span 4;
}

.aiCoreDynamicKpi span,
.aiCoreDynamicKpi em{
  display: block;
  color: var(--ai-muted);
  font-size: 12px;
  font-style: normal;
}

.aiCoreDynamicKpi strong{
  display: block;
  margin: 8px 0;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -.04em;
}

.aiCoreDynamicTable,
.aiCoreDynamicChart{
  grid-column: span 12;
}

.aiCoreDynamicWidget header{
  margin-bottom: 12px;
}

.aiCoreDynamicWidget header strong,
.aiCoreDynamicAlerts strong{
  display: block;
  font-size: 15px;
  color: var(--ai-text);
}

.aiCoreDynamicWidget header span{
  display: block;
  margin-top: 3px;
  color: var(--ai-muted);
  font-size: 12px;
}

.aiCoreDynamicBars{
  display: grid;
  gap: 10px;
}

.aiCoreDynamicBarRow{
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 50px;
  gap: 10px;
  align-items: center;
}

.aiCoreDynamicBarRow span{
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.aiCoreDynamicBarRow div{
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15,23,42,.08);
}

.aiCoreDynamicBarRow i{
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--ai-brand), var(--ai-brand2));
}

.aiCoreDynamicBarRow strong{
  color: var(--ai-text);
  font-size: 12px;
  text-align: right;
}

.aiCoreFlowCapabilityWarnings{
  display: grid;
  gap: 6px;
}

.aiCoreFlowCapabilityWarnings span{
  border-radius: 14px;
  padding: 9px 11px;
  background: rgba(217,119,6,.08);
  color: #92400e;
  font-size: 12.5px;
  font-weight: 750;
}

.aiCoreDynamicAlerts{
  border-color: rgba(217,119,6,.20);
  background: rgba(217,119,6,.06);
}

.aiCoreDynamicAlerts ul{
  margin: 8px 0 0;
  padding-left: 18px;
}

.aiCoreDynamicAlerts li{
  margin: 5px 0;
  color: #92400e;
  font-size: 13px;
}

.aiCoreDynamicEmpty{
  color: var(--ai-muted);
  font-size: 13px;
}

@media (max-width: 900px){
  .aiCoreDynamicKpi{
    grid-column: span 12;
  }

  .aiCoreDynamicBarRow{
    grid-template-columns: 1fr;
  }
}


.aiCoreFlowActivateHint{
  margin-left: auto;
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(15,23,42,.06);
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.aiCoreFlowCapabilityStatus.isPaused{
  background: rgba(100,116,139,.12);
  color: #475569;
}

.aiCoreFlowCapabilityStatus.isPending{
  background: rgba(217,119,6,.12);
  color: #92400e;
}

.aiCoreFlowCapabilityStatus.isError{
  background: rgba(220,38,38,.12);
  color: #991b1b;
}


/* =========================================================
   Flow Builder IA · Respuestas estructuradas del agente
   ========================================================= */

.aiCoreFlowAdvice{
  display: grid;
  gap: 14px;
  border: 1px solid rgba(214,51,132,.18);
  border-radius: 22px;
  padding: 16px;
  background:
    radial-gradient(circle at top left, rgba(214,51,132,.08), transparent 34%),
    #fff;
  box-shadow: 0 18px 44px rgba(15,23,42,.07);
}

.aiCoreFlowAdviceHeader{
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-radius: 18px;
  padding: 14px;
  background: rgba(248,250,252,.92);
  border: 1px solid rgba(15,23,42,.08);
}

.aiCoreFlowAdviceHeader span{
  display: block;
  color: var(--ai-muted);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.aiCoreFlowAdviceHeader h3{
  margin: 5px 0 6px;
  color: var(--ai-text);
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -.03em;
}

.aiCoreFlowAdviceHeader p{
  margin: 0;
  color: #64748b;
  font-size: 13.5px;
  line-height: 1.55;
}

.aiCoreFlowAdviceHeader > strong{
  flex: 0 0 auto;
  align-self: flex-start;
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(22,163,74,.10);
  color: #166534;
  font-size: 12px;
}

.aiCoreFlowAdviceSection{
  display: grid;
  gap: 10px;
}

.aiCoreFlowAdviceSection h4{
  margin: 0;
  color: var(--ai-text);
  font-size: 15px;
  letter-spacing: -.02em;
}

.aiCoreFlowAdviceGrid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.aiCoreFlowAdviceCard,
.aiCoreFlowAdvicePriority,
.aiCoreFlowAdviceTimeline article{
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}

.aiCoreFlowAdviceCard strong,
.aiCoreFlowAdvicePriority strong,
.aiCoreFlowAdviceTimeline strong{
  display: block;
  color: var(--ai-text);
  font-size: 13.5px;
}

.aiCoreFlowAdviceCard p,
.aiCoreFlowAdvicePriority p,
.aiCoreFlowAdviceTimeline p{
  margin: 6px 0 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.48;
}

.aiCoreFlowAdviceCard small,
.aiCoreFlowAdvicePriority small,
.aiCoreFlowAdviceTimeline small{
  display: block;
  margin-top: 7px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
}

.aiCoreFlowAdviceList{
  display: grid;
  gap: 9px;
}

.aiCoreFlowAdvicePriority{
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
}

.aiCoreFlowAdvicePriority > span{
  display: inline-flex;
  justify-content: center;
  border-radius: 999px;
  padding: 6px 8px;
  background: rgba(214,51,132,.10);
  color: var(--ai-brand);
  font-size: 11px;
  font-weight: 950;
}

.aiCoreFlowAdviceTimeline{
  display: grid;
  gap: 9px;
}

.aiCoreFlowAdviceTimeline article{
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
}

.aiCoreFlowAdviceTimeline article > span{
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ai-brand), var(--ai-brand2));
  color: #fff;
  font-size: 12px;
  font-weight: 950;
}

.aiCoreFlowConfigTable{
  overflow: auto;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 16px;
}

.aiCoreFlowConfigTable table{
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.aiCoreFlowConfigTable th,
.aiCoreFlowConfigTable td{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(15,23,42,.07);
  text-align: left;
  font-size: 12.5px;
}

.aiCoreFlowConfigTable th{
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: rgba(248,250,252,.95);
}

.aiCoreFlowConfigTable td span{
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(15,23,42,.06);
  color: #334155;
  font-weight: 850;
}

.aiCoreFlowNextSteps{
  margin: 0;
  padding-left: 20px;
  color: #334155;
}

.aiCoreFlowNextSteps li{
  margin: 7px 0;
  font-size: 13.5px;
  line-height: 1.45;
}

.aiCoreFlowAdviceWarnings{
  display: grid;
  gap: 7px;
}

.aiCoreFlowAdviceWarnings span{
  border-radius: 14px;
  padding: 9px 11px;
  background: rgba(217,119,6,.08);
  color: #92400e;
  font-size: 12.5px;
  font-weight: 750;
}

@media (max-width: 720px){
  .aiCoreFlowAdviceHeader,
  .aiCoreFlowAdvicePriority,
  .aiCoreFlowAdviceTimeline article{
    grid-template-columns: 1fr;
  }

  .aiCoreFlowAdviceHeader{
    display: grid;
  }
}




/* =========================================================
   Actividad IA dentro de conversación
   ========================================================= */

.aiCoreActivityMessage{
  animation: aiCoreFadeIn .18s ease both;
}

.aiCoreActivityBubble{
  max-width: 760px;
  border: 1px solid rgba(214,51,132,.16) !important;
  background:
    radial-gradient(circle at top left, rgba(214,51,132,.08), transparent 34%),
    rgba(255,255,255,.98) !important;
}

.aiCoreActivityHeader{
  display: flex;
  align-items: center;
  gap: 9px;
}

.aiCoreActivityHeader strong{
  color: var(--ai-text);
  font-size: 13px;
  font-weight: 950;
}

.aiCoreActivityBubble p{
  margin: 7px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.aiCoreActivityPulse{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ai-brand), var(--ai-brand2));
  box-shadow: 0 0 0 0 rgba(214,51,132,.28);
  animation: aiCorePulse 1.2s infinite;
}

.aiCoreActivitySteps{
  display: flex;
  gap: 5px;
  margin-top: 10px;
}

.aiCoreActivitySteps span{
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(214,51,132,.38);
  animation: aiCoreTyping 1s infinite ease-in-out;
}

.aiCoreActivitySteps span:nth-child(2){
  animation-delay: .14s;
}

.aiCoreActivitySteps span:nth-child(3){
  animation-delay: .28s;
}

.aiCoreJsonBlock{
  overflow: auto;
  max-height: 360px;
  border-radius: 18px;
  padding: 14px 16px;
  background: #0f172a;
  color: #e5e7eb;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.aiCoreStructuredHeader{
  border-radius: 18px;
  padding: 14px;
  border: 1px solid rgba(15,23,42,.08);
  background: rgba(248,250,252,.95);
  margin-bottom: 12px;
}

.aiCoreStructuredHeader h3{
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: -.03em;
}

.aiCoreStructuredHeader p{
  margin: 0;
  color: #64748b;
  font-size: 13.5px;
  line-height: 1.5;
}

.aiCoreStructuredBlock{
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.aiCoreStructuredBlock h4{
  margin: 0;
  font-size: 15px;
}

.aiCoreStatsGrid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.aiCoreStatCard{
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
}

.aiCoreStatCard span{
  display: block;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 900;
}

.aiCoreStatCard strong{
  display: block;
  margin-top: 8px;
  color: var(--ai-text);
  font-size: 24px;
  line-height: 1;
}

@keyframes aiCorePulse{
  0%{ box-shadow: 0 0 0 0 rgba(214,51,132,.28); }
  70%{ box-shadow: 0 0 0 9px rgba(214,51,132,0); }
  100%{ box-shadow: 0 0 0 0 rgba(214,51,132,0); }
}

@keyframes aiCoreTyping{
  0%, 80%, 100%{
    opacity: .35;
    transform: translateY(0);
  }
  40%{
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes aiCoreFadeIn{
  from{
    opacity: 0;
    transform: translateY(4px);
  }
  to{
    opacity: 1;
    transform: translateY(0);
  }
}



/* =========================================================
   Flow Builder IA · Mensaje principal legible y completo
   ========================================================= */

.aiCoreFlowAdviceReadable{
  gap: 14px;
}

.aiCoreFlowAdviceMainText{
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 18px;
  padding: 16px 18px;
  background: #fff;
  color: #1f2937;
  font-size: 15px;
  line-height: 1.68;
  white-space: normal;
}

.aiCoreFlowAdviceMainText p{
  margin: 0 0 12px;
}

.aiCoreFlowAdviceMainText p:last-child{
  margin-bottom: 0;
}

.aiCoreFlowAdviceMainText ul,
.aiCoreFlowAdviceMainText ol{
  margin: 10px 0 10px 22px;
  padding: 0;
}

.aiCoreFlowAdviceMainText li{
  margin: 6px 0;
}

.aiCoreFlowAdviceMainText strong{
  color: #111827;
  font-weight: 900;
}

.aiCoreFlowAdviceHeader h3{
  max-width: 100%;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
}

.aiCoreFlowAdviceHeader p{
  max-width: 100%;
  overflow: visible;
  text-overflow: unset;
  white-space: normal;
}




/* =========================================================
   Flow Builder IA · Render de respuesta JSON estructurada
   ========================================================= */

.aiCoreFlowAdviceReadable{
  display: grid;
  gap: 14px;
}

.aiCoreFlowAdviceHeader{
  align-items: flex-start;
}

.aiCoreFlowAdviceHeader h3{
  max-width: 100%;
  margin-bottom: 8px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.aiCoreFlowAdviceHeader p{
  max-width: 980px;
  color: #475569;
  font-size: 14.5px;
  line-height: 1.62;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.aiCoreFlowAdviceCard p,
.aiCoreFlowAdvicePriority p,
.aiCoreFlowAdviceTimeline p{
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

.aiCoreFlowAdviceCard small,
.aiCoreFlowAdvicePriority small,
.aiCoreFlowAdviceTimeline small{
  white-space: normal;
}



.aiCoreFlowAdviceMainText{
  border:1px solid rgba(15,23,42,.08);
  border-radius:18px;
  padding:16px 18px;
  background:#fff;
  color:#1f2937;
  font-size:14.5px;
  line-height:1.7;
  white-space:pre-line;
}

.aiCoreFlowAdviceHeader p{
  white-space:pre-line;
}




/* =========================================================
   Sidebar · Departamento + pestañas Chats / Flujos / Apps
   ========================================================= */

.aiCoreDepartmentSwitcher{
  gap: 9px;
}

.aiCoreDepartmentSwitcher small{
  color: rgba(255,255,255,.58);
  font-size: 12px;
  line-height: 1.4;
}

.aiCoreConversationHub{
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-rows: auto auto auto minmax(0,1fr);
}

.aiCoreHubTabs{
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.10);
}

.aiCoreHubTabs button{
  flex: 1 1 0;
  width: auto;
  border: 0;
  min-width: 0;
  min-height: 34px;
  border-radius: 999px;
  background: transparent;
  color: rgba(255,255,255,.68);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .01em;
  white-space: nowrap;
}

.aiCoreHubTabs button:hover{
  background: rgba(255,255,255,.08);
  color: #fff;
}

.aiCoreHubTabs button.isActive{
  background: #fff;
  color: #14144f;
  box-shadow: 0 12px 28px rgba(0,0,0,.18);
}

.aiCoreHubEmpty,
.aiCoreHubLoading{
  border: 1px dashed rgba(255,255,255,.16);
  border-radius: 18px;
  padding: 16px;
  color: rgba(255,255,255,.68);
  background: rgba(255,255,255,.06);
}

.aiCoreHubEmpty strong{
  display: block;
  color: #fff;
  font-size: 14px;
  margin-bottom: 5px;
}

.aiCoreHubEmpty span,
.aiCoreHubLoading{
  font-size: 12.5px;
  line-height: 1.45;
}

.aiCoreAppListItem strong{
  padding-right: 4px;
}

.aiCoreThreadTypeBadge.isChat{
  background: rgba(255,255,255,.12);
  color: rgba(255,255,255,.78);
}

.aiCoreModalHint{
  margin: -4px 0 0;
  color: var(--ai-muted);
  font-size: 13px;
  line-height: 1.45;
}



/* Ajuste responsive de pestañas del workspace:
   - 2 pestañas: Chat / Flujos ocupan 50% cada una.
   - 1 pestaña visible: ocupa todo el ancho.
   - Si en el futuro vuelve una tercera pestaña, también se adapta sin dejar huecos. */
.aiCoreHubTabs > button[hidden],
.aiCoreHubTabs > [hidden]{
  display: none !important;
}

.aiCoreHubTabs:has(> button:not([hidden]):only-child){
  padding: 5px;
}


/* =========================================================
   Workspace tabs · permisos por departamento
   ========================================================= */

.aiCoreHubTabs button[hidden]{
  display:none !important;
}

.aiCoreHubTabs button:disabled{
  opacity:.45;
  cursor:not-allowed;
}

.aiCoreHubLoading,
.aiCoreHubEmpty{
  border:1px dashed rgba(255,255,255,.16);
  border-radius:18px;
  padding:16px;
  color:rgba(255,255,255,.68);
  background:rgba(255,255,255,.06);
}

.aiCoreHubEmpty strong{
  display:block;
  color:#fff;
  font-size:14px;
  margin-bottom:5px;
}

.aiCoreHubEmpty span,
.aiCoreHubLoading{
  font-size:12.5px;
  line-height:1.45;
}

.aiCoreThreadItemTop{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
}

.aiCoreThreadTypeBadge{
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  padding:4px 8px;
  font-style:normal;
  font-size:10px;
  line-height:1;
  font-weight:1000;
  letter-spacing:.02em;
}

.aiCoreThreadTypeBadge.isChat{
  background:rgba(255,255,255,.12);
  color:rgba(255,255,255,.78);
}

.aiCoreThreadItem.isActive .aiCoreThreadTypeBadge.isChat{
  background:rgba(15,23,42,.08);
  color:#475569;
}

.aiCoreThreadTypeBadge.isEnabled{
  background:rgba(22,163,74,.14);
  color:#bbf7d0;
}

.aiCoreThreadItem.isActive .aiCoreThreadTypeBadge.isEnabled{
  background:rgba(22,163,74,.12);
  color:#166534;
}

.aiCoreThreadTypeBadge.isDisabled{
  background:rgba(245,158,11,.14);
  color:#fde68a;
}

.aiCoreThreadItem.isActive .aiCoreThreadTypeBadge.isDisabled{
  background:rgba(245,158,11,.14);
  color:#92400e;
}

.aiCoreModalHint{
  margin:-2px 0 0;
  color:var(--ai-muted);
  font-size:13px;
  line-height:1.45;
}


/* =========================================================
   Workspace · Departamento integrado y ultra compacto
   ========================================================= */

.aiCoreDepartmentSwitcher{
  display: none !important;
}

.aiCoreSidebar{
  gap: 10px !important;
}

.aiCoreConversationHub{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) !important;
  gap: 9px !important;
  padding: 16px 18px !important;
}

.aiCoreConversationHubHeader{
  margin: 0 !important;
  min-height: 40px !important;
}

.aiCoreWorkspaceDepartmentInline{
  display: grid;
  gap: 6px;
  padding: 8px 9px 9px;
  border-radius: 18px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.10);
}

.aiCoreWorkspaceDepartmentTop{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.aiCoreWorkspaceDepartmentTop label{
  margin-bottom: 2px;
  color: rgba(255,255,255,.82);
  font-size: 10px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.aiCoreWorkspaceDepartmentTop small{
  min-width: 0;
  color: rgba(255,255,255,.54);
  font-size: 10.8px;
  line-height: 1.15;
  text-align: right;
}

.aiCoreWorkspaceDepartmentInline select{
  width: 100%;
  height: 28px !important;
  min-height: 28px !important;
  padding: 0 28px 3.5px 12px !important;
  border-radius: 50px !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  background: #fff !important;
  color: #101225 !important;
  font-size: 14px !important;
  line-height: 1 !important;
}

.aiCoreHubTabs{
  margin-top: 0 !important;
}

.aiCoreConversationHubDivider{
  margin: 0 !important;
}

.aiCoreThreads{
  min-height: 0 !important;
  height: 100% !important;
  overflow-y: auto !important;
}



/* =========================================================
   Admin · Auth como módulo empresarial 07
   ========================================================= */

.ai-admin-auth-grid{
  margin-top: 16px;
}

.ai-admin-auth-grid .ai-admin-section > header > span{
  background: linear-gradient(135deg,#2563eb,#7c3aed);
}

.ai-admin-auth-grid .ai-admin-model-card small{
  color: #64748b;
}




/* =========================================================
   Apps dinámicas · Código generado seguro
   ========================================================= */

.aiCoreFlowCapabilityGenerated{
  padding: 16px;
}

.aiCoreGeneratedAppShell{
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 24px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 18px 60px rgba(15,23,42,.08);
}

.aiCoreGeneratedAppFrame{
  width: 100%;
  min-height: 720px;
  border: 0;
  display: block;
  background: #fff;
}

.aiCoreFlowCapabilityGenerated .aiCoreFlowCapabilityHeader{
  margin-bottom: 14px;
}

@media (max-width: 900px){
  .aiCoreGeneratedAppFrame{
    min-height: 640px;
  }
}




/* =========================================================
   Flow Builder chips
   ========================================================= */

.aiCoreAppBuilderChip{
  border-color: rgba(123,30,138,.22) !important;
  background: rgba(123,30,138,.08) !important;
  color: #7B1E8A !important;
}

.aiCoreAppBuilderChip:disabled{
  opacity: .45;
  cursor: not-allowed;
}

.aiCoreShell:not(.isFlowLocked) #aiCoreModifyAppChip{
  display: none !important;
}




/* =========================================================
   Generated dynamic app iframe
   ========================================================= */

.aiCoreGeneratedAppShell{
  width:100%;
  border:1px solid rgba(22,24,28,.10);
  border-radius:24px;
  overflow:hidden;
  background:#fff;
  box-shadow:0 18px 60px rgba(9,6,74,.06);
}

.aiCoreGeneratedAppFrame{
  width:100%;
  min-height:760px;
  border:0;
  display:block;
  background:#fff;
}



/* =========================================================
   Universal Dynamic Apps
   ========================================================= */

.aiCoreUniversalApp{
  border:1px solid rgba(22,24,28,.10);
  border-radius:28px;
  background:#fff;
  box-shadow:0 22px 70px rgba(9,6,74,.08);
  overflow:hidden;
}

.aiCoreUniversalAppHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  padding:22px;
  border-bottom:1px solid rgba(22,24,28,.08);
  background:radial-gradient(circle at top left,rgba(184,50,160,.12),transparent 30rem),#fff;
}

.aiCoreUniversalAppHeader span,
.aiCoreUniversalHero span,
.aiCoreUniversalPanel header span,
.aiCoreUniversalMetrics article span{
  display:block;
  color:#667085;
  font-size:11px;
  letter-spacing:.13em;
  text-transform:uppercase;
  font-weight:1000;
  margin-bottom:8px;
}

.aiCoreUniversalAppHeader h3,
.aiCoreUniversalHero h2,
.aiCoreUniversalPanel header h4{
  margin:0;
  color:#16181C;
  letter-spacing:-.035em;
}

.aiCoreUniversalAppHeader h3{
  font-size:24px;
}

.aiCoreUniversalAppHeader p,
.aiCoreUniversalHero p,
.aiCoreUniversalPanel header p{
  margin:8px 0 0;
  color:#667085;
  line-height:1.55;
}

.aiCoreUniversalAppBody{
  display:grid;
  gap:14px;
  padding:18px;
  background:#F6F4F0;
}

.aiCoreUniversalHero,
.aiCoreUniversalPanel,
.aiCoreUniversalMetrics article,
.aiCoreUniversalEmpty{
  border:1px solid rgba(22,24,28,.10);
  border-radius:24px;
  background:#fff;
  box-shadow:0 16px 50px rgba(9,6,74,.05);
}

.aiCoreUniversalHero{
  padding:22px;
}

.aiCoreUniversalHero h2{
  font-size:30px;
}

.aiCoreUniversalMetrics{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}

.aiCoreUniversalMetrics article{
  padding:16px;
}

.aiCoreUniversalMetrics article strong{
  display:block;
  color:#16181C;
  font-size:26px;
  letter-spacing:-.04em;
}

.aiCoreUniversalMetrics article small{
  display:block;
  margin-top:6px;
  color:#94A3B8;
}

.aiCoreUniversalPanel{
  padding:18px;
}

.aiCoreUniversalPanel header{
  margin-bottom:16px;
}

.aiCoreUniversalPanel header h4{
  font-size:21px;
}

.aiCoreUniversalForm{
  display:grid;
  gap:16px;
}

.aiCoreUniversalFields{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.aiCoreUniversalField{
  display:grid;
  gap:7px;
}

.aiCoreUniversalField span{
  color:#334155;
  font-size:13px;
  font-weight:950;
}

.aiCoreUniversalField input,
.aiCoreUniversalField textarea,
.aiCoreUniversalField select{
  width:100%;
  border:1px solid rgba(22,24,28,.13);
  border-radius:16px;
  padding:12px 13px;
  background:#fff;
  color:#111827;
  font:inherit;
}

.aiCoreUniversalField textarea{
  min-height:110px;
  resize:vertical;
}

.aiCoreUniversalField small{
  color:#94A3B8;
  line-height:1.35;
}

.aiCoreUniversalFieldFull{
  grid-column:1 / -1;
}

.aiCoreUniversalCheck{
  display:flex;
  align-items:center;
  gap:10px;
  min-height:48px;
}

.aiCoreUniversalCheck input{
  width:auto;
}

.aiCoreUniversalFormFooter{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding-top:14px;
  border-top:1px solid rgba(22,24,28,.08);
}

.aiCoreUniversalFormFooter button{
  border:0;
  border-radius:999px;
  padding:13px 20px;
  color:#fff;
  background:linear-gradient(135deg,#B832A0,#7B1E8A);
  font-weight:1000;
  cursor:pointer;
}

.aiCoreUniversalFormFooter small{
  color:#667085;
}

.aiCoreUniversalTableWrap{
  overflow:auto;
  border:1px solid rgba(22,24,28,.10);
  border-radius:18px;
}

.aiCoreUniversalTableWrap table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
}

.aiCoreUniversalTableWrap th,
.aiCoreUniversalTableWrap td{
  text-align:left;
  padding:11px 12px;
  border-bottom:1px solid rgba(22,24,28,.08);
  font-size:13px;
}

.aiCoreUniversalTableWrap th{
  background:#F8FAFC;
  color:#475569;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:11px;
}

.aiCoreUniversalEmpty{
  padding:18px;
  color:#667085;
}

.aiCoreUniversalEmpty strong{
  display:block;
  color:#16181C;
  margin-bottom:5px;
}

@media(max-width:900px){
  .aiCoreUniversalAppHeader{
    flex-direction:column;
  }

  .aiCoreUniversalHero h2{
    font-size:24px;
  }

  .aiCoreUniversalMetrics{
    grid-template-columns:1fr;
  }

  .aiCoreUniversalFields{
    grid-template-columns:1fr;
  }

  .aiCoreUniversalFieldFull{
    grid-column:auto;
  }

  .aiCoreUniversalFormFooter{
    align-items:flex-start;
    flex-direction:column;
  }
}




/* =========================================================
   Universal App schema states
   ========================================================= */

.aiCoreUniversalSchemaNotice,
.aiCoreUniversalSchemaMissing{
  border:1px solid rgba(184,50,160,.18);
  background:rgba(184,50,160,.06);
  color:#5B2164;
  border-radius:18px;
  padding:14px 16px;
  margin-bottom:14px;
}

.aiCoreUniversalSchemaNotice strong,
.aiCoreUniversalSchemaMissing strong{
  display:block;
  color:#4A154B;
  font-weight:1000;
  margin-bottom:5px;
}

.aiCoreUniversalSchemaNotice p,
.aiCoreUniversalSchemaMissing p{
  margin:0;
  color:#6B3A70;
  line-height:1.45;
}

.aiCoreUniversalFormFooter button:disabled{
  opacity:.45;
  cursor:not-allowed;
  filter:grayscale(.4);
}



/* =========================================================
   Universal nested fields / repeaters
   ========================================================= */

.aiCoreUniversalNested,
.aiCoreUniversalRepeater{
  border:1px solid rgba(22,24,28,.10);
  border-radius:22px;
  background:rgba(255,255,255,.82);
  padding:16px;
}

.aiCoreUniversalNested > header,
.aiCoreUniversalRepeater > header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:14px;
  margin-bottom:14px;
}

.aiCoreUniversalNested > header strong,
.aiCoreUniversalRepeater > header strong{
  display:block;
  color:#16181C;
  font-weight:1000;
  font-size:16px;
}

.aiCoreUniversalNested > header p,
.aiCoreUniversalRepeater > header p{
  margin:5px 0 0;
  color:#667085;
  line-height:1.45;
}

.aiCoreUniversalRepeater > header button,
.aiCoreUniversalRepeaterRowHead button{
  border:1px solid rgba(184,50,160,.22);
  border-radius:999px;
  background:rgba(184,50,160,.08);
  color:#7B1E8A;
  padding:8px 12px;
  font-weight:1000;
  cursor:pointer;
}

.aiCoreUniversalRepeaterRow{
  border:1px solid rgba(22,24,28,.09);
  border-radius:18px;
  background:#fff;
  padding:14px;
  margin-top:10px;
}

.aiCoreUniversalRepeaterRowHead{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}

.aiCoreUniversalRepeaterRowHead strong{
  color:#334155;
  font-weight:1000;
}


/* =========================================================
   FIX FINAL - Workspace context menu: chats / flujos / apps
   Corrige texto cortado, layout, ancho y legibilidad.
   ========================================================= */

#aiCoreThreadContextMenu.aiCoreThreadContextMenu{
  position: fixed !important;
  z-index: 999999 !important;
  width: 260px !important;
  min-width: 260px !important;
  max-width: 280px !important;
  padding: 10px !important;
  border-radius: 22px !important;
  background: rgba(10, 16, 35, .98) !important;
  border: 1px solid rgba(255,255,255,.11) !important;
  box-shadow:
    0 30px 90px rgba(0,0,0,.42),
    inset 0 1px 0 rgba(255,255,255,.08) !important;
  backdrop-filter: blur(18px) !important;
  -webkit-backdrop-filter: blur(18px) !important;
  color: #fff !important;
  overflow: hidden !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu[hidden]{
  display: none !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu button{
  width: 100% !important;
  min-height: 46px !important;
  display: grid !important;
  grid-template-columns: 34px minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 10px !important;
  padding: 10px 12px !important;
  border: 0 !important;
  border-radius: 16px !important;
  background: transparent !important;
  color: rgba(255,255,255,.92) !important;
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 950 !important;
  line-height: 1.15 !important;
  text-align: left !important;
  white-space: nowrap !important;
  cursor: pointer !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu button:hover{
  background: rgba(255,255,255,.085) !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu button > span:first-child{
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  display: inline-grid !important;
  place-items: center !important;
  border-radius: 13px !important;
  color: rgba(255,255,255,.90) !important;
  background: rgba(255,255,255,.07) !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 1 !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu button > span[data-context-label]{
  width: auto !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  display: block !important;
  color: inherit !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  opacity: 1 !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu button svg{
  width: 18px !important;
  height: 18px !important;
  display: block !important;
  flex: 0 0 auto !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu .aiCoreThreadContextDivider{
  height: 1px !important;
  margin: 8px 6px !important;
  background: rgba(255,255,255,.12) !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu .aiCoreContextRename > span:first-child{
  color: #f7d7ff !important;
  background: rgba(184,50,160,.16) !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu .aiCoreThreadContextDanger{
  color: #ffd1d1 !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu .aiCoreThreadContextDanger > span:first-child{
  color: #ffb4b4 !important;
  background: rgba(255,49,49,.13) !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu .aiCoreThreadContextDanger:hover{
  background: rgba(255,49,49,.16) !important;
  color: #fff !important;
}

#aiCoreThreadContextMenu.aiCoreThreadContextMenu [data-thread-action="pin"][hidden],
#aiCoreThreadContextMenu.aiCoreThreadContextMenu [data-thread-action="unpin"][hidden],
#aiCoreThreadContextMenu.aiCoreThreadContextMenu [data-thread-action="rename"][hidden]{
  display: none !important;
}



/* =========================================================
   DTP AI Core modern confirm / prompt dialog
   ========================================================= */

.aiCoreDialogOpen{
  overflow:hidden;
}

.aiCoreModernDialog{
  position:fixed;
  inset:0;
  z-index:1000000;
  display:grid;
  place-items:center;
  padding:24px;
}

.aiCoreModernDialog[hidden]{
  display:none !important;
}

.aiCoreModernDialogBackdrop{
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 50% 20%, rgba(214,51,132,.20), transparent 34%),
    rgba(4,6,28,.54);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
}

.aiCoreModernDialogCard{
  position:relative;
  width:min(100%,460px);
  border:1px solid rgba(255,255,255,.70);
  border-radius:30px;
  background:
    linear-gradient(180deg,rgba(255,255,255,.98),rgba(255,255,255,.92));
  box-shadow:
    0 40px 120px rgba(4,6,28,.34),
    inset 0 1px 0 rgba(255,255,255,.85);
  padding:24px;
  animation:aiCoreDialogIn .18s ease-out;
}

@keyframes aiCoreDialogIn{
  from{
    opacity:0;
    transform:translateY(10px) scale(.98);
  }
  to{
    opacity:1;
    transform:translateY(0) scale(1);
  }
}

.aiCoreModernDialogClose{
  position:absolute;
  top:14px;
  right:14px;
  width:34px;
  height:34px;
  border:1px solid rgba(15,23,42,.08);
  border-radius:999px;
  background:rgba(15,23,42,.04);
  color:#475569;
  font-size:22px;
  line-height:1;
  display:grid;
  place-items:center;
}

.aiCoreModernDialogClose:hover{
  background:rgba(15,23,42,.08);
}

.aiCoreModernDialogIcon{
  width:58px;
  height:58px;
  border-radius:22px;
  display:grid;
  place-items:center;
  color:#fff;
  font-weight:1000;
  letter-spacing:.02em;
  background:linear-gradient(135deg,var(--ai-brand),var(--ai-brand2));
  box-shadow:0 22px 50px rgba(214,51,132,.26);
  margin-bottom:18px;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogIcon{
  background:linear-gradient(135deg,#FF3131,#FF914D);
  box-shadow:0 22px 50px rgba(255,49,49,.24);
}

.aiCoreModernDialogEyebrow{
  display:block;
  margin-bottom:7px;
  color:#667085;
  font-size:12px;
  font-weight:1000;
  text-transform:uppercase;
  letter-spacing:.12em;
}

.aiCoreModernDialogBody h3{
  margin:0;
  color:#111827;
  font-size:24px;
  line-height:1.12;
  letter-spacing:-.035em;
}

.aiCoreModernDialogBody p{
  margin:11px 0 0;
  color:#667085;
  font-size:15px;
  line-height:1.55;
}

.aiCoreModernDialogInputWrap{
  margin-top:18px;
  display:grid;
  gap:8px;
}

.aiCoreModernDialogInputWrap[hidden]{
  display:none !important;
}

.aiCoreModernDialogInputWrap label{
  color:#334155;
  font-size:13px;
  font-weight:1000;
}

.aiCoreModernDialogInput{
  width:100%;
  border:1px solid rgba(15,23,42,.13);
  border-radius:18px;
  padding:14px 15px;
  background:#fff;
  color:#111827;
  outline:none;
  font-weight:800;
}

.aiCoreModernDialogInput:focus{
  border-color:rgba(214,51,132,.50);
  box-shadow:0 0 0 5px rgba(214,51,132,.10);
}

.aiCoreModernDialogInput.hasError{
  border-color:rgba(220,38,38,.55);
  box-shadow:0 0 0 5px rgba(220,38,38,.10);
}

.aiCoreModernDialogInputWrap small{
  color:#667085;
  line-height:1.4;
}

.aiCoreModernDialogActions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:24px;
}

.aiCoreModernDialogActions button{
  border-radius:999px;
  padding:12px 16px;
  font-weight:1000;
  border:1px solid rgba(15,23,42,.10);
}

.aiCoreModernDialogCancel{
  background:#fff;
  color:#334155;
}

.aiCoreModernDialogCancel:hover{
  background:#f8fafc;
}

.aiCoreModernDialogConfirm{
  border-color:transparent !important;
  color:#fff;
  background:linear-gradient(135deg,var(--ai-brand),var(--ai-brand2));
  box-shadow:0 16px 34px rgba(214,51,132,.22);
}

.aiCoreModernDialogConfirm:hover{
  filter:brightness(1.03);
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogConfirm{
  background:linear-gradient(135deg,#FF3131,#FF914D);
  box-shadow:0 16px 34px rgba(255,49,49,.24);
}

@media (max-width:560px){
  .aiCoreModernDialog{
    padding:16px;
    align-items:end;
  }

  .aiCoreModernDialogCard{
    width:100%;
    border-radius:28px;
    padding:22px;
  }

  .aiCoreModernDialogActions{
    display:grid;
    grid-template-columns:1fr;
  }

  .aiCoreModernDialogConfirm{
    order:-1;
  }
}


/* =========================================================
   DTP AI Core modern dialog - danger state aligned to layout
   ========================================================= */

.aiCoreModernDialog.isDanger .aiCoreModernDialogCard{
  border: 1px solid rgba(184, 50, 160, .22) !important;
  background:
    radial-gradient(circle at top left, rgba(184, 50, 160, .12), transparent 28rem),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,255,255,.94)) !important;
  box-shadow:
    0 42px 120px rgba(9, 6, 74, .34),
    0 18px 60px rgba(184, 50, 160, .16),
    inset 0 1px 0 rgba(255,255,255,.86) !important;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogBackdrop{
  background:
    radial-gradient(circle at 50% 18%, rgba(184, 50, 160, .24), transparent 34%),
    rgba(9, 6, 74, .62) !important;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogIcon{
  color: #fff !important;
  background: linear-gradient(135deg, #B832A0, #7B1E8A) !important;
  box-shadow:
    0 22px 54px rgba(184, 50, 160, .30),
    inset 0 1px 0 rgba(255,255,255,.20) !important;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogEyebrow{
  color: #7B1E8A !important;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogBody h3{
  color: #16181C !important;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogBody p{
  color: #5F6772 !important;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogCancel{
  background: #fff !important;
  color: #334155 !important;
  border: 1px solid rgba(22, 24, 28, .10) !important;
  box-shadow: 0 10px 26px rgba(9, 6, 74, .06) !important;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogCancel:hover{
  background: rgba(184, 50, 160, .06) !important;
  color: #7B1E8A !important;
  border-color: rgba(184, 50, 160, .20) !important;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogConfirm{
  color: #fff !important;
  background: linear-gradient(135deg, #B832A0, #7B1E8A) !important;
  border-color: transparent !important;
  box-shadow:
    0 18px 42px rgba(184, 50, 160, .28),
    inset 0 1px 0 rgba(255,255,255,.18) !important;
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogConfirm:hover{
  filter: brightness(1.04) saturate(1.04) !important;
  transform: translateY(-1px);
}

.aiCoreModernDialog.isDanger .aiCoreModernDialogConfirm:active{
  transform: translateY(0);
}


/* =========================================================
   DTP AI Core - Smart spreadsheet import UI
   ========================================================= */

.aiCoreImportPanel{
  margin-top:18px;
  border:1px solid rgba(184,50,160,.14);
  border-radius:28px;
  background:
    radial-gradient(circle at top left, rgba(184,50,160,.10), transparent 30rem),
    rgba(255,255,255,.94);
  box-shadow:
    0 20px 70px rgba(9,6,74,.07),
    inset 0 1px 0 rgba(255,255,255,.82);
  padding:22px;
}

.aiCoreImportPanelHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  margin-bottom:18px;
}

.aiCoreImportPanelHeader span{
  display:block;
  color:#667085;
  font-size:12px;
  font-weight:1000;
  letter-spacing:.14em;
  text-transform:uppercase;
  margin-bottom:7px;
}

.aiCoreImportPanelHeader h4{
  margin:0;
  color:#16181C;
  font-size:24px;
  line-height:1.1;
  letter-spacing:-.035em;
}

.aiCoreImportPanelHeader p{
  margin:9px 0 0;
  color:#667085;
  line-height:1.55;
  max-width:860px;
}

.aiCoreImportBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  padding:9px 13px;
  background:rgba(22,163,74,.10);
  color:#166534;
  font-size:12px;
  font-weight:1000;
  white-space:nowrap;
}

.aiCoreImportControls{
  display:grid;
  grid-template-columns:minmax(220px,.8fr) minmax(260px,1.2fr) auto;
  gap:12px;
  align-items:end;
}

.aiCoreImportControl{
  display:grid;
  gap:7px;
}

.aiCoreImportControl span{
  color:#334155;
  font-size:13px;
  font-weight:1000;
}

.aiCoreImportControl select{
  width:100%;
  min-height:48px;
  border:1px solid rgba(22,24,28,.11);
  border-radius:17px;
  background:#fff;
  color:#16181C;
  padding:0 14px;
  font-weight:850;
  outline:none;
}

.aiCoreImportControl select:focus{
  border-color:rgba(184,50,160,.42);
  box-shadow:0 0 0 5px rgba(184,50,160,.10);
}

.aiCoreImportDropzone{
  min-height:74px;
  display:grid;
  align-content:center;
  gap:5px;
  border:1.5px dashed rgba(184,50,160,.30);
  border-radius:20px;
  background:rgba(184,50,160,.05);
  padding:13px 16px;
  cursor:pointer;
}

.aiCoreImportDropzone:hover{
  background:rgba(184,50,160,.075);
  border-color:rgba(184,50,160,.45);
}

.aiCoreImportDropzone strong{
  color:#4A154B;
  font-size:15px;
  font-weight:1000;
  overflow:hidden;
  white-space:nowrap;
  text-overflow:ellipsis;
}

.aiCoreImportDropzone small{
  color:#667085;
  font-weight:700;
}

.aiCoreImportControls > button,
.aiCoreImportActions button{
  min-height:48px;
  border:0;
  border-radius:999px;
  padding:0 18px;
  color:#fff;
  font-weight:1000;
  background:linear-gradient(135deg,#B832A0,#7B1E8A);
  box-shadow:0 18px 42px rgba(184,50,160,.24);
  cursor:pointer;
  white-space:nowrap;
}

.aiCoreImportControls > button:disabled,
.aiCoreImportActions button:disabled{
  opacity:.48;
  cursor:not-allowed;
  filter:grayscale(.35);
}

.aiCoreImportStatus{
  margin-top:14px;
  border-radius:18px;
  padding:13px 15px;
  font-weight:850;
  line-height:1.45;
  border:1px solid rgba(22,24,28,.09);
  color:#475569;
  background:#fff;
}

.aiCoreImportStatus.loading{
  border-color:rgba(59,130,246,.16);
  background:rgba(59,130,246,.06);
  color:#1D4ED8;
}

.aiCoreImportStatus.success{
  border-color:rgba(22,163,74,.18);
  background:rgba(22,163,74,.07);
  color:#166534;
}

.aiCoreImportStatus.warning{
  border-color:rgba(245,158,11,.24);
  background:rgba(245,158,11,.09);
  color:#92400E;
}

.aiCoreImportStatus.error{
  border-color:rgba(184,50,160,.24);
  background:rgba(184,50,160,.08);
  color:#7B1E8A;
}

.aiCoreImportPreview{
  margin-top:16px;
}

.aiCoreImportStats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}

.aiCoreImportStats article{
  border:1px solid rgba(22,24,28,.08);
  border-radius:20px;
  background:#fff;
  padding:16px;
}

.aiCoreImportStats span{
  display:block;
  color:#667085;
  font-size:12px;
  font-weight:900;
  margin-bottom:8px;
}

.aiCoreImportStats strong{
  display:block;
  color:#16181C;
  font-size:26px;
  line-height:1;
  letter-spacing:-.04em;
}

.aiCoreImportGrid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
  margin-top:12px;
}

.aiCoreImportGrid section,
.aiCoreImportRows{
  border:1px solid rgba(22,24,28,.08);
  border-radius:22px;
  background:#fff;
  padding:16px;
}

.aiCoreImportGrid h5,
.aiCoreImportRows h5{
  margin:0 0 12px;
  color:#16181C;
  font-size:15px;
  font-weight:1000;
}

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

.aiCoreImportChips span{
  display:inline-flex;
  border-radius:999px;
  padding:7px 10px;
  color:#4A154B;
  background:rgba(184,50,160,.08);
  font-size:12px;
  font-weight:900;
}

.aiCoreImportMapping{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:8px;
}

.aiCoreImportMapping li{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:9px 10px;
  border-radius:14px;
  background:rgba(15,23,42,.035);
}

.aiCoreImportMapping strong{
  color:#16181C;
  font-size:13px;
}

.aiCoreImportMapping span{
  color:#667085;
  font-size:13px;
  font-weight:850;
}

.aiCoreImportMuted{
  margin:0;
  color:#667085;
  line-height:1.5;
}

.aiCoreImportRows{
  margin-top:12px;
}

.aiCoreImportTableWrap{
  overflow:auto;
  border-radius:16px;
  border:1px solid rgba(22,24,28,.08);
}

.aiCoreImportRows table{
  width:100%;
  border-collapse:collapse;
  min-width:760px;
  background:#fff;
}

.aiCoreImportRows th,
.aiCoreImportRows td{
  padding:11px 12px;
  border-bottom:1px solid rgba(22,24,28,.07);
  text-align:left;
  vertical-align:top;
  color:#334155;
  font-size:13px;
}

.aiCoreImportRows th{
  color:#667085;
  background:rgba(15,23,42,.035);
  font-weight:1000;
  text-transform:uppercase;
  letter-spacing:.06em;
  font-size:11px;
}

.aiCoreImportRowStatus{
  display:inline-flex;
  border-radius:999px;
  padding:5px 8px;
  font-size:11px;
  font-weight:1000;
  background:rgba(100,116,139,.10);
  color:#475569;
}

.aiCoreImportRowStatus.valid,
.aiCoreImportRowStatus.success{
  background:rgba(22,163,74,.10);
  color:#166534;
}

.aiCoreImportRowStatus.invalid,
.aiCoreImportRowStatus.failed{
  background:rgba(184,50,160,.10);
  color:#7B1E8A;
}

.aiCoreImportRowStatus.waiting_approval{
  background:rgba(245,158,11,.13);
  color:#92400E;
}

.aiCoreImportActions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  margin-top:14px;
}

.aiCoreImportActions button:first-child{
  color:#4A154B;
  background:#fff;
  border:1px solid rgba(184,50,160,.18);
  box-shadow:0 10px 24px rgba(9,6,74,.06);
}

@media (max-width:900px){
  .aiCoreImportControls,
  .aiCoreImportGrid,
  .aiCoreImportStats{
    grid-template-columns:1fr;
  }

  .aiCoreImportActions{
    display:grid;
    grid-template-columns:1fr;
  }

  .aiCoreImportControls > button,
  .aiCoreImportActions button{
    width:100%;
  }
}
/* =========================================================
   Flow Builder IA · share + window viewer + generated runtime
   ========================================================= */

.aiCoreFlowCapabilityHeaderActions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

.aiCoreFlowCapabilityHeaderActions > button{
  min-height:34px;
  border:1px solid rgba(184,50,160,.16);
  border-radius:999px;
  padding:0 13px;
  background:rgba(184,50,160,.07);
  color:#7B1E8A;
  font-size:12px;
  font-weight:1000;
  white-space:nowrap;
}

.aiCoreFlowCapabilityHeaderActions > button:hover{
  background:rgba(184,50,160,.12);
  transform:translateY(-1px);
}

.aiCoreGeneratedAppFrame{
  width:100%;
  min-height:760px;
  border:0;
  display:block;
  background:#F6F4F0;
}

.aiCoreGeneratedAppShell{
  width:100%;
  border:1px solid rgba(22,24,28,.10);
  border-radius:24px;
  overflow:hidden;
  background:#fff;
  box-shadow:0 18px 60px rgba(9,6,74,.06);
}

.aiCoreAppWindowOpen{
  overflow:hidden;
}

.aiCoreAppWindowModal{
  position:fixed;
  inset:0;
  z-index:1000001;
  display:grid;
  place-items:center;
  padding:22px;
}

.aiCoreAppWindowModal[hidden]{
  display:none !important;
}

.aiCoreAppWindowBackdrop{
  position:absolute;
  inset:0;
  background:
    radial-gradient(circle at 50% 10%, rgba(184,50,160,.20), transparent 34%),
    rgba(9,6,74,.62);
  backdrop-filter:blur(18px);
  -webkit-backdrop-filter:blur(18px);
}

.aiCoreAppWindowCard{
  position:relative;
  width:min(1380px,96vw);
  height:min(900px,92vh);
  border:1px solid rgba(255,255,255,.72);
  border-radius:30px;
  background:#F6F4F0;
  box-shadow:
    0 40px 130px rgba(4,6,28,.38),
    inset 0 1px 0 rgba(255,255,255,.86);
  overflow:hidden;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
}

.aiCoreAppWindowHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 18px;
  background:rgba(255,255,255,.88);
  border-bottom:1px solid rgba(22,24,28,.08);
}

.aiCoreAppWindowHeader span{
  display:block;
  color:#667085;
  font-size:11px;
  letter-spacing:.13em;
  text-transform:uppercase;
  font-weight:1000;
  margin-bottom:3px;
}

.aiCoreAppWindowHeader h3{
  margin:0;
  color:#16181C;
  font-size:18px;
  letter-spacing:-.02em;
}

.aiCoreAppWindowActions{
  display:flex;
  align-items:center;
  gap:9px;
}

.aiCoreAppWindowActions button{
  min-height:36px;
  border:1px solid rgba(184,50,160,.16);
  border-radius:999px;
  padding:0 14px;
  background:#fff;
  color:#7B1E8A;
  font-weight:1000;
}

.aiCoreAppWindowActions button:first-child{
  color:#fff;
  border-color:transparent;
  background:linear-gradient(135deg,#B832A0,#7B1E8A);
  box-shadow:0 14px 34px rgba(184,50,160,.22);
}

.aiCoreAppWindowBody{
  min-height:0;
  overflow:auto;
  padding:18px;
}

.aiCoreAppWindowBody .aiCoreFlowCapability{
  max-width:none;
  margin:0;
  box-shadow:none;
}

.aiCoreAppWindowBody .aiCoreGeneratedAppFrame{
  min-height:calc(92vh - 178px);
}

@media (max-width:720px){
  .aiCoreFlowCapabilityHeaderActions{
    width:100%;
    justify-content:flex-start;
  }

  .aiCoreAppWindowModal{
    padding:10px;
  }

  .aiCoreAppWindowCard{
    width:100%;
    height:96vh;
    border-radius:24px;
  }

  .aiCoreAppWindowHeader{
    align-items:flex-start;
    flex-direction:column;
  }

  .aiCoreAppWindowActions{
    width:100%;
  }

  .aiCoreAppWindowActions button{
    flex:1;
  }
}

/* =========================================================
   Flow Builder IA · enlaces públicos/privados + pantalla completa
   ========================================================= */

.aiCoreAppSharePanel{
  display:grid;
  gap:12px;
  padding:14px;
  border:1px solid rgba(22,24,28,.10);
  border-radius:24px;
  background:#fff;
  box-shadow:0 18px 60px rgba(9,6,74,.07);
}

.aiCoreAppSharePanel header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}

.aiCoreAppSharePanel header span,
.aiCoreSharedAppHeader span,
.aiCoreSharedAppError span{
  display:block;
  color:#667085;
  font-size:11px;
  letter-spacing:.13em;
  text-transform:uppercase;
  font-weight:1000;
  margin-bottom:5px;
}

.aiCoreAppSharePanel h4{
  margin:0;
  color:#16181C;
  font-size:18px;
  letter-spacing:-.03em;
}

.aiCoreAppSharePanel p{
  margin:6px 0 0;
  color:#667085;
  line-height:1.5;
}

.aiCoreAppShareLinks{
  display:grid;
  gap:8px;
}

.aiCoreAppShareLink{
  display:grid;
  gap:6px;
  padding:12px;
  border:1px solid rgba(22,24,28,.09);
  border-radius:18px;
  background:#F6F4F0;
}

.aiCoreAppShareLink strong{
  color:#16181C;
  font-size:13px;
}

.aiCoreAppShareLink input{
  width:100%;
  border:1px solid rgba(22,24,28,.10);
  border-radius:14px;
  padding:10px 12px;
  background:#fff;
  color:#16181C;
  font-size:13px;
}

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

.aiCoreAppShareActions button{
  min-height:36px;
  border:1px solid rgba(184,50,160,.16);
  border-radius:999px;
  padding:0 14px;
  background:rgba(184,50,160,.07);
  color:#7B1E8A;
  font-weight:1000;
}

.aiCoreSharedAppBody{
  margin:0;
  width:100%;
  height:100vh;
  height:100dvh;
  min-height:0;
  overflow:hidden;
  background:#F6F4F0;
  color:#16181C;
}

.aiCoreSharedAppShell{
  width:100%;
  height:100vh;
  height:100dvh;
  min-height:0;
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  gap:12px;
  padding:14px;
  overflow:hidden;
}

.aiCoreSharedAppHeader,
.aiCoreSharedAppError{
  border:1px solid rgba(22,24,28,.10);
  border-radius:28px;
  background:rgba(255,255,255,.92);
  box-shadow:0 22px 70px rgba(9,6,74,.07);
}

.aiCoreSharedAppHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:18px;
}

.aiCoreSharedAppHeader h1,
.aiCoreSharedAppError h1{
  margin:0;
  color:#16181C;
  letter-spacing:-.04em;
}

.aiCoreSharedAppHeader p,
.aiCoreSharedAppError p{
  margin:8px 0 0;
  color:#667085;
  line-height:1.5;
}

.aiCoreSharedAppHeader strong{
  display:inline-grid;
  place-items:center;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  color:#fff;
  background:linear-gradient(135deg,#B832A0,#7B1E8A);
  box-shadow:0 14px 34px rgba(184,50,160,.22);
}

.aiCoreSharedAppFrameShell{
  min-height:0;
  height:100%;
  display:flex;
  flex-direction:column;
  border:1px solid rgba(22,24,28,.10);
  border-radius:30px;
  overflow:hidden;
  background:#fff;
  box-shadow:0 24px 80px rgba(9,6,74,.08);
}

.aiCoreSharedAppFrame{
  flex:1 1 auto;
  width:100%;
  height:100%;
  min-height:0;
  max-height:100%;
  border:0;
  display:block;
  background:#F6F4F0;
}

.aiCoreSharedAppError{
  width:min(720px,94vw);
  margin:auto;
  padding:28px;
}

@media (max-width: 760px){
  .aiCoreSharedAppShell{
    gap:10px;
    padding:10px;
  }

  .aiCoreSharedAppHeader{
    display:grid;
    padding:14px;
    border-radius:24px;
  }

  .aiCoreSharedAppHeader h1{
    font-size:clamp(22px,7vw,34px);
  }

  .aiCoreSharedAppFrame{
    height:100%;
    min-height:0;
  }
}

.aiCoreAppVisibilityBadge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(22,24,28,.10);
  background:rgba(255,255,255,.72);
  color:var(--ai-muted,#667085);
  font-size:12px;
  font-weight:900;
}

.aiCoreAppVisibilityBadge.isPublic{
  background:rgba(255,145,77,.12);
  border-color:rgba(255,145,77,.24);
  color:#9A4B12;
}

/* =========================================================
   Flow Builder · selección visual de integración
   ========================================================= */

.aiCoreIntegrationPicker{
  display:flex;
  flex-direction:column;
  gap:16px;
  padding:18px;
  border:1px solid rgba(22,24,28,.08);
  border-radius:24px;
  background:rgba(255,255,255,.74);
  box-shadow:0 22px 60px rgba(22,24,28,.08);
}

.aiCoreIntegrationPicker.isResolving{
  opacity:.72;
  pointer-events:none;
}

.aiCoreIntegrationPickerHeader{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.aiCoreIntegrationPickerHeader span,
.aiCoreIntegrationOptionTop span{
  color:#687386;
  font-size:11px;
  font-weight:900;
  letter-spacing:.14em;
  text-transform:uppercase;
}

.aiCoreIntegrationPickerHeader h3{
  margin:0;
  color:#16181C;
  font-size:18px;
  line-height:1.18;
}

.aiCoreIntegrationPickerHeader p{
  margin:0;
  color:#5F6772;
  font-size:14px;
  line-height:1.45;
}

.aiCoreIntegrationIntent{
  display:flex;
  flex-direction:column;
  gap:4px;
  padding:12px 14px;
  border:1px dashed rgba(22,24,28,.12);
  border-radius:18px;
  background:rgba(246,244,240,.72);
}

.aiCoreIntegrationIntent strong{
  color:#16181C;
  font-size:12px;
}

.aiCoreIntegrationIntent span{
  color:#5F6772;
  font-size:13px;
}

.aiCoreIntegrationOptionGrid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:12px;
}

.aiCoreIntegrationOption{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:15px;
  border:1px solid rgba(22,24,28,.10);
  border-radius:22px;
  background:rgba(255,255,255,.92);
  box-shadow:0 14px 36px rgba(22,24,28,.06);
}

.aiCoreIntegrationOptionTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.aiCoreIntegrationOptionTop b{
  padding:4px 9px;
  border-radius:999px;
  background:rgba(126,46,150,.09);
  color:#7E2E96;
  font-size:11px;
  font-weight:900;
}

.aiCoreIntegrationOption h4{
  margin:0;
  color:#16181C;
  font-size:15px;
  line-height:1.25;
}

.aiCoreIntegrationOption p,
.aiCoreIntegrationOption small{
  margin:0;
  color:#5F6772;
  font-size:13px;
  line-height:1.42;
}

.aiCoreIntegrationOptionMeta{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.aiCoreIntegrationOptionMeta span{
  max-width:100%;
  padding:5px 8px;
  border-radius:999px;
  background:rgba(22,24,28,.05);
  color:#5F6772;
  font-size:11px;
  font-weight:800;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.aiCoreIntegrationOptionMeta span.isWarning{
  background:rgba(255,145,77,.14);
  color:#8A4214;
}

.aiCoreIntegrationSelectBtn{
  align-self:flex-start;
  margin-top:auto;
}

.aiCoreIntegrationPickerFooter{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding-top:2px;
}

.aiCoreIntegrationPickerFooter span{
  color:#687386;
  font-size:12px;
}

@media (max-width: 720px){
  .aiCoreIntegrationPicker{
    padding:14px;
    border-radius:20px;
  }

  .aiCoreIntegrationOptionGrid{
    grid-template-columns:1fr;
  }

  .aiCoreIntegrationPickerFooter{
    align-items:stretch;
    flex-direction:column;
  }
}


/* =========================================================
   Flow Builder inline shaping controls
   ========================================================= */
.aiCoreAppBuilderPromptPanel{
  margin:18px 0;
  border:1px solid rgba(214,51,132,.14);
  border-radius:24px;
  padding:16px;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:14px;
  align-items:center;
  background:
    radial-gradient(circle at 0 0, rgba(214,51,132,.08), transparent 36%),
    rgba(255,255,255,.86);
  box-shadow:0 18px 48px rgba(15,23,42,.06);
}

.aiCoreAppBuilderPromptPanel span{
  display:block;
  margin-bottom:5px;
  color:var(--ai-muted);
  font-size:11px;
  font-weight:1000;
  text-transform:uppercase;
  letter-spacing:.12em;
}

.aiCoreAppBuilderPromptPanel strong{
  display:block;
  color:var(--ai-text);
  font-size:18px;
  letter-spacing:-.025em;
}

.aiCoreAppBuilderPromptPanel p{
  margin:7px 0 0;
  color:var(--ai-muted);
  font-size:14px;
  line-height:1.55;
}

.aiCoreAppBuilderSuggestions{
  display:flex;
  flex-wrap:wrap;
  justify-content:flex-end;
  gap:8px;
}

.aiCoreAppBuilderSuggestions button,
.aiCoreFlowCapabilityHeaderActions [data-shape-generated-app]{
  border:1px solid rgba(214,51,132,.18);
  border-radius:999px;
  padding:10px 13px;
  color:var(--ai-brand2);
  background:rgba(214,51,132,.07);
  font-weight:950;
  box-shadow:0 10px 22px rgba(214,51,132,.06);
}

.aiCoreAppBuilderSuggestions button:hover,
.aiCoreFlowCapabilityHeaderActions [data-shape-generated-app]:hover{
  transform:translateY(-1px);
  background:rgba(214,51,132,.12);
}

@media(max-width:860px){
  .aiCoreAppBuilderPromptPanel{
    grid-template-columns:1fr;
  }

  .aiCoreAppBuilderSuggestions{
    justify-content:flex-start;
  }
}


/* =========================================================
   Flow Builder IA · acciones compactas y panel de forma
   ========================================================= */

.aiCoreFlowCapabilityHeaderActions{
  gap:8px;
}

.aiCoreFlowCapabilityHeaderActions > .aiCoreAppActionBtn,
.aiCoreFlowCapabilityHeaderActions > button.aiCoreAppActionBtn{
  min-height:32px;
  border:1px solid rgba(184,50,160,.16);
  border-radius:999px;
  padding:0 12px;
  background:rgba(255,255,255,.78);
  color:#7B1E8A;
  font-size:12px;
  font-weight:950;
  line-height:1;
  box-shadow:0 10px 24px rgba(9,6,74,.045);
}

.aiCoreFlowCapabilityHeaderActions > .aiCoreAppActionBtnPrimary{
  color:#fff;
  border-color:transparent;
  background:linear-gradient(135deg,#B832A0,#7B1E8A);
  box-shadow:0 12px 28px rgba(184,50,160,.18);
}

.aiCoreAppShapePanel{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  margin:14px 0 0;
  padding:12px;
  border:1px solid rgba(184,50,160,.12);
  border-radius:22px;
  background:
    radial-gradient(circle at top left,rgba(184,50,160,.08),transparent 22rem),
    rgba(255,255,255,.86);
  box-shadow:0 14px 38px rgba(9,6,74,.055);
}

.aiCoreAppShapePanel > div:first-child{
  min-width:0;
}

.aiCoreAppShapePanel span{
  display:block;
  color:#667085;
  font-size:11px;
  font-weight:1000;
  letter-spacing:.12em;
  text-transform:uppercase;
  margin-bottom:4px;
}

.aiCoreAppShapePanel strong{
  display:block;
  color:#16181C;
  font-size:14px;
  font-weight:1000;
  letter-spacing:-.01em;
}

.aiCoreAppShapePanel p{
  margin:4px 0 0;
  color:#667085;
  font-size:12px;
  line-height:1.45;
}

.aiCoreAppShapeActions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  flex-wrap:wrap;
  gap:8px;
}

.aiCoreAppShapeChip,
.aiCoreAppShapePrimary,
.aiCoreFlowCreateAppBtn,
.aiCoreFlowModifyAppBtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  border-radius:999px;
  padding:0 13px;
  font-size:12px;
  font-weight:1000;
  line-height:1;
  white-space:nowrap;
  cursor:pointer;
  transition:transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.aiCoreAppShapeChip{
  border:1px solid rgba(22,24,28,.10);
  background:#fff;
  color:#4A5568;
  box-shadow:0 8px 20px rgba(9,6,74,.04);
}

.aiCoreAppShapeChip:hover{
  color:#7B1E8A;
  border-color:rgba(184,50,160,.20);
  background:rgba(184,50,160,.06);
  transform:translateY(-1px);
}

.aiCoreAppShapePrimary,
.aiCoreFlowCreateAppBtn,
.aiCoreFlowModifyAppBtn{
  border:0;
  color:#fff;
  background:linear-gradient(135deg,#B832A0,#7B1E8A);
  box-shadow:0 12px 26px rgba(184,50,160,.20);
}

.aiCoreAppShapePrimary:hover,
.aiCoreFlowCreateAppBtn:hover,
.aiCoreFlowModifyAppBtn:hover{
  transform:translateY(-1px);
  box-shadow:0 16px 34px rgba(184,50,160,.24);
}

.aiCoreFlowRunActions{
  align-items:center;
  gap:9px 10px;
}

.aiCoreFlowRunActions > span{
  font-size:12px;
  color:#667085;
}

@media (max-width:900px){
  .aiCoreAppShapePanel{
    align-items:flex-start;
    flex-direction:column;
  }

  .aiCoreAppShapeActions{
    justify-content:flex-start;
  }

  .aiCoreAppShapeChip,
  .aiCoreAppShapePrimary,
  .aiCoreFlowCreateAppBtn,
  .aiCoreFlowModifyAppBtn{
    min-height:32px;
    padding:0 12px;
  }
}


/* =========================================================
   Hotfix v14 · Flow Builder actions compactas y con estilo propio
   ========================================================= */

.aiCoreFlowCapabilityHeaderActions{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  flex-wrap:wrap !important;
  gap:8px !important;
}

.aiCoreFlowCapabilityHeaderActions > button,
.aiCoreFlowCapabilityHeaderActions > .aiCoreAppActionBtn,
.aiCoreFlowCapabilityHeaderActions > button[data-open-generated-app],
.aiCoreFlowCapabilityHeaderActions > button[data-copy-generated-app],
.aiCoreFlowCapabilityHeaderActions > button[data-flow-modify-app]{
  width:auto !important;
  min-width:0 !important;
  min-height:32px !important;
  height:32px !important;
  padding:0 12px !important;
  border-radius:999px !important;
  border:1px solid rgba(184,50,160,.16) !important;
  background:rgba(255,255,255,.92) !important;
  color:#6D2F88 !important;
  font-size:12px !important;
  font-weight:1000 !important;
  line-height:1 !important;
  letter-spacing:0 !important;
  white-space:nowrap !important;
  box-shadow:0 8px 20px rgba(9,6,74,.045) !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:6px !important;
}

.aiCoreFlowCapabilityHeaderActions > button[data-flow-modify-app],
.aiCoreFlowCapabilityHeaderActions > .aiCoreAppActionBtnPrimary{
  border-color:transparent !important;
  color:#fff !important;
  background:linear-gradient(135deg,#B832A0,#7B1E8A) !important;
  box-shadow:0 12px 26px rgba(184,50,160,.18) !important;
}

.aiCoreFlowCapabilityHeaderActions > button:hover{
  transform:translateY(-1px) !important;
}

.aiCoreAppShapePanel{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:12px !important;
  margin:12px 0 0 !important;
  padding:10px 12px !important;
  border:1px solid rgba(184,50,160,.13) !important;
  border-radius:18px !important;
  background:
    radial-gradient(circle at top left,rgba(184,50,160,.07),transparent 18rem),
    rgba(255,255,255,.92) !important;
  box-shadow:0 12px 30px rgba(9,6,74,.045) !important;
}

.aiCoreAppShapePanel > div:first-child{
  min-width:0 !important;
  flex:1 1 auto !important;
}

.aiCoreAppShapePanel span{
  display:block !important;
  margin:0 0 3px !important;
  color:#667085 !important;
  font-size:10.5px !important;
  font-weight:1000 !important;
  letter-spacing:.11em !important;
  text-transform:uppercase !important;
  line-height:1.2 !important;
}

.aiCoreAppShapePanel strong{
  display:block !important;
  color:#16181C !important;
  font-size:13.5px !important;
  font-weight:1000 !important;
  letter-spacing:-.01em !important;
  line-height:1.25 !important;
}

.aiCoreAppShapePanel p{
  margin:3px 0 0 !important;
  color:#667085 !important;
  font-size:12px !important;
  line-height:1.35 !important;
}

.aiCoreAppShapeActions,
.aiCoreFlowRunActions{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  flex-wrap:wrap !important;
  gap:7px !important;
}

.aiCoreAppShapeActions > button,
.aiCoreAppShapeChip,
.aiCoreAppShapePrimary,
.aiCoreFlowCreateAppBtn,
.aiCoreFlowModifyAppBtn,
.aiCoreFlowRunActions > button[data-flow-create-app],
.aiCoreFlowRunActions > button[data-flow-modify-app]{
  width:auto !important;
  min-width:0 !important;
  min-height:31px !important;
  height:31px !important;
  padding:0 12px !important;
  border-radius:999px !important;
  font-size:12px !important;
  font-weight:1000 !important;
  line-height:1 !important;
  letter-spacing:0 !important;
  white-space:nowrap !important;
  cursor:pointer !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:6px !important;
  transition:transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease !important;
}

.aiCoreAppShapeActions > button[data-app-prompt],
.aiCoreAppShapeChip{
  border:1px solid rgba(22,24,28,.10) !important;
  background:#fff !important;
  color:#475569 !important;
  box-shadow:0 7px 18px rgba(9,6,74,.035) !important;
}

.aiCoreAppShapeActions > button[data-app-prompt]:hover,
.aiCoreAppShapeChip:hover{
  color:#7B1E8A !important;
  border-color:rgba(184,50,160,.22) !important;
  background:rgba(184,50,160,.055) !important;
  transform:translateY(-1px) !important;
}

.aiCoreAppShapeActions > button[data-flow-modify-app]:not([data-app-prompt]),
.aiCoreAppShapePrimary,
.aiCoreFlowCreateAppBtn,
.aiCoreFlowModifyAppBtn,
.aiCoreFlowRunActions > button[data-flow-create-app],
.aiCoreFlowRunActions > button[data-flow-modify-app]{
  border:0 !important;
  color:#fff !important;
  background:linear-gradient(135deg,#B832A0,#7B1E8A) !important;
  box-shadow:0 10px 24px rgba(184,50,160,.18) !important;
}

.aiCoreAppShapeActions > button[data-flow-modify-app]:not([data-app-prompt]):hover,
.aiCoreAppShapePrimary:hover,
.aiCoreFlowCreateAppBtn:hover,
.aiCoreFlowModifyAppBtn:hover{
  transform:translateY(-1px) !important;
  box-shadow:0 14px 30px rgba(184,50,160,.22) !important;
}

.aiCoreFlowRunActions > span{
  color:#667085 !important;
  font-size:12px !important;
  line-height:1.35 !important;
}

@media (max-width:900px){
  .aiCoreAppShapePanel{
    align-items:flex-start !important;
    flex-direction:column !important;
  }

  .aiCoreAppShapeActions,
  .aiCoreFlowRunActions,
  .aiCoreFlowCapabilityHeaderActions{
    justify-content:flex-start !important;
  }

  .aiCoreAppShapeActions > button,
  .aiCoreAppShapeChip,
  .aiCoreAppShapePrimary,
  .aiCoreFlowCreateAppBtn,
  .aiCoreFlowModifyAppBtn{
    min-height:30px !important;
    height:30px !important;
    padding:0 11px !important;
    font-size:11.5px !important;
  }
}


/* =========================================================
   Fix pantalla completa app compartida: evita corte inferior
   ========================================================= */

html:has(body.aiCoreSharedAppBody){
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  overflow:hidden !important;
}

body.aiCoreSharedAppBody{
  width:100% !important;
  height:100vh !important;
  height:100dvh !important;
  min-height:0 !important;
  overflow:hidden !important;
}

body.aiCoreSharedAppBody .aiCoreSharedAppShell{
  width:100% !important;
  height:100vh !important;
  height:100dvh !important;
  min-height:0 !important;
  max-height:100dvh !important;
  grid-template-rows:auto minmax(0,1fr) !important;
  overflow:hidden !important;
}

body.aiCoreSharedAppBody .aiCoreSharedAppFrameShell{
  min-height:0 !important;
  height:100% !important;
  max-height:100% !important;
  overflow:hidden !important;
  display:flex !important;
  flex-direction:column !important;
}

body.aiCoreSharedAppBody .aiCoreSharedAppFrame{
  flex:1 1 auto !important;
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  max-height:100% !important;
  border:0 !important;
}

@supports not (height: 100dvh){
  body.aiCoreSharedAppBody,
  body.aiCoreSharedAppBody .aiCoreSharedAppShell{
    height:100vh !important;
    max-height:100vh !important;
  }
}

/* =========================================================
   Flow Builder IA: respuestas naturales tipo copiloto
   ========================================================= */

.aiCoreFlowAnswer{
  width:100% !important;
  border:1px solid rgba(214,51,132,.14) !important;
  border-radius:24px !important;
  padding:18px !important;
  background:
    radial-gradient(circle at top left, rgba(214,51,132,.08), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.94)) !important;
  box-shadow:0 18px 46px rgba(15,23,42,.07) !important;
}

.aiCoreFlowAnswerHeader{
  display:flex !important;
  align-items:flex-start !important;
  justify-content:space-between !important;
  gap:16px !important;
  margin-bottom:12px !important;
}

.aiCoreFlowAnswerHeader span{
  display:block !important;
  margin-bottom:6px !important;
  color:#64748b !important;
  font-size:11px !important;
  font-weight:950 !important;
  line-height:1 !important;
  letter-spacing:.12em !important;
  text-transform:uppercase !important;
}

.aiCoreFlowAnswerHeader h3{
  margin:0 !important;
  color:#111827 !important;
  font-size:20px !important;
  line-height:1.18 !important;
  letter-spacing:-.035em !important;
}

.aiCoreFlowAnswerHeader strong{
  flex:0 0 auto !important;
  border-radius:999px !important;
  padding:8px 11px !important;
  background:rgba(22,163,74,.10) !important;
  color:#166534 !important;
  font-size:12px !important;
  font-weight:950 !important;
  line-height:1 !important;
}

.aiCoreFlowAnswerBody{
  color:#334155 !important;
  font-size:15px !important;
  line-height:1.72 !important;
}

.aiCoreFlowAnswerBody h1,
.aiCoreFlowAnswerBody h2,
.aiCoreFlowAnswerBody h3{
  margin:14px 0 8px !important;
  color:#111827 !important;
  letter-spacing:-.03em !important;
}

.aiCoreFlowAnswerBody h1{font-size:22px !important}
.aiCoreFlowAnswerBody h2{font-size:19px !important}
.aiCoreFlowAnswerBody h3{font-size:17px !important}

.aiCoreFlowAnswerBody p{
  margin:0 0 11px !important;
}

.aiCoreFlowAnswerBody p:last-child{
  margin-bottom:0 !important;
}

.aiCoreFlowAnswerBody ul,
.aiCoreFlowAnswerBody ol{
  margin:8px 0 12px !important;
  padding-left:22px !important;
}

.aiCoreFlowAnswerBody li{
  margin:4px 0 !important;
}

.aiCoreFlowAnswerBody strong{
  color:#111827 !important;
}

.aiCoreFlowAnswerBody code{
  border:1px solid rgba(214,51,132,.14) !important;
  border-radius:8px !important;
  padding:2px 6px !important;
  background:rgba(214,51,132,.06) !important;
  color:#9d174d !important;
}

/* Compatibilidad: si quedó alguna tarjeta antigua de Flow Advice, se renderiza como respuesta normal. */
.aiCoreFlowAdviceReadable,
.aiCoreFlowAdvice{
  border-radius:24px !important;
  border:1px solid rgba(214,51,132,.14) !important;
  background:#fff !important;
}

.aiCoreFlowAdviceSection h4,
.aiCoreFlowAdviceReadable .aiCoreFlowAdviceSection h4{
  color:#111827 !important;
  font-size:15px !important;
  letter-spacing:-.02em !important;
  text-transform:none !important;
}

@media (max-width:860px){
  .aiCoreFlowAnswer{
    border-radius:20px !important;
    padding:14px !important;
  }

  .aiCoreFlowAnswerHeader{
    flex-direction:column !important;
    gap:8px !important;
  }

  .aiCoreFlowAnswerHeader h3{
    font-size:18px !important;
  }

  .aiCoreFlowAnswerBody{
    font-size:14px !important;
    line-height:1.62 !important;
  }
}


/* =========================================================
   Flow Builder: respuestas naturales, limpias y no técnicas
   ========================================================= */

.aiCoreFlowNaturalAnswer{
  width:100% !important;
  display:grid !important;
  gap:12px !important;
  border:1px solid rgba(214,51,132,.12) !important;
  border-radius:18px !important;
  padding:16px 18px !important;
  background:
    radial-gradient(circle at top left, rgba(214,51,132,.07), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96)) !important;
  box-shadow:0 14px 34px rgba(15,23,42,.06) !important;
}

.aiCoreFlowNaturalHeader{
  display:flex !important;
  align-items:flex-start !important;
  justify-content:space-between !important;
  gap:14px !important;
}

.aiCoreFlowNaturalHeader span{
  display:inline-flex !important;
  width:max-content !important;
  margin:0 0 5px !important;
  padding:4px 8px !important;
  border-radius:999px !important;
  background:rgba(100,116,139,.10) !important;
  color:#64748b !important;
  font-size:10.5px !important;
  line-height:1 !important;
  font-weight:950 !important;
  letter-spacing:.08em !important;
  text-transform:uppercase !important;
}

.aiCoreFlowNaturalHeader h3{
  margin:0 !important;
  color:#0f172a !important;
  font-size:18px !important;
  line-height:1.2 !important;
  letter-spacing:-.025em !important;
}

.aiCoreFlowNaturalHeader strong{
  flex:0 0 auto !important;
  min-width:44px !important;
  height:34px !important;
  border-radius:999px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:0 10px !important;
  background:rgba(22,163,74,.10) !important;
  color:#166534 !important;
  font-size:12px !important;
  font-weight:1000 !important;
}

.aiCoreFlowNaturalBody{
  color:#334155 !important;
  font-size:14.5px !important;
  line-height:1.68 !important;
}

.aiCoreFlowNaturalBody p{
  margin:0 0 10px !important;
}

.aiCoreFlowNaturalBody p:last-child{
  margin-bottom:0 !important;
}

.aiCoreFlowNaturalBody ul,
.aiCoreFlowNaturalBody ol{
  margin:8px 0 10px !important;
  padding-left:20px !important;
}

.aiCoreFlowNaturalBody li{
  margin:4px 0 !important;
}

.aiCoreFlowNaturalBody blockquote{
  margin:10px 0 !important;
  padding:10px 13px !important;
  border-left:3px solid rgba(214,51,132,.40) !important;
  border-radius:12px !important;
  background:rgba(214,51,132,.06) !important;
  color:#1f2937 !important;
}

.aiCoreFlowNaturalBody code{
  border:1px solid rgba(15,23,42,.08) !important;
  border-radius:7px !important;
  padding:1px 5px !important;
  background:#f8fafc !important;
  color:#be185d !important;
}

/* Evita que tarjetas heredadas de Flow Advice parezcan formularios técnicos */
.aiCoreFlowAnswer{
  border-radius:18px !important;
  padding:16px 18px !important;
  background:#fff !important;
  border:1px solid rgba(15,23,42,.08) !important;
  box-shadow:0 14px 34px rgba(15,23,42,.06) !important;
}

.aiCoreFlowAnswerHeader{
  margin-bottom:10px !important;
}

.aiCoreFlowAnswerHeader span{
  font-size:10.5px !important;
  letter-spacing:.08em !important;
}

.aiCoreFlowAnswerHeader h3{
  font-size:18px !important;
  line-height:1.2 !important;
}

.aiCoreFlowAnswerBody{
  font-size:14.5px !important;
  line-height:1.65 !important;
}


/* v19 · Flow/App bidirectional links and compact standalone controls */
.aiCoreFlowHeaderActions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}

.aiCoreFlowOpenBtn,
.aiCoreFlowHeaderActions .aiCoreMiniBtn,
.aiCoreFlowConnectedApp .aiCoreMiniBtn{
  padding:8px 11px;
  min-height:34px;
  line-height:1;
  font-size:12px;
}

.aiCoreFlowConnectedApp,
.aiCoreAppConnectedFlow{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:14px 0;
  padding:14px 16px;
  border:1px solid rgba(214,51,132,.13);
  border-radius:20px;
  background:linear-gradient(135deg,rgba(214,51,132,.055),rgba(109,47,136,.045));
}

.aiCoreFlowConnectedApp span,
.aiCoreAppConnectedFlow span{
  display:block;
  color:var(--ai-muted);
  font-size:11px;
  font-weight:1000;
  letter-spacing:.12em;
  text-transform:uppercase;
}

.aiCoreFlowConnectedApp strong,
.aiCoreAppConnectedFlow strong{
  display:block;
  margin-top:3px;
  color:var(--ai-text);
  font-size:14px;
  line-height:1.25;
}

.aiCoreFlowConnectedApp small,
.aiCoreAppConnectedFlow small{
  display:block;
  margin-top:4px;
  color:var(--ai-muted);
  line-height:1.4;
}

.aiCoreAppConnectedFlow{
  margin:12px 18px 0;
}

.aiCoreAppConnectedFlow .aiCoreAppActionBtn{
  flex:0 0 auto;
  padding:8px 12px;
}

@media(max-width:780px){
  .aiCoreFlowConnectedApp,
  .aiCoreAppConnectedFlow{
    align-items:flex-start;
    flex-direction:column;
  }
}

/* v24 · Estado operativo y conexión App ↔ Flujo */
.aiCoreAppConnectedFlow .aiCoreAppActionBtn,
.aiCoreAppConnectedFlow button[data-flow-open-window],
.aiCoreFlowConnectedApp .aiCoreMiniBtn,
.aiCoreFlowConnectedApp button[data-open-generated-app],
.aiCoreFlowRunActions .aiCoreFlowToggleBtn,
.aiCoreFlowRunActions button[data-flow-toggle]{
  appearance:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:36px;
  padding:8px 13px;
  border:1px solid rgba(214,51,132,.22);
  border-radius:999px;
  background:rgba(214,51,132,.07);
  color:var(--ai-brand2);
  font-size:12px;
  line-height:1;
  font-weight:950;
  text-decoration:none;
  white-space:nowrap;
  box-shadow:0 10px 24px rgba(214,51,132,.08);
}

.aiCoreAppConnectedFlow .aiCoreAppActionBtn:hover,
.aiCoreAppConnectedFlow button[data-flow-open-window]:hover,
.aiCoreFlowConnectedApp .aiCoreMiniBtn:hover,
.aiCoreFlowConnectedApp button[data-open-generated-app]:hover,
.aiCoreFlowRunActions .aiCoreFlowToggleBtn:hover,
.aiCoreFlowRunActions button[data-flow-toggle]:hover{
  transform:translateY(-1px);
  border-color:rgba(214,51,132,.34);
  background:rgba(214,51,132,.11);
  color:var(--ai-brand2);
}

/* =========================================================
   Hotfix v26 · Acciones de prueba del flujo ordenadas y compactas
   ========================================================= */
.aiCoreFlowRunResult .aiCoreFlowRunActions{
  display:grid !important;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr)) !important;
  gap:10px !important;
  align-items:stretch !important;
  justify-content:stretch !important;
  margin-top:18px !important;
  padding-top:14px !important;
  border-top:1px solid rgba(22,24,28,.08) !important;
}

.aiCoreFlowRunActionItem{
  min-width:0 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:12px !important;
  padding:12px 14px !important;
  border:1px solid rgba(22,24,28,.08) !important;
  border-radius:18px !important;
  background:rgba(255,255,255,.86) !important;
  box-shadow:0 10px 28px rgba(9,6,74,.045) !important;
}

.aiCoreFlowRunActionItem.isPrimary{
  border-color:rgba(214,51,132,.18) !important;
  background:
    radial-gradient(circle at top left,rgba(214,51,132,.09),transparent 16rem),
    rgba(255,255,255,.92) !important;
}

.aiCoreFlowRunActionItem.isMuted{
  border-style:dashed !important;
  background:rgba(248,250,252,.82) !important;
}

.aiCoreFlowRunActionCopy{
  min-width:0 !important;
  display:grid !important;
  gap:3px !important;
}

.aiCoreFlowRunActionCopy strong{
  display:block !important;
  margin:0 !important;
  color:#16181C !important;
  font-size:13px !important;
  font-weight:1000 !important;
  line-height:1.2 !important;
  letter-spacing:-.01em !important;
}

.aiCoreFlowRunActionCopy span,
.aiCoreFlowRunResult .aiCoreFlowRunActions .aiCoreFlowRunActionCopy span{
  display:block !important;
  margin:0 !important;
  color:#667085 !important;
  font-size:12px !important;
  line-height:1.35 !important;
}

.aiCoreFlowRunActionButtons{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  flex-wrap:wrap !important;
  gap:7px !important;
  flex:0 0 auto !important;
}

.aiCoreFlowRunResult .aiCoreFlowRunActionItem button,
.aiCoreFlowRunResult .aiCoreFlowRunActionButtons button,
.aiCoreFlowRunResult .aiCoreFlowRunActions button[data-flow-toggle],
.aiCoreFlowRunResult .aiCoreFlowRunActions button[data-flow-create-app],
.aiCoreFlowRunResult .aiCoreFlowRunActions button[data-flow-modify-app],
.aiCoreFlowRunResult .aiCoreFlowRunActions button[data-open-generated-app]{
  width:auto !important;
  min-width:0 !important;
  min-height:32px !important;
  height:32px !important;
  padding:0 13px !important;
  border-radius:999px !important;
  font-size:12px !important;
  font-weight:1000 !important;
  line-height:1 !important;
  letter-spacing:0 !important;
  white-space:nowrap !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:6px !important;
  transition:transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease !important;
}

.aiCoreFlowRunResult .aiCoreFlowRunActions button[data-flow-toggle],
.aiCoreFlowRunResult .aiCoreFlowRunActions button[data-flow-create-app],
.aiCoreFlowRunResult .aiCoreFlowRunActions button[data-flow-modify-app]{
  border:0 !important;
  color:#fff !important;
  background:linear-gradient(135deg,#B832A0,#7B1E8A) !important;
  box-shadow:0 12px 26px rgba(184,50,160,.18) !important;
}

.aiCoreFlowRunResult .aiCoreFlowRunActions button[data-open-generated-app]{
  border:1px solid rgba(184,50,160,.18) !important;
  color:#6D2F88 !important;
  background:rgba(255,255,255,.94) !important;
  box-shadow:0 8px 20px rgba(9,6,74,.045) !important;
}

.aiCoreFlowRunResult .aiCoreFlowRunActions button:hover{
  transform:translateY(-1px) !important;
}

@media(max-width:760px){
  .aiCoreFlowRunResult .aiCoreFlowRunActions{
    grid-template-columns:1fr !important;
  }

  .aiCoreFlowRunActionItem{
    align-items:flex-start !important;
    flex-direction:column !important;
  }

  .aiCoreFlowRunActionButtons{
    justify-content:flex-start !important;
  }
}

/* =========================================================
   Flow Builder · selección múltiple de endpoints
   ========================================================= */

.aiCoreIntegrationPickerToolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:12px 14px;
  border:1px solid rgba(22,24,28,.08);
  border-radius:18px;
  background:rgba(246,244,240,.68);
}

.aiCoreIntegrationPickerToolbar > div:first-child{
  display:flex;
  align-items:baseline;
  gap:7px;
  min-width:0;
}

.aiCoreIntegrationPickerToolbar strong{
  color:#16181C;
  font-size:18px;
  font-weight:950;
  letter-spacing:-.03em;
}

.aiCoreIntegrationPickerToolbar span{
  color:#687386;
  font-size:12px;
  font-weight:850;
}

.aiCoreIntegrationPickerToolbarActions,
.aiCoreIntegrationPickerFooterActions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}

.aiCoreIntegrationOption{
  position:relative;
}

.aiCoreIntegrationOption.isSelected{
  border-color:rgba(214,51,132,.30);
  background:linear-gradient(180deg,rgba(255,255,255,.98),rgba(253,244,250,.76));
  box-shadow:0 20px 48px rgba(214,51,132,.10);
}

.aiCoreIntegrationCheckRow{
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin:0;
  cursor:pointer;
}

.aiCoreIntegrationCheckRow input{
  width:18px;
  height:18px;
  margin-top:2px;
  accent-color:var(--ai-brand);
  flex:0 0 auto;
}

.aiCoreIntegrationCheckRow > span{
  min-width:0;
  display:grid;
  gap:2px;
}

.aiCoreIntegrationCheckRow strong{
  color:#687386;
  font-size:11px;
  font-weight:950;
  letter-spacing:.14em;
  text-transform:uppercase;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.aiCoreIntegrationCheckRow small{
  width:max-content;
  max-width:100%;
  padding:4px 9px;
  border-radius:999px;
  background:rgba(126,46,150,.09);
  color:#7E2E96;
  font-size:11px;
  font-weight:900;
}

.aiCoreIntegrationPickerFooter{
  align-items:center;
  padding:13px 14px;
  border:1px solid rgba(22,24,28,.08);
  border-radius:20px;
  background:rgba(255,255,255,.70);
}

.aiCoreIntegrationPickerFooterCopy{
  min-width:0;
  display:grid;
  gap:3px;
}

.aiCoreIntegrationPickerFooterCopy strong{
  color:#16181C;
  font-size:13px;
  font-weight:950;
}

.aiCoreIntegrationPickerFooterCopy span{
  color:#687386;
  font-size:12px;
  line-height:1.35;
}

.aiCoreIntegrationUseSelectedBtn{
  min-height:38px;
  padding:10px 16px;
  box-shadow:0 14px 30px rgba(214,51,132,.18);
}

@media (max-width: 720px){
  .aiCoreIntegrationPickerToolbar,
  .aiCoreIntegrationPickerFooter{
    align-items:stretch;
    flex-direction:column;
  }

  .aiCoreIntegrationPickerToolbarActions,
  .aiCoreIntegrationPickerFooterActions{
    justify-content:flex-start;
  }

  .aiCoreIntegrationUseSelectedBtn{
    width:100%;
  }
}

/* ==========================================================================
   Flow Builder · Codificador integrado
   Fuente de verdad técnica para apps generadas.
   ========================================================================== */
.aiCoreCoderBody{
  min-height:100dvh;
  overflow:hidden;
  background:
    radial-gradient(circle at 8% 0%, rgba(214,51,132,.13), transparent 34%),
    linear-gradient(180deg,#F7F4F8,#F4F6FA);
  color:#16181C;
}

.aiCoreCoderShell{
  height:100dvh;
  min-height:0;
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr);
  gap:14px;
  padding:18px;
  overflow:hidden;
}

.aiCoreCoderTopbar,
.aiCoreCoderMetaGrid article,
.aiCoreCoderPanel,
.aiCoreCoderMain,
.aiCoreCoderPreviewPanel,
.aiCoreCoderAlert{
  border:1px solid rgba(22,24,28,.10);
  background:rgba(255,255,255,.88);
  border-radius:24px;
  box-shadow:0 18px 55px rgba(9,6,74,.06);
  backdrop-filter:blur(16px);
}

.aiCoreCoderTopbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:18px 20px;
}

.aiCoreCoderTopbar span,
.aiCoreCoderMetaGrid span,
.aiCoreCoderPanel>span,
.aiCoreCoderPreviewHeader span{
  display:block;
  color:#667085;
  font-size:11px;
  font-weight:1000;
  letter-spacing:.16em;
  text-transform:uppercase;
}

.aiCoreCoderTopbar h1{
  margin:6px 0 6px;
  font-size:28px;
  line-height:1.04;
  letter-spacing:-.04em;
}

.aiCoreCoderTopbar p,
.aiCoreCoderMetaGrid p,
.aiCoreCoderPanel p{
  margin:0;
  color:#667085;
  line-height:1.55;
}

.aiCoreCoderTopbarActions,
.aiCoreCoderActionsStack{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

.aiCoreCoderPrimary,
.aiCoreCoderGhost,
.aiCoreCoderTabs button,
.aiCoreCoderRevision button{
  border-radius:999px;
  min-height:38px;
  padding:0 15px;
  font-weight:1000;
  border:1px solid rgba(214,51,132,.18);
  cursor:pointer;
}

.aiCoreCoderPrimary{
  border:0;
  color:#fff;
  background:linear-gradient(135deg,#D63384,#7B1E8A);
  box-shadow:0 14px 34px rgba(214,51,132,.20);
}

.aiCoreCoderGhost,
.aiCoreCoderTabs button,
.aiCoreCoderRevision button{
  color:#7B1E8A;
  background:rgba(255,255,255,.84);
}

.aiCoreCoderMetaGrid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
}

.aiCoreCoderMetaGrid article{
  padding:15px 16px;
}

.aiCoreCoderMetaGrid strong{
  display:block;
  margin:6px 0 4px;
  font-size:20px;
  letter-spacing:-.03em;
}

.aiCoreCoderGrid{
  min-height:0;
  display:grid;
  grid-template-columns:320px minmax(0,1fr) minmax(360px,.9fr);
  gap:14px;
  overflow:hidden;
}

.aiCoreCoderSide,
.aiCoreCoderMain,
.aiCoreCoderPreviewPanel{
  min-height:0;
  overflow:auto;
}

.aiCoreCoderSide{
  display:grid;
  align-content:start;
  gap:14px;
}

.aiCoreCoderPanel{
  padding:16px;
}

.aiCoreCoderPanel h2{
  margin:7px 0 8px;
  font-size:19px;
  letter-spacing:-.035em;
}

.aiCoreCoderPanel textarea{
  width:100%;
  min-height:116px;
  margin:12px 0;
  border:1px solid rgba(22,24,28,.12);
  border-radius:18px;
  padding:12px 13px;
  resize:vertical;
  outline:none;
  background:#fff;
}

.aiCoreCoderMain{
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  padding:12px;
}

.aiCoreCoderTabs{
  display:flex;
  align-items:center;
  gap:8px;
  padding:0 0 10px;
}

.aiCoreCoderTabs button.isActive{
  color:#fff;
  background:linear-gradient(135deg,#D63384,#7B1E8A);
  border-color:transparent;
}

.aiCoreCoderEditors{
  min-height:0;
  position:relative;
}

.aiCoreCoderEditors textarea,
.aiCoreCoderEditors pre{
  display:none;
  width:100%;
  height:100%;
  min-height:360px;
  margin:0;
  border:1px solid rgba(22,24,28,.10);
  border-radius:20px;
  background:#0F172A;
  color:#E5E7EB;
  padding:16px;
  resize:none;
  outline:none;
  overflow:auto;
  font:13px/1.6 ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace;
  tab-size:2;
}

.aiCoreCoderEditors textarea.isActive,
.aiCoreCoderEditors pre.isActive{
  display:block;
}

.aiCoreCoderValidation{
  margin-top:10px;
  border:1px solid rgba(217,119,6,.20);
  background:rgba(255,251,235,.82);
  color:#92400E;
  border-radius:18px;
  padding:12px 14px;
  line-height:1.5;
}

.aiCoreCoderValidation.isOk{
  border-color:rgba(22,163,74,.18);
  background:rgba(236,253,245,.82);
  color:#166534;
}

.aiCoreCoderValidation.isDanger,
.aiCoreCoderAlert.isDanger{
  border-color:rgba(220,38,38,.22);
  background:rgba(254,242,242,.86);
  color:#991B1B;
}

.aiCoreCoderPreviewPanel{
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  padding:12px;
}

.aiCoreCoderPreviewHeader{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:0 0 10px;
}

.aiCoreCoderPreviewHeader strong{
  display:block;
  margin-top:4px;
}

.aiCoreCoderPreview{
  width:100%;
  height:100%;
  min-height:420px;
  border:1px solid rgba(22,24,28,.10);
  border-radius:22px;
  background:#fff;
}

.aiCoreCoderRevisions{
  display:grid;
  gap:10px;
  max-height:360px;
  overflow:auto;
  padding-right:3px;
}

.aiCoreCoderRevision{
  border:1px solid rgba(22,24,28,.10);
  border-radius:18px;
  padding:12px;
  background:#fff;
}

.aiCoreCoderRevision.isCurrent{
  border-color:rgba(22,163,74,.28);
  background:rgba(236,253,245,.70);
}

.aiCoreCoderRevision div{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.aiCoreCoderRevision p{
  margin:8px 0;
  color:#475569;
  font-size:13px;
}

.aiCoreCoderRevision small{
  display:block;
  color:#94A3B8;
  margin-bottom:10px;
}

.aiCoreCoderAlert{
  padding:13px 16px;
  font-weight:850;
}

.aiCoreCoderEmpty{
  border:1px dashed rgba(22,24,28,.16);
  border-radius:18px;
  padding:14px;
  color:#667085;
  background:#fff;
}

button[data-open-app-coder],
.aiCoreAppShapeActions button[data-open-app-coder]{
  border:1px solid rgba(214,51,132,.18);
  background:rgba(255,255,255,.86);
  color:#7B1E8A;
}

@media(max-width:1280px){
  .aiCoreCoderGrid{grid-template-columns:280px minmax(0,1fr)}
  .aiCoreCoderPreviewPanel{grid-column:1 / -1;min-height:520px}
}

@media(max-width:860px){
  .aiCoreCoderBody{overflow:auto}
  .aiCoreCoderShell{height:auto;min-height:100dvh;overflow:visible;padding:12px}
  .aiCoreCoderTopbar{display:grid}
  .aiCoreCoderMetaGrid,.aiCoreCoderGrid{grid-template-columns:1fr}
  .aiCoreCoderEditors textarea,.aiCoreCoderEditors pre{min-height:320px}
}

/* ==========================================================================
   v34 · Codificador integrado fullscreen
   Mejora de layout/UX sin tocar lógica: foco en editor, preview y versiones.
   ========================================================================== */
.aiCoreCoderBody{
  height:100dvh;
  min-height:100dvh;
  overflow:hidden;
  background:
    radial-gradient(circle at 8% -8%, rgba(214,51,132,.16), transparent 30%),
    radial-gradient(circle at 92% 0%, rgba(109,47,136,.12), transparent 28%),
    linear-gradient(180deg,#F7F4F8 0%,#F2F4F8 100%);
}

.aiCoreCoderShell{
  width:100%;
  max-width:none;
  height:100dvh;
  min-height:0;
  padding:12px;
  gap:10px;
  display:grid;
  grid-template-rows:auto auto minmax(0,1fr);
  overflow:hidden;
}

.aiCoreCoderTopbar{
  min-height:82px;
  max-height:118px;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:center;
  gap:18px;
  padding:14px 16px;
  border-radius:24px;
}

.aiCoreCoderTopbar > div:first-child{
  min-width:0;
}

.aiCoreCoderTopbar h1{
  max-width:1180px;
  margin:4px 0 5px;
  font-size:clamp(20px,1.55vw,28px);
  line-height:1.08;
  letter-spacing:-.035em;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.aiCoreCoderTopbar p{
  max-width:980px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size:13px;
}

.aiCoreCoderTopbarActions{
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:nowrap;
}

.aiCoreCoderTopbarActions .aiCoreCoderPrimary,
.aiCoreCoderTopbarActions .aiCoreCoderGhost{
  min-height:38px;
  padding:0 14px;
  white-space:nowrap;
}

.aiCoreCoderMetaGrid{
  min-height:0;
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
}

.aiCoreCoderMetaGrid article{
  min-width:0;
  min-height:74px;
  padding:12px 14px;
  border-radius:20px;
  display:grid;
  align-content:center;
}

.aiCoreCoderMetaGrid strong{
  margin:4px 0 3px;
  font-size:18px;
  line-height:1.15;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.aiCoreCoderMetaGrid p{
  font-size:12px;
  line-height:1.35;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.aiCoreCoderGrid{
  min-height:0;
  height:100%;
  display:grid;
  grid-template-columns:minmax(260px,300px) minmax(520px,1.22fr) minmax(420px,.9fr);
  gap:10px;
  overflow:hidden;
}

.aiCoreCoderSide,
.aiCoreCoderMain,
.aiCoreCoderPreviewPanel{
  min-height:0;
  max-height:100%;
  overflow:hidden;
}

.aiCoreCoderSide{
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  gap:10px;
}

.aiCoreCoderPanel{
  min-width:0;
  padding:14px;
  border-radius:22px;
}

.aiCoreCoderPanel h2{
  margin:6px 0 6px;
  font-size:17px;
  line-height:1.16;
}

.aiCoreCoderPanel p{
  font-size:12.5px;
  line-height:1.45;
}

.aiCoreCoderPanel textarea{
  min-height:96px;
  max-height:170px;
  margin:10px 0;
  border-radius:16px;
  font-size:13px;
}

.aiCoreCoderActionsStack{
  display:grid;
  grid-template-columns:1fr;
  gap:8px;
}

.aiCoreCoderActionsStack .aiCoreCoderPrimary,
.aiCoreCoderActionsStack .aiCoreCoderGhost{
  width:100%;
}

.aiCoreCoderMain{
  display:grid;
  grid-template-rows:auto minmax(0,1fr) auto;
  padding:10px;
  border-radius:24px;
}

.aiCoreCoderTabs{
  gap:7px;
  padding:0 0 9px;
  overflow:auto hidden;
  scrollbar-width:none;
}

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

.aiCoreCoderTabs button{
  min-height:36px;
  padding:0 15px;
  flex:0 0 auto;
}

.aiCoreCoderEditors{
  min-height:0;
  height:100%;
}

.aiCoreCoderEditors textarea,
.aiCoreCoderEditors pre{
  height:100%;
  min-height:0;
  border-radius:18px;
  padding:16px;
  font-size:13px;
  line-height:1.62;
}

.aiCoreCoderValidation{
  max-height:120px;
  overflow:auto;
  margin-top:8px;
  border-radius:16px;
  padding:10px 12px;
  font-size:13px;
}

.aiCoreCoderPreviewPanel{
  display:grid;
  grid-template-rows:auto minmax(0,1fr);
  padding:10px;
  border-radius:24px;
}

.aiCoreCoderPreviewHeader{
  min-height:48px;
  padding:0 0 9px;
}

.aiCoreCoderPreviewHeader strong{
  font-size:15px;
}

.aiCoreCoderPreviewHeader .aiCoreCoderGhost{
  min-height:36px;
  padding:0 13px;
  white-space:nowrap;
}

.aiCoreCoderPreview{
  height:100%;
  min-height:0;
  border-radius:20px;
}

.aiCoreCoderRevisions{
  max-height:none;
  min-height:0;
  height:100%;
  overflow:auto;
  padding-right:4px;
}

.aiCoreCoderRevision{
  border-radius:16px;
  padding:11px;
}

.aiCoreCoderRevision div{
  align-items:flex-start;
}

.aiCoreCoderRevision p{
  font-size:12.5px;
  line-height:1.42;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}

.aiCoreCoderRevision button{
  min-height:34px;
  padding:0 12px;
}

@media(max-width:1440px){
  .aiCoreCoderGrid{
    grid-template-columns:minmax(246px,280px) minmax(460px,1.1fr) minmax(360px,.82fr);
  }

  .aiCoreCoderTopbarActions{
    flex-wrap:wrap;
    max-width:470px;
  }
}

@media(max-width:1180px){
  .aiCoreCoderBody{
    overflow:auto;
  }

  .aiCoreCoderShell{
    height:auto;
    min-height:100dvh;
    overflow:visible;
    grid-template-rows:auto auto auto;
  }

  .aiCoreCoderTopbar{
    grid-template-columns:1fr;
  }

  .aiCoreCoderTopbarActions{
    justify-content:flex-start;
    max-width:none;
  }

  .aiCoreCoderMetaGrid{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .aiCoreCoderGrid{
    grid-template-columns:1fr;
    overflow:visible;
  }

  .aiCoreCoderSide,
  .aiCoreCoderMain,
  .aiCoreCoderPreviewPanel{
    overflow:visible;
  }

  .aiCoreCoderSide{
    grid-template-rows:auto auto;
  }

  .aiCoreCoderEditors textarea,
  .aiCoreCoderEditors pre{
    min-height:440px;
  }

  .aiCoreCoderPreview{
    min-height:560px;
  }
}

@media(max-width:720px){
  .aiCoreCoderShell{
    padding:10px;
  }

  .aiCoreCoderTopbar,
  .aiCoreCoderMetaGrid article,
  .aiCoreCoderPanel,
  .aiCoreCoderMain,
  .aiCoreCoderPreviewPanel{
    border-radius:18px;
  }

  .aiCoreCoderMetaGrid{
    grid-template-columns:1fr;
  }

  .aiCoreCoderTopbarActions{
    display:grid;
    grid-template-columns:1fr 1fr;
    width:100%;
  }

  .aiCoreCoderTopbarActions button{
    width:100%;
  }
}

/* ==========================================================================
   v35 · Codificador integrado tipo IDE
   Objetivo: el editor de código ocupa la pantalla; IA, historial, estado y
   preview quedan como paneles desplegables laterales/superiores sin tocar lógica.
   ========================================================================== */
body.aiCoreCoderBody{
  height:100dvh !important;
  min-height:100dvh !important;
  overflow:hidden !important;
  background:
    radial-gradient(circle at 4% -10%, rgba(214,51,132,.16), transparent 32%),
    radial-gradient(circle at 96% 0%, rgba(123,30,138,.14), transparent 30%),
    linear-gradient(180deg,#EEEAF1 0%,#E9ECF2 100%) !important;
}

body.aiCoreCoderBody .aiCoreCoderShell{
  height:100dvh !important;
  min-height:0 !important;
  width:100vw !important;
  max-width:none !important;
  padding:10px !important;
  gap:8px !important;
  display:grid !important;
  grid-template-rows:64px minmax(0,1fr) !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderTopbar{
  height:64px !important;
  min-height:64px !important;
  max-height:64px !important;
  display:grid !important;
  grid-template-columns:minmax(0,1fr) auto !important;
  align-items:center !important;
  gap:12px !important;
  padding:8px 10px 8px 14px !important;
  border-radius:18px !important;
  background:rgba(255,255,255,.92) !important;
  box-shadow:0 14px 38px rgba(9,6,74,.08) !important;
  z-index:80 !important;
}

body.aiCoreCoderBody .aiCoreCoderTopbar span{
  font-size:10px !important;
  letter-spacing:.18em !important;
}

body.aiCoreCoderBody .aiCoreCoderTopbar h1{
  margin:2px 0 2px !important;
  max-width:none !important;
  font-size:clamp(16px,1.1vw,21px) !important;
  line-height:1.08 !important;
  -webkit-line-clamp:1 !important;
}

body.aiCoreCoderBody .aiCoreCoderTopbar p{
  max-width:none !important;
  font-size:12px !important;
  line-height:1.25 !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

body.aiCoreCoderBody .aiCoreCoderTopbarActions{
  flex-wrap:nowrap !important;
  gap:7px !important;
  max-width:none !important;
}

body.aiCoreCoderBody .aiCoreCoderTopbarActions .aiCoreCoderPrimary,
body.aiCoreCoderBody .aiCoreCoderTopbarActions .aiCoreCoderGhost{
  min-height:36px !important;
  padding:0 13px !important;
  white-space:nowrap !important;
}

/* El área real de trabajo: el editor ocupa prácticamente toda la pantalla. */
body.aiCoreCoderBody .aiCoreCoderGrid{
  position:relative !important;
  height:100% !important;
  min-height:0 !important;
  display:block !important;
  overflow:hidden !important;
  border-radius:24px !important;
}

body.aiCoreCoderBody .aiCoreCoderMain{
  position:absolute !important;
  inset:0 !important;
  z-index:10 !important;
  display:grid !important;
  grid-template-rows:44px minmax(0,1fr) minmax(0,auto) !important;
  padding:12px !important;
  border-radius:24px !important;
  background:linear-gradient(180deg,#08111F 0%,#0F172A 100%) !important;
  border:1px solid rgba(255,255,255,.10) !important;
  box-shadow:0 24px 70px rgba(9,6,74,.18) !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderTabs{
  height:44px !important;
  padding:0 0 8px !important;
  gap:8px !important;
  align-items:center !important;
  border-bottom:1px solid rgba(255,255,255,.08) !important;
}

body.aiCoreCoderBody .aiCoreCoderTabs button{
  min-height:32px !important;
  padding:0 14px !important;
  border:1px solid rgba(255,255,255,.10) !important;
  background:rgba(255,255,255,.06) !important;
  color:#CBD5E1 !important;
}

body.aiCoreCoderBody .aiCoreCoderTabs button.isActive{
  color:#fff !important;
  background:linear-gradient(135deg,#D63384,#7B1E8A) !important;
  border-color:transparent !important;
  box-shadow:0 12px 28px rgba(214,51,132,.24) !important;
}

body.aiCoreCoderBody .aiCoreCoderEditors{
  height:100% !important;
  min-height:0 !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderEditors textarea,
body.aiCoreCoderBody .aiCoreCoderEditors pre{
  height:100% !important;
  min-height:0 !important;
  border-radius:18px !important;
  border:1px solid rgba(148,163,184,.18) !important;
  background:#050B18 !important;
  color:#E5E7EB !important;
  padding:20px 22px !important;
  font-size:14px !important;
  line-height:1.72 !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04) !important;
}

body.aiCoreCoderBody .aiCoreCoderValidation{
  max-height:112px !important;
  overflow:auto !important;
  margin-top:10px !important;
  border-radius:16px !important;
  background:rgba(255,251,235,.94) !important;
}

/* Estado/sincronización: panel inferior desplegable, no ocupa el área del editor. */
body.aiCoreCoderBody .aiCoreCoderMetaGrid{
  position:fixed !important;
  left:50% !important;
  bottom:10px !important;
  z-index:60 !important;
  width:min(980px,calc(100vw - 150px)) !important;
  display:grid !important;
  grid-template-columns:repeat(4,minmax(0,1fr)) !important;
  gap:8px !important;
  padding:44px 10px 10px !important;
  border:1px solid rgba(22,24,28,.10) !important;
  border-radius:22px !important;
  background:rgba(255,255,255,.96) !important;
  box-shadow:0 22px 60px rgba(9,6,74,.14) !important;
  transform:translate(-50%,calc(100% - 40px)) !important;
  transition:transform .22s ease, box-shadow .22s ease !important;
}

body.aiCoreCoderBody .aiCoreCoderMetaGrid:hover,
body.aiCoreCoderBody .aiCoreCoderMetaGrid:focus-within{
  transform:translate(-50%,0) !important;
}

body.aiCoreCoderBody .aiCoreCoderMetaGrid::before{
  content:"Estado · versión · flujo · sincronización";
  position:absolute;
  top:0;
  left:0;
  right:0;
  height:40px;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#7B1E8A;
  font-size:11px;
  font-weight:1000;
  letter-spacing:.14em;
  text-transform:uppercase;
  border-bottom:1px solid rgba(22,24,28,.08);
}

body.aiCoreCoderBody .aiCoreCoderMetaGrid article{
  min-height:68px !important;
  padding:10px 12px !important;
  border-radius:16px !important;
  box-shadow:none !important;
}

/* Panel IA + historial como drawer izquierdo. */
body.aiCoreCoderBody .aiCoreCoderSide{
  position:fixed !important;
  top:84px !important;
  left:10px !important;
  bottom:10px !important;
  z-index:70 !important;
  width:min(420px,92vw) !important;
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) !important;
  gap:10px !important;
  padding:0 !important;
  overflow:visible !important;
  transform:translateX(calc(-100% + 44px)) !important;
  transition:transform .22s ease, filter .22s ease !important;
  filter:drop-shadow(0 24px 58px rgba(9,6,74,.20));
}

body.aiCoreCoderBody .aiCoreCoderSide:hover,
body.aiCoreCoderBody .aiCoreCoderSide:focus-within{
  transform:translateX(0) !important;
}

body.aiCoreCoderBody .aiCoreCoderSide::after{
  content:"IA";
  position:absolute;
  top:18px;
  right:-44px;
  width:44px;
  height:96px;
  display:flex;
  align-items:center;
  justify-content:center;
  writing-mode:vertical-rl;
  text-orientation:mixed;
  color:#fff;
  font-size:12px;
  font-weight:1000;
  letter-spacing:.16em;
  text-transform:uppercase;
  border-radius:0 16px 16px 0;
  background:linear-gradient(180deg,#D63384,#7B1E8A);
  box-shadow:0 16px 34px rgba(214,51,132,.24);
}

body.aiCoreCoderBody .aiCoreCoderSide .aiCoreCoderPanel{
  background:rgba(255,255,255,.98) !important;
  border-radius:20px !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderSide .aiCoreCoderPanel:last-child{
  min-height:0 !important;
  display:grid !important;
  grid-template-rows:auto auto minmax(0,1fr) !important;
}

body.aiCoreCoderBody .aiCoreCoderRevisions{
  height:100% !important;
  min-height:0 !important;
  overflow:auto !important;
}

/* Preview como drawer derecho, estilo panel moderno. */
body.aiCoreCoderBody .aiCoreCoderPreviewPanel{
  position:fixed !important;
  top:84px !important;
  right:10px !important;
  bottom:10px !important;
  z-index:70 !important;
  width:min(620px,94vw) !important;
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) !important;
  padding:12px !important;
  border-radius:22px !important;
  background:rgba(255,255,255,.98) !important;
  overflow:visible !important;
  transform:translateX(calc(100% - 44px)) !important;
  transition:transform .22s ease, filter .22s ease !important;
  filter:drop-shadow(0 24px 58px rgba(9,6,74,.20));
}

body.aiCoreCoderBody .aiCoreCoderPreviewPanel:hover,
body.aiCoreCoderBody .aiCoreCoderPreviewPanel:focus-within{
  transform:translateX(0) !important;
}

body.aiCoreCoderBody .aiCoreCoderPreviewPanel::after{
  content:"Preview";
  position:absolute;
  top:18px;
  left:-44px;
  width:44px;
  height:122px;
  display:flex;
  align-items:center;
  justify-content:center;
  writing-mode:vertical-rl;
  text-orientation:mixed;
  color:#7B1E8A;
  font-size:12px;
  font-weight:1000;
  letter-spacing:.14em;
  text-transform:uppercase;
  border:1px solid rgba(214,51,132,.18);
  border-right:0;
  border-radius:16px 0 0 16px;
  background:rgba(255,255,255,.98);
  box-shadow:0 16px 34px rgba(9,6,74,.12);
}

body.aiCoreCoderBody .aiCoreCoderPreviewHeader{
  min-height:44px !important;
  padding:0 0 10px !important;
}

body.aiCoreCoderBody .aiCoreCoderPreview{
  height:100% !important;
  min-height:0 !important;
  border-radius:18px !important;
}

/* Al abrir drawers, que no bloqueen trabajar con el editor salvo en la franja necesaria. */
body.aiCoreCoderBody .aiCoreCoderSide:not(:hover):not(:focus-within) .aiCoreCoderPanel,
body.aiCoreCoderBody .aiCoreCoderPreviewPanel:not(:hover):not(:focus-within) > *:not(.aiCoreCoderPreviewHeader){
  pointer-events:none;
}

@media(max-width:980px){
  body.aiCoreCoderBody{
    overflow:auto !important;
  }

  body.aiCoreCoderBody .aiCoreCoderShell{
    height:auto !important;
    min-height:100dvh !important;
    grid-template-rows:auto auto auto !important;
    overflow:visible !important;
  }

  body.aiCoreCoderBody .aiCoreCoderTopbar{
    height:auto !important;
    min-height:0 !important;
    max-height:none !important;
    grid-template-columns:1fr !important;
  }

  body.aiCoreCoderBody .aiCoreCoderTopbarActions{
    display:grid !important;
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    width:100% !important;
  }

  body.aiCoreCoderBody .aiCoreCoderMetaGrid,
  body.aiCoreCoderBody .aiCoreCoderSide,
  body.aiCoreCoderBody .aiCoreCoderPreviewPanel,
  body.aiCoreCoderBody .aiCoreCoderMain{
    position:static !important;
    transform:none !important;
    width:auto !important;
    inset:auto !important;
  }

  body.aiCoreCoderBody .aiCoreCoderMetaGrid{
    grid-template-columns:1fr !important;
    padding:10px !important;
  }

  body.aiCoreCoderBody .aiCoreCoderMetaGrid::before,
  body.aiCoreCoderBody .aiCoreCoderSide::after,
  body.aiCoreCoderBody .aiCoreCoderPreviewPanel::after{
    display:none !important;
  }

  body.aiCoreCoderBody .aiCoreCoderGrid{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:10px !important;
    height:auto !important;
    overflow:visible !important;
  }

  body.aiCoreCoderBody .aiCoreCoderMain{
    min-height:70vh !important;
  }

  body.aiCoreCoderBody .aiCoreCoderEditors textarea,
  body.aiCoreCoderBody .aiCoreCoderEditors pre{
    min-height:58vh !important;
  }

  body.aiCoreCoderBody .aiCoreCoderPreview{
    min-height:520px !important;
  }
}

/* ========================================================================== 
   DTP AI Core · Codificador v36
   Paneles laterales derechos por click: no tapan el editor ni la validación.
   Preview fullscreen con cierre claro. Mantiene intacta la lógica del editor.
   ========================================================================== */
body.aiCoreCoderBody .aiCoreCoderRail{
  position:fixed !important;
  top:96px !important;
  right:12px !important;
  z-index:140 !important;
  display:flex !important;
  flex-direction:column !important;
  gap:10px !important;
  width:54px !important;
  pointer-events:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderRail button{
  width:54px !important;
  min-height:96px !important;
  padding:10px 0 !important;
  border-radius:18px !important;
  border:1px solid rgba(214,51,132,.20) !important;
  background:rgba(255,255,255,.94) !important;
  color:#7B1E8A !important;
  font-size:11px !important;
  font-weight:1000 !important;
  letter-spacing:.15em !important;
  text-transform:uppercase !important;
  writing-mode:vertical-rl !important;
  text-orientation:mixed !important;
  box-shadow:0 16px 34px rgba(9,6,74,.12) !important;
  cursor:pointer !important;
  transition:transform .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease !important;
}

body.aiCoreCoderBody .aiCoreCoderRail button:hover,
body.aiCoreCoderBody .aiCoreCoderRail button.isActive{
  transform:translateX(-3px) !important;
  background:linear-gradient(180deg,#D63384,#7B1E8A) !important;
  color:#fff !important;
  border-color:transparent !important;
  box-shadow:0 20px 42px rgba(214,51,132,.26) !important;
}

/* Reserva una franja real para las pestañas laterales: el editor ya no queda tapado. */
body.aiCoreCoderBody .aiCoreCoderMain{
  right:78px !important;
  bottom:0 !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
  right:min(520px,calc(100vw - 430px)) !important;
}

body.aiCoreCoderBody .aiCoreCoderValidation{
  position:relative !important;
  z-index:12 !important;
  max-height:128px !important;
  margin-top:10px !important;
}

/* Reset de drawers v35: ya no se abren por hover ni se ubican a la izquierda. */
body.aiCoreCoderBody .aiCoreCoderSide,
body.aiCoreCoderBody .aiCoreCoderMetaGrid{
  position:fixed !important;
  top:84px !important;
  right:78px !important;
  left:auto !important;
  bottom:10px !important;
  z-index:120 !important;
  width:min(430px,calc(100vw - 100px)) !important;
  height:auto !important;
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) !important;
  gap:10px !important;
  padding:12px !important;
  border-radius:22px !important;
  border:1px solid rgba(22,24,28,.10) !important;
  background:rgba(255,255,255,.98) !important;
  box-shadow:0 24px 70px rgba(9,6,74,.18) !important;
  overflow:hidden !important;
  opacity:0 !important;
  pointer-events:none !important;
  transform:translateX(calc(100% + 90px)) !important;
  transition:transform .22s ease, opacity .22s ease !important;
  filter:none !important;
}

body.aiCoreCoderBody .aiCoreCoderSide:hover,
body.aiCoreCoderBody .aiCoreCoderSide:focus-within,
body.aiCoreCoderBody .aiCoreCoderMetaGrid:hover,
body.aiCoreCoderBody .aiCoreCoderMetaGrid:focus-within{
  transform:translateX(calc(100% + 90px)) !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderSide,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMetaGrid{
  opacity:1 !important;
  pointer-events:auto !important;
  transform:translateX(0) !important;
}

body.aiCoreCoderBody .aiCoreCoderSide::after,
body.aiCoreCoderBody .aiCoreCoderMetaGrid::before,
body.aiCoreCoderBody .aiCoreCoderPreviewPanel::after{
  display:none !important;
  content:none !important;
}

body.aiCoreCoderBody .aiCoreCoderSide:not(:hover):not(:focus-within) .aiCoreCoderPanel,
body.aiCoreCoderBody .aiCoreCoderPreviewPanel:not(:hover):not(:focus-within) > *:not(.aiCoreCoderPreviewHeader){
  pointer-events:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderDrawerHeader{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:12px !important;
  padding:4px 2px 12px !important;
  border-bottom:1px solid rgba(22,24,28,.08) !important;
}

body.aiCoreCoderBody .aiCoreCoderDrawerHeader span{
  display:block !important;
  color:#667085 !important;
  font-size:10px !important;
  font-weight:1000 !important;
  letter-spacing:.16em !important;
  text-transform:uppercase !important;
}

body.aiCoreCoderBody .aiCoreCoderDrawerHeader strong{
  display:block !important;
  margin-top:4px !important;
  color:#16181C !important;
  font-size:15px !important;
  line-height:1.18 !important;
}

body.aiCoreCoderBody .aiCoreCoderDrawerHeader .aiCoreCoderGhost{
  min-height:34px !important;
  padding:0 12px !important;
  font-size:12px !important;
  white-space:nowrap !important;
}

body.aiCoreCoderBody .aiCoreCoderSide .aiCoreCoderPanel{
  min-height:0 !important;
  padding:14px !important;
  border-radius:18px !important;
  box-shadow:none !important;
  border:1px solid rgba(22,24,28,.08) !important;
}

body.aiCoreCoderBody .aiCoreCoderSide .aiCoreCoderPanel:last-child{
  min-height:0 !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderMetaGrid{
  grid-template-columns:1fr !important;
  align-content:start !important;
  transform:translateX(calc(100% + 90px)) !important;
}

body.aiCoreCoderBody .aiCoreCoderMetaGrid article{
  min-height:82px !important;
  padding:14px !important;
  border-radius:18px !important;
  border:1px solid rgba(22,24,28,.08) !important;
  background:#fff !important;
}

body.aiCoreCoderBody .aiCoreCoderMetaGrid .aiCoreCoderDrawerHeader{
  grid-column:1 / -1 !important;
}

/* Preview: solo se despliega al click y ocupa pantalla completa, con cierre visible. */
body.aiCoreCoderBody .aiCoreCoderPreviewPanel{
  position:fixed !important;
  inset:72px 14px 14px 14px !important;
  z-index:180 !important;
  width:auto !important;
  height:auto !important;
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) !important;
  padding:14px !important;
  border-radius:24px !important;
  border:1px solid rgba(22,24,28,.10) !important;
  background:rgba(255,255,255,.98) !important;
  box-shadow:0 32px 90px rgba(9,6,74,.28) !important;
  opacity:0 !important;
  pointer-events:none !important;
  transform:translateY(16px) scale(.985) !important;
  transition:opacity .20s ease, transform .20s ease !important;
  filter:none !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderPreviewPanel:hover,
body.aiCoreCoderBody .aiCoreCoderPreviewPanel:focus-within{
  transform:translateY(16px) scale(.985) !important;
}

body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderPreviewPanel{
  opacity:1 !important;
  pointer-events:auto !important;
  transform:translateY(0) scale(1) !important;
}

body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderPreviewPanel::before{
  content:"";
  position:fixed;
  inset:0;
  z-index:-1;
  background:rgba(15,23,42,.36);
  backdrop-filter:blur(6px);
}

body.aiCoreCoderBody .aiCoreCoderPreviewHeader{
  min-height:48px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:12px !important;
  padding:0 0 12px !important;
  border-bottom:1px solid rgba(22,24,28,.08) !important;
}

body.aiCoreCoderBody .aiCoreCoderPreviewHeader > div:first-child{
  min-width:0 !important;
}

body.aiCoreCoderBody .aiCoreCoderPreviewActions{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  gap:8px !important;
  flex-wrap:wrap !important;
}

body.aiCoreCoderBody .aiCoreCoderPreviewActions .aiCoreCoderGhost{
  min-height:36px !important;
  padding:0 13px !important;
  font-size:12px !important;
  white-space:nowrap !important;
}

body.aiCoreCoderBody .aiCoreCoderPreviewActions [data-coder-close-panel]{
  background:linear-gradient(135deg,#D63384,#7B1E8A) !important;
  color:#fff !important;
  border-color:transparent !important;
  box-shadow:0 14px 30px rgba(214,51,132,.20) !important;
}

body.aiCoreCoderBody .aiCoreCoderPreview{
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  border-radius:20px !important;
  background:#fff !important;
}

@media(max-width:980px){
  body.aiCoreCoderBody .aiCoreCoderRail{
    position:sticky !important;
    top:8px !important;
    right:auto !important;
    width:100% !important;
    z-index:120 !important;
    flex-direction:row !important;
    justify-content:center !important;
    order:2 !important;
  }

  body.aiCoreCoderBody .aiCoreCoderRail button{
    width:auto !important;
    min-height:38px !important;
    padding:0 14px !important;
    writing-mode:horizontal-tb !important;
  }

  body.aiCoreCoderBody .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
    right:auto !important;
  }

  body.aiCoreCoderBody .aiCoreCoderSide,
  body.aiCoreCoderBody .aiCoreCoderMetaGrid{
    top:76px !important;
    right:10px !important;
    bottom:10px !important;
    width:calc(100vw - 20px) !important;
  }

  body.aiCoreCoderBody .aiCoreCoderPreviewPanel{
    inset:70px 10px 10px 10px !important;
  }
}

/* ========================================================================== 
   DTP AI Core · Codificador v37
   UX funcional: IA visible, corrección con IA, guardado real, estados claros.
   Solo complementa layout v36; no cambia lógica de app ni flujos.
   ========================================================================== */
body.aiCoreCoderBody.hasCoderUnsavedChanges .aiCoreCoderTopbar{
  border-color:rgba(217,119,6,.28) !important;
  box-shadow:0 18px 46px rgba(217,119,6,.10) !important;
}

body.aiCoreCoderBody.hasCoderUnsavedChanges [data-coder-sync]{
  color:#B45309 !important;
}

.aiCoreCoderToast{
  position:fixed;
  left:50%;
  bottom:22px;
  z-index:260;
  transform:translateX(-50%);
  max-width:min(760px,calc(100vw - 36px));
  padding:13px 18px;
  border-radius:999px;
  border:1px solid rgba(22,24,28,.10);
  background:rgba(255,255,255,.96);
  color:#16181C;
  box-shadow:0 22px 60px rgba(9,6,74,.18);
  font-weight:900;
  line-height:1.35;
  backdrop-filter:blur(14px);
}

.aiCoreCoderToast.isOk{
  color:#166534;
  border-color:rgba(22,163,74,.20);
  background:rgba(236,253,245,.96);
}

.aiCoreCoderToast.isWarn,
.aiCoreCoderToast.isInfo{
  color:#92400E;
  border-color:rgba(217,119,6,.22);
  background:rgba(255,251,235,.96);
}

.aiCoreCoderToast.isDanger{
  color:#991B1B;
  border-color:rgba(220,38,38,.22);
  background:rgba(254,242,242,.96);
}

body.aiCoreCoderBody .aiCoreCoderValidationHead{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:12px !important;
  margin-bottom:6px !important;
}

body.aiCoreCoderBody .aiCoreCoderFixBtn{
  min-height:34px !important;
  padding:0 13px !important;
  border:0 !important;
  border-radius:999px !important;
  color:#fff !important;
  background:linear-gradient(135deg,#D63384,#7B1E8A) !important;
  font-weight:1000 !important;
  box-shadow:0 12px 30px rgba(214,51,132,.20) !important;
  white-space:nowrap !important;
}

body.aiCoreCoderBody .aiCoreCoderAIStatus{
  margin-top:10px !important;
  padding:10px 12px !important;
  border-radius:14px !important;
  background:rgba(248,250,252,.95) !important;
  color:#475569 !important;
  font-size:12.5px !important;
  line-height:1.45 !important;
  border:1px solid rgba(15,23,42,.08) !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult{
  margin-top:10px !important;
  padding:12px !important;
  border-radius:16px !important;
  border:1px solid rgba(214,51,132,.14) !important;
  background:linear-gradient(180deg,rgba(253,242,248,.82),rgba(255,255,255,.96)) !important;
  color:#334155 !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult strong{
  display:block !important;
  color:#16181C !important;
  font-size:14px !important;
  margin-bottom:6px !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult p{
  margin:0 0 8px !important;
  color:#475569 !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult small{
  display:block !important;
  color:#7B1E8A !important;
  font-weight:850 !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult ul,
body.aiCoreCoderBody .aiCoreCoderValidation ul{
  margin:8px 0 0 !important;
  padding-left:20px !important;
}

body.aiCoreCoderBody .aiCoreCoderPrimary:disabled,
body.aiCoreCoderBody .aiCoreCoderGhost:disabled{
  opacity:.52 !important;
  cursor:not-allowed !important;
  box-shadow:none !important;
}

body.aiCoreCoderBody .aiCoreCoderSide{
  grid-template-rows:auto minmax(0,1.1fr) minmax(0,.9fr) !important;
}

body.aiCoreCoderBody .aiCoreCoderPanel:first-of-type{
  min-height:0 !important;
  overflow:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderPanel textarea[data-coder-ai-prompt]{
  min-height:132px !important;
  max-height:240px !important;
}

body.aiCoreCoderBody .aiCoreCoderRevisions{
  border-radius:16px !important;
}

@media(max-width:980px){
  .aiCoreCoderToast{
    bottom:12px;
    border-radius:18px;
  }
}


/* ========================================================================== 
   v38 · Codificador integrado: IA funcional, historial separado y acciones robustas
   ========================================================================== */
body.aiCoreCoderBody .aiCoreCoderRail{
  top:50% !important;
  transform:translateY(-50%) !important;
  gap:10px !important;
}

body.aiCoreCoderBody .aiCoreCoderRail button{
  width:56px !important;
  min-height:84px !important;
  max-height:118px !important;
  padding:9px 0 !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

body.aiCoreCoderBody .aiCoreCoderRail button[data-coder-panel-toggle="history"]{
  min-height:116px !important;
}

body.aiCoreCoderBody .aiCoreCoderSide,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
body.aiCoreCoderBody .aiCoreCoderMetaGrid{
  position:fixed !important;
  top:84px !important;
  right:78px !important;
  left:auto !important;
  bottom:10px !important;
  z-index:120 !important;
  width:min(460px,calc(100vw - 110px)) !important;
  height:auto !important;
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) !important;
  gap:10px !important;
  padding:12px !important;
  border-radius:22px !important;
  border:1px solid rgba(22,24,28,.10) !important;
  background:rgba(255,255,255,.98) !important;
  box-shadow:0 24px 70px rgba(9,6,74,.18) !important;
  overflow:hidden !important;
  opacity:0 !important;
  pointer-events:none !important;
  transform:translateX(calc(100% + 90px)) !important;
  transition:transform .22s ease, opacity .22s ease !important;
  filter:none !important;
}

body.aiCoreCoderBody .aiCoreCoderSide:hover,
body.aiCoreCoderBody .aiCoreCoderSide:focus-within,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel:hover,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel:focus-within,
body.aiCoreCoderBody .aiCoreCoderMetaGrid:hover,
body.aiCoreCoderBody .aiCoreCoderMetaGrid:focus-within{
  transform:translateX(calc(100% + 90px)) !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderSide,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderHistoryPanel,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMetaGrid{
  opacity:1 !important;
  pointer-events:auto !important;
  transform:translateX(0) !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
  right:min(548px,calc(100vw - 430px)) !important;
}

body.aiCoreCoderBody .aiCoreCoderSide{
  grid-template-rows:auto minmax(0,1fr) !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel{
  display:grid !important;
  grid-template-rows:auto auto auto minmax(150px,auto) auto auto minmax(0,1fr) !important;
  min-height:0 !important;
  overflow:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]{
  order:4 !important;
  display:block !important;
  position:relative !important;
  z-index:1 !important;
  margin-top:10px !important;
  min-height:76px !important;
  height:100px !important;
  max-height:150px !important;
  overflow:auto !important;
  resize:vertical !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]:focus{
  border-color:rgba(214,51,132,.34) !important;
  box-shadow:0 0 0 4px rgba(214,51,132,.09) !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderActionsStack{
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:9px !important;
  margin-top:4px !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderPrimary,
body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderGhost{
  min-height:40px !important;
}

body.aiCoreCoderBody .aiCoreCoderAIStatus,
body.aiCoreCoderBody .aiCoreCoderAIResult{
  flex:0 0 auto !important;
}

body.aiCoreCoderBody .aiCoreCoderHistoryPanel .aiCoreCoderPanel{
  min-height:0 !important;
  display:grid !important;
  grid-template-rows:auto auto auto minmax(0,1fr) !important;
  overflow:hidden !important;
  padding:14px !important;
  border-radius:18px !important;
  border:1px solid rgba(22,24,28,.08) !important;
  background:rgba(255,255,255,.98) !important;
  box-shadow:none !important;
}

body.aiCoreCoderBody .aiCoreCoderHistoryPanel .aiCoreCoderRevisions{
  height:100% !important;
  max-height:none !important;
  min-height:0 !important;
  overflow:auto !important;
  padding-right:5px !important;
}

body.aiCoreCoderBody .aiCoreCoderHistoryPanel .aiCoreCoderRevision{
  background:#fff !important;
}

body.aiCoreCoderBody .aiCoreCoderValidation{
  z-index:20 !important;
  pointer-events:auto !important;
  max-height:150px !important;
}

body.aiCoreCoderBody .aiCoreCoderPreviewPanel{
  inset:70px 12px 12px 12px !important;
  z-index:220 !important;
}

body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderPreviewPanel{
  opacity:1 !important;
  pointer-events:auto !important;
  transform:translateY(0) scale(1) !important;
}

body.aiCoreCoderBody .aiCoreCoderPreviewActions [data-coder-close-panel="preview"]{
  min-width:132px !important;
}

@media(max-width:980px){
  body.aiCoreCoderBody .aiCoreCoderSide,
  body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
  body.aiCoreCoderBody .aiCoreCoderMetaGrid{
    top:76px !important;
    right:10px !important;
    bottom:10px !important;
    width:calc(100vw - 20px) !important;
  }

  body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
    right:auto !important;
  }
}

/* ========================================================================== 
   v39 · Codificador integrado: acciones IA confiables y layout sin bloqueos
   ========================================================================== */
body.aiCoreCoderBody{
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderShell{
  contain:layout style !important;
}

body.aiCoreCoderBody .aiCoreCoderMain{
  transition:right .16s ease !important;
  will-change:right !important;
}

body.aiCoreCoderBody .aiCoreCoderEditors,
body.aiCoreCoderBody .aiCoreCoderEditors textarea,
body.aiCoreCoderBody .aiCoreCoderEditors pre{
  contain:layout paint !important;
}

body.aiCoreCoderBody .aiCoreCoderSide,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
body.aiCoreCoderBody .aiCoreCoderMetaGrid{
  contain:layout paint style !important;
  will-change:transform,opacity !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel{
  gap:12px !important;
  align-content:start !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]{
  order:4 !important;
  display:block !important;
  position:relative !important;
  z-index:1 !important;
  margin-top:10px !important;
  min-height:76px !important;
  height:100px !important;
  max-height:150px !important;
  overflow:auto !important;
  resize:vertical !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]:focus{
  border-color:rgba(178,34,168,.42) !important;
  box-shadow:0 0 0 4px rgba(178,34,168,.10) !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderActionsStack{
  position:sticky !important;
  bottom:0 !important;
  z-index:4 !important;
  padding-top:8px !important;
  background:linear-gradient(180deg,rgba(255,255,255,.72),#fff 34%) !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel [data-coder-ai-preview],
body.aiCoreCoderBody .aiCoreCoderAIPanel [data-coder-ai-apply],
body.aiCoreCoderBody .aiCoreCoderAIPanel [data-coder-ai-discard],
body.aiCoreCoderBody [data-coder-fix-ai]{
  pointer-events:auto !important;
  user-select:none !important;
  touch-action:manipulation !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderPrimary:not(:disabled),
body.aiCoreCoderBody [data-coder-fix-ai]:not(:disabled){
  cursor:pointer !important;
  box-shadow:0 14px 34px rgba(178,34,168,.20) !important;
}

body.aiCoreCoderBody .aiCoreCoderAIStatus{
  min-height:42px !important;
  display:flex !important;
  align-items:center !important;
  border-radius:14px !important;
  background:rgba(246,244,240,.74) !important;
  border:1px solid rgba(22,24,28,.07) !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult:not([hidden]){
  display:block !important;
  max-height:220px !important;
  overflow:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderValidation{
  position:relative !important;
  flex:0 0 auto !important;
  min-height:58px !important;
  max-height:160px !important;
  overflow:auto !important;
  margin-top:0 !important;
}

body.aiCoreCoderBody .aiCoreCoderValidationHead{
  gap:12px !important;
}

body.aiCoreCoderBody .aiCoreCoderFixBtn{
  flex:0 0 auto !important;
  white-space:nowrap !important;
}

@media(prefers-reduced-motion: reduce){
  body.aiCoreCoderBody .aiCoreCoderMain,
  body.aiCoreCoderBody .aiCoreCoderSide,
  body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
  body.aiCoreCoderBody .aiCoreCoderMetaGrid,
  body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]{
    transition:none !important;
  }
}

/* ========================================================================== 
   v40 · Codificador integrado: estabilidad de puntero, edición fluida y panel IA real
   Corrige parpadeo de cursor/manito causado por cierres de panel y transiciones.
   ========================================================================== */
body.aiCoreCoderBody .aiCoreCoderShell,
body.aiCoreCoderBody .aiCoreCoderGrid,
body.aiCoreCoderBody .aiCoreCoderMain,
body.aiCoreCoderBody .aiCoreCoderEditors,
body.aiCoreCoderBody .aiCoreCoderEditors textarea,
body.aiCoreCoderBody .aiCoreCoderEditors pre{
  pointer-events:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderEditors textarea{
  cursor:text !important;
  user-select:text !important;
  -webkit-user-select:text !important;
  caret-color:#D63384 !important;
  resize:none !important;
  touch-action:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]{
  cursor:text !important;
  user-select:text !important;
  -webkit-user-select:text !important;
  pointer-events:auto !important;
  touch-action:auto !important;
}

body.aiCoreCoderBody button,
body.aiCoreCoderBody [role="button"],
body.aiCoreCoderBody .aiCoreCoderRail button,
body.aiCoreCoderBody .aiCoreCoderPrimary,
body.aiCoreCoderBody .aiCoreCoderGhost,
body.aiCoreCoderBody .aiCoreCoderFixBtn{
  cursor:pointer !important;
  pointer-events:auto !important;
  -webkit-tap-highlight-color:transparent !important;
}

body.aiCoreCoderBody button:disabled,
body.aiCoreCoderBody .aiCoreCoderPrimary:disabled,
body.aiCoreCoderBody .aiCoreCoderGhost:disabled{
  cursor:not-allowed !important;
}

/* Los paneles cerrados no ocupan interacción ni disparan hover invisible. */
body.aiCoreCoderBody .aiCoreCoderSide,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
body.aiCoreCoderBody .aiCoreCoderMetaGrid{
  visibility:hidden !important;
  pointer-events:none !important;
  transform:translateX(calc(100% + 96px)) !important;
  transition:opacity .16s ease, transform .16s ease, visibility 0s linear .16s !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderSide,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderHistoryPanel,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMetaGrid{
  visibility:visible !important;
  pointer-events:auto !important;
  transform:translateX(0) !important;
  transition:opacity .16s ease, transform .16s ease, visibility 0s !important;
}

/* Evita que hover/focus cierre o desplace el panel bajo el cursor. */
body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderSide:hover,
body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderSide:focus-within,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderHistoryPanel:hover,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderHistoryPanel:focus-within,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMetaGrid:hover,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMetaGrid:focus-within{
  transform:translateX(0) !important;
}

/* El editor solo se reacomoda cuando realmente hay panel lateral abierto. */
body.aiCoreCoderBody .aiCoreCoderMain{
  transition:none !important;
  will-change:auto !important;
  z-index:20 !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
  right:min(548px,calc(100vw - 430px)) !important;
}

body.aiCoreCoderBody:not(.isCoderAssistantOpen):not(.isCoderHistoryOpen):not(.isCoderMetaOpen) .aiCoreCoderMain{
  right:78px !important;
}

/* El rail queda en una capa propia y no invade el editor. */
body.aiCoreCoderBody .aiCoreCoderRail{
  z-index:170 !important;
  pointer-events:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderRail::before,
body.aiCoreCoderBody .aiCoreCoderRail::after,
body.aiCoreCoderBody .aiCoreCoderSide::before,
body.aiCoreCoderBody .aiCoreCoderSide::after,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel::before,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel::after,
body.aiCoreCoderBody .aiCoreCoderMetaGrid::before,
body.aiCoreCoderBody .aiCoreCoderMetaGrid::after{
  pointer-events:none !important;
}

/* Panel IA: acciones siempre visibles y sin overlay encima del textarea. */
body.aiCoreCoderBody .aiCoreCoderAIPanel{
  overflow:auto !important;
  overscroll-behavior:contain !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderActionsStack{
  position:relative !important;
  bottom:auto !important;
  z-index:2 !important;
  padding-top:6px !important;
  background:transparent !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel [data-coder-ai-preview],
body.aiCoreCoderBody .aiCoreCoderAIPanel [data-coder-ai-apply],
body.aiCoreCoderBody .aiCoreCoderAIPanel [data-coder-ai-discard],
body.aiCoreCoderBody [data-coder-fix-ai]{
  min-height:42px !important;
  position:relative !important;
  z-index:5 !important;
}

body.aiCoreCoderBody .aiCoreCoderValidation{
  position:relative !important;
  z-index:24 !important;
  pointer-events:auto !important;
}

/* ========================================================================== 
   v41 · Codificador integrado: corrección de raíz para puntero y acciones IA
   - Elimina drawers invisibles/hover que interceptaban clicks.
   - Quita transiciones que movían pestañas bajo el cursor.
   - Mantiene el editor como superficie estable de edición.
   ========================================================================== */
body.aiCoreCoderBody,
body.aiCoreCoderBody *{
  scroll-behavior:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderGrid{
  position:relative !important;
  isolation:isolate !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderMain{
  position:absolute !important;
  inset:0 78px 0 0 !important;
  z-index:10 !important;
  transition:none !important;
  transform:none !important;
  will-change:auto !important;
  pointer-events:auto !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
  right:min(552px,calc(100vw - 430px)) !important;
  transition:none !important;
}

body.aiCoreCoderBody:not(.isCoderAssistantOpen):not(.isCoderHistoryOpen):not(.isCoderMetaOpen) .aiCoreCoderMain{
  right:78px !important;
}

body.aiCoreCoderBody .aiCoreCoderEditors{
  position:relative !important;
  z-index:11 !important;
  pointer-events:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderEditors textarea,
body.aiCoreCoderBody .aiCoreCoderEditors pre{
  position:absolute !important;
  inset:0 !important;
  width:100% !important;
  height:100% !important;
  display:block !important;
  opacity:0 !important;
  visibility:hidden !important;
  pointer-events:none !important;
  cursor:text !important;
  transform:none !important;
  transition:none !important;
  contain:none !important;
}

body.aiCoreCoderBody .aiCoreCoderEditors textarea.isActive,
body.aiCoreCoderBody .aiCoreCoderEditors pre.isActive{
  opacity:1 !important;
  visibility:visible !important;
  pointer-events:auto !important;
  z-index:2 !important;
}

body.aiCoreCoderBody .aiCoreCoderEditors textarea.isActive{
  user-select:text !important;
  -webkit-user-select:text !important;
  caret-color:#D63384 !important;
  cursor:text !important;
}

body.aiCoreCoderBody .aiCoreCoderValidation{
  position:relative !important;
  z-index:12 !important;
  pointer-events:auto !important;
  transform:none !important;
  transition:none !important;
}

body.aiCoreCoderBody .aiCoreCoderRail{
  position:fixed !important;
  top:96px !important;
  right:12px !important;
  z-index:90 !important;
  width:54px !important;
  pointer-events:auto !important;
  transform:none !important;
  transition:none !important;
}

body.aiCoreCoderBody .aiCoreCoderRail button,
body.aiCoreCoderBody .aiCoreCoderRail button:hover,
body.aiCoreCoderBody .aiCoreCoderRail button:focus,
body.aiCoreCoderBody .aiCoreCoderRail button.isActive{
  transform:none !important;
  transition:none !important;
  cursor:pointer !important;
  pointer-events:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderRail button:hover,
body.aiCoreCoderBody .aiCoreCoderRail button.isActive{
  background:linear-gradient(180deg,#D63384,#7B1E8A) !important;
  color:#fff !important;
  border-color:transparent !important;
}

body.aiCoreCoderBody .aiCoreCoderSide,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
body.aiCoreCoderBody .aiCoreCoderMetaGrid{
  display:none !important;
  position:fixed !important;
  top:84px !important;
  right:78px !important;
  left:auto !important;
  bottom:10px !important;
  width:min(460px,calc(100vw - 110px)) !important;
  height:auto !important;
  z-index:120 !important;
  opacity:1 !important;
  visibility:visible !important;
  pointer-events:auto !important;
  transform:none !important;
  transition:none !important;
  contain:none !important;
  overflow:hidden !important;
  border-radius:22px !important;
  background:rgba(255,255,255,.985) !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderSide,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderHistoryPanel,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMetaGrid{
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) !important;
}

body.aiCoreCoderBody .aiCoreCoderSide:hover,
body.aiCoreCoderBody .aiCoreCoderSide:focus-within,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel:hover,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel:focus-within,
body.aiCoreCoderBody .aiCoreCoderMetaGrid:hover,
body.aiCoreCoderBody .aiCoreCoderMetaGrid:focus-within{
  transform:none !important;
}

body.aiCoreCoderBody .aiCoreCoderSide::before,
body.aiCoreCoderBody .aiCoreCoderSide::after,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel::before,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel::after,
body.aiCoreCoderBody .aiCoreCoderMetaGrid::before,
body.aiCoreCoderBody .aiCoreCoderMetaGrid::after,
body.aiCoreCoderBody .aiCoreCoderRail::before,
body.aiCoreCoderBody .aiCoreCoderRail::after{
  display:none !important;
  content:none !important;
  pointer-events:none !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel .aiCoreCoderPanel,
body.aiCoreCoderBody .aiCoreCoderMetaGrid{
  min-height:0 !important;
  overflow:auto !important;
  overscroll-behavior:contain !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]{
  order:4 !important;
  display:block !important;
  position:relative !important;
  z-index:1 !important;
  margin-top:10px !important;
  min-height:76px !important;
  height:100px !important;
  max-height:150px !important;
  overflow:auto !important;
  resize:vertical !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderActionsStack{
  position:relative !important;
  z-index:4 !important;
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:10px !important;
  pointer-events:auto !important;
  background:transparent !important;
}

body.aiCoreCoderBody button,
body.aiCoreCoderBody .aiCoreCoderPrimary,
body.aiCoreCoderBody .aiCoreCoderGhost,
body.aiCoreCoderBody .aiCoreCoderFixBtn,
body.aiCoreCoderBody [data-coder-ai-preview],
body.aiCoreCoderBody [data-coder-fix-ai],
body.aiCoreCoderBody [data-coder-panel-toggle]{
  cursor:pointer !important;
  pointer-events:auto !important;
  transform:none !important;
  transition:none !important;
  touch-action:manipulation !important;
  -webkit-tap-highlight-color:transparent !important;
}

body.aiCoreCoderBody button:disabled,
body.aiCoreCoderBody .aiCoreCoderPrimary:disabled,
body.aiCoreCoderBody .aiCoreCoderGhost:disabled{
  cursor:not-allowed !important;
}

body.aiCoreCoderBody .aiCoreCoderPreviewPanel{
  display:none !important;
  position:fixed !important;
  inset:70px 12px 12px 12px !important;
  z-index:220 !important;
  opacity:1 !important;
  visibility:visible !important;
  pointer-events:auto !important;
  transform:none !important;
  transition:none !important;
}

body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderPreviewPanel{
  display:grid !important;
}

@media(max-width:980px){
  body.aiCoreCoderBody .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
    inset:0 64px 0 0 !important;
  }

  body.aiCoreCoderBody .aiCoreCoderSide,
  body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
  body.aiCoreCoderBody .aiCoreCoderMetaGrid{
    right:64px !important;
    width:calc(100vw - 78px) !important;
  }
}

/* v43 · Codificador IA: panel de solicitud claro y sin superposición */
body.aiCoreCoderBody .aiCoreCoderAIPanel{
  display:flex !important;
  flex-direction:column !important;
  gap:14px !important;
  overflow:visible !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel > span{
  display:block !important;
  margin:0 !important;
  line-height:1.1 !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel h2{
  margin:0 !important;
  line-height:1.18 !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel p[data-coder-ai-context]{
  display:block !important;
  position:relative !important;
  z-index:1 !important;
  margin:0 0 4px !important;
  padding:0 !important;
  max-width:100% !important;
  color:#667085 !important;
  line-height:1.55 !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]{
  order:4 !important;
  display:block !important;
  position:relative !important;
  z-index:1 !important;
  margin-top:10px !important;
  min-height:76px !important;
  height:100px !important;
  max-height:150px !important;
  overflow:auto !important;
  resize:vertical !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult ul{
  margin:10px 0 0 !important;
  padding-left:20px !important;
  color:#9F1239 !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult small{
  display:block !important;
  margin-top:8px !important;
  line-height:1.45 !important;
}

/* v44 · Codificador IA: mensajes de reparación claros y sin superposición */
body.aiCoreCoderBody .aiCoreCoderAIPanel p[data-coder-ai-context]{
  position:relative !important;
  z-index:3 !important;
  margin:0 0 10px !important;
  min-height:auto !important;
  overflow:visible !important;
}
body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]{
  position:relative !important;
  z-index:1 !important;
  margin-top:0 !important;
}
body.aiCoreCoderBody .aiCoreCoderAIResult details{
  margin-top:10px;
  border:1px solid rgba(22,24,28,.10);
  border-radius:14px;
  padding:10px 12px;
  background:rgba(255,255,255,.72);
}
body.aiCoreCoderBody .aiCoreCoderAIResult summary{
  cursor:pointer;
  font-weight:900;
  color:#7B1E8A;
}

/* v45 · Codificador IA: layout profesional, sin mezcla entre contexto, textarea, acciones y resultado */
body.aiCoreCoderBody .aiCoreCoderSide{
  box-shadow:0 24px 80px rgba(22,24,28,.14) !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderSide{
  grid-template-rows:auto minmax(0,1fr) !important;
}

body.aiCoreCoderBody .aiCoreCoderSide > .aiCoreCoderDrawerHeader{
  flex-shrink:0 !important;
  position:relative !important;
  z-index:2 !important;
  background:rgba(255,255,255,.98) !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel{
  display:grid !important;
  grid-template-columns:1fr !important;
  grid-auto-rows:max-content !important;
  align-content:start !important;
  gap:12px !important;
  min-height:0 !important;
  height:100% !important;
  overflow:auto !important;
  padding:18px !important;
  scroll-padding-bottom:24px !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel > span,
body.aiCoreCoderBody .aiCoreCoderAIPanel h2,
body.aiCoreCoderBody .aiCoreCoderAIPanel p[data-coder-ai-context],
body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt],
body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderActionsStack,
body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderAIStatus,
body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderAIResult{
  grid-column:1 !important;
  position:relative !important;
  inset:auto !important;
  transform:none !important;
  float:none !important;
  clear:both !important;
  width:100% !important;
  max-width:100% !important;
  box-sizing:border-box !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel p[data-coder-ai-context]{
  display:block !important;
  min-height:0 !important;
  margin:0 !important;
  padding:0 !important;
  color:#667085 !important;
  font-size:13.5px !important;
  line-height:1.5 !important;
  overflow:visible !important;
  white-space:normal !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]{
  order:4 !important;
  display:block !important;
  position:relative !important;
  z-index:1 !important;
  margin-top:10px !important;
  min-height:76px !important;
  height:100px !important;
  max-height:150px !important;
  overflow:auto !important;
  resize:vertical !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderActionsStack{
  display:grid !important;
  gap:10px !important;
  margin:4px 0 0 !important;
  padding:0 !important;
  z-index:1 !important;
}

body.aiCoreCoderBody .aiCoreCoderAIStatus{
  display:block !important;
  margin:2px 0 0 !important;
  padding:12px 14px !important;
  border-radius:14px !important;
  background:#F8FAFC !important;
  border:1px solid rgba(22,24,28,.08) !important;
  color:#475467 !important;
  line-height:1.45 !important;
  overflow:visible !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult:not([hidden]){
  display:block !important;
  margin:0 !important;
  padding:14px !important;
  border-radius:18px !important;
  background:#fff !important;
  border:1px solid rgba(182,41,165,.12) !important;
  box-shadow:0 12px 34px rgba(22,24,28,.06) !important;
  color:#344054 !important;
  overflow:visible !important;
}

body.aiCoreCoderBody .aiCoreCoderAIResult strong,
body.aiCoreCoderBody .aiCoreCoderAIResult p,
body.aiCoreCoderBody .aiCoreCoderAIResult small{
  display:block !important;
  position:relative !important;
  margin-left:0 !important;
  margin-right:0 !important;
  white-space:normal !important;
}

/* v46 · Codificador IA: separación final de contexto, entrada, acciones y resultados */
body.aiCoreCoderBody .aiCoreCoderAIPanel{
  isolation:isolate !important;
  row-gap:14px !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel p[data-coder-ai-context]{
  order:3 !important;
  display:block !important;
  min-height:auto !important;
  max-height:none !important;
  padding:0 2px !important;
  margin:0 0 2px !important;
  z-index:0 !important;
  pointer-events:none !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel textarea[data-coder-ai-prompt]{
  order:4 !important;
  display:block !important;
  position:relative !important;
  z-index:1 !important;
  margin-top:10px !important;
  min-height:76px !important;
  height:100px !important;
  max-height:150px !important;
  overflow:auto !important;
  resize:vertical !important;
}

body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderActionsStack{order:5 !important;}
body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderAIStatus{order:6 !important;}
body.aiCoreCoderBody .aiCoreCoderAIPanel .aiCoreCoderAIResult{order:7 !important;}

body.aiCoreCoderBody .aiCoreCoderAIResult:not([hidden]) details{
  max-height:220px !important;
  overflow:auto !important;
}



.aiCoreAppShapeHeader {
  display: grid;
  gap: 6px;
}

.aiCoreAppShapeBody {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.aiCoreAppShapeGroup {
  display: grid;
  gap: 12px;
}

.aiCoreAppShapeGroupHeader {
  display: grid;
  gap: 3px;
}

.aiCoreAppShapeGroupHeader small,
.aiCoreAppCoderBox small {
  color: rgba(95, 103, 114, 0.92);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.aiCoreAppShapeGroupHeader strong,
.aiCoreAppCoderBox strong {
  color: #16181c;
  font-size: 14px;
  font-weight: 900;
}

.aiCoreAppCoderBox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(22, 24, 28, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72)),
    rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 34px rgba(22, 24, 28, 0.06);
}

.aiCoreAppCoderBox > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.aiCoreAppCoderBox p {
  margin: 0;
  color: rgba(95, 103, 114, 0.95);
  font-size: 13px;
  line-height: 1.45;
}

.aiCoreAppCoderButton {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  background: linear-gradient(135deg, #16181c, #343944);
  box-shadow: 0 14px 30px rgba(22, 24, 28, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.aiCoreAppCoderButton:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(22, 24, 28, 0.22);
}

.aiCoreAppCoderButton:active {
  transform: translateY(0);
  opacity: 0.88;
}

@media (max-width: 720px) {
  .aiCoreAppCoderBox {
    align-items: stretch;
    flex-direction: column;
  }

  .aiCoreAppCoderButton {
    width: 100%;
  }
}


.aiCoreAppShapeBody {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.aiCoreAppShapeBox {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(22, 24, 28, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.74)),
    rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 34px rgba(22, 24, 28, 0.06);
}

.aiCoreAppShapeBoxContent {
  display: grid;
  gap: 4px;
  min-width: 220px;
}

.aiCoreAppShapeBoxContent small {
  color: rgba(95, 103, 114, 0.92);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.aiCoreAppShapeBoxContent strong {
  color: #16181c;
  font-size: 14px;
  font-weight: 900;
}

.aiCoreAppShapeBoxContent p {
  margin: 0;
  color: rgba(95, 103, 114, 0.95);
  font-size: 13px;
  line-height: 1.45;
}

.aiCoreAppQuickActionsBox .aiCoreAppShapeActions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
}

.aiCoreAppCoderBox {
  margin: 0;
}

.aiCoreAppCoderButton {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  background: linear-gradient(135deg, #16181c, #343944);
  box-shadow: 0 14px 30px rgba(22, 24, 28, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.aiCoreAppCoderButton:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(22, 24, 28, 0.22);
}

.aiCoreAppCoderButton:active {
  transform: translateY(0);
  opacity: 0.88;
}

@media (max-width: 900px) {
  .aiCoreAppShapeBox {
    align-items: stretch;
    flex-direction: column;
  }

  .aiCoreAppQuickActionsBox .aiCoreAppShapeActions {
    justify-content: flex-start;
  }

  .aiCoreAppCoderButton {
    width: 100%;
  }
}
/* Codificador IA · diagnósticos contextuales no bloqueantes */
body.aiCoreCoderBody .aiCoreCoderValidation.isWarning,
.aiCoreCoderValidation.isWarning {
  border-color: rgba(245, 158, 11, 0.32);
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.96), rgba(255, 255, 255, 0.92));
  color: #7c4a03;
}

body.aiCoreCoderBody .aiCoreCoderSeverity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(22, 24, 28, 0.08);
  color: #16181c;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

body.aiCoreCoderBody .aiCoreCoderDiagnosticList {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

body.aiCoreCoderBody .aiCoreCoderDiagnostic {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid rgba(22, 24, 28, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
}

body.aiCoreCoderBody .aiCoreCoderDiagnostic strong {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

body.aiCoreCoderBody .aiCoreCoderDiagnostic span {
  color: #16181c;
  font-size: 13px;
  line-height: 1.45;
}

body.aiCoreCoderBody .aiCoreCoderDiagnostic small {
  color: rgba(95, 103, 114, 0.9);
  font-size: 11px;
  font-weight: 800;
}

body.aiCoreCoderBody .aiCoreCoderDiagnostic.is-medium,
body.aiCoreCoderBody .aiCoreCoderDiagnostic.is-low,
body.aiCoreCoderBody .aiCoreCoderDiagnostic.is-info {
  border-color: rgba(245, 158, 11, 0.22);
}

body.aiCoreCoderBody .aiCoreCoderDiagnostic.is-high,
body.aiCoreCoderBody .aiCoreCoderDiagnostic.is-critical {
  border-color: rgba(239, 68, 68, 0.32);
  background: rgba(254, 242, 242, 0.84);
}

/* ========================================================================== 
   v40 · Codificador integrado: UX visible del App Planner + dominio operativo
   Hace visible lo que antes quedaba escondido en Estado: dominio, app type,
   acción primaria, seguridad, health gate y recuperación rápida de JS.
   ========================================================================== */
body.aiCoreCoderBody .aiCoreCoderShell{
  grid-template-rows:64px minmax(92px,auto) minmax(0,1fr) !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar{
  min-height:92px !important;
  display:grid !important;
  grid-template-columns:minmax(260px,1.25fr) repeat(4,minmax(160px,.75fr)) auto !important;
  gap:10px !important;
  align-items:stretch !important;
  border:1px solid rgba(22,24,28,.10) !important;
  border-radius:22px !important;
  padding:10px !important;
  background:linear-gradient(135deg,rgba(255,255,255,.96),rgba(253,242,248,.92)) !important;
  box-shadow:0 18px 48px rgba(9,6,74,.09) !important;
  overflow:hidden !important;
  z-index:70 !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar article{
  min-width:0 !important;
  border:1px solid rgba(22,24,28,.08) !important;
  border-radius:18px !important;
  padding:12px 13px !important;
  background:rgba(255,255,255,.88) !important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.65) !important;
  display:grid !important;
  align-content:center !important;
  gap:4px !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelHero{
  background:radial-gradient(circle at 0% 0%,rgba(184,50,160,.14),transparent 18rem),#fff !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar span{
  display:block !important;
  color:#667085 !important;
  font-size:10px !important;
  line-height:1 !important;
  letter-spacing:.15em !important;
  text-transform:uppercase !important;
  font-weight:1000 !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar strong{
  display:block !important;
  min-width:0 !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
  color:#111827 !important;
  font-size:17px !important;
  line-height:1.12 !important;
  letter-spacing:-.035em !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelHero strong{
  font-size:20px !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar p{
  margin:0 !important;
  min-width:0 !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
  color:#667085 !important;
  font-size:12px !important;
  line-height:1.3 !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelActions{
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:8px !important;
  align-content:center !important;
  min-width:138px !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelActions .aiCoreCoderGhost{
  min-height:36px !important;
  padding:0 12px !important;
  font-size:12px !important;
  white-space:nowrap !important;
  background:#fff !important;
}

body.aiCoreCoderBody.hasCoderJsBroken .aiCoreCoderIntelHealth{
  border-color:rgba(220,38,38,.28) !important;
  background:linear-gradient(180deg,rgba(254,242,242,.94),#fff) !important;
}

body.aiCoreCoderBody.hasCoderJsBroken [data-coder-intel-health]{
  color:#991B1B !important;
}

body.aiCoreCoderBody.hasCoderBlockingIssues:not(.hasCoderJsBroken) .aiCoreCoderIntelHealth{
  border-color:rgba(217,119,6,.28) !important;
  background:linear-gradient(180deg,rgba(255,251,235,.94),#fff) !important;
}

body.aiCoreCoderBody.hasCoderBlockingIssues:not(.hasCoderJsBroken) [data-coder-intel-health]{
  color:#B45309 !important;
}

body.aiCoreCoderBody.hasCoderJsBroken [data-coder-recover-js]{
  color:#fff !important;
  border-color:transparent !important;
  background:linear-gradient(135deg,#D63384,#7B1E8A) !important;
  box-shadow:0 14px 30px rgba(214,51,132,.22) !important;
}

body.aiCoreCoderBody .aiCoreCoderPlanMatrix{
  grid-column:1 / -1 !important;
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:8px !important;
  min-height:0 !important;
  overflow:auto !important;
}

body.aiCoreCoderBody .aiCoreCoderPlanMatrix article{
  min-height:0 !important;
  padding:12px !important;
  border-radius:16px !important;
  background:linear-gradient(180deg,#fff,rgba(248,250,252,.88)) !important;
}

body.aiCoreCoderBody .aiCoreCoderPlanMatrix strong{
  display:block !important;
  margin-top:5px !important;
  color:#111827 !important;
  font-size:13px !important;
  line-height:1.35 !important;
  white-space:normal !important;
  overflow-wrap:anywhere !important;
}

body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMetaGrid{
  width:min(560px,calc(100vw - 110px)) !important;
}

body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
  right:min(648px,calc(100vw - 430px)) !important;
}

@media(max-width:1320px){
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar{
    grid-template-columns:minmax(240px,1fr) repeat(2,minmax(160px,.8fr)) auto !important;
  }
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar article:nth-of-type(4),
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar article:nth-of-type(5){
    display:none !important;
  }
}

@media(max-width:980px){
  body.aiCoreCoderBody .aiCoreCoderShell{
    grid-template-rows:auto auto auto auto !important;
  }
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar{
    grid-template-columns:1fr !important;
    min-height:0 !important;
  }
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar article:nth-of-type(4),
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar article:nth-of-type(5){
    display:grid !important;
  }
  body.aiCoreCoderBody .aiCoreCoderIntelActions{
    grid-template-columns:1fr 1fr !important;
    min-width:0 !important;
  }
  body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
    right:auto !important;
  }
}

/* ==========================================================================
   DTP AI Core · Codificador v41
   Navegación explícita Codificador/Diff + App Planner compacto y visible.
   Refuerza la UX aunque existan estáticos cacheados o estilos heredados.
   ========================================================================== */
body.aiCoreCoderBody .aiCoreCoderShell{
  grid-template-rows:64px minmax(96px,auto) minmax(0,1fr) !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar{
  display:grid !important;
  grid-template-columns:minmax(260px,1.25fr) repeat(4,minmax(150px,.75fr)) auto !important;
  gap:10px !important;
  align-items:stretch !important;
  border:1px solid rgba(22,24,28,.10) !important;
  border-radius:22px !important;
  padding:10px !important;
  background:linear-gradient(135deg,rgba(255,255,255,.97),rgba(253,242,248,.92)) !important;
  box-shadow:0 18px 48px rgba(9,6,74,.09) !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar article{
  min-width:0 !important;
  border:1px solid rgba(22,24,28,.08) !important;
  border-radius:18px !important;
  padding:12px 13px !important;
  background:rgba(255,255,255,.9) !important;
  display:grid !important;
  align-content:center !important;
  gap:4px !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar span{
  display:block !important;
  color:#667085 !important;
  font-size:10px !important;
  line-height:1 !important;
  letter-spacing:.15em !important;
  text-transform:uppercase !important;
  font-weight:1000 !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar strong{
  display:block !important;
  min-width:0 !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
  color:#111827 !important;
  font-size:17px !important;
  line-height:1.12 !important;
  letter-spacing:-.035em !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelHero strong{
  font-size:20px !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelligenceBar p{
  margin:0 !important;
  min-width:0 !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  white-space:nowrap !important;
  color:#667085 !important;
  font-size:12px !important;
  line-height:1.3 !important;
}

body.aiCoreCoderBody .aiCoreCoderIntelActions{
  display:grid !important;
  grid-template-columns:1fr !important;
  gap:8px !important;
  align-content:center !important;
  min-width:138px !important;
}

body.aiCoreCoderBody .aiCoreCoderGrid{
  position:relative !important;
  min-height:0 !important;
  height:100% !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody .aiCoreCoderMain{
  position:absolute !important;
  inset:0 78px 0 0 !important;
  z-index:10 !important;
  display:grid !important;
  grid-template-rows:auto 44px minmax(0,1fr) auto !important;
  padding:12px !important;
  border-radius:24px !important;
  background:linear-gradient(180deg,#08111F 0%,#0F172A 100%) !important;
  border:1px solid rgba(255,255,255,.10) !important;
  box-shadow:0 24px 70px rgba(9,6,74,.18) !important;
  overflow:hidden !important;
}

body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
  right:min(520px,calc(100vw - 430px)) !important;
}

body.aiCoreCoderBody .aiCoreCoderWorkspaceHeader{
  display:flex !important;
  align-items:center !important;
  justify-content:space-between !important;
  gap:14px !important;
  padding:0 2px 10px !important;
  color:#E5E7EB !important;
}

body.aiCoreCoderBody .aiCoreCoderWorkspaceHeader span{
  display:block !important;
  color:#94A3B8 !important;
  font-size:10px !important;
  font-weight:1000 !important;
  letter-spacing:.16em !important;
  text-transform:uppercase !important;
}

body.aiCoreCoderBody .aiCoreCoderWorkspaceHeader strong{
  display:block !important;
  margin-top:3px !important;
  font-size:17px !important;
  letter-spacing:-.035em !important;
  color:#fff !important;
}

body.aiCoreCoderBody .aiCoreCoderWorkspaceHeader p{
  margin:2px 0 0 !important;
  color:#94A3B8 !important;
  font-size:12px !important;
  line-height:1.35 !important;
}

body.aiCoreCoderBody .aiCoreCoderWorkspaceActions{
  display:flex !important;
  align-items:center !important;
  justify-content:flex-end !important;
  gap:8px !important;
  flex-wrap:wrap !important;
}

body.aiCoreCoderBody .aiCoreCoderWorkspaceActions .aiCoreCoderGhost{
  min-height:34px !important;
  padding:0 12px !important;
  font-size:12px !important;
  background:rgba(255,255,255,.08) !important;
  color:#E5E7EB !important;
  border-color:rgba(255,255,255,.12) !important;
}

body.aiCoreCoderBody .aiCoreCoderWorkspaceActions .aiCoreCoderGhost.isActive{
  color:#fff !important;
  background:linear-gradient(135deg,#D63384,#7B1E8A) !important;
  border-color:transparent !important;
}

body.aiCoreCoderBody .aiCoreCoderRail button{
  min-height:80px !important;
  font-size:10px !important;
}

body.aiCoreCoderBody .aiCoreCoderRail button.isActive,
body.aiCoreCoderBody .aiCoreCoderRail button:hover{
  background:linear-gradient(180deg,#D63384,#7B1E8A) !important;
  color:#fff !important;
  border-color:transparent !important;
}

@media(max-width:1320px){
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar{
    grid-template-columns:minmax(240px,1fr) repeat(2,minmax(160px,.8fr)) auto !important;
  }
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar article:nth-of-type(4),
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar article:nth-of-type(5){
    display:none !important;
  }
}

@media(max-width:980px){
  body.aiCoreCoderBody .aiCoreCoderShell{
    grid-template-rows:auto auto auto auto !important;
  }
  body.aiCoreCoderBody .aiCoreCoderIntelligenceBar{
    grid-template-columns:1fr !important;
  }
  body.aiCoreCoderBody .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
    position:static !important;
    inset:auto !important;
    min-height:70vh !important;
  }
  body.aiCoreCoderBody .aiCoreCoderWorkspaceHeader{
    align-items:flex-start !important;
    flex-direction:column !important;
  }
  body.aiCoreCoderBody .aiCoreCoderWorkspaceActions{
    width:100% !important;
    justify-content:flex-start !important;
  }
  body.aiCoreCoderBody .aiCoreCoderRail button{
    min-height:38px !important;
    font-size:11px !important;
  }
}

/* DTP AI Core · Coder rail separation fix
   Keeps editor navigation (Código/Diff) away from Planner actions (Ver plan/Recuperar JS). */
body.aiCoreCoderBody .aiCoreCoderShell{
  --dtp-coder-rail-top:214px;
  --dtp-coder-rail-width:62px;
}
body.aiCoreCoderBody .aiCoreCoderIntelActions{
  padding-left:10px;
  border-left:1px solid rgba(22,24,28,.08);
}
body.aiCoreCoderBody .aiCoreCoderRail{
  top:var(--dtp-coder-rail-top);
  right:14px;
  width:var(--dtp-coder-rail-width);
  padding:8px 4px;
  border-radius:24px;
  background:rgba(255,255,255,.48);
  border:1px solid rgba(214,51,132,.12);
  box-shadow:0 18px 42px rgba(9,6,74,.10);
  backdrop-filter:blur(14px);
}
body.aiCoreCoderBody .aiCoreCoderRail button{
  min-height:74px;
}
body.aiCoreCoderBody .aiCoreCoderRail button:nth-child(2){
  margin-bottom:18px;
}
body.aiCoreCoderBody .aiCoreCoderRail button:nth-child(3){
  position:relative;
}
body.aiCoreCoderBody .aiCoreCoderRail button:nth-child(3)::before{
  content:"";
  position:absolute;
  left:8px;
  right:8px;
  top:-15px;
  height:1px;
  background:rgba(123,30,138,.20);
}
@media(max-width:1320px){
  body.aiCoreCoderBody .aiCoreCoderShell{--dtp-coder-rail-top:204px;}
}
@media(max-width:980px){
  body.aiCoreCoderBody .aiCoreCoderIntelActions{
    border-left:0;
    border-top:1px solid rgba(22,24,28,.08);
    padding-left:0;
    padding-top:10px;
  }
  body.aiCoreCoderBody .aiCoreCoderRail{
    top:8px;
    width:100%;
    padding:6px;
  }
  body.aiCoreCoderBody .aiCoreCoderRail button:nth-child(2){
    margin-bottom:0;
    margin-right:14px;
  }
  body.aiCoreCoderBody .aiCoreCoderRail button:nth-child(3)::before{
    left:-10px;
    right:auto;
    top:6px;
    bottom:6px;
    width:1px;
    height:auto;
  }
}

/* ========================================================================== 
   v47 · Coder drawer same-height fix
   Keeps Código/Diff/IA/Historial/Preview/Estado inside the coder grid so every
   opened panel has the same height as the editor and never covers the Planner.
   ========================================================================== */
body.aiCoreCoderBody .aiCoreCoderShell{
  --dtp-coder-rail-width:62px;
  --dtp-coder-rail-gap:16px;
  --dtp-coder-drawer-width:clamp(420px,30vw,540px);
  --dtp-coder-editor-right:calc(var(--dtp-coder-rail-width) + var(--dtp-coder-rail-gap));
  --dtp-coder-editor-right-open:calc(var(--dtp-coder-drawer-width) + var(--dtp-coder-rail-width) + (var(--dtp-coder-rail-gap) * 2));
}
body.aiCoreCoderBody .aiCoreCoderGrid{
  position:relative !important;
  height:100% !important;
  min-height:0 !important;
  overflow:hidden !important;
  isolation:isolate !important;
}
body.aiCoreCoderBody .aiCoreCoderMain{
  position:absolute !important;
  inset:0 var(--dtp-coder-editor-right) 0 0 !important;
  z-index:20 !important;
  min-height:0 !important;
}
body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderMain,
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain{
  right:var(--dtp-coder-editor-right-open) !important;
}
body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderMain{
  right:var(--dtp-coder-editor-right) !important;
  opacity:.12 !important;
  pointer-events:none !important;
}
body.aiCoreCoderBody .aiCoreCoderRail{
  position:absolute !important;
  top:0 !important;
  right:0 !important;
  bottom:0 !important;
  height:auto !important;
  max-height:none !important;
  width:var(--dtp-coder-rail-width) !important;
  z-index:120 !important;
  display:flex !important;
  flex-direction:column !important;
  align-items:center !important;
  gap:10px !important;
  padding:8px 4px !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  overscroll-behavior:contain !important;
  border-radius:24px !important;
  background:rgba(255,255,255,.52) !important;
  border:1px solid rgba(214,51,132,.12) !important;
  box-shadow:0 18px 42px rgba(9,6,74,.10) !important;
  backdrop-filter:blur(14px) !important;
}
body.aiCoreCoderBody .aiCoreCoderRail button{
  width:54px !important;
  min-height:64px !important;
  flex:0 0 64px !important;
  padding:8px 0 !important;
  border-radius:18px !important;
  writing-mode:vertical-rl !important;
  text-orientation:mixed !important;
}
body.aiCoreCoderBody .aiCoreCoderRail button:nth-child(2){margin-bottom:12px !important;}
body.aiCoreCoderBody .aiCoreCoderRail button:nth-child(3)::before{top:-11px !important;}
body.aiCoreCoderBody .aiCoreCoderSide,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
body.aiCoreCoderBody .aiCoreCoderMetaGrid{
  display:none !important;
  position:absolute !important;
  top:0 !important;
  right:var(--dtp-coder-editor-right) !important;
  bottom:0 !important;
  left:auto !important;
  width:var(--dtp-coder-drawer-width) !important;
  height:auto !important;
  max-height:none !important;
  z-index:90 !important;
  opacity:1 !important;
  visibility:visible !important;
  pointer-events:auto !important;
  transform:none !important;
  transition:none !important;
  overflow:hidden !important;
  border-radius:24px !important;
  background:rgba(255,255,255,.985) !important;
  border:1px solid rgba(22,24,28,.08) !important;
  box-shadow:0 24px 80px rgba(22,24,28,.14) !important;
}
body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderSide,
body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderHistoryPanel{
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) !important;
}
body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMetaGrid{
  display:grid !important;
  grid-auto-rows:max-content !important;
  align-content:start !important;
  overflow:auto !important;
  padding:14px !important;
  gap:12px !important;
}
body.aiCoreCoderBody .aiCoreCoderSide > .aiCoreCoderDrawerHeader,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel > .aiCoreCoderDrawerHeader{
  position:sticky !important;
  top:0 !important;
  z-index:5 !important;
}
body.aiCoreCoderBody .aiCoreCoderAIPanel,
body.aiCoreCoderBody .aiCoreCoderHistoryPanel .aiCoreCoderPanel{
  min-height:0 !important;
  height:100% !important;
  overflow:auto !important;
  overscroll-behavior:contain !important;
}
body.aiCoreCoderBody .aiCoreCoderPreviewPanel{
  display:none !important;
  position:absolute !important;
  top:0 !important;
  right:var(--dtp-coder-editor-right) !important;
  bottom:0 !important;
  left:0 !important;
  height:auto !important;
  min-height:0 !important;
  z-index:100 !important;
  opacity:1 !important;
  visibility:visible !important;
  pointer-events:auto !important;
  transform:none !important;
  transition:none !important;
  border-radius:24px !important;
  overflow:hidden !important;
}
body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderPreviewPanel{
  display:grid !important;
  grid-template-rows:auto minmax(0,1fr) !important;
}
body.aiCoreCoderBody .aiCoreCoderPreview{
  min-height:0 !important;
  height:100% !important;
}
@media(max-width:1280px){
  body.aiCoreCoderBody .aiCoreCoderShell{--dtp-coder-drawer-width:clamp(380px,36vw,500px);}
}
@media(max-width:980px){
  body.aiCoreCoderBody .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain,
  body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderMain{
    position:static !important;
    inset:auto !important;
    right:auto !important;
    opacity:1 !important;
    pointer-events:auto !important;
    min-height:70vh !important;
  }
  body.aiCoreCoderBody .aiCoreCoderRail{
    position:sticky !important;
    top:8px !important;
    width:100% !important;
    height:auto !important;
    max-height:none !important;
    flex-direction:row !important;
    justify-content:center !important;
    overflow:auto !important;
  }
  body.aiCoreCoderBody .aiCoreCoderRail button{
    width:auto !important;
    min-height:38px !important;
    flex:0 0 auto !important;
    padding:0 12px !important;
    writing-mode:horizontal-tb !important;
  }
  body.aiCoreCoderBody .aiCoreCoderSide,
  body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
  body.aiCoreCoderBody .aiCoreCoderMetaGrid,
  body.aiCoreCoderBody .aiCoreCoderPreviewPanel{
    position:static !important;
    width:100% !important;
    height:auto !important;
    min-height:70vh !important;
  }
}

/* v48 · Codificador: rail lateral sin Código/Diff y sin truncado.
   Código y Diff quedan disponibles en la barra superior y en el header interno del editor. */
body.aiCoreCoderBody .aiCoreCoderRail button{
  writing-mode:vertical-rl !important;
  text-orientation:mixed !important;
  white-space:nowrap !important;
  overflow:visible !important;
  text-overflow:clip !important;
  word-break:normal !important;
  width:54px !important;
  padding:10px 0 !important;
  letter-spacing:.13em !important;
}
body.aiCoreCoderBody .aiCoreCoderRail button::before,
body.aiCoreCoderBody .aiCoreCoderRail button::after{
  content:none !important;
  display:none !important;
}
body.aiCoreCoderBody .aiCoreCoderRail button[data-coder-panel-toggle="assistant"]{
  min-height:64px !important;
  flex:0 0 64px !important;
}
body.aiCoreCoderBody .aiCoreCoderRail button[data-coder-panel-toggle="history"]{
  min-height:96px !important;
  flex:0 0 96px !important;
  margin-bottom:0 !important;
}
body.aiCoreCoderBody .aiCoreCoderRail button[data-coder-panel-toggle="preview"]{
  min-height:88px !important;
  flex:0 0 88px !important;
}
body.aiCoreCoderBody .aiCoreCoderRail button[data-coder-panel-toggle="meta"]{
  min-height:82px !important;
  flex:0 0 82px !important;
}
@media(max-width:980px){
  body.aiCoreCoderBody .aiCoreCoderRail button{
    writing-mode:horizontal-tb !important;
    white-space:nowrap !important;
    width:auto !important;
    min-height:38px !important;
    flex:0 0 auto !important;
    padding:0 14px !important;
  }
}

/* dtp-coder-final-non-overlay-panels-v60 */

    /* v60 · Fuente única de layout para el Codificador.
       Historial, IA Builder y Estado usan la misma columna lateral y NO tapan el editor.
       Preview se muestra amplio, como vista de revisión, ocupando el área del editor + panel. */
    body.aiCoreCoderBody .aiCoreCoderGrid{
      --dtp-coder-rail-width:64px!important;
      --dtp-coder-panel-width:clamp(420px,32vw,560px)!important;
      --dtp-coder-panel-gap:14px!important;
      position:relative!important;
      display:grid!important;
      grid-template-columns:minmax(0,1fr) var(--dtp-coder-panel-width) var(--dtp-coder-rail-width)!important;
      grid-template-rows:minmax(0,1fr)!important;
      gap:var(--dtp-coder-panel-gap)!important;
      width:100%!important;
      height:100%!important;
      min-height:0!important;
      overflow:hidden!important;
      isolation:isolate!important;
    }
    body.aiCoreCoderBody .aiCoreCoderMain{
      position:relative!important;
      inset:auto!important;
      top:auto!important;
      right:auto!important;
      bottom:auto!important;
      left:auto!important;
      grid-column:1!important;
      grid-row:1!important;
      z-index:10!important;
      width:100%!important;
      height:100%!important;
      min-width:0!important;
      min-height:0!important;
      max-width:none!important;
      display:grid!important;
      grid-template-rows:auto 44px minmax(0,1fr) auto!important;
      opacity:1!important;
      transform:none!important;
      pointer-events:auto!important;
      overflow:hidden!important;
    }
    body.aiCoreCoderBody.isCoderPlannerOpen .aiCoreCoderMain,
    body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderMain,
    body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMain,
    body.aiCoreCoderBody.isCoderAssistantOpen .aiCoreCoderMain{
      right:auto!important;
      display:grid!important;
      opacity:1!important;
      pointer-events:auto!important;
      transform:none!important;
    }
    body.aiCoreCoderBody .aiCoreCoderRail{
      position:relative!important;
      grid-column:3!important;
      grid-row:1!important;
      top:auto!important;
      right:auto!important;
      bottom:auto!important;
      left:auto!important;
      z-index:30!important;
      width:var(--dtp-coder-rail-width)!important;
      height:100%!important;
      max-height:none!important;
      min-height:0!important;
      display:flex!important;
      flex-direction:column!important;
      align-items:center!important;
      gap:10px!important;
      padding:8px 5px!important;
      margin:0!important;
      overflow-y:auto!important;
      overflow-x:hidden!important;
      border-radius:24px!important;
      background:rgba(255,255,255,.56)!important;
      border:1px solid rgba(214,51,132,.13)!important;
      box-shadow:0 18px 42px rgba(9,6,74,.10)!important;
      backdrop-filter:blur(14px)!important;
    }
    body.aiCoreCoderBody .aiCoreCoderRail button{
      width:54px!important;
      flex:0 0 auto!important;
      margin:0!important;
      padding:10px 0!important;
      border-radius:18px!important;
      border:1px solid rgba(214,51,132,.20)!important;
      background:rgba(255,255,255,.94)!important;
      color:#7B1E8A!important;
      box-shadow:0 14px 28px rgba(9,6,74,.10)!important;
      cursor:pointer!important;
      writing-mode:vertical-rl!important;
      text-orientation:mixed!important;
      white-space:nowrap!important;
      overflow:visible!important;
      text-overflow:clip!important;
      font-size:10px!important;
      line-height:1!important;
      font-weight:1000!important;
      letter-spacing:.13em!important;
      text-transform:uppercase!important;
    }
    body.aiCoreCoderBody .aiCoreCoderRail button[data-coder-panel-toggle="planner"]{min-height:74px!important;flex-basis:74px!important;}
    body.aiCoreCoderBody .aiCoreCoderRail button[data-coder-panel-toggle="history"]{min-height:96px!important;flex-basis:96px!important;}
    body.aiCoreCoderBody .aiCoreCoderRail button[data-coder-panel-toggle="preview"]{min-height:88px!important;flex-basis:88px!important;}
    body.aiCoreCoderBody .aiCoreCoderRail button[data-coder-panel-toggle="meta"]{min-height:82px!important;flex-basis:82px!important;}
    body.aiCoreCoderBody .aiCoreCoderRail button.isActive,
    body.aiCoreCoderBody .aiCoreCoderRail button:hover,
    body.aiCoreCoderBody .aiCoreCoderRail button:focus-visible{
      background:linear-gradient(180deg,#D63384,#7B1E8A)!important;
      color:#fff!important;
      border-color:transparent!important;
      outline:0!important;
    }
    body.aiCoreCoderBody .aiCoreCoderRail button::before,
    body.aiCoreCoderBody .aiCoreCoderRail button::after{content:none!important;display:none!important;}
    body.aiCoreCoderBody .aiCoreCoderPlannerPanel,
    body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
    body.aiCoreCoderBody .aiCoreCoderMetaGrid,
    body.aiCoreCoderBody .aiCoreCoderSide{
      display:none!important;
      position:relative!important;
      grid-column:2!important;
      grid-row:1!important;
      top:auto!important;
      right:auto!important;
      bottom:auto!important;
      left:auto!important;
      z-index:20!important;
      width:100%!important;
      height:100%!important;
      min-width:0!important;
      min-height:0!important;
      max-height:none!important;
      max-width:none!important;
      margin:0!important;
      padding:0!important;
      transform:none!important;
      opacity:1!important;
      visibility:visible!important;
      pointer-events:auto!important;
      overflow:hidden!important;
      border-radius:24px!important;
      background:rgba(255,255,255,.985)!important;
      border:1px solid rgba(22,24,28,.08)!important;
      box-shadow:0 24px 80px rgba(22,24,28,.14)!important;
    }
    body.aiCoreCoderBody.isCoderPlannerOpen .aiCoreCoderPlannerPanel,
    body.aiCoreCoderBody.isCoderHistoryOpen .aiCoreCoderHistoryPanel{
      display:grid!important;
      grid-template-rows:auto minmax(0,1fr)!important;
    }
    body.aiCoreCoderBody.isCoderMetaOpen .aiCoreCoderMetaGrid{
      display:grid!important;
      grid-template-rows:auto!important;
      align-content:start!important;
      gap:12px!important;
      padding:14px!important;
      overflow:auto!important;
    }
    body.aiCoreCoderBody .aiCoreCoderPlannerPanel .aiCoreCoderDrawerHeader,
    body.aiCoreCoderBody .aiCoreCoderHistoryPanel .aiCoreCoderDrawerHeader,
    body.aiCoreCoderBody .aiCoreCoderMetaGrid .aiCoreCoderDrawerHeader{
      position:sticky!important;
      top:0!important;
      z-index:5!important;
      background:rgba(255,255,255,.97)!important;
      border-bottom:1px solid rgba(22,24,28,.08)!important;
    }
    body.aiCoreCoderBody .aiCorePlannerWizardBody,
    body.aiCoreCoderBody .aiCoreCoderHistoryPanel .aiCoreCoderPanel{
      min-height:0!important;
      height:100%!important;
      overflow:auto!important;
      overscroll-behavior:contain!important;
    }
    body.aiCoreCoderBody .aiCorePlannerWizardBody{padding:16px!important;gap:12px!important;}
    body.aiCoreCoderBody .aiCorePlannerWizardHero{padding:14px!important;border-radius:18px!important;background:linear-gradient(135deg,#fff,#fff7fd)!important;}
    body.aiCoreCoderBody .aiCorePlannerWizardHero h2{font-size:18px!important;margin:4px 0!important;}
    body.aiCoreCoderBody .aiCorePlannerWizardHero p{font-size:12.5px!important;line-height:1.45!important;}
    body.aiCoreCoderBody .aiCorePlannerStepGrid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important;}
    body.aiCoreCoderBody .aiCorePlannerStep{padding:9px!important;border-radius:14px!important;}
    body.aiCoreCoderBody .aiCorePlannerStep strong{font-size:12px!important;}
    body.aiCoreCoderBody .aiCorePlannerStep small{font-size:11px!important;line-height:1.25!important;}
    body.aiCoreCoderBody .aiCorePlannerWizardPrompt{min-height:112px!important;height:128px!important;max-height:190px!important;resize:vertical!important;}
    body.aiCoreCoderBody .aiCorePlannerWizardActions{display:grid!important;grid-template-columns:1fr 1fr auto!important;gap:8px!important;align-items:center!important;}
    body.aiCoreCoderBody .aiCorePlannerWizardActions button{min-height:42px!important;}
    body.aiCoreCoderBody .aiCoreCoderPreviewPanel{
      display:none!important;
      position:relative!important;
      grid-column:1 / 3!important;
      grid-row:1!important;
      top:auto!important;
      right:auto!important;
      bottom:auto!important;
      left:auto!important;
      z-index:25!important;
      width:100%!important;
      height:100%!important;
      min-height:0!important;
      max-height:none!important;
      border-radius:24px!important;
      overflow:hidden!important;
      opacity:1!important;
      visibility:visible!important;
      pointer-events:auto!important;
      transform:none!important;
      background:#fff!important;
      border:1px solid rgba(22,24,28,.08)!important;
      box-shadow:0 24px 80px rgba(22,24,28,.14)!important;
    }
    body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderPreviewPanel{display:grid!important;grid-template-rows:auto minmax(0,1fr)!important;}
    body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderMain,
    body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderPlannerPanel,
    body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderHistoryPanel,
    body.aiCoreCoderBody.isCoderPreviewOpen .aiCoreCoderMetaGrid{display:none!important;}
    body.aiCoreCoderBody .aiCoreCoderPreview{width:100%!important;height:100%!important;min-height:0!important;border:0!important;background:#fff!important;border-radius:0 0 22px 22px!important;}
    body.aiCoreCoderBody .aiCoreBuilderModal[hidden]{display:none!important;}
    body.aiCoreCoderBody .aiCoreBuilderModal{
      position:fixed!important;
      inset:0!important;
      z-index:5000!important;
      display:grid!important;
      place-items:center!important;
      padding:24px!important;
      background:rgba(15,23,42,.50)!important;
      backdrop-filter:blur(18px)!important;
    }
    body.aiCoreCoderBody .aiCoreBuilderModalDialog{
      width:min(1160px,calc(100vw - 48px))!important;
      height:min(760px,calc(100vh - 48px))!important;
      display:grid!important;
      grid-template-rows:auto minmax(0,1fr) auto!important;
      overflow:hidden!important;
      border-radius:28px!important;
      background:#fff!important;
      border:1px solid rgba(255,255,255,.75)!important;
      box-shadow:0 34px 120px rgba(9,6,74,.34)!important;
    }
    body.aiCoreCoderBody .aiCoreBuilderModalHeader,
    body.aiCoreCoderBody .aiCoreBuilderModalFooter{padding:16px 22px!important;border-color:rgba(22,24,28,.08)!important;background:rgba(255,255,255,.96)!important;}
    body.aiCoreCoderBody .aiCoreBuilderModalBody{
      min-height:0!important;
      overflow:hidden!important;
      display:grid!important;
      grid-template-columns:320px minmax(0,1fr)!important;
      gap:16px!important;
      padding:18px 22px!important;
      background:linear-gradient(135deg,#fff,#fff7fd)!important;
    }
    body.aiCoreCoderBody .aiCoreBuilderModalSteps{min-height:0!important;overflow:auto!important;display:grid!important;align-content:start!important;gap:10px!important;}
    body.aiCoreCoderBody .aiCoreBuilderModalContent{min-width:0!important;min-height:0!important;display:grid!important;grid-template-rows:auto minmax(0,1fr)!important;gap:14px!important;overflow:hidden!important;}
    body.aiCoreCoderBody .aiCoreBuilderModalSummary{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:10px!important;min-width:0!important;overflow:visible!important;}
    body.aiCoreCoderBody .aiCoreBuilderModalPreview{min-height:0!important;display:grid!important;place-items:stretch!important;border:1px dashed rgba(214,51,132,.20)!important;border-radius:22px!important;background:#fff!important;overflow:hidden!important;}
    body.aiCoreCoderBody .aiCoreBuilderModalPreview iframe{width:100%!important;height:100%!important;min-height:0!important;border:0!important;background:#fff!important;}
    body.aiCoreCoderBody .aiCoreBuilderModalEmpty{display:grid!important;place-items:center!important;text-align:center!important;padding:24px!important;color:#667085!important;font-weight:900!important;line-height:1.55!important;}
    body.aiCoreCoderBody .aiCoreBuilderLoading{display:grid!important;gap:12px!important;place-items:center!important;text-align:center!important;color:#475467!important;}
    body.aiCoreCoderBody .aiCoreBuilderSpinner{width:42px!important;height:42px!important;border-radius:999px!important;border:4px solid rgba(214,51,132,.16)!important;border-top-color:#d63384!important;animation:dtpBuilderSpin .9s linear infinite!important;}
    body.aiCoreCoderBody .aiCoreBuilderLoading strong{color:#111827!important;font-size:16px!important;}
    body.aiCoreCoderBody .aiCoreBuilderLoading small{display:block!important;color:#667085!important;font-weight:700!important;}
    @keyframes dtpBuilderSpin{to{transform:rotate(360deg)}}
    @media(max-width:1180px){
      body.aiCoreCoderBody .aiCoreCoderGrid{grid-template-columns:minmax(0,1fr) minmax(360px,42vw) var(--dtp-coder-rail-width)!important;}
    }
    @media(max-width:900px){
      body.aiCoreCoderBody .aiCoreCoderGrid{display:block!important;overflow:auto!important;}
      body.aiCoreCoderBody .aiCoreCoderMain,
      body.aiCoreCoderBody .aiCoreCoderPlannerPanel,
      body.aiCoreCoderBody .aiCoreCoderHistoryPanel,
      body.aiCoreCoderBody .aiCoreCoderMetaGrid,
      body.aiCoreCoderBody .aiCoreCoderPreviewPanel{position:relative!important;width:100%!important;min-height:70vh!important;margin-bottom:14px!important;}
      body.aiCoreCoderBody .aiCoreCoderRail{position:sticky!important;bottom:8px!important;width:100%!important;height:auto!important;flex-direction:row!important;justify-content:center!important;}
      body.aiCoreCoderBody .aiCoreCoderRail button{writing-mode:horizontal-tb!important;width:auto!important;min-height:38px!important;flex-basis:auto!important;padding:0 12px!important;}
      body.aiCoreCoderBody .aiCoreBuilderModalBody{grid-template-columns:1fr!important;overflow:auto!important;}
      body.aiCoreCoderBody .aiCoreBuilderModalSummary{grid-template-columns:1fr!important;}
    }


/* Flow runtime diagnostics: hidden by default, visible only on user request. */
.aiCoreFlowDiagnosticToggle{
  margin-top: 14px;
  border: 1px solid rgba(148, 163, 184, .34);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.88));
  box-shadow: 0 14px 34px rgba(15, 23, 42, .08);
  overflow: hidden;
}

.aiCoreFlowDiagnosticToggle > summary{
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px;
  padding: 9px 14px;
  border: 1px solid rgba(124, 58, 237, .22);
  border-radius: 999px;
  background: rgba(250, 245, 255, .92);
  color: #6d28d9;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}

.aiCoreFlowDiagnosticToggle > summary::-webkit-details-marker{ display: none; }

.aiCoreFlowDiagnosticToggle > summary::before{
  content: "▸";
  font-size: 12px;
  transition: transform .16s ease;
}

.aiCoreFlowDiagnosticToggle[open] > summary::before{ transform: rotate(90deg); }

.aiCoreFlowDiagnosticToggle > summary:hover{
  background: rgba(243, 232, 255, .98);
  box-shadow: 0 10px 24px rgba(124, 58, 237, .14);
  transform: translateY(-1px);
}

.aiCoreFlowDiagnosticPanel{
  border-top: 1px solid rgba(148, 163, 184, .24);
  padding: 14px;
  background: rgba(255,255,255,.72);
}

.aiCoreFlowDiagnosticPanel h3:first-child{ margin-top: 0; }


/* =========================================================
   Login final redesign: fondo moderno + logo sin espacio muerto
   Solo agrega lo correspondiente y mantiene intacto lo demás.
   ========================================================= */

.aiCoreLoginBody{
  min-height: 100vh !important;
  margin: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  color: #e5e7eb !important;
  background:
    radial-gradient(46rem 30rem at 10% 14%, rgba(99,102,241,.28), transparent 52%),
    radial-gradient(34rem 24rem at 86% 18%, rgba(217,70,239,.18), transparent 50%),
    radial-gradient(38rem 28rem at 74% 86%, rgba(34,211,238,.14), transparent 52%),
    linear-gradient(180deg, #060816 0%, #0a1020 50%, #0b1220 100%) !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.aiCoreLoginBody::before,
.aiCoreLoginBody::after{
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.aiCoreLoginBody::before{
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: .20;
  mask-image: radial-gradient(circle at 30% 30%, #000 0%, rgba(0,0,0,.86) 36%, rgba(0,0,0,.42) 62%, transparent 82%);
}

.aiCoreLoginBody::after{
  background:
    radial-gradient(30rem 16rem at 18% 10%, rgba(255,255,255,.08), transparent 60%),
    radial-gradient(22rem 12rem at 82% 82%, rgba(255,255,255,.05), transparent 60%);
  opacity: .65;
}

.aiCoreLoginShell{
  position: relative !important;
  z-index: 1 !important;
  min-height: 100vh !important;
  padding: 26px 18px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

.aiCoreLoginCard{
  width: min(520px, 100%) !important;
  padding: 18px 34px 28px !important;
  border-radius: 28px !important;
  border: 1px solid rgba(255,255,255,.10) !important;
  background: linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(248,250,252,.94) 100%) !important;
  box-shadow:
    0 24px 90px rgba(2,8,23,.32),
    0 1px 0 rgba(255,255,255,.58) inset !important;
  backdrop-filter: blur(14px) saturate(120%) !important;
}

.aiCoreLoginBrandLogoOnly{
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 0 16px !important;
  padding: 0 !important;
}

.aiCoreLoginBrandImage{
  display: block !important;
  width: min(360px, 92%) !important;
  max-width: 100% !important;
  height: auto !important;
  object-fit: contain !important;
  margin: 0 !important;
}

.aiCoreLoginIntroClean{
  margin: 0 0 18px !important;
}

.aiCoreLoginIntroClean h1{
  margin: 0 !important;
  color: #0f172a !important;
  font-size: 32px !important;
  line-height: 1.02 !important;
  letter-spacing: -.04em !important;
}

.aiCoreLoginIntroClean p{
  margin: 10px 0 0 !important;
  color: #64748b !important;
  font-size: 14.5px !important;
  line-height: 1.45 !important;
}

.aiCoreLoginAlert{
  margin-bottom: 14px !important;
  border-color: rgba(220,38,38,.18) !important;
  background: rgba(220,38,38,.06) !important;
}

.aiCoreLoginForm{
  display: grid !important;
  gap: 8px !important;
}

.aiCoreLoginForm label{
  margin-top: 2px !important;
}

.aiCoreLoginInputWrap input{
  min-height: 54px !important;
  border-radius: 18px !important;
  background: rgba(255,255,255,.92) !important;
}

.aiCoreLoginSubmit{
  min-height: 54px !important;
  margin-top: 14px !important;
  background: linear-gradient(135deg, #db2777 0%, #9333ea 100%) !important;
  box-shadow: 0 16px 36px rgba(147,51,234,.24) !important;
}

.aiCoreLoginSubmit:hover{
  transform: translateY(-1px) !important;
}

@media (max-height: 820px){
  .aiCoreLoginShell{
    align-items: flex-start !important;
  }
}

@media (max-width: 640px){
  .aiCoreLoginShell{
    padding: 16px 12px !important;
    align-items: flex-start !important;
  }

  .aiCoreLoginCard{
    width: min(100%, 520px) !important;
    padding: 14px 20px 22px !important;
    border-radius: 24px !important;
  }

  .aiCoreLoginBrandLogoOnly{
    margin-bottom: 14px !important;
  }

  .aiCoreLoginBrandImage{
    width: min(320px, 96%) !important;
  }

  .aiCoreLoginIntroClean h1{
    font-size: 30px !important;
  }
}


/* ========================================================================== 
   DTP AI Core · Login premium redesign vFinal
   Scope: only authentication screen. Keeps auth behavior untouched.
   Fixes: real modern background + logo asset whitespace + compact card layout.
   ========================================================================== */

body.aiCoreLoginBody{
  min-height:100vh !important;
  margin:0 !important;
  overflow-x:hidden !important;
  overflow-y:auto !important;
  color:#0f172a !important;
  background:
    radial-gradient(900px 520px at 12% 16%, rgba(214,51,132,.18), transparent 58%),
    radial-gradient(760px 460px at 88% 14%, rgba(109,47,136,.16), transparent 56%),
    radial-gradient(760px 520px at 78% 92%, rgba(37,99,235,.10), transparent 58%),
    linear-gradient(135deg, #fbfcff 0%, #f5f7fc 46%, #eef3fa 100%) !important;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif !important;
}

body.aiCoreLoginBody::before,
body.aiCoreLoginBody::after{
  content:"" !important;
  position:fixed !important;
  inset:0 !important;
  pointer-events:none !important;
}

/* soft neural/mesh texture, intentionally light to match the white product UI */
body.aiCoreLoginBody::before{
  opacity:.58 !important;
  background:
    linear-gradient(90deg, rgba(15,23,42,.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(15,23,42,.03) 1px, transparent 1px),
    radial-gradient(circle at 24% 30%, rgba(255,255,255,.92) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 22%, rgba(214,51,132,.18) 0 2px, transparent 3px),
    radial-gradient(circle at 84% 72%, rgba(109,47,136,.15) 0 2px, transparent 3px) !important;
  background-size: 42px 42px, 42px 42px, 180px 180px, 220px 220px, 260px 260px !important;
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,.85) 0%, rgba(0,0,0,.48) 58%, transparent 100%) !important;
}

/* modern brand glow shapes; no old diagonal split */
body.aiCoreLoginBody::after{
  opacity:.9 !important;
  background:
    radial-gradient(420px 260px at 18% 78%, rgba(214,51,132,.12), transparent 68%),
    radial-gradient(420px 260px at 84% 30%, rgba(109,47,136,.12), transparent 68%),
    linear-gradient(135deg, transparent 0 58%, rgba(255,255,255,.42) 58% 100%) !important;
}

body.aiCoreLoginBody .aiCoreLoginShell{
  position:relative !important;
  z-index:1 !important;
  min-height:100vh !important;
  padding:24px 18px !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
}

body.aiCoreLoginBody .aiCoreLoginShell::before{
  content:"" !important;
  position:absolute !important;
  width:min(840px, 76vw) !important;
  height:min(620px, 72vh) !important;
  border-radius:44px !important;
  background:
    radial-gradient(circle at 22% 24%, rgba(214,51,132,.24), transparent 34%),
    radial-gradient(circle at 78% 18%, rgba(109,47,136,.20), transparent 34%),
    radial-gradient(circle at 76% 76%, rgba(37,99,235,.12), transparent 36%),
    rgba(255,255,255,.28) !important;
  filter:blur(42px) !important;
  opacity:.78 !important;
  transform:translate3d(0,0,0) !important;
}

body.aiCoreLoginBody .aiCoreLoginCard{
  position:relative !important;
  z-index:1 !important;
  width:min(486px, 100%) !important;
  min-height:0 !important;
  max-height:none !important;
  padding:30px 34px 32px !important;
  border-radius:30px !important;
  border:1px solid rgba(255,255,255,.72) !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,252,.90)) !important;
  box-shadow:
    0 34px 90px rgba(15,23,42,.13),
    0 14px 36px rgba(109,47,136,.08),
    inset 0 1px 0 rgba(255,255,255,.92) !important;
  backdrop-filter:blur(24px) saturate(140%) !important;
  display:block !important;
}

body.aiCoreLoginBody .aiCoreLoginBrandLogoOnly{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  height:auto !important;
  min-height:0 !important;
  margin:0 0 28px !important;
  padding:0 !important;
  line-height:0 !important;
}

body.aiCoreLoginBody .aiCoreLoginBrandImage{
  display:block !important;
  width:min(405px, 96%) !important;
  height:auto !important;
  max-width:100% !important;
  max-height:92px !important;
  margin:0 auto !important;
  padding:0 !important;
  object-fit:contain !important;
  object-position:center !important;
  vertical-align:middle !important;
  filter:drop-shadow(0 18px 28px rgba(15,23,42,.07)) !important;
}

body.aiCoreLoginBody .aiCoreLoginIntroClean{
  margin:0 0 18px !important;
}

body.aiCoreLoginBody .aiCoreLoginIntroClean h1{
  margin:0 !important;
  color:#0f172a !important;
  font-size:34px !important;
  line-height:1 !important;
  letter-spacing:-.045em !important;
}

body.aiCoreLoginBody .aiCoreLoginIntroClean p{
  margin:9px 0 0 !important;
  color:#64748b !important;
  font-size:14.5px !important;
  line-height:1.45 !important;
}

body.aiCoreLoginBody .aiCoreLoginAlert{
  margin:0 0 16px !important;
  border:1px solid rgba(220,38,38,.18) !important;
  border-radius:16px !important;
  padding:12px 14px !important;
  background:rgba(254,242,242,.92) !important;
  color:#991b1b !important;
  font-size:13.5px !important;
  font-weight:800 !important;
}

body.aiCoreLoginBody .aiCoreLoginForm{
  display:grid !important;
  gap:8px !important;
}

body.aiCoreLoginBody .aiCoreLoginForm label{
  margin:2px 0 0 !important;
  color:#334155 !important;
  font-size:11.5px !important;
  font-weight:950 !important;
  letter-spacing:.11em !important;
  text-transform:uppercase !important;
}

body.aiCoreLoginBody .aiCoreLoginInputWrap input{
  width:100% !important;
  min-height:52px !important;
  border:1px solid rgba(15,23,42,.10) !important;
  border-radius:18px !important;
  padding:0 15px !important;
  background:rgba(255,255,255,.92) !important;
  color:#0f172a !important;
  outline:none !important;
  font-size:15px !important;
  box-shadow:0 12px 28px rgba(15,23,42,.045) !important;
}

body.aiCoreLoginBody .aiCoreLoginInputWrap input:focus{
  border-color:rgba(214,51,132,.48) !important;
  box-shadow:
    0 0 0 4px rgba(214,51,132,.10),
    0 16px 32px rgba(15,23,42,.06) !important;
}

body.aiCoreLoginBody .aiCoreLoginSubmit{
  width:100% !important;
  min-height:54px !important;
  margin-top:14px !important;
  border:0 !important;
  border-radius:999px !important;
  padding:0 18px !important;
  background:linear-gradient(135deg, #d63384 0%, #7b2f8e 100%) !important;
  color:#fff !important;
  font-size:15px !important;
  font-weight:950 !important;
  cursor:pointer !important;
  box-shadow:0 18px 38px rgba(214,51,132,.24) !important;
}

body.aiCoreLoginBody .aiCoreLoginSubmit:hover{
  transform:translateY(-1px) !important;
  box-shadow:0 22px 44px rgba(214,51,132,.28) !important;
}

body.aiCoreLoginBody .aiCoreLoginSubmit:active{
  transform:translateY(0) scale(.99) !important;
}

@media (max-height:760px){
  body.aiCoreLoginBody .aiCoreLoginShell{
    align-items:flex-start !important;
    padding-top:18px !important;
    padding-bottom:18px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginCard{
    padding-top:24px !important;
    padding-bottom:26px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginBrandLogoOnly{
    margin-bottom:22px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginBrandImage{
    width:min(370px, 94%) !important;
    max-height:84px !important;
  }
}

@media (max-width:640px){
  body.aiCoreLoginBody .aiCoreLoginShell{
    align-items:flex-start !important;
    padding:16px 12px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginCard{
    width:min(100%, 486px) !important;
    padding:22px 20px 24px !important;
    border-radius:24px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginBrandLogoOnly{
    margin-bottom:20px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginBrandImage{
    width:min(330px, 98%) !important;
    max-height:78px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginIntroClean h1{
    font-size:30px !important;
  }
}



/* =========================================================
   Login final: logo grande real + card centrado en pantalla
   Este bloque corrige de raíz cualquier override anterior del login.
   ========================================================= */

html:has(.aiCoreLoginBody),
body.aiCoreLoginBody{
  width: 100% !important;
  min-height: 100dvh !important;
}

body.aiCoreLoginBody{
  margin: 0 !important;
  overflow: hidden !important;
}

body.aiCoreLoginBody .aiCoreLoginShell{
  width: 100% !important;
  min-height: 100dvh !important;
  padding: 24px !important;
  display: grid !important;
  place-items: center !important;
}

body.aiCoreLoginBody .aiCoreLoginCard{
  width: min(620px, calc(100vw - 48px)) !important;
  min-height: auto !important;
  max-height: calc(100dvh - 48px) !important;
  padding: 34px 42px 36px !important;
  display: block !important;
  overflow: visible !important;
}

body.aiCoreLoginBody .aiCoreLoginBrandLogoOnly{
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 0 34px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
}

body.aiCoreLoginBody img.aiCoreLoginBrandImage{
  display: block !important;
  width: clamp(360px, 33vw, 500px) !important;
  max-width: 96% !important;
  min-width: 320px !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center center !important;
  margin: 0 auto !important;
  padding: 0 !important;
  transform: none !important;
}

body.aiCoreLoginBody .aiCoreLoginIntroClean{
  margin: 0 0 22px !important;
}

body.aiCoreLoginBody .aiCoreLoginIntroClean h1{
  margin: 0 !important;
}

body.aiCoreLoginBody .aiCoreLoginForm{
  margin: 0 !important;
}

@media (max-height: 760px){
  body.aiCoreLoginBody{
    overflow-y: auto !important;
  }

  body.aiCoreLoginBody .aiCoreLoginShell{
    min-height: 100dvh !important;
    padding: 16px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginCard{
    width: min(600px, calc(100vw - 32px)) !important;
    max-height: none !important;
    padding: 24px 34px 28px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginBrandLogoOnly{
    margin-bottom: 24px !important;
  }

  body.aiCoreLoginBody img.aiCoreLoginBrandImage{
    width: clamp(330px, 31vw, 460px) !important;
  }
}

@media (max-width: 640px){
  body.aiCoreLoginBody{
    overflow-y: auto !important;
  }

  body.aiCoreLoginBody .aiCoreLoginShell{
    padding: 16px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginCard{
    width: min(100%, 560px) !important;
    padding: 22px 20px 26px !important;
    border-radius: 24px !important;
  }

  body.aiCoreLoginBody .aiCoreLoginBrandLogoOnly{
    margin-bottom: 24px !important;
  }

  body.aiCoreLoginBody img.aiCoreLoginBrandImage{
    width: min(390px, 98%) !important;
    min-width: 0 !important;
  }
}



/* =========================================================
   DTP AI Core Login v3 — layout aislado y definitivo
   ---------------------------------------------------------
   Importante:
   - No depende de .aiCoreLogin* para evitar conflictos acumulados.
   - Solo afecta templates/registration/login.html cuando usa .dtpLoginBody.
   - Mantiene intactas las pantallas internas del AI Core.
   ========================================================= */

body.dtpLoginBody{
  min-height:100dvh !important;
  width:100% !important;
  margin:0 !important;
  overflow:hidden !important;
  color:#0f172a !important;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif !important;
  background:
    radial-gradient(900px 520px at 8% 10%, rgba(214,51,132,.16), transparent 58%),
    radial-gradient(780px 500px at 92% 14%, rgba(109,47,136,.13), transparent 56%),
    radial-gradient(780px 520px at 74% 92%, rgba(14,165,233,.10), transparent 58%),
    linear-gradient(135deg,#fcf7fb 0%,#f8fafc 46%,#eef5fb 100%) !important;
}

body.dtpLoginBody::before,
body.dtpLoginBody::after{
  content:"" !important;
  position:fixed !important;
  inset:0 !important;
  pointer-events:none !important;
}

body.dtpLoginBody::before{
  background:
    linear-gradient(115deg, rgba(255,255,255,.20), transparent 34%),
    linear-gradient(300deg, rgba(255,255,255,.18), transparent 40%),
    linear-gradient(135deg, transparent 0 48%, rgba(255,255,255,.48) 48.1% 48.45%, transparent 48.55%) !important;
  opacity:.90 !important;
}

body.dtpLoginBody::after{
  background-image:
    linear-gradient(rgba(15,23,42,.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,.024) 1px, transparent 1px) !important;
  background-size:34px 34px !important;
  opacity:.45 !important;
  mask-image:radial-gradient(circle at 50% 42%, rgba(0,0,0,.44), transparent 72%) !important;
}

.dtpLoginShell{
  position:relative !important;
  z-index:1 !important;
  min-height:100dvh !important;
  width:100% !important;
  display:grid !important;
  place-items:center !important;
  padding:24px !important;
}

.dtpLoginCard{
  width:min(540px, calc(100vw - 48px)) !important;
  border:1px solid rgba(15,23,42,.09) !important;
  border-radius:32px !important;
  background:rgba(255,255,255,.90) !important;
  box-shadow:
    0 30px 90px rgba(15,23,42,.12),
    inset 0 1px 0 rgba(255,255,255,.78) !important;
  backdrop-filter:blur(22px) saturate(125%) !important;
  padding:34px 38px 36px !important;
}

.dtpLoginLogoWrap{
  display:flex !important;
  justify-content:center !important;
  align-items:center !important;
  margin:0 0 32px !important;
  padding:0 !important;
}

.dtpLoginLogo{
  display:block !important;
  width:min(420px, 96%) !important;
  max-width:100% !important;
  height:auto !important;
  object-fit:contain !important;
  object-position:center center !important;
  margin:0 auto !important;
  padding:0 !important;
}

.dtpLoginIntro{
  margin:0 0 22px !important;
}

.dtpLoginIntro h1{
  margin:0 !important;
  color:#0f172a !important;
  font-size:34px !important;
  line-height:1 !important;
  letter-spacing:-.045em !important;
}

.dtpLoginIntro p{
  margin:10px auto 0 !important;
  color:#64748b !important;
  font-size:15px !important;
  line-height:1.45 !important;
  text-align:center !important;
  max-width:420px !important;
}

.dtpLoginAlert{
  margin:0 0 16px !important;
  border:1px solid rgba(220,38,38,.18) !important;
  border-radius:18px !important;
  padding:12px 14px !important;
  background:rgba(220,38,38,.07) !important;
  color:#991b1b !important;
  font-size:13.5px !important;
  font-weight:800 !important;
}

.dtpLoginForm{
  display:grid !important;
  gap:10px !important;
  margin:0 !important;
}

.dtpLoginForm label{
  margin-top:2px !important;
  color:#334155 !important;
  font-size:12px !important;
  font-weight:950 !important;
  letter-spacing:.10em !important;
  text-transform:uppercase !important;
}

.dtpLoginInput input{
  width:100% !important;
  min-height:54px !important;
  border:1px solid rgba(15,23,42,.12) !important;
  border-radius:18px !important;
  padding:0 15px !important;
  background:rgba(255,255,255,.96) !important;
  color:#0f172a !important;
  outline:none !important;
  font-size:15px !important;
  box-shadow:0 12px 28px rgba(15,23,42,.045) !important;
}

.dtpLoginInput input:focus{
  border-color:rgba(214,51,132,.50) !important;
  box-shadow:
    0 0 0 4px rgba(214,51,132,.11),
    0 16px 36px rgba(15,23,42,.07) !important;
}

.dtpLoginSubmit{
  width:100% !important;
  min-height:54px !important;
  margin-top:14px !important;
  border:0 !important;
  border-radius:999px !important;
  padding:0 18px !important;
  background:linear-gradient(135deg,#d63384 0%,#7c2d8f 100%) !important;
  color:#fff !important;
  font-size:15px !important;
  font-weight:950 !important;
  cursor:pointer !important;
  box-shadow:0 20px 42px rgba(214,51,132,.24) !important;
}

.dtpLoginSubmit:hover{
  transform:translateY(-1px) !important;
  box-shadow:0 24px 50px rgba(214,51,132,.30) !important;
}

.dtpLoginSubmit:active{
  transform:translateY(0) scale(.99) !important;
}

@media (max-height:720px){
  body.dtpLoginBody{
    overflow-y:auto !important;
  }

  .dtpLoginShell{
    align-items:start !important;
    padding:16px !important;
  }

  .dtpLoginCard{
    padding:24px 34px 28px !important;
  }

  .dtpLoginLogoWrap{
    margin-bottom:22px !important;
  }

  .dtpLoginLogo{
    width:min(380px, 94%) !important;
  }

  .dtpLoginIntro{
    margin-bottom:18px !important;
  }
}

@media (max-width:640px){
  body.dtpLoginBody{
    overflow-y:auto !important;
  }

  .dtpLoginShell{
    padding:16px !important;
  }

  .dtpLoginCard{
    width:min(100%, 520px) !important;
    padding:24px 20px 26px !important;
    border-radius:26px !important;
  }

  .dtpLoginLogoWrap{
    margin-bottom:24px !important;
  }

  .dtpLoginLogo{
    width:min(360px, 98%) !important;
  }

  .dtpLoginIntro h1{
    font-size:30px !important;
  }
}



/* =========================================================
   DTP AI Core Login — corrección final de centrado y fondo
   ---------------------------------------------------------
   - Fondo pastel del área inferior aplicado a toda la pantalla.
   - Card centrado real en desktop y mobile.
   - Sin corte superior.
   - Sin heredar layout roto de bloques anteriores.
   ========================================================= */

html:has(body.dtpLoginBody){
  height: 100% !important;
  min-height: 100% !important;
  overflow: hidden !important;
}

body.dtpLoginBody{
  width: 100% !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  overflow: hidden !important;
  color: #0f172a !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;

  /* Fondo completo usando el mismo lenguaje visual pastel que se veía abajo */
  background:
    radial-gradient(980px 620px at 12% 18%, rgba(214,51,132,.16), transparent 62%),
    radial-gradient(900px 620px at 86% 20%, rgba(109,47,136,.10), transparent 60%),
    radial-gradient(900px 680px at 76% 86%, rgba(14,165,233,.13), transparent 62%),
    linear-gradient(135deg, #fff3fa 0%, #f8f7fc 42%, #eef8ff 100%) !important;
}

body.dtpLoginBody::before,
body.dtpLoginBody::after{
  content: "" !important;
  position: fixed !important;
  inset: 0 !important;
  pointer-events: none !important;
}

/* Malla sutil en toda la pantalla, sin bloques blancos gigantes */
body.dtpLoginBody::before{
  background-image:
    linear-gradient(rgba(15,23,42,.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,.022) 1px, transparent 1px) !important;
  background-size: 34px 34px !important;
  opacity: .42 !important;
  mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,.58), transparent 76%) !important;
}

/* Brillos suaves de marca */
body.dtpLoginBody::after{
  background:
    radial-gradient(520px 340px at 20% 18%, rgba(255,255,255,.46), transparent 68%),
    radial-gradient(620px 380px at 80% 84%, rgba(255,255,255,.34), transparent 70%),
    linear-gradient(135deg, transparent 0 48%, rgba(255,255,255,.34) 48.1% 48.34%, transparent 48.45%) !important;
  opacity: .72 !important;
}

body.dtpLoginBody .dtpLoginShell{
  position: relative !important;
  z-index: 1 !important;
  width: 100% !important;
  min-height: 100dvh !important;
  padding: 24px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

body.dtpLoginBody .dtpLoginCard{
  width: min(540px, calc(100vw - 48px)) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;

  display: block !important;
  position: relative !important;
  inset: auto !important;
  transform: none !important;

  border: 1px solid rgba(15,23,42,.09) !important;
  border-radius: 32px !important;
  background: rgba(255,255,255,.91) !important;
  backdrop-filter: blur(22px) saturate(125%) !important;
  box-shadow:
    0 30px 90px rgba(15,23,42,.12),
    inset 0 1px 0 rgba(255,255,255,.80) !important;

  padding: 34px 38px 36px !important;
  overflow: visible !important;
}

body.dtpLoginBody .dtpLoginLogoWrap{
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 0 30px !important;
  padding: 0 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
}

body.dtpLoginBody .dtpLoginLogo{
  display: block !important;
  width: min(420px, 96%) !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center center !important;
  margin: 0 auto !important;
  padding: 0 !important;
  transform: none !important;
}

body.dtpLoginBody .dtpLoginIntro{
  margin: 0 0 22px !important;
  padding: 0 !important;
}

body.dtpLoginBody .dtpLoginIntro h1{
  margin: 0 !important;
  color: #0f172a !important;
  font-size: 34px !important;
  line-height: 1 !important;
  letter-spacing: -.045em !important;
}

body.dtpLoginBody .dtpLoginIntro p{
  margin: 10px 0 0 !important;
  color: #64748b !important;
  font-size: 15px !important;
  line-height: 1.45 !important;
}

body.dtpLoginBody .dtpLoginForm{
  display: grid !important;
  gap: 10px !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.dtpLoginBody .dtpLoginForm label{
  margin: 2px 0 0 !important;
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  letter-spacing: .10em !important;
  text-transform: uppercase !important;
}

body.dtpLoginBody .dtpLoginInput input{
  width: 100% !important;
  min-height: 54px !important;
  border: 1px solid rgba(15,23,42,.12) !important;
  border-radius: 18px !important;
  padding: 0 15px !important;
  background: rgba(255,255,255,.97) !important;
  color: #0f172a !important;
  outline: none !important;
  font-size: 15px !important;
  box-shadow: 0 12px 28px rgba(15,23,42,.045) !important;
}

body.dtpLoginBody .dtpLoginInput input:focus{
  border-color: rgba(214,51,132,.50) !important;
  box-shadow:
    0 0 0 4px rgba(214,51,132,.11),
    0 16px 36px rgba(15,23,42,.07) !important;
}

body.dtpLoginBody .dtpLoginAlert{
  margin: 0 0 16px !important;
  border: 1px solid rgba(220,38,38,.18) !important;
  border-radius: 18px !important;
  padding: 12px 14px !important;
  background: rgba(220,38,38,.07) !important;
  color: #991b1b !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
}

body.dtpLoginBody .dtpLoginSubmit{
  width: 100% !important;
  min-height: 54px !important;
  margin-top: 14px !important;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 0 18px !important;
  background: linear-gradient(135deg, #d63384 0%, #7c2d8f 100%) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 950 !important;
  cursor: pointer !important;
  box-shadow: 0 20px 42px rgba(214,51,132,.24) !important;
}

body.dtpLoginBody .dtpLoginSubmit:hover{
  transform: translateY(-1px) !important;
  box-shadow: 0 24px 50px rgba(214,51,132,.30) !important;
}

body.dtpLoginBody .dtpLoginSubmit:active{
  transform: translateY(0) scale(.99) !important;
}

@media (max-height: 760px){
  html:has(body.dtpLoginBody){
    overflow: auto !important;
  }

  body.dtpLoginBody{
    overflow-y: auto !important;
  }

  body.dtpLoginBody .dtpLoginShell{
    min-height: 100dvh !important;
    padding: 16px !important;
    align-items: center !important;
  }

  body.dtpLoginBody .dtpLoginCard{
    width: min(520px, calc(100vw - 32px)) !important;
    padding: 24px 34px 28px !important;
  }

  body.dtpLoginBody .dtpLoginLogoWrap{
    margin-bottom: 22px !important;
  }

  body.dtpLoginBody .dtpLoginLogo{
    width: min(360px, 94%) !important;
  }

  body.dtpLoginBody .dtpLoginIntro{
    margin-bottom: 18px !important;
  }
}

@media (max-width: 640px){
  html:has(body.dtpLoginBody){
    overflow: auto !important;
  }

  body.dtpLoginBody{
    overflow-y: auto !important;
  }

  body.dtpLoginBody .dtpLoginShell{
    padding: 16px !important;
  }

  body.dtpLoginBody .dtpLoginCard{
    width: min(100%, 520px) !important;
    padding: 24px 20px 26px !important;
    border-radius: 26px !important;
  }

  body.dtpLoginBody .dtpLoginLogoWrap{
    margin-bottom: 24px !important;
  }

  body.dtpLoginBody .dtpLoginLogo{
    width: min(350px, 98%) !important;
  }

  body.dtpLoginBody .dtpLoginIntro h1{
    font-size: 30px !important;
  }
}



/* =========================================================
   DTP AI Core Login — ROOT FIX definitivo
   ---------------------------------------------------------
   Problema corregido:
   - El logo anterior podía ser un PNG cuadrado con espacio transparente.
   - El card quedaba visualmente alto y parecía cortado.
   - El fondo se veía dividido por capas anteriores.
   Solución:
   - Asset dtp-logo.png recortado.
   - Card auto-height, centrado real y sin altura artificial.
   - Fondo pastel aplicado completo a toda la pantalla.
   ========================================================= */

html:has(body.dtpLoginBody){
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  overflow: hidden !important;
  background: #f8f7fc !important;
}

body.dtpLoginBody{
  width: 100% !important;
  min-height: 100dvh !important;
  margin: 0 !important;
  overflow: hidden !important;
  color: #0f172a !important;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  background:
    radial-gradient(980px 620px at 12% 16%, rgba(214,51,132,.16), transparent 62%),
    radial-gradient(920px 640px at 88% 18%, rgba(109,47,136,.10), transparent 60%),
    radial-gradient(920px 680px at 76% 86%, rgba(14,165,233,.13), transparent 62%),
    linear-gradient(135deg, #fff3fa 0%, #f8f7fc 44%, #eef8ff 100%) !important;
}

body.dtpLoginBody::before,
body.dtpLoginBody::after{
  content: "" !important;
  position: fixed !important;
  inset: 0 !important;
  pointer-events: none !important;
}

body.dtpLoginBody::before{
  background-image:
    linear-gradient(rgba(15,23,42,.020) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,.020) 1px, transparent 1px) !important;
  background-size: 34px 34px !important;
  opacity: .42 !important;
  mask-image: radial-gradient(circle at 50% 50%, rgba(0,0,0,.60), transparent 78%) !important;
}

body.dtpLoginBody::after{
  background:
    radial-gradient(560px 340px at 20% 18%, rgba(255,255,255,.42), transparent 70%),
    radial-gradient(640px 420px at 82% 84%, rgba(255,255,255,.32), transparent 72%),
    linear-gradient(135deg, transparent 0 48%, rgba(255,255,255,.28) 48.1% 48.32%, transparent 48.42%) !important;
  opacity: .72 !important;
}

body.dtpLoginBody .dtpLoginShell{
  position: relative !important;
  z-index: 1 !important;
  width: 100% !important;
  min-height: 100dvh !important;
  padding: 24px !important;
  display: grid !important;
  place-items: center !important;
  align-items: center !important;
  justify-items: center !important;
}

body.dtpLoginBody .dtpLoginCard{
  width: min(520px, calc(100vw - 48px)) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: calc(100dvh - 48px) !important;

  display: block !important;
  position: relative !important;
  inset: auto !important;
  transform: none !important;

  border: 1px solid rgba(15,23,42,.09) !important;
  border-radius: 30px !important;
  background: rgba(255,255,255,.92) !important;
  backdrop-filter: blur(22px) saturate(125%) !important;
  box-shadow:
    0 30px 90px rgba(15,23,42,.12),
    inset 0 1px 0 rgba(255,255,255,.82) !important;

  padding: 30px 36px 34px !important;
  overflow: visible !important;
}

body.dtpLoginBody .dtpLoginLogoWrap{
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 0 24px !important;
  padding: 0 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: visible !important;
}

body.dtpLoginBody .dtpLoginLogo{
  display: block !important;
  width: min(410px, 94%) !important;
  max-width: 100% !important;
  height: auto !important;
  max-height: 96px !important;
  object-fit: contain !important;
  object-position: center center !important;
  margin: 0 auto !important;
  padding: 0 !important;
  transform: none !important;
}

body.dtpLoginBody .dtpLoginIntro{
  margin: 0 0 20px !important;
  padding: 0 !important;
}

body.dtpLoginBody .dtpLoginIntro h1{
  margin: 0 !important;
  color: #0f172a !important;
  font-size: 34px !important;
  line-height: 1 !important;
  letter-spacing: -.045em !important;
}

body.dtpLoginBody .dtpLoginIntro p{
  margin: 10px 0 0 !important;
  color: #64748b !important;
  font-size: 15px !important;
  line-height: 1.42 !important;
}

body.dtpLoginBody .dtpLoginForm{
  display: grid !important;
  gap: 10px !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.dtpLoginBody .dtpLoginForm label{
  margin: 2px 0 0 !important;
  color: #334155 !important;
  font-size: 12px !important;
  font-weight: 950 !important;
  letter-spacing: .10em !important;
  text-transform: uppercase !important;
}

body.dtpLoginBody .dtpLoginInput input{
  width: 100% !important;
  min-height: 54px !important;
  border: 1px solid rgba(15,23,42,.12) !important;
  border-radius: 18px !important;
  padding: 0 15px !important;
  background: rgba(255,255,255,.97) !important;
  color: #0f172a !important;
  outline: none !important;
  font-size: 15px !important;
  box-shadow: 0 12px 28px rgba(15,23,42,.045) !important;
}

body.dtpLoginBody .dtpLoginInput input:focus{
  border-color: rgba(214,51,132,.50) !important;
  box-shadow:
    0 0 0 4px rgba(214,51,132,.11),
    0 16px 36px rgba(15,23,42,.07) !important;
}

body.dtpLoginBody .dtpLoginAlert{
  margin: 0 0 16px !important;
  border: 1px solid rgba(220,38,38,.18) !important;
  border-radius: 18px !important;
  padding: 12px 14px !important;
  background: rgba(220,38,38,.07) !important;
  color: #991b1b !important;
  font-size: 13.5px !important;
  font-weight: 800 !important;
}

body.dtpLoginBody .dtpLoginSubmit{
  width: 100% !important;
  min-height: 54px !important;
  margin-top: 14px !important;
  border: 0 !important;
  border-radius: 999px !important;
  padding: 0 18px !important;
  background: linear-gradient(135deg, #d63384 0%, #7c2d8f 100%) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 950 !important;
  cursor: pointer !important;
  box-shadow: 0 20px 42px rgba(214,51,132,.24) !important;
}

body.dtpLoginBody .dtpLoginSubmit:hover{
  transform: translateY(-1px) !important;
  box-shadow: 0 24px 50px rgba(214,51,132,.30) !important;
}

body.dtpLoginBody .dtpLoginSubmit:active{
  transform: translateY(0) scale(.99) !important;
}

@media (max-height: 720px){
  html:has(body.dtpLoginBody){
    overflow: auto !important;
  }

  body.dtpLoginBody{
    overflow-y: auto !important;
  }

  body.dtpLoginBody .dtpLoginShell{
    min-height: 100dvh !important;
    padding: 16px !important;
    align-items: center !important;
  }

  body.dtpLoginBody .dtpLoginCard{
    width: min(500px, calc(100vw - 32px)) !important;
    max-height: none !important;
    padding: 22px 32px 26px !important;
  }

  body.dtpLoginBody .dtpLoginLogoWrap{
    margin-bottom: 18px !important;
  }

  body.dtpLoginBody .dtpLoginLogo{
    width: min(340px, 92%) !important;
    max-height: 80px !important;
  }

  body.dtpLoginBody .dtpLoginIntro{
    margin-bottom: 16px !important;
  }
}

@media (max-width: 640px){
  html:has(body.dtpLoginBody){
    overflow: auto !important;
  }

  body.dtpLoginBody{
    overflow-y: auto !important;
  }

  body.dtpLoginBody .dtpLoginShell{
    padding: 16px !important;
  }

  body.dtpLoginBody .dtpLoginCard{
    width: min(100%, 500px) !important;
    padding: 22px 20px 26px !important;
    border-radius: 26px !important;
  }

  body.dtpLoginBody .dtpLoginLogoWrap{
    margin-bottom: 20px !important;
  }

  body.dtpLoginBody .dtpLoginLogo{
    width: min(340px, 98%) !important;
    max-height: 78px !important;
  }

  body.dtpLoginBody .dtpLoginIntro h1{
    font-size: 30px !important;
  }
}




/* =========================================================
   Login: logo grande sin aumentar espacios verticales
   ========================================================= */

body.dtpLoginBody .dtpLoginCard{
  padding-top: 32px !important;
  padding-bottom: 38px !important;
}

body.dtpLoginBody .dtpLoginLogoWrap{
  height: 92px !important;
  min-height: 92px !important;
  max-height: 92px !important;

  margin: 0 0 22px !important;
  padding: 0 !important;

  display: flex !important;
  align-items: center !important;
  justify-content: center !important;

  line-height: 0 !important;
  overflow: visible !important;
}

body.dtpLoginBody .dtpLoginLogo{
  height: 486px !important;
  width: auto !important;

  max-width: 96% !important;
  max-height: 486px !important;

  display: block !important;
  object-fit: contain !important;
  object-position: center !important;

  margin: 0 auto !important;
  padding: 0 !important;
}




.aiCoreLoginIntro{
  width:100% !important;
  display:flex !important;
  flex-direction:column !important;
  align-items:center !important;
  justify-content:center !important;
  gap:14px !important;
  margin:0 0 22px !important;
  text-align:center !important;
}

.loginAccessTabs{
  width:100% !important;
  max-width:520px !important;
  display:grid !important;
  grid-template-columns:1fr 1fr !important;
  gap:8px !important;
  padding:7px !important;
  border:1px solid rgba(15,23,42,.08) !important;
  border-radius:999px !important;
  background:linear-gradient(180deg, rgba(255,255,255,.92), rgba(248,250,252,.9)) !important;
  box-shadow:
    0 16px 40px rgba(15,23,42,.08),
    inset 0 1px 0 rgba(255,255,255,.9) !important;
}

.loginAccessTab{
  min-height:50px !important;
  width:100% !important;
  border:0 !important;
  border-radius:999px !important;
  background:transparent !important;
  color:#667085 !important;
  font-size:13px !important;
  font-weight:850 !important;
  letter-spacing:.08em !important;
  text-transform:uppercase !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  text-align:center !important;
  gap:9px !important;
  cursor:pointer !important;
  position:relative !important;
  white-space:nowrap !important;
  transition:
    background .22s ease,
    color .22s ease,
    box-shadow .22s ease,
    transform .22s ease,
    opacity .22s ease !important;
}

.loginAccessTab:hover{
  color:#101828 !important;
  background:rgba(255,255,255,.72) !important;
}

.loginAccessTab.is-active{
  background:#ffffff !important;
  color:#14213d !important;
  box-shadow:
    0 12px 28px rgba(15,23,42,.13),
    inset 0 1px 0 rgba(255,255,255,1) !important;
}

.loginAccessTab.is-coming-soon{
  cursor:pointer !important;
  color:#7b8496 !important;
}

.loginAccessTab.is-coming-soon:hover{
  color:#14213d !important;
}

.loginAccessIcon{
  width:22px !important;
  height:22px !important;
  min-width:22px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  border-radius:999px !important;
  background:rgba(219,39,119,.08) !important;
}

.loginAccessIcon svg{
  width:15px !important;
  height:15px !important;
  stroke:currentColor !important;
  stroke-width:1.9 !important;
  stroke-linecap:round !important;
  stroke-linejoin:round !important;
}

.loginAccessTab.is-active .loginAccessIcon{
  color:#db2777 !important;
  background:rgba(219,39,119,.10) !important;
}

.loginAccessText{
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  text-align:center !important;
  line-height:1 !important;
}

.loginSoonBadge{
  display:none !important;
  position:absolute !important;
  top:-9px !important;
  right:18px !important;
  padding:4px 8px !important;
  border-radius:999px !important;
  background:#fdf2f8 !important;
  color:#be185d !important;
  border:1px solid rgba(219,39,119,.14) !important;
  font-size:10px !important;
  font-weight:850 !important;
  letter-spacing:.02em !important;
  text-transform:none !important;
  box-shadow:0 8px 18px rgba(190,24,93,.12) !important;
}

.loginAccessTab.is-coming-soon:hover .loginSoonBadge{
  display:inline-flex !important;
}

.loginAccessHint{
  width:100% !important;
  max-width:460px !important;
  margin:0 auto !important;
  color:#64748b !important;
  font-size:14.5px !important;
  line-height:1.45 !important;
  text-align:center !important;
}

.loginAccessHint.is-warning{
  color:#be185d !important;
  font-weight:750 !important;
}

@media (max-width:520px){
  .loginAccessTabs{
    max-width:100% !important;
    border-radius:26px !important;
  }

  .loginAccessTab{
    min-height:48px !important;
    font-size:12px !important;
    letter-spacing:.05em !important;
    gap:7px !important;
  }

  .loginAccessIcon{
    width:20px !important;
    height:20px !important;
    min-width:20px !important;
  }

  .loginSoonBadge{
    right:10px !important;
  }
}


.loginAccessTab{
  min-height:50px !important;
  height:50px !important;
  padding:0 22px !important;
  box-sizing:border-box !important;

  display:flex !important;
  align-items:center !important;
  justify-content:center !important;

  gap:10px !important;
  line-height:1 !important;
  text-align:center !important;
  vertical-align:middle !important;
}

.loginAccessIcon{
  width:24px !important;
  height:24px !important;
  min-width:24px !important;
  flex:0 0 24px !important;

  display:flex !important;
  align-items:center !important;
  justify-content:center !important;

  margin:0 !important;
  padding:0 !important;
  line-height:0 !important;
}

.loginAccessIcon svg{
  width:15px !important;
  height:15px !important;
  display:block !important;
  margin:0 !important;
}

.loginAccessText{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;

  height:24px !important;
  margin:0 !important;
  padding:0 !important;

  line-height:1 !important;
  text-align:center !important;
}


.aiCoreThreadActions #aiCoreFlowModeToggle,
.aiCoreThreadActions #aiCoreFlowModeToggle.aiCoreFlowModePill,
#aiCoreFlowModeToggle[hidden]{
  display:none !important;
  visibility:hidden !important;
  opacity:0 !important;
  pointer-events:none !important;
  width:0 !important;
  height:0 !important;
  min-width:0 !important;
  min-height:0 !important;
  max-width:0 !important;
  max-height:0 !important;
  padding:0 !important;
  margin:0 !important;
  border:0 !important;
  overflow:hidden !important;
}