/* Nineod Project Builder (PRD) — styled to match the nineod landing page
   (app/assets/stylesheets/vendor/custom/application_nineod/landing.scss). */

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

:root {
  --blue: #4263eb;
  --blue-dark: #3451d1;
  --blue-soft: #eef1fe;
  --ink: #111a2e;
  --text: #5b6478;
  --text-muted: #8a93a6;
  --border: #e7eaf1;
  --bg: #fff;
  --bg-soft: #f6f7fb;
  --bg-tint: #f3f5fd;
  --radius: 12px;
  --heading-font: 'Manrope', 'DM Sans', system-ui, sans-serif;
  --body-font: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --shadow-card: 0 20px 40px -24px rgba(17, 26, 46, .25);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--body-font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- shared ---------- */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.eyebrow::before,
.eyebrow::after {
  content: '';
  width: 22px;
  height: 2px;
  background: var(--blue);
}

.section-header .eyebrow::before,
.section-header .eyebrow::after {
  display: none;
}

/* ---------- header ---------- */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1120px;
  min-height: 72px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}

.logo-text {
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.04em;
}

.logo-dot {
  color: var(--blue);
}

.logo-sub {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-left: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.logo-beta {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
}

nav {
  display: flex;
  gap: 32px;
}

nav a {
  color: #4a5266;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: color .2s;
}

nav a:hover {
  color: var(--blue);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
}

.btn-primary:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.btn-ghost,
.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--ink);
}

.btn-outline {
  padding: 12px 20px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.btn-ghost:hover,
.btn-outline:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none !important;
}

.btn:focus-visible,
.btn-outline:focus-visible,
.btn-generate:focus-visible,
.fund-option:focus-visible {
  outline: 3px solid rgba(66, 99, 235, .35);
  outline-offset: 2px;
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 152px 20px 88px;
  text-align: center;
  background: linear-gradient(180deg, #fff 30%, var(--bg-tint) 100%);
}

.hero-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.hero-glow::before {
  content: '';
  position: absolute;
  top: 60px;
  right: -120px;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  background: linear-gradient(160deg, #dfe4fd, #eef0fd);
}

.hero-glow::after {
  content: '';
  position: absolute;
  bottom: -160px;
  left: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: linear-gradient(160deg, #eef0fd, #f6f7fb);
}

.hero-inner {
  max-width: 880px;
  margin: 0 auto;
  position: relative;
}

h1 {
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.045em;
  margin-bottom: 24px;
}

.h1-accent {
  display: block;
  color: var(--blue);
}

.hero-sub {
  max-width: 620px;
  margin: 0 auto 44px;
  color: var(--text);
  font-size: 18px;
  line-height: 1.75;
}

/* ---------- idea input ---------- */
.input-wrapper {
  max-width: 768px;
  margin: 0 auto;
  position: relative;
  text-align: left;
}

.input-glow {
  display: none;
}

.input-box {
  position: relative;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 30px 60px -30px rgba(17, 26, 46, .3);
  transition: border-color .2s, box-shadow .2s;
}

.input-wrapper:focus-within .input-box {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(66, 99, 235, .12), 0 30px 60px -30px rgba(17, 26, 46, .3);
}

.textarea-wrapper {
  position: relative;
}

textarea {
  width: 100%;
  min-height: 130px;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  padding: 16px;
}

textarea::placeholder {
  color: var(--text-muted);
}

#user-prompt {
  display: block;
  max-height: 320px;
  overflow-y: auto;
}

.input-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 12px;
  gap: 16px;
  border-top: 1px solid var(--border);
}

#prd-start-verification {
  padding: 8px 12px 16px;
}

#prd-start-captcha > div {
  margin-inline: auto;
}

#prd-start-message {
  padding: 0 12px 16px;
  font-size: 14px;
  line-height: 1.5;
}

#prd-start-message:empty {
  display: none;
}

.prd-captcha-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
  text-align: left;
}

.prd-captcha-notice svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--blue);
}

.prd-captcha-notice strong {
  color: var(--ink);
  font-weight: 600;
}

.prd-captcha-notice a {
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 2px;
}

#prd-start-captcha-notice {
  margin: 4px 12px 12px;
}

.input-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.category-badge-container {
  margin-right: auto;
  pointer-events: none;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  background: var(--blue-soft);
  color: var(--blue);
  white-space: nowrap;
  animation: popIn .3s ease;
}

.category-badge svg {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
  stroke: var(--blue);
}

