:root {
  color-scheme: light;
  --font-body: "Segoe UI", Arial, sans-serif;
  --font-display: "Segoe UI", Arial, sans-serif;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --radius-card: 17px;
  --radius-control: 10px;
  --radius-pill: 99px;
  --border-width: 1px;
  --ink: #24352f;
  --muted: #68756e;
  --green: #426c59;
  --green-dark: #315440;
  --green-pale: #edf3ed;
  --cream: #f5f7f2;
  --paper: #fff;
  --line: #e4e9e2;
  --error: #a53e35;
  --shadow: 0 14px 42px rgb(43 63 50 / 7%);
  font-family: var(--font-body);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 90% 4%, rgb(228 236 224 / 52%), transparent 32rem),
    var(--cream);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(100% - 32px, 900px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  display: grid;
  place-items: center;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.brand-title {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.025em;
  line-height: 1.2;
}

.brand-trademark {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
}

.brand-tagline {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.35;
}

.privacy-dialog {
  width: min(calc(100% - 32px), 520px);
  max-width: 520px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 80px rgb(25 38 29 / 24%);
}

.privacy-dialog::backdrop {
  background: rgb(25 38 29 / 54%);
  backdrop-filter: blur(3px);
}

.privacy-dialog-content {
  padding: clamp(24px, 6vw, 38px);
}

.privacy-dialog h2 {
  margin: 0 0 16px;
  font-size: clamp(23px, 5vw, 29px);
}

.privacy-dialog-content > div {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.privacy-dialog-content > div p {
  margin: 0 0 13px;
}

.privacy-dialog-content strong {
  color: var(--ink);
}

.privacy-dialog .primary-button {
  width: 100%;
  margin-top: 10px;
}

.app-main {
  width: 100%;
  flex: 1;
  padding: var(--space-5) 0 var(--space-7);
}

.print-copy {
  display: none;
}

.welcome,
.completion {
  width: min(100%, 660px);
  margin: var(--space-6) auto 0;
  padding: clamp(26px, 6vw, 54px);
  border: 1px solid rgb(228 233 226 / 80%);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: var(--shadow);
  text-align: center;
}

.eyebrow {
  margin: 0 0 13px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -.045em;
}

.welcome h1,
.completion h1 {
  max-width: 540px;
  margin: 0 auto 14px;
  font-size: clamp(32px, 8vw, 48px);
  line-height: 1.12;
}

.welcome-subtitle {
  max-width: 450px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(16px, 3.5vw, 18px);
  line-height: 1.6;
}

.welcome-illustration {
  width: 82px;
  height: 82px;
  margin: 0 auto 25px;
  display: grid;
  place-items: center;
  border-radius: 26px;
  background: var(--green-pale);
  color: var(--green);
}

.welcome-illustration img {
  width: 44px;
  height: 44px;
}

.welcome-details {
  max-width: 460px;
  margin: var(--space-6) auto var(--space-6);
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.privacy-note {
  max-width: 450px;
  margin: var(--space-5) auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.primary-button,
.secondary-button,
.text-button {
  min-height: 52px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  transition: background-color .16s ease, transform .16s ease, border-color .16s ease;
}

.primary-button {
  min-width: 190px;
  padding: 0 25px;
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
}

.primary-button:hover {
  border-color: var(--green-dark);
  background: var(--green-dark);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: .7;
}

.primary-button:active,
.secondary-button:active {
  transform: translateY(1px);
}

.secondary-button {
  padding: 0 20px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.secondary-button:hover {
  border-color: #c8d5c9;
  background: #f8faf7;
}

.text-button {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--green);
}

.text-button:hover {
  color: var(--green-dark);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
}

.resume-row {
  margin-top: 13px;
}

.resume-row .text-button {
  font-size: 14px;
}

.record {
  width: min(100%, 720px);
  margin: 0 auto;
}

.progress-block {
  margin: 0 auto 26px;
  padding: 0 2px;
}

.progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 11px;
}

.progress-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.progress-count {
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: #e4e9e2;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width .25s ease;
}

.form-heading {
  margin-bottom: var(--space-5);
}

.form-heading h1 {
  margin: 0 0 6px;
  font-size: clamp(27px, 6vw, 34px);
  line-height: 1.2;
}

.form-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.form-section {
  margin: 0 0 var(--space-4);
  padding: clamp(20px, 5vw, 27px);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 5px 18px rgb(43 63 50 / 3%);
}

.section-heading {
  margin: 0 0 19px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.025em;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4) 20px;
}

.field {
  min-width: 0;
}

.field label,
.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.optional {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.text-input,
.select-input,
.text-area {
  width: 100%;
  min-height: 48px;
  padding: 12px 13px;
  border: var(--border-width) solid #dce3db;
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--ink);
  font-size: 15px;
}

.text-area {
  min-height: 84px;
  resize: vertical;
  line-height: 1.5;
}

.text-area.meal-area {
  min-height: 76px;
}

.text-input::placeholder,
.text-area::placeholder {
  color: #707d75;
}

.select-input {
  padding-right: 36px;
}

.scale-input {
  max-width: 160px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.choice-card {
  min-height: 46px;
  position: relative;
}

.choice-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.choice-card span {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid #dce3db;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  text-align: center;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}

.choice-card input:checked + span {
  border-color: #9fb8a4;
  background: var(--green-pale);
  color: var(--green-dark);
  font-weight: 700;
}

.choice-card input:focus-visible + span {
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

.symptom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.symptom-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.symptom-option {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid #e1e6df;
  border-radius: 10px;
  color: #536159;
  cursor: pointer;
  font-size: 13px;
}

.symptom-option:has(input:checked) {
  border-color: #a7bca9;
  background: #f4f8f3;
  color: var(--green-dark);
}

.symptom-option input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--green);
}

.other-symptom {
  margin-top: 13px;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.radio-option {
  min-height: 46px;
  min-width: 108px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border: 1px solid #dce3db;
  border-radius: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
}

.radio-option:has(input:checked) {
  border-color: #9fb8a4;
  background: var(--green-pale);
  color: var(--green-dark);
  font-weight: 600;
}

.radio-option input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--green);
}

.form-error {
  min-height: 0;
  margin: 0;
  color: var(--error);
  font-size: 13px;
}

.form-error:not(:empty) {
  margin: 14px 0 0;
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.form-actions-start {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.action-status {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--green-dark);
  font-size: 13px;
  line-height: 1.55;
}

.action-status:empty {
  display: none;
}

.action-status.error {
  color: var(--error);
}

.day-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: 14px;
}

.copy-instructions {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  text-align: left;
}

.storage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: center;
  margin-top: 15px;
}

.completion-actions {
  flex-wrap: wrap;
}

.send-practitioner {
  margin: 24px 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--green-pale);
  text-align: left;
}

