/* ==========================================================================
   WaiCRM — Sistema visual
   Marca: verde azulado (confianza + WhatsApp) sobre neutros fríos.
   Modo claro/oscuro con [data-bs-theme] de Bootstrap 5.3.
   ========================================================================== */
:root {
  --wai-brand: #0E7C66;
  --wai-brand-600: #0B6655;
  --wai-brand-50: #E7F4F1;
  --wai-accent: #F59E0B;
  --wai-bg: #F4F6F8;
  --wai-surface: #FFFFFF;
  --wai-surface-2: #F9FAFB;
  --wai-border: #E3E8EE;
  --wai-text: #1B2631;
  --wai-muted: #6B7785;
  --wai-sidebar: #0F1E1A;
  --wai-sidebar-text: #B7C6C1;
  --wai-sidebar-active: #1B3A33;
  --wai-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 4px 16px rgba(16, 24, 40, .06);
  --wai-radius: 14px;
  --wai-sidebar-w: 264px;
  --wai-sidebar-w-collapsed: 76px;
  --wai-topbar-h: 64px;
  --bs-primary: #0E7C66;
  --bs-primary-rgb: 14, 124, 102;
  --bs-link-color: #0E7C66;
  --bs-link-color-rgb: 14, 124, 102;
  --bs-body-font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
[data-bs-theme="dark"] {
  --wai-bg: #0D1417;
  --wai-surface: #141D21;
  --wai-surface-2: #182328;
  --wai-border: #253238;
  --wai-text: #E4ECEA;
  --wai-muted: #8FA09B;
  --wai-brand-50: #12302A;
  --wai-sidebar: #0A1012;
  --wai-sidebar-active: #173029;
  --wai-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
  --bs-body-bg: #0D1417;
  --bs-body-color: #E4ECEA;
  --bs-border-color: #253238;
  --bs-primary: #22A68A;
  --bs-primary-rgb: 34, 166, 138;
  --bs-link-color: #3CC4A6;
  --bs-link-color-rgb: 60, 196, 166;
}

html, body { min-height: 100%; }
body { background: var(--wai-bg); color: var(--wai-text); font-size: .95rem; }
a { text-decoration: none; }
.text-muted, .wai-muted { color: var(--wai-muted) !important; }

/* Botones de marca ------------------------------------------------------- */
.btn-primary {
  --bs-btn-bg: var(--wai-brand); --bs-btn-border-color: var(--wai-brand);
  --bs-btn-hover-bg: var(--wai-brand-600); --bs-btn-hover-border-color: var(--wai-brand-600);
  --bs-btn-active-bg: var(--wai-brand-600); --bs-btn-active-border-color: var(--wai-brand-600);
  --bs-btn-disabled-bg: var(--wai-brand); --bs-btn-disabled-border-color: var(--wai-brand);
}
.btn-outline-primary {
  --bs-btn-color: var(--wai-brand); --bs-btn-border-color: var(--wai-brand);
  --bs-btn-hover-bg: var(--wai-brand); --bs-btn-hover-border-color: var(--wai-brand);
  --bs-btn-active-bg: var(--wai-brand-600);
}
[data-bs-theme="dark"] .btn-outline-primary { --bs-btn-color: #3CC4A6; --bs-btn-border-color: #3CC4A6; }
.btn { border-radius: 10px; font-weight: 500; }
.btn-icon { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.form-control, .form-select { border-radius: 10px; border-color: var(--wai-border); background-color: var(--wai-surface); }
.form-control:focus, .form-select:focus { border-color: var(--wai-brand); box-shadow: 0 0 0 .2rem rgba(14, 124, 102, .15); }
.form-label { font-weight: 600; font-size: .85rem; margin-bottom: .35rem; }
.form-check-input:checked { background-color: var(--wai-brand); border-color: var(--wai-brand); }

/* Tarjetas --------------------------------------------------------------- */
.wai-card {
  background: var(--wai-surface); border: 1px solid var(--wai-border);
  border-radius: var(--wai-radius); box-shadow: var(--wai-shadow);
}
.wai-card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--wai-border); display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.wai-card-body { padding: 1.25rem; }
.wai-card-title { font-size: 1rem; font-weight: 600; margin: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.page-head h1 { font-size: 1.4rem; font-weight: 700; margin: 0; }
.page-head p { margin: .2rem 0 0; color: var(--wai-muted); }

/* Indicadores ------------------------------------------------------------ */
.stat { padding: 1.1rem 1.25rem; display: flex; gap: 1rem; align-items: center; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; flex-shrink: 0; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--wai-muted); font-size: .82rem; }
.tone-green { background: #E3F5EF; color: #0E7C66; }
.tone-blue { background: #E6EEFE; color: #2563EB; }
.tone-amber { background: #FEF3DC; color: #B45309; }
.tone-rose { background: #FDE7EF; color: #BE185D; }
.tone-violet { background: #F1E8FD; color: #7E22CE; }
[data-bs-theme="dark"] .tone-green { background: #12302A; color: #3CC4A6; }
[data-bs-theme="dark"] .tone-blue { background: #172544; color: #7AA2F7; }
[data-bs-theme="dark"] .tone-amber { background: #33270F; color: #F5B54A; }
[data-bs-theme="dark"] .tone-rose { background: #3A1626; color: #F38AB3; }
[data-bs-theme="dark"] .tone-violet { background: #2A1A3D; color: #C49BF5; }

.bar-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: .75rem; align-items: center; margin-bottom: .6rem; font-size: .85rem; }
.bar-track { height: 10px; background: var(--wai-surface-2); border: 1px solid var(--wai-border); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--wai-brand), #22C3A0); border-radius: 99px; transition: width .6s ease; }

/* Listas responsivas (reemplazo de tablas) -------------------------------- */
.wai-list { display: flex; flex-direction: column; }
.wai-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center;
  padding: .85rem 1.25rem; border-bottom: 1px solid var(--wai-border);
}
.wai-row:last-child { border-bottom: 0; }
.wai-row:hover { background: var(--wai-surface-2); }
.wai-row .meta { color: var(--wai-muted); font-size: .82rem; }
.wai-empty { text-align: center; padding: 3rem 1rem; color: var(--wai-muted); }
.wai-empty i { font-size: 2.5rem; display: block; margin-bottom: .5rem; opacity: .6; }

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--wai-surface-2); }
.avatar-lg { width: 84px; height: 84px; }
.avatar-sm { width: 30px; height: 30px; }

.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .6rem; border-radius: 99px; font-size: .74rem; font-weight: 600; }
.stage-nuevo { background: #E6EEFE; color: #1D4ED8; }
.stage-interesado { background: #FEF3DC; color: #B45309; }
.stage-negociacion { background: #F1E8FD; color: #7E22CE; }
.stage-cliente { background: #E3F5EF; color: #0E7C66; }
.stage-perdido { background: #F1F3F5; color: #6B7785; }
[data-bs-theme="dark"] .stage-nuevo { background: #172544; color: #7AA2F7; }
[data-bs-theme="dark"] .stage-interesado { background: #33270F; color: #F5B54A; }
[data-bs-theme="dark"] .stage-negociacion { background: #2A1A3D; color: #C49BF5; }
[data-bs-theme="dark"] .stage-cliente { background: #12302A; color: #3CC4A6; }
[data-bs-theme="dark"] .stage-perdido { background: #1E272B; color: #8FA09B; }

/* Grilla de tarjetas con imagen ------------------------------------------ */
.media-card { overflow: hidden; height: 100%; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.media-card:hover { transform: translateY(-2px); }
.media-card .cover { aspect-ratio: 16/10; width: 100%; object-fit: cover; background: var(--wai-surface-2); }
.media-card .body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: .4rem; }
.contact-card { padding: 1.1rem; text-align: center; height: 100%; display: flex; flex-direction: column; align-items: center; gap: .35rem; cursor: pointer; }
.contact-card:hover { border-color: var(--wai-brand); }

/* ==========================================================================
   Shell: sidebar + topbar
   ========================================================================== */
.wai-shell { min-height: 100vh; }
.wai-sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--wai-sidebar-w); background: var(--wai-sidebar);
  color: var(--wai-sidebar-text); display: flex; flex-direction: column; z-index: 1040;
  transition: width .22s ease, transform .22s ease;
}
.wai-brand { height: var(--wai-topbar-h); display: flex; align-items: center; gap: .7rem; padding: 0 1.1rem; color: #fff; font-weight: 700; font-size: 1.1rem; border-bottom: 1px solid rgba(255,255,255,.06); white-space: nowrap; overflow: hidden; }
.wai-brand-logo { width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #22C3A0, #0E7C66); display: grid; place-items: center; flex-shrink: 0; overflow: hidden; }
.wai-brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.wai-nav { flex: 1; overflow-y: auto; padding: .75rem .6rem 1rem; }
.wai-nav::-webkit-scrollbar { width: 6px; }
.wai-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 6px; }
.wai-group { margin-bottom: .25rem; }
.wai-group-btn {
  width: 100%; display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; border: 0; background: transparent;
  color: var(--wai-sidebar-text); border-radius: 10px; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600;
}
.wai-group-btn:hover { color: #fff; background: rgba(255,255,255,.04); }
.wai-group-btn .chev { margin-left: auto; transition: transform .2s; font-size: .75rem; }
.wai-group.open .wai-group-btn .chev { transform: rotate(90deg); }
.wai-group.open .wai-group-btn { color: #fff; }
.wai-group-items { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.wai-group.open .wai-group-items { grid-template-rows: 1fr; }
.wai-group-items > div { overflow: hidden; }
.wai-link {
  display: flex; align-items: center; gap: .75rem; padding: .58rem .75rem .58rem 1rem; margin: .1rem 0; border-radius: 10px;
  color: var(--wai-sidebar-text); white-space: nowrap; font-size: .92rem;
}
.wai-link i { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }
.wai-link:hover { color: #fff; background: rgba(255,255,255,.05); }
.wai-link.active { background: var(--wai-sidebar-active); color: #fff; box-shadow: inset 3px 0 0 #22C3A0; }
.wai-sidebar-foot { padding: .75rem; border-top: 1px solid rgba(255,255,255,.06); font-size: .78rem; white-space: nowrap; overflow: hidden; }

.wai-main { margin-left: var(--wai-sidebar-w); transition: margin-left .22s ease; min-height: 100vh; display: flex; flex-direction: column; }
.wai-topbar {
  height: var(--wai-topbar-h); position: sticky; top: 0; z-index: 1030; display: flex; align-items: center; gap: .75rem;
  padding: 0 1.25rem; background: color-mix(in srgb, var(--wai-surface) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--wai-border);
}
.wai-topbar .crumb { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wai-content { padding: 1.5rem; flex: 1; width: 100%; }
.wai-loader { display: flex; align-items: center; justify-content: center; min-height: 40vh; color: var(--wai-muted); }

/* Sidebar colapsado (solo escritorio) */
@media (min-width: 992px) {
  body.sb-collapsed .wai-sidebar { width: var(--wai-sidebar-w-collapsed); }
  body.sb-collapsed .wai-main { margin-left: var(--wai-sidebar-w-collapsed); }
  body.sb-collapsed .wai-brand span,
  body.sb-collapsed .wai-group-btn span, body.sb-collapsed .wai-group-btn .chev,
  body.sb-collapsed .wai-link span, body.sb-collapsed .wai-sidebar-foot { display: none; }
  body.sb-collapsed .wai-group-btn { justify-content: center; padding: .55rem 0; }
  body.sb-collapsed .wai-link { justify-content: center; padding: .6rem 0; }
  body.sb-collapsed .wai-group-items { grid-template-rows: 1fr; }
  body.sb-collapsed .wai-group-btn { display: none; }
  body.sb-collapsed .wai-group + .wai-group { border-top: 1px solid rgba(255,255,255,.06); padding-top: .25rem; }
}

.wai-backdrop { display: none; }
@media (max-width: 991.98px) {
  .wai-sidebar { transform: translateX(-100%); width: 280px; }
  .wai-main { margin-left: 0; }
  body.sb-open .wai-sidebar { transform: none; }
  body.sb-open .wai-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1035; }
  .wai-content { padding: 1rem; }
}

/* ==========================================================================
   Login a pantalla completa
   ========================================================================== */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at 10% 10%, #1BA585 0%, transparent 55%), radial-gradient(900px 500px at 90% 90%, #0A4D40 0%, transparent 60%), #0B3B32;
}
.auth-hero h1 { font-size: clamp(1.8rem, 3vw, 2.7rem); font-weight: 800; line-height: 1.15; max-width: 560px; }
.auth-hero p { color: #CDE7E0; max-width: 520px; font-size: 1.05rem; }
.auth-hero .feat { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; }
.auth-hero .feat i { background: rgba(255,255,255,.12); width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 1.2rem; flex-shrink: 0; }
.auth-hero .bubble { position: absolute; border-radius: 50%; background: rgba(255,255,255,.05); }
.chat-mock { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 18px; padding: 1rem; max-width: 420px; backdrop-filter: blur(6px); }
.chat-mock .m { padding: .55rem .8rem; border-radius: 12px; margin-bottom: .5rem; font-size: .88rem; max-width: 85%; }
.chat-mock .m.in { background: rgba(255,255,255,.92); color: #13332C; }
.chat-mock .m.out { background: #22C3A0; color: #062E25; margin-left: auto; }
.auth-panel { background: var(--wai-surface); display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; }
.auth-form { width: 100%; max-width: 440px; }
.auth-form h2 { font-weight: 800; font-size: 1.65rem; }
.auth-form .form-control { padding: .7rem .9rem; }
.input-icon { position: relative; }
.input-icon > i { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--wai-muted); }
.input-icon > .form-control { padding-left: 2.5rem; }
.input-icon > .toggle-pass { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--wai-muted); padding: .4rem .6rem; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: .6rem; border: 1px solid var(--wai-border); background: var(--wai-surface); color: var(--wai-text); padding: .65rem; border-radius: 10px; font-weight: 600; width: 100%; }
.social-btn:hover { background: var(--wai-surface-2); }
.divider { display: flex; align-items: center; gap: .75rem; color: var(--wai-muted); font-size: .8rem; margin: 1.25rem 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--wai-border); }
.auth-view { display: none; animation: fadeUp .25s ease; }
.auth-view.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 991.98px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 1.75rem 1.5rem; min-height: auto; }
  .auth-hero .hide-sm { display: none !important; }
  .auth-panel { padding: 1.75rem 1.25rem 2.5rem; align-items: flex-start; }
}

/* ==========================================================================
   Wizard
   ========================================================================== */
.wiz-top { background: var(--wai-surface); border-bottom: 1px solid var(--wai-border); }
.wiz-container { max-width: 980px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.stepper { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: 1.25rem 0 1.75rem; }
.step-pill { position: relative; padding: .8rem .9rem; border-radius: 12px; border: 1px solid var(--wai-border); background: var(--wai-surface); display: flex; gap: .7rem; align-items: center; }
.step-pill .num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--wai-surface-2); border: 1px solid var(--wai-border); flex-shrink: 0; }
.step-pill .t { font-weight: 600; font-size: .9rem; line-height: 1.2; }
.step-pill .s { font-size: .74rem; color: var(--wai-muted); }
.step-pill.done .num { background: var(--wai-brand); color: #fff; border-color: var(--wai-brand); }
.step-pill.current { border-color: var(--wai-brand); box-shadow: 0 0 0 3px rgba(14,124,102,.12); }
.step-pill.current .num { background: var(--wai-brand-50); color: var(--wai-brand); border-color: var(--wai-brand); }
.step-pill.locked { opacity: .55; }
.wiz-progress { height: 6px; background: var(--wai-border); border-radius: 99px; overflow: hidden; }
.wiz-progress > div { height: 100%; background: linear-gradient(90deg, var(--wai-brand), #22C3A0); transition: width .5s ease; }
.wiz-panel { animation: fadeUp .3s ease; }
.help-box { background: var(--wai-brand-50); border: 1px dashed color-mix(in srgb, var(--wai-brand) 40%, transparent); border-radius: 12px; padding: 1rem 1.1rem; font-size: .88rem; }
.help-box ol { margin: .4rem 0 0; padding-left: 1.1rem; }
.copy-field { display: flex; gap: .5rem; }
.copy-field .form-control { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--wai-accent); display: inline-block; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(245,158,11,.6); } 70% { box-shadow: 0 0 0 10px rgba(245,158,11,0); } 100% { box-shadow: 0 0 0 0 rgba(245,158,11,0); } }
.success-hero { text-align: center; padding: 2rem 1rem 1rem; }
.success-hero .big { width: 84px; height: 84px; border-radius: 50%; background: var(--wai-brand-50); color: var(--wai-brand); display: grid; place-items: center; font-size: 2.6rem; margin: 0 auto 1rem; }
@media (max-width: 767.98px) {
  .stepper { grid-template-columns: repeat(4, 1fr); }
  .step-pill { flex-direction: column; text-align: center; padding: .6rem .3rem; gap: .35rem; }
  .step-pill .s { display: none; }
  .step-pill .t { font-size: .72rem; }
}

/* ==========================================================================
   CRM / Chat
   ========================================================================== */
.crm-wrap { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - var(--wai-topbar-h) - 3rem); min-height: 520px; overflow: hidden; }
.crm-list { border-right: 1px solid var(--wai-border); display: flex; flex-direction: column; min-height: 0; }
.crm-list-head { padding: .9rem; border-bottom: 1px solid var(--wai-border); display: flex; flex-direction: column; gap: .6rem; }
.crm-filters { display: flex; gap: .35rem; overflow-x: auto; }
.crm-filters .btn { white-space: nowrap; font-size: .78rem; padding: .25rem .65rem; border-radius: 99px; }
.crm-items { flex: 1; overflow-y: auto; }
.conv-item { display: grid; grid-template-columns: auto 1fr auto; gap: .7rem; padding: .8rem .9rem; border-bottom: 1px solid var(--wai-border); cursor: pointer; align-items: center; }
.conv-item:hover { background: var(--wai-surface-2); }
.conv-item.active { background: var(--wai-brand-50); }
.conv-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .prev { color: var(--wai-muted); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-item .time { font-size: .72rem; color: var(--wai-muted); text-align: right; }
.badge-unread { background: var(--wai-brand); color: #fff; border-radius: 99px; font-size: .7rem; padding: .1rem .45rem; font-weight: 700; }
.crm-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { padding: .75rem 1rem; border-bottom: 1px solid var(--wai-border); display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.chat-body {
  flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: .45rem;
  background-color: var(--wai-surface-2);
  background-image: radial-gradient(color-mix(in srgb, var(--wai-border) 70%, transparent) 1px, transparent 1px);
  background-size: 18px 18px;
}
.msg { max-width: min(78%, 620px); padding: .55rem .8rem .35rem; border-radius: 14px; box-shadow: 0 1px 1px rgba(0,0,0,.05); word-wrap: break-word; font-size: .92rem; }
.msg .txt { white-space: pre-wrap; }
.msg.in { background: var(--wai-surface); align-self: flex-start; border-top-left-radius: 4px; }
.msg.out { background: #D9F7EC; align-self: flex-end; border-top-right-radius: 4px; color: #0F2C25; }
.msg.out.ai { background: #E3EDFF; color: #12234A; }
[data-bs-theme="dark"] .msg.out { background: #145244; color: #E5FFF7; }
[data-bs-theme="dark"] .msg.out.ai { background: #1E3260; color: #E3EBFF; }
.msg .foot { font-size: .7rem; opacity: .7; text-align: right; margin-top: .15rem; display: flex; gap: .35rem; justify-content: flex-end; align-items: center; }
.msg img { max-width: 260px; border-radius: 10px; display: block; margin-bottom: .3rem; }
.msg.failed { outline: 1px solid #DC3545; }
.msg-note { align-self: center; background: #FFF4D6; color: #7A4B00; font-size: .78rem; padding: .3rem .8rem; border-radius: 99px; text-align: center; }
[data-bs-theme="dark"] .msg-note { background: #3A2E10; color: #F5D38A; }
.day-sep { align-self: center; font-size: .72rem; background: var(--wai-surface); border: 1px solid var(--wai-border); padding: .15rem .7rem; border-radius: 99px; color: var(--wai-muted); margin: .4rem 0; }
.chat-compose { border-top: 1px solid var(--wai-border); padding: .75rem; display: flex; gap: .5rem; align-items: flex-end; background: var(--wai-surface); }
.chat-compose textarea { resize: none; max-height: 140px; }
.chat-empty { flex: 1; display: grid; place-items: center; color: var(--wai-muted); text-align: center; padding: 2rem; }
.crm-back { display: none; }
@media (max-width: 991.98px) {
  .crm-wrap { grid-template-columns: 1fr; height: calc(100vh - var(--wai-topbar-h) - 2rem); }
  .crm-wrap.show-chat .crm-list { display: none; }
  .crm-wrap:not(.show-chat) .crm-chat { display: none; }
  .crm-back { display: inline-flex; }
}

/* Asistente IA interno */
.copilot-body { height: 52vh; min-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; padding: 1rem; background: var(--wai-surface-2); border-radius: 12px; }

/* Utilidades ------------------------------------------------------------- */
.mono { font-family: ui-monospace, Consolas, monospace; }
.cursor-pointer { cursor: pointer; }
.img-drop { border: 2px dashed var(--wai-border); border-radius: 14px; padding: 1rem; text-align: center; cursor: pointer; position: relative; }
.img-drop img { max-height: 160px; max-width: 100%; border-radius: 10px; object-fit: cover; }
.img-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swal2-popup { border-radius: 16px !important; font-family: var(--bs-body-font-family) !important; }
[data-bs-theme="dark"] .swal2-popup { background: var(--wai-surface) !important; color: var(--wai-text) !important; }
[data-bs-theme="dark"] .swal2-title, [data-bs-theme="dark"] .swal2-html-container { color: var(--wai-text) !important; }
.select2-container--bootstrap-5 .select2-selection { border-radius: 10px; border-color: var(--wai-border); min-height: calc(1.5em + .75rem + 2px); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection,
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown { background-color: var(--wai-surface); color: var(--wai-text); border-color: var(--wai-border); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered { color: var(--wai-text); }
[data-bs-theme="dark"] .select2-container--bootstrap-5 .select2-dropdown .select2-results__options .select2-results__option.select2-results__option--highlighted { background: var(--wai-sidebar-active); color: #fff; }
.modal-content { border-radius: 16px; border-color: var(--wai-border); background: var(--wai-surface); }
.tox-tinymce { border-radius: 10px !important; }
.portal-hero { background: linear-gradient(135deg, #0B3B32, #0E7C66); color: #fff; border-radius: var(--wai-radius); padding: 1.5rem; }
