/* =========================================================================
   CRM WTP · Sistema visual
   Minimalista, alto contraste, claro/oscuro. Esmeralda = acción, Índigo = analítica.
   ========================================================================= */
:root {
  --bg: #f6f7f9;
  --bg-2: #eef0f4;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #e5e7eb;
  --border-strong: #d4d8de;
  --text: #0b1220;
  --text-2: #334155;
  --muted: #64748b;
  --emerald: #10b981;
  --emerald-600: #059669;
  --emerald-50: #ecfdf5;
  --indigo: #6366f1;
  --indigo-600: #4f46e5;
  --indigo-50: #eef2ff;
  --amber: #f59e0b;
  --amber-50: #fffbeb;
  --red: #ef4444;
  --red-50: #fef2f2;
  --sky: #0ea5e9;
  --sky-50: #f0f9ff;
  --chat-bg: #efeae2;
  --bubble-in: #ffffff;
  --bubble-out: #d9fdd3;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px -12px rgba(15, 23, 42, .12);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .28);
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 248px;
  --font: "Inter", "Segoe UI Variable", "Segoe UI", ui-sans-serif, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0a0b0e;
  --bg-2: #111318;
  --surface: #121419;
  --surface-2: #16191f;
  --border: #23272f;
  --border-strong: #2e333d;
  --text: #eef1f6;
  --text-2: #c7cdd8;
  --muted: #8b93a3;
  --emerald-50: rgba(16, 185, 129, .12);
  --indigo-50: rgba(99, 102, 241, .14);
  --amber-50: rgba(245, 158, 11, .12);
  --red-50: rgba(239, 68, 68, .12);
  --sky-50: rgba(14, 165, 233, .12);
  --chat-bg: #0d1116;
  --bubble-in: #1c2129;
  --bubble-out: #0f4c3a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 30px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background .25s ease, color .25s ease;
}
a { color: inherit; text-decoration: none; }
a.link { color: var(--emerald-600); font-weight: 500; }
a.link:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; line-height: 1.2; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 .6em; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 22px; height: 22px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.stack > * + * { margin-top: 14px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mt { margin-top: 18px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 18px; } .mb-s { margin-bottom: 8px; }
.hide { display: none !important; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- layout app */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px; border-right: 1px solid var(--border); background: var(--surface); z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; font-size: 15.5px; letter-spacing: -.02em; }
.logo {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  background: conic-gradient(from 210deg, var(--emerald), #34d399, var(--indigo), var(--emerald));
  box-shadow: 0 6px 18px -6px rgba(16, 185, 129, .7), inset 0 1px 0 rgba(255, 255, 255, .35);
  transform: perspective(200px) rotateX(8deg) rotateY(-10deg); transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}
.brand:hover .logo { transform: perspective(200px) rotateX(-8deg) rotateY(14deg) scale(1.06); }
.logo svg { width: 18px; height: 18px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 14px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: 9px; color: var(--text-2);
  font-weight: 500; position: relative; transition: background .15s, color .15s, transform .15s;
}
.nav a:hover { background: var(--bg-2); color: var(--text); }
.nav a.active { background: var(--emerald-50); color: var(--emerald-600); }
[data-theme="dark"] .nav a.active { color: #34d399; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--emerald); }
.nav .count { margin-left: auto; background: var(--emerald); color: #fff; font-size: 11px; font-weight: 700; border-radius: 20px; padding: 1px 7px; }
.sidebar-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.plan-pill { display: block; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); font-size: 12px; margin-bottom: 8px; }
.plan-pill b { display: block; font-size: 13px; }
.plan-pill.bad { background: var(--red-50); color: var(--red); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.search { position: relative; flex: 1; max-width: 420px; }
.search input, .search input[type=search] { padding-left: 36px; background: var(--surface); height: 36px; }
.search .icon { position: absolute; left: 11px; top: 9px; color: var(--muted); }
.search-results { position: absolute; top: 42px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; }
.search-results a { display: block; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.search-results a:hover { background: var(--bg-2); }
.kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; color: var(--muted); position: absolute; right: 9px; top: 9px; }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; transition: all .15s; }
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 12.5px;
  color: #fff; background: linear-gradient(135deg, var(--indigo), var(--emerald)); flex: none;
}
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.content { padding: 28px; max-width: 1360px; width: 100%; margin: 0 auto; animation: page-in .45s cubic-bezier(.2, .8, .2, 1); }
.content.full { max-width: none; padding: 0; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 6px 0 0; }
.menu-toggle { display: none; }

/* ---------------------------------------------------------------- componentes */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card.pad, .pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-body { padding: 20px; }
.card.hover { transition: transform .25s cubic-bezier(.2, .8, .2, 1), box-shadow .25s, border-color .25s; }
.card.hover:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, box-shadow .2s ease, background .2s, border-color .2s; user-select: none;
}
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.primary {
  background: linear-gradient(180deg, #19c690, var(--emerald-600)); border-color: transparent; color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 8px 20px -8px rgba(16, 185, 129, .8);
}
.btn.primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .25) inset, 0 12px 26px -8px rgba(16, 185, 129, .9); }
.btn.indigo { background: linear-gradient(180deg, #7577f5, var(--indigo-600)); border-color: transparent; color: #fff; box-shadow: 0 8px 20px -8px rgba(99, 102, 241, .8); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-50); border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.sm { height: 31px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { height: 48px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

label, .label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=tel],
input[type=search], input[type=time], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--emerald); box-shadow: 0 0 0 4px rgba(16, 185, 129, .15); }
input[type=color] { width: 48px; height: 40px; padding: 3px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
input[type=checkbox], input[type=radio] { accent-color: var(--emerald); width: 16px; height: 16px; }
.field { margin-bottom: 16px; }
.field .help, .helptext { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--red); font-size: 12.5px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label, .chip-check {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid var(--border); border-radius: 30px;
  font-weight: 500; cursor: pointer; margin: 0; transition: all .15s; background: var(--surface);
}
.checks label:has(input:checked), .chip-check:has(input:checked) { border-color: var(--emerald); background: var(--emerald-50); }
.checks ul, ul.checks { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.input-group { display: flex; gap: 8px; }
.copy-field { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--surface-2); }
.copy-field code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 30px; font-size: 12px; font-weight: 600; background: var(--bg-2); color: var(--muted); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--emerald-50); color: var(--emerald-600); }
[data-theme="dark"] .badge.ok { color: #34d399; }
.badge.warn { background: var(--amber-50); color: #b45309; }
[data-theme="dark"] .badge.warn { color: #fbbf24; }
.badge.bad { background: var(--red-50); color: var(--red); }
.badge.info { background: var(--sky-50); color: var(--sky); }
.badge.indigo { background: var(--indigo-50); color: var(--indigo); }
.badge.pulse::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 currentColor; } 50% { box-shadow: 0 0 0 4px transparent; } }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; border: 1px solid; }

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 11px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--surface-2); }
.table .person { display: flex; align-items: center; gap: 10px; }

