/* Eusi Rezept – Stylesheet
   Hell, warm, ruhig. Rot nur für Primäraktionen, aktive Filter und Hinweise. */

:root {
  --bg: #fbf9f6;
  --surface: #ffffff;
  --surface-2: #f3efea;
  --border: #e5dfd7;
  --border-strong: #cfc7bd;
  --text: #1f1b18;
  --text-2: #6b645d;
  --text-3: #9a928a;
  --primary: #c4342d;
  --primary-hover: #a82b25;
  --primary-soft: #fbeae8;
  --ok-bg: #e9f4ec;  --ok-text: #1f5a2e;  --ok-border: #cfe5d6;
  --err-bg: #fdecea; --err-text: #8f2420; --err-border: #f5cfcb;
  --tip-bg: #fbf3df; --tip-border: #efe0b4;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgba(31, 27, 24, .04), 0 10px 28px -14px rgba(31, 27, 24, .22);
  --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --wrap: 1080px;
  --gutter: 16px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 150ms;
  --t: 220ms;
}
@media (min-width: 640px) { :root { --gutter: 24px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* Grundlagen ------------------------------------------------------------ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font-body); font-size: 16px; line-height: 1.55;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip { position: absolute; left: 8px; top: -100px; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); z-index: 100; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.wrap {
  width: 100%; max-width: var(--wrap); margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.page { padding-top: 20px; padding-bottom: 72px; }
@media (min-width: 640px) { .page { padding-top: 28px; } }

.icon { width: 1.25em; height: 1.25em; flex: 0 0 auto; }

/* Kopfzeile ------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(251, 249, 246, .88);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding-top: 8px; padding-bottom: 8px; }
.logo {
  display: inline-flex; flex-direction: column;
  font-family: var(--font-display); font-style: italic; font-size: 23px; line-height: .9;
  text-decoration: none; padding: 4px 2px; color: var(--text);
}
.logo span:last-child { padding-left: .55em; }
.topnav { display: flex; align-items: center; gap: 6px; }
.link-quiet {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 10px 6px;
  color: var(--text-2); text-decoration: none;
}
.link-quiet:hover { color: var(--text); text-decoration: underline; }

/* Knöpfe ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast), transform var(--t-fast) var(--ease);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; transform: none; }
.btn-primary, .btn-danger { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, .btn-danger:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-quiet { background: transparent; border-color: transparent; }
.btn-quiet:hover { background: var(--surface-2); border-color: transparent; }
.btn-danger-text { color: var(--text-2); }
.btn-danger-text:hover { color: var(--primary); }
.btn-lg { min-height: 50px; padding: 0 22px; font-size: 17px; }
.btn-sm { min-height: 38px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn-block { width: 100%; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--text-2); text-decoration: none;
  transition: background var(--t-fast), color var(--t-fast);
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn-sm { width: 40px; height: 40px; }
.btn-add { width: 44px; padding: 0; border-radius: 50%; }
.btn-add span { display: none; }
@media (min-width: 480px) {
  .btn-add { width: auto; padding: 0 16px 0 12px; border-radius: 12px; }
  .btn-add span { display: inline; }
}

/* Profilbild ------------------------------------------------------------ */

.avatar {
  display: inline-grid; place-items: center; flex: 0 0 auto;
  width: 38px; height: 38px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
}
.avatar-fallback { font-family: var(--font-display); font-style: italic; font-size: 21px; line-height: 1; padding-bottom: 2px; user-select: none; }
.avatar-sm { width: 28px; height: 28px; }
.avatar-sm.avatar-fallback { font-size: 16px; }
.avatar-lg { width: 96px; height: 96px; }
.avatar-lg.avatar-fallback { font-size: 50px; }
.avatar-link { display: inline-flex; padding: 3px; border-radius: 50%; transition: background var(--t-fast); }
.avatar-link:hover { background: var(--surface-2); }
.avatar-link:hover .avatar { border-color: var(--border-strong); }
.avatar-big { display: inline-flex; }
.avatar-frame { display: inline-flex; }
.profile-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; margin-bottom: 18px; }
.profile-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.profile-actions .hint { margin-top: 0; }
.profile-form .field { margin-bottom: 16px; max-width: 400px; }
.recipe-foot { display: flex; align-items: center; gap: 10px; }

/* Hinweise -------------------------------------------------------------- */

.flash { margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-weight: 500; }
.flash-ok { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-border); }
.flash-error { background: var(--err-bg); color: var(--err-text); border-color: var(--err-border); }
.page .flash { margin: 0 0 20px; }

/* Text ------------------------------------------------------------------ */

