:root {
  --bg: #0c2420;
  --surface: #12332d;
  --surface-2: #183f38;
  --ink: #fff3d6;
  --muted: #9cc3b8;
  --line: #235048;
  --chip: #12332d;
  --chip-ink: #c8e0d8;
  /* Buttons, inputs and rows: --surface on the page, --surface-2 inside a
     surface (sheet, cards, menus) so they still stand out. */
  --raised: #12332d;
  --accent: #ffcf3f;
  --accent-ink: #2b1708;
  --accent-soft: #2e4128;
  --heart: #ff6a4d;
  --brand-teal: #13715f;
  --card: linear-gradient(160deg, #183f38, #0e2924);
  --dashed: #2c5a52;
  --placeholder: linear-gradient(135deg, #e0952a, #f6b73c 45%, #e8a531 70%, #d4861f);
  --success: #9fdc6a;
  --danger: #ff8a75;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 24px rgba(0, 0, 0, .28);
  --radius: 18px;
  /* Both point at Sora: --serif is still what headings ask for. */
  --serif: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sans: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--sans);
}

a { color: inherit; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }

/* ---- top bar ---------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 700 1.3rem/1 var(--sans);
  text-decoration: none;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.brand img { flex: none; width: 40px; height: 40px; transform: rotate(-8deg); }
.brand-ease { color: var(--accent); }
.nav { display: flex; gap: 4px; }
.nav a {
  position: relative;
  text-decoration: none;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}
.nav-icon { display: none; }
/* Phones: the tabs become a fixed bar at the bottom, an emoji over each
   label; the top bar keeps the logo and + Add. After the rules above, so
   these win. */
:root { --tabbar-h: 64px; }
@media (max-width: 640px) {
  /* A backdrop-filter would make the top bar the box the tab bar is fixed
     to (inside it, not the screen), so here the top bar is solid. */
  .topbar { backdrop-filter: none; background: var(--bg); }
  .topbar-inner { justify-content: space-between; gap: 8px; }
  .topbar .add-btn { padding: 8px 14px; font-size: .92rem; }  /* .add-btn is defined below */
  .nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 20;
    gap: 0;
    padding: 4px 8px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }
  .nav a {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    min-height: calc(var(--tabbar-h) - 8px);
    padding: 4px 2px;
    font-size: .74rem;
    border-radius: 14px;
  }
  .nav-icon { display: block; font-size: 1.4rem; line-height: 1; filter: grayscale(.6) opacity(.75); }
  .nav a[aria-current="page"] .nav-icon { filter: none; }
  .nav a[aria-current="page"] { background: var(--accent-soft); }
  .nav a[aria-current="page"]::after { display: none; }
  /* Room below the content (and sticky save bars) for the tab bar. */
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .actions-sticky, .p-save { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}
@media (max-width: 350px) {
  .topbar-inner { padding-left: 12px; padding-right: 12px; }
  .brand img { width: 34px; height: 34px; }
  .brand { font-size: 1.15rem; gap: 8px; }
  .topbar .add-btn { padding: 7px 10px; font-size: .86rem; }
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

/* ---- search + filters ------------------------------------------------- */

.search {
  position: relative;
  margin-bottom: 14px;
}
.search svg {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
}
.search input {
  width: 100%;
  height: 54px;
  padding: 0 18px 0 48px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--raised);
  border: 0;
  border-radius: 16px;
  outline: none;
}
.search input::placeholder { color: #7fa79c; opacity: 1; }
.search input:focus { box-shadow: inset 0 0 0 1.5px var(--accent); }

.filters { display: grid; gap: 8px; margin-bottom: 18px; }
.chip-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chip-label {
  flex: 0 0 72px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px 0;
  min-width: 0;
}
.chips::-webkit-scrollbar { display: none; }
/* relative: keeps each hidden checkbox inside the scrolling row, not
   positioned against the page (which made the whole page scroll sideways). */
.chip { position: relative; flex: none; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block;
  padding: 7px 13px;
  border-radius: 11px;
  background: var(--chip);
  color: var(--chip-ink);
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.chip:hover span { background: var(--accent-soft); }
.chip input:checked + span {
  background: transparent;
  color: var(--accent);
  box-shadow: inset 0 0 0 1.5px var(--accent);
  font-weight: 600;
}
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 560px) {
  .chip-row { flex-direction: column; align-items: stretch; gap: 4px; }
  .chip-label { flex: none; }
}

/* ---- results ---------------------------------------------------------- */

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.results-head p { margin: 0; }
.clear { color: var(--accent); font-weight: 500; text-decoration: none; }
.note {
  margin: 0 0 14px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: .95rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

.card {
  display: flex;
  flex-direction: column;
  padding: 8px;
  background: var(--card);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: transform .15s;
}
.card:hover { transform: translateY(-2px); }

.card-img, .hero {
  position: relative;
  background: var(--placeholder);
  overflow: hidden;
}
.card-img { aspect-ratio: 4 / 3; }
.card .card-img { border-radius: 18px; }
.card-img::before, .hero::before {
  content: attr(data-initial);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font: 700 2.4rem/1 var(--serif);
  color: #2b1708;
}
.card-img img, .hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.badge {
  position: absolute;
  left: 8px;
  top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(12, 36, 32, .78);
  color: #fff3d6;
  font-size: .72rem;
  font-weight: 600;
}
/* "Quick": a yellow dot in place of the mockup's clock. */
.badge:not(.badge-fav)::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.card-body { padding: 10px 6px 4px; }
.card h3 {
  margin: 0 0 4px;
  font: 600 .95rem/1.3 var(--sans);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card .meta { margin: 0; color: var(--muted); font-size: .85rem; }

.more {
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: 8px;
  padding: 10px 26px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--raised);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.more:hover { background: var(--accent-soft); }
.more.htmx-request { opacity: .6; }

.empty { text-align: center; padding: 48px 16px; }
.empty p { margin: 4px 0; }
.empty-icon { font-size: 2.4rem; }

#results.htmx-request { opacity: .6; transition: opacity .2s .1s; }

/* ---- recipe detail ---------------------------------------------------- */

.back {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
}
.recipe { max-width: 920px; margin: 0 auto; }
.hero {
  aspect-ratio: 16 / 9;
  max-height: 460px;
  width: 100%;
  border-radius: 30px;
  box-shadow: var(--shadow);
}
.hero::before { font-size: 4rem; padding-bottom: 34px; }  /* centred above the panel */
@media (max-width: 560px) {
  .hero { aspect-ratio: 3 / 2; }
}

.recipe-head { margin: 0 0 8px; }
/* Overlaps the bottom of the photo. */
.recipe-panel {
  position: relative;
  margin-top: -34px;
  padding: 18px;
  border-radius: 26px;
  background: linear-gradient(180deg, rgba(19, 113, 95, .97), rgba(12, 46, 40, .98));
  box-shadow: 0 -6px 20px rgba(0, 0, 0, .18);
}
.recipe-head h1 {
  margin: 0 0 6px;
  font: 600 clamp(1.45rem, 4.5vw, 2.3rem)/1.2 var(--serif);
  letter-spacing: -.02em;
}
.meta-line { margin: 0 0 12px; color: var(--muted); font-size: 1.05rem; }
.recipe-panel .meta-line { margin: 0; color: #cfe8e0; font-size: .95rem; }
.recipe-panel .tag-list { margin: 12px 0 0; }
.recipe-panel .tag { background: rgba(12, 36, 32, .55); color: var(--ink); }
.recipe-panel a.tag:hover { background: rgba(12, 36, 32, .8); }
.recipe-panel .tag-quiet { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 243, 214, .3); color: #cfe8e0; }
.recipe-panel .btn-ghost { background: rgba(12, 36, 32, .6); }
.recipe-panel .btn-ghost:hover { background: rgba(12, 36, 32, .85); }
.desc { color: var(--chip-ink); max-width: 68ch; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.tag {
  padding: 4px 10px;
  border-radius: 9px;
  background: var(--chip);
  color: var(--chip-ink);
  font-size: .85rem;
  font-weight: 500;
  text-decoration: none;
}
a.tag:hover { background: var(--accent-soft); }
.tag-quiet { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

.review-note {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: .95rem;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 26px;
  padding: 0;
}
.facts div {
  flex: 1 1 72px;
  max-width: 160px;
  padding: 10px 8px;
  border-radius: 14px;
  background: var(--raised);
  text-align: center;
}
.facts dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

.recipe-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 36px;
}
@media (max-width: 760px) {
  .recipe-body { grid-template-columns: 1fr; gap: 20px; }
}
.recipe h2 { font: 600 1.3rem/1.2 var(--serif); letter-spacing: -.02em; margin: 0 0 12px; }

.ingredients ul { list-style: none; margin: 0; padding: 0; }
.ingredients li { border-bottom: 1px solid var(--line); }
.ingredients label { display: flex; gap: 12px; padding: 9px 0; cursor: pointer; }
.ingredients input { accent-color: var(--accent); width: 18px; height: 18px; margin-top: 3px; flex: none; }
.ingredients input:checked + span { color: var(--muted); text-decoration: line-through; }

.steps ol { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 18px 44px;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: .9rem;
}

/* ---- cooking mode (recipe page) ---------------------------------------- */

/* Full screen: just the steps, big enough to read from the counter. */
.cook {
  --raised: var(--surface-2);
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  color: var(--ink);
  background: var(--bg);
  border: 0;
}
.cook[open] { display: flex; flex-direction: column; }
.cook::backdrop { background: var(--bg); }
html.cooking { overflow: hidden; }
.cook-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid var(--line);
}
.cook-head .eyebrow { margin-bottom: 2px; }
.cook-title { margin: 0; font: 600 1.25rem/1.25 var(--serif); letter-spacing: -.02em; overflow-wrap: anywhere; }
.cook-status:empty { display: none; }
.cook-status { margin: 8px 16px 0; }
.cook-steps {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
  margin: 0;
  padding: 14px 16px 24px;
  width: 100%;
  max-width: 760px;
  align-self: center;
}
.cook-steps li { margin-bottom: 10px; }
.cook-steps label {
  display: flex;
  gap: 14px;
  padding: 16px;
  font-size: 1.2rem;
  line-height: 1.55;
  background: var(--surface);
  border: 2px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity .2s;
}
.cook-steps input { position: absolute; opacity: 0; pointer-events: none; }
.cook-num {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 1rem;
}
.cook-text { min-width: 0; overflow-wrap: anywhere; }
.cook-now label { border-color: var(--accent); }
.cook-steps input:focus-visible + .cook-num { outline: 2px solid var(--accent); outline-offset: 2px; }
.cook-steps input:checked ~ .cook-text { color: var(--muted); text-decoration: line-through; }
.cook-steps input:checked + .cook-num { background: var(--success); color: var(--accent-ink); font-size: 0; }
.cook-steps input:checked + .cook-num::after { content: "✓"; font-size: 1.1rem; }
.cook-steps li:has(input:checked) label { opacity: .6; }
.cook-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}

.notes { margin-top: 24px; }
.notes p { white-space: pre-line; }
.source { margin-top: 28px; color: var(--muted); }
.source a { color: var(--accent); font-weight: 500; }

/* ---- buttons ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled, .btn.htmx-request { opacity: .6; cursor: progress; }
.btn-big { padding: 13px 28px; font-size: 1.05rem; border-radius: 16px; }
.btn-small { padding: 7px 13px; font-size: .88rem; }
.btn-ghost { background: var(--raised); color: var(--ink); font-weight: 500; }
.btn-ghost:hover { background: var(--accent-soft); filter: none; }
.btn-quiet { background: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--ink); filter: none; }
.btn-link {
  padding: 0;
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  font-weight: 500;
  cursor: pointer;
}

.add-btn {
  margin-left: auto;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  white-space: nowrap;
}
.add-btn:hover { filter: brightness(1.06); }
.add-btn[aria-current="page"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--accent); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 18px; }
.small { font-size: .9rem; }

/* ---- add recipe ------------------------------------------------------- */

.add { max-width: 680px; margin: 0 auto; }
.add h1 { font: 600 clamp(1.7rem, 4.5vw, 2.2rem)/1.15 var(--serif); letter-spacing: -.02em; margin: 8px 0 4px; }
.lede { margin: 0 0 18px; }

.add-box textarea, .import-card textarea, .editor input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
}
.add-box textarea { font-size: 1.05rem; resize: vertical; }
.add-box textarea:focus, .import-card textarea:focus, .editor input:focus { border-color: var(--accent); }

.import-card {
  --raised: var(--surface-2);
  --chip: var(--surface-2);
  background: var(--surface);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.import-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font: 600 1.3rem/1.25 var(--serif);
  letter-spacing: -.02em;
}
.import-title.success { color: var(--success); }
.eyebrow {
  margin: 0 0 8px;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.source-line { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.source-line a { color: inherit; }

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.stages li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.stages li::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex: none;
}
.stages li.current { color: var(--ink); font-weight: 500; }
.stages li.current::before { border-color: var(--accent); background: var(--accent); animation: pulse 1s ease-in-out infinite alternate; }
.stages li.done { color: var(--ink); }
.stages li.done::before { content: "✓"; border: 0; width: auto; height: auto; color: var(--success); font-weight: 700; }
@keyframes pulse { from { opacity: .4; } to { opacity: 1; } }

.recipe-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  margin: 4px 0 8px;
  border-radius: 16px;
  background: var(--raised);
  text-decoration: none;
}
.recipe-row-img { width: 96px; flex: none; border-radius: 12px; }
.recipe-row h3 { margin: 0 0 2px; font: 600 1.05rem/1.3 var(--sans); }
.recipe-row .meta { margin: 0; color: var(--muted); font-size: .9rem; }
a.recipe-row:hover { background: var(--accent-soft); }

.preview-details { margin-top: 10px; }
.preview-details summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.preview-lists { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; font-size: .92rem; }
.preview-lists ul, .preview-lists ol { padding-left: 18px; }
@media (max-width: 560px) { .preview-lists { grid-template-columns: 1fr; } }

.field-error { color: var(--danger); font-size: .9rem; margin: 6px 0 0; }

/* ---- add many recipes ------------------------------------------------- */

.bulk-link { margin: -10px 0 18px; }
.bulk-link a, .bulk-recent a, .from-list a { color: var(--accent); font-weight: 500; }
.bulk-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-bottom: 22px; }
.bulk-form .actions { margin-top: 6px; }
.file-pick {
  display: grid;
  gap: 2px;
  padding: 16px;
  border: 1.5px dashed var(--dashed);
  border-radius: 18px;
  background: transparent;
  cursor: pointer;
}
.file-pick:hover, .file-pick:focus-within { border-color: var(--accent); }
.file-pick-label { font-weight: 600; }
.file-pick input { margin-top: 8px; width: 100%; min-width: 0; font: inherit; font-size: .9rem; }
.file-pick input::file-selector-button {
  margin-right: 10px;
  padding: 7px 13px;
  font: inherit;
  font-weight: 500;
  color: var(--ink);
  background: var(--raised);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.bulk-form .or { margin: 0; }
.skipped { color: var(--muted); margin: 6px 0 0; padding-left: 18px; overflow-wrap: anywhere; }
details.skipped { padding-left: 0; margin-top: 16px; }
details.skipped summary { cursor: pointer; }
details.skipped ul { padding-left: 18px; }

.bulk-help p { margin: 0 0 10px; }
.bulk-columns { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 0 0 12px; }
.bulk-columns dt { font-weight: 600; font-family: ui-monospace, Consolas, monospace; font-size: .92rem; }
.bulk-columns dd { margin: 0; }
.bulk-example {
  margin: 0 0 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--raised);
  font-size: .82rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bulk-help code { font-size: .9em; background: var(--chip); padding: 1px 5px; border-radius: 6px; }
.bulk-recent { margin-top: 22px; }
.bulk-recent ul { margin: 0; padding-left: 18px; overflow-wrap: anywhere; }
.bulk-name { overflow-wrap: anywhere; }

.bulk-progress { width: 100%; height: 10px; accent-color: var(--accent); }
.bulk-summary { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 0; padding: 0; color: var(--muted); }
.bulk-summary .is-saved { color: var(--success); font-weight: 600; }
.bulk-summary .is-attention { color: var(--accent); font-weight: 600; }
.bulk-rows { list-style: none; margin: 18px 0 0; padding: 0; border-top: 1px solid var(--line); }
.bulk-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.bulk-title { flex: 1 1 14em; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.bulk-title a { text-decoration: none; }
.bulk-title a:hover { text-decoration: underline; }
.bulk-url { color: var(--muted); font-weight: 400; font-size: .9rem; }
.bulk-status { flex: none; font-size: .9rem; }
.bulk-status a { color: var(--accent); font-weight: 600; }
.is-saved .bulk-status, .is-updated .bulk-status { color: var(--success); font-weight: 600; }
.is-exists .bulk-status, .is-exists .bulk-status a { color: var(--muted); font-weight: 400; }
.bulk-detail { flex-basis: 100%; }
.bulk-detail.tag-list { margin: 4px 0 0; }

/* ---- editor ------------------------------------------------------------ */

.editor { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field > legend { font-weight: 600; font-size: .92rem; padding: 0; }
.field textarea { resize: vertical; line-height: 1.45; }
.field [aria-invalid="true"] { border-color: var(--danger); }
.field-row { display: flex; gap: 12px; align-items: end; }
.field-grow { flex: 1; }
.field-row-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 560px) { .field-row-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.field-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 10px; }
.chips-wrap { flex-wrap: wrap; overflow: visible; }
.actions-sticky {
  position: sticky;
  bottom: 0;
  margin: 0 -22px -22px;
  padding: 14px 22px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(6px);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}

.recipe-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.recipe-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 14px 0 6px; }
.recipe-actions p { margin: 0; }
.recipe-actions a { color: var(--accent); }

/* ---- weekly plan ------------------------------------------------------- */

.week { max-width: 760px; margin: 0 auto; }
.week-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.week-head .eyebrow { margin-bottom: 2px; }
.week-title { margin: 0; font: 600 clamp(1.7rem, 5vw, 2.3rem)/1.1 var(--serif); letter-spacing: -.02em; }
.week-nav { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 0;
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  list-style: none;
}
.icon-btn:hover { background: var(--accent-soft); }
summary.icon-btn::-webkit-details-marker { display: none; }

.week-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 16px; min-height: 36px; }
.week-summary p { margin: 0; }
.pill-ok { padding: 6px 12px; border-radius: 12px; background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); font-weight: 600; font-size: .9rem; }
.week-hint { text-align: center; margin-top: 20px; }

.days { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.day {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}
.day.past { opacity: .62; }
/* Opacity makes each past day its own stacking context, which trapped an
   open ⋯ menu under the next (past) day. Lift the day whose menu is open. */
.day:has(.meal-menu[open]) { position: relative; z-index: 30; opacity: 1; }
.day-label { position: relative; display: grid; justify-items: center; padding-bottom: 9px; }
.dow { font-size: .72rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dom { font: 600 1.3rem/1.15 var(--serif); }
.day.today .dow, .day.today .dom { color: var(--accent); }
.day.today .day-label::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateX(-50%);
}

.day-meals { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-height: 64px; }
.day-empty { display: flex; align-items: stretch; gap: 8px; min-height: 64px; }

/* A dinner's optional sides: smaller rows tucked under it. */
.day-body { display: grid; gap: 6px; min-width: 0; }
.day-sides { list-style: none; margin: 0; padding: 0 0 0 14px; display: grid; gap: 6px; }
.today-course .day-sides { margin-top: 8px; }
.meal-side .meal-img { width: 44px; border-radius: 12px; }
.meal-side .meal-img::before { font-size: 1.1rem; }
.meal-side .meal-main { padding: 4px 6px; gap: 10px; }
.meal-side .meal-title { font-size: .92rem; font-weight: 500; }
.meal-side .meal-menu summary.icon-btn { height: 36px; }
.side-add { display: flex; gap: 8px; }
.side-action {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 5px 8px;
  font: inherit;
  font-size: .8rem;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--dashed);
  border-radius: 14px;
  cursor: pointer;
}
.side-action:hover { border-color: var(--accent); color: var(--ink); }
.side-action span { color: var(--accent); font-size: 1rem; line-height: 1; }
.day-sides-label { margin-top: 10px; }
.note-form { display: flex; gap: 6px; margin-top: 8px; width: 100%; }
.note-form input {
  flex: 1;
  min-width: 0;
  padding: 7px 12px;
  font: inherit;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.meal {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: 22px;
  background: var(--card);
}
.day.today .meal { box-shadow: inset 0 0 0 1.5px rgba(255, 207, 63, .6); }
.meal-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 6px; text-decoration: none; }
a.meal-main:hover .meal-title { color: var(--accent); }
.meal-img { width: 84px; flex: none; border-radius: 16px; }
.meal-img::before { font-size: 1.6rem; }
.meal-text { display: grid; min-width: 0; }
.meal-title { font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meal .meta { color: var(--muted); font-size: .85rem; }
.meal-leftover .meal-img img { filter: saturate(.75); }
.meal-note .meal-img { width: 52px; }
.drag-handle { padding: 10px 8px 10px 2px; color: #4f7d73; cursor: grab; touch-action: none; font-size: 1.2rem; user-select: none; }
.meal-ghost { opacity: .35; }
.meal-chosen { box-shadow: var(--shadow), inset 0 0 0 1.5px var(--accent); }

.meal-menu { position: relative; }
.meal-menu summary.icon-btn { width: 36px; height: 44px; border-radius: 12px; font-size: 1.1rem; color: var(--muted); background: transparent; }
.meal-menu summary.icon-btn:hover { color: var(--ink); }
.meal-menu[open] summary.icon-btn { background: var(--surface-2); color: var(--ink); }
.menu {
  --chip: var(--surface);
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 20;
  width: 236px;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .45);
}
.menu > button {
  padding: 9px 10px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.menu > button:hover { background: var(--accent-soft); }
.menu .danger { color: var(--danger); }
.menu-group { padding: 6px 10px; }
.menu-label { display: block; margin-bottom: 6px; }
.menu-days { display: flex; flex-wrap: wrap; gap: 4px; }
.menu-days button {
  padding: 4px 9px;
  font: inherit;
  font-size: .85rem;
  color: var(--chip-ink);
  background: var(--chip);
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}
.menu-days button:hover { background: var(--accent); color: var(--accent-ink); }

@media (max-width: 560px) {
  .day { grid-template-columns: 40px minmax(0, 1fr); gap: 8px; }
  .meal-img { width: 64px; }
}

.day-action {
  flex: 1 1 0;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.25;
  color: var(--muted);
  background: transparent;
  border: 1.5px dashed var(--dashed);
  border-radius: 18px;
  cursor: pointer;
}
.day-action:hover { border-color: var(--accent); color: var(--ink); }
.day-action span { color: var(--accent); font-size: 1.25rem; line-height: 1; }

/* ---- recipe picker sheet ----------------------------------------------- */

.sheet {
  --raised: var(--surface-2);
  --chip: var(--surface-2);
  width: min(640px, 100vw);
  max-width: 100vw;
  max-height: min(86vh, 900px);
  margin: auto;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  border-radius: 26px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.sheet::backdrop { background: rgba(4, 16, 14, .62); }
.sheet[open] { display: flex; flex-direction: column; }
#sheet-body { overflow-y: auto; overscroll-behavior: contain; }
@media (max-width: 640px) {
  .sheet {
    margin: auto 0 0;
    width: 100vw;
    max-height: 88vh;
    border-radius: 26px 26px 0 0;
  }
}

.choose { padding: 0 18px 22px; }
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin: 0 -18px 12px;
  padding: 16px 18px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.sheet-head .eyebrow { margin-bottom: 2px; }
.sheet-title { margin: 0; font: 600 1.35rem/1.2 var(--serif); letter-spacing: -.02em; }
.choose-search .search { margin-bottom: 10px; }
.choose-search .search input { height: 48px; }
.choose-search .chips { gap: 6px; }
.choose-section { margin-top: 18px; }
.choose-label {
  margin: 0 0 8px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.choose-list { display: grid; gap: 6px; }
.choose-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid transparent;
  border-radius: 16px;
  cursor: pointer;
}
.choose-row:hover, .choose-row:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.choose-row.htmx-request { opacity: .6; }
.choose-img { width: 72px; flex: none; border-radius: 12px; }
.choose-img::before { font-size: 1.5rem; }
.choose-text { display: grid; min-width: 0; }
.choose-title { font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choose-row .meta { color: var(--muted); font-size: .85rem; }
.choose-more { text-align: center; margin: 12px 0 0; }
.choose-note { margin-top: 18px; }
.choose-note summary { list-style: none; cursor: pointer; }
.choose-note summary::-webkit-details-marker { display: none; }

/* ---- favorites, ratings, cooked ------------------------------------------ */

.feedback { display: grid; gap: 8px; margin: 16px 0 6px; }
.feedback-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.fb-btn, .rate {
  min-height: 44px;
  padding: 8px 14px;
  font: inherit;
  font-size: .9rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--raised);
  border: 0;
  border-radius: 14px;
  cursor: pointer;
}
.fb-btn { flex: 1 1 auto; }
.fb-btn:hover, .rate:hover { background: var(--accent-soft); }
.fb-btn.on { box-shadow: inset 0 0 0 1.5px var(--heart); }
.fb-done { color: var(--success); font-weight: 600; }
.rating { display: flex; flex-wrap: wrap; gap: 8px; }
.rate { flex: 1 1 auto; min-height: 42px; border-radius: 12px; color: var(--chip-ink); }
.rate.on { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 600; }
.rate-no.on { color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.cook-stats { margin: 0; }
.feedback .note { margin: 0; }
.fb-btn.htmx-request, .rate.htmx-request { opacity: .6; }

.badge-fav { left: auto; right: 10px; padding: 3px 7px; }
.fav-mark { font-size: .85em; }
.meal-cooked .meal-img { opacity: .75; }
.cooked-mark { color: var(--success); font-weight: 600; }

/* ---- insights ------------------------------------------------------------- */

.insights { max-width: 760px; margin: 0 auto; }
.insights h1 { font: 600 clamp(1.8rem, 5vw, 2.4rem)/1.1 var(--serif); letter-spacing: -.02em; margin: 2px 0 6px; }
.insight-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.insight-stats div { padding: 12px 14px; border-radius: 16px; background: var(--surface); }
.insight-stats dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.insight-stats dd { margin: 2px 0 0; font: 600 1.6rem/1.1 var(--serif); letter-spacing: -.02em; color: var(--accent); }
.insight-stats small { display: block; color: var(--muted); font: 400 .8rem/1.3 var(--sans); }
@media (max-width: 560px) { .insight-stats { grid-template-columns: 1fr 1fr; } }
.insight-section { margin-top: 26px; }
.insight-section h2 { font: 600 1.3rem/1.2 var(--serif); letter-spacing: -.02em; margin: 0 0 2px; }
.insight-section > p { margin: 0 0 10px; }
.insight-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.insight-row .recipe-row { flex: 1 1 280px; margin: 3px 0; }
.insight-why { color: var(--muted); font-size: .88rem; }
.insight-row .plan-picker { flex-basis: 100%; }

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 22px;
  padding: 22px 16px 40px;
  border-top: 1px solid var(--line);
  font-size: .92rem;
}
.footer a { color: var(--muted); text-decoration: none; }
.footer a:hover { color: var(--accent); }
.footer-form { margin: 0; }
.footer .btn-link { color: var(--muted); font-weight: 400; cursor: pointer; }
.footer .btn-link:hover { color: var(--accent); }

/* ---- signing in ------------------------------------------------------------ */

.auth { max-width: 420px; margin: 4vh auto 0; text-align: center; }
.auth h1 { font: 600 clamp(1.6rem, 6vw, 2rem)/1.15 var(--serif); letter-spacing: -.02em; margin: 4px 0 6px; }
.auth-logo { display: block; margin: 0 auto 10px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .35)); }
.auth-form, .account-form { display: grid; gap: 14px; text-align: left; }
.auth-form .btn { width: 100%; margin-top: 4px; }
.auth-form input, .account-form input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
}
.auth-form input:focus, .account-form input:focus { border-color: var(--accent); }
.auth-help { margin-top: 22px; }

/* ---- household settings and admin ------------------------------------------ */

.account-card {
  --raised: var(--surface-2);
  margin: 0 0 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.account-card h2 { margin: 0 0 6px; font: 600 1.15rem/1.25 var(--serif); }
.account-card > p { margin: 0 0 12px; }
.account-form { margin-top: 12px; }
.account-form .btn { justify-self: start; }
.plain-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; overflow-wrap: anywhere; }
.inline-form { display: inline; margin: 0 0 0 6px; }
.owner { margin-top: 12px; }
.owner summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.danger-zone .owner summary { color: var(--danger); }
.btn-danger { background: var(--danger); color: var(--accent-ink); }
.notice { color: var(--success); margin: 0 0 14px; }
.link-box { display: grid; gap: 10px; margin: 0 0 12px; }
.link-box .actions { margin-top: 0; }
.link-text {
  width: 100%;
  padding: 10px 12px;
  font: .9rem/1.3 var(--sans);
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--accent);
  border-radius: 12px;
}

