/* Prep & Pantry brand: colors sampled from the logo. */
:root {
  --bg: #faf6ec;            /* warm cream page */
  --surface: #fffefa;       /* cards */
  --tote: #f0e7d6;          /* the basket's canvas */
  --text: #2e3a2f;
  --muted: #6b7466;
  --accent: #345238;        /* wordmark green: buttons, headings */
  --accent-hover: #28422c;
  --accent-text: #ffffff;
  --leaf: #5f8239;          /* checks, highlights */
  --gold: #b9832a;          /* the ampersand (text-safe shade) */
  --gold-bright: #d19a33;
  --gold-soft: #f7ebcd;
  --tomato: #c0402f;
  --carrot: #ea7e23;
  --sage: #a3ae96;
  --border: #e7dcc6;
  --shadow: 0 1px 2px rgba(52, 82, 56, 0.06), 0 4px 14px rgba(52, 82, 56, 0.05);
  --error: #c0402f;
  --radius: 14px;
  --font-display: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18201a;
    --surface: #212b23;
    --tote: #2a352c;
    --text: #f1ece0;
    --muted: #aeb5a4;
    --accent: #9cc07a;
    --accent-hover: #b2d191;
    --accent-text: #14200f;
    --leaf: #9cc07a;
    --gold: #e3b456;
    --gold-bright: #e3b456;
    --gold-soft: #3a3322;
    --tomato: #f0917f;
    --sage: #6f7b66;
    --border: #334036;
    --shadow: none;
    --error: #f0917f;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .brand, button, .button {
  font-family: var(--font-display);
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img { width: 38px; height: 38px; }
.amp { color: var(--gold-bright); }

main {
  max-width: 720px;
  margin: 24px auto 48px;
  padding: 0 16px;
}

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

.card h1 { margin-top: 0; font-size: 1.4rem; }

/* Sign-in */
.login {
  max-width: 380px;
  margin: 6vh auto 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}
.login-logo { display: block; width: min(280px, 70vw); height: auto; margin: 0 auto 4px; }
.login h1 { text-align: center; }

input, textarea, select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--leaf) 25%, transparent);
}

button, .button {
  display: inline-block;
  font-size: 1rem;
  font-weight: 500;
  padding: 10px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}
button:hover, .button:hover { background: var(--accent-hover); }

button.secondary, .button.secondary {
  background: var(--tote);
  color: var(--accent);
  border: 1px solid var(--border);
}
button.secondary:hover, .button.secondary:hover { background: var(--border); }

button.link {
  background: none;
  color: var(--muted);
  padding: 4px 0;
  font-family: var(--font-body);
}
button.link:hover { background: none; color: var(--text); }

.error { color: var(--error); margin: 0; }

h1 { font-size: 1.75rem; font-weight: 600; color: var(--accent); margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem; font-weight: 600; color: var(--accent); margin: 0 0 12px; }
a { color: var(--leaf); text-underline-offset: 2px; }
.muted { color: var(--muted); }
main > .card, main > form.card, main > section, main > details, .meal-list .card { margin-bottom: 16px; }