.send-practitioner h2 {
  margin: 0;
  font-size: 19px;
}

.send-practitioner > p:not(.action-status) {
  margin: 8px 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.send-practitioner .primary-button {
  width: 100%;
}

.completion-actions .secondary-button,
.completion-actions .primary-button {
  min-width: 150px;
}

.install-button {
  min-width: auto;
  white-space: nowrap;
}

.form-actions .primary-button {
  min-width: 175px;
}

.completion-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 22px;
  border-radius: 50%;
  background: var(--green-pale);
  color: var(--green);
}

.completion-icon svg {
  width: 31px;
  height: 31px;
}

.completion-intro {
  margin: 0 auto 27px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.summary {
  width: min(100%, 720px);
  margin: 0 auto;
  text-align: left;
}

.summary-header {
  margin-bottom: 17px;
}

.summary-header h2 {
  margin: 0 0 5px;
  font-size: 22px;
}

.summary-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.summary-day {
  margin-bottom: 13px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfcfa;
}

.summary-day h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.summary-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 11px 20px;
  margin: 0;
}

.summary-item dt {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.summary-item dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.completion-actions {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-2);
  margin: 25px 0 0;
}

.site-footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 14px 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.pwa-status:not(:empty) {
  flex-basis: 100%;
  color: var(--muted);
  line-height: 1.5;
}

.footer-dot {
  width: var(--space-1);
  height: var(--space-1);
  border-radius: 50%;
  background: #a6b0a8;
}

.visually-hidden {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (min-width: 600px) {
  .page-shell {
    width: min(100% - 56px, 900px);
  }

  .app-main {
    padding-top: 30px;
  }

  .field-grid.two-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .choice-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .symptom-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .completion-actions {
    flex-direction: row;
  }
}

@media (max-width: 520px) {
  .site-header {
    min-height: 70px;
    gap: 4px;
  }

  .header-actions {
    gap: 4px;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .brand-name {
    max-width: 145px;
    font-size: 13px;
  }

  .brand-trademark {
    font-size: 8px;
  }

  .form-actions:not(.form-actions-start) {
    align-items: stretch;
  }

  .form-actions:not(.form-actions-start) button {
    min-width: 0;
    padding-inline: 12px;
  }
}

@media print {
  @page {
    margin: 14mm;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .page-shell {
    width: 100%;
  }

  .site-header,
  .site-footer,
  .completion-actions,
  .day-record-actions,
  .storage-actions,
  .action-status,
  .privacy-note,
  .privacy-dialog {
    display: none;
  }

  .record,
  .completion {
    display: none !important;
  }

  .print-copy {
    display: block !important;
  }

  .app-main {
    padding: 0;
  }

  .completion {
    width: 100%;
    margin: 0;
    padding: 10px 0;
    border: 0;
    box-shadow: none;
  }

  .summary-day {
    break-inside: avoid;
    border-color: #bbb;
    background: #fff;
  }

  .summary-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
