/* ===========================================================================
   Kochbuch – Design nach dem Canva-Original
   Farben und Schriften stammen 1:1 aus dem PDF (Hintergrund #CAB5AF,
   Text #1C1918, Vollkorn / Montserrat / Rubik).
   =========================================================================== */

:root {
  --bg:        #faf6f4;
  --surface:   #ffffff;
  --surface-2: #f4ebe7;
  --rose:      #cab5af;
  --rose-deep: #a3867d;
  --rose-soft: #eee2dd;
  --ink:       #1c1918;
  --ink-2:     #6b5d58;
  --ink-3:     #9c8d87;
  --line:      #e7dad5;
  --ok:        #6d8462;
  --warn:      #b4704e;

  --font-display: 'Vollkorn', Georgia, serif;
  --font-label:   'Montserrat', system-ui, sans-serif;
  --font-body:    'Rubik', system-ui, -apple-system, sans-serif;

  --radius:    14px;
  --radius-lg: 22px;
  --shadow:    0 1px 2px rgba(28,25,24,.05), 0 8px 24px -12px rgba(28,25,24,.18);
  --shadow-lg: 0 2px 6px rgba(28,25,24,.06), 0 24px 48px -20px rgba(28,25,24,.28);
  --tab-h:     64px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

button { font: inherit; color: inherit; cursor: pointer; }

/* Safari zoomt beim Doppeltipp hinein – das passiert schnell, wenn man die
   Personenzahl mehrmals hintereinander hochtippt. "manipulation" schaltet nur
   den Doppeltipp-Zoom ab; mit zwei Fingern lässt sich weiterhin zoomen. */
button, a, label, summary, input[type="checkbox"], .chip, .card, .tabbar__link {
  touch-action: manipulation;
}
/* Kein graues Aufblitzen und keine Textauswahl beim schnellen Tippen */
button, .tabbar__link, .chip { -webkit-tap-highlight-color: transparent; }
.stepper button, .servings__btn, .planitem__servings button { user-select: none; }

svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* --- Kopfzeile & Navigation ---------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 24px;
  padding: 14px clamp(16px, 4vw, 32px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -.01em;
  text-decoration: none;
  margin-right: auto;
}

.topnav { display: none; gap: 4px; }

.topnav__link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: .93rem;
  color: var(--ink-2);
  transition: background .15s, color .15s;
}
.topnav__link svg { width: 18px; height: 18px; }
.topnav__link:hover { background: var(--rose-soft); color: var(--ink); }
.topnav__link.is-active { background: var(--ink); color: var(--bg); }

.topbar__logout button {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink-2);
}
.topbar__logout button svg { width: 18px; height: 18px; }
.topbar__logout button:hover { color: var(--ink); border-color: var(--rose); }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 50;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar__link {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 4px 8px;
  text-decoration: none; color: var(--ink-3);
  font-family: var(--font-label); font-size: .64rem;
  font-weight: 500; letter-spacing: .06em; text-transform: uppercase;
}
.tabbar__link svg { width: 21px; height: 21px; }
.tabbar__link.is-active { color: var(--ink); }

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 32px) calc(var(--tab-h) + 40px);
  /* Randaussparung bei Geräten mit Notch im Querformat */
  padding-left: max(clamp(16px, 4vw, 32px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 32px), env(safe-area-inset-right));
}

@media (min-width: 860px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  .shell { padding-bottom: 64px; }
}

/* --- Bausteine ------------------------------------------------------------ */

.eyebrow {
  font-family: var(--font-label);
  font-size: .68rem; font-weight: 600;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--rose-deep);
  margin: 0 0 6px;
}

.hero { margin: 8px 0 24px; }
.hero--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.hero__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2rem, 6vw, 2.9rem);
  line-height: 1.05; letter-spacing: -.02em;
  margin: 0;
}
.hero__meta { color: var(--ink-2); font-size: .92rem; margin: 8px 0 0; }