/* ---- generate my week ---------------------------------------------------- */

.week-summary { flex-wrap: wrap; }
.week-actions { flex-wrap: wrap; justify-content: flex-end; }
.generate .choose-label { margin-top: 16px; }
.generated-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin: 0 0 14px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--accent-soft);
}
.generated-note p { margin: 0; }
.generated-actions { display: flex; align-items: center; gap: 6px; }

/* ---- choose for me ------------------------------------------------------- */

.week-actions { display: flex; align-items: center; gap: 8px; }
.choose-for-me { color: var(--chip-ink); }
.choose-roll { margin-top: 10px; }

.suggest-prefs { margin-bottom: 14px; }
.suggest-hero {
  display: block;
  overflow: hidden;
  border-radius: 20px;
  background: var(--raised);
  text-decoration: none;
}
.suggest-img { aspect-ratio: 16 / 10; }
.suggest-img::before { font-size: 3rem; }
.suggest-body { padding: 12px 14px 14px; }
.suggest-title { margin: 0 0 4px; font: 600 1.3rem/1.2 var(--serif); letter-spacing: -.02em; }
.suggest-hero:hover .suggest-title { color: var(--accent); }
.suggest-hero .meta { margin: 0; color: var(--muted); }
.suggest-why {
  display: inline-block;
  margin: 8px 0 0;
  padding: 3px 10px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--chip-ink);
  font-size: .82rem;
  font-weight: 500;
}
.suggest-actions { margin-top: 12px; }
.suggest-browse { text-align: center; margin: 18px 0 0; }

