/* SIEM Chat — hoja de estilos única
   Tipografía: Plus Jakarta Sans. Cada sección tiene su color (--accent). */
:root {
  --bg: #F5F6FA; --surface: #FFFFFF; --surface-2: #F8FAFC; --border: #E5E8EF; --border-2: #D7DCE5;
  --text: #0F172A; --text-2: #334155; --muted: #64748B;
  --side: #0B1220; --side-2: #121B2E; --side-text: #B6C0D3;
  --accent: #2563EB; --ok: #16A34A; --warn: #D97706; --bad: #DC2626;
  --radius: 12px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 4px 16px rgba(15,23,42,.06);
  --bubble-in: #FFFFFF; --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
[data-theme="dark"] {
  --bg: #0B1020; --surface: #121a2c; --surface-2: #0f1626; --border: #222c42; --border-2: #2d3954;
  --text: #E7ECF5; --text-2: #C3CCDB; --muted: #8A96AD; --bubble-in: #19233a;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; display: flex; }
a { color: inherit; text-decoration: none; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 12.5px; border: 1px solid var(--border); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; }
.muted { color: var(--muted); }
.ic { flex-shrink: 0; }

/* ---------- Barra lateral ---------- */
.sidebar { width: 248px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; flex-shrink: 0; height: 100vh; position: sticky; top: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; color: #fff; }
.brand-txt { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.brand-txt b { font-size: 18px; font-weight: 800; letter-spacing: -.03em; }
.brand-txt b i, .brand-i { font-style: normal; background: linear-gradient(90deg, #22C55E, #0EA5E9 60%, #818CF8); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-txt small { color: var(--side-text); font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-logo { flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(14,165,233,.35)); }
.logo-dot { width: 26px; height: 26px; border-radius: 8px; background: conic-gradient(from 210deg, #2563EB, #7C3AED, #DB2777, #EA580C, #16A34A, #2563EB); display: inline-block; box-shadow: inset 0 0 0 5px rgba(255,255,255,.18); }
nav { flex: 1; overflow-y: auto; padding: 4px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; font-weight: 600; font-size: 13.5px; transition: background .15s, color .15s; }
.nav-item .nav-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.nav-item:hover { background: var(--side-2); color: #fff; }
.nav-item.active { background: color-mix(in srgb, var(--c) 22%, var(--side)); color: #fff; }
.nav-item.active .nav-ic { background: var(--c); color: #fff; }
.nav-item .pill { margin-left: auto; }
.side-foot { border-top: 1px solid #1c2740; padding: 12px; display: flex; align-items: center; gap: 8px; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.me b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me small { color: var(--side-text); font-size: 11.5px; }
.side-foot .icon-btn { color: var(--side-text); }

/* ---------- Estructura principal ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
.topbar { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.page-title { font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 12px; }
.title-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.content { flex: 1; overflow-y: auto; padding: 24px; }
body[data-page="inbox"] .content { padding: 0; overflow: hidden; }
.only-mobile { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.card-h h3 { flex: 1; }
.card-b { padding: 18px; }
.grid { display: grid; gap: 16px; grid-template-columns: minmax(0,1fr); }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }

.btn { font: inherit; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text); cursor: pointer; transition: filter .15s, background .15s; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 36px; height: 36px; border: 0; background: transparent; border-radius: 9px; display: inline-grid; place-items: center; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.on { color: #F59E0B; }

input, select, textarea { font: inherit; font-weight: 500; font-size: 13.5px; color: var(--text); background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 9px 12px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { resize: vertical; min-height: 80px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span2 { grid-column: span 2; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }

.pill { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); white-space: nowrap; }
.pill.red { background: var(--bad); color: #fff; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.u0 { color: var(--ok); } .u1 { color: #0EA5E9; } .u2 { color: var(--warn); } .u3 { color: var(--bad); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 12.5px; flex-shrink: 0; background: #94A3B8; }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 48px 20px; }
.empty .ic { width: 40px; height: 40px; color: var(--accent); opacity: .6; margin-bottom: 8px; }

.stat { padding: 18px; border-top: 3px solid var(--accent); }
.stat small { color: var(--muted); font-weight: 600; font-size: 12px; }
.stat b { display: block; font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat em { font-style: normal; font-size: 12px; color: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; flex-direction: row; font-weight: 600; }
.switch input { display: none; }
.switch span { width: 36px; height: 20px; border-radius: 999px; background: var(--border-2); position: relative; transition: background .2s; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch em { font-style: normal; font-size: 12.5px; color: var(--muted); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-weight: 600; transition: transform .25s; z-index: 99; box-shadow: var(--shadow); }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--bad); color: #fff; }
.modal { position: fixed; inset: 0; background: rgba(2,6,23,.55); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 16px; width: min(640px, 100%); max-height: 90vh; overflow-y: auto; padding: 24px; position: relative; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-box h3 { margin-bottom: 16px; font-size: 17px; }
.modal-x { position: absolute; top: 14px; right: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.ok-box, .err-box, .info-box { padding: 12px 14px; border-radius: 10px; margin: 10px 0; font-weight: 600; display: flex; gap: 8px; align-items: flex-start; }
.ok-box { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.err-box { background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); }
.info-box { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text-2); font-weight: 500; }

/* ---------- Login / instalador ---------- */
.auth-page { align-items: center; justify-content: center; background: radial-gradient(circle at 20% 10%, #1e3a8a 0, transparent 40%), radial-gradient(circle at 80% 90%, #7C3AED 0, transparent 35%), #0B1220; padding: 24px; overflow-y: auto; }
.auth-card { background: var(--surface); width: min(400px, 100%); padding: 32px; border-radius: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.35); margin: auto; }
.auth-card.wide { width: min(720px, 100%); }
.brand-lg { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; letter-spacing: -.02em; }
.brand-lg small { font-size: 13px; color: var(--muted); font-weight: 600; }
.checks { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.checks li { display: flex; gap: 8px; align-items: center; }
.checks .ok { color: var(--ok); } .checks .bad { color: var(--bad); }

/* ---------- Bandeja ---------- */
.inbox { display: grid; grid-template-columns: 210px 340px minmax(0,1fr) 320px; height: 100%; }
.inbox > div { min-height: 0; }
.folders { border-right: 1px solid var(--border); padding: 14px 10px; overflow-y: auto; background: var(--surface); }
.folder { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; cursor: pointer; font-weight: 600; color: var(--text-2); font-size: 13px; }
.folder:hover { background: var(--surface-2); }
.folder.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.folder .n { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.folder-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 14px 10px 6px; }
.convs { border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--surface); }
.convs-h { padding: 12px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.seg { display: flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 12.5px; padding: 6px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.conv-list { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; position: relative; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.conv.active::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.conv .meta { flex: 1; min-width: 0; }
.conv .row1 { display: flex; gap: 6px; align-items: center; }
.conv .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.conv .time { font-size: 11.5px; color: var(--muted); }
.conv .prev { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.conv .row3 { display: flex; gap: 6px; margin-top: 6px; align-items: center; flex-wrap: wrap; }
.conv .unread { background: var(--accent); color: #fff; min-width: 20px; height: 20px; border-radius: 999px; font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.chan-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chat { display: flex; flex-direction: column; background: var(--bg); }
.chat-h { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.chat-h .who { flex: 1; min-width: 0; }
.chat-h .who b, .chat-h .who small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-h .who small { color: var(--muted); }
.chat-h select { width: auto; height: 34px; padding: 0 10px; }
.msgs { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 6px; background-image: radial-gradient(color-mix(in srgb, var(--border) 70%, transparent) 1px, transparent 1px); background-size: 18px 18px; }
.day { align-self: center; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface); padding: 3px 10px; border-radius: 999px; margin: 10px 0; border: 1px solid var(--border); }
.bubble { max-width: min(72%, 560px); padding: 9px 12px 6px; border-radius: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 1px 1px rgba(15,23,42,.06); }
.bubble.in { background: var(--bubble-in); align-self: flex-start; border-top-left-radius: 4px; border: 1px solid var(--border); }
.bubble.out { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); align-self: flex-end; border-top-right-radius: 4px; }
.bubble.out.bot { background: color-mix(in srgb, #7C3AED 12%, var(--surface)); }
.bubble.note { background: #FEF3C7; color: #78350F; align-self: flex-end; border: 1px dashed #F59E0B; }
.bubble .ft { display: flex; justify-content: flex-end; gap: 6px; font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.bubble .ft .read { color: #0EA5E9; }
.bubble .ft .failed { color: var(--bad); }
.bubble img, .bubble video { max-width: 260px; border-radius: 10px; display: block; margin-bottom: 4px; }
.bubble audio { max-width: 260px; }
.sysmsg { align-self: center; font-size: 12px; color: var(--muted); text-align: center; max-width: 80%; }
.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 14px; }
.composer .tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.composer .tabs button { border: 0; background: transparent; font: inherit; font-weight: 600; font-size: 12.5px; padding: 5px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); }
.composer .tabs button.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.composer .tabs button[data-mode="note"].active { background: #FEF3C7; color: #92400E; }
.composer .box { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 44px; max-height: 160px; resize: none; }
.composer .warn { font-size: 12.5px; color: var(--warn); margin-bottom: 8px; display: flex; gap: 6px; align-items: center; }
.qr-pop { position: absolute; bottom: 100%; left: 14px; right: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); max-height: 240px; overflow-y: auto; }
.qr-pop div { padding: 8px 12px; cursor: pointer; }
.qr-pop div:hover, .qr-pop div.sel { background: var(--surface-2); }
.qr-pop b { color: var(--accent); margin-right: 8px; }
.side-panel { border-left: 1px solid var(--border); background: var(--surface); overflow-y: auto; }
.sp-sec { padding: 16px; border-bottom: 1px solid var(--border); }
.sp-sec h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.ai-card { border: 1px solid color-mix(in srgb, #4F46E5 30%, var(--border)); background: color-mix(in srgb, #4F46E5 6%, var(--surface)); border-radius: 12px; padding: 12px; }
.ai-card p { margin: 0 0 8px; line-height: 1.5; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; font-size: 13px; align-items: center; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; }
.kv select, .kv input { padding: 5px 8px; height: 30px; font-size: 12.5px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; color: #fff; }
.tag button { border: 0; background: none; color: inherit; cursor: pointer; padding: 0; opacity: .8; }
.note-item { background: #FFFBEB; border: 1px solid #FDE68A; color: #78350F; border-radius: 10px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 8px; }
.note-item small { display: block; opacity: .7; margin-top: 4px; }
.chat-empty { display: grid; place-items: center; height: 100%; color: var(--muted); text-align: center; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.kcol { width: 280px; flex-shrink: 0; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; display: flex; flex-direction: column; max-height: calc(100vh - 200px); }
.kcol-h { padding: 12px 14px; display: flex; align-items: center; gap: 8px; font-weight: 700; border-top: 4px solid var(--c); border-radius: 14px 14px 0 0; }
.kcol-h .sum { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 600; }
.kcards { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: var(--shadow); }
.kcard b { display: block; }
.kcard small { color: var(--muted); }
.kcard.dragging { opacity: .5; }
.kcards.over { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 10px; }

/* ---------- Flujos ---------- */
.steps { display: flex; flex-direction: column; gap: 10px; }
.step { border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 10px; padding: 12px; background: var(--surface); }
.step-h { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 700; }
.step-h .num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 11px; }
.step-h .sp { flex: 1; }
.opt-row { display: grid; grid-template-columns: 1fr 180px 34px; gap: 6px; margin-top: 6px; }

/* ---------- Barras de analítica ---------- */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 80px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.bar-row .fill { height: 100%; background: var(--accent); border-radius: 999px; }
.bar-row .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.spark div { flex: 1; background: color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 5px 5px 0 0; min-height: 2px; position: relative; }
.spark div:hover::after { content: attr(data-l); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-size: 11px; padding: 2px 6px; border-radius: 5px; white-space: nowrap; }
.spark-x { display: flex; gap: 4px; font-size: 10.5px; color: var(--muted); margin-top: 6px; }
.spark-x span { flex: 1; text-align: center; }

/* ---------- Responsive ---------- */
#folderSel { display: none; }
@media (max-width: 1560px) { .inbox { grid-template-columns: 320px minmax(0,1fr) 300px; } .folders { display: none; } #folderSel { display: block; } }
@media (max-width: 1080px) { .inbox { grid-template-columns: 300px minmax(0,1fr); } .side-panel { display: none; } .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) {
  .sidebar { position: fixed; left: -260px; z-index: 40; transition: left .2s; }
  .sidebar.open { left: 0; }
  .only-mobile { display: inline-grid; }
  .content { padding: 16px; }
  .topbar { padding: 0 12px; }
  .switch em { display: none; }
  .g2, .g3, .g4, .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .inbox { grid-template-columns: 1fr; }
  .inbox.has-chat .convs { display: none; }
  .inbox:not(.has-chat) .chat { display: none; }
  .bar-row { grid-template-columns: 100px 1fr 60px; }
}

/* Tarjeta de anuncio (Click to WhatsApp) */
.ad-card{border:1px solid var(--border);border-radius:12px;overflow:hidden;background:var(--surface)}
.ad-card img{display:block;width:100%;max-height:160px;object-fit:cover}
.ad-card>div{padding:10px 12px;font-size:13px}
.ad-card p{margin:4px 0 6px;color:var(--muted)}
.ad-card .kv{margin-top:6px}
label.check { display: flex; gap: 8px; align-items: center; flex-direction: row; font-weight: 500; }
.kcol-h .auto-btn { width: 26px; height: 26px; font-size: 13px; opacity: .45; } .kcol-h .auto-btn.on { opacity: 1; background: #FEF3C7; }
label.check input[type=checkbox] { width: 18px; height: 18px; flex: none; padding: 0; margin: 0; border: 0; box-shadow: none; accent-color: var(--accent, #2563EB); }

/* =====================================================================
   Fondos de marca (estilo "escritorio" con paneles flotantes)
   Colores WaChat: verde #22C55E · cielo #0EA5E9 · índigo #6366F1 · noche #0B1530
   Se activa con <html data-wall="aurora|oceano|selva|noche">; "clásico" = sin fondo.
   ===================================================================== */
html[data-wall="aurora"] { --wall: radial-gradient(1200px 700px at 85% 110%, rgba(34,197,94,.75), transparent 60%), radial-gradient(900px 600px at 10% -10%, rgba(99,102,241,.95), transparent 60%), linear-gradient(128deg, #1E1B4B 0%, #3730A3 24%, #0369A1 55%, #0EA5E9 72%, #16A34A 100%); }
html[data-wall="oceano"] { --wall: radial-gradient(1000px 600px at 90% 0%, rgba(14,165,233,.7), transparent 60%), radial-gradient(800px 600px at 0% 100%, rgba(99,102,241,.55), transparent 60%), linear-gradient(160deg, #0B1530 0%, #0C4A6E 55%, #0284C7 100%); }
html[data-wall="selva"] { --wall: radial-gradient(1000px 700px at 100% 100%, rgba(163,230,53,.45), transparent 55%), radial-gradient(900px 600px at 0% 0%, rgba(14,165,233,.45), transparent 60%), linear-gradient(140deg, #052E2B 0%, #065F46 45%, #16A34A 85%); }
html[data-wall="noche"] { --wall: radial-gradient(800px 500px at 15% 10%, rgba(99,102,241,.45), transparent 60%), radial-gradient(700px 500px at 90% 90%, rgba(34,197,94,.3), transparent 60%), radial-gradient(600px 400px at 70% 20%, rgba(14,165,233,.25), transparent 60%), #070B1A; }

html[data-wall] body:not(.auth-page) { background: var(--wall); background-attachment: fixed; }
/* Brillo diagonal muy sutil, como el de la burbuja del logo */
html[data-wall] body:not(.auth-page)::before { content: ''; position: fixed; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.07) 44%, transparent 52%); }

html[data-wall] .sidebar { background: rgba(6, 11, 30, .52); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); border-right: 1px solid rgba(255,255,255,.08); --side-text: #D5DEEE; }
html[data-wall] .nav-item:hover { background: rgba(255,255,255,.08); }
html[data-wall] .nav-item.active { background: rgba(255,255,255,.14); box-shadow: inset 3px 0 0 var(--c); }
html[data-wall] .side-foot { border-top-color: rgba(255,255,255,.1); }

html[data-wall] .topbar { background: transparent; border-bottom: 0; color: #fff; }
html[data-wall] .page-title { text-shadow: 0 1px 12px rgba(0,0,0,.25); }
html[data-wall] .title-ic { background: rgba(255,255,255,.18); color: #fff; backdrop-filter: blur(8px); }
html[data-wall] .topbar .icon-btn { color: rgba(255,255,255,.85); }
html[data-wall] .topbar .icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
html[data-wall] .switch em { color: rgba(255,255,255,.9); }
html[data-wall] .switch span { background: rgba(255,255,255,.3); }

html[data-wall] .content { padding-top: 6px; }
/* Texto suelto sobre el fondo */
html[data-wall] .content > p.muted, html[data-wall] .content > .toolbar > .muted, html[data-wall] .content > .toolbar > p.muted, html[data-wall] .content > .toolbar > .grow.muted { color: rgba(255,255,255,.88); }
html[data-wall] .content > .toolbar a.badge, html[data-wall] .content > form.toolbar .muted { color: rgba(255,255,255,.9); }
html[data-wall] .content > .info-box { background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.18); }
html[data-wall] .content > .info-box .ic, html[data-wall] .content > .info-box b { color: #fff; }
html[data-wall] .card { border-color: transparent; border-radius: 16px; box-shadow: 0 10px 30px rgba(3,7,30,.18); }
html[data-wall] .toolbar .btn:not(.primary) { border-color: transparent; box-shadow: 0 2px 8px rgba(3,7,30,.12); }

/* Bandeja: paneles flotantes */
html[data-wall] body[data-page="inbox"] .content { padding: 0 16px 16px; }
html[data-wall] .inbox { gap: 10px; }
html[data-wall] .inbox > .folders, html[data-wall] .inbox > .convs, html[data-wall] .inbox > .chat, html[data-wall] .inbox > .side-panel { border: 0; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 30px rgba(3,7,30,.2); }
html[data-wall] .chat { background: var(--surface-2); }

/* Embudos: columnas de vidrio y etapas en flecha */
html[data-wall] .kcol { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); backdrop-filter: blur(14px); border-radius: 14px; }
html[data-wall] .kcol-h { border-top: 0; margin: 8px 8px 0; padding: 9px 26px 9px 14px; border-radius: 8px 0 0 8px; background: var(--c); color: #fff; clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%); }
html[data-wall] .kcol-h .chan-dot { display: none; }
html[data-wall] .kcol-h .pill.cnt { background: rgba(255,255,255,.25); color: #fff; }
html[data-wall] .kcol-h .sum { color: rgba(255,255,255,.9); }
html[data-wall] .kcol-h .auto-btn { color: #fff; opacity: .7; }
html[data-wall] .kcol-h .auto-btn.on { background: rgba(255,255,255,.3); opacity: 1; }
html[data-wall] .kcard { border: 0; border-radius: 12px; box-shadow: 0 4px 14px rgba(3,7,30,.14); }
html[data-wall] .kcards.over { background: rgba(255,255,255,.2); }

/* Selector de fondo */
.wall-pick { position: relative; }
.wall-pop { position: absolute; right: 0; top: 44px; z-index: 50; background: var(--surface); color: var(--text); border-radius: 14px; box-shadow: 0 18px 50px rgba(3,7,30,.3); padding: 12px; width: 260px; }
.wall-pop[hidden] { display: none; }
.wall-pop p { margin: 0 0 10px; font-weight: 700; font-size: 13px; }
.wall-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wall-grid button { border: 2px solid transparent; border-radius: 10px; height: 56px; cursor: pointer; padding: 0; position: relative; overflow: hidden; font: inherit; }
.wall-grid button span { position: absolute; left: 6px; bottom: 4px; font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.wall-grid button.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--surface) inset; }
.wall-grid button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 760px) { html[data-wall] .sidebar { background: rgba(6, 11, 30, .92); } }
@media (prefers-reduced-transparency: reduce) { html[data-wall] .sidebar, html[data-wall] .kcol { backdrop-filter: none; background: rgba(6,11,30,.9); } }
.wall-sw-aurora { background: linear-gradient(128deg, #1E1B4B, #3730A3 30%, #0EA5E9 70%, #16A34A); }
.wall-sw-oceano { background: linear-gradient(160deg, #0B1530, #0C4A6E 55%, #0284C7); }
.wall-sw-selva { background: linear-gradient(140deg, #052E2B, #065F46 45%, #16A34A); }
.wall-sw-noche { background: radial-gradient(circle at 20% 20%, rgba(99,102,241,.6), transparent 60%), #070B1A; }
.wall-sw-clasico { background: linear-gradient(90deg, #0B1220 30%, #F5F6FA 30%); }
.wall-sw-clasico span { color: #0B1220 !important; text-shadow: none !important; left: auto !important; right: 6px; }
html[data-wall] .card { overflow: clip; }
html[data-wall] .kcol-h { white-space: nowrap; min-width: 0; }
html[data-wall] .kcol-h .sum { flex-shrink: 0; }
.kcol-h { min-width: 0; }
.kcol-h .kname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Pestañas sobre el fondo (Ajustes, periodos de Analíticas, embudos): vidrio + activa en blanco */
html[data-wall] .content > .toolbar > a.btn { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.22); box-shadow: none; backdrop-filter: blur(10px); }
html[data-wall] .content > .toolbar > a.btn:hover { background: rgba(255,255,255,.24); }
html[data-wall] .content > .toolbar > a.btn.primary { background: #fff; color: var(--accent); border-color: #fff; box-shadow: 0 4px 14px rgba(3,7,30,.18); }

/* Gráficos con el degradado de la marca */
.spark div { background: linear-gradient(180deg, #0EA5E9, #22C55E); opacity: .9; }
.bar-row .fill { background: linear-gradient(90deg, #22C55E, #0EA5E9); }

/* ---------- Ingreso ---------- */
.auth-page { background: radial-gradient(1200px 700px at 85% 110%, rgba(34,197,94,.75), transparent 60%), radial-gradient(900px 600px at 10% -10%, rgba(99,102,241,.95), transparent 60%), linear-gradient(128deg, #1E1B4B 0%, #3730A3 24%, #0369A1 55%, #0EA5E9 72%, #16A34A 100%); position: relative; }
.auth-page::before { content: ''; position: fixed; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,.08) 44%, transparent 52%); }
.auth-wrap { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 56px; align-items: center; width: min(1040px, 100%); margin: auto; }
.auth-pitch { color: #fff; }
.auth-pitch h1 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.08; font-weight: 800; letter-spacing: -.035em; margin: 0 0 18px; max-width: 14ch; text-wrap: balance; }
.auth-pitch p { font-size: 16px; line-height: 1.55; color: rgba(255,255,255,.86); margin: 0 0 26px; max-width: 46ch; }
.auth-pitch ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.auth-pitch li { display: flex; gap: 10px; align-items: center; font-weight: 600; color: rgba(255,255,255,.92); }
.auth-pitch li i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: rgba(255,255,255,.16); font-style: normal; font-size: 13px; }
.auth-page .auth-card { margin: 0; box-shadow: 0 30px 80px rgba(3,7,30,.35); }
.auth-page .auth-card .btn.primary { background: linear-gradient(90deg, #16A34A, #0EA5E9); border: 0; height: 44px; font-size: 14.5px; }
.auth-foot { position: fixed; left: 0; right: 0; bottom: 14px; text-align: center; color: rgba(255,255,255,.7); font-size: 12px; }
@media (max-width: 900px) { .auth-wrap { grid-template-columns: 1fr; gap: 24px; } .auth-pitch ul { display: none; } .auth-pitch h1 { font-size: 28px; } .auth-pitch p { margin-bottom: 0; } }