.block { margin: 30px 0; }
.block--card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(18px, 3vw, 26px);
  box-shadow: var(--shadow);
}
.block__label {
  font-family: var(--font-label);
  font-size: .74rem; font-weight: 600;
  letter-spacing: .17em; text-transform: uppercase;
  margin: 0 0 14px;
}
.block__label--sub { color: var(--ink-2); font-size: .68rem; }

.empty {
  text-align: center; color: var(--ink-2);
  padding: 40px 16px; line-height: 2;
}

.note {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0; font-size: .93rem;
}
.note--soft { background: transparent; border: 1px dashed var(--line); color: var(--ink-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border: 1px solid transparent; border-radius: 999px;
  font-family: var(--font-label); font-size: .8rem; font-weight: 600;
  letter-spacing: .04em;
  text-decoration: none;
  transition: transform .12s, background .15s, border-color .15s;
}
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--ink); color: var(--bg); }
.btn--primary:hover { background: #34302e; }
.btn--ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--rose); color: var(--ink); }
.btn--danger { background: transparent; color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.btn--block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field__label {
  font-family: var(--font-label); font-size: .66rem; font-weight: 600;
  letter-spacing: .13em; text-transform: uppercase; color: var(--ink-2);
}
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: 11px;
  padding: 10px 13px;
  width: 100%;
}
.field textarea { resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--rose) 70%, transparent);
  outline-offset: 1px; border-color: var(--rose);
}
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field--inline .field__label { white-space: nowrap; }
.field--narrow { max-width: 150px; }
.field--check { flex-direction: row; align-items: center; gap: 10px; }
.field--check input { width: auto; }

/* --- Anmeldung ------------------------------------------------------------ */

.page-login { background: var(--rose); }
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login__card {
  background: var(--bg);
  border-radius: 26px;
  padding: 40px clamp(24px, 6vw, 44px);
  width: min(400px, 100%);
  text-align: center;
  box-shadow: var(--shadow-lg);
}
.login__mark { width: 96px; height: 96px; margin: 0 auto 8px; color: var(--rose-deep); }
.login h1 { font-family: var(--font-display); font-weight: 600; font-size: 2.2rem; margin: 0; letter-spacing: -.02em; }
.login__sub { color: var(--ink-2); margin: 4px 0 26px; font-size: .95rem; }
.login__form { text-align: left; }
.login__error { color: var(--warn); font-size: .88rem; margin: -6px 0 12px; }

/* --- Rezeptübersicht ------------------------------------------------------ */

.filters { margin-bottom: 26px; }

