:root {
  color-scheme: light;
  --bg: #f5f2eb;
  --surface: #fffdf7;
  --surface-strong: #ffffff;
  --text: #20302d;
  --muted: #66736f;
  --line: #ded8ca;
  --green: #145f50;
  --green-soft: #dceee8;
  --blue: #275f8f;
  --blue-soft: #dce9f4;
  --amber: #a86416;
  --amber-soft: #f6ead2;
  --rose: #9b4050;
  --rose-soft: #f3dfe3;
  --shadow: 0 18px 45px rgba(39, 50, 44, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(20, 95, 80, 0.08), transparent 260px),
    var(--bg);
  font-family:
    Inter,
    "PingFang SC",
    "Microsoft YaHei",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

.shell {
  width: min(1440px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 120px;
  padding: 22px 24px;
  border: 1px solid rgba(222, 216, 202, 0.75);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 253, 247, 0.96), rgba(255, 253, 247, 0.8)),
    url("data:image/svg+xml,%3Csvg width='560' height='180' viewBox='0 0 560 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23145f50' stroke-opacity='.12' stroke-width='2'%3E%3Cpath d='M0 142C86 94 127 156 210 108s126-52 198-12 91 25 152-25'/%3E%3Cpath d='M36 59c69 41 109 14 162-19 59-36 116 23 177 32 63 9 102-32 155-54'/%3E%3C/g%3E%3Cg fill='%23a86416' fill-opacity='.16'%3E%3Crect x='398' y='46' width='82' height='9' rx='4.5'/%3E%3Crect x='410' y='67' width='108' height='9' rx='4.5'/%3E%3Crect x='424' y='88' width='72' height='9' rx='4.5'/%3E%3C/g%3E%3C/svg%3E") right center / auto 100% no-repeat;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 280px;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.1);
}

.brand-mark span {
  width: 30px;
  height: 30px;
  border: 3px solid #fff7e8;
  border-top-color: #e8b865;
  border-radius: 50%;
  position: relative;
}

.brand-mark span::after {
  position: absolute;
  right: -7px;
  bottom: 1px;
  width: 12px;
  height: 4px;
  border-radius: 999px;
  background: #fff7e8;
  content: "";
  transform: rotate(-35deg);
}

.eyebrow,
.section-kicker {
  margin: 0 0 5px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.12;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  padding: 0 16px;
  color: #fff;
  background: var(--green);
}

.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  border-color: var(--line);
}

.file-button input {
  display: none;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.summary-card {
  min-height: 110px;
  padding: 18px;
  border: 1px solid rgba(20, 95, 80, 0.12);
  border-radius: 8px;
  background: var(--green-soft);
}

.summary-card.protein {
  background: var(--blue-soft);
  border-color: rgba(39, 95, 143, 0.13);
}

.summary-card.fat {
  background: var(--rose-soft);
  border-color: rgba(155, 64, 80, 0.13);
}

.summary-card.cost {
  background: var(--amber-soft);
  border-color: rgba(168, 100, 22, 0.14);
}

.summary-card span,
.macro-board span,
.schedule-time {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: clamp(28px, 3.2vw, 40px);
  line-height: 1;
}

.week-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.day-tab {
  min-height: 78px;
  padding: 13px 12px;
  color: var(--text);
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.82);
}

.day-tab strong,
.day-tab span {
  display: block;
}

.day-tab strong {
  font-size: 16px;
}

.day-tab span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.day-tab.active {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.day-tab.active span {
  color: rgba(255, 255, 255, 0.78);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(0, 1.7fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid rgba(222, 216, 202, 0.82);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 20px 14px;
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  color: #fff;
  font-size: 24px;
  line-height: 1;
  background: var(--green);
}

.schedule-list {
  display: grid;
  gap: 12px;
  padding: 0 20px 20px;
}

.schedule-card {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 34px;
  gap: 10px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.schedule-card input,
.schedule-card textarea,
.meal-input,
.meal-select {
  width: 100%;
  min-height: 36px;
  color: var(--text);
  border: 1px solid #d7d0c1;
  border-radius: 7px;
  background: #fffefa;
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.schedule-card input:focus,
.schedule-card textarea:focus,
.meal-input:focus,
.meal-select:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(20, 95, 80, 0.12);
}

.schedule-card input {
  padding: 0 10px;
}

.schedule-card textarea {
  min-height: 72px;
  padding: 9px 10px;
  resize: vertical;
}

.schedule-fields {
  display: grid;
  gap: 8px;
}

.delete-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--rose);
  border: 1px solid rgba(155, 64, 80, 0.24);
  border-radius: 7px;
  background: var(--rose-soft);
}

.macro-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0 20px 16px;
}

.macro-board div {
  padding: 14px;
  border: 1px solid rgba(222, 216, 202, 0.9);
  border-radius: 8px;
  background: #fffefa;
}

.macro-board strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
  line-height: 1.15;
}

.table-frame {
  margin: 0 20px 20px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid #eee7da;
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #52615d;
  font-size: 13px;
  font-weight: 700;
  background: #f8f4eb;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.meal-select {
  min-width: 92px;
  padding: 0 8px;
}

.meal-input {
  min-width: 86px;
  padding: 0 9px;
}

.name-input {
  min-width: 150px;
}

.nutrition {
  min-width: 150px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #d7d0c1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 44px));
  padding: 13px 16px;
  color: #fff;
  border-radius: 8px;
  background: #20302d;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.18);
  transform: translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 1080px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 24px, 620px);
    padding-top: 14px;
  }

  .hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px;
  }

  .toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .primary-button,
  .ghost-button {
    flex: 1 1 130px;
  }

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

  .summary-grid,
  .macro-board {
    grid-template-columns: 1fr;
  }

  .schedule-card {
    grid-template-columns: 1fr 34px;
  }

  .schedule-time {
    grid-column: 1 / -1;
  }
}
