:root {
  --bg: #0f1320;
  --bg2: #161b2e;
  --panel: #1c2238;
  --panel2: #232a45;
  --line: rgba(255,255,255,.10);
  --text: #e8ebf5;
  --muted: #9aa3c0;
  --accent: #4f7cff;
  --accent2: #6f9bff;
  --green: #2ecc71;
  --orange: #e0a82e;
  --red: #ff5d6c;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Buttons ---------- */
.btn {
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  padding: 10px 16px; border-radius: 10px; font: inherit; font-weight: 600;
  cursor: pointer; transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-danger { background: var(--red); border-color: transparent; }
.btn-success { background: var(--green); border-color: transparent; color: #062; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.icon-btn { background: transparent; border: 0; color: var(--muted); font-size: 18px; cursor: pointer; padding: 4px 8px; }
.icon-btn:hover { color: var(--text); }

/* ---------- Fields ---------- */
.field, .input, select.field {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg2); color: var(--text);
  font: inherit; margin-bottom: 10px;
}
.field:focus { outline: 2px solid var(--accent); border-color: transparent; }
label.lbl { display: block; font-size: 12px; color: var(--muted); margin: 2px 0 4px; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--panel); padding: 28px;
  border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.login-brand { font-size: 24px; font-weight: 700; }
.login-sub { color: var(--muted); margin: 4px 0 22px; }
.login-error { color: var(--red); min-height: 18px; margin: 8px 0 0; font-size: 14px; }
.login-hint { color: var(--muted); font-size: 12px; margin-top: 14px; text-align: center; }
.role-choice-grid { display: grid; gap: 10px; margin-bottom: 14px; }
.role-choice {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg2);
  padding: 12px; cursor: pointer;
}
.role-choice:has(input:checked) { border-color: var(--accent); background: rgba(79,124,255,.14); }
.role-choice input { width: 17px; height: 17px; accent-color: var(--accent); }
.role-choice span { display: grid; gap: 2px; }
.role-choice b { font-size: 15px; }
.role-choice small { color: var(--muted); line-height: 1.35; }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10; flex-wrap: wrap;
}
.tb-left { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.tb-logo { font-size: 20px; }
.tb-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.role-badge {
  font-size: 11px; text-transform: uppercase; letter-spacing: .5px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; background: var(--accent); color: #fff;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px;
  border: 1px solid transparent; color: var(--muted); background: transparent;
}
.tab:hover { color: var(--text); background: var(--panel2); }
.tab.active { color: #fff; background: var(--accent); }
.content { padding: 18px; max-width: 1200px; width: 100%; margin: 0 auto; }

/* ---------- Generic cards / grids ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.grid { display: grid; gap: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.spacer { flex: 1; }

/* ---------- Tables (Tische) ---------- */
.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.table-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; cursor: pointer; text-align: center; transition: border-color .15s, transform .05s;
}
.table-card:hover { border-color: var(--accent); }
.table-card:active { transform: translateY(1px); }
.table-card.busy { border-color: var(--orange); background: linear-gradient(180deg, rgba(224,168,46,.10), var(--panel)); }
.table-card .t-name { font-weight: 700; font-size: 16px; }
.table-card .t-meta { color: var(--muted); font-size: 13px; margin-top: 6px; }
.table-card .t-total { font-weight: 700; color: var(--orange); margin-top: 4px; }

/* ---------- Menu (Bestellaufnahme) ---------- */
.order-layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.cat-block { margin-bottom: 18px; }
.cat-title { font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 0 8px; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.item-btn {
  text-align: left; padding: 12px; border-radius: 10px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
}
.item-btn:hover { border-color: var(--accent); }
.item-btn.unavailable { opacity: .5; cursor: not-allowed; position: relative; }
.item-btn .i-img { width: 100%; height: 90px; object-fit: cover; border-radius: 8px; margin-bottom: 8px; display: block; background: var(--bg2); }
.item-btn .i-name { font-weight: 600; font-size: 14px; }
.item-btn .i-price { color: var(--accent2); font-size: 13px; margin-top: 4px; }
.item-btn .i-sold { margin-top: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--red); }

/* Plus/Minus-Mengenwähler */
.qty-stepper { display: inline-flex; align-items: center; gap: 8px; }
.qty-stepper.big { gap: 14px; margin: 4px 0 10px; }
.qty-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font-size: 20px; font-weight: 700;
  line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.qty-stepper.big .qty-btn { width: 44px; height: 44px; font-size: 26px; }
.qty-btn:hover { border-color: var(--accent); filter: brightness(1.1); }
.qty-val { min-width: 26px; text-align: center; font-weight: 700; font-size: 16px; }
.qty-stepper.big .qty-val { font-size: 22px; min-width: 40px; }

/* Add-Dialog Kopf mit Bild */
.add-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.add-img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--bg2); }

/* Admin: Thumbnail + Bildvorschau */
.lr-thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; background: var(--bg2); }
.img-preview { width: 110px; height: 110px; object-fit: cover; border-radius: 10px; background: var(--bg2); margin-bottom: 8px; display: none; }

