:root {
  color-scheme: light;
  --paper: #f5f0e6;
  --paper-deep: #eee6d8;
  --surface: #fffcf7;
  --ink: #292620;
  --muted: #7b7469;
  --faint: #b9b0a3;
  --line: #ded6ca;
  --accent: #d96f45;
  --accent-deep: #b94f2d;
  --accent-soft: #f4d5c8;
  --good: #5f7c63;
  --warning: #a76522;
  --warning-bg: #f6e5cc;
  --radius-lg: 28px;
  --radius-md: 18px;
  --shadow: 0 24px 70px rgba(67, 48, 28, 0.1);
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 2%, rgba(255, 255, 255, 0.82), transparent 26rem),
    var(--paper);
}

button,
input,
select {
  font: inherit;
}

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

button {
  color: inherit;
}

button,
select,
input[type="date"] {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 760px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(22px, env(safe-area-inset-top)) 22px max(40px, env(safe-area-inset-bottom));
}

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

.brand-name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.logo-mark {
  display: block;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 252, 247, 0.72);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.icon-button:hover {
  background: var(--surface);
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 42px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-deep);
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.55rem, 11vw, 4.5rem);
  line-height: 0.97;
  letter-spacing: -0.065em;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.65rem, 6vw, 2.25rem);
  line-height: 1.08;
  letter-spacing: -0.045em;
}

h3 {
  margin-bottom: 5px;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.6;
}

.button {
  display: inline-flex;
  min-height: 52px;
  padding: 0 24px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.button:not(.button-quiet):hover {
  background: #100f0d;
}

.button:active {
  transform: translateY(1px) scale(0.99);
}

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

.button-accent {
  background: var(--accent);
}

.button-accent:hover {
  background: var(--accent-deep);
}

.button-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.button-quiet:hover {
  background: rgba(255, 252, 247, 0.72);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--faint);
}

.button:focus-visible,
.text-button:focus-visible,
.icon-button:focus-visible,
.language-toggle button:focus-visible,
.segmented button:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 3px;
}

.text-button {
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font-weight: 700;
  cursor: pointer;
}

.onboarding-shell {
  display: grid;
  min-height: calc(100svh - max(44px, env(safe-area-inset-top)) - max(40px, env(safe-area-inset-bottom)));
  grid-template-rows: auto 1fr auto;
}

.onboarding-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.language-toggle {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border-radius: 999px;
  background: rgba(255, 252, 247, 0.8);
}

.language-toggle button {
  min-width: 42px;
  padding: 7px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  cursor: pointer;
}

.language-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}

.progress {
  display: flex;
  margin: 25px 0 20px;
  gap: 7px;
}

.progress span {
  width: 24px;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  transition: width 260ms ease, background 260ms ease;
}

.progress span.active {
  width: 48px;
  background: var(--accent);
}

.onboarding-stage {
  display: flex;
  padding: 42px 0 34px;
  align-items: center;
}

