/* Verkaufsstand: Preisschilder an der Theke, Kassenbons beim Kassieren und beim Abschluss. */
:root {
  /* KBM-Grün wie auf kbm-duisburg.de. Darauf immer dunkle Schrift, Weiß wäre unlesbar. */
  --kbm:#d0d830; --dunkel:#2a2a2a; --tiefgruen:#566000; --grund:#f2f3ec; --papier:#fff;
  --leise:#666666; --linie:#d9dbcc; --rot:#b3261e;
  --rund:ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --bon:ui-monospace, "SF Mono", "Roboto Mono", Menlo, monospace;
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; font:16px/1.4 var(--rund); background:var(--grund); color:var(--dunkel); -webkit-tap-highlight-color:transparent; font-variant-numeric:tabular-nums; }
h1, h2 { line-height:1.1; margin:0; }
h1 { font-size:34px; font-weight:900; }
h2 { font-size:20px; font-weight:800; margin:26px 0 10px; }
button, input, select { font:inherit; color:inherit; }

button { cursor:pointer; min-height:46px; padding:10px 16px; border:2px solid var(--linie); border-radius:12px; background:var(--papier); font-weight:700; touch-action:manipulation; }
button:active { transform:translateY(2px); }
button.primary { background:var(--tiefgruen); border-color:var(--tiefgruen); color:#fff; }
button.danger { color:var(--rot); }
button.on { background:var(--dunkel); border-color:var(--dunkel); color:#fff; }
button.ghost { min-height:36px; padding:4px 12px; background:transparent; border-color:#2a2a2a66; }
button:disabled { opacity:.5; }
:focus-visible { outline:3px solid var(--tiefgruen); outline-offset:2px; }
header :focus-visible { outline-color:var(--dunkel); }
.cartbar:focus-visible { outline-color:var(--kbm); }

input, select { width:100%; min-height:48px; padding:10px 12px; border:2px solid var(--linie); border-radius:10px; background:#fff; font-size:16px; }
label { display:block; margin:12px 0; font-size:14px; color:var(--leise); }
label input, label select { display:block; margin-top:4px; color:var(--dunkel); font-size:16px; }
.muted { color:var(--leise); font-size:14px; }
.error { color:var(--rot); min-height:1.4em; margin:10px 0 0; }

/* Kassenbon: gezackte Abrisskante oben und unten */
.bon {
  background:var(--papier); color:var(--dunkel); padding:24px 18px;
  -webkit-mask:conic-gradient(from -45deg at bottom,#0000,#000 1deg 89deg,#0000 90deg) bottom/14px 51% repeat-x,
    conic-gradient(from 135deg at top,#0000,#000 1deg 89deg,#0000 90deg) top/14px 51% repeat-x;
  mask:conic-gradient(from -45deg at bottom,#0000,#000 1deg 89deg,#0000 90deg) bottom/14px 51% repeat-x,
    conic-gradient(from 135deg at top,#0000,#000 1deg 89deg,#0000 90deg) top/14px 51% repeat-x;
}
.bon > h2:first-child { margin-top:0; }
.bon h2:focus { outline:none; }
.total { display:flex; justify-content:space-between; align-items:baseline; gap:12px; margin:0; padding:12px 0; border-block:3px double var(--dunkel); font:800 28px/1.2 var(--bon); }
.posten { display:flex; align-items:baseline; gap:8px; margin:8px 0; font-family:var(--bon); font-size:15px; }
.posten::before { content:""; order:1; flex:1; min-width:16px; border-bottom:2px dotted var(--linie); }
.posten > :last-child { order:2; font-weight:700; }

/* Anmeldung */
body:has(#login:not([hidden])) { background:var(--kbm); }
#login { max-width:390px; margin:0 auto; padding:max(7vh, 20px) 16px 24px; }
#login h1 { text-align:center; padding-bottom:14px; border-bottom:3px double var(--dunkel); }
#login button { width:100%; margin-top:6px; min-height:54px; }

/* Kopf und Navigation */
header { position:sticky; top:0; z-index:5; display:flex; align-items:center; gap:10px; background:var(--kbm); color:var(--dunkel); padding:calc(10px + env(safe-area-inset-top)) 16px 10px; }
header strong { margin-right:auto; font-size:22px; font-weight:900; }
#pending { background:var(--dunkel); color:#fff; border-radius:20px; padding:3px 10px; font-size:13px; font-weight:700; }
#view { max-width:1040px; margin:0 auto; padding:14px 12px 180px; }
nav { position:fixed; inset:auto 0 0; z-index:5; display:flex; gap:4px; background:var(--papier); border-top:1px solid var(--linie); padding:6px 6px calc(6px + env(safe-area-inset-bottom)); }
nav button { flex:1; border:0; background:transparent; color:var(--leise); padding:8px 4px; }
nav button.on { background:var(--kbm); color:var(--dunkel); }

.chips { display:flex; gap:8px; overflow-x:auto; padding:3px 3px 12px; }
.chips button { white-space:nowrap; border-radius:30px; min-height:40px; padding:6px 16px; }

/* Theke: Foto mit gestecktem Preisschild */
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:12px; }
.tile { position:relative; display:flex; flex-direction:column; padding:5px; border:0; border-radius:18px; text-align:left; box-shadow:0 3px 0 var(--linie); }
.tile:active { box-shadow:0 1px 0 var(--linie); }
.tile .media { position:relative; display:block; width:100%; }
.tile .pic { display:grid; place-items:center; width:100%; aspect-ratio:1; object-fit:cover; border-radius:13px; background:var(--grund); font-size:56px; }
.tile .preis { position:absolute; right:6px; bottom:-12px; transform:rotate(-4deg); background:var(--kbm); border-radius:6px; padding:3px 10px; font-size:20px; font-weight:900; box-shadow:0 2px 0 #2a2a2a40; }
.tile .name { display:block; padding:16px 6px 7px; font-size:17px; font-weight:800; line-height:1.2; overflow-wrap:anywhere; }
.tile.picked { box-shadow:0 0 0 4px var(--tiefgruen); }
.tile .count { position:absolute; top:-6px; right:-6px; z-index:1; min-width:40px; padding:5px 10px; border:3px solid #fff; border-radius:30px; background:var(--tiefgruen); color:#fff; font-size:20px; font-weight:900; text-align:center; }
.tile .left { position:absolute; top:11px; left:11px; z-index:1; background:#2a2a2ad9; color:#fff; border-radius:8px; padding:2px 8px; font-size:13px; }
.tile.soldout .pic { filter:grayscale(1); opacity:.4; }
.tile.soldout .preis { background:var(--dunkel); color:#fff; font-size:15px; }
.tile.other .name .muted { display:block; font-weight:500; }
.tile.other { background:transparent; border:3px dashed var(--linie); box-shadow:none; }
.tile.other .pic { background:transparent; color:var(--tiefgruen); font-size:64px; font-weight:400; }

/* Kassenleiste */
.cartbar { position:fixed; left:10px; right:10px; bottom:calc(74px + env(safe-area-inset-bottom)); z-index:6; display:flex; align-items:center; gap:12px; max-width:620px; min-height:70px; margin:0 auto; padding:8px 8px 8px 18px; border:0; border-radius:18px; background:var(--dunkel); color:#fff; text-align:left; box-shadow:0 8px 24px #2a2a2a55; }
.cartbar .sum { margin-right:auto; font-size:28px; font-weight:900; line-height:1.05; }
.cartbar small { display:block; font-size:13px; font-weight:500; opacity:.8; }
.cartbar .go { background:var(--kbm); color:var(--dunkel); border-radius:12px; padding:15px 22px; font-size:19px; font-weight:900; }

/* Dialoge */
dialog { width:min(480px, calc(100vw - 20px)); max-height:92dvh; padding:0; border:0; background:transparent; }
dialog::backdrop { background:#2a2a2ab3; }
.row { display:flex; gap:8px; align-items:center; }
.row > .grow { flex:1; min-width:0; overflow-wrap:anywhere; }
.line { padding:10px 0; border-bottom:2px dashed var(--linie); }
.line input.price { width:96px; text-align:right; font-family:var(--bon); font-weight:700; }
.line .row + .row { margin-top:6px; }
.qty { min-width:34px; text-align:center; font-size:20px; font-weight:800; }
.line button { min-width:48px; font-size:20px; }
.line + .total { border-top:0; }
.change { font-weight:800; font-size:18px; min-height:1.4em; margin:4px 0; }
.actions { display:flex; gap:8px; margin-top:14px; }
.actions button { flex:1; padding-inline:8px; }
.actions .primary { flex:2; }

/* Listen */
.list { background:var(--papier); border-radius:16px; padding:0 12px; }
.list > * { padding:12px 0; }
.list > * + * { border-top:1px solid var(--linie); }
.thumb { display:grid; place-items:center; flex:none; width:56px; height:56px; object-fit:cover; border-radius:10px; background:var(--grund); font-size:28px; }
.betrag { display:block; font:800 19px var(--bon); }
.cancelled { opacity:.55; text-decoration:line-through; }
.tag { color:var(--rot); font-weight:700; font-size:14px; }

/* Statistik */
.panel { background:var(--papier); border-radius:16px; padding:14px; }
.abschluss { max-width:460px; margin:4px auto 0; }
.abschluss h2 { text-align:center; margin:0 0 14px; }
.abschluss .total { margin-bottom:10px; }
table { width:100%; border-collapse:collapse; font-size:15px; }
th, td { text-align:left; padding:8px 4px; border-bottom:1px solid var(--linie); }
th { font-size:13px; color:var(--leise); }
tbody tr:last-child td { border-bottom:0; }
td.num, th.num { text-align:right; white-space:nowrap; }
.bar { display:grid; grid-template-columns:52px 1fr 80px; gap:8px; align-items:center; font-size:14px; margin:6px 0; }
.bar progress { width:100%; height:18px; appearance:none; border:0; background:var(--grund); box-shadow:inset 0 0 0 1px var(--linie); border-radius:5px; overflow:hidden; }
.bar progress::-webkit-progress-bar { background:var(--grund); }
.bar progress::-webkit-progress-value { background:var(--kbm); }
.bar progress::-moz-progress-bar { background:var(--kbm); }
.bar span:last-child { text-align:right; font-weight:700; }
form.panel + form.panel { margin-top:10px; }

#toast { position:fixed; top:76px; left:50%; z-index:20; max-width:90vw; width:max-content; transform:translate(-50%, -8px); background:var(--dunkel); color:#fff; border-radius:30px; padding:11px 20px; font-weight:700; text-align:center; opacity:0; pointer-events:none; transition:opacity .2s, transform .2s; }
#toast.show { opacity:1; transform:translate(-50%, 0); }

@media (min-width:800px) {
  header { padding-inline:max(16px, calc((100% - 1016px) / 2)); }
  nav { position:static; width:calc(100% - 24px); max-width:1016px; margin:12px auto 0; border:0; border-radius:16px; padding:6px; }
  #view { padding-bottom:130px; }
  .cartbar { bottom:20px; }
  .grid { grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:16px; }
}
/* Am PC steht die Navigation oben unter dem Kopf */
#app { display:flex; flex-direction:column; }
#view { width:100%; order:2; }
header { order:0; }
nav { order:1; }

@media (prefers-reduced-motion:reduce) { * { transition:none !important; } button:active { transform:none; } }

.printonly { display:none; }
@media print {
  header, nav, .cartbar, .noprint, #toast { display:none !important; }
  body { background:#fff; }
  #view { padding:0; }
  .printonly { display:block; }
  .bon { -webkit-mask:none; mask:none; border:1px solid #888; }
  .panel, .list { border:1px solid #888; }
  .panel, .list > *, .bon { break-inside:avoid; }
  * { -webkit-print-color-adjust:exact; print-color-adjust:exact; }
}
