/* Recipeer — design system and layout.
   Warm, food-inspired palette: herb green, cream, tomato, saffron. Light and dark themes. */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/fraunces-600.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/fonts/fraunces-600-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #faf6ef;
  --surface: #ffffff;
  --surface-2: #f3ede3;
  --surface-3: #ebe3d6;
  --ink: #26231e;
  --ink-2: #57514a;
  --ink-3: #7d7568;
  --line: #e4dccd;
  --line-strong: #cfc4b1;
  --herb: #2f5d46;
  --herb-hover: #264d3a;
  --herb-ink: #ffffff;
  --herb-soft: #e2ede5;
  --herb-text: #24503a;
  --tomato: #b84a2b;
  --tomato-soft: #f8e3da;
  --tomato-text: #9a3c21;
  --saffron: #c98a1d;
  --saffron-soft: #f8ecd2;
  --saffron-text: #845a0e;
  --sky: #33617d;
  --sky-soft: #e1ecf2;
  --shadow-1: 0 1px 2px rgba(60, 45, 20, .06), 0 1px 1px rgba(60, 45, 20, .04);
  --shadow-2: 0 6px 20px rgba(60, 45, 20, .10), 0 2px 6px rgba(60, 45, 20, .06);
  --shadow-3: 0 18px 48px rgba(40, 30, 10, .22);
  --radius-s: 8px;
  --radius: 14px;
  --radius-l: 20px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --tabbar-h: 64px;
  --topbar-h: 56px;
  --sidebar-w: 248px;
  --focus: 0 0 0 3px rgba(47, 93, 70, .35);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1916;
    --surface: #23211d;
    --surface-2: #2c2a25;
    --surface-3: #36332d;
    --ink: #f2ede4;
    --ink-2: #c9c1b3;
    --ink-3: #9a9183;
    --line: #3a362f;
    --line-strong: #4d483f;
    --herb: #86bf9c;
    --herb-hover: #9bcdae;
    --herb-ink: #10241a;
    --herb-soft: #24372c;
    --herb-text: #9fd1b2;
    --tomato: #e9896a;
    --tomato-soft: #43271e;
    --tomato-text: #f1a78e;
    --saffron: #e5b558;
    --saffron-soft: #3f321a;
    --saffron-text: #efc77a;
    --sky: #8db9d6;
    --sky-soft: #1f3341;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-2: 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-3: 0 18px 48px rgba(0, 0, 0, .5);
    --focus: 0 0 0 3px rgba(134, 191, 156, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a1916; --surface: #23211d; --surface-2: #2c2a25; --surface-3: #36332d;
  --ink: #f2ede4; --ink-2: #c9c1b3; --ink-3: #9a9183; --line: #3a362f; --line-strong: #4d483f;
  --herb: #86bf9c; --herb-hover: #9bcdae; --herb-ink: #10241a; --herb-soft: #24372c; --herb-text: #9fd1b2;
  --tomato: #e9896a; --tomato-soft: #43271e; --tomato-text: #f1a78e;
  --saffron: #e5b558; --saffron-soft: #3f321a; --saffron-text: #efc77a; --sky: #8db9d6; --sky-soft: #1f3341;
  --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 8px 24px rgba(0,0,0,.35); --shadow-3: 0 18px 48px rgba(0,0,0,.5);
  --focus: 0 0 0 3px rgba(134,191,156,.45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
a { color: var(--herb-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.2rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 .75em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.tiny { font-size: .78rem; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: .5rem; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.stack.tight { gap: .4rem; }
.grow { flex: 1 1 auto; min-width: 0; }
.center { text-align: center; }
.noscript { padding: 2rem; text-align: center; }

/* ------------------------------------------------------------------ boot */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: .75rem; color: var(--ink-3); font-family: var(--font-display); font-size: 1.25rem; }
.boot img { border-radius: 18px; box-shadow: var(--shadow-2); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.96); opacity: .8; } }

/* ------------------------------------------------------------------ app shell */
.shell { min-height: 100vh; min-height: 100dvh; }
.main { padding: 0 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); max-width: 1200px; margin: 0 auto; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: .5rem;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.topbar.scrolled { border-bottom-color: var(--line); }
.topbar .title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); font-family: var(--font-display); font-size: 1.2rem; font-weight: 600; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--ink-3); text-decoration: none; font-size: .7rem; font-weight: 600; letter-spacing: .01em;
  position: relative;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--herb-text); }