.suggestions-container {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  animation: slideDown .3s ease;
}

.suggestion-item {
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s, color .2s;
  white-space: nowrap;
}

.suggestion-item:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.btn-generate {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border: none;
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .2s, transform .2s;
}

.btn-generate:hover:not(:disabled) {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

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

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ---------- sections ---------- */
.section {
  max-width: 1120px;
  margin: 0 auto;
  padding: 96px 20px;
}

.section-header {
  max-width: 640px;
  margin: 0 auto 48px;
  text-align: center;
}

.section-header h2 {
  max-width: 560px;
  margin: 0 auto 16px;
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.035em;
}

.section-header p {
  color: var(--text);
  font-size: 16px;
  line-height: 1.7;
}

section,
.section {
  scroll-margin-top: 72px;
}

.eyebrow-plain::before,
.eyebrow-plain::after {
  display: none;
}

.h2 {
  margin-bottom: 20px;
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.035em;
}

.h2-line {
  display: block;
}

.body-text {
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.75;
}

.btn-lg {
  padding: 14px 22px;
  font-size: 15px;
}

.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
}

.icon-box svg {
  width: 18px;
  height: 18px;
}

/* our approach */
.approach-intro {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  margin-bottom: 64px;
}

.strengths {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.strength {
  padding: 32px 32px 40px;
}

.strength:first-child {
  padding-left: 0;
}

.strength + .strength {
  border-left: 1px solid var(--border);
}

.strength .icon-box {
  margin-bottom: 26px;
}

.strength-title,
.step-title {
  margin-bottom: 14px;
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -.02em;
}

.strength .body-text {
  margin-bottom: 0;
}

/* how it works */
.section-band {
  background: var(--bg-soft);
}

.steps {
  max-width: 800px;
  margin: 0 auto;
  list-style: none;
}

.step {
  display: grid;
  grid-template-columns: 64px 1fr 1.15fr;
  gap: 8px 24px;
  padding: 28px 0;
  border-top: 1px solid var(--border);
}

.step-num {
  padding-top: 3px;
  color: #7c87a0;
  font-size: 14px;
  font-weight: 700;
}

.step-title {
  margin-bottom: 0;
}

.step-desc {
  font-size: 14px;
  line-height: 1.75;
}

.steps-cta {
  margin-top: 48px;
  text-align: center;
}

/* features — same column-with-dividers look as the landing "three strengths" */
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.feat-card {
  padding: 32px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transition: background-color .2s;
}

.feat-card:hover {
  background: var(--bg-soft);
}

.feat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-bottom: 24px;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
}

.feat-icon svg {
  width: 20px;
  height: 20px;
}

.feat-title {
  margin-bottom: 10px;
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.feat-desc {
  font-size: 14px;
  line-height: 1.7;
}

/* ---------- flow cards (chat, fundamentals, overview) ---------- */
#overview-section,
#review-revision-notice {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px 64px;
  display: none;
}

#review-revision-notice {
  margin-block: 24px;
  padding-bottom: 0;
}

#review-revision-instruction {
  margin: 8px 0 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#overview-section.show {
  display: block;
  animation: fadeUp .4s ease;
}

.flow-section {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px 64px;
  display: none;
}

.flow-section.show {
  display: block;
  animation: fadeUp .4s ease;
}

/* The flow sections sit right below the tinted hero. */
.flow-section.show,
#overview-section.show {
  padding-top: 8px;
}