.search { position: relative; margin-bottom: 14px; }
.search svg {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px; color: var(--ink-3);
}
.search input {
  font: inherit; width: 100%;
  padding: 13px 16px 13px 44px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink);
}
.search input:focus { outline: 2px solid color-mix(in srgb, var(--rose) 70%, transparent); border-color: var(--rose); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .85rem; text-decoration: none; color: var(--ink-2);
  transition: border-color .15s, background .15s, color .15s;
}
.chip:hover { border-color: var(--rose); color: var(--ink); }
.chip em { font-style: normal; color: var(--ink-3); font-size: .78rem; }
.chip.is-active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.is-active em { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.chip--action.is-due { border-color: var(--rose-deep); color: var(--ink); background: var(--rose-soft); }
.chip--check { cursor: pointer; }
.chip--check input { position: absolute; opacity: 0; pointer-events: none; }
.chip--check:has(input:checked) { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: clamp(12px, 2.2vw, 22px);
}

.card { text-decoration: none; display: block; }
.card__media {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow);
  transition: transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .2s;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card:hover .card__media { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card__placeholder { display: grid; place-items: center; height: 100%; font-size: 2rem; }
.card__placeholder--big { font-size: 4rem; aspect-ratio: 3/4; }
.card__fav {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 999px; background: rgba(255,255,255,.9);
  color: var(--rose-deep); font-size: .95rem;
}
.card__body { padding: 10px 4px 0; }
.card__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: 1.02rem; line-height: 1.25; margin: 0;
  letter-spacing: -.01em;
}
.card__tags {
  margin: 5px 0 0; display: flex; flex-wrap: wrap; gap: 8px;
  font-size: .72rem; color: var(--ink-3);
}

/* --- Rezeptdetail --------------------------------------------------------- */

/* Foto randlos: die Polsterung von .shell wird exakt wieder aufgehoben –
   inklusive Randaussparung, sonst bleibt im Querformat ein Streifen stehen. */
.recipe {
  margin-top: -20px;
  margin-left: calc(-1 * max(clamp(16px, 4vw, 32px), env(safe-area-inset-left)));
  margin-right: calc(-1 * max(clamp(16px, 4vw, 32px), env(safe-area-inset-right)));
}
.recipe__photo { position: relative; background: var(--surface-2); }
.recipe__photo img { width: 100%; max-height: 62vh; object-fit: cover; }

.recipe__back, .recipe__fav {
  position: absolute; top: 16px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: none; border-radius: 999px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none;
}
.recipe__back { left: 16px; }
.recipe__back svg { width: 20px; height: 20px; }
.recipe__fav { right: 16px; color: var(--ink-3); font-size: 1.1rem; }
.recipe__fav.is-on { color: var(--rose-deep); }

.recipe__body {
  position: relative;
  margin-top: -34px;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  padding: 28px clamp(16px, 4vw, 32px) 0;
  max-width: 760px;
  margin-inline: auto;
}
.recipe__tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.pill {
  font-family: var(--font-label); font-size: .66rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase;
  background: var(--rose-soft); color: var(--rose-deep);
  padding: 5px 11px; border-radius: 999px;
}
.recipe__title {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2rem, 7vw, 3rem); line-height: 1.03;
  letter-spacing: -.025em; margin: 0 0 20px;
}