.site-nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.site-nav a:hover { color: var(--accent); background: var(--tote); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--tote); }
.site-nav form { margin-left: 6px; }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row label { flex: 1 1 160px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.toolbar input { flex: 1 1 200px; }

.meal-list { list-style: none; padding: 0; margin: 0; }
.meal-list .card { padding: 16px; }
.meal-name { font-weight: 600; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 6px 0 12px; color: var(--muted); font-size: 0.9rem; }
.pill { background: var(--tote); border: 1px solid var(--border); border-radius: 999px; padding: 1px 10px; font-size: 0.85rem; color: var(--muted); }
.effort-easy { color: var(--leaf); border-color: color-mix(in srgb, var(--leaf) 40%, transparent); }

.member summary { cursor: pointer; }
.member form { margin-top: 12px; }

.ratings { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.ratings li { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stars { display: flex; align-items: center; gap: 2px; }
.star { background: none; color: var(--border); font-size: 1.5rem; padding: 0 2px; line-height: 1; }
.star.on { color: var(--gold-bright); }
.star:hover { color: var(--gold-bright); background: none; }

button.danger { color: var(--tomato); }
ul.error { padding-left: 20px; }

.small { font-size: 0.85rem; }
.ai-box { border-style: dashed; border-color: var(--sage); background: color-mix(in srgb, var(--tote) 45%, var(--surface)); }
.notice { background: var(--gold-soft); border-left: 4px solid var(--gold-bright); padding: 10px 14px; border-radius: 0 10px 10px 0; }
.steps li { margin-bottom: 6px; }
button:disabled { opacity: 0.6; cursor: progress; }

h3 { font-size: 1rem; margin: 16px 0 6px; }
.plain { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.link-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); }
.link-card:hover { border-color: var(--leaf); }

.week { list-style: none; padding: 0; margin: 0 0 12px; }
.week li { display: flex; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.week li:last-child { border-bottom: 0; }
.week .day { width: 64px; color: var(--muted); flex: none; }
.week li.today .day { color: var(--leaf); font-weight: 700; }

.nights { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.night { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.night:last-child { border-bottom: 0; }
.night-options { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.check { display: inline-flex; gap: 6px; align-items: center; }
fieldset.who { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
fieldset.who legend { float: left; margin-right: 8px; }

.night-card h2 { margin: 0; }
.meal-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 4px; }
.pill.new { background: var(--gold-soft); border-color: transparent; color: var(--gold); font-weight: 600; }
.inline-select select { max-width: 260px; }

.add-item { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; }
.add-item input[name=name] { flex: 1 1 180px; }
.qty-input { width: 90px; }
.category { color: var(--leaf); font-family: var(--font-display); font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; margin: 18px 0 4px; }
.items { list-style: none; padding: 0; margin: 0; }
.item { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item .toggle { flex: none; }
.check-btn { width: 32px; height: 32px; padding: 0; border-radius: 9px; border: 1.5px solid var(--sage); background: var(--surface); color: var(--sage); font-size: 1.05rem; font-weight: 700; line-height: 1; }
.check-btn:hover { background: var(--tote); }
.item.on .check-btn { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.item-edit { flex: 1; min-width: 0; }
.item-edit summary { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; padding-top: 4px; }
.item-edit summary::-webkit-details-marker { display: none; }
.item:not(.on) .item-name { color: var(--muted); }
.qty { color: var(--muted); font-size: 0.9rem; }
.for { flex-basis: 100%; }
.edit-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.edit-row input[name=name] { flex: 1 1 160px; }
.rename summary { list-style: none; cursor: pointer; }
.rename summary::-webkit-details-marker { display: none; }
.rename h1 { display: inline; }
.stack .night label, .stack .add-item label { flex-direction: row; align-items: center; gap: 6px; font-weight: normal; }
.stack .night .day-label { font-weight: 600; }

progress { width: 100%; height: 12px; accent-color: var(--leaf); }
.columns-2 { columns: 2; column-gap: 24px; display: block; }
.columns-2 li { break-inside: avoid; margin-bottom: 4px; }
.trip { padding: 6px 0; border-bottom: 1px solid var(--border); }
.trip:last-child { border-bottom: 0; }
.trip summary { cursor: pointer; }
input[type=file] { padding: 8px; }
.add-item input[name=text] { flex: 1 1 260px; }
.add-item .hint { flex-basis: 100%; margin: 0; }

.store-row { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.store-row:last-child { border-bottom: 0; }
.store-picker { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0 0 12px; }
.store-picker label { display: flex; gap: 8px; align-items: center; }

/* Little leaf sprigs from the logo, used sparingly on section headings. */
.sprig::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  vertical-align: -2px;
  background: var(--leaf);
  -webkit-mask: url("/static/brand/sprig.svg") center / contain no-repeat;
  mask: url("/static/brand/sprig.svg") center / contain no-repeat;
}

/* The logo art has its own cream background; blend it into light cards, frame it in dark mode. */
.login-logo, .brand img { mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) {
  .login-logo, .brand img { mix-blend-mode: normal; border-radius: 12px; }
}
.week a, .plain a, .meal-pick a { color: var(--text); text-decoration: none; font-weight: 600; }
.week a:hover, .plain a:hover, .meal-pick a:hover { color: var(--leaf); text-decoration: underline; }

@media (max-width: 560px) {
  .site-header { padding: 8px 12px; gap: 6px; }
  .brand { font-size: 1.15rem; }
  .brand img { width: 32px; height: 32px; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 5px 9px; font-size: 0.95rem; }
  .site-nav form { margin-left: 2px; }
  .site-nav button.link { font-size: 0.9rem; }
  h1 { font-size: 1.5rem; }
}

/* Empty states: the logo's basket with a friendly invitation. */
.empty {
  text-align: center;
  padding: 28px 20px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.empty img { display: block; margin: 0 auto 8px; mix-blend-mode: multiply; }
.empty h2 { margin-bottom: 6px; }
.empty p { max-width: 440px; margin: 0 auto 14px; }
.empty.compact { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; margin: 4px 0 8px; }
.empty.compact img { margin: 0; flex: none; }
.empty.compact p { margin: 0; }
@media (prefers-color-scheme: dark) { .empty img { mix-blend-mode: normal; border-radius: 12px; } }

.greeting { font-family: var(--font-display); font-size: 1.1rem; font-weight: 500; color: var(--accent); margin: 0 0 12px; }

/* AI actions: warm gold so they read as "the helper", plus a gentle busy state. */
.ai-box {
  border: 1px solid color-mix(in srgb, var(--gold-bright) 45%, var(--border));
  background: color-mix(in srgb, var(--gold-soft) 55%, var(--surface));
}
.ai-label { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; color: var(--accent); }
.ai-badge { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold-bright) 40%, transparent); font-size: 0.95rem; }
form.busy button[type=submit] { animation: thinking 1.4s ease-in-out infinite; opacity: 1; cursor: progress; }
@keyframes thinking { 0%, 100% { filter: none; } 50% { filter: brightness(1.25) saturate(1.2); } }
@media (prefers-reduced-motion: reduce) { form.busy button[type=submit] { animation: none; } }

/* Effort in brand colors. */
.effort-medium { color: var(--gold); border-color: color-mix(in srgb, var(--gold-bright) 40%, transparent); background: var(--gold-soft); }
.effort-project { color: #b85d14; border-color: color-mix(in srgb, var(--carrot) 40%, transparent); background: color-mix(in srgb, var(--carrot) 12%, var(--surface)); }
@media (prefers-color-scheme: dark) { .effort-project { color: #f3a060; } }
.stack .ai-label { flex-direction: row; align-items: center; }