.page-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(32px, 6vw, 40px); letter-spacing: -.01em; margin-bottom: 8px; }
.muted { color: var(--text-2); }
.center { text-align: center; }
.hint { color: var(--text-2); font-size: 14px; margin-top: 6px; line-height: 1.45; }
.hint a { color: inherit; }
.backlink { margin-bottom: 8px; font-size: 15px; }
.backlink a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 0; color: var(--text-2); text-decoration: none; }
.backlink a:hover { color: var(--text); text-decoration: underline; }

/* Suche und Filter ------------------------------------------------------ */

.home-head { margin-bottom: 14px; }
.search { position: relative; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-2); pointer-events: none; }
.search-input {
  width: 100%; min-height: 48px; padding: 0 16px 0 44px; border-radius: 14px;
  border: 1px solid var(--border); background: var(--surface); appearance: none; -webkit-appearance: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.search-input::placeholder { color: var(--text-3); }
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.chips {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
  margin: 0 calc(-1 * var(--gutter)) 12px; padding: 2px var(--gutter) 8px;
}
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 640px) {
  .chips { flex-wrap: wrap; overflow: visible; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
}
.chip {
  display: inline-flex; align-items: center; flex: 0 0 auto;
  min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 15px; text-decoration: none; white-space: nowrap;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip:hover { border-color: var(--border-strong); background: var(--surface-2); }
.chip.is-active { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }
.chip-sm { min-height: 32px; padding: 0 12px; font-size: 14px; }

/* Rezeptkarten ---------------------------------------------------------- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); gap: 14px; margin-top: 4px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 20px; } }
.card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: inherit; text-decoration: none;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.card:focus-visible { outline-offset: 3px; }
.card-media { aspect-ratio: 4 / 3; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--text-3); }
.card-placeholder .icon { width: 36px; height: 36px; stroke-width: 1.5; }
.card-body { display: flex; flex-direction: column; gap: 6px; flex: 1; padding: 12px 14px 14px; }
.card-title { font-size: 16px; font-weight: 600; line-height: 1.3; text-wrap: balance; }
@media (min-width: 640px) { .card-title { font-size: 17px; } }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: auto; color: var(--text-2); font-size: 13.5px; }
.meta-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.meta-item .icon { width: 16px; height: 16px; }
.empty-inline { padding: 32px 0; text-align: center; color: var(--text-2); }

/* Leerzustand ----------------------------------------------------------- */

.empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 56px 16px; text-align: center; }
.empty-icon { width: 44px; height: 44px; color: var(--text-3); stroke-width: 1.5; }
.empty-title { font-family: var(--font-display); font-weight: 400; font-size: 34px; }
.empty p { color: var(--text-2); max-width: 36ch; }
.empty .btn { margin-top: 8px; }

/* Rezeptansicht --------------------------------------------------------- */

.recipe-head { margin-bottom: 20px; }
.recipe-title {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(36px, 7vw, 54px);
  line-height: 1.05; letter-spacing: -.015em; text-wrap: balance; margin-bottom: 12px;
}
.recipe-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 14px; color: var(--text-2); font-size: 15px; }
.recipe-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.inline { display: inline; }
.recipe-figure { margin: 0 0 24px; border-radius: var(--radius-lg); overflow: hidden; background: var(--surface-2); }
.recipe-figure img { width: 100%; height: auto; max-height: 60vh; object-fit: cover; }

.recipe-cols { display: grid; gap: 28px; }
@media (min-width: 820px) {
  .recipe-cols { grid-template-columns: minmax(280px, 360px) 1fr; gap: 44px; align-items: start; }
  .ingredients { position: sticky; top: 84px; }
}
.ingredients { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 18px 8px; }
.ingredients-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; margin-bottom: 8px; }
.ingredients h2, .steps h2 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.steps h2 { margin-bottom: 10px; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.stepper-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text); transition: background var(--t-fast);
}
.stepper-btn:hover { background: var(--surface-2); }
.stepper-btn:disabled { color: var(--text-3); background: transparent; cursor: default; }
.stepper-out { min-width: 7.5em; text-align: center; font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }

/* Abhakbare Zeilen (Zutaten + Schritte) */
.ingredient-list, .step-list { list-style: none; }
.check-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.check-row {
  position: relative; display: grid; grid-template-columns: 6.5rem 1fr; gap: 12px; align-items: baseline;
  padding: 10px 0 10px 30px; border-bottom: 1px solid var(--border); cursor: pointer;
}
.ingredient-list li:last-child .check-row { border-bottom: 0; }
.check-row::before {
  content: ''; position: absolute; left: 0; top: 13px; width: 18px; height: 18px; border-radius: 6px;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  transition: background var(--t-fast), border-color var(--t-fast);
}
.check-row::after {
  content: ''; position: absolute; left: 6.5px; top: 15.5px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0);
  transition: transform var(--t-fast) var(--ease);
}
.check-row:has(.check-input:checked)::before { background: var(--primary); border-color: var(--primary); }
.check-row:has(.check-input:checked)::after { transform: rotate(45deg) scale(1); }
.check-row:has(.check-input:checked) .ing-amount,
.check-row:has(.check-input:checked) .ing-name { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.check-row:has(.check-input:focus-visible), .step-row:has(.check-input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.ing-amount { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ing-name { overflow-wrap: anywhere; }

.step-row { position: relative; display: grid; grid-template-columns: 32px 1fr; gap: 14px; align-items: start; padding: 10px 0; cursor: pointer; }
.step-num {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 14px;
  transition: background var(--t-fast), color var(--t-fast);
}
.step-text { font-size: 17px; line-height: 1.6; padding-top: 3px; overflow-wrap: anywhere; }
.step-row:has(.check-input:checked) .step-num { background: var(--primary); color: #fff; }
.step-row:has(.check-input:checked) .step-text { color: var(--text-3); }

.tip { margin-top: 24px; padding: 16px 18px; background: var(--tip-bg); border: 1px solid var(--tip-border); border-radius: var(--radius); }
.tip h3 { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.tip h3 .icon { width: 18px; height: 18px; }
.tip p { line-height: 1.6; }
.recipe-foot { margin-top: 32px; font-size: 14px; }

/* Formulare ------------------------------------------------------------- */

.recipe-form, .settings { max-width: 720px; }
.form-head { margin-bottom: 20px; }
.field { margin-bottom: 22px; }
.field > label, .field > legend, .field > .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface); appearance: none; -webkit-appearance: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.input::placeholder { color: var(--text-3); }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input-lg { min-height: 52px; font-size: 18px; }
.input-num { text-align: center; padding-left: 8px; padding-right: 8px; }
.textarea { resize: none; line-height: 1.5; overflow: hidden; }
.has-error .input { border-color: var(--primary); }
.field-error { margin-top: 6px; color: var(--err-text); font-size: 14px; font-weight: 500; }

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 20px; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 56px; }
.input-suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-2); pointer-events: none; }
.input-pair { display: grid; grid-template-columns: 84px 1fr; gap: 8px; }

.chip-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-toggle { position: relative; }
.chip-toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-toggle span {
  display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); font-size: 15px; cursor: pointer; user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip-toggle span:hover { border-color: var(--border-strong); }
.chip-toggle input:checked + span { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }
.chip-toggle input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }

.ing-head { display: grid; grid-template-columns: 4.6rem 4.6rem 1fr 40px; gap: 8px; margin-bottom: 4px; padding: 0 2px; font-size: 13px; color: var(--text-2); }
.repeat-list { display: flex; flex-direction: column; gap: 8px; list-style: none; }
.ing-row { display: grid; grid-template-columns: 4.6rem 4.6rem 1fr 40px; gap: 8px; align-items: center; }
.ing-row .input { padding-left: 10px; padding-right: 10px; }
@media (min-width: 480px) {
  .ing-head, .ing-row { grid-template-columns: 5.5rem 6rem 1fr 40px; }
  .ing-row .input { padding-left: 14px; padding-right: 14px; }
}
.step-edit { display: grid; grid-template-columns: 32px 1fr 40px; gap: 10px; align-items: start; }
.step-edit .step-num { margin-top: 7px; }
.row-tools { display: flex; flex-direction: column; gap: 0; }
.row-tools .iconbtn-sm { height: 36px; }
.repeat-foot { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 10px; }