.servings {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 16px;
  width: fit-content;
}
.servings__label { font-size: .86rem; color: var(--ink-2); }
.servings__btn {
  width: 30px; height: 30px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg);
  font-size: 1.05rem; line-height: 1; display: grid; place-items: center;
}
.servings__btn:hover { border-color: var(--rose); }
.servings__value {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 600;
  min-width: 1.4ch; text-align: center;
}
.servings__hint { font-size: .74rem; color: var(--ink-3); }

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredient {
  display: flex; align-items: baseline; gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.ingredient:last-child { border-bottom: none; }
.ingredient__name { flex: 1; }
.ingredient__note { display: block; font-size: .78rem; color: var(--ink-3); font-style: normal; }
.ingredient__amount {
  font-style: italic; color: var(--ink-2);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.ingredient.is-fixed .ingredient__amount { color: var(--ink-3); }
.ingredients__legend { font-size: .76rem; color: var(--ink-3); margin: 12px 0 0; }

.prose p {
  display: flex; gap: 14px; align-items: flex-start;
  margin: 0 0 16px; line-height: 1.7;
}
.step-no {
  flex: none;
  width: 26px; height: 26px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--rose-soft); color: var(--rose-deep);
  font-family: var(--font-label); font-size: .72rem; font-weight: 600;
  margin-top: 2px;
}

.planform { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.planform .field { margin-bottom: 0; }

.recipe__foot {
  margin: 28px 0 0; padding: 18px 0 40px;
  border-top: 1px solid var(--line);
  font-size: .82rem; color: var(--ink-3);
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* --- Wochenplan ----------------------------------------------------------- */

.weeknav { display: flex; gap: 6px; }

.planweek {
  display: grid; gap: 12px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .planweek { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .planweek { grid-template-columns: repeat(4, 1fr); } }

.day {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
}
.day.is-today { border-color: var(--rose-deep); box-shadow: 0 0 0 3px var(--rose-soft); }
.day--open { grid-column: 1 / -1; background: var(--surface-2); }
.day__head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.day__head h2 {
  font-family: var(--font-label); font-size: .7rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; margin: 0;
}
.day__head span { font-size: .75rem; color: var(--ink-3); }

.slot { margin-bottom: 10px; }
.slot__label {
  font-size: .68rem; color: var(--ink-3);
  font-family: var(--font-label); letter-spacing: .1em; text-transform: uppercase;
}
.slot__items { display: flex; flex-direction: column; gap: 8px; margin-top: 5px; }
.slot__add {
  border: 1px dashed var(--line); border-radius: var(--radius);
  background: transparent; color: var(--ink-3);
  padding: 7px; font-size: 1rem; line-height: 1;
}
.slot__add:hover { border-color: var(--rose-deep); color: var(--rose-deep); background: var(--surface-2); }

.planitem {
  display: grid;
  grid-template-columns: 38px 1fr auto auto;
  align-items: center; gap: 9px;
  background: var(--bg);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 7px 9px;
}
.day--open .planitem { background: var(--surface); }
.planitem__img { width: 38px; height: 38px; border-radius: 9px; object-fit: cover; }
.planitem__title { font-size: .87rem; line-height: 1.25; text-decoration: none; }
.planitem__servings { display: flex; align-items: center; gap: 2px; }
.planitem__servings button {
  width: 22px; height: 22px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .8rem; line-height: 1; display: grid; place-items: center;
}
.planitem__servings span { font-size: .82rem; min-width: 1.6ch; text-align: center; font-variant-numeric: tabular-nums; }
.planitem__remove {
  border: none; background: transparent; color: var(--ink-3);
  font-size: 1.15rem; line-height: 1; padding: 2px 4px;
}
.planitem__remove:hover { color: var(--warn); }

.listbuild__lead { color: var(--ink-2); font-size: .92rem; margin: 0 0 16px; }
.staplepicks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.staplepick {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px 7px 11px; font-size: .85rem;
  background: var(--bg); cursor: pointer;
}
.staplepick:has(input:checked) { border-color: var(--rose-deep); background: var(--rose-soft); }
.staplepick em { font-style: normal; color: var(--ink-3); font-size: .78rem; }

/* --- Rezept-Auswahl (Dialog) ---------------------------------------------- */

.picker {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(28,25,24,.4);
  display: grid; place-items: end center;
  backdrop-filter: blur(3px);
}
.picker[hidden] { display: none; }
.picker__panel {
  background: var(--bg);
  width: min(560px, 100%);
  max-height: 86dvh;
  border-radius: 24px 24px 0 0;
  padding: 18px 18px 0;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 700px) {
  .picker { place-items: center; }
  .picker__panel { border-radius: 24px; padding-bottom: 18px; }
}
.picker__head { display: flex; align-items: center; justify-content: space-between; }
.picker__head h2 { font-family: var(--font-display); font-size: 1.3rem; margin: 0; font-weight: 600; }
.picker__close { border: none; background: transparent; font-size: 1.6rem; line-height: 1; color: var(--ink-3); }
.picker__search {
  font: inherit; margin: 12px 0;
  padding: 11px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
}
.picker__servings { margin-bottom: 10px; }
.picker__servings input { max-width: 90px; }
.picker__form { display: flex; flex-direction: column; min-height: 0; }
.picker__list {
  list-style: none; margin: 0; padding: 0 0 18px;
  overflow-y: auto; display: grid; gap: 6px;
}
.picker__item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 7px 10px; border: 1px solid transparent; border-radius: var(--radius);
  background: var(--surface); text-align: left;
}
.picker__item:hover { border-color: var(--rose); }
.picker__item img { width: 40px; height: 40px; border-radius: 9px; object-fit: cover; }

/* --- Einkaufsliste -------------------------------------------------------- */

.progressring { width: 54px; height: 54px; }
.progressring circle { fill: none; stroke-width: 3.2; }
.progressring__track { stroke: var(--line); }
.progressring__bar {
  stroke: var(--rose-deep); stroke-linecap: round;
  transform: rotate(-90deg); transform-origin: 50% 50%;
  stroke-dasharray: 106.8;
  stroke-dashoffset: calc(106.8 - 106.8 * var(--pct) / 100);
  transition: stroke-dashoffset .4s ease;
}

.additem {
  display: grid; gap: 8px;
  grid-template-columns: 1fr 78px 88px auto;
  margin-bottom: 22px;
}
.additem input {
  font: inherit; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--ink); min-width: 0;
}
.additem input:focus { outline: 2px solid color-mix(in srgb, var(--rose) 70%, transparent); border-color: var(--rose); }
@media (max-width: 620px) {
  .additem { grid-template-columns: 1fr 1fr; }
  .additem__name { grid-column: 1 / -1; }
  .additem .btn { grid-column: 1 / -1; }
}

.quickadd { margin-bottom: 20px; }
.quickadd .block__label { margin-bottom: 9px; }

.listgroups { display: grid; gap: 22px; }
.listgroup__head {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--font-label); font-size: .7rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink-2);
  margin: 0 0 8px;
}
.listgroup__icon { font-size: 1rem; letter-spacing: 0; }