.result-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.result-title {
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.result-subtitle {
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 14px;
}

.result-meta {
  display: flex;
  gap: 12px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.overview-body {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.result-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

/* chat */
.chat-card {
  padding: 24px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(60vh, 560px);
  min-height: 220px;
  overflow-y: auto;
  padding: 20px 4px;
  border-top: 1px solid var(--border);
  scroll-behavior: smooth;
}

.chat-msg {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  max-width: 85%;
  animation: fadeUp .25s ease;
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-family: var(--heading-font);
  font-size: 13px;
  font-weight: 800;
}

.chat-bubble {
  padding: 11px 15px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-msg.assistant .chat-bubble {
  background: #f1f3f8;
  color: var(--ink);
}

.chat-msg.user .chat-bubble {
  background: var(--blue);
  color: #fff;
}

.chat-msg.typing .chat-bubble {
  display: flex;
  gap: 5px;
  padding: 15px 17px;
}

.chat-msg.typing .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: typingDot 1.2s infinite ease-in-out;
}

.chat-msg.typing .dot:nth-child(2) { animation-delay: .15s; }
.chat-msg.typing .dot:nth-child(3) { animation-delay: .3s; }

.chat-choice {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0 16px 40px;
}

.chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color .2s, box-shadow .2s;
}

.chat-composer:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(66, 99, 235, .12);
}

.chat-composer textarea {
  min-height: 48px;
  max-height: 160px;
  padding: 10px 12px;
  font-size: 15px;
  resize: none;
  overflow-y: auto;
}

.chat-composer textarea:disabled {
  opacity: .6;
  cursor: progress;
}

.chat-composer .btn-generate {
  padding: 12px 16px;
}

.flow-footer {
  margin-top: 16px;
  text-align: center;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link:hover {
  color: var(--blue);
}

/* open questions (card shared with the old fundamentals styles) */
.fund-progress-bar {
  height: 4px;
  margin-bottom: 28px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.fund-progress-fill {
  height: 100%;
  width: 0;
  background: var(--blue);
  transition: width .3s ease;
}

.fund-question {
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -.02em;
}

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

.fund-option {
  text-align: left;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}

.fund-option:hover {
  border-color: var(--blue);
}

.fund-option.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 1px var(--blue) inset;
}

.fund-option.not-sure {
  color: var(--text-muted);
  font-style: italic;
}

.fund-option.not-sure.selected {
  color: var(--ink);
}

.fund-note {
  min-height: 70px;
  margin-top: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.fund-note:focus {
  border-color: var(--blue);
}

#fund-back:disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* open questions */
.fund-answer {
  width: 100%;
  min-height: 110px;
  margin: 0 0 12px;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
}

.fund-answer:disabled {
  background: var(--bg-soft);
  color: var(--text-muted);
}

#fund-not-sure {
  width: auto;
}

/* client Draft PRD editor */
.draft-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
}

.draft-document {
  min-width: 0;
}

.draft-document .result-header > :first-child {
  flex: 1;
  min-width: 0;
}

.draft-document .result-title,
.draft-document .result-subtitle {
  overflow-wrap: anywhere;
}

.draft-editor {
  position: relative;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.draft-tabs {
  display: flex;
  gap: 4px;
  padding: 6px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}

.draft-tab {
  padding: 7px 14px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.draft-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(17, 26, 46, .08);
}

.draft-tab:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.draft-tab:focus-visible {
  outline: 3px solid rgba(66, 99, 235, .35);
}

.draft-preview,
.draft-textarea {
  height: 620px;
  overflow-y: auto;
}

.draft-textarea {
  display: block;
  width: 100%;
  padding: 18px 20px;
  border: none;
  outline: none;
  resize: none;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
}

.draft-textarea[readonly] {
  background: var(--bg-soft);
  color: var(--text);
}

.markdown-body {
  padding: 20px 24px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
  color: var(--ink);
  font-family: var(--heading-font);
  letter-spacing: -.02em;
  line-height: 1.3;
}

.markdown-body h1 { font-size: 24px; margin: 0 0 16px; }
.markdown-body h2 { font-size: 19px; margin: 28px 0 10px; padding-top: 20px; border-top: 1px solid var(--border); }
.markdown-body h3 { font-size: 15px; margin: 18px 0 6px; }
.markdown-body p { margin: 0 0 12px; }
.markdown-body ul,
.markdown-body ol { margin: 0 0 12px; padding-left: 22px; }
.markdown-body li { margin-bottom: 4px; }
.markdown-body strong { color: var(--ink); }

.markdown-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin-bottom: 12px;
}

.markdown-body th,
.markdown-body td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  text-align: left;
}

.draft-revising {
  position: absolute;
  left: 50%;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-card);
}

.draft-side-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.draft-ai,
.document-explanation-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-tint);
}

.draft-ai.locked {
  opacity: .55;
}

.draft-ai-title {
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 15px;
  font-weight: 700;
}

