/* 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: 90px; }
.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; max-width: 160px; 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; } }

/* ---------- Ajustes para celular ---------- */
@media (max-width: 760px) {
  .topbar { height: 56px; gap: 8px; }
  .page-title { font-size: 17px; gap: 10px; }
  .title-ic { width: 32px; height: 32px; }
  .top-actions { gap: 4px; }
  html[data-wall] .content { padding: 4px 12px 16px; }
  html[data-wall] body[data-page="inbox"] .content { padding: 0 8px 8px; }

  /* Menú lateral como cajón con fondo oscuro detrás */
  .sidebar.open { box-shadow: 0 0 0 100vmax rgba(3,7,30,.5); }

  /* Barras de herramientas: buscadores a todo el ancho, botones en fila */
  .content > form.toolbar > input, .content > form.toolbar > select { flex: 1 1 100%; }
  .content > .toolbar .btn { flex: 0 0 auto; }
  .content > .toolbar > .grow:not(.muted) { display: none; }
  /* Pestañas (Ajustes, Analíticas): una sola fila deslizable */
  .content > .toolbar:has(> a.btn + a.btn) { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -12px; margin-right: -12px; padding: 0 12px; }
  .content > .toolbar:has(> a.btn + a.btn)::-webkit-scrollbar { display: none; }

  /* Tablas: se deslizan dentro de su tarjeta */
  .card { overflow-x: auto !important; }
  .card > .tbl { min-width: 620px; }
  .card-b { overflow-wrap: anywhere; }
  .g4, .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stat { padding: 14px; } .stat b { font-size: 22px; }

  /* Embudos: una columna por pantalla, deslizando con imán */
  .kanban { scroll-snap-type: x mandatory; margin: 0 -12px; padding: 0 12px 10px; }
  .kcol { width: 84vw; scroll-snap-align: center; max-height: calc(100vh - 230px); }

  /* Chat: nombre arriba, asignación y acciones en una segunda fila */
  .chat-h { height: auto; flex-wrap: wrap; padding: 8px 10px; gap: 6px 8px; }
  .chat-h .who { flex: 1 1 0; min-width: 120px; }
  .chat-h select { order: 5; flex: 1 1 140px; height: 32px; }
  .chat-h .icon-btn { order: 6; width: 34px; height: 34px; }
  .chat-h #backBtn { order: 0; width: 28px; }
  .msgs { padding: 14px 12px; }
  .bubble { max-width: 86%; }
  .composer { padding: 8px 10px; }
  .composer .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .composer .tabs button { white-space: nowrap; }

  .modal { padding: 0; place-items: end center; }
  .modal-box { width: 100%; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; max-height: 92vh; }

  /* Ingreso: título corto y el formulario a la vista */
  .auth-page { padding: 20px 16px; flex-direction: column; }
  .auth-wrap { width: 100%; }
  .auth-page .auth-card { width: 100%; }
  .auth-pitch h1 { font-size: 26px; margin-bottom: 0; max-width: none; }
  .auth-pitch p, .auth-pitch ul { display: none; }
  .auth-wrap { gap: 18px; align-content: center; min-height: calc(100vh - 80px); }
  .auth-card { padding: 24px 20px; }
  .auth-foot { position: static; margin-top: 16px; }
}
.grid.split { grid-template-columns: minmax(0,1fr) var(--side-w, 320px); }
html[data-wall] .content > a.muted { color: rgba(255,255,255,.9); }
@media (max-width: 900px) { .grid.split { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 760px) { .opt-row { grid-template-columns: 1fr; gap: 6px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); } .opt-row > .icon-btn { justify-self: end; } }
/* Código y etiquetas sueltas sobre el fondo */
html[data-wall] .content > .toolbar code, html[data-wall] .content > .info-box code, html[data-wall] .content > p code { background: rgba(255,255,255,.2); color: #fff; border-color: rgba(255,255,255,.25); }
html[data-wall] .content > .toolbar > label { color: rgba(255,255,255,.92); }
@media (max-width: 760px) {
  .content > .toolbar > p, .content > .toolbar > label { flex: 1 1 100%; }
  .content > .toolbar > label select { width: 100%; }
  .card-h { flex-wrap: wrap; }
  .card-h h3 { flex: 1 1 100%; }
  .card-h select { flex: 1 1 0; min-width: 0; }
}

/* =====================================================================
   Tareas
   ===================================================================== */
.pill.amber { background: #F59E0B; color: #fff; }
.task-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.tcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 12px; min-height: 120px; }
html[data-wall] .tcol { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.22); backdrop-filter: blur(14px); }
.tcol h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 2px 4px 12px; }
html[data-wall] .tcol h3 { color: #fff; }
.tdot { width: 10px; height: 10px; border-radius: 50%; background: var(--d); box-shadow: 0 0 0 3px color-mix(in srgb, var(--d) 25%, transparent); }
.tlist { display: flex; flex-direction: column; gap: 8px; }
.tempty { margin: 6px 4px; font-size: 12.5px; }
html[data-wall] .tempty { color: rgba(255,255,255,.8); }
.tcard { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border-radius: 12px; padding: 10px 8px 10px 12px; box-shadow: 0 2px 10px rgba(3,7,30,.08); border: 1px solid var(--border); border-left: 3px solid #0EA5E9; transition: opacity .25s, transform .25s; }
.tcard.late { border-left-color: #EF4444; }
.tcard.today { border-left-color: #F59E0B; }
.tcard.done { border-left-color: #22C55E; opacity: .75; }
.tcard.done b { text-decoration: line-through; color: var(--muted); }
.tcard.leaving { opacity: 0; transform: translateX(8px); }
.tcard .tbody { flex: 1; min-width: 0; }
.tcard b { display: block; font-size: 13.5px; line-height: 1.35; }
.tcard small { color: var(--muted); font-size: 12px; }
.tcard small a { color: var(--accent); font-weight: 600; }
.tcard p { margin: 6px 0 0; font-size: 12.5px; color: var(--text-2); white-space: pre-wrap; }
.tcard .icon-btn { width: 28px; height: 28px; flex: none; }
.late-tag { color: #DC2626; font-weight: 700; }
.tcheck { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--border-2); background: var(--surface); cursor: pointer; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; margin-top: 1px; padding: 0; }
.tcheck:hover { border-color: #22C55E; background: color-mix(in srgb, #22C55E 15%, var(--surface)); }
.tcard.done .tcheck { background: #22C55E; border-color: #22C55E; }
.tcheck:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ctasks { display: flex; flex-direction: column; gap: 6px; }
.ctasks .tcard { box-shadow: none; padding: 8px 6px 8px 10px; }
.sp-sec h4 .btn.sm { text-transform: none; letter-spacing: 0; height: 26px; }
.quick-due { display: flex; gap: 6px; flex-wrap: wrap; margin-top: -4px; }

/* Historial */
.timeline { display: flex; flex-direction: column; position: relative; }
.timeline::before { content: ''; position: absolute; left: 13px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl-item { display: flex; gap: 10px; position: relative; padding: 5px 0; }
.tl-ic { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--surface); border: 2px solid var(--border); display: grid; place-items: center; font-size: 13px; z-index: 1; }
.tl-item p { margin: 3px 0 0; font-size: 13px; line-height: 1.4; }
.tl-item small { color: var(--muted); font-size: 11.5px; }
.timeline.mini .tl-item p { font-size: 12.5px; }
.k-stage .tl-ic { border-color: #6366F1; } .k-task .tl-ic { border-color: #F59E0B; } .k-done .tl-ic { border-color: #22C55E; } .k-ad .tl-ic, .k-form .tl-ic { border-color: #0EA5E9; }
.modal-box .timeline { max-height: 65vh; overflow-y: auto; }

/* =====================================================================
   Chat interno
   ===================================================================== */
body[data-page="teamchat"] .content { padding: 0; overflow: hidden; }
html[data-wall] body[data-page="teamchat"] .content { padding: 0 16px 16px; }
.tc { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 10px; height: 100%; }
.tc-rooms, .tc-main { background: var(--surface); border-radius: 16px; overflow: hidden; display: flex; flex-direction: column; min-height: 0; box-shadow: 0 10px 30px rgba(3,7,30,.18); }
.tc-rooms { overflow-y: auto; }
.tc-rooms-h { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.tc-rooms-h input { flex: 1; }
.tc-people-h { padding: 14px 14px 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.tc-list { display: flex; flex-direction: column; padding: 0 6px; }
.tc-item { display: flex; gap: 10px; align-items: center; padding: 10px 8px; border-radius: 12px; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.tc-item:hover { background: var(--surface-2); }
.tc-item.active { background: color-mix(in srgb, #0EA5E9 12%, var(--surface)); }
.tc-item .avatar { position: relative; flex: none; }
.tc-item .avatar .on, .tc-head .avatar .on { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%; background: #22C55E; border: 2px solid var(--surface); }
.tc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tc-txt b, .tc-txt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-txt small { color: var(--muted); font-size: 12px; }
.tc-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tc-meta small { color: var(--muted); font-size: 11px; }
.tc-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tc-head .who { flex: 1; min-width: 0; } .tc-head .who b, .tc-head .who small { display: block; } .tc-head .who small { color: var(--muted); font-size: 12px; }
.tc-msgs { background-color: var(--surface-2); }
.tc-author { display: block; font-size: 12px; margin-bottom: 2px; }
.tc-sys { align-self: center; background: color-mix(in srgb, #6366F1 10%, var(--surface)); border: 1px solid color-mix(in srgb, #6366F1 25%, transparent); max-width: 88%; }
.tc-contact { display: inline-block; margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 3px 8px; border-radius: 8px; margin-right: 6px; }
.tc .composer .box textarea { flex: 1; resize: none; min-height: 40px; }
.tc-main > .chat-empty { flex: 1; }
.group-people { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; margin-top: 8px; max-height: 40vh; overflow-y: auto; }

@media (max-width: 1100px) { .task-board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .task-board { grid-template-columns: 1fr; }
  .tc { grid-template-columns: 1fr; }
  .tc.has-room .tc-rooms { display: none; }
  .tc:not(.has-room) .tc-main { display: none; }
  html[data-wall] body[data-page="teamchat"] .content { padding: 0 8px 8px; }
  .group-people { grid-template-columns: 1fr; }
}
.pill[hidden] { display: none !important; }
[hidden] { display: none !important; } .tcol h3 [data-n]:empty { display: none; }
/* Adjuntos del chat interno */
.tc-clip { cursor: pointer; flex: none; }
.tc-up { font-size: 12.5px; color: var(--muted); padding: 0 4px 6px; }
.tc-main.drop { outline: 3px dashed #0EA5E9; outline-offset: -8px; }
.tc-img { display: block; margin: 2px 0 4px; }
.tc-img img { display: block; max-width: min(320px, 100%); max-height: 280px; border-radius: 10px; object-fit: cover; }
.tc-vid { display: block; max-width: min(360px, 100%); border-radius: 10px; margin: 2px 0 4px; }
.bubble audio { max-width: 100%; margin: 2px 0 4px; }
.tc-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px 0 4px; border-radius: 10px; background: color-mix(in srgb, var(--text) 6%, transparent); color: inherit; text-decoration: none; min-width: 200px; max-width: 320px; }
.tc-file:hover { background: color-mix(in srgb, var(--text) 10%, transparent); }
.tc-file b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.tc-file small { color: var(--muted); font-size: 11.5px; }
.tc-fic { width: 38px; height: 44px; flex: none; border-radius: 6px; background: linear-gradient(160deg, #0EA5E9, #6366F1); color: #fff; font-size: 10px; font-weight: 800; display: grid; place-items: center; }
.mem-list { display: flex; flex-direction: column; gap: 4px; max-height: 40vh; overflow-y: auto; }
.mem { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-bottom: 1px solid var(--border); }
.mem > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; font-weight: 600; font-size: 13.5px; }
.mem small { color: var(--muted); font-weight: 500; font-size: 11.5px; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.tc-head #tcSound { font-size: 16px; }
/* Contador del chat interno bien visible */
.nav-item .pill[data-badge="chat"] { background: #EF4444; color: #fff; min-width: 22px; justify-content: center; box-shadow: 0 0 0 3px rgba(239,68,68,.25); animation: pillPulse 1.6s ease-in-out infinite; }
@keyframes pillPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.55); } 50% { box-shadow: 0 0 0 7px rgba(239,68,68,0); } }
@media (prefers-reduced-motion: reduce) { .nav-item .pill[data-badge="chat"] { animation: none; } }
/* Alertas emergentes */
#chatAlerts { position: fixed; top: 76px; right: 16px; z-index: 300; display: flex; flex-direction: column; gap: 10px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.chat-alert { pointer-events: auto; display: flex; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: 0 18px 50px rgba(3,7,30,.35); border-left: 4px solid #0EA5E9; animation: caIn .35s cubic-bezier(.2,.9,.3,1.2); transition: opacity .5s, transform .5s; }
.chat-alert.direct { border-left-color: #EF4444; }
.chat-alert.out { opacity: 0; transform: translateX(30px); }
.chat-alert .avatar { flex: none; }
.ca-body { flex: 1; min-width: 0; }
.ca-body b { display: block; font-size: 14px; }
.ca-body b small { font-weight: 500; color: var(--muted); }
.ca-body p { margin: 4px 0 10px; font-size: 13.5px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.ca-actions { display: flex; gap: 6px; }
@keyframes caIn { from { opacity: 0; transform: translateY(-14px) scale(.97); } }
@media (max-width: 760px) { #chatAlerts { top: 64px; left: 12px; right: 12px; width: auto; } }

/* Chat interno: opciones de mensaje, «Visto por» y borrados */
.tc-msgs .bubble { position: relative; padding-right: 30px; }
.tc-msgs .bubble.tc-sys { padding-right: 12px; }
.tc-more { position: absolute; top: 2px; right: 4px; border: 0; background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--muted); border-radius: 6px; width: 24px; height: 20px; line-height: 1; font-size: 15px; cursor: pointer; opacity: 0; transition: opacity .12s; }
.tc-msgs .bubble:hover .tc-more, .tc-more:focus-visible { opacity: 1; }
@media (hover: none) { .tc-more { opacity: .55; } }
.tc-menu { position: fixed; z-index: 1200; min-width: 170px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); padding: 4px; display: grid; }
.tc-menu button { border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 7px; font: inherit; font-size: 13.5px; color: var(--text); cursor: pointer; }
.tc-menu button:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.tc-menu button.danger { color: var(--bad); }
.tc-seen { font-weight: 600; letter-spacing: .01em; cursor: default; }
.tc-seen.read { color: #0EA5E9; }
.bubble.tc-del { opacity: .75; }
.bubble.tc-del i { color: var(--muted); }
.bubble.tc-del-admin { border: 1px dashed var(--bad); background: color-mix(in srgb, var(--bad) 6%, var(--surface)); }
.bubble.tc-del-admin > div:not(.tc-deltag):not(.ft) { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.tc-deltag { font-size: 11px; font-weight: 600; color: var(--bad); margin-bottom: 4px; }
.seen-h { margin: 12px 0 6px; font-size: 13px; }

/* Invitaciones de usuario */
.invite-box { display: flex; gap: 8px; align-items: center; }
.invite-box input { flex: 1; min-width: 0; font-size: 12.5px; }
.hint-box { margin: 0; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); }
.btn.wa { background: #25D366; border-color: #25D366; color: #fff; }
.btn.wa:hover { background: #1EBE5A; }
.row-actions { white-space: nowrap; }
.row-actions { text-align: right; padding-left: 4px !important; }
.row-actions .icon-btn { width: 30px; height: 30px; }
.tbl-scroll { overflow-x: auto; }
.tbl .badge { white-space: nowrap; }

/* Recordatorios */
.kind-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.kind-pick label { flex: 1; min-width: 110px; }
.kind-pick input { position: absolute; opacity: 0; pointer-events: none; }
.kind-pick span { display: block; text-align: center; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 600; font-size: 13.5px; cursor: pointer; transition: border-color .15s, background .15s; }
.kind-pick input:checked + span { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); color: var(--accent); }
.kind-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.mail-opt { font-size: 13.5px; }
.mail-opt small { font-size: 12px; }
.chat-alert.reminder { border-left-color: #F59E0B; background: color-mix(in srgb, #F59E0B 7%, var(--surface)); animation: caIn .35s cubic-bezier(.2,.9,.3,1.2), remindPulse 1.6s ease-in-out .4s 3; }
.chat-alert.reminder .ca-actions { flex-wrap: wrap; }
@keyframes remindPulse { 50% { box-shadow: 0 18px 50px rgba(3,7,30,.35), 0 0 0 6px color-mix(in srgb, #F59E0B 35%, transparent); } }
@media (prefers-reduced-motion: reduce) { .chat-alert.reminder { animation: none; } }

/* Embudo por defecto */
.pipe-default { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin: -4px 0 12px; color: var(--muted); }
.pipe-default label { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 0; font-size: 13px; font-weight: 600; color: inherit; }
html[data-wall] .content > .pipe-default { color: rgba(255,255,255,.92); }
.pipe-default select { width: auto; padding: 5px 8px; font-size: 13px; }
.pipe-default select { margin: 0 !important; }

/* Calendario de tareas */
.toolbar .seg { flex: none; }
.toolbar .seg button { padding: 6px 12px; }
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.cal-main, .cal-agenda { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 12px; }
.cal-h { display: flex; align-items: center; gap: 6px; margin: 0 2px 10px; }
.cal-h h3 { margin: 0 4px; font-size: 16px; min-width: 150px; text-align: center; }
.cal-h .icon-btn { font-size: 20px; line-height: 1; }
.cal-hint { color: var(--muted); font-size: 11.5px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-dow span { font-size: 11.5px; font-weight: 700; color: var(--muted); text-align: center; padding: 2px 0 4px; }
.cal-day { position: relative; min-height: 96px; padding: 5px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; cursor: pointer; overflow: hidden; transition: border-color .12s, background .12s; }
.cal-day:hover { border-color: var(--border); }
.cal-day:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-day.wkend { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
.cal-day.other { opacity: .45; }
.cal-day.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.cal-day.drop { border: 2px dashed var(--accent); }
.cal-n { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 4px; font-size: 12px; font-weight: 700; border-radius: 11px; }
.cal-day.today .cal-n { background: var(--accent); color: #fff; }
.cal-count { display: none; }
.cal-chips { display: grid; gap: 3px; margin-top: 3px; }
.cal-chip { display: flex; align-items: center; gap: 3px; font-size: 11px; line-height: 1.25; padding: 3px 5px; border-radius: 6px; background: color-mix(in srgb, #0EA5E9 14%, var(--surface)); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: grab; }
.cal-chip b { font-weight: 700; flex: none; }
.cal-chip i { flex: none; width: 7px; height: 7px; border-radius: 50%; }
.cal-chip.late { background: color-mix(in srgb, #EF4444 16%, var(--surface)); }
.cal-chip.done { background: color-mix(in srgb, #22C55E 14%, var(--surface)); text-decoration: line-through; color: var(--muted); cursor: pointer; }
.cal-chip.dragging { opacity: .4; }
.cal-more { font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-agenda { position: sticky; top: 12px; }
.cal-ag-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cal-ag-h small { display: block; color: var(--muted); font-size: 12px; }
.cal-agenda .tlist { display: grid; gap: 8px; }
@media (max-width: 1100px) { .cal-wrap { grid-template-columns: 1fr; } .cal-agenda { position: static; } }
@media (max-width: 760px) {
  .cal-hint { display: none; }
  .cal-main { padding: 8px; }
  .cal-day { min-height: 52px; padding: 3px; text-align: center; }
  .cal-chips, .cal-more { display: none; }
  .cal-count { display: block; margin: 2px auto 0; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); font-size: 0; }
  .cal-h h3 { min-width: 0; font-size: 15px; }
}

/* Embudo en lista */
.pipe-list { padding: 0; overflow: hidden; }
.pl-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px; border-bottom: 1px solid var(--border); }
.pl-tools input[type=search] { flex: 1 1 220px; max-width: 320px; }
.pl-tools select { width: auto; }
.pl-tbl th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.pl-tbl th[aria-sort=ascending]::after { content: ' ▲'; font-size: 9px; }
.pl-tbl th[aria-sort=descending]::after { content: ' ▼'; font-size: 9px; }
.pl-who { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.pl-who small { flex-basis: 100%; color: var(--muted); }
.pl-stage { width: auto; min-width: 150px; padding: 5px 8px; font-size: 13px; font-weight: 600; border-left: 4px solid var(--sc, #64748B); }
.pl-agent { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pl-agent i { width: 8px; height: 8px; border-radius: 50%; }
.pl-last { display: grid; max-width: 280px; }
.pl-last span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.pl-last small { color: var(--muted); }
.pl-wait { color: #F59E0B; font-size: 10px; }
.pl-tbl td { vertical-align: middle; }
.pl-tbl td.num { white-space: nowrap; }

/* Multicanal */
.avatar { position: relative; }
.kind-dot { position: absolute; right: -3px; bottom: -3px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px; border: 2px solid var(--surface); color: #fff; font: 700 8.5px/12px system-ui, sans-serif; font-style: normal; text-align: center; }
.transcript { margin-top: 6px; padding: 6px 8px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 7%, transparent); font-size: 12.5px; line-height: 1.4; white-space: pre-wrap; }

/* Ajustes: Canales e Integraciones */
.hub { display: grid; gap: 8px; max-width: 980px; }
.hub-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.hub-row:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); transform: translateX(2px); }
.hub-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hub-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--c); font: 800 13px/1 system-ui, sans-serif; }
.hub-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.hub-txt b { font-size: 15px; }
.hub-txt small { color: var(--muted); font-size: 12.5px; }
.hub-go { color: var(--muted); font-size: 22px; line-height: 1; }
.hub-back { display: flex; align-items: baseline; gap: 14px; margin: 0 0 14px; }
.hub-back a { color: rgba(255,255,255,.9); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.hub-back h2 { margin: 0; font-size: 20px; color: #fff; }
html:not([data-wall]) .hub-back a, html:not([data-wall]) .hub-back h2 { color: var(--text); }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 13.5px; line-height: 1.5; }
.code-sample { width: 100%; font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; white-space: pre-wrap; overflow-x: auto; margin: 6px 0; }
.api-doc td { font-size: 12.5px; vertical-align: top; }
.ev-pick { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: grid; gap: 6px; }
.ev-pick legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.ok-txt { color: var(--ok); }
.err-txt { color: var(--bad); }
@media (max-width: 640px) { .hub-row { flex-wrap: wrap; } .hub-txt { flex-basis: calc(100% - 60px); } .hub-row .badge { margin-left: 54px; } .hub-go { display: none; } }

/* Identificadores */
.acct-ids { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.acct-ids small { display: block; color: var(--muted); font-size: 12px; margin-bottom: 3px; }
.acct-ids b { font-size: 17px; font-variant-numeric: tabular-nums; }
.copyable { cursor: copy; border-bottom: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent); }
.copyable:hover { color: var(--accent); }
.id-list { margin-top: 12px; display: grid; gap: 6px; text-align: left; }
.id-list > div { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 12.5px; }
.id-list small { color: var(--muted); white-space: nowrap; }
.id-list code { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; background: none; padding: 0; }

/* Google Sheets (OAuth) */
.gs-card { overflow: hidden; }
.gs-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.gs-head p { margin: 4px 0 0; font-size: 13px; max-width: 520px; }
.gs-acts { display: grid; gap: 8px; justify-items: stretch; min-width: 220px; text-align: center; }
.gbtn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.g-ic { width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #4285F4; font: 800 14px/22px system-ui, sans-serif; text-align: center; }
.btn.danger-txt { color: var(--bad); }
.gs-link { font-size: 12.5px; word-break: break-all; }
.info-box.ok-box { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.info-box.err-box { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }

/* ---------- Flujos: lista con carpetas ---------- */
.fl-crumbs { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.fl-crumbs a { color: var(--muted); font-weight: 600; } .fl-crumbs a.on { color: var(--text); font-weight: 700; }
.fl-search input { width: 200px; }
.fl-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 16px; }
.fl-folder { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; font-weight: 600; transition: border-color .15s, box-shadow .15s; }
.fl-folder:hover { border-color: #7C3AED; box-shadow: var(--shadow); }
.fl-folder svg { color: #7C3AED; flex-shrink: 0; }
.fl-folder .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-folder .icon-btn.sm { width: 26px; height: 26px; }
.fl-name { font-weight: 700; } .fl-name:hover { color: #7C3AED; }
.fl-tbl .badge { margin-left: 6px; }

/* ---------- Flujos: lienzo ---------- */
.fc-top { display: flex; align-items: center; gap: 10px; margin: -6px 0 12px; flex-wrap: wrap; }
.fc-back { color: var(--muted); font-weight: 600; white-space: nowrap; } .fc-back:hover { color: var(--text); }
.fc-sep { color: var(--border-2); }
.fc-name { font-size: 17px; font-weight: 800; border: 1px solid transparent; background: transparent; padding: 5px 8px; border-radius: 8px; min-width: 200px; width: min(420px, 40vw); color: var(--text); }
.fc-name:hover, .fc-name:focus { border-color: var(--border-2); background: var(--surface); outline: none; }
.fc-active small { color: var(--muted); font-weight: 600; }
.fc-top .grow { flex: 1; }
.fc-wrap { position: relative; height: calc(100vh - 168px); min-height: 460px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; cursor: grab; user-select: none;
  background-color: var(--surface-2); background-image: radial-gradient(circle, var(--border-2) 1px, transparent 1.2px); background-size: 22px 22px; }
.fc-wrap.panning { cursor: grabbing; }
.fc-world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fc-svg { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.fc-svg .fce { fill: none; stroke-width: 2.2; pointer-events: stroke; cursor: pointer; opacity: .85; }
.fc-svg .fce:hover, .fc-svg .fce.sel { stroke-width: 4; opacity: 1; }
.fc-svg .fce.tmp { stroke-dasharray: 6 5; pointer-events: none; }
.fc-svg .fce-del { pointer-events: all; cursor: pointer; } .fc-svg .fce-del circle { fill: #DC2626; } .fc-svg .fce-del text { fill: #fff; font-size: 12px; font-weight: 700; }
.fcn { position: absolute; background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px; box-shadow: 0 2px 8px rgba(15,23,42,.08); cursor: move; font-size: 12.5px; }
.fcn:hover { border-color: var(--c); }
.fcn.sel { border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent), 0 6px 18px rgba(15,23,42,.12); }
.fcn.drop { border-color: #16A34A; box-shadow: 0 0 0 4px rgba(22,163,74,.25); }
.fcn-h { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); border-radius: 11px 11px 0 0; background: color-mix(in srgb, var(--c) 9%, var(--surface)); }
.fcn-h b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcn-ic { width: 22px; height: 22px; border-radius: 6px; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 12px; flex-shrink: 0; }
.fcn-b { padding: 9px 12px; color: var(--text-2); line-height: 1.45; word-break: break-word; }
.fcn-b:empty { display: none; }
.fcn-txt { white-space: pre-line; }
.fcn-img { font-weight: 600; margin-bottom: 4px; }
.fcn-tag { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.fcn-rule, .fcn-act { padding: 3px 0; border-bottom: 1px dashed var(--border); } .fcn-rule:last-child, .fcn-act:last-child { border-bottom: 0; }
.fcn-rule i { color: var(--muted); }
.fcn-ports { border-top: 1px solid var(--border); padding: 4px 0; }
.fcn-ports:empty { display: none; }
.fcn-port { position: relative; display: flex; justify-content: flex-end; align-items: center; padding: 4px 22px 4px 12px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.fcn-port span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcn-out { position: absolute; right: -7px; top: 50%; width: 13px; height: 13px; margin-top: -6.5px; border-radius: 50%; background: #64748B; border: 2.5px solid var(--surface); box-shadow: 0 0 0 1px var(--border-2); cursor: crosshair; }
.fcn-port.g .fcn-out { background: #16A34A; } .fcn-port.r .fcn-out { background: #DC2626; } .fcn-port.r { color: #B91C1C; }
.fcn-out:hover { transform: scale(1.35); }
.fcn-in { position: absolute; left: -7px; top: 15px; width: 13px; height: 13px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--c); }
.fc-tools { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 4px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 5px; box-shadow: var(--shadow); cursor: default; }
.fc-tools .icon-btn { font-size: 17px; color: var(--text-2); }
.fc-mini { position: absolute; right: 14px; bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); cursor: pointer; }
.fc-hint { position: absolute; left: 14px; top: 12px; font-size: 12px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 6px 10px; border-radius: 8px; transition: opacity .6s; pointer-events: none; }
.fc-hint.fade { opacity: 0; }
.fc-addmenu { position: absolute; z-index: 6; width: 290px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(15,23,42,.18); padding: 6px; cursor: default; }
.fc-addmenu button { display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px; border-radius: 8px; cursor: pointer; color: var(--text); font: inherit; }
.fc-addmenu button:hover { background: var(--surface-2); }
.fc-addmenu button span { grid-row: span 2; width: 30px; height: 30px; border-radius: 8px; background: var(--c); color: #fff; display: grid; place-items: center; }
.fc-addmenu small { color: var(--muted); font-size: 11.5px; }
.fc-panel { position: absolute; top: 0; right: 0; bottom: 0; width: 370px; max-width: 100%; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(15,23,42,.08); display: flex; flex-direction: column; cursor: default; user-select: text; z-index: 5; }
.fcp-h { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.fcp-h > span:first-child { width: 26px; height: 26px; border-radius: 7px; background: var(--c); color: #fff; display: grid; place-items: center; }
.fcp-h .grow { flex: 1; }
.fcp-b { padding: 14px; overflow-y: auto; display: grid; gap: 12px; align-content: start; flex: 1; }
.fcp-b > div { display: grid; gap: 10px; }
.fcp-row { display: flex; gap: 6px; align-items: center; } .fcp-row > input, .fcp-row > select { flex: 1; min-width: 0; }
.fcp-sub { font-weight: 700; font-size: 12.5px; margin-top: 4px; }
.fcp-group { border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: grid; gap: 8px; background: var(--surface-2); }
.fcp-rule { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; padding: 8px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); }
.fcp-rule > input { grid-column: 1 / 3; }
.fcp-vars { display: flex; flex-wrap: wrap; gap: 4px; margin-top: -4px; }
.fcp-vars button { border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; font-size: 11px; padding: 2px 6px; cursor: pointer; color: var(--text-2); font-family: inherit; }
.fcp-vars button:hover { border-color: var(--accent); color: var(--accent); }
.fcp-note { font-size: 12px; margin: 0; }
@media (max-width: 760px) { .fc-panel { width: 100%; } .fc-mini { display: none; } .fc-name { width: 100%; } }
/* Switches dentro de tarjetas / barras blancas cuando hay fondo de pantalla */
html[data-wall] .card .switch span, html[data-wall] .fc-top .switch span, html[data-wall] .modal .switch span, html[data-wall] .sp-sec .switch span { background: var(--border-2); }
html[data-wall] .switch input:checked + span { background: var(--ok); }
.fc-top { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 6px 8px 6px 14px; margin: -8px 0 12px; box-shadow: var(--shadow); }
.fc-top .icon-btn { font-size: 17px; color: var(--text-2); }
html[data-wall] .fl-crumbs, html[data-wall] .fl-crumbs a { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.25); }
html[data-wall] .fl-crumbs a:not(.on) { opacity: .8; }
html[data-wall] .fl-hint-txt { color: rgba(255,255,255,.88); }
.kv-dates dd { font-size: 12.5px; }
.warn-badge { background: #FEF3C7; border-color: #FCD34D; color: #92400E; }
.fc-state { color: var(--muted); font-size: 12px; white-space: nowrap; }
.fc-testlist { display: grid; gap: 6px; margin-top: 10px; max-height: 320px; overflow-y: auto; }
.fc-testlist button { display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; font: inherit; color: var(--text); }
.fc-testlist button:hover { border-color: var(--accent); }

/* 2.4.0 · editor de flujos: contenidos del mensaje */
.fcp-items{display:flex;flex-direction:column;gap:10px;margin-bottom:10px}
.fcp-item{border:1px solid var(--line,#E2E8F0);border-radius:10px;background:var(--bg2,#F8FAFC);overflow:hidden}
.fcp-item-h{display:flex;align-items:center;gap:4px;padding:6px 8px;border-bottom:1px solid var(--line,#E2E8F0);font-size:13px}
.fcp-item-h .icon-btn{width:24px;height:24px;font-size:12px}
.fcp-item-b{padding:8px;display:flex;flex-direction:column;gap:6px}
.fcp-item-b textarea,.fcp-item-b input,.fcp-item-b select{width:100%}
.fcp-btn{border:1px dashed var(--line,#CBD5E1);border-radius:8px;padding:6px;display:flex;flex-direction:column;gap:4px;margin-bottom:6px;background:var(--bg,#fff)}
.fcp-next{display:inline-flex;gap:2px;margin-left:auto}
.fcp-next .icon-btn{width:26px;height:26px;font-size:13px}
.fcp-act{display:flex;flex-direction:column;gap:6px}
.fcp-act input,.fcp-act select,.fcp-act textarea{width:100%}
.fcn-sep{height:1px;background:var(--line,#E2E8F0);margin:6px 0}
.fcn-media{font-size:12.5px;padding:4px 6px;border-radius:6px;background:var(--bg2,#F1F5F9)}
.fcn-link{font-size:12px;color:#2563EB;margin-top:3px}
.fcn.fcn-note{background:#FEF9C3;border-color:#FDE047}
.fcn.fcn-note .fcn-h{background:transparent}

/* 2.4.1 · barra de cada bloque + vista previa */
.fcn-tb { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 14px rgba(15,23,42,.12); opacity: 0; pointer-events: none; transition: opacity .12s; white-space: nowrap; cursor: default; }
.fcn-tb::after { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 10px; }
.fcn:hover .fcn-tb, .fcn.sel .fcn-tb { opacity: 1; pointer-events: auto; }
.fcn-tb button { position: relative; width: 30px; height: 30px; display: grid; place-items: center; border: 0; background: none; border-radius: 7px; color: var(--text); cursor: pointer; }
.fcn-tb button:hover { background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--c); }
.fcn-tb button.on { color: #16A34A; }
.fcn-tb button.danger:hover { background: #FEE2E2; color: #DC2626; }
.fcn-tb button:hover::before { content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); background: #475569; color: #fff; font-size: 12px; padding: 5px 9px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 5; }
.warn-box { background: #FEF3C7; border-color: #FCD34D; color: #92400E; }
.wp-phone { background: #EFEAE2; border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow: auto; margin: 10px 0; }
.wp-b { align-self: flex-start; max-width: 85%; background: #fff; color: #111B21; border-radius: 0 10px 10px 10px; padding: 7px 9px; font-size: 14px; line-height: 1.4; box-shadow: 0 1px .5px rgba(0,0,0,.13); }
.wp-b img { display: block; max-width: 100%; border-radius: 7px; margin-bottom: 5px; }
.wp-media { background: #E9EDEF; border-radius: 7px; padding: 16px 10px; text-align: center; color: #54656F; font-size: 13px; margin-bottom: 4px; }
.wp-btns { margin: 7px -9px -7px; border-top: 1px solid #E9EDEF; }
.wp-btns div { text-align: center; color: #027EB5; padding: 8px; font-size: 14px; border-bottom: 1px solid #E9EDEF; }
.wp-btns div:last-child { border-bottom: 0; }
.wp-list { margin-top: 8px; border-top: 1px dashed #D1D7DB; padding-top: 6px; display: flex; flex-direction: column; gap: 5px; }
.wp-list small { display: block; color: #667781; }
.wp-var { background: #DCF8C6; border-radius: 4px; padding: 0 3px; font-size: 13px; }
.wp-sys { align-self: center; background: #FFF5C4; color: #54656F; font-size: 12px; border-radius: 7px; padding: 4px 10px; text-align: center; max-width: 90%; }
.wp-sys .fcn-act, .wp-sys .fcn-rule, .wp-sys div { display: block; }
.wp-typing { align-self: flex-start; background: #fff; border-radius: 10px; padding: 8px 12px; display: flex; gap: 3px; align-items: center; }
.wp-typing i { width: 6px; height: 6px; border-radius: 50%; background: #9AA6AC; animation: wpdot 1s infinite; }
.wp-typing i:nth-child(2) { animation-delay: .15s } .wp-typing i:nth-child(3) { animation-delay: .3s }
@keyframes wpdot { 0%,60%,100% { opacity: .3 } 30% { opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .wp-typing i { animation: none } }
.wp-car { display: flex; gap: 6px; overflow-x: auto; }
.wp-car .wp-b { min-width: 180px; }
.wp-mail { background: #fff; border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.fcn-firsttag { margin-left: auto; flex-shrink: 0; font-size: 10.5px; font-weight: 700; color: #fff; background: #16A34A; border-radius: 999px; padding: 2px 8px; }
.fcn.fcn-first { border-color: #16A34A; }
.fcn.fcn-start { border-style: dashed; }
.fcn-firsttag { background: #16A34A; }
.fc-nostart { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 6; background: #FEF3C7; color: #92400E; border: 1px solid #FCD34D; border-radius: 10px; padding: 8px 14px; font-size: 13px; box-shadow: 0 4px 14px rgba(15,23,42,.1); max-width: 90%; }
.opt-ed { display: flex; flex-direction: column; gap: 6px; }
.opt-ed-h { font-weight: 600; font-size: 13.5px; display: flex; flex-direction: column; gap: 2px; }
.opt-ed-h small { font-weight: 400; }
.opt-ed-h kbd { font: inherit; font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; }
.opt-ed-rows { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow: auto; padding: 2px; }
.opt-ed-row { display: flex; align-items: center; gap: 6px; }
.opt-ed-row input { flex: 1; }
.opt-ed-n { width: 20px; text-align: right; font-size: 12px; color: var(--text-2); flex-shrink: 0; }
.ok-badge { background: #DCFCE7; color: #166534; }
.cp-card { margin-bottom: 14px; }
/* Diálogos propios */
.ui-dlg { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; padding: 16px; background: rgba(15,23,42,.45); opacity: 0; transition: opacity .12s; }
.ui-dlg.in { opacity: 1; } .ui-dlg.out { opacity: 0; }
.ui-dlg-box { width: min(440px, 100%); background: var(--surface); color: var(--text); border-radius: 16px; padding: 22px 22px 18px; box-shadow: 0 20px 50px rgba(15,23,42,.3); transform: translateY(6px) scale(.98); transition: transform .12s; display: flex; flex-direction: column; gap: 10px; }
.ui-dlg.in .ui-dlg-box { transform: none; }
.ui-dlg-box h3 { margin: 0; font-size: 17px; }
.ui-dlg-box p { margin: 0; color: var(--text-2); font-size: 14px; line-height: 1.5; }
.ui-dlg-box .ui-dlg-in { width: 100%; }
.ui-dlg-box .modal-actions { margin-top: 6px; }
.btn.dlg-danger { background: #DC2626; border-color: #DC2626; color: #fff; }
.btn.dlg-danger:hover { background: #B91C1C; }
@media (prefers-reduced-motion: reduce) { .ui-dlg, .ui-dlg-box { transition: none; } }
/* Contactos por número de la empresa */
.chan-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.chan-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13px; }
.chan-chip i { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.chan-chip span { color: var(--text-2); font-variant-numeric: tabular-nums; }
.chan-chip:hover { border-color: var(--primary, #7C3AED); }
.chan-chip.on { border-color: var(--primary, #7C3AED); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary, #7C3AED) 25%, transparent); }
.chan-chip:focus-visible { outline: 2px solid var(--primary, #7C3AED); outline-offset: 2px; }
/* Panel de inicios (info.siem.pe) */
.ini-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; max-height: 320px; overflow: auto; }
.ini-card { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.ini-card div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ini-card b { font-size: 13px; }
.ini-card small { color: var(--text-2); font-size: 12px; }
.entries { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.entries b { font-size: 12.5px; }
.entry { display: grid; grid-template-columns: auto 1fr; gap: 0 8px; padding: 5px 8px; border-radius: 8px; background: color-mix(in srgb, var(--ok, #16A34A) 8%, transparent); }
.entry.re { background: color-mix(in srgb, var(--warn, #D97706) 10%, transparent); }
.entry span:first-child { color: var(--text-2); font-variant-numeric: tabular-nums; }
.entry span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry small { grid-column: 2; color: var(--text-2); }
/* Analíticas › Asesores: tiempo de respuesta por periodo */
.rt-chart { display: flex; align-items: flex-end; gap: 4px; height: 240px; padding-top: 18px; overflow-x: auto; }
.rt-col { flex: 1 0 34px; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; padding-bottom: 34px; }
.rt-bar { width: 70%; max-width: 38px; border-radius: 6px 6px 2px 2px; background: #16A34A; min-height: 0; }
.rt-bar.u2 { background: #D97706; } .rt-bar.u3 { background: #DC2626; }
.rt-v { font-size: 10.5px; color: var(--text-2); white-space: nowrap; margin-bottom: 3px; }
.rt-x { position: absolute; bottom: 14px; font-size: 10.5px; color: var(--text-2); white-space: nowrap; }
.rt-r { position: absolute; bottom: 0; font-size: 10.5px; font-weight: 700; color: #fff; background: #DC2626; border-radius: 999px; padding: 0 6px; }
/* Mapa de calor día × hora */
.mini-stat { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; display: flex; flex-direction: column; gap: 2px; }
.mini-stat small { color: var(--text-2); } .mini-stat b { font-size: 22px; } .mini-stat em { font-style: normal; font-size: 12px; color: var(--text-2); }
.mini-stat.bad b { color: #DC2626; }
.hm-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; }
.hm-t { display: block; font-size: 13px; margin-bottom: 6px; }
.hm-grid { display: grid; grid-template-columns: 34px repeat(24, minmax(14px, 1fr)); gap: 2px; font-size: 10px; }
.hm-h { color: var(--text-2); text-align: left; }
.hm-d { color: var(--text-2); align-self: center; }
.hm-c { aspect-ratio: 1; border-radius: 3px; display: grid; place-items: center; font-size: 9px; color: #fff; background: var(--border); outline: 1px solid color-mix(in srgb, var(--border) 60%, transparent); }
@media (max-width: 640px) { .hm-wrap { grid-template-columns: 1fr; } }
/* Agente IA */
.aia-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.aia-mode { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; }
.aia-mode.static { cursor: default; background: color-mix(in srgb, var(--border) 25%, transparent); }
.aia-mode input[type=checkbox] { margin-top: 3px; }
.aia-mode span { display: flex; flex-direction: column; gap: 3px; } .aia-mode small { color: var(--text-2); font-size: 12.5px; line-height: 1.45; }
.aia-fields { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }
.aia-docs, .aia-media { display: flex; flex-direction: column; gap: 8px; }
.aia-doc, .aia-m { display: flex; gap: 12px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.aia-doc > div, .aia-mi { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.aia-doc small, .aia-mi small { color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.aia-doc.off, .aia-m.off { opacity: .55; }
.aia-prev { width: 120px; flex-shrink: 0; display: grid; place-items: center; }
.aia-prev img, .aia-prev video { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; }
.aia-prev audio { width: 120px; }
.aia-prev span { font-size: 12px; text-align: center; word-break: break-all; }
.aia-up { border: 1px dashed var(--border); border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.wp-b.wp-me { align-self: flex-end; background: #D9FDD3; border-radius: 10px 0 10px 10px; }
@media (max-width: 640px) { .aia-m { flex-wrap: wrap; } }
.ai-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ai-toggle.on { background: #10A37F; border-color: #10A37F; color: #fff; }
.ai-badge { background: color-mix(in srgb, #10A37F 15%, transparent); color: #0B7A5F; }

/* Flujos 2.7.1: menú de contenido estilo Telenet */
.fcp-addbox { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 16px; margin: 10px 0; border: 1.5px dashed var(--border-2); border-radius: 10px; background: transparent; color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; }
.fcp-addbox:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }
.fcp-ghost { border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; padding: 4px 0; cursor: pointer; }
.fcp-quick-top { margin: 4px 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.fcp-pick { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--border-2); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; }
.fcp-pick::after { content: '▾'; float: right; color: var(--muted); }
.fc-menu { position: fixed; z-index: 3100; min-width: 230px; max-width: 340px; max-height: 70vh; overflow: auto; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 30px rgba(15,23,42,.16); }
.fcm-q { width: 100%; box-sizing: border-box; margin: 0 0 6px; padding: 7px 9px; border: 1px solid var(--border-2); border-radius: 6px; font: inherit; background: var(--surface); color: var(--text); }
.fcm-i { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.fcm-i svg { flex: none; color: var(--muted); }
.fcm-i span { flex: 1; }
.fcm-i i { font-style: normal; color: var(--muted); }
.fcm-i em { font-style: normal; font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 0 6px; }
.fcm-i:hover, .fcm-i.open { background: var(--surface-2); }
.fcm-i.soon { opacity: .55; }
.fcn-dash { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 4px 0; padding: 12px 8px; border: 1.5px dashed var(--border-2); border-radius: 10px; text-align: center; }
.fcn-dash span { color: var(--text-2); font-size: 12.5px; }

/* Condición estilo Telenet */
.cnd-group { padding: 4px 0 10px; }
.cnd-q { font-weight: 600; font-size: 13.5px; margin: 6px 0 8px; }
.cnd-q a { font-weight: 400; color: var(--accent); text-decoration: none; }
.cnd-q a:hover { text-decoration: underline; }
.cnd-rule { display: flex; align-items: center; gap: 6px; margin: 6px 0; padding: 4px 4px 4px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.cnd-txt { flex: 1; border: 0; background: none; padding: 4px 0; text-align: left; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.cnd-new { display: block; width: 100%; margin: 4px 0 6px; padding: 14px; border: 0; border-top: 1px solid var(--border); background: none; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.cnd-new:hover { color: var(--accent); }
.cnd-box { width: min(780px, 100%); padding: 20px; }
.cnd-bar { display: grid; grid-template-columns: minmax(150px, 1.1fr) 170px minmax(180px, 1.6fr); border: 1px solid var(--border); border-radius: 999px; box-shadow: 0 2px 8px rgba(15,23,42,.06); }
.cnd-bar > * { border: 0; border-right: 1px solid var(--border); background: transparent; font: inherit; font-size: 14px; color: var(--text); padding: 10px 14px; min-width: 0; }
.cnd-bar > *:last-child { border-right: 0; }
.cnd-src { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border-radius: 999px 0 0 999px; }
.cnd-src::after, .cnd-multi::after { content: ' ▾'; color: var(--muted); }
.cnd-val { padding: 0 !important; display: flex; }
.cnd-val .cnd-in { flex: 1; width: 100%; border: 0; background: transparent; font: inherit; font-size: 14px; color: var(--text); padding: 10px 14px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cnd-val input.cnd-in { cursor: text; }
.cnd-two { display: flex; flex-direction: column; flex: 1; }
.cnd-two .cnd-in { padding: 5px 14px !important; }
.cnd-foot { display: flex; justify-content: space-between; padding-top: 14px; margin-top: 6px; border-top: 1px solid var(--border); }
.cnd-pick { position: fixed; z-index: 3200; display: flex; flex-direction: column; padding: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 12px 32px rgba(15,23,42,.2); }
.cnd-list { overflow: auto; flex: 1; }
.cnd-all { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-bottom: 6px; }
.cnd-all button { border: 0; background: var(--surface-2); padding: 8px; font: inherit; font-size: 13px; color: var(--text); cursor: pointer; }
.cnd-gh { padding: 10px 10px 4px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); }
.cnd-gh:first-child { border-top: 0; }
.cnd-it { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 10px 6px 18px; border: 0; background: none; font: inherit; font-size: 13.5px; color: var(--text); text-align: left; cursor: pointer; border-radius: 4px; }
.cnd-it:hover { background: var(--surface-2); }
.cnd-it.on { background: var(--accent); color: #fff; }
@media (max-width: 640px) { .cnd-bar { grid-template-columns: 1fr; border-radius: 12px; } .cnd-bar > * { border-right: 0; border-bottom: 1px solid var(--border); } .cnd-src { border-radius: 12px 12px 0 0; } }
.cnd-it input[type=checkbox] { width: 16px !important; height: 16px; flex: none; margin: 0; padding: 0; accent-color: var(--accent); }

/* Esperar / Dividir / Correo / Página de inicio (2.8.1) */
.fcp-inline { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.fcp-check { display: flex !important; flex-direction: row !important; justify-content: flex-start !important; text-align: left; align-items: center; gap: 8px; margin: 10px 0 6px; font-weight: 400; color: var(--text-2); }
.fcp-check input { width: 18px !important; flex: none; height: 18px; margin: 0; accent-color: #111; }
.fcp-split { padding: 10px 0; border-bottom: 1px solid var(--border); }
.fcp-split input[type=range] { flex: 1; accent-color: var(--accent); }
.fcp-vname { border: 0 !important; padding: 2px 0 !important; font-weight: 600; background: transparent !important; }
.fcp-sum { text-align: center; font-size: 13px; margin: 10px 0 4px; }
.fcp-sum.ok { color: #15803d; } .fcp-sum.bad { color: #b91c1c; font-weight: 600; }
.fcp-big { font-size: 16px !important; font-weight: 600; }
.fcp-imgbox { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; min-height: 120px; margin: 8px 0; padding: 12px; border: 1.5px dashed var(--border-2); border-radius: 12px; color: var(--muted); position: relative; text-align: center; }
.fcp-imgbox img { max-width: 100%; max-height: 220px; border-radius: 8px; }
.fcp-imgbox > span { font-size: 26px; width: 100%; }
.fcp-imgbox .icon-btn { position: absolute; top: 6px; right: 6px; background: var(--surface); }
.fcp-link { display: flex; gap: 6px; margin: 6px 0 2px; }
.fcp-link input { flex: 1; min-width: 0; font-size: 12px; }
.fcn-mail > div { font-size: 12px; padding: 2px 0; border-bottom: 1px solid var(--border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcn-mail .fcn-btn { margin-top: 6px; background: #111; color: #fff; text-align: center; border-radius: 6px; padding: 6px; border: 0; }
.switch-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; font-weight: 400; }
.switch-row input { width: 18px !important; height: 18px; flex: none; }
.sp-more { margin-top: 8px; } .sp-more summary { cursor: pointer; color: var(--accent); font-size: 13px; padding: 4px 0; }

/* Tablero en vivo */
.lv-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.lv-kpis { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.lv-kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; min-width: 120px; display: flex; flex-direction: column; }
.lv-kpi b { font-size: 26px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.lv-kpi span { font-size: 12px; color: var(--muted); }
.lv-kpi.warn b { color: #d97706; } .lv-kpi.bad b { color: #dc2626; }
.lv-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(240px, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .lv-grid { grid-template-columns: 1fr; } }
.lv-tbl td { vertical-align: middle; }
.lv-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: #94a3b8; }
.lv-dot.on { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); } .lv-dot.busy { background: #f59e0b; }
.lv-late { background: rgba(220,38,38,.05); }
.lv-w { color: #d97706; font-weight: 700; } .lv-b { color: #dc2626 !important; font-weight: 700; }
.lv-un { max-height: 520px; overflow: auto; }
.lv-un-i { display: flex; justify-content: space-between; gap: 8px; padding: 9px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13.5px; }
.lv-un-i:hover { background: var(--surface-2); }
/* Auditoría */
.qa-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.qa-inline { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; }
.qa-filters { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.qa-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .qa-grid { grid-template-columns: 1fr; } }
.qa-bar { display: inline-block; width: 90px; height: 7px; border-radius: 6px; background: var(--surface-2); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.qa-bar i { display: block; height: 100%; border-radius: 6px; }
.qa-crit { display: grid; grid-template-columns: 1fr 100px 30px; align-items: center; gap: 6px; font-size: 13px; margin: 5px 0; }
.qa-sel { background: var(--surface-2); }
.qa-item { border-bottom: 1px solid var(--border); }
.qa-item summary { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; cursor: pointer; list-style: none; }
.qa-score { flex: none; min-width: 38px; text-align: center; color: #fff; border-radius: 8px; padding: 6px 4px; font-size: 15px; }
.qa-det { padding: 0 16px 14px 66px; }
.qa-pts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.qa-pt { font-size: 12px; border: 1px solid; border-radius: 20px; padding: 2px 9px; }
.qa-err { color: #b91c1c; font-size: 13px; margin: 4px 0; }
.qa-tips { margin: 4px 0 10px; padding-left: 18px; font-size: 13px; }
/* Otros números y analítica de flujos */
.link-chip { display: inline-block; margin: 6px 4px 0 0; padding: 3px 9px; border-radius: 14px; background: var(--surface-2); color: var(--text); font-size: 12.5px; text-decoration: none; }
.link-chip small { color: var(--muted); }
.fcn-stat { margin: 6px 10px 0; padding: 4px 8px; border-radius: 6px; background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 600; }
.fcn-stat.zero { background: #f1f5f9; color: #94a3b8; }
.fc-vers { max-height: 50vh; overflow: auto; }
.fc-ver { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }

/* Cambiar de empresa */
@media (min-width: 761px) { .sidebar { position: relative; } } /* en celular la barra es fija y se oculta (03-responsive) */
.brand-sw { cursor: pointer; border-radius: 12px; margin: 6px 8px 0; padding: 12px 12px 10px; transition: background .15s; }
.brand-sw:hover, .brand-sw:focus-visible, .brand-sw[aria-expanded="true"] { background: rgba(255,255,255,.1); outline: none; }
.brand-sw .brand-txt { flex: 1; }
.brand-txt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw-caret { font-size: 15px; opacity: .7; }
.co-menu { position: absolute; z-index: 60; left: 10px; right: 10px; top: 72px; background: var(--surface, #fff); color: var(--text, #0f172a); border: 1px solid var(--border, #e2e8f0); border-radius: 12px; box-shadow: 0 18px 40px rgba(15,23,42,.28); padding: 6px; max-height: 60vh; overflow: auto; }
.co-h { font-size: 12px; font-weight: 600; color: var(--muted, #64748b); padding: 8px 10px 6px; }
.co-load { font-size: 13px; color: var(--muted, #64748b); padding: 10px; }
.co-i { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
a.co-i:hover, a.co-i:focus-visible { background: var(--surface-2, #f1f5f9); outline: none; }
.co-cur { opacity: .75; }
.co-av { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--accent, #2563eb); color: #fff; flex: none; }
.co-t { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.co-t b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-t small { font-size: 11.5px; color: var(--muted, #64748b); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.co-ok { margin-left: auto; color: #16a34a; font-weight: 700; }
.fu-val { display: flex; flex-direction: column; gap: 6px; }
.fu-lbl { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.fu-val[hidden], .fu-opts[hidden] { display: none; }
.fu-opts { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 10px 12px; border: 1px solid var(--border, #e2e8f0); border-radius: 10px; max-height: 180px; overflow: auto; }
.fu-opts .check { font-weight: 500; margin: 0; }

/* Embudos: catálogo de plantillas y estado de las oportunidades */
.modal-box:has(.tpl-cat) { width: min(1000px, 100%); }
.tc-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 18px; min-height: 420px; }
.tc-nav { display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--border); padding-right: 12px; }
.tc-s { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; background: none; border: 0; border-radius: 8px; padding: 9px 10px; font: inherit; font-size: 14px; color: var(--text); cursor: pointer; }
.tc-s small { color: var(--text-2); font-size: 12px; }
.tc-s:hover, .tc-s:focus-visible { background: var(--surface-2); outline: none; }
.tc-s.on { background: var(--surface-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent, #2563EB); }
.tc-s[data-sec="blank"] { order: 99; margin-top: 8px; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; padding-top: 12px; }
.tc-body { min-width: 0; }
.tc-sec { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.tc-sec b { font-size: 16px; }
.tc-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.tc-card.is-main { border-color: var(--accent, #2563EB); box-shadow: 0 0 0 1px var(--accent, #2563EB) inset; margin-bottom: 4px; }
.tc-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tc-h > div { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tc-goal { margin: 4px 0 0; font-size: 13px; }
.tc-steps { list-style: none; counter-reset: st; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 10px 0 6px; }
.tc-steps li { counter-increment: st; font-size: 12.5px; padding: 4px 9px 4px 6px; border-radius: 999px; background: var(--surface-2); display: flex; gap: 5px; align-items: center; }
.tc-steps li::before { content: counter(st); font-size: 11px; font-weight: 700; color: var(--text-2); min-width: 14px; text-align: center; }
.tc-steps li:last-child { background: rgba(22,163,74,.14); }
.tc-sub { margin: 18px 0 8px; font-size: 14px; }
.tc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.tc-blank { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 24px 4px; }
.deal-sum { display: inline-flex; background: var(--surface); color: var(--text); border-radius: 10px; padding: 7px 14px; box-shadow: 0 1px 2px rgba(15,23,42,.08); flex-wrap: wrap; gap: 14px; align-items: baseline; margin: 0 0 12px; font-size: 13.5px; }
.deal-sum .ds-won b { color: #16A34A; }
.deal-sum .ds-lost b { color: #DC2626; }
.kc-lost { margin-left: auto; background: none; border: 1px solid var(--border); border-radius: 999px; font: inherit; font-size: 11.5px; padding: 2px 8px; color: var(--text-2); cursor: pointer; }
.kc-lost:hover, .kc-lost:focus-visible { color: #DC2626; border-color: #DC2626; outline: none; }
.lost-badge { background: rgba(220,38,38,.12); color: #DC2626; }
.pl-reason { display: block; color: var(--text-2); font-size: 12px; margin-top: 3px; }
.pl-acts { white-space: nowrap; }
.pl-acts .btn + .btn { margin-left: 6px; }
.lost-opts { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.lost-opts legend { margin-bottom: 8px; font-size: 13px; }
@media (max-width: 720px) { .tc-wrap { grid-template-columns: 1fr; } .tc-nav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 0 0 8px; } .tc-s { white-space: nowrap; } .tc-s[data-sec="blank"] { order: 0; margin: 0; border: 0; padding-top: 9px; } }
.lost-opts .check { justify-content: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--text); }
.lost-opts .check:has(input:checked) { border-color: #DC2626; background: rgba(220,38,38,.06); }
.lost-opts input[type=radio] { width: 18px; height: 18px; flex: none; padding: 0; margin: 0; border: 0; box-shadow: none; accent-color: #DC2626; }
.tf-map { display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow: auto; }
.tf-row { display: grid; grid-template-columns: 1fr 18px 1fr; gap: 8px; align-items: center; font-size: 14px; }
.tf-row > span:first-child { padding: 8px 10px; background: var(--surface-2); border-radius: 8px; }

/* Panel del contacto: pasos de flujo y errores (como Telenet) */
.sp-trace > summary { list-style: none; cursor: pointer; display: flex; align-items: center; }
.sp-trace > summary::-webkit-details-marker { display: none; }
.sp-trace > summary h4 { margin: 0; flex: 1; display: flex; align-items: center; gap: 6px; }
.sp-trace > summary::after { content: '⌄'; color: var(--text-2); font-size: 16px; transition: transform .15s; }
.sp-trace[open] > summary::after { transform: rotate(180deg); }
.sp-trace .tr-body { margin-top: 10px; font-size: 12.5px; }
.tr-acts { font-size: 12.5px; font-weight: 500; margin-top: 8px; }
.tr-tbl { width: 100%; border-collapse: collapse; }
.tr-tbl th { text-align: left; font-size: 11.5px; color: var(--text-2); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.tr-tbl td { padding: 7px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tr-tbl td:last-child { white-space: nowrap; color: var(--text-2); }
.tr-tbl small { display: block; color: var(--text-2); margin-top: 2px; }
.tr-tbl .tr-fail small { color: #DC2626; }
.tr-n { background: #DC2626; color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }
.tr-n:empty { display: none; }
.tr-errs { list-style: none; padding: 0; margin: 0 0 8px; display: flex; flex-direction: column; gap: 6px; }
.tr-errs li { padding: 7px 9px; border-radius: 8px; background: rgba(220,38,38,.07); border-left: 3px solid #DC2626; line-height: 1.4; }
.tr-errs li.tr-warn { background: rgba(217,119,6,.08); border-left-color: #D97706; }
.tr-errs li small { display: block; color: var(--text-2); font-size: 11px; }

/* Bitácora */
.lg-health { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.lg-h { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 12px; padding: 12px 14px; border: 1px solid var(--border); }
.lg-h > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lg-h small { color: var(--text-2); font-size: 12px; }
.lg-h b { font-size: 14px; }
.lg-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.lg-st { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.lg-ok .lg-dot { background: #16A34A; } .lg-ok .lg-st { background: rgba(22,163,74,.12); color: #15803D; }
.lg-warn .lg-dot { background: #D97706; } .lg-warn .lg-st { background: rgba(217,119,6,.14); color: #B45309; }
.lg-bad .lg-dot { background: #DC2626; } .lg-bad .lg-st { background: rgba(220,38,38,.12); color: #B91C1C; }
.lg-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.lg-filters input[type=search] { flex: 1; min-width: 220px; }
.lg-filters select, .lg-filters input { width: auto; }
.lg-tbl td { vertical-align: top; }
.lg-when { white-space: nowrap; color: var(--text-2); }
.lg-msg { max-width: 560px; line-height: 1.45; }
.lg-b-error { background: rgba(220,38,38,.12); color: #B91C1C; }
.lg-b-warn { background: rgba(217,119,6,.14); color: #B45309; }
.lg-b-info { background: var(--surface-2); }
.lg-found { list-style: none; margin: 0; padding: 6px; }
.lg-found a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 8px; color: inherit; text-decoration: none; }
.lg-found a:hover, .lg-found a:focus-visible { background: var(--surface-2); outline: none; }
.lg-found small { color: var(--text-2); }
.lg-who .card-b { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lg-who .card-b > div { display: flex; flex-direction: column; }
.lg-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.chip-f { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.chip-f.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.lg-tl { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 12px; border: 1px solid var(--border); }
.lg-day { padding: 8px 16px; font-size: 12px; font-weight: 600; color: var(--text-2); background: var(--surface-2); }
.lg-e { display: grid; grid-template-columns: 70px 92px 1fr; gap: 10px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 13.5px; align-items: start; }
.lg-e[hidden], .lg-day[hidden] { display: none; }
.lg-e time { color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 1px; }
.lg-e small { display: block; color: var(--text-2); font-size: 12px; margin-top: 2px; }
.lg-tag { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); justify-self: start; }
.lg-k-in .lg-tag { background: rgba(37,99,235,.1); color: #1D4ED8; }
.lg-k-out .lg-tag { background: rgba(22,163,74,.1); color: #15803D; }
.lg-k-flow .lg-tag { background: rgba(124,58,237,.1); color: #6D28D9; }
.lg-k-err { background: rgba(220,38,38,.05); } .lg-k-err .lg-tag { background: rgba(220,38,38,.12); color: #B91C1C; }
.lg-k-warn { background: rgba(217,119,6,.05); } .lg-k-warn .lg-tag { background: rgba(217,119,6,.14); color: #B45309; }
@media (max-width: 640px) { .lg-e { grid-template-columns: 60px 1fr; } .lg-e > div { grid-column: 1 / -1; } }
.seg a { flex: 1; text-align: center; text-decoration: none; font-weight: 600; font-size: 12.5px; padding: 6px 14px; border-radius: 7px; color: var(--muted); white-space: nowrap; }
.seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg a:focus-visible { outline: 2px solid var(--accent, #2563EB); }

/* Flujos: condición con salidas en tarjetas y reglas en línea */
.fc-panel.fc-panel-wide { width: min(620px, 56%); }
.fcn-rule .fcn-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.cnd-card { --oc: #16A34A; border: 1px solid var(--border); border-radius: 12px; margin: 0 0 10px; background: var(--surface); overflow: visible; }
.cnd-card.open { border-color: color-mix(in srgb, var(--oc) 45%, var(--border)); box-shadow: 0 1px 0 color-mix(in srgb, var(--oc) 20%, transparent); }
.cnd-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; border-radius: 12px; }
.cnd-card.open > .cnd-head { background: color-mix(in srgb, var(--oc) 10%, transparent); border-radius: 12px 12px 0 0; }
.cnd-head:focus-visible { outline: 2px solid var(--oc); outline-offset: -2px; }
.cnd-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--oc); flex: none; }
.cnd-ttl { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cnd-ttl b { font-size: 15px; }
.cnd-ttl small { color: var(--text-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cnd-chev { color: var(--text-2); font-size: 18px; line-height: 1; transition: transform .15s; }
.cnd-card.open .cnd-chev { transform: rotate(180deg); }
.cnd-body { padding: 12px 14px 14px; }
.cnd-meta { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-bottom: 12px; }
.cnd-meta label { font-size: 12.5px; font-weight: 600; color: var(--text-2); display: flex; flex-direction: column; gap: 4px; }
.cnd-heads, .cnd-inline { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .9fr) minmax(0, 1.3fr); gap: 8px; }
.cnd-heads { font-size: 12px; color: var(--text-2); font-weight: 600; margin: 0 34px 4px 2px; }
.cnd-line { display: flex; align-items: center; gap: 6px; }
.cnd-line .cnd-inline { flex: 1; }
.cnd-inline { border: 0; border-radius: 0; box-shadow: none; }
.cnd-inline > * { border: 1px solid var(--border) !important; border-radius: 9px !important; background: var(--surface) !important; padding: 9px 11px; font-size: 13.5px; min-width: 0; color: var(--text); }
.cnd-inline .cnd-src { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cnd-inline .cnd-val { padding: 0 !important; display: flex; }
.cnd-inline .cnd-val .cnd-in { padding: 9px 11px; font-size: 13.5px; }
.cnd-inline .cnd-val select.cnd-in { cursor: pointer; }
.cnd-inline .cnd-two .cnd-in { padding: 6px 11px !important; }
.cnd-inline .cnd-none { padding: 9px 11px; color: var(--text-2); }
.cnd-inline.bad > * { border-color: #F59E0B !important; }
.cnd-inline .cnd-src:hover, .cnd-inline .cnd-multi:hover { border-color: var(--oc, var(--accent)) !important; }
.cnd-join { font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; margin: 4px 0 4px 4px; }
.cnd-acts { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; gap: 8px; }
.cnd-addr { border: 0; background: color-mix(in srgb, var(--oc) 10%, transparent); color: color-mix(in srgb, var(--oc) 80%, var(--text)); font: inherit; font-weight: 600; font-size: 13.5px; padding: 8px 12px; border-radius: 8px; cursor: pointer; }
.cnd-delg { border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.cnd-delg:hover { color: #DC2626; }
.cnd-addg { display: inline-flex; margin: 2px 0 12px; border: 1.5px solid var(--accent, #7C3AED); color: var(--accent, #7C3AED); background: none; font: inherit; font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 10px; cursor: pointer; }
.cnd-addg:hover { background: color-mix(in srgb, var(--accent, #7C3AED) 8%, transparent); }
.cnd-else { --oc: #DC2626; background: var(--surface-2); }
.cnd-else .cnd-head { cursor: default; }
/* Barra superior del editor en una sola fila */
.fc-top { flex-wrap: nowrap; }
.fc-top .fc-name { width: auto; min-width: 120px; max-width: 280px; field-sizing: content; }
.fc-top .fc-back { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.fc-top .fc-state { max-width: 170px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .fc-top { flex-wrap: wrap; } }
@media (max-width: 760px) { .fc-panel.fc-panel-wide { width: 100%; } .cnd-heads { display: none; } .cnd-inline { grid-template-columns: 1fr; } }
/* Bloque de condición en el lienzo: una fila por salida */
.fcn-cports { padding: 10px 0 8px; }
.fcn-cports .fcn-port { padding: 5px 24px 5px 12px; justify-content: stretch; }
.fcn-cbox { flex: 1; display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border: 1px solid var(--border); border-left: 3px solid #16A34A; border-radius: 8px; background: var(--surface); font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.35; white-space: normal !important; overflow: visible !important; text-align: left; }
.fcn-cbox b { font-size: 12.5px; }
.fcn-celse { flex: 1; text-align: right; font-size: 12px; color: #B91C1C; line-height: 1.35; white-space: normal !important; padding: 6px 2px; }
.fcn-port .fcn-cbox span { white-space: normal; overflow: visible; text-overflow: clip; }
.cnd-inline .cnd-multi { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; white-space: normal !important; text-align: left; min-height: 40px; padding: 6px 26px 6px 8px !important; position: relative; }
.cnd-inline .cnd-multi::after { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.cnd-chip { background: color-mix(in srgb, var(--oc, #2563EB) 12%, transparent); color: var(--text); border-radius: 6px; padding: 3px 7px; font-size: 12.5px; font-weight: 600; }
.cnd-or { font-style: normal; font-size: 11.5px; color: var(--text-2); }
.cnd-ph { color: var(--text-2); }
.cnd-warn { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(217,119,6,.09); border: 1px solid rgba(217,119,6,.35); font-size: 12.5px; line-height: 1.45; color: var(--text); }
.cnd-warn b { display: block; margin-bottom: 2px; }
.cnd-warn .btn { margin-top: 8px; display: inline-flex; }
.cnd-inline { align-items: start; }
.cnd-inline .cnd-val, .cnd-inline .cnd-multi { overflow: visible !important; height: auto !important; max-height: none !important; }
.cnd-inline .cnd-src, .cnd-inline .cnd-op { min-height: 40px; }
/* Acción «Establecer campos personalizados»: varias filas */
.fs-rows { display: flex; flex-direction: column; gap: 6px; }
.fs-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; gap: 6px; align-items: center; }
.fs-row select, .fs-row input { min-width: 0; }
.fs-add { margin-top: 8px; border: 1px dashed var(--border); background: none; border-radius: 8px; padding: 7px 10px; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent, #7C3AED); cursor: pointer; width: 100%; }
.fs-add:hover { background: var(--surface-2); }
/* Variables en los flujos: lista al escribir «{» y botón { } */
.fv-box { position: fixed; z-index: 400; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 14px 34px rgba(15,23,42,.22); overflow: auto; padding: 4px; }
.fv-g { font-size: 11.5px; font-weight: 700; color: var(--text-2); padding: 8px 10px 4px; position: sticky; top: -4px; background: var(--surface); }
.fv-i { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left; font: inherit; font-size: 13.5px; color: var(--text); padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.fv-i code { font-size: 11.5px; color: var(--text-2); background: var(--surface-2); padding: 1px 6px; border-radius: 5px; white-space: nowrap; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.fv-i:hover, .fv-i.on { background: color-mix(in srgb, var(--accent, #7C3AED) 10%, transparent); }
.fv-none { padding: 10px; color: var(--text-2); font-size: 13px; }
.fv-btn { position: fixed; z-index: 390; height: 22px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font: 600 11.5px/20px ui-monospace, monospace; cursor: pointer; }
.fv-btn:hover { color: var(--accent, #7C3AED); border-color: var(--accent, #7C3AED); }
.fv-btn[hidden] { display: none; }
.fv-note { font-size: 12px; color: var(--text-2); background: var(--surface-2); border-radius: 7px; padding: 7px 10px; margin: 2px 2px 4px; line-height: 1.4; }

/* Establecer varios campos: un renglón por campo dentro del bloque */
.fcn-fs { margin: 4px 0 0 18px; display: grid; gap: 3px; }
.fcn-fs > div { font-size: 12px; line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.fcn-fs b { font-weight: 600; }
.fcn-fs b::after { content: ': '; }
.fcn-fs span { color: var(--muted); }
.fcn-var { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 11.5px; line-height: 1.5; }
.fcn-var.sys { background: #E0E7FF; color: #3730A3; }
.fcn-var.cf { background: #DCFCE7; color: #166534; }
.fcn-var.bad { background: #FEE2E2; color: #B91C1C; }
.fv-i code.sys { background: #E0E7FF; color: #3730A3; }
.fv-i code.cf { background: #DCFCE7; color: #166534; }
.fv-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.fv-dot.sys { background: #6366F1; } .fv-dot.cf { background: #16A34A; }
.fv-g small { font-weight: 500; color: var(--text-2); }

/* ---------- Tablas de WaChat ---------- */
.dt-wrap { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.dt-side { padding: 12px; position: sticky; top: 12px; }
.dt-side-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.dt-list { display: grid; gap: 2px; }
.dt-list a { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.dt-list a span { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-list a small { color: var(--text-2); font-size: 11.5px; }
.dt-list a:hover { background: var(--surface-2); }
.dt-list a.on { background: color-mix(in srgb, #0F766E 12%, transparent); }
.dt-list a.on span { color: #0F766E; }
.dt-help { font-size: 12px; color: var(--text-2); line-height: 1.45; margin: 12px 4px 2px; }
.dt-main { padding: 14px 16px; min-width: 0; }
.dt-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dt-top .grow, .dt-bar .grow { flex: 1; }
.dt-title { font-size: 18px; margin: 0; }
.dt-count { font-size: 13px; }
.dt-used { margin-top: 8px; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border-radius: 8px; padding: 7px 10px; }
.dt-bar { display: flex; align-items: center; gap: 8px; margin: 12px 0 10px; flex-wrap: wrap; }
.dt-search { display: flex; align-items: center; gap: 6px; border: 1px solid var(--border-2); border-radius: 8px; padding: 0 8px; height: 30px; color: var(--text-2); min-width: 220px; background: var(--surface); }
.dt-search input { border: 0; outline: 0; background: none; font: inherit; font-size: 13px; color: var(--text); width: 100%; }
.dt-saved { font-size: 12.5px; min-width: 80px; text-align: right; color: var(--text-2); }
.dt-saved.ok { color: var(--ok); } .dt-saved.err { color: var(--bad); }
.dt-scroll { overflow: auto; max-height: calc(100vh - 280px); border: 1px solid var(--border); border-radius: 10px; }
.dt-grid { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; font-size: 13px; }
.dt-grid th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); cursor: pointer; user-select: none; white-space: nowrap; min-width: 140px; }
.dt-grid th span { font-weight: 700; }
.dt-grid th small { display: block; font-weight: 500; color: var(--text-2); font-size: 11px; }
.dt-grid th.sorted span::after { content: ' ↑'; color: #0F766E; } .dt-grid th.sorted.desc span::after { content: ' ↓'; }
.dt-grid td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 0; background: var(--surface); }
.dt-grid td input:not([type=checkbox]), .dt-grid td select { width: 100%; min-width: 140px; border: 0; background: transparent; font: inherit; font-size: 13px; color: var(--text); padding: 7px 10px; outline: 0; border-radius: 0; }
.dt-grid td input:focus, .dt-grid td select:focus { box-shadow: inset 0 0 0 2px #0F766E; background: color-mix(in srgb, #0F766E 5%, var(--surface)); }
.dt-grid .dt-n { position: sticky; left: 0; z-index: 1; min-width: 40px; width: 40px; text-align: center; background: var(--surface-2); cursor: default; }
.dt-grid th.dt-n { z-index: 3; }
.dt-grid tr.pk td { background: color-mix(in srgb, var(--bad) 7%, var(--surface)); }
.dt-grid tr.ok td { transition: background .6s; background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.dt-none { padding: 26px; text-align: center; color: var(--text-2); font-size: 13.5px; }
.dt-pg { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px; font-size: 13px; }
.dt-tip { font-size: 12px; color: var(--text-2); margin: 10px 2px 0; }
.dt-empty { padding: 40px 20px; text-align: center; max-width: 520px; margin: 0 auto; }
.dt-empty p { color: var(--text-2); line-height: 1.5; }
.dt-cols { display: grid; gap: 8px; margin: 12px 0; max-height: 50vh; overflow: auto; }
.dt-col { display: grid; gap: 6px; }
.dt-col-r { display: grid; grid-template-columns: 1fr 160px 30px 30px; gap: 6px; align-items: center; }
.dt-col textarea { margin-left: 0; font-size: 12.5px; }
.dt-seg { margin: 10px 0 12px; }
.dt-seg a { flex: 1; text-align: center; font-weight: 600; font-size: 12.5px; padding: 6px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.dt-seg a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dt-imp-opts { display: grid; gap: 4px; margin-top: 12px; }
.btn.danger-bg { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-bg:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 860px) { .dt-wrap { grid-template-columns: 1fr; } .dt-side { position: static; } .dt-scroll { max-height: 60vh; } }

/* ---------- Herramientas ---------- */
.tl-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tl-card { display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto 1fr; column-gap: 12px; row-gap: 3px; padding: 16px; text-decoration: none; color: var(--text); transition: transform .15s, box-shadow .15s; }
.tl-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg, 0 8px 24px rgba(15,23,42,.12)); }
.tl-card:focus-visible { outline: 2px solid #7C3AED; outline-offset: 2px; }
.tl-ic { grid-row: 1 / 3; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: #7C3AED; }
.tl-ic-in, .tl-ic-out { background: #0F766E; } .tl-ic-poll { background: #DB2777; } .tl-ic-table { background: #16A34A; } .tl-ic-fb { background: #0866FF; }
.tl-ic-seq { background: #F59E0B; } .tl-ic-copy { background: #475569; } .tl-ic-send { background: #EA580C; } .tl-ic-bolt { background: #CA8A04; }
.tl-t { font-weight: 700; font-size: 14.5px; }
.tl-t em { font-style: normal; font-size: 10.5px; font-weight: 700; color: #7C3AED; background: color-mix(in srgb, #7C3AED 12%, transparent); padding: 1px 7px; border-radius: 999px; margin-left: 4px; vertical-align: 1px; }
.tl-d { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.tl-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tl-head h2 { margin: 0; font-size: 19px; }
.tl-head .grow, .tl-row1 .grow, .tl-sv-bar .grow { flex: 1; }
.tl-back { font-size: 13px; color: var(--text-2); text-decoration: none; }
html[data-wall] .tl-head h2, html[data-wall] .tl-back { color: #fff; }
.tl-empty { padding: 28px; max-width: 640px; }
.tl-empty p { color: var(--text-2); line-height: 1.55; }
.tl-list { display: grid; gap: 12px; }
.tl-link { display: grid; grid-template-columns: 112px minmax(0, 1fr) auto auto; gap: 16px; align-items: center; padding: 14px 16px; }
.tl-link.off, .tl-hook.off { opacity: .62; }
.tl-qr { width: 112px; height: 112px; display: grid; place-items: center; background: #fff; border-radius: 8px; border: 1px solid var(--border); }
.tl-qr canvas { width: 104px; height: 104px; image-rendering: pixelated; }
.tl-row1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tl-row1 b { font-size: 15px; }
.tl-msg { font-size: 13px; color: var(--text-2); margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-meta { font-size: 12.5px; color: var(--text-2); margin: 4px 0; }
.tl-url { display: flex; gap: 6px; margin-top: 6px; max-width: 520px; }
.tl-url input { flex: 1; min-width: 0; font-size: 12.5px; height: 30px; padding: 0 8px; border: 1px solid var(--border-2); border-radius: 7px; background: var(--surface-2); color: var(--text); font-family: ui-monospace, monospace; }
.tl-stats { display: flex; gap: 18px; }
.tl-stats div { display: grid; text-align: center; }
.tl-stats b { font-size: 20px; } .tl-stats span { font-size: 11.5px; color: var(--text-2); }
.tl-act { display: grid; gap: 6px; justify-items: stretch; }
.tl-hook { padding: 14px 16px; }
.tl-foot { font-size: 12.5px; margin-top: 12px; line-height: 1.5; }
html[data-wall] .tl-foot { color: rgba(255,255,255,.9); }
.badge.warn { color: #B45309; background: #FEF3C7; border-color: #FDE68A; }
.tl-fm { display: grid; gap: 6px; }
.tl-fm-r { display: grid; grid-template-columns: 1fr 16px 1fr 30px; gap: 6px; align-items: center; }
.tl-sv-bar { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 12px; }
.tl-sv-bar label { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; }
.tl-q { padding: 14px 16px; margin-bottom: 12px; }
.tl-q-h { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-q-h b { font-size: 14.5px; }
.tl-q-n { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-2); margin: 8px 0 10px; }
.tl-pct { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--text); }
.tl-pct i { width: 70px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #DB2777 var(--p), var(--surface-2) var(--p)); }
.tl-bars { display: grid; gap: 6px; }
.tl-bar { display: grid; grid-template-columns: minmax(120px, 240px) 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.tl-bl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-bt { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.tl-bt i { display: block; height: 100%; background: #DB2777; border-radius: 6px; }
.tl-bn { color: var(--text-2); font-size: 12px; text-align: right; }
.tl-ans { display: grid; gap: 4px; max-height: 320px; overflow: auto; }
.tl-ans div { display: grid; grid-template-columns: 170px 1fr; gap: 10px; font-size: 13px; padding: 5px 0; border-bottom: 1px solid var(--border); }
.tl-ans a { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .tl-link { grid-template-columns: 90px 1fr; } .tl-qr { width: 90px; height: 90px; } .tl-qr canvas { width: 82px; height: 82px; } .tl-stats, .tl-act { grid-column: 1 / -1; } .tl-act { display: flex; flex-wrap: wrap; } .tl-bar { grid-template-columns: 1fr 1fr 70px; } .tl-ans div { grid-template-columns: 1fr; gap: 2px; } }
.tl-foot code { background: rgba(255,255,255,.18); color: inherit; padding: 0 4px; border-radius: 4px; }

/* ---------- Reglas automáticas ---------- */
.tl-ic-rule { background: #2563EB; }
.rl-help { font-size: 13px; color: var(--text-2); margin: 0 0 10px; }
html[data-wall] .rl-help { color: rgba(255,255,255,.9); }
.rl-ex { margin: 6px 0 12px 18px; display: grid; gap: 6px; font-size: 13.5px; color: var(--text-2); }
.rl-list { display: grid; gap: 10px; }
.rl-card { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; padding: 12px 14px; align-items: start; }
.rl-card.off { opacity: .6; }
.rl-card.dragging { opacity: .4; outline: 2px dashed #2563EB; }
.rl-grip { cursor: grab; color: var(--text-2); font-size: 18px; line-height: 1.2; user-select: none; padding-top: 2px; }
.rl-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rl-top b { font-size: 15px; }
.rl-when { font-size: 11.5px; font-weight: 600; color: #1D4ED8; background: #DBEAFE; padding: 1px 8px; border-radius: 999px; }
.rl-if, .rl-then { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-top: 7px; font-size: 13px; }
.rl-k { font-weight: 700; color: var(--text-2); font-size: 12px; text-transform: none; }
.rl-c { background: #FEF3C7; color: #92400E; padding: 2px 8px; border-radius: 6px; }
.rl-a { background: #DCFCE7; color: #166534; padding: 2px 8px; border-radius: 6px; }
.rl-join { font-size: 12px; color: var(--text-2); font-weight: 600; }
.rl-meta { font-size: 12px; color: var(--text-2); margin-top: 7px; }
.rl-side { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.modal-box:has(.rl-ed) { width: min(880px, 100%); }
.rl-ed { display: grid; gap: 14px; }
.rl-sec { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; }
.rl-sec-h { font-weight: 700; font-size: 13.5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.rl-radios { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13.5px; }
.rl-match { display: inline-flex; }
.rl-match a { padding: 2px 10px; font-size: 12.5px; cursor: pointer; border-radius: 6px; color: var(--muted); }
.rl-match a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.rl-cond { display: grid; gap: 6px; padding: 8px; border-radius: 10px; background: var(--surface-2); }
.rl-cond-r { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(140px, 1fr) minmax(130px, .8fr) 30px; gap: 6px; align-items: center; }
.rl-cond-r:not(:has([data-cf])) { grid-template-columns: minmax(140px, 1fr) minmax(130px, .8fr) 30px; }
.rl-cond-v { display: flex; gap: 6px; flex-wrap: wrap; }
.rl-cond-v > input, .rl-cond-v > select { flex: 1; min-width: 160px; }
.rl-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.rl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--border-2); border-radius: 999px; font-size: 12.5px; cursor: pointer; background: var(--surface); font-weight: 500; }
.rl-chip input { display: none; }
.rl-chip.on { background: #FEF3C7; border-color: #F59E0B; color: #92400E; }
.rl-none { font-size: 13px; color: var(--text-2); padding: 6px 2px; }
.rl-row-btns { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.rl-add { max-width: 240px; }
.rl-act { border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; display: grid; gap: 6px; background: var(--surface); }
.rl-act-h { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.rl-act-b { display: grid; gap: 6px; }
.rl-act-b > select, .rl-act-b > input { width: 100%; }
.rl-pair { display: grid; grid-template-columns: minmax(150px, 1fr) 14px minmax(150px, 1fr) 30px; gap: 6px; align-items: center; }
.rl-oe { font-size: 13px; }
.rl-prog { display: grid; gap: 6px; margin: 8px 0; font-size: 13px; }
.rl-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.rl-bar i { display: block; height: 100%; width: 0; background: #2563EB; transition: width .3s; }
@media (max-width: 760px) { .rl-card { grid-template-columns: 1fr; } .rl-grip { display: none; } .rl-side { justify-content: flex-start; } .rl-cond-r, .rl-cond-r:not(:has([data-cf])), .rl-pair { grid-template-columns: 1fr; } }
.rl-ed label.check, .rl-prog ~ * label.check { display: inline-flex !important; flex-direction: row !important; align-items: center; gap: 7px; font-weight: 500; }
.rl-ed label.check input { width: auto !important; height: auto; flex: none; margin: 0; }
.dt-ads { margin-top: 8px; font-size: 13px; background: #EFF6FF; color: #1E3A8A; border: 1px solid #BFDBFE; border-radius: 8px; padding: 8px 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dt-ads .ok-txt { color: var(--ok); font-weight: 600; }
.btn.dt-ads-on { border-color: #93C5FD; background: #EFF6FF; color: #1D4ED8; }
.ad-map { display: grid; gap: 6px; margin-bottom: 8px; }
.ad-map-r { display: grid; grid-template-columns: 1fr 16px 1fr 30px; gap: 6px; align-items: center; }
.modal-actions .grow { flex: 1; }
.lg-solved { opacity: .55; }
.lg-stack { white-space: pre-wrap; font-size: 11.5px; max-height: 220px; overflow: auto; background: var(--surface-2); padding: 8px; border-radius: 6px; margin: 6px 0; }
.install-app { white-space: nowrap; }
/* Analíticas: ganadas y perdidas */
.bad-txt { color: var(--bad); }
.an-out .card-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.an-pl { margin-left: auto; }
.an-out-k { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.an-out-k div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.an-out-k small { font-size: 12px; color: var(--text-2); font-weight: 600; }
.an-out-k b { font-size: 22px; }
.an-out-k em { font-style: normal; font-size: 11px; color: var(--text-2); }
.an-sub { font-size: 13.5px; margin: 0 0 8px; }
@media (max-width: 760px) { .an-out-k { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sw-rows { display: grid; gap: 6px; margin-top: 12px; max-height: 50vh; overflow: auto; }
.sw-r { display: grid; grid-template-columns: 1fr 16px 1.2fr; gap: 8px; align-items: center; font-size: 13.5px; }
.tl-head .btn + .btn { margin-left: 0; }
/* ---------- Recordatorios y seguimiento ---------- */
.tl-ic-bell { background: #EA580C; }
/* Auditoría configurable */
.qa-tabs { margin-bottom: 14px; }
.qa-critical { border-left: 3px solid #DC2626; }
.badge.qa-cr { background: #FEE2E2; color: #B91C1C; border-color: #FECACA; }
.qa-month { margin-left: auto; }
.qa-sup { display: grid; grid-template-columns: 44px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.qa-sup.done { opacity: .6; }
.qa-sup-a { display: flex; gap: 6px; align-items: center; }
.qc-crit { display: grid; gap: 6px; margin-bottom: 8px; }
.qc-r { display: grid; grid-template-columns: 1fr 80px 30px; gap: 6px; }
.qa-conf textarea { width: 100%; }
@media (max-width: 760px) { .qa-sup { grid-template-columns: 44px 1fr; } .qa-sup-a { grid-column: 1 / -1; } }
.rm-link { display: grid; gap: 10px; justify-items: start; }
/* Frases con casillas en una sola línea («Avisar a los [3] min…») */
.rm-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
/* ---------- Menú lateral por grupos (Ventas, Automatización…) y modo compacto ---------- */
nav { gap: 1px; }
.nav-item { padding: 7px 10px; }
.nav-item .nav-ic { width: 28px; height: 28px; }
.nav-grp { margin-top: 4px; }
.nav-grp-h { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; background: none; border: 0; border-radius: 8px;
  color: var(--side-text); font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; padding: 9px 10px 5px; cursor: pointer; opacity: .8; }
.nav-grp-h:hover, .nav-grp-h:focus-visible { opacity: 1; color: #fff; outline: none; }
.nav-grp-h svg { transition: transform .15s; transform: rotate(-90deg); flex: none; }
.nav-grp.open .nav-grp-h svg { transform: none; }
.nav-grp.has-active:not(.open) .nav-grp-h { color: #fff; }
.nav-grp-b { display: none; flex-direction: column; gap: 1px; }
.nav-grp.open .nav-grp-b { display: flex; }
#menuBtn { display: inline-grid; }

@media (min-width: 761px) {
  body.sb-mini .sidebar { width: 76px; }
  body.sb-mini .brand { justify-content: center; padding: 16px 0 12px; margin: 6px 6px 0; }
  body.sb-mini .brand-txt, body.sb-mini .sw-caret, body.sb-mini .nav-t, body.sb-mini .me > span:last-child { display: none; }
  body.sb-mini nav { padding: 4px 10px; }
  body.sb-mini .nav-item { justify-content: center; padding: 6px; position: relative; }
  body.sb-mini .nav-item .pill { position: absolute; top: 0; right: 2px; margin: 0; font-size: 10px; min-width: 17px; height: 17px; padding: 0 4px; }
  body.sb-mini .nav-grp-h { justify-content: center; padding: 8px 0; cursor: default; }
  body.sb-mini .nav-grp-h span, body.sb-mini .nav-grp-h svg { display: none; }
  body.sb-mini .nav-grp-h::after { content: ''; width: 26px; height: 1px; background: rgba(255,255,255,.18); }
  body.sb-mini .nav-grp-b { display: flex; }
  body.sb-mini .side-foot { flex-direction: column; padding: 10px 6px; }
}
/* ---------- Bandeja con aspecto de WhatsApp: fondo con dibujos, burbujas verde/blanco con colita, cabecera y caja de texto ---------- */
:root { --wa-wall: #EFEAE2; --wa-doodle-op: .13; --wa-in: #FFFFFF; --wa-out: #D9FDD3; --wa-bot: #E9E3FB; --wa-text: #111B21; --wa-meta: #667781;
  --wa-bar: #F0F2F5; --wa-read: #53BDEB; --wa-green: #00A884; --wa-day: #FFFFFF; --wa-sys: #FFF6D8; --wa-sys-text: #54656F; --wa-art-bg: #DDF3E9; }
[data-theme="dark"] { --wa-wall: #0B141A; --wa-doodle-op: .045; --wa-in: #202C33; --wa-out: #005C4B; --wa-bot: #3A3266; --wa-text: #E9EDEF; --wa-meta: #8696A0;
  --wa-bar: #202C33; --wa-day: #182229; --wa-sys: #182229; --wa-sys-text: #8696A0; --wa-art-bg: #1D3A36; }

.chat, html[data-wall] .chat { background: var(--wa-wall); position: relative; isolation: isolate; }
.chat::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: var(--wa-doodle-op);
  background-image: url("data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="300" height="300" fill="none" stroke="%238a7f6e" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"%3E%3Cg transform="translate(20 22) rotate(-20 12 12)"%3E%3Cpath d="M2 4a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H10l-5 4v-4H5a3 3 0 0 1-3-3z"/%3E%3C/g%3E%3Cg transform="translate(120 16) rotate(17 12 12)"%3E%3Cpath d="M12 21s-8-5-8-11a4.5 4.5 0 0 1 8-2.8A4.5 4.5 0 0 1 20 10c0 6-8 11-8 11z"/%3E%3C/g%3E%3Cg transform="translate(210 30) rotate(14 12 12)"%3E%3Cpath d="m12 2 3 6.5 7 .8-5.2 4.8 1.5 7-6.3-3.6-6.3 3.6 1.5-7L2 9.3l7-.8z"/%3E%3C/g%3E%3Cg transform="translate(40 110) rotate(11 12 12)"%3E%3Cpath d="M2 5h8a3 3 0 0 1 3 3v13a2 2 0 0 0-2-2H2zM22 5h-8a3 3 0 0 0-3 3v13a2 2 0 0 1 2-2h9z"/%3E%3C/g%3E%3Cg transform="translate(150 95) rotate(8 12 12)"%3E%3Cpath d="M2 9 12 4l10 5-10 5zM6 11v5c3 2.5 9 2.5 12 0v-5M22 9v6"/%3E%3C/g%3E%3Cg transform="translate(245 120) rotate(5 12 12)"%3E%3Ccircle cx="12" cy="12" r="10"/%3E%3Cpath d="M12 6v6l4 2"/%3E%3C/g%3E%3Cg transform="translate(85 190) rotate(2 12 12)"%3E%3Ccircle cx="12" cy="12" r="10"/%3E%3Cpath d="M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01"/%3E%3C/g%3E%3Cg transform="translate(190 185) rotate(-1 12 12)"%3E%3Cpath d="M22 2 11 13M22 2l-7 20-4-9-9-4z"/%3E%3C/g%3E%3Cg transform="translate(15 250) rotate(-4 12 12)"%3E%3Cpath d="M17 3a2.8 2.8 0 0 1 4 4L7.5 20.5 2 22l1.5-5.5z"/%3E%3C/g%3E%3Cg transform="translate(270 230) rotate(-7 12 12)"%3E%3Cpath d="M9 18V5l12-2v13"/%3E%3Ccircle cx="6" cy="18" r="3"/%3E%3Ccircle cx="18" cy="16" r="3"/%3E%3C/g%3E%3Cg transform="translate(130 260) rotate(-10 12 12)"%3E%3Cpath d="M2 12l5 5L18 6M9 15l1 1 11-11"/%3E%3C/g%3E%3Cg transform="translate(250 10) rotate(-13 12 12)"%3E%3Crect x="5" y="2" width="14" height="20" rx="2.5"/%3E%3Cpath d="M11 18h2"/%3E%3C/g%3E%3Cg transform="translate(60 60) rotate(-16 12 12)"%3E%3Cpath d="M4 4h16v12H5.2L4 17.2z"/%3E%3Cpath d="M8 9h8M8 12h5"/%3E%3C/g%3E%3Cg transform="translate(200 250) rotate(-19 12 12)"%3E%3Cpath d="M3 11h18M5 11V8a7 7 0 0 1 14 0v3M4 11l1.2 9h13.6L20 11"/%3E%3C/g%3E%3C/svg%3E"); background-size: 300px 300px; }
[data-theme="dark"] .chat::before { background-image: url("data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" width="300" height="300" fill="none" stroke="%23c9d4dc" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"%3E%3Cg transform="translate(20 22) rotate(-20 12 12)"%3E%3Cpath d="M2 4a3 3 0 0 1 3-3h14a3 3 0 0 1 3 3v9a3 3 0 0 1-3 3H10l-5 4v-4H5a3 3 0 0 1-3-3z"/%3E%3C/g%3E%3Cg transform="translate(120 16) rotate(17 12 12)"%3E%3Cpath d="M12 21s-8-5-8-11a4.5 4.5 0 0 1 8-2.8A4.5 4.5 0 0 1 20 10c0 6-8 11-8 11z"/%3E%3C/g%3E%3Cg transform="translate(210 30) rotate(14 12 12)"%3E%3Cpath d="m12 2 3 6.5 7 .8-5.2 4.8 1.5 7-6.3-3.6-6.3 3.6 1.5-7L2 9.3l7-.8z"/%3E%3C/g%3E%3Cg transform="translate(40 110) rotate(11 12 12)"%3E%3Cpath d="M2 5h8a3 3 0 0 1 3 3v13a2 2 0 0 0-2-2H2zM22 5h-8a3 3 0 0 0-3 3v13a2 2 0 0 1 2-2h9z"/%3E%3C/g%3E%3Cg transform="translate(150 95) rotate(8 12 12)"%3E%3Cpath d="M2 9 12 4l10 5-10 5zM6 11v5c3 2.5 9 2.5 12 0v-5M22 9v6"/%3E%3C/g%3E%3Cg transform="translate(245 120) rotate(5 12 12)"%3E%3Ccircle cx="12" cy="12" r="10"/%3E%3Cpath d="M12 6v6l4 2"/%3E%3C/g%3E%3Cg transform="translate(85 190) rotate(2 12 12)"%3E%3Ccircle cx="12" cy="12" r="10"/%3E%3Cpath d="M8 14s1.5 2 4 2 4-2 4-2M9 9h.01M15 9h.01"/%3E%3C/g%3E%3Cg transform="translate(190 185) rotate(-1 12 12)"%3E%3Cpath d="M22 2 11 13M22 2l-7 20-4-9-9-4z"/%3E%3C/g%3E%3Cg transform="translate(15 250) rotate(-4 12 12)"%3E%3Cpath d="M17 3a2.8 2.8 0 0 1 4 4L7.5 20.5 2 22l1.5-5.5z"/%3E%3C/g%3E%3Cg transform="translate(270 230) rotate(-7 12 12)"%3E%3Cpath d="M9 18V5l12-2v13"/%3E%3Ccircle cx="6" cy="18" r="3"/%3E%3Ccircle cx="18" cy="16" r="3"/%3E%3C/g%3E%3Cg transform="translate(130 260) rotate(-10 12 12)"%3E%3Cpath d="M2 12l5 5L18 6M9 15l1 1 11-11"/%3E%3C/g%3E%3Cg transform="translate(250 10) rotate(-13 12 12)"%3E%3Crect x="5" y="2" width="14" height="20" rx="2.5"/%3E%3Cpath d="M11 18h2"/%3E%3C/g%3E%3Cg transform="translate(60 60) rotate(-16 12 12)"%3E%3Cpath d="M4 4h16v12H5.2L4 17.2z"/%3E%3Cpath d="M8 9h8M8 12h5"/%3E%3C/g%3E%3Cg transform="translate(200 250) rotate(-19 12 12)"%3E%3Cpath d="M3 11h18M5 11V8a7 7 0 0 1 14 0v3M4 11l1.2 9h13.6L20 11"/%3E%3C/g%3E%3C/svg%3E"); }
.msgs { background: none; padding: 16px 7% 12px; gap: 2px; }

.chat-h { background: var(--wa-bar); border-bottom: 0; }
.composer { background: var(--wa-bar); border-top: 0; padding: 8px 14px 10px; }
.composer textarea { border-radius: 22px; border: 0; background: var(--surface); padding: 11px 16px; box-shadow: none; }
[data-theme="dark"] .composer textarea { background: #2A3942; color: var(--wa-text); }
.composer #sendBtn { width: 44px; height: 44px; padding: 0; border-radius: 50%; background: var(--wa-green); border-color: var(--wa-green); display: grid; place-items: center; flex: none; }

/* Burbujas */
.msgs .bubble { border: 0; border-radius: 8px; color: var(--wa-text); padding: 6px 9px 7px; max-width: min(65%, 560px); font-size: 14.2px; line-height: 1.4;
  box-shadow: 0 1px .5px rgba(11,20,26,.13); position: relative; }
.msgs .bubble.in { background: var(--wa-in); }
.msgs .bubble.out { background: var(--wa-out); }
.msgs .bubble.out.bot { background: var(--wa-bot); }
.msgs .bubble.note { background: #FEF3C7; color: #78350F; border: 1px dashed #F59E0B; }
/* primera de un grupo: separación y colita (como en WhatsApp) */
.msgs > .bubble.in:not(.bubble.in + .bubble.in), .msgs > .bubble.out:not(.bubble.out + .bubble.out) { margin-top: 8px; }
.msgs > .bubble.in:not(.bubble.in + .bubble.in) { border-top-left-radius: 0; }
.msgs > .bubble.out:not(.bubble.out + .bubble.out) { border-top-right-radius: 0; }
.msgs > .bubble.in:not(.bubble.in + .bubble.in)::before, .msgs > .bubble.out:not(.bubble.out + .bubble.out)::before {
  content: ''; position: absolute; top: 0; width: 8px; height: 13px; background: inherit; }
.msgs > .bubble.in:not(.bubble.in + .bubble.in)::before { left: -8px; clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msgs > .bubble.out:not(.bubble.out + .bubble.out)::before { right: -8px; clip-path: polygon(0 0, 100% 0, 0 100%); }
.msgs .bubble .ft { color: var(--wa-meta); font-size: 11px; margin-top: 2px; }
.msgs .bubble .ft .read { color: var(--wa-read); }
.msgs .bubble img, .msgs .bubble video { border-radius: 6px; }
.msgs .day { background: var(--wa-day); color: var(--wa-meta); border: 0; border-radius: 8px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  box-shadow: 0 1px .5px rgba(11,20,26,.13); margin: 12px 0 6px; }
.msgs .sysmsg { background: var(--wa-sys); color: var(--wa-sys-text); border-radius: 8px; padding: 5px 12px; margin: 6px 0; font-size: 12px; box-shadow: 0 1px .5px rgba(11,20,26,.1); }

/* Sin conversación abierta: portada como la de WhatsApp en la computadora */
.wa-intro { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 24px 0;
  background: var(--wa-bar); border-bottom: 6px solid var(--wa-green); color: var(--wa-meta); }
.wa-intro-art { width: min(320px, 70%); margin-bottom: 26px; }
.wa-intro-art svg { width: 100%; height: auto; display: block; }
.wa-intro h2 { margin: 0 0 10px; font-size: 30px; font-weight: 300; color: var(--wa-text); letter-spacing: -.01em; }
.wa-intro p { margin: 0; max-width: 46ch; font-size: 14px; line-height: 1.55; }
.wa-intro-n { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 22px; }
.wa-intro-n button { border: 1px solid color-mix(in srgb, var(--wa-meta) 30%, transparent); background: var(--surface); color: var(--wa-text); border-radius: 999px;
  padding: 7px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.wa-intro-n button b { color: var(--wa-green); margin-right: 4px; }
.wa-intro-n button:hover { border-color: var(--wa-green); }
.wa-intro-lock { margin-top: auto; padding: 28px 0 22px; font-size: 13px; display: flex; gap: 6px; align-items: center; }
[data-theme="dark"] .wa-intro { background: #222E35; }
[data-theme="dark"] .wa-intro-n button { background: #2A3942; }

/* Sin conversación abierta no se muestra el panel derecho vacío */
.inbox:not(.has-chat) .side-panel { display: none; }
@media (min-width: 1561px) { .inbox:not(.has-chat) { grid-template-columns: 210px 340px minmax(0,1fr); } }
@media (min-width: 1081px) and (max-width: 1560px) { .inbox:not(.has-chat) { grid-template-columns: 320px minmax(0,1fr); } }
@media (max-width: 760px) { .msgs { padding: 12px 10px; } .msgs .bubble { max-width: 85%; } }
.wa-intro-n button:has(b:empty) { display: none; }

/* Columna de carpetas: «Canales» y «Por asesor» plegables */
button.folder-title { display: flex; width: 100%; align-items: center; justify-content: space-between; background: none; border: 0; font-family: inherit; cursor: pointer; text-align: left; }
button.folder-title:hover { color: var(--text); }
button.folder-title span { transition: transform .15s; }
.fold-sec.shut .fold-b { display: none; }
.fold-sec.shut button.folder-title span { transform: rotate(-90deg); }

/* Con fondos de color los paneles tienen esquinas redondeadas (overflow: hidden): el panel derecho y las carpetas deben seguir desplazándose */
html[data-wall] .inbox > .side-panel, html[data-wall] .inbox > .folders { overflow-y: auto; overscroll-behavior: contain; }
/* ---------- Herramientas › Recordatorios: portada con reglas de envío, secciones por situación y tarjetas con color ---------- */
.rm2 { display: grid; gap: 14px; padding-bottom: 76px; }
.rm2-hero { padding: 20px 22px; display: grid; gap: 16px; }
.rm2-hero-t { display: flex; gap: 16px; align-items: flex-start; }
.rm2-hero-ic { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; color: #fff; background: linear-gradient(135deg, #F97316, #EA580C); box-shadow: 0 8px 20px rgba(234,88,12,.3); }
.rm2-hero-x { flex: 1; min-width: 0; }
.rm2-hero-x h2 { margin: 2px 0 4px; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.rm2-hero-x p { margin: 0; font-size: 13.5px; color: var(--text-2); max-width: 70ch; line-height: 1.5; }
.rm2-master { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 14px; border-radius: 12px; background: color-mix(in srgb, var(--ok) 10%, transparent); }
.rm2-master .rm-state { font-size: 12.5px; color: var(--ok); }
.rm2.is-off .rm2-master { background: var(--surface-2); }
.rm2.is-off .rm2-master .rm-state { color: var(--muted); }
.rm2-rules { display: grid; grid-template-columns: minmax(310px, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 10px; }
.rm2-rule { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; align-content: start; font-size: 13.5px; }
.rm2-rule small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.rm2-rule.soft { background: transparent; border-style: dashed; }
.rm2-off-note { display: none; margin: 0; padding: 9px 12px; border-radius: 10px; background: #FFF7ED; color: #9A3412; font-size: 13px; }
.rm2.is-off .rm2-off-note { display: block; }
[data-theme="dark"] .rm2-off-note { background: #3b2412; color: #FDBA74; }

.rm2-sec { display: flex; align-items: center; gap: 8px; margin: 10px 2px 0; font-size: 14px; font-weight: 800; color: var(--text); }
.rm2-sec svg { color: var(--muted); }
html[data-wall] .rm2-sec { color: #fff; } html[data-wall] .rm2-sec svg { color: rgba(255,255,255,.75); }
.rm2-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 12px; align-items: start; }

.rm2-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; transition: box-shadow .15s, border-color .15s; }
html[data-wall] .rm2-card { border-color: transparent; box-shadow: 0 10px 30px rgba(3,7,30,.16); }
.rm2-card > header { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.rm2-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); transition: background .15s, color .15s; }
.rm2-card.on .rm2-ic { background: var(--c); color: #fff; }
.rm2-tt { flex: 1; min-width: 0; }
.rm2-tt b { display: block; font-size: 14px; }
.rm2-tt small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.rm2-card:not(.on) .rm2-tt b { color: var(--text-2); }
.rm2-body { display: none; gap: 10px; padding: 12px 16px 16px; border-top: 1px solid var(--border); font-size: 13.5px; box-shadow: inset 3px 0 0 var(--c); }
.rm2-card.on .rm2-body { display: grid; }
.rm2-card.on { border-color: color-mix(in srgb, var(--c) 35%, var(--border)); }

.rm2 input.rm2-n { width: 64px; text-align: center; padding-left: 6px; padding-right: 6px; }
.rm2 input.rm2-t { width: 132px; }
.rm2 input.rm2-w { width: 110px; }
.rm2 input.rm2-wl { width: 150px; }
.rm2 .rm-line input, .rm2 .rm-line select { display: inline-block; margin: 0; }
.rm2-f { display: grid; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.rm2-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.rm2-hint { color: var(--muted); font-size: 12px; margin-top: -4px; }
.rm2-checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.rm2-act { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); }
.rm2-act-l { width: 100%; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.rm2-act select { width: auto; min-width: 220px; }
.rm2-act label { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-2); }

.rm2-bar { position: sticky; bottom: 12px; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--border); box-shadow: 0 12px 30px rgba(3,7,30,.18); }
.rm2-bar #rmReset { margin-left: auto; }
.rm2-dirty { color: #C2410C; font-weight: 700; font-size: 13px; }
[data-theme="dark"] .rm2-dirty { color: #FDBA74; }
.rm2-ro { margin: 0; }

@media (max-width: 1250px) { .rm2-rules { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .rm2-hero { padding: 16px; } .rm2-hero-t { flex-wrap: wrap; } .rm2-hero-ic { display: none; }
  .rm2-master { flex-direction: row; } .rm2-two { grid-template-columns: 1fr; }
  .rm2-rules { grid-template-columns: 1fr 1fr; gap: 8px; } .rm2-rule:first-child, .rm2-rule.soft { grid-column: 1 / -1; } .rm2-rule { padding: 8px 10px; }
  .rm2-act select { min-width: 0; width: 100%; } .rm2-bar { bottom: 8px; }
}
.rm2 .switch span { background: var(--border-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 12%, transparent); }
.rm2 .switch input:checked + span { background: var(--ok); box-shadow: none; }

/* Filas «pregunta → respuesta» y recuadro «Así funciona» */
.rm2-row { display: grid; gap: 6px; }
.rm2-k { font-size: 12px; font-weight: 700; color: var(--text-2); }
.rm2-row > input, .rm2-row > select { width: 100%; }
.rm2-two > input, .rm2-two > select { width: 100%; }
.rm2-how { padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.55; color: var(--text); background: color-mix(in srgb, var(--c) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--c) 22%, transparent); }
.rm2-how > b { color: var(--c); }
[data-theme="dark"] .rm2-how > b { color: color-mix(in srgb, var(--c) 60%, #fff); }
.rm2 select.rm2-u { width: auto; display: inline-block; margin: 0; }
