@charset "UTF-8";
/* ============================================================================
   FunnelIQ — design system (dark-first, matches the funnel-diagnostics UI)
   ========================================================================= */
:root {
  --bg: #0a0a0d;
  --surface: #131318;
  --surface-2: #191a21;
  --surface-3: #20212a;
  --border: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);

  --accent: #f0a13c;
  --accent-2: #2dd9c4;
  --accent-soft: rgba(240,161,60,0.14);

  --green: #22c55e;
  --green-soft: rgba(34,197,94,0.14);
  --amber: #f59e0b;
  --amber-soft: rgba(245,158,11,0.14);
  --red: #ef4a4a;
  --red-soft: rgba(239,74,74,0.14);

  --text: #eef0f4;
  --text-dim: #9a9ca8;
  --text-muted: #64656f;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.35);

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;

  --topbar-h: 64px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #1a1103; }
.btn-primary:hover { background: #f6ad4d; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; border-color: var(--border-strong); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Auth pages ─────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.auth-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 32px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-md);
}
.auth-logo { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.auth-logo::after { content: ''; }
.auth-tagline { color: var(--text-dim); font-size: 13px; margin: -8px 0 4px; }
.auth-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); font-weight: 600; }
.auth-card input {
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; color: var(--text); font-size: 14px; font-family: inherit;
}
.auth-card input:focus { outline: none; border-color: var(--accent); }
.auth-links { display: flex; justify-content: space-between; font-size: 13px; margin-top: 4px; flex-wrap: wrap; gap: 8px; }
.alert { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.alert-error { background: var(--red-soft); color: #ffb3b3; border: 1px solid rgba(239,74,74,0.3); }
.alert-info { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(240,161,60,0.3); word-break: break-all; }

/* ─── App shell ──────────────────────────────────────────────────────────── */
.app-shell { max-width: 1320px; margin: 0 auto; padding: 28px 24px 80px; }
.topbar-eyebrow { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.topbar-eyebrow a { color: var(--text-dim); }
.topbar-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.topbar-title { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; margin: 4px 0 8px; }
.topbar-title .accent { color: var(--accent); }
.topbar-tagline { color: var(--text-dim); font-size: 14px; max-width: 640px; margin: 0; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-dim); }

.tab-nav {
  display: inline-flex; gap: 4px; margin: 22px 0 24px; padding: 5px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  max-width: 100%; overflow-x: auto;
}
.tab-link { padding: 8px 18px; font-size: 14px; font-weight: 600; color: var(--text-dim); border-radius: var(--radius-sm); white-space: nowrap; border: 1px solid transparent; }
.tab-link:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.tab-link.active { color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(240,161,60,0.35); }

.section-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-bottom: 10px; }

/* ─── Project switcher ───────────────────────────────────────────────────── */
.project-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; }
.project-card {
  flex: 0 0 180px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px; cursor: pointer; transition: border-color .15s, background .15s; position: relative;
}
.project-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.project-card.active { border-color: var(--accent); background: var(--surface-2); box-shadow: 0 0 0 3px var(--accent-soft); }
.project-card .sparkline { width: 100%; height: 32px; margin-bottom: 8px; display: block; }
.project-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-card .project-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-flex; align-items: center; flex: none; padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; letter-spacing: .05em; }
.badge-good { background: var(--green-soft); color: var(--green); }
.badge-okay { background: var(--amber-soft); color: var(--amber); }
.badge-poor { background: var(--red-soft); color: var(--red); }
.badge-nodata { background: var(--surface-3); color: var(--text-muted); }
.project-card-new {
  flex: 0 0 160px; display: flex; align-items: center; justify-content: center; color: var(--text-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md); font-size: 13px; font-weight: 600; cursor: pointer;
}
.project-card-new:hover { color: var(--text-dim); border-color: var(--text-dim); }

.project-toolbar { display: flex; align-items: center; gap: 10px; margin: 14px 0 24px; }
.project-toolbar input[type=text] {
  flex: 0 0 240px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 8px 12px; color: var(--text); font-size: 14px;
}

