/* ============================================================
   GTM Lead Qualifier - clean, flat, neutral UI (Supabase/Resend style).
   Content sits on a plain page. White surfaces, 1px borders define edges.
   AceMakers teal is an ACCENT only (primary buttons, active nav, links, focus).
   Inter, 14px base. No pills, minimal shadows, no textures, no emojis.
   Light is the default; dark is a neutral (non-teal-tinted) theme.
   ============================================================ */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;      /* subtle fill: active tab, hover */
  --border: #e5e5e5;
  --text: #171717;
  --text-2: #737373;
  --text-3: #a3a3a3;

  --accent: #0a7d68;         /* AceMakers teal */
  --accent-hover: #096b59;
  --accent-weak: rgba(10, 125, 104, 0.10);
  --accent-ring: rgba(10, 125, 104, 0.22);
  --on-accent: #ffffff;

  --green: #16a34a;
  --red: #dc2626;
  --amber: #d97706;
  --blue: #0d7f9e;

  --radius: 8px;             /* cards / surfaces */
  --radius-ctl: 6px;         /* buttons / inputs / chips */

  /* legacy aliases still referenced by class rules below */
  --foreground: var(--text);
  --muted-foreground: var(--text-2);
  --muted-2: var(--text-3);
  --line: var(--border);
  --primary: var(--accent);
  --card: var(--surface);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--accent-weak); }

.ico { width: 16px; height: 16px; display: inline-block; vertical-align: -2px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 14px; height: 14px; }
.ico-lg { width: 20px; height: 20px; }

