:root {
  color-scheme: light;
  --cream: #f6f1e8;
  --paper: #fcfaf6;
  --white: #ffffff;
  --sage: #9ead9a;
  --sage-soft: #dfe6dc;
  --green: #355a4a;
  --green-dark: #29473b;
  --copper: #b9785b;
  --copper-soft: #edd8cc;
  --charcoal: #343434;
  --muted: #6d6b65;
  --line: #e4dbcf;
  --danger: #9f473b;
  --shadow: 0 18px 50px rgba(53, 44, 37, 0.1);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --tap: 48px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--cream);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--charcoal);
  background:
    radial-gradient(circle at 8% -10%, rgba(185, 120, 91, 0.12), transparent 30rem),
    linear-gradient(180deg, var(--paper), var(--cream));
  font-size: 17px;
  line-height: 1.55;
}

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

button,
label,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(185, 120, 91, 0.5);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 12px 16px;
  color: var(--white);
  background: var(--green-dark);
  border-radius: 10px;
  transition: top 0.2s ease;
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 74px;
  padding: 12px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid rgba(228, 219, 207, 0.85);
  background: rgba(252, 250, 246, 0.92);
  backdrop-filter: blur(16px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-lockup p {
  margin: 0;
  line-height: 1.15;
}

.brand-name {
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-method {
  margin-top: 3px !important;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid var(--copper);
  border-radius: 50%;
}

.brand-mark::before,
.brand-mark span {
  content: "";
  position: absolute;
  border: 2px solid var(--copper);
  border-radius: 50%;
}

.brand-mark::before {
  width: 21px;
  height: 21px;
}

.brand-mark span {
  width: 7px;
  height: 7px;
  background: var(--copper);
}

.icon-button {
  display: grid;
  width: var(--tap);
  height: var(--tap);
  padding: 0;
  place-items: center;
  color: var(--green);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  cursor: pointer;
}

.icon-button svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

main {
  width: 100%;
}

#app {
  width: min(100% - 32px, 820px);
  margin: 0 auto;
  padding: 28px 0 max(52px, env(safe-area-inset-bottom));
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  align-items: center;
  justify-content: center;
  padding: 0 18px max(28px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--green-dark);
  font-weight: 760;
  text-decoration-color: rgba(53, 90, 74, 0.35);
  text-underline-offset: 3px;
}

.site-footer a:hover {
  text-decoration-color: currentColor;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--charcoal);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

h1 {
  margin-bottom: 18px;
  font-size: clamp(2.15rem, 8vw, 4rem);
}

h2 {
  margin-bottom: 14px;
  font-size: clamp(1.65rem, 6vw, 2.45rem);
}

h3 {
  margin-bottom: 10px;
  font-size: 1.22rem;
}

.eyebrow {
  margin-bottom: 9px;
  color: var(--copper);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lead {
  max-width: 38rem;
  margin-bottom: 24px;
  color: #4b4a46;
  font-size: 1.13rem;
}

.small-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.welcome {
  padding-top: 16px;
}

.welcome-panel,
.surface,
.feedback-card,
.summary-hero,
.day-form-card {
  border: 1px solid rgba(228, 219, 207, 0.95);
  border-radius: var(--radius-lg);
  background: rgba(252, 250, 246, 0.96);
  box-shadow: var(--shadow);
}

.welcome-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 6vw, 48px);
}

.welcome-panel::after {
  content: "";
  position: absolute;
  right: -78px;
  top: -90px;
  width: 220px;
  height: 220px;
  border: 34px solid rgba(158, 173, 154, 0.16);
  border-radius: 50%;
  pointer-events: none;
}

.promise-list {
  display: grid;
  gap: 14px;
  margin: 26px 0;
  padding: 0;
  list-style: none;
}

.promise-list li {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 12px;
  align-items: start;
}

.promise-list span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  color: var(--white);
  border-radius: 50%;
  background: var(--green);
  font-size: 0.84rem;
  font-weight: 800;
}

.consent-box {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 12px;
  align-items: start;
  margin: 24px 0 18px;
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--cream);
}

.consent-box input {
  width: 22px;
  height: 22px;
  margin-top: 3px;
  accent-color: var(--green);
}

.button-row,
.dialog-actions,
.form-actions,
.summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-flex;
  min-height: var(--tap);
  align-items: center;
  justify-content: center;
  padding: 13px 20px;
  color: var(--white);
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--green);
  font-size: 1rem;
  font-weight: 760;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
  background: var(--green-dark);
  box-shadow: 0 8px 22px rgba(53, 90, 74, 0.18);
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.button-secondary {
  color: var(--green);
  border-color: var(--sage);
  background: var(--white);
}

