:root {
  --bg: #f6f1e7;
  --paper: #fffdf8;
  --ink: #2b2620;
  --muted: #7a6f62;
  --line: #e4dccd;
  --accent: #c2562b;
  --accent-ink: #fff;
  --green: #4f7a46;
  --soft: #f0e7d6;
  --freeze: #3c6e8f;
  --radius: 12px;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1a16; --paper: #26221d; --ink: #efe8dc; --muted: #a99d8c; --line: #3a342c;
    --accent: #e07a4d; --accent-ink: #1d1a16; --green: #8fbf7f; --soft: #302a23; --freeze: #7fb2d4;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 17px; line-height: 1.5; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px 120px; }
h1 { font-size: 1.9rem; line-height: 1.15; margin: .4em 0 .3em; }
h2 { font-size: 1.25rem; margin: 1.6em 0 .5em; }
h3 { font-size: 1rem; margin: 1em 0 .3em; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-family: system-ui, sans-serif; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.error { color: #b3261e; }
.count { font-size: .7em; color: var(--muted); font-weight: normal; font-family: system-ui, sans-serif; }

/* Kopf */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; font-size: 1.15rem; }
.top nav { display: flex; gap: 4px; font-family: system-ui, sans-serif; font-size: .92rem; }
.top nav a { text-decoration: none; padding: 6px 10px; border-radius: 999px; }
.top nav a.on { background: var(--ink); color: var(--bg); }

/* Formulare */
input, select, textarea { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label { display: block; font-family: system-ui, sans-serif; font-size: .85rem; color: var(--muted); }
label input, label select { margin-top: 4px; color: var(--ink); font-size: 1rem; }
label.inline { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
label.inline input { width: auto; margin: 0; }
button, .button { cursor: pointer; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 9px 16px; text-decoration: none; display: inline-block; font-family: system-ui, sans-serif; font-size: .95rem; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
button.danger { color: #b3261e; }
button.ghost { background: transparent; border-color: transparent; }
button:disabled { opacity: .5; cursor: default; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.login form { display: grid; gap: 14px; max-width: 380px; }

/* Suche */
.searchbox { position: relative; }
.searchbox input { font-size: 1.15rem; padding: 14px 44px 14px 16px; border-radius: 14px; }
.searchbox button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); font-size: 1.4rem; padding: 4px 10px; }

/* Listen */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li { position: relative; display: flex; align-items: stretch; flex-wrap: wrap; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.list li.picked { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.row { flex: 1; display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; text-decoration: none; align-items: center; min-width: 0; }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.orig { color: var(--muted); font-size: .88rem; font-style: italic; }
.orig.big { font-size: 1.05rem; margin: -.2em 0 .6em; }
.missing { font-family: system-ui, sans-serif; font-size: .82rem; color: var(--accent); margin-top: 2px; }
.pick { display: flex; align-items: center; padding-left: 14px; }
.pick input { width: 20px; height: 20px; accent-color: var(--accent); }
.list .factor.small { flex-basis: 100%; padding: 0 14px 12px 48px; }
.meta { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; font-family: system-ui, sans-serif; }
.pill { font-size: .74rem; background: var(--soft); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.pill.lang { font-weight: 600; }
.pill.freeze { color: var(--freeze); }
@media (max-width: 520px) {
  .row { flex-direction: column; align-items: flex-start; }
  .meta { justify-content: flex-start; }
}

/* Filter */
.filters { display: grid; gap: 10px; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: .86rem; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-family: system-ui, sans-serif; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .x { background: none; border: 0; padding: 0 2px; color: inherit; font-size: 1rem; line-height: 1; }
.chip small { opacity: .6; }

/* Andock-Leiste */
.dock { position: fixed; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); border-radius: 999px; padding: 8px 8px 8px 18px; display: flex; gap: 8px; align-items: center; box-shadow: 0 8px 30px rgb(0 0 0 / .25); font-family: system-ui, sans-serif; max-width: calc(100% - 32px); }
.dock .ghost { color: var(--bg); }

/* Mengen-Wahl */
.factor { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--paper); }
.factor button { border: 0; border-radius: 0; padding: 7px 14px; background: transparent; }
.factor button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.factor.small button { padding: 4px 10px; font-size: .82rem; }
.cooking { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 18px 0 4px; padding: 12px 14px; background: var(--soft); border-radius: var(--radius); font-family: system-ui, sans-serif; font-size: .95rem; }

/* Rezept */
.back { margin: 0; font-family: system-ui, sans-serif; font-size: .9rem; }
.back a { text-decoration: none; color: var(--muted); }
.recipe .meta { justify-content: flex-start; margin-bottom: 6px; }
.freeze-note { font-size: .95rem; padding: 10px 14px; border-radius: var(--radius); background: var(--paper); border: 1px solid var(--line); }
.freeze-note.gut { border-color: var(--freeze); }
.freeze-note.gut strong { color: var(--freeze); }
.notice { margin: 16px 0; border-color: var(--accent); }
.notice p { margin-top: 0; }
.ings { list-style: none; padding: 0; margin: 0; }
.ings li { display: grid; grid-template-columns: 6.5em 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.ings li.has { color: var(--muted); }
.ings .q { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; font-family: system-ui, sans-serif; font-size: .95rem; }
.ings .de, .ings .note, .ings .hint { color: var(--muted); }
.ings .hint { font-size: .85rem; }
.steps { padding-left: 1.4em; }
.steps li { margin-bottom: .9em; padding-left: .2em; }
.steps li::marker { font-weight: 700; color: var(--accent); }
.amt { font-family: system-ui, sans-serif; font-weight: 700; font-size: .9em; color: var(--green); white-space: nowrap; }
.notes { padding-left: 1.2em; color: var(--muted); }
.notes.hand { font-style: italic; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }

/* Einkaufsliste */
.addline { display: flex; gap: 8px; margin: 10px 0 16px; }
.addline select { width: auto; }
.addline button { flex-shrink: 0; font-size: 1.2rem; padding: 6px 16px; }
.shop { list-style: none; padding: 0; margin: 0; }
.shop li label { display: grid; grid-template-columns: 24px 5.5em 1fr; gap: 10px; align-items: baseline; padding: 10px 2px; border-bottom: 1px solid var(--line); color: var(--ink); font-family: inherit; font-size: 1rem; cursor: pointer; }
.shop input { width: 20px; height: 20px; accent-color: var(--green); align-self: center; }
.shop .q { font-weight: 700; text-align: right; font-family: system-ui, sans-serif; font-size: .92rem; }
.shop .hint { color: var(--muted); font-size: .85rem; }
.shop .from { display: block; color: var(--muted); font-size: .78rem; font-family: system-ui, sans-serif; }
.shop li.done .n, .shop li.done .q { text-decoration: line-through; color: var(--muted); }

/* Editor */
.editor .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 520px) { .editor .grid2 { grid-template-columns: 1fr; } }
.ing-edit { display: grid; gap: 10px; margin-bottom: 10px; }
.ing-row { display: grid; grid-template-columns: 2.4em 5em 4.5em 1fr 1fr; gap: 6px; align-items: center; padding: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.ing-row > :nth-child(n+6) { grid-column: span 1; }
.ing-row input, .ing-row select { padding: 7px 8px; font-size: .92rem; }
.iid { font-family: ui-monospace, monospace; font-size: .8rem; color: var(--muted); text-align: center; }
@media (max-width: 620px) { .ing-row { grid-template-columns: 2.4em 1fr 1fr; } }
.step-row { display: grid; grid-template-columns: 2em 1fr auto; gap: 6px; margin-bottom: 8px; align-items: start; }
code { font-family: ui-monospace, monospace; font-size: .85em; background: var(--soft); padding: 1px 4px; border-radius: 4px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 90px; background: var(--green); color: #fff; padding: 10px 18px; border-radius: 999px; font-family: system-ui, sans-serif; box-shadow: 0 6px 20px rgb(0 0 0 / .2); }
.ings .q.free { font-weight: normal; color: var(--muted); font-size: .82rem; }
.used { font-family: system-ui, sans-serif; font-size: .82rem; color: var(--green); font-weight: 600; margin-top: 2px; }
