:root {
  color-scheme: light;
  --ink: #14201d;
  --muted: #60706b;
  --green: #0b5b4c;
  --green-dark: #08483d;
  --mint: #e8f3ef;
  --paper: #ffffff;
  --line: #d7e1dd;
  --amber: #ef9d22;
  --danger: #a8322d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(circle at top, #edf8f4 0, #f7faf9 45%, #eef3f1 100%);
  color: var(--ink);
}
button, textarea, input { font: inherit; }
.shell { width: min(100% - 24px, 820px); margin: 0 auto; padding: 20px 0 28px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.brand { margin: 0; color: var(--green); font-size: 15px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.subtitle, footer { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.save-status { margin: 0; color: var(--muted); font-size: 13px; font-weight: 750; }
.save-status.error { color: var(--danger); }
.progress-wrap { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; margin-bottom: 14px; color: var(--muted); font-size: 13px; font-weight: 800; }
.progress-track { height: 7px; overflow: hidden; border-radius: 99px; background: #dce7e3; }
.progress-bar { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--amber)); transition: width .2s ease; }
.app-card { min-height: 560px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.96); box-shadow: 0 18px 50px rgba(24,55,45,.09); overflow: hidden; }
.panel { padding: 24px; }
h1 { margin: 0 0 10px; font-size: clamp(26px, 5vw, 38px); line-height: 1.12; }
h2 { margin: 0 0 8px; font-size: 20px; }
p { line-height: 1.55; }
.lead { max-width: 650px; color: var(--muted); font-size: 17px; }
.notice { margin: 18px 0; border-left: 4px solid var(--amber); border-radius: 8px; padding: 13px 14px; background: #fff8e9; color: #5d4316; }
.messages { display: grid; gap: 12px; max-height: 430px; padding: 22px; overflow-y: auto; background: #f8fbfa; scroll-behavior: smooth; }
.message { max-width: 84%; border-radius: 14px; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.message.assistant { justify-self: start; border: 1px solid var(--line); border-bottom-left-radius: 4px; background: var(--paper); }
.message.user { justify-self: end; border-bottom-right-radius: 4px; background: var(--green); color: white; }
.composer { border-top: 1px solid var(--line); padding: 18px 20px 20px; background: var(--paper); }
.question-label { display: block; margin-bottom: 10px; color: var(--green-dark); font-weight: 850; line-height: 1.4; }
textarea { width: 100%; min-height: 105px; resize: vertical; border: 1px solid #bfccc7; border-radius: 12px; padding: 12px 13px; color: var(--ink); background: white; }
textarea:focus, input:focus { outline: 3px solid rgba(11,91,76,.17); border-color: var(--green); }
.actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.button { min-height: 46px; border: 0; border-radius: 10px; padding: 11px 17px; background: var(--green); color: white; cursor: pointer; font-weight: 850; }
.button:hover { background: var(--green-dark); }
.button:disabled { cursor: wait; opacity: .58; }
.button.secondary { border: 1px solid var(--line); background: white; color: var(--muted); }
.button.danger { margin-left: auto; background: transparent; color: var(--danger); }
.hint { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.consent-box { display: flex; align-items: flex-start; gap: 10px; margin: 20px 0; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #f8fbfa; }
.consent-box input { width: 20px; height: 20px; flex: 0 0 auto; }
.summary { display: grid; gap: 0; margin: 20px 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.summary-row { display: grid; grid-template-columns: minmax(150px, .38fr) 1fr; gap: 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.summary-row:last-child { border-bottom: 0; }
.summary-label { color: var(--muted); font-size: 13px; font-weight: 850; }
.summary-value { white-space: pre-wrap; overflow-wrap: anywhere; }
.success { text-align: center; padding: 56px 24px; }
.success-mark { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; background: var(--mint); color: var(--green); font-size: 30px; font-weight: 900; }
footer { padding: 16px 4px 0; text-align: center; }
[hidden] { display: none !important; }

@media (max-width: 620px) {
  .shell { width: min(100% - 16px, 820px); padding-top: 12px; }
  .topbar { align-items: flex-start; }
  .app-card { min-height: calc(100vh - 145px); border-radius: 14px; }
  .panel, .messages { padding: 17px; }
  .composer { padding: 15px; }
  .message { max-width: 93%; }
  .summary-row { grid-template-columns: 1fr; gap: 4px; }
  .actions { align-items: stretch; flex-direction: column; }
  .button, .button.danger { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}
