:root {
  color-scheme: light;
  --paper: #f2f0ea;
  --surface: #fffdfa;
  --ink: #2b2622;
  --muted: #66746f;
  --line: #ded8ca;
  --green: #1f5f4d;
  --green-soft: #dfece4;
  --blue: #dce8ef;
  --gold: #efe4c6;
  --rose: #f0ded9;
  --clay: #c4674a;
  --focus: #184f97;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(31, 95, 77, .08), transparent 30%),
    linear-gradient(315deg, rgba(196, 103, 74, .10), transparent 35%),
    var(--paper);
  color: var(--ink);
  line-height: 1.5;
}

button, input, textarea, select { font: inherit; }

button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 2px;
}

button[disabled] { opacity: .55; cursor: not-allowed; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px clamp(14px, 4vw, 34px);
  background: rgba(247, 245, 238, .94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  min-width: 0;
  text-align: center;
  font-weight: 760;
  overflow-wrap: anywhere;
}

.save-state {
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
}

.shell {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 4vw, 32px) 76px;
}

body[data-home="true"] .shell { width: min(720px, 100%); }
body[data-home="true"] .topbar { grid-template-columns: 1fr; width: min(720px, 100%); margin: 0 auto; }
body[data-home="true"] #backBtn, body[data-home="true"] .save-state, body[data-home="true"] .hero, body[data-home="true"] .progress { display: none; }
body[data-home="true"] .brand { text-align: left; font-size: 13px; }

.hero { padding: clamp(18px, 4vw, 34px) 0 16px; }

.kicker {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, h3 { margin: 0; line-height: 1.08; letter-spacing: 0; }
h1 { max-width: 820px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(36px, 8vw, 66px); font-weight: 500; }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 5vw, 40px); font-weight: 500; }
h3 { font-size: 17px; }

.lead {
  max-width: 760px;
  margin: 18px 0 0;
  color: #4f5f59;
  font-size: 18px;
}

.progress {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
  gap: 6px;
  margin: 20px 0;
}

