/* Sapien9 Outreach — CRM dark. Paleta: negro grafito + cian ciber + acentos de estado. */
:root {
  --bg: #0a0e14;
  --bg-2: #0f141c;
  --panel: #131a24;
  --panel-2: #1a2230;
  --border: #232d3d;
  --border-soft: #1c2431;
  --text: #e6edf3;
  --text-dim: #8b98a9;
  --text-faint: #5b6472;
  --accent: #22d3ee;       /* cian ciberseguridad */
  --accent-2: #0891b2;
  --accent-glow: rgba(34, 211, 238, .15);
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --purple: #a78bfa;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,.35);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Tema claro: overrides de las variables. Se activa con <html data-theme="light">. */
html[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --border: #d7dde8;
  --border-soft: #e6eaf1;
  --text: #16202e;
  --text-dim: #52607a;
  --text-faint: #8a94a6;
  --accent: #0891b2;
  --accent-2: #0e7490;
  --accent-glow: rgba(8, 145, 178, .12);
  --green: #0f9d63;
  --amber: #b7791f;
  --red: #dc2626;
  --purple: #7c3aed;
  --shadow: 0 2px 14px rgba(20, 30, 50, .08);
}

[x-cloak] { display: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- layout ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; background: var(--bg-2);
  border-right: 1px solid var(--border); padding: 20px 12px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-weight: 800; color: #04222b; font-size: 18px;
  box-shadow: 0 0 16px var(--accent-glow);
}
.brand-name { font-weight: 700; letter-spacing: .3px; }
.brand-name small { display: block; font-size: 10px; color: var(--text-faint); font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px;
  color: var(--text-dim); font-weight: 500; transition: all .12s;
}
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-glow); color: var(--accent); }
.nav .nav-ico { width: 18px; text-align: center; opacity: .9; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--text-faint); }
.sidebar-foot .u-name { color: var(--text-dim); font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 28px; border-bottom: 1px solid var(--border); background: var(--bg-2);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 650; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.tb-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--bg); }
.tb-toggle button, .tb-toggle a { background: transparent; border: none; color: var(--text-dim); padding: 6px 11px; font-size: 12px; font-weight: 600; cursor: pointer; font-family: var(--font); text-decoration: none; }
.tb-toggle button.on, .tb-toggle a.on { background: var(--accent-glow); color: var(--accent); }
.tb-icon-btn { background: var(--bg); border: 1px solid var(--border); color: var(--text-dim); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; font-size: 15px; }
.tb-icon-btn:hover { color: var(--text); border-color: var(--accent); }
.content { padding: 24px 28px; max-width: 1240px; width: 100%; }

/* ---- cards / KPIs ---- */
.grid { display: grid; gap: 16px; }
.kpi-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow);
}
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi .k-val { font-size: 30px; font-weight: 750; letter-spacing: -.5px; }
.kpi .k-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .6px; }
.kpi .k-accent { color: var(--accent); }
.kpi .k-green { color: var(--green); }
.kpi .k-amber { color: var(--amber); }

.section-title { font-size: 15px; font-weight: 650; margin: 28px 0 12px; color: var(--text); }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }

/* ---- funnel ---- */
.funnel { display: flex; flex-direction: column; gap: 8px; }
.funnel-row { display: flex; align-items: center; gap: 12px; }
.funnel-label { width: 120px; font-size: 13px; color: var(--text-dim); }
.funnel-bar-wrap { flex: 1; background: var(--panel-2); border-radius: 6px; overflow: hidden; height: 26px; }
.funnel-bar { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); display: flex; align-items: center; padding: 0 10px; color: #04222b; font-weight: 700; font-size: 12px; min-width: 28px; }
.funnel-count { width: 46px; text-align: right; font-weight: 600; }