/* ─── Metric cards ───────────────────────────────────────────────────────── */
.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric-card {
  background: radial-gradient(140px 90px at 100% 100%, rgba(240,161,60,0.07), transparent 70%), var(--surface);
  border: 1px solid var(--border); border-top: 2px solid rgba(240,161,60,0.3);
  border-radius: var(--radius-md); padding: 16px 18px;
}
.metric-card .metric-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; }
.metric-card .metric-value { font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
.metric-card .metric-sub { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.metric-card.accent-2 {
  background: radial-gradient(140px 90px at 100% 100%, rgba(45,217,196,0.09), transparent 70%), var(--surface);
  border-top-color: rgba(45,217,196,0.35);
}
.metric-card.accent-2 .metric-value { color: var(--accent-2); }
.metric-card.money {
  background: radial-gradient(160px 100px at 100% 0%, rgba(240,161,60,0.14), transparent 70%), var(--surface);
  border-top-color: var(--accent);
}
.metric-card.money .metric-value { color: var(--accent); }

/* ─── Funnel type pills ──────────────────────────────────────────────────── */
.funnel-type-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.pill-group { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-dim); font-size: 13px; font-weight: 600; cursor: pointer;
}
.pill:hover { color: var(--text); border-color: var(--text-dim); }
.pill.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.benchmark-input { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.benchmark-input input {
  width: 64px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 6px 8px; color: var(--text); font-size: 14px; text-align: right;
}
.coaching-tip { color: var(--accent); font-size: 13px; font-weight: 600; margin: 4px 0 20px; }

/* ─── Funnel visualization ───────────────────────────────────────────────── */
.funnel-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.funnel-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.funnel-panel-title { font-size: 17px; font-weight: 700; }
.funnel-panel-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.funnel-panel-actions { display: flex; gap: 8px; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-dim); cursor: pointer; }
.icon-btn:hover { color: var(--text); }

.status-legend { display: flex; gap: 20px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); margin: 16px 0 20px; }
.status-legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.status-legend b { color: var(--text); font-weight: 700; }
.dot-healthy { background: var(--green); }
.dot-attention { background: var(--amber); }
.dot-urgent { background: var(--red); }

.funnel-steps { display: flex; flex-direction: column; }
.funnel-step {
  position: relative; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-2);
  padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.funnel-step.status-urgent { border-color: rgba(239,74,74,0.4); background: linear-gradient(90deg, rgba(239,74,74,0.10), transparent 60%); }