.draft-ai-sub {
  margin: 4px 0 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.draft-ai-messages {
  flex: 1;
  min-height: 160px;
  max-height: 430px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.draft-ai-messages .chat-msg {
  max-width: 100%;
}

.draft-ai-messages .chat-bubble {
  font-size: 13px;
}

.draft-ai-empty {
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.draft-ai-composer {
  margin-top: auto;
  background: #fff;
}

.draft-ai-remaining {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: right;
}

#draft-save-state[data-state="unsaved"],
#draft-save-state[data-state="saving"] {
  color: #b7791f;
}

#draft-save-state[data-state="error"] {
  color: #c53030;
}

/* next steps (Draft PRD page) */
.next-steps {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.next-steps-title {
  margin-bottom: 14px;
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 16px;
  font-weight: 700;
}

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

.next-step {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, transform .15s;
}

.next-step:hover:not(:disabled) {
  border-color: var(--blue);
  transform: translateY(-1px);
}

.next-step.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.next-step.primary:hover:not(:disabled) {
  background: var(--blue-dark);
}

.next-step.subtle {
  background: var(--bg-soft);
}

.next-step:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.next-step:focus-visible,
.ns-chip:focus-visible {
  outline: 3px solid rgba(66, 99, 235, .35);
  outline-offset: 2px;
}

.next-step-name {
  font-size: 15px;
  font-weight: 700;
}

.next-step-desc {
  font-size: 13px;
  line-height: 1.5;
  opacity: .8;
}

/* next step modal */
.modal.modal-wide {
  max-width: 960px;
}

.ns-field {
  margin-bottom: 18px;
}

.ns-custom {
  margin-top: 12px;
}

.ns-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ns-label-row label {
  margin-bottom: 8px;
}

.ns-currency {
  width: auto;
  margin-bottom: 8px;
  padding: 6px 10px;
  font-size: 13px;
}

.ns-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ns-chip {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background-color .15s;
}

.ns-chip:hover {
  border-color: var(--blue);
}

.ns-chip.selected {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 1px var(--blue) inset;
}

.ns-chip.not-sure {
  color: var(--text-muted);
  font-style: italic;
}

input[type="date"] {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}

/* read-only proposal preview */
.draft-layout.single {
  grid-template-columns: minmax(0, 1fr);
}

/* WhatsApp button */
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 6px;
  background: #25d366;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.btn-whatsapp:hover {
  background: #1ebe5b;
}

/* Discuss Later + done */
.later-summary {
  max-height: 520px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.done-card {
  text-align: center;
}

.done-icon {
  margin-bottom: 12px;
  font-size: 40px;
}

.done-text {
  max-width: 560px;
  margin: 12px auto 6px;
  color: var(--text);
  line-height: 1.6;
}

.done-key {
  color: var(--text-muted);
  font-size: 13px;
}

.done-actions {
  justify-content: center;
}

/* ---------- modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 26, 46, .45);
  backdrop-filter: blur(6px);
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn .2s ease;
}

.modal {
  width: 100%;
  max-width: 720px;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding: 36px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 30px 80px -20px rgba(17, 26, 46, .45);
  animation: slideUp .25s ease;
}

.modal h3 {
  margin-bottom: 8px;
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.03em;
}

.modal p {
  margin-bottom: 24px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

input[type="email"],
input[type="text"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  margin-bottom: 20px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(66, 99, 235, .12);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ---------- Project Builder account ---------- */
#prd-auth-password-note {
  margin-top: 16px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.prd-ideas-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.prd-ideas-header #prd-ideas-title {
  margin-bottom: 0;
}

#prd-account-new-idea {
  padding: 10px 14px;
  font-size: 13px;
}

#prd-account-new-idea-note {
  font-size: 13px;
  line-height: 1.5;
}

.prd-ideas-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.prd-idea-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  text-align: left;
  font-family: inherit;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.prd-idea-card:hover,
.prd-idea-card:focus-visible {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.prd-idea-card:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.prd-idea-card:disabled {
  opacity: .6;
  cursor: wait;
}

.prd-idea-title {
  color: var(--ink);
  font-size: 14px;
}

.prd-idea-description {
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.prd-idea-action {
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
}

#prd-ideas-title {
  margin-bottom: 12px;
  color: var(--ink);
}

.draft-reopen-note {
  margin-top: 16px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

#prd-auth-modal .modal {
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
}

#prd-auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

#prd-auth-form input {
  margin-bottom: 0;
}

#prd-auth-message {
  margin: 0;
  overflow-wrap: anywhere;
}

#prd-auth-message:empty {
  display: none;
}

#prd-auth-note {
  margin: 16px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

#prd-captcha {
  text-align: center;
}

#prd-captcha > div {
  margin-inline: auto;
}

#prd-auth-form .modal-actions {
  margin-top: 0;
  align-items: stretch;
}

#prd-auth-form .modal-actions > button {
  flex: 1;
  min-width: 0;
}

.prd-auth-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.prd-auth-links .btn-outline {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-color: transparent;
  color: var(--blue);
}

