/* ===========================================================
   Leads Maps · WhatsApp — Visual System
   Inspired by modern marketing-agency / SaaS dashboards
   =========================================================== */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap");

:root {
  /* Surface */
  --bg-0: #07090d;
  --bg-1: #0c1117;
  --bg-2: #11171f;
  --bg-3: #1a212c;
  --bg-elev: #161d27;
  --border: #1f2935;
  --border-strong: #2c3947;
  --border-glow: rgba(82, 234, 162, 0.18);

  /* Text */
  --text: #e9edf3;
  --text-muted: #8893a5;
  --text-dim: #5f6a7c;

  /* Brand & accents */
  --brand-1: #6366f1;        /* indigo */
  --brand-2: #a855f7;        /* purple */
  --brand-3: #ec4899;        /* pink */
  --whats: #25d366;
  --whats-hi: #1ebb56;
  --accent: #52eaa2;
  --warn: #facc15;
  --danger: #ef4444;
  --info: #38bdf8;

  /* Gradients */
  --grad-brand: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --grad-wa: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  --grad-card: linear-gradient(160deg, rgba(99, 102, 241, 0.04) 0%, rgba(168, 85, 247, 0.02) 60%, transparent 100%);

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55), 0 4px 10px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 0 1px rgba(82, 234, 162, 0.2), 0 8px 32px rgba(82, 234, 162, 0.12);

  /* Radii & motion */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);

  --container: 1280px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(99, 102, 241, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(236, 72, 153, 0.08), transparent 55%),
    var(--bg-0);
  color: var(--text);
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--text); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: #fff; }

code, pre, .mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.86em; }

/* ============== TOP BAR ============== */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.8rem 2rem;
  background: rgba(11, 16, 23, 0.78);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}

.brand .logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--grad-brand);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 1rem;
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.35);
}

.brand small {
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.66rem;
  display: block;
  line-height: 1;
  margin-top: 2px;
}

.nav-links {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.nav-links a {
  padding: 0.45rem 0.85rem;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  transition: all .15s var(--ease);
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-links a.active {
  color: #fff;
  background: rgba(99, 102, 241, 0.18);
}

.topbar .agency-chip {
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-1);
}

/* ============== LAYOUT ============== */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 2rem;
}

.hero {
  margin: 0.5rem 0 2.2rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: rgba(82, 234, 162, 0.08);
  border: 1px solid rgba(82, 234, 162, 0.2);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

.eyebrow .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

h1, h2, h3, h4 {
  margin: 0;
  letter-spacing: -0.02em;
  font-weight: 700;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.4rem);
  line-height: 1.1;
  margin-top: 0.7rem;
}

h1 .grad {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h2 { font-size: 1.15rem; margin: 2.2rem 0 0.9rem; }
h3 { font-size: 1rem; }

.hero-sub {
  max-width: 680px;
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 0.7rem;
}

/* ============== KPIs ============== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

@media (max-width: 800px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.kpi {
  position: relative;
  background: var(--bg-elev);
  background-image: var(--grad-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.2rem;
  overflow: hidden;
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}

.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); }

.kpi::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--r-lg);
  padding: 1px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), transparent 50%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

.kpi .k-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.kpi .k-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 0.4rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.kpi .k-value small {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi .k-icon {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  opacity: 0.92;
}
.kpi .k-icon.brand { background: var(--grad-brand); }
.kpi .k-icon.wa { background: var(--grad-wa); }
.kpi .k-icon.warn { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.kpi .k-icon.info { background: linear-gradient(135deg, #38bdf8, #6366f1); }

/* ============== CARDS / PANELS ============== */

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.card.flush { padding: 0; }
.card .pad { padding: 1.4rem 1.5rem; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2rem 0 0.9rem;
}

.section-head h2 { margin: 0; }

.muted { color: var(--text-muted); }

/* ============== CAMPAIGN GRID ============== */

.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1rem;
}

.campaign {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.3rem 1.4rem 1.1rem;
  transition: all .2s var(--ease);
  overflow: hidden;
}

.campaign::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
}