.button-secondary:hover {
  color: var(--green-dark);
  background: var(--sage-soft);
}

.button-tertiary {
  color: var(--charcoal);
  border-color: var(--line);
  background: transparent;
}

.button-tertiary:hover {
  background: var(--cream);
}

.button-danger {
  color: var(--danger);
  border-color: rgba(159, 71, 59, 0.28);
  background: var(--white);
}

.button-danger:hover {
  color: var(--white);
  background: var(--danger);
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.dashboard-head {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
}

.dashboard-head h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 7vw, 3.4rem);
}

.deadline {
  flex: 0 0 auto;
  padding: 10px 13px;
  color: var(--green-dark);
  border: 1px solid var(--sage-soft);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.85rem;
  font-weight: 750;
  white-space: nowrap;
}

.progress-shell {
  margin-bottom: 24px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.75);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-meta strong {
  color: var(--charcoal);
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--sage-soft);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--copper));
  transition: width 0.35s ease;
}

.day-rail {
  display: grid;
  grid-template-columns: repeat(7, minmax(42px, 1fr));
  gap: 7px;
  margin-top: 18px;
}

.day-dot {
  min-width: 0;
  min-height: 48px;
  padding: 6px 2px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--paper);
  font-size: 0.78rem;
  font-weight: 750;
  cursor: default;
}

.day-dot.is-complete {
  color: var(--white);
  border-color: var(--green);
  background: var(--green);
  cursor: pointer;
}

.day-dot.is-next {
  color: var(--green-dark);
  border: 2px solid var(--copper);
  background: var(--white);
}

.surface {
  padding: clamp(22px, 5vw, 36px);
}

.surface + .surface,
.surface + .feedback-card,
.feedback-card + .surface,
.feedback-card + .feedback-card {
  margin-top: 18px;
}

.next-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
}

.next-action p {
  max-width: 33rem;
  margin-bottom: 0;
  color: var(--muted);
}

.feedback-card {
  padding: clamp(22px, 5vw, 32px);
  border-left: 6px solid var(--sage);
}

.feedback-card.is-copper {
  border-left-color: var(--copper);
}

.feedback-card.is-alert {
  border-left-color: var(--danger);
}

.feedback-card p:last-child {
  margin-bottom: 0;
}

.feedback-kicker {
  margin-bottom: 7px;
  color: var(--green);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.unlock-note {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: start;
}

.unlock-note .number {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--white);
  border-radius: 50%;
  background: var(--copper);
  font-weight: 800;
}

.expired-note {
  color: var(--danger);
  border-color: rgba(159, 71, 59, 0.22);
  background: #fff8f6;
}

.wizard-head {
  margin-bottom: 20px;
}

.wizard-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.wizard-step {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.day-form-card {
  padding: clamp(22px, 5vw, 38px);
}

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

.field,
.fieldset {
  min-width: 0;
  margin: 0 0 24px;
}

.field-grid .field,
.field-grid .fieldset {
  margin-bottom: 0;
}

.field label,
.fieldset legend {
  display: block;
  margin-bottom: 9px;
  color: var(--charcoal);
  font-size: 1rem;
  font-weight: 760;
}

.fieldset {
  padding: 0;
  border: 0;
}

.field-help {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.86rem;
}

input[type="text"],
input[type="time"],
input[type="date"],
textarea,
select {
  width: 100%;
  min-height: 52px;
  padding: 13px 14px;
  color: var(--charcoal);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font-size: 1rem;
}

textarea {
  min-height: 98px;
  resize: vertical;
}

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

.choice-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice {
  position: relative;
  min-width: 0;
}

.choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice span {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  color: var(--muted);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
}

.choice input:checked + span {
  color: var(--white);
  border-color: var(--green);
  background: var(--green);
  box-shadow: 0 8px 20px rgba(53, 90, 74, 0.16);
}

.meal-card {
  margin-bottom: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--white);
}

.meal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.meal-head h3 {
  margin-bottom: 0;
}

.text-button {
  min-height: 44px;
  padding: 8px 10px;
  color: var(--danger);
  border: 0;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 750;
  cursor: pointer;
}

.signal-panel {
  margin-top: 18px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.form-actions {
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.form-error {
  margin: 0 0 18px;
  padding: 13px 15px;
  color: #78372f;
  border: 1px solid #e5b9b1;
  border-radius: 12px;
  background: #fff4f1;
  font-weight: 650;
}

.summary-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 6vw, 44px);
  color: var(--white);
  border: 0;
  background: var(--green);
}

.summary-hero h1,
.summary-hero h2 {
  color: var(--white);
}

.summary-hero .eyebrow {
  color: #edc6b4;
}

.summary-hero p:last-child {
  margin-bottom: 0;
  color: #eef2ed;
}

