﻿:root {
  --bg: #f5f4f1;
  --card: #ffffff;
  --text: #2b2b2b;
  --muted: #8a8a8a;
  --accent: #e0662a;
  --accent-dark: #c2531f;
  --green: #2e8b57;
  --red: #c0392b;
  --border: #e2dfd8;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 16px;
}

.wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ---- Topbar ---- */
.topbar {
  background: var(--text);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 54px;
  flex-wrap: wrap;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.1rem;
  white-space: nowrap;
}

.nav-toggle {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
  font-size: 1.2rem;
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.nav {
  display: none;
  flex-direction: column;
  gap: 2px;
  background: var(--text);
  padding: 8px 0 12px;
  flex-basis: 100%;
  width: 100%;
}

.nav.open { display: flex; }

.nav a {
  color: #fff;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
}

.nav a:hover { background: rgba(255, 255, 255, 0.12); }

.nav-user {
  color: #ccc;
  padding: 10px 12px;
  white-space: nowrap;
}

.btn-ghost {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #fff;
}

.inline-form { display: inline-flex; gap: 4px; align-items: center; }

@media (min-width: 860px) {
  .nav-toggle { display: none; }
  .nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    padding: 0;
    flex-basis: auto;
    width: auto;
  }
}

/* ---- Layout / Cards ---- */
main.wrap { padding-top: 20px; padding-bottom: 40px; }

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.page-head h1 { margin: 0; font-size: 1.5rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.card h2 { margin-top: 0; font-size: 1.15rem; }

h1 { font-size: 1.5rem; }

.muted { color: var(--muted); font-size: 0.9rem; }

.footer { text-align: center; padding: 24px 16px; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  padding: 9px 16px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1.3;
}

.btn:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.btn-block { display: block; width: 100%; }

.btn-small { padding: 5px 10px; font-size: 0.85rem; border-radius: 8px; }

.btn-danger { background: var(--red); border-color: var(--red); }

.btn-danger:hover { background: #a93226; border-color: #a93226; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }

.btn-row .btn { margin: 0; }

.btn-fav { background: #f4c542; border-color: #f4c542; color: #3a2d00; }

/* ---- Flash ---- */
.flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  border: 1px solid;
}

.flash-success { background: #e7f5ec; border-color: #bfe3cc; color: #1f6b3d; }
.flash-error { background: #fdecea; border-color: #f2c4bf; color: #a42a1c; }

/* ---- Forms ---- */
form label {
  display: block;
  font-weight: 600;
  margin-top: 10px;
  font-size: 0.95rem;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

textarea { resize: vertical; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 12px;
}

@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }

.form-row { display: flex; flex-direction: column; gap: 8px; }
@media (min-width: 640px) { .form-row { flex-direction: row; } .form-row input { flex: 1; } .form-row .btn { flex: 0 0 auto; } }

.checkbox-row { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; }
.checkbox-row label, .chk { display: flex !important; align-items: center; gap: 6px; font-weight: 500; }
.chk input { width: auto; }

.auth-card { max-width: 420px; margin: 40px auto; }

/* ---- Stats ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 16px; }

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}

.stat-num { display: block; font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat-label { color: var(--muted); font-size: 0.85rem; }

/* ---- Recipe list ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

.filter-bar input[type="search"] { flex: 1 1 200px; }
.filter-bar select { width: auto; }

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.recipe-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  display: block;
}

.recipe-card:hover { border-color: var(--accent); }

.recipe-thumb {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 10px;
  background: #f2f2f2;
}

.recipe-hero {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 12px;
  background: #f2f2f2;
}

.recipe-card-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.recipe-title { font-weight: 700; }
.recipe-card-meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 0.85rem; }

.badge {
  background: #eee;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
}

.badge-green { background: #e7f5ec; color: var(--green); }
.badge-auto { background: #eef2ff; color: #4f46e5; }

.share-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.share-row input { flex: 1 1 260px; font-size: inherit; }
.share-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.share-cta p { margin: 0; }

.img-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.img-field img {
  max-width: 260px;
  max-height: 160px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--border);
  background: #f2f2f2;
}

/* ---- Recipe detail ---- */
.recipe-detail { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 860px) { .recipe-detail { grid-template-columns: 1fr 1fr; align-items: start; } }

.recipe-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }

.serving-form { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.serving-form label { margin: 0; display: flex; align-items: center; gap: 6px; }
.serving-form select { width: auto; }

table.ingredients { width: 100%; border-collapse: collapse; margin: 8px 0; }
table.ingredients td { padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: top; }
td.qty { width: 60px; font-weight: 700; white-space: nowrap; }
td.unit { width: 70px; color: var(--muted); }

/* ---- Ingredient rows (forms) ---- */
.ing-row { display: grid; grid-template-columns: 70px 90px 1fr 34px; gap: 6px; margin-bottom: 6px; align-items: center; }
.ing-row.ing-head span { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
.btn-remove {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  color: var(--red);
  cursor: pointer;
  font-size: 0.9rem;
}

.tag-picker { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }

/* ---- Plan ---- */
.plan-list { display: flex; flex-direction: column; gap: 10px; }

.plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
}

.plan-card:hover { border-color: var(--accent); }

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.day-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
}

.day-head { margin: 0 0 10px; font-size: 1.05rem; }

.meal-box {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
}

.meal-box h3 { margin: 0 0 6px; font-size: 0.85rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.03em; }

.meal-box-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.meal-box-head h3 { margin: 0; }

.btn-del {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  background: none;
  border-radius: 7px;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--muted);
}
.btn-del:hover { border-color: var(--red); color: var(--red); }

.fill-meals { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.fill-meals .chk { font-weight: 500; }

.meal-selected { margin-bottom: 6px; display: flex; align-items: flex-start; gap: 10px; }
.meal-selected strong { margin-right: 0; }
.meal-selected-text { display: block; }

.meal-thumb {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 7px;
  background: #f2f2f2;
  flex: 0 0 auto;
}

.fill-menu { position: relative; display: inline-block; }
.fill-menu summary { list-style: none; }
.fill-menu summary::-webkit-details-marker { display: none; }
.fill-menu-box {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 300px;
  z-index: 40;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}
.fill-menu-box form label { font-size: 0.9rem; }

.meal-box.pick-target { outline: 2px dashed var(--accent); }
.meal-box.drop-target { outline: 2px dashed var(--green); background: #f2faf5; }

.cat-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.cat-side .cat-drawer { margin: 0; }

.cat-drawer summary { cursor: pointer; }
.cat-search { margin: 10px 0; }
.cat-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; margin-top: 2px; }

.cat-recipe {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 6px 8px;
  cursor: grab;
  background: #fff;
}
.cat-recipe:hover { border-color: var(--accent); }
.cat-recipe.picking { outline: 2px solid var(--accent); }
.cat-recipe img { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; background: #f2f2f2; flex: 0 0 auto; }
.cat-recipe span { font-size: 0.9rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Mini-Katalog im â€žÃ„ndernâ€œ-Editor (statt Dropdown) ---- */
.mini-cat { margin-bottom: 8px; }
.mini-cat-search { width: 100%; box-sizing: border-box; }
.mini-cat-list { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow: auto; margin-top: 6px; }
.mini-recipe {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 4px 6px;
  cursor: pointer;
}
.mini-recipe:hover { border-color: var(--accent); }
.mini-recipe.selected { border-color: var(--accent); background: #eef4fd; }
.mini-recipe input[type="radio"] {
  width: auto;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  flex: 0 0 auto;
}
.mini-recipe img { width: 30px; height: 30px; object-fit: cover; border-radius: 5px; background: #f2f2f2; flex: 0 0 auto; }
.mini-recipe span { flex: 1; min-width: 0; font-size: 0.85rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-empty { font-size: 0.85rem; padding: 4px 2px; }

@media (min-width: 1000px) {
  .cat-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .cat-side { position: sticky; top: 70px; }
  .cat-side .cat-list { max-height: calc(100vh - 190px); }
}

.manual-grid { width: 100%; border-collapse: collapse; margin-top: 8px; }
.manual-grid th, .manual-grid td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.manual-grid th { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.manual-grid td select { padding: 6px 8px; font-size: 0.9rem; }
.manual-day { white-space: nowrap; font-weight: 600; font-size: 0.9rem; }

.meal-edit summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; margin-bottom: 6px; }

.meal-edit form select, .meal-edit form input[type="text"] { margin-bottom: 6px; }

.persons-input { width: 64px; display: inline-block; padding: 6px; }

/* ---- Shopping ---- */
.shop-list { list-style: none; margin: 0; padding: 0; }

.shop-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.shop-list li.done .shop-name { text-decoration: line-through; color: var(--muted); }

.check-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  background: none;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
}

.shop-qty { font-weight: 700; min-width: 44px; }
.shop-qty-form { margin: 0; }
.shop-qty-input {
  width: 58px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 0.95rem;
  font-weight: 600;
  background: #fff;
  text-align: right;
}
.shop-qty-input:hover { border-color: var(--accent); }
.shop-unit { color: var(--muted); min-width: 40px; }
.shop-name { flex: 1; }

/* ---- Settings ---- */
.meal-type-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.meal-type-row input { flex: 1; }

.invite-code {
  background: #fff3e0;
  border: 1px dashed var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  letter-spacing: 0.08em;
}

.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.plain-list li:last-child { border-bottom: none; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; }
.pw-reset summary { display: inline-flex; }
.pw-reset form { margin-top: 6px; }
.shared-thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 7px; background: #f2f2f2; flex: 0 0 auto; }
/* ---- Kalender (Übersicht) ---- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-head h2 { margin: 0; flex: 1; text-align: center; font-size: 1.25rem; }
.cal-head .btn { min-width: 38px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cal-dow { background: #f5f6f8; font-weight: 700; text-align: center; padding: 6px 2px; font-size: 0.8rem; color: var(--muted); border-bottom: 1px solid var(--border); }

.cal-day {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  min-height: 92px;
  background: var(--card);
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.today { background: #f0f6ff; box-shadow: inset 0 0 0 2px var(--accent); }
.cal-num { font-weight: 700; font-size: 0.85rem; margin-bottom: 4px; }
.cal-day.today .cal-num { color: var(--accent); }

.cal-dishes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.cal-dishes li { font-size: 0.74rem; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-dishes li a { color: var(--text); text-decoration: none; }
.cal-dishes li a:hover { color: var(--accent); text-decoration: underline; }
.cal-empty { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); min-height: 92px; }
.cal-legend { margin: 10px 2px 0; }

@media (max-width: 640px) {
  .cal-day { min-height: 64px; padding: 4px; }
  .cal-dishes li { white-space: normal; }
  .cal-num { font-size: 0.75rem; }
}
