/* ============================================================
   Portal de asociados (cx/) — tema legacy cx2
   topbar degradado #11458B→#1384D2→#11458B · drawer <991px
   tablas con variante móvil · Poppins · card-header brand
   ============================================================ */
:root{
  --cx-primary: var(--brand-blue);
  --cx-danger: var(--brand-red);
  --cx-warning: var(--brand-yellow);
  --cx-dark: var(--brand-blue-dark);
  --cx-success:#2E7D32; --cx-info:#0288D1;
  --cx-bg-app:var(--front-bg); --cx-bg-surface:#FFFFFF;
  --cx-text-primary:#2C2A29; --cx-text-secondary:#666;
  --cx-topbar-height:64px; --cx-sidebar-width:260px;
  --cx-gutter:24px; --cx-radius:10px; --cx-radius-button:24px;
  --cx-shadow-card:0 2px 8px rgba(0,0,0,.06); --cx-transition:.2s ease;
  --cx-font: var(--front-font);
}
body.portal{
  font-family:"Poppins",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  background:var(--cx-bg-app); color:var(--cx-text-primary);
}
.portal-topbar{
  min-height:var(--cx-topbar-height); padding:0 var(--cx-gutter); position:relative;
  display:flex; align-items:center;
  background:linear-gradient(135deg,var(--cx-dark),var(--cx-primary));
  box-shadow:0 2px 12px rgba(0,0,0,.15);
}
.portal-topbar-inner{position:relative; z-index:1; height:var(--cx-topbar-height); width:100%;}
.portal-brand{color:#fff; font-weight:700; font-size:1.25rem; white-space:nowrap;}
.portal-brand img{height:34px; margin-right:.6rem;}
/* Logos del header */
.header-logos{display:inline-flex; align-items:center; gap:.65rem;}
.header-logos .logo-sq{height:34px; width:auto;}          /* multi 1:1 */
.header-logos .logo-169{height:24px; width:auto; background:#fff; border-radius:6px; padding:3px 8px;}  /* coomultiunion 16:9 sobre blanco */
.portal-user{color:#fff; font-weight:600; font-size:.92rem;}
.portal-topbar .btn-logout{
  color:#fff; border:none; border-radius:var(--cx-radius-button); padding:.35rem .9rem; font-size:.85rem;
  background:radial-gradient(140% 140% at 30% 100%,#c62828 0%,#b71c1c 35%,var(--cx-danger) 60%,#d32f2f 100%);
}
.portal-topbar .btn-logout:hover{filter:brightness(1.08);}
.portal-topbar .btn-notif{color:#fff; border:none; background:rgba(255,255,255,.16); width:34px; height:34px; padding:0; display:inline-flex; align-items:center; justify-content:center; border-radius:9999px; font-size:1rem;}
.portal-topbar .btn-notif:hover{background:rgba(255,255,255,.28);}
@media(max-width:991px){ .portal-topbar{padding:0 1rem;} .portal-brand{font-size:1.05rem;} }
@media(max-width:767px){ .portal-brand span.brand-text{display:none;} .portal-user{font-size:.85rem;} }

/* ----- Layout ----- */
.portal-shell{display:flex; min-height:calc(100vh - var(--cx-topbar-height));}
.portal-sidebar{
  width:var(--cx-sidebar-width); flex:0 0 auto; background:var(--cx-bg-surface);
  border-right:1px solid #eceef1; padding:1.25rem 1rem;
}
.portal-main{flex:1 1 auto; min-width:0; padding:1.5rem var(--cx-gutter) 3rem;}
@media(max-width:991px){
  .portal-sidebar{
    position:fixed; top:var(--cx-topbar-height); left:0; z-index:50;
    width:min(320px,85vw); height:calc(100vh - var(--cx-topbar-height));
    transform:translateX(-100%); transition:transform var(--cx-transition);
    box-shadow:4px 0 20px rgba(0,0,0,.18); overflow-y:auto;
  }
  body.portal-drawer-open .portal-sidebar{transform:translateX(0);}
  body.portal-drawer-open{overflow:hidden;}
  .portal-main{padding:1rem;}
}
.portal-drawer-overlay{position:fixed; inset:var(--cx-topbar-height) 0 0 0; z-index:45; background:rgba(17,69,139,.35); opacity:0; visibility:hidden; transition:opacity var(--cx-transition);}
body.portal-drawer-open .portal-drawer-overlay{opacity:1; visibility:visible;}

/* ----- Navegación (dock) ----- */
.portal-dock-nav a.portal-dock-item{
  display:flex; align-items:center; gap:.8rem; padding:.65rem .85rem; margin-bottom:.35rem;
  border-radius:9999px; color:var(--cx-text-primary); text-decoration:none; font-weight:500;
  background:linear-gradient(-75deg,rgba(255,255,255,.7),rgba(232,236,241,.7));
  transition:transform var(--cx-transition),background var(--cx-transition);
}
.portal-dock-item .portal-dock-icon{
  width:28px; height:28px; display:inline-flex; align-items:center; justify-content:center;
  border-radius:50%; background:rgba(255,255,255,.6); color:var(--cx-dark); font-size:.9rem;
}
.portal-dock-item:hover{transform:scale(1.02);}
.portal-dock-group{margin-bottom:.85rem;}
.portal-dock-group:last-child{margin-bottom:0;}
.portal-dock-group-label{
  font-size:.68rem; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  color:var(--cx-text-secondary); padding:0 .85rem .35rem;
}
.portal-dock-nav a.portal-dock-item.active{
  background:linear-gradient(135deg,#11458B,#1384D2);
  color:#fff; font-weight:600;
  box-shadow:0 6px 16px rgba(17,69,139,.22);
}
.portal-dock-nav a.portal-dock-item.active:hover{
  background:linear-gradient(135deg,#11458B,#1384D2);
  color:#fff;
}
.portal-dock-item.active .portal-dock-icon{background:rgba(255,255,255,.18); color:#fff;}
.portal-dock-group-options{margin-top:.5rem;}
@media (min-width: 992px){
  .portal-sidebar{
    position:sticky; top:0; align-self:flex-start;
    max-height:calc(100vh - var(--cx-topbar-height)); overflow-y:auto;
  }
}
.portal-topbar .btn-notif.active{
  background:rgba(255,255,255,.34);
  box-shadow:inset 0 0 0 2px rgba(255,255,255,.55);
}

/* ----- Títulos ----- */
.portal-page-title{
  font-weight:800; background:linear-gradient(90deg,#11458B,#1384D2,#11458B,#1384D2,#11458B);
  -webkit-background-clip:text; background-clip:text; color:transparent;
}
.portal-area-title{font-weight:700; color:#1a1a1a;}

/* ----- Tarjetas ----- */
.portal-card{background:var(--cx-bg-surface); border-radius:var(--cx-radius); box-shadow:var(--cx-shadow-card); padding:1.25rem; border:none;}
.portal-card-glowing-border{border:2px solid rgba(22,121,192,.65); box-shadow:0 0 12px rgba(22,121,192,.18);}
.card-header-brand{display:flex; align-items:center; gap:.75rem; color:var(--cx-dark);}
.card-header-brand .crumb{font-size:.78rem; color:var(--cx-text-secondary);}

/* ----- CTA "Habla con Soli" (Inicio) ----- */
a.soli-cta{display:block; color:inherit; text-decoration:none; transition:transform var(--cx-transition), box-shadow var(--cx-transition);}
a.soli-cta:hover{color:inherit; transform:translateY(-1px); box-shadow:var(--cx-shadow-card),0 6px 18px rgba(17,69,139,.14);}
.soli-cta-avatar{flex:0 0 auto; width:48px; height:48px; border-radius:50%; overflow:hidden; display:inline-flex; align-items:center; justify-content:center; background:#eef3f9; color:var(--cx-dark);}
.soli-cta-avatar img{width:100%; height:100%; object-fit:cover; transform:scale(1.35); transform-origin:center; display:block;}
.soli-cta-arrow{margin-left:auto; font-size:1.15rem; color:var(--cx-dark);}
@media (max-width:575.98px){ .soli-cta-avatar{width:42px; height:42px;} }

/* ----- Tablas + variante móvil ----- */
.portal-table{width:100%; border-collapse:collapse; font-size:.9rem;}
.portal-table thead th{background:#f8f9fa; text-transform:uppercase; letter-spacing:.02em; font-size:.72rem; padding:.6rem .75rem; color:var(--cx-text-secondary); border-bottom:2px solid #eef0f3;}
.portal-table tbody td{padding:.65rem .75rem; border-bottom:1px solid #f0f2f5; vertical-align:middle;}
.portal-table tbody tr:hover{background:#fafbfc;}
/* Filas resaltadas (aportes: incentivos y comisiones) */
.portal-table tbody tr.fila-destacada{background:#e1e9f4;}
.portal-table tbody tr.fila-destacada:hover{background:#d5e1ef;}
html[data-bs-theme="dark"] .portal-table tbody tr.fila-destacada{background:rgba(24,130,205,.22);}
html[data-bs-theme="dark"] .portal-table tbody tr.fila-destacada:hover{background:rgba(24,130,205,.32);}
.badge-etapa{font-size:.72rem; font-weight:600; padding:.3em .6em; border-radius:9999px; white-space:nowrap;}
.badge-mora{background:#fdecea; color:var(--cx-danger);}
@media(max-width:991px){
  .portal-table, .portal-table thead, .portal-table tbody, .portal-table tr, .portal-table th, .portal-table td{display:block; width:100%;}
  .portal-table thead{display:none;}
  .portal-table tr{display:grid; gap:.3rem; padding:.85rem; margin-bottom:.9rem; border:1px solid #eef0f3; border-radius:var(--cx-radius); box-shadow:var(--cx-shadow-card);}
  .portal-table tbody td{display:flex; justify-content:space-between; align-items:center; gap:1rem; border:none; padding:.28rem 0;}
  .portal-table tbody td::before{content:attr(data-label); font-size:.7rem; text-transform:uppercase; color:var(--cx-text-secondary); font-weight:600; flex:0 0 40%;}
  .portal-table tbody td > .cell-val{text-align:right;}
}

/* ----- Montos ----------*/
.money{font-weight:600;}
.money-neg{color:var(--cx-danger);}

/* ----- Botones ----- */
.btn-portal-gradient{
  border:none; color:#fff; font-weight:600; border-radius:var(--cx-radius-button); padding:.5rem 1.1rem;
  background:linear-gradient(135deg,var(--cx-primary),var(--cx-dark));
  box-shadow:0 3px 10px rgba(17,69,139,.25);
}
.btn-portal-gradient:hover{filter:brightness(1.08); color:#fff; transform:translateY(-1px);}
.btn-portal-outline{border-radius:var(--cx-radius-button); border:1px solid var(--cx-dark); color:var(--cx-dark); font-weight:600;}
.btn-portal-outline:hover{background:var(--cx-dark); color:#fff;}
.btn-portal-outline.is-pending{opacity:.55; border-style:dashed;}
.btn-portal-accent{
  border:none; border-radius:var(--cx-radius-button); padding:.5rem 1.1rem; font-weight:600; color:var(--cx-dark);
  background:linear-gradient(-75deg,#FED327,#E5C420);
}
.btn-portal-accent:hover{filter:brightness(1.05);}

/* ----- Form (portal) ----- */
.form-label{font-size:.8rem; font-weight:600; color:var(--cx-text-secondary);}
.portal-input, .portal-select{width:100%; border:1px solid #d8dde3; border-radius:.6rem; padding:.55rem .75rem; font-size:.95rem;}
.portal-input:focus, .portal-select:focus{border-color:var(--cx-primary); box-shadow:0 0 0 .2rem rgba(19,132,210,.15); outline:none;}
.form-check-input:checked{background-color:var(--cx-primary); border-color:var(--cx-primary);}

/* ----- mini-cards ocio (index) ----- */
.portal-mini{text-align:center; padding:1.5rem 1rem;}
.mini-icon{width:56px; height:56px; flex:0 0 auto; display:flex; align-items:center; justify-content:center; border-radius:50%; font-size:1.5rem; background:linear-gradient(-75deg,#11458B,#1384D2); color:#fff; box-shadow:0 6px 16px rgba(17,69,139,.35);}
.portal-mini .mini-icon{margin-inline:auto;}
.portal-mini h6{margin-top:.8rem; font-weight:600;}
.mini-icon.mini-icon-sm{width:38px; height:38px; font-size:1rem; box-shadow:0 4px 10px rgba(17,69,139,.28);}
a:hover > .mini-icon-sm{transform:translateY(-1px); filter:brightness(1.06);}

/* ----- Detalle grid ----- */
.portal-datos-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:1rem;}
@media(max-width:991px){ .portal-datos-grid{grid-template-columns:1fr;} }
.dato-item .dato-label{font-size:.72rem; text-transform:uppercase; color:var(--cx-text-secondary);}
.dato-item .dato-val{font-weight:600; word-break:break-word;}

/* ====================== AUTH (login / password_set) ====================== */
.portal-auth-screen{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:1.5rem; position:relative; overflow:hidden;
  background:radial-gradient(150% 180% at 20% 120%,var(--cx-dark) 0%,#0d3a6b 35%,var(--cx-primary) 60%,#1a6bab 85%,var(--cx-dark) 100%);}
.portal-auth-screen .portal-shape{position:absolute; border-radius:50%; background:rgba(254,211,39,.12); filter:blur(30px);}
.portal-auth-screen .s1{width:340px;height:340px;top:-80px;left:-60px;}
.portal-auth-screen .s2{width:260px;height:260px;bottom:-60px;right:-40px;background:rgba(255,255,255,.1);}
.card-mobile{max-width:430px; width:100%; border-radius:16px; background:rgba(255,255,255,.18); box-shadow:0 12px 30px rgba(0,0,0,.25); border:none; backdrop-filter:blur(6px);}
.portal-auth-screen .card-header{background:transparent; color:#fff; text-align:center; padding:1.75rem 1.5rem .5rem;}
.portal-auth-screen .card-header-brand{flex-direction:column; color:#fff;}
.portal-auth-screen .card-header-brand img{height:74px; margin-bottom:.6rem;}
.portal-auth-screen .form-section{padding:1.25rem 1.5rem 1.75rem;}
.portal-auth-screen .input-group{background:rgba(255,255,255,.9); border-radius:9999px; overflow:hidden;}
.portal-auth-screen .input-group input{border:none; background:transparent; padding:.6rem 1rem;}
.portal-auth-screen .input-group-text{background:#fff; color:var(--cx-dark); border:none;}
.portal-auth-screen .btn-portal-gradient{width:100%;}

/* Logo secundario (inferior) sobre fondo blanco */
.auth-bottom-logo{background:#fff; border-radius:12px; padding:10px 18px; display:inline-flex; align-items:center; box-shadow:0 2px 8px rgba(0,0,0,.12);}
.auth-bottom-logo img{height:32px;}
/* Enlaces de respaldo en auth (crear contraseña) */
.auth-links{display:flex; flex-direction:column; gap:.35rem; margin-top:1rem;}
.auth-links a{color:#fff; font-size:.85rem; text-decoration:none; opacity:.9;}
.auth-links a:hover{opacity:1; text-decoration:underline;}

/* Botón "ver contraseña" (ojo) — estilo común (login y formularios) */
.btn-eye{background:#fff; border:none; color:var(--cx-dark); cursor:pointer; padding:0 .85rem; display:inline-flex; align-items:center; border-radius:0 .6rem .6rem 0; z-index:3; flex:0 0 auto;}
.btn-eye:hover{color:#0d3a6b;}
/* Los inputs custom dentro de un input-group deben crecer en línea (ojo a la derecha) */
.input-group > .portal-input{flex:1 1 auto; width:1%;}
.input-group > .input-group-text{border-radius:.6rem 0 0 .6rem;}

/* ── Señal de entorno (APP_ENV) ───────────────────────────────────
   El portal NO pinta el sidebar; cambia el color del topbar (y del
   login) y muestra el badge de entorno. Producción no cambia. */
body.env-test .portal-topbar{ background:linear-gradient(135deg,#7a0f10,#E92E2F); }
body.env-local .portal-topbar{ background:linear-gradient(135deg,#000000,#2b2b2b); }
body.env-test .portal-auth-screen{ background:radial-gradient(150% 180% at 20% 120%,#5c0a0b 0%,#8f1416 35%,#E92E2F 60%,#c12628 85%,#5c0a0b 100%); }
body.env-local .portal-auth-screen{ background:radial-gradient(150% 180% at 20% 120%,#000000 0%,#111111 35%,#2b2b2b 60%,#1a1a1a 85%,#000000 100%); }

.env-badge{
  display:inline-block; padding:.15rem .5rem; font-size:.68rem; font-weight:700;
  letter-spacing:.04em; line-height:1.1; color:#fff; background:#E92E2F;
  border-radius:9999px; vertical-align:middle;
}
body.env-local .env-badge{background:#000000;}

/* ===================== Asistente IA (chat) ===================== */
.chat-app{padding:0; overflow:hidden;}
.chat-mobilebar{display:none;}
.chat-historial-backdrop{display:none;}
.chat-layout{display:grid; grid-template-columns:260px 1fr; height:calc(100vh - var(--cx-topbar-height) - 9rem); min-height:420px;}
.chat-side{border-right:1px solid var(--front-line); background:var(--cx-bg-surface); display:flex; flex-direction:column; min-height:0;}
.chat-side-head{display:flex; align-items:center; justify-content:space-between; gap:.5rem; padding:.75rem .85rem; border-bottom:1px solid var(--front-line);}
.chat-side-head .card-header-brand{min-width:0; flex:1 1 auto; overflow:hidden;}
.chat-side-head .card-header-brand > div{min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.chat-new{border-radius:9999px; display:inline-flex; align-items:center; flex:0 0 auto; white-space:nowrap;}
.chat-sesiones{overflow-y:auto; padding:.5rem; flex:1 1 auto;}
.chat-side-empty{padding:1rem; font-size:.85rem; color:var(--cx-text-secondary);}
.chat-sesion{display:flex; align-items:center; gap:.25rem; border-radius:.6rem; margin-bottom:.2rem;}
.chat-sesion.active{background:rgba(17,69,139,.1);}
.chat-sesion.cerrada .chat-sesion-title{opacity:.65;}
.chat-sesion-lock{font-size:.68rem; color:var(--cx-text-secondary); margin-left:.4rem;}
.chat-cerrada{display:flex; flex-direction:column; align-items:center; gap:.5rem; text-align:center; color:var(--cx-text-secondary); font-size:.85rem; padding:1rem .5rem;}
.chat-sesion-btn{display:flex; align-items:center; gap:.35rem; flex:1 1 auto; min-width:0; text-align:left; background:none; border:none; padding:.55rem .6rem; border-radius:.6rem; cursor:pointer;}
.chat-sesion-title{flex:1 1 auto; min-width:0; display:block; font-size:.88rem; color:var(--cx-text-primary); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.chat-sesion-del{flex:0 0 auto; background:none; border:none; color:var(--cx-text-secondary); padding:.4rem; border-radius:.5rem; cursor:pointer; opacity:0; transition:opacity var(--cx-transition);}
.chat-sesion:hover .chat-sesion-del{opacity:1;}
.chat-sesion-del:hover{color:var(--cx-danger); background:rgba(235,48,49,.08);}
.chat-main{display:flex; flex-direction:column; min-height:0;}
.chat-mensajes{flex:1 1 auto; overflow-y:auto; padding:1.1rem; display:flex; flex-direction:column; gap:.7rem; background:var(--cx-bg-app);}
.chat-msg{display:flex; gap:.5rem; align-items:flex-end;}
.chat-msg.user{justify-content:flex-start; flex-direction:row-reverse;}
.chat-msg.assistant{justify-content:flex-start;}
.chat-avatar{flex:0 0 auto; width:32px; height:32px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; font-size:.85rem; overflow:hidden;}
.chat-avatar-img{width:100%; height:100%; object-fit:cover; transform:scale(1.35); transform-origin:center; display:block;}
.chat-msg.assistant .chat-avatar{background:linear-gradient(135deg,var(--cx-dark),var(--cx-primary)); color:#fff;}
.chat-msg.user .chat-avatar{background:var(--cx-text-secondary); color:#fff;}
.chat-bubble{max-width:min(680px,82%); padding:.65rem .9rem; border-radius:14px; font-size:.94rem; line-height:1.45; white-space:pre-wrap; word-wrap:break-word;}
.chat-msg.user .chat-bubble{background:linear-gradient(135deg,var(--cx-dark),var(--cx-primary)); color:#fff; border-bottom-right-radius:4px;}
.chat-msg.assistant .chat-bubble{background:var(--cx-bg-surface); color:var(--cx-text-primary); border:1px solid var(--front-line); border-bottom-left-radius:4px; box-shadow:var(--cx-shadow-card);}
.chat-msg.error .chat-bubble{background:#fdecea; border-color:#f5c6c4; color:#8a1c1c;}
.chat-time{font-size:.68rem; color:var(--cx-text-secondary); margin-top:.3rem; text-align:left; opacity:.85;}
.chat-msg.user .chat-time{color:rgba(255,255,255,.82); text-align:right;}
.chat-bubble a{color:var(--cx-primary); font-weight:600; text-decoration:underline; word-break:break-word;}
.chat-bubble a:hover{text-decoration:none;}
.chat-bubble strong{font-weight:700;}
.chat-msg.user .chat-bubble a{color:#fff; text-decoration:underline;}
.chat-msg.user .chat-bubble strong{color:#fff;}
.chat-status{color:var(--cx-text-secondary); font-style:italic;}
.chat-chips{display:flex; flex-wrap:wrap; gap:.4rem; margin-top:.6rem;}
.chat-chip{border:1px solid var(--cx-primary); color:var(--cx-dark); background:var(--cx-bg-surface); border-radius:9999px; padding:.28rem .7rem; font-size:.8rem; cursor:pointer; transition:var(--cx-transition);}
.chat-chip:hover{background:var(--cx-primary); color:#fff;}
.chat-fb{display:flex; gap:.3rem; margin-top:.35rem; padding-left:.2rem; align-items:center; flex-wrap:wrap;}
.chat-msg.user .chat-fb{justify-content:flex-end;}
.chat-fb-btn{background:none; border:none; color:var(--cx-text-secondary); cursor:pointer; font-size:.85rem; padding:.1rem .25rem; border-radius:.4rem;}
.chat-fb-btn:hover{color:var(--cx-dark);}
.chat-fb-btn.sel{color:var(--cx-primary);}
.chat-msg.user .chat-fb-btn{color:rgba(255,255,255,.85);}
.chat-msg.user .chat-fb-btn:hover{color:#fff;}
.chat-msg.user .chat-fb-btn.sel{color:#ffe08a;}
.chat-fb-comment{display:flex; gap:.35rem; align-items:center; flex:1 1 100%; margin-top:.25rem;}
.chat-fb-comment input{flex:1 1 auto; min-width:0;}
.chat-fb-send{border:none; background:var(--cx-primary); color:#fff; border-radius:.5rem; padding:.3rem .6rem; font-size:.8rem; cursor:pointer; flex:0 0 auto;}
.chat-fb-send:hover{filter:brightness(1.08);}
.chat-help{display:flex; align-items:center; justify-content:space-between; gap:.5rem 1rem; flex-wrap:wrap; padding:.5rem 1rem; border-top:1px solid var(--front-line); background:var(--cx-bg-surface); font-size:.74rem; color:var(--cx-text-secondary);}
.chat-help-notes{display:flex; flex-direction:column; gap:.15rem; min-width:0;}
.chat-help-note{display:inline-flex; align-items:flex-start; gap:.4rem;}
.chat-help-note i{flex:0 0 auto; margin-top:.15rem;}
.chat-help-link{color:var(--cx-primary); font-weight:600; text-decoration:none; white-space:nowrap;}
.chat-help-link:hover{text-decoration:underline;}
.chat-inputbar{display:flex; gap:.6rem; align-items:flex-end; padding:.8rem 1rem; border-top:1px solid var(--front-line); background:var(--cx-bg-surface);}
/* Conversación cerrada: se oculta el área de envío (caja de texto + avisos). */
.chat-main.es-cerrada .chat-inputbar,
.chat-main.es-cerrada .chat-help{display:none;}
.chat-input{resize:none; overflow-y:auto; max-height:140px;}
.chat-send{border-radius:50%; width:44px; height:44px; flex:0 0 auto; display:inline-flex; align-items:center; justify-content:center; padding:0;}
@media (max-width:767.98px){
  /* Una columna: la conversación ocupa todo; el historial es un cajón que entra
     desde la DERECHA (se abre con el botón "Conversaciones"). El área de mensajes
     hace scroll y la barra de envío queda SIEMPRE visible. */
  .chat-layout{
    display:flex;
    flex-direction:column;
    grid-template-columns:none;
    height:calc(100vh - var(--cx-topbar-height) - 6.5rem);
    height:calc(100dvh - var(--cx-topbar-height) - 6.5rem);
  }
  .chat-main{flex:1 1 auto; min-height:0;}
  /* En el cajón (táctil) el botón de archivar se muestra siempre. */
  .chat-side .chat-sesion-del{opacity:1;}

  /* Barra con el botón que abre el historial */
  .chat-mobilebar{display:flex; align-items:center; justify-content:flex-end; gap:.5rem; padding:.5rem .7rem; border-bottom:1px solid var(--front-line); background:var(--cx-bg-surface);}
  .chat-mobilebar-btn{display:inline-flex; align-items:center; gap:.5rem; border:1px solid var(--front-line); background:transparent; color:var(--cx-text-primary); border-radius:9999px; padding:.4rem .8rem; font-size:.85rem; font-weight:600; cursor:pointer;}
  .chat-mobilebar-btn:hover{background:rgba(17,69,139,.06);}

  /* Historial como cajón (drawer) desde la derecha */
  .chat-side{
    position:fixed; top:var(--cx-topbar-height); right:0; bottom:0; left:auto;
    width:min(320px,85vw); max-height:none;
    border-left:1px solid var(--front-line); border-right:none; border-bottom:none;
    box-shadow:-10px 0 30px rgba(0,0,0,.2);
    transform:translateX(100%); transition:transform var(--cx-transition);
    z-index:1060;
  }
  body.chat-historial-open .chat-side{transform:translateX(0);}
  .chat-historial-backdrop{
    display:block; position:fixed; inset:var(--cx-topbar-height) 0 0 0; z-index:1050;
    background:rgba(10,16,26,.45); opacity:0; visibility:hidden; transition:opacity var(--cx-transition);
  }
  body.chat-historial-open .chat-historial-backdrop{opacity:1; visibility:visible;}

  .chat-mensajes{padding:.8rem;}
  .chat-bubble{max-width:90%;}
  .chat-help{padding:.35rem .65rem; font-size:.68rem; gap:.25rem; line-height:1.3;}
  .chat-inputbar{padding:.55rem .65rem;}
}

/* ====================== Animaciones sutiles ====================== */
@keyframes cx-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cx-icon-pop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes cx-soft-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(24,130,205,.18); }
  50%      { box-shadow: 0 0 0 6px rgba(24,130,205,0); }
}

@media (prefers-reduced-motion: no-preference) {
  .portal-card,
  .portal-mini,
  .soli-cta {
    animation: cx-fade-up .32s ease backwards;
  }
  .row > [class*="col-"]:nth-child(1) .portal-card,
  .row > [class*="col-"]:nth-child(1) .portal-mini { animation-delay: .02s; }
  .row > [class*="col-"]:nth-child(2) .portal-card,
  .row > [class*="col-"]:nth-child(2) .portal-mini { animation-delay: .05s; }
  .row > [class*="col-"]:nth-child(3) .portal-card,
  .row > [class*="col-"]:nth-child(3) .portal-mini { animation-delay: .08s; }
  .row > [class*="col-"]:nth-child(4) .portal-card,
  .row > [class*="col-"]:nth-child(4) .portal-mini { animation-delay: .11s; }
  .row > [class*="col-"]:nth-child(5) .portal-card,
  .row > [class*="col-"]:nth-child(5) .portal-mini { animation-delay: .14s; }
  .row > [class*="col-"]:nth-child(6) .portal-card,
  .row > [class*="col-"]:nth-child(6) .portal-mini { animation-delay: .17s; }

  .portal-dock-item { transition: transform .18s ease, background .18s ease; }
  .portal-dock-item:hover { transform: translateX(2px) scale(1.012); }
  .portal-dock-item:hover .portal-dock-icon { animation: cx-icon-pop .28s ease; }
  .portal-dock-item.active { animation: cx-soft-pulse 1.2s ease-out 1; }

  .portal-mini { transition: transform .18s ease, box-shadow .18s ease; }
  .portal-mini:hover { transform: translateY(-3px); box-shadow: var(--cx-shadow-card), 0 10px 24px rgba(17,69,139,.16); }

  .btn-portal-gradient,
  .btn-portal-outline,
  .btn-portal-accent { transition: transform .16s ease, box-shadow .16s ease, filter .16s ease; }
  .btn-portal-gradient:hover,
  .btn-portal-outline:hover,
  .btn-portal-accent:hover { transform: translateY(-1px); }
  .btn-notif:hover { transform: rotate(-8deg) scale(1.06); }
  .chat-chip { transition: transform .16s ease, background .16s ease, color .16s ease; }
  .chat-chip:hover { transform: translateY(-1px) scale(1.02); }
  .mini-icon { transition: transform .18s ease, box-shadow .18s ease; }
  .portal-mini:hover .mini-icon,
  a:hover > .mini-icon { transform: scale(1.06) rotate(-2deg); }
}
