:root {
  --green: #2f7d32;
  --green-dark: #1f5c22;
  --bg: #f6f7f5;
  --card: #fff;
  --line: #dce0d9;
  --text: #1d2118;
  --muted: #5f6b59;
}
* { box-sizing: border-box; }
body {
  margin: 0; padding: 0 0 6.5rem;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
}
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: .75rem 1.25rem;
  align-items: center; justify-content: space-between;
  padding: .8rem 1rem; color: #fff;
  background: linear-gradient(135deg, var(--green-dark), var(--green) 65%);
  box-shadow: 0 2px 12px rgba(0, 0, 0, .18);
}

/* Whose meal plan this is, said once and quietly: their initials on a tile, rather
   than a copy of their logo file. Inverted against the green bar it sits on — the same
   monogram as the favicon, which is white-on-green because it sits on browser chrome. */
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.brand-mark {
  flex: none;
  display: grid; place-items: center;
  width: 2.5rem; height: 2.5rem; border-radius: .7rem;
  background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  font-size: .84rem; font-weight: 800; letter-spacing: .02em; color: var(--green-dark);
}
.brand-text { display: grid; gap: .1rem; min-width: 0; }
.brand-title { margin: 0; font-size: 1.2rem; font-weight: 700; letter-spacing: .01em; }
.brand-sub {
  font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: #d5e8d5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* The month being filled in — stated once, where the switch used to be. */
.month-badge {
  padding: .35rem .85rem; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #fff;
  font-size: .85rem; font-weight: 600; white-space: nowrap;
}
.month-badge:empty { display: none; }

@media (max-width: 460px) {
  .topbar { justify-content: center; }
}
main { max-width: 1100px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.card h2 { margin: 0 0 .35rem; font-size: 1.05rem; }
.hint { margin: .25rem 0 .75rem; color: var(--muted); font-size: .88rem; }

/* Where the details are stored is worth explaining, but not worth a permanent banner —
   it lives behind the "i" beside the heading. */
.head-left { display: flex; align-items: center; gap: .4rem; }
.info-wrap { position: relative; display: inline-flex; }
button.info {
  width: 1.3rem; height: 1.3rem; padding: 0; border-radius: 50%;
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  font-size: .8rem; font-weight: 700; line-height: 1; cursor: pointer;
}
button.info:hover, button.info[aria-expanded="true"] {
  border-color: var(--green); color: var(--green-dark); background: #f2f7f2;
}
.popover {
  position: absolute; top: calc(100% + .45rem); left: -.5rem; z-index: 20;
  width: min(23rem, 78vw); padding: .7rem .8rem;
  background: #fff; border: 1px solid var(--line); border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0; box-shadow: 0 6px 20px rgba(0,0,0,.13);
  font-size: .85rem; line-height: 1.45; color: var(--text); font-weight: 400;
}
.popover[hidden] { display: none; }
.popover strong { color: var(--green-dark); }

#profile-view {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
}
.profile-summary { display: grid; gap: .15rem; font-size: .95rem; }
.summary-name { font-weight: 600; font-size: 1.02rem; }
.summary-meta { color: var(--muted); font-size: .87rem; }
.form-actions { display: flex; justify-content: flex-end; margin-top: .9rem; }
.card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
}

/* An explicit 12-column grid: fields line up in tidy rows instead of the ragged
   columns an auto-fit grid produced once some fields were capped narrower. */
.fields { display: grid; grid-template-columns: repeat(12, 1fr); gap: .8rem .75rem; }
.fields label { display: grid; gap: .3rem; font-size: .82rem; color: var(--muted); min-width: 0; }
.fields label[hidden] { display: none; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-6 { grid-column: span 6; }

.fields input, .fields select {
  width: 100%; min-width: 0;
  padding: .55rem .6rem; font-size: 1rem; color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; background: #fff;
}
.fields input:focus-visible, .fields select:focus-visible {
  outline: 2px solid var(--green); outline-offset: 1px;
}

/* Narrow screens get their own spans per field, so the rows still tile to 12 rather
   than leaving half-empty gaps where a wide field could not fit beside a narrow one. */
@media (max-width: 760px) {
  .sm-3 { grid-column: span 3; }
  .sm-6 { grid-column: span 6; }
  .sm-9 { grid-column: span 9; }
  .sm-12 { grid-column: span 12; }
}

.saved { font-size: .8rem; color: var(--green-dark); white-space: nowrap; }

.deadline { font-size: .9rem; color: var(--muted); }
.deadline + .deadline { margin-top: .3rem; }
.deadline a { color: var(--green-dark); }
.deadline.passed { color: #a1301f; font-weight: 600; }

.day {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: .7rem .85rem; margin-bottom: .6rem;
}
.day.chosen { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); }
.day-head { display: flex; align-items: baseline; gap: .5rem; margin-bottom: .5rem; }
.day-date { font-weight: 700; font-size: 1rem; }
.opts { display: grid; gap: .4rem; }

/* The two main courses are alternatives, so on a wide screen they belong side by side
   where they can be compared at a glance. They stack again when there is no room. */
.mains { display: grid; gap: .4rem; }
@media (min-width: 760px) {
  .mains { grid-template-columns: 1fr 1fr; }
}
.opt {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .55rem .6rem; border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; background: #fdfdfc;
}
.opt:hover { border-color: var(--green); }
.opt input { margin-top: .15rem; width: 1.15rem; height: 1.15rem; accent-color: var(--green); flex: none; }
.opt.on { background: #eef6ee; border-color: var(--green); }
/* The category is a label, the dish is the content — so they get different jobs:
   a small chip for the former, the darkest, heaviest text on the card for the latter. */
.opt-label { display: grid; gap: .3rem; justify-items: start; min-width: 0; }
.opt-kind {
  padding: .08rem .4rem; border-radius: 4px;
  background: #e8ebe5; color: #55604f;
  font-size: .64rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  line-height: 1.5;
}
.opt-dish { font-size: .97rem; font-weight: 500; color: var(--text); line-height: 1.35; }
.opt.on .opt-kind { background: var(--green); color: #fff; }
.opt.on .opt-dish { color: var(--green-dark); }
.extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .4rem; }

.actionbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; background: #fff; border-top: 1px solid var(--line);
}
.summary { display: flex; align-items: baseline; gap: .75rem; font-size: .95rem; color: var(--muted); }

/* Kept away from the PDF buttons and styled as a quiet link: it throws work away, so
   it should not sit next to, or look like, the action you actually want. */
button.link {
  padding: 0; border: none; background: none; color: var(--muted);
  font-size: .9rem; text-decoration: underline; cursor: pointer;
}
button.link:hover:not(:disabled) { color: #a1301f; }
button.link:disabled { opacity: .4; cursor: default; text-decoration: none; }
.buttons { display: flex; gap: .5rem; flex-wrap: wrap; }
button {
  font: inherit; padding: .6rem 1rem; border-radius: 8px; cursor: pointer; border: 1px solid var(--line);
  background: #fff; color: var(--text);
}
button.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
button:disabled { opacity: .55; cursor: not-allowed; }
button.primary:disabled { background: #9bb79c; border-color: #9bb79c; }
button:hover:not(:disabled) { border-color: var(--green); }


#toast {
  position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%) translateY(1rem);
  background: #23291f; color: #fff; padding: .65rem 1rem; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: #8c2b1c; }

@media (max-width: 560px) {
  .actionbar { flex-direction: column; align-items: stretch; }
  .buttons { justify-content: stretch; }
  .buttons button { flex: 1; }
}

