/* CRM CRECEMOS · mismo lenguaje visual del sitio: blanco, verde Solesta, cristal líquido, tipografía Apple/Inter. */
:root {
  --bg: #f5f5f7; --surface: #ffffff; --ink: #1d1d1f; --muted: #6e6e73; --line: rgb(0 0 0 / .07);
  --green: #27801a; --green-ink: #1f6e12; --deep: #0e3d08; --lime: #a6f20a; --on-lime: #0b2a06;
  --grad: linear-gradient(135deg, #b8f52a 0%, #7ad81e 50%, #3fb31a 100%);
  --grad-deep: linear-gradient(135deg, #1f7a12 0%, #145a0c 45%, #0e3d08 100%);
  --hot: #e5484d; --warm: #f5a623; --cold: #5e8fe6; --violet: #6e56cf;
  --r-sm: 10px; --r: 16px; --r-lg: 22px;
  --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 12px 32px -18px rgb(20 70 10 / .28);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", system-ui, sans-serif;
  --side: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); letter-spacing: -0.01em; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--green); text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -0.025em; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--grad); animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.8); opacity: .4; } }

/* ── Cristal líquido ── */
.glass { background: linear-gradient(180deg, rgb(255 255 255 / .78), rgb(255 255 255 / .6)); -webkit-backdrop-filter: blur(22px) saturate(190%); backdrop-filter: blur(22px) saturate(190%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .95), inset 0 0 0 1px rgb(255 255 255 / .5), 0 18px 40px -18px rgb(20 70 10 / .3); }

