/* Kokette: an old cookbook with a modern layout. Cream paper, a serif for
   everything that is a title, double rules, recipe cards with a red line
   under the name, marks that look stamped, and a strip of checked tablecloth
   under the masthead. Deep green like a cast-iron pot, a tomato for what
   matters. The same page is the app's interface inside a web view, so
   everything starts from a phone and widens: one column, then two, then the
   whole screen (--kant keeps the content within 1240 px without wrappers). */
:root {
  --green: #1f4d3a;
  --green-dark: #153628;
  --green-mid: #3f7d55;
  --green-soft: #e6efe7;
  --green-line: #c5d8c9;
  --cream: #faf5ec;
  --paper: #fffdf9;
  --tomato: #e2543b;
  --tomato-dark: #b83b25;
  --tomato-soft: #fbe6df;
  --amber: #8a5a00;
  --amber-mid: #c98a1b;
  --amber-soft: #fbefcf;
  --ink: #1b2822;
  --muted: #5b685f;
  --line: #e3d7c0;
  --rule: #cdbf9f;
  --field: #d3c8b4;
  --radius: 8px;
  --radius-s: 6px;
  --shadow: 0 1px 0 rgba(90, 70, 30, 0.06), 0 3px 10px rgba(90, 70, 30, 0.06);
  --shadow-up: 0 2px 0 rgba(90, 70, 30, 0.08), 0 12px 26px rgba(90, 70, 30, 0.14);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --tabs: 64px;
  --page: 1240px;
  --kant: max(16px, calc(50% - var(--page) / 2));
  --gap: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0;
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg, rgba(120, 95, 45, 0.028) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(120, 95, 45, 0.028) 0 1px, transparent 1px 3px),
    var(--cream);
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 0.4em; color: var(--green-dark); text-wrap: balance; }
h1 { font-size: 1.9rem; letter-spacing: -0.01em; }
.page > h1::after, .page-head h1::after, .recipe-head h1::after { content: ""; display: block; width: 56px; height: 5px; margin-top: 10px; border-top: 2px solid var(--tomato); border-bottom: 1px solid var(--tomato); }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.8em; }
a { color: var(--green); text-underline-offset: 3px; }
ul, ol { margin: 0; padding: 0; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--tomato); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ── frame ── */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px;
  padding: 6px var(--kant);
  padding-top: calc(6px + env(safe-area-inset-top));
  background: var(--paper); color: var(--green-dark);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 6px 16px rgba(90, 70, 30, 0.08);
}
/* the tablecloth: a strip of red check under the masthead */
.top::after {
  content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 8px; margin-top: 1px;
  background:
    repeating-linear-gradient(90deg, rgba(226, 84, 59, 0.55) 0 4px, transparent 4px 8px),
    repeating-linear-gradient(0deg, rgba(226, 84, 59, 0.55) 0 4px, transparent 4px 8px),
    var(--paper);
  border-bottom: 1px solid var(--rule);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--green-dark); text-decoration: none; font: 700 1.5rem/1 var(--serif); letter-spacing: 0.01em; min-height: 44px; }
.brand img { display: block; width: 32px; height: 32px; }
main { padding: 30px var(--kant) calc(var(--tabs) + 36px + env(safe-area-inset-bottom)); }
body.plain main { padding-bottom: 48px; }
.page { display: flow-root; }
.page > * + * { margin-top: var(--gap); }
.page > h1 + * { margin-top: 6px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px 24px; }
.page-head > div > :last-child { margin-bottom: 0; }

