/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--primary); color: #1e293b; height: 100svh; overflow: hidden; padding-top: env(safe-area-inset-top, 0px); }

/* ===== CSS Variables ===== */
:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --success: #16a34a;
  --success-hover: #15803d;
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --warning: #d97706;
  --warning-hover: #b45309;
  --ghost: #64748b;
  --surface: #ffffff;
  --border: #e2e8f0;
  --muted: #94a3b8;
  --header-h: 56px;
  --cart-w: 340px;
  --radius: 10px;
}

/* ===== App Layout ===== */
#app { display: flex; flex-direction: column; height: 100%; background: #f1f5f9; }

/* ===== Header ===== */
#header {
  height: var(--header-h);
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 8px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.logo-img { height: 40px; width: auto; border-radius: 8px; object-fit: contain; }
.logo { font-size: 1.2rem; font-weight: 700; white-space: nowrap; color: white; }
.header-right { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: 8px; border: none;
  font-size: .85rem; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn-primary   { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success   { background: var(--success); color: white; }
.btn-success:hover { background: var(--success-hover); }
.btn-danger    { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-warning   { background: var(--warning); color: white; }
.btn-warning:hover { background: var(--warning-hover); }
.btn-ghost     { background: rgba(255,255,255,.15); color: white; }
.btn-ghost:hover { background: rgba(255,255,255,.25); }
.btn-outline   { background: transparent; color: var(--text); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--surface); }
.btn-outline   { background: transparent; border: 2px solid var(--danger); color: var(--danger); }
.btn-outline:hover { background: var(--danger); color: white; }
.btn-large     { padding: 12px; font-size: 1rem; width: 100%; justify-content: center; border-radius: var(--radius); }

/* ===== Main Area ===== */
#main {
  flex: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 1fr var(--cart-w);
  grid-template-areas: "filter cart" "products cart";
  overflow: hidden;
}

/* ===== Category Filter ===== */
.category-filter {
  grid-area: filter;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  overflow-x: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cat-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: none;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  opacity: .7;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.cat-btn:hover, .cat-btn.active { opacity: 1; transform: scale(1.05); }

/* ===== Product Grid ===== */
.product-grid {
  grid-area: products;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px;
  overflow-y: auto;
  align-content: start;
}
.product-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  transition: border-color .15s, transform .1s, box-shadow .15s;
  text-align: center;
  user-select: none;
}
.product-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(79,70,229,.15); }
.product-card:active { transform: scale(.97); }
.product-card .prod-name { font-size: .9rem; font-weight: 600; line-height: 1.2; }
.product-card .prod-price { font-size: 1rem; font-weight: 700; color: var(--primary); }
.product-card .prod-cat { font-size: .72rem; color: var(--muted); }