.roulette { max-width: 1000px; margin: 0 auto; }
.roulette h1 { font: 600 clamp(1.8rem, 5vw, 2.5rem)/1.1 var(--serif); letter-spacing: -.02em; margin: 2px 0 14px; }
.roulette-form { display: grid; gap: 10px; justify-items: start; margin-bottom: 22px; }
.count-chips { gap: 6px; }
.roulette-go { margin-top: 4px; }
.suggest-grid { display: grid; gap: 18px; max-width: 560px; }
.suggest-grid-3 { max-width: none; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.suggest-card {
  --raised: var(--surface-2);
  --chip: var(--surface-2);
  display: flex;
  flex-direction: column;
  padding: 10px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.suggest-card .suggest-hero { flex: 1; }
.suggest-card .suggest-actions { margin-top: 10px; }
.suggest-card .plan-picker { box-shadow: none; padding: 10px; }
.suggest-card-empty { justify-content: center; text-align: center; min-height: 160px; }
.roulette-again { justify-content: center; margin-top: 18px; }

/* ---- add to plan -------------------------------------------------------- */

.plan-picker {
  --raised: var(--surface-2);
  --chip: var(--surface-2);
  width: 100%;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/* On a recipe page "Add to meal plan" is the big yellow button. */
.recipe-actions .plan-picker-slot { flex: 1 1 100%; }
.recipe-actions .plan-picker-slot > .btn {
  width: 100%;
  min-height: 54px;
  border-radius: 18px;
  font-size: 1rem;
  box-shadow: 0 10px 24px rgba(255, 207, 63, .22);
}
.picker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.picker-title { margin: 0; font-weight: 600; }
.picker-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.picker-day {
  display: grid;
  gap: 2px;
  padding: 9px 12px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
}
.picker-day:hover { border-color: var(--accent); background: var(--accent-soft); }
.picker-dow { font-weight: 600; }
.picker-what { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-day.taken .picker-what { color: var(--chip-ink); }
.added-note { margin: 0; }
.added-note a { color: var(--accent); }
.success { color: var(--success); font-weight: 600; }

/* ---- groceries ---------------------------------------------------------- */

.groceries { max-width: 640px; margin: 0 auto; }
.back-link { display: inline-block; margin-bottom: 6px; color: var(--muted); text-decoration: none; font-size: .92rem; }
.back-link:hover { color: var(--accent); }
.g-head h1 { font: 600 clamp(1.7rem, 5vw, 2.2rem)/1.15 var(--serif); letter-spacing: -.02em; margin: 2px 0 4px; }
.g-for { margin: 0; font-size: .92rem; }
.g-for a { color: inherit; }
.g-for a:hover { color: var(--accent); }

.g-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 6px; }
.segmented { display: inline-flex; padding: 3px; border-radius: 14px; background: var(--raised); }
.segmented a { padding: 6px 14px; border-radius: 11px; color: var(--chip-ink); text-decoration: none; font-size: .9rem; font-weight: 500; }
.segmented a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.g-count { margin: 0 0 0 auto; color: var(--muted); }
.g-count strong { color: var(--ink); font: 600 1.2rem/1 var(--serif); }

.g-section { margin-top: 20px; }
.g-section h2, .g-staples-title { font: 600 1.15rem/1.2 var(--serif); letter-spacing: -.02em; margin: 0 0 6px; }
.g-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: 18px; }
.g-item { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; padding: 4px 14px; border-top: 1px solid var(--line); }
.g-item:first-child { border-top: 0; }
.g-check { flex: 1 1 0; display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 44px; cursor: pointer; }
.g-check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--success); cursor: pointer; }
.g-text { min-width: 0; overflow-wrap: anywhere; }
.g-name { font-weight: 500; }
.g-amount { color: var(--muted); font-size: .92rem; white-space: nowrap; }
.g-check input:checked + .g-text { color: var(--muted); text-decoration: line-through; }
.g-check input:checked + .g-text .g-name { font-weight: 400; }