.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13.5px; }
.alert.warn { background: var(--amber-50); border-color: rgba(245, 158, 11, .35); }
.alert.bad { background: var(--red-50); border-color: rgba(239, 68, 68, .3); }
.alert.ok { background: var(--emerald-50); border-color: rgba(16, 185, 129, .3); }
.alert.info { background: var(--indigo-50); border-color: rgba(99, 102, 241, .3); }

.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--bg-2); border: 1px solid var(--border); }
.tabs a, .tabs button { padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--muted); border: 0; background: none; cursor: pointer; font-family: inherit; }
.tabs a.active, .tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.progress { height: 10px; border-radius: 20px; background: var(--bg-2); overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.progress .p-read { background: var(--indigo); }
.progress .p-del { background: var(--emerald); }
.progress .p-sent { background: #7dd3c0; }
.progress .p-fail { background: var(--red); }
.progress.striped > span:first-child { background-image: linear-gradient(45deg, rgba(255, 255, 255, .25) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .25) 50%, rgba(255, 255, 255, .25) 75%, transparent 75%); background-size: 16px 16px; animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 16px 0; } }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* KPI ------------------------------------------------------------------ */
.kpi { position: relative; padding: 18px; overflow: hidden; transform-style: preserve-3d; }
.kpi .kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 12.5px; }
.kpi .kpi-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--emerald-50); color: var(--emerald-600); }
.kpi.indigo .kpi-ico { background: var(--indigo-50); color: var(--indigo); }
.kpi.amber .kpi-ico { background: var(--amber-50); color: var(--amber); }
.kpi.sky .kpi-ico { background: var(--sky-50); color: var(--sky); }
.kpi .kpi-value { font-size: 30px; font-weight: 750; letter-spacing: -.03em; margin-top: 12px; font-variant-numeric: tabular-nums; }
.kpi .kpi-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi .ring { position: absolute; right: 16px; top: 16px; width: 46px; height: 46px; }
.kpi::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(16, 185, 129, .12), transparent 70%); pointer-events: none; }
.kpi.indigo::after { background: radial-gradient(circle, rgba(99, 102, 241, .14), transparent 70%); }