/* the tabs: along the bottom on a phone, in the top band on a wide screen */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  display: flex; justify-content: space-around;
  background: rgba(255, 253, 249, 0.96); border-top: 3px double var(--rule);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  padding: 0 4px env(safe-area-inset-bottom);
}
/* signed out: one button, in the masthead on every width */
.tabs.out { position: static; flex: none; background: none; border: 0; padding: 0; backdrop-filter: none; -webkit-backdrop-filter: none; }
.tab {
  flex: 1 1 0; min-width: 0; min-height: var(--tabs);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); text-decoration: none; font-size: 0.7rem; font-weight: 600;
}
.tab .icon { box-sizing: content-box; padding: 4px 16px; border-radius: 999px; transition: background 0.15s; }
.tab[aria-current="page"] { color: var(--green-dark); }
.tab[aria-current="page"] .icon { background: var(--green-soft); color: var(--green); }
.icon { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
@media (min-width: 800px) {
  body { font-size: 16px; }
  .tabs { position: static; background: none; border: 0; padding: 0; gap: 2px; justify-content: flex-end; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .tab { flex: none; flex-direction: row; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 0; color: var(--muted); font: 600 1.02rem var(--serif); letter-spacing: 0.01em; box-shadow: inset 0 -3px 0 transparent; transition: color 0.15s, box-shadow 0.15s; }
  .tab:hover { color: var(--green-dark); box-shadow: inset 0 -3px 0 var(--rule); }
  .tab .icon { width: 20px; height: 20px; padding: 0; border-radius: 0; }
  .tab[aria-current="page"] { color: var(--green-dark); box-shadow: inset 0 -3px 0 var(--tomato); }
  .tab[aria-current="page"] .icon { background: none; color: var(--tomato-dark); }
  main { padding-top: 40px; padding-bottom: 64px; }
  h1 { font-size: 2.1rem; }
  :root { --gap: 20px; }
}

/* ── text ── */
.lead { font-size: 1.05rem; color: var(--muted); }
.note { color: var(--muted); font-size: 0.9rem; }
.meta { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.4em; }
.center { text-align: center; }
.loading { color: var(--muted); padding: 32px 0; text-align: center; }
.error { background: var(--tomato-soft); border: 1px solid var(--tomato); color: #7a2414; border-radius: var(--radius); padding: 12px 14px; }
.error p:last-child { margin-bottom: 0; }
.error .btn { margin-top: 10px; }
.warning { background: var(--amber-soft); border: 1px solid #e3c877; border-radius: var(--radius); padding: 14px; }
.warning h2 { color: var(--amber); font-size: 1.05rem; }
.warning ul { padding-left: 1.2em; }
.warning > :last-child { margin-bottom: 0; }
.empty { text-align: center; padding: 40px 16px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty p:first-child { font: 600 1.2rem var(--serif); color: var(--green-dark); }
.save-status { min-height: 1.4em; margin: 0; color: var(--muted); font-size: 0.88rem; }
.page > h1 + .save-status { margin-top: -4px; text-align: right; }
.page > .save-status + * { margin-top: 4px; }

/* ── cards, buttons, fields ── */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; list-style: none; position: relative; box-shadow: var(--shadow); }
.card > :last-child { margin-bottom: 0; }
.card > h2:first-child { font-variant: small-caps; letter-spacing: 0.05em; font-size: 1.3rem; padding-bottom: 8px; margin-bottom: 12px; border-bottom: 3px double var(--rule); }
.card.inset { background: var(--green-soft); border-color: var(--green-line); margin-top: 12px; box-shadow: none; }
.card.danger-zone { border-color: #efc4b9; }
.cards { display: grid; gap: 14px; list-style: none; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 20px;
  font: 600 1rem/1.2 inherit; font-family: inherit; text-decoration: none; text-align: center;
  color: var(--cream); background: var(--green); border: 1.5px solid var(--green-dark); border-radius: var(--radius); cursor: pointer;
  box-shadow: 0 3px 0 var(--green-dark); letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, box-shadow 0.05s;
}
.btn:hover { background: var(--green-dark); }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--green-dark); }
.btn.accent { background: var(--tomato); border-color: var(--tomato-dark); color: #fff; box-shadow: 0 3px 0 var(--tomato-dark); }
.btn.accent:hover { background: #d44a32; }
.btn.accent:active:not(:disabled) { box-shadow: 0 1px 0 var(--tomato-dark); }
.btn.ghost { background: var(--paper); color: var(--green); border-color: var(--rule); box-shadow: 0 3px 0 var(--line); }
.btn.ghost:hover { background: var(--green-soft); }
.btn.ghost:active:not(:disabled) { box-shadow: 0 1px 0 var(--line); }
.btn.danger { background: var(--tomato-dark); border-color: #8f2a18; color: #fff; box-shadow: 0 3px 0 #8f2a18; }
.btn.danger-text { color: var(--tomato-dark); border-color: #e5b5a8; }
.btn.big { min-height: 54px; font-size: 1.08rem; padding: 12px 28px; }
.btn.small { min-height: 40px; padding: 6px 14px; font-size: 0.92rem; }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.actions.stack { flex-direction: column; align-items: stretch; }
.actions.end { justify-content: flex-end; }
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 8px 0 0; background: none; border: 0; color: var(--green); font: 600 1rem inherit; font-family: inherit; cursor: pointer; text-decoration: none; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field > label, .label, .search > label { font-weight: 600; font-size: 0.9rem; color: var(--green-dark); }
input[type="text"], input[type="search"], input[type="url"], input[type="number"], input[type="date"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px;
  font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--field); border-radius: var(--radius-s);
  box-shadow: inset 0 1px 2px rgba(90, 70, 30, 0.08);
}
input[type="search"] { padding-left: 42px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b685f' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E") 12px 50% / 20px no-repeat; }
textarea { resize: vertical; line-height: 1.45; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--tomato); outline-offset: 1px; border-color: var(--green); }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 12px; align-items: end; }
.field-row.end .btn { margin-bottom: 12px; }
.card > .field-row { margin-top: 14px; }

.check { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--green); margin: 0; }
.tick-group { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.tick-group legend { font: 700 1.02rem var(--serif); font-variant: small-caps; letter-spacing: 0.05em; color: var(--green-dark); padding: 0; margin-bottom: 2px; }
.ticks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.chip {
  min-height: 44px; padding: 8px 16px; border-radius: 999px;
  font: 600 0.96rem inherit; font-family: inherit; color: var(--green);
  background: #fff; border: 1.5px solid var(--green-line); cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.chips.small .chip { min-height: 40px; padding: 6px 12px; font-size: 0.9rem; }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: var(--cream); }
.chip.add { border-style: dashed; color: var(--tomato-dark); border-color: var(--tomato); }
.chip.remove { background: var(--green-soft); }
.chip.mapped { border-radius: 10px; text-align: left; }

.segmented { display: flex; background: #efe6d6; border-radius: var(--radius); padding: 4px; gap: 4px; margin-bottom: 14px; }
.segmented button {
  flex: 1 1 0; min-width: 0; min-height: 42px; padding: 6px 8px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font: 600 0.95rem inherit; font-family: inherit; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--paper); color: var(--green-dark); box-shadow: 0 1px 3px rgba(29, 42, 36, 0.18); }

.stepper { display: inline-flex; align-items: center; gap: 4px; }
.step { width: 46px; height: 46px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1.5px solid var(--green-line); background: #fff; color: var(--green); cursor: pointer; }
.step:hover:not(:disabled) { background: var(--green-soft); }
.step:disabled { opacity: 0.35; cursor: not-allowed; }
.stepper-value { min-width: 2.2em; text-align: center; font: 700 1.25rem var(--serif); }

/* how much there is: four steps in one joined bar, fuller and greener */
.levels { display: grid; grid-template-columns: repeat(4, 1fr); background: #f1e9db; border-radius: var(--radius); padding: 3px; gap: 2px; }
.level {
  min-height: 38px; padding: 4px 2px; border-radius: 6px; border: 0;
  background: transparent; color: var(--muted); font: 600 0.85rem inherit; font-family: inherit; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.level:hover { background: rgba(255, 255, 255, 0.7); }
.level[aria-pressed="true"] { color: #fff; box-shadow: 0 1px 3px rgba(29, 42, 36, 0.25); }
.level.l0[aria-pressed="true"] { background: #7d857f; }
.level.l1[aria-pressed="true"] { background: var(--amber-mid); }
.level.l2[aria-pressed="true"] { background: var(--green-mid); }
.level.l3[aria-pressed="true"] { background: var(--green); }

/* a star that is on or off: "always at home" */
.pin { width: 44px; height: 44px; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: none; color: #b9ad97; cursor: pointer; }
.pin:hover { background: var(--amber-soft); color: var(--amber-mid); }
.pin[aria-pressed="true"] { color: var(--amber-mid); }
.pin[aria-pressed="true"] .icon { fill: currentColor; }
.legend { display: inline-flex; align-items: center; gap: 6px; margin: 0; color: var(--muted); font-size: 0.88rem; }
.legend .icon { width: 18px; height: 18px; color: var(--amber-mid); fill: currentColor; }

/* catalogue search */
.search { display: flex; flex-direction: column; gap: 4px; position: relative; }
.hits { list-style: none; background: #fff; border: 1.5px solid var(--field); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-up); }
.hits li + li { border-top: 1px solid var(--line); }
.hit { width: 100%; min-height: 46px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; padding: 10px 14px; background: none; border: 0; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.hit:hover, .hit:focus-visible { background: var(--green-soft); }
.hit-name { font-weight: 600; }
.hit-via, .hit-note { color: var(--muted); font-size: 0.88rem; }
.hit-note { margin-left: auto; }
.hit-none { padding: 12px 14px; color: var(--muted); }

.guest { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; margin: 12px 0 0; background: var(--cream); min-width: 0; }
.guest legend { font-weight: 700; padding: 0 6px; }
.guests .note { margin-top: 8px; }

.dialog { border: 1px solid var(--rule); outline: 1px solid var(--rule); outline-offset: -7px; border-radius: var(--radius); padding: 24px; width: min(92vw, 460px); color: var(--ink); background: var(--paper); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); }
.dialog::backdrop { background: rgba(21, 54, 40, 0.55); }
.dialog .actions { justify-content: flex-end; margin-top: 16px; }

.codebox { background: var(--green-soft); border: 1px solid var(--green-line); border-radius: var(--radius); padding: 16px; text-align: center; }
.code { display: block; margin: 8px 0 12px; font: 700 1.5rem/1.3 ui-monospace, Consolas, monospace; letter-spacing: 0.06em; color: var(--green-dark); user-select: all; overflow-wrap: anywhere; }
.codebox .actions { justify-content: center; }
.copied { color: var(--muted); font-size: 0.9rem; }
.photo-wrap { display: inline-flex; }

#toasts { position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs) + 14px + env(safe-area-inset-bottom)); z-index: 20; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
body.plain #toasts { bottom: 16px; }
.toast { margin: 0; max-width: 480px; padding: 12px 18px; border-radius: var(--radius); background: var(--green-dark); color: var(--cream); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
.toast.error { background: var(--tomato-dark); color: #fff; }
@media (min-width: 800px) { #toasts { bottom: 24px; } }

/* ── welcome ── */
.welcome { display: grid; gap: 28px; align-items: center; max-width: 560px; margin: 0 auto; }
.hero { text-align: center; padding: 12px 0 0; }
.hero-mark { width: 76px; height: 76px; filter: drop-shadow(0 8px 16px rgba(21, 54, 40, 0.25)); }
.hero h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); line-height: 1.08; margin: 14px 0 12px; }
.hero h1 em { font-style: italic; color: var(--tomato-dark); }
.kicker { font: 700 0.9rem var(--serif); font-variant: small-caps; letter-spacing: 0.16em; color: var(--tomato-dark); margin: 14px 0 0; }
.hero .lead { font: italic 1.2rem/1.45 var(--serif); color: var(--ink); max-width: 30em; margin-inline: auto; }
.hero .actions { justify-content: center; margin-top: 22px; }
.hero .btn.big { min-width: min(100%, 300px); }
.hero .note { margin: 14px auto 0; max-width: 34em; }
.hero .error { margin-top: 16px; text-align: left; }
.points { list-style: none; display: grid; gap: 12px; }
.points { background: var(--paper); border: 1px solid var(--rule); outline: 1px solid var(--rule); outline-offset: -6px; border-radius: var(--radius); padding: 14px 22px; box-shadow: var(--shadow); gap: 0; }
.points li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--rule); }
.points li:last-child { border-bottom: 0; }
.points li.points-title { display: block; font: 700 0.95rem var(--serif); font-variant: small-caps; letter-spacing: 0.12em; text-align: center; color: var(--tomato-dark); padding: 6px 0 12px; border-bottom: 3px double var(--rule); }
.points .icon { box-sizing: content-box; padding: 9px; border-radius: 50%; border: 1.5px solid currentColor; color: var(--green); }
.points li:nth-child(3) .icon { color: var(--tomato-dark); }
.points li:nth-child(4) .icon { color: var(--amber); }
.points.plain { background: none; border: 0; outline: 0; box-shadow: none; padding: 0; }
.points.plain li { display: block; border: 0; padding: 2px 0 2px 24px; position: relative; }
.points.plain li::before { content: ""; position: absolute; left: 4px; top: 0.6em; width: 8px; height: 8px; border-radius: 50%; background: var(--tomato); }
.welcome-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 20px; }
.lang-switch { display: flex; justify-content: center; gap: 8px; }
.lang-switch .chip { min-height: 40px; padding: 6px 14px; font-size: 0.9rem; }
.steps { color: var(--tomato-dark); font-weight: 700; font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 0; }
body[data-view="start"] .page { max-width: 760px; margin: 0 auto; }
@media (min-width: 960px) {
  body[data-view="valkommen"] main { padding-top: clamp(28px, 8vh, 96px); }
  .welcome { max-width: 1120px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 56px; }
  .hero { text-align: left; padding: 0; }
  .hero .lead { margin-inline: 0; font-size: 1.3rem; }
  .hero .actions { justify-content: flex-start; }
  .hero .note { margin-inline: 0; }
  .welcome-foot { justify-content: flex-start; grid-column: 1 / -1; }
}

/* ── pantry ── */
.pantry-tools { display: grid; gap: 12px; }
.scan-bar .note { margin: 6px 0 0; }
.scan-panel .actions { margin-top: 14px; }
.pantry-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }
.pantry-list { column-gap: var(--gap); }
.group { break-inside: avoid; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: var(--gap); overflow: hidden; }
.group h2 { margin: 0; padding: 12px 16px 9px; font-size: 1.12rem; font-variant: small-caps; letter-spacing: 0.06em; background: #f7f0e3; border-bottom: 3px double var(--rule); display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.group h2 .count { font: 600 0.8rem system-ui, sans-serif; font-variant: normal; letter-spacing: 0; color: var(--muted); }
.rows { list-style: none; display: grid; gap: 8px; }
.group .rows { gap: 0; }
.pantry-row { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 4px; padding: 4px 10px 10px 4px; }
.group .pantry-row + .pantry-row { border-top: 1px solid var(--line); }
.pantry-row .levels { grid-column: 1 / -1; margin-left: 10px; }
.pantry-row.none .name { color: var(--muted); }
.pantry-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.name { font-weight: 650; }
.sunk, .read-as { color: var(--amber); font-size: 0.82rem; }
.read-as { color: var(--muted); margin: 0; }
.pantry-name .check { color: var(--ink); font-weight: 700; font-size: 1rem; min-height: 40px; }
.rows.review .pantry-row { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; grid-template-columns: minmax(0, 1fr); }
.rows.review .pantry-row .levels { margin-left: 0; }
.pantry-row.unknown { border-color: #e3c877; background: #fffaf0; }
@media (min-width: 560px) {
  .pantry-row { grid-template-columns: auto minmax(0, 1fr) minmax(240px, 280px); padding: 5px 10px 5px 4px; }
  .pantry-row .levels { grid-column: auto; margin-left: 0; }
  .rows.review .pantry-row { grid-template-columns: minmax(0, 1fr) 260px; }
}
@media (min-width: 800px) {
  .pantry-tools { grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .pantry-tools .scan-bar .note { display: none; }
}
@media (min-width: 1120px) { .pantry-list { columns: 2; } }

/* ── cook now, recipes ── */
.suggestion { display: flex; flex-direction: column; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.suggestion:hover, .recipe-link:hover { border-color: var(--green-line); box-shadow: var(--shadow-up); transform: translateY(-2px); }
.suggestion-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1.5px solid #ecb7ab; }
.suggestion-head h3 { margin: 0 0 2px; font-size: 1.15rem; }
.cover { flex: none; min-width: 3.4em; padding: 2px 8px; border: 1.5px solid currentColor; border-radius: 4px; font: 700 0.88rem/1.5 var(--serif); text-align: center; color: var(--green-mid); transform: rotate(2deg); }
.cover.full { color: var(--green-dark); background: var(--green-soft); }
.cover.low { color: var(--amber); }
.suggestion .tags { margin-top: auto; padding-top: 4px; }
.stretched { text-decoration: none; color: inherit; }
.stretched::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 6px; overflow: hidden; background: #ece2d0; accent-color: var(--green-mid); display: block; margin: 6px 0 12px; }
progress::-webkit-progress-bar { background: #ece2d0; }
progress::-webkit-progress-value { background: var(--green-mid); border-radius: 6px; }
progress::-moz-progress-bar { background: var(--green-mid); }
.missing { margin-bottom: 0.5em; font-size: 0.95rem; }
.missing strong { color: var(--tomato-dark); }
.missing.all { color: var(--green); font-weight: 600; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { background: var(--amber-soft); color: var(--amber); border-radius: 4px; padding: 2px 9px; font-size: 0.8rem; font-weight: 600; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 4px; font: 700 0.7rem/1.6 system-ui, sans-serif; letter-spacing: 0.07em; text-transform: uppercase; white-space: nowrap; vertical-align: middle; }
.badge.flexible { border: 1.5px solid currentColor; color: var(--green-mid); margin-left: 8px; }
.ways { background: var(--amber-soft); border: 1px solid #e3c877; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; }
.ways h3 { color: var(--amber); font-size: 1rem; font-variant: small-caps; letter-spacing: 0.05em; }
.ways ul { list-style: none; display: grid; gap: 8px; }
.badge.st-have { background: var(--green-soft); color: var(--green-dark); }
.badge.st-compose { background: #dcebf0; color: #1e4f5e; }
.badge.st-substitute { background: var(--amber-soft); color: var(--amber); }
.badge.st-buy { background: var(--tomato-soft); color: var(--tomato-dark); }
.badge.st-skip { background: #ece8e0; color: var(--muted); }
.badge.st-blocked { background: #7a2414; color: #fff; }
.results > h2 { margin-bottom: 12px; }
.results > .note { margin-top: 16px; }
@media (min-width: 1000px) {
  body[data-view="laga"] .page { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 8px 28px; align-items: start; }
  body[data-view="laga"] .page > * { margin-top: 0; }
  body[data-view="laga"] .page > h1 { grid-column: 1 / -1; }
  .cook-setup { position: sticky; top: 84px; }
  .cook-setup .field-row { grid-template-columns: 1fr; }
}

.items { list-style: none; display: grid; gap: 6px; }
.item { background: var(--paper); border: 1px solid var(--line); border-left: 5px solid var(--line); border-radius: 6px; padding: 8px 12px; }
.item.st-have { border-left-color: var(--green-mid); }
.item.st-compose { border-left-color: #3b8298; }
.item.st-substitute { border-left-color: #d49a1e; }
.item.st-buy { border-left-color: var(--tomato); }
.item.st-blocked { border-left-color: #7a2414; }
.item.st-skip { opacity: 0.75; }
.item-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.item-name { font-weight: 600; flex: 1 1 8em; }
.optional { font-weight: 400; color: var(--muted); font-size: 0.88rem; }
.item-amount { color: var(--muted); white-space: nowrap; }
.item-detail { margin: 4px 0 0; font-size: 0.92rem; }
.score { font-weight: 700; }
.score.s-good { color: #2f6a45; }
.score.s-ok { color: var(--amber); }
.score.s-different { color: var(--tomato-dark); }
.items.parts { margin: 8px 0 2px 4px; }
.items.parts .item { background: var(--cream); }
.summary { font-weight: 600; }
.plain-list, .steps-list { padding-left: 1.4em; }
.steps-list { list-style: none; padding: 0; counter-reset: step; display: grid; gap: 14px; }
.steps-list li { counter-increment: step; display: grid; grid-template-columns: 34px 1fr; gap: 16px; align-items: start; font-size: 1.05rem; line-height: 1.55; }
.steps-list li::before { content: counter(step); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--tomato); outline: 1px solid var(--tomato); outline-offset: 2px; color: var(--tomato-dark); font: 700 1rem var(--serif); }
.recipe-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; }
.recipe-head h1 { margin-bottom: 4px; }
.recipe-head .meta { margin: 0; }
.recipe-context { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 20px; padding: 10px 16px; }
.recipe-context .field { margin: 0; flex-direction: row; align-items: center; gap: 12px; }
.recipe-context .note { margin: 0; }
.recipe-cols { display: grid; gap: 24px; margin-top: var(--gap); }
.recipe-cols section > :last-child { margin-bottom: 0; }
.recipe-cols section > * + h2, .recipe-cols section > * + h3 { margin-top: 20px; }
body[data-sub="detalj"] .page { max-width: 1040px; margin: 0 auto; }
@media (min-width: 1000px) {
  .recipe-cols { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 40px; align-items: start; }
}
.how { margin-top: 6px; }
.how summary { cursor: pointer; color: var(--green); font-weight: 600; font-size: 0.92rem; min-height: 36px; display: flex; align-items: center; }
.how ol { padding-left: 1.4em; font-size: 0.95rem; display: grid; gap: 4px; }
.trace { margin-top: 28px; }
.trace summary { font: 700 1.1rem var(--serif); color: var(--green-dark); }
.trace-raw { list-style: none; columns: 2 220px; column-gap: 32px; }
.trace-raw li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dotted var(--rule); break-inside: avoid; }
.trace h3 { margin-top: 22px; font-variant: small-caps; letter-spacing: 0.05em; }
.trace-tree, .trace-tree ul { list-style: none; }
.trace-tree ul { margin: 6px 0 4px 6px; padding-left: 16px; border-left: 2px solid var(--line); }
.trace-tree > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.trace-tree > li:last-child { border-bottom: 0; }
.trace-line { display: flex; justify-content: space-between; gap: 12px; }
.trace-tree .note { margin: 4px 0 2px; }
.trace-steps { padding-left: 1.4em; font-size: 0.93rem; color: var(--ink); margin-bottom: 4px; }
.recipe-tools { max-width: 640px; }
.recipe-tools .field { margin: 0; }
.recipe-list { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.recipe-link { display: flex; flex-direction: column; gap: 4px; min-height: 76px; height: 100%; justify-content: center; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); text-decoration: none; color: var(--ink); transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; }
.recipe-link .name { font: 700 1.1rem/1.25 var(--serif); color: var(--green-dark); padding-bottom: 6px; border-bottom: 1.5px solid #ecb7ab; }
.recipe-link .meta { margin: 0; }

/* ── plan ── */
.day-setup { list-style: none; display: grid; gap: 8px; }
.day-row { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.day-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.day-name, .day-date { display: block; font: 700 1.05rem var(--serif); color: var(--green-dark); }
.day-name::first-letter, .day-date::first-letter { text-transform: uppercase; }
.day-summary { color: var(--muted); font-size: 0.9rem; }
.day-own { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.day-own .field { margin: 12px 0 0; }
.plan-setup { display: grid; gap: var(--gap); max-width: 720px; margin: 0 auto; }
.plan-setup > div { display: grid; gap: var(--gap); align-content: start; }
@media (min-width: 1000px) {
  .plan-setup { max-width: none; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
}
.plan-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.plan-bar .meta { margin: 0; font-size: 1rem; }
.plan-panels { display: grid; gap: 24px; }
.plan-panels > section > h2 { display: none; }
.plan-days .cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.plan-panels:not([data-tab="days"]) > .plan-days,
.plan-panels:not([data-tab="shopping"]) > .plan-shopping,
.plan-panels:not([data-tab="prep"]) > .plan-prep { display: none; }
.day { display: flex; flex-direction: column; }
.day h3 { font-size: 1.15rem; margin-bottom: 4px; }
.day h3 a { color: inherit; text-decoration: none; }
.day h3 a:hover { text-decoration: underline; }
.day .actions { margin-top: auto; }
.day-date { margin-bottom: 6px; color: var(--tomato-dark); font: 700 0.8rem/1.4 system-ui, sans-serif; letter-spacing: 0.06em; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.day-date { padding-bottom: 6px; border-bottom: 1.5px solid #ecb7ab; }
.day-date .badge { border: 1.5px solid currentColor; background: none !important; transform: rotate(-3deg); }
.day.cooked { background: #f3f1ea; box-shadow: none; }
.day.cooked h3 { color: var(--muted); }
.day-none { font-weight: 600; }
.chain { color: var(--green); font-weight: 600; font-size: 0.92rem; margin-bottom: 0.4em; }
.chain::before { content: "↻ "; }
.day-items { margin: 4px 0 10px; }
.day-items summary, .fold summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 8px; color: var(--green); font-weight: 600; }
.day-items summary { font-size: 0.95rem; list-style: none; }
.day-items summary::-webkit-details-marker { display: none; }
.day-items summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform 0.15s; }
.day-items[open] summary::after { transform: rotate(225deg) translateY(-2px); }
.day-items[open] summary { margin-bottom: 8px; }
.day-items .warning { margin-bottom: 8px; }
.totals { font-weight: 600; margin-bottom: 12px; }
.plan-shopping .group { margin-bottom: 12px; }
.shop-row { padding: 4px 16px 8px; }
.shop-row + .shop-row { border-top: 1px solid var(--line); }
.shop-row .check { font-weight: 650; }
.shop-row.done { opacity: 0.55; }
.shop-row.done .check span { text-decoration: line-through; }
.shop-detail { margin: -4px 0 0 32px; color: var(--muted); font-size: 0.88rem; }
.shop-detail:empty { display: none; }
.buy-on { color: var(--tomato-dark); font-weight: 600; }
@media (min-width: 1100px) {
  .plan-tabs { display: none; }
  .plan-panels { grid-template-columns: minmax(0, 1fr) 380px; gap: 16px 32px; align-items: start; }
  .plan-panels > section { display: block !important; }
  .plan-panels > section > h2 { display: block; margin-bottom: 12px; }
  .plan-days, .plan-prep { grid-column: 1; }
  .plan-shopping { grid-column: 2; grid-row: 1 / span 2; position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
  .plan-prep .lead { font-size: 0.95rem; }
}

/* ── household ── */
.settings { display: grid; gap: var(--gap); }
.settings > div { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
@media (min-width: 1000px) { .settings { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.fold { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin-bottom: 8px; }
.fold summary { padding: 4px 14px; justify-content: space-between; flex-wrap: wrap; color: var(--ink); }
.fold summary:hover { background: var(--cream); border-radius: var(--radius); }
.fold summary .meta { margin: 0; font-weight: 400; }
.fold[open] summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.fold-body { padding: 14px; }

.card.inset + h3, .actions + h3 { margin-top: 22px; }
.join-form .field { margin-bottom: 10px; }
.join-form .error { margin-bottom: 10px; }

/* ── the privacy pages ── */
.doc { max-width: 720px; margin: 0 auto; padding: 28px 16px 64px; }
.doc h2 { margin-top: 1.6em; }
.doc ul { padding-left: 1.3em; }
.doc li { margin-bottom: 0.5em; }
.doc .card { margin: 16px 0; }
.noscript { text-align: center; padding: 12px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* the timetable: a column of clock times down the margin, like a train table */
.timetable-fold { margin-top: 28px; }
.timetable-fold summary { font: 700 1.1rem var(--serif); color: var(--green-dark); }
.tt-serve-at { display: flex; align-items: center; gap: 12px; margin: 10px 0 14px; font-weight: 600; }
.tt-serve-at input { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; min-height: 44px; }
.timetable { list-style: none; }
.timetable li { display: grid; grid-template-columns: 9.5ch 1fr; gap: 14px; padding: 9px 0; border-bottom: 1px dotted var(--rule); }
.timetable li:last-child { border-bottom: 0; }
.timetable .tt-clock { font: 700 1rem var(--serif); font-variant-numeric: tabular-nums; color: var(--green-dark); }
.timetable .note { display: block; margin: 2px 0 0; }
.timetable .badge.ahead { margin-top: 4px; }
.timetable .tt-serve { border-top: 3px double var(--rule); border-bottom: 3px double var(--rule); font-variant: small-caps; letter-spacing: 0.05em; font-weight: 700; }
.timetable .tt-early { display: block; margin-top: 4px; color: var(--amber); font-size: 0.93rem; }
.badge.untried { border-style: dashed; }

.note.clash { color: var(--amber); border-left: 3px solid #e3c877; padding-left: 10px; }

/* what is left over: a slip pinned under the list */
.leftover { border: 1px dashed var(--rule); border-radius: var(--radius); padding: 10px 14px; margin: 14px 0; background: #fffdf9; }
.leftover h3 { font-size: 0.95rem; font-variant: small-caps; letter-spacing: 0.05em; color: var(--green-dark); margin-bottom: 4px; }
.leftover h3:not(:first-child) { margin-top: 10px; }
.leftover ul { list-style: none; display: grid; gap: 4px; font-size: 0.95rem; }