/* ---------- inputs ---------- */
input[type="text"], input[type="password"], input[type="number"], input[type="email"],
select, textarea {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-ctl);
  padding: 8px 11px; transition: border-color .12s, box-shadow .12s;
}
textarea { line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
::placeholder { color: var(--text-3); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }

/* ============================================================
   Top bar + tabs
   ============================================================ */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 52px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 50;
}
.brand-logo { height: 18px; width: auto; display: block; flex-shrink: 0; }
.brand-light { display: none; }
[data-theme="light"] .brand-dark, :root .brand-dark { display: none; }
[data-theme="light"] .brand-light, :root .brand-light { display: block; }
[data-theme="dark"] .brand-dark { display: block; }
[data-theme="dark"] .brand-light { display: none; }
.topbar-divider { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }
.topbar-title { color: var(--text); font-size: 14px; font-weight: 600; }
.ws-select {
  width: auto; background: var(--surface); border: 1px solid var(--border); color: var(--text);
  border-radius: var(--radius-ctl); padding: 5px 26px 5px 10px; font-size: 13px; font-weight: 500;
  cursor: pointer; max-width: 220px; margin-left: 2px;
}
.tabs { display: flex; gap: 2px; }
.topbar-tabs { margin-left: 6px; }
.tab {
  padding: 6px 11px; font-family: inherit; font-size: 13px; font-weight: 500;
  border: none; border-radius: var(--radius-ctl); background: transparent; color: var(--text-2);
  cursor: pointer; transition: background .12s, color .12s;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.active { background: var(--surface-2); color: var(--accent); }
.tab .dot { display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 6px; font-size: 11px; line-height: 16px; text-align: center; border-radius: var(--radius-ctl); background: var(--accent); color: var(--on-accent); font-weight: 600; }
.topbar-sub { color: var(--text-2); font-size: 13px; margin-left: auto; }
.topbar-user { color: var(--text-2); font-size: 13px; margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-user span { color: var(--text); font-weight: 500; }
.topbar-user button {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; border: none; color: var(--text-2);
  border-radius: var(--radius-ctl); padding: 5px 8px; font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
}
.topbar-user button:hover { background: var(--surface-2); color: var(--text); }
.theme-toggle {
  margin-left: 2px; flex-shrink: 0; width: 30px; height: 30px; border-radius: var(--radius-ctl);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-family: inherit;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }

/* ============================================================
   Page + sections (no box-in-box). Content sits on the page.
   .card is a flat section; .surface is a real bordered white box.
   ============================================================ */
.main { max-width: 1140px; margin: 0 auto; padding: 28px 28px 80px; }
.card { background: transparent; border: none; box-shadow: none; padding: 0; margin-bottom: 30px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 14px; }
.card-title .right { float: right; color: var(--text-2); font-weight: 400; font-size: 13px; }

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

.note { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-top: 8px; }
.note a, .help-text a { color: var(--accent); }
.help-text { font-size: 13px; color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.plabel { font-size: 12px; color: var(--text-2); font-weight: 600; margin: 14px 0 6px; }
.kv { display: flex; gap: 8px; font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.kv b { color: var(--text); font-weight: 600; }

/* ============================================================
   Buttons (no pills; 6px)
   ============================================================ */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 9px 16px; font-family: inherit; font-size: 14px; font-weight: 500;
  border: 1px solid var(--accent); border-radius: var(--radius-ctl);
  background: var(--accent); color: var(--on-accent); cursor: pointer; transition: background .12s;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sec {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; font-family: inherit; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); border-radius: var(--radius-ctl);
  background: var(--surface); color: var(--text); cursor: pointer; transition: background .12s, border-color .12s;
}
.btn-sec:hover { background: var(--surface-2); }
.btn-sec:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sec:disabled:hover { background: var(--surface); }
.btn-green { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.btn-green:hover { background: var(--accent-hover); }

/* ============================================================
   Upload / qualify
   ============================================================ */
.upload-zone { border: 1px dashed var(--border); border-radius: var(--radius); padding: 30px; text-align: center; cursor: pointer; transition: border-color .12s, background .12s; background: var(--surface); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--surface-2); }
.upload-icon { color: var(--text-3); margin-bottom: 8px; display: flex; justify-content: center; }
.upload-icon .ico { width: 26px; height: 26px; }
.upload-text { font-size: 14px; font-weight: 500; color: var(--text); }
.upload-sub { font-size: 13px; color: var(--text-2); margin-top: 4px; }
.file-info { display: none; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-ctl); margin-top: 12px; font-size: 13px; color: var(--text); }
.file-info .ico { color: var(--accent); }
.error-banner { display: none; padding: 10px 14px; background: rgba(220,38,38,0.06); border: 1px solid rgba(220,38,38,0.3); border-radius: var(--radius-ctl); font-size: 13px; color: var(--red); margin-top: 12px; }

.quota-row { margin-top: 10px; font-size: 13px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.quota-pill { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); border-radius: var(--radius-ctl); padding: 3px 10px; font-weight: 500; }
.quota-pill.low { background: rgba(217,119,6,0.08); border-color: rgba(217,119,6,0.35); color: var(--amber); }
.quota-warn { color: var(--red); }

/* progress */
.progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13px; color: var(--text-2); }
.progress-bar-wrap { background: var(--surface-2); border-radius: 99px; height: 6px; overflow: hidden; margin-bottom: 16px; border: 1px solid var(--border); }
.progress-bar { height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; width: 0%; }

/* stats row */
.stats-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 14px 0 20px; }
.stat-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-align: center; }
.stat-num { font-size: 24px; font-weight: 600; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.stat-yes .stat-num { color: var(--green); }
.stat-no .stat-num { color: var(--red); }
.stat-maybe .stat-num { color: var(--amber); }
.stat-search .stat-num { color: var(--blue); }
.stat-qual .stat-num { color: var(--accent); }

/* ============================================================
   Tables (flat, 44px rows, 1px separators)
   ============================================================ */
.results-table, .runs-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.results-table { table-layout: fixed; min-width: 900px; }
.results-table th, .runs-table th {
  text-align: left; padding: 10px; font-size: 12px; font-weight: 500; color: var(--text-2);
  border-bottom: 1px solid var(--border); background: transparent; position: sticky; top: 0; z-index: 2;
}
.results-table td, .runs-table td { padding: 0 10px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text); }
.runs-table td { height: 44px; }
.results-table td { height: 52px; }
.results-table td { word-break: break-word; overflow-wrap: anywhere; }
.results-table tr:hover td, .runs-table tr:hover td { background: var(--surface-2); }
.results-table td a, .runs-table a { color: var(--text); }
.results-table td a:hover { color: var(--accent); }
.runs-table a { color: var(--accent); }
.w-name { width: 17%; } .w-co { width: 20%; } .w-fit { width: 8%; } .w-reason { width: 30%; } .w-fb { width: 15%; }
.col-reason { color: var(--text-2); }
.cell-mid { vertical-align: middle; }

