:root {
  --green: #2f6f4f;
  --green-dark: #245a3f;
  --bg: #f6f7f4;
  --card: #ffffff;
  --text: #222222;
  --muted: #6b7280;
  --border: #e2e5e0;
  --danger: #b3261e;
  --radius: 12px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.6rem 1rem;
  background: var(--green);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .brand {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.1rem;
  margin-right: auto;
}

.nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.nav a {
  color: #eaf3ee;
  text-decoration: none;
  padding: 0.45rem 0.7rem;
  border-radius: 8px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav a:hover, .nav a:focus { background: rgba(255, 255, 255, 0.15); }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem 0.9rem 3rem;
}

h1 { font-size: 1.5rem; margin: 0.4rem 0 0.8rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.6rem; }
h3 { font-size: 1rem; margin: 0.8rem 0 0.4rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.card.link {
  display: block;
  text-decoration: none;
  color: inherit;
  min-height: 44px;
}

.card.link:hover { border-color: var(--green); }

.muted { color: var(--muted); }
.mt { margin-top: 1rem; }

.form label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.7rem;
}

.form input, .form textarea, .form select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.form input:focus, .form textarea:focus, .form select:focus {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { color: var(--danger); border-color: #e5b6b3; background: #fdf3f2; }
.btn.small { min-height: 36px; padding: 0.3rem 0.6rem; font-size: 0.85rem; }

.row { display: flex; align-items: center; gap: 0.5rem; }
.row.wrap { flex-wrap: wrap; }
.row.spread { justify-content: space-between; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }

/* Rezeptseite: Toolbar + Buttons + Suchfeld — mobil (iPhone) volle Breite gestapelt */
.toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; }

.btns { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.7rem; }
.btns .btn { flex: 1 1 45%; }

form.search { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 0.7rem; }
form.search input,
form.search select {
  width: 100%;
  padding: 0.6rem 0.7rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
form.search .row select { flex: 1; }

.mb { margin-bottom: 1rem; }
.btn.full { width: 100%; }

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0.4rem 0;
}

.cat-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.3rem 0;
}
.cat-row .inline-form { margin: 0; }
.cat-row select {
  padding: 0.45rem 0.5rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  max-width: 100%;
}

.inline-form label { font-weight: 600; }
.inline-form input {
  width: 6rem;
  padding: 0.5rem 0.6rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table.ing { width: 100%; border-collapse: collapse; margin-bottom: 0.5rem; }
table.ing th { text-align: left; font-size: 0.85rem; color: var(--muted); padding: 0.2rem 0.3rem; }
table.ing td { padding: 0.25rem 0.3rem 0.25rem 0; }
table.ing input, table.ing select {
  width: 100%;
  padding: 0.5rem 0.5rem;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
table.ing td:nth-child(2) { width: 6rem; }
table.ing td:nth-child(3) { width: 7rem; }
table.ing td:nth-child(4) { width: 3rem; }

.ingredients { padding-left: 1.2rem; }
.ingredients li { padding: 0.15rem 0; }

pre.instructions {
  white-space: pre-wrap;
  background: #f4f6f3;
  border-radius: 8px;
  padding: 0.8rem;
  font-family: inherit;
  font-size: 0.98rem;
}

table.nut { border-collapse: collapse; margin: 0.4rem 0; }
table.nut th, table.nut td { border: 1px solid var(--border); padding: 0.4rem 0.7rem; text-align: left; }
table.nut th { background: #f4f6f3; }

.flash {
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.8rem;
  border: 1px solid var(--border);
  background: #fff;
}
.flash.success { border-color: #bfe3cd; background: #eaf7ee; }
.flash.error { border-color: #e5b6b3; background: #fdf3f2; }
.flash.info { border-color: #c9dff5; background: #eef5fc; }

.auth-wrap { max-width: 420px; margin: 2rem auto; }

.code {
  background: #f4f6f3;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 1.05rem;
  letter-spacing: 0.1em;
}

.badge {
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 0.05rem 0.55rem;
  font-size: 0.8rem;
  font-weight: 600;
}

ul.shop { list-style: none; padding: 0; margin: 0; }

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.2rem;
  border-bottom: 1px solid var(--border);
  min-height: 48px;
}

.item:last-child { border-bottom: none; }

.item .label { display: flex; flex-direction: column; }
.item .name { font-weight: 600; }
.item .amt { color: var(--muted); font-size: 0.9rem; }

.item.cart .name, .item.cart .amt {
  text-decoration: line-through;
  opacity: 0.55;
}

.item .actions { display: flex; gap: 0.35rem; flex-shrink: 0; }
.item .actions form { margin: 0; }

.suggest-wrap { position: relative; display: block; }

.suggest {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 20;
  list-style: none;
  margin: 0.2rem 0 0;
  padding: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  max-height: 260px;
  overflow-y: auto;
}

.suggest li {
  padding: 0.6rem 0.7rem;
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}

.suggest li:hover, .suggest li:focus { background: #eef5f0; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin: 1rem 0;
}

@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  h1 { font-size: 1.3rem; }
  .container { padding: 0.8rem 0.7rem 2.5rem; }
  .topbar { padding: 0.5rem 0.7rem; }
  .nav a { padding: 0.4rem 0.55rem; font-size: 0.92rem; }
  table.ing td:nth-child(2) { width: 5rem; }
  table.ing td:nth-child(3) { width: 5.5rem; }
  /* iPhone: Buttons nebeneinander (2 pro Zeile), Suche/Suchen volle Breite */
  .btns .btn { flex: 1 1 45%; }
  form.search .row .btn { flex: 0 0 auto; }
}
