/* Ementa da Semana — single hand-written stylesheet, mobile-first. */

:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --text: #23211d;
  --muted: #6b665d;
  --border: #e7e1d5;
  --field: #faf8f4;
  --accent: #2f6b4f;
  --accent-strong: #24543e;
  --accent-soft: #e3efe8;
  --accent-text: #ffffff;
  --track: #ece6da;
  --error-bg: #fdecea;
  --error-text: #8c1d18;
  --ok-bg: #e3efe8;
  --ok-text: #1e5a3a;
  --warn-bg: #fdf1d8;
  --warn-text: #7a4b00;
  /* Rating colours (always shown together with the number). */
  --rating-1: #c53b37;
  --rating-2: #e8873a;
  --rating-3: #6b7378;
  --rating-4: #8cc98f;
  --rating-5: #23824a;
  --shadow: 0 1px 2px rgb(70 55 30 / 0.05), 0 6px 18px rgb(70 55 30 / 0.06);
  --shadow-raised: 0 1px 2px rgb(30 60 45 / 0.18), 0 4px 12px rgb(30 60 45 / 0.16);
  --radius: 14px;
  --radius-small: 10px;
  --tap: 44px;
  --tabbar-height: 60px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141614;
    --surface: #1e211e;
    --text: #ecefeb;
    --muted: #a3aaa2;
    --border: #313631;
    --field: #171a17;
    --accent: #6fbf95;
    --accent-strong: #9bd8b6;
    --accent-soft: #1f3329;
    --accent-text: #0f1a14;
    --track: #2a2e2a;
    --error-bg: #46201d;
    --error-text: #ffb4ab;
    --ok-bg: #1f3329;
    --ok-text: #a6e3bf;
    --warn-bg: #40300f;
    --warn-text: #f3cf85;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    --shadow-raised: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

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