.funnel-step.status-attention { border-color: rgba(245,158,11,0.35); background: linear-gradient(90deg, rgba(245,158,11,0.08), transparent 60%); }
.funnel-step.status-healthy { border-color: rgba(34,197,94,0.3); }
.step-main { display: flex; align-items: center; gap: 14px; }
.step-badge { width: 26px; height: 26px; border-radius: 6px; background: var(--surface-3); color: var(--text-dim); border: 1px solid transparent; font-size: 12px; font-weight: 800; display: flex; align-items: center; justify-content: center; flex: none; }
.funnel-step.status-healthy .step-badge { background: var(--green-soft); color: var(--green); border-color: rgba(34,197,94,0.4); }
.funnel-step.status-attention .step-badge { background: var(--amber-soft); color: var(--amber); border-color: rgba(245,158,11,0.4); }
.funnel-step.status-urgent .step-badge { background: var(--red-soft); color: var(--red); border-color: rgba(239,74,74,0.4); }
.step-name { font-size: 14px; font-weight: 700; }
.step-sublabel { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.step-count { font-size: 24px; font-weight: 800; margin-top: 2px; }
.step-caption { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

.funnel-connector { display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 12px; padding: 8px 0; color: var(--text-dim); flex-wrap: wrap; text-align: center; }
.funnel-connector.status-healthy { color: var(--green); }
.funnel-connector.status-attention { color: var(--amber); }
.funnel-connector.status-urgent { color: var(--red); }
.funnel-connector .muted { color: var(--text-muted); }

/* ─── Modal ──────────────────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-overlay.open { display: flex; }
.modal { width: 100%; max-width: 560px; max-height: 86vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-md); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { font-size: 17px; margin: 0; }
.modal-close { background: none; border: none; color: var(--text-dim); font-size: 20px; cursor: pointer; line-height: 1; }
.modal-section-label { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin: 18px 0 10px; }
.modal-section-label:first-of-type { margin-top: 0; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-dim); font-weight: 600; }
.field-grid input {
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 9px 10px; color: var(--text); font-size: 14px; font-family: inherit;
}
.field-grid input:focus { outline: none; border-color: var(--accent); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.save-status { font-size: 12px; color: var(--text-muted); align-self: center; margin-right: auto; }

/* ─── A/B Test tab ───────────────────────────────────────────────────────── */
.ab-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.variant-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.variant-card.variant-b { border-color: rgba(45,217,196,0.3); }
.variant-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.variant-badge { width: 28px; height: 28px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 800; flex: none; }
.variant-badge-a { background: var(--accent-soft); color: var(--accent); }
.variant-badge-b { background: rgba(45,217,196,0.14); color: var(--accent-2); }
.variant-title { font-size: 15px; font-weight: 700; }

.sig-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px; }
.sig-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.transition-select { display: flex; align-items: center; gap: 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; }
.transition-select select {
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 7px 10px; color: var(--text); font-size: 13px; font-family: inherit; text-transform: none; letter-spacing: normal; font-weight: 600;
}
.sig-empty-msg { color: var(--text-dim); font-size: 13px; text-align: center; padding: 30px 0; margin: 0; }
.sig-winner-banner { text-align: center; padding: 18px 0 10px; }
.sig-winner-label { font-size: 20px; font-weight: 800; }
.sig-winner-sub { font-size: 13px; color: var(--text-dim); margin-top: 4px; }
.sig-winner-a .sig-winner-label { color: var(--accent); }
.sig-winner-b .sig-winner-label { color: var(--accent-2); }
.sig-winner-none .sig-winner-label { color: var(--text-dim); }
.sig-stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 16px 0; }
.sig-stat-col { text-align: center; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; }
.sig-stat-value { font-size: 26px; font-weight: 800; margin: 8px 0 2px; }
.sig-stat-sub { font-size: 12px; color: var(--text-muted); }
.sig-meta { text-align: center; font-size: 12px; color: var(--text-muted); }

/* ─── Launch/Audit tab ───────────────────────────────────────────────────── */
.audit-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.audit-head { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; padding-bottom: 22px; border-bottom: 1px solid var(--border); }
.progress-ring-wrap { position: relative; width: 100px; height: 100px; flex: none; }
.progress-ring { transform: rotate(-90deg); }
.progress-ring-bg { fill: none; stroke: var(--surface-3); stroke-width: 8; }
.progress-ring-fg { fill: none; stroke: var(--accent); stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset .3s ease; }
.progress-ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 800; }

.audit-category { margin-bottom: 22px; }
.audit-category:last-child { margin-bottom: 0; }
.audit-category-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); font-weight: 700; margin-bottom: 8px; }
.audit-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.audit-item:hover { background: var(--surface-2); }
.audit-item input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; flex: none; }
.audit-item-label { font-size: 14px; font-weight: 600; }
.audit-item.checked .audit-item-label { color: var(--text-dim); text-decoration: line-through; text-decoration-color: var(--border-strong); }

/* ─── Empty states ───────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty-state h3 { color: var(--text); margin-bottom: 6px; }

@media (max-width: 640px) {
  .field-grid { grid-template-columns: 1fr; }
  .funnel-step { flex-wrap: wrap; }
  .ab-grid { grid-template-columns: 1fr; }
  .sig-stats-grid { grid-template-columns: 1fr; }
  .audit-head { flex-wrap: wrap; }
}
