body { background: var(--bg); color: var(--fg); font-family: var(--f-body); font-size: 16px; margin: 0; padding-inline: 16px; padding-block: 12px 28px; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; touch-action: manipulation; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1240px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

.head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { font-family: var(--f-display); font-weight: 700; font-size: 24px; letter-spacing: .04em; text-transform: uppercase; }
.brand small { font-family: var(--f-body); font-weight: 500; font-size: 13px; letter-spacing: 0; text-transform: none; color: var(--muted); margin-left: 8px; }
.nav { display: flex; gap: 6px; margin-left: auto; background: var(--panel2); padding: 4px; border-radius: 14px; }
.nav button { min-height: 48px; padding: 0 22px; border-radius: 11px; font-weight: 600; }
.nav button[aria-selected="true"] { background: var(--panel); box-shadow: 0 1px 3px rgba(0,0,0,.18); color: var(--accent); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 22px; background: var(--panel2); font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.kpi .k-l { color: var(--muted); font-size: 14px; font-weight: 500; }
.kpi .k-v { font-family: var(--f-display); font-weight: 700; font-size: 38px; line-height: 1.1; margin-top: 2px; }
.kpi .k-d { font-size: 14px; color: var(--muted); margin-top: 2px; }
.up { color: var(--ok); font-weight: 600; } .down { color: var(--bad); font-weight: 600; }

.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.panel.wide { grid-column: 1 / -1; }
.panel h2 { margin: 0 0 4px; font-family: var(--f-display); font-size: 21px; font-weight: 700; letter-spacing: .02em; }
.panel .sub { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-family: var(--f-body); font-size: 12px; }
.chart .val { fill: var(--fg); font-weight: 600; }
.chart .bar { fill: var(--bar); cursor: pointer; }
.chart .bar.hi { fill: var(--accent); }
.chart .axis { stroke: var(--line); }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--line); }
th.r, td.r { text-align: right; }
.mini { display: inline-flex; align-items: flex-end; gap: 2px; height: 26px; vertical-align: middle; }
.mini i { width: 8px; background: var(--bar); border-radius: 2px 2px 0 0; display: block; }
.mini i.hi { background: var(--accent); }
.seg { display: inline-flex; background: var(--panel2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { min-height: 36px; padding: 0 12px; border-radius: 8px; font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--accent); }
.themebtn { min-height: 40px; padding: 0 14px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); font-weight: 500; font-size: 15px; }
.note { font-size: 13px; color: var(--muted); }
.ebcell { color: var(--eb); font-weight: 600; }

.hist-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 48px; text-align: left; }
.hist-h h2 { margin: 0; }
.chev { transition: transform .15s; display: inline-block; color: var(--muted); } .chev.open { transform: rotate(180deg); }
.hbars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 6px 0; overflow-x: auto; }
.hb { flex: 1 1 0; min-width: 54px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 100%; }
.hb i { width: 100%; max-width: 56px; background: var(--bar); border-radius: 4px 4px 0 0; display: block; position: relative; min-height: 2px; }
.hb i em { position: absolute; left: 0; right: 0; bottom: 0; background: var(--eb); display: block; }
.hb.best i { background: var(--accent); }
.hb b { font-size: 13px; } .hb span { font-size: 12px; color: var(--muted); }
/* Sitzungen */
.sesgrid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.srow { display: grid; grid-template-columns: 108px 1fr auto auto; gap: 10px; align-items: center; width: 100%; text-align: left; min-height: 60px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.srow:last-child { border-bottom: 0; }
.srow[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.srow small { display: block; color: var(--muted); font-size: 12px; }
.st { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 13px; font-weight: 600; text-align: center; }
.st.open { background: var(--ok); color: #fff; } .st.closed { background: var(--panel2); color: var(--muted); }
:root:not([data-theme="light"]) .st.open { color: #07210f; }
.sbox { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sbox div { background: var(--panel2); border-radius: 10px; padding: 8px 10px; }
.sbox span { display: block; font-size: 12px; color: var(--muted); } .sbox b { font-size: 19px; }
.cnt { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; }
.cnt input { min-height: 48px; width: 130px; text-align: right; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); padding: 0 10px; }
.diff.ok { color: var(--ok); font-weight: 700; } .diff.bad { color: var(--bad); font-weight: 700; }
.kinds { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kinds .chip { background: var(--eb-soft); color: var(--eb); }
/* Produkte */
.prodgrid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.search { flex: 1; min-width: 160px; min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; }
.btn { min-height: 48px; padding: 0 18px; border-radius: 12px; font-weight: 600; background: var(--panel2); }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.plist { max-height: 640px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.prow { display: grid; grid-template-columns: 38px 1fr auto 74px 14px; gap: 10px; align-items: center; width: 100%; text-align: left; min-height: 56px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.prow:last-child { border-bottom: 0; }
.prow[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.prow .nr { color: var(--muted); font-weight: 600; }
.prow .nm { font-weight: 600; overflow-wrap: anywhere; }
.prow .nm small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.prow .ct { font-size: 12px; color: var(--muted); background: var(--panel2); border-radius: 10px; padding: 2px 8px; white-space: nowrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); }
.dot.off { background: var(--bar); }
.badge-dup { color: var(--warn); font-weight: 600; font-size: 12px; }

.editor { display: flex; flex-direction: column; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 14px; color: var(--muted); font-weight: 500; }
.field input, .field select { min-height: 48px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); padding: 0 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; padding: 0 14px; border-radius: 12px; background: var(--panel2); font-weight: 600; width: 100%; }
.sw { width: 52px; height: 30px; border-radius: 15px; background: var(--bar); position: relative; flex: none; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left .12s; }
.toggle[aria-pressed="true"] .sw { background: var(--ok); }
.toggle[aria-pressed="true"] .sw::after { left: 25px; }
.media { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: center; }
.tile { height: 112px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; justify-content: space-between; }
.tile b { font-size: 16px; line-height: 1.15; overflow-wrap: anywhere; }
.tile span { font-family: var(--f-display); font-weight: 600; font-size: 22px; color: var(--accent); }
.drop { border: 2px dashed var(--line); border-radius: 12px; padding: 12px; color: var(--muted); font-size: 14px; }
.info { font-size: 14px; color: var(--muted); display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; }
.info b { color: var(--fg); font-weight: 600; }
.warn { background: var(--accent-soft); border: 1px solid var(--warn); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.syncbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--eb-soft); color: var(--eb); border: 1px solid var(--eb); border-radius: 12px; padding: 8px 14px; font-weight: 600; margin-bottom: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: 12px 20px; border-radius: 12px; font-weight: 600; box-shadow: 0 6px 24px rgba(0,0,0,.35); z-index: 5; max-width: calc(100% - 32px); }
@media (max-width: 899px) {
  .panels, .prodgrid, .sesgrid { grid-template-columns: 1fr; }
  .nav { margin-left: 0; width: 100%; } .nav button { flex: 1; }
  .prow { grid-template-columns: 30px 1fr 60px 14px; } .prow .ct { display: none; }
}
/* Ergänzungen Backend */
[hidden] { display: none !important; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
fieldset:disabled .btn.w, fieldset:disabled .toggle { opacity: .6; }
.themebtn, .btn { color: var(--fg); }
.btn.primary { color: var(--accent-fg); }
.btn.danger { color: var(--bad); }
.head .who { color: var(--muted); font-size: 14px; }
.login { max-width: 380px; margin: 40px auto; display: flex; flex-direction: column; gap: 12px; }
.err { color: var(--bad); font-weight: 600; min-height: 1.2em; margin: 0; }
.tabpanel { display: block; }
.lrow { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; width: 100%; text-align: left; min-height: 56px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.lrow:last-child { border-bottom: 0; }
.lrow[aria-selected="true"] { background: var(--accent-soft); box-shadow: inset 4px 0 0 var(--accent); }
.lrow small { display: block; color: var(--muted); font-size: 12px; }
.lrow.off b { color: var(--muted); }
.twogrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 12px; align-items: start; }
.field textarea { min-height: 72px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); padding: 8px 12px; font: inherit; color: inherit; }
.field textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tile img { width: 100%; height: 56px; object-fit: cover; border-radius: 8px; }
.media img.pimg { width: 112px; height: 112px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
.chip.on { background: var(--accent); color: var(--accent-fg); }
.chk { width: 24px; height: 24px; }
td .btn, td select, td input[type=text] { min-height: 40px; }
td select { border-radius: 8px; border: 1px solid var(--line); background: var(--panel); padding: 0 8px; }
tr.void td { text-decoration: line-through; color: var(--muted); }
.loading { color: var(--muted); padding: 16px; }
.exports { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--fg); }
.statusline { color: var(--muted); font-size: 14px; }
@media (max-width: 899px) { .twogrid { grid-template-columns: 1fr; } .nav { overflow-x: auto; } .nav button { padding: 0 12px; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* E2E-Fixes: Zahlen nicht umbrechen, Grid-Kinder dürfen schrumpfen */
td.num, th.r, td.r, .lrow .num, .prow .num { white-space: nowrap; }
.row2 > *, .field { min-width: 0; }
.field input, .field select { width: 100%; box-sizing: border-box; min-width: 0; }
@media (max-width: 560px) {
  .srow { grid-template-columns: 1fr auto; row-gap: 2px; }
  .srow > .st { grid-column: 1 / -1; justify-self: start; }
  .srow > span:nth-child(2) { grid-column: 1 / -1; }
  .srow > span:nth-child(3) { grid-column: 1; text-align: left; }
  .srow > span:nth-child(4) { grid-column: 2; }
  .tablewrap td, .tablewrap th { padding-left: 5px; padding-right: 5px; }
  .tablewrap { overflow-x: auto; }
}

/* Drawer (Belege) */
.drawer-ov { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; justify-content: flex-end; }
.drawer { background: var(--bg); width: min(560px, 100%); height: 100%; display: flex; flex-direction: column; padding: 14px 16px; gap: 8px; box-shadow: -4px 0 20px rgba(0,0,0,.3); }
.drawer-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawer-h h2 { margin: 0; font-family: var(--f-display); font-size: 21px; }
.drawer-b { flex: 1; overflow-y: auto; }
.drawer-f { display: flex; justify-content: center; }
.ord { border-bottom: 1px solid var(--line); }
.ord-h { display: grid; grid-template-columns: auto auto 1fr auto; overflow-wrap: anywhere; gap: 8px; align-items: center; width: 100%; min-height: 48px; text-align: left; }
.ord-h .r, .ord-b .r { text-align: right; }
.ord-b { padding: 0 0 8px 8px; }
.ord-b table { width: 100%; }
.ord.void .ord-h > span:not(:nth-child(3)) { text-decoration: line-through; color: var(--muted); }
.vtag { color: var(--bad); }
@media (max-width: 600px) { .drawer { width: 100%; } }

/* Einkauf */
.buy-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; align-items: end; }
.hint { background: var(--panel2); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 14px; font-size: 14px; color: var(--muted); }
body.ro .adminonly { display: none; }
.kinds .kx { min-height: 32px; min-width: 32px; margin-left: 4px; color: inherit; }
/* Sitzungen: Mehrfachauswahl und Löschen */
.srowwrap { display: grid; grid-template-columns: 52px 1fr; align-items: stretch; border-bottom: 1px solid var(--line); }
.srowwrap .srow { border-bottom: 0; }
.selbox { display: flex; align-items: center; justify-content: center; min-width: 52px; min-height: 52px; cursor: pointer; }
.selbox input { width: 24px; height: 24px; }
.btn.delete { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 700; }
.btn.delete:disabled { opacity: .45; cursor: not-allowed; }
.delpanel { border: 2px solid var(--bad); border-radius: 12px; padding: 12px 14px; margin: 10px 0; display: grid; gap: 10px; }
.delpanel .bad { color: var(--bad); font-weight: 700; }
.delpanel .delrow { padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; }
.delpanel .delrow.settled { border-color: var(--bad); background: var(--accent-soft); }
.delpanel input[type=text] { min-height: 44px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.delete { color: #1a0505; } }
:root[data-theme="dark"] .btn.delete { color: #1a0505; }