.g-from { flex-basis: 100%; min-width: 0; padding: 0 0 8px 34px; margin-top: -6px; font-size: .82rem; color: var(--muted); }
.g-from summary { cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; list-style: none; }
.g-from summary::-webkit-details-marker { display: none; }
.g-from[open] summary { white-space: normal; }
.g-from ul { margin: 4px 0 0; padding-left: 16px; color: var(--ink); }

.g-remove { flex: none; width: 36px; height: 36px; font-size: 1.3rem; line-height: 1; color: var(--muted); background: none; border: 0; border-radius: 50%; cursor: pointer; }
.g-remove:hover { background: var(--accent-soft); color: var(--ink); }
.g-add { display: flex; gap: 8px; margin-top: 8px; }
.g-add input { flex: 1; min-width: 0; padding: 9px 14px; font: inherit; color: var(--ink); background: var(--raised); border: 1px solid var(--line); border-radius: 12px; outline: none; }
.g-add input:focus { border-color: var(--accent); }

.g-staples > summary { display: flex; align-items: baseline; gap: 8px; cursor: pointer; }
.g-staples > summary .g-staples-title { margin: 0 0 6px; }
/* Lists a row can go back to are always in the page; hide them while empty. */
.g-aisle:not(:has(.g-item)), .g-staples:not(:has(.g-item)), .g-cart:not(:has(.g-item)) { display: none; }
#g-extras-list:not(:has(.g-item)) { display: none; }

