/* ==========================================================================
   CERVARIA – Designsystem
   Ruhige Flächen, großzügige Abstände, eine einzige Akzentfarbe (Bernstein).
   ========================================================================== */

:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1a1915;
  --ink-2: #4a4841;
  --muted: #7c786e;
  --line: rgba(26, 25, 21, 0.09);
  --line-strong: rgba(26, 25, 21, 0.16);
  --accent: #b8750a;
  --accent-ink: #8a5600;
  --accent-soft: rgba(184, 117, 10, 0.11);
  --positive: #1f7a4d;
  --positive-soft: rgba(31, 122, 77, 0.1);
  --negative: #b93a2b;
  --negative-soft: rgba(185, 58, 43, 0.09);
  --shadow-sm: 0 1px 2px rgba(26, 25, 21, 0.04), 0 1px 1px rgba(26, 25, 21, 0.03);
  --shadow: 0 1px 2px rgba(26, 25, 21, 0.04), 0 8px 24px -12px rgba(26, 25, 21, 0.12);
  --shadow-lg: 0 24px 64px -24px rgba(26, 25, 21, 0.35), 0 2px 6px rgba(26, 25, 21, 0.06);
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 22px;
  --sidebar: 252px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f0f0d;
  --surface: #1a1a17;
  --surface-2: #151513;
  --ink: #f2f0ea;
  --ink-2: #cbc7bc;
  --muted: #8f8b80;
  --line: rgba(242, 240, 234, 0.09);
  --line-strong: rgba(242, 240, 234, 0.18);
  --accent: #e2a23a;
  --accent-ink: #edb55a;
  --accent-soft: rgba(226, 162, 58, 0.14);
  --positive: #5ec48f;
  --positive-soft: rgba(94, 196, 143, 0.13);
  --negative: #f0806f;
  --negative-soft: rgba(240, 128, 111, 0.13);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 64px -20px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #0f0f0d;
    --surface: #1a1a17;
    --surface-2: #151513;
    --ink: #f2f0ea;
    --ink-2: #cbc7bc;
    --muted: #8f8b80;
    --line: rgba(242, 240, 234, 0.09);
    --line-strong: rgba(242, 240, 234, 0.18);
    --accent: #e2a23a;
    --accent-ink: #edb55a;
    --accent-soft: rgba(226, 162, 58, 0.14);
    --positive: #5ec48f;
    --positive-soft: rgba(94, 196, 143, 0.13);
    --negative: #f0806f;
    --negative-soft: rgba(240, 128, 111, 0.13);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px -14px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 64px -20px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}