.dot {
  min-width: 0;
  padding: 10px 5px;
  border-bottom: 3px solid #cfc8b8;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.dot.done, .dot.current { color: var(--green); border-color: var(--green); }

.stage { display: none; animation: enter .22s ease-out; }
.stage.active { display: block; }

.panel, .summary-block, dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.home-panel {
  display: grid;
  gap: 20px;
  min-height: calc(100vh - 120px);
  align-content: center;
  padding: clamp(22px, 5vw, 42px);
}

.panel {
  padding: clamp(16px, 4vw, 28px);
  box-shadow: 3px 4px 0 rgba(43, 38, 34, .08);
}

.start-panel { display: grid; gap: 22px; }
.start-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.greeting p, .muted { color: var(--muted); }

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

.journey-card, .path-card {
  min-height: 116px;
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: start;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  text-align: left;
  background: var(--surface);
}

.journey-card strong, .path-card strong { display: block; margin-bottom: 5px; font-size: 16px; }
.journey-card span, .path-card span { color: var(--muted); }
.glyph {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 800;
}

.path-card:nth-child(3n) .glyph { background: var(--blue); color: #24526a; }
.path-card:nth-child(3n+1) .glyph { background: var(--gold); color: #76551a; }
.path-card:nth-child(3n+2) .glyph { background: var(--rose); color: #8a3c2d; }

.curadoria {
  display: grid;
  gap: 8px;
  max-width: 820px;
  padding: 16px;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: rgba(255, 253, 250, .76);
}

.curadoria p { margin: 0; }

.home-actions {
  display: flex;
  justify-content: flex-end;
}

.conversation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

.question-card {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 3px 4px 0 rgba(43, 38, 34, .08);
}

.question-card > h2 {
  max-width: 760px;
}

.answer-label textarea {
  min-height: 128px;
  font-size: 17px;
}

.example-box {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f5ed;
}

.example-box summary {
  cursor: pointer;
  font-weight: 750;
  color: var(--green);
}

.support-row {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
}

.support-label {
  flex-basis: 100%;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
}

.chip.selected {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.scaffold-panel {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px dashed #bda77a;
  border-radius: 8px;
  background: #fffaf0;
  animation: scaffoldSlide .24s ease-out;
  transform-origin: top;
}

.scaffold-intro {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: rgba(255, 253, 250, .78);
}

.scaffold-intro p,
.scaffold-next {
  margin: 0;
  color: #4f5f59;
}

.original-question {
  font-weight: 750;
  color: var(--ink);
}

.scaffold-pause {
  display: grid;
  gap: 12px;
  justify-items: center;
  padding: 16px 14px;
  border-radius: 8px;
  background: rgba(223, 236, 228, .58);
  text-align: center;
}

.scaffold-pause p {
  margin: 0;
  color: #4f5f59;
}

.pause-title {
  color: var(--green);
  font-weight: 800;
}

.thinking-wave {
  position: relative;
  width: 62px;
  height: 62px;
}

.thinking-wave span {
  position: absolute;
  inset: 14px;
  border: 2px solid rgba(31, 95, 77, .45);
  border-radius: 50%;
  animation: thinkingWave 2.4s ease-out infinite;
}

.thinking-wave span:nth-child(2) { animation-delay: .55s; }
.thinking-wave span:nth-child(3) { animation-delay: 1.1s; }

@media (prefers-reduced-motion: reduce) {
  .thinking-wave span { animation: none; }
}

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

.option-grid button {
  border-radius: 8px;
  text-align: left;
  padding: 10px 12px;
}

.live-summary {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, .92);
}

.live-summary p { margin: 0; color: var(--muted); }

.summary-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, .8);
}

.provisional {
  padding: 18px;
  border-radius: 8px;
  background: var(--green-soft);
  border: 1px solid color-mix(in srgb, var(--green) 28%, transparent);
}

.provisional p {
  margin-bottom: 0;
  font-size: 18px;
}

.choice-note {
  margin: 0;
  color: var(--green);
  font-weight: 750;
}

.pdf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.therapist-card {
  border-left: 5px solid var(--clay);
}

.print-frame {
  position: fixed;
  width: 0;
  height: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 18px;
  align-items: start;
}

.stack { display: grid; gap: 14px; }

label { display: grid; gap: 7px; font-weight: 700; }
label small { color: var(--muted); font-weight: 500; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}
textarea { min-height: 96px; resize: vertical; }

.chips, .choices, .actions, .tabs { display: flex; flex-wrap: wrap; gap: 9px; }
.chip, .choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 650;
}
.chip input, .choice input { width: auto; }

.primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
  font-weight: 760;
}
.secondary { background: var(--green-soft); color: var(--green); border-color: transparent; font-weight: 760; }
.quiet { background: transparent; border-color: transparent; color: var(--muted); }
.danger { color: #8a2f22; border-color: #e1b6ad; background: #fff7f4; }

.side-panel {
  position: sticky;
  top: 76px;
  display: grid;
  gap: 12px;
}

.summary-block {
  padding: 16px;
  display: grid;
  gap: 10px;
}
.summary-block h3 { color: var(--green); }
.summary-list { margin: 0; padding-left: 18px; }
.summary-list li { margin: 4px 0; }

.therapist {
  border-left: 5px solid var(--clay);
}
.shared {
  border-left: 5px solid var(--green);
}

.scaffold-box {
  border: 1px dashed #cbbf9f;
  border-radius: 8px;
  padding: 14px;
  background: #fffaf0;
}

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

.mini-card {
  padding: 13px;
  border-radius: 8px;
  background: #f8f5ed;
  border: 1px solid var(--line);
}

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

.footer-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

dialog {
  width: min(460px, calc(100vw - 28px));
  padding: 0;
}
dialog::backdrop { background: rgba(30, 26, 22, .38); }
.dialog-body { display: grid; gap: 14px; padding: 22px; }

@media (max-width: 820px) {
  .topbar { grid-template-columns: auto 1fr; }
  .save-state { grid-column: 1 / -1; justify-self: start; }
  .home-grid, .journey-grid, .path-grid, .two-col, .review-grid, .status-row, .conversation-layout, .option-grid { grid-template-columns: 1fr; }
  .side-panel, .live-summary { position: static; }
  .progress { grid-template-columns: 1fr; }
  .dot { text-align: left; border-bottom-width: 1px; }
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes scaffoldSlide {
  from { opacity: 0; transform: translateY(-8px) scaleY(.98); }
  to { opacity: 1; transform: translateY(0) scaleY(1); }
}

@keyframes thinkingWave {
  0% { opacity: .62; transform: scale(.35); }
  70% { opacity: .18; }
  100% { opacity: 0; transform: scale(1.8); }
}

.crisis-note {
  width: min(1080px, 100%);
  margin: 0 auto;
  padding: 6px clamp(16px, 4vw, 32px) 30px;
  color: var(--muted);
  font-size: 13px;
}
.crisis-note p { margin: 0; }
.crisis-note a { color: var(--green); }

body[data-locked="true"] #backBtn,
body[data-locked="true"] .save-state,
body[data-locked="true"] .hero,
body[data-locked="true"] .progress { display: none; }

.gate-form { display: grid; gap: 12px; max-width: 460px; }

.backup-note { margin: 0; }
