@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;450;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

/* ---------------------------------------------------------------------------
   Next.js / Vercel (Geist) brand design tokens — light theme
   --------------------------------------------------------------------------- */
:root {
  /* surfaces */
  --bg: #ffffff;
  --bg-subtle: #fafafa;       /* geist gray 100 */
  --panel: #ffffff;
  --card: #fafafa;

  /* text */
  --heading: #000000;
  --text: #171717;            /* geist foreground */
  --muted: #666666;           /* geist gray 700 */
  --faint: #8f8f8f;

  /* lines */
  --border: #eaeaea;          /* the signature Vercel border */
  --border-strong: #d4d4d4;

  /* interactive */
  --accent: #0070f3;          /* vercel blue */
  --accent-weak: #e8f1ff;
  --primary: #000000;         /* primary button */
  --primary-hover: #383838;
  --success: #16a34a;
  --danger: #e5484d;

  --radius: 6px;
  --radius-lg: 10px;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

code, .mono { font-family: var(--mono); }
code {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 0.85em;
  color: var(--text);
}

/* ---------- simulated landing-page content ---------- */
/* Panel is a fixed 440px column on the LEFT; offset page content so it clears it
   (the widget bubble is viewport-fixed bottom-right and is unaffected). */
body { padding-left: 440px; }
@media (max-width: 900px) { body { padding-left: 0; } }

/* ---------- widget env chip ----------
   Sits just above the bottom-right widget bubble. Tells you WHICH env the widget
   loaded from (the three look identical otherwise) and confirms the real mount. */
#harness-widget-chip {
  position: fixed;
  right: 20px;
  bottom: 96px;                 /* clear of the widget bubble below it */
  z-index: 99999990;            /* under the widget (99999999) but above the page */
  pointer-events: none;         /* display-only: never intercept a click meant for the widget */
  display: flex;
  align-items: center;
  gap: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--chip-color, var(--faint));
  border-radius: 10px;
  padding: 7px 11px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.13);
  font-family: var(--sans);
}
#harness-widget-chip .hwc-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--chip-color, var(--faint));
  flex: none;
}
#harness-widget-chip .hwc-text { display: flex; flex-direction: column; line-height: 1.25; }
#harness-widget-chip .hwc-env {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--chip-color, var(--text));
}
#harness-widget-chip .hwc-host { font-size: 10px; color: var(--muted); }
#harness-widget-chip .hwc-status {
  margin-left: 4px;
  font-size: 10px;
  font-weight: 600;
  color: var(--faint);
  white-space: nowrap;
}
#harness-widget-chip.is-loaded .hwc-status { color: var(--success); }
#harness-widget-chip.is-error { border-left-color: var(--danger); }
#harness-widget-chip.is-error .hwc-status { color: var(--danger); font-weight: 700; }

