/* Koken met Marinus — klassiek kookboek */
@font-face { font-family: "Lora"; src: url("/static/fonts/Lora.woff2") format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("/static/fonts/Lora-Italic.woff2") format("woff2"); font-weight: 400 700; font-style: italic; font-display: swap; }

:root {
  --paper: #f6efe2; --card: #fffaf1; --ink: #2b1d16; --muted: #7a6858; --line: #e3d5bd;
  --terra: #9c3d26; --terra-2: #b85636; --wine: #6e2416; --ochre: #c9963f; --sand: #efe3cc;
  --danger: #9c2f1f; --on-terra: #fff8ec;
  --r: 6px; --shadow: 0 1px 0 rgba(60,30,10,.06), 0 6px 18px -8px rgba(60,30,10,.25);
  --serif: "Lora", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #1c1510; --card: #261c15; --ink: #f1e6d4; --muted: #b09d88; --line: #3d2f24;
          --terra: #e0805f; --terra-2: #eb9875; --wine: #f0a58a; --sand: #2f241b; --on-terra: #1c1510; --shadow: none; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.55 var(--serif); }
body { background-image: radial-gradient(rgba(120,80,40,.035) 1px, transparent 1px); background-size: 4px 4px; }
a { color: var(--terra); }
h1 { font-family: var(--serif); font-weight: 600; font-size: 1.85rem; line-height: 1.15; margin: .35em 0 .25em; letter-spacing: -.01em; }
h2 { font-family: var(--sans); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .16em;
  color: var(--terra); margin: 1.4em 0 .7em; display: flex; align-items: center; gap: 10px; }
h2::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
button, input, textarea, select { font: inherit; color: inherit; }

/* ---------- kop en tabbalk ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 10px) 16px 10px; background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 3px double var(--line); }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); }
.brand img { width: 32px; height: 32px; border-radius: 50%; }
.brand span { font-family: var(--serif); font-size: 1.22rem; font-weight: 600; }
.brand em { font-style: italic; font-weight: 400; color: var(--terra); }
main { max-width: 880px; margin: 0 auto; padding: 16px 18px calc(100px + var(--safe-b)); }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-around;
  padding: 7px 0 calc(7px + var(--safe-b)); background: var(--card); border-top: 1px solid var(--line); font-family: var(--sans); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .7rem; letter-spacing: .04em;
  color: var(--muted); text-decoration: none; min-width: 84px; }
.tabbar a.active { color: var(--terra); }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.add svg { background: var(--terra); color: var(--on-terra); border-radius: 50%; padding: 5px; width: 34px; height: 34px; margin-top: -6px;
  box-shadow: 0 0 0 3px var(--card), 0 0 0 4px var(--line); }

/* ---------- knoppen en velden ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line);
  background: var(--card); border-radius: 999px; padding: 9px 16px; cursor: pointer; text-decoration: none; color: var(--ink);
  font-family: var(--sans); font-size: .92rem; }
.btn.primary { background: var(--terra); border-color: var(--terra); color: var(--on-terra); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 13px; font-size: .85rem; }
.btn.block { width: 100%; padding: 13px; font-size: 1rem; }
.btn:disabled { opacity: .5; }
.iconbtn { border: 0; background: none; padding: 6px; cursor: pointer; color: var(--terra); font-size: 1.3rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }

input[type=text], input[type=url], input[type=password], input[type=number], input[type=search], textarea, select {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: var(--r); padding: 11px 13px; outline: none; font-family: var(--sans); font-size: 1rem; }
input:focus, textarea:focus { border-color: var(--terra-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--terra) 15%, transparent); }
textarea { min-height: 120px; resize: vertical; }
label { display: block; font-family: var(--sans); font-size: .8rem; color: var(--muted); margin: 16px 0 5px; }

/* ---------- overzicht ---------- */
.search { margin-bottom: 12px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; font-family: var(--sans); }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 13px;
  font-size: .82rem; cursor: pointer; white-space: nowrap; }
