@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/static/fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Figtree";
  font-style: normal;
  font-weight: 300 900;
  font-display: swap;
  src: url("/static/fonts/figtree-latin-wght-normal.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;
}
:root {
  color-scheme: light;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #22251f;
  --muted: #666b60;
  --line: #dfddd5;
  --accent: #2f6b4f;
  --accent-text: #ffffff;
  --danger: #a23a2c;
  --chip: #ecebe4;
  --radius: 10px;
  --gap: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161815;
    --surface: #21241f;
    --text: #e9e9e2;
    --muted: #a3a79b;
    --line: #363a32;
    --accent: #6fbb94;
    --accent-text: #10201a;
    --danger: #ec8a7b;
    --chip: #2f332b;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161815;
  --surface: #21241f;
  --text: #e9e9e2;
  --muted: #a3a79b;
  --line: #363a32;
  --accent: #6fbb94;
  --accent-text: #10201a;
  --danger: #ec8a7b;
  --chip: #2f332b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow-wrap: anywhere; }
h1 { font-size: 1.8rem; font-weight: 500; line-height: 1.2; margin: 0 0 var(--gap); }
h2 { font-size: 1.3rem; font-weight: 400; margin: 0 0 var(--gap); }
h3 { font-size: 1rem; font-weight: 500; margin: 0 0 8px; }
.symbol { width: 1em; height: 1em; vertical-align: -.125em; }
a { color: var(--accent); }
input, select, textarea { width: 100%; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
textarea { resize: vertical; }
input[type="checkbox"] { width: auto; }
label { font-weight: 600; font-size: .9rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; text-decoration: none; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn--danger { color: var(--danger); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--icon { width: 40px; padding: 0; font-size: 1.2rem; }
/* The check mark sits in the left padding, so the width stays the same. */
.btn--done, .btn--done:disabled { position: relative; background: var(--accent); border-color: var(--accent); color: var(--accent-text); opacity: 1; }
.btn--done::before { content: "✓"; position: absolute; left: 2px; font-size: .75em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.btn--small { min-height: 32px; padding: 3px 10px; font-size: .9rem; }

.topbar { display: flex; align-items: center; gap: 4px 20px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar__brand { order: 1; font-weight: 600; font-size: 1.05rem; color: var(--text); text-decoration: none; white-space: nowrap; }
.topbar__scroll { display: contents; }
.topbar__nav { order: 2; display: flex; gap: 2px; flex: 1 1 auto; }
.topbar__tools { order: 3; display: flex; align-items: center; gap: 2px; }
.topbar__account { order: 4; display: flex; align-items: center; gap: 2px; }
.topbar__link { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 11px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font: inherit; text-decoration: none; white-space: nowrap; cursor: pointer; }
.topbar__link:hover { background: var(--chip); }
.topbar__link[aria-current="page"] { background: var(--chip); font-weight: 600; }
.topbar .btn--ghost { min-height: 36px; padding: 4px 11px; white-space: nowrap; }

.page { max-width: 1040px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: var(--gap); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); margin-bottom: var(--gap); }
.card__head h2 { margin: 0; }
.hint { color: var(--muted); font-size: .85rem; margin: 8px 0 0; }
.card__head .hint { margin: 0; }
.empty { color: var(--muted); }
.form-error { color: var(--danger); margin: 0; }
.prewrap { white-space: pre-wrap; margin: 0; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 8px; }
.login h1 { font-size: 1.4rem; }

.filters { display: flex; flex-direction: column; gap: 8px; }
.filters__row { display: flex; gap: 12px; align-items: center; }
.filters__row select { width: auto; min-width: 150px; }
.dialog.cat-dialog { width: min(480px, calc(100vw - 32px)); max-height: 80vh; padding: 0; }
.cat-dialog[open] { display: flex; flex-direction: column; }
.cat-dialog__head { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); padding: 10px 8px 10px 16px; border-bottom: 1px solid var(--line); }
.cat-dialog__head h2 { margin: 0; }
.cat-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 0; }
.cat-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 10px 16px; font-size: 1rem; font-weight: 400; cursor: pointer; }
.cat-row:hover { background: var(--chip); }
.cat-row__count { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; text-align: right; }
.cat-dialog__empty { padding: 16px; margin: 0; }
.cat-dialog__foot { display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.list-info { margin: 0; color: var(--muted); font-size: .9rem; }
.results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.recipe-tile { position: relative; display: flex; min-width: 0; }
.recipe-tile__star { position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 1.2rem; cursor: pointer; }
.recipe-tile__star:hover { background: var(--chip); }
.recipe-tile__star--on { color: var(--accent); }
.recipe-card { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 12px 48px 12px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); text-decoration: none; }
.recipe-card__name { font-weight: 500; }
.recipe-card__meta { color: var(--muted); font-size: .85rem; }
.pager { display: flex; align-items: center; justify-content: center; gap: var(--gap); }

.recipe-head { display: flex; flex-direction: column; gap: 8px; }
.recipe-head h1 { margin: 0; }
.facts { display: flex; gap: 24px; margin: 0; }
.facts dt { color: var(--muted); font-size: .8rem; }
.facts dd { margin: 0; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.recipe-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--gap); align-items: start; }
.ingredients, .steps { margin: 0; padding: 0; list-style: none; }
.ingredients li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.ingredients li:last-child { border-bottom: 0; }
.ingredient__amount { font-weight: 600; }
.steps { counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-left: 2.2em; line-height: 1.6; margin-bottom: 18px; }
.steps li:last-child { margin-bottom: 0; }
.steps li::before { content: counter(step); position: absolute; left: 0; width: 1.5em; text-align: right; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.step__setting { font-weight: 700; }
.scaler { display: flex; align-items: center; gap: 6px; }
.scaler__value { min-width: 2.2em; text-align: center; font-weight: 600; }
.nutrition { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 0; }
.nutrition dt { color: var(--muted); font-size: .8rem; }
.nutrition dd { margin: 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.chip { background: var(--chip); border-radius: 999px; padding: 2px 10px; font-size: .9rem; }

.form { display: flex; flex-direction: column; gap: var(--gap); }
.field { display: flex; flex-direction: column; gap: 4px; }

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rows:empty { display: none; }
.rows-head { display: flex; justify-content: space-between; align-items: center; gap: var(--gap); }
.rows-head h1 { margin: 0; }
.row { display: flex; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.row:hover { border-color: var(--muted); }
.row__link { flex: 1 1 auto; min-width: 0; display: flex; justify-content: space-between; align-items: baseline; gap: var(--gap); padding: 12px; color: var(--text); text-decoration: none; }
.row__name { min-width: 0; }
.row__time { flex: none; color: var(--muted); font-size: .85rem; }
.row__remove { flex: none; margin-right: 4px; border-color: transparent; background: transparent; color: var(--muted); }

.btn--fav { gap: 6px; }
.btn--fav-on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }

.inline-form { display: flex; gap: 8px; }
.inline-form .btn { flex: none; }
.accounts { display: flex; flex-direction: column; gap: var(--gap); margin-top: var(--gap); }
.account { border-top: 1px solid var(--line); padding-top: var(--gap); display: flex; flex-direction: column; gap: 8px; }
.sessions, .hidden-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.session { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.session .hint { margin: 0; }
.hidden-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

.cook-root { position: fixed; inset: 0; background: var(--bg); }
.cook { height: 100%; max-width: 820px; margin: 0 auto; display: flex; flex-direction: column; padding: 12px 16px; }
.cook__head { display: flex; justify-content: space-between; align-items: center; }
.cook__counter { color: var(--muted); font-weight: 600; }
.cook__body { flex: 1 1 auto; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; padding: 16px 0; }
.cook__text { font-size: clamp(1.3rem, 4vw, 2rem); line-height: 1.4; margin: 0; }
.cook__time { color: var(--accent); }
.cook__timer-starts { display: flex; flex-wrap: wrap; gap: 8px; }
.cook__timers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cook__timer { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.cook__timer--done { border-color: var(--accent); }
.cook__clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 1.2rem; }
.cook__foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-bottom: env(safe-area-inset-bottom); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 8px; z-index: 20; }
.dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 16px; }
.dialog::backdrop { background: rgba(0, 0, 0, .4); }
.dialog__text { margin: 0 0 var(--gap); font-weight: 600; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 720px) {
  .dialog.cat-dialog { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .recipe-grid, .results { grid-template-columns: minmax(0, 1fr); }
  .inline-form { flex-wrap: wrap; }
  .topbar { flex-wrap: wrap; padding: 8px 12px 4px; }
  .topbar__tools { order: 2; margin-left: auto; }
  .topbar__scroll { order: 3; display: flex; flex-basis: 100%; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .topbar__scroll::-webkit-scrollbar { display: none; }
  .topbar__nav, .topbar__account { flex: none; }
}
