:root {
  --bg: #f6f7f3;
  --surface: #ffffff;
  --text: #1c2a1e;
  --muted: #5b6b5d;
  --line: #d5ddd3;
  --green: #2f7a3b;
  --green-dark: #22592b;
  --red: #b3261e;
  --amber: #8a5a00;
  --amber-bg: #fff4d6;
  --ok-bg: #e5f3e7;
  --error-bg: #fdecea;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

main { max-width: 44rem; margin: 0 auto; padding: 1rem 1rem 4rem; }

h1 { font-size: 1.5rem; margin: .5rem 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }

a { color: var(--green-dark); }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .5rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.top nav { display: flex; gap: 1rem; }
.top nav a { text-decoration: none; padding: .25rem 0; }
.top nav a[aria-current="page"] { font-weight: 700; border-bottom: 2px solid var(--green); }
.top form { margin: 0; }

label { display: block; margin: .75rem 0; font-weight: 600; }
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: .5rem 0; }
label.small { font-weight: 400; font-size: .9rem; color: var(--muted); }
input:not([type="checkbox"]), select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .6rem .7rem;
  font: inherit; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: .5rem;
}
input[type="checkbox"] { width: 1.25rem; height: 1.25rem; accent-color: var(--green); }
textarea { resize: vertical; }

fieldset { border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); margin: 1rem 0; padding: .5rem 1rem 1rem; }
legend { font-weight: 700; padding: 0 .25rem; }
fieldset.allergens .allergen { display: inline-block; margin-right: 1rem; }

fieldset.allergens .allergen:has(.allergen-detail):has(:checked) { display: block; }
.allergen:not(:has(:checked)) .allergen-detail { display: none; }

/* Ingredient table: name, grams for women and men, remove. One line even on a phone. */
fieldset.ingredients { scroll-margin-top: 4rem; }
.ingredient-rows { list-style: none; margin: 0; padding: 0; }
.ingredient-row {
  display: grid; grid-template-columns: minmax(0, 1fr) 3.5rem 3.5rem 2.25rem; gap: .4rem; align-items: center;
  margin: .35rem 0;
}
.ingredient-row input:not([type="checkbox"]) { margin-top: 0; padding: .5rem .6rem; }
.ingredient-row input[inputmode="numeric"] { padding: .5rem .3rem; text-align: center; }
.ingredient-head { margin-bottom: 0; font-size: .85rem; font-weight: 600; color: var(--muted); }
.ingredient-head span:nth-child(n+2) { text-align: center; }
.ingredient-row .field-error { grid-column: 1 / -1; font-size: .9rem; }
.ingredient-row.invalid input:not([type="checkbox"]) { border-color: var(--red); }
label.remove { position: relative; margin: 0; cursor: pointer; }
label.remove input { position: absolute; opacity: 0; width: 1px; height: 1px; }
label.remove span[aria-hidden] {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; font-size: 1.3rem; line-height: 1;
  color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: .5rem;
}
label.remove:has(:focus-visible) span[aria-hidden] { outline: 2px solid var(--green); outline-offset: 2px; }
label.remove:has(:checked) span[aria-hidden] { color: var(--red); background: var(--error-bg); border-color: var(--red); }
.ingredient-row:has(.remove :checked) input:not([type="checkbox"]) { text-decoration: line-through; opacity: .55; }
summary { cursor: pointer; color: var(--green-dark); margin: .5rem 0; }

/* Present for screen readers and for Enter (the first submit button), not on screen. */
.visually-hidden, .default-submit {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* A closed day needs no meals; an open day needs no reason. */
fieldset.day:has(.closed-toggle :checked) label.course { display: none; }
fieldset.day:not(:has(.closed-toggle :checked)) .closed-note { display: none; }

button, .button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  padding: .6rem 1rem; border-radius: .5rem; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
}
button.primary, .button.primary { background: var(--green); border-color: var(--green); color: #fff; }
button.danger { color: var(--red); border-color: var(--red); }
button.link { border: 0; background: none; padding: 0; color: var(--green-dark); text-decoration: underline; font-weight: 400; }
.buttons { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0; }

.message { padding: .75rem 1rem; border-radius: .5rem; margin: 1rem 0; }
.message.ok { background: var(--ok-bg); }
.message.error { background: var(--error-bg); color: var(--red); }
.message ul { margin: .25rem 0 0; padding-left: 1.25rem; }
.message p { margin: 0; }
.field-error { display: block; color: var(--red); font-weight: 400; }
.hint { display: block; color: var(--muted); font-size: .9rem; font-weight: 400; }

.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: .1rem .5rem; border-radius: 1rem; background: var(--line); }
.badge.live, .badge.ok { background: var(--ok-bg); color: var(--green-dark); }
.badge.live-changed, .badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.draft { background: #e8ecf5; color: #344466; }

.weeks, .dishes { list-style: none; padding: 0; margin: 0; }
.weeks li, .dishes li {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem;
  padding: .6rem .75rem; margin: .25rem 0; background: var(--surface); border: 1px solid var(--line); border-radius: .5rem;
}
.weeks li.current { border-color: var(--green); }

.pager { display: flex; justify-content: space-between; gap: 1rem; font-size: .95rem; }

.side-actions { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.side-actions form { margin: 1rem 0; }

.preview { background: var(--surface); border-radius: .75rem; padding: .5rem 1rem; }
.preview .den { border-top: 1px solid var(--line); }
.preview dt { font-weight: 700; margin-top: .5rem; }
.preview dd { margin: 0; }
.preview .alergeny { color: var(--muted); font-size: .9rem; }

.login { max-width: 22rem; }
