:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #6a6f76;
  --border: #e2e0db;
  --primary: #2f6f5e;
  --primary-hover: #245849;
  --primary-soft: #e3efeb;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --info: #1d5a8c;
  --info-soft: #e5f0fa;
  --ok: #1f6b3a;
  --ok-soft: #e2f3e7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--primary); }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .8rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 .5rem; }
.card > h3:first-child { margin-top: 0; }
code, kbd { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
kbd { border: 1px solid currentColor; border-radius: 4px; padding: 0 .3em; opacity: .75; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { float: right; }

/* ---------------------------------------------------------------- Layout */
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  padding: .6rem 1rem; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1.1rem; text-decoration: none; color: var(--text); }
.brand img { display: block; height: 44px; width: auto; flex: none; }
.nav { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .9rem; }
.nav a { text-decoration: none; color: var(--text); }
.nav a:hover { color: var(--primary); }
.subnav {
  display: flex; flex-wrap: wrap; gap: .2rem; padding: .4rem 1rem; background: var(--primary-soft);
  border-bottom: 1px solid var(--border);
}
.subnav a { padding: .3rem .7rem; border-radius: 6px; text-decoration: none; color: var(--primary); }
.subnav a.active, .subnav a:hover { background: var(--surface); }

.container { max-width: 1100px; margin: 0 auto; padding: 1.2rem 1rem 3rem; }
.container.wide { max-width: 1400px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; margin-bottom: .5rem; }
.page-head h1 { margin: 0; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.card.narrow { max-width: 520px; margin: 1.5rem auto; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.card-head h2, .card-head h3 { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0; }
.inline { display: inline; }

/* ---------------------------------------------------------------- Formulare */
.form { display: flex; flex-direction: column; gap: .75rem; }
.form label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; font-size: .95rem; }
.form .row { display: flex; flex-wrap: wrap; gap: .75rem; }
.form .row > label { flex: 1 1 180px; }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.form-inline .grow, .form .grow { flex: 1 1 240px; }
label.check { flex-direction: row !important; align-items: flex-start; gap: .5rem !important; font-weight: 400 !important; }
label.check input { margin-top: .3rem; }
input, select, textarea {
  font: inherit; padding: .5rem .65rem; border: 1px solid #c9c6bf; border-radius: 7px; background: #fff; color: inherit;
  min-width: 0; width: 100%;
}
label.check input { width: auto; flex: none; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.price-input { max-width: 8rem; }
textarea { resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  font: inherit; font-weight: 500; padding: .5rem 1rem; border-radius: 7px; cursor: pointer;
  border: 1px solid #c9c6bf; background: #fff; color: var(--text); text-decoration: none; white-space: nowrap;
}
.btn:hover { background: #f1f0ec; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #e3b5b1; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { padding: .3rem .7rem; font-size: .9rem; }
.btn-big { padding: .9rem 1rem; font-size: 1.15rem; width: 100%; }
.linklike { background: none; border: none; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.linklike.danger { color: var(--danger); }

/* ---------------------------------------------------------------- Meldungen */
.flashes { margin-bottom: 1rem; }
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: .5rem; border: 1px solid transparent; }
.flash-success { background: var(--ok-soft); color: var(--ok); border-color: #bfe0c9; }
.flash-error { background: var(--danger-soft); color: var(--danger); border-color: #f0c4bf; }
.flash-info { background: var(--info-soft); color: var(--info); border-color: #c3dbef; }
.announcement { background: var(--warn-soft); border: 1px solid #efd9a0; border-radius: 8px; padding: .7rem 1rem; margin-bottom: 1rem; }
.announcement p { margin: .3rem 0 0; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .8rem; font-weight: 500; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-muted { background: #eeede9; color: var(--muted); }
.seller-badge { background: var(--primary); color: #fff; padding: .35rem .8rem; border-radius: 8px; }
.seller-badge strong { font-size: 1.2rem; letter-spacing: .05em; }

/* ---------------------------------------------------------------- Tabellen */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table tfoot td { font-weight: 600; border-bottom: none; }
.table.compact td, .table.compact th { padding: .25rem .5rem; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.code { font-family: ui-monospace, Consolas, monospace; white-space: nowrap; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions > * + * { margin-left: .7rem; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 1rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* ---------------------------------------------------------------- Startseite */
.hero { text-align: center; padding: 2rem 1rem 1.5rem; }
.hero h1 { font-size: 2.2rem; }
.hero-meta { display: flex; justify-content: center; flex-wrap: wrap; gap: .3rem 1.5rem; font-size: 1.1rem; }
.hero-text { max-width: 640px; margin: 1rem auto; white-space: pre-line; }
.hero-actions { display: flex; justify-content: center; gap: .6rem; margin: 1.2rem 0 .6rem; }

/* ---------------------------------------------------------------- Kennzahlen */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; margin-bottom: 1rem; }
.stats-wide { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.stat { background: #faf9f7; border: 1px solid var(--border); border-radius: 8px; padding: .7rem .9rem; display: flex; flex-direction: column; }
.stats-wide .stat { background: var(--surface); box-shadow: var(--shadow); }
.stat-label { font-size: .8rem; color: var(--muted); }
.stat-value { font-size: 1.45rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-value.neg { color: var(--muted); }
.stat-main { background: var(--primary-soft) !important; border-color: #bcd8cf; }
.stat-main .stat-value { color: var(--primary); }
.flash-update { animation: pulse 1.2s ease-out; }
@keyframes pulse { from { background: #fff1a8; } to { background: transparent; } }

.live-indicator { font-size: .85rem; color: var(--ok); display: inline-flex; align-items: center; gap: .35rem; }
.live-indicator .dot { width: .6rem; height: .6rem; border-radius: 50%; background: currentColor; animation: blink 2s infinite; }
.live-indicator.offline { color: var(--danger); }
.live-indicator.offline .dot { animation: none; }
@keyframes blink { 50% { opacity: .3; } }

.progress { height: 10px; background: #eeede9; border-radius: 99px; overflow: hidden; margin-bottom: 1rem; }
.progress-bar { height: 100%; background: var(--primary); transition: width .6s; }
.recent { list-style: none; padding: 0; margin: 0; }
.recent li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.recent .code { color: var(--muted); margin-right: .4rem; }

/* ---------------------------------------------------------------- Schichten */
.shift { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.shift h3 { margin: 0 0 .2rem; }
.shift p { margin: .2rem 0; }
.shift-mine { border-color: var(--primary); background: #f7fbf9; }

/* ---------------------------------------------------------------- Kasse */
.kasse { display: grid; grid-template-columns: 1fr 340px; gap: 1rem; align-items: start; }
.scan-form { display: flex; gap: .5rem; margin-bottom: .6rem; }
.scan-input { font-size: 1.4rem; padding: .7rem .9rem; font-family: ui-monospace, Consolas, monospace; }
.kasse-message { padding: .8rem 1rem; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); margin-bottom: .8rem; font-size: 1.05rem; min-height: 3.2rem; }
.kasse-message.ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe0c9; }
.kasse-message.error { background: var(--danger-soft); color: var(--danger); border-color: #f0c4bf; font-weight: 600; }
.kasse-message.info { background: var(--info-soft); color: var(--info); border-color: #c3dbef; }
.kasse-message.big { font-size: 1.25rem; font-weight: 600; }
.cart-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.cart td { font-size: 1.05rem; }
.cart tr.new td { animation: pulse 1.2s ease-out; }
.kasse-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: .7rem; position: sticky; top: 1rem; }
.total-box { background: var(--primary); color: #fff; border-radius: 8px; padding: .8rem 1rem; text-align: right; }
.total-label { font-size: .95rem; opacity: .9; }
.total { font-size: 2.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.given { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; }
.given input { font-size: 1.3rem; }
.quick-cash { display: flex; gap: .4rem; }
.quick-cash .btn { flex: 1; }
.change-box { font-size: 1.2rem; }
.change-box .neg { color: var(--danger); }
.history { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.history li { display: flex; justify-content: space-between; padding: .3rem 0; border-bottom: 1px solid var(--border); }
.camera { margin-bottom: .8rem; display: flex; flex-direction: column; gap: .5rem; }
.camera video { width: 100%; max-height: 320px; background: #000; border-radius: 8px; object-fit: cover; }
.camera[hidden] { display: none; }

/* ---------------------------------------------------------------- Abrechnung */
.statement { background: #fff; padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); }
.statement .table { margin-bottom: 1.2rem; }
.total-row td { border-top: 2px solid var(--text); font-size: 1.1rem; }
.signature { display: flex; justify-content: space-between; gap: 2rem; margin-top: 3rem; }
.sig-line { border-top: 1px solid var(--text); padding-top: .3rem; min-width: 240px; font-size: .85rem; }

/* ---------------------------------------------------------------- Etiketten */
.sheets { overflow-x: auto; padding-bottom: 1rem; }
.sheet {
  width: 210mm; height: 297mm; margin: 0 auto 1.5rem; background: #fff; box-shadow: 0 2px 12px rgba(0, 0, 0, .15);
  display: grid; grid-template-columns: repeat(var(--cols), var(--lw)); grid-auto-rows: var(--lh); align-content: start;
  padding-top: calc((297mm - var(--rows) * var(--lh)) / 2 + var(--oy));
  padding-left: calc((210mm - var(--cols) * var(--lw)) / 2 + var(--ox));
  overflow: hidden; break-after: page; page-break-after: always;
}
.label {
  width: var(--lw); height: var(--lh); padding: 2.5mm 3.5mm; overflow: hidden;
  display: flex; flex-direction: column; color: #000; font-family: Arial, Helvetica, sans-serif;
  outline: 1px dashed #ddd; outline-offset: -1px;
}
.label-skip { background: repeating-linear-gradient(45deg, #fafafa, #fafafa 6px, #f0f0f0 6px, #f0f0f0 12px); }
.label-top { display: flex; justify-content: space-between; align-items: baseline; gap: 2mm; font-size: 7pt; }
.label-event { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #444; }
.label-code { font-weight: 700; font-size: 10pt; font-family: "Courier New", monospace; white-space: nowrap; }
.label-desc { font-size: 9pt; font-weight: 600; line-height: 1.15; margin-top: .8mm; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.label-bottom { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 2mm; }
.label-barcode { flex: 0 0 auto; width: 38mm; }
.label-barcode .barcode { display: block; width: 100%; height: 10mm; }
.label-digits { font-family: "Courier New", monospace; font-size: 7pt; text-align: center; letter-spacing: .15em; }
.label-right { text-align: right; min-width: 0; }
.label-size { font-size: 8pt; white-space: nowrap; }
.label-price { font-size: 15pt; font-weight: 700; white-space: nowrap; line-height: 1.1; }

.layout-4x10 .label { padding: 1.8mm 2.5mm; }
.layout-4x10 .label-event { display: none; }
.layout-4x10 .label-code { font-size: 8pt; }
.layout-4x10 .label-desc { font-size: 7pt; -webkit-line-clamp: 1; }
.layout-4x10 .label-barcode { width: 28mm; }
.layout-4x10 .label-barcode .barcode { height: 8mm; }
.layout-4x10 .label-price { font-size: 11pt; }
.layout-4x10 .label-size { font-size: 6.5pt; }
.layout-2x8 .label-barcode { width: 50mm; }
.layout-2x8 .label-desc { font-size: 10pt; }
.layout-2x8 .label-price { font-size: 18pt; }
.layout-3x7 .label-barcode .barcode { height: 12mm; }

/* ---------------------------------------------------------------- Footer, Captcha, Rechtliches */
.footer { display: flex; justify-content: center; gap: 1.5rem; padding: 1.5rem 1rem 2rem; font-size: .9rem; }
.footer a { color: var(--muted); }
.captcha { display: flex; align-items: center; gap: .6rem; padding: .6rem .8rem; border: 1px solid var(--border); border-radius: 8px; background: #faf9f7; font-size: .9rem; color: var(--muted); }
.captcha-box { width: 1.1rem; height: 1.1rem; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin 1s linear infinite; flex: none; }
.captcha-ok { color: var(--ok); border-color: #bfe0c9; background: var(--ok-soft); }
.captcha-ok .captcha-box { animation: none; border-color: var(--ok); background: var(--ok); }
.captcha-error { color: var(--danger); }
.captcha-error .captcha-box { animation: none; border-color: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.legal { max-width: 820px; margin: 0 auto 1rem; }
.legal h2 { margin-top: 1.4rem; }
.text-danger { color: var(--danger); font-weight: 600; }

/* ---------------------------------------------------------------- Mobil */
@media (max-width: 860px) {
  .kasse { grid-template-columns: 1fr; }
  .kasse-side { position: static; }
  .scan-form { flex-wrap: wrap; }
  .scan-form .scan-input { flex: 1 1 100%; }
  .total { font-size: 2rem; }
}
@media (max-width: 560px) {
  .container { padding: .8rem 16px 2rem; }
  h1 { font-size: 1.35rem; }
  .hero h1 { font-size: 1.7rem; }
  .shift { flex-direction: column; align-items: flex-start; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .price-input { max-width: none; }
}

/* ---------------------------------------------------------------- Druck */
@media print {
  body { background: #fff; }
  .no-print, .topbar, .subnav, .flashes { display: none !important; }
  .container { max-width: none; padding: 0; margin: 0; }
  .card { box-shadow: none; border: none; padding: 0; }
  .statement { border: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
  .labels-page .container { padding: 0; }
  .sheets { overflow: visible; padding: 0; }
  .sheet { margin: 0; box-shadow: none; }
  .sheet:last-child { break-after: auto; page-break-after: auto; }
  .label { outline: none; }
  .label-skip { background: none; }
  .with-frame .label { outline: .2mm dashed #999; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
