/* =========================================================
   CRM · Hoja de estilos
   Paleta: blanco, grises fríos y azules. El color principal
   se puede cambiar desde Ajustes (variable --primary).
   ========================================================= */
:root {
  --primary: #2563eb;
  --primary-600: color-mix(in srgb, var(--primary) 88%, #000);
  --primary-50: color-mix(in srgb, var(--primary) 7%, #fff);
  --primary-100: color-mix(in srgb, var(--primary) 14%, #fff);
  --primary-200: color-mix(in srgb, var(--primary) 28%, #fff);
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e6eaf1;
  --line-2: #eef1f6;
  --bg: #f4f6fa;
  --surface: #ffffff;
  --navy: #0b1a3a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 50px -12px rgba(15, 23, 42, .25);
  --ring: 0 0 0 4px color-mix(in srgb, var(--primary) 16%, transparent);
  --danger: #dc2626;
  --warn: #d97706;
  --ok: #059669;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
code { font-size: 12px; background: var(--line-2); padding: 1px 6px; border-radius: 6px; color: var(--ink-2); }
.ic { flex-shrink: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 600; }
.block { display: block; }
.grow { flex: 1 1 auto; min-width: 0; }
.nowrap { white-space: nowrap; }
.break { word-break: break-word; }
.truncate { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.text-danger { color: var(--danger) !important; }
.text-warn { color: var(--warn); font-weight: 600; }
.mt-12 { margin-top: 12px; } .mb-12 { margin-bottom: 12px; } .mb-8 { margin-bottom: 8px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.inline-form { display: inline; }
.link { color: var(--primary); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40;
  padding: 18px 14px; transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, #0b1a3a));
  box-shadow: 0 4px 12px -4px color-mix(in srgb, var(--primary) 60%, transparent);
}
.brand-logo { width: 34px; height: 34px; border-radius: 10px; object-fit: contain; background: #fff; }
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 600; padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s;
}
.nav-item .ic { color: var(--muted); }
.nav-item:hover { background: var(--line-2); }
.nav-item.active { background: var(--primary-50); color: var(--primary); }
.nav-item.active .ic { color: var(--primary); }
.nav-count {
  margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 600; min-width: 22px; text-align: center;
  padding: 1px 7px; border-radius: 999px; background: var(--primary); color: #fff;
}
.nav-count.warn { background: #fef3c7; color: #92400e; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 4px; border-radius: var(--radius-sm); }
.me:hover { background: var(--line-2); }
.me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.me-text strong { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-text small { color: var(--muted); font-size: 12px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
}
.search {
  flex: 1; max-width: 460px; display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 14px; color: var(--muted); transition: box-shadow .15s, border-color .15s;
}
.search:focus-within { border-color: var(--primary-200); box-shadow: var(--ring); }
.search input { border: 0; outline: 0; background: transparent; padding: 9px 0; width: 100%; font: inherit; color: var(--ink); }
.topbar .btn-primary { margin-left: auto; }
.menu-btn { display: none; }
.content { padding: 8px 28px 48px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 14px 0 22px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.crumbs { display: flex; align-items: center; gap: 6px; margin: -8px 0 14px; }
.scrim { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.no-pad { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head p { margin-top: 2px; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: #f8fafc; border-color: #d8dee8; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 0; box-shadow: var(--ring); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(15,23,42,.1), inset 0 1px 0 rgba(255,255,255,.15); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-soft { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary); }
.btn-soft:hover { background: var(--primary-100); border-color: var(--primary-200); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--line-2); border-color: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-danger-ghost { color: var(--danger); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { height: 46px; font-size: 15px; }
.btn-block { width: 100%; }
.btn.disabled { pointer-events: none; opacity: .4; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0;
  background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--line-2); color: var(--ink); }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 12px; width: 100%; outline: 0; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 44px; }
select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-200); box-shadow: var(--ring); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; padding: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; position: relative; }
.field.inline > .ic { position: absolute; left: 12px; color: var(--muted); }
.field.inline > .ic + input { padding-left: 36px; }
.field.inline.date > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field.inline.date input { width: auto; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.span-2 { grid-column: span 2; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--tone-bg); color: var(--tone-fg);
}
.badge i { width: 6px; height: 6px; border-radius: 50%; background: var(--tone); }
.tone-blue   { --tone: #2563eb; --tone-bg: #eff4ff; --tone-fg: #1d4ed8; }
.tone-sky    { --tone: #0284c7; --tone-bg: #e8f6fd; --tone-fg: #0369a1; }
.tone-indigo { --tone: #4f46e5; --tone-bg: #eef0ff; --tone-fg: #4338ca; }
.tone-violet { --tone: #7c3aed; --tone-bg: #f3efff; --tone-fg: #6d28d9; }
.tone-cyan   { --tone: #0891b2; --tone-bg: #e6f8fb; --tone-fg: #0e7490; }
.tone-teal   { --tone: #0d9488; --tone-bg: #e6f7f5; --tone-fg: #0f766e; }
.tone-green  { --tone: #059669; --tone-bg: #e7f8f0; --tone-fg: #047857; }
.tone-amber  { --tone: #d97706; --tone-bg: #fef6e7; --tone-fg: #b45309; }
.tone-red    { --tone: #dc2626; --tone-bg: #fdeeee; --tone-fg: #b91c1c; }
.tone-gray   { --tone: #64748b; --tone-bg: #f1f4f8; --tone-fg: #475569; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--line-2); color: var(--ink-2); white-space: nowrap;
}
.chip.tiny { font-size: 11px; padding: 1px 7px; }
.chip-info { background: var(--primary-50); color: var(--primary); }
.chip-warn { background: #fef6e7; color: #b45309; }
.chip-danger { background: #fdeeee; color: #b91c1c; }
.chip-ok { background: #e7f8f0; color: #047857; }
.pill { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--line-2); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }

.avatar {
  --av: var(--primary);
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; display: inline-grid; place-items: center;
  font-size: 12.5px; font-weight: 600; color: var(--av); background: color-mix(in srgb, var(--av) 12%, #fff);
  border: 1px solid color-mix(in srgb, var(--av) 18%, #fff);
}
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }
.person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.person.small { gap: 8px; font-size: 13px; }
.person .strong:hover { color: var(--primary); }

.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); margin: 10px 0 0;
  background: #ecfdf5; color: #065f46; border: 1px solid #c8f0dc; font-weight: 500; animation: slideIn .25s ease;
}
.toast-error { background: #fef2f2; color: #991b1b; border-color: #fbd5d5; }
@keyframes slideIn { from { opacity: 0; transform: translateY(-4px); } }
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fbd5d5; }
.tip { margin-top: 14px; padding: 12px 14px; background: var(--primary-50); border: 1px solid var(--primary-100); border-radius: var(--radius-sm); font-size: 13px; color: var(--ink-2); line-height: 1.6; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .ic { color: var(--muted-2); margin-bottom: 10px; }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.small-empty { padding: 28px 12px; }
.small-empty p { font-size: 13px; max-width: 280px; margin: 0 auto; }

/* ---------- Dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; transition: border-color .15s, transform .15s; }
a.kpi:hover { border-color: var(--primary-200); }
.kpi-top { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 13px; font-weight: 500; }
.kpi-ic { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--primary-50); color: var(--primary); flex-shrink: 0; }
.kpi strong { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; }
.kpi small { font-size: 12.5px; }
.kpi-alert { border-color: var(--primary-200); background: linear-gradient(180deg, var(--primary-50), #fff 70%); }
.delta { font-style: normal; font-weight: 600; margin-left: 4px; padding: 0 6px; border-radius: 6px; font-size: 11.5px; }
.delta.up { color: #047857; background: #e7f8f0; }
.delta.down { color: #b91c1c; background: #fdeeee; }
.grid-main { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-main > .card:only-child { grid-column: span 2; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 220px; padding-top: 18px; }
.bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; }
.bar { width: 100%; max-width: 34px; height: var(--h); border-radius: 6px 6px 3px 3px; background: var(--primary-100); transition: background .15s; }
.bar-col:hover .bar { background: var(--primary-200); }
.bar-col.today .bar { background: var(--primary); }
.bar-val { font-size: 11.5px; font-weight: 600; color: var(--ink-2); min-height: 16px; }
.bar-lbl { font-size: 11.5px; color: var(--muted-2); }
.bar-col.today .bar-lbl { color: var(--primary); font-weight: 600; }

.list { list-style: none; padding: 0; margin: -6px -10px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm); }
a.list-row:hover { background: var(--line-2); }
.list-row .grow { display: flex; flex-direction: column; line-height: 1.35; }
.list-row strong { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row small { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.funnel { display: flex; flex-direction: column; gap: 4px; }
.funnel-row { display: grid; grid-template-columns: 120px 1fr 32px; align-items: center; gap: 12px; padding: 5px 6px; border-radius: 8px; }
.funnel-row:hover { background: var(--line-2); }
.funnel-lbl { font-size: 13px; color: var(--ink-2); }
.funnel-track { height: 8px; background: var(--line-2); border-radius: 99px; overflow: hidden; }
.funnel-fill { display: block; height: 100%; width: var(--w); background: var(--tone); border-radius: 99px; }
.funnel-num { text-align: right; font-weight: 600; font-size: 13px; }
.mini-progress { display: inline-block; width: 46px; height: 5px; border-radius: 9px; background: var(--line-2); vertical-align: middle; overflow: hidden; margin-right: 4px; }
.mini-progress i { display: block; height: 100%; width: var(--w); background: var(--primary); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 11px 16px; background: #fafbfd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover td { background: #f9fbff; }
.table .num { text-align: right; }
.table.compact th { background: none; padding: 8px 10px; }
.table.compact td { padding: 10px; }
.table .chk { width: 44px; padding-right: 0; }
.leads-table .person small { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.phone-link { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.phone-link:hover { color: var(--primary); }
.phone-link .ic { color: var(--muted-2); }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; padding-bottom: 2px; scrollbar-width: none; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 9px; color: var(--muted); font-weight: 500; white-space: nowrap; font-size: 13px; }
.tab em { font-style: normal; font-size: 11.5px; padding: 0 7px; border-radius: 99px; background: var(--line-2); color: var(--muted); }
.tab:hover { color: var(--ink); background: #fff; }
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow), 0 0 0 1px var(--line); }
.tab.active em { background: var(--primary); color: #fff; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; margin-bottom: 14px; }
.filters .field.inline.grow { min-width: 200px; }
.filters select { width: auto; min-width: 170px; }
.bulkbar {
  position: sticky; top: 64px; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: 12px;
  background: var(--navy); color: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.bulkbar select { width: auto; height: 32px; padding-top: 4px; padding-bottom: 4px; font-size: 13px; }
.bulkbar strong { margin-right: 8px; font-size: 13px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 18px; }

/* ---------- Ficha del lead ---------- */
.lead-hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.lead-id { display: flex; gap: 14px; align-items: center; }
.lead-id p { margin-top: 6px; }
.lead-cta { display: flex; gap: 8px; flex-wrap: wrap; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 16px; align-items: start; }

.stepper { display: flex; gap: 0; overflow-x: auto; padding: 4px 0 2px; }
.step {
  flex: 1; min-width: 104px; position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 0; background: none; cursor: pointer; padding: 4px 4px 2px; font: inherit; color: var(--muted);
}
.step::before { content: ""; position: absolute; top: 18px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 2px; background: var(--line); }
.step:first-child::before { display: none; }
.step.done::before, .step.current::before { background: var(--primary); }
.step-dot {
  position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 600; background: var(--surface); border: 2px solid var(--line); color: var(--muted); transition: all .2s;
}
.step-lbl { font-size: 12.5px; font-weight: 500; text-align: center; line-height: 1.25; }
.step:hover:not(:disabled) .step-dot { border-color: var(--primary-200); color: var(--primary); }
.step.done .step-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.done .step-lbl { color: var(--ink-2); }
.step.current .step-dot { border-color: var(--primary); color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 5px var(--primary-50); }
.step.current .step-lbl { color: var(--primary); font-weight: 600; }
.step.current.warn .step-dot { border-color: var(--warn); color: var(--warn); background: #fef6e7; box-shadow: 0 0 0 5px #fef6e7; }
.step.current.warn .step-lbl { color: var(--warn); }
.step:last-child.current .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; box-shadow: 0 0 0 5px #e7f8f0; }
.step:last-child.current .step-lbl { color: var(--ok); }
.stepper.is-closed { opacity: .45; }
.stepper.is-closed .step { cursor: default; }
.step-hint { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.closed-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--tone-bg); color: var(--tone-fg); margin-bottom: 16px; }

.call-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.call-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border-radius: 12px; cursor: pointer;
  background: #fafbfd; border: 1px solid var(--line); color: var(--ink-2); font: inherit; font-weight: 500; font-size: 13px; transition: all .15s;
}
.call-btn .ic { color: var(--muted); }
.call-btn:hover { border-color: var(--primary-200); background: var(--primary-50); color: var(--primary); }
.call-btn:hover .ic { color: var(--primary); }
.call-btn.ok { border-color: var(--primary-100); background: var(--primary-50); color: var(--primary); }
.call-btn.ok .ic { color: var(--primary); }
.call-btn.ok:hover { background: var(--primary); color: #fff; }
.call-btn.ok:hover .ic { color: #fff; }
.call-btn.bad:hover { border-color: #fbd5d5; background: #fef2f2; color: var(--danger); }
.call-btn.bad:hover .ic { color: var(--danger); }

.note-box { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; }
.note-box textarea { flex: 1; }
.message-quote { background: #fafbfd; border: 1px solid var(--line); border-left: 3px solid var(--primary); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 18px; }
.message-quote p { margin-top: 4px; color: var(--ink-2); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 14px; top: 8px; bottom: 8px; width: 2px; background: var(--line-2); }
.timeline li { display: flex; gap: 12px; padding: 8px 0; position: relative; }
.tl-ic { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--muted); flex-shrink: 0; }
.tl-note .tl-ic { background: #fffbeb; border-color: #fde9b7; color: #b45309; }
.tl-call .tl-ic { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary); }
.tl-status .tl-ic { background: #eef0ff; border-color: #dcdffd; color: #4338ca; }
.tl-assign .tl-ic { background: #e8f6fd; border-color: #cbe9f8; color: #0369a1; }
.tl-body { flex: 1; min-width: 0; padding-top: 4px; }
.tl-meta { display: flex; gap: 8px; align-items: baseline; font-size: 13px; }
.tl-text { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; word-break: break-word; }
.tl-note .tl-text { background: #fffdf5; border: 1px solid #f7ecc9; padding: 8px 12px; border-radius: 10px; margin-top: 6px; }

.dl { display: grid; grid-template-columns: 96px 1fr; gap: 9px 12px; margin: 0; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; }
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 4px 10px; font: inherit; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.chip-btn:hover { border-color: var(--primary-200); color: var(--primary); background: var(--primary-50); }
.radio-list { display: flex; flex-direction: column; gap: 6px; }
.radio { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; transition: all .15s; }
.radio:hover { background: #fafbfd; }
.radio:has(input:checked) { border-color: var(--primary-200); background: var(--primary-50); }

/* ---------- Embudo (kanban) ---------- */
.board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; min-height: 70vh; }
.col { flex: 0 0 272px; background: #eef1f6; border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 10px; font-size: 13.5px; }
.col-head em { font-style: normal; font-size: 12px; color: var(--muted); background: #fff; padding: 0 7px; border-radius: 99px; }
.col-head small { margin-left: auto; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--tone); }
.col-body { padding: 4px 10px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 80px; flex: 1; border-radius: 0 0 var(--radius) var(--radius); transition: background .15s; }
.col-body.drag-over { background: var(--primary-100); }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; display: flex; flex-direction: column; gap: 3px; cursor: grab; box-shadow: var(--shadow); transition: box-shadow .15s, transform .15s, border-color .15s; }
.kcard:hover { border-color: var(--primary-200); box-shadow: 0 4px 12px -4px rgba(15,23,42,.12); }
.kcard.dragging { opacity: .5; transform: rotate(1.5deg); }
.kcard-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.kcard-top strong { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kcard-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.col-empty { text-align: center; color: var(--muted-2); font-size: 12.5px; padding: 18px 0; border: 1.5px dashed #d5dbe5; border-radius: 10px; }

/* ---------- Equipo y ajustes ---------- */
.user-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.user-card { display: flex; flex-direction: column; gap: 16px; }
.user-card.inactive { opacity: .55; }
.user-top { display: flex; gap: 12px; align-items: center; }
.user-stats { display: grid; grid-template-columns: repeat(3, 1fr); background: #fafbfd; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 10px 4px; text-align: center; }
.user-stats div { display: flex; flex-direction: column; line-height: 1.3; }
.user-stats div + div { border-left: 1px solid var(--line); }
.user-stats strong { font-size: 14px; }
.user-stats small { font-size: 11.5px; }
.user-actions { display: flex; align-items: center; gap: 6px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-grid .span-2 { grid-column: span 2; }
.copy-field { display: flex; align-items: center; gap: 10px; background: #fafbfd; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 6px 6px 14px; color: var(--muted); }
.copy-field input { border: 0; background: transparent; padding: 6px 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--ink-2); box-shadow: none; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { position: relative; cursor: pointer; }
.swatch input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.swatch i, .swatch input[type=color] { display: block; width: 34px; height: 34px; border-radius: 10px; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.swatch input[type=color] { padding: 0; cursor: pointer; background: conic-gradient(#ef4444, #f59e0b, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ef4444); }
.swatch input[type=color]::-webkit-color-swatch-wrapper { padding: 0; } .swatch input[type=color]::-webkit-color-swatch { border: 0; opacity: 0; }
.swatch:has(input[type=radio]:checked) i, .swatch:has(input[type=radio]:checked) input[type=color] { box-shadow: 0 0 0 2px var(--ink); }
.option-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.option-card input { margin-top: 3px; }
.option-card span { display: flex; flex-direction: column; gap: 2px; }
.option-card:has(input:checked) { border-color: var(--primary-200); background: var(--primary-50); }

/* ---------- Modales ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(11, 26, 58, .42); backdrop-filter: blur(3px); }
.modal.open { display: flex; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal-card { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 40px); overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .2s ease; }
.modal-card.sm { max-width: 440px; }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 4px; }
.modal-body { padding: 16px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line-2); }

/* ---------- Login / instalación ---------- */
.auth-body { background: #fff; }
.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; padding: 44px 52px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at 110% -10%, color-mix(in srgb, var(--primary) 70%, transparent), transparent 60%),
              radial-gradient(700px 500px at -20% 120%, color-mix(in srgb, var(--primary) 45%, transparent), transparent 60%), var(--navy);
}
.auth-hero::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 40px 40px; mask-image: linear-gradient(180deg, #000, transparent 85%); pointer-events: none; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 16px; position: relative; z-index: 1; }
.auth-brand.light .brand-mark { background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.hero-copy { position: relative; z-index: 1; max-width: 460px; }
.hero-copy h1 { font-size: 38px; line-height: 1.12; letter-spacing: -.03em; font-weight: 700; }
.hero-copy p { margin-top: 16px; color: rgba(255,255,255,.72); font-size: 15.5px; line-height: 1.6; }
.hero-points { list-style: none; padding: 0; margin: 26px 0 0; display: flex; flex-direction: column; gap: 10px; color: rgba(255,255,255,.88); }
.hero-points li { display: flex; align-items: center; gap: 10px; }
.hero-points .ic { color: color-mix(in srgb, var(--primary) 40%, #fff); }
.hero-pipeline { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.hero-pipeline span { width: var(--w); padding: 8px 14px; border-radius: 10px; font-size: 12.5px; font-weight: 500; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(6px); }
.auth-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth-form { width: 100%; max-width: 380px; }
.auth-form h2 { font-size: 26px; letter-spacing: -.02em; }
.auth-form input { height: 46px; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 32px; width: 100%; max-width: 460px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 14px; }
.auth-card .auth-brand { color: var(--ink); margin-bottom: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid-main { grid-template-columns: 1fr; }
  .grid-main > .card:only-child { grid-column: auto; }
  .lead-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(11,26,58,.35); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 16px; }
  .content { padding: 4px 16px 40px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .span-2 { grid-column: auto; }
  .auth-split { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
}
@media (max-width: 640px) {
  h1 { font-size: 21px; }
  .topbar .btn-primary span { display: none; }
  .topbar .btn-primary { width: 38px; padding: 0; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi strong { font-size: 22px; }
  .call-actions { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .hide-sm { display: none; }
  .card { padding: 16px; }
  .lead-cta { width: 100%; }
  .lead-cta .btn { flex: 1; }
  .filters .field.inline.date { flex: 1; }
  .filters select { flex: 1; min-width: 0; }
  .bars { gap: 4px; height: 180px; }
  .bar-val { display: none; }
  .funnel-row { grid-template-columns: 100px 1fr 28px; }
}

/* Ajustes finales */
[hidden] { display: none !important; }
.content { display: flex; flex-direction: column; }
.content > .toast { order: -2; }
.content > .crumbs { order: -1; margin: 16px 0 -6px; }