.tabbar a[aria-current="page"]::before { content: ""; position: absolute; top: 6px; width: 44px; height: 30px; border-radius: 15px; background: var(--herb-soft); z-index: -1; }
.tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); }

.sidebar { display: none; }

@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; }
  .tabbar { display: none; }
  .sidebar {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100vh; padding: 20px 14px;
    border-right: 1px solid var(--line); background: var(--surface);
  }
  .sidebar .brand { padding: 6px 10px 18px; }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar a.nav {
    display: flex; align-items: center; gap: .75rem; padding: 10px 12px; border-radius: 10px;
    color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .95rem;
  }
  .sidebar a.nav:hover { background: var(--surface-2); color: var(--ink); }
  .sidebar a.nav[aria-current="page"] { background: var(--herb-soft); color: var(--herb-text); }
  .sidebar a.nav svg { width: 20px; height: 20px; flex: none; }
  .sidebar .sep { height: 1px; background: var(--line); margin: 10px 8px; }
  .sidebar .foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
  .main { padding: 0 32px 48px; width: 100%; }
  .topbar { padding: 0 32px; margin: 0 -32px; }
  .topbar .back-only-mobile { display: none; }
}

.page-head { padding: 8px 0 18px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; }
.page-head h1 { flex: 1 1 auto; }
.page-head .sub { flex-basis: 100%; color: var(--ink-3); margin: -4px 0 0; }
.section { margin: 28px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 12px; }
.section-head a { font-size: .9rem; font-weight: 600; text-decoration: none; white-space: nowrap; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: .95rem; line-height: 1;
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background .15s, transform .08s, box-shadow .15s, border-color .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn.primary { background: var(--herb); color: var(--herb-ink); }
.btn.primary:hover { background: var(--herb-hover); }
.btn.danger { background: var(--tomato-soft); color: var(--tomato-text); }
.btn.danger:hover { background: var(--tomato); color: #fff; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.outline { background: transparent; border-color: var(--line-strong); }
.btn.outline:hover { background: var(--surface-2); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: .875rem; }
.btn.block { width: 100%; }
.btn[disabled], .btn.busy { opacity: .55; pointer-events: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border-radius: 50%; border: none; background: transparent; color: var(--ink-2); cursor: pointer;
  text-decoration: none; position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn.on { color: var(--tomato); }
.icon-btn .badge { position: absolute; top: 4px; right: 2px; }

.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--tomato); color: #fff; font-size: .7rem; font-weight: 700; line-height: 1;
}

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.field .hint { font-size: .82rem; color: var(--ink-3); }
.field .error { font-size: .85rem; color: var(--tomato-text); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-size: 1rem; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus { outline: none; border-color: var(--herb); box-shadow: var(--focus); }
.input.invalid { border-color: var(--tomato); }
.input::placeholder { color: var(--ink-3); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.search-input { position: relative; }
.search-input svg.lead { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--ink-3); pointer-events: none; }
.search-input .input { padding-left: 44px; border-radius: 999px; }
.search-input .clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 520px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
.check { display: flex; align-items: flex-start; gap: .65rem; cursor: pointer; font-size: .95rem; padding: 6px 0; }
.check input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--herb); flex: none; }
.form-error { background: var(--tomato-soft); color: var(--tomato-text); padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: .92rem; }
.form-ok { background: var(--herb-soft); color: var(--herb-text); padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: .92rem; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: .9rem; color: var(--ink-2); margin-bottom: 6px; padding: 0; }

/* chips & segmented */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 4px; scroll-snap-type: x proximity; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: .35rem; min-height: 36px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  font-size: .88rem; font-weight: 600; cursor: pointer; white-space: nowrap; scroll-snap-align: start;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip[aria-pressed="true"], .chip.on { background: var(--herb); border-color: var(--herb); color: var(--herb-ink); }
.chip svg { width: 16px; height: 16px; }
.chip .x { margin-right: -6px; opacity: .7; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: transparent; min-height: 36px; padding: 0 14px; border-radius: 999px; font-weight: 600; font-size: .86rem; color: var(--ink-2); cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }

.tag { display: inline-flex; align-items: center; gap: .3rem; padding: 3px 9px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.tag svg { width: 13px; height: 13px; }
.tag.herb { background: var(--herb-soft); color: var(--herb-text); }
.tag.saffron { background: var(--saffron-soft); color: var(--saffron-text); }
.tag.tomato { background: var(--tomato-soft); color: var(--tomato-text); }
.tag.sky { background: var(--sky-soft); color: var(--sky); }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); }
.stepper button { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%; cursor: pointer; display: grid; place-items: center; color: var(--ink-2); }
.stepper button:hover { background: var(--surface-2); }
.stepper button svg { width: 18px; height: 18px; }
.stepper output { min-width: 2.4em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ cards & surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card.pad { padding: 16px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel + .panel { margin-top: 12px; }
.callout { display: flex; gap: .8rem; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); }
.callout svg { width: 22px; height: 22px; flex: none; margin-top: 1px; }
.callout.herb { background: var(--herb-soft); color: var(--herb-text); }
.callout.saffron { background: var(--saffron-soft); color: var(--saffron-text); }
.callout.tomato { background: var(--tomato-soft); color: var(--tomato-text); }
.callout .grow > :last-child { margin-bottom: 0; }

/* recipe cards */
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 18px 16px; }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 260px); gap: 14px; overflow-x: auto; margin: 0 -16px; padding: 4px 16px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }
.rail > * { scroll-snap-align: start; }
@media (min-width: 900px) { .rail { margin: 0; padding: 4px 0 10px; grid-auto-columns: minmax(230px, 1fr); grid-auto-flow: column; } }
.rcard { position: relative; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow-1); transition: box-shadow .2s, transform .2s; }
.rcard:hover { box-shadow: var(--shadow-2); }
.rcard a.cover { display: block; position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.rcard a.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.rcard:hover a.cover img { transform: scale(1.03); }
.rcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.rcard h3 { font-size: 1.02rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard h3 a { color: var(--ink); text-decoration: none; }
.rcard h3 a::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.rcard .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .82rem; color: var(--ink-3); }
.rcard .meta span { display: inline-flex; align-items: center; gap: 4px; }
.rcard .meta svg { width: 14px; height: 14px; }
.rcard .fav { position: absolute; top: 8px; right: 8px; z-index: 2; background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); box-shadow: var(--shadow-1); }
.rcard .badge-match { position: absolute; left: 8px; top: 8px; z-index: 1; }
.rcard .actions { position: relative; z-index: 2; margin-top: auto; display: flex; gap: 6px; }
.match { display: flex; flex-direction: column; gap: 6px; }
.match .bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.match .bar i { display: block; height: 100%; border-radius: 3px; background: var(--herb); }
.match.almost .bar i { background: var(--saffron); }
.match.far .bar i { background: var(--ink-3); }
.match .line { font-size: .82rem; color: var(--ink-2); line-height: 1.35; }
.match .line b { color: var(--ink); }
.match .ok { color: var(--herb-text); font-weight: 700; }
.cover-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.cover-fallback svg { width: 38%; height: 38%; opacity: .35; }
.cover-fallback span { position: absolute; bottom: 10px; left: 12px; right: 12px; font-family: var(--font-display); font-size: 1.05rem; color: rgba(0,0,0,.45); line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* list rows */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; min-height: 56px; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row .main-col { flex: 1; min-width: 0; }
.list-row .name { font-weight: 600; overflow-wrap: anywhere; }
.list-row .sub { font-size: .82rem; color: var(--ink-3); }
.list-row.done .name { text-decoration: line-through; color: var(--ink-3); }
.list-row button.rowbtn { all: unset; flex: 1; min-width: 0; cursor: pointer; display: block; }
.list-head { padding: 14px 14px 6px; font-size: .78rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); background: var(--surface); }
.tickbox { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; flex: none; background: var(--surface); cursor: pointer; transition: background .15s, border-color .15s; }
.tickbox svg { width: 16px; height: 16px; color: transparent; }
.tickbox[aria-checked="true"] { background: var(--herb); border-color: var(--herb); }
.tickbox[aria-checked="true"] svg { color: var(--herb-ink); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ink-3); }
.status-dot.ok { background: var(--herb); }
.status-dot.low, .status-dot.uncertain { background: var(--saffron); }
.status-dot.out, .status-dot.missing, .status-dot.short { background: var(--tomato); }

