:root {
  --ink: #17343a;
  --muted: #687c80;
  --faint: #8c9b9d;
  --teal: #176b70;
  --teal-dark: #0f575c;
  --teal-pale: #e8f4f3;
  --mint: #a9d6ce;
  --line: #dce7e6;
  --surface: rgba(255, 255, 255, 0.96);
  --background: #f4f8f8;
  --shadow: 0 20px 55px rgba(36, 79, 82, 0.1);
  --radius: 24px;
}

* { box-sizing: border-box; }

html { background: var(--background); }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% -10%, rgba(169, 214, 206, 0.42), transparent 31rem),
    linear-gradient(180deg, #f7fbfa 0%, #f1f6f6 100%);
  font-family: "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }

button:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(23, 107, 112, 0.28);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one { width: 190px; height: 190px; top: 12%; right: -125px; background: rgba(169, 214, 206, 0.26); }
.ambient-two { width: 140px; height: 140px; bottom: 5%; left: -95px; background: rgba(191, 220, 218, 0.26); }

#app { position: relative; z-index: 1; }

.shell {
  width: min(100%, 580px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
}

.topbar { min-height: 48px; display: grid; grid-template-columns: 50px 1fr 50px; align-items: center; }
.brand-mark { grid-column: 2; justify-self: center; display: flex; align-items: center; gap: 9px; color: var(--teal); font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.brand-icon { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #cae0de; border-radius: 9px; background: #fff; box-shadow: 0 4px 14px rgba(27, 88, 90, .07); }
.brand-icon svg { width: 15px; }

.back-button { grid-column: 1; grid-row: 1; width: 44px; height: 44px; border: 0; border-radius: 50%; color: var(--ink); background: rgba(255,255,255,.8); display: grid; place-items: center; cursor: pointer; }
.back-button svg { width: 21px; }

.progress-wrap { margin: 19px 4px 28px; }
.progress-labels { display: flex; justify-content: space-between; margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 600; }
.progress-track { height: 5px; overflow: hidden; border-radius: 5px; background: #dfe9e8; }
.progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), #5aa89f); transition: width 350ms ease; }

.content { flex: 1; display: flex; flex-direction: column; animation: enter 330ms ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.eyebrow { margin: 0 0 10px; color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: "Newsreader", Georgia, serif; font-weight: 500; letter-spacing: -.025em; }
h1 { max-width: 460px; font-size: clamp(38px, 10vw, 52px); line-height: .98; }
h2 { font-size: clamp(31px, 8vw, 42px); line-height: 1.04; }
.intro { margin: 16px 0 0; color: var(--muted); font-size: 16px; line-height: 1.55; }

.welcome-content { justify-content: center; padding: 7vh 4px 2vh; }
.welcome-kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 25px; color: var(--teal); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #51a99a; box-shadow: 0 0 0 5px rgba(81,169,154,.12); }
.welcome-copy { margin: 22px 0 0; color: var(--ink); font-size: 19px; line-height: 1.5; }
.welcome-copy strong { font-weight: 500; }

.action-area { margin-top: auto; padding-top: 28px; }
.primary-button, .secondary-button { width: 100%; min-height: 58px; border-radius: 16px; font-weight: 700; letter-spacing: .015em; cursor: pointer; transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease; }
.primary-button { border: 0; color: white; background: linear-gradient(135deg, var(--teal), var(--teal-dark)); box-shadow: 0 11px 26px rgba(23,107,112,.2); }
.primary-button:hover { box-shadow: 0 13px 29px rgba(23,107,112,.26); transform: translateY(-1px); }
.primary-button:active { transform: translateY(1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .45; box-shadow: none; transform: none; }
.secondary-button { margin-top: 10px; border: 1px solid var(--line); color: var(--teal-dark); background: rgba(255,255,255,.75); }
.disclaimer { margin: 17px auto 0; max-width: 420px; color: #7d8d8f; font-size: 11px; line-height: 1.5; text-align: center; }
.sync-note { min-height: 24px; margin: 0 0 12px; display: flex; align-items: center; justify-content: center; gap: 9px; color: var(--muted); font-size: 12px; }
.spinner { width: 15px; height: 15px; display: inline-block; border: 2px solid #c5d9d7; border-top-color: var(--teal); border-radius: 50%; animation: spin 700ms linear infinite; }
.spinner.large { width: 31px; height: 31px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
.connection-error { margin: 0 0 14px; padding: 14px 15px; display: grid; gap: 4px; border: 1px solid #e5d8c9; border-radius: 14px; color: #5e5145; background: #fffaf4; font-size: 12px; line-height: 1.45; text-align: left; }
.connection-error strong { font-size: 13px; }
.connection-error button { justify-self: start; margin-top: 5px; padding: 4px 0; border: 0; color: var(--teal-dark); background: transparent; font-size: 11px; font-weight: 700; letter-spacing: .07em; cursor: pointer; }
.connection-error.standalone { width: 100%; margin-top: 28px; }

.options { display: grid; gap: 10px; margin-top: 25px; }
.option { min-height: 59px; width: 100%; padding: 14px 15px; display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 16px; color: #29464b; background: var(--surface); box-shadow: 0 5px 18px rgba(49,90,92,.035); text-align: left; cursor: pointer; }
.option:hover { border-color: #b8d5d1; }
.option.selected { border-color: #69a9a3; background: var(--teal-pale); box-shadow: inset 0 0 0 1px rgba(23,107,112,.08); }
.check { width: 24px; height: 24px; border: 1.5px solid #b7c9c8; border-radius: 7px; display: grid; place-items: center; color: white; background: white; transition: all 150ms ease; }
.option.selected .check { border-color: var(--teal); background: var(--teal); }
.check svg { width: 15px; opacity: 0; transform: scale(.7); transition: all 150ms ease; }
.option.selected .check svg { opacity: 1; transform: scale(1); }
.option-label { font-size: 15px; line-height: 1.35; }

.radio-options .option { grid-template-columns: 24px 1fr; }
.radio-options .check { border-radius: 50%; }
.radio-options .option.selected .check { border: 7px solid var(--teal); background: white; }

.assessment-count { margin-top: 23px; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.scale { margin-top: 30px; padding: 22px 17px 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.scale-values { display: flex; justify-content: space-between; gap: 8px; }
.scale-button { width: 46px; height: 46px; border: 1px solid #cddcdb; border-radius: 50%; color: var(--muted); background: white; font-weight: 700; cursor: pointer; }
.scale-button.selected { border-color: var(--teal); color: white; background: var(--teal); box-shadow: 0 0 0 5px rgba(23,107,112,.1); }
.scale-labels { margin-top: 16px; display: flex; justify-content: space-between; gap: 30px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.scale-labels span:last-child { text-align: right; }

.review-card { margin-top: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.review-section { padding: 20px; }
.review-section + .review-section { border-top: 1px solid var(--line); }
.review-header { display: flex; justify-content: space-between; gap: 15px; align-items: center; }
.review-label { margin: 0; color: var(--teal); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.edit-link { border: 0; color: var(--teal); background: none; font-size: 13px; font-weight: 700; cursor: pointer; }
.summary-list { margin: 13px 0 0; padding: 0; list-style: none; }
.summary-list li { position: relative; padding: 5px 0 5px 17px; color: #3d565b; font-size: 14px; line-height: 1.4; }
.summary-list li::before { content: ""; position: absolute; top: 12px; left: 1px; width: 6px; height: 6px; border-radius: 50%; background: #7db9b1; }
.review-question { margin: 24px 0 0; font-family: "Newsreader", Georgia, serif; font-size: 24px; line-height: 1.2; }

.complete-content { justify-content: center; align-items: center; text-align: center; padding: 4vh 6px 2vh; }
.complete-icon { position: relative; width: 82px; height: 82px; margin-bottom: 29px; display: grid; place-items: center; border-radius: 50%; color: var(--teal); background: var(--teal-pale); }
.complete-icon::after { content: ""; position: absolute; inset: -8px; border: 1px solid rgba(23,107,112,.15); border-radius: 50%; }
.complete-icon svg { width: 38px; }
.complete-content .intro { max-width: 430px; }

.chart-content { padding-top: 13px; }
.chart-id { margin-top: 20px; padding: 20px; border: 1px solid #cfe0df; border-radius: 20px; color: white; background: linear-gradient(135deg, #245e63, #174c51); box-shadow: 0 18px 38px rgba(21,75,80,.18); }
.chart-id-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.patient-number { font-family: "Newsreader", Georgia, serif; font-size: 28px; letter-spacing: .01em; }
.status-pill { padding: 7px 10px; border: 1px solid rgba(255,255,255,.23); border-radius: 999px; color: #d9f2ed; background: rgba(255,255,255,.1); font-size: 10px; font-weight: 700; letter-spacing: .1em; }
.chart-meta { margin-top: 9px; color: rgba(255,255,255,.68); font-size: 11px; }
.chart-status { margin-top: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.status-row { min-height: 58px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.status-row + .status-row { border-top: 1px solid var(--line); }
.status-name { color: #385358; font-size: 14px; }
.status-value { color: var(--faint); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.status-value.done { color: var(--teal); }
.private-note { margin: 20px 0 10px; display: flex; gap: 9px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.private-note svg { flex: 0 0 auto; width: 16px; margin-top: 1px; color: var(--teal); }
.chart-review { box-shadow: none; }
.chart-review details { border-top: 1px solid var(--line); }
.chart-review details:first-child { border-top: 0; }
.chart-review summary { min-height: 59px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; list-style: none; color: #345055; font-weight: 600; cursor: pointer; }
.chart-review summary::-webkit-details-marker { display: none; }
.chart-review summary svg { width: 17px; color: var(--teal); transition: transform 180ms ease; }
.chart-review details[open] summary svg { transform: rotate(180deg); }
.detail-body { padding: 0 18px 18px; }

.reset-button { margin: 20px auto 0; border: 0; color: var(--muted); background: none; font-size: 12px; text-decoration: underline; cursor: pointer; }

@media (min-width: 700px) {
  .shell { padding-top: 28px; padding-bottom: 35px; }
  .content:not(.welcome-content):not(.complete-content) { padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
