:root {
  --bg: #f4f5f5;
  --surface: #ffffff;
  --text: #15181c;
  --text-muted: #6b7280;
  --text-subtle: #8b8f96;
  --border: #e5e7eb;
  --border-strong: #d8dadd;
  --pill-bg: #ffffff;
  --pill-border: #e3e5e8;
  --accent-green: #1f9d6a;
  --accent-green-soft: #d6efe2;
  --black: #14171b;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04),
    0 8px 24px rgba(16, 24, 40, 0.04);
  --radius-pill: 999px;
  --radius-card: 14px;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", "Inter", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.04);
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
  padding: 9px 20px;
}

.btn-dark {
  background: var(--black);
  color: #fff;
}

.btn-dark:hover {
  background: #000;
  transform: translateY(-1px);
}

/* ---------- Page layout ---------- */
.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 64px;
}

/* ---------- Stepper ---------- */
.stepper-wrap {
  position: relative;
  width: 100%;
  max-width: 680px;
  margin: 8px auto 56px;
  padding: 22px 16px 12px;
}

.stepper-bg {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    circle at center,
    rgba(20, 23, 27, 0.06) 1px,
    transparent 1.4px
  );
  background-size: 14px 14px;
  -webkit-mask-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0) 75%
  );
  mask-image: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0) 75%
  );
  pointer-events: none;
}

.stepper {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}

.step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Connecting line between steps */
.step + .step::before {
  content: "";
  position: absolute;
  top: 14px;
  right: calc(50% + 18px);
  left: calc(-50% + 18px);
  height: 2px;
  background: var(--border-strong);
  z-index: 0;
}

/* The line that comes BEFORE an active or completed step */
.step.is-active::before,
.step.is-complete + .step::before {
  background: var(--accent-green);
}

.step-circle {
  position: relative;
  z-index: 1;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  color: var(--text-subtle);
  font-size: 12px;
  font-weight: 600;
}

.step.is-complete .step-circle {
  background: var(--accent-green);
  border-color: var(--accent-green);
  color: #fff;
}

.step.is-active .step-circle {
  background: var(--black);
  border-color: var(--black);
  color: #fff;
}

.step-label {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.step.is-complete .step-label,
.step.is-active .step-label {
  color: var(--text);
}

/* ---------- Problem statement (post-Ideation handoff) ---------- */
.problem-statement-wrap {
  width: 100%;
  max-width: 680px;
  margin: 0 auto 16px;
}

.problem-statement-wrap[hidden] {
  display: none;
}

.problem-statement-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.problem-statement-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 18px;
}

.problem-statement-eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-green);
}

.problem-statement-edit {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
}

.problem-statement-display {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.4;
  letter-spacing: -0.005em;
  color: var(--text);
}

.problem-statement-display[hidden] {
  display: none;
}

.problem-statement-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.problem-statement-form[hidden] {
  display: none;
}

.problem-statement-input {
  width: 100%;
  min-height: 56px;
  max-height: 200px;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.problem-statement-input:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(20, 23, 27, 0.08);
}

.problem-statement-input::placeholder {
  color: #aab0b8;
}

.problem-statement-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.problem-statement-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.problem-statement-cancel {
  font-size: 13px;
}

.problem-statement-save {
  padding: 8px 18px;
  font-size: 13.5px;
}

.problem-statement-message {
  margin: 4px 0 0;
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--accent-green-soft);
  color: #0c5d3e;
}

.problem-statement-message[hidden] {
  display: none;
}

.problem-statement-message[data-tone="error"] {
  background: #fef2f2;
  color: #991b1b;
}

/* ---------- Hero ---------- */
.hero {
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-title,
.hero-subtitle {
  max-width: 720px;
}

.prompt-card,
.hero-hint {
  max-width: 720px;
  width: 100%;
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 8px 0 14px;
  color: var(--text);
}

.hero-subtitle {
  margin: 0 0 32px;
  font-size: 16px;
  color: var(--text-muted);
}

/* ---------- Suggestion pills ---------- */
.suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 22px;
  width: 100%;
  max-width: 760px;
}

.suggestion {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  background: var(--pill-bg);
  border: 1px solid var(--pill-border);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease,
    transform 0.15s ease, box-shadow 0.15s ease;
}

.suggestion:hover {
  border-color: #c9ccd1;
  background: #fafafa;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.04);
}