.harness-page {
  max-width: 680px;
  margin: 64px auto;
  padding: 0 24px 140px;
}
.harness-page h1 {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--heading);
  margin: 14px 0 16px;
}
.harness-page p { color: var(--muted); }
.harness-page nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
}
.harness-page nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 450;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color 0.15s, background 0.15s;
}
.harness-page nav a:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.route-tag {
  display: inline-block;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ---------- simulated landing-page UI kit ---------- */
/* page-type badge — one colour per page so you always know where you are */
.lp-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--muted);
}
.lp-badge.home      { background: #ecfdf5; color: #15803d; border-color: #bbf7d0; }
.lp-badge.pricing   { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.lp-badge.geo       { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.lp-badge.institute { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.lp-badge.referrer  { background: #f8fafc; color: #475569; border-color: #e2e8f0; }

.lp-sub { font-size: 16px; color: var(--muted); margin: 12px 0 24px; max-width: 62ch; }

/* "what this page represents" marker */
.lp-marker {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  padding: 14px 16px;
  margin: 0 0 28px;
  max-width: 62ch;
}
.lp-marker-row { display: flex; gap: 10px; font-size: 13px; padding: 4px 0; align-items: baseline; }
.lp-marker-row > span:first-child {
  flex: 0 0 104px;
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.lp-marker code { font-size: 12px; }

/* live readout of the query params this page was loaded with (= the captured touch) */
.lp-live { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.lp-chip {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
  color: var(--text);
}
.lp-chip b { color: var(--accent); font-weight: 600; }
.lp-chip-empty { color: var(--faint); font-style: italic; border-style: dashed; }

/* light fake content so it reads like a real landing page */
.lp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 0 0 28px;
  max-width: 62ch;
}
.lp-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.lp-card h3 { margin: 0 0 6px; font-size: 15px; color: var(--heading); }
.lp-card p { margin: 0; font-size: 13px; color: var(--muted); }
.lp-price { font-size: 22px; font-weight: 600; color: var(--heading); margin: 2px 0 6px; }

/* ---------- control panel (right sidebar) ---------- */
#harness-panel {
  position: fixed;
  top: 0;
  left: 0; /* LEFT side — keep the bottom-right corner clear for the widget bubble */
  width: 440px;
  max-width: 92vw;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 20px;
  font-size: 13px;
  z-index: 2147483000;
  box-shadow: 8px 0 24px rgba(0, 0, 0, 0.05);
}
#harness-panel h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--heading);
  margin: 0 0 16px;
}
#harness-panel h3 {
  font-size: 11px;
  font-weight: 600;
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
}
#harness-panel h4 { font-size: 13px; font-weight: 600; color: var(--text); margin: 14px 0 6px; }

/* numbered "how to use" strip */
.hp-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: 0 0 16px;
  font-size: 11px;
}
.hp-step {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.hp-step-arrow { color: var(--faint); }

.hp-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

/* env banner — solid semantic colour (grey/amber/red) set inline by panel.js */
.hp-banner {
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 14px;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.hp-banner strong { display: block; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.hp-confirm { display: block; font-size: 11px; opacity: 0.9; margin-top: 4px; }

.hp-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.hp-label { display: block; font-size: 11px; color: var(--muted); margin: 10px 0 4px; font-weight: 450; }
.hp-hint { font-size: 11px; color: var(--faint); margin: 8px 0 0; line-height: 1.5; }
.hp-hint a { color: var(--accent); text-decoration: none; }
.hp-hint a:hover { text-decoration: underline; }

.hp-input {
  flex: 1 1 auto;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12px;
  font-family: var(--sans);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hp-input::placeholder { color: var(--faint); }
.hp-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
select.hp-input { cursor: pointer; }
input.hp-input[class*="mono"], .hp-input.mono { font-family: var(--mono); }

/* Standout — draws the eye to the field that gates everything (the token). */
.hp-input.standout {
  border-color: var(--accent);
  background: var(--accent-weak);
  box-shadow: 0 0 0 3px var(--accent-weak);
}
.hp-input.standout::placeholder { color: var(--accent); opacity: 0.8; }

/* Click cue — points to the live widget bubble after the journey is built. */
.hp-click-cue {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px dashed #25D366;
  border-radius: var(--radius);
  background: rgba(37, 211, 102, 0.08);
  color: #128C4B;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* buttons */
.hp-btn {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.hp-btn:hover { border-color: var(--border-strong); background: var(--bg-subtle); }
.hp-btn.primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 600;
}
.hp-btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.hp-btn.danger {
  background: var(--bg);
  border-color: var(--border);
  color: var(--danger);
}
.hp-btn.danger:hover { background: #fef2f2; border-color: var(--danger); }

/* env selector buttons — coloured by --env-color (inline) */
.hp-env-btn {
  flex: 1;
  border: 1.5px solid var(--env-color);
  background: var(--bg);
  color: var(--env-color);
  border-radius: var(--radius);
  padding: 9px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.hp-env-btn:hover { background: var(--bg-subtle); }
.hp-env-btn.active { background: var(--env-color); color: #fff; }

/* scenarios */
.hp-scenario {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg);
  transition: border-color 0.15s;
}
.hp-scenario:hover { border-color: var(--border-strong); }
.hp-sc-title { font-weight: 600; color: var(--heading); margin-bottom: 4px; }
.hp-sc-desc { font-size: 11px; color: var(--muted); margin-bottom: 4px; line-height: 1.5; }
.hp-sc-paid { font-size: 11px; color: var(--success); margin-bottom: 8px; font-weight: 500; }

.hp-freeform { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }

/* ---------- journey palette ---------- */
.hp-pal-cat {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  margin: 12px 0 6px;
}
.hp-pal-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.hp-block {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--radius);
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--sans);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.hp-block:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
/* semantic left-edge by category */
.hp-block-paid    { border-left-color: #d97706; }
.hp-block-organic { border-left-color: #16a34a; }
.hp-block-special { border-left-color: #6d28d9; }

/* composed-journey readout */
.hp-comp {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  padding: 6px;
  margin-bottom: 10px;
  min-height: 28px;
}
.hp-comp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-left: 3px solid var(--border-strong);
  background: var(--bg);
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 11px;
}
.hp-comp-row:last-child { margin-bottom: 0; }
.hp-comp-row.hp-block-paid    { border-left-color: #d97706; }
.hp-comp-row.hp-block-organic { border-left-color: #16a34a; }
.hp-comp-row.hp-block-special { border-left-color: #6d28d9; }
.hp-comp-idx {
  flex: none;
  width: 16px;
  text-align: center;
  color: var(--faint);
  font-family: var(--mono);
}
.hp-comp-label { flex: 1 1 auto; color: var(--text); font-weight: 500; }
.hp-comp-when { flex: none; color: var(--muted); font-family: var(--mono); font-size: 10px; }
/* a touch older than 90d: shown in the stack but dropped from the shipped journey */
.hp-comp-row.is-pruned { opacity: 0.55; }
.hp-comp-row.is-pruned .hp-comp-label { text-decoration: line-through; }
.hp-comp-row.is-pruned .hp-comp-when { color: var(--danger); }

/* code / journey / SQL blocks */
.hp-pre {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 260px;
  overflow-y: auto;
  margin: 0 0 10px;
}
.hp-sql { color: var(--accent); }

.hp-device { font-size: 11px; color: var(--muted); margin-bottom: 10px; font-family: var(--mono); }
.hp-device div { word-break: break-all; }
.hp-paid { font-size: 12px; color: var(--text); margin-bottom: 10px; }
.hp-checklist { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.hp-checklist ol { margin: 6px 0; padding-left: 18px; }
.hp-checklist li { margin-bottom: 4px; }

/* scrollbar polish (webkit) */
#harness-panel::-webkit-scrollbar, .hp-pre::-webkit-scrollbar { width: 10px; }
#harness-panel::-webkit-scrollbar-thumb, .hp-pre::-webkit-scrollbar-thumb {
  background: #e0e0e0; border-radius: 999px; border: 3px solid var(--bg);
}
.hp-pre::-webkit-scrollbar-thumb { border-color: var(--bg-subtle); }
