:root {
  color-scheme: light;
  --bg: #f3f0e8;
  --card: #fffdf8;
  --ink: #1c1915;
  --muted: #6b645c;
  --line: #e4ddd0;
  --green: #145c3e;
  --green-2: #1f6b4a;
  --amber: #8a5a00;
  --red: #9b2c2c;
  --red-bg: #fdecec;
  --shadow: 0 8px 24px rgba(28, 25, 21, 0.06);
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100dvh; }
button, input, select { font: inherit; font-size: 16px; }
button {
  background: var(--green);
  color: white;
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  min-height: 44px;
}
button.ghost { background: transparent; color: var(--green); border: 1px solid var(--line); }
button.on { background: var(--green); color: white; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.92rem; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 12px;
  padding: 12px;
  color: var(--ink);
}
.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card, form.stack, .item, .bar-card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.card { width: min(420px, 100%); }
h1, h2 { font-weight: 600; margin: 0 0 8px; }
h1 { font-size: 1.6rem; }
.eyebrow { letter-spacing: 0.14em; text-transform: uppercase; font-size: 0.72rem; color: var(--green); margin: 0; font-family: system-ui, sans-serif; }
.muted { color: var(--muted); }
.error { color: var(--red); min-height: 1.2em; }
header, main { padding: 16px 16px 0; }
main { padding-bottom: calc(88px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 248, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
nav button { background: transparent; color: var(--muted); padding: 8px 2px; font-size: 0.78rem; font-family: system-ui, sans-serif; }
nav button.on { color: var(--green); font-weight: 700; }
.row { display: flex; gap: 8px; align-items: end; }
.row > * { flex: 1; }
.stack { display: grid; gap: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented { display: flex; gap: 6px; }
.segmented button { flex: 1; background: white; color: var(--ink); border: 1px solid var(--line); }
.segmented button.on { background: var(--green); color: white; }
.item { display: grid; gap: 4px; }
.item.overdue { background: var(--red-bg); }
.item .meta { color: var(--muted); font-size: 0.85rem; font-family: system-ui, sans-serif; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions button { padding: 8px 12px; min-height: 40px; }
.bar { height: 8px; background: #efeae1; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green-2); }
.bar.over span { background: var(--amber); }
.bar-card { display: grid; gap: 6px; margin-bottom: 8px; }
.alert { background: var(--red-bg); color: var(--red); padding: 12px; border-radius: 14px; }
.stat { font-size: 1.15rem; }
#chart { width: 100%; height: auto; background: var(--card); border-radius: 18px; }
video { width: 100%; border-radius: 16px; background: #111; max-height: 280px; }
.check { flex-direction: row; align-items: center; gap: 10px; }
.check input { width: auto; }
#toast {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  background: var(--ink);
  color: white;
  padding: 12px 14px;
  border-radius: 12px;
  text-align: center;
}
dialog { border: 0; border-radius: 18px; width: min(440px, calc(100% - 24px)); padding: 0; }
dialog form { padding: 16px; }
#chore-badge {
  display: inline-block;
  background: var(--red);
  color: white;
  border-radius: 99px;
  min-width: 1.2em;
  padding: 0 5px;
  font-size: 0.7rem;
}
h2 { font-size: 1.15rem; }
#meal-groups, #search-results, #chore-list, #measure-list, #barcode-result { display: grid; gap: 8px; }