/* ---------- Prompt card ---------- */
.prompt-card {
  position: relative;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.prompt-card:focus-within {
  border-color: #c5c8cd;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04),
    0 12px 32px rgba(16, 24, 40, 0.06);
}

.prompt-input {
  width: 100%;
  min-height: 64px;
  max-height: 240px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
  padding: 0;
}

.prompt-input::placeholder {
  color: #aab0b8;
}

.prompt-send {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #b4b8be;
  color: #fff;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

.prompt-send:hover {
  background: #8d9198;
  transform: translateY(-1px);
}

.prompt-send.is-active {
  background: var(--black);
}

.hero-hint {
  margin: 18px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.hero-hint a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.hero-hint a:hover {
  color: #000;
}

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.footer-right {
  display: flex;
  gap: 28px;
}

.footer-right a:hover {
  color: var(--text);
}

/* ---------- Workspace (chat + artifacts) ---------- */
.workspace {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  align-items: start;
}

.chat-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.sidebar-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: 24px;
  align-self: start;
}

/* Once a conversation has started we collapse the marketing copy. */
body[data-chat="active"] .hero-title {
  font-size: clamp(20px, 2.5vw, 24px);
  margin: 0 0 4px;
}
body[data-chat="active"] .hero-subtitle,
body[data-chat="active"] .suggestions {
  display: none;
}
body[data-chat="active"] .hero {
  margin-bottom: 16px;
}

/* ---------- Chat thread ---------- */
.chat-thread {
  width: 100%;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 0 18px;
}

.chat-thread:empty {
  margin: 0;
}

.msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg-user {
  align-self: flex-end;
  background: var(--black);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg-assistant {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg-assistant.is-typing {
  color: var(--text-muted);
  font-style: italic;
}

.msg-typing-dots {
  display: inline-flex;
  gap: 4px;
  vertical-align: middle;
  margin-left: 2px;
}
.msg-typing-dots span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-subtle);
  animation: typingDot 1.2s infinite ease-in-out;
}
.msg-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.msg-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typingDot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.msg-error {
  align-self: flex-start;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.prompt-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- Artifacts panel ---------- */
.artifacts-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px 18px 14px;
  box-shadow: var(--shadow-card);
}

.artifacts-header h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.artifacts-header p {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.artifacts-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.artifact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.artifact-item:hover {
  background: #f7f8f9;
  border-color: var(--border);
}

.artifact-item:disabled {
  cursor: default;
  color: var(--text-muted);
}

.artifact-item:disabled:hover {
  background: transparent;
  border-color: transparent;
}

.artifact-item.is-active {
  background: #f7f8f9;
  border-color: var(--border);
}

.artifact-item.is-active .artifact-label {
  color: var(--text);
  font-weight: 600;
}

.artifact-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef0f2;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.status-pill[data-status="draft"] {
  background: #fef3c7;
  color: #92400e;
}

.status-pill[data-status="complete"] {
  background: var(--accent-green-soft);
  color: var(--accent-green);
}

.status-pill[data-status="active"] {
  background: #e6e7e9;
  color: var(--text);
}

.status-pill[data-status="standby"] {
  background: #fef3c7;
  color: #92400e;
}

/* ---------- Contradiction Auditor panel ---------- */
.auditor-panel[hidden] {
  display: none;
}

.auditor-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.auditor-title-row h3 {
  margin: 0;
}

.auditor-body {
  margin-top: 4px;
  padding: 12px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: #fafbfc;
}

.auditor-empty {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ---------- Startup Ideas panel ---------- */
.ideas-panel[hidden] {
  display: none;
}

.ideas-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.ideas-title-row h3 {
  margin: 0;
}

.ideas-add {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

.ideas-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
}

.ideas-list:empty {
  display: none;
}

.ideas-empty {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.idea-item {
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease,
    transform 0.12s ease;
}

.idea-item:hover {
  background: #ffffff;
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.idea-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.idea-num {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.idea-item-title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.idea-source-pill {
  flex-shrink: 0;
}

.idea-source-pill[data-source="coach"] {
  background: #e6e7e9;
  color: var(--text);
}

.idea-source-pill[data-source="user"] {
  background: var(--accent-green-soft);
  color: var(--accent-green);
}

.idea-item-desc {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Idea detail modal */
.idea-description {
  margin: 6px 0 16px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}

.idea-metadata {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

.idea-meta-dl {
  margin: 0;
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 14px;
  row-gap: 6px;
  font-size: 13px;
}

.idea-meta-dl dt {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: capitalize;
}

.idea-meta-dl dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

/* Add-idea form */
.idea-textarea {
  resize: vertical;
  min-height: 92px;
  font-family: inherit;
}

/* ---------- Idea-Spotting Action Plan panel ---------- */
.objectives-panel[hidden] {
  display: none;
}

.objectives-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.objectives-title-row h3 {
  margin: 0;
}

.objectives-add {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

.objectives-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 4px;
}

.objectives-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #eef0f2;
  overflow: hidden;
}

.objectives-progress-bar > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent-green);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.objectives-progress-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.objectives-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}

.objectives-list:empty {
  display: none;
}

.objectives-empty {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.objective-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 32px 10px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafbfc;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.objective-item:hover {
  background: #ffffff;
  border-color: var(--border-strong);
}

.objective-item.is-done {
  background: #f4faf6;
  border-color: var(--accent-green-soft);
}

.objective-checkbox {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-top: 1px;
  transition: background 0.12s ease, border-color 0.12s ease,
    transform 0.12s ease;
}

.objective-checkbox:hover {
  border-color: var(--text-subtle);
  transform: scale(1.04);
}

.objective-item.is-done .objective-checkbox {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.objective-body {
  flex: 1;
  min-width: 0;
}

.objective-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.objective-num {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.objective-title {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
}

.objective-item.is-done .objective-title {
  color: var(--text-muted);
  text-decoration: line-through;
  text-decoration-color: var(--text-subtle);
}

.objective-source-pill {
  flex-shrink: 0;
}

.objective-source-pill[data-source="coach"] {
  background: #e6e7e9;
  color: var(--text);
}

.objective-source-pill[data-source="user"] {
  background: var(--accent-green-soft);
  color: var(--accent-green);
}

.objective-desc {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.objective-item.is-done .objective-desc {
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.objective-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease;
}

.objective-item:hover .objective-remove {
  opacity: 1;
}

.objective-remove:hover {
  background: #fef2f2;
  color: #991b1b;
}

/* ---------- User chip in header ---------- */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  font-size: 13px;
  color: var(--text);
}

.user-email {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover { color: var(--text); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 23, 27, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 28px 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.18);
  position: relative;
  animation: popIn 0.18s ease;
}
.modal-wide { max-width: 640px; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.modal h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.01em;
}

.modal-sub {
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: #f1f3f5; color: var(--text); }

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 14px;
  font: inherit;
  font-size: 14.5px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.text-input:focus {
  border-color: var(--black);
  box-shadow: 0 0 0 3px rgba(20, 23, 27, 0.08);
}

.auth-form .btn {
  width: 100%;
  padding: 11px;
}

.auth-message {
  margin: 14px 0 0;
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-green-soft);
  color: #0c5d3e;
}

.auth-message[data-tone="error"] {
  background: #fef2f2;
  color: #991b1b;
}

.auth-toggle {
  margin-top: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  gap: 6px;
}

.auth-toggle .link-btn {
  color: var(--text);
  font-weight: 500;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  color: var(--text-subtle);
  font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.btn-ghost {
  width: 100%;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 10px;
}

.btn-ghost:hover {
  background: #f7f8f9;
  transform: translateY(-1px);
}

/* Artifact preview modal */
.modal-wide h2 {
  font-size: 22px;
  margin-top: 6px;
  margin-bottom: 14px;
}

.artifact-body {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 60vh;
  overflow-y: auto;
}

/* Hide elements based on auth/chat state */
[data-when="authed"]   { display: none; }
body[data-state="authed"] [data-when="authed"]   { display: inline-flex; }
body[data-state="authed"] [data-when="anon"]     { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .sidebar-column {
    position: static;
    order: 2;
  }
}

@media (max-width: 640px) {
  .site-header,
  .site-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .site-footer {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .footer-right {
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .stepper-wrap {
    margin-bottom: 36px;
  }

  .step-label {
    font-size: 11px;
  }

  .step + .step::before {
    right: calc(50% + 16px);
    left: calc(-50% + 16px);
  }

  .suggestions {
    gap: 8px;
  }

  .suggestion {
    font-size: 12.5px;
    padding: 8px 14px;
  }

}

/* ---------- Sub-stage completion celebration ---------- */
.celebration {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 24px;
  display: flex;
  justify-content: center;
  z-index: 200;
  pointer-events: none;
  padding: 0 16px;
}

.celebration[hidden] {
  display: none;
}

.celebration-card {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.18);
  max-width: 560px;
  width: 100%;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.celebration.is-visible .celebration-card {
  transform: translateY(0);
  opacity: 1;
}

.celebration-check {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background: var(--accent-green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 6px var(--accent-green-soft);
  animation: celebPop 0.4s cubic-bezier(0.18, 1.25, 0.4, 1);
}

@keyframes celebPop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.celebration-text {
  flex: 1;
  min-width: 0;
}

.celebration-eyebrow {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-green);
  font-weight: 600;
}

.celebration-title {
  margin: 2px 0 4px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}

.celebration-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
}

.celebration-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.celebration-actions .btn {
  padding: 8px 14px;
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .celebration-card {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .celebration-actions {
    width: 100%;
    justify-content: stretch;
  }

  .celebration-actions .btn {
    flex: 1;
  }
}
