:root {
  color-scheme: light;
  --bg: #f4f0e8;
  --ink: #1d2528;
  --muted: #667270;
  --paper: #fffdf8;
  --line: #ded6c9;
  --red: #d94f3f;
  --green: #177160;
  --blue: #2f6f9d;
  --gold: #b98728;
  --shadow: 0 14px 34px rgba(42, 35, 27, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background:
    linear-gradient(180deg, rgba(47, 111, 157, 0.14), transparent 260px),
    var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.app-head {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 14px;
}

.eyebrow,
.label {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 10px;
  font-size: clamp(34px, 10vw, 72px);
  line-height: 1;
  letter-spacing: 0;
}

.app-head > p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.55;
}

.mode-tabs {
  position: sticky;
  top: 0;
  z-index: 10;
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 0;
  background: rgba(244, 240, 232, 0.92);
  backdrop-filter: blur(14px);
}

.mode-tabs button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  box-shadow: 0 5px 14px rgba(42, 35, 27, 0.05);
}

.mode-tabs button.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

main {
  width: min(980px, calc(100vw - 28px));
  margin: 0 auto;
  padding-bottom: 50px;
}

.view-panel {
  display: none;
  padding: 18px 0 0;
}

.view-panel.active {
  display: block;
}

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

.section-heading h2 {
  margin-bottom: 0;
  font-size: clamp(26px, 6vw, 42px);
}

.section-heading span {
  color: var(--blue);
  font-size: 18px;
}

.day-tabs,
.filters {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: thin;
}

.day-tabs button,
.filters button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.day-tabs button {
  width: 174px;
  min-height: 54px;
  padding: 10px 12px;
  white-space: pre-line;
  text-align: left;
}

.filters button {
  padding: 10px 13px;
  white-space: nowrap;
}

.day-tabs button.active,
.filters button.active {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.timeline,
.budget-list,
.food-grid {
  display: grid;
  gap: 10px;
}

.timeline article,
.budget-list article,
.food-card,
.money-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.timeline article {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 12px;
  padding: 14px;
}

.timeline time {
  color: var(--red);
  font-weight: 900;
}

.timeline p {
  margin: 0;
  font-weight: 800;
  line-height: 1.45;
}

.money-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.money-summary article {
  padding: 18px;
}

.money-summary span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.money-summary strong {
  color: var(--blue);
  font-size: clamp(22px, 5vw, 34px);
}

.budget-list article {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.budget-list article.budget-food {
  display: block;
  padding: 0;
  overflow: hidden;
}

.food-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  text-align: left;
}

.budget-copy {
  flex: 1;
  min-width: 0;
}

.food-toggle b {
  color: var(--blue);
  white-space: nowrap;
}

.chevron {
  color: var(--muted);
  font-size: 20px;
  font-weight: 900;
  transition: transform 0.18s ease;
}

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

.food-budget-panel {
  border-top: 1px solid var(--line);
  padding: 12px;
  background: rgba(47, 111, 157, 0.04);
}

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

.food-budget-entry {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 138px 54px;
  gap: 8px;
  align-items: center;
}

.food-name-input,
.food-budget-entry .money-input input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.food-name-input {
  min-width: 0;
  padding: 0 10px;
}

.food-name-input:focus,
.food-budget-entry .money-input input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(47, 111, 157, 0.16);
}

.delete-food-budget,
.add-food-budget {
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.delete-food-budget {
  height: 42px;
  background: #fff4f1;
  color: var(--red);
}

.add-food-budget {
  width: 100%;
  height: 44px;
  margin-top: 10px;
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.badge {
  width: 48px;
  flex: 0 0 48px;
  padding: 6px 0;
  border-radius: 999px;
  background: #e7eee8;
  color: var(--green);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.budget-list div {
  flex: 1;
  min-width: 0;
}

.budget-list strong {
  display: block;
  margin-bottom: 4px;
}

.budget-list p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.money-input {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 138px;
  color: var(--blue);
  font-weight: 900;
}

.money-input input {
  width: 104px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  text-align: right;
  font-weight: 900;
}

.money-input input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(47, 111, 157, 0.16);
}

.money-input span {
  white-space: nowrap;
}

.budget-list b {
  color: var(--blue);
  white-space: nowrap;
}

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

.food-card {
  min-height: 286px;
  padding: 17px;
}

.food-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.food-card h3 {
  margin-bottom: 8px;
  font-size: 19px;
  line-height: 1.32;
}

.food-card p {
  color: var(--muted);
  line-height: 1.55;
}

.food-card .area {
  color: var(--red);
  font-weight: 900;
}

dl {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

dl div {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px;
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

dd {
  margin: 0;
  font-weight: 700;
}

.food-card em {
  display: inline-block;
  margin-bottom: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #ffe2dc;
  color: var(--red);
  font-style: normal;
  font-weight: 900;
}

.food-card a {
  display: inline-flex;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  text-decoration: none;
  font-weight: 900;
}

@media (max-width: 640px) {
  .app-head,
  .mode-tabs,
  main {
    width: min(100% - 22px, 980px);
  }

  .app-head {
    padding-top: 18px;
  }

  .mode-tabs {
    gap: 6px;
  }

  .mode-tabs button {
    min-height: 46px;
  }

  .view-panel {
    padding-top: 14px;
  }

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

  .day-tabs button {
    width: 158px;
  }

  .timeline article {
    grid-template-columns: 62px 1fr;
    padding: 13px;
  }

  .budget-list article {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .food-toggle {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .food-toggle b {
    width: 100%;
    padding-left: 60px;
  }

  .food-budget-entry {
    grid-template-columns: 1fr;
  }

  .food-budget-entry .money-input {
    width: 100%;
    padding-left: 0;
  }

  .delete-food-budget {
    width: 100%;
  }

  .money-input {
    width: 100%;
    padding-left: 60px;
    justify-content: flex-start;
  }

  .money-input input {
    flex: 1;
    width: 100%;
  }

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