:root {
  --bg: #0c0e12;
  --bg-elev: #141821;
  --bg-soft: #1a2030;
  --border: #2a3344;
  --text: #e8edf5;
  --muted: #8b97ab;
  --accent: #3d8bfd;
  --accent-2: #22c55e;
  --danger: #f87171;
  --warn: #fbbf24;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2740 0%, transparent 55%),
              radial-gradient(900px 500px at 100% 0%, #122018 0%, transparent 45%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: rgba(12, 14, 18, 0.92);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 2rem; padding: 0 0.25rem; }
.brand img { width: 42px; height: 42px; object-fit: contain; border-radius: 8px; }
.brand span { font-weight: 700; letter-spacing: 0.02em; font-size: 1.05rem; }
.nav a {
  display: block;
  color: var(--muted);
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  margin-bottom: 0.25rem;
  text-decoration: none;
}
.nav a:hover, .nav a.active {
  background: var(--bg-soft);
  color: var(--text);
  text-decoration: none;
}

.main { flex: 1; padding: 1.5rem 2rem 3rem; max-width: 1200px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.topbar h1 { margin: 0; font-size: 1.45rem; font-weight: 650; }
.muted { color: var(--muted); }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .grid-4, .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .main { padding: 1rem; }
}

.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value { font-size: 1.75rem; font-weight: 700; margin-top: 0.35rem; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.35rem; }
input, select, textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.9rem;
  font: inherit;
}
textarea { min-height: 140px; resize: vertical; }
.btn {
  display: inline-block;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.btn:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: #7f1d1d; }
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.7rem 0.5rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { color: var(--muted); font-weight: 600; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--bg-soft);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-new { color: #93c5fd; }
.badge-qualified { color: #86efac; }
.badge-emailed { color: #fde68a; }
.badge-replied { color: #c4b5fd; }
.badge-won { color: #4ade80; }
.badge-skip, .badge-lost { color: #fca5a5; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}
.alert-success { background: rgba(34,197,94,0.12); color: #86efac; }
.alert-error { background: rgba(248,113,113,0.12); color: #fca5a5; }

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.auth-card {
  width: min(400px, 100%);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem;
}
.auth-card .logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.auth-card .logo img { width: 72px; height: 72px; object-fit: contain; }
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.checkbox-row { display: flex; gap: 0.5rem; align-items: flex-start; margin-bottom: 0.6rem; }
.checkbox-row input { width: auto; margin: 0.2rem 0 0; }
.form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.5rem; }
.code { font-family: ui-monospace, monospace; font-size: 0.85rem; color: var(--muted); }
