:root {
  --bg: #faf6f1;
  --surface: #ffffff;
  --text: #2b2420;
  --muted: #7a6d64;
  --line: #e8dfd6;
  --accent: #c2552d;
  --accent-soft: #f6e3d9;
  --fav: #d64545;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 4px 16px rgba(60, 40, 20, .06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1714;
    --surface: #26201c;
    --text: #f1e9e2;
    --muted: #ab9d92;
    --line: #3a312b;
    --accent: #e0754a;
    --accent-soft: #3d2a20;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.container { max-width: 1040px; margin: 0 auto; padding: 16px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.user { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.user #userName { max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 10px 16px; border-radius: 999px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:disabled { opacity: .6; cursor: default; }

/* Login */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border-radius: 20px;
  padding: 32px 24px; box-shadow: var(--shadow); text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.login-card h1 { margin: 4px 0 0; }
.login-card p { margin: 0 0 12px; }
.btn-provider { width: 100%; }

/* Lijst */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.search {
  flex: 1 1 260px; padding: 11px 16px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 6px 12px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer;
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.card {
  position: relative; background: var(--surface); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column;
  border: 1px solid var(--line);
}
.card .thumb { aspect-ratio: 4/3; background: var(--accent-soft); object-fit: cover; width: 100%; }
.card .thumb-empty { aspect-ratio: 4/3; background: var(--accent-soft); display: grid; place-items: center; font-size: 42px; }
.card .body { padding: 12px 14px 14px; }
.card h3 { margin: 0 0 4px; font-size: 17px; line-height: 1.3; }
.card .meta { font-size: 13px; color: var(--muted); }
.fav-btn {
  position: absolute; top: 8px; right: 8px; width: 38px; height: 38px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.92); cursor: pointer; display: grid; place-items: center;
  font-size: 20px; line-height: 1; color: var(--fav);
}
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

/* Detail */
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; }
.hero { border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; max-height: 420px; }
.hero img { width: 100%; height: 100%; max-height: 420px; object-fit: cover; }
.title-row { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.title-row h1 { margin: 0 0 6px; line-height: 1.2; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
.fact { background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; font-size: 14px; }
.cols { display: grid; gap: 24px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 800px) { .cols { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); } }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.panel h2 { margin: 0 0 10px; font-size: 19px; }
.panel h4 { margin: 14px 0 6px; font-size: 15px; color: var(--muted); }
.servings { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; }
.step-btn {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font: inherit; font-size: 20px; line-height: 1; cursor: pointer;
}
.step-btn:hover:not(:disabled) { border-color: var(--accent); }
.step-btn:disabled { opacity: .4; cursor: default; }
.s-count { min-width: 28px; text-align: center; font-weight: 700; font-size: 18px; }
.s-note { font-size: 13px; margin: -2px 0 8px; }
.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.ingredients label { display: flex; gap: 10px; align-items: baseline; cursor: pointer; }
.ingredients input { accent-color: var(--accent); width: 18px; height: 18px; flex: none; transform: translateY(3px); }
.ingredients input:checked + span { text-decoration: line-through; color: var(--muted); }
.steps { padding-left: 0; margin: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 8px 0 12px 42px; cursor: pointer; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 6px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.steps li.done { color: var(--muted); }
.steps li.done::before { background: var(--line); color: var(--muted); }
.tips { margin: 0; padding-left: 20px; }
.source { font-size: 14px; margin-top: 12px; word-break: break-word; }
.wake { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); margin: -8px 0 16px; }

/* Notities */
.notes { margin-top: 28px; }
.note-form textarea {
  width: 100%; min-height: 90px; resize: vertical; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font: inherit; background: var(--bg); color: var(--text);
}
.note-form .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.previews .pv { position: relative; }
.previews img { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; }
.previews button {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: var(--text); color: var(--bg); cursor: pointer; font-size: 13px; line-height: 1;
}
.note { padding: 14px 0; border-top: 1px solid var(--line); }
.note:first-child { border-top: none; }
.note-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.note-head strong { color: var(--text); }
.note p { margin: 6px 0 0; white-space: pre-wrap; }
.note-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.note-photos img { width: 120px; height: 120px; object-fit: cover; border-radius: 10px; cursor: zoom-in; }
.del { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; text-decoration: underline; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: grid; place-items: center; z-index: 50; padding: 16px; cursor: zoom-out; }
.lightbox img { max-height: 92vh; max-width: 100%; border-radius: 8px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; }

@media print {
  .topbar, .fav-btn, .notes, .back, .wake { display: none !important; }
}
