:root {
  --ink: #12213d;
  --ink-soft: #526078;
  --cream: #fbf7ef;
  --surface: #fffdf8;
  --line: #e9e1d4;
  --oat: #ead9b8;
  --sage: #a9bfa1;
  --apricot: #ffc18f;
  --periwinkle: #7d93c7;
  --danger: #9e514b;
  --shadow: 0 10px 30px rgb(50 42 32 / 7%);
  --shadow-small: 0 4px 14px rgb(50 42 32 / 6%);
  --radius-large: 24px;
  --radius-medium: 18px;
  --nav-height: 76px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--cream);
  background-color: var(--cream);
  color: var(--ink);
  font-family: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: pan-x pan-y;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  background-color: var(--cream);
  overscroll-behavior: none;
}

.safe-area-background {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  height: env(safe-area-inset-top, 0px);
  background: var(--cream);
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.refresh-indicator {
  --pull-offset: 0px;
  --pull-progress: 0;
  position: fixed;
  z-index: 110;
  top: max(5px, env(safe-area-inset-top));
  left: 50%;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  transform: translate(-50%, calc(-58px + var(--pull-offset)));
  border: 1px solid rgb(233 225 212 / 90%);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 6px 20px rgb(50 42 32 / 14%);
  color: var(--ink-soft);
  opacity: var(--pull-progress);
  pointer-events: none;
  transition: opacity 80ms linear, color 120ms ease;
}

.refresh-indicator svg {
  width: 20px;
  height: 20px;
  transform: rotate(calc(var(--pull-progress) * 210deg));
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.refresh-indicator.is-ready {
  color: var(--ink);
}

.refresh-indicator.is-loading svg,
.bottom-nav__refresh.is-loading svg {
  animation: refresh-spin 700ms linear infinite;
}

@keyframes refresh-spin {
  to { transform: rotate(360deg); }
}

button,
textarea,
input {
  font: inherit;
}

input,
textarea,
select {
  font-size: 16px;
}

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

button:focus-visible,
a:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(125 147 199 / 48%);
  outline-offset: 3px;
}

.app-frame {
  width: min(100%, 700px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
}

.app-main {
  padding: max(28px, env(safe-area-inset-top)) 20px calc(var(--nav-height) + 42px + env(safe-area-inset-bottom));
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(2.35rem, 10vw, 3.4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.date-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-score {
  display: grid;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #eee3ce;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.date-score[hidden] { display: none; }
.date-score[data-score="-4"] { background: #b55838; color: white; }
.date-score[data-score="-3"] { background: #d98964; }
.date-score[data-score="-2"] { background: #f0b698; }
.date-score[data-score="-1"] { background: #f8ddcf; }
.date-score[data-score="0"] { background: #eee3ce; }
.date-score[data-score="1"] { background: #e1e6f1; }
.date-score[data-score="2"] { background: #bcc8e0; }
.date-score[data-score="3"] { background: #8fa4cd; }
.date-score[data-score="4"] { background: #526ba3; color: white; }

.icon-button,
.date-switcher__button {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgb(255 253 248 / 72%);
  color: var(--ink);
  cursor: pointer;
}

.icon-button svg,
.date-switcher__button svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.date-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.date-switcher__current {
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
}

.goal-card {
  overflow: hidden;
  border: 1px solid rgb(233 225 212 / 78%);
  border-radius: var(--radius-medium);
  background: rgb(255 253 248 / 88%);
  box-shadow: var(--shadow-small);
}

.goal-card__toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 8px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.goal-card__toggle svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 150ms ease;
}

.goal-card__toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.goal-card__summary {
  padding: 0 20px 18px;
}

.goal-card__summary h2 {
  margin: 0 0 6px;
  font-size: 1.08rem;
  letter-spacing: -0.025em;
}

.goal-card__summary p {
  margin: 0 0 9px;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 500;
  line-height: 1.48;
}

.goal-card__summary small,
.insight-goal small {
  display: block;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.goal-editor {
  padding: 17px 20px 20px;
  border-top: 1px solid var(--line);
  background: rgb(251 247 239 / 66%);
}

.goal-editor label {
  display: block;
  margin: 12px 0 7px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 600;
}

.goal-editor label:first-child {
  margin-top: 0;
}

.goal-editor input,
.goal-editor textarea {
  width: 100%;
  padding: 12px 13px;
  border: 1px solid #ddd4c6;
  border-radius: 13px;
  outline: none;
  background: var(--surface);
  color: var(--ink);
}

.goal-editor textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.45;
}

.goal-editor input:focus,
.goal-editor textarea:focus {
  border-color: var(--periwinkle);
  box-shadow: 0 0 0 3px rgb(125 147 199 / 18%);
}

.goal-editor__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 13px;
}

.text-button {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}

.four-dots {
  display: inline-grid;
  grid-template-columns: repeat(4, 8px);
  gap: 5px;
}

.four-dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--oat);
}

.four-dots i:nth-child(2) { background: var(--sage); }
.four-dots i:nth-child(3) { background: var(--apricot); }
.four-dots i:nth-child(4) { background: var(--periwinkle); }

.day-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 4px 10px;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.day-summary strong {
  color: var(--ink);
}

.meal-list {
  display: grid;
  gap: 12px;
}

.meal-card {
  --meal-color: var(--oat);
  overflow: hidden;
  border: 1px solid rgb(233 225 212 / 78%);
  border-radius: var(--radius-medium);
  background: rgb(255 253 248 / 90%);
  box-shadow: var(--shadow-small);
  transition: border-color 160ms ease, transform 160ms ease;
}

.meal-card--lunch { --meal-color: var(--sage); }
.meal-card--dinner { --meal-color: var(--apricot); }
.meal-card--snacks { --meal-color: var(--periwinkle); }

.meal-card.is-saving {
  opacity: 0.72;
}

.meal-card.has-error {
  border-color: rgb(158 81 75 / 52%);
}

.meal-card__main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 92px;
  padding: 18px;
}

.meal-card__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.meal-dot {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--meal-color);
}

.meal-card h2 {
  margin-bottom: 2px;
  font-size: 1.03rem;
  letter-spacing: -0.02em;
}

.meal-status {
  display: block;
  color: var(--ink-soft);
  font-size: 0.72rem;
  white-space: nowrap;
}

.score-control {
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: repeat(3, 44px);
  overflow: hidden;
  border: 1px solid #ddd4c6;
  border-radius: 14px;
  background: var(--surface);
}

.score-control button {
  height: 42px;
  border: 0;
  border-right: 1px solid #e4dccf;
  background: transparent;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, transform 100ms ease;
}

.score-control button:last-child {
  border-right: 0;
}

.score-control button:hover {
  background: rgb(18 33 61 / 4%);
}

.score-control button:active {
  transform: scale(0.94);
}

.score-control button[aria-pressed="true"] {
  background: var(--meal-color);
}

.note-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px 14px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.note-toggle svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 150ms ease;
}

.note-toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.note-panel {
  padding: 4px 18px 18px;
}

.note-panel label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

.note-panel textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid #ddd4c6;
  border-radius: 13px;
  background: var(--cream);
  color: var(--ink);
  line-height: 1.45;
}

.note-panel__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.note-panel__actions span {
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 17px;
  border: 0;
  border-radius: 13px;
  background: var(--ink);
  color: white;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.secondary-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.bottom-nav {
  position: fixed;
  z-index: 10;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  grid-template-columns: repeat(4, 1fr);
  padding: 9px max(18px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(18px, env(safe-area-inset-left));
  border-top: 1px solid rgb(233 225 212 / 90%);
  background: rgb(255 253 248 / 92%);
  backdrop-filter: blur(18px);
}

.bottom-nav__brand {
  display: none;
}

.bottom-nav__refresh {
  display: none;
}

.bottom-nav__item {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 3px;
  color: #727989;
  font-size: 0.68rem;
  font-weight: 600;
  text-decoration: none;
}

.bottom-nav__item svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.bottom-nav__item.is-active {
  color: var(--ink);
}

.bottom-nav__item.is-active svg {
  fill: rgb(234 217 184 / 75%);
}

.toast {
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: calc(var(--nav-height) + 24px + env(safe-area-inset-bottom));
  left: 20px;
  max-width: 420px;
  margin: auto;
  padding: 13px 16px;
  transform: translateY(20px);
  border-radius: 14px;
  background: var(--ink);
  color: white;
  font-size: 0.82rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast.is-error {
  background: var(--danger);
}

.placeholder-page h1 {
  margin-bottom: 28px;
}

.placeholder-card {
  padding: 48px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.placeholder-card h2 {
  margin: 24px 0 10px;
  font-size: 1.25rem;
}

.placeholder-card p {
  max-width: 420px;
  margin: 0 auto 24px;
  color: var(--ink-soft);
  line-height: 1.55;
}

.four-dots--large {
  grid-template-columns: repeat(2, 28px);
  gap: 8px;
}

.four-dots--large i {
  width: 28px;
  height: 28px;
}

.four-dots--mark {
  grid-template-columns: repeat(2, 16px);
  gap: 6px;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.four-dots--mark i {
  width: 16px;
  height: 16px;
}

.history[aria-busy="true"] .calendar-card,
.history[aria-busy="true"] .weekly-list,
.history[aria-busy="true"] .history-summary {
  opacity: 0.58;
}

.history__header {
  margin-bottom: 26px;
}

.month-switcher {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.month-switcher__label {
  text-align: center;
}

.month-switcher__label h2 {
  margin: 0 0 2px;
  font-size: 1.12rem;
  letter-spacing: -0.025em;
}

.month-switcher__label button {
  padding: 2px 8px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
}

.month-switcher__label button:disabled {
  visibility: hidden;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 14px;
  transition: opacity 150ms ease;
}

.history-summary article {
  min-width: 0;
  padding: 14px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
  text-align: center;
}

.history-summary span {
  display: block;
  overflow: hidden;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.64rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-summary strong {
  font-size: 1.35rem;
  letter-spacing: -0.04em;
}

.is-positive,
[data-tone="positive"] {
  color: #4d669f;
}

.is-negative,
[data-tone="negative"] {
  color: #a95f35;
}

.is-neutral,
[data-tone="neutral"] {
  color: var(--ink-soft);
}

.calendar-card {
  padding: 15px 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: opacity 150ms ease;
}

.calendar-weekdays,
.history-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.calendar-weekdays {
  margin-bottom: 6px;
}

.calendar-weekdays span {
  padding: 4px 0;
  color: var(--ink-soft);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 68px;
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
  padding: 6px 2px 5px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--ink);
  text-decoration: none;
}

.calendar-day:not(.is-tracked):hover {
  border-color: var(--line);
  background: var(--cream);
}

.calendar-day.is-tracked:hover {
  filter: brightness(0.97);
}

.calendar-day.is-today {
  border: 2px solid var(--ink);
}

.calendar-day.is-tracked {
  transition: filter 140ms ease;
}

.calendar-day[data-score="-4"] { background: #b55838; color: white; }
.calendar-day[data-score="-3"] { background: #d98964; }
.calendar-day[data-score="-2"] { background: #f0b698; }
.calendar-day[data-score="-1"] { background: #f8ddcf; }
.calendar-day[data-score="0"] { background: #eee3ce; }
.calendar-day[data-score="1"] { background: #e1e6f1; }
.calendar-day[data-score="2"] { background: #bcc8e0; }
.calendar-day[data-score="3"] { background: #8fa4cd; }
.calendar-day[data-score="4"] { background: #526ba3; color: white; }

.calendar-day[data-score="-4"] .calendar-day__score,
.calendar-day[data-score="4"] .calendar-day__score {
  color: white;
}

.calendar-day[data-score="-4"] .completion-dots i,
.calendar-day[data-score="4"] .completion-dots i {
  background: rgb(255 255 255 / 35%);
}

.calendar-day[data-score="-4"] .completion-dots i.is-filled,
.calendar-day[data-score="4"] .completion-dots i.is-filled {
  background: white;
}

.calendar-day--blank {
  pointer-events: none;
}

.calendar-day__number {
  font-size: 0.72rem;
  font-weight: 600;
}

.calendar-day__score {
  margin-top: 4px;
  font-size: 0.71rem;
  line-height: 1;
}

.calendar-day.is-tracked .calendar-day__score {
  color: var(--ink);
}

.completion-dots {
  display: grid;
  grid-template-columns: repeat(4, 4px);
  gap: 2px;
  margin-top: auto;
}

.completion-dots i,
.legend-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ded7cb;
}

.completion-dots i.is-filled,
.legend-dot--filled {
  background: var(--ink);
}

.calendar-legend {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.64rem;
}

.calendar-legend span,
.completion-legend {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
}

.score-scale {
  display: grid;
  width: min(100%, 260px);
  align-items: center;
  grid-template-columns: auto repeat(9, 1fr) auto;
  gap: 2px;
}

.score-scale > span {
  padding: 0 3px;
  color: var(--ink-soft);
  font-size: 0.61rem;
  font-weight: 700;
}

.score-scale i {
  height: 12px;
  background: var(--line);
}

.score-scale i:first-of-type { border-radius: 6px 0 0 6px; }
.score-scale i:last-of-type { border-radius: 0 6px 6px 0; }
.score-scale i[data-score="-4"] { background: #b55838; }
.score-scale i[data-score="-3"] { background: #d98964; }
.score-scale i[data-score="-2"] { background: #f0b698; }
.score-scale i[data-score="-1"] { background: #f8ddcf; }
.score-scale i[data-score="0"] { background: #eee3ce; }
.score-scale i[data-score="1"] { background: #e1e6f1; }
.score-scale i[data-score="2"] { background: #bcc8e0; }
.score-scale i[data-score="3"] { background: #8fa4cd; }
.score-scale i[data-score="4"] { background: #526ba3; }

.completion-legend {
  color: var(--ink-soft);
  font-size: 0.64rem;
}

.weekly-section {
  margin-top: 32px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.28rem;
  letter-spacing: -0.035em;
}

.section-heading > span {
  padding-bottom: 2px;
  color: var(--ink-soft);
  font-size: 0.66rem;
}

.weekly-list {
  display: grid;
  gap: 9px;
  transition: opacity 150ms ease;
}

.week-card {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.week-card h3 {
  margin: 0 0 3px;
  font-size: 0.9rem;
  letter-spacing: -0.02em;
}

.week-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.7rem;
}

.week-card__metrics {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 14px;
}

.week-card__metrics span {
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

.week-card__metrics strong {
  min-width: 30px;
  font-size: 1.05rem;
  text-align: right;
}

.insights__header {
  margin-bottom: 22px;
}

.insights[aria-busy="true"] .insight-summary,
.insights[aria-busy="true"] .insight-section {
  opacity: 0.58;
}

.range-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgb(255 253 248 / 72%);
}

.range-control button {
  min-height: 38px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.range-control button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow-small);
}

.range-caption {
  margin: 7px 0 18px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  text-align: center;
}

.insight-goal {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.insight-goal > span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.insight-goal p {
  margin: 5px 0 8px;
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.45;
}

.insight-goal strong {
  display: block;
  font-size: 0.92rem;
}

.settings-page__header {
  margin-bottom: 34px;
}

.settings-section + .settings-section {
  margin-top: 30px;
}

.settings-section > .eyebrow {
  margin: 0 0 9px 2px;
}

.settings-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.settings-card h2 {
  margin: 0 0 5px;
  font-size: 1rem;
  letter-spacing: -0.025em;
}

.settings-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
  line-height: 1.45;
}

.settings-card form {
  flex: 0 0 auto;
}

.logout-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid rgb(158 81 75 / 25%);
  border-radius: 13px;
  background: #f8ddcf;
  color: #7e3828;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.logout-button svg {
  width: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.settings-card--about {
  justify-content: flex-start;
}

.settings-card--reminders {
  align-items: flex-start;
}

.settings-card__copy {
  min-width: 0;
}

.reminder-schedule {
  display: grid;
  gap: 10px;
  margin: 18px 0 15px;
  padding: 0;
  list-style: none;
}

.reminder-schedule li {
  display: grid;
  grid-template-columns: 67px 1fr;
  gap: 9px;
  align-items: baseline;
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.reminder-schedule strong {
  color: var(--ink);
  font-size: 0.7rem;
}

.notification-status {
  color: var(--ink-soft);
  font-size: 0.66rem !important;
  font-weight: 600;
}

.settings-card--reminders.is-enabled .notification-status {
  color: #526f4e;
}

.notification-button {
  min-width: 78px;
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0 13px;
  border: 1px solid rgb(18 33 61 / 14%);
  border-radius: 13px;
  background: var(--ink);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.notification-button:disabled {
  cursor: wait;
  opacity: 0.52;
}

.settings-card--reminders.is-enabled .notification-button {
  background: var(--cream);
  color: var(--ink);
}

.settings-card--llm {
  align-items: flex-start;
}

.llm-access-status {
  margin-top: 14px !important;
  color: var(--ink-soft);
  font-size: 0.66rem !important;
  font-weight: 600;
}

.settings-card--llm.is-enabled .llm-access-status {
  color: #526f4e;
}

.settings-actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 8px;
}

.settings-action {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgb(18 33 61 / 14%);
  border-radius: 13px;
  background: var(--ink);
  color: white;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.settings-action:disabled {
  cursor: wait;
  opacity: 0.52;
}

.settings-action--secondary {
  background: var(--cream);
  color: var(--ink);
}

.settings-action--danger {
  border-color: rgb(158 81 75 / 25%);
  background: #f8ddcf;
  color: #7e3828;
}

.llm-access-result {
  margin-top: 16px;
}

.llm-access-result label {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.68rem;
  font-weight: 700;
}

.llm-access-url-row {
  display: flex;
  gap: 7px;
  margin-bottom: 8px;
}

.llm-access-url-row input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-size: 0.67rem;
}

@media (max-width: 390px) {
  .settings-card--reminders,
  .settings-card--llm {
    flex-direction: column;
  }

  .notification-button,
  .settings-actions,
  .settings-action {
    width: 100%;
  }
}

.insight-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
  transition: opacity 150ms ease;
}

.insight-summary article {
  min-width: 0;
  padding: 14px 6px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  text-align: center;
}

.insight-summary span {
  display: block;
  overflow: hidden;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 0.58rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insight-summary strong {
  font-size: 1.16rem;
  letter-spacing: -0.04em;
}

.insight-section {
  margin-top: 34px;
  transition: opacity 150ms ease;
}

.section-heading--stacked {
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}

.section-heading--stacked > p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.4;
}

.rhythm-card {
  overflow-x: auto;
  padding: 16px 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.rhythm-grid {
  display: grid;
  min-width: 314px;
  grid-template-columns: 66px repeat(7, minmax(32px, 1fr));
  gap: 4px;
}

.rhythm-grid__corner,
.rhythm-grid__weekday {
  min-height: 22px;
}

.rhythm-grid__weekday {
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
}

.rhythm-grid__meal {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 0.64rem;
  font-weight: 700;
}

.rhythm-grid__meal > i,
.pattern-row__identity > i {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--oat);
}

.rhythm-grid__meal--lunch > i,
.pattern-row--lunch .pattern-row__identity > i { background: var(--sage); }
.rhythm-grid__meal--dinner > i,
.pattern-row--dinner .pattern-row__identity > i { background: var(--apricot); }
.rhythm-grid__meal--snacks > i,
.pattern-row--snacks .pattern-row__identity > i { background: var(--periwinkle); }

.rhythm-cell {
  display: flex;
  min-width: 0;
  height: 52px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  padding: 3px 1px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
}

.rhythm-cell strong {
  font-size: 0.67rem;
}

.rhythm-cell span {
  margin-top: 2px;
  font-size: 0.48rem;
  opacity: 0.72;
}

.rhythm-cell.is-low-confidence {
  background-image: repeating-linear-gradient(135deg, transparent, transparent 4px, rgb(255 255 255 / 42%) 4px, rgb(255 255 255 / 42%) 7px);
}

.rhythm-cell.is-selected {
  outline: 3px solid var(--ink);
  outline-offset: 1px;
}

.rhythm-cell[data-score="-4"],
.observation-card[data-score="-4"] { background-color: #b55838; color: white; }
.rhythm-cell[data-score="-3"],
.observation-card[data-score="-3"] { background-color: #d98964; }
.rhythm-cell[data-score="-2"],
.observation-card[data-score="-2"] { background-color: #f0b698; }
.rhythm-cell[data-score="-1"],
.observation-card[data-score="-1"] { background-color: #f8ddcf; }
.rhythm-cell[data-score="0"],
.observation-card[data-score="0"] { background-color: #eee3ce; }
.rhythm-cell[data-score="1"],
.observation-card[data-score="1"] { background-color: #e1e6f1; }
.rhythm-cell[data-score="2"],
.observation-card[data-score="2"] { background-color: #bcc8e0; }
.rhythm-cell[data-score="3"],
.observation-card[data-score="3"] { background-color: #8fa4cd; }
.rhythm-cell[data-score="4"],
.observation-card[data-score="4"] { background-color: #526ba3; color: white; }

.rhythm-detail {
  min-height: 48px;
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  background: var(--cream);
  color: var(--ink-soft);
  font-size: 0.65rem;
  line-height: 1.45;
}

.score-scale--insights {
  margin: 12px auto 0;
}

.observation-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.observation-card {
  min-height: 142px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.observation-card > span {
  display: block;
  margin-bottom: 18px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.75;
}

.observation-card h3 {
  margin: 0 0 5px;
  font-size: 0.95rem;
  letter-spacing: -0.025em;
}

.observation-card p {
  margin: 0;
  font-size: 0.68rem;
  line-height: 1.4;
  opacity: 0.78;
}

.pattern-list {
  display: grid;
  gap: 9px;
}

.pattern-row {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.pattern-row__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.pattern-row__identity h3 {
  margin: 0 0 2px;
  font-size: 0.84rem;
}

.pattern-row__identity p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.64rem;
}

.pattern-row__result {
  display: grid;
  width: 118px;
  flex: 0 0 auto;
  grid-template-columns: 34px 1fr;
  align-items: center;
  gap: 8px;
}

.pattern-row__result > strong {
  font-size: 0.85rem;
  text-align: right;
}

.mix-bar {
  display: flex;
  width: 100%;
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.mix-bar i {
  height: 100%;
}

.mix-bar__negative,
.score-mix-legend__negative { background: #d98964; }
.mix-bar__neutral,
.score-mix-legend__neutral { background: #ead9b8; }
.mix-bar__positive,
.score-mix-legend__positive { background: #7d93c7; }
.mix-bar__empty { width: 100%; background: var(--line); }

.score-mix-card {
  padding: 22px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.score-mix-card > .mix-bar {
  height: 16px;
}

.score-mix-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.score-mix-legend span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.66rem;
  font-weight: 600;
}

.score-mix-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.public-body {
  min-height: 100dvh;
  background: var(--cream);
}

.public-shell {
  width: min(100%, 1120px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  background: var(--cream);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  grid-template-columns: repeat(2, 10px);
  grid-template-rows: repeat(2, 10px);
  place-content: center;
  gap: 5px;
  border: 1px solid rgb(233 225 212 / 70%);
  border-radius: 13px;
  background: #fffdf8;
  box-shadow: var(--shadow-small);
}

.brand-mark i {
  border-radius: 50%;
  background: var(--oat);
}

.brand-mark i:nth-child(2) { background: var(--sage); }
.brand-mark i:nth-child(3) { background: var(--apricot); }
.brand-mark i:nth-child(4) { background: var(--periwinkle); }

.brand-mark--large {
  width: 74px;
  height: 74px;
  grid-template-columns: repeat(2, 18px);
  grid-template-rows: repeat(2, 18px);
  gap: 9px;
  border-radius: 22px;
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-nav__login {
  padding: 10px 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgb(255 253 248 / 76%);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
}

.landing-hero {
  display: grid;
  min-height: 600px;
  align-items: center;
  grid-template-columns: minmax(0, 1.1fr) minmax(300px, 0.9fr);
  gap: clamp(48px, 9vw, 110px);
  padding: 68px 4% 48px;
}

.landing-hero__copy h1 {
  max-width: 690px;
  margin-bottom: 24px;
  font-size: clamp(3rem, 7vw, 5.5rem);
}

.landing-hero__lead {
  max-width: 590px;
  margin-bottom: 28px;
  color: var(--ink-soft);
  font-size: clamp(1rem, 2vw, 1.16rem);
  line-height: 1.65;
}

.waitlist-form {
  display: flex;
  max-width: 520px;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-small);
}

.waitlist-form input {
  width: 100%;
  min-width: 0;
  padding: 0 12px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.waitlist-form .primary-button {
  flex: 0 0 auto;
}

.waitlist-note {
  margin: 10px 0 0 7px;
  color: var(--ink-soft);
  font-size: 0.72rem;
}

.waitlist-note a,
.auth-card__footer a {
  color: var(--ink);
  font-weight: 700;
}

.landing-demo {
  position: relative;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgb(255 253 248 / 88%);
  box-shadow: 0 30px 70px rgb(50 42 32 / 13%);
  transform: rotate(1.5deg);
}

.landing-demo::before {
  position: absolute;
  z-index: -1;
  width: 170px;
  height: 170px;
  top: -60px;
  right: -35px;
  border-radius: 50%;
  background: #e6b25e;
  content: "";
  opacity: 0.48;
}

.landing-demo__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 4px 4px 10px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.landing-demo__top strong {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: #bcc8e0;
  color: var(--ink);
  font-size: 0.95rem;
  letter-spacing: 0;
}

.landing-meal {
  --landing-meal: #e6b25e;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  padding: 12px 15px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: white;
  font-size: 0.84rem;
  font-weight: 600;
}

.landing-meal > span {
  display: flex;
  align-items: center;
  gap: 10px;
}

.landing-meal i {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--landing-meal);
}

.landing-meal strong {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--landing-meal);
}

.landing-meal--lunch { --landing-meal: #7fa082; }
.landing-meal--dinner { --landing-meal: #f08d64; }
.landing-meal--snacks { --landing-meal: #657fc2; }

.landing-demo > p {
  margin: 18px 0 2px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  text-align: center;
}

.landing-principles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 4%;
}

.landing-principles article {
  display: flex;
  min-height: 84px;
  align-items: center;
  gap: 13px;
  padding: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.landing-principles strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.auth-layout {
  display: flex;
  min-height: calc(100dvh - 64px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 34px;
}

.auth-card {
  width: min(100%, 460px);
  padding: clamp(24px, 6vw, 42px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgb(255 253 248 / 90%);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-bottom: 16px;
  font-size: clamp(2.5rem, 10vw, 3.7rem);
}

.auth-card__intro {
  margin-bottom: 24px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}

.public-form {
  display: grid;
}

.public-form label {
  margin: 14px 0 7px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
}

.public-form input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #ddd4c6;
  border-radius: 14px;
  outline: none;
  background: #faf7f0;
  color: var(--ink);
}

.public-form input:focus {
  border-color: #7d93c7;
  box-shadow: 0 0 0 3px rgb(125 147 199 / 18%);
}

.field-help {
  margin: 7px 2px 0;
  color: var(--ink-soft);
  font-size: 0.66rem;
}

.public-form .primary-button {
  margin-top: 22px;
}

.primary-button--wide {
  width: 100%;
  min-height: 50px;
}

.form-error {
  margin: 0 0 6px;
  padding: 11px 13px;
  border-radius: 12px;
  background: #f8ddcf;
  color: #7e3828;
  font-size: 0.75rem;
  line-height: 1.4;
}

.auth-card__footer {
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
  text-align: center;
}

.auth-card--success {
  text-align: center;
}

.auth-card--success .brand-mark {
  margin: 0 auto 24px;
}

@media (min-width: 700px) {
  .app-frame {
    border-right: 1px solid rgb(233 225 212 / 60%);
    border-left: 1px solid rgb(233 225 212 / 60%);
    background: rgb(251 247 239 / 65%);
  }

  .app-main {
    padding-right: 40px;
    padding-left: 40px;
  }

  .bottom-nav {
    right: 50%;
    left: auto;
    width: min(100%, 700px);
    transform: translateX(50%);
  }
}

@media (min-width: 900px) {
  :root {
    --desktop-nav-width: 210px;
  }

  body {
    background-image:
      radial-gradient(circle at 88% 8%, rgb(234 217 184 / 22%), transparent 28%),
      radial-gradient(circle at 8% 92%, rgb(169 191 161 / 14%), transparent 25%);
    background-attachment: fixed;
  }

  .safe-area-background {
    display: none;
  }

  .refresh-indicator {
    display: none;
  }

  .app-frame {
    display: grid;
    width: min(100%, 1400px);
    min-height: 100vh;
    margin: 0 auto;
    grid-template-columns: var(--desktop-nav-width) minmax(0, 1fr);
    border: 0;
    background: transparent;
  }

  .app-main {
    grid-column: 2;
    padding: 48px clamp(36px, 5vw, 72px) 64px;
  }

  .bottom-nav {
    position: sticky;
    top: 0;
    right: auto;
    bottom: auto;
    left: auto;
    display: flex;
    width: auto;
    height: 100vh;
    grid-column: 1;
    grid-row: 1;
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
    padding: 28px 18px;
    transform: none;
    border-top: 0;
    border-right: 1px solid rgb(233 225 212 / 90%);
    background: rgb(255 253 248 / 82%);
    backdrop-filter: blur(22px);
  }

  .bottom-nav__brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin: 0 4px 34px;
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    text-decoration: none;
  }

  .bottom-nav__brand .brand-mark {
    width: 38px;
    height: 38px;
    grid-template-columns: repeat(2, 9px);
    grid-template-rows: repeat(2, 9px);
    gap: 4px;
    border: 1px solid rgb(233 225 212 / 65%);
  }

  .bottom-nav__brand .brand-mark i {
    width: 9px;
    height: 9px;
  }

  .bottom-nav__item {
    min-height: 52px;
    justify-content: flex-start;
    flex-direction: row;
    gap: 13px;
    padding: 0 14px;
    border-radius: 15px;
    font-size: 0.78rem;
    transition: background 150ms ease, color 150ms ease, transform 150ms ease;
  }

  .bottom-nav__item:hover {
    background: rgb(251 247 239 / 80%);
    color: var(--ink);
    transform: translateX(2px);
  }

  .bottom-nav__item.is-active {
    background: var(--cream);
    box-shadow: inset 0 0 0 1px rgb(233 225 212 / 78%);
  }

  .bottom-nav__item svg {
    width: 23px;
    height: 23px;
  }

  .bottom-nav__refresh {
    display: flex;
    min-height: 48px;
    align-items: center;
    gap: 13px;
    margin-top: auto;
    padding: 0 14px;
    border: 0;
    border-radius: 15px;
    background: transparent;
    color: #727989;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
  }

  .bottom-nav__refresh:hover {
    background: var(--cream);
    color: var(--ink);
  }

  .bottom-nav__refresh:disabled {
    cursor: wait;
    opacity: 0.72;
  }

  .bottom-nav__refresh svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
  }

  .toast {
    right: 32px;
    bottom: 28px;
    left: auto;
    width: min(420px, calc(100vw - var(--desktop-nav-width) - 64px));
    margin: 0;
  }

  .page-header {
    margin-bottom: 28px;
  }

  .four-dots--mark {
    padding: 14px;
    border-radius: 18px;
  }

  .today {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    column-gap: 32px;
  }

  .today > .page-header {
    grid-column: 1;
    grid-row: 1;
  }

  .today > .date-switcher {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    margin: 0;
  }

  .today > .goal-card,
  .today > .day-summary,
  .today > .meal-list {
    grid-column: 1 / -1;
  }

  .today > .goal-card {
    margin-top: 8px;
  }

  .goal-card__toggle {
    padding: 18px 24px 8px;
  }

  .goal-card__summary {
    padding: 0 24px 20px;
  }

  .goal-card__summary h2 {
    font-size: 1.18rem;
  }

  .goal-card__summary p {
    max-width: 780px;
  }

  .day-summary {
    padding: 24px 5px 12px;
  }

  .meal-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .meal-card__main {
    min-height: 106px;
    padding: 22px;
  }

  .meal-dot {
    width: 42px;
    height: 42px;
  }

  .meal-card h2 {
    font-size: 1.08rem;
  }

  .note-toggle {
    padding: 10px 22px 17px;
  }

  .note-panel {
    padding: 4px 22px 22px;
  }

  .history {
    display: grid;
    grid-template-columns: minmax(0, 1.65fr) minmax(250px, 0.85fr);
    grid-template-areas:
      "header switcher"
      "summary summary"
      "calendar weekly";
    gap: 0 28px;
  }

  .history__header {
    grid-area: header;
  }

  .history > .month-switcher {
    grid-area: switcher;
    align-self: center;
    margin: 0 0 26px;
  }

  .history-summary {
    grid-area: summary;
    gap: 14px;
    margin-bottom: 18px;
  }

  .history-summary article {
    padding: 17px 14px;
  }

  .history-summary span {
    font-size: 0.68rem;
  }

  .history-summary strong {
    font-size: 1.55rem;
  }

  .calendar-card {
    grid-area: calendar;
    padding: 20px 16px 17px;
  }

  .calendar-weekdays,
  .history-calendar {
    gap: 7px;
  }

  .calendar-day {
    min-height: 82px;
    padding: 9px 3px 7px;
    border-radius: 14px;
  }

  .calendar-day__number,
  .calendar-day__score {
    font-size: 0.78rem;
  }

  .calendar-legend {
    align-items: center;
    justify-content: space-between;
    flex-direction: row;
    gap: 14px;
    padding: 15px 4px 0;
  }

  .weekly-section {
    grid-area: weekly;
    min-width: 0;
    margin-top: 0;
  }

  .weekly-section .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .week-card {
    min-height: 84px;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    padding: 15px 16px;
  }

  .week-card__metrics {
    justify-content: space-between;
  }

  .insights {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "header range"
      "header caption"
      "goal goal"
      "summary summary"
      "rhythm rhythm"
      "observations observations"
      "meal weekday"
      "score score";
    gap: 0 28px;
  }

  .insights__header {
    grid-area: header;
  }

  .insights > .range-control {
    grid-area: range;
    align-self: end;
    margin-top: 5px;
  }

  .insights > .range-caption {
    grid-area: caption;
    margin: 8px 0 22px;
  }

  .insights > .insight-goal { grid-area: goal; }
  .insights > .insight-summary { grid-area: summary; }
  .insights > section:nth-of-type(1) { grid-area: rhythm; }
  .insights > section:nth-of-type(2) { grid-area: observations; }
  .insights > section:nth-of-type(3) { grid-area: meal; }
  .insights > section:nth-of-type(4) { grid-area: weekday; }
  .insights > section:nth-of-type(5) { grid-area: score; }

  .insight-goal {
    padding: 20px 22px;
  }

  .insight-goal p {
    max-width: 800px;
  }

  .insight-summary {
    gap: 14px;
    margin-top: 16px;
  }

  .insight-summary article {
    padding: 18px 12px;
  }

  .insight-summary span {
    font-size: 0.66rem;
  }

  .insight-summary strong {
    font-size: 1.42rem;
  }

  .insight-section {
    margin-top: 42px;
  }

  .rhythm-card {
    padding: 22px 20px 18px;
  }

  .rhythm-grid {
    grid-template-columns: 100px repeat(7, minmax(54px, 1fr));
    gap: 7px;
  }

  .rhythm-grid__weekday,
  .rhythm-grid__meal {
    font-size: 0.72rem;
  }

  .rhythm-cell {
    height: 64px;
    border-radius: 13px;
  }

  .rhythm-cell strong {
    font-size: 0.76rem;
  }

  .rhythm-cell span {
    font-size: 0.56rem;
  }

  .rhythm-detail {
    padding: 14px 16px;
    font-size: 0.72rem;
  }

  .observation-grid {
    gap: 14px;
  }

  .observation-card {
    min-height: 160px;
    padding: 22px;
  }

  .pattern-row {
    min-height: 80px;
    padding: 15px 17px;
  }

  .score-mix-card {
    padding: 26px 24px;
  }

  .settings-page {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
    grid-template-areas:
      "header header"
      "reminders llm"
      "account about";
    align-items: start;
    gap: 24px 30px;
  }

  .settings-page__header {
    grid-area: header;
    margin-bottom: 8px;
  }

  .settings-page > .settings-section:nth-of-type(1) { grid-area: reminders; }
  .settings-page > .settings-section:nth-of-type(2) { grid-area: llm; }
  .settings-page > .settings-section:nth-of-type(3) { grid-area: account; }
  .settings-page > .settings-section:nth-of-type(4) { grid-area: about; }

  .settings-section + .settings-section {
    margin-top: 0;
  }

  .settings-card {
    padding: 24px;
  }

  .settings-card--reminders {
    min-height: 100%;
  }

  .reminder-schedule {
    gap: 14px;
    margin: 24px 0 19px;
  }

  .reminder-schedule li {
    grid-template-columns: 78px 1fr;
    font-size: 0.74rem;
  }

  .reminder-schedule strong {
    font-size: 0.76rem;
  }
}

@media (max-width: 430px) {
  .meal-card__main {
    padding: 16px 14px;
  }

  .meal-dot {
    width: 34px;
    height: 34px;
  }

  .meal-card__identity {
    gap: 9px;
  }

  .score-control {
    grid-template-columns: repeat(3, 40px);
  }

  .rhythm-grid__meal > span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .date-score {
    width: 46px;
    height: 46px;
  }

  .landing-nav .brand-lockup > span:last-child {
    display: none;
  }

  .landing-hero {
    display: flex;
    min-height: auto;
    flex-direction: column;
    gap: 70px;
    padding: 64px 0 44px;
  }

  .landing-hero__copy h1 {
    font-size: clamp(3.2rem, 16vw, 4.4rem);
  }

  .waitlist-form {
    align-items: stretch;
    flex-direction: column;
    padding: 8px;
  }

  .waitlist-form input {
    min-height: 48px;
  }

  .waitlist-form .primary-button {
    min-height: 48px;
  }

  .landing-demo {
    width: calc(100% - 16px);
  }

  .landing-principles {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .landing-principles article {
    min-height: 60px;
  }

  .auth-layout {
    justify-content: flex-start;
    padding-top: 20px;
  }
}

@media (max-width: 350px) {
  .observation-grid {
    grid-template-columns: 1fr;
  }
}

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