:root {
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-hover: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --ink: #09090b;
  --ink-secondary: #3f3f46;
  --ink-muted: #71717a;
  --primary: #18181b;
  --primary-hover: #27272a;
  --primary-ink: #ffffff;
  --radius: 6px;
  --radius-sm: 4px;

  --ok-ink: #15803d;
  --ok-bg: #f0fdf4;
  --ok-border: #bbf7d0;

  --err-ink: #b91c1c;
  --err-bg: #fef2f2;
  --err-border: #fecaca;

  --warn-ink: #a16207;
  --warn-bg: #fefce8;
  --warn-border: #fde68a;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--ink);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.async-note-flush {
  margin-top: 0;
}

.empty-state-flush {
  border: none;
  border-radius: 0;
}

.half-nav-btn-link {
  text-decoration: none;
}

.half-nav-btn-link:hover {
  text-decoration: none;
}

.eyebrow-inline {
  margin-right: 4px;
}

.unlock-form {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.unlock-form .input {
  max-width: 280px;
}

.alert-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

h2 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

code,
pre,
.mono {
  font-family: var(--font-mono);
}

p code,
span code,
li code {
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

/* Containers */
.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 24px;
}

.container-wide {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.topbar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand-group {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 13px;
  color: var(--ink-muted);
  font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
  color: var(--ink);
  text-decoration: none;
}

/* Main */
.main {
  padding-top: 32px;
  padding-bottom: 64px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Typography helpers */
.eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
}

.muted {
  color: var(--ink-muted);
}

.text-sm {
  font-size: 13px;
}

.text-xs {
  font-size: 12px;
}

.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }

/* Cards */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-compact {
  padding: 14px 16px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.card-head-tight {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  padding: 9px 14px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn:hover {
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: var(--primary);
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-outline {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--border-strong);
}

.btn-danger-outline {
  background: var(--bg);
  color: var(--err-ink);
  border-color: var(--border);
}

.btn-danger-outline:hover:not(:disabled) {
  background: var(--err-bg);
  border-color: var(--err-border);
}

.btn-sm {
  padding: 7px 11px;
  font-size: 12.5px;
}

.btn-xs {
  padding: 5px 9px;
  font-size: 12px;
}

.btn-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.pill-ok {
  color: var(--ok-ink);
  background: var(--ok-bg);
  border-color: var(--ok-border);
}

.pill-err {
  color: var(--err-ink);
  background: var(--err-bg);
  border-color: var(--err-border);
}

.pill-warn {
  color: var(--warn-ink);
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

/* Inputs */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.45;
  outline: none;
  transition: border-color 0.12s ease;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--ink);
}

.textarea {
  resize: vertical;
}

.input.mono,
.textarea.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* MCP URL Bar */
.mcp-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.mcp-bar-left {
  min-width: 0;
  flex: 1;
}

.mcp-url {
  display: inline-block;
  margin-top: 4px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  word-break: break-all;
}

/* Home selector */
.selector-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 12px;
  align-items: end;
}

.selector-arrow {
  padding-bottom: 9px;
  color: var(--ink-muted);
  font-size: 15px;
}

.route-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.route-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  text-decoration: none;
}

.route-item:last-child {
  border-bottom: none;
}

.route-item:hover {
  background: var(--surface);
  text-decoration: none;
}

.route-item-title {
  font-weight: 500;
  color: var(--ink);
}

.route-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Route page */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.breadcrumb a {
  color: var(--ink-muted);
}

.breadcrumb a:hover {
  color: var(--ink);
}

.route-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.meta-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* Steps */
.half-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.half-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.step-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--bg);
}

.step-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.step-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.step-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.step-action {
  margin-top: 8px;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.step-meta {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
}

.step-meta-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px;
  align-items: baseline;
}

.step-meta-key {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
}

.step-meta-val {
  color: var(--ink-secondary);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.bridge-bar {
  padding: 10px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

/* Research / Docs list */
.docs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg);
}

.doc-link {
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

/* Check-in section */
.segmented {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-muted);
  cursor: pointer;
}

.seg-btn:hover {
  color: var(--ink);
}

.seg-btn.active {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--border);
}

.checkin-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.checkin-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.checkin-row:last-child {
  border-bottom: none;
}

/* Builder workspace (hello.goodbye.sh) */
.workspace-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.half-nav {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.half-nav-btn {
  appearance: none;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 11px 12px;
  cursor: pointer;
  font-family: var(--font-sans);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.half-nav-btn:last-child {
  border-bottom: none;
}

.half-nav-btn:hover {
  background: var(--surface);
}

.half-nav-btn.active {
  background: var(--surface);
  box-shadow: inset 2px 0 0 var(--ink);
}

.half-nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.half-nav-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.editor-pane {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.editor-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-secondary);
  cursor: pointer;
}

.lint-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.lint-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.lint-row:last-child {
  border-bottom: none;
}

.lint-name {
  font-weight: 500;
  color: var(--ink);
}

.lint-detail {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

.code-block {
  margin: 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 440px;
  overflow-y: auto;
}

.inline-alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
}

.inline-alert.is-error {
  border-color: var(--err-border);
  background: var(--err-bg);
  color: var(--err-ink);
}

.inline-alert.is-ok {
  border-color: var(--ok-border);
  background: var(--ok-bg);
  color: var(--ok-ink);
}

.empty-state {
  padding: 18px;
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 18px 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* Toast */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  padding: 9px 14px;
  background: var(--primary);
  color: var(--primary-ink);
  border: 1px solid var(--primary);
  border-radius: var(--radius);
  font-size: 12.5px;
  font-weight: 500;
}

.toast.is-error {
  background: var(--err-bg);
  color: var(--err-ink);
  border-color: var(--err-border);
}

/* Atomic actions & async wait */
.atomic-list {
  margin: 10px 0 0;
  padding: 10px 12px 10px 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.atomic-list li {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.async-note {
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid var(--warn-border);
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-size: 12.5px;
  line-height: 1.45;
}

/* Training MCP mode toggle */
.mode-box {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mode-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.mode-prompt-pre {
  margin: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Goodbye Share Card */
.share-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.share-card-preview {
  margin-top: 14px;
  width: 100%;
  aspect-ratio: 1200 / 630;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.share-card-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.share-link-bar {
  margin-top: 12px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.share-link-url {
  font-size: 12.5px;
  color: var(--ink);
  word-break: break-all;
}

/* Collapsible locators & extraction details */
.step-disclosure {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

.step-disclosure > summary {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-secondary);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.step-disclosure > summary::-webkit-details-marker {
  display: none;
}

.step-disclosure[open] > summary {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.step-disclosure-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.locator-list {
  margin: 0;
  padding-left: 16px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-secondary);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.locator-list li {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Responsive */
@media (max-width: 820px) {
  .container,
  .container-wide {
    padding: 0 16px;
  }

  .selector-row,
  .share-form-row {
    grid-template-columns: 1fr;
  }

  .selector-arrow {
    display: none;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Beta Waitlist Pages (hello.goodbye.sh/are & hello.goodbye.sh/it) */
.beta-hero {
  max-width: 680px;
}

.beta-title {
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.beta-lead {
  font-size: 15px;
  line-height: 1.6;
}

.beta-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.beta-steps {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.beta-step-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: start;
}

.beta-step-num {
  font-size: 12px;
  color: var(--ink-muted);
  padding-top: 2px;
}

.beta-rules {
  margin: 8px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13.5px;
  color: var(--ink-secondary);
}

.card-subtle {
  background: var(--surface);
}

.beta-switch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.form-alert {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: 1px solid var(--border);
}

.form-alert-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.form-alert-ok {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