/* ------------------------------------------------------------------ sheet / dialog */
.backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(20, 16, 10, .45); animation: fade .18s ease-out; }
.sheet {
  position: fixed; z-index: 91; left: 0; right: 0; bottom: 0; max-height: min(92vh, 900px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-3);
  padding-bottom: env(safe-area-inset-bottom);
  animation: slideup .26s cubic-bezier(.2, .9, .3, 1);
}
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-strong); margin: 8px auto 0; flex: none; }
.sheet header { display: flex; align-items: center; gap: .5rem; padding: 8px 8px 8px 20px; flex: none; }
.sheet header h2 { flex: 1; font-size: 1.2rem; }
.sheet .content { padding: 4px 20px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet footer { padding: 12px 20px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex: none; }
.sheet footer .btn { flex: 1; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 48px)); border-radius: 22px; max-height: min(86vh, 860px); animation: pop .2s ease-out; }
  .sheet.wide { width: min(820px, calc(100vw - 48px)); }
  .sheet .grab { display: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes slideup { from { transform: translateY(100%); } }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } }

/* toast */
.toasts { position: fixed; z-index: 120; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 900px) { .toasts { bottom: 24px; left: calc(50% + var(--sidebar-w) / 2); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: .75rem; padding: 12px 12px 12px 16px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-3); font-weight: 600; font-size: .92rem; animation: toastin .25s ease-out; }
.toast.error { background: var(--tomato); color: #fff; }
.toast .grow { min-width: 0; }
.toast button { all: unset; cursor: pointer; font-weight: 800; padding: 6px 8px; border-radius: 8px; color: inherit; text-decoration: underline; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* empty states, skeletons */
.empty { text-align: center; padding: 40px 16px; color: var(--ink-2); display: flex; flex-direction: column; align-items: center; gap: .65rem; }
.empty .art { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; background: var(--herb-soft); color: var(--herb-text); }
.empty .art svg { width: 38px; height: 38px; }
.empty h3 { color: var(--ink); }
.empty p { max-width: 380px; margin: 0; }
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--herb); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block { display: grid; place-items: center; padding: 48px 0; }

/* ------------------------------------------------------------------ autocomplete */
.combo { position: relative; }
.combo-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2); max-height: 320px; overflow-y: auto; padding: 6px; margin: 0; list-style: none; }
.combo-list li { display: flex; align-items: center; gap: .6rem; padding: 10px 12px; border-radius: 10px; cursor: pointer; }
.combo-list li[aria-selected="true"] { background: var(--herb-soft); }
.combo-list li .alias { font-size: .8rem; color: var(--ink-3); }
.combo-list li.create { color: var(--herb-text); font-weight: 600; }

/* ------------------------------------------------------------------ home */
.hero { padding: 6px 0 4px; }
.hero h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.5rem); }
.hero p { color: var(--ink-2); margin: 6px 0 0; }
.quick-add { margin-top: 16px; display: flex; gap: 10px; align-items: stretch; }
.quick-add .combo { flex: 1; }
.stat-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.expiring-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ recipe page */
.recipe-hero { display: grid; gap: 20px; margin-bottom: 24px; }
@media (min-width: 900px) { .recipe-hero { grid-template-columns: 1.1fr 1fr; align-items: start; } }
.recipe-hero .photo { position: relative; border-radius: var(--radius-l); overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-2); box-shadow: var(--shadow-1); }
.recipe-hero .photo img { width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 899px) { .recipe-hero .photo { margin: 0 -16px; border-radius: 0; } }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fact .k { font-size: .75rem; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.fact .v { font-weight: 700; font-size: 1.02rem; font-variant-numeric: tabular-nums; }
.recipe-body { display: grid; gap: 28px; }
@media (min-width: 1000px) { .recipe-body { grid-template-columns: minmax(300px, 380px) 1fr; align-items: start; } .recipe-body .ing-col { position: sticky; top: 72px; } }
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.ing-list li:first-child { border-top: 0; }
.ing-list .qty { min-width: 74px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ing-list .what { flex: 1; min-width: 0; }
.ing-list .what .note { color: var(--ink-3); font-size: .88rem; }
.ing-list .hint { display: block; font-size: .8rem; margin-top: 2px; }
.ing-group { font-weight: 700; color: var(--ink-2); font-size: .85rem; margin: 14px 0 2px; text-transform: uppercase; letter-spacing: .05em; }
.steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 36px 1fr; gap: 12px; }
.steps li::before { content: counter(step); width: 32px; height: 32px; border-radius: 50%; background: var(--herb-soft); color: var(--herb-text); display: grid; place-items: center; font-weight: 800; font-size: .9rem; }
.steps li p { margin: 4px 0 0; }
.steps img { border-radius: 12px; margin-top: 10px; }
.price-mini { font-size: .8rem; color: var(--ink-3); }
.stars { display: inline-flex; gap: 1px; color: var(--saffron); vertical-align: -2px; }
.stars svg { width: 16px; height: 16px; }
.stars.lg svg { width: 30px; height: 30px; }
.stars button { all: unset; cursor: pointer; padding: 3px; border-radius: 6px; }
.dist { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; font-size: .85rem; }
.dist .bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.dist .bar i { display: block; height: 100%; background: var(--saffron); }
.review { padding: 14px 0; border-top: 1px solid var(--line); }
.sticky-actions { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); z-index: 20; display: flex; gap: 10px; padding: 10px; background: color-mix(in srgb, var(--surface) 90%, transparent); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow-2); margin-top: 24px; }
.sticky-actions .btn { flex: 1; }
@media (min-width: 900px) { .sticky-actions { bottom: 18px; max-width: 640px; margin-left: auto; margin-right: auto; } }