/* ===== Cart ===== */
.cart {
  grid-area: cart;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 10px;
  overflow: hidden;
}
.cart h3 { font-size: 1rem; font-weight: 700; }
.cart-items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: .85rem;
}
.cart-item-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qty-btn { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: white; cursor: pointer; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.qty-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.cart-item-total { font-weight: 700; min-width: 54px; text-align: right; font-size: .82rem; }
.cart-summary { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.summary-row { display: flex; justify-content: space-between; align-items: center; font-size: .88rem; }
.total-row { font-size: 1rem; margin-top: 4px; }
.discount-row { gap: 8px; }
.change-row .change-amount { font-size: 1rem; font-weight: 700; color: var(--success); }
.change-negative { color: var(--danger) !important; }
.cart-buttons-row { display: flex; flex-direction: column; gap: 6px; }

/* ===== Input ===== */
.input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  background: white;
  color: #1e293b;
  outline: none;
  transition: border-color .15s;
}
.input:focus { border-color: var(--primary); }
.input-sm { padding: 4px 8px; font-size: .82rem; }
.color-input { padding: 3px; width: 48px; height: 36px; cursor: pointer; }

/* ===== Modals ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal.hidden { display: none; }
.hidden { display: none !important; }
.modal-box {
  background: white;
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  position: relative;
}
.modal-close-x {
  position: sticky; top: 0; float: right;
  margin: -8px -8px 0 0;
  background: #fee2e2; border: none;
  width: 36px; height: 36px; border-radius: 50%;
  font-size: 1rem; cursor: pointer; color: var(--danger);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; z-index: 10; font-weight: 700;
}
.modal-close-x:hover { background: var(--danger); color: #fff; }
.modal-box.wide { max-width: 760px; }
.modal-box h2 { font-size: 1.1rem; font-weight: 700; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; margin-top: 4px; }
.export-check-label { display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap; color: var(--text); }
.export-check-label input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }

/* ===== Admin Tabs ===== */
.admin-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); padding-bottom: 4px; }
.tab-btn { padding: 6px 16px; border: none; background: none; cursor: pointer; font-weight: 600; color: var(--muted); border-radius: 6px 6px 0 0; }
.tab-btn.active { color: var(--primary); border-bottom: 2px solid var(--primary); margin-bottom: -2px; }
.tab-content { display: flex; flex-direction: column; gap: 12px; }
.tab-content.hidden { display: none; }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form-row .input { flex: 1; min-width: 100px; }
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th, .data-table td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); }
.data-table th { font-weight: 700; background: #f8fafc; }
.data-table tr:hover td { background: #f1f5f9; }

/* ===== Tag List ===== */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }
.field-hint { font-size: .82rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; margin: 6px 0 4px; line-height: 1.5; }
.tag { display: flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; font-size: .82rem; font-weight: 600; color: white; }
.tag .tag-del { background: none; border: none; color: inherit; cursor: pointer; font-size: .9rem; opacity: .7; }
.tag .tag-del:hover { opacity: 1; }
.tag .tag-newline { background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.5); border-radius: 6px; color: white; cursor: pointer; font-size: .78rem; font-weight: 600; opacity: .85; padding: 2px 7px; margin-right: 2px; white-space: nowrap; }
.tag .tag-newline:hover { opacity: 1; background: rgba(0,0,0,.3); }
.tag .tag-newline.active { background: white; color: #1e293b; opacity: 1; font-weight: 700; border-color: white; }
.grid-cat-break { grid-column: 1 / -1; height: 0; }

/* ===== Operator List ===== */
.operator-list { display: flex; flex-direction: column; gap: 6px; }
.operator-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-radius: 10px; border: 2px solid var(--border); cursor: pointer; font-weight: 600; transition: border-color .15s, background .15s; }
.operator-item:hover { border-color: var(--primary); background: #eef2ff; }
.operator-item.active { border-color: var(--primary); background: #eef2ff; color: var(--primary); }

/* ===== Payment Confirm ===== */
.receipt-box { max-width: 380px; max-height: calc(100vh - 80px); }
#modal-receipt { align-items: flex-start; padding-top: 40px; }
#receipt-content { white-space: normal; }
.receipt-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.receipt-nav-btn { padding: 8px 20px; font-size: 1.3rem; color: var(--text); min-width: 52px; min-height: 44px; }
.receipt-nav-btn:disabled { opacity: .3; cursor: default; }
#receipt-nav-label { font-size: .85rem; font-weight: 700; color: var(--muted); flex: 1; text-align: center; }
.receipt-date { font-size: .8rem; color: var(--muted); margin: 0 0 8px; }
.receipt-items-table { margin-bottom: 8px; font-size: .88rem; }
.receipt-disc-row td { color: var(--danger); font-size: .82rem; }
.storno-badge { background: var(--danger); color: #fff; text-align: center; padding: 7px 12px; border-radius: 8px; font-weight: 700; font-size: .95rem; margin-bottom: 10px; letter-spacing: .06em; }
.payment-confirm { padding: 8px 0 4px; }
.payment-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--primary);
  border-radius: 10px; margin-bottom: 12px; color: white;
}
.payment-total-label { font-size: .85rem; font-weight: 700; opacity: .85; text-transform: uppercase; letter-spacing: .04em; }
.payment-total-val { font-size: 2rem; font-weight: 800; }
.payment-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-top: 1px solid var(--border);
  font-size: 1rem;
}
.payment-label { color: var(--muted); font-weight: 600; }
.payment-val { font-size: 1.1rem; font-weight: 700; }
.payment-change-row { background: #f0fdf4; border-radius: 0 0 8px 8px; }
.payment-change-val { font-size: 1.8rem; font-weight: 800; color: var(--success); }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: white;
  padding: 10px 20px; border-radius: 8px;
  font-size: .9rem; font-weight: 600;
  z-index: 2000;
  opacity: 1; transition: opacity .3s;
}
.toast.hidden { display: none; }
.toast.fade-out { opacity: 0; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ===== Statistics ===== */
.stats-summary { display: flex; gap: 12px; margin-bottom: 4px; }
.stats-card {
  flex: 1; padding: 16px 18px; border-radius: 12px;
  border: 1px solid var(--border); background: #f8fafc;
}
.stats-card-primary { background: var(--primary); color: white; border-color: var(--primary); }
.stats-card-accent  { background: var(--success);  color: white; border-color: var(--success); }
.stats-card-label { font-size: .75rem; font-weight: 600; opacity: .75; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.stats-card-value { font-size: 1.45rem; font-weight: 800; }
.stats-table td, .stats-table th { vertical-align: middle; }
.stats-name-cell { min-width: 120px; }
.stats-bar-wrap { height: 5px; background: #e2e8f0; border-radius: 3px; margin-top: 5px; }
.stats-bar { height: 5px; background: var(--primary); border-radius: 3px; transition: width .3s; }
.stats-num { text-align: right; white-space: nowrap; }
.stats-rev { font-weight: 700; color: var(--success); }
.stats-share { color: var(--muted); font-size: .82rem; }

/* ===== Chips / Tokens ===== */
.chip-dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.15);
  display: inline-block; flex-shrink: 0; vertical-align: middle;
}
.product-card .chip-dot {
  position: absolute; bottom: 8px; right: 8px; display: block;
}
.chip-form-group { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.chip-form-label { display: flex; align-items: center; gap: 5px; cursor: pointer; font-size: .85rem; font-weight: 600; white-space: nowrap; user-select: none; }
.chip-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); flex-shrink: 0; }
.color-palette { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.color-palette--disabled { opacity: .35; pointer-events: none; }
.color-swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(0,0,0,.18);
  cursor: pointer; padding: 0; flex-shrink: 0;
  transition: transform .1s;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { outline: 3px solid #1e293b; outline-offset: 2px; transform: scale(1.1); }
.cart-chips {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; background: #fafafa;
  border-radius: 8px; border: 1px solid var(--border);
  flex-wrap: wrap; flex-shrink: 0;
}
.cart-chips.hidden { display: none; }
.cart-chips-label { font-size: .75rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
.cart-chips-list { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.chip-item { display: flex; align-items: center; gap: 5px; font-size: .95rem; font-weight: 800; }
.receipt-chips {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  margin-top: 10px; padding-top: 8px;
  border-top: 1px dashed var(--border); white-space: normal;
}
.receipt-chips-label { font-size: .8rem; font-weight: 700; color: var(--muted); }

/* ===== Touch Optimizations ===== */
button, .product-card, .cat-btn, .operator-item {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* Larger category pills */
.cat-btn { padding: 10px 20px; font-size: .9rem; min-height: 44px; }
/* Larger product cards */
.product-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
.product-card { padding: 20px 12px; min-height: 96px; }
.product-card:active { transform: scale(.94); box-shadow: none; background: #eef2ff; border-color: var(--primary); }
.product-card .prod-name { font-size: .95rem; }
.product-card .prod-price { font-size: 1.05rem; }
.product-card { position: relative; overflow: visible; }
/* Cart item: 5-col grid with +/- and tappable qty */
.cart-item { grid-template-columns: 1fr 40px 36px 40px auto; padding: 8px 6px; gap: 4px; min-height: 52px; }
.qty-btn { width: 40px; height: 40px; font-size: 1.15rem; border-radius: 8px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.qty-val {
  width: 36px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem;
  background: #e0e7ff; color: var(--primary); border-radius: 8px;
  cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.qty-val:active { background: var(--primary); color: white; }
/* Product qty badge */
.prod-qty-badge {
  position: absolute; top: -8px; right: -8px;
  background: var(--success); color: white;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: .78rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.25); z-index: 1;
}
/* Lagerbestand-Badge (links unten) */
.prod-stock-badge {
  position: absolute; bottom: -7px; left: -7px;
  background: #e0e7ff; color: var(--primary);
  min-width: 22px; height: 22px; border-radius: 11px;
  padding: 0 5px;
  font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.18); z-index: 1;
  border: 1.5px solid var(--primary);
}
.prod-stock-badge.prod-stock-empty {
  background: #fee2e2; color: var(--danger);
  border-color: var(--danger);
}
.product-card.out-of-stock {
  opacity: 0.45; cursor: not-allowed; pointer-events: none;
}
/* Checkout button larger */
.btn-large { padding: 14px; font-size: 1.05rem; }

/* ===== Numpad ===== */
.numpad-modal { align-items: center; padding: 16px; }
.numpad-box {
  width: 100%; max-width: 380px; margin: 0 auto;
  background: #f1f5f9; border-radius: 20px;
  padding: 16px 16px 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
}
.numpad-close-btn {
  position: absolute; top: 12px; right: 14px;
  background: #fee2e2; border: none; font-size: 1.1rem; font-weight: 700;
  color: var(--danger); cursor: pointer; padding: 0;
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.numpad-close-btn:hover { background: var(--danger); color: #fff; }
.numpad-label { font-size: .82rem; font-weight: 600; color: var(--muted); text-align: center; }
.numpad-display {
  font-size: 2rem; font-weight: 700; text-align: right;
  padding: 10px 16px; background: white; border-radius: 12px;
  border: 2px solid var(--border); min-height: 60px;
  display: flex; align-items: center; justify-content: flex-end;
  letter-spacing: 1px; color: #1e293b;
}
.numpad-quick { display: flex; gap: 8px; flex-wrap: wrap; }
.np-quick {
  flex: 1 1 calc(33.33% - 6px);
  padding: 11px 4px;
  border: 2px solid var(--border); background: white; border-radius: 10px;
  font-size: .9rem; font-weight: 700; cursor: pointer; color: var(--primary);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background .1s, border-color .1s;
}
.np-quick:active { background: var(--primary); color: white; border-color: var(--primary); }
.numpad-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.np-btn {
  height: 68px; border: none; border-radius: 12px;
  font-size: 1.5rem; font-weight: 700; cursor: pointer;
  background: white; color: #1e293b;
  box-shadow: 0 2px 5px rgba(0,0,0,.09);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .08s, background .08s;
}
.np-btn:active { transform: scale(.91); background: #e2e8f0; }
.np-back { background: #fee2e2; color: var(--danger); }
.np-back:active { background: var(--danger); color: white; }
.np-clear { background: #fef3c7; color: var(--warning); }
.np-clear:active { background: var(--warning); color: white; }
.np-decimal { background: #e0f2fe; color: #0284c7; font-size: 1.3rem; }
.np-decimal:active { background: #0284c7; color: white; }
.np-ok { grid-column: 2 / 4; background: var(--success); color: white; font-size: 1.6rem; }
.np-ok:active { background: var(--success-hover); }
/* qty mode: hide decimal, OK spans all 3 cols */
.numpad-grid.mode-qty .np-decimal { display: none; }
.numpad-grid.mode-qty .np-ok { grid-column: 1 / -1; }

/* ===== Help Tab ===== */
.help-content { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 8px; }
.help-section { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.help-section h3 { font-size: .95rem; font-weight: 700; margin: 0 0 8px; color: var(--primary); }
.help-section p { font-size: .87rem; color: var(--text); line-height: 1.55; margin: 0; }
.help-section ul { margin: 6px 0 0; padding-left: 18px; }
.help-section li { font-size: .87rem; color: var(--text); line-height: 1.55; margin-bottom: 3px; }
.numpad-finalize-btn {
  width: 100%; padding: 16px; border: none; border-radius: 14px;
  background: var(--success); color: white;
  font-size: 1.1rem; font-weight: 700; cursor: pointer;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background .1s;
}
.numpad-finalize-btn:active { background: var(--success-hover); }
/* Numpad Cart Summary (Gesamt + Rückgeld) */
.numpad-cart-summary {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 12px; display: flex;
  flex-direction: column; gap: 4px;
}
.ncs-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .88rem;
}
.ncs-change-row { font-weight: 600; }
.ncs-change-val { font-size: .95rem; color: var(--success); }
.ncs-change-val.change-negative { color: var(--danger); }

/* ===== Print ===== */
@media print {
  body * { visibility: hidden; }
  #receipt-content, #receipt-content *, #dayclose-content, #dayclose-content * { visibility: visible; }
  .modal-box { position: fixed; left: 0; top: 0; width: 100%; }
}

/* ===== Responsive ===== */
@media (max-width: 767px) {
  :root { --cart-w: 100%; --header-h: 48px; }

  /* Header: Text in Buttons ausblenden, nur Icons */
  .header-right { gap: 3px; flex-wrap: nowrap; }
  .header-right .btn span[data-i18n],
  .header-right .btn span:not(.logo) { display: none; }
  .header-right .btn { padding: 7px 10px; font-size: 1rem; }
  .logo { font-size: 1rem; }

  /* Layout: Produktraster oben, Warenkorb unten */
  #main {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas: "filter" "products" "cart";
  }
  .cart {
    max-height: 52svh;
    overflow-y: auto;
    border-left: none;
    border-top: 2px solid var(--border);
    padding: 8px 12px;
    gap: 5px;
  }
  .cart h3 { font-size: .85rem; margin-bottom: 2px; }
  /* Zwischensumme/Gesamt im Cart auf Mobile ausblenden */
  .cart-summary .summary-row:not(.discount-row) { display: none; }
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px; padding: 8px;
  }
  .product-card { padding: 8px 8px; min-height: 56px; }
  .product-card .prod-name { font-size: .82rem; }
  .product-card .prod-price { font-size: .88rem; }
  .product-card .prod-cat { display: none; }

  /* Kassieren + Leeren nebeneinander */
  .cart-buttons-row { display: flex; gap: 8px; }
  .cart-buttons-row #btn-checkout { flex: 3; }
  .cart-buttons-row #btn-clear-cart { flex: 1; padding: 12px 6px; font-size: .82rem; }

  /* Zusammenfassung kompakter */
  .cart-summary { padding-top: 5px; gap: 3px; }
  .summary-row { font-size: .82rem; }
  .total-row { font-size: .9rem; }
  .change-row .change-amount { font-size: .9rem; }

  /* Warenkorb-Zeilen kompakter */
  .cart-item { padding: 5px 4px; min-height: 42px; }
  .qty-btn { width: 34px; height: 34px; font-size: 1rem; }
  .qty-val { width: 30px; height: 34px; font-size: .88rem; }
  .cart-item-total { min-width: 44px; font-size: .79rem; }

  /* Modals: fast vollständig */
  .modal { padding: 8px; }
  .modal-box { padding: 14px; gap: 10px; max-height: 96svh; }
  .modal-box.wide { max-width: 100%; }

  /* Admin: Formularfelder untereinander */
  .form-row { flex-direction: column; }
  .form-row .input, .form-row select.input { width: 100%; }
  .form-row .btn { align-self: flex-start; }

  /* Tabellen: horizontal scrollbar */
  .data-table { font-size: .8rem; }
  #tab-products { overflow-x: auto; }
  #tab-products table { min-width: 480px; }

  /* Bon-Modal */
  .receipt-box { max-width: 100%; max-height: calc(100svh - 60px); }
  #modal-receipt { padding-top: 8px; }

  /* Statistik kompakter */
  .stats-table { font-size: .78rem; }
  .stats-summary { flex-direction: row; }
  .stats-card { padding: 8px 10px; }

  .modal-actions { justify-content: flex-start; }
}

@media (max-width: 420px) {
  .header-right .btn { padding: 6px 8px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; padding: 8px; }
  .numpad-box { padding: 12px 10px 18px; gap: 9px; }
  .np-btn { height: 58px; font-size: 1.3rem; }
  .numpad-display { font-size: 1.7rem; }
}
