:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --paper: #ffffff;
  --ink: #1e2724;
  --muted: #68716c;
  --line: #dfe4dc;
  --leaf: #2f7d65;
  --leaf-soft: #e4f2ec;
  --tomato: #c95c45;
  --tomato-soft: #f9e6df;
  --grain: #f2c66d;
  --grain-soft: #fff5d8;
  --blue: #385f8f;
  --blue-soft: #e9f0fb;
  --shadow: 0 18px 46px rgba(35, 48, 41, 0.12);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

.app-shell {
  min-height: 100vh;
}

.top-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 420px);
  gap: 32px;
  align-items: center;
  padding: 32px clamp(18px, 4vw, 56px) 26px;
  background: linear-gradient(110deg, #fbfcf8 0%, #edf6f1 48%, #fff8e1 100%);
  border-bottom: 1px solid var(--line);
}

.top-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--leaf);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 1.05;
}

h2 {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.25;
}

h3 {
  margin: 0;
  font-size: 1rem;
}

.safety-note {
  max-width: 680px;
  margin: 18px 0 0;
  color: #43504a;
  font-size: 1rem;
  line-height: 1.75;
}

.hero-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid rgba(47, 125, 101, 0.22);
  box-shadow: var(--shadow);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 28px;
  max-width: 1480px;
  margin: 0 auto;
  padding: 28px clamp(18px, 4vw, 56px) 48px;
}

.profile-panel {
  align-self: start;
  position: sticky;
  top: 18px;
  padding: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(35, 48, 41, 0.08);
}

.needs-profile .top-band {
  padding-bottom: 18px;
}

.needs-profile .workspace {
  grid-template-columns: minmax(280px, 760px);
  justify-content: center;
}

.needs-profile .profile-panel {
  position: static;
}

.needs-profile .content-area {
  display: none;
}

.profile-ready:not(.editing-profile) .workspace {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1220px;
}

.profile-ready:not(.editing-profile) .top-band {
  display: none;
}

.profile-ready:not(.editing-profile) .profile-panel {
  display: none;
}

.section-heading {
  margin-bottom: 18px;
}

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

.profile-form {
  display: grid;
  gap: 14px;
}

.profile-status {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.58;
  font-size: 0.92rem;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd7cf;
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(47, 125, 101, 0.16);
}

.form-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 4px;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 13px;
  cursor: pointer;
  font-weight: 800;
}

.primary-button {
  background: var(--leaf);
  color: #fff;
}

.primary-button:hover {
  background: #266a55;
}

.secondary-button,
.summary-button {
  background: #fff;
  color: var(--leaf);
  border-color: #b7d3c6;
}

.secondary-button:hover,
.summary-button:hover {
  background: var(--leaf-soft);
}

.summary-button {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.content-area {
  min-width: 0;
}

.day-summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding: 24px;
  background: #21362f;
  color: #fff;
  box-shadow: var(--shadow);
}

.day-actions {
  display: grid;
  gap: 10px;
  flex: 0 0 auto;
  width: min(260px, 100%);
}

.day-summary .eyebrow {
  color: #9ee0c2;
}

.condition-note {
  margin: 12px 0 0;
  max-width: 800px;
  color: #d8eee5;
  line-height: 1.65;
}

.profile-chip {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #eef8f3;
  font-size: 0.9rem;
  line-height: 1.5;
}

.content-section {
  margin-top: 28px;
}

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

.meal-card {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr auto auto;
  min-height: 330px;
  padding: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(35, 48, 41, 0.07);
}

.meal-card.primary {
  border-color: rgba(47, 125, 101, 0.42);
}

.meal-card.snack {
  background: #fffdf6;
}

.meal-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.meal-slot {
  color: var(--tomato);
  font-size: 0.82rem;
  font-weight: 800;
}

.meal-kind {
  color: var(--muted);
  font-size: 0.78rem;
}

.ingredient-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0;
}

.ingredient {
  padding: 5px 8px;
  background: var(--leaf-soft);
  color: #245d4b;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 700;
}

.steps {
  margin: 0;
  padding-left: 20px;
  color: #46524d;
  line-height: 1.62;
}

.steps li + li {
  margin-top: 4px;
}

.meal-note {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.meal-note span {
  padding: 8px 10px;
  background: #f5f7f2;
  border-left: 3px solid var(--grain);
}

.meal-alert {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--tomato-soft);
  border: 1px solid rgba(201, 92, 69, 0.24);
  color: #813322;
  font-size: 0.86rem;
  line-height: 1.55;
}

.meal-alert p {
  margin: 0;
}

.meal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.feedback-button {
  min-height: 38px;
  padding: 8px 12px;
  background: #fff;
  color: var(--leaf);
  border-color: #b7d3c6;
  font-size: 0.86rem;
}

.feedback-button:hover {
  background: var(--leaf-soft);
}

.feedback-panel {
  margin-top: 24px;
  padding: 18px;
  background: #fff;
  border: 1px solid rgba(47, 125, 101, 0.28);
  box-shadow: 0 10px 28px rgba(35, 48, 41, 0.06);
}

.feedback-panel[hidden] {
  display: none;
}

.feedback-meal-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.feedback-form {
  display: grid;
  gap: 14px;
}

.feedback-storage-status {
  min-height: 22px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.88rem;
}

.feedback-history {
  margin-top: 24px;
}

.history-list {
  display: grid;
  gap: 10px;
}

.history-item {
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.history-item strong {
  display: block;
  margin-bottom: 6px;
}

.history-item p {
  margin: 6px 0 0;
  color: #44514b;
  line-height: 1.55;
  font-size: 0.9rem;
}

.history-item.empty {
  color: var(--muted);
  font-weight: 700;
}

.history-item .feedback-warning,
.feedback-warning {
  color: #9e3e2c;
  font-weight: 800;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.week-day {
  min-height: 132px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.week-day.active {
  border-color: var(--leaf);
  background: #f2faf5;
}

.week-day strong {
  display: block;
  margin-bottom: 8px;
}

.week-day span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.health-list {
  display: grid;
  gap: 10px;
}

.health-item {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.health-badge {
  display: inline-flex;
  justify-content: center;
  min-width: 76px;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.health-item.ok .health-badge {
  background: var(--leaf-soft);
  color: #255e4b;
}

.health-item.observe .health-badge {
  background: var(--blue-soft);
  color: var(--blue);
}

.health-item.warn .health-badge {
  background: var(--tomato-soft);
  color: #9e3e2c;
}

.health-item p {
  margin: 0;
  color: #44514b;
  line-height: 1.6;
}

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

.source-card {
  padding: 15px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.source-card a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.source-card a:hover {
  text-decoration: underline;
}

.source-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

@media (max-width: 1050px) {
  .top-band,
  .workspace {
    grid-template-columns: 1fr;
  }

  .profile-panel {
    position: static;
  }

  .hero-image {
    max-height: 360px;
  }
}

@media (max-width: 720px) {
  .top-band {
    padding: 24px 16px 18px;
  }

  .workspace {
    padding: 18px 16px 34px;
  }

  .field-grid,
  .meal-grid,
  .source-list {
    grid-template-columns: 1fr;
  }

  .day-summary {
    display: grid;
  }

  .profile-chip {
    max-width: none;
  }

  .form-actions {
    grid-template-columns: 1fr;
  }

  .health-item {
    grid-template-columns: 1fr;
  }
}
