:root {
  --navy: #1E2938;
  --navy-2: #253246;
  --navy-3: #30405A;
  --navy-line: rgba(255, 255, 255, .09);
  --verde: #72C267;
  --verde-600: #54B452;
  --verde-700: #2F7F2C;
  --verde-50: #EAF6E8;
  --amarillo: #FFD600;
  --ambar: #E59A00;
  --ambar-50: #FDF3DC;
  --azul: #2F7FD8;
  --azul-50: #E6F0FB;
  --fondo: #F5F7FA;
  --tinta: #1B2433;
  --humo: #7A8596;
  --humo-2: #5B6678;
  --linea: #E2E7EE;
  --surface: #FFFFFF;
  --ok: #2F7F2C;
  --ok-50: #EAF6E8;
  --bad: #C2372A;
  --bad-50: #FCEAE8;
  --bubble-out: #DCF5D6;
  --bubble-in: #FFFFFF;
  --chat-bg: #EEF1F5;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(30, 41, 56, .06), 0 12px 28px -18px rgba(30, 41, 56, .35);
  --display: "Sora", "Helvetica Neue", Arial, sans-serif;
  --sans: "DM Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 15px; line-height: 1.45; color: var(--tinta); background: var(--fondo); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid var(--amarillo); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--amarillo); color: var(--navy); padding: 8px 14px; border-radius: 8px; font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
.num { font-family: var(--display); font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); grid-template-rows: 64px minmax(0, 1fr); height: 100vh; height: 100dvh; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--navy); color: #fff; border-bottom: 1px solid var(--navy-line); z-index: 40; }
.menu-btn { display: none; background: none; border: 0; color: inherit; padding: 8px; margin-left: -8px; border-radius: 8px; }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand img { height: 28px; width: auto; display: block; }
.brand-sep { width: 1px; height: 30px; background: var(--navy-line); }
.brand-title { font-family: var(--display); font-weight: 700; font-size: 15px; line-height: 1.1; white-space: nowrap; }
.brand-title small { display: block; font-family: var(--sans); font-weight: 500; font-size: 12px; color: #A8B3C4; }
.spacer { flex: 1; }
.synthetic { font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); background: var(--amarillo); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.me { display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--verde-600); color: #fff; font-family: var(--display); font-weight: 700; font-size: 13px; flex: none; }
.me-txt { font-weight: 600; font-size: 14px; line-height: 1.15; }
.me-txt small { display: block; font-weight: 400; font-size: 12px; color: #A8B3C4; }

.sidebar { background: var(--navy); color: #DCE3EC; padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-label { font-weight: 700; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: #7F8BA0; padding: 10px 12px 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; color: inherit; text-align: left; padding: 10px 12px; border-radius: 9px; font-size: 15px; font-weight: 600; }
.nav-item svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--navy-2); }
.nav-item[aria-current="page"] { background: var(--navy-3); color: #fff; box-shadow: inset 3px 0 0 var(--verde); }
.nav-item[aria-current="page"] svg { color: var(--verde); opacity: 1; }
.nav-item .count { margin-left: auto; background: var(--verde); color: var(--navy); font-size: 12px; font-weight: 800; min-width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px; }
.nav-item .count.alert { background: #F0604D; color: #fff; }
.side-foot { margin-top: auto; padding: 14px 12px 4px; border-top: 1px solid var(--navy-line); font-size: 13px; color: #A8B3C4; display: grid; gap: 8px; }
.side-foot b { color: #fff; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.side-foot .ln { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.side-foot .ln i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); display: inline-block; flex: none; box-shadow: 0 0 0 3px rgba(114, 194, 103, .2); }
.scrim { display: none; }

.main { overflow-y: auto; min-width: 0; background: var(--fondo); }
.main:focus { outline: none; }
.page { padding: 28px 32px 48px; max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: -.01em; }
.page-head p { margin: 6px 0 0; color: var(--humo-2); }
.page-head .grow { flex: 1; min-width: 220px; }
.eyebrow { font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--verde-700); }

/* ---------- Botones e inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 9px; border: 1px solid var(--linea); background: var(--surface); padding: 9px 14px; font-weight: 700; font-size: 14px; line-height: 1.1; white-space: nowrap; }
.btn:hover { border-color: #C6CFDB; }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--verde); border-color: var(--verde); color: var(--navy); }
.btn.primary:hover { background: var(--verde-600); border-color: var(--verde-600); }
.btn.dark { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(30, 41, 56, .06); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.input, .select, .textarea { width: 100%; border: 1px solid var(--linea); background: var(--surface); border-radius: 9px; padding: 9px 12px; font-size: 14px; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--verde); outline-offset: 0; border-color: transparent; }
.textarea { resize: vertical; min-height: 70px; }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 700; font-size: 13px; color: var(--humo-2); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 12.5px; font-weight: 600; background: var(--fondo); border: 1px solid var(--linea); white-space: nowrap; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--humo)); display: inline-block; }
button.chip { cursor: pointer; }
button.chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px; border-radius: 6px; padding: 2px 8px; background: var(--fondo); border: 1px solid var(--linea); color: var(--humo-2); white-space: nowrap; }
.badge.ok { background: var(--ok-50); border-color: transparent; color: var(--ok); }
.badge.warn { background: var(--ambar-50); border-color: transparent; color: #8A5B00; }
.badge.info { background: var(--azul-50); border-color: transparent; color: #1D5FA8; }
.badge.bad { background: var(--bad-50); border-color: transparent; color: var(--bad); }
.badge.stage { background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 80%, #000); border-color: transparent; }
.mini-av { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--c, var(--navy-3)); color: #fff; font-size: 10.5px; font-weight: 700; flex: none; }

.card { background: var(--surface); border: 1px solid var(--linea); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 18px 0; flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-family: var(--display); font-weight: 700; font-size: 16px; }
.card-h .grow { flex: 1; }
.card-b { padding: 14px 18px 18px; }

/* ---------- Resumen ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { padding: 16px 18px; }
.kpi .lbl { font-weight: 600; font-size: 13.5px; color: var(--humo-2); }
.kpi .val { font-family: var(--display); font-weight: 700; font-size: 34px; line-height: 1; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 13px; color: var(--humo-2); margin-top: 8px; }
.kpi .sub b { color: var(--ok); font-weight: 700; }
.kpi.hl { background: var(--navy); color: #fff; border-color: var(--navy); }
.kpi.hl .lbl, .kpi.hl .sub { color: #B6C1D1; }
.kpi.hl .val { color: var(--verde); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-content: start; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; align-items: end; height: 190px; padding-top: 10px; }
.bar { display: grid; grid-template-rows: auto 1fr auto; gap: 6px; height: 100%; text-align: center; }
.bar .v { font-weight: 700; font-size: 13px; }
.bar .col { align-self: end; background: var(--navy-3); border-radius: 6px 6px 2px 2px; min-height: 6px; }
.bar.today .col { background: var(--verde-600); }
.bar .d { font-weight: 600; color: var(--humo-2); font-size: 13px; }
.hbars { display: grid; gap: 10px; }
.hbars div { display: grid; grid-template-columns: 130px 1fr 44px; gap: 10px; align-items: center; font-size: 13.5px; }
.hbars .track { height: 10px; background: #EDF0F4; border-radius: 99px; overflow: hidden; }
.hbars .track i { display: block; height: 100%; background: var(--c, var(--navy)); border-radius: 99px; }
.hbars b { text-align: right; font-variant-numeric: tabular-nums; }
.pipeline-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.pipeline-strip div { background: var(--fondo); border-radius: 10px; padding: 10px 12px; border-top: 3px solid var(--c); }
.pipeline-strip small { display: block; font-size: 12px; color: var(--humo-2); font-weight: 600; }
.pipeline-strip b { font-family: var(--display); font-size: 22px; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 10px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid #EEF1F5; font-size: 13.5px; }
.feed li:last-child { border-bottom: 0; }
.feed li::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--verde-600); margin-top: 6px; }
.feed small { display: block; color: var(--humo); font-size: 12px; }
.fine { font-size: 12.5px; color: var(--humo); margin: 10px 0 0; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 700; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--humo-2); padding: 11px 14px; border-bottom: 1px solid var(--linea); white-space: nowrap; background: #FAFBFC; }
td { padding: 11px 14px; border-bottom: 1px solid #EEF1F5; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: #F8FAFC; }
tbody tr.fresh, .kcard.fresh { animation: flash 2.6s ease-out; }
@keyframes flash { from { background: #FFF6BF; } to { background: transparent; } }
td .strong { font-weight: 700; }
td small { display: block; color: var(--humo-2); font-size: 12px; }
.who-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.meter { height: 6px; background: #EDF0F4; border-radius: 99px; overflow: hidden; width: 110px; margin-top: 5px; }
.meter i { display: block; height: 100%; background: var(--verde-600); border-radius: 99px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--linea); }
.toolbar .input { max-width: 260px; }
.toolbar .select { width: auto; }
.seg { display: inline-flex; gap: 2px; background: #EDF0F4; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--humo-2); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(30, 41, 56, .12); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kcol { background: #EAEEF3; border-radius: 12px; padding: 10px; min-height: 240px; display: flex; flex-direction: column; gap: 8px; }
.kcol.over { outline: 2px dashed var(--verde-600); outline-offset: -4px; background: var(--verde-50); }
.kcol-h { display: flex; align-items: center; gap: 8px; padding: 2px 4px 6px; font-weight: 700; font-size: 13.5px; }
.kcol-h i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.kcol-h span { margin-left: auto; color: var(--humo-2); font-weight: 600; }
.kcard { background: #fff; border: 1px solid var(--linea); border-radius: 10px; padding: 10px 12px; display: grid; gap: 6px; text-align: left; width: 100%; box-shadow: 0 1px 1px rgba(30, 41, 56, .05); cursor: grab; }
.kcard:hover { border-color: #C6CFDB; }
.kcard b { font-size: 14px; }
.kcard .prog { font-size: 12.5px; color: var(--humo-2); line-height: 1.3; }
.kcard .foot { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--humo); }
.kcard .foot .spacer { flex: 1; }
.kcard .warn-sla { color: var(--bad); font-weight: 700; }

/* ---------- Bandeja ---------- */
.inbox { display: grid; grid-template-columns: 330px minmax(0, 1fr) 310px; height: 100%; min-height: 0; }
.clist { border-right: 1px solid var(--linea); display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.clist-top { padding: 14px 14px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--linea); }
.clist-top h1 { font-family: var(--display); font-weight: 700; font-size: 20px; }
.lines { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.lines button { border: 1px solid var(--linea); background: #fff; border-radius: 999px; padding: 5px 10px; font-size: 12.5px; font-weight: 700; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; color: var(--humo-2); }
.lines button i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.lines button[aria-pressed="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.clist ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.citem { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; width: 100%; border: 0; background: none; text-align: left; padding: 12px 14px; border-bottom: 1px solid #EEF1F5; }
.citem:hover { background: #F8FAFC; }
.citem[aria-current="true"] { background: var(--verde-50); box-shadow: inset 3px 0 0 var(--verde-600); }
.citem .avatar { width: 42px; height: 42px; font-size: 14px; background: var(--navy-3); }
.citem .nm, .citem .pv { display: block; }
.citem .nm { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.citem .pv { font-size: 13px; color: var(--humo-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.citem .tg { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--humo-2); }
.citem .tg .ln { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; }
.citem .tg .ln i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.citem .meta { display: grid; justify-items: end; gap: 6px; font-size: 12px; color: var(--humo); align-content: start; }
.citem .un { background: var(--verde-600); color: #fff; font-weight: 700; font-size: 12px; min-width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; padding: 0 5px; }
.citem.unread .pv { color: var(--tinta); font-weight: 600; }

.thread { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--chat-bg); }
.thread-h { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--linea); min-height: 62px; }
.thread-h .avatar { background: var(--navy-3); }
.thread-h .who { min-width: 0; flex: 1; }
.thread-h .who b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-h .who small { display: block; color: var(--humo-2); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-h .back-btn, .cpanel .back-btn { display: none; }
.timer { font-weight: 700; font-size: 12px; color: var(--ok); background: var(--ok-50); border-radius: 6px; padding: 3px 8px; white-space: nowrap; }
.timer.off { color: var(--bad); background: var(--bad-50); }
.msgs { flex: 1; overflow-y: auto; padding: 20px clamp(12px, 3vw, 36px); display: flex; flex-direction: column; gap: 10px; background-image: radial-gradient(rgba(30, 41, 56, .05) 1px, transparent 1px); background-size: 18px 18px; }
.msgs > * { flex: none; }
.bubble { max-width: min(520px, 82%); padding: 8px 12px 6px; border-radius: 10px; font-size: 14.5px; box-shadow: 0 1px 1px rgba(30, 41, 56, .08); position: relative; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.in { align-self: flex-start; background: var(--bubble-in); border-top-left-radius: 3px; }
.bubble.out { align-self: flex-end; background: var(--bubble-out); border-top-right-radius: 3px; }
.bubble .t { display: block; text-align: right; font-size: 11.5px; color: var(--humo); margin-top: 2px; }
.bubble .tpl { font-weight: 700; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--verde-700); display: flex; align-items: center; gap: 5px; margin-bottom: 4px; }
.bubble .btns { display: grid; gap: 1px; margin: 8px -12px -6px; border-top: 1px solid rgba(30, 41, 56, .08); }
.bubble .btns span { text-align: center; padding: 8px; color: #1F7AC2; font-weight: 700; font-size: 14px; }
.sysmsg { align-self: center; font-size: 12.5px; color: var(--humo-2); background: rgba(255, 255, 255, .85); border-radius: 8px; padding: 5px 12px; text-align: center; max-width: 92%; display: inline-flex; gap: 6px; align-items: center; }
.sysmsg svg { width: 14px; height: 14px; color: var(--verde-700); flex: none; }
.sysmsg.alert svg { color: var(--bad); }
.note { align-self: center; max-width: min(520px, 92%); background: #FFF8D6; border: 1px dashed #E0BD2D; border-radius: 8px; padding: 8px 12px; font-size: 13.5px; }
.note b { font-weight: 800; letter-spacing: .04em; font-size: 11.5px; text-transform: uppercase; color: #7D6300; display: block; }
.leadcard { align-self: flex-start; width: min(340px, 90%); background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 2px 6px rgba(30, 41, 56, .12); border: 1px solid var(--linea); }
.leadcard .lc-h { background: var(--navy); color: #fff; padding: 9px 12px; display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.leadcard .lc-h svg { color: var(--verde); width: 16px; height: 16px; }
.leadcard .lc-b { padding: 10px 12px 12px; font-size: 13.5px; display: grid; gap: 4px; }
.leadcard .lc-b b { font-size: 15px; }
.leadcard .lc-b small { color: var(--humo-2); }
.leadcard .t { display: block; text-align: right; font-size: 11px; color: var(--humo); }

.composer { background: var(--surface); border-top: 1px solid var(--linea); padding: 10px 14px 12px; display: grid; gap: 8px; }
.composer .qr { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.composer .qr button { border: 1px solid var(--linea); background: var(--fondo); border-radius: 999px; padding: 4px 10px; font-size: 12.5px; white-space: nowrap; }
.composer form { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; min-height: 42px; max-height: 120px; border: 1px solid var(--linea); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; background: var(--fondo); }
.composer textarea:focus { outline: 2px solid var(--verde); border-color: transparent; }
.icon-btn { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--linea); background: var(--surface); flex: none; color: var(--tinta); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn.send { background: var(--verde); border-color: var(--verde); color: var(--navy); }
.empty { margin: auto; text-align: center; color: var(--humo-2); padding: 40px 20px; }
.empty b { display: block; font-family: var(--display); font-size: 18px; color: var(--tinta); margin-bottom: 4px; }

.cpanel { border-left: 1px solid var(--linea); background: var(--surface); overflow-y: auto; padding: 18px 16px; display: grid; gap: 18px; align-content: start; }
.cpanel .who { text-align: center; }
.cpanel .who .avatar { width: 60px; height: 60px; font-size: 20px; margin: 0 auto 8px; background: var(--navy-3); }
.cpanel .who b { display: block; font-size: 16px; }
.cpanel .who small { color: var(--humo-2); }
.cpanel h3 { font-weight: 800; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--humo-2); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--humo-2); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.tag-toggle { border: 1px dashed var(--linea); background: none; }
button.tag-toggle[aria-pressed="true"] { background: var(--c); border: 1px solid var(--c); color: #fff; }
.tag-toggle[aria-pressed="true"] i { background: #fff; }
.notes-list { display: grid; gap: 8px; margin-bottom: 8px; }
.notes-list div { background: #FFF8D6; border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.notes-list small { display: block; color: #7D6300; font-weight: 700; font-size: 11.5px; margin-bottom: 2px; }

/* ---------- Asignación ---------- */
.rules { display: grid; gap: 10px; }
.rule { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--linea); border-radius: 12px; background: #fff; }
.rule .ic { width: 40px; height: 40px; border-radius: 10px; background: var(--navy); color: var(--verde); display: grid; place-items: center; }
.rule .ic svg { width: 20px; height: 20px; }
.rule b { display: block; font-size: 14.5px; }
.rule small { color: var(--humo-2); font-size: 13px; }
.rule.off { opacity: .55; }
.switch { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; font-weight: 600; }
.switch .tr { width: 44px; height: 26px; border-radius: 99px; background: #CDD5DF; position: relative; transition: background .2s; flex: none; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch[aria-checked="true"] .tr { background: var(--verde-600); }
.switch[aria-checked="true"] .tr::after { transform: translateX(18px); }
.sim { display: grid; gap: 14px; }
.sim-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: stretch; }
.sim-flow > div { background: var(--fondo); border-radius: 10px; padding: 12px; font-size: 13px; min-height: 86px; }
.sim-flow > div small { display: block; font-weight: 800; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--humo-2); margin-bottom: 6px; }
.sim-flow > div.on { background: var(--verde-50); outline: 2px solid var(--verde-600); }
.sim-flow .arr { align-self: center; color: var(--verde-700); font-weight: 800; }

/* ---------- Formularios y QR ---------- */
.forms-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-card { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; padding: 16px; }
.qr-box { width: 132px; height: 132px; background: #fff; border: 1px solid var(--linea); border-radius: 10px; padding: 8px; display: grid; place-items: center; }
.qr-box img, .qr-box canvas { width: 100% !important; height: 100% !important; image-rendering: pixelated; }
.qr-box.web { background: var(--navy); color: var(--verde); }
.qr-box.web svg { width: 48px; height: 48px; }
.form-card h3 { font-family: var(--display); font-size: 16px; }
.form-card p { margin: 4px 0 10px; font-size: 13px; color: var(--humo-2); }
.fstats { display: flex; gap: 16px; font-size: 12.5px; color: var(--humo-2); margin-bottom: 10px; }
.fstats b { display: block; font-family: var(--display); font-size: 18px; color: var(--tinta); }
.mform { background: #fff; border-radius: 16px; overflow: hidden; border: 1px solid var(--linea); }
.mform-h { background: var(--navy); color: #fff; padding: 18px; display: grid; gap: 8px; }
.mform-h img { height: 22px; width: auto; }
.mform-h b { font-family: var(--display); font-size: 17px; }
.mform-h small { color: #B6C1D1; }
.mform-b { padding: 16px 18px 18px; display: grid; gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--humo-2); }
.check input { margin-top: 3px; accent-color: var(--verde-600); }

.furl { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--azul); font-weight: 600; margin-bottom: 10px; min-width: 0; }
.furl span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-card.fresh { animation: flash 2.6s ease-out; }
.mform-b .field > span em { color: var(--bad); font-style: normal; }
.radio-f { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.radio-f legend { font-weight: 700; font-size: 13px; color: var(--humo-2); margin-bottom: 6px; padding: 0; }
.radio { display: flex; align-items: center; gap: 10px; border: 1px solid var(--linea); border-radius: 9px; padding: 10px 12px; font-size: 14px; }
.radio input { accent-color: var(--verde-600); width: 18px; height: 18px; margin: 0; }
.mform-b .input, .mform-b .select { padding: 12px; font-size: 16px; }
.btn.big { padding: 14px; font-size: 16px; width: 100%; }
.urlbar { display: flex; align-items: center; gap: 6px; background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--humo-2); margin: 0 0 10px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border: 1px solid var(--linea); }
.form-scr { padding: 12px; min-height: 0; max-height: 640px; overflow-y: auto; }
.form-scr .mform { font-size: 14px; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.builder-side .phone { position: sticky; top: 0; }
.slug { display: flex; align-items: center; border: 1px solid var(--linea); border-radius: 9px; background: var(--fondo); overflow: hidden; }
.slug small { padding: 0 4px 0 10px; color: var(--humo-2); white-space: nowrap; font-size: 12.5px; }
.slug .input { border: 0; border-radius: 0; min-width: 0; }
.flist { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.flist li { display: flex; align-items: center; gap: 8px; border: 1px solid var(--linea); border-radius: 10px; padding: 6px 8px 6px 4px; background: #fff; }
.flist li.on { border-color: var(--verde-600); box-shadow: 0 0 0 3px var(--verde-50); }
.fl-main { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 6px 8px; display: grid; gap: 2px; }
.fl-main b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ft { font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--verde-700); }
.fl-acts { display: flex; gap: 4px; flex: none; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 8px; font-weight: 700; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.fedit { background: var(--fondo); border-radius: 12px; padding: 14px; display: grid; gap: 12px; margin-bottom: 14px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Masivos ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.stat-grid div { background: var(--fondo); border-radius: 10px; padding: 10px 12px; }
.stat-grid small { display: block; font-size: 12px; color: var(--humo-2); }
.stat-grid b { font-family: var(--display); font-weight: 700; font-size: 22px; }
.stat-grid em { font-style: normal; font-size: 12px; color: var(--humo-2); margin-left: 4px; }
.wizard { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 22px; align-items: start; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; counter-reset: st; }
.steps button { border: 1px solid var(--linea); background: var(--surface); border-radius: 999px; padding: 6px 14px 6px 8px; font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center; gap: 8px; counter-increment: st; }
.steps button::before { content: counter(st); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #EDF0F4; font-size: 12px; }
.steps button[aria-current="step"] { border-color: var(--navy); background: var(--navy); color: #fff; }
.steps button[aria-current="step"]::before { background: var(--verde); color: var(--navy); }
.steps button.done::before { content: "✓"; background: var(--verde-600); color: #fff; }
.opt-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.opt { text-align: left; border: 1.5px solid var(--linea); background: var(--surface); border-radius: 12px; padding: 14px; display: grid; gap: 6px; }
.opt:hover { border-color: #C6CFDB; }
.opt[aria-checked="true"] { border-color: var(--verde-600); box-shadow: 0 0 0 3px var(--verde-50); }
.opt b { font-size: 14.5px; }
.opt small { color: var(--humo-2); font-size: 13px; }
.wiz-foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.summary div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--linea); font-size: 14px; }
.summary div span { color: var(--humo-2); }

.phone { position: sticky; top: 0; background: var(--navy); border-radius: 34px; padding: 12px; box-shadow: var(--shadow); }
.phone-scr { background: var(--chat-bg); border-radius: 24px; overflow: hidden; min-height: 500px; display: flex; flex-direction: column; }
.phone-top { background: #1F5A3C; color: #fff; display: flex; align-items: center; gap: 10px; padding: 12px 14px; }
.phone-top img { width: 34px; height: 34px; border-radius: 50%; background: #fff; object-fit: contain; padding: 3px; }
.phone-top b { font-size: 14px; display: block; }
.phone-top small { font-size: 11.5px; opacity: .8; }
.phone-body { padding: 14px 12px; display: flex; flex-direction: column; gap: 8px; flex: 1; background-image: radial-gradient(rgba(30, 41, 56, .05) 1px, transparent 1px); background-size: 16px 16px; }
.pv-bubble { background: #fff; border-radius: 10px; border-top-left-radius: 3px; overflow: hidden; max-width: 92%; font-size: 13.5px; box-shadow: 0 1px 1px rgba(30, 41, 56, .08); }
.pv-bubble .hdr { aspect-ratio: 16 / 9; background: var(--navy) url("assets/banner.webp") center / cover; }
.pv-bubble p { margin: 0; padding: 8px 10px 4px; white-space: pre-wrap; }
.pv-bubble .t { display: block; text-align: right; font-size: 10.5px; color: var(--humo); padding: 0 10px 6px; }
.pv-bubble .btns span { display: block; text-align: center; border-top: 1px solid #EEF1F5; padding: 8px; color: #1F7AC2; font-weight: 700; font-size: 13px; }
.pv-bubble.alert { border-left: 3px solid var(--ambar); }

/* ---------- Recordatorios ---------- */
.agenda { display: grid; gap: 8px; }
.rem { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--linea); border-radius: 12px; background: #fff; }
.rem .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--c-bg, var(--fondo)); color: var(--c, var(--navy)); }
.rem .ic svg { width: 18px; height: 18px; }
.rem b { font-size: 14px; display: block; }
.rem small { color: var(--humo-2); font-size: 12.5px; }
.rem.overdue { border-color: #F2B8B0; background: #FFF7F6; }
.rem.done { opacity: .5; }
.rem.done b { text-decoration: line-through; }
.rem .acts { display: flex; gap: 6px; }
.alert-rules { display: grid; gap: 10px; }
.alert-rules label { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--linea); font-size: 14px; }
.alert-rules label:last-child { border-bottom: 0; }
.alert-rules small { display: block; color: var(--humo-2); font-size: 12.5px; }
.alert-rules select { width: auto; }

/* ---------- Diálogo y toasts ---------- */
dialog { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); box-shadow: 0 30px 80px -20px rgba(30, 41, 56, .55); color: var(--tinta); }
dialog.narrow { width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(20, 28, 40, .55); }
.dlg-h { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--linea); }
.dlg-h h2 { font-family: var(--display); font-weight: 700; font-size: 19px; flex: 1; }
.dlg-b { padding: 18px 20px; display: grid; gap: 16px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--linea); flex-wrap: wrap; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--linea); display: grid; gap: 12px; }
.timeline li { position: relative; font-size: 13.5px; }
.timeline li::before { content: ""; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--verde-600); border: 2px solid #fff; }
.timeline small { display: block; color: var(--humo); font-size: 12px; }
.grid-f { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13px; color: var(--humo-2); background: var(--azul-50); border-radius: 9px; padding: 10px 12px; }
.toast-root { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 200; }
.toast { background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; max-width: 400px; animation: tin .25s ease-out; }
.toast i { width: 8px; height: 8px; border-radius: 50%; background: var(--verde); flex: none; margin-top: 6px; }
.toast b { color: var(--verde); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.noscript { padding: 30px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox .cpanel { display: none; }
  .inbox.show-panel { grid-template-columns: 300px minmax(0, 1fr) 290px; }
  .inbox.show-panel .cpanel { display: grid; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wizard, .builder { grid-template-columns: minmax(0, 1fr); }
  .builder-side .phone { position: static; }
  .phone { position: static; max-width: 360px; }
  .forms-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-grid; place-items: center; }
  .sidebar { position: fixed; top: 64px; bottom: 0; left: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .22s ease; }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; position: fixed; inset: 64px 0 0 0; background: rgba(20, 28, 40, .5); z-index: 50; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .me-txt, .brand-sep, .brand-title small { display: none; }
  .page { padding: 20px 16px 40px; }
  .inbox, .inbox.show-panel { grid-template-columns: minmax(0, 1fr); }
  .inbox .thread, .inbox .cpanel, .inbox.show-panel .cpanel { display: none; }
  .inbox.open .clist { display: none; }
  .inbox.open .thread { display: flex; }
  .inbox.open.show-panel .thread { display: none; }
  .inbox.open.show-panel .cpanel { display: grid; }
  .thread-h .back-btn { display: grid; }
  .cpanel .back-btn { display: inline-flex; }
  .pipeline-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sim-flow { grid-template-columns: minmax(0, 1fr); }
  .sim-flow .arr { transform: rotate(90deg); justify-self: center; }
}
@media (max-width: 560px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand img { height: 22px; }
  .brand-title { display: none; }
  .synthetic { font-size: 10.5px; padding: 3px 8px; }
  #ta { display: none; }
  .me .avatar { width: 30px; height: 30px; font-size: 12px; }
  .kpis { gap: 10px; }
  .kpi .val { font-size: 28px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opt-grid, .grid-f { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 24px; }
  .form-card { grid-template-columns: minmax(0, 1fr); }
  .hbars div { grid-template-columns: 100px 1fr 36px; }
  .pipeline-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rem { grid-template-columns: 36px minmax(0, 1fr); }
  .rem .acts { grid-column: 2; }
  .toast-root { left: 16px; right: 16px; }
  .bars { gap: 6px; }
  th, td { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