/* Store tabs: their own row, scrolling sideways inside if there are many. */
.g-tabs { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; margin: 4px 0 2px; }
.g-tabs a { flex: none; white-space: nowrap; }
.g-tab-count { margin-left: 4px; font-size: .78rem; opacity: .75; }
.g-anywhere h2 { color: var(--muted); }

/* A ticked row fades before it moves to In cart. */
.g-item.g-leaving { opacity: .35; transition: opacity .9s ease-in; }
.g-cart > summary { display: flex; align-items: baseline; gap: 8px; cursor: pointer; }
.g-cart-title { font: 600 1.15rem/1.2 var(--serif); letter-spacing: -.02em; margin: 0 0 6px; color: var(--muted); }
.g-cart .g-store, .g-cart .g-from, .g-cart .g-remove, .g-cart .g-have { display: none; }

/* The store chip and its menu. */
.g-store { position: relative; flex: none; }
.g-chip { display: block; max-width: 8.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 9px; border-radius: 9px; background: var(--surface-2); color: var(--chip-ink);
  font-size: .78rem; font-weight: 500; cursor: pointer; list-style: none; user-select: none; }
.g-chip::-webkit-details-marker { display: none; }
.g-chip-empty { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.g-chip-once { box-shadow: inset 0 0 0 1px var(--accent); }
.g-store[open] .g-chip { background: var(--accent); color: var(--accent-ink); }
.g-store-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 230px;
  padding: 10px; border-radius: 14px; background: var(--surface-2); box-shadow: var(--shadow); }
