/* DM Inmobiliaria · CRM v1
   Marca: cian #1ba6a6 (primario) · azul #24318e (secundario) · Anton / Antonio
   Texto de interfaz: Plus Jakarta Sans (legibilidad a 13-14 px) */

@font-face { font-family: "Anton"; src: url("fonts/Anton-Regular.ttf") format("truetype"); font-display: swap; }

:root {
  --cian: #1ba6a6;
  --cian-600: #168d8d;
  --cian-700: #127474;
  --cian-100: #d1eded;
  --cian-50: #ecf7f7;
  --azul: #24318e;
  --azul-800: #1c2672;
  --azul-900: #151c55;
  --azul-100: #d3d6e8;
  --azul-50: #eef0f8;

  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #e3e7ec;
  --line-2: #eef1f4;
  --ink: #141a2e;
  --ink-2: #3d455c;
  --muted: #6b7286;
  --faint: #9aa0b0;

  --ok: #1f9d55;
  --warn: #c9821b;
  --bad: #d14343;

  --wa: #1fae57;
  --ig: #d6336c;
  --fb: #1877f2;

  --r: 10px;
  --r-sm: 7px;
  --shadow: 0 1px 2px rgba(20,26,46,.06), 0 4px 14px rgba(20,26,46,.06);
  --shadow-lg: 0 10px 40px rgba(20,26,46,.18);

  --f-ui: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-head: "Antonio", "Anton", "Arial Narrow", sans-serif;
  --f-num: "Anton", "Antonio", Impact, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--f-ui); font-size: 14px; line-height: 1.45; color: var(--ink);
  background: var(--bg); -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--cian); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
