:root {
  --bg: #efeae0;
  --surface: #ffffff;
  --surface-2: #f8f5ef;
  --ink: #16201b;
  --muted: #5b655f;
  --line: #ddd5c5;
  --brand: #1d4a37;
  --brand-2: #2c6a4f;
  --gold: #d5a23a;
  --go: #13843f;
  --go-dark: #0c6430;
  --go-soft: #e3f3e8;
  --warn: #e0700f;
  --warn-soft: #fff1e2;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --blue: #1f5fbf;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(22, 32, 27, .08), 0 4px 14px rgba(22, 32, 27, .08);
  --shadow-lg: 0 10px 30px rgba(22, 32, 27, .18);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 19px; line-height: 1.3; -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
input, select { font: inherit; color: inherit; }
button:disabled { cursor: default; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px; min-height: 68px;
  background: var(--brand); color: #fff;
  border-bottom: 4px solid var(--gold);
}
.topbar h1 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: .01em; display: flex; align-items: center; gap: 10px; }
.topbar .spacer { flex: 1; }
.topbar .pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: rgba(255,255,255,.14); font-size: 15px; font-weight: 700; white-space: nowrap;
}
.topbar .pill.bad { background: var(--danger); }
.topbar .pill .dot { width: 10px; height: 10px; border-radius: 50%; background: #5fe08e; }
.topbar .pill.bad .dot { background: #fff; }
.topbar a.home {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 16px; border-radius: 12px;
  color: #fff; text-decoration: none; font-weight: 800; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.35);
}
.wake {
  display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border-radius: 12px;
  background: rgba(255,255,255,.12); font-size: 15px; font-weight: 700; cursor: pointer; user-select: none; white-space: nowrap;
}
.wake input { width: 24px; height: 24px; accent-color: var(--gold); margin: 0; }
.wake.unsupported { opacity: .5; }

main { padding: 16px; }
.section-title {
  margin: 20px 4px 10px; font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
}
.section-title::after { content: ""; flex: 1; height: 2px; background: var(--line); }
.section-title:first-child { margin-top: 4px; }

.update-banner {
  position: fixed; left: 50%; top: 80px; transform: translateX(-50%); z-index: 100;
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px; font-weight: 800; box-shadow: var(--shadow-lg);
}

/* ---------- Startseite ---------- */
.hub { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; padding: 20px 16px; max-width: 1100px; margin: 0 auto; }
.hub a {
  display: flex; align-items: center; gap: 20px; min-height: 150px; padding: 24px; border-radius: 22px;
  color: #fff; text-decoration: none; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.hub a:active { transform: scale(.98); }
.hub .emoji { font-size: 58px; line-height: 1; }
.hub .t { font-size: 30px; font-weight: 900; }
.hub .d { font-size: 16px; opacity: .85; font-weight: 600; }
.hub .kasse { background: linear-gradient(135deg, #17964a, #0c6430); }
.hub .kueche { background: linear-gradient(135deg, #ee7f1d, #c25400); }
.hub .stats { background: linear-gradient(135deg, #2a6fd4, #174a9a); }
.hub .admin { background: linear-gradient(135deg, #4a544f, #262d29); }

/* ---------- Kasse ---------- */
.pos { display: grid; grid-template-columns: 1fr 380px; min-height: calc(100vh - 72px); }
.pos .products { padding: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 12px; }
.tile {
  position: relative; min-height: 140px; padding: 12px 10px; border: 0; border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  border-bottom: 6px solid var(--brand-2); transition: transform .06s, background .15s;
}
.tile:active { transform: scale(.96); background: var(--go-soft); }
.tile.in-cart { background: var(--go-soft); outline: 3px solid var(--go); outline-offset: -3px; }
.tile .icon { font-size: 46px; line-height: 1; }
.tile .name { font-weight: 800; text-align: center; font-size: 18px; }
.tile .price { font-size: 20px; font-weight: 900; color: var(--brand); background: var(--surface-2); padding: 2px 12px; border-radius: 999px; }
.tile .badge {
  position: absolute; top: 8px; right: 8px; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 20px;
  background: var(--go); color: #fff; font-weight: 900; font-size: 20px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.tiles.extras { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tiles.extras .tile { min-height: 100px; border-bottom-color: var(--gold); }
.tiles.extras .tile .icon { font-size: 34px; }

.cart {
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -6px 0 20px rgba(0,0,0,.06);
  display: flex; flex-direction: column; position: sticky; top: 72px; height: calc(100vh - 72px);
}
.cart-head { padding: 14px 16px 6px; font-weight: 900; font-size: 20px; display: flex; justify-content: space-between; align-items: center; }
.cart-head .count { font-size: 15px; color: var(--muted); font-weight: 700; }
.cart-items { flex: 1; overflow-y: auto; padding: 0 12px; }
.cart-row { display: grid; grid-template-columns: 1fr auto auto auto; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.cart-row .n { font-weight: 700; line-height: 1.2; }
.cart-row .n small { display: block; color: var(--muted); font-weight: 600; font-size: 14px; }
.qbtn {
  width: 52px; height: 52px; border-radius: 14px; border: 0; background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line);
  font-size: 28px; font-weight: 900; line-height: 1;
}
.qbtn:active { background: var(--line); }
.cart-row .q { min-width: 34px; text-align: center; font-size: 24px; font-weight: 900; }
.cart-empty { color: var(--muted); padding: 30px 12px; text-align: center; font-weight: 600; }
.cart-empty .big { font-size: 46px; display: block; margin-bottom: 8px; }
.cart-foot { padding: 12px 16px 16px; border-top: 2px solid var(--line); background: var(--surface-2); }
.sum-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.sum-row .l { font-weight: 800; color: var(--muted); }
.sum { font-size: 40px; font-weight: 900; }
.sum-eur { font-size: 15px; color: var(--muted); font-weight: 700; text-align: right; }
.cart-actions { display: grid; grid-template-columns: auto 1fr; gap: 10px; }
.btn-clear {
  min-height: 84px; padding: 0 18px; border-radius: 16px; border: 0; background: var(--danger-soft); color: var(--danger); font-weight: 900;
}
.btn-go {
  min-height: 84px; padding: 0 16px; border: 0; border-radius: 16px;
  background: var(--go); color: #fff; font-size: 28px; font-weight: 900; box-shadow: 0 4px 0 var(--go-dark);
}
.btn-go:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--go-dark); }
.btn-go:disabled { background: #a9c3b1; box-shadow: none; }

.toast {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.9); opacity: 0; pointer-events: none;
  background: var(--go); color: #fff; font-size: 34px; font-weight: 900; padding: 28px 44px; border-radius: 24px;
  box-shadow: var(--shadow-lg); z-index: 50; text-align: center; transition: opacity .15s, transform .15s;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.toast.err { background: var(--danger); }
.toast small { display: block; font-size: 20px; opacity: .9; margin-top: 6px; }

@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; }
  .pos .products { padding-bottom: 300px; }
  .cart { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; max-height: 55vh; border-left: 0; border-top: 4px solid var(--brand); z-index: 15; }
  .cart-items { max-height: 26vh; }
  .cart-head { padding-top: 8px; }
}

/* ---------- Küche ---------- */
.kitchen { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; padding: 16px; align-items: start; }
.col-title { margin: 0 0 10px; font-size: 15px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.now {
  background: var(--surface); border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden;
  border: 5px solid var(--warn);
}
.now-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; background: var(--warn); color: #fff; }
.now-head .label { font-size: 20px; font-weight: 900; letter-spacing: .08em; }
.now-head .no { font-size: 44px; font-weight: 900; line-height: 1; }
.now-head .age { font-weight: 800; background: rgba(0,0,0,.18); padding: 4px 12px; border-radius: 999px; }
.now ul { list-style: none; margin: 0; padding: 8px 20px; }
.now li { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 2px solid var(--line); font-size: 32px; font-weight: 800; }
.now li:last-child { border-bottom: 0; }
.now li .qty { min-width: 84px; text-align: center; background: var(--ink); color: #fff; border-radius: 14px; padding: 4px 10px; font-weight: 900; }
.now li .ic { font-size: 36px; }
.now li.extra { font-size: 24px; color: var(--muted); }
.now li.extra .qty { background: var(--line); color: var(--ink); min-width: 84px; }
.now .btn-done { margin: 8px 20px 20px; width: calc(100% - 40px); min-height: 110px; font-size: 38px; }

.btn-done {
  border: 0; border-radius: 18px; background: var(--go); color: #fff; font-weight: 900; box-shadow: 0 5px 0 var(--go-dark);
}
.btn-done:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--go-dark); }
.btn-done:disabled { opacity: .6; }

.idle { background: var(--surface); border-radius: 24px; box-shadow: var(--shadow); padding: 70px 20px; text-align: center; }
.idle .big { font-size: 80px; }
.idle .t { font-size: 32px; font-weight: 900; margin-top: 8px; }
.idle .d { color: var(--muted); font-weight: 600; }

.prep { background: var(--brand); color: #fff; border-radius: 20px; padding: 14px 16px 16px; box-shadow: var(--shadow); margin-bottom: 16px; }
.prep h3 { margin: 0 0 10px; font-size: 18px; font-weight: 900; display: flex; justify-content: space-between; align-items: baseline; }
.prep h3 small { font-weight: 700; opacity: .8; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; color: var(--ink); border-radius: 14px; padding: 8px 14px; font-weight: 800; font-size: 22px; }
.chip b { font-size: 26px; color: var(--brand); }
.chip.extra { background: rgba(255,255,255,.16); color: #fff; font-size: 17px; padding: 6px 12px; }
.chip.extra b { color: var(--gold); font-size: 19px; }
.prep .none { opacity: .8; font-weight: 700; }
.prep .total { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.25); font-size: 15px; font-weight: 700; opacity: .9; }

.queue { display: flex; flex-direction: column; gap: 10px; }
.qcard {
  background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 12px 14px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; border-left: 8px solid var(--line);
}
.qcard .no { font-size: 26px; font-weight: 900; min-width: 56px; }
.qcard .pos-n { display: block; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; }
.qcard .items { font-size: 19px; font-weight: 700; line-height: 1.35; }
.qcard .items .x { color: var(--muted); font-weight: 600; font-size: 16px; }
.qcard .age { font-size: 14px; color: var(--muted); font-weight: 700; }
.qcard .btn-done { min-height: 64px; min-width: 64px; font-size: 26px; padding: 0 12px; box-shadow: 0 3px 0 var(--go-dark); }
.qcard.next { border-left-color: var(--warn); }
.is-new { animation: flash 1.2s ease-in-out 3; }
.new-tag { display: inline-block; background: var(--danger); color: #fff; font-size: 13px; font-weight: 900; padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 6px; }
@keyframes flash { 0%, 100% { box-shadow: var(--shadow); } 50% { box-shadow: 0 0 0 6px var(--gold), var(--shadow-lg); } }

@media (max-width: 900px) {
  .kitchen { grid-template-columns: 1fr; }
  .now li { font-size: 26px; }
}

/* ---------- Statistik ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); border-top: 6px solid var(--brand-2); }
.kpi.money { border-top-color: var(--gold); }
.kpi .l { color: var(--muted); font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: .05em; }
.kpi .v { font-size: 42px; font-weight: 900; line-height: 1.1; margin-top: 4px; }
.kpi .s { color: var(--muted); font-weight: 600; font-size: 15px; }
.table-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--surface-2); color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: .05em; }
td.r, th.r { text-align: right; }
td.prod { font-weight: 800; }
.bar { height: 10px; border-radius: 5px; background: var(--brand-2); min-width: 2px; }
td.barcell { width: 30%; }
tfoot td { font-weight: 900; background: var(--surface-2); }
.meta { color: var(--muted); font-weight: 600; font-size: 15px; margin: 10px 4px; }

/* ---------- Verwalten ---------- */
.admin { max-width: 1100px; margin: 0 auto; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 4px; font-size: 21px; }
.panel p.hint { margin: 0 0 12px; color: var(--muted); font-weight: 600; font-size: 15px; }
.panel-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.field { display: flex; align-items: center; gap: 8px; font-weight: 800; white-space: nowrap; }
.field input { width: 140px; }
.admin input, .admin select {
  min-height: 58px; padding: 6px 12px; border: 2px solid var(--line); border-radius: 12px; background: #fff; width: 100%;
}
.admin input:focus, .admin select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,95,191,.2); }
.admin input.icon { font-size: 28px; text-align: center; padding: 4px; }
.btn { min-height: 58px; padding: 0 18px; border: 0; border-radius: 12px; font-weight: 800; white-space: nowrap; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary.ok { background: var(--go); }
.btn-primary.dirty { box-shadow: 0 0 0 3px var(--gold); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost-danger { background: var(--danger-soft); color: var(--danger); }
.panel.danger { border: 2px solid var(--danger-soft); }
.grid-prod { display: grid; grid-template-columns: 84px minmax(0, 1fr) 110px 150px 150px 64px; gap: 8px; align-items: center; }
.grid-prod.head { color: var(--muted); font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; padding: 0 2px 6px; }
.prod-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.prod-row:last-child { border-bottom: 0; }
.prod-row.new { padding-top: 12px; }
@media (max-width: 800px) {
  .grid-prod { grid-template-columns: 70px 1fr 90px; }
  .grid-prod.head span:nth-child(n+4) { display: none; }
}