.chip.on { background: var(--terra); color: var(--on-terra); border-color: var(--terra); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.card { background: var(--card); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.card .img { aspect-ratio: 4/3; background: var(--sand) center/cover no-repeat; display: grid; place-items: center;
  font-size: 2rem; color: var(--terra); border-bottom: 1px solid var(--line); }
.card .t { padding: 10px 12px 4px; font-weight: 600; font-size: 1rem; line-height: 1.25; }
.card .m { padding: 0 12px 12px; font-family: var(--sans); font-size: .75rem; color: var(--muted); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); font-style: italic; }
.empty .big { font-size: 2.6rem; color: var(--terra); font-style: normal; margin-bottom: 6px; }

/* ---------- recept ---------- */
.hero { margin: -16px -18px 0; aspect-ratio: 16/10; max-height: 400px; background: var(--sand) center/cover; }
@media (min-width: 700px) { .hero { margin: 0; border-radius: var(--r); border: 1px solid var(--line); } }
.recipe-head { text-align: center; padding: 6px 4px 0; }
.recipe-head h1 { font-size: 2rem; }
.recipe-head .desc { font-style: italic; color: var(--muted); max-width: 38em; margin: .3em auto 0; }
.ornament { color: var(--terra); letter-spacing: .5em; font-size: .9rem; margin: .4em 0; }
.meta { font-family: var(--sans); color: var(--muted); font-size: .85rem; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; justify-content: center; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-top: 16px; }
.panel > h2:first-child { margin-top: 0; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; font-family: var(--sans); }
.stepper button { border: 0; background: none; width: 38px; height: 36px; font-size: 1.2rem; cursor: pointer; color: var(--terra); }
.stepper span { min-width: 96px; text-align: center; font-weight: 600; font-size: .92rem; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-family: var(--sans); font-size: .85rem; cursor: pointer; user-select: none; }
.switch input { width: 40px; height: 24px; appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; transition: .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked { background: var(--terra-2); }
.switch input:checked::after { left: 19px; }

.ings { list-style: none; padding: 0; margin: 0; }
.ings li { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px dotted var(--line); cursor: pointer; }
.ings li:last-child { border-bottom: 0; }
.ings li.grp { font-style: italic; font-weight: 600; color: var(--terra); border: 0; padding-top: 14px; cursor: default; }
.ings .q { min-width: 84px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--wine); }
.ings .note { color: var(--muted); font-style: italic; }
.ings li.done { opacity: .4; text-decoration: line-through; }
.steps { padding: 0; margin: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 10px 0 12px 46px; border-bottom: 1px dotted var(--line); cursor: pointer; }
.steps li:last-child { border-bottom: 0; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 7px; width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid var(--terra); color: var(--terra); display: grid; place-items: center; font-weight: 600; font-style: italic; font-size: 1rem; }
.steps li.done { opacity: .4; }
.nut { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.nut div { background: var(--sand); border-radius: var(--r); padding: 8px 4px; }
.nut b { display: block; font-size: 1.1rem; color: var(--wine); }
.nut span { font-family: var(--sans); font-size: .7rem; color: var(--muted); }
.photos { display: flex; gap: 8px; overflow-x: auto; }
.photos img { height: 120px; border-radius: var(--r); cursor: pointer; border: 1px solid var(--line); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; justify-content: center; font-family: var(--sans); }
.tags a { font-size: .75rem; letter-spacing: .03em; border: 1px solid var(--line); color: var(--muted);
  padding: 2px 10px; border-radius: 999px; text-decoration: none; background: var(--card); }

/* ---------- toevoegen ---------- */
.seg { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 3px; margin-bottom: 16px; font-family: var(--sans); }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 999px; cursor: pointer; font-size: .9rem; }
.seg button.on { background: var(--terra); color: var(--on-terra); font-weight: 600; }
.drop { border: 1.5px dashed var(--terra-2); border-radius: var(--r); padding: 30px 16px; text-align: center; cursor: pointer; background: var(--card); }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.thumbs img { width: 76px; height: 76px; object-fit: cover; border-radius: var(--r); }
.spinner { width: 42px; height: 42px; border: 3px solid var(--line); border-top-color: var(--terra); border-radius: 50%;
  animation: spin 1s linear infinite; margin: 34px auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
.hint { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin-top: 8px; }

/* ---------- boodschappen ---------- */
.shop h3 { font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; color: var(--terra); margin: 20px 0 6px; }
.shop ul { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.shop li { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-bottom: 1px dotted var(--line); }
.shop li:last-child { border-bottom: 0; }
.shop li .box { width: 22px; height: 22px; border-radius: 4px; border: 1.5px solid var(--terra-2); flex: none; cursor: pointer; display: grid; place-items: center; }
.shop li.checked .box { background: var(--terra-2); }
.shop li.checked .box::after { content: "✓"; color: var(--on-terra); font-size: .8rem; font-family: var(--sans); }
.shop li.checked .txt { text-decoration: line-through; color: var(--muted); }
.shop .txt { flex: 1; cursor: pointer; }
.shop .txt b { color: var(--wine); }
.shop .from { font-family: var(--sans); font-size: .72rem; color: var(--muted); display: block; }
.shop .x { color: var(--muted); font-size: 1rem; }
.addrow { display: flex; gap: 8px; margin-bottom: 6px; }

.ed-ing { font-family: ui-monospace, Menlo, monospace !important; font-size: .9rem !important; min-height: 220px; }
.toast { position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 999px; font-family: var(--sans); font-size: .88rem;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 50; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.login { max-width: 340px; margin: 60px auto; text-align: center; }
.login img { width: 96px; border-radius: 50%; }
.login h1 em { font-weight: 400; color: var(--terra); }

@media screen and (min-width: 760px) { .cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; align-items: start; } }

/* ---------- printen ---------- */
.print-only { display: none; }
@media print {
  @page { margin: 15mm; }
  :root { --ink: #1a120d; --card: #fff; --paper: #fff; --line: #bbb; --muted: #555; --terra: #8a3420; --wine: #5a1d12; }
  body { font-size: 11pt; background: #fff; }
  .no-print, .topbar, .tabbar, .toolbar, .toast, .photos { display: none !important; }
  .print-only { display: block; }
  main { padding: 0; max-width: none; }
  .hero { margin: 0 0 8px; height: 6cm; max-height: 6cm; aspect-ratio: auto; border-radius: 4px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .panel { box-shadow: none; padding: 0; border: 0; }
  .cols { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10mm; }
  .ings li, .steps li { padding: 3px 0; border: 0; break-inside: avoid; }
  .ings li.done, .steps li.done { opacity: 1; text-decoration: none; }
  .steps li { padding-left: 30px; }
  .steps li::before { width: 20px; height: 20px; top: 3px; font-size: 9pt; }
  h1 { font-size: 22pt; }
  a { color: #000; text-decoration: none; }
  .print-brand { display: block; text-align: center; font-style: italic; color: var(--terra); font-size: 9pt; margin-top: 8mm; }
}
.print-brand { display: none; }

/* ---------- foto's bewerken ---------- */
.ph-ed { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.ph-ed .ph { position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.ph-ed .ph.main { outline: 2px solid var(--terra); outline-offset: 1px; }
.ph-ed img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-ed .badge { position: absolute; left: 4px; bottom: 4px; background: var(--terra); color: var(--on-terra); font: 600 .65rem var(--sans); padding: 2px 6px; border-radius: 999px; }
.ph-ed button { position: absolute; top: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(30,20,15,.65); color: #fff; font-size: .85rem; display: grid; place-items: center; }
.ph-ed .del { right: 4px; } .ph-ed .star { left: 4px; color: #f3c45a; }

/* ---------- gebruikers ---------- */
.profile-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--terra); color: var(--on-terra) !important;
  display: grid !important; place-items: center; text-decoration: none; font-weight: 600; font-family: var(--serif); }
.profile-btn[style*="none"] { display: none !important; }
.owners { overflow-x: auto; scrollbar-width: none; }
.owners button { flex: none; padding: 7px 14px; white-space: nowrap; }
.owner-line { font-family: var(--sans); font-size: .82rem; color: var(--muted); margin-top: 4px; }
.ulist { list-style: none; padding: 0; margin: 0; }
.ulist li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dotted var(--line); }
.ulist li:last-child { border-bottom: 0; }

/* ---------- mislukte imports ---------- */
.inbox { border-color: color-mix(in srgb, var(--terra) 45%, var(--line)); background: color-mix(in srgb, var(--terra) 6%, var(--card)); margin: 0 0 14px; }
.inbox h2 { margin-top: 0; }
.inbox .fail { padding: 10px 0; border-top: 1px dotted var(--line); }
.inbox .fail:first-of-type { border-top: 0; padding-top: 0; }
.inbox .fail p { margin: 6px 0 10px; }
.inbox .fail-src { font-family: var(--sans); font-size: .8rem; }

.ph-find { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-top: 12px; }
.ph-find button { padding: 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; aspect-ratio: 1; cursor: pointer; background: var(--paper, #fff); }
.ph-find button:disabled { opacity: .4; }
.ph-find img { width: 100%; height: 100%; object-fit: cover; display: block; }
.paste-box { margin-top: 12px; padding: 18px 14px; border: 2px dashed var(--line); border-radius: var(--r); text-align: center; color: var(--muted, #8a7b6b); font-style: italic; min-height: 24px; outline: none; -webkit-user-select: text; user-select: text; }
.paste-box:focus { border-color: var(--terra); color: inherit; font-style: normal; }
.paste-box.busy { opacity: .6; pointer-events: none; }