/* ------------------------------------------------------------------ editor */
.editor-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.editor-section + .editor-section { margin-top: 14px; }
.ed-line { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; padding: 10px 0; border-top: 1px dashed var(--line); }
.ed-line:first-of-type { border-top: 0; }
.ed-line .handle { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 6px; color: var(--ink-3); }
.ed-line .handle button { all: unset; cursor: pointer; padding: 2px; border-radius: 6px; display: grid; }
.ed-line .handle svg { width: 18px; height: 18px; }
.ed-grid { display: grid; grid-template-columns: 90px 110px 1fr; gap: 8px; }
@media (max-width: 600px) { .ed-grid { grid-template-columns: 1fr 1fr; } .ed-grid .full { grid-column: 1 / -1; } }
.ed-extra { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.ed-step { display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: start; }
.ed-step .n { width: 28px; height: 28px; margin-top: 8px; border-radius: 50%; background: var(--herb-soft); color: var(--herb-text); display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.upload { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; border: 2px dashed var(--line-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--ink-3); cursor: pointer; overflow: hidden; }
.upload img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.upload input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload .label { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 600; }
.upload svg { width: 30px; height: 30px; }

/* ------------------------------------------------------------------ cooking mode */
.cook { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: flex; flex-direction: column; padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
.cook-top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.cook-top .t { flex: 1; min-width: 0; font-family: var(--font-display); font-weight: 600; font-size: 1.05rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cook-progress { height: 4px; background: var(--surface-3); }
.cook-progress i { display: block; height: 100%; background: var(--herb); transition: width .3s; }
.cook-body { flex: 1; overflow-y: auto; display: grid; }
@media (min-width: 900px) { .cook-body { grid-template-columns: 360px 1fr; } .cook-body .cook-ings { border-right: 1px solid var(--line); display: block !important; } }
.cook-ings { padding: 16px 18px; overflow-y: auto; background: var(--surface); }
.cook-step { padding: 28px 24px; display: flex; flex-direction: column; gap: 18px; max-width: 860px; margin: 0 auto; width: 100%; }
.cook-step .count { font-weight: 800; color: var(--herb-text); letter-spacing: .06em; text-transform: uppercase; font-size: .85rem; }
.cook-step .text { font-size: clamp(1.35rem, 1rem + 1.6vw, 2rem); line-height: 1.45; font-weight: 500; }
.cook-step .text mark { background: var(--saffron-soft); color: inherit; border-radius: 4px; padding: 0 3px; }
.cook-step .used { display: flex; flex-wrap: wrap; gap: 8px; }
.cook-step .used .tag { font-size: .9rem; padding: 6px 12px; }
.cook-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--surface); }
.cook-nav .btn { min-height: 60px; font-size: 1.1rem; border-radius: 18px; }
.cook-ing { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 1.1rem; cursor: pointer; }
.cook-ing:first-child { border-top: 0; }
.cook-ing.done { color: var(--ink-3); text-decoration: line-through; }
.cook-ing .q { min-width: 80px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timers { display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.timer { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.timer.ring { background: var(--tomato); color: #fff; border-color: var(--tomato); animation: ring 1s infinite; }
@keyframes ring { 50% { transform: scale(1.04); } }
.timer .lbl { font-weight: 600; font-size: .8rem; opacity: .8; max-width: 140px; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------------ planner */
.week-nav { display: flex; align-items: center; gap: 6px; }
.week { display: grid; gap: 12px; }
@media (min-width: 1100px) { .week { grid-template-columns: repeat(7, 1fr); gap: 10px; } }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.day.today { border-color: var(--herb); box-shadow: 0 0 0 1px var(--herb) inset; }
.day.drop { background: var(--herb-soft); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.day-head .d { font-weight: 800; }
.day-head .c { font-size: .78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.slot-label { font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-top: 2px; }
.meal { display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 12px; background: var(--surface-2); cursor: grab; position: relative; }
.meal img, .meal .ph { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; flex: none; background: var(--surface-3); }
.meal .t { font-weight: 600; font-size: .88rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meal .s { font-size: .75rem; color: var(--ink-3); }
.meal.cooked { opacity: .55; }
.meal a { color: inherit; text-decoration: none; }
.add-meal { all: unset; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px; border-radius: 10px; border: 1px dashed var(--line-strong); color: var(--ink-3); font-size: .82rem; font-weight: 600; }
.add-meal:hover { color: var(--herb-text); border-color: var(--herb); background: var(--herb-soft); }
.add-meal svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ prices */
.price-big { font-family: var(--font-display); font-size: 1.8rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.conf { display: inline-flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; }
.conf i { width: 6px; height: 12px; border-radius: 2px; background: var(--surface-3); display: inline-block; }
.conf.c1 i:nth-child(-n+1), .conf.c2 i:nth-child(-n+2), .conf.c3 i:nth-child(-n+3) { background: var(--herb); }
.conf.c1 i:nth-child(1) { background: var(--saffron); }
.totals { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); }
.totals .big { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ tables (admin) */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.t { width: 100%; border-collapse: collapse; font-size: .9rem; }
table.t th, table.t td { padding: 10px 12px; text-align: left; border-top: 1px solid var(--line); vertical-align: top; }
table.t th { border-top: 0; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); background: var(--surface-2); }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 18px; scrollbar-width: none; }
.tabs button, .tabs a { all: unset; cursor: pointer; padding: 10px 14px; font-weight: 600; color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs [aria-selected="true"] { color: var(--herb-text); border-bottom-color: var(--herb); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.kv .fact .v { font-size: 1.3rem; }
.health-ok { color: var(--herb-text); font-weight: 700; }
.health-bad { color: var(--tomato-text); font-weight: 700; }
pre.code { white-space: pre-wrap; font-size: .8rem; background: var(--surface-2); padding: 10px; border-radius: 10px; overflow-x: auto; margin: 0; }

/* ------------------------------------------------------------------ auth */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); background:
  radial-gradient(1200px 500px at 10% -10%, var(--herb-soft), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, var(--saffron-soft), transparent 60%), var(--bg); }
.auth-card { width: min(440px, 100%); background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-2); padding: 28px 24px; display: flex; flex-direction: column; gap: 16px; border: 1px solid var(--line); }
.auth-card .brand { justify-content: center; font-size: 1.6rem; }
.auth-card .brand img { width: 52px; height: 52px; border-radius: 14px; }
.auth-card .lead { text-align: center; color: var(--ink-2); margin: -6px 0 4px; }
.auth-foot { text-align: center; font-size: .92rem; color: var(--ink-3); }

/* misc */
.divider { height: 1px; background: var(--line); margin: 20px 0; }
.kbd { font: 600 .78rem var(--font); padding: 2px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
.notice-bar { background: var(--saffron-soft); color: var(--saffron-text); padding: 10px 16px; font-weight: 600; font-size: .9rem; text-align: center; }
.offline-bar { position: fixed; top: env(safe-area-inset-top); left: 50%; transform: translateX(-50%); z-index: 100; background: var(--ink); color: var(--bg); padding: 6px 14px; border-radius: 0 0 12px 12px; font-size: .82rem; font-weight: 700; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-2); padding: 6px; }
.menu a, .menu button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .6rem; width: 100%; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: .92rem; color: var(--ink); }
.menu a:hover, .menu button:hover { background: var(--surface-2); }
.menu svg { width: 18px; height: 18px; color: var(--ink-3); }
.rel { position: relative; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--herb-text); list-style: none; padding: 6px 0; }
details.more > summary::-webkit-details-marker { display: none; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
a.chip, a.btn, a.icon-btn { text-decoration: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cover-fallback { filter: brightness(.82) saturate(.9); } }
@media (min-width: 900px) { .recipe-hero.no-photo { grid-template-columns: 1fr; max-width: 860px; } }
/* Planner: seven equal columns that may shrink below their content on wide screens. */
@media (min-width: 1100px) {
  .week { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .week .day { padding: 10px 8px; }
  .week .meal { flex-wrap: wrap; padding: 6px 4px 6px 8px; }
  .week .meal img, .week .meal .ph { display: none; }
  .week .meal .t { -webkit-line-clamp: 3; }
}