.g-scope { display: flex; gap: 12px; margin-bottom: 8px; font-size: .82rem; color: var(--muted); }
.g-scope label { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.g-scope input { margin: 0; accent-color: var(--accent); }
.g-store-options { display: flex; flex-direction: column; gap: 4px; }
.g-store-options button { padding: 9px 12px; font: inherit; font-size: .95rem; text-align: left; color: var(--ink);
  background: var(--raised); border: 0; border-radius: 10px; cursor: pointer; }
.g-store-options button:hover { background: var(--accent-soft); }
.g-store-options button[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--accent); }
.g-store-options button[aria-pressed="true"]::after { content: " ✓"; color: var(--accent); }
.g-store-new { display: flex; gap: 6px; margin-top: 8px; }
.g-store-new input, .g-rename input { flex: 1; min-width: 0; padding: 7px 10px; font: inherit; font-size: .9rem; color: var(--ink);
  background: var(--raised); border: 1px solid var(--line); border-radius: 10px; outline: none; }
.g-store-new input:focus, .g-rename input:focus { border-color: var(--accent); }

.g-manage { margin-top: 28px; }
.g-manage > summary { cursor: pointer; }
.g-store-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.g-store-list li { display: flex; align-items: center; gap: 6px; }
.g-rename { flex: 1; display: flex; gap: 6px; min-width: 0; }