.summary-hero::after {
  content: "";
  position: absolute;
  right: -78px;
  bottom: -110px;
  width: 260px;
  height: 260px;
  border: 38px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}

.metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  margin-bottom: 4px;
  color: var(--green-dark);
  font-size: 1.55rem;
}

.metric span {
  color: var(--muted);
  font-size: 0.84rem;
}

.insight-list {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.insight-list li {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
}

.insight-list strong {
  color: var(--green-dark);
}

.callout {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius-md);
}

.callout p:last-child {
  margin-bottom: 0;
}

.callout-label {
  margin-bottom: 7px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.callout-neutral {
  color: var(--green-dark);
  background: var(--sage-soft);
}

.callout-copper {
  color: #633c2e;
  background: var(--copper-soft);
}

.selection-grid {
  display: grid;
  gap: 18px;
}

.continuity {
  color: var(--white);
  border: 0;
  background: var(--green-dark);
}

.continuity h2,
.continuity h3 {
  color: var(--white);
}

.continuity .eyebrow {
  color: #edc6b4;
}

.continuity p {
  color: #eef2ed;
}

.day-table {
  width: 100%;
  border-collapse: collapse;
}

.day-table th,
.day-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.day-table th {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dialog {
  width: min(calc(100% - 28px), 650px);
  max-height: calc(100vh - 34px);
  padding: 0;
  overflow: auto;
  color: var(--charcoal);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--paper);
  box-shadow: 0 25px 80px rgba(33, 30, 27, 0.28);
}

.dialog::backdrop {
  background: rgba(41, 35, 31, 0.58);
  backdrop-filter: blur(3px);
}

.dialog > *:not(.dialog-head) {
  margin-right: 24px;
  margin-left: 24px;
}

.dialog > *:last-child {
  margin-bottom: 26px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 24px 24px 12px;
}

.dialog-head h2 {
  margin-bottom: 0;
}

.example-grid {
  display: grid;
  gap: 2px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}

.example-grid div {
  display: grid;
  gap: 3px;
  padding: 13px 15px;
  background: var(--white);
}

.example-grid span {
  color: var(--copper);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 80;
  display: grid;
  width: min(calc(100% - 36px), 420px);
  gap: 10px;
}

.toast {
  padding: 14px 16px;
  color: var(--white);
  border-radius: 12px;
  background: var(--green-dark);
  box-shadow: 0 16px 40px rgba(30, 30, 27, 0.26);
  font-weight: 700;
  animation: toast-in 0.22s ease both;
}

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

@media (max-width: 680px) {
  body {
    font-size: 16.5px;
  }

  .site-header {
    min-height: 68px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  #app {
    width: min(100% - 24px, 820px);
    padding-top: 20px;
  }

  .dashboard-head,
  .next-action {
    display: block;
  }

  .deadline {
    display: inline-block;
    margin-top: 4px;
  }

  .next-action .button {
    width: 100%;
    margin-top: 20px;
  }

  .day-rail {
    gap: 5px;
  }

  .day-dot {
    min-height: 45px;
    font-size: 0.7rem;
  }

  .field-grid,
  .metric-grid {
    grid-template-columns: 1fr;
  }

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

  .choice-grid.compact-mobile {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .choice span {
    min-height: 50px;
  }

  .meal-card {
    margin-right: -6px;
    margin-left: -6px;
    padding: 17px;
  }

  .form-actions .button,
  .summary-actions .button,
  .dialog-actions .button {
    width: 100%;
  }

  .form-actions .button-tertiary {
    order: 3;
  }

  .day-table {
    font-size: 0.9rem;
  }

  .day-table th:nth-child(3),
  .day-table td:nth-child(3) {
    display: none;
  }
}

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

@media print {
  @page {
    size: A4;
    margin: 15mm;
  }

  body {
    background: var(--white);
    font-size: 11pt;
  }

  .site-header,
  .no-print,
  .summary-actions,
  .continuity,
  .toast-region,
  dialog {
    display: none !important;
  }

  #app {
    width: 100%;
    padding: 0;
  }

  .site-footer {
    padding: 4mm 0 0;
    color: var(--charcoal);
    font-size: 9pt;
  }

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

  .summary-hero,
  .surface,
  .feedback-card {
    break-inside: avoid;
    margin: 0 0 12px;
    padding: 18px;
    border: 1px solid #cfc8bf;
    box-shadow: none;
  }

  .summary-hero {
    color: var(--charcoal);
    background: var(--white);
  }

  .summary-hero h1,
  .summary-hero h2,
  .summary-hero p:last-child,
  .summary-hero .eyebrow {
    color: var(--charcoal);
  }

  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