.items { list-style: none; margin: 0; padding: 0; }
.item {
  display: grid;
  grid-template-columns: 30px 1fr auto 26px;
  align-items: center; gap: 11px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 6px;
  transition: opacity .2s, background .2s;
}
.item.is-checked { opacity: .48; background: var(--surface-2); }
.item.is-checked .item__name { text-decoration: line-through; }

.item__check {
  width: 26px; height: 26px; border-radius: 8px;
  border: 1.6px solid var(--line); background: var(--bg);
  display: grid; place-items: center; color: transparent;
}
.item__check svg { width: 15px; height: 15px; stroke-width: 2.6; }
.item.is-checked .item__check { background: var(--ok); border-color: var(--ok); color: #fff; }

.item__main { min-width: 0; }
.item__name { display: block; line-height: 1.3; }
.item__from {
  display: block; font-size: .72rem; color: var(--ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item__amount {
  border: 1px solid transparent; border-radius: 8px;
  background: transparent; padding: 3px 8px;
  font-style: italic; color: var(--ink-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.item__amount:hover { border-color: var(--line); background: var(--bg); }
.item__amount.is-edited { color: var(--warn); font-style: normal; }
.item__amount.is-edited::after { content: ' ✎'; font-size: .7em; }
.item__amount input { font: inherit; width: 4.5ch; border: none; background: transparent; text-align: right; }

.item__delete { border: none; background: transparent; color: var(--ink-3); font-size: 1.15rem; line-height: 1; }
.item__delete:hover { color: var(--warn); }

.listclose { margin: 28px 0; text-align: center; }

.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.history span { color: var(--ink-3); }

/* --- Vorrat --------------------------------------------------------------- */

.stapleform { display: grid; gap: 0 16px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: end; }
.stapleform .btn { grid-column: 1 / -1; justify-self: start; margin-top: 6px; }
.stapleform__actions { grid-column: 1 / -1; display: flex; gap: 10px; margin-top: 6px; }
.stapleform__actions .btn { grid-column: auto; margin-top: 0; }

.stapleslist { display: grid; gap: 8px; }
.staple {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 4px 14px;
}
.staple.is-due { border-color: var(--rose-deep); background: var(--rose-soft); }
.staple summary {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; cursor: pointer; list-style: none;
}
.staple summary::-webkit-details-marker { display: none; }
.staple__name { flex: 1; }
.staple__amount { color: var(--ink-2); font-style: italic; font-size: .88rem; }
.staple__rhythm {
  font-family: var(--font-label); font-size: .64rem; font-weight: 500;
  letter-spacing: .09em; text-transform: uppercase; color: var(--ink-3);
}
.stapleform--edit { padding: 8px 0 16px; border-top: 1px solid var(--line); margin-top: 4px; }

/* --- Neues-Rezept-Kachel & Archiv ---------------------------------------- */

.card__media--new {
  display: grid; place-content: center; gap: 8px; justify-items: center;
  border: 1.5px dashed var(--line); background: transparent;
  color: var(--ink-3); text-align: center; padding: 16px;
  transition: border-color .2s, color .2s, background .2s;
}
.card__media--new svg { width: 32px; height: 32px; }
.card__media--new span {
  font-family: var(--font-label); font-size: .68rem; font-weight: 600;
  letter-spacing: .12em; text-transform: uppercase;
}
.card--new:hover .card__media--new {
  border-color: var(--rose-deep); color: var(--rose-deep);
  background: var(--rose-soft); transform: none; box-shadow: none;
}
.archivelink { text-align: center; margin: 34px 0 0; font-size: .86rem; color: var(--ink-3); }

.archivebar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  background: var(--surface-2); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 18px;
  font-size: .9rem; color: var(--ink-2);
}

.flash {
  border-radius: var(--radius); padding: 12px 16px; margin: 0 0 18px;
  font-size: .92rem;
}
.flash--error { background: color-mix(in srgb, var(--warn) 14%, var(--bg)); color: var(--warn); }
.flash--ok { background: color-mix(in srgb, var(--ok) 14%, var(--bg)); color: var(--ok); }

/* --- Editor --------------------------------------------------------------- */

.editor { padding-bottom: 120px; }
.editor__row { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 18px; }

.ed-step__no {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 999px;
  background: var(--ink); color: var(--bg);
  font-size: .68rem; margin-right: 8px; vertical-align: -5px;
  letter-spacing: 0;
}
.ed-count {
  float: right; font-style: normal; font-weight: 500;
  color: var(--ink-3); letter-spacing: .04em; text-transform: none;
}
.ed-count.is-flash { color: var(--ok); }
.ed-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
/* Beschriftung ausserhalb eines .field (z.B. über den Tag-Chips) */
.block > .field__label { display: block; margin: 20px 0 9px; }
.chips--tags { margin-bottom: 4px; }

.field--hero input {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 600;
  padding: 12px 16px; letter-spacing: -.01em;
}
.field--spaced { margin-top: 22px; }
.field--hero.is-invalid input {
  border-color: var(--warn);
  animation: shake .4s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(2px); }
}

/* Foto-Ablage */
.dropzone {
  position: relative;
  border: 1.5px dashed var(--line); border-radius: var(--radius-lg);
  background: var(--bg);
  min-height: 190px;
  display: grid; place-items: center;
  overflow: hidden; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--rose-deep); background: var(--rose-soft); }
.dropzone.is-over { border-style: solid; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__hint {
  display: grid; justify-items: center; gap: 4px;
  color: var(--ink-3); text-align: center; padding: 24px;
  pointer-events: none;
}
.dropzone__hint svg { width: 30px; height: 30px; }
.dropzone__hint strong { font-family: var(--font-label); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.dropzone__hint span { font-size: .8rem; }
.dropzone__preview { display: none; width: 100%; max-height: 320px; object-fit: cover; }
.dropzone.has-image .dropzone__preview { display: block; }
.dropzone.has-image .dropzone__hint { display: none; }
.dropzone__clear {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 30px; height: 30px; border-radius: 999px; border: none;
  background: rgba(255,255,255,.92); color: var(--ink);
  font-size: 1.1rem; line-height: 1; box-shadow: var(--shadow);
}

/* Zähler-Stepper */
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button {
  width: 34px; height: 34px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 1.05rem; line-height: 1; display: grid; place-items: center;
  transition: border-color .15s, transform .1s;
}
.stepper button:hover { border-color: var(--rose-deep); }
.stepper button:active { transform: scale(.9); }
.stepper input {
  font: inherit; width: 56px; text-align: center;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 4px; background: var(--surface);
  font-variant-numeric: tabular-nums;
  transition: transform .18s, border-color .18s;
}
.stepper input.is-bumped { transform: scale(1.12); border-color: var(--rose-deep); }
.stepper__suffix { font-size: .85rem; color: var(--ink-2); }

/* Zutatenzeilen */
.ingrows { display: grid; gap: 8px; }
.ingrow {
  display: grid;
  grid-template-columns: 20px 1.7fr 78px 92px 1fr 30px;
  gap: 8px; align-items: center;
  background: var(--bg); border: 1px solid transparent;
  border-radius: 12px; padding: 4px;
  transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.ingrow:focus-within { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
.ingrow.is-dragging { opacity: .4; }
.ingrow.is-dropzone { border-color: var(--rose-deep); border-style: dashed; }
.ingrow__handle {
  cursor: grab; color: var(--ink-3); text-align: center;
  font-size: .8rem; letter-spacing: -2px; user-select: none;
  /* verhindert, dass beim Ziehen mit dem Finger die Seite scrollt */
  touch-action: none;
  display: grid; place-items: center; min-height: 34px;
}
.ingrow__handle:active { cursor: grabbing; }
.ingrow input {
  font: inherit; padding: 9px 12px; min-width: 0; width: 100%;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.ingrow input:focus { outline: none; border-color: var(--rose); }
.ingrow__qty, .ingrow__unit { text-align: center; }
.ingrow__del {
  border: none; background: transparent; color: var(--ink-3);
  font-size: 1.2rem; line-height: 1; border-radius: 999px;
  transition: color .15s, background .15s;
}
.ingrow__del:hover { color: var(--warn); background: var(--surface-2); }
@media (max-width: 680px) {
  /* Auf dem Handy dreizeilig statt gequetscht – mit benannten Bereichen,
     damit nichts unter den Ziehgriff rutscht. */
  .ingrow {
    grid-template-columns: 30px minmax(0, 1fr) minmax(0, 1fr) 34px;
    grid-template-areas:
      "handle name name del"
      ".      qty  unit unit"
      ".      note note note";
    row-gap: 6px;
    padding: 8px 6px;
  }
  .ingrow__handle { grid-area: handle; align-self: center; }
  .ingrow__name   { grid-area: name; }
  .ingrow__qty    { grid-area: qty; }
  .ingrow__unit   { grid-area: unit; }
  .ingrow__note   { grid-area: note; }
  .ingrow__del    { grid-area: del; justify-self: end; }
}

/* Vorschlagsliste */
.ac {
  position: absolute; z-index: 80;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 5px; display: none; max-height: 300px; overflow-y: auto;
}
.ac__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: none; border-radius: 8px;
  background: transparent; text-align: left; font-size: .92rem;
}
.ac__item:hover, .ac__item.is-active { background: var(--rose-soft); }
.ac__name { flex: 1; }
.ac__unit { color: var(--ink-3); font-size: .78rem; font-style: italic; }

/* Einheiten-Schnellwahl */
.unitpop {
  position: absolute; z-index: 80;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 7px; width: 240px;
  display: none; /* jQuery blendet ein – deshalb liegt das Grid eine Ebene tiefer */
}
.unitpop__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
.unitpop button {
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); padding: 7px 2px; font-size: .78rem;
}
.unitpop button:hover { border-color: var(--rose-deep); background: var(--rose-soft); }

/* Sammel-Import */
.bulk {
  margin-top: 14px; padding: 16px;
  background: var(--surface-2); border-radius: var(--radius);
}
.bulk__hint { margin: 0 0 10px; font-size: .82rem; color: var(--ink-2); line-height: 1.8; }
.bulk__hint code {
  background: var(--surface); border-radius: 6px; padding: 2px 7px;
  font-size: .82em; margin-right: 4px;
}
.bulk textarea {
  font: inherit; width: 100%; padding: 11px 14px; margin-bottom: 10px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  resize: vertical;
}

/* Zubereitungsschritte */
.steps { display: grid; gap: 8px; }
.steprow { display: grid; grid-template-columns: 28px 1fr 30px; gap: 10px; align-items: start; }
.steprow__no {
  width: 28px; height: 28px; border-radius: 999px; margin-top: 11px;
  display: grid; place-items: center;
  background: var(--rose-soft); color: var(--rose-deep);
  font-family: var(--font-label); font-size: .72rem; font-weight: 600;
}
.steprow textarea {
  font: inherit; width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); resize: none; overflow: hidden;
  line-height: 1.6; min-height: 52px;
}
.steprow textarea:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-soft); }
.steprow__del {
  border: none; background: transparent; color: var(--ink-3);
  font-size: 1.2rem; line-height: 1; margin-top: 10px; border-radius: 999px;
}
.steprow__del:hover { color: var(--warn); background: var(--surface-2); }

/* Speicherleiste */
.savebar {
  position: fixed; z-index: 45;
  left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap;
  padding: 12px clamp(14px, 4vw, 32px);
  padding-left: max(clamp(14px, 4vw, 32px), env(safe-area-inset-left));
  padding-right: max(clamp(14px, 4vw, 32px), env(safe-area-inset-right));
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  transition: border-color .2s;
}
.savebar.is-dirty { border-top-color: var(--rose-deep); }
.savebar__state {
  font-family: var(--font-label); font-size: .68rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
  min-width: 0;
}
.savebar__state.is-dirty { color: var(--warn); }
.savebar__buttons { display: flex; gap: 8px; margin-left: auto; flex: 1; justify-content: flex-end; }
.savebar__buttons .btn { flex: 0 1 auto; min-width: 0; }
@media (max-width: 460px) {
  /* Zu schmal für den Statustext – der Hinweis wird zum Punkt,
     damit man trotzdem sieht, dass etwas offen ist. */
  .savebar__state { font-size: 0; letter-spacing: 0; }
  .savebar__state.is-dirty::before {
    content: ''; display: block;
    width: 9px; height: 9px; border-radius: 999px;
    background: var(--warn);
    animation: pulse 1.6s ease-in-out infinite;
  }
  .savebar__buttons .btn { flex: 1; padding-inline: 10px; font-size: .75rem; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ===========================================================================
   Feinschliff für Handy und Touch
   =========================================================================== */

/* Nichts darf seitlich aus dem Bild laufen */
.editor__row .field,
.planform .field,
.stapleform .field { min-width: 0; }
.bulk__hint code { word-break: break-word; }
.hero__title, .card__title, .recipe__title, .item__name { overflow-wrap: anywhere; }

/* Grössere Ziele, wo mit dem Finger getippt wird */
@media (pointer: coarse) {
  .ingrow__del,
  .steprow__del,
  .item__delete,
  .planitem__remove,
  .dropzone__clear { min-width: 38px; min-height: 38px; }

  .item__check { width: 30px; height: 30px; }
  .item { grid-template-columns: 34px 1fr auto 38px; padding: 13px 12px; }

  .planitem__servings button { width: 30px; height: 30px; }
  .planitem { grid-template-columns: 38px 1fr auto auto; gap: 10px; padding: 8px; }

  .servings__btn { width: 36px; height: 36px; }
  .slot__add { padding: 11px; }
  .chip { padding: 9px 15px; }
  .ac__item { padding: 11px 12px; }
  .unitpop button { padding: 11px 2px; }
}

@media (max-width: 430px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }

  /* Zwei Zähler nebeneinander werden zu eng – untereinander ist ruhiger */
  .editor__row { gap: 6px 20px; }
  .editor__row .field { flex: 1 1 100%; }

  .block--card { border-radius: 18px; }
  .recipe__body { border-radius: 22px 22px 0 0; }
  .ed-count { float: none; display: block; margin-top: 4px; }
  .ed-actions .btn { flex: 1 1 auto; }
}