.campaign.c-tembiu::before { background: linear-gradient(90deg, #f97316, #ef4444); }
.campaign.c-marcarapp::before { background: linear-gradient(90deg, #6366f1, #38bdf8); }
.campaign.c-evoluado::before { background: linear-gradient(90deg, #a855f7, #ec4899); }

.campaign:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }

.campaign .c-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}

.campaign .c-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 1.1rem;
  color: #fff;
  font-weight: 700;
}
.campaign.c-tembiu .c-icon { background: linear-gradient(135deg, #f97316, #ef4444); }
.campaign.c-marcarapp .c-icon { background: linear-gradient(135deg, #6366f1, #38bdf8); }
.campaign.c-evoluado .c-icon { background: linear-gradient(135deg, #a855f7, #ec4899); }

.campaign h3 { margin: 0; font-size: 0.98rem; }

.campaign p { margin: 0.4rem 0 0.9rem; color: var(--text-muted); font-size: 0.88rem; line-height: 1.5; }

.campaign .c-stats {
  display: flex;
  gap: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
  margin-top: 0.6rem;
}

.campaign .c-stat { flex: 1; }
.campaign .c-stat .v { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; }
.campaign .c-stat .l { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }

.campaign .c-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--info);
}
.campaign .c-link:hover { color: #fff; }
.campaign .c-link::after { content: "→"; transition: transform .15s var(--ease); }
.campaign .c-link:hover::after { transform: translateX(3px); }

/* ============== FORMS ============== */

form .form-row {
  display: grid;
  grid-template-columns: 1.2fr 2fr 1fr auto;
  gap: 0.9rem;
  align-items: end;
}

@media (max-width: 800px) {
  form .form-row { grid-template-columns: 1fr; }
}

label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}

input[type="text"],
input[type="number"],
input[type="search"],
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.94rem;
  transition: all .15s var(--ease);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

input::placeholder { color: var(--text-dim); }

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-1);
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
}
.checkbox input { accent-color: var(--whats); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.2rem;
  border: 0;
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(168, 85, 247, 0.4); color: #fff; }

.btn-wa {
  background: var(--grad-wa);
  color: #002a14;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.3);
}
.btn-wa:hover { color: #002a14; transform: translateY(-1px); box-shadow: 0 10px 24px rgba(37, 211, 102, 0.4); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.82rem; }
.btn-lg { padding: 0.85rem 1.5rem; font-size: 1rem; }

/* ============== TABLE ============== */

.table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 0.85rem 1rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.9rem;
}

tbody tr:last-child td { border-bottom: 0; }

tbody tr { transition: background .12s var(--ease); }
tbody tr:hover { background: rgba(99, 102, 241, 0.045); }

tbody tr.contacted td { opacity: 0.75; }
tbody tr.contacted td .lead-name { color: var(--text-muted); }

.btn-wa.dim {
  background: transparent;
  border: 1px solid rgba(37, 211, 102, 0.35);
  color: rgba(82, 234, 162, 0.9);
  box-shadow: none;
}
.btn-wa.dim:hover {
  background: rgba(37, 211, 102, 0.12);
  color: var(--accent);
  transform: none;
  box-shadow: none;
}

td .lead-name {
  font-weight: 600;
  color: var(--text);
}

td .lead-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
td .lead-link:hover {
  color: var(--info);
  text-decoration: underline;
  text-underline-offset: 3px;
}
td .lead-link:hover svg { opacity: 1 !important; }

td .lead-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ============== BADGES & PILLS ============== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge.web-yes { background: rgba(56, 189, 248, 0.12); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.2); }
.badge.web-no { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.22); }
.badge.contacted { background: rgba(82, 234, 162, 0.12); color: var(--accent); border: 1px solid rgba(82, 234, 162, 0.25); }

.camp-badge {
  display: inline-block;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: filter .15s var(--ease), transform .15s var(--ease);
}
.camp-badge:hover { filter: brightness(1.15); transform: translateY(-1px); text-decoration: none; }

.camp-badge.c-tembiu     { background: rgba(249, 115, 22, 0.14); color: #fdba74; border-color: rgba(249, 115, 22, 0.32); }
.camp-badge.c-marcarapp  { background: rgba(99, 102, 241, 0.14); color: #a5b4fc; border-color: rgba(99, 102, 241, 0.32); }
.camp-badge.c-evoluado   { background: rgba(168, 85, 247, 0.14); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.32); }

.rating {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 600;
  color: var(--warn);
}

.rating::before { content: "★"; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

.status.pending  { background: rgba(148, 163, 184, 0.12); color: #cbd5e1; }
.status.running  { background: rgba(250, 204, 21, 0.12); color: #fde68a; }
.status.completed { background: rgba(82, 234, 162, 0.12); color: var(--accent); }
.status.failed   { background: rgba(239, 68, 68, 0.14); color: #fca5a5; }

/* ============== FILTERS ============== */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.filter-bar > label,
.filter-bar > .field { flex: 1 1 160px; min-width: 140px; }

/* ============== PREVIEW ============== */

.split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 1.2rem;
}

@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

.msg {
  background: linear-gradient(180deg, #1a3a2d 0%, #11251c 100%);
  border: 1px solid rgba(82, 234, 162, 0.2);
  padding: 1.3rem 1.4rem;
  border-radius: var(--r-md);
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #d9f5e6;
  position: relative;
  margin: 0;
}

.msg::before {
  content: "";
  position: absolute;
  bottom: -8px;
  left: 24px;
  width: 16px; height: 16px;
  background: #11251c;
  border-right: 1px solid rgba(82, 234, 162, 0.2);
  border-bottom: 1px solid rgba(82, 234, 162, 0.2);
  transform: rotate(45deg);
}

.field-row { display: flex; justify-content: space-between; padding: 0.55rem 0; border-bottom: 1px dashed var(--border); }
.field-row:last-child { border-bottom: 0; }
.field-row .l { color: var(--text-muted); font-size: 0.84rem; }
.field-row .v { font-weight: 500; }

/* ============== JOB DETAIL ============== */

.kvs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.kvs .kv { padding: 0.7rem 0.9rem; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--r-sm); }
.kvs .kv .l { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.kvs .kv .v { font-size: 1rem; font-weight: 600; margin-top: 0.2rem; }

/* ============== UTILITIES ============== */

.row { display: flex; gap: 0.55rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.spacer { flex: 1; }

.center { text-align: center; }
.hide-mobile { }
@media (max-width: 700px) { .hide-mobile { display: none; } }

footer.legal {
  margin-top: 3rem;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.78rem;
}