.lead-name { display: flex; align-items: center; gap: 10px; }
.avatar-wrap { flex-shrink: 0; border-radius: 50%; overflow: hidden; }
.avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1px solid var(--border); background: var(--surface-2); display: block; }
.avatar.is-placeholder { transform: scale(1.28); border: none; background: transparent; }
.avatar.fallback { align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-2); }

/* verdict badges (small, subtle) */
.badge { display: inline-block; padding: 2px 8px; border-radius: var(--radius-ctl); font-size: 12px; font-weight: 500; border: 1px solid transparent; }
.badge-yes { background: rgba(22,163,74,0.10); color: var(--green); border-color: rgba(22,163,74,0.25); }
.badge-no { background: rgba(220,38,38,0.08); color: var(--red); border-color: rgba(220,38,38,0.22); }
.badge-maybe { background: rgba(217,119,6,0.10); color: var(--amber); border-color: rgba(217,119,6,0.25); }
.badge-error { background: var(--surface-2); color: var(--text-2); border-color: var(--border); }
.corrected-tag { display: inline-block; margin-left: 6px; font-size: 11px; color: var(--text-2); white-space: nowrap; }
.searched-tag { font-size: 11px; color: var(--blue); font-weight: 500; }
.searched-note { font-size: 12px; color: var(--blue); margin-top: 5px; line-height: 1.4; }
.reason-d > summary { cursor: pointer; list-style: none; color: var(--text-2); }
.reason-d > summary::-webkit-details-marker { display: none; }
.reason-detail { margin-top: 8px; }
.rd-label { font-size: 11px; font-weight: 600; color: var(--text-2); margin: 10px 0 4px; }

/* feedback controls (Lucide thumbs, not emoji) */
.fb-controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.fb-btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-ctl); width: 30px; height: 28px; cursor: pointer; font-family: inherit; color: var(--text-2); }
.fb-btn:hover { border-color: var(--text-3); color: var(--text); }
.fb-btn.good.on { background: rgba(22,163,74,0.10); border-color: rgba(22,163,74,0.4); color: var(--green); }
.fb-btn.bad.on { background: rgba(220,38,38,0.08); border-color: rgba(220,38,38,0.4); color: var(--red); }
.fb-saved { font-size: 11px; color: var(--text-2); }

/* ============================================================
   Filter chips + toolbar
   ============================================================ */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 5px 11px; font-family: inherit; font-size: 13px; font-weight: 500; border: 1px solid var(--border); border-radius: var(--radius-ctl); background: var(--surface); color: var(--text-2); cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.chip:hover { color: var(--text); background: var(--surface-2); }
.chip.on { background: var(--accent-weak); color: var(--accent); border-color: var(--accent); }
.chip .n { opacity: 0.7; margin-left: 4px; }
.toolbar .spacer { flex: 1; }
.toolbar select { width: auto; font-size: 13px; padding: 7px 11px; }

.empty { text-align: center; padding: 40px 20px; color: var(--text-2); }
.empty .ico { width: 28px; height: 28px; margin-bottom: 8px; color: var(--text-3); }
.empty .t { font-size: 14px; font-weight: 600; color: var(--text); }
.empty .d { font-size: 13px; margin-top: 4px; }

/* ============================================================
   Target blocks: flat columns, colored dot header, left-border rows
   ============================================================ */
.target-summary { font-size: 16px; font-weight: 500; color: var(--text); line-height: 1.5; }
.target-empty { color: var(--text-2); font-weight: 400; font-size: 13px; }
.target-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.target-ver { font-size: 12px; font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: 1px 7px; }

.target-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-top: 6px; }
.target-col { display: flex; flex-direction: column; }
.target-col-head { display: flex; align-items: center; gap: 8px; padding: 0 0 10px; font-size: 13px; font-weight: 600; color: var(--text); }
.target-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.target-col-yes .target-dot { background: var(--green); }
.target-col-no .target-dot { background: var(--red); }
.target-col-maybe .target-dot { background: var(--amber); }
.target-col-n { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--text-2); }
.target-col-body { display: flex; flex-direction: column; gap: 8px; }