/* Gráfico de barras ------------------------------------------------------ */
.bars { display: flex; align-items: flex-end; gap: 8px; height: 190px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bars .stack-b { width: 100%; max-width: 26px; display: flex; flex-direction: column-reverse; border-radius: 7px 7px 3px 3px; overflow: hidden; height: 0; transition: height .9s cubic-bezier(.2, .8, .2, 1); background: var(--bg-2); }
.bars .stack-b span { display: block; width: 100%; }
.bars .b-out { background: linear-gradient(180deg, #34d399, var(--emerald-600)); }
.bars .b-in { background: linear-gradient(180deg, #a5b4fc, var(--indigo)); }
.bars .lbl { font-size: 10.5px; color: var(--muted); }
.bars .bar:hover .stack-b { filter: brightness(1.08); }

/* Toasts ------------------------------------------------------------------ */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; max-width: 380px; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toast-in .45s cubic-bezier(.2, .9, .3, 1.3); font-size: 13.5px;
}
.toast .t-ico { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; background: var(--emerald); }
.toast.error .t-ico { background: var(--red); }
.toast.warning .t-ico { background: var(--amber); }
.toast.info .t-ico { background: var(--indigo); }
.toast.out { animation: toast-out .3s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96) rotateX(20deg); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

/* Skeleton ------------------------------------------------------------------ */
.skeleton { background: linear-gradient(90deg, var(--bg-2) 0%, var(--surface-2) 50%, var(--bg-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-line { height: 12px; margin: 8px 0; }

/* Modal ------------------------------------------------------------------ */
.modal-bg { position: fixed; inset: 0; background: rgba(8, 10, 14, .5); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 900; padding: 20px; animation: fade .2s ease; perspective: 1200px; }
.modal { width: 100%; max-width: 560px; max-height: 90vh; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); animation: modal-in .35s cubic-bezier(.2, .9, .3, 1.15); }
.modal .card-head { position: sticky; top: 0; background: var(--surface); z-index: 1; }
@keyframes modal-in { from { opacity: 0; transform: translateY(20px) rotateX(-12deg) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }

/* Empty state ------------------------------------------------------------- */
.empty { text-align: center; padding: 56px 20px; }
.empty .art { width: 150px; height: 120px; margin: 0 auto 18px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--muted); max-width: 420px; margin: 0 auto 16px; }

/* Ilustraciones flotantes 3D --------------------------------------------- */
.float { animation: float 6s ease-in-out infinite; }
.float.d2 { animation-delay: -2s; } .float.d3 { animation-delay: -4s; }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-8px) rotate(1.5deg); } }
[data-tilt] { transform-style: preserve-3d; transition: transform .35s cubic-bezier(.2, .8, .2, 1); will-change: transform; }
.reveal { opacity: 0; transform: translateY(24px) rotateX(10deg); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1); }
.reveal.in { opacity: 1; transform: none; }

/* Stepper (onboarding) ---------------------------------------------------- */
.stepper { display: flex; gap: 0; margin-bottom: 26px; counter-reset: st; }
.stepper .st { flex: 1; display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 600; font-size: 13px; position: relative; }
.stepper .st .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); background: var(--surface); font-size: 13px; flex: none; transition: all .3s; }
.stepper .st:not(:last-child)::after { content: ""; flex: 1; height: 2px; background: var(--border); margin: 0 12px; border-radius: 2px; }
.stepper .st.done .n { background: var(--emerald); border-color: var(--emerald); color: #fff; }
.stepper .st.done::after { background: var(--emerald); }
.stepper .st.now { color: var(--text); }
.stepper .st.now .n { border-color: var(--emerald); color: var(--emerald-600); box-shadow: 0 0 0 5px rgba(16, 185, 129, .15); }
.howto { counter-reset: h; list-style: none; padding: 0; margin: 0; }
.howto li { counter-increment: h; position: relative; padding: 0 0 14px 38px; }
.howto li::before { content: counter(h); position: absolute; left: 0; top: -1px; width: 25px; height: 25px; border-radius: 8px; display: grid; place-items: center; background: var(--indigo-50); color: var(--indigo); font-weight: 700; font-size: 12px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status-dot.ok { background: var(--emerald); box-shadow: 0 0 0 4px rgba(16, 185, 129, .18); }
.status-dot.bad { background: var(--red); box-shadow: 0 0 0 4px rgba(239, 68, 68, .18); }
.connect-art { position: relative; height: 170px; perspective: 900px; }

/* Teléfono (vista previa) ------------------------------------------------ */
.phone-wrap { perspective: 1400px; display: flex; justify-content: center; position: sticky; top: 84px; }
.phone {
  width: 300px; height: 610px; border-radius: 46px; padding: 12px; background: linear-gradient(145deg, #2a2f38, #0c0e12);
  box-shadow: inset 0 0 0 2px #3a404b, inset 0 0 0 6px #0b0d10, 0 40px 80px -30px rgba(0, 0, 0, .55), 0 18px 30px -18px rgba(0, 0, 0, .5);
  transform: rotateY(-14deg) rotateX(6deg); transform-style: preserve-3d; transition: transform .8s cubic-bezier(.2, .8, .2, 1);
  position: relative;
}
.phone:hover { transform: rotateY(-4deg) rotateX(2deg); }
.phone::before { content: ""; position: absolute; top: 20px; left: 50%; transform: translateX(-50%) translateZ(2px); width: 92px; height: 24px; background: #050608; border-radius: 20px; z-index: 3; }
.phone::after { content: ""; position: absolute; right: -4px; top: 150px; width: 4px; height: 70px; border-radius: 0 4px 4px 0; background: #1b1f26; }
.phone-screen { width: 100%; height: 100%; border-radius: 36px; overflow: hidden; background: var(--chat-bg); display: flex; flex-direction: column; position: relative; }
.phone-top { background: #075e54; color: #fff; padding: 48px 14px 12px; display: flex; align-items: center; gap: 10px; }
[data-theme="dark"] .phone-top { background: #1f2c33; }
.phone-top .avatar { width: 32px; height: 32px; background: #ffffff33; }
.phone-top b { font-size: 13.5px; display: block; }
.phone-top small { font-size: 11px; opacity: .8; }
.phone-body { flex: 1; padding: 14px 10px; overflow: auto; background-image: radial-gradient(rgba(0, 0, 0, .05) 1px, transparent 1px); background-size: 14px 14px; }
.wa-bubble { background: var(--bubble-in); border-radius: 10px; border-top-left-radius: 2px; padding: 6px 8px 4px; max-width: 92%; box-shadow: 0 1px .5px rgba(0, 0, 0, .13); font-size: 13px; color: var(--text); word-wrap: break-word; animation: bubble-in .35s cubic-bezier(.2, .9, .3, 1.3); }
.wa-bubble .wa-media { height: 130px; border-radius: 7px; margin: -2px -4px 6px; display: grid; place-items: center; background: linear-gradient(135deg, #d1fae5, #e0e7ff); color: #475569; font-size: 12px; font-weight: 600; }
.wa-bubble .wa-head { font-weight: 700; margin-bottom: 3px; }
.wa-bubble .wa-foot { color: var(--muted); font-size: 11.5px; margin-top: 4px; }
.wa-bubble .wa-time { text-align: right; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.wa-btn { margin-top: 3px; background: var(--bubble-in); border-radius: 9px; padding: 8px; text-align: center; color: #0284c7; font-size: 13px; font-weight: 500; box-shadow: 0 1px .5px rgba(0, 0, 0, .13); max-width: 92%; display: flex; gap: 6px; align-items: center; justify-content: center; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.var { background: rgba(99, 102, 241, .15); color: var(--indigo-600); border-radius: 4px; padding: 0 3px; font-weight: 600; }
[data-theme="dark"] .var { color: #a5b4fc; }

/* ---------------------------------------------------------------- bandeja */
.inbox { display: grid; grid-template-columns: 340px 1fr 320px; height: calc(100vh - 60px); background: var(--surface); }
.inbox.no-side { grid-template-columns: 340px 1fr 0; }
.inbox .col { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); }
.inbox .col:last-child { border-right: 0; }
.ib-head { padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.ib-list { flex: 1; overflow: auto; }
.conv { display: flex; gap: 11px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s; position: relative; }
.conv:hover { background: var(--surface-2); }
.conv.active { background: var(--emerald-50); }
.conv.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--emerald); }
.conv .c-top { display: flex; justify-content: space-between; gap: 8px; }
.conv .c-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .c-prev { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .c-time { font-size: 11.5px; color: var(--muted); flex: none; }
.conv .c-unread { background: var(--emerald); color: #fff; border-radius: 20px; font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 19px; height: 19px; }
.conv.unread .c-time { color: var(--emerald-600); font-weight: 600; }
.conv .c-meta { display: flex; gap: 6px; align-items: center; margin-top: 3px; }
.chat-head b { white-space: nowrap; }
.chat-head { overflow: hidden; height: 64px; padding: 0 16px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
.chat-body { flex: 1; overflow: auto; padding: 18px 6% 10px; background: var(--chat-bg); background-image: radial-gradient(rgba(0, 0, 0, .045) 1px, transparent 1px); background-size: 16px 16px; }
[data-theme="dark"] .chat-body { background-image: radial-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px); }
.day-sep { text-align: center; margin: 12px 0; }
.day-sep span { background: var(--surface); color: var(--muted); font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 8px; box-shadow: var(--shadow-sm); }
.msg { display: flex; margin: 3px 0; }
.msg.out { justify-content: flex-end; }
.bubble { max-width: min(560px, 76%); padding: 7px 10px 5px; border-radius: 12px; background: var(--bubble-in); box-shadow: 0 1px .5px rgba(0, 0, 0, .13); position: relative; white-space: pre-wrap; word-wrap: break-word; font-size: 14px; animation: bubble-in .3s cubic-bezier(.2, .9, .3, 1.2); }
.msg.in .bubble { border-top-left-radius: 3px; }
.msg.out .bubble { background: var(--bubble-out); border-top-right-radius: 3px; }
.bubble .meta { display: flex; gap: 5px; align-items: center; justify-content: flex-end; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.bubble .tick { width: 15px; height: 15px; }
.bubble .tick.read { color: #3b82f6; }
.bubble .tick.fail { color: var(--red); }
.bubble img, .bubble video { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; margin-bottom: 4px; }
.bubble audio { max-width: 260px; }
.bubble .doc { display: flex; gap: 8px; align-items: center; padding: 8px; border-radius: 8px; background: rgba(0, 0, 0, .05); font-weight: 500; }
.bubble .tpl-tag, .bubble .by { font-size: 10.5px; font-weight: 700; color: var(--indigo); margin-bottom: 2px; display: block; }
.bubble .by { color: var(--emerald-600); }
.bubble .err { color: var(--red); font-size: 12px; margin-top: 4px; white-space: normal; }
.composer { border-top: 1px solid var(--border); padding: 10px 12px; background: var(--surface); position: relative; }
.composer .box { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { min-height: 42px; max-height: 160px; height: 42px; resize: none; border-radius: 12px; padding: 10px 12px; }
.composer .send { width: 42px; height: 42px; border-radius: 50%; padding: 0; }
.window-bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; font-size: 12.5px; border-radius: 10px; margin-bottom: 8px; background: var(--emerald-50); }
.window-bar.closed { background: var(--amber-50); }
.window-bar .timer { font-family: var(--mono); font-weight: 700; }
.quick-pop { position: absolute; bottom: 100%; left: 12px; right: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 240px; overflow: auto; }
.quick-pop div { padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.quick-pop div:hover, .quick-pop div.sel { background: var(--emerald-50); }
.side { overflow: auto; padding: 20px 18px; }
.side .sec { padding: 16px 0; border-bottom: 1px solid var(--border); }
.side .sec:last-child { border: 0; }
.side h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 10px; }
.timer-ring { width: 74px; height: 74px; }
.chat-empty { flex: 1; display: grid; place-items: center; background: var(--surface-2); text-align: center; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.filters button { border: 1px solid var(--border); background: var(--surface); padding: 4px 10px; border-radius: 20px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.filters button.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.filters button .n { opacity: .7; margin-left: 3px; }

/* ---------------------------------------------------------------- auth / público */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-side { position: relative; overflow: hidden; background: #07120e; color: #e6fff5; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; perspective: 1200px; }
.auth-side h2 { font-size: 30px; line-height: 1.15; max-width: 440px; }
.auth-side p { color: #a7d9c6; max-width: 420px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { margin-bottom: 6px; }
.orb { position: absolute; border-radius: 50%; filter: blur(50px); opacity: .65; animation: orb 14s ease-in-out infinite; pointer-events: none; }
.orb.a { width: 380px; height: 380px; background: #10b981; top: -120px; right: -80px; }
.orb.b { width: 320px; height: 320px; background: #6366f1; bottom: -100px; left: -60px; animation-delay: -5s; }
.orb.c { width: 220px; height: 220px; background: #22d3ee; top: 40%; left: 40%; opacity: .3; animation-delay: -9s; }
@keyframes orb { 0%, 100% { transform: translate(0, 0) scale(1); } 33% { transform: translate(40px, 30px) scale(1.1); } 66% { transform: translate(-30px, 20px) scale(.95); } }
.grid-floor { position: absolute; inset: auto -20% -30% -20%; height: 60%; background-image: linear-gradient(rgba(16, 185, 129, .25) 1px, transparent 1px), linear-gradient(90deg, rgba(16, 185, 129, .25) 1px, transparent 1px); background-size: 46px 46px; transform: rotateX(70deg); transform-origin: top; mask-image: linear-gradient(to bottom, #000, transparent 85%); animation: floor 6s linear infinite; }
@keyframes floor { to { background-position: 0 46px; } }

.pub-nav { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 22px; padding: 8px 8px 8px 16px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(14px) saturate(160%); border: 1px solid var(--border); box-shadow: var(--shadow); width: min(1080px, calc(100% - 28px)); }
.pub-nav .links { display: flex; gap: 20px; margin-left: 12px; font-weight: 500; color: var(--text-2); }
.pub-nav .links a:hover { color: var(--text); }
.hero { position: relative; overflow: hidden; padding: 150px 24px 90px; background: radial-gradient(1200px 600px at 70% 0%, rgba(16, 185, 129, .14), transparent 60%), radial-gradient(900px 500px at 10% 20%, rgba(99, 102, 241, .12), transparent 60%); }
.hero-inner { max-width: 1140px; margin: 0 auto; display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(36px, 5vw, 60px); line-height: 1.02; letter-spacing: -.045em; font-weight: 800; }
.hero h1 .grad { background: linear-gradient(90deg, var(--emerald), #34d399 40%, var(--indigo)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: 18px; color: var(--text-2); margin: 20px 0 28px; max-width: 540px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 6px; border-radius: 30px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 600; margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.eyebrow b { background: var(--emerald); color: #fff; padding: 1px 8px; border-radius: 20px; font-size: 11px; }
.stage { position: relative; height: 560px; perspective: 1600px; display: grid; place-items: center; }
.stage .phone { transform: rotateY(-18deg) rotateX(8deg) rotateZ(1deg); }
.fcard { position: absolute; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow-lg); font-size: 12.5px; display: flex; gap: 10px; align-items: center; transform-style: preserve-3d; }
.fcard .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.fcard b { display: block; font-size: 15px; }
.f1 { top: 70px; left: -10px; transform: translateZ(80px); }
.f2 { bottom: 90px; right: -20px; transform: translateZ(120px); }
.f3 { top: 46%; right: -30px; transform: translateZ(60px); }
.section { max-width: 1140px; margin: 0 auto; padding: 90px 24px; }
.section-title { text-align: center; max-width: 680px; margin: 0 auto 46px; }
.section-title h2 { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -.035em; }
.section-title p { color: var(--muted); font-size: 16px; margin-top: 10px; }
.feature { padding: 24px; perspective: 800px; }
.feature .f-ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; margin-bottom: 14px; color: #fff; box-shadow: 0 10px 22px -10px currentColor; transform: translateZ(30px); }
.feature h3 { margin-bottom: 6px; font-size: 16px; }
.feature p { color: var(--muted); margin: 0; }
.price { padding: 28px; display: flex; flex-direction: column; position: relative; }
.price.featured { border: 2px solid var(--emerald); box-shadow: 0 30px 60px -30px rgba(16, 185, 129, .6); }
.price .ribbon { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--emerald); color: #fff; font-size: 11.5px; font-weight: 700; padding: 3px 12px; border-radius: 20px; }
.price .amount { font-size: 42px; font-weight: 800; letter-spacing: -.04em; margin: 12px 0 2px; }
.price .amount small { font-size: 14px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.price ul { list-style: none; padding: 0; margin: 18px 0 24px; flex: 1; }
.price li { display: flex; gap: 9px; align-items: flex-start; padding: 6px 0; color: var(--text-2); }
.price li .icon { color: var(--emerald); margin-top: 2px; }
.faq details { border-bottom: 1px solid var(--border); padding: 16px 4px; }
.faq summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; }
.faq summary::after { content: "+"; font-size: 20px; color: var(--muted); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--muted); margin-top: 10px; }
.footer { border-top: 1px solid var(--border); padding: 30px 24px; color: var(--muted); font-size: 13px; }
.footer .in { max-width: 1140px; margin: 0 auto; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.logos-strip { display: flex; justify-content: center; gap: 36px; flex-wrap: wrap; color: var(--muted); font-weight: 600; font-size: 14px; margin-top: 36px; opacity: .85; }
.logos-strip span { display: inline-flex; gap: 8px; align-items: center; }
.cta-band { position: relative; overflow: hidden; border-radius: 24px; padding: 56px 40px; text-align: center; color: #fff; background: radial-gradient(600px 300px at 20% 0%, rgba(255, 255, 255, .18), transparent), linear-gradient(120deg, #059669, #10b981 40%, #6366f1); box-shadow: 0 40px 80px -40px rgba(16, 185, 129, .8); }
.cta-band h2 { font-size: 34px; }
.cta-band .btn { background: #fff; color: #064e3b; border: 0; }
.prose { max-width: 780px; margin: 0 auto; padding: 120px 24px 60px; }
.prose h1 { margin-bottom: 10px; }
.prose h2 { margin: 28px 0 10px; }
.prose p, .prose li { color: var(--text-2); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1200px) {
  .inbox { grid-template-columns: 300px 1fr; }
  .inbox .side-col { display: none; }
  .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .hero-inner, .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .stage { height: 520px; }
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: 1fr 1fr; }
  .pub-nav .links { display: none; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  .menu-toggle { display: grid; }
  .content { padding: 18px; }
  .topbar { padding: 0 14px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .inbox { grid-template-columns: 1fr; }
  .inbox .list-col.hidden-m, .inbox .chat-col.hidden-m { display: none; }
  .phone-wrap { position: static; }
}
@media (max-width: 560px) {
  .g4, .g5 { grid-template-columns: 1fr 1fr; }
  .kpi .kpi-value { font-size: 24px; }
  .stepper .st span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