.app { display: grid; grid-template-columns: 76px 1fr; height: 100vh; }
.rail {
  background: var(--azul); color: #fff; display: flex; flex-direction: column; align-items: center;
  padding: 14px 0 12px; gap: 4px; position: relative; z-index: 5;
}
.rail .logo { width: 40px; height: 40px; margin-bottom: 16px; color: #fff; display: block; }
.nav-btn {
  width: 64px; padding: 9px 0 7px; border: 0; background: transparent; color: rgba(255,255,255,.72);
  border-radius: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; position: relative; transition: background .15s, color .15s;
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-btn[aria-current="page"] { background: var(--cian); color: #fff; }
.nav-btn .dot {
  position: absolute; top: 4px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: #fff; color: var(--azul); font-size: 10.5px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--azul);
}
.rail .spacer { flex: 1; }
.me {
  width: 36px; height: 36px; border-radius: 50%; background: var(--cian); color: #fff; font-weight: 700;
  display: grid; place-items: center; font-size: 13px; border: 2px solid rgba(255,255,255,.5); margin-top: 6px;
}

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 60px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar h1 {
  font-family: var(--f-head); font-weight: 700; font-size: 24px; letter-spacing: .01em; margin: 0;
  text-transform: uppercase; color: var(--azul);
}
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .grow { flex: 1; }
.view { flex: 1; min-height: 0; overflow: hidden; display: flex; }

/* ---------- Controls ---------- */
.btn {
  height: 36px; padding: 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--panel); font-weight: 600; display: inline-flex; align-items: center; gap: 7px;
  white-space: nowrap; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--cian); border-color: var(--cian); color: #fff; }
.btn.primary:hover { background: var(--cian-600); }
.btn.dark { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn.dark:hover { background: var(--azul-800); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn.sm.icon { width: 30px; }
.btn.danger { color: var(--bad); }

.search {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid transparent; min-width: 240px; color: var(--muted);
}
.search:focus-within { border-color: var(--cian); background: #fff; }
.search svg { width: 16px; height: 16px; flex: none; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--ink); }
.search kbd {
  font: 600 11px var(--f-ui); color: var(--faint); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; background: #fff;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.input, .select, textarea.input {
  height: 36px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; padding: 0 10px;
  outline: 0; width: 100%; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 9px 10px; resize: vertical; min-height: 70px; }
.input:focus, .select:focus { border-color: var(--cian); box-shadow: 0 0 0 3px var(--cian-50); }

.seg { display: inline-flex; background: var(--bg); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.seg button {
  white-space: nowrap; border: 0; background: transparent; height: 30px; padding: 0 11px; border-radius: 5px; font-weight: 600;
  color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.seg .n { font-size: 11px; color: var(--faint); font-weight: 700; }

/* ---------- Channel badges / avatars / tags ---------- */
.ch { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: none; }
.ch svg { width: 11px; height: 11px; }
.ch.wa { background: var(--wa); } .ch.ig { background: var(--ig); } .ch.fb { background: var(--fb); }
.ch-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }

.av {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 700; color: #fff; font-size: 14px; position: relative;
}
.av .ch { position: absolute; right: -3px; bottom: -3px; box-shadow: 0 0 0 2px #fff; }
.av.sm { width: 30px; height: 30px; font-size: 11.5px; }
.av.sm .ch { width: 15px; height: 15px; } .av.sm .ch svg { width: 9px; height: 9px; }
.av.lg { width: 56px; height: 56px; font-size: 19px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--tc-bg); color: var(--tc);
}
.tag .x { border: 0; background: transparent; padding: 0; margin-right: -3px; color: inherit; opacity: .6; display: grid; }
.tag .x:hover { opacity: 1; }
.tag .x svg { width: 12px; height: 12px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 12px;
  font-size: 12px; font-weight: 700; background: var(--stage-bg, var(--bg)); color: var(--stage, var(--ink-2));
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--stage, var(--muted)); }

.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Inbox ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0,1fr) 340px; flex: 1; min-height: 0; }
.inbox.no-panel { grid-template-columns: 340px minmax(0,1fr) 0; }
.col { min-height: 0; display: flex; flex-direction: column; background: var(--panel); }
.col + .col { border-left: 1px solid var(--line); }

.list-head { padding: 14px 14px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.list-head .row { display: flex; gap: 8px; align-items: center; }
.list-head .search { min-width: 0; flex: 1; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; }
.list-head .seg { display: flex; }
.list-head .seg button { flex: 1; justify-content: center; padding: 0 6px; }
.chip {
  height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line); background: #fff;
  font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; flex: none;
}
.chip[aria-pressed="true"] { background: var(--azul); border-color: var(--azul); color: #fff; }
.chip .ch { width: 15px; height: 15px; } .chip .ch svg { width: 9px; height: 9px; }

.conv-list { overflow-y: auto; flex: 1; }
.conv {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 11px; padding: 12px 14px; cursor: pointer;
  border-bottom: 1px solid var(--line-2); position: relative; width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0; background: #fff;
}
.conv:hover { background: #f8fafb; }
.conv[aria-current="true"] { background: var(--cian-50); }
.conv[aria-current="true"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--cian); }
.conv .name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.conv .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.conv.unread .last { color: var(--ink); font-weight: 600; }
.conv .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.conv .time { font-size: 11.5px; color: var(--faint); font-weight: 600; white-space: nowrap; }
.conv.unread .time { color: var(--cian-700); }
.badge {
  min-width: 20px; height: 20px; border-radius: 10px; background: var(--cian); color: #fff; font-size: 11px; font-weight: 800;
  display: grid; place-items: center; padding: 0 6px;
}
.conv .tags { margin-top: 6px; }
.conv .tag { height: 19px; font-size: 10.5px; padding: 0 6px; }
.wait { font-size: 11px; font-weight: 700; color: var(--warn); }

/* chat */
.chat { background: #f1f3f5; }
.chat-head {
  height: 64px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: #fff; border-bottom: 1px solid var(--line);
}
.chat-head .who { min-width: 0; flex: 1; }
.chat-head .who b { display: block; font-size: 15px; }
.chat-head .who small { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.msgs { flex: 1; overflow-y: auto; padding: 18px 22px 10px; display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; font-size: 11.5px; font-weight: 700; color: var(--muted); background: #fff; border-radius: 10px; padding: 3px 10px; margin: 10px 0 6px; }
.bubble {
  max-width: min(72%, 560px); padding: 8px 12px 6px; border-radius: 14px; background: #fff; box-shadow: 0 1px 1px rgba(20,26,46,.06);
  font-size: 14px; white-space: pre-wrap; word-wrap: break-word; align-self: flex-start; border-bottom-left-radius: 4px;
}
.bubble.out { align-self: flex-end; background: var(--cian-100); border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.bubble.bot { background: var(--azul-50); }
.bubble .t { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.bubble .t svg { width: 14px; height: 14px; color: var(--cian-700); }
.bubble .by { font-size: 11px; font-weight: 700; color: var(--azul); margin-bottom: 2px; }
.note {
  align-self: stretch; margin: 4px 30px; background: #fff8e6; border: 1px dashed #e7c46b; border-radius: 10px; padding: 8px 12px; font-size: 13px;
}
.note .by { font-size: 11px; font-weight: 700; color: #8a6514; display: flex; align-items: center; gap: 5px; margin-bottom: 2px; }
.note .by svg { width: 13px; height: 13px; }
.sys { align-self: center; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin: 4px 0; }
.sys svg { width: 13px; height: 13px; }

.composer { flex: none; background: #fff; border-top: 1px solid var(--line); padding: 10px 14px 12px; }
.composer .modes { display: flex; gap: 4px; margin-bottom: 8px; align-items: center; }
.composer .modes .hint { margin-left: auto; font-size: 11.5px; color: var(--faint); }
.composer .box { display: flex; align-items: flex-end; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 6px 6px 6px 12px; background: #fff; }
.composer .box:focus-within { border-color: var(--cian); box-shadow: 0 0 0 3px var(--cian-50); }
.composer.note-mode .box { background: #fffbef; border-color: #e7c46b; }
.composer textarea { flex: 1; border: 0; outline: 0; resize: none; background: transparent; max-height: 140px; min-height: 24px; padding: 6px 0; line-height: 1.4; }
.composer .send { width: 38px; height: 38px; border-radius: 10px; border: 0; background: var(--cian); color: #fff; display: grid; place-items: center; flex: none; }
.composer .send:disabled { background: var(--line); }
.composer .send svg { width: 18px; height: 18px; }
.composer.note-mode .send { background: #c99a2e; }
.window-warn { font-size: 12px; color: var(--warn); display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.window-warn svg { width: 14px; height: 14px; }

.qr-pop {
  position: absolute; bottom: calc(100% + 6px); left: 14px; right: 14px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 280px; overflow-y: auto; padding: 6px; z-index: 20;
}
.qr-pop button { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; }
.qr-pop button:hover, .qr-pop button.on { background: var(--cian-50); }
.qr-pop b { display: block; font-size: 13px; }
.qr-pop small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* lead panel */
.lead-panel { overflow-y: auto; }
.lp-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.lp-head .top { display: flex; gap: 12px; align-items: center; }
.lp-head h2 { font-size: 17px; margin: 0; line-height: 1.2; }
.lp-head .id { font-size: 12px; color: var(--muted); }
.lp-sec { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.lp-sec h3 {
  font-family: var(--f-head); font-weight: 600; text-transform: uppercase; font-size: 14px; letter-spacing: .04em; color: var(--azul);
  margin: 0; display: flex; align-items: center; justify-content: space-between;
}
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 10px; align-items: center; font-size: 13px; }
.kv > span { color: var(--muted); font-weight: 600; font-size: 12px; }
.kv .input, .kv .select { height: 32px; font-size: 13px; }
.stage-bar { display: flex; gap: 3px; }
.stage-bar i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.stage-bar i.on { background: var(--stage); }

.task { display: grid; grid-template-columns: 20px 1fr auto; gap: 8px; align-items: start; font-size: 13px; padding: 4px 0; }
.task input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--cian); }
.task.done .tx { text-decoration: line-through; color: var(--faint); }
.task .due { font-size: 11.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.task .due.late { color: var(--bad); } .task .due.today { color: var(--warn); }

.tag-add { position: relative; }
.pop {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; width: 240px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 8px;
}
.pop .opt { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: transparent; padding: 6px 8px; border-radius: 7px; text-align: left; font-size: 13px; }
.pop .opt:hover { background: var(--bg); }
.pop .opt .sw { width: 12px; height: 12px; border-radius: 4px; background: var(--tc); }
.pop .opt .ck { margin-left: auto; color: var(--cian); width: 16px; height: 16px; }

/* ---------- Pipeline ---------- */
.pipe-wrap { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pipe-bar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.pipe-bar .total { margin-left: auto; color: var(--muted); font-size: 13px; }
.pipe-bar .total b { color: var(--ink); }
.board { flex: 1; overflow: auto; display: flex; gap: 12px; padding: 16px 20px 20px; align-items: flex-start; }
.stage-col { width: 286px; flex: none; display: flex; flex-direction: column; max-height: 100%; border-radius: 12px; background: #e9edf1; }
.stage-col.over { background: var(--cian-100); box-shadow: inset 0 0 0 2px var(--cian); }
.stage-head { padding: 12px 12px 10px; border-top: 4px solid var(--stage); border-radius: 12px 12px 0 0; }
.stage-head .t { display: flex; align-items: center; gap: 8px; }
.stage-head b { font-family: var(--f-head); text-transform: uppercase; font-size: 15px; letter-spacing: .03em; font-weight: 700; }
.stage-head .n { font-size: 12px; font-weight: 800; color: var(--muted); background: #fff; border-radius: 9px; padding: 1px 7px; }
.stage-head .sum { font-size: 12.5px; color: var(--muted); margin-top: 2px; font-weight: 600; }
.cards { padding: 0 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.card {
  background: #fff; border-radius: 10px; padding: 11px 12px; box-shadow: 0 1px 2px rgba(20,26,46,.08); cursor: grab;
  border: 1px solid transparent; display: flex; flex-direction: column; gap: 8px; transition: box-shadow .12s, border-color .12s;
}
.card:hover { border-color: var(--cian-100); box-shadow: var(--shadow); }
.card.dragging { opacity: .45; }
.card .r1 { display: flex; align-items: center; gap: 9px; }
.card .r1 b { font-size: 13.5px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .msg { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .r3 { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.card .money { font-weight: 800; color: var(--ink); font-size: 13px; }
.card .r3 .sp { flex: 1; }
.card .due { font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.card .due svg { width: 13px; height: 13px; }
.card .due.late { color: var(--bad); } .card .due.today { color: var(--warn); }
.card .tag { height: 19px; font-size: 10.5px; padding: 0 6px; }
.card .unr { width: 8px; height: 8px; border-radius: 50%; background: var(--cian); flex: none; }
.add-card { margin: 0 8px 10px; border: 1px dashed #c7ced8; background: transparent; border-radius: 10px; height: 34px; color: var(--muted); font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; }
.add-card:hover { background: #fff; color: var(--ink); }
.add-card svg { width: 15px; height: 15px; }

/* ---------- Pages (dashboard, contacts, tasks, settings) ---------- */
.page { flex: 1; overflow-y: auto; padding: 22px 24px 40px; }
.page-inner { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: #fff; border-radius: var(--r); padding: 16px 18px; border: 1px solid var(--line); }
.kpi span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi b { display: block; font-family: var(--f-num); font-weight: 400; font-size: 38px; line-height: 1.1; margin-top: 6px; color: var(--azul); letter-spacing: .01em; }
.kpi small { font-size: 12px; color: var(--muted); }
.kpi.accent { background: var(--azul); border-color: var(--azul); color: #fff; }
.kpi.accent span, .kpi.accent small { color: rgba(255,255,255,.75); }
.kpi.accent b { color: #fff; }
.grid2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.box { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; min-width: 0; }
.box h3 { font-family: var(--f-head); text-transform: uppercase; color: var(--azul); font-size: 16px; letter-spacing: .03em; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; }
.box h3 .btn { font-family: var(--f-ui); text-transform: none; letter-spacing: 0; }
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel .f { display: grid; grid-template-columns: 150px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.funnel .f .bar { height: 22px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.funnel .f .bar i { display: block; height: 100%; background: var(--stage); border-radius: 6px; min-width: 4px; }
.funnel .f .v { text-align: right; font-weight: 700; }
.chan-split { display: flex; flex-direction: column; gap: 12px; }
.chan-split .c { display: grid; grid-template-columns: 130px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.chan-split .bar { height: 10px; border-radius: 5px; background: var(--bg); overflow: hidden; }
.chan-split .bar i { display: block; height: 100%; }
.mini-list { display: flex; flex-direction: column; }
.mini-list .it { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; cursor: pointer; }
.mini-list .it:last-child { border-bottom: 0; }
.mini-list .it .grow { flex: 1; min-width: 0; }
.mini-list .it .grow b { display: block; }
.mini-list .it .grow small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

table.tbl { width: 100%; border-collapse: collapse; background: #fff; font-size: 13.5px; }
.tbl-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--r); overflow: auto; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; position: sticky; top: 0; white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover td { background: #f8fafb; }
.tbl .who { display: flex; align-items: center; gap: 10px; font-weight: 700; }

.settings { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.s-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; }
.s-nav button { text-align: left; border: 0; background: transparent; padding: 9px 12px; border-radius: 8px; font-weight: 600; color: var(--ink-2); }
.s-nav button:hover { background: #fff; }
.s-nav button[aria-current="true"] { background: #fff; color: var(--azul); box-shadow: var(--shadow); }
.s-body { display: flex; flex-direction: column; gap: 14px; }
.s-body p.lead { margin: 0; color: var(--muted); max-width: 70ch; }
.channel-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line-2); }
.channel-row:last-child { border-bottom: 0; }
.channel-row .ch { width: 40px; height: 40px; } .channel-row .ch svg { width: 20px; height: 20px; }
.channel-row b { display: block; }
.channel-row small { color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status.on { color: var(--ok); } .status.on i { background: var(--ok); }
.edit-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.edit-row:last-child { border-bottom: 0; }
.edit-row .input { height: 34px; }
.edit-row input[type=color] { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; flex: none; }
.handle { color: var(--faint); cursor: grab; display: grid; }
.handle svg { width: 16px; height: 16px; }
.rule { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; align-items: center; }
.rule .when { font-size: 13.5px; }
.rule .when b { color: var(--azul); }
.rule small { color: var(--muted); display: block; margin-top: 3px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: var(--line); transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + span { background: var(--cian); }
.switch input:checked + span::after { transform: translateX(16px); }

/* ---------- Modal / drawer / toast ---------- */
.scrim { position: fixed; inset: 0; background: rgba(21,28,85,.32); z-index: 50; display: grid; place-items: center; padding: 20px; animation: fade .15s ease-out; }
.modal { background: #fff; border-radius: 14px; width: min(520px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: up .18s ease-out; }
.modal header { padding: 18px 20px 6px; display: flex; align-items: center; justify-content: space-between; }
.modal header h2 { margin: 0; font-family: var(--f-head); text-transform: uppercase; color: var(--azul); font-size: 21px; letter-spacing: .02em; }
.modal .body { padding: 10px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal footer { padding: 14px 20px 18px; display: flex; justify-content: flex-end; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drawer-scrim { position: fixed; inset: 0; background: rgba(21,28,85,.22); z-index: 40; animation: fade .15s ease-out; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 380px; background: #fff; z-index: 41; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; animation: slide .2s ease-out; }
.drawer .lead-panel { flex: 1; }
.drawer .close { position: absolute; top: 12px; right: 12px; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  background: var(--azul-900); color: #fff; border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  min-width: 280px; max-width: 380px; font-size: 13px; animation: up .2s ease-out; cursor: pointer;
}
.toast b { display: block; }
.toast small { opacity: .8; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { opacity: 0; transform: translateY(8px); } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.demo-note { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.demo-note svg { width: 14px; height: 14px; }
.mob-only { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .inbox { grid-template-columns: 300px minmax(0,1fr) 300px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1080px) {
  .inbox, .inbox.no-panel { grid-template-columns: 300px minmax(0,1fr); }
  .inbox .lead-panel.col { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .topbar .search { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr 62px; }
  .rail { order: 2; flex-direction: row; justify-content: space-around; padding: 4px; }
  .rail .logo, .rail .spacer, .rail .me, .rail .nav-btn.desk { display: none; }
  .nav-btn { width: auto; flex: 1; }
  .topbar { padding: 0 12px; gap: 8px; } .topbar .sub, .topbar .hide-m { display: none; }
  .topbar h1 { font-size: 20px; }
  .inbox, .inbox.no-panel { grid-template-columns: 1fr; }
  .inbox.has-sel .col.list { display: none; }
  .inbox:not(.has-sel) .col.chat { display: none; }
  .mob-only { display: inline-flex !important; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .settings { grid-template-columns: 1fr; }
  .s-nav { flex-direction: row; overflow-x: auto; position: static; }
  .page { padding: 16px 14px 30px; }
  .drawer { width: 100%; }
  .bubble { max-width: 86%; }
  .funnel .f { grid-template-columns: 110px 1fr 70px; }
}
.seg svg { width: 15px; height: 15px; flex: none; }

/* ===== Modo en vivo: adjuntos, estados de envío, inicio de sesión ===== */
.bubble .att-img { display: block; margin: 2px 0 6px; border-radius: 10px; overflow: hidden; max-width: 260px; }
.bubble .att-img img { display: block; width: 100%; height: auto; }
.bubble audio { display: block; width: 240px; max-width: 100%; margin: 2px 0 6px; }
.bubble .att-file { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 6px; color: var(--azul); font-weight: 600; text-decoration: none; }
.bubble .att-file svg { width: 16px; height: 16px; }
.bubble.failed { box-shadow: inset 0 0 0 1.5px var(--bad); }
.bubble .t .fail { color: var(--bad); font-weight: 700; }

.login { min-height: 100vh; min-height: 100dvh; width: 100%; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 32px 28px; }
.login-card .logo { width: 44px; height: 44px; color: var(--azul); }
.login-card h1 { font-family: var(--f-head); font-weight: 700; font-size: 28px; letter-spacing: -.01em; color: var(--azul); line-height: 1.1; }
.login-card .lead { color: var(--muted); margin-top: -6px; }
.login-card .btn { justify-content: center; }
.login-err { min-height: 18px; font-size: 13px; color: var(--bad); margin: -4px 0; }
.login-card.is-loading { align-items: center; text-align: center; color: var(--muted); }
.login-card.is-loading .logo { animation: dm-pulse 1.2s ease-in-out infinite; }
@keyframes dm-pulse { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .login-card.is-loading .logo { animation: none; } }
.app > .login { grid-column: 1 / -1; grid-row: 1 / -1; }