.target-chip {
  position: relative; display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; padding-left: 13px; border-radius: var(--radius-ctl); font-size: 13px; line-height: 1.4;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border); color: var(--text);
}
.target-col-yes .target-chip { border-left-color: var(--green); }
.target-col-no .target-chip { border-left-color: var(--red); }
.target-col-maybe .target-chip { border-left-color: var(--amber); }
.target-chip.from-feedback { padding-right: 30px; }
.chip-fb { display: inline-flex; align-items: center; font-size: 11px; font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; height: 17px; margin-top: 1px; flex-shrink: 0; }
.chip-fb-key { font-size: 11px; font-weight: 500; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
.chip-x { position: absolute; top: 6px; right: 7px; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 4px; background: transparent; color: var(--text-3); cursor: pointer; font-family: inherit; opacity: 0; transition: opacity .12s, color .12s, background .12s; }
.target-chip:hover .chip-x { opacity: 1; }
.chip-x:hover { color: var(--red); background: var(--surface-2); }

/* ============================================================
   Plan & usage / pricing
   ============================================================ */
.plan-now-name { font-size: 18px; font-weight: 600; color: var(--text); }
.plan-now-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.meter { margin-top: 10px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; max-width: 420px; border: 1px solid var(--border); }
.meter-fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s; }
.meter-fill.low { background: var(--amber); }

.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 18px; }
.plan { position: relative; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 14px; background: var(--surface); display: flex; flex-direction: column; }
.plan.is-current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan-badge { position: absolute; top: -9px; left: 14px; font-size: 11px; font-weight: 600; background: var(--accent); color: var(--on-accent); padding: 2px 8px; border-radius: 4px; }
.plan-name { font-size: 13px; font-weight: 600; color: var(--text); }
.plan-price { font-size: 24px; font-weight: 600; color: var(--text); margin-top: 6px; }
.plan-price span { font-size: 13px; font-weight: 400; color: var(--text-2); }
.plan-price-sub { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.plan-accounts { font-size: 12px; font-weight: 600; color: var(--accent); margin-top: 8px; }
.plan-accounts-sub { font-weight: 400; color: var(--text-2); }
.plan-leads { font-size: 13px; font-weight: 600; color: var(--text); margin-top: 6px; }
.plan-depths { font-size: 12px; color: var(--text-2); margin-top: 3px; }

/* Monthly / yearly billing toggle above the plan grid. */
.bill-toggle { display: inline-flex; gap: 2px; margin-top: 14px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.bt-opt { font-size: 12px; font-weight: 500; color: var(--text-2); background: transparent; border: 0; padding: 6px 14px; border-radius: calc(var(--radius) - 3px); cursor: pointer; }
.bt-opt.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.bt-save { color: var(--accent); font-weight: 600; }
.plan-blurb { font-size: 12px; color: var(--text-2); line-height: 1.5; margin-top: 8px; flex: 1; }
/* Pin the CTA to the card bottom so buttons line up across cards of different
   height (e.g. the Free card has no Tip line). */
.plan-cta { margin-top: auto; padding-top: 14px; }
.plan-actions { margin-top: 14px; display: flex; gap: 8px; }
.plan-tag { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.plan-tag.plan-growth, .plan-tag.plan-scale { background: var(--accent-weak); color: var(--accent); border-color: transparent; }
.plan-tag.plan-starter { background: rgba(13,127,158,0.10); color: var(--blue); border-color: transparent; }
.plan-tag.plan-legacy { background: rgba(217,119,6,0.10); color: var(--amber); border-color: transparent; }
.plan-tag.plan-none { background: var(--surface-2); color: var(--text-3); }

/* consent checkbox */
.consent-row { display: flex; gap: 9px; align-items: flex-start; font-size: 13px; line-height: 1.5; color: var(--text-2); margin: 4px 0 14px; cursor: pointer; }
.consent-row input { margin-top: 2px; flex-shrink: 0; width: auto; }
.inline-check { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); margin: 0; }
.inline-check input { width: auto; margin: 0; }

/* ============================================================
   Admin trends
   ============================================================ */
.trend-activity { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 6px 0 18px; }
.trend-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.trend-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 13px; }
.trend-term { width: 170px; flex-shrink: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trend-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.trend-fill { height: 100%; border-radius: 99px; }
.trend-fill.yes { background: var(--green); }
.trend-fill.no { background: var(--red); }
.trend-n { width: 26px; text-align: right; color: var(--text-2); font-weight: 500; }
.ws-sum { font-size: 12px; color: var(--text-2); font-weight: 400; margin-top: 2px; max-width: 260px; }
.admin-plan-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.admin-plan-row select { width: auto; }
.admin-plan-sel { width: auto; font-size: 12px; padding: 3px 22px 3px 8px; }
.legacy-link-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.legacy-link-row input { font-family: ui-monospace, monospace; font-size: 12px; }
.raw-prompt { margin-top: 14px; }
.raw-prompt > summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
.raw-prompt > summary:hover { color: var(--accent); }
.admin-target { margin-bottom: 4px; }

/* prompt / code boxes (admin only) */
.prompt-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: 14px 16px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.6; color: var(--text); white-space: pre-wrap; max-height: 360px; overflow-y: auto; }
.code-box { font-family: ui-monospace, monospace; font-size: 11px; white-space: pre-wrap; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: 8px; margin-top: 3px; }

/* learned lessons + history */
.lesson { position: relative; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--amber); border-radius: var(--radius-ctl); padding: 9px 11px; font-size: 13px; color: var(--text); margin-bottom: 6px; }
.lesson-x { float: right; margin-left: 10px; background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; font-family: inherit; }
.lesson-x:hover { color: var(--red); }
.hist-item { border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: 10px 13px; margin-bottom: 8px; font-size: 13px; color: var(--text-2); background: var(--surface); }
.hist-item .v { font-weight: 600; color: var(--text); }
.hist-item .ts { color: var(--text-3); }

