:root {
  --bg: #0a0e14;
  --bg-elevated: #121820;
  --bg-input: #0f141c;
  --border: #1e2a3a;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --accent: #00d4aa;
  --accent-dim: #00a884;
  --danger: #ff6b6b;
  --warning: #ffc857;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "Cascadia Code", monospace;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  --focus: 0 0 0 3px rgba(0, 212, 170, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 170, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(0, 120, 200, 0.08), transparent);
  pointer-events: none;
  z-index: -1;
}

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

.container {
  width: min(920px, 94vw);
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.22em;
  font-size: 0.85rem;
  color: var(--accent);
  text-transform: uppercase;
}

h1 {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 600;
  margin: 0.5rem 0 1rem;
  letter-spacing: -0.02em;
}

.lead { color: var(--text-muted); max-width: 62ch; }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.progress-wrap { margin: 1.5rem 0; }
.progress-label { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.35s ease;
}

.wizard-step { display: none; }
.wizard-step.active { display: block; }

fieldset {
  border: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

legend {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 1rem;
  padding: 0;
}

label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  margin-bottom: 1rem;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

textarea { min-height: 100px; resize: vertical; }

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.check-grid label.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  margin: 0;
  font-size: 0.875rem;
}

.check-grid label.check:has(input:checked) {
  border-color: var(--accent);
  background: rgba(0, 212, 170, 0.08);
}

.check-grid input { width: auto; margin: 0; }

.hp { position: absolute; left: -9999px; opacity: 0; pointer-events: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
  justify-content: space-between;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #041510;
}
.btn-primary:hover { background: var(--accent-dim); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: var(--text-muted); }

.autosave-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 1rem;
}

.privacy-box {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.privacy-box label { display: flex; gap: 0.5rem; align-items: flex-start; color: var(--text); }

.err { color: var(--danger); font-size: 0.8125rem; margin-top: -0.75rem; margin-bottom: 0.75rem; }

.security-note {
  font-size: 0.8125rem;
  color: var(--warning);
  margin: 1rem 0;
}

/* Admin */
.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
}

.admin-nav {
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
}

.admin-nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  border-radius: 6px;
  margin-bottom: 0.25rem;
}
.admin-nav a:hover { background: var(--bg-input); color: var(--text); text-decoration: none; }

.admin-main { padding: 1.5rem 2rem; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat-card strong { font-size: 1.75rem; display: block; color: var(--accent); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th, td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
}
th { color: var(--text-muted); font-weight: 500; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-new { background: rgba(0, 212, 170, 0.2); color: var(--accent); }
.status-contacted { background: rgba(100, 180, 255, 0.2); color: #64b4ff; }
.status-qualified { background: rgba(255, 200, 87, 0.2); color: var(--warning); }
.status-proposal { background: rgba(180, 130, 255, 0.2); color: #b482ff; }
.status-won { background: rgba(0, 212, 170, 0.35); color: #fff; }
.status-lost, .status-archived { background: rgba(139, 156, 179, 0.2); color: var(--text-muted); }

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.section-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}
.section-block h3 { margin: 0 0 0.75rem; font-size: 0.9375rem; color: var(--accent); }
.section-block dl { margin: 0; }
.section-block dt { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.5rem; }
.section-block dd { margin: 0.15rem 0 0; }

.ref-id {
  font-family: var(--mono);
  font-size: 1.25rem;
  color: var(--accent);
}

.conditional { display: none; }
.conditional.visible { display: block; }