/* Kategorie-Farbtöne */
.tint-amber { --tint: #c58512; }
.tint-gold { --tint: #c9a50c; }
.tint-green { --tint: #3f9463; }
.tint-blue { --tint: #3a7fc4; }
.tint-red { --tint: #c4543f; }
.tint-gray { --tint: #8b877d; }

/* ---- Basis ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.4vw, 2.35rem); font-weight: 650; letter-spacing: -0.025em; line-height: 1.12; }
h2 { font-size: 1.1rem; font-weight: 620; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; font-weight: 620; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .small { font-size: 0.85rem; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.pos { color: var(--positive); }
.neg { color: var(--negative); }
.hidden, [hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.eyebrow {
  font-size: 0.72rem; font-weight: 620; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}

/* ---- Grundgerüst ------------------------------------------------------- */

.shell { min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  display: flex; flex-direction: column; gap: 4px;
  padding: 26px 14px 16px;
  background: var(--surface-2);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 12px 22px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; flex: none;
  background: linear-gradient(160deg, #e5ab3d, #b8750a); color: #fff;
  display: grid; place-items: center; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), var(--shadow-sm);
}
.brand-mark .icon { width: 19px; height: 19px; }
.brand-mark img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.brand-name { font-weight: 680; letter-spacing: 0.14em; font-size: 0.86rem; }
.brand-org { display: block; font-size: 0.74rem; color: var(--muted); letter-spacing: 0; font-weight: 450; margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { padding: 18px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 0 12px;
  border-radius: var(--r-sm); color: var(--ink-2); font-size: 0.94rem; font-weight: 500;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}
.nav a:hover { background: var(--line); text-decoration: none; color: var(--ink); }
.nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.nav a.active .icon { color: var(--accent); }
.nav .icon { width: 19px; height: 19px; color: var(--muted); }

.sidebar-foot { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r); color: var(--ink); }
.user-chip:hover { background: var(--line); text-decoration: none; }
.user-chip .who { min-width: 0; line-height: 1.25; }
.user-chip .who b { display: block; font-weight: 600; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { font-size: 0.76rem; color: var(--muted); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; font-size: 0.8rem; letter-spacing: 0.02em;
}
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }

.main { margin-left: var(--sidebar); padding: 44px clamp(20px, 4vw, 56px) 96px; }
.wrap { max-width: 1120px; margin: 0 auto; }
.wrap.narrow { max-width: 720px; }

.topbar { display: none; }
.tabbar { display: none; }
.scrim { display: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 30px; }
.page-head .lead { color: var(--muted); margin-top: 6px; max-width: 60ch; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.backlink { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 0.88rem; margin-bottom: 10px; }
.backlink .icon { width: 16px; height: 16px; }

.stack { display: flex; flex-direction: column; gap: 22px; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-title:first-child { margin-top: 0; }

/* ---- Karten ------------------------------------------------------------ */

.card {
  background: var(--surface); border-radius: var(--r-lg); padding: 24px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card.flush { padding: 0; overflow: hidden; }
.card.quiet { background: transparent; box-shadow: none; border-style: dashed; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card.flush .card-head { padding: 20px 24px 0; }
a.card { display: block; color: inherit; transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease); }
a.card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat .value { font-size: 1.9rem; font-weight: 640; letter-spacing: -0.025em; line-height: 1.15; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.hero { padding: 34px 32px; }
.hero .amount {
  font-size: clamp(3rem, 2rem + 6vw, 5rem); font-weight: 640; letter-spacing: -0.045em; line-height: 1;
  margin: 14px 0 12px; font-variant-numeric: tabular-nums;
}
.hero .meta { display: flex; gap: 28px; flex-wrap: wrap; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.hero .meta div b { display: block; font-size: 1.15rem; font-weight: 620; font-variant-numeric: tabular-nums; }
.hero .meta div span { font-size: 0.8rem; color: var(--muted); }

/* ---- Listen & Tabellen ------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; }
.list li, .list .item { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-top: 1px solid var(--line); }
.list li:first-child, .list .item:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .grow b { display: block; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .grow span { font-size: 0.82rem; color: var(--muted); }
.list .amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
a.item { color: inherit; transition: background 0.15s; }
a.item:hover { background: var(--surface-2); text-decoration: none; }
.dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); flex: none; }
.dot .icon { width: 17px; height: 17px; }
.dot.pos { background: var(--positive-soft); color: var(--positive); border-color: transparent; }
.dot.tinted { background: color-mix(in srgb, var(--tint) 14%, transparent); color: var(--tint); border-color: transparent; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; font-size: 0.72rem; font-weight: 620; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); padding: 12px 14px; white-space: nowrap; }
td { padding: 13px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
th.right, td.right { text-align: right; }
tr.strong td { font-weight: 640; border-top: 1px solid var(--line-strong); }
tr.dim td { color: var(--muted); }
td .sub { display: block; font-size: 0.8rem; color: var(--muted); }
tbody tr:hover td { background: var(--surface-2); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 0.74rem; font-weight: 600; background: var(--line); color: var(--ink-2); white-space: nowrap;
}
.badge.ok { background: var(--positive-soft); color: var(--positive); }
.badge.warn { background: var(--accent-soft); color: var(--accent-ink); }
.badge.bad { background: var(--negative-soft); color: var(--negative); }

.empty { padding: 44px 24px; text-align: center; color: var(--muted); }
.empty .icon { width: 30px; height: 30px; margin-bottom: 10px; opacity: 0.6; }
.empty p { max-width: 42ch; margin: 0 auto; }

.pager { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 18px; color: var(--muted); font-size: 0.88rem; }

/* ---- Bedienelemente ---------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 560 0.93rem/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: transform 0.12s var(--ease), background 0.18s, border-color 0.18s, opacity 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { text-decoration: none; border-color: var(--ink-2); }
.btn:active { transform: scale(0.97); }
.btn .icon { width: 17px; height: 17px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { opacity: 0.88; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
:root[data-theme="dark"] .btn.accent { color: #1a1915; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.quiet:hover { background: var(--line); }
.btn.danger { color: var(--negative); }
.btn.danger:hover { border-color: var(--negative); }
.btn.sm { min-height: 34px; padding: 0 14px; font-size: 0.84rem; }
.btn.lg { min-height: 56px; padding: 0 30px; font-size: 1.02rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--accent-ink); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }

.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .label { font-size: 0.83rem; font-weight: 580; color: var(--ink-2); }
.field .help { font-size: 0.8rem; color: var(--muted); }
.field-error { font-size: 0.8rem; color: var(--negative); }
input[type="text"], input[type="password"], input[type="email"], input[type="number"], input[type="date"],
input[type="search"], input[type="month"], input[type="file"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--r);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 400 1rem/1.4 var(--font); transition: border-color 0.18s, box-shadow 0.18s;
  -webkit-appearance: none; appearance: none;
}
textarea { min-height: 150px; resize: vertical; }
select {
  padding-right: 38px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat;
}
select[multiple] { background-image: none; min-height: 180px; padding: 6px; }
select[multiple] option { padding: 8px 10px; border-radius: 8px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
input.big { min-height: 64px; font-size: 1.7rem; font-weight: 620; letter-spacing: -0.02em; text-align: center; font-variant-numeric: tabular-nums; }
input.count { max-width: 110px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 24px; }

.check { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; min-height: 30px; }
.check input { appearance: none; -webkit-appearance: none; width: 22px; height: 22px; margin: 1px 0 0; flex: none; border-radius: 7px; border: 1.5px solid var(--line-strong); background: var(--surface); cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--accent); border-color: var(--accent); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4L18 8'/%3E%3C/svg%3E"); background-size: 16px; background-position: center; background-repeat: no-repeat; }
.check span small { display: block; color: var(--muted); }

.segmented { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--line); gap: 2px; }
.segmented a, .segmented button {
  border: 0; background: transparent; color: var(--ink-2); padding: 7px 16px; border-radius: 999px;
  font: 560 0.85rem/1.2 var(--font); cursor: pointer; white-space: nowrap;
}
.segmented a:hover { text-decoration: none; color: var(--ink); }
.segmented .on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 9px 16px; font: 560 0.9rem/1 var(--font); cursor: pointer; }
.chip:hover { border-color: var(--accent); }

/* ---- Meldungen & Dialoge ----------------------------------------------- */

.flashes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.flash {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  animation: rise 0.35s var(--ease) both;
}
.flash .icon { margin-top: 1px; }
.flash b { display: block; }
.flash.success .icon { color: var(--positive); }
.flash.error { border-color: color-mix(in srgb, var(--negative) 35%, transparent); background: color-mix(in srgb, var(--negative) 6%, var(--surface)); }
.flash.error .icon { color: var(--negative); }
.flash.info .icon { color: var(--accent); }

.notice { display: flex; gap: 12px; padding: 14px 18px; border-radius: var(--r); background: var(--accent-soft); color: var(--ink); font-size: 0.92rem; }
.notice .icon { color: var(--accent); margin-top: 1px; }
.notice.bad { background: var(--negative-soft); }
.notice.bad .icon { color: var(--negative); }
.notice.ok { background: var(--positive-soft); }
.notice.ok .icon { color: var(--positive); }

dialog {
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; background: var(--surface); color: var(--ink);
  width: min(480px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-shadow: var(--shadow-lg);
}
dialog[open] { animation: pop 0.28s var(--ease) both; }
dialog::backdrop { background: rgba(15, 15, 13, 0.42); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.dialog-body { padding: 28px; }
.dialog-body h2 { font-size: 1.3rem; margin-bottom: 6px; letter-spacing: -0.02em; }
.dialog-body > p { color: var(--muted); margin-bottom: 20px; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ---- Getränkeschrank --------------------------------------------------- */

.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.bottle-card {
  position: relative; display: flex; flex-direction: column; gap: 4px; padding: 20px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: inherit;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
a.bottle-card:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.bottle-card .glyph {
  width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; margin-bottom: 14px;
  background: color-mix(in srgb, var(--tint) 14%, transparent); color: var(--tint);
}
.bottle-card .glyph .icon { width: 24px; height: 24px; }
.bottle-card .name { font-weight: 620; letter-spacing: -0.01em; }
.bottle-card .qty { font-size: 2.1rem; font-weight: 640; letter-spacing: -0.03em; line-height: 1.1; margin-top: 10px; font-variant-numeric: tabular-nums; }
.bottle-card .qty small { font-size: 0.82rem; font-weight: 450; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.bottle-card .foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.86rem; color: var(--muted); }
.bottle-card.low { border-color: color-mix(in srgb, var(--negative) 40%, transparent); }
.bottle-card.low .qty { color: var(--negative); }
.bottle-card.off { opacity: 0.55; }
.bottle-card .flag { position: absolute; top: 18px; right: 18px; }
.level { height: 6px; }
.level rect.track { fill: var(--line); }
.level rect.fill { fill: var(--tint, var(--accent)); }
.bottle-card.low .level rect.fill { fill: var(--negative); }

/* ---- Kasse ------------------------------------------------------------- */

.till { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
.pos-search { position: relative; }
.pos-search .icon { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 22px; height: 22px; }
.pos-search input { min-height: 62px; padding-left: 54px; font-size: 1.15rem; border-radius: 20px; box-shadow: var(--shadow); border-color: var(--line); }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 20px; }
.person {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-lg); min-height: 72px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); cursor: pointer; text-align: left;
  font: inherit; color: inherit; transition: transform 0.14s var(--ease), border-color 0.18s;
  -webkit-tap-highlight-color: transparent;
}
.person:hover { border-color: var(--accent); }
.person:active { transform: scale(0.97); }
.person .who { min-width: 0; flex: 1; line-height: 1.3; }
.person .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who span { font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.person .who span.neg { color: var(--negative); }

.customer { display: flex; align-items: center; gap: 16px; padding: 18px 20px; }
.customer .who { flex: 1; min-width: 0; }
.customer .who b { font-size: 1.2rem; font-weight: 640; letter-spacing: -0.02em; display: block; }
.customer .facts { display: flex; gap: 22px; flex-wrap: wrap; }
.customer .facts div { line-height: 1.25; }
.customer .facts b { display: block; font-size: 1.05rem; font-weight: 640; font-variant-numeric: tabular-nums; }
.customer .facts span { font-size: 0.74rem; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 14px; margin-top: 20px; }
.tile {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-height: 150px; padding: 18px; border-radius: var(--r-lg); cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--ink); font: inherit;
  transition: transform 0.12s var(--ease), border-color 0.18s, box-shadow 0.18s;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.tile:hover { border-color: var(--tint); }
.tile:active { transform: scale(0.955); }
.tile .glyph { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: color-mix(in srgb, var(--tint) 14%, transparent); color: var(--tint); margin-bottom: auto; }
.tile .glyph .icon { width: 22px; height: 22px; }
.tile .name { font-size: 0.8rem; font-weight: 680; letter-spacing: 0.07em; text-transform: uppercase; margin-top: 14px; overflow-wrap: anywhere; }
.tile .price { font-size: 1.55rem; font-weight: 640; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .left { font-size: 0.8rem; color: var(--muted); }
.tile .count {
  position: absolute; top: 14px; right: 14px; min-width: 30px; height: 30px; padding: 0 9px; border-radius: 999px;
  background: var(--ink); color: var(--bg); display: grid; place-items: center; font-weight: 680; font-size: 0.9rem;
  animation: pop 0.2s var(--ease) both;
}
.tile.selected { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink), var(--shadow); }
.tile.soldout { opacity: 0.42; pointer-events: none; }
.tile .freeflag { position: absolute; bottom: 16px; right: 16px; color: var(--accent); }

.cart { position: sticky; top: 28px; padding: 0; overflow: hidden; }
.cart-head { padding: 20px 22px 12px; display: flex; justify-content: space-between; align-items: baseline; }
.cart-lines { list-style: none; margin: 0; padding: 0 22px; max-height: 42vh; overflow-y: auto; }
.cart-lines li { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.cart-lines .grow { flex: 1; min-width: 0; }
.cart-lines .grow b { display: block; font-weight: 580; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-lines .grow span { font-size: 0.8rem; color: var(--muted); }
.stepper { display: inline-flex; align-items: center; gap: 2px; background: var(--line); border-radius: 999px; padding: 3px; }
.stepper button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; box-shadow: var(--shadow-sm); }
.stepper button:active { transform: scale(0.92); }
.stepper button .icon { width: 15px; height: 15px; }
.stepper output { min-width: 30px; text-align: center; font-weight: 640; font-variant-numeric: tabular-nums; }
.cart-empty { padding: 26px 22px 30px; color: var(--muted); font-size: 0.92rem; }
.cart-sum { padding: 16px 22px 22px; border-top: 1px solid var(--line); background: var(--surface-2); }
.cart-sum .line { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--muted); padding: 2px 0; }
.cart-sum .total { display: flex; justify-content: space-between; align-items: baseline; font-size: 1.6rem; font-weight: 640; letter-spacing: -0.03em; margin: 8px 0 16px; font-variant-numeric: tabular-nums; }
.cart-sum .total span:first-child { font-size: 0.9rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.cart-warn { color: var(--negative); font-size: 0.86rem; margin-bottom: 12px; font-weight: 560; }

.done { text-align: center; padding: 40px 28px 30px; }
.done .tick { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 20px; display: grid; place-items: center; background: var(--positive-soft); color: var(--positive); animation: pop 0.4s var(--ease) both; }
.done .tick .icon { width: 34px; height: 34px; stroke-width: 2.2; }
.done.fail .tick { background: var(--negative-soft); color: var(--negative); }
.done .big { font-size: 2.6rem; font-weight: 640; letter-spacing: -0.04em; line-height: 1.1; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.done .dialog-actions { justify-content: center; }

/* ---- Diagramme --------------------------------------------------------- */

.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 14px; align-items: center; font-size: 0.9rem; }
.bar-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .val { font-weight: 620; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { width: 100%; height: 10px; display: block; border-radius: 999px; overflow: hidden; }
.bar .track { fill: var(--line); }
.bar .a { fill: var(--tint, var(--accent)); }
.bar .b { fill: var(--ink-2); opacity: 0.45; }
.columns { width: 100%; height: 180px; display: block; overflow: visible; }
.columns .a { fill: var(--accent); }
.columns .b { fill: var(--ink-2); opacity: 0.4; }
.columns .axis { stroke: var(--line-strong); stroke-width: 1; vector-effect: non-scaling-stroke; }
.columns .grid-line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-axis { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 18px; font-size: 0.8rem; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; background: var(--accent); }
.legend i.b { background: var(--ink-2); opacity: 0.45; }

.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 20px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 580; font-variant-numeric: tabular-nums; }
.kv .sum { border-top: 1px solid var(--line-strong); padding-top: 10px; font-weight: 640; color: var(--ink); }

/* ---- Rechte-Matrix ----------------------------------------------------- */

.perm-group { margin-top: 18px; }
.perm-group .check { padding: 6px 0; }
details.role { border-top: 1px solid var(--line); }
details.role:first-of-type { border-top: 0; }
details.role > summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 18px 24px; cursor: pointer; }
details.role > summary::-webkit-details-marker { display: none; }
details.role > summary .icon { transition: transform 0.2s var(--ease); color: var(--muted); }
details.role[open] > summary .icon { transform: rotate(90deg); }
details.role .inner { padding: 0 24px 24px; }

/* ---- Gastseiten (Login, Installer, Fehler) ------------------------------ */

.guest { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px; }
.guest-card { width: min(420px, 100%); }
.guest-card.wide { width: min(640px, 100%); }
.guest-brand { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-bottom: 30px; text-align: center; }
.guest-brand .brand-mark { width: 60px; height: 60px; border-radius: 19px; }
.guest-brand .brand-mark .icon { width: 32px; height: 32px; }
.guest-brand .brand-name { font-size: 1rem; letter-spacing: 0.22em; }
.guest-foot { text-align: center; margin-top: 22px; font-size: 0.84rem; color: var(--muted); }

.steps { display: flex; gap: 6px; margin-bottom: 26px; }
.steps i { flex: 1; height: 4px; border-radius: 999px; background: var(--line-strong); }
.steps i.on { background: var(--accent); }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks .grow { flex: 1; }
.checks .ok { color: var(--positive); }
.checks .fail { color: var(--negative); }
.checks .warn { color: var(--accent); }

.prose { white-space: pre-line; line-height: 1.7; color: var(--ink-2); max-width: 68ch; }
.receipt { max-width: 420px; margin: 0 auto; text-align: center; }
.receipt .kv { text-align: left; margin-top: 24px; padding-top: 20px; border-top: 1px dashed var(--line-strong); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.86em; }
code { background: var(--line); padding: 2px 6px; border-radius: 6px; }

/* ---- Responsiv --------------------------------------------------------- */

@media (max-width: 1100px) {
  .till { grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; }
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .sidebar { transform: translateX(-102%); transition: transform 0.32s var(--ease); box-shadow: var(--shadow-lg); width: min(300px, 86vw); padding-top: 22px; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 15, 13, 0.4); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
  .main { margin-left: 0; padding: 20px 18px 120px; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -4px -4px 18px;
  }
  .topbar .brand { padding: 0; }
  .iconbtn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
  .iconbtn:hover { background: var(--line); }
  .tabbar {
    display: flex; position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 30;
    background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lg); padding: 6px;
  }
  .tabbar a, .tabbar button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 6px; border-radius: 18px;
    font: 560 0.66rem/1.1 var(--font); color: var(--muted); background: none; border: 0; cursor: pointer; min-width: 0;
  }
  .tabbar a span, .tabbar button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.active { color: var(--ink); background: var(--line); }
  .tabbar a.active .icon { color: var(--accent); }
  .tabbar .icon { width: 22px; height: 22px; }
  .split, .till { grid-template-columns: minmax(0, 1fr); }
  .grid.c3 { grid-template-columns: minmax(0, 1fr); }
  .cart { position: static; }
  .hero { padding: 26px 22px; }
  .card { padding: 20px; }
  .list li, .list .item { padding: 13px 20px; }
  th:first-child, td:first-child { padding-left: 20px; }
  th:last-child, td:last-child { padding-right: 20px; }
}

@media (max-width: 560px) {
  .grid.c2, .grid.c4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { min-height: 136px; padding: 15px; }
  .people { grid-template-columns: minmax(0, 1fr); }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bottle-card { padding: 16px; }
  .bottle-card .qty { font-size: 1.7rem; }
  .page-head { margin-bottom: 22px; }
  .customer { flex-wrap: wrap; }
  .bar-row { grid-template-columns: minmax(70px, 100px) 1fr auto; gap: 10px; }
  .form-actions .btn, .dialog-actions .btn { flex: 1; }
  .hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---- Druck (Berichte, Belege) ------------------------------------------ */

@media print {
  :root, :root[data-theme] {
    --bg: #fff; --surface: #fff; --surface-2: #fff; --ink: #000; --ink-2: #222; --muted: #555;
    --line: #ddd; --line-strong: #bbb; --shadow: none; --shadow-sm: none; --shadow-lg: none; --accent: #8a5600; --accent-ink: #8a5600;
  }
  .sidebar, .topbar, .tabbar, .scrim, .no-print, .flashes, .page-head .actions, .backlink { display: none !important; }
  .main { margin: 0; padding: 0; }
  .wrap { max-width: none; }
  body { font-size: 11pt; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; padding: 14px; }
  .grid, .split { gap: 10px; }
  .split { grid-template-columns: 1fr 1fr; }
  .grid.c4 { grid-template-columns: repeat(4, 1fr); }
  table { font-size: 9.5pt; }
  td, th { padding: 6px 8px; }
  a { color: inherit; }
  @page { margin: 14mm; }
}

/* ---- Abstände & Kleinigkeiten ------------------------------------------ */
[data-gap] { margin-top: 18px; }
[data-gap-after] { margin-bottom: 18px; }
.stat .value { display: block; }
.card > .dot { margin-bottom: 4px; }
ul.stack-sm { padding-left: 18px; margin: 0; }
td form { display: inline; }
.list .item .icon.muted, .list li .icon.muted { color: var(--muted); width: 18px; height: 18px; }
.grid.top { align-content: start; grid-auto-rows: min-content; }
.stat .value.text { font-size: 1.35rem; line-height: 1.25; overflow-wrap: anywhere; margin-top: 12px; }
.customer .who { flex: 1 1 150px; }
.customer .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.customer .who span { display: block; }
.customer .facts { flex: none; }
table.compact { font-size: 0.86rem; }
table.compact th, table.compact td { padding: 10px 8px; }
table.compact th { letter-spacing: 0.04em; }
table.compact td:first-child { white-space: nowrap; }
.bar-row { grid-template-columns: minmax(90px, 160px) 1fr 104px; }
.bar-row .val { text-align: right; }
.bottle-card .eyebrow { font-size: 0.66rem; }

@media (max-width: 860px) {
  /* Kasse mobil: Vorgang bleibt über der Tab-Leiste sichtbar */
  .card.cart { padding: 0; position: sticky; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 20; box-shadow: var(--shadow-lg); }
  .cart-head, .cart-empty { display: none; }
  .cart-lines { max-height: 24vh; padding-top: 4px; }
  .cart-lines li:first-child { border-top: 0; }
  .cart-sum { padding: 12px 18px 16px; }
  .cart-sum .total { margin: 2px 0 10px; font-size: 1.3rem; }
  .till { padding-bottom: 8px; }
}
.customer { flex-wrap: wrap; }
.customer .who { min-width: 150px; }
