:root {
  --bg: #fbf6ef;
  --card: #ffffff;
  --ink: #2b2118;
  --muted: #7a6a5c;
  --accent: #b4532a;
  --accent-ink: #ffffff;
  --line: #eadfd0;
  --danger: #b3261e;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1713;
    --card: #2a221c;
    --ink: #f3e9dd;
    --muted: #b3a393;
    --accent: #e07b4c;
    --accent-ink: #1d1713;
    --line: #3b3027;
    --danger: #f2b8b5;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: 96px; }

#topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 12px 10px;
  background: var(--accent); color: var(--accent-ink);
}
#topbar h1 { flex: 1; margin: 0; font-size: 1.15rem; font-weight: 650;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: transparent; border: 0; color: inherit; font-size: 1.5rem;
  width: 40px; height: 40px; border-radius: 50%; }
.icon-btn:active { background: rgba(255,255,255,.2); }

main { padding: 14px; max-width: 720px; margin: 0 auto; }

#fab {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 18px);
  width: 58px; height: 58px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-ink); font-size: 2rem; line-height: 1;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
}

.search { width: 100%; padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 1rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  margin: 12px 0; overflow: hidden; }
.row { display: flex; align-items: center; gap: 10px; padding: 14px; width: 100%;
  background: transparent; border: 0; color: inherit; text-align: left; font: inherit; }
.row + .row { border-top: 1px solid var(--line); }
.row:active { background: var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 600; }
.row .sub { color: var(--muted); font-size: .85rem; }
.badge { background: var(--line); color: var(--muted); border-radius: 999px;
  padding: 2px 10px; font-size: .8rem; }
.chev { color: var(--muted); }
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--line); flex: none; }

h2 { font-size: 1rem; margin: 22px 4px 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

.recipe-photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: var(--radius); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: .85rem; }
.recipe h3 { margin: 22px 0 8px; }
.recipe ul, .recipe ol { padding-left: 22px; margin: 0; }
.recipe li { margin: 6px 0; }
.notes { white-space: pre-wrap; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; }

form label { display: block; margin: 14px 2px 4px; font-weight: 600; font-size: .9rem; }
form input[type=text], form input[type=number], form select, form textarea {
  width: 100%; padding: 11px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; }
form textarea { min-height: 120px; resize: vertical; }
.hint { color: var(--muted); font-size: .8rem; margin: 3px 2px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

.btn { display: inline-block; padding: 12px 18px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--danger); }
.actions { display: flex; gap: 10px; margin: 22px 0; flex-wrap: wrap; }
.actions .btn { flex: 1; text-align: center; }

.sheet { position: fixed; top: calc(env(safe-area-inset-top) + 54px); right: 10px; z-index: 10;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(0,0,0,.25); overflow: hidden; min-width: 220px; }
.sheet[hidden] { display: none; }
.sheet button { display: block; width: 100%; text-align: left; padding: 14px 16px; background: transparent;
  border: 0; color: var(--ink); font: inherit; }
.sheet button + button { border-top: 1px solid var(--line); }

#toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 20;
  background: #2b2118; color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .9rem; max-width: 90%; }
#toast[hidden] { display: none; }
[hidden] { display: none !important; }
