/* Kassenoberflaeche: touchtauglich, ohne JavaScript, ohne Inline-Styles (CSP) */

.page-pos { max-width: 1400px; }
.pos-head { margin: .25rem 0 1rem; }
.pos-head h1 { margin-bottom: .1rem; }

/* Entwicklungshinweis, gut sichtbar und nicht nur im Fuss */
.devbanner {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem;
  padding: .6rem .9rem; margin: 0 0 1rem;
  background: #fff4d6; border: 2px solid #d99a00; border-radius: 12px; color: #5b3d00;
}
.devtag { display: inline-block; padding: .2rem .7rem; border-radius: 999px; background: #d99a00; color: #fff; font-weight: 800; letter-spacing: .04em; font-size: .9rem; }
.devtag-strong { background: #b3261e; }
.devtext { font-size: .9rem; }
.dev-note { padding: .6rem .8rem; background: #fff4d6; border: 1px solid #d99a00; border-radius: 8px; color: #5b3d00; }

/* Touch-Buttons */
.pos-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  min-height: 64px; padding: .8rem 1.1rem; border: 2px solid transparent; border-radius: 14px;
  font: inherit; font-weight: 700; text-align: center; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.pos-btn-title { font-size: 1.15rem; letter-spacing: .02em; }
.pos-btn-sub { font-size: .85rem; font-weight: 500; opacity: .9; }
.pos-btn-primary { background: var(--brand); color: #fff; }
.pos-btn-primary:hover, .pos-btn-primary:focus-visible { background: var(--brand-dark); }
.pos-btn-quick { background: #eaf0ff; color: var(--brand-dark); border-color: #c5d3f7; }
.pos-btn-quick:hover { background: #dbe6ff; }
.pos-btn-danger { background: #fff; color: #b3261e; border-color: #e2a9a5; }
.pos-btn-danger:hover { background: #fdeceb; }
.pos-btn-disabled { background: #e5e9f2; color: #7b869b; cursor: not-allowed; }
.pos-btn-wide { width: 100%; }
.pos-btn:active { transform: translateY(1px); }
.pos-btn:focus-visible, .pos-item:focus-visible, .qty-btn:focus-visible, .pos-group:focus-visible { outline: 3px solid #f0a500; outline-offset: 2px; }

/* Kassenwahl */
.reg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.reg-card h2 { margin-bottom: .1rem; }
.reg-terminals { display: grid; gap: .6rem; margin-top: .8rem; }
.badge-warn { display: inline-block; padding: .2rem .7rem; border-radius: 999px; background: #fff4d6; color: #7a5200; font-size: .85rem; font-weight: 600; }
.pos-leave { margin-top: 1rem; }

/* Kopfzeile der Kasse */
.pos-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; }
.pos-bar-info { display: flex; flex-direction: column; min-width: 0; }
.pos-bar-info .muted { margin: 0; font-size: .9rem; }

/* Aufbau: Sortiment links, Warenkorb rechts */
.pos-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 1rem; align-items: start; }
.pos-catalog { min-width: 0; }
.pos-cart { position: sticky; top: calc(var(--header-h) + .75rem); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.pos-cart h2 { margin: 0; }

/* Warengruppen */
.pos-groups { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.pos-group {
  display: inline-flex; align-items: center; min-height: 52px; padding: .5rem 1.1rem; border-radius: 12px;
  font-weight: 700; text-decoration: none; color: #fff; border: 3px solid transparent; touch-action: manipulation;
}
.pos-group.is-active { border-color: #101a33; box-shadow: 0 0 0 2px #fff inset; }
.tone-0 { background: #1f4fd8; } .tone-1 { background: #0f766e; } .tone-2 { background: #b45309; }
.tone-3 { background: #7c3aed; } .tone-4 { background: #be185d; } .tone-5 { background: #4b5563; }

/* Artikel */
.pos-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.pos-items form { margin: 0; }
.pos-item {
  display: flex; flex-direction: column; justify-content: space-between; gap: .4rem; width: 100%; min-height: 96px; padding: .7rem .8rem;
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px; text-align: left; font: inherit; cursor: pointer; touch-action: manipulation;
}
.pos-item:hover { border-color: var(--brand); }
.pos-item:active { background: #eef2fb; }
.pos-item-name { font-weight: 700; line-height: 1.2; }
.pos-item-price { color: var(--brand-dark); font-weight: 700; }

/* Warenkorb */
.cart-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; max-height: 46vh; overflow-y: auto; }
.cart-line { padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 12px; background: #fafbfe; }
.cart-line-main { display: flex; justify-content: space-between; gap: .75rem; font-weight: 600; }
.cart-line-amount { white-space: nowrap; }
.cart-line-ctl { display: flex; align-items: center; gap: .4rem; margin-top: .5rem; }
.qty-btn { min-width: 52px; min-height: 48px; padding: 0 .8rem; border: 2px solid var(--border); border-radius: 12px; background: #fff; font: inherit; font-weight: 800; font-size: 1.2rem; cursor: pointer; touch-action: manipulation; }
.qty-btn:hover { border-color: var(--brand); }
.qty-remove { margin-left: auto; font-size: .9rem; font-weight: 600; color: #b3261e; border-color: #e2a9a5; }
.qty { min-width: 2.2rem; text-align: center; font-weight: 800; font-size: 1.15rem; }
.cart-sums { border-top: 2px solid var(--border); padding-top: .6rem; display: grid; gap: .3rem; }
.cart-sum { display: flex; justify-content: space-between; color: var(--muted); }
.cart-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.15rem; }
.cart-total strong { font-size: 1.9rem; }
.cart-actions { display: grid; gap: .5rem; }

/* Zahlung */
.pay-total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.2rem; margin-bottom: 1rem; }
.pay-total strong { font-size: 2.2rem; }
.pay-methods { display: grid; gap: .75rem; }
.pay-methods form { margin: 0; }
.pos-back { margin-top: 1.25rem; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.cash-field label { display: block; font-weight: 700; margin-bottom: .3rem; }
.cash-field input { width: 100%; min-height: 60px; padding: .6rem .9rem; font: inherit; font-size: 1.6rem; font-weight: 700; border: 2px solid #c3ccdd; border-radius: 12px; }
.cash-field input:focus { outline: 3px solid var(--brand); border-color: var(--brand); }
.pay-actions { margin-top: 1rem; }
.card-instruction { font-size: 1.3rem; font-weight: 700; margin: 1rem 0 .5rem; }

.done-card { margin-bottom: 1rem; text-align: center; }
.done-card h1 { color: #0f766e; }
.change-box { display: flex; flex-direction: column; align-items: center; margin: .5rem 0 1.25rem; padding: 1rem; background: #eaf7f2; border: 2px solid #0f766e; border-radius: 14px; }
.change-box strong { font-size: 2.8rem; color: #0f766e; }

/* Beleg */
.receipt { font-variant-numeric: tabular-nums; }
.receipt-marks { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; margin-bottom: .5rem; }
.receipt-mark { padding: .3rem .8rem; border: 2px solid #b3261e; border-radius: 8px; color: #b3261e; font-weight: 800; letter-spacing: .06em; }
.receipt-notice { text-align: center; font-size: .9rem; color: #7a1a14; margin: 0 0 1rem; }
.receipt-head { text-align: center; margin-bottom: 1rem; }
.receipt-meta { display: grid; grid-template-columns: max-content 1fr; gap: .15rem 1rem; margin: 0 0 1rem; }
.receipt-meta dt { color: var(--muted); }
.receipt-meta dd { margin: 0; }
.receipt-meta .wrap { word-break: break-all; }
.receipt table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.receipt td, .receipt th { padding: .2rem 0; text-align: left; }
.receipt .num { text-align: right; }
.receipt-total td { border-top: 2px solid var(--text); font-weight: 800; font-size: 1.1rem; padding-top: .4rem; }
.receipt-tax { font-size: .9rem; color: var(--muted); }
.receipt-tse { border-top: 1px dashed var(--border); padding-top: .75rem; font-size: .85rem; }
.receipt-tse h2 { font-size: 1rem; }
.narrow-left { max-width: 760px; margin-left: auto; margin-right: auto; }

/* Tablet und Smartphone: Warenkorb unter dem Sortiment, Bezahlen bleibt sichtbar */
@media (max-width: 900px) {
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart { position: static; }
  .cart-lines { max-height: none; }
  .pos-items { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .cart-actions { position: sticky; bottom: 0; background: var(--surface); padding: .5rem 0 .25rem; z-index: 5; }
}
@media (max-width: 480px) {
  .pos-btn-title { font-size: 1.05rem; }
  .pay-total strong { font-size: 1.8rem; }
  .cart-total strong { font-size: 1.6rem; }
}

@media print {
  .topbar, .footer, .devbanner, .pos-back, .done-card, .flash { display: none !important; }
  .receipt-marks, .receipt-notice { display: block !important; }
}

/* ===== Persoenlicher Bereich (Smartphone) ===== */
.tile-wallet { border-top-color: #7c3aed; }
.me-balance { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; }
.me-label { color: var(--muted); }
.me-amount { font-size: 2.8rem; line-height: 1.1; }
.me-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.me-list li { padding-bottom: .6rem; border-bottom: 1px solid var(--border); }
.me-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.me-row { display: flex; justify-content: space-between; gap: .75rem; }
.me-sub { font-size: .85rem; margin: 0; }
.me-pos { color: #0f766e; font-weight: 700; }
.me-neg { color: #b3261e; font-weight: 700; }
.me-pay { text-align: center; }
.me-qr { width: min(80vw, 340px); margin: 0 auto 1rem; padding: .5rem; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.qr-svg { display: block; width: 100%; height: auto; }
.me-hint { font-weight: 600; }

/* ===== Kamera-Scan und Zahlung mit WebPOS Card ===== */
.scan-box { position: relative; width: 100%; max-width: 480px; margin: 0 auto 1rem; aspect-ratio: 4 / 3; background: #101a33; border-radius: 14px; overflow: hidden; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-status { text-align: center; margin: .5rem 0 1rem; color: var(--muted); }
.scan-error { color: #b3261e; font-weight: 600; }
.scan-dev { margin-top: 1.25rem; }
.wc-name { font-size: 1.6rem; font-weight: 800; margin-bottom: .75rem; }
.wc-figures { display: grid; grid-template-columns: 1fr auto; gap: .4rem 1rem; font-size: 1.15rem; margin: 0 0 1rem; }
.wc-figures dt { color: var(--muted); }
.wc-figures dd { margin: 0; text-align: right; font-weight: 700; }
.wc-after { color: #0f766e; font-size: 1.4rem; }

/* ===== Verwaltung: Mitarbeiter, Guthaben, Karten ===== */
.search-bar { display: flex; flex-wrap: wrap; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.search-bar .field { flex: 1 1 220px; margin: 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; }
.balance-box { display: flex; flex-direction: column; gap: .2rem; }
.balance-amount { font-size: 2.4rem; }
.subtle { margin-top: 1rem; }
.subtle summary { cursor: pointer; font-weight: 600; }
.inline-details { display: inline-block; vertical-align: top; }
.inline-details summary { list-style: none; cursor: pointer; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-details[open] { display: block; margin-top: .5rem; }
.num { text-align: right; }
.wrap { word-break: break-all; }

/* ===== WebPOS Card in Kreditkartengroesse ===== */
.card-sheet-wrap { display: flex; justify-content: center; margin: 1.5rem 0; }
.wcard { width: 85.6mm; height: 53.98mm; box-sizing: border-box; display: flex; align-items: center; gap: 3mm; padding: 4mm; background: #fff; color: #101a33;
  border: .3mm solid #101a33; border-radius: 3.5mm; overflow: hidden; box-shadow: 0 2px 10px rgba(16, 26, 51, .2); font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.wcard-qr { flex: none; width: 34mm; height: 34mm; }
.wcard-qr .qr-svg { width: 100%; height: 100%; }
.wcard-text { display: flex; flex-direction: column; justify-content: center; min-width: 0; gap: 1mm; }
.wcard-brand { font-size: 5mm; font-weight: 800; letter-spacing: .3mm; color: #1f4fd8; }
.wcard-name { font-size: 3.6mm; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.wcard-number { font-size: 3.4mm; font-family: ui-monospace, Consolas, monospace; letter-spacing: .2mm; }
.wcard-flag { font-size: 2.6mm; font-weight: 700; color: #7a1a14; }
.wcard-hint { font-size: 2.4mm; color: #4a556b; line-height: 1.25; }

@media print {
  @page { size: 85.6mm 53.98mm; margin: 0; }
  .topbar, .footer, .admin-nav, .aui, .screen-only, .flash, .crumbs, .devbanner { display: none !important; }
  html, body { background: #fff !important; min-height: 0 !important; }
  main.page, .admin, .admin-main { display: block !important; padding: 0 !important; margin: 0 !important; max-width: none !important; width: auto !important; }
  .card-sheet-wrap { margin: 0; display: block; }
  .wcard { box-shadow: none; border-radius: 0; border: none; page-break-inside: avoid; }
}

/* ===== Kassenjournal und Kassenabschluss ===== */
.pos-bar-links { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.soll-box { display: flex; flex-direction: column; gap: .1rem; margin-bottom: .75rem; }
.soll-amount { font-size: 2rem; }
.journal-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.journal-info td { color: var(--muted); background: #fafbfe; }
.pos-actions-row { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
.pos-actions-row .pos-btn { flex: 1 1 200px; }
.kv-table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.kv-table td, .kv-table th { padding: .3rem 0; text-align: left; border-bottom: 1px solid var(--border); }
.kv-table .num { text-align: right; white-space: nowrap; }
.kv-table .sum td { font-weight: 800; border-top: 2px solid var(--text); }
.diff-flag td { color: #b3261e; }
.closing-report h3 { margin: 1.2rem 0 .4rem; }
.report-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.range-form { display: flex; flex-wrap: wrap; gap: .75rem; align-items: end; margin-bottom: 1rem; }
.range-form .field { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; }
.kpi span { display: block; color: var(--muted); font-size: .85rem; }
.kpi strong { font-size: 1.5rem; }
.bar-cell { position: relative; min-width: 120px; }
.bar { display: block; height: .55rem; border-radius: 4px; background: #1f4fd8; }
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; } .w-15 { width: 15%; } .w-20 { width: 20%; } .w-25 { width: 25%; } .w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; } .w-45 { width: 45%; }
.w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; } .w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; } .w-90 { width: 90%; } .w-95 { width: 95%; } .w-100 { width: 100%; }

/* ===== Artikelkacheln mit Bild ===== */
.pos-items { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .7rem; }
.pos-item { padding: 0; overflow: hidden; gap: 0; justify-content: flex-start; min-height: 0; }
.pos-item-img { display: block; width: 100%; aspect-ratio: 4 / 3; background: #eef2f9; overflow: hidden; }
.pos-item-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pos-item-name { padding: .55rem .7rem 0; min-height: calc(2.4em + .55rem); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.pos-item-price { padding: .1rem .7rem .6rem; text-align: right; font-size: 1.1rem; }
@media (max-width: 900px) { .pos-items { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
@media (max-width: 480px) { .pos-items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; } .pos-item-name { font-size: .95rem; } }

/* ===== Artikelbild in der Verwaltung ===== */
.item-thumb { width: 48px; height: 36px; object-fit: cover; border-radius: 6px; vertical-align: middle; background: #eef2f9; margin-right: .4rem; }
.item-image-row { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.item-image-preview { width: 240px; max-width: 100%; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: #eef2f9; }
.item-image-preview img { display: block; width: 100%; height: auto; }
.item-image-actions { flex: 1 1 280px; display: grid; gap: .75rem; }
.pos-bar { flex-wrap: wrap; } .pos-bar-links { justify-content: flex-end; }