/* ── Botones ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 0; border-radius: 980px; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; transition: transform 160ms, box-shadow 200ms, background 200ms, opacity 200ms; -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--grad); color: var(--on-lime); box-shadow: inset 0 1px 0 rgb(255 255 255 / .6), 0 8px 20px -10px rgb(63 179 26 / .8); }
.btn--primary:hover { box-shadow: inset 0 1px 0 rgb(255 255 255 / .6), 0 12px 26px -10px rgb(63 179 26 / .9); }
.btn--ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn--ghost:hover { background: #fafafa; box-shadow: inset 0 0 0 1px rgb(0 0 0 / .14); }
.btn--dark { background: var(--grad-deep); color: #fff; }
.btn--danger { background: #fff; color: var(--hot); box-shadow: inset 0 0 0 1px rgb(229 72 77 / .35); }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn--icon { width: 40px; padding: 0; }
.btn svg { flex: none; }
.link { background: none; border: 0; color: var(--green); font-weight: 600; cursor: pointer; padding: 0; }

/* ── Formularios ── */
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; font-weight: 500; color: var(--muted); }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 9px 12px; border: 0; border-radius: var(--r-sm); background: var(--surface); box-shadow: inset 0 0 0 1px rgb(0 0 0 / .1); outline: none; transition: box-shadow 160ms; }
.input:focus, .select:focus, .textarea:focus { box-shadow: inset 0 0 0 2px var(--green), 0 0 0 4px rgb(39 128 26 / .14); }
.textarea { min-height: 90px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.err { color: var(--hot); font-size: 13px; min-height: 18px; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ── Acceso ── */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(60% 50% at 20% 10%, rgb(166 242 10 / .18), transparent 70%), radial-gradient(50% 40% at 90% 90%, rgb(39 128 26 / .14), transparent 70%), var(--bg); }
.auth__card { width: min(420px, 100%); padding: 32px; border-radius: 28px; display: grid; gap: 16px; }
.auth__brand { display: flex; flex-direction: column; align-items: center; gap: 10px; justify-self: center; padding: 4px 0 6px; color: var(--ink); }
.auth__brand .logo--v { width: 124px; }
/* Logo oficial (brand.js): hereda el color del texto; el símbolo lleva el verde de la marca */
.logo { display: block; height: auto; overflow: visible; }
.crm-tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 980px; font-size: 10.5px; font-weight: 700; letter-spacing: .14em; color: #0b2a06; background: linear-gradient(135deg, #d4ff6b, #7ad81e 60%, #3fb31a); }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; color: var(--ink); }
.side__brand .logo--h { width: 128px; }
/* Portal del cliente (Mi lote) en la ficha de venta */
.portal-card__st { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
.portal-code { display: grid; justify-items: center; gap: 4px; padding: 18px; margin-bottom: 14px; border-radius: 18px; text-align: center; background: rgb(166 242 10 / .14); box-shadow: inset 0 0 0 1px rgb(63 179 26 / .3); }
.portal-code small, .portal-code span { color: var(--muted); font-size: 12.5px; }
.portal-code strong { font-size: 30px; letter-spacing: .14em; font-variant-numeric: tabular-nums; color: #0e3d08; }
.wordmark { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; background: linear-gradient(120deg, #3aa516, #27801a 50%, #145a0c); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark small { font-size: 11px; letter-spacing: .3em; color: var(--muted); -webkit-text-fill-color: var(--muted); margin-left: 4px; font-weight: 600; }
.auth h1 { font-size: 26px; }
.auth p { margin: 0; color: var(--muted); }

/* ── Estructura ── */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; border-right: 1px solid var(--line); background: rgb(255 255 255 / .7); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--ink); font-weight: 500; cursor: pointer; border: 0; background: none; width: 100%; text-align: left; transition: background 160ms; }
.nav-item:hover { background: rgb(39 128 26 / .07); }
.nav-item[aria-current="page"] { background: var(--grad); color: var(--on-lime); font-weight: 600; box-shadow: inset 0 1px 0 rgb(255 255 255 / .6), 0 6px 16px -8px rgb(63 179 26 / .7); }
.nav-item .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; font-size: 12px; font-weight: 700; display: grid; place-items: center; background: var(--hot); color: #fff; }
.side__foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--on-lime); background: var(--grad); flex: none; }
.avatar--sm { width: 26px; height: 26px; font-size: 11px; }
.me small { display: block; color: var(--muted); font-size: 12px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 10px; padding: 12px 24px; background: rgb(245 245 247 / .78); -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 22px; margin-right: auto; }
.search { position: relative; width: min(340px, 40vw); }
.search .input { padding-left: 36px; border-radius: 980px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.bell { position: relative; }
.bell .dot { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--hot); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.content { padding: 22px 24px 60px; display: grid; gap: 18px; align-content: start; }

/* ── Tarjetas ── */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.card h2 { font-size: 17px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.card h2 small { font-weight: 500; color: var(--muted); font-size: 13px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi strong { font-size: 28px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.kpi em { font-style: normal; font-size: 12px; color: var(--muted); }
.kpi--accent { background: var(--grad-deep); color: #fff; }
.kpi--accent span, .kpi--accent em { color: rgb(255 255 255 / .75); }
.kpi--alert strong { color: var(--hot); }
.cols { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 980px; background: rgb(0 0 0 / .05); }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 980px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgb(0 0 0 / .12); }

/* Embudo y barras */
.funnel { display: grid; gap: 8px; }
.funnel__row { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.bar { height: 22px; border-radius: 8px; background: rgb(0 0 0 / .04); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 8px; background: var(--grad); min-width: 2px; transition: width 600ms cubic-bezier(.22, 1, .36, 1); }
.funnel__row strong { text-align: right; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 120px; }

/* Tablas */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.click { cursor: pointer; transition: background 140ms; }
tbody tr.click:hover { background: rgb(39 128 26 / .04); }
.rank { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; background: rgb(0 0 0 / .05); }
.rank--1 { background: var(--grad); color: var(--on-lime); }

/* Etiquetas */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 980px; font-size: 12px; font-weight: 600; white-space: nowrap; background: rgb(0 0 0 / .05); color: var(--ink); }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.temp-CALIENTE { color: var(--hot); background: rgb(229 72 77 / .1); }
.temp-TIBIO { color: #b26a00; background: rgb(245 166 35 / .14); }
.temp-FRIO { color: #3a68c4; background: rgb(94 143 230 / .12); }
.stage { background: rgb(39 128 26 / .1); color: var(--green-ink); }
.stage-PERDIDO { background: rgb(0 0 0 / .06); color: var(--muted); }
.stage-VENTA { background: var(--grad); color: var(--on-lime); }
.chan { background: rgb(0 0 0 / .05); }
.chan-META { background: rgb(24 119 242 / .1); color: #1462c7; }
.chan-TIKTOK { background: rgb(0 0 0 / .08); color: #111; }
.chan-GOOGLE { background: rgb(234 67 53 / .1); color: #c5221f; }
.chan-WHATSAPP { background: rgb(37 211 102 / .14); color: #128c4a; }
.score { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.score b { width: 46px; height: 6px; border-radius: 9px; background: rgb(0 0 0 / .07); overflow: hidden; display: inline-block; }
.score b i { display: block; height: 100%; background: var(--grad); }
.overdue { color: var(--hot); font-weight: 600; }

/* Filtros */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip { border: 0; padding: 7px 14px; border-radius: 980px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); font-size: 13px; font-weight: 500; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--grad); color: var(--on-lime); box-shadow: none; font-weight: 600; }
.filters .select { width: auto; min-height: 34px; padding: 4px 30px 4px 12px; border-radius: 980px; font-size: 13px; }

/* Embudo (kanban) */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; scroll-snap-type: x proximity; }
.col { background: rgb(0 0 0 / .035); border-radius: var(--r-lg); padding: 10px; min-height: 200px; scroll-snap-align: start; transition: background 160ms, box-shadow 160ms; }
.col.is-over { background: rgb(166 242 10 / .16); box-shadow: inset 0 0 0 2px rgb(63 179 26 / .5); }
.col__head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; font-weight: 600; font-size: 14px; }
.col__head span { font-size: 12px; color: var(--muted); font-weight: 600; background: #fff; padding: 2px 8px; border-radius: 99px; }
.col__body { display: grid; gap: 8px; }
.kcard { background: #fff; border-radius: 14px; padding: 12px; box-shadow: 0 1px 2px rgb(0 0 0 / .05), 0 6px 16px -12px rgb(20 70 10 / .35); cursor: grab; display: grid; gap: 6px; transition: transform 160ms, box-shadow 160ms; }
.kcard:hover { transform: translateY(-2px); box-shadow: 0 14px 28px -16px rgb(20 70 10 / .45); }
.kcard.is-dragging { opacity: .5; }
.kcard strong { font-size: 14px; }
.kcard__meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }

/* Panel del lead */
.drawer-scrim { position: fixed; inset: 0; z-index: 90; background: rgb(10 20 8 / .25); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity 260ms; }
.drawer-scrim.is-open { opacity: 1; }
.drawer { position: fixed; z-index: 100; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--bg); box-shadow: -30px 0 60px -30px rgb(20 70 10 / .4); transform: translateX(104%); transition: transform 420ms cubic-bezier(.22, 1, .36, 1); display: flex; flex-direction: column; }
.drawer.is-open { transform: none; }
.drawer__head { padding: 18px 20px 14px; background: #fff; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.drawer__title { display: flex; align-items: center; gap: 12px; }
.drawer__title h2 { font-size: 22px; }
.drawer__title .btn--icon { margin-left: auto; }
.drawer__body { overflow-y: auto; padding: 16px 20px 40px; display: grid; gap: 14px; align-content: start; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick .btn { flex-direction: column; gap: 4px; min-height: 64px; border-radius: 16px; font-size: 12px; }
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.kv div { display: grid; gap: 2px; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; font-size: 14px; word-break: break-word; }
.ai { border-radius: var(--r-lg); padding: 16px; background: linear-gradient(160deg, rgb(166 242 10 / .14), rgb(255 255 255) 55%); box-shadow: inset 0 0 0 1px rgb(63 179 26 / .25); display: grid; gap: 10px; }
.ai h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.ai .spark-ico { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--grad); color: var(--on-lime); }
.ai__msg { background: #fff; border-radius: 14px; padding: 12px; box-shadow: inset 0 0 0 1px var(--line); white-space: pre-wrap; }
.ai__row { display: flex; flex-wrap: wrap; gap: 8px; }
.timeline { display: grid; gap: 0; }
.tl { display: grid; grid-template-columns: 28px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tl:last-child { border-bottom: 0; }
.tl__ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgb(0 0 0 / .05); color: var(--muted); }
.tl__ico--call, .tl__ico--whatsapp, .tl__ico--visit { background: rgb(166 242 10 / .25); color: var(--green-ink); }
.tl__ico--stage { background: var(--grad); color: var(--on-lime); }
.tl__ico--sla { background: rgb(229 72 77 / .12); color: var(--hot); }
.tl p { margin: 0; white-space: pre-wrap; }
.tl small { color: var(--muted); font-size: 12px; }
.mic { position: relative; }
.mic.is-rec { background: var(--hot); color: #fff; box-shadow: 0 0 0 6px rgb(229 72 77 / .18); animation: rec 1.2s ease-in-out infinite; }
@keyframes rec { 50% { box-shadow: 0 0 0 12px rgb(229 72 77 / .08); } }

/* Tareas */
.task { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgb(0 0 0 / .2); background: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.check.is-done { background: var(--grad); border-color: transparent; color: var(--on-lime); }
.task.is-done .task__t { text-decoration: line-through; color: var(--muted); }
.task__t { font-weight: 500; }
.task small { color: var(--muted); font-size: 12px; }

/* Modal */
.modal-scrim { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgb(10 20 8 / .3); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal { width: min(480px, 100%); max-height: 90vh; overflow-y: auto; border-radius: 26px; padding: 24px; display: grid; gap: 14px; background: #fff; box-shadow: 0 40px 80px -30px rgb(20 70 10 / .5); animation: pop 280ms cubic-bezier(.22, 1.2, .36, 1); }
@keyframes pop { from { transform: scale(.94); opacity: 0; } }
.modal h2 { font-size: 20px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.secret { font: 600 16px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .08em; background: var(--bg); padding: 12px; border-radius: 12px; word-break: break-all; user-select: all; }

/* Avisos */
#toast-host { position: fixed; z-index: 300; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; pointer-events: none; }
.toast { padding: 12px 18px; border-radius: 16px; font-weight: 500; background: rgb(29 29 31 / .92); color: #fff; box-shadow: 0 16px 40px -16px rgb(0 0 0 / .5); animation: pop 300ms cubic-bezier(.22, 1.2, .36, 1); }
.toast--ok { background: var(--grad-deep); }
.toast--err { background: #b42318; }
.notif-panel { position: fixed; z-index: 120; top: 64px; right: 16px; width: min(380px, calc(100vw - 32px)); max-height: 70vh; overflow-y: auto; border-radius: 22px; padding: 10px; }
.notif { display: grid; gap: 2px; padding: 10px 12px; border-radius: 14px; cursor: pointer; }
.notif:hover { background: rgb(39 128 26 / .06); }
.notif.is-unread strong::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--hot); margin-right: 6px; }
.notif small { color: var(--muted); font-size: 12px; }
.empty { padding: 30px 10px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.hint { font-size: 13px; color: var(--muted); }
.list-cards { display: none; }

/* ── Móvil: app con barra inferior ── */
.tabbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 10px 14px; }
  .top h1 { font-size: 20px; }
  .search { display: none; }
  .content { padding: 14px 14px calc(110px + env(safe-area-inset-bottom)); gap: 14px; }
  .cols { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi strong { font-size: 24px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 80; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 24px; }
  .tab { border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 0 5px; border-radius: 18px; font-size: 10.5px; font-weight: 500; color: #5a5a60; cursor: pointer; position: relative; -webkit-tap-highlight-color: transparent; }
  .tab[aria-current="page"] { background: var(--grad); color: var(--on-lime); font-weight: 600; box-shadow: inset 0 1px 0 rgb(255 255 255 / .7); }
  .tab .count { position: absolute; top: 2px; right: 18%; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--hot); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
  .table-wrap.leads-table { display: none; }
  .list-cards { display: grid; gap: 8px; }
  .lcard { background: #fff; border-radius: 18px; padding: 14px; box-shadow: var(--shadow); display: grid; gap: 6px; }
  .lcard__top { display: flex; align-items: center; gap: 8px; }
  .lcard__top strong { margin-right: auto; }
  .board { grid-auto-columns: 84%; }
  .drawer { width: 100vw; border-radius: 0; }
  .quick { grid-template-columns: repeat(4, 1fr); }
  .grid2 { grid-template-columns: 1fr; }
  .notif-panel { top: auto; bottom: calc(90px + env(safe-area-inset-bottom)); }
  .funnel__row { grid-template-columns: 96px 1fr 34px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

[hidden] { display: none !important; }
/* Evita que una tabla ancha estire la página en pantallas chicas */
.content { grid-template-columns: minmax(0, 1fr); }
.content > *, [data-dash], [data-list], [data-tasks], [data-team], .cols > * { min-width: 0; }
[data-dash] { display: grid; gap: 18px; }
@media (max-width: 900px) {
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
  .filters::-webkit-scrollbar { display: none; }
  .filters > * { flex: none; }
}

/* ── WhatsApp: bandeja y chat ── */
.inbox { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; height: calc(100vh - 66px - 44px); min-height: 520px; }
.inbox__list { display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.inbox__tools { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.wa-note { margin: 0; display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 14px; background: rgb(245 166 35 / .1); box-shadow: inset 0 0 0 1px rgb(245 166 35 / .25); font-size: 13px; color: #6b4a06; }
.wa-note svg { flex: none; margin-top: 2px; }
.convs { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 4px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 6px; }
.conv { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: start; text-align: left; border: 0; background: none; padding: 10px; border-radius: 14px; cursor: pointer; transition: background 160ms; }
.conv:hover { background: rgb(39 128 26 / .05); }
.conv.is-active { background: linear-gradient(135deg, rgb(184 245 42 / .22), rgb(63 179 26 / .12)); box-shadow: inset 0 0 0 1px rgb(63 179 26 / .25); }
.conv .avatar { width: 40px; height: 40px; }
.conv__main { display: grid; gap: 3px; min-width: 0; }
.conv__top { display: flex; gap: 8px; align-items: baseline; }
.conv__top strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: auto; }
.conv__top small { color: var(--muted); font-size: 12px; flex: none; }
.conv__last { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.is-unread .conv__last { color: var(--ink); font-weight: 500; }
.conv__last b { font-weight: 600; color: var(--ink); }
.conv__last .by-ai { color: var(--green); }
.conv__tags { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.conv__tags .pill { font-size: 11px; padding: 2px 8px; }
.conv__badge { align-self: center; min-width: 22px; height: 22px; border-radius: 99px; background: var(--grad); color: var(--on-lime); font-size: 12px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.ai-pill { background: rgb(63 179 26 / .1); color: var(--green-ink); }

.chat { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.chat__empty { margin: auto; display: grid; justify-items: center; gap: 6px; max-width: 300px; }
.chat__empty svg { color: var(--green); }
.chat__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chat__who { display: grid; min-width: 0; margin-right: auto; }
.chat__who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__who small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__mode { width: auto; min-height: 32px; padding: 4px 28px 4px 12px; border-radius: 980px; font-size: 13px; }
.chat__back { display: none; }
.chat__back svg { transform: rotate(180deg); }
.control { display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13px; background: #fafafa; border-bottom: 1px solid var(--line); }
.control span { margin-right: auto; }
.control--ai { background: linear-gradient(90deg, rgb(184 245 42 / .16), rgb(255 255 255)); }
.control--ai svg { color: var(--green); }
.control--human { background: linear-gradient(90deg, rgb(245 166 35 / .14), rgb(255 255 255)); }
.chat__scroll { flex: 1; overflow-y: auto; padding: 16px clamp(12px, 3vw, 28px); display: flex; flex-direction: column; gap: 6px;
  background: radial-gradient(70% 60% at 90% 0%, rgb(166 242 10 / .07), transparent 70%), #f7f8f5; }
.day { text-align: center; margin: 10px 0 4px; }
.day span { font-size: 12px; color: var(--muted); background: rgb(255 255 255 / .9); padding: 3px 10px; border-radius: 99px; box-shadow: 0 1px 2px rgb(0 0 0 / .06); text-transform: capitalize; }
.msg { max-width: min(74%, 560px); padding: 8px 12px 6px; border-radius: 18px; display: grid; gap: 2px; box-shadow: 0 1px 1.5px rgb(0 0 0 / .08); animation: msg-in 260ms cubic-bezier(.22, 1, .36, 1); }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
.msg p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg small { justify-self: end; font-size: 11px; color: var(--muted); }
.msg em { font-size: 12px; font-style: normal; }
.msg--customer { align-self: flex-start; background: #fff; border-bottom-left-radius: 6px; }
.msg--ai { align-self: flex-end; background: linear-gradient(135deg, #eafbd0, #dff6c2); border-bottom-right-radius: 6px; }
.msg--agent { align-self: flex-end; background: linear-gradient(135deg, #1f7a12, #145a0c); color: #fff; border-bottom-right-radius: 6px; }
.msg--agent small, .msg--agent .who { color: rgb(255 255 255 / .75); }
.who { font-size: 11.5px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.who--ai { color: var(--green); }
.tick--read { color: #3b9cf0; }
.msg--agent .tick--read { color: #b8f52a; }
.tick--failed { color: var(--hot); font-weight: 700; }
.composer { border-top: 1px solid var(--line); padding: 10px 12px 12px; display: grid; gap: 8px; background: #fff; }
.composer .textarea { min-height: 44px; max-height: 160px; resize: none; border-radius: 20px; padding: 11px 14px; }
.composer__row { display: flex; align-items: center; gap: 8px; }
.composer__row .hint { margin-right: auto; font-size: 12px; }
.composer__row .btn--primary { margin-left: auto; }
.composer--closed p { margin: 0; }
.draft-tag { justify-self: start; display: inline-flex; gap: 5px; align-items: center; font-size: 12px; font-weight: 600; color: var(--green-ink); background: rgb(166 242 10 / .2); padding: 3px 10px; border-radius: 99px; }
.simbar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; background: #f1f3ee; border-top: 1px dashed rgb(0 0 0 / .12); font-size: 12px; color: var(--muted); }
.simbar span { display: inline-flex; gap: 4px; align-items: center; flex: none; }
.simbar .input { min-height: 34px; border-radius: 99px; font-size: 13px; }
.wa-setup { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.wa-setup summary { cursor: pointer; font-weight: 600; }
.wa-setup ol { padding-left: 20px; display: grid; gap: 10px; font-size: 14px; }

@media (max-width: 900px) {
  .inbox { grid-template-columns: 1fr; height: auto; min-height: 0; }
  .convs { background: none; box-shadow: none; padding: 0; gap: 8px; }
  .conv { background: #fff; box-shadow: var(--shadow); border-radius: 18px; }
  .chat { display: none; }
  body.in-chat .chat { display: flex; position: fixed; inset: 0; z-index: 95; border-radius: 0; }
  body.in-chat .tabbar { display: none; }
  .chat__back { display: inline-flex; }
  .chat__head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .chat__head .hide-sm { display: none; }
  .composer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .msg { max-width: 86%; }
  .control { flex-wrap: wrap; }
}
.content[data-view="chats"] { padding-bottom: 22px; }
@media (min-width: 901px) { .inbox { height: calc(100vh - 111px); height: calc(100dvh - 111px); } }

/* ── Campañas ── */
.plat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.plat { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 4px; }
.plat header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.plat header b { font-size: 13px; color: var(--green-ink); background: rgb(166 242 10 / .2); padding: 2px 8px; border-radius: 99px; }
.plat strong { font-size: 22px; letter-spacing: -0.02em; }
.plat small { color: var(--muted); font-size: 12.5px; }
.conn { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.conn li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.conn li i { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgb(0 0 0 / .2); flex: none; margin-top: 3px; }
.conn li.on svg { color: var(--green); flex: none; margin-top: 3px; }
.conn li small { display: block; }
.conv-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.conv-counts div { background: #fafafa; border-radius: 14px; padding: 10px 12px; display: grid; }
.conv-counts span { font-size: 12px; color: var(--muted); }
.conv-counts strong { font-size: 20px; }
.conv-counts small { font-size: 11.5px; color: var(--muted); }
.ev-grid { display: grid; grid-template-columns: max-content 1fr; gap: 8px 12px; align-items: center; }
@media (max-width: 900px) { .conv-counts { grid-template-columns: 1fr 1fr 1fr; } .ev-grid { grid-template-columns: 1fr; } }
td.num, th.num { white-space: nowrap; }
@media (max-width: 900px) { .plat-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .plat strong { font-size: 18px; } }

/* ── Posventa ── */
.mini-bar { display: block; height: 6px; border-radius: 99px; background: rgb(0 0 0 / .07); overflow: hidden; margin-top: 6px; }
.mini-bar i { display: block; height: 100%; background: var(--grad); border-radius: inherit; }
.kpi--accent .mini-bar { background: rgb(255 255 255 / .25); }
.bar--warn i { background: linear-gradient(90deg, #f5a623, #e5484d) !important; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.sale-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.sale-head > div:nth-child(2) { margin-right: auto; }
.sale-head h2 { font-size: 22px; }
.sale-head p { margin: 2px 0 0; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.steps button { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: var(--surface); box-shadow: var(--shadow); border-radius: 14px; padding: 10px 12px; cursor: pointer; font-size: 13px; text-align: left; color: var(--muted); }
.steps button:disabled { cursor: default; }
.steps i { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 700; background: rgb(0 0 0 / .06); }
.steps .done button { color: var(--ink); }
.steps .done i { background: var(--green); color: #fff; }
.steps .now button { color: var(--on-lime); background: var(--grad); font-weight: 600; }
.steps .now i { background: #fff; color: var(--green-ink); }
.stack { display: grid; gap: 18px; align-content: start; min-width: 0; }
.docs { display: grid; gap: 6px; }
.doc { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; cursor: pointer; font-size: 14px; }
.doc:hover { background: #fafafa; }
.doc input { margin-top: 3px; accent-color: var(--green); width: 16px; height: 16px; }
.doc small { display: block; color: var(--muted); font-size: 11.5px; }
.doc.is-done span { color: var(--green-ink); }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr; } }
@media print {
  .side, .top, .tabbar, .no-print, .filters, #toast-host { display: none !important; }
  .shell { display: block; } body { background: #fff; } .content { padding: 0; }
  .card, .kpi { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
  .steps button { box-shadow: none; border: 1px solid #ddd; }
  .cols { grid-template-columns: 1fr; }
}
.funnel--money .funnel__row { grid-template-columns: 96px 1fr auto; } .funnel--money strong { white-space: nowrap; }
.task > .pill { white-space: nowrap; }

/* ── Ajustes de diseño: cada bloque con su espacio, botones con su tamaño natural ── */
[data-pv], [data-camp], [data-tasks], [data-dash], [data-team-wrap] { display: grid; gap: 18px; align-content: start; min-width: 0; }
.kpis + .cols, .kpis + section, .cols + .cols, .cols + section, section + .cols { margin-top: 0; }
.field { align-content: start; }
.grid2 { align-items: start; }
.grid2 > .chip, form > .chip, .field > .chip, label.chip { display: inline-flex; align-items: center; gap: 8px; justify-self: start; align-self: center; width: auto; min-height: 36px; line-height: 1.2; }
label.chip input { margin: 0; accent-color: var(--green); width: 16px; height: 16px; flex: none; }
.field > .btn, .grid2 > .btn, .grid2 > div > .btn, form > .btn, .card > .btn { justify-self: start; align-self: start; height: auto; min-height: 40px; width: auto; }
.btn--sm { min-height: 34px; }
.btn--icon { flex: none; aspect-ratio: auto; height: 40px; }
.btn--icon.btn--sm { width: 34px; height: 34px; }
.kpi { min-width: 0; }
.kpi strong { overflow-wrap: anywhere; }
.plat-cards { align-items: stretch; }
.card h2 { flex-wrap: wrap; }
.ai--bar { display: flex; align-items: center; gap: 16px; justify-content: space-between; }
.ai--bar > div { display: grid; gap: 4px; max-width: 760px; }
.bulk { display: grid; gap: 10px; max-height: 62vh; overflow-y: auto; padding-right: 4px; }
.bulk__item { background: #fafafa; border-radius: 16px; padding: 12px; display: grid; gap: 8px; }
.bulk__item.is-sent { background: rgb(166 242 10 / .12); }
.bulk__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.matrix th, .matrix td { text-align: center; white-space: nowrap; }
.matrix td:first-child, .matrix th:first-child { text-align: left; white-space: normal; }
.matrix .yes { color: var(--green); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgb(39 128 26 / .1); }
.matrix .no { color: var(--muted); }
.roles-desc { display: grid; gap: 6px; margin-top: 12px; font-size: 13.5px; }
.roles-desc p { margin: 0; color: var(--muted); }
.roles-desc strong { color: var(--ink); }
.modal { max-height: 88vh; overflow-y: auto; }
@media (max-width: 900px) {
  .ai--bar { flex-direction: column; align-items: stretch; }
  .ai--bar .btn { justify-content: center; }
}
.task:has(> .pill:first-child) { grid-template-columns: auto minmax(0, 1fr) auto; }

/* ── Listas desplegables con el estilo de la marca ──
   Flecha propia con margen. En navegadores que permiten personalizar la lista (Chrome/Edge recientes),
   el menú de opciones también lleva el estilo: cristal, bordes redondeados y la opción elegida en verde. */
select.select {
  -webkit-appearance: none; appearance: none; cursor: pointer;
  padding-right: 42px !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2327801A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; background-size: 12px 8px;
  text-overflow: ellipsis; white-space: nowrap;
}
@supports (appearance: base-select) {
  select.select, select.select::picker(select) { appearance: base-select; }
  select.select { display: inline-flex; align-items: center; gap: 10px; background-image: none; padding-right: 16px !important; }
  select.select::picker-icon {
    content: ""; width: 12px; height: 8px; margin-left: auto; flex: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1.5l5 5 5-5' stroke='%2327801A' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 12px 8px;
    transition: rotate 200ms ease;
  }
  select.select:open::picker-icon { rotate: 180deg; }
  select.select::picker(select) {
    border: 0; border-radius: 18px; padding: 6px; margin-block: 6px; min-width: anchor-size(width);
    background: rgb(255 255 255 / .92); -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
    box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06), 0 22px 44px -16px rgb(20 70 10 / .38);
    max-height: min(60vh, 380px); overflow-y: auto;
    opacity: 0; translate: 0 -4px; transition: opacity 160ms ease, translate 160ms ease, display 160ms allow-discrete, overlay 160ms allow-discrete;
  }
  select.select:open::picker(select) { opacity: 1; translate: 0 0; }
  @starting-style { select.select:open::picker(select) { opacity: 0; translate: 0 -4px; } }
  select.select option { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; font-size: 14px; color: var(--ink, #1d1d1f); cursor: pointer; }
  select.select option:hover, select.select option:focus-visible { background: rgb(39 128 26 / .08); outline: none; }
  select.select option:checked { background: linear-gradient(135deg, #b8f52a 0%, #7ad81e 50%, #3fb31a 100%); color: #0b2a06; font-weight: 600; }
  select.select option::checkmark { order: 1; margin-left: auto; content: "✓"; font-weight: 700; }
  select.select option:disabled { opacity: .45; cursor: default; }
}

/* ═══ Versión móvil: distribución ═══ */
.who-cell { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage-tabs { display: none; }

/* Fichas de leads (lista móvil) */
.lcard { position: relative; gap: 10px !important; padding: 14px 14px 12px !important; border-radius: 20px !important; cursor: pointer; transition: transform 160ms; }
.lcard:active { transform: scale(.985); }
.lcard.is-new { box-shadow: inset 3px 0 0 #e5484d, var(--shadow) !important; }
.lcard__top { display: grid !important; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px !important; }
.lcard__top .avatar { width: 40px; height: 40px; }
.lcard__id { display: grid; gap: 1px; min-width: 0; }
.lcard__id strong { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lcard__id small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lcard__score { min-width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.lcard__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.lcard__foot { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); padding-top: 8px; border-top: 1px solid var(--line); }
.lcard__foot span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lcard__alert { color: #c2353a; font-weight: 600; }

@media (max-width: 900px) {
  /* Encabezado: título con espacio; «Nuevo» compacto */
  .top { gap: 8px; min-height: 58px; }
  .top h1 { font-size: 21px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 0; }
  .top .btn--primary[data-new-lead] { width: 42px; padding: 0; }
  .top .btn--primary[data-new-lead] .hide-sm { display: none; }
  .content { gap: 12px; }
  .card { padding: 16px; border-radius: 20px; }
  .card h2 { font-size: 16px; }
  .card h2 small { flex-basis: 100%; font-size: 12px; }

  /* Filtros: una fila deslizable, con tamaño cómodo para el dedo */
  .filters { gap: 8px; }
  .filters .chip, .filters .select, .filters .input, .filters .btn { min-height: 38px; }
  .filters .input { width: 170px !important; }

  /* Tablas → tarjetas apiladas (cada dato con su etiqueta) */
  .table-wrap:not(:has(.matrix)) { margin: 0; padding: 0; overflow: visible; }
  .table-wrap table:not(.matrix) thead { display: none; }
  .table-wrap table:not(.matrix), .table-wrap table:not(.matrix) tbody { display: block; width: 100%; }
  .table-wrap table:not(.matrix) tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .table-wrap table:not(.matrix) tr:first-child { padding-top: 4px; }
  .table-wrap table:not(.matrix) tr:last-child { border-bottom: 0; padding-bottom: 0; }
  .table-wrap table:not(.matrix) td { display: grid; align-content: start; gap: 3px; padding: 0; border: 0; text-align: left !important; white-space: normal; min-width: 0; font-size: 14px; }
  .table-wrap table:not(.matrix) td::before { content: attr(data-label); font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .01em; }
  .table-wrap table:not(.matrix) td[data-label=""]::before { display: none; }
  .table-wrap table:not(.matrix) td:first-child { grid-column: 1 / -1; font-size: 15px; }
  .table-wrap table:not(.matrix) td:first-child::before { display: none; }
  .table-wrap table:not(.matrix) td:last-child:not([data-label]), .table-wrap table:not(.matrix) td[data-label=""] { grid-column: 1 / -1; }
  .table-wrap table:not(.matrix) td .row-actions { justify-content: flex-start; }
  .table-wrap table:not(.matrix) td .pill { justify-self: start; }

  /* Embudo: una etapa a la vez */
  .stage-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 2px 14px 4px; }
  .stage-tabs::-webkit-scrollbar { display: none; }
  .stage-tabs .chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 38px; }
  .stage-tabs .chip b { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; display: grid; place-items: center; font-size: 12px; background: rgb(0 0 0 / .06); }
  .stage-tabs .chip[aria-pressed="true"] b { background: rgb(255 255 255 / .55); }
  .board { display: block; overflow: visible; padding: 0; }
  .board .col { display: none; background: none; padding: 0; min-height: 0; }
  .board .col.is-active { display: block; }
  .board .col__head { display: none; }
  .board .col__body { gap: 10px; }
  .board .kcard { padding: 14px; border-radius: 18px; cursor: pointer; }
  .board .kcard strong { font-size: 15px; }


  /* Chats y listas: respiración uniforme */
  .convs { gap: 10px; }
  .conv { padding: 12px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; border-radius: 18px; }
}

.col__empty { margin: 0; padding: 18px 8px; text-align: center; color: var(--muted); font-size: 13px; }
@media (max-width: 900px) { [data-list].card { background: none; box-shadow: none; padding: 0; } .list-cards { gap: 10px; } }

/* Barra inferior: se reparte sola según cuántas secciones tiene el rol (4 o 5), siempre centrada */
@media (max-width: 900px) {
  .tabbar { grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); left: 50%; right: auto; translate: -50% 0; width: min(calc(100% - 20px), 460px); }
  .tab { min-width: 0; }
  .tab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
}

/* ── Asistente IA del equipo ── */
.assist-btn { gap: 6px; color: var(--green-ink); box-shadow: inset 0 0 0 1px rgb(63 179 26 / .35); background: linear-gradient(135deg, rgb(184 245 42 / .18), #fff); }
.assist { position: fixed; z-index: 115; top: 72px; right: 16px; bottom: 16px; width: min(420px, calc(100vw - 32px)); border-radius: 26px; display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; transform: translateY(10px) scale(.98); transition: opacity 220ms, transform 320ms cubic-bezier(.22, 1, .36, 1); background: rgb(255 255 255 / .94); }
.assist.is-open { opacity: 1; transform: none; }
.assist__head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 12px; border-bottom: 1px solid var(--line); }
.assist__head > div { display: grid; margin-right: auto; }
.assist__head small { color: var(--muted); font-size: 12px; }
.assist__log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.assist__hello p { margin: 0 0 12px; color: var(--muted); }
.assist__tips { display: grid; gap: 8px; }
.assist__tips .chip { text-align: left; justify-self: stretch; min-height: 40px; }
.amsg { max-width: 92%; padding: 10px 14px; border-radius: 18px; font-size: 14px; line-height: 1.5; }
.amsg p { margin: 0 0 6px; } .amsg p:last-child { margin: 0; }
.amsg ul { margin: 4px 0 6px; padding-left: 18px; display: grid; gap: 4px; }
.amsg a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.amsg--user { align-self: flex-end; background: var(--grad-deep); color: #fff; border-bottom-right-radius: 6px; }
.amsg--assistant { align-self: flex-start; background: #f3f5f0; border-bottom-left-radius: 6px; }
.amsg.is-typing { display: flex; gap: 4px; padding: 14px; }
.amsg.is-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: typing 1s infinite ease-in-out; }
.amsg.is-typing i:nth-child(2) { animation-delay: .15s; } .amsg.is-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
.assist__form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: #fff; }
.assist__form .textarea { min-height: 44px; max-height: 120px; resize: none; border-radius: 22px; padding: 11px 16px; }
@media (max-width: 900px) {
  .assist-btn { width: 42px; padding: 0; }
  .assist { inset: 0; width: 100%; border-radius: 0; padding-bottom: env(safe-area-inset-bottom); z-index: 130; }
  .assist__head { padding-top: calc(12px + env(safe-area-inset-top)); }
}
@media (max-width: 900px) { .assist-btn .hide-sm { display: none; } }

/* Enviar del asistente: círculo fijo de 44 px, alineado con el campo */
.assist__form { align-items: center; }
.assist__form .textarea { flex: 1 1 auto; width: auto; min-width: 0; }
.assist__form .btn { flex: 0 0 44px; width: 44px !important; height: 44px !important; min-height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; }

/* ── Tour 360° (editor) ── */
.tour-upload { cursor: pointer; }
.tour-rail { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.tour-scene { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border: 0; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left; }
.tour-scene img, .tour-scene__ph { width: 76px; height: 38px; border-radius: 12px; object-fit: cover; display: grid; place-items: center; background: #eef2ea; color: var(--muted); }
.tour-scene span:last-child { display: grid; gap: 3px; }
.tour-scene strong { font-size: 13.5px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tour-scene .pill { justify-self: start; font-size: 11px; }
.tour-scene.is-active { box-shadow: inset 0 0 0 2px var(--green), var(--shadow); }
.tour-edit { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.tour-view { display: grid; gap: 10px; min-width: 0; position: sticky; top: 84px; }
.tour-view .t360 { aspect-ratio: 16 / 10; }
.tour-panel { display: grid; gap: 12px; }
.tour-panel h3 { margin: 6px 0 0; font-size: 14px; }
.tour-map { height: 240px; border-radius: 16px; overflow: hidden; background: #dfe6da; }
.tour-sliders { display: grid; gap: 10px; }
.tslider { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.tslider span { display: flex; justify-content: space-between; }
.tslider output { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.tslider input { width: 100%; accent-color: var(--green); }
.tour-actions { display: flex; justify-content: space-between; gap: 10px; }
.tour-cam span { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #0b2a06; background: linear-gradient(135deg, #d4ff6b, #3fb31a); box-shadow: 0 0 0 3px #fff, 0 6px 14px rgb(0 0 0 / .35); }
.tour-handle span { display: block; width: 22px; height: 22px; border-radius: 50%; background: #3fb31a; box-shadow: 0 0 0 3px #fff, 0 4px 10px rgb(0 0 0 / .35); cursor: move; }
.tour-empty { display: block; color: var(--green); margin-bottom: 8px; }
@media (max-width: 1100px) { .tour-edit { grid-template-columns: 1fr; } .tour-view { position: static; } }

/* ═══ Capas: los mapas (Leaflet) y el visor 360 quedan contenidos y nunca tapan paneles, menús ni ventanas ═══ */
.leaflet-container, .tour-map, .t360, .esri-map { position: relative; isolation: isolate; z-index: 0; }
.assist { z-index: 140; }
.notif-panel { z-index: 145; }
.modal-scrim { z-index: 160; }

/* ═══ Campos: un solo anillo de enfoque (sin el contorno doble del navegador) ═══ */
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; }

/* ═══ Asistente: panel más sólido y caja de escritura en cápsula ═══ */
.assist { background: linear-gradient(180deg, rgb(255 255 255 / .97), rgb(248 250 246 / .97)); }
.assist::before { content: ""; position: absolute; inset: -40% -30% auto; height: 260px; z-index: -1; pointer-events: none;
  background: radial-gradient(50% 60% at 70% 40%, rgb(166 242 10 / .16), transparent 70%); }
.assist__head .spark-ico { width: 32px; height: 32px; border-radius: 11px; display: grid; place-items: center; color: var(--on-lime); background: var(--grad); box-shadow: 0 6px 14px -6px rgb(63 179 26 / .8); }
.assist__tips .chip { position: relative; padding-left: 38px; border-radius: 16px; background: #fff; box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgb(0 0 0 / .03); transition: box-shadow 160ms, transform 160ms; }
.assist__tips .chip::before { content: "✦"; position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--green); font-size: 13px; }
.assist__tips .chip:hover { box-shadow: inset 0 0 0 1px rgb(63 179 26 / .45), 0 6px 16px -10px rgb(20 70 10 / .4); transform: translateY(-1px); }
.assist__form { display: grid !important; gap: 6px; padding: 10px 12px 12px !important; border-top: 1px solid var(--line); background: rgb(255 255 255 / .9) !important; }
.composer-pill { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 26px; background: #fff;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .1), 0 10px 24px -18px rgb(20 70 10 / .45); transition: box-shadow 180ms; }
.composer-pill:focus-within { box-shadow: inset 0 0 0 1.5px var(--green), 0 0 0 4px rgb(39 128 26 / .1), 0 10px 24px -18px rgb(20 70 10 / .45); }
.composer-pill__ico { flex: none; width: 28px; height: 28px; margin-bottom: 6px; display: grid; place-items: center; color: var(--green); }
.composer-pill textarea { flex: 1; min-width: 0; min-height: 40px; max-height: 120px; padding: 10px 2px; border: 0; outline: none; background: transparent; resize: none; overflow-y: hidden;
  font: 15px/1.4 var(--font); color: var(--ink); scrollbar-width: thin; }
.composer-pill textarea::placeholder { color: #8e8e93; }
.composer-pill__send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer; color: var(--on-lime); background: var(--grad);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .6), 0 6px 14px -6px rgb(63 179 26 / .8); transition: transform 160ms, opacity 160ms; }
.composer-pill__send:hover { transform: scale(1.05); }
.composer-pill__send:disabled { opacity: .45; transform: none; cursor: default; }
.assist__note { margin: 0; text-align: center; font-size: 11px; color: var(--muted); }
@media (max-width: 900px) { .assist__note { display: none; } .assist__form { padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important; } }

/* ── Ubicación de la lotización ── */
.tour-tabs button { font-weight: 600; }
.plan-tool { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.plan-tool__map { position: relative; border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); isolation: isolate; }
.plan-tool__map [data-pmap] { height: min(72vh, 680px); min-height: 420px; background: #dfe6da; }
.plan-tool__map .is-picking { cursor: crosshair !important; }
.plan-tool__banner { position: absolute; z-index: 1000; left: 50%; top: 14px; transform: translateX(-50%); width: min(92%, 560px); padding: 12px 16px; border-radius: 18px; font-size: 14px; line-height: 1.45;
  color: #fff; background: rgb(11 30 7 / .86); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 16px 34px -14px rgb(0 0 0 / .6); }
.plan-tool__banner button { margin-left: 8px; border: 0; border-radius: 980px; padding: 4px 12px; font: 600 12px var(--font); cursor: pointer; color: #0b2a06; background: #c6f75a; }
.plan-tool__legend { position: absolute; z-index: 1000; left: 14px; bottom: 14px; display: flex; gap: 14px; padding: 8px 14px; border-radius: 980px; font-size: 12px; font-weight: 600; color: #fff; background: rgb(11 30 7 / .7); }
.plan-tool__legend span { display: inline-flex; align-items: center; gap: 6px; }
.plan-tool__legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-a { background: #ff5a4f; } .dot-b { background: #4f9dff; } .dot-c { background: #3fb31a; box-shadow: 0 0 0 2px #fff; }
.plan-tool__panel { display: grid; gap: 12px; position: sticky; top: 84px; }
.plan-tool__step { display: flex; gap: 12px; align-items: flex-start; }
.plan-tool__step small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.plan-tool__num { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--on-lime); background: var(--grad); }
.plan-tool__coords { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; padding: 8px 10px; border-radius: 12px; background: #f6f7f4; }
.nudge { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.nudge span { margin-right: auto; }
.nudge button { width: 34px; height: 34px; border: 0; border-radius: 10px; cursor: pointer; font-size: 15px; background: #fff; box-shadow: inset 0 0 0 1px var(--line); }
.nudge button:hover { box-shadow: inset 0 0 0 1px rgb(63 179 26 / .5); background: rgb(166 242 10 / .1); }
.plan-block span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--font); color: #c6f75a; background: rgb(11 42 6 / .85); }
.pick span { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--font); color: #fff; box-shadow: 0 0 0 3px #fff, 0 4px 10px rgb(0 0 0 / .4); }
.pick--a span { background: #ff5a4f; } .pick--b span { background: #4f9dff; }
.pick--real span { border-radius: 6px; }
@media (max-width: 1100px) { .plan-tool { grid-template-columns: 1fr; } .plan-tool__panel { position: static; } }