.image-preview { width: 100%; max-width: 360px; aspect-ratio: 4 / 3; margin-bottom: 10px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* Rezeptformular: Abschnitte ------------------------------------------- */

.form-head { margin-bottom: 18px; }
.form-head .muted { margin-top: 2px; }
.form-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px 16px 18px; margin-bottom: 16px;
}
@media (min-width: 640px) { .form-section { padding: 22px 24px 24px; margin-bottom: 20px; } }
.form-section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.form-section-head h2 { font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.form-section-head h2 .muted { font-weight: 400; font-size: 15px; margin-left: 4px; }
.form-section-num {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 13px; font-weight: 700; flex: 0 0 auto;
}
.form-section .field:last-child, .form-section .field-last { margin-bottom: 0; }
.hint-top { margin: -8px 0 14px; }

/* Foto */
.photo-drop {
  position: relative; aspect-ratio: 16 / 10; border-radius: var(--radius);
  border: 2px dashed var(--border-strong); background: var(--bg); overflow: hidden;
  transition: border-color var(--t-fast), background var(--t-fast);
}
@media (min-width: 640px) { .photo-drop { aspect-ratio: 16 / 7; } }
.photo-drop.has-image { border-style: solid; border-color: var(--border); background: var(--surface-2); }
.photo-drop.is-dragover { border-color: var(--primary); background: var(--primary-soft); }
.photo-drop.is-busy { opacity: .7; }
.photo-frame { position: absolute; inset: 0; display: block; }
.photo-frame img { width: 100%; height: 100%; object-fit: cover; }
.photo-empty {
  position: absolute; inset: 0; width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; padding: 16px; border: 0; background: transparent; color: var(--text); text-align: center; border-radius: inherit;
  transition: background var(--t-fast);
}
.photo-empty:hover { background: var(--surface-2); }
.photo-empty strong { font-weight: 600; font-size: 16px; }
.photo-icon { width: 30px; height: 30px; color: var(--text-2); stroke-width: 1.6; margin-bottom: 2px; }
.photo-sub { font-size: 13.5px; color: var(--text-2); }
.photo-tools { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 6px; }
.btn-overlay { background: rgba(255, 255, 255, .92); border-color: transparent; box-shadow: 0 2px 10px -4px rgba(0, 0, 0, .35); backdrop-filter: blur(6px); }
.btn-overlay:hover { background: #fff; }

/* Titel als Schreibzeile */
.title-input {
  display: block; width: 100%; padding: 6px 0 8px; border: 0; border-bottom: 2px solid var(--border);
  background: transparent; font-size: 24px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3; border-radius: 0;
  transition: border-color var(--t-fast);
}
@media (min-width: 640px) { .title-input { font-size: 28px; } }
.title-input::placeholder { color: var(--text-3); font-weight: 500; }
.title-input:focus { outline: none; border-bottom-color: var(--primary); }
.has-error .title-input { border-bottom-color: var(--primary); }

/* Dauer + Ergibt */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 24px; margin-bottom: 24px; }
.meta-grid .field { margin-bottom: 0; }
@media (max-width: 639px) { .photo-sub-drag { display: none; } }
.quick-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-chips .chip { cursor: pointer; }
.portion-control { display: grid; grid-template-columns: auto 1fr; gap: 8px; align-items: center; }
.stepper-input { height: 46px; }
.stepper-field {
  width: 3.2em; height: 100%; border: 0; background: transparent; text-align: center; font-weight: 600;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.stepper-field::-webkit-outer-spin-button, .stepper-field::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-field:focus { outline: none; }
.stepper-input:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Neuer Tag im Formular */
.chip-new { display: inline-flex; }
.chip-add { border-style: dashed; color: var(--text-2); gap: 4px; cursor: pointer; }
.chip-add:hover { color: var(--text); }
.chip-add .icon { width: 16px; height: 16px; }
.chip-input {
  min-height: 40px; width: 12em; padding: 0 14px; border-radius: 999px; border: 1px solid var(--primary);
  background: var(--surface); font-size: 15px; box-shadow: 0 0 0 3px var(--primary-soft);
}
.chip-input:focus { outline: none; }

/* Zutaten-Schnelleingabe */
.quick-add { display: grid; grid-template-columns: 1fr 52px; gap: 8px; }
.quick-add-btn { min-height: 52px; padding: 0; border-radius: var(--radius-sm); }
.quick-add-btn .icon { width: 22px; height: 22px; }
.quick-add + .hint { margin-bottom: 16px; }
.ing-head { margin-top: 4px; }

/* Speicherleiste */
.form-summary { margin-right: auto; font-size: 14px; }
@media (max-width: 479px) { .form-summary { display: none; } }

.form-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: 10px; margin-top: 12px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: rgba(251, 249, 246, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
}
@media (max-width: 479px) { .form-actions .btn-primary { flex: 1; } }

/* Login ----------------------------------------------------------------- */

.login { max-width: 400px; margin: 24px auto 0; }
.login .page-title { margin-bottom: 4px; }
.login > .muted { margin-bottom: 20px; }
.login .flash { margin-bottom: 16px; }
.login .center { margin-top: 20px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack .field { margin-bottom: 0; }
.stack-narrow { max-width: 400px; }

/* Einstellungen --------------------------------------------------------- */

.panel { margin-top: 20px; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); scroll-margin-top: 84px; }
.panel h2 { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.panel > .muted { margin-bottom: 14px; }
.panel-plain { background: transparent; border-color: transparent; padding: 8px 0; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-form .input { flex: 1 1 200px; }
.tag-list { list-style: none; display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.tag-row { display: flex; align-items: center; gap: 8px; }
.tag-row .input { flex: 1; min-width: 0; min-height: 42px; }
.tag-count { min-width: 5.5rem; text-align: right; font-size: 13.5px; white-space: nowrap; }
@media (max-width: 479px) { .tag-count { display: none; } }

/* Dialog ---------------------------------------------------------------- */

.dialog { border: 0; padding: 0; background: transparent; max-width: min(92vw, 420px); }
.dialog::backdrop { background: rgba(31, 27, 24, .4); }
.dialog-in { padding: 22px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.dialog-text { margin-bottom: 18px; font-size: 17px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog[open] { animation: pop var(--t) var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
