:root {
  --bg: #14171c;
  --panel: #1c2128;
  --panel-2: #232a33;
  --line: #2d3640;
  --text: #e6ebf0;
  --muted: #8a949f;
  --accent: #e8b04b;
  --accent-d: #c8902f;
  --green: #3fb950;
  --red: #e5534b;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-size: 15px;
}
header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
header h1 { font-size: 18px; margin: 0; }
header h1 .acc { color: var(--accent); }
nav {
  display: flex; gap: 4px; padding: 0 24px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
nav button {
  background: none; border: none; color: var(--muted); padding: 12px 16px;
  cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent;
}
nav button.active { color: var(--accent); border-bottom-color: var(--accent); }
main { padding: 24px; max-width: 1100px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 18px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 9px 11px; font-size: 14px; width: 100%;
}
.field { flex: 1; min-width: 140px; }
button.btn {
  background: var(--accent); color: #1a1d22; border: none; border-radius: 8px;
  padding: 9px 16px; font-weight: 600; cursor: pointer; font-size: 14px;
}
button.btn:hover { background: var(--accent-d); }
button.ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; font-size: 13px;
}
button.ghost:hover { border-color: var(--accent); }
button.danger { color: var(--red); border-color: #4a2b2b; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
.sortth { background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; }
.sortth:hover { color: var(--text); }
.pill { padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--panel-2); color: var(--muted); }
.pill.debt { background: #3a2a18; color: var(--accent); }
.pill.ok { background: #16301c; color: var(--green); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.product {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center;
}
.product .icon { font-size: 42px; line-height: 1; height: 110px; display: flex; align-items: center; justify-content: center; }
/* contain (nicht cover): zeigt das ganze 220x220-Bild, nichts wird abgeschnitten
   — wie auf dem Display. Weisser Hintergrund passend zum weissen Rand der Bilder. */
.product .pimg { width: 100%; height: 110px; object-fit: contain; border-radius: 8px; background: #fff; }
.product .prow { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.product .name { font-weight: 600; margin: 8px 0 4px; }
.product .price { color: var(--accent); font-size: 18px; font-weight: 700; }
.product .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* Umschalter Kacheln/Liste */
.viewtoggle button.active { border-color: var(--accent); color: var(--accent); }
/* Listenansicht des Katalogs */
.catalog-list td:first-child, .catalog-list th:first-child { width: 56px; }
.lthumb { width: 44px; height: 44px; object-fit: contain; background: #fff; border-radius: 6px; display: block; }
.licon { font-size: 26px; }
.notice {
  background: #3a2a18; border: 1px solid var(--accent-d); color: var(--accent);
  padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px;
}
.muted { color: var(--muted); }
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); padding: 12px 18px;
  border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--red); color: #ffb3ae; }
dialog {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; min-width: 320px;
}
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog h3 { margin: 0 0 14px; }
#qrimg { display: block; margin: 14px auto; background: #fff; padding: 10px; border-radius: 8px; }
.edit-img { width: 180px; height: 180px; object-fit: contain; background: #fff; border-radius: 10px; }
.img-fig { margin: 0; text-align: center; }
.img-fig figcaption { font-size: 11px; margin-top: 4px; }
/* Vorschlag dezent als „neu" hervorheben */
#editCandFig .edit-img { box-shadow: 0 0 0 2px var(--accent); }
#editCandFig figcaption { color: var(--accent); }
#editDialog { width: 380px; max-width: 92vw; }
#historyDialog { width: 560px; max-width: 92vw; }
/* Abstand zwischen Betrag (€, rechtsbündig) und Scrollbalken */
#historyDialog th:last-child, #historyDialog td:last-child { padding-right: 18px; }
#loginOverlay {
  position: fixed; inset: 0; background: var(--bg); z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px; width: 320px; max-width: 90vw; text-align: center;
}
.login-card h2 { margin: 0 0 6px; }
.login-card input { margin-top: 8px; }
header #logoutBtn { margin-left: 12px; }

/* Wochenplan-Raster (Speisekarte) */
.menuweek { border-radius: 10px; padding: 2px 0; }
/* dezente Markierung der 2 aktiven KWs (Akzentfarbe, leicht getönt) */
.menuweek.active { background: rgba(232, 176, 75, .06); border: 1px solid rgba(232, 176, 75, .28); padding: 2px 10px 10px; }
.menuweek.active > h3 { color: var(--accent); }
.menugrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.menucell { border: 1px solid var(--line, #2a2a2a); border-radius: 8px; padding: 8px; min-height: 70px; background: var(--panel-2); }
.menucell-h { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.menudish { display: block; width: 100%; text-align: left; margin: 3px 0; padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--line, #333); background: var(--panel, #1c1c1c); color: var(--text, #eee); cursor: pointer; font-size: 13px; }
.menudish:hover { border-color: var(--accent); }
@media (max-width: 720px) { .menugrid { grid-template-columns: repeat(2, 1fr); } }

/* Speisekarte: Drag & Drop der Gerichte zwischen Tages-Lanes */
.menudish { cursor: grab; }
.menudish:active { cursor: grabbing; }
.menudish.dragging { opacity: .45; }
.menucell.dropok { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); background: var(--panel, #1c1c1c); }
