
:root{--ia-bg:#07101f;--ia-card:#101b30;--ia-line:#263a5b;--ia-text:#edf4ff;--ia-muted:#9fb0c8;--ia-purple:#7c3aed;--ia-green:#22c55e}
.ia-page{min-height:calc(100vh - 66px);background:var(--ia-bg);color:var(--ia-text);display:grid;grid-template-columns:300px minmax(0,1fr);gap:14px;padding:14px}
.ia-sidebar{display:flex;flex-direction:column;gap:12px}.ia-card{background:var(--ia-card);border:1px solid var(--ia-line);border-radius:16px;padding:14px}
.ia-card-title{font-weight:800;margin-bottom:10px}.ia-card select,.ia-card input{width:100%;box-sizing:border-box;background:#0a1427;color:#fff;border:1px solid #344b70;border-radius:11px;padding:11px}
.ia-small{font-size:12px;color:var(--ia-muted);margin-top:8px;word-break:break-word}.ia-state-row{display:flex;justify-content:space-between;gap:10px;padding:7px 0;border-bottom:1px solid rgba(255,255,255,.07)}
.ia-secondary{width:100%;margin-top:8px;border:0;border-radius:10px;padding:10px;background:#263a5c;color:white;cursor:pointer}
.ia-main{min-width:0;background:#0d182b;border:1px solid var(--ia-line);border-radius:18px;display:flex;flex-direction:column;min-height:calc(100vh - 95px);overflow:hidden}
.ia-mobile-head{display:none}.ia-messages{flex:1;overflow:auto;padding:20px;display:flex;flex-direction:column;gap:12px}
.ia-welcome{max-width:760px;margin:auto;text-align:center;color:var(--ia-muted)}.ia-welcome h1{color:#fff}.ia-logo{font-size:56px}.ia-note{margin-top:16px;text-align:left;background:#12213a;border:1px solid #2d4468;padding:12px;border-radius:12px}
.ia-msg{max-width:min(78%,820px);padding:12px 14px;border-radius:15px;background:#172744;align-self:flex-start;white-space:pre-wrap;overflow-wrap:anywhere}
.ia-msg.me{align-self:flex-end;background:#5b21b6}.ia-msg .meta{font-size:11px;color:#b5c5dd;margin-bottom:6px}.ia-msg.error{border:1px solid #ef4444}
.ia-attachments{display:none;gap:8px;flex-wrap:wrap;padding:8px 14px;border-top:1px solid var(--ia-line)}.ia-attachments.show{display:flex}
.ia-att{background:#152642;border:1px solid #345071;border-radius:10px;padding:7px 9px;font-size:12px}.ia-att button{border:0;background:transparent;color:#fff;cursor:pointer}
.ia-quick{display:flex;gap:8px;padding:8px 14px;overflow:auto}.ia-quick button{white-space:nowrap;border:1px solid #344b70;background:#13213a;color:#fff;border-radius:10px;padding:9px 11px;cursor:pointer}
.ia-compose{border-top:1px solid var(--ia-line);padding:12px;display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:10px;align-items:end}
.ia-media-buttons{display:flex;gap:6px}.ia-media-buttons button{border:0;background:#1b2d4b;color:#fff;border-radius:10px;padding:10px;cursor:pointer}.ia-media-buttons span{display:none}
.ia-compose textarea{resize:none;min-height:54px;max-height:160px;border:1px solid #344b70;background:#071326;color:#fff;border-radius:13px;padding:12px;font:inherit}
.ia-send{border:0;border-radius:12px;background:var(--ia-purple);color:#fff;font-size:22px;width:48px;height:48px;cursor:pointer}.ia-send:disabled{opacity:.5}
.ia-online{color:var(--ia-green)}.ia-offline{color:#f59e0b}.ia-chip{border:0;border-radius:999px;background:#142540;color:#fff;padding:8px 10px}
.ia-global-button{position:fixed;right:16px;bottom:16px;z-index:1000;background:#7c3aed!important;color:#fff!important;border-radius:999px!important;padding:11px 14px!important;box-shadow:0 7px 24px rgba(0,0,0,.35);text-decoration:none!important;font-weight:800}
@media(max-width:760px){
 .ia-page{display:block;padding:0;min-height:calc(100vh - 58px)}.ia-sidebar{display:none}.ia-main{border-radius:0;border-left:0;border-right:0;min-height:calc(100vh - 58px)}
 .ia-topbar nav{display:none!important}.ia-mobile-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:9px 10px;border-bottom:1px solid var(--ia-line);background:#0b172a;position:sticky;top:0;z-index:2}
 .ia-mobile-head select{min-width:0;flex:1;background:#142540;color:#fff;border:1px solid #30496e;border-radius:10px;padding:9px}
 .ia-messages{padding:12px;min-height:46vh}.ia-msg{max-width:91%}.ia-welcome{padding:18px 8px}.ia-welcome h1{font-size:22px}
 .ia-quick{padding:7px 9px}.ia-compose{padding:9px;grid-template-columns:1fr auto}.ia-media-buttons{grid-column:1/-1}.ia-media-buttons button{flex:1;display:flex;align-items:center;justify-content:center;gap:5px}.ia-media-buttons span{display:inline;font-size:12px}
 .ia-compose textarea{min-height:48px}.ia-send{width:46px;height:46px}.ia-global-button{right:10px;bottom:10px;padding:10px 12px!important}
}


/* V1.88: acceso IA siempre visible en celular/app */
.ia-global-v188{z-index:2147483000!important}
@media(max-width:760px){
  .ia-global-v188{
    position:fixed!important;
    right:12px!important;
    bottom:calc(env(safe-area-inset-bottom, 0px) + 82px)!important;
    min-width:64px!important;
    min-height:48px!important;
    display:flex!important;
    align-items:center!important;
    justify-content:center!important;
    gap:5px!important;
    font-size:16px!important;
    border:2px solid rgba(255,255,255,.45)!important;
    box-shadow:0 10px 30px rgba(0,0,0,.55)!important;
  }
  #iaModeMobile{max-width:145px;flex:0 0 auto!important}
}

/* V1.89 mobile IA guarantee */
@media(max-width:760px){
  .ia-global-button,.ia-global-v188{
    display:flex!important;
    visibility:visible!important;
    opacity:1!important;
    position:fixed!important;
    right:12px!important;
    bottom:calc(env(safe-area-inset-bottom,0px) + 82px)!important;
    z-index:2147483640!important;
  }
}


/* V1.91 - IA en menú superior */
.ia-global-button,.ia-global-v188,[id^="iaGlobalButtonV"]{display:none!important}
.top-ia-link{
  position:static!important;
  display:inline-flex!important;
  align-items:center!important;
  width:auto!important;
  height:auto!important;
  min-width:0!important;
  min-height:0!important;
  background:transparent!important;
  box-shadow:none!important;
  border:0!important;
  padding:0!important;
  margin:0!important;
  color:inherit!important;
  font-size:inherit!important;
  text-decoration:none!important;
}


/* V1.92 - Mantenimiento IA */
#iaDevCardV192 .ia-secondary{margin-top:7px}
#iaDevCardV192 button:disabled{opacity:.45;cursor:not-allowed}
#iaDevStatus{margin-top:8px;line-height:1.35}


/* V1.93 - estados de cambio real */
#iaDevStatus{font-weight:600}
#iaDevApply:not(:disabled){outline:1px solid rgba(255,255,255,.20)}


/* V1.94 - bloqueo visual durante mantenimiento */
#iaDevCardV192 button:disabled{opacity:.48}


/* V2.03 - chat adaptable a ventanas pequeñas */
html, body { max-width:100%; overflow-x:hidden; }
.ia-shell, .ia-main, .ia-chat, .ia-panel { min-width:0 !important; }
#iaMessages {
  min-height:0 !important;
  max-width:100%;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  padding-bottom:12px;
}
.ia-msg {
  max-width:min(78%, 760px) !important;
  overflow-wrap:anywhere;
  word-break:break-word;
}
.ia-composer, .ia-input-row {
  position:sticky !important;
  bottom:0;
  z-index:30;
  max-width:100%;
}
#iaInput, textarea[name="message"] {
  min-width:0 !important;
  width:100% !important;
  resize:none;
  max-height:160px;
}
@media (max-width: 900px) {
  .ia-layout, .ia-shell {
    grid-template-columns: 220px minmax(0,1fr) !important;
  }
  .ia-msg { max-width:92% !important; }
}
@media (max-width: 720px) {
  .ia-layout, .ia-shell {
    display:block !important;
  }
  .ia-sidebar {
    max-height:210px;
    overflow:auto;
    margin-bottom:8px;
  }
  .ia-main, .ia-chat {
    width:100% !important;
    min-height:calc(100vh - 230px);
  }
  .ia-msg { max-width:96% !important; }
}

/* V2.06 - Actividad visible */
#iaActivityV206{margin-top:10px;padding:10px;border:1px solid #29446c;border-radius:10px;background:#0a192d;color:#bcd0eb;font-size:12px}
#iaActivityV206 .h{font-weight:800;color:#fff;margin-bottom:6px}
#iaActivityV206 .stage{font-weight:700;color:#dbeafe;margin-bottom:4px}
#iaActivityV206 .detail{line-height:1.35;margin-bottom:7px}
#iaActivityV206 .bar{height:6px;border-radius:8px;background:#1b2a42;overflow:hidden}
#iaActivityV206 .bar i{display:block;height:100%;width:0;background:#7c3aed;transition:width .25s ease}
#iaActivityV206 .meta{margin-top:5px;font-size:10px;color:#7890b2}
#iaActivityV206.active{border-color:#6d28d9}
/* Cuando IA está embebida en Música, mantener entrada visible y usar todo el alto */
@media (max-width:900px){#iaMessages{max-width:100%!important}.ia-msg{max-width:92%!important}}

/* V2.07 - conversación compacta: lo viejo queda arriba dentro del scroll */
body{overflow:hidden!important}
.ia-shell,.ia-layout,.ia-main,.ia-chat{min-height:0!important}
.ia-main,.ia-chat{height:calc(100vh - 86px)!important;max-height:calc(100vh - 86px)!important;overflow:hidden!important}
#iaMessages{
  height:calc(100vh - 245px)!important;
  max-height:calc(100vh - 245px)!important;
  min-height:180px!important;
  overflow-y:auto!important;
  overscroll-behavior:contain;
  scroll-behavior:smooth;
  padding-bottom:18px!important
}
.ia-composer,.ia-input-row{
  position:sticky!important;
  bottom:0!important;
  z-index:50!important;
  background:#081426!important
}
header,.topbar,.ia-topbar{position:sticky!important;top:0!important;z-index:80!important}
.ia-sidebar{overflow-y:auto!important;max-height:calc(100vh - 86px)!important}
@media(max-width:900px){
  .ia-main,.ia-chat{height:calc(100vh - 72px)!important;max-height:calc(100vh - 72px)!important}
  #iaMessages{height:calc(100vh - 225px)!important;max-height:calc(100vh - 225px)!important}
}
@media(max-width:720px){
  body{overflow:auto!important}
  .ia-main,.ia-chat{height:auto!important;max-height:none!important}
  #iaMessages{height:55vh!important;max-height:55vh!important}
}

/* V2.08 - Controles de conversación */
#iaChatToolsV208{
  display:flex;gap:8px;align-items:center;justify-content:flex-end;
  padding:6px 8px;background:#081426;position:sticky;top:0;z-index:45
}
#iaChatToolsV208 button{
  border:1px solid #334b70;background:#162845;color:#e8f0ff;
  border-radius:9px;padding:7px 10px;cursor:pointer;font-size:12px
}
#iaMessages.iaCollapsedV208{
  height:58px!important;max-height:58px!important;min-height:58px!important;
  overflow:hidden!important;opacity:.88
}
#iaMessages.iaCollapsedV208 .ia-msg{display:none!important}
#iaMessages.iaCollapsedV208 .ia-msg:last-child{display:block!important;max-width:100%!important}

/* V2.13 - indicador de respuesta sustentada */
.iaGroundedV213{
  margin-top:8px;padding:6px 8px;border:1px solid #2f5d4b;border-radius:8px;
  background:#0d2a24;color:#a7f3d0;font-size:11px;line-height:1.3
}