/* runs / credits */
.cred-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 18px; }
/* Usage tiles are compact so all five fit one row without overflowing. */
.cred-grid .stat-box { padding: 12px 8px; min-width: 0; }
.cred-grid .stat-num { font-size: 17px; white-space: nowrap; }
.cred-grid .stat-label { font-size: 11px; }

/* proposals (feedback modal) */
.prop { border: 1px solid var(--border); border-radius: var(--radius-ctl); padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.prop label.chk { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--text); cursor: pointer; }
.prop .reason { color: var(--text-2); font-size: 12px; margin-top: 3px; }
.prop .chg { font-weight: 600; color: var(--accent); }
.prop-lesson { display: flex; gap: 9px; align-items: flex-start; }
.prop-lesson input[type="checkbox"] { margin-top: 7px; width: auto; flex-shrink: 0; }
.lesson-edit { flex: 1; font-size: 13px; line-height: 1.45; }

/* onboarding steps */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.step { display: flex; gap: 11px; align-items: flex-start; padding: 14px 15px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.step.done { border-color: var(--border); }
.step.active { border-color: var(--accent); }
.step-num { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.step.done .step-num, .step.active .step-num { background: var(--accent); color: var(--on-accent); }
.step-t { font-size: 13px; font-weight: 600; color: var(--text); }
.step-d { font-size: 13px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }

/* learning mini-dashboard */
.learn-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.lstat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; flex: 0 1 190px; min-width: 150px; }
.lstat .v { font-size: 20px; font-weight: 600; color: var(--text); }
.lstat .l { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.lstat.accent .v { color: var(--accent); }

/* settings grid + workspace members */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ws-member { display: flex; justify-content: space-between; align-items: center; padding: 8px 11px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-ctl); font-size: 13px; margin-bottom: 6px; }
.ws-member .role { color: var(--text-2); font-size: 11px; margin-left: 6px; }
.ws-member button { background: none; border: 1px solid var(--border); color: var(--red); border-radius: var(--radius-ctl); padding: 3px 9px; font-size: 11px; cursor: pointer; font-family: inherit; }
.ws-member button:hover { background: rgba(220,38,38,0.06); }

/* ============================================================
   Depth selector (Qualify)
   ============================================================ */
.tier-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.tier { position: relative; display: block; padding: 14px 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color .12s; }
.tier-badge { position: absolute; top: -9px; right: 12px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.tier:hover { border-color: var(--text-3); }
.tier.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tier input { position: absolute; opacity: 0; pointer-events: none; }
.tier .tier-t { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.tier .tier-d { font-size: 13px; color: var(--text-2); line-height: 1.45; }

/* ============================================================
   Auth
   ============================================================ */
.auth-wrap { max-width: 400px; margin: 72px auto; }
.auth-wrap .card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-bottom: 0; }
.auth-wrap .card-title { margin-bottom: 16px; }
.auth-tabs { display: flex; gap: 2px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.auth-tabs .tab { flex: 1; text-align: center; border-radius: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auth-tabs .tab.active { background: transparent; border-bottom-color: var(--accent); }
.auth-field { margin-bottom: 12px; }

/* ============================================================
   Modals (flat white surface)
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(23,23,23,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-width: 600px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 22px 24px; box-shadow: 0 12px 40px rgba(23,23,23,0.12); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.modal-head span { font-size: 15px; font-weight: 600; color: var(--text); }
.modal-x { background: none; border: none; cursor: pointer; color: var(--text-3); padding: 2px; display: inline-flex; border-radius: 4px; }
.modal-x:hover { color: var(--text); background: var(--surface-2); }
.modal-sub { font-size: 13px; color: var(--text-2); margin-bottom: 12px; line-height: 1.5; }
.modal-sub b { color: var(--text); }
.modal-actions { display: flex; gap: 8px; align-items: center; margin-top: 16px; }

/* ============================================================
   Setup wizard
   ============================================================ */
.wiz-intro-main { padding-top: 2px; }
.wiz-headline { font-size: 18px; font-weight: 600; color: var(--text); margin: 0 0 4px; }
.wiz-create-head { font-size: 13px; font-weight: 500; color: var(--text-2); margin: 0 0 12px; }
.wiz-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.wiz-opt { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .12s; }
.wiz-opt:hover { border-color: var(--text-3); }
.wiz-opt.spotlight { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.wiz-opt-t { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 600; color: var(--text); }
.wiz-ic { width: 16px; height: 16px; color: var(--text-2); flex-shrink: 0; }
.wiz-opt-d { font-size: 13px; color: var(--text-2); line-height: 1.45; margin-top: 3px; }
.wiz-link-row { display: flex; gap: 8px; margin-top: 11px; }
.wiz-link-row input { flex: 1; }
.wiz-opt-row { display: flex; align-items: center; gap: 14px; }
.wiz-opt-main { flex: 1; min-width: 0; }
.wiz-act { flex-shrink: 0; min-width: 100px; text-align: center; }
.wiz-file { color: var(--accent); font-weight: 500; }
.wiz-loading { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 20px 30px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; margin-bottom: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }
.wiz-loading-t { font-size: 15px; font-weight: 600; color: var(--text); }
.wiz-loading-d { font-size: 13px; color: var(--text-2); margin-top: 5px; }
.wiz-review-note { font-size: 13px; color: var(--text-2); margin: 14px 0 2px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-ctl); }
.target-more { font-size: 12px; color: var(--text-2); padding: 2px; }

/* mascot assets kept but dormant (trigger removed) */
.wiz-mascot-stage, .wiz-audio-row, .wiz-mascot, .wiz-bubble { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .target-grid, .plan-grid, .trend-cols, .trend-activity { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .settings-grid, .tier-select { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .cred-grid, .learn-stats { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 60px; }
  .topbar { padding: 0 16px; }
}

/* ============================================================
   DARK THEME - neutral surfaces, same teal accent
   ============================================================ */
[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #171717;
  --surface-2: #262626;
  --border: #262626;
  --text: #ededed;
  --text-2: #a3a3a3;
  --text-3: #6b6b6b;
  --accent: #2dd4bf;
  --accent-hover: #14b8a6;
  --accent-weak: rgba(45, 212, 191, 0.12);
  --accent-ring: rgba(45, 212, 191, 0.25);
  --on-accent: #04231e;
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --blue: #38bdf8;
}
[data-theme="dark"] .error-banner { background: rgba(248,113,113,0.10); border-color: rgba(248,113,113,0.3); }