/* Bar: Schnell-Verfügbarkeit */
.avail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.avail-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-align: left;
}
.avail-chip:hover { border-color: var(--accent); }
.avail-chip.sold { border-color: var(--red); background: rgba(255,93,108,.10); }
.avail-img { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; background: var(--bg2); flex: 0 0 auto; }
.avail-name { font-weight: 600; font-size: 13px; flex: 1; }
.avail-state { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--green); }
.avail-chip.sold .avail-state { color: var(--red); }
.cart { position: sticky; top: 72px; }
.cart-list { list-style: none; margin: 0; padding: 0; max-height: 50vh; overflow: auto; }
.cart-li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cart-li .c-qty { font-weight: 700; min-width: 28px; }
.cart-li .c-main { flex: 1; }
.cart-li .c-note { color: var(--muted); font-size: 12px; }
.cart-li .c-price { font-weight: 600; }
.cart-empty { color: var(--muted); padding: 16px 0; text-align: center; }
.cart-total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin: 12px 0; }
.state-pill { font-size: 10px; padding: 1px 7px; border-radius: 999px; font-weight: 700; text-transform: uppercase; }
.state-neu { background: rgba(255,93,108,.18); color: var(--red); }
.state-in_arbeit { background: rgba(224,168,46,.18); color: var(--orange); }
.state-erledigt { background: rgba(46,204,113,.18); color: var(--green); }

/* ---------- Bar display ---------- */
.bar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.bar-card {
  background: var(--panel); border: 1px solid var(--line); border-left: 5px solid var(--red);
  border-radius: var(--radius); padding: 14px;
}
.bar-card.in_arbeit { border-left-color: var(--orange); }
.bar-card .bc-top { display: flex; justify-content: space-between; align-items: baseline; }
.bar-card .bc-table { font-weight: 700; }
.bar-card .bc-qty { font-size: 28px; font-weight: 800; line-height: 1; }
.bar-card .bc-name { font-size: 17px; font-weight: 600; margin: 6px 0; }
.bar-card .bc-note { color: var(--orange); font-size: 13px; }
.bar-card .bc-actions { display: flex; gap: 8px; margin-top: 10px; }
.bar-card .bc-time { color: var(--muted); font-size: 12px; }

/* ---------- Admin lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-row .lr-main { flex: 1; }
.list-row .lr-sub { color: var(--muted); font-size: 13px; }
.tax-tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--panel2); color: var(--muted); }
.na { color: var(--red); }

/* ---------- Invoice / receipt ---------- */
.receipt {
  font-family: 'Courier New', monospace; white-space: pre; background: #fff; color: #111;
  padding: 16px; border-radius: 8px; max-height: 60vh; overflow: auto; font-size: 13px; line-height: 1.35;
}
.split-tabs { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 100; padding: 16px; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 16px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 20px; border-radius: 10px; box-shadow: var(--shadow); z-index: 200; font-weight: 600;
}
.toast.err { border-color: var(--red); color: var(--red); }
.toast.ok { border-color: var(--green); }

.empty { color: var(--muted); text-align: center; padding: 30px; }

@media (max-width: 820px) {
  .order-layout { grid-template-columns: 1fr; }
  .cart { position: static; }
  .tabs { order: 3; width: 100%; }
}

/* ===================== Erweiterungen (Multi-Verein, Events, Bestand, Benachrichtigungen) ===================== */
.btn-warn { background: var(--orange); border-color: transparent; color: #2a1c00; }
.btn-info { background: #4f9bff; border-color: transparent; color: #001533; }

.state-teilweise { background: rgba(224,168,46,.18); color: var(--orange); }
.state-bereit { background: rgba(79,155,255,.20); color: #4f9bff; }
.bar-card.teilweise { border-left-color: var(--orange); }
.bar-card.bereit { border-left-color: #4f9bff; }

/* Topbar-Extras: Glocke + Speisekarte */
.tb-extras { display: flex; align-items: center; gap: 8px; }
.bell { position: relative; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; cursor: pointer; font-size: 16px; }
.bell:hover { border-color: var(--accent); }
.bell-badge { position: absolute; top: -7px; right: -7px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
.list-row.unread { font-weight: 600; }
.list-row.unread .lr-main::before { content: '●'; color: var(--accent); margin-right: 6px; font-size: 11px; }

/* Bestand-Hinweise */
.i-stock { font-size: 11px; color: var(--muted); margin-top: 2px; }
.i-stock.low { color: var(--orange); font-weight: 700; }
.avail-stock { font-size: 11px; color: var(--muted); }
.avail-stock.low { color: var(--orange); font-weight: 700; }
.list-row.low { background: rgba(224,168,46,.07); }
.low-badge { font-size: 11px; color: var(--orange); font-weight: 700; margin-left: 8px; }

/* Formular-Raster */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

/* Event-Report */
.report-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
.report-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.report-card .rc-label { color: var(--muted); font-size: 12px; }
.report-card .rc-value { font-size: 20px; font-weight: 800; margin-top: 4px; }
.rc-value.pos { color: var(--green); }
.rc-value.neg { color: var(--red); }
.report-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.report-table th, .report-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.report-table th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.report-table td.pos { color: var(--green); font-weight: 600; }
.report-table td.neg { color: var(--red); font-weight: 600; }

/* Panels mit Abstand */
.panel + .panel { margin-top: 16px; }
.lbl { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
