:root {
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe5f1;
  --bg: #f5f8fc;
  --teal: #00c2a8;
  --blue: #246bfe;
  --red: #ef4444;
  --amber: #f59e0b;
  --green: #10b981;
  --shadow: 0 18px 48px rgba(17, 24, 39, 0.1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 0%, rgba(0, 194, 168, 0.18), transparent 30%),
    radial-gradient(circle at 90% 10%, rgba(36, 107, 254, 0.16), transparent 28%),
    #f8fafc;
}
.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid rgba(36, 107, 254, 0.16);
  border-radius: 12px;
  background: white;
  padding: 28px;
  box-shadow: var(--shadow);
}
.login-card h1, .login-card p { margin: 0; }
.login-card p { color: var(--muted); line-height: 1.5; }
.login-card label, .field { display: grid; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 900; }
.login-card input, input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 11px 12px;
  color: var(--ink);
  outline: none;
}
textarea { min-height: 110px; resize: vertical; }
.form-error { color: var(--red); font-size: 13px; font-weight: 800; min-height: 18px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  overflow-y: auto;
  background: #08111f;
  color: white;
  padding: 20px;
}
.brand { display: flex; gap: 11px; align-items: center; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: white;
  font-weight: 950;
  box-shadow: 0 10px 24px rgba(36, 107, 254, 0.28);
}
.brand span, .sidebar-card small { display: block; color: #91a4bd; font-size: 12px; margin-top: 2px; }
.nav { display: grid; gap: 7px; align-content: start; }
.nav a {
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 12px;
  color: #cbd5e1;
  font-weight: 850;
  transition: 0.18s ease;
}
.nav a:hover, .nav a.active {
  color: white;
  border-color: rgba(0, 194, 168, 0.22);
  background: rgba(36, 107, 254, 0.16);
  transform: translateX(2px);
}
.sidebar-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  padding: 14px;
}
.sidebar-card span, .eyebrow {
  color: var(--teal);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.workspace { min-width: 0; padding: 24px; }
.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.topbar h1 { margin: 4px 0; font-size: 30px; }
.topbar p { margin: 0; color: var(--muted); }
.actions, .form-actions, .segmented { display: flex; flex-wrap: wrap; gap: 9px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 9px 13px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}
.button.primary { background: var(--ink); border-color: var(--ink); color: white; }
.button.blue { background: var(--blue); border-color: var(--blue); color: white; }
.button.danger { color: var(--red); }
.button:disabled { opacity: .55; cursor: not-allowed; }

.page-content { display: grid; gap: 16px; }
.module {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  padding: 16px;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.05);
}
.module-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.module-heading h2, .module-heading p { margin: 0; }
.module-heading p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.metric-card, .card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 14px;
}
.metric-card span, .card small { display: block; color: var(--muted); font-size: 12px; font-weight: 850; }
.metric-card strong { display: block; margin-top: 8px; font-size: 26px; }
.card h3 { margin: 0 0 8px; }
.card p { margin: 0; color: var(--muted); line-height: 1.5; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: #eef2ff;
  color: #1e3a8a;
  font-size: 11px;
  font-weight: 950;
}
.badge.alta, .badge.ganho { background: rgba(16, 185, 129, .12); color: #047857; }
.badge.media, .badge.contato, .badge.proposta { background: rgba(245, 158, 11, .13); color: #92400e; }
.badge.baixa, .badge.perdido, .badge.nao_contatar { background: rgba(239, 68, 68, .12); color: #991b1b; }

.lead-list, .activity-list, .campaign-list { display: grid; gap: 10px; }
.lead-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 130px auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}
.lead-row h3, .lead-row p { margin: 0; }
.lead-row p, .muted { color: var(--muted); font-size: 13px; line-height: 1.45; }
.score {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(0, 194, 168, .13), rgba(36, 107, 254, .13));
  color: var(--ink);
  font-size: 20px;
  font-weight: 950;
}
.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(190px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.kanban-col {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}
.kanban-col h3 { margin: 0 0 10px; font-size: 14px; }
.kanban-card {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 10px;
  margin-bottom: 8px;
}
.kanban-card strong { font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }
.result-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  color: var(--muted);
  white-space: pre-wrap;
}
.approval-item, .activity-item, .campaign-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  padding: 12px;
}
.approval-item pre {
  white-space: pre-wrap;
  color: var(--ink);
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px;
}
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  background: var(--ink);
  color: white;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

@media (max-width: 1040px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; grid-template-rows: auto; }
  .nav { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-4, .grid-3, .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .workspace { padding: 14px; }
  .topbar, .module-heading { display: grid; }
  .nav, .grid-4, .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
}