a {
  color: var(--accent-strong);
  text-underline-offset: 0.15em;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: 1.55rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h2 {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
}

/* Titles of plain sections (categories, shop sections): small, quiet labels. */
main > h2,
main > form > h2,
main > section:not(.card):not(.day) > h2 {
  margin: 1.25rem 0 0.5rem 0.25rem;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

small,
.row-sub {
  color: var(--muted);
}

/* Layout */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 1rem;
  padding-top: calc(0.6rem + env(safe-area-inset-top));
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  flex: none;
  border-radius: 22%;
}

.who {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.avatar {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: calc(var(--tabbar-height) + 1.5rem + env(safe-area-inset-bottom));
}

.tabbar {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 2;
  display: flex;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.tabbar > * {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-height: var(--tabbar-height);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}

.tabbar .icon {
  width: 3.2rem;
  height: 1.75rem;
  padding: 0.15rem 0;
  border-radius: 999px;
  transition: background-color 0.15s;
}

.tabbar [aria-current="page"] {
  color: var(--accent-strong);
  font-weight: 700;
}

.tabbar [aria-current="page"] .icon {
  background: var(--accent-soft);
}

.tabbar [aria-disabled="true"] {
  opacity: 0.45;
}

.login-intro {
  margin: 1.5rem 0 1.25rem;
  text-align: center;
  color: var(--muted);
}

.login-intro .brand-mark {
  box-shadow: var(--shadow-raised);
}

.login-intro p {
  margin: 0.75rem 0 0;
}

/* Components */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.narrow {
  max-width: 24rem;
  margin-inline: auto;
}

.notice {
  border-radius: var(--radius-small);
  padding: 0.65rem 0.85rem;
  margin: 0 0 0.75rem;
}

.notice-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.notice-error {
  background: var(--error-bg);
  color: var(--error-text);
}

form label {
  display: block;
  margin: 0.75rem 0 0.25rem;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
select,
textarea {
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
  width: 100%;
  min-height: var(--tap);
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

label.check {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: var(--tap);
  font-weight: 400;
}

label.check input {
  width: 1.3rem;
  height: 1.3rem;
  flex: none;
  accent-color: var(--accent);
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0.5rem 1.25rem;
  margin-top: 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.08s,
    background-color 0.15s,
    border-color 0.15s;
}

button:active,
.button:active {
  transform: scale(0.97);
}

button.primary,
.button.primary {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-raised);
}

@media (hover: hover) {
  button:hover,
  .button:hover {
    border-color: var(--accent);
  }

  button.primary:hover,
  .button.primary:hover {
    filter: brightness(1.08);
  }

  .menu a:hover,
  .rows a:hover {
    background: var(--field);
  }
}

form button.primary {
  width: 100%;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.menu,
.rows {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.menu li + li,
.rows li + li {
  border-top: 1px solid var(--border);
}

.menu a,
.rows a {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.6rem;
  min-height: var(--tap);
  padding: 0.75rem 1rem;
  color: var(--text);
  text-decoration: none;
}

/* A chevron tells the row can be opened. */
.menu a::after {
  content: "›";
  margin-left: auto;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
}

.row-title {
  font-weight: 600;
}

.row-sub {
  flex-basis: 100%;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.badge {
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  background: var(--ok-bg);
  color: var(--ok-text);
}

.badge-muted {
  background: var(--track);
  color: var(--muted);
}

.facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1rem;
  margin: 0;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.hint {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.rows .row {
  padding: 0.75rem 1rem;
}

.rows .row .row-sub {
  display: block;
}

/* Ratings: the number is always shown, colour is an extra cue. */

.r1 {
  --rc: var(--rating-1);
  --rt: #ffffff;
}

.r2 {
  --rc: var(--rating-2);
  --rt: #1f1300;
}

.r3 {
  --rc: var(--rating-3);
  --rt: #ffffff;
}

.r4 {
  --rc: var(--rating-4);
  --rt: #0f2a12;
}

.r5 {
  --rc: var(--rating-5);
  --rt: #ffffff;
}

.rate-sticky {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0 -1rem 0.5rem;
  padding: 0.6rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.progress p {
  margin: 0 0 0.3rem;
  font-weight: 600;
}

.progress progress {
  display: block;
  width: 100%;
  height: 0.4rem;
  appearance: none;
  border: 0;
  border-radius: 999px;
  overflow: hidden;
  background: var(--track);
}

.progress progress::-webkit-progress-bar {
  background: var(--track);
}

.progress progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.progress progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.segmented {
  display: flex;
  gap: 3px;
  margin-top: 0.6rem;
  padding: 3px;
  border-radius: var(--radius);
  background: var(--track);
}

.segmented a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(var(--tap) - 6px);
  border-radius: 9px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}

.segmented a[aria-current="true"] {
  color: var(--text);
  background: var(--surface);
  font-weight: 700;
  box-shadow: var(--shadow);
}

.rate-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.rate-row {
  padding: 0.6rem 0.75rem 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  /* Keep the row clear of the sticky bar when jumping to #ing-… */
  scroll-margin-top: 8rem;
}

.rate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: var(--tap);
}

.rate-name {
  font-weight: 600;
}

.rate-hint {
  color: var(--muted);
  font-size: 0.85rem;
}

.rate-row button {
  margin-top: 0;
}

.rate-reset {
  min-height: var(--tap);
  padding: 0 0.75rem;
  font-weight: 400;
  font-size: 0.9rem;
  color: var(--muted);
  background: transparent;
}

.rate-scale {
  display: flex;
  gap: 0.4rem;
}

.rate {
  flex: 1;
  min-height: 48px;
  padding: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  background: transparent;
  border: 2px solid var(--rc);
  border-radius: var(--radius);
}

@media (hover: hover) {
  .rate:hover {
    border-color: var(--rc);
    background: color-mix(in srgb, var(--rc) 14%, transparent);
  }
}

.rate[aria-pressed="true"] {
  color: var(--rt);
  background: var(--rc);
}

/* Family matrix */

.matrix-wrap {
  margin: 0 -1rem 1.5rem;
  overflow-x: auto;
}

.matrix {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.9rem;
}

.matrix th,
.matrix td {
  padding: 0.45rem 0.4rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.matrix th:first-child {
  padding-left: 1rem;
  text-align: left;
  font-weight: 400;
}

.matrix thead th {
  position: sticky;
  top: 0;
  background: var(--surface);
  font-weight: 600;
  vertical-align: bottom;
}

.matrix small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  font-size: 0.75rem;
}

.matrix .matrix-group th {
  padding-top: 0.9rem;
  background: var(--bg);
  font-weight: 700;
}

.matrix td {
  width: 3.2rem;
  font-weight: 700;
  color: var(--rt, var(--muted));
  background: var(--rc, transparent);
  border-left: 2px solid var(--surface);
}

/* Weekly menu */

.week-tabs {
  margin: 0 0 1rem;
}

.week-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.week-head h1 {
  margin: 0;
}

.week-head small {
  display: block;
  font-size: 0.9rem;
  font-weight: 400;
}

.badge-draft {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.notice-warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.notice ul {
  margin: 0.25rem 0 0.5rem;
  padding-left: 1.2rem;
}

.notice ul:last-child {
  margin-bottom: 0;
}

.week-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.week-actions form {
  flex: 1;
}

.week-actions button {
  width: 100%;
  margin-top: 0;
}

button:disabled,
.htmx-request button {
  opacity: 0.6;
}

.day {
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.day.is-today {
  border-color: var(--accent);
}

.day h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  padding: 0.65rem 0.9rem;
  font-size: 1rem;
  letter-spacing: -0.005em;
  background: var(--field);
  border-bottom: 1px solid var(--border);
}

.day.is-today h2 {
  background: var(--accent-soft);
}

.day h2::first-letter {
  text-transform: uppercase;
}

.slot {
  padding: 0.7rem 0.9rem;
}

.slot + .slot {
  border-top: 1px solid var(--border);
}

.slot-main {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.slot-meal {
  flex: none;
  width: 3.6rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.slot-dish {
  flex: 1;
  font-weight: 600;
}

.slot-off {
  color: var(--muted);
  font-weight: 400;
}

.score {
  flex: none;
  min-width: 2.4rem;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--rt);
  background: var(--rc);
}

.slot-meta,
.slot-notes {
  margin: 0.15rem 0 0 4.2rem;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.85rem;
}

.slot-notes li::before {
  content: "• ";
}

.problem {
  color: var(--warn-text);
}

.slot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.slot-actions button {
  margin-top: 0;
  padding: 0 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: transparent;
}

.slot-more summary {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 0.7rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--field);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  cursor: pointer;
  list-style: none;
}

.slot-more summary::-webkit-details-marker {
  display: none;
}

.slot-more[open] {
  display: flex;
  flex-wrap: wrap;
  flex-basis: 100%;
  gap: 0.4rem;
}

.slot-more[open] summary {
  background: var(--track);
}

.slot-more[open] button {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.panel {
  margin-top: 0.6rem;
  padding: 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-close {
  margin-top: 0;
  padding: 0 0.7rem;
  font-size: 0.85rem;
  font-weight: 400;
  background: transparent;
}

.panel input[type="search"] {
  width: 100%;
  min-height: var(--tap);
  margin-top: 0.4rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.choices {
  list-style: none;
  max-height: 60vh;
  margin: 0.5rem 0 0;
  padding: 0;
  overflow-y: auto;
}

.choices li + li {
  margin-top: 0.35rem;
}

.choices-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.choice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.2rem 0.6rem;
  width: 100%;
  margin-top: 0;
  padding: 0.5rem 0.7rem;
  font-weight: 400;
  text-align: left;
}

.choice-name {
  flex: 1;
  font-weight: 600;
}

.choice-notes {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  color: var(--muted);
  font-size: 0.8rem;
}

.week-shopping {
  width: 100%;
  margin-top: 0;
}

.week-counts {
  text-align: center;
}

/* Shopping list */

.shop-actions {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.shop-actions button {
  flex: 1;
  margin-top: 0;
}

.shop-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.shop-line + .shop-line {
  border-top: 1px solid var(--border);
}

.shop-line label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--tap);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
}

.shop-line input {
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  accent-color: var(--accent);
}

.shop-name {
  font-weight: 600;
}

.shop-text small {
  display: block;
}

.shop-line input:checked + .shop-text {
  color: var(--muted);
  text-decoration: line-through;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: pre;
  border: 0;
  padding: 0;
}

/* Dish library */

.head-actions {
  display: flex;
  gap: 0.4rem;
}

.top-list .rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.top-list .row-sub {
  padding-left: 2.4rem;
}

.button.compact {
  margin-top: 0;
  padding: 0 0.9rem;
}

.filters input[type="search"] {
  width: 100%;
  min-height: var(--tap);
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.filter-row {
  display: flex;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
}

.filter-row {
  flex-wrap: wrap;
}

.filter-row select {
  flex: 1 1 calc(50% - 0.4rem);
  min-width: 0;
  padding: 0.5rem 0.4rem;
  background: var(--surface);
}

.rows a .row-title,
.row-inline .row-title {
  flex: 1;
}

.rows a.is-inactive .row-title {
  color: var(--muted);
}

.rows .row.row-inline {
  display: flex;
  align-items: center;
}

.badge-leftover {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge-soup {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.slot-soup {
  margin: 0.15rem 0 0 4.2rem;
  font-size: 0.9rem;
}

.badge-suggested {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.heart {
  color: var(--rating-1);
}

.dish-top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.dish-top-actions > *,
.dish-top-actions .button {
  flex: 1;
  margin-top: 0;
}

.favourite-form button {
  width: 100%;
  margin-top: 0;
}

.favourite[aria-pressed="true"] {
  color: var(--rating-1);
  border-color: var(--rating-1);
}

.suggestion {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.suggestion-text {
  flex: 1;
  min-width: 0;
}

.rows .suggestion-text a.row-title {
  display: inline;
  min-height: 0;
  padding: 0;
  color: var(--text);
  text-decoration: none;
}

.suggestion .row-sub {
  display: block;
}

.link-button {
  margin-top: 0;
  padding: 0 0.6rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  background: transparent;
}

.week-suggestions {
  margin-top: 1.5rem;
}

.badge-veto {
  background: var(--error-bg);
  color: var(--error-text);
}

.dish-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.dish-actions > * {
  flex: 1;
}

.dish-actions .button,
.dish-actions button {
  width: 100%;
  margin-top: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.75rem;
}

fieldset {
  min-width: 0;
  margin: 0.75rem 0 0;
  padding: 0;
  border: 0;
}

.months legend {
  padding: 0;
  font-weight: 600;
}

.months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.months label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: var(--tap);
  margin: 0;
  font-weight: 400;
}

.months input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: var(--accent);
}

.ing-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 0.4rem;
  margin: 0 0 0.6rem;
  padding: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ing-row .ing-name {
  grid-column: 1 / -1;
}

.ing-row .ing-note {
  grid-column: 1 / 3;
}

.ing-row select,
.ing-row input[type="text"] {
  min-width: 0;
  padding: 0.5rem 0.4rem;
}

.ing-row .ing-remove {
  margin-top: 0;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 400;
}

/* Meal feedback */

.feedback {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.4rem;
}

.feedback-label {
  flex: 1;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
}

.vote {
  min-width: 3.6rem;
  margin-top: 0;
  padding: 0 0.6rem;
  font-weight: 400;
}

.vote[aria-pressed="true"] {
  font-weight: 700;
  border-color: var(--accent);
  background: var(--accent-soft);
}

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

/* Settings */

textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
}

.grid-table {
  width: 100%;
  border-collapse: collapse;
}

.grid-table th,
.grid-table td {
  height: var(--tap);
  padding: 0 0.25rem;
  border-bottom: 1px solid var(--border);
  text-align: center;
  font-weight: 400;
}

.grid-table thead th {
  color: var(--muted);
  font-size: 0.85rem;
}

.grid-table tbody th {
  text-align: left;
}

.grid-table tbody tr:last-child th,
.grid-table tbody tr:last-child td {
  border-bottom: 0;
}

.grid-table input {
  width: 1.4rem;
  height: 1.4rem;
  accent-color: var(--accent);
}

.settings-email {
  margin-top: 1.5rem;
}

.card + button.primary {
  margin-top: 0;
}

/* Wider screens: navigation moves under the header. */
@media (min-width: 48rem) {
  body {
    display: flex;
    flex-direction: column;
  }

  .tabbar {
    position: static;
    order: 1;
    width: 100%;
    max-width: 44rem;
    margin: 0 auto;
    border-top: 0;
    border-bottom: 1px solid var(--border);
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .tabbar > * {
    flex-direction: row;
    gap: 0.4rem;
    font-size: 0.85rem;
  }

  .tabbar .icon {
    width: 2.4rem;
  }

  main {
    order: 2;
    width: 100%;
    padding-bottom: 2rem;
  }
}

/* Print: just the content, black on white. */
@media print {
  :root {
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #000000;
    --muted: #333333;
    --border: #999999;
  }

  .topbar,
  .tabbar,
  .week-tabs,
  .shop-actions,
  .week-actions,
  .slot-actions,
  .slot-panel,
  .week-shopping,
  .feedback,
  .notice,
  #shopping-progress {
    display: none !important;
  }

  body {
    font-size: 11pt;
  }

  * {
    box-shadow: none !important;
  }

  main {
    max-width: none;
    padding: 0;
  }

  .shop-section,
  .day {
    break-inside: avoid;
  }

  .shop-list {
    margin-bottom: 0.6rem;
    border: 0;
    border-radius: 0;
  }

  .shop-line label {
    min-height: 0;
    padding: 0.15rem 0;
  }

  .shop-line + .shop-line {
    border-top: 0;
  }

  .shop-line input {
    appearance: none;
    width: 0.9rem;
    height: 0.9rem;
    border: 1px solid #000000;
  }

  .shop-line input:checked + .shop-text {
    color: #000000;
  }
}