/* ---- tables ---- */
table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th, table.tbl td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-soft); }
table.tbl th { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--text-faint); font-weight: 600; }
table.tbl tr:hover td { background: var(--panel-2); }
table.tbl td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---- badges ---- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; border: 1px solid transparent; }
.b-new { background: #1e293b; color: var(--text-dim); }
.b-in_sequence, .b-queued { background: rgba(34,211,238,.12); color: var(--accent); }
.b-opened { background: rgba(167,139,250,.14); color: var(--purple); }
.b-clicked { background: rgba(96,165,250,.14); color: #60a5fa; }
.b-replied { background: rgba(52,211,153,.12); color: var(--green); }
.b-interested, .b-meeting { background: rgba(52,211,153,.2); color: var(--green); border-color: rgba(52,211,153,.35); }
.b-not_interested { background: #2a1c1c; color: var(--text-dim); }
.b-bounced, .b-stopped { background: rgba(248,113,113,.12); color: var(--red); }
.b-completed { background: #1e293b; color: var(--text-faint); }
.b-valid { background: rgba(52,211,153,.15); color: var(--green); }
.b-catch_all { background: rgba(251,191,36,.14); color: var(--amber); }
.b-invalid, .b-none { background: rgba(248,113,113,.12); color: var(--red); }
.b-unknown { background: #1e293b; color: var(--text-dim); }
.b-admin { background: rgba(167,139,250,.16); color: var(--purple); }
.b-account_executive { background: rgba(34,211,238,.12); color: var(--accent); }
.b-active { background: rgba(52,211,153,.15); color: var(--green); }
.b-paused { background: rgba(251,191,36,.14); color: var(--amber); }
.b-error { background: rgba(248,113,113,.15); color: var(--red); }
.b-draft { background: #1e293b; color: var(--text-dim); }

/* ---- forms & buttons ---- */
label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; font-weight: 500; }
input, select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; font-family: var(--font);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea { resize: vertical; min-height: 90px; }
.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 16px; font-size: 13px;
  font-weight: 600; cursor: pointer; transition: all .12s; font-family: var(--font);
}
.btn:hover { background: var(--border); text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #04222b; border-color: transparent; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { background: rgba(248,113,113,.12); color: var(--red); border-color: rgba(248,113,113,.3); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- toolbar / filters ---- */
.toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* ---- login ---- */
.login-wrap { display: grid; place-items: center; min-height: 100vh; background: radial-gradient(circle at 50% 30%, #0f1a24, var(--bg)); }
.login-card { width: 360px; }
.login-card .brand { justify-content: center; padding-bottom: 24px; }

/* ---- flash / alerts ---- */
.flash { background: rgba(34,211,238,.1); border: 1px solid rgba(34,211,238,.3); color: var(--accent); padding: 11px 16px; border-radius: 8px; margin-bottom: 18px; }
.alert-err { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.3); color: var(--red); padding: 11px 16px; border-radius: 8px; margin-bottom: 14px; }
.alert-warn { background: rgba(251,191,36,.1); border: 1px solid rgba(251,191,36,.3); color: var(--amber); padding: 11px 16px; border-radius: 8px; margin-bottom: 14px; }

/* ---- modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(4,8,12,.7); display: grid; place-items: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 24px; width: 520px; max-width: 92vw; max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow); }
.modal h3 { margin-top: 0; }

/* ---- misc ---- */
.hr { border: none; border-top: 1px solid var(--border-soft); margin: 20px 0; }
.pill-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.pill-toggle a { padding: 6px 14px; color: var(--text-dim); font-size: 13px; }
.pill-toggle a.on { background: var(--accent-glow); color: var(--accent); }
.cap-bar-wrap { background: var(--panel-2); border-radius: 5px; height: 8px; overflow: hidden; width: 100%; }
.cap-bar { height: 100%; background: var(--accent); }
code.inline { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; color: var(--accent); }
.step-card { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 14px; background: var(--panel-2); }
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.step-num { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-glow); color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.empty { text-align: center; padding: 48px; color: var(--text-faint); }