.prd-auth-links .btn-outline:hover {
  background: var(--blue-soft);
}

@media (max-width: 480px) {
  #prd-auth-modal {
    padding: 16px;
  }

  #prd-auth-modal .modal {
    max-height: calc(100dvh - 32px);
    padding: 24px 16px;
  }
}

/* ---------- toasts ---------- */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  box-shadow: 0 16px 40px -16px rgba(17, 26, 46, .35);
  animation: toastIn .25s ease;
}

.toast.success { border-left: 3px solid #22a05a; }
.toast.error { border-left: 3px solid #e5484d; }
.toast.info { border-left: 3px solid var(--blue); }

.toast-msg {
  flex: 1;
  line-height: 1.45;
}

.toast-close {
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 13px;
}

.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-copy {
  margin-left: 6px;
}

.footer-links {
  display: flex;
  gap: 20px;
}

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

footer a:hover {
  color: var(--blue);
}

/* ---------- loading overlay ---------- */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(10px);
}

#loading-overlay.show {
  display: flex;
  animation: fadeIn .2s ease;
}

.loading-spinner {
  width: 52px;
  height: 52px;
  border: 3px solid var(--blue-soft);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.loading-text {
  color: var(--ink);
  font-family: var(--heading-font);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.loading-sub {
  max-width: 320px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

/* ---------- animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes typingDot {
  0%, 60%, 100% { opacity: .3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ---------- responsive ---------- */
@media (max-width: 991px) {
  .next-steps-grid {
    grid-template-columns: 1fr;
  }

  .draft-layout {
    grid-template-columns: 1fr;
  }

  .draft-ai-messages {
    max-height: 280px;
  }

  nav {
    display: none;
  }

  .approach-intro {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 48px;
  }

  .strengths {
    grid-template-columns: 1fr;
    border-bottom: 0;
  }

  .strength,
  .strength:first-child {
    padding: 32px 0;
    border-bottom: 1px solid var(--border);
  }

  .strength + .strength {
    border-left: 0;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .header-inner {
    padding: 0 16px;
    gap: 12px;
  }

  .header-actions .btn {
    padding: 10px 12px;
    font-size: 13px;
  }

  .header-actions > .btn:last-child {
    display: none;
  }

  .logo-sub {
    display: none;
  }

  .step {
    grid-template-columns: 40px 1fr;
  }

  .step-desc {
    grid-column: 2;
  }

  .hero {
    padding: 120px 20px 64px;
  }

  .hero-sub {
    font-size: 16px;
  }

  .section {
    padding: 72px 20px;
  }

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

  .input-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .input-footer-right {
    width: 100%;
  }

  .btn-generate {
    width: 100%;
    justify-content: center;
  }

  .flow-section,
  #overview-section,
  #review-revision-notice {
    padding: 0 16px 48px;
  }

  #review-revision-notice {
    padding-bottom: 0;
  }

  .chat-card,
  .flow-section .result-card,
  #overview-section .result-card,
  #review-revision-notice .result-card {
    padding: 18px;
  }

  .modal-overlay {
    padding: 16px;
  }

  .modal {
    max-height: calc(100dvh - 32px);
    padding: 24px 20px;
  }

  .chat-msg {
    max-width: 95%;
  }

  .chat-choice {
    padding-left: 0;
  }

  .chat-choice > * {
    flex: 1 1 100%;
    justify-content: center;
  }

  .draft-preview,
  .draft-textarea {
    height: 460px;
  }

  .markdown-body {
    padding: 16px;
  }

  .chat-composer .btn-generate {
    width: auto;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
  }
}
/* Document tools keep historical previews separate from the active editor. */
.modal.document-tool-modal { max-width: 1200px; }
.document-version-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.document-version-list button { text-align: left; white-space: normal; }
.document-version-list button[aria-pressed="true"] { outline: 2px solid var(--accent, #3579eb); outline-offset: 2px; }
.document-history-preview { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e5e7eb; }
.document-explanation-panel { margin-top: auto; }
#document-explanation-label { font-size: 13px; margin-bottom: 10px; color: var(--ink); }
#document-explanation-answer { max-height: 300px; overflow-y: auto; overflow-wrap: anywhere; padding: 0; font-size: 13px; }
#document-explanation-answer:empty { display: none; }
#document-explanation-answer:not(:empty) { margin-bottom: 12px; }
#document-explanation-status { font-size: 12px; color: var(--text-muted); margin: 8px 0 0; }