.onboarding-content {
  width: 100%;
  animation: step-in 360ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

.hero-logo {
  width: 132px;
  height: 132px;
  margin: 0 0 36px;
  filter: drop-shadow(0 22px 24px rgba(93, 58, 32, 0.12));
}

.welcome-import {
  margin-top: 18px;
}

.onboarding-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.onboarding-actions .button:last-child {
  margin-left: auto;
}

.field-grid {
  display: grid;
  gap: 20px;
  margin-top: 31px;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.input,
.select {
  width: 100%;
  min-height: 51px;
  padding: 0 0 8px;
  border: 0;
  border-bottom: 1.5px solid var(--line);
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 650;
  transition: border 160ms ease;
}

.input:focus,
.select:focus {
  border-bottom-color: var(--accent);
}

.input::placeholder {
  color: var(--faint);
  font-weight: 500;
}

.input-with-unit {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 12px;
  border-bottom: 1.5px solid var(--line);
}

.input-with-unit:focus-within {
  border-color: var(--accent);
}

.input-with-unit .input {
  min-width: 0;
  flex: 1 1 auto;
  border: 0;
}

.unit {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(var(--segments, 2), minmax(0, 1fr));
  padding: 4px;
  gap: 3px;
  border-radius: 14px;
  background: var(--paper-deep);
}

.segmented button {
  min-height: 42px;
  padding: 7px 9px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
}

.segmented button.selected {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(58, 43, 29, 0.08);
}

.calculation-strip {
  display: flex;
  margin-top: 32px;
  padding: 18px 0;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.calculation-strip span {
  color: var(--muted);
  font-size: 0.86rem;
}

.calculation-strip strong {
  font-size: 1.55rem;
  letter-spacing: -0.04em;
}

.allocation-preview {
  display: grid;
  margin-top: 26px;
  gap: 0;
}

.allocation-row {
  display: flex;
  min-height: 49px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.allocation-row:last-child {
  border-bottom: 0;
}

.allocation-row span {
  color: var(--muted);
}

.allocation-row strong {
  font-size: 1.02rem;
}

.setup-summary {
  margin-top: 34px;
}

.summary-lead {
  display: flex;
  padding: 0 0 20px;
  align-items: end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.summary-lead strong {
  display: block;
  font-size: 2.65rem;
  line-height: 1;
  letter-spacing: -0.06em;
}

.summary-lead span {
  color: var(--muted);
  font-size: 0.86rem;
}

.helper {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.home-shell {
  padding-bottom: 80px;
}

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

.puppy-title {
  margin-bottom: 3px;
  font-size: clamp(2.35rem, 9vw, 4.3rem);
}

.puppy-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.week-section {
  animation: rise-in 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.section-kicker {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.week-date {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.inline-actions {
  display: flex;
  gap: 14px;
}

.metric-hero {
  display: flex;
  padding: 28px 0 24px;
  align-items: end;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.metric-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.metric-value {
  font-size: clamp(3.6rem, 15vw, 6rem);
  font-weight: 750;
  line-height: 0.86;
  letter-spacing: -0.075em;
}

.metric-value small {
  margin-left: 4px;
  color: var(--muted);
  font-size: 0.96rem;
  letter-spacing: 0;
}

.weight-block {
  text-align: right;
}

.weight-block strong {
  font-size: 1.5rem;
  letter-spacing: -0.04em;
}

.meal-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 18px 0 10px;
  column-gap: 25px;
}

.meal-item {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.meal-name {
  color: var(--muted);
  font-size: 0.87rem;
}

.meal-grams {
  font-weight: 750;
}

.delta {
  display: inline-flex;
  margin: 14px 0 0;
  padding: 8px 11px;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 750;
}

.primary-action {
  display: flex;
  width: 100%;
  margin-top: 28px;
  justify-content: space-between;
}

.section {
  margin-top: 58px;
}

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

.section-heading h2 {
  margin: 0;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.chart-wrap {
  position: relative;
  min-height: 210px;
  padding: 16px 0 0;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.chart-wrap svg {
  display: block;
  width: 100%;
  height: 190px;
  overflow: visible;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-axis {
  stroke: var(--faint);
  stroke-width: 1;
}

.chart-axis-label {
  fill: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.chart-path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 3;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-empty {
  display: grid;
  min-height: 180px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.history-list {
  border-top: 1px solid var(--line);
}

.history-item {
  padding: 19px 0;
  border-bottom: 1px solid var(--line);
}

.history-summary {
  display: grid;
  width: 100%;
  padding: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.history-summary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.83rem;
}

.history-total {
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -0.035em;
}

.history-details {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 240ms ease;
}

.history-details > div {
  overflow: hidden;
}

.history-item.open .history-details {
  grid-template-rows: 1fr;
}

.history-detail-inner {
  display: grid;
  padding-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}

.history-detail-inner span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.history-detail-inner strong {
  font-size: 0.92rem;
}

.edit-panel {
  margin-top: 22px;
  animation: step-in 220ms ease both;
}

.edit-meals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px 22px;
}

.edit-panel .input {
  font-size: 1rem;
}

.validation-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 0.82rem;
  font-weight: 700;
}

.validation-note.match {
  background: rgba(95, 124, 99, 0.12);
  color: var(--good);
}

.edit-footer {
  display: flex;
  margin-top: 18px;
  justify-content: flex-end;
  gap: 12px;
}

.mini-button {
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 0.82rem;
  font-weight: 750;
  cursor: pointer;
}

.mini-button.quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.sheet-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: flex;
  padding: 12px;
  align-items: flex-end;
  justify-content: center;
  background: rgba(41, 38, 32, 0.3);
  backdrop-filter: blur(6px);
  animation: fade-in 180ms ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
}

.sheet {
  width: min(100%, 560px);
  max-height: min(84svh, 760px);
  padding: 26px 24px max(26px, env(safe-area-inset-bottom));
  overflow: auto;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: sheet-up 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes sheet-up {
  from { transform: translateY(30px); opacity: 0; }
}

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

.sheet-header h2 {
  margin: 0;
}

.settings-list {
  display: grid;
  gap: 24px;
}

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

.settings-section-title {
  margin: 0 0 16px;
  color: var(--accent-deep);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

.future-note {
  margin: 8px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.settings-actions {
  display: grid;
  margin-top: 30px;
  gap: 10px;
}

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

.migration-notice {
  display: flex;
  margin: -12px 0 34px;
  padding: 11px 0;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  color: var(--good);
  font-size: 0.78rem;
  font-weight: 700;
}

.weight-block small {
  display: block;
  max-width: 180px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.35;
}

.meal-name small {
  display: block;
  margin-top: 3px;
  color: var(--good);
  font-size: 0.68rem;
}

.week-tools {
  display: flex;
  margin-top: 24px;
  flex-wrap: wrap;
  gap: 9px;
}

.next-week-action {
  display: flex;
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  justify-content: space-between;
  border-color: transparent;
  color: var(--muted);
}

.current-events {
  margin-top: 20px;
  border-top: 1px solid var(--line);
}

.current-events button {
  display: flex;
  width: 100%;
  min-height: 54px;
  padding: 10px 0;
  align-items: center;
  gap: 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.current-events strong,
.current-events small {
  display: block;
}

.current-events strong { font-size: 0.84rem; }
.current-events small { margin-top: 2px; color: var(--muted); font-size: 0.72rem; }

.chart-heading {
  align-items: flex-end;
}

.chart-heading > div:first-child p {
  margin-top: 4px;
}

.range-selector {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.range-selector button {
  min-width: 42px;
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  cursor: pointer;
}

.range-selector button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--surface);
}

.chart-wrap {
  min-height: 232px;
}

.chart-wrap svg {
  height: 224px;
}

.chart-event {
  cursor: pointer;
  outline: none;
}

.event-band {
  fill: rgba(217, 111, 69, 0.11);
}

.event-band.skipped { fill: rgba(167, 101, 34, 0.13); }
.event-band.special { fill: rgba(95, 124, 99, 0.13); }
.event-band.other { fill: rgba(123, 116, 105, 0.1); }
.event-marker { fill: var(--accent); }
.event-marker.skipped { fill: var(--warning); }
.event-marker.special { fill: var(--good); }
.event-marker.other { fill: var(--muted); }

.chart-dot {
  cursor: pointer;
  transition: r 140ms ease, fill 140ms ease;
}

.chart-dot.selected {
  fill: var(--accent);
  r: 7px;
}

.chart-selection {
  display: flex;
  min-height: 45px;
  padding: 12px 0;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
}

.chart-selection strong {
  color: var(--ink);
  font-size: 0.95rem;
}

.history-timeline {
  padding-top: 18px;
}

.timeline-entry {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
}

.timeline-entry + .timeline-entry {
  margin-top: 18px;
}

.timeline-rail {
  position: relative;
  display: flex;
  justify-content: center;
}

.timeline-rail::after {
  position: absolute;
  top: 25px;
  bottom: -24px;
  width: 1px;
  background: var(--line);
  content: "";
}

.timeline-entry:last-child .timeline-rail::after {
  display: none;
}

.timeline-rail > span:not(.event-dot) {
  position: relative;
  z-index: 1;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper);
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 800;
}

.timeline-content {
  min-width: 0;
  padding-bottom: 5px;
}

.timeline-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.timeline-heading p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.timeline-heading strong {
  font-size: 0.95rem;
}

.entry-actions {
  display: flex;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.fixed-event-type {
  display: block;
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
  font-size: 1rem;
}

.special-meal-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
}

.entry-actions button,
.copy-previous {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-deep);
  font-size: 0.7rem;
  font-weight: 750;
  cursor: pointer;
}

.compact-allocation {
  display: grid;
  margin-top: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 18px;
}

.compact-allocation > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.74rem;
}

.compact-allocation strong { color: var(--ink); }
.compact-allocation small { display: block; color: var(--good); font-size: 0.62rem; }

.entry-note,
.event-details,
.entry-topper {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.5;
}

.entry-topper { color: var(--good); font-weight: 700; }

.history-actions {
  display: flex;
  margin: 22px 0 2px 40px;
  flex-wrap: wrap;
  gap: 18px;
}

.event-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
}

.event-dot.skipped { background: var(--warning); }
.event-dot.special { background: var(--good); }
.event-dot.other { background: var(--muted); }

.timeline-rail .event-dot {
  position: relative;
  z-index: 1;
  margin-top: 6px;
  box-shadow: 0 0 0 6px var(--paper);
}

.event-entry.selected .timeline-content {
  margin: -8px -10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--accent-soft);
}

.plan-entry.editing {
  display: block;
}

.plan-entry.editing .edit-panel {
  margin-top: 0;
}

.record-sheet {
  max-height: min(92svh, 900px);
}

.record-sheet .sheet-header h2 {
  margin-top: 4px;
  font-size: 1.25rem;
}

.sheet-editor {
  margin-top: 0;
}

.plan-meta-fields {
  margin-top: 22px;
}

.sync-row {
  display: flex;
  margin: 24px 0 14px;
  flex-wrap: wrap;
  gap: 10px 20px;
}

.check-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}

.check-control input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.meal-edit-list {
  border-top: 1px solid var(--line);
}

.meal-edit-row {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.meal-edit-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  align-items: center;
  gap: 16px;
}

.meal-edit-main > span {
  font-size: 0.86rem;
  font-weight: 750;
}

.topper-toggle {
  margin-top: 10px;
}

.topper-fields {
  display: grid;
  margin-top: 13px;
  grid-template-columns: minmax(0, 1fr) 112px 30px;
  align-items: end;
  gap: 14px;
}

.topper-list,
.event-topper-list {
  margin-top: 12px;
  padding-left: 24px;
}

.topper-actions {
  display: flex;
  margin-top: 11px;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.remove-inline {
  width: 30px;
  height: 30px;
  margin-bottom: 7px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.remove-inline:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.computed-input[readonly] {
  color: var(--ink);
  background: color-mix(in srgb, var(--paper-deep) 46%, transparent);
  cursor: default;
}

.copy-previous {
  grid-column: 1 / -1;
  justify-self: start;
}

.treats-field,
.compact-note {
  margin-top: 20px;
}

.compact-note textarea,
.event-form textarea {
  min-height: 74px;
  resize: vertical;
  line-height: 1.45;
}

.topper-total {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.topper-total strong { color: var(--good); }

.event-form {
  display: grid;
  gap: 22px;
}

.sheet-guidance {
  margin: -4px 0 20px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}

.special-meals-editor {
  border-top: 1px solid var(--line);
}

.subsection-heading,
.special-meal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.subsection-heading {
  padding: 16px 0 4px;
}

.special-meal-editor {
  padding: 18px 0 20px;
  border-bottom: 1px solid var(--line);
}

.special-meal-add-footer {
  display: flex;
  padding: 18px 0 4px;
}

.special-meal-add-footer .mini-button {
  width: 100%;
}

.special-meal-heading > span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: var(--paper);
  background: var(--ink);
  font-size: 0.68rem;
  font-weight: 800;
}

.remove-text {
  color: var(--muted);
  font-size: 0.7rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.special-main-fields {
  display: grid;
  margin-top: 14px;
  grid-template-columns: minmax(110px, 0.8fr) minmax(150px, 1.25fr) 105px;
  gap: 14px;
}

.special-meal-summary {
  display: grid;
  margin-top: 12px;
  gap: 9px;
}

.special-meal-summary > div {
  display: grid;
  padding-left: 12px;
  border-left: 2px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  gap: 2px;
}

.special-meal-summary span,
.special-meal-summary small {
  color: var(--muted);
  font-size: 0.73rem;
}

.special-meal-summary small {
  color: var(--good);
}

.special-marker {
  margin: 9px 0 0;
  color: var(--accent-deep);
  font-size: 0.7rem;
  font-weight: 700;
}

.recovery-panel {
  max-width: 620px;
}

.recovery-actions {
  display: flex;
  margin-top: 32px;
  flex-wrap: wrap;
  gap: 12px;
}

@media (min-width: 680px) {
  .app-shell {
    padding-inline: 42px;
  }

  .onboarding-stage {
    padding-block: 60px;
  }

  .sheet-backdrop {
    padding: 32px;
    align-items: center;
  }

  .sheet { max-height: min(calc(100svh - 64px), 760px); }
  .record-sheet { max-height: min(calc(100svh - 64px), 900px); }
}

@media (max-width: 440px) {
  .field-grid.two,
  .meal-list,
  .edit-meals,
  .settings-profile-grid {
    grid-template-columns: 1fr;
  }

  .field-grid.two .field.compact-half {
    grid-column: auto;
  }

  .metric-hero {
    align-items: flex-start;
  }

  .weight-block strong {
    font-size: 1.25rem;
  }

  .chart-heading {
    display: block;
  }

  .range-selector {
    width: 100%;
    margin-top: 14px;
  }

  .range-selector button {
    flex: 1;
  }

  .compact-allocation {
    grid-template-columns: 1fr;
  }

  .timeline-heading {
    gap: 8px;
  }

  .entry-actions {
    display: grid;
    gap: 5px;
    text-align: right;
  }

  .meal-edit-main {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .topper-fields {
    padding-left: 0;
    grid-template-columns: minmax(0, 1fr) 92px 28px;
  }

  .topper-list,
  .event-topper-list {
    padding-left: 0;
  }

  .special-main-fields {
    grid-template-columns: 1fr 92px;
  }

  .special-main-fields .field:first-child {
    grid-column: 1 / -1;
  }

  .week-tools .mini-button {
    flex: 1 1 145px;
  }

  .recovery-actions .button {
    width: 100%;
  }
}

@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;
  }
}