.g-skipped { margin-top: 24px; }
.g-skipped summary { cursor: pointer; }
.g-skipped ul { color: var(--muted); padding-left: 18px; }
.g-skipped a { color: var(--accent); }

/* ---- template nights ----------------------------------------------------- */

/* A template's emoji where a recipe has a photo. */
.template-img::before {
  font: 400 2.2rem/1 "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  color: var(--ink);
}
.meal-img.template-img::before { font-size: 1.9rem; }
.choose-img.template-img::before { font-size: 1.8rem; }
.suggest-img.template-img::before { font-size: 4.5rem; }
/* The tappable area of a template dinner (opens its options). */
button.meal-main { font: inherit; color: inherit; text-align: left; background: none; border: 0; border-radius: 12px; cursor: pointer; }
button.meal-main:hover .meal-title, button.meal-main:focus-visible .meal-title { color: var(--accent); }
.meal-template .meal .meta, .meal-template .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.choose-label-link { margin-left: 8px; color: var(--accent); text-transform: none; letter-spacing: 0; font-weight: 500; }
.choose-templates { margin-bottom: 14px; }
.template-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 6px;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid transparent;
  border-radius: 16px;
  cursor: pointer;
}
.template-row:hover, .template-row:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.template-row.htmx-request { opacity: .6; }
.template-row .meta { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The options sheet. */
.t-pick { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.t-pick .chip input { position: absolute; opacity: 0; }
.t-notes { margin: 4px 0 0; }

/* The list page. */
.t-page-actions { margin: 0 0 16px; }
.t-list { display: grid; gap: 10px; }
.t-card {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  text-decoration: none;
  scroll-margin-top: 80px;
}
.t-card:hover .t-card-name { color: var(--accent); }
.t-card:target { outline: 2px solid var(--accent); }
.t-card-icon { width: 72px; flex: none; border-radius: 16px; }
.t-card-body { display: grid; gap: 2px; min-width: 0; }
.t-card-name { font: 600 1.1rem/1.25 var(--serif); letter-spacing: -.02em; margin-bottom: 2px; }
.t-card .meta { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.t-card .meta strong { color: var(--ink); font-weight: 600; }

/* The editor. */
.t-emoji { width: 84px; flex: none; }
.t-emoji input { text-align: center; }
.template-editor .field-row input { height: 50px; }
.t-parts { display: grid; gap: 12px; }
.t-part { margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); min-width: 0; }
.t-part-head { display: flex; align-items: center; gap: 10px; }
.t-part-head input { flex: 1; min-width: 0; font-weight: 600; }
.t-remove-part { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.t-options { list-style: none; margin: 10px 0 6px; padding: 0 0 0 12px; display: grid; gap: 8px; border-left: 2px solid var(--line); }
.t-option-main { display: flex; align-items: center; gap: 4px; }
.t-option-main input { flex: 1; min-width: 0; }
.t-groceries { margin: 4px 0 0; font-size: .88rem; color: var(--muted); }
.t-groceries summary { cursor: pointer; }
.t-groceries textarea { margin-top: 6px; font-size: .95rem; }
.t-add-part { justify-self: start; margin-top: 10px; }
.t-delete { margin-top: 18px; text-align: center; }
.t-delete-btn { color: var(--danger); }

/* ---- pantry ------------------------------------------------------------ */

.p-item { min-height: 52px; }
.p-item .g-text { flex: 1 1 0; }
/* Have / Out: one tap flips it. */
.p-state { flex: none; min-width: 74px; padding: 6px 12px; font: inherit; font-size: .88rem; font-weight: 600;
  color: var(--success); background: var(--surface-2); border: 0; border-radius: 10px; cursor: pointer; }
.p-out .p-state { color: var(--accent-ink); background: var(--accent); }
.p-out .g-name { color: var(--accent); }

/* Setup: – / Have / Out per row, a segmented radio group. */
.p-pick { flex: none; display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.p-pick label { cursor: pointer; }
.p-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.p-pick span { display: block; min-width: 30px; padding: 5px 9px; border-radius: 9px; text-align: center;
  font-size: .82rem; font-weight: 500; color: var(--chip-ink); }
.p-pick input:checked + span { background: var(--surface); color: var(--ink); }
.p-pick input[value="have"]:checked + span { background: var(--success); color: var(--accent-ink); font-weight: 600; }
.p-pick input[value="out"]:checked + span { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.p-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.p-save { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 35%); text-align: center; }
.p-save .btn { min-width: 60%; }
.used-up .g-list { margin-top: 10px; background: var(--surface); }
.used-up-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.card .card-pantry { margin-top: 2px; color: var(--accent); }
.used-up-inline { padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); }
.used-up-inline h3 { margin: 0 0 2px; font: 600 1.05rem/1.2 var(--serif); }
.used-up-inline .g-list { margin-top: 8px; }
.used-up-inline .used-up-actions { margin-top: 10px; }
/* 🏠 Have it: found at home, so it joins the pantry (and moves to At home). */
.g-have { flex: none; width: 36px; height: 36px; font-size: 1.05rem; line-height: 1; background: none; border: 0; border-radius: 50%; cursor: pointer; opacity: .75; }
.g-have:hover, .g-have:focus-visible { background: var(--accent-soft); opacity: 1; }

/* ---- meal tabs: Dinner / Breakfast / Lunch / Treats ---------------------- */
.course-tabs { display: flex; width: 100%; margin-top: 4px; }
.course-tabs a { flex: 1 1 0; min-width: 0; text-align: center; padding: 8px 4px; }
@media (max-width: 350px) { .course-tabs a { font-size: .82rem; } }
/* The day's label opens its whole menu. */
button.day-label { border: 0; background: none; color: inherit; font: inherit; cursor: pointer;
  border-radius: 12px; padding-top: 4px; }
button.day-label:hover .dow, button.day-label:focus-visible .dow { color: var(--accent); }
button.day-label:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.treats-note { margin: 0 0 10px; }
.treat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.day-menu .day-course { margin-top: 14px; }
.day-course-list { list-style: none; margin: 0; padding: 0; }
.day-menu .day-action { width: 100%; min-height: 52px; }
.picker-courses { display: flex; margin-bottom: 10px; }
.picker-courses a { flex: 1 1 0; min-width: 0; text-align: center; padding: 6px 4px; font-size: .85rem; }
.day-menu a.choose-row { color: inherit; text-decoration: none; }

/* ---- ☀️ Today ------------------------------------------------------------ */
.today-course { margin-top: 18px; }
.today-course-title { font: 600 1.15rem/1.2 var(--serif); letter-spacing: -.02em; margin: 0 0 8px; }
.today-meals { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
/* No dragging here: every meal is on the same day. */
.today-view .drag-handle { display: none; }

/* ---- 👥 people: who's this phone? ---------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.who-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 8px; border-radius: 999px;
  background: var(--raised); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: .9rem; white-space: nowrap;
}
.who-chip > span:first-child { font-size: 1.15rem; line-height: 1; }
.who-chip:hover { background: var(--accent-soft); }
.who-chip-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  /* Just the face, so the top bar stays one row. */
  .who-chip { padding: 0; width: 38px; height: 38px; justify-content: center; }
  .who-chip-name { display: none; }
}
@media (max-width: 350px) { .who-chip { width: 34px; height: 34px; } }

.who-list { display: grid; gap: 10px; }
.who-pick {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px;
  padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--raised); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
}
.who-pick:hover, .who-pick:focus-visible { background: var(--accent-soft); }
.who-pick.on { border-color: var(--accent); }
.who-emoji { font-size: 1.8rem; line-height: 1; }
.who-text { display: grid; }
.who-name { font-weight: 600; font-size: 1.05rem; }

.people-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; }
.person details { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.person summary {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none;
}
.person summary::-webkit-details-marker { display: none; }
.person-edit { margin-left: auto; }
.badge-me { font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.person details > form { padding: 0 16px 14px; --raised: var(--surface-2); }
.person-form { display: grid; gap: 12px; }
.person-add { padding: 16px; border: 1px dashed var(--dashed); border-radius: var(--radius); }
.person-add h2 { margin: 0; font: 600 1.15rem/1.2 var(--serif); }
.person-remove { color: var(--danger); }
.emoji-choices { display: flex; flex-wrap: wrap; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.emoji-choice input { position: absolute; opacity: 0; pointer-events: none; }
.emoji-choice span {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  font-size: 1.35rem; background: var(--raised); border: 2px solid transparent; cursor: pointer;
}
.emoji-choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.emoji-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.everyones { margin: 10px 0 0; }
.everyone { white-space: nowrap; }
