:root {
  --bg: #0f0e17;
  --surface: #1a1828;
  --surface-2: #231f35;
  --border: #2e2a45;
  --accent: #a78bfa;
  --accent-bright: #c4b5fd;
  --gold: #f59e0b;
  --gold-dim: #fbbf24;
  --text: #f0eeff;
  --text-dim: #9d96c0;
  --text-muted: #635d84;
  --green: #34d399;
  --red: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.logo span.dim { color: var(--text-dim); font-weight: 400; }

nav { display: flex; gap: 4px; }

.tab-btn {
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab-btn:hover { background: var(--surface-2); color: var(--text); }
.tab-btn.active { background: var(--accent); color: #fff; }

.badge-pro {
  background: linear-gradient(135deg, var(--gold), #f97316);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

/* ── Layout ── */
.page { display: none; padding: 32px 24px; max-width: 1100px; margin: 0 auto; }
.page.active { display: block; }

/* ── Calculator ── */
.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }

.field input, .field select {
  width: 100%;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
  appearance: none;
}

.field input:focus, .field select:focus { border-color: var(--accent); }
.field input::placeholder { color: var(--text-muted); }

.select-wrapper { position: relative; }
.select-wrapper::after {
  content: '▾';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  font-size: 12px;
}

.deliverable-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.deliverable-btn {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.deliverable-btn:hover { border-color: var(--accent); color: var(--text); }
.deliverable-btn.active { border-color: var(--accent); background: rgba(167,139,250,0.12); color: var(--text); }

.platform-grid { display: flex; gap: 8px; flex-wrap: wrap; }

.platform-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.platform-btn:hover { border-color: var(--accent); color: var(--text); }
.platform-btn.active { border-color: var(--accent); background: rgba(167,139,250,0.12); color: var(--text); }

/* Extras checkboxes */
.extras-list { display: flex; flex-direction: column; gap: 8px; }

.extra-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s;
  user-select: none;
}

.extra-item:hover { border-color: var(--accent); }
.extra-item.checked { border-color: var(--accent); background: rgba(167,139,250,0.08); }

.extra-item input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }
.extra-item .extra-label { flex: 1; font-size: 13px; }
.extra-item .extra-fee { font-size: 12px; color: var(--gold); font-weight: 600; }

/* ── Rate Output ── */
.rate-output {
  background: linear-gradient(135deg, rgba(167,139,250,0.08), rgba(245,158,11,0.06));
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 16px;
}

.rate-label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }

.rate-range {
  font-size: 38px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.rate-range .sep { color: var(--text-muted); margin: 0 8px; font-weight: 300; }

.rate-midpoint {
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-dim);
}

.rate-midpoint strong { color: var(--gold); }

/* Rate breakdown */
.breakdown {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.breakdown-title {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 14px;
}

.breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

.breakdown-row:last-child { border-bottom: none; }
.breakdown-row .bk-label { color: var(--text-dim); }
.breakdown-row .bk-value { color: var(--text); font-weight: 500; }
.breakdown-row.total .bk-label { color: var(--text); font-weight: 600; }
.breakdown-row.total .bk-value { color: var(--gold); font-weight: 700; font-size: 15px; }

/* Niche selector with description */
.niche-meta { font-size: 12px; color: var(--text-muted); margin-top: 6px; min-height: 16px; }
.niche-multiplier { color: var(--gold); font-weight: 600; }

/* ── Pipeline ── */
.pipeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.pipeline-title { font-size: 20px; font-weight: 700; }

.revenue-summary {
  display: flex;
  align-items: center;
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
}

.rev-item { text-align: center; }
.rev-item .rev-val { font-size: 20px; font-weight: 700; color: var(--green); }
.rev-item .rev-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rev-divider { width: 1px; height: 36px; background: var(--border); }

.pipeline-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}

@media (max-width: 900px) { .pipeline-board { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 500px) { .pipeline-board { grid-template-columns: repeat(2, 1fr); } }

.lane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  min-width: 160px;
}

.lane-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.lane-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lane-name { font-size: 12px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.lane-count { margin-left: auto; font-size: 11px; color: var(--text-muted); background: var(--surface-2); padding: 1px 6px; border-radius: 10px; }

.deal-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.deal-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.deal-card:last-child { margin-bottom: 0; }

.deal-brand { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.deal-meta { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; }

.deal-rates { display: flex; flex-direction: column; gap: 3px; }
.deal-rate-row { display: flex; justify-content: space-between; font-size: 12px; }
.deal-rate-label { color: var(--text-muted); }
.deal-rate-val { font-weight: 600; }
.deal-rate-val.suggested { color: var(--accent-bright); }
.deal-rate-val.offered.below { color: var(--red); }
.deal-rate-val.offered.fair { color: var(--green); }
.deal-rate-val.offered.none { color: var(--text-muted); font-style: italic; }

.underpay-warning {
  margin-top: 8px;
  font-size: 11px;
  color: var(--red);
  background: rgba(248,113,113,0.1);
  border-radius: 4px;
  padding: 3px 6px;
}

/* ── Deal modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow);
}

.modal-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.modal-brand { font-size: 20px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-dim); font-size: 20px;
  cursor: pointer; line-height: 1; padding: 4px;
}
.modal-close:hover { color: var(--text); }

.modal-field { margin-bottom: 14px; }
.modal-field .mf-label { font-size: 12px; color: var(--text-muted); margin-bottom: 3px; }
.modal-field .mf-value { font-size: 14px; color: var(--text); }

.modal-note {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

/* empty lane */
.lane-empty { font-size: 12px; color: var(--text-muted); text-align: center; padding: 12px 0; }

/* scroll hint */
.scroll-hint { font-size: 12px; color: var(--text-muted); margin-top: 12px; }
