:root {
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-2: #e9f1f9;
  --text: #14283a;
  --muted: #5b6f84;
  --border: #d5e1ee;
  --primary: #1871b8;
  --primary-dark: #125a93;
  --primary-soft: #e3effa;
  --accent: #66a6df;
  --primary-text: #ffffff;
  --ok: #2f855a;
  --warn: #b7791f;
  --danger: #c53030;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 40, 58, .06), 0 4px 14px rgba(20, 40, 58, .06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1a26;
    --surface: #182636;
    --surface-2: #1f3044;
    --text: #e6eef7;
    --muted: #9db0c4;
    --border: #2b3f55;
    --primary: #4da3e8;
    --primary-dark: #2f86cc;
    --primary-soft: #1d3a55;
    --accent: #7fbcec;
    --primary-text: #08192a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding-bottom: calc(64px + var(--safe-bottom));
}
a { color: var(--primary); text-decoration: none; }
h1 { font-size: 1.5rem; margin: 0 0 .35rem; }
h2 { font-size: 1.05rem; margin: 1.25rem 0 .5rem; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
h3 { font-size: 1rem; margin: .8rem 0 .4rem; }
.count { font-size: .8rem; background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 0 .55rem; font-weight: 500; }
.muted { color: var(--muted); font-size: .9rem; }
.small { font-size: .82rem; }
.center { text-align: center; }
.error { color: var(--danger); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
code { font-size: .85em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; word-break: break-all; }
pre { background: var(--surface-2); padding: .6rem .8rem; border-radius: 8px; overflow: auto; font-size: .85rem; white-space: pre-wrap; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ---------- Kopfzeile und Navigation */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 1rem;
  padding: .5rem 1rem; padding-top: calc(.5rem + env(safe-area-inset-top, 0px));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: .55rem; color: var(--text); font-weight: 700; font-size: 1.05rem; white-space: nowrap; flex: none; }   /* Logo nie zusammendrücken */
.brand-icon { height: 30px; width: auto; flex: none; }          /* GOITS-Zeichen (Würfel mit Leiterbahnen), static/goits-mark.svg */
.brand-text { display: flex; flex-direction: column; line-height: 1.05; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: .62rem; letter-spacing: .18em; color: var(--accent); font-weight: 600; }
.brand-short { display: none; }
@media (max-width: 599px) {
  .brand-full { display: none; }
  .brand-short { display: inline; }
  .userbox .role { display: none; }
}
/* Menü: passt es nicht in eine Zeile, bricht es in eine zweite (dritte …) Zeile um – nichts wird abgeschnitten; Logo und Benutzer
   bleiben links und rechts, die Höhe der Kopfzeile misst app.js (--topbar-h) für die klebenden Listenköpfe mit */
.topnav { display: none; flex: 1; min-width: 0; flex-wrap: wrap; gap: .2rem .1rem; align-items: center; }
@media (min-width: 900px) and (max-width: 1399px) { .topnav a { font-size: .9rem; padding: .4rem .55rem; } }
@media (min-width: 900px) and (max-width: 1699px) { .userbox .role { display: none; } }   /* Platz für das Menü */
.topnav a { padding: .45rem .7rem; border-radius: 8px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.topnav a.active { background: var(--primary-soft); color: var(--primary); }
.topnav a:hover { color: var(--primary); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-size: .88rem; color: var(--muted); white-space: nowrap; }
.userbox .role { font-size: .72rem; background: var(--surface-2); padding: .1rem .45rem; border-radius: 999px; }
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  overflow-x: auto; scrollbar-width: none;            /* viele Bereiche: waagerecht wischen */
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar a { flex: 1 0 auto; min-width: 4.2rem; text-align: center; padding: .55rem .3rem .5rem; font-size: .72rem; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.tabbar a .ic { font-size: 1.25rem; line-height: 1; font-style: normal; }
.tabbar a.active { color: var(--primary); font-weight: 600; }
.tabbar:empty { display: none; }

main { max-width: 760px; margin: 0 auto; padding: 1rem; }
main.wide { max-width: 1500px; }
main.wide form.box, main.wide .auth, main.wide .narrow { max-width: 1000px; }

/* ---------- Bausteine */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .95rem; cursor: pointer;
  text-align: center; line-height: 1.2; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.small { padding: .32rem .7rem; font-size: .84rem; border-radius: 8px; }
.btn.big { padding: .7rem 1.3rem; font-size: 1.02rem; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.filepick { position: relative; overflow: hidden; }
.btn.filepick input[type=file] { position: absolute; left: 0; top: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 100px; }
.linkbtn { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; padding: 0 .2rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; align-items: center; }
.row.tight { margin-top: .35rem; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 .75rem; }
.row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 .75rem; }
.row4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 .75rem; }
.row2 > label, .row3 > label, .row4 > label { min-width: 0; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin: .75rem 0; box-shadow: var(--shadow); }
.box h2 { margin-top: 0; }
.box.warn { border-left: 4px solid var(--warn); }
.box.info { border-left: 4px solid var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: .84rem; cursor: pointer; }
.chip.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
.badge { display: inline-block; font-size: .72rem; padding: .12rem .5rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: middle; }
.badge.blue { background: var(--primary-soft); color: var(--primary); }
.badge.green { background: #dff5e8; color: var(--ok); }
.badge.orange { background: #fdf0d8; color: var(--warn); }
.badge.red { background: #fde1e1; color: var(--danger); }
.badge.purple { background: #ece3f8; color: #6b3fa0; }
.badge.teal { background: #d7f3f0; color: #0f766e; }
@media (prefers-color-scheme: dark) {
  .badge.green { background: #1c3b2c; } .badge.orange { background: #3d2f14; } .badge.red { background: #43201f; }
  .badge.purple { background: #34264d; color: #c9abf0; } .badge.teal { background: #143a38; color: #7dd3cc; }
}

/* ---------- Formulare */
.form label { display: flex; flex-direction: column; gap: .25rem; font-size: .86rem; color: var(--muted); margin: .55rem 0; }
.form label > span.hint { font-size: .75rem; }
.form input, .form select, .form textarea, .modal-input {
  padding: .55rem .65rem; font: inherit; font-size: 16px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); width: 100%; min-width: 0;
}
.form input:focus, .form select:focus, .form textarea:focus, .modal-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form textarea { min-height: 84px; resize: vertical; }
.form textarea.short { min-height: 52px; }
.form input[type=date], .form select {
  -webkit-appearance: none; appearance: none; display: block; width: 100%; max-width: 100%; min-width: 0;
  min-height: 2.7rem; text-align: left;
}
.form input[type=date]::-webkit-date-and-time-value { text-align: left; }
.form select { padding-right: 1.8rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.form label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: .45rem; margin: .4rem 1rem .4rem 0; color: var(--text); font-size: .95rem; }
.form label.inline input { width: auto; }
.form input[type=checkbox] { width: 20px; height: 20px; }
/* Kästchen und Optionsfelder in Formularen gut treffbar, auch wenn der Text daneben umbricht */
.form label.inline input[type=checkbox], .form label.inline input[type=radio], .form input[type=checkbox] { width: 22px; height: 22px; min-width: 22px; flex: 0 0 auto; margin: 0; cursor: pointer; }
.form label.inline input[type=radio] { width: 20px; height: 20px; min-width: 20px; }
.form .unit { display: flex; align-items: center; gap: .4rem; }
.form .unit input { flex: 1; }
.form .unit span { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 .9rem; }
.form-grid label.wide { grid-column: 1 / -1; }
.form input.num, .table input.num { text-align: right; font-variant-numeric: tabular-nums; }
.form fieldset { border: 1px solid var(--border); border-radius: 10px; padding: .4rem .8rem .7rem; margin: .55rem 0; min-width: 0; }
.form fieldset legend { font-size: .86rem; color: var(--muted); padding: 0 .3rem; }

/* Suchfeld mit Vorschlagsliste (Kunde, Artikel) */
.suggest { position: relative; }
.suggest ul { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; margin: 2px 0 0; padding: .25rem 0; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); max-height: 280px; overflow-y: auto; }
.suggest ul:empty { display: none; }
.suggest li { padding: .45rem .7rem; cursor: pointer; font-size: .9rem; color: var(--text); display: flex; flex-direction: column; }
.suggest li:hover, .suggest li.on { background: var(--primary-soft); }
.suggest li .sub { font-size: .78rem; color: var(--muted); }
.suggest li.muted { cursor: default; }

/* ---------- Anmeldung */
.auth { max-width: 420px; margin: 2rem auto; }
.auth .logo { display: block; width: 100%; max-width: 380px; margin: 0 auto 1.5rem; }
.auth .box { padding: 1.4rem; }
.auth .links { margin-top: 1rem; text-align: center; font-size: .9rem; }

/* ---------- Listen */
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: .5rem 0 .75rem; }
.searchwrap { position: relative; flex: 1 1 220px; min-width: 0; display: flex; }
.searchwrap input[type=search] { width: 100%; padding: .55rem 2.4rem .55rem .7rem; font: inherit; font-size: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); -webkit-appearance: none; appearance: none; }
.searchwrap input[type=search]::-webkit-search-cancel-button, .searchwrap input[type=search]::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.searchwrap .clear { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); width: 1.9rem; height: 1.9rem; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font: inherit; font-size: 1.35rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.searchwrap .clear:hover { background: var(--surface-2); color: var(--text); }
.toolbar select, .toolbar input[type=date], .toolbar input[type=number] { padding: .5rem .6rem; font: inherit; font-size: .92rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); max-width: 100%; min-height: 2.5rem; }
.toolbar label.inline { display: inline-flex; align-items: center; gap: .35rem; font-size: .88rem; color: var(--muted); }
.summary { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .25rem 0 .5rem; }
.summary h1 { margin: 0; }
.summary .spacer { flex: 1; }

.tabs { display: flex; gap: .3rem; flex-wrap: wrap; margin: .5rem 0 .75rem; }
.tabs button, .tabs a { padding: .45rem .9rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: .9rem; cursor: pointer; }
.tabs button.on, .tabs a.on { background: var(--primary); border-color: var(--primary); color: var(--primary-text); font-weight: 600; }

.cards { display: grid; gap: .6rem; }
.card { display: grid; grid-template-columns: 1fr auto; gap: .2rem .7rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .8rem; box-shadow: var(--shadow); color: var(--text); }
.card.thumbed { grid-template-columns: 56px 1fr auto; }
.card .thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 1.4rem; grid-row: span 2; }
.card .num { font-size: .78rem; color: var(--muted); font-family: ui-monospace, Menlo, Consolas, monospace; }
.card .name { font-weight: 600; line-height: 1.25; }
.card .meta { font-size: .82rem; color: var(--muted); margin-top: .1rem; }
.card .side { text-align: right; font-size: .85rem; color: var(--muted); grid-row: span 2; }
.card .side strong { display: block; color: var(--text); font-size: 1rem; }
.card .body { min-width: 0; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { padding: .5rem .6rem; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; font-size: .8rem; color: var(--muted); white-space: nowrap; user-select: none; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.link { cursor: pointer; }
.table tbody tr.link:hover { background: var(--primary-soft); }
.table tbody tr.inactive td { opacity: .6; }
.table td.num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.table td:first-child:has(.thumb) { width: 48px; padding-right: 0; }
.table td.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; white-space: nowrap; }
.table td.name { font-weight: 600; min-width: 160px; }
.table td .sub { display: block; font-weight: 400; font-size: .8rem; color: var(--muted); }
.table td.actions { white-space: nowrap; text-align: right; }
.table.compact th, .table.compact td { padding: .4rem .5rem; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 2px solid var(--border); }
.table td.low { color: var(--danger); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem; box-shadow: var(--shadow); color: var(--text); display: block; }
.tile strong { display: block; font-size: 1.45rem; color: var(--primary); line-height: 1.15; }
.tile span { font-size: .82rem; color: var(--muted); display: block; }
.tile .sub { font-size: .78rem; margin-top: .15rem; }
.tile.warn strong { color: var(--warn); }
.tile.danger strong { color: var(--danger); }
.tile.ok strong { color: var(--ok); }
a.tile:hover { border-color: var(--accent); }
ul.list { list-style: none; padding: 0; margin: .5rem 0; }
ul.list li { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
ul.list li:last-child { border-bottom: 0; }
ul.list li > span:first-child { flex: 1; min-width: 200px; }
ul.list li .actions { display: flex; gap: .35rem; flex-wrap: wrap; align-items: center; }

/* ---------- Detail */
.detail-head { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.detail-head .img { width: 160px; height: 160px; border-radius: var(--radius); object-fit: cover; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 2.5rem; overflow: hidden; }
.detail-head .img img { width: 100%; height: 100%; object-fit: contain; }          /* ganzes Bild zeigen, nicht beschneiden */
.detail-head .titles { flex: 1; min-width: 240px; }
.detail-head .number { font-family: ui-monospace, Menlo, Consolas, monospace; color: var(--muted); font-size: .95rem; }
.detail-head h1 { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem .9rem; }
.kv div { padding: .45rem .6rem; background: var(--surface-2); border-radius: 8px; min-width: 0; }
.kv div > span:first-child { display: block; font-size: .74rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kv div strong { font-weight: 600; font-size: 1rem; word-break: break-word; }
.kv div.hl { background: var(--primary-soft); }
.kv div.wide { grid-column: 1 / -1; }
.notes { white-space: pre-wrap; background: var(--surface-2); padding: .7rem .8rem; border-radius: 8px; }
.addr { white-space: pre-line; line-height: 1.4; }
.addr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .75rem; }
.addr-grid .box { margin: 0; }
.totals { margin-left: auto; max-width: 420px; width: 100%; }
.totals div { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.totals div:last-child { border-bottom: 0; }
.totals div.big { font-size: 1.1rem; font-weight: 700; border-top: 2px solid var(--border); padding-top: .4rem; }
.totals div.due { color: var(--primary); font-weight: 600; }
.log { font-size: .85rem; }
.log li { display: grid; grid-template-columns: max-content 1fr; justify-content: start; gap: .5rem 1rem; padding: .3rem 0; border-bottom: 1px solid var(--border); }
.log li span { text-align: left; }
.log li span:first-child { color: var(--muted); white-space: nowrap; }
.doc-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 .75rem; }

/* ---------- Belegeditor: Positionen */
.items .pos-row { display: grid; grid-template-columns: 2rem minmax(220px, 3fr) 6rem 6rem 7rem 5rem 5.5rem 7rem 6rem; gap: .35rem; align-items: start; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.items .pos-head { display: grid; grid-template-columns: 2rem minmax(220px, 3fr) 6rem 6rem 7rem 5rem 5.5rem 7rem 6rem; gap: .35rem; font-size: .78rem; color: var(--muted); font-weight: 600; padding: .3rem 0; border-bottom: 1px solid var(--border); }
.items .pos-row .pos { color: var(--muted); font-size: .85rem; padding-top: .7rem; }
.items .pos-row input, .items .pos-row select, .items .pos-row textarea { padding: .45rem .5rem; font-size: 15px; margin: 0; }
.items .pos-row textarea { min-height: 38px; max-height: 60vh; margin-top: .3rem; font-size: .88rem; line-height: 1.4; resize: vertical; overflow-y: auto; }   /* Höhe setzt views-editor.js nach dem Inhalt */
.items .pos-row .sum { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; padding-top: .6rem; white-space: nowrap; }
.items .pos-row .tools { display: flex; gap: .15rem; justify-content: flex-end; padding-top: .3rem; }
.items .pos-row .tools button { padding: .3rem .45rem; font-size: .85rem; border-radius: 6px; }
.items .pos-row label { margin: 0; }
.items .pos-row .lbl { display: none; font-size: .72rem; color: var(--muted); margin-bottom: .1rem; }
.items .pos-row .article-no { font-size: .75rem; color: var(--muted); margin-top: .15rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
@media (max-width: 1099px) {
  .items .pos-head { display: none; }
  .items .pos-row { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .4rem; }
  .items .pos-row .pos { grid-column: 1 / 2; padding-top: 0; }
  .items .pos-row .field-name { grid-column: 2 / 6; }
  .items .pos-row .tools { grid-column: 6 / 7; }
  .items .pos-row .field-qty, .items .pos-row .field-unit, .items .pos-row .field-price, .items .pos-row .field-disc, .items .pos-row .field-tax { grid-column: span 2; }
  .items .pos-row .field-qty, .items .pos-row .field-unit, .items .pos-row .field-price { grid-column: span 2; }
  .items .pos-row .sum { grid-column: span 2; padding-top: 1.3rem; }
  .items .pos-row .lbl { display: block; }
}
@media (max-width: 599px) {
  .items .pos-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .items .pos-row .pos { grid-column: 1 / 2; }
  .items .pos-row .field-name { grid-column: 1 / 3; }
  .items .pos-row .tools { grid-column: 2 / 3; grid-row: 1; }
  .items .pos-row .field-qty, .items .pos-row .field-unit, .items .pos-row .field-price, .items .pos-row .field-disc, .items .pos-row .field-tax, .items .pos-row .sum { grid-column: span 1; }
}

/* ---------- Dialoge und Hinweise */
.modal-backdrop { position: fixed; inset: 0; background: rgba(10, 25, 40, .5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal { background: var(--surface); border-radius: 14px; padding: 1.2rem; width: min(460px, 100%); box-shadow: 0 10px 40px rgba(0, 0, 0, .3); max-height: calc(100vh - 2rem); max-height: calc(100dvh - 2rem); overflow-y: auto; }
.modal.wide { width: min(720px, 100%); }
/* Dialoge mit Tabellen (ecoDMS-Suche): so breit wie der Inhalt, bis zur Fensterbreite */
.modal.xwide { width: fit-content; min-width: min(720px, 100%); max-width: 100%; }
.modal.xwide .table-wrap { overflow-x: auto; }
.modal.xwide .dms-hits td.nowrap, .modal.xwide .dms-hits th.nowrap { white-space: nowrap; }
.modal.xwide .dms-hits td.wrap { min-width: 18rem; }
.modal h3 { margin: 0 0 .5rem; }
.modal p { margin: 0 0 .5rem; white-space: pre-line; }
.modal-actions { justify-content: flex-end; }
/* Knopfleiste bleibt bei langen Dialogen (Trefferlisten, Vorschau) unten sichtbar statt mit dem Inhalt wegzuscrollen */
.modal .modal-actions { position: sticky; bottom: -1.2rem; z-index: 3; background: var(--surface); margin: .8rem -1.2rem -1.2rem; padding: .7rem 1.2rem 1.2rem;
  border-top: 1px solid var(--border); border-radius: 0 0 14px 14px; }
#toast { position: fixed; left: 50%; bottom: calc(80px + var(--safe-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: .6rem 1rem; border-radius: 10px; font-size: .92rem; z-index: 60; max-width: 90vw; box-shadow: var(--shadow); }
#toast.error { background: var(--danger); color: #fff; }
#toast.ok { background: var(--ok); color: #fff; }

/* ---------- Etiketten */
.badge.linklike { cursor: pointer; border: 0; font: inherit; font-size: inherit; }
.badge.blue { background: rgba(80, 140, 255, .18); color: #7fb0ff; }
.label-preview { background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow); display: inline-block; max-width: 100%; margin: .5rem 0; }
.label-preview img { display: block; max-width: 100%; height: auto; }
.printsend { background: var(--primary-soft); padding: .6rem .8rem; border-radius: 10px; }
#printSheet { display: none; }
/* Belegdruck: Logo-Vorschau immer auf Weiß, damit transparente PNGs wie auf dem Papier aussehen */
.logo-row { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.logo-preview { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: .5rem; min-width: 120px; min-height: 80px; display: flex; align-items: center; justify-content: center; }
.logo-preview img { max-width: 160px; max-height: 160px; display: block; }
.logo-preview span { color: #5b6f84; font-size: .85rem; }
.logo-tools { flex: 1; min-width: 240px; }
.form label.btn.filepick { display: inline-flex; flex-direction: row; color: var(--text); font-size: .95rem; margin: 0; }
.form textarea.tall { min-height: 18rem; }
.tokenbox { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.tokenbox code { font-size: 1rem; padding: .35rem .6rem; user-select: all; -webkit-user-select: all; }
.userrow select { padding: .35rem .5rem; font: inherit; font-size: .88rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: auto; }

.desktop-only { display: none; }
.mobile-only { display: initial; }
@media (min-width: 900px) {
  body { padding-bottom: 1rem; }
  .topnav { display: flex; }
  .tabbar { display: none; }
  .desktop-only { display: initial; }
  .mobile-only { display: none; }
  main { padding: 1.25rem 2rem; }
  .table th, .table td { padding: .55rem .8rem; }
}
@media (max-width: 599px) {
  .row2, .row3, .row4 { grid-template-columns: minmax(0, 1fr); }
  .detail-head .img { width: 100%; height: 200px; }
  .log li { grid-template-columns: 1fr; gap: 0; }
  .brand-text { font-size: .95rem; }
}

/* ---------- Druck */
@media print {
  .topbar, .tabbar, .no-print, #toast, .toolbar, .summary .btn, .doc-actions { display: none !important; }
  body { background: #fff; color: #000; padding: 0; }
  main { max-width: none; padding: 0; }
  .box { border: 0; box-shadow: none; padding: 0; }
  .table-wrap { border: 0; box-shadow: none; overflow: visible; }
  .table th { position: static; }
  body.printing-label > *:not(#printSheet) { display: none !important; }
  body.printing-label #printSheet { display: block; margin: 0; }
  #printSheet .page { width: var(--pw); height: var(--ph); overflow: hidden; margin: 0; display: flex; align-items: center; justify-content: center; page-break-after: always; break-after: page; }
  #printSheet .page:last-child { page-break-after: auto; break-after: auto; }
  #printSheet .page img { width: var(--lw); height: var(--lh); display: block; }
  #printSheet.rot .page img { transform: rotate(90deg); }
}
.editor input.serial { margin-top: .25rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.mono.small { font-size: .8rem; }

.spinner { display: inline-block; width: 0.9em; height: 0.9em; border: 2px solid var(--border, #ccc); border-top-color: var(--accent, #2563eb); border-radius: 50%; animation: ab-spin 0.8s linear infinite; vertical-align: -0.15em; }
@keyframes ab-spin { to { transform: rotate(360deg); } }

/* Scanner-Dialog */
.modal.scan { width: min(560px, 100%); }
.modal.scan .videowrap { position: relative; }
.modal.scan video { width: 100%; max-height: 50vh; border-radius: 10px; background: #000; object-fit: cover; display: block; }
.modal.scan video.mirror { transform: scaleX(-1); }
.modal.scan .camswitch { position: absolute; right: .6rem; bottom: .6rem; background: rgba(0, 0, 0, .55); color: #fff; border-color: transparent; }
.modal.scan form.manual { display: flex; gap: .5rem; margin: .5rem 0; }
.modal.scan form.manual input { flex: 1; min-width: 0; font-size: 16px; }

/* Kopf der Listen (Titel, Knöpfe, Suche, Filter) bleibt beim Scrollen unter der Kopfzeile stehen */
.list-head { position: sticky; top: var(--topbar-h, 0px); z-index: 4; background: var(--bg); margin: 0 -1rem; padding: .25rem 1rem .25rem; box-shadow: 0 6px 8px -8px rgba(0, 0, 0, .35); }
.list-head .summary { margin-top: 0; }
.list-head .toolbar { margin-bottom: .25rem; }

.label-content { row-gap: .35rem; }
.label-content select.small { padding: .3rem .5rem; font-size: .85rem; min-height: 0; width: auto; flex: 0 0 auto; }

/* sortierbare Spalten */
table.table > thead th { cursor: pointer; }
table.table > thead th.sorted-asc::after { content: ' ▲'; font-size: .7em; opacity: .8; }
table.table > thead th.sorted-desc::after { content: ' ▼'; font-size: .7em; opacity: .8; }

/* Tankbuch-Auswertung: Verlauf (eine Kennzahl, Säulen oder Linie, Tooltip je Zeitraum) */
.fs-chart { position: relative; }
.fs-svg { display: block; max-width: 100%; height: auto; font-family: inherit; touch-action: pan-y; }
.fs-grid { stroke: var(--border); stroke-width: 1; }
.fs-base { stroke: var(--muted); stroke-width: 1; opacity: .5; }
.fs-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.fs-year { font-weight: 600; }
.fs-bar { fill: var(--primary); }
.fs-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fs-dot { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.fs-hit { fill: transparent; cursor: crosshair; }
.fs-band { fill: var(--primary); opacity: .1; }
.fs-cross { stroke: var(--muted); stroke-width: 1; opacity: .7; }
.fs-tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem; box-shadow: var(--shadow); font-size: .8rem; display: flex; flex-direction: column; gap: .1rem; min-width: 11rem; max-width: 17rem; z-index: 2; }
.fs-tip[hidden] { display: none; }
.fs-tip span { color: var(--muted); }
.fs-tip b { color: var(--text); }
#fsVeh tr.on td { background: var(--primary-soft); }
/* Kennzahlen (Auswertung) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin: .5rem 0 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: .7rem .9rem; display: flex; flex-direction: column; gap: .15rem; }
.stat span { font-size: .8rem; color: var(--muted); }
.stat strong { font-size: 1.25rem; }
.stat small { color: var(--muted); }
/* Mahnwesen: Mahnstufen in den Einstellungen */
.dn-level { border: 1px solid var(--border); border-radius: 10px; padding: .6rem .8rem .2rem; margin: 0 0 .8rem; }
.dn-level legend { font-weight: 600; padding: 0 .3rem; }
/* Reklamationen: Positionen im Formular */
.rk-items input { width: 100%; min-width: 0; padding: .35rem .45rem; font: inherit; font-size: .9rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-sizing: border-box; }
.rk-items td { padding: .3rem .3rem; vertical-align: middle; }
.rk-items td:nth-child(1) { width: 9rem; } .rk-items td:nth-child(3) { width: 4.5rem; } .rk-items td:nth-child(4) { width: 4.5rem; } .rk-items td:nth-child(5) { width: 9rem; }
.rk-items td:nth-child(2) input { min-width: 12rem; } .rk-items td:nth-child(6) input { min-width: 12rem; }
.rk-items td:nth-child(3) input { text-align: right; }
.rk-form h3 { margin: 1rem 0 .4rem; display: flex; align-items: center; gap: .6rem; }
.rk-save-sup { align-self: end; padding-bottom: .5rem; }
.rk-form .rk-docs { margin: 1rem 0 .3rem; background: var(--surface-2); box-shadow: none; }
.rk-form .rk-docs-hint { margin: 0 0 .8rem; }
/* Ziffernblock auf dem Bildschirm (numpad.js): unter dem Zahlenfeld im Dialog, große Tasten fürs Tablet */
.numpad { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; margin: .1rem 0 .7rem; max-width: 22rem; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; -webkit-touch-callout: none; }
.numpad button { font: inherit; font-size: 1.35rem; font-weight: 600; padding: .65rem 0; min-height: 3rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer; -webkit-tap-highlight-color: transparent; }
.numpad button:active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.numpad .nk-zero { grid-column: span 2; }
/* Zahlenfeld im Dialog angetippt: bisheriger Wert grau als Platzhalter, die Eingabe ersetzt ihn (numpad.js, wie FreshKeeper) */
input.np-fresh::placeholder { color: var(--muted); opacity: 1; }
.numpad .nk-enter { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.numpad .nk-kbd { grid-column: 1 / -1; font-size: .82rem; font-weight: 500; min-height: 0; padding: .3rem 0; background: none; border: 0; color: var(--muted); }
/* Lager → Auswertung: Zu- und Abgänge je Monat (zwei Säulen), Ladenhüter */
.sr-chart .cr-col { flex-basis: 2.8rem; }
.sr-col .bars { display: flex; align-items: flex-end; justify-content: center; gap: 2px; width: 100%; }
.sr-col .bars .b { width: 38%; max-width: 1.1rem; }
.sr-col .bars .b.in { background: var(--ok); }
.sr-col .bars .b.out { background: var(--danger); }
.sr-legend { display: flex; gap: 1rem; font-size: .78rem; color: var(--muted); margin: .2rem 0 0; }
.sr-legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
.stat .linkbtn { font-size: .78rem; }
tr.sr-cat { cursor: pointer; }
.ek-chart .cr-col { flex-basis: 3.4rem; max-width: 4.2rem; }
.cr-filter label.inline input[type=checkbox] { flex: none; }
tr.sr-cat.on td { font-weight: 600; }
/* Auswertung am Kunden: Filter, Säulen je Jahr/Monat, Anteilsbalken */
.cust-tabs { margin-top: .2rem; }
.cr-filter .toolbar { flex-wrap: wrap; gap: .4rem .6rem; margin: 0; }
.cr-filter .toolbar + .toolbar { margin-top: .5rem; }
.cr-filter .searchwrap { flex: 1 1 14rem; max-width: 22rem; }
.cr-filter label.inline { max-width: 100%; min-width: 0; }
.cr-filter select { max-width: 100%; min-width: 0; }
@media (max-width: 699px) { .cr-filter label.inline { width: 100%; } .cr-filter label.inline select, .cr-filter label.inline input { flex: 1 1 auto; } .cr-filter .searchwrap { max-width: none; } }
.cr-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1rem; }
.cr-grid > .box { margin: 0 0 1rem; }
@media (max-width: 899px) { .cr-grid { grid-template-columns: minmax(0, 1fr); } }
.cr-chart { display: flex; align-items: flex-end; gap: .3rem; padding: .3rem 0 .45rem; overflow-x: auto; overflow-y: hidden; }   /* Höhe aus dem Inhalt: die Bildlaufleiste liegt unter den Beschriftungen */
.cr-grid.stack { grid-template-columns: minmax(0, 1fr); }      /* viele Jahre: Jahressäulen über die ganze Breite */
.cr-col { flex: 1 0 2.4rem; min-width: 2.4rem; max-width: 5rem; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  background: none; border: 0; padding: 0; color: inherit; font: inherit; }
button.cr-col { cursor: pointer; }
.cr-col .v { font-size: .68rem; color: var(--muted); white-space: nowrap; margin-bottom: .15rem; }
.cr-col .b { width: 70%; max-width: 2.6rem; background: var(--primary); border-radius: 4px 4px 0 0; opacity: .8; transition: opacity .15s; }
.cr-col.dim .b { background: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.cr-col:hover .b, .cr-col.on .b { opacity: 1; }
.cr-col .l { font-size: .72rem; color: var(--muted); margin-top: .25rem; white-space: nowrap; border-top: 1px solid var(--border); width: 100%; text-align: center; padding-top: .15rem; }
.cr-col.on .l { color: var(--text); font-weight: 600; }
td.cr-share { min-width: 9rem; white-space: nowrap; }
td.cr-share .track { display: inline-block; width: 5rem; height: .55rem; background: var(--surface-2); border-radius: 3px; vertical-align: middle; margin-right: .45rem; overflow: hidden; }
td.cr-share .bar { display: block; height: 100%; background: var(--primary); opacity: .75; }
.stat strong.cr-dates { font-size: 1rem; }

/* PDF-Dialog der installierten App (pdfview.js): Seiten als Bilder, scrollbar, mit Schließen/Teilen/Sichern */
.modal.pdfview { width: min(960px, 100%); height: calc(100vh - 2rem); height: calc(100dvh - 2rem); display: flex; flex-direction: column; padding: .7rem .8rem; }
.modal.pdfview .pdfview-head { flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; align-items: center; }
.modal.pdfview .pdfview-head h3 { margin: 0; font-size: 1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdfview-pages { flex: 1; min-height: 0; overflow: auto; background: #6b7785; padding: .6rem; border-radius: 8px; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; }
.pdfview-page { display: block; margin: 0 auto .6rem; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); max-width: 100%; flex: none; }
.pdfview-status { color: #fff; text-align: center; margin: .4rem 0; font-size: .9rem; }
.pdfview-frame { flex: 1; width: 100%; border: 0; background: #fff; border-radius: 4px; }

/* Stundennachweis: Zeilen mit Eingabefeldern; die Taetigkeit bekommt den ganzen freien Platz, die Zeitspalten nur so viel wie noetig */
main.wide form.box.ts-form { max-width: none; }
.ts-table { width: 100%; table-layout: auto; }
.ts-table th, .ts-table td { padding: .3rem .35rem; vertical-align: middle; }
.ts-table td:not(.ts-c-act), .ts-table th:not(.ts-c-act) { width: 1%; white-space: nowrap; }
.ts-table input { width: 100%; min-width: 0; padding: .35rem .45rem; font: inherit; font-size: .92rem; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); }
.ts-table .ts-date { display: inline-flex; align-items: center; gap: .4rem; }
.ts-table .ts-wd { display: inline-block; width: 1.5rem; font-size: .8rem; color: var(--muted); text-align: right; }
.ts-table td.ts-c-date input { width: 10.2rem; }
.ts-table td.ts-c-act input { width: 100%; min-width: 14rem; }
.ts-table td.ts-c-act textarea { display: block; width: 100%; min-width: 14rem; padding: .35rem .45rem; font: inherit; font-size: .92rem; line-height: 1.35; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text); resize: none; overflow: hidden; min-height: 0; }
/* Projekt-Kontingent: Balken (Strich = vergangener Anteil des Zeitraums) */
.pj-bar { position: relative; display: flex; height: .5rem; border-radius: 4px; background: color-mix(in srgb, var(--border) 70%, transparent); overflow: hidden; margin: .4rem 0 .25rem; max-width: 34rem; }
.pj-bar span { display: block; flex: none; height: 100%; background: var(--primary); }
.pj-bar.warn span { background: var(--warn); }
.pj-bar.over span { background: var(--danger); }
.pj-bar span.open { background: color-mix(in srgb, var(--primary) 40%, transparent); }       /* in Bearbeitung */
.pj-bar i { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); opacity: .55; }
.pj-list li { display: block; }
.ts-proj-usage { align-self: end; padding-bottom: .4rem; min-width: 0; }
.ts-table td.ts-c-act textarea:disabled { background: transparent; border-color: transparent; padding-left: 0; }
.ts-table td.ts-c-from input, .ts-table td.ts-c-to input { width: 5.4rem; text-align: center; }
.ts-table td.ts-c-pause input { width: 4.8rem; text-align: right; }
/* Kalenderwochen: leichter Rahmen um die Tage einer KW, „KW nn“ senkrecht links am Kasten, kleiner Abstand zwischen den Wochen */
.ts-table { border-collapse: separate; border-spacing: 0; --kw-line: color-mix(in srgb, var(--primary) 28%, var(--border)); }
.ts-table tbody.ts-week td { border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent); }
.ts-table tbody.ts-week tr:first-child td { border-top: 1px solid var(--kw-line); }
.ts-table tbody.ts-week tr:last-child td { border-bottom: 1px solid var(--kw-line); }
.ts-table tbody.ts-week td.ts-c-end { border-right: 1px solid var(--kw-line); }
.ts-table tbody.ts-week tr:first-child td.ts-c-end { border-top-right-radius: 10px; }
.ts-table tbody.ts-week tr:last-child td.ts-c-end { border-bottom-right-radius: 10px; }
/* Wochensumme rechts neben dem Kasten der Kalenderwoche */
.ts-table tbody.ts-week td.ts-wsum { border: 0 !important; background: transparent; padding: .2rem .2rem .2rem .8rem; text-align: right; vertical-align: middle; min-width: 4.2rem; }
.ts-table td.ts-wsum strong { display: block; font-size: 1.02rem; font-variant-numeric: tabular-nums; color: var(--primary); }
.ts-table td.ts-wsum span { display: block; font-size: .75rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.ts-table th.ts-wsum-h { text-align: right; padding-left: .8rem; }
.ts-table tbody.ts-week td.ts-kw { width: 1.9rem; padding: .3rem .15rem; text-align: center; vertical-align: middle; border: 1px solid var(--kw-line);
  border-radius: 10px 0 0 10px; background: color-mix(in srgb, var(--primary-soft) 70%, transparent); }
.ts-table td.ts-kw span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); font-size: .72rem; font-weight: 700;
  letter-spacing: .06em; color: var(--primary); white-space: nowrap; }
.ts-table tbody.ts-gap td { height: .5rem; padding: 0; border: 0; background: transparent; }
.ts-table th.ts-kw-h { width: 1.9rem; padding: 0; }
table.table.nosort > thead th { cursor: default; }
.ts-table td[data-sum] { font-variant-numeric: tabular-nums; text-align: right; min-width: 3.6rem; }
.ts-table input:disabled { background: transparent; border-color: transparent; color: var(--text); padding-left: 0; }
.ts-table input.bad { border-color: #d33; }

/* Protokoll */
/* Vorgang: Verlauf mit Einträgen (Notiz, Telefonat, Besprechung, Aufgabe) */
ul.list.case-log li { display: grid; grid-template-columns: 8.5rem 1fr; justify-content: stretch; align-items: start; gap: .2rem 1rem; }
ul.list.case-log li > span:last-child { text-align: left; }
.case-log .when { color: var(--muted); font-size: .8rem; line-height: 1.35; }
.case-log .entry-body { min-width: 0; border-left: 3px solid var(--primary); padding-left: .7rem; }
.case-log li.task .entry-body { border-left-color: var(--warn); }
.case-log li.task.done .entry-body { border-left-color: var(--ok); }
.case-log .entry-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.case-log .entry-head .actions { margin-left: auto; display: flex; gap: .3rem; }
.case-log .entry-head input[type=checkbox] { width: 1.1rem; height: 1.1rem; margin: 0; }
.case-log .entry-text { white-space: pre-wrap; margin: .15rem 0; font-size: .92rem; color: var(--text); }
.case-log li.done .entry-text { text-decoration: line-through; opacity: .65; }
@media (max-width: 599px) { ul.list.case-log li { grid-template-columns: 1fr; } }
.log-detail { white-space: pre-wrap; font-size: .74rem; max-height: 16rem; overflow: auto; margin: .2rem 0 0; }
tr.warnrow td { background: rgba(220, 60, 60, .07); }

/* Tankbeleg zuschneiden */
.modal.crop .crop-wrap { flex: 1; min-height: 0; overflow: auto; background: #333; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.crop-canvas { max-width: 100%; display: block; cursor: crosshair; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font: inherit; text-decoration: underline; }

/* Empfänger der Benachrichtigungen als Chips (Gruppe / Konto / Adresse) mit × zum Entfernen */
.rec { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; min-width: 14rem; }
.rec select { max-width: 18rem; }
.rchips { display: inline-flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.rchip { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .25rem .15rem .6rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: .84rem; white-space: nowrap; }
.rchip .tag { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rchip button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 0 .3rem; }
.rchip button:hover { color: var(--danger); }
.table td.pre { white-space: pre-line; }
.table td.center, .table th.center { text-align: center; }
.list-head p.small { margin: .1rem 0 .35rem; }
.permarea { display: flex; flex-wrap: wrap; gap: .2rem .7rem; align-items: baseline; padding: .25rem 0; border-top: 1px solid var(--border); }
.permarea:first-child { border-top: 0; }
.permlabel { font-weight: 600; font-size: .85rem; min-width: 6.5rem; }
.permdetails summary { cursor: pointer; margin: .4rem 0 .2rem; }
tr.hl td { background: color-mix(in srgb, var(--accent, #3b82f6) 18%, transparent); }
/* Kopfzeile der Tabellen klebt unter dem festen Seitenkopf (Höhe --head-h aus app.js). Auf breiten Bildschirmen darf der Tabellenrahmen
   nicht selbst scrollen, sonst greift sticky nicht; schmale Bildschirme behalten den waagerechten Scrollbereich. */
@media (min-width: 1100px) {
  main .table-wrap { overflow-x: visible; }
  main .table-wrap.scrollx { overflow-x: auto; }             /* passt die Tabelle nicht hinein (app.js AB.fitTables), scrollt der Rahmen */
  main .table-wrap.scrollx .table th { position: static; }    /* im scrollenden Rahmen kann die Kopfzeile nicht an der Seite kleben */
  main .table th { top: calc(var(--topbar-h, 0px) + var(--head-h, 0px)); z-index: 3; }
  main .table thead th:first-child { border-top-left-radius: var(--radius); }
  main .table thead th:last-child { border-top-right-radius: var(--radius); }
}
.joblist { display: flex; flex-direction: column; gap: .3rem; max-height: 45vh; overflow: auto; margin: .2rem 0 .5rem; }
.jobpick { display: flex; gap: .5rem; align-items: baseline; font-size: .9rem; line-height: 1.35; cursor: pointer; }

/* Reisekostenabrechnung: Tageszeilen mit übereinander stehenden Feldern (Anlass/Reiseweg, Beginn/Ende, km/Betrag) */
.trdays td { vertical-align: top; }
.trdays .stack { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.trdays input { width: 100%; min-width: 0; }
.trdays input[type=date] { min-width: 9.5rem; }
.trdays input.time { width: 5.2rem; text-align: center; }
.trdays input.num, .trdays .calc.num { text-align: right; }
.trdays td:nth-child(3) { min-width: 14rem; }
.trdays td:nth-child(6), .trdays td:nth-child(7) { width: 7rem; }
.trdays .calc { font-size: .78rem; color: var(--muted); }
.trdays input.auto { color: var(--muted); }
.trdays input.invalid { border-color: var(--danger); outline-color: var(--danger); }
#bkAmtRows input.invalid { border-color: var(--danger); outline-color: var(--danger); }
/* Betrag aufteilen (Kontobewegung buchen): je Teil eine Zeile, schmal zweizeilig */
.amt-rows { display: grid; gap: .4rem; margin: .25rem 0 .5rem; }
.amt-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.8fr) minmax(0, 1fr) 5.5rem 7rem 2.4rem; gap: .4rem; align-items: center; }
.amt-row > * { min-width: 0; margin: 0; }
.amt-row .amt-gross { text-align: right; }
.amt-row .amt-rm { justify-self: center; }
.amt-row.private .amt-desc, .amt-row.private .amt-rate, .amt-row.private .amt-ref { opacity: .45; }
.amt-head { font-size: .78rem; color: var(--muted); margin-top: .4rem; }
@media (max-width: 640px) {
  .amt-head { display: none; }
  .amt-row { grid-template-columns: minmax(0, 1fr) 6.5rem 2.4rem; grid-template-areas: "cat gross rm" "desc rate rm" "ref ref rm"; padding: .4rem 0; border-bottom: 1px solid var(--border); }
  .amt-row .amt-cat { grid-area: cat; } .amt-row .amt-gross { grid-area: gross; } .amt-row .amt-rm { grid-area: rm; }
  .amt-row .amt-desc { grid-area: desc; } .amt-row .amt-rate { grid-area: rate; } .amt-row .amt-ref { grid-area: ref; }
}
/* Sammelbetrag: Kombinationen vorhandener Buchungen in der Kontobewegung */
.combo-box { display: grid; gap: .5rem; margin-bottom: .75rem; }
.combo { border: 1px solid var(--border); border-radius: 8px; padding: .4rem .6rem; }
.combo .list { margin: 0 0 .4rem; }
.trdays td.meals { white-space: nowrap; }
.trdays td.meals label { display: inline-flex; align-items: center; gap: .15rem; margin-right: .35rem; font-size: .8rem; color: var(--muted); }
.trdays td.meals input[type=checkbox] { width: 16px; height: 16px; }
.trtotals { margin: .75rem 0 .25rem; font-variant-numeric: tabular-nums; }
.trtotals .big { font-size: 1.08rem; }
.form .dhl-warn-field { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }   /* Feld mit Hinweis der DHL-Prüfung */
.trwarn { margin: .25rem 0 .75rem; padding: .5rem .75rem; border-radius: 8px; background: rgba(255, 170, 60, .14); border: 1px solid rgba(255, 170, 60, .45); font-size: .88rem; }

/* Nachweise → Auswertung: Gruppen mit Unterzeilen, Anteil als Balken, gewählte Zeile */
.trp-row { cursor: pointer; }
.trp-row.on > td { background: var(--primary-soft); }
.trp-g > td { font-weight: 600; background: var(--surface-2); }
.trp-c > td:first-child { padding-left: 1.6rem; }
.trp-sum > td { font-weight: 700; border-top: 2px solid var(--border); }
.trp-bar { display: inline-block; width: 44px; height: 6px; border-radius: 3px; background: var(--surface-2); margin-right: .4rem; vertical-align: middle; overflow: hidden; }
.trp-bar i { display: block; height: 100%; background: var(--accent); }
.trp-g .trp-bar { background: var(--surface); }

/* Buchhaltung → Kontoauszüge */
.bank-in { color: var(--ok); font-weight: 600; }
.bank-out { color: var(--danger); font-weight: 600; }
.filter-note { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; margin: 0 0 .6rem; padding: .4rem .7rem; border-radius: 8px; background: var(--primary-soft); }
.filter-note .btn { margin-left: auto; }
.trx-info { margin: 0 0 .6rem; }
.trx-info .trx-purpose { white-space: pre-wrap; word-break: break-word; margin: .15rem 0 .25rem; }
.trx-info .trx-amount { font-size: 1.1rem; }
#bkStmts > summary { cursor: pointer; }
#bkStmts[open] > summary { margin-bottom: .5rem; }

/* „?“-Hilfe im Dialogtitel und Hilfetexte */
.modal h3 .help-btn { float: right; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--primary);
  font-weight: 700; font-size: 1rem; line-height: 1; cursor: pointer; margin-left: .5rem; }
.modal h3 .help-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.help-text h4 { margin: 1rem 0 .35rem; font-size: 1rem; }
.help-text p, .help-text li { line-height: 1.45; white-space: normal; }
.help-text ol { padding-left: 1.3rem; margin: .3rem 0; }
.help-text li { margin: .2rem 0; }
.help-text code { word-break: normal; }

/* Doppelbuchungen */
.conf-pair .row2 { gap: .6rem; margin: .4rem 0; }
.conf-side { border: 1px solid var(--border); border-radius: 10px; padding: .5rem .6rem; background: var(--surface); }

/* Vorgänge */
.case-steps { display: inline-flex; gap: 2px; flex-wrap: wrap; vertical-align: middle; }
.case-steps span { font-size: .72rem; padding: .1rem .45rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.case-steps span.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); font-weight: 600; }
.drop-zone { border: 2px dashed var(--border); display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; transition: border-color .15s, background .15s; }
.drop-zone p { flex-basis: 100%; }
.drop-zone.over { border-color: var(--primary); background: var(--primary-soft); }
.list.mails li.mail-row { cursor: pointer; align-items: flex-start; }
.list.mails li.mail-row:hover { background: var(--surface-2); }
.list li .grow { flex: 1; min-width: 0; }
.list.mails .preview { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ul.list.mails li > span.dir { font-size: 1.1rem; width: 1.6rem; flex: 0 0 1.6rem; min-width: 0; text-align: center; padding-top: .1rem; }
.mail-row .dir.in { color: var(--primary); }
.mail-row .dir.out { color: var(--ok); }
.mail-head { margin-bottom: .6rem; }
.mail-text { max-height: 50vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: .9rem; }

/* Kasten „Dokumente“ (Dateien, E-Mails, ecoDMS) und E-Mail-Dialoge */
.list.docs li.doc-row, .list li.doc-row { align-items: flex-start; }
ul.list li.doc-row > span.doc-ic { flex: 0 0 1.6rem; min-width: 0; font-size: 1.05rem; text-align: center; padding-top: .05rem; }
/* Anhänge eingerückt unter ihrer E-Mail; Beschreibungszeile je Datei/E-Mail */
ul.list li.doc-child, ul.list li.mail-child { margin-left: 1.6rem; padding-left: .6rem; border-left: 2px solid var(--border); }
ul.list li.doc-child + li:not(.doc-child), ul.list li.mail-child + li:not(.mail-child) { border-top: 1px solid var(--border); }
ul.list input.doc-desc { display: block; width: 100%; max-width: 42rem; box-sizing: border-box; margin: .3rem 0 0; padding: .2rem .45rem; font: inherit; font-size: .85rem;
  line-height: 1.35; color: var(--text); background: transparent; border: 1px dashed var(--border); border-radius: 6px; transition: border-color .15s, background .15s; }
ul.list input.doc-desc:hover { border-style: solid; }
ul.list input.doc-desc:focus { border: 1px solid var(--primary); background: var(--surface); outline: none; }
ul.list input.doc-desc::placeholder { color: var(--muted); opacity: .75; }
ul.list input.doc-desc.saved { border: 1px solid var(--ok); }
.btn.dms-done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
ul.list li.doc-row > .actions { flex: 0 0 auto; }
@media (pointer: coarse) { ul.list input.doc-desc { font-size: 16px; } }     /* iPhone vergrößert sonst beim Antippen */
.box.drop-over { outline: 2px dashed var(--primary); outline-offset: -4px; background: var(--primary-soft); }
.mail-drop { display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: 1.3rem 1rem; border: 2px dashed var(--border); border-radius: var(--radius);
             background: color-mix(in srgb, var(--surface-2) 45%, transparent); text-align: center; transition: border-color .15s, background .15s; }
.mail-drop.over { border-color: var(--primary); background: var(--primary-soft); }
.mail-drop.done { border-style: solid; border-color: var(--accent, var(--primary)); padding: .8rem 1rem; }
.mail-drop-icon { font-size: 2rem; line-height: 1; }
.mail-drop.done .mail-drop-icon { font-size: 1.4rem; }
.mail-hint { margin: .5rem 0 .2rem; }
.mail-prev { margin-top: .6rem; }
.mail-subj { font-weight: 700; font-size: 1.05rem; margin-bottom: .4rem; }
.mail-kv { margin-bottom: .5rem; }
.mail-excerpt { white-space: pre-wrap; font-size: .86rem; background: var(--surface-2); border-radius: 8px; padding: .55rem .7rem; max-height: 9rem; overflow: auto; }
.mail-inbox { border: 1px solid var(--border); border-radius: var(--radius); padding: .6rem .7rem; margin-bottom: .7rem; background: var(--surface); }
.mail-inbox-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .45rem; }
.mail-inbox p { margin: .2rem 0 0; }
.mail-inbox-list { display: flex; flex-direction: column; gap: .3rem; max-height: 14rem; overflow: auto; }
.mail-inbox-list.tall { max-height: 60vh; }
.mail-inbox-item { display: flex; align-items: center; gap: .5rem; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer;
                   background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.mail-inbox-item.static { cursor: default; align-items: flex-start; }
.mail-inbox-item:hover, .mail-inbox-item:focus-visible { border-color: var(--primary); outline: none; }
.mail-inbox-item.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.mail-inbox-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mail-inbox-text > strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-inbox-text > span { overflow-wrap: anywhere; }
.mail-inbox-text select { max-width: 100%; min-width: 0; flex: 1 1 14rem; }
.mail-inbox:not([hidden]) + .mail-drop:not(.done) { padding: .8rem 1rem; }
.mail-inbox:not([hidden]) + .mail-drop .mail-drop-icon { font-size: 1.4rem; }
.mail-inbox-item .btn { flex: none; }
/* Linien-Symbole (app.js AB.icon) statt Emoji in engen Kennzeichen */
.ico { width: 1.05em; height: 1.05em; vertical-align: -.16em; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; flex: none; }
.badge .ico { width: 1.1em; height: 1.1em; margin-right: .1em; }
.dms-mark { color: var(--primary); }
/* Seriennummern je Stück */
.serial-row { display: flex; gap: .35rem; align-items: center; margin-top: .25rem; }
.serial-row input.serial { flex: 1; min-width: 0; margin-top: 0; }
.serial-row .btn { flex: none; }
.serial-pick { display: flex; flex-direction: column; gap: .25rem; max-height: 40vh; overflow: auto; padding: .35rem .5rem; border: 1px solid var(--border); border-radius: 8px; margin: .3rem 0; }
.serial-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.serial-chips .chip { cursor: default; font-size: .8rem; }
/* Sammelbox */
.sb-list { display: flex; flex-direction: column; gap: .6rem; }
.sb-item { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; justify-content: space-between; margin: 0; }
.sb-main { display: flex; flex-direction: column; gap: .15rem; min-width: 0; flex: 1 1 22rem; }
.sb-main > strong { overflow-wrap: anywhere; }
.sb-item.sb-new { box-shadow: inset 4px 0 0 var(--primary); }
.sb-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; flex: 0 1 32rem; justify-content: flex-end; min-width: 0; }
.sb-actions select { flex: 1 1 14rem; min-width: 0; width: 100%; max-width: 100%; margin: 0; padding: .45rem .6rem; font: inherit; font-size: .9rem; border: 1px solid var(--border);
                     border-radius: 10px; background: var(--surface); color: var(--text); min-height: 2.3rem; }
@media (max-width: 699px) { .sb-actions { flex-basis: 100%; justify-content: flex-start; } .sb-actions select { flex-basis: 100%; } }

/* Tooltips (tooltips.js): title-Attribute als gestalteter Hinweis */
.tooltip { position: fixed; z-index: 100; max-width: min(320px, calc(100vw - 16px)); padding: .38rem .6rem; border-radius: 7px; pointer-events: none;
  background: var(--text); color: var(--bg); font-size: .8rem; line-height: 1.35; font-weight: 500; box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
  white-space: pre-line; opacity: 0; transform: translateY(-3px); transition: opacity .12s ease, transform .12s ease; }
.tooltip.above { transform: translateY(3px); }
.tooltip.on { opacity: 1; transform: none; }

/* Farbe (3D-Druckteile) */
.color-chip { display: inline-flex; align-items: center; gap: .3rem; white-space: nowrap; vertical-align: middle; }
.color-dot { display: inline-block; width: .8rem; height: .8rem; border-radius: 50%; border: 1px solid rgba(128, 128, 128, .55); flex: none; }
.color-dot.clear { background: repeating-linear-gradient(45deg, rgba(128, 128, 128, .35) 0 2px, transparent 2px 4px); }
.color-dot.unknown { background: conic-gradient(#d62828, #f5c400, #2a9d4b, #1f6fd1, #7b3fb3, #d62828); }
label[data-color] .unit > span[data-colordot] { display: inline-flex; align-items: center; padding: 0 .1rem; }

/* Dokumente an einer Lagerbuchung (im Buchungs-/Bearbeiten-Dialog) */
.modal .mv-docs { margin: .6rem 0 0; padding: .6rem .8rem; }
.modal .mv-docs h2 { font-size: 1rem; }

/* Lager → Auswertung: Suche bis an die Export-Knöpfe, die groß genug zum Antippen sind */
.st-report-bar .searchwrap { flex: 1 1 220px; }
.st-report-bar .spacer { display: none; }
.st-report-bar .btn.export { min-height: 2.6rem; min-width: 6.5rem; padding: .55rem 1.1rem; font-size: .98rem; justify-content: center; }
@media (max-width: 599px) { .st-report-bar .searchwrap { flex: 1 1 100%; } .st-report-bar .btn.export { flex: 1 1 0; min-width: 0; } }

/* Artikelliste: Massenbearbeitung */
.table th.sel, .table td.sel { width: 2rem; text-align: center; cursor: default; }
.table td.sel input, .table th.sel input { width: 1.05rem; height: 1.05rem; margin: 0; cursor: pointer; }
.bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: .1rem 0 .5rem; padding: .45rem .7rem; border-radius: 10px;
  background: var(--primary-soft); border: 1px solid var(--primary); }
.bulkbar strong { margin-right: .4rem; }

/* Shop-Seite: laufender Abgleich */
.run-box { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; margin: .4rem 0 .6rem; }

/* Buchhaltung → Auswertung: Vorjahreswerte unter den Kennzahlen, gewählte Zeile beim Eingrenzen */
.kv div .sub { display: block; font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.table tbody tr.on-row { background: var(--primary-soft); }
.table tbody tr.on-row td:first-child { font-weight: 600; color: var(--primary); }

/* Beleg per E-Mail: weitere Anhänge (Beleg, Vorgang, Stundennachweis, verwandte Belege) */
.mail-atts { border: 1px solid var(--border); border-radius: 8px; padding: .5rem .75rem .6rem; margin: .4rem 0 0; }
.mail-atts legend { padding: 0 .3rem; font-weight: 600; }
.mail-att-group + .mail-att-group { margin-top: .45rem; }
.mail-att-head { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .15rem; }
.mail-att { display: flex; align-items: flex-start; gap: .5rem; padding: .2rem 0; }
.mail-att input { margin-top: .2rem; }
.mail-att .sub { display: block; font-size: .8rem; color: var(--muted); }

/* Mail-Dialoge: angehängte Signatur zur Ansicht */
.mail-sig { margin: -.2rem 0 .3rem; }
.mail-sig pre { margin: .25rem 0 0; font-family: inherit; font-size: .84rem; color: var(--muted); overflow: visible; }
.mail-sig-paper { background: #fff; color: #1f2933; border: 1px solid var(--border); border-radius: 8px; padding: .4rem .9rem .8rem; margin-top: .3rem; overflow-x: auto; }
.mail-sig-paper table { margin-top: .4rem !important; }
#sigPreview { margin: .2rem 0 .8rem; }

/* Buchhaltung: offene Rechnungen (noch nicht bezahlt, ohne Buchungsdatum) über der Buchungsliste */
.open-items summary { cursor: pointer; list-style-position: inside; }
.open-items .box.warn { margin: .6rem 0; padding: .5rem .75rem; }
.open-items .box.warn p { margin: 0 0 .4rem; }
.open-items .table-wrap { margin-top: .5rem; }

/* Kasse (#/pos): Vollbild-Kassenmodus fürs Tablet im Querformat – ohne Kopfzeile/Menü der App (body.pos-mode), eigene Kopfleiste,
   links Kacheln (Favoriten, Warengruppen, Suche), rechts der Bon mit Zifferntastatur, Storno und Bezahlen */
body.pos-mode > header.topbar, body.pos-mode #tabbar, body.pos-device > header.topbar, body.pos-device #tabbar { display: none !important; }
body.pos-mode { padding-bottom: 0 !important; overflow: hidden; }          /* kein Platz für die Tab-Leiste, kein Nachschwingen */
body.pos-mode main { max-width: none; margin: 0; padding: .5rem .7rem .6rem; }
/* eigener Name: „.pos“ ist die Positionsnummer im Beleg-Editor und wurde sonst bildschirmhoch (Abstand zwischen den Positionen) */
.pos-app { display: flex; flex-direction: column; gap: .5rem; height: calc(100vh - 1.1rem); height: calc(100dvh - 1.1rem); min-height: 480px; }
.pos-head { display: flex; align-items: center; gap: .55rem; padding: .35rem .5rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.pos-logo { width: 34px; height: 34px; }
.pos-title { display: flex; flex-direction: column; line-height: 1.15; }
.pos-title span { font-size: .82rem; color: var(--muted); }
.pos-clock { color: var(--muted); font-size: .9rem; margin-right: .3rem; white-space: nowrap; }
.pos-hbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .05rem; min-width: 4.6rem; height: 3.1rem; padding: 0 .5rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); color: inherit; font: inherit; font-size: .78rem; cursor: pointer; }
.pos-hbtn i { font-style: normal; font-size: 1.15rem; line-height: 1; }
.pos-hbtn.red { color: var(--danger); }
.pos-body { flex: 1; display: grid; grid-template-columns: 1fr minmax(340px, 34%); gap: .6rem; min-height: 0; }
.pos-left { display: flex; flex-direction: column; gap: .45rem; min-height: 0; }
.pos-search { display: flex; gap: .45rem; }
.pos-search input { flex: 1; font-size: 1.05rem; min-height: 2.8rem; border-radius: 10px; }
.pos-tool { min-height: 2.8rem; padding: 0 .9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.pos-tabs { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.pos-tab { min-height: 2.5rem; padding: 0 1rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.pos-tab.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.pos-crumb { color: var(--muted); font-weight: 600; }
.pos-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; align-content: start; padding: .1rem .1rem .5rem; -webkit-overflow-scrolling: touch; }
.pos-grid.groups { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.pos-tile { position: relative; display: flex; flex-direction: column; align-items: stretch; gap: .3rem; padding: .5rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; text-align: left; min-height: 160px; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.pos-tile:active { transform: scale(.97); background: var(--primary-soft); }
.pos-tile img, .pos-tile-ph { width: 100%; height: 92px; object-fit: contain; border-radius: 10px; background: #fff; }
.pos-group img, .pos-group .pos-tile-ph { height: 110px; }
.pos-tile-ph { display: flex; align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); }
.pos-tile-name { font-size: .9rem; line-height: 1.25; flex: 1; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pos-group .pos-tile-name { font-weight: 700; font-size: 1rem; text-align: center; }
.pos-tile-count { font-size: .78rem; color: var(--muted); text-align: center; }
.pos-tile-price { font-weight: 700; font-size: 1.05rem; }
.pos-tile-stock { position: absolute; top: .45rem; right: .45rem; font-size: .72rem; padding: .05rem .45rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pos-tile-stock.neg { color: var(--danger); }
.pos-back { align-items: center; justify-content: center; font-size: 1.1rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); }
.pos-cart { display: flex; flex-direction: column; gap: .4rem; min-height: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: .55rem; }
.pos-cust { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .92rem; }
.pos-lines-head { display: grid; grid-template-columns: 1fr 7.4rem 5.6rem; gap: .4rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 0 .3rem; border-bottom: 1px solid var(--border); }
.pos-lines-head span:nth-child(2) { text-align: center; } .pos-lines-head span:last-child { text-align: right; }
.pos-lines { flex: 1; min-height: 4rem; overflow-y: auto; display: flex; flex-direction: column; -webkit-overflow-scrolling: touch; }
.pos-empty { margin: auto; text-align: center; font-size: .9rem; }
.pos-line { display: grid; grid-template-columns: 1fr 7.4rem 5.6rem; gap: .4rem; align-items: center; padding: .35rem .3rem; border-bottom: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.pos-line.on { background: var(--primary-soft); }
.pos-line-name { min-width: 0; font-size: .92rem; }
.pos-line-name .sub { display: block; font-size: .76rem; color: var(--muted); }
.pos-qty { display: flex; align-items: center; justify-content: center; gap: .25rem; }
.pos-qty button { width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: inherit; font-size: 1.1rem; cursor: pointer; }
.pos-qty span { min-width: 1.5rem; text-align: center; font-weight: 700; }
.pos-line-total { font-weight: 700; text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: .25rem; }
.pos-edit { border: 0; background: none; color: var(--muted); font-size: 1rem; cursor: pointer; padding: .2rem; }
.pos-total { display: flex; justify-content: space-between; align-items: baseline; padding: .15rem .3rem 0; }
.pos-total > span { font-size: 1.05rem; }
.pos-total strong { font-size: 2.1rem; }
.warn-text { color: var(--warn); margin: .1rem .3rem; }
.pos-pad { display: flex; flex-direction: column; gap: .35rem; }
.pos-entry { min-height: 2.3rem; display: flex; align-items: center; justify-content: flex-end; padding: 0 .7rem; border-radius: 10px; background: var(--surface-2); font-size: 1.25rem; overflow: hidden; white-space: nowrap; }
.pos-entry .muted { font-size: .85rem; }
.pos-keys4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.pos-keys4 button { height: 3.05rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: inherit; font: inherit; font-size: 1.3rem; font-weight: 600; cursor: pointer; }
.pos-keys4 button:active { background: var(--primary-soft); }
.pos-keys4 button.k-c { color: var(--danger); }
.pos-keys4 button.k-f { font-size: .95rem; color: var(--primary); }
.pos-actions { display: grid; grid-template-columns: 1fr 2fr; gap: .45rem; }
.pos-big { min-height: 3.7rem; border-radius: 12px; border: 0; font: inherit; font-size: 1.3rem; font-weight: 800; color: #fff; cursor: pointer; }
.pos-big.green { background: #1f9d55; } .pos-big.red { background: #d64545; }
.pos-big:disabled { opacity: .45; cursor: default; }
.pos-methods { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: .3rem 0 .6rem; }
.pos-method { min-height: 5.2rem; border-radius: 14px; border: 0; font: inherit; font-size: 1.25rem; font-weight: 800; color: #fff; background: var(--primary); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; }
.pos-method i { font-style: normal; font-size: 1.6rem; }
.pos-method.cash { background: #1f9d55; } .pos-method.invoice { background: #6b7785; } .pos-method.paypal { background: #2b6cb0; }
.pos-cashpad .pos-quick { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .5rem; }
.pos-cashpad .pos-quick .btn { min-height: 2.8rem; min-width: 4.5rem; font-size: 1.05rem; }
.pos-change { font-size: 1.1rem; margin: .4rem 0; align-self: end; }
.pos-change strong { font-size: 1.5rem; }
.pos-change.big strong { font-size: 2.6rem; color: #1f9d55; }
.pos-qr img { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 8px; display: block; }
.pos-paypal { display: flex; flex-direction: column; align-items: center; text-align: center; gap: .3rem; }
.pos-paypal .pos-qr img { width: 260px; height: 260px; }
.pos-pplabel { overflow-wrap: anywhere; max-width: 32rem; }
/* Inventar */
#ivHead.primary-soft, #ipHead.primary-soft { border-color: var(--primary); }
.inv-tabs { margin: 0 0 0 .6rem; flex-wrap: nowrap; }
.inv-tabs a { padding: .35rem .75rem; white-space: nowrap; }
.inv-tabs a.on .count { background: rgba(255, 255, 255, .25); color: inherit; }
.inv-tabs .count:empty { display: none; }
.modal .dlg-docs { margin-top: .6rem; box-shadow: none; }
.form textarea.autogrow { min-height: clamp(7.5rem, 22vh, 16rem); max-height: 55vh; overflow-y: auto; resize: vertical; line-height: 1.45; }
/* Belegeditor: Herkunft des Preises (Staffel, Kundenpreis) klein unter dem Preisfeld */
.pos-row .price-hint { display: block; font-size: .7rem; line-height: 1.2; color: var(--muted); margin-top: .15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-row .price-hint:empty { display: none; }
/* Empfängerfeld mit Kontaktvorschlägen (AB.recipientPicker) */
.rcp-wrap { position: relative; }
.rcp-list { position: absolute; left: 0; right: 0; top: 100%; margin-top: 2px; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .35); max-height: 19rem; overflow-y: auto; padding: .25rem; }
.rcp-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name badge" "mail badge"; gap: .05rem .6rem; width: 100%; text-align: left;
  padding: .4rem .55rem; border: 0; border-radius: 8px; background: none; color: inherit; cursor: pointer; font: inherit; }
.rcp-item.on, .rcp-item:hover { background: var(--surface-2); }
.rcp-name { grid-area: name; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcp-mail { grid-area: mail; font-size: .85em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rcp-item .badge { grid-area: badge; align-self: center; }
/* Auswahl mit Suche (AB.comboBox / AB.enhanceSelect) */
.cb-group { padding: .35rem .55rem .15rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cb-empty { padding: .5rem .6rem; }
.cb-item { grid-template-areas: "name" "mail"; grid-template-columns: minmax(0, 1fr); }
.dlg-addasset { margin: .3rem 0 0; }
/* Datenblatt-Dialog: Abschnitte als Raster */
.ds-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .35rem 1rem; margin: .3rem 0 .6rem; }
.ds-grid label.muted { opacity: .55; }
.ds-size { max-width: 18rem; }
/* Quittungen: Foto im Erfassungsdialog, Aufteilung nach Steuersätzen */
@media (min-width: 760px) { .dlg-cols.rc-cols { grid-template-columns: minmax(13rem, 19rem) minmax(0, 1fr); } }
.rc-shot { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; margin-bottom: .5rem; }
.rc-shot img { max-width: 100%; max-height: 38vh; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: zoom-in; }
.rc-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem; width: 100%; min-height: 6rem; border: 2px dashed var(--border); border-radius: 10px; font-size: 1.8rem; }
.rc-calc { align-self: end; padding-bottom: .55rem; }
.rc-split-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .5rem; margin-top: .3rem; }
.kv .big { font-size: 1.25rem; }
/* Bildergalerie und Großansicht */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: .5rem; }
.gal-item { position: relative; margin: 0; }
.gal-thumb { display: block; width: 100%; aspect-ratio: 1; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-del { position: absolute; top: .3rem; right: .3rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; font-size: .8rem; }
.detail-head .img img.zoomable { cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(5, 10, 18, .92); display: flex; align-items: center; justify-content: center; }
.lightbox figure { margin: 0; max-width: 94vw; max-height: 92vh; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.lightbox img { max-width: 94vw; max-height: 84vh; object-fit: contain; border-radius: 8px; background: #fff; }
.lightbox figcaption { color: #e6eef7; font-size: .9rem; text-align: center; }
.lb-close, .lb-nav { position: absolute; border: 0; background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer; border-radius: 50%; width: 2.8rem; height: 2.8rem; font-size: 1.4rem; line-height: 1; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); font-size: 2rem; }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); font-size: 2rem; }
.lb-close:hover, .lb-nav:hover { background: rgba(255, 255, 255, .28); }
.ir-opts { display: flex; flex-direction: column; gap: .55rem; }
.ir-row { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.ir-lbl { font-size: .78rem; color: var(--muted); min-width: 6.5rem; text-transform: uppercase; letter-spacing: .03em; }
.ir-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip-toggle { padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer; }
.chip-toggle.on { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--muted); padding: .4rem .8rem; font: inherit; font-size: .85rem; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--primary); color: var(--primary-text); }
.table tr.ir-sub td { font-size: .82rem; color: var(--muted); padding-top: .15rem; padding-bottom: .15rem; }
.table tr.ir-grp td { background: var(--surface-2); }
.ir-kpi .tile strong { font-size: 1.25rem; }
@media (max-width: 599px) { .ir-lbl { min-width: 100%; } }
.dlg-assets { margin: .55rem 0; display: flex; flex-direction: column; gap: .3rem; }
.dlg-assets [data-assets] { display: flex; flex-direction: column; gap: .3rem; }
.dlg-asset-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .3rem .3rem .3rem .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.dlg-assets select { max-width: 100%; }
.dlg-bk { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .55rem 0; padding: .45rem .6rem; border: 1px dashed var(--border); border-radius: 10px; }
.iv-sm { display: none; }
.table td.nowrap { white-space: nowrap; }
.iv-search #ipHead { flex: 0 0 auto; white-space: nowrap; }
.iv-search { flex-wrap: nowrap; }
.iv-search #ivHead { flex: 0 0 auto; white-space: nowrap; }
@media (max-width: 599px) {
  .iv-lbl { display: none; }
  .iv-sm { display: inline; }
  .inv-h1 { display: none; }
  .inv-tabs { margin-left: 0; }
  .iv-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
  .iv-filters select { width: 100%; min-width: 0; }
  .list-head.iv-open { position: static; }            /* Handy: aufgeklappte Filter scrollen mit weg statt den halben Bildschirm zu belegen */
}
.modal.large { width: min(1240px, 100%); }
.dlg-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 0 1.6rem; align-items: start; }
.dlg-sec h4 { margin: .7rem 0 0; padding-bottom: .25rem; border-bottom: 1px solid var(--border); }
.dlg-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 .9rem; align-items: end; }
.dlg-grid > label { min-width: 0; }
.dlg-grid input, .dlg-grid select { height: 2.7rem; box-sizing: border-box; }          /* Datums- und Auswahlfelder gleich hoch wie Textfelder */
.dlg-grid .span2 { grid-column: span 2; }
.dlg-grid .span3 { grid-column: 1 / -1; }
.dlg-grid .dlg-note { margin: .55rem 0; align-self: center; }
.dlg-grid .unit { position: relative; display: block; }                          /* Einheit im Feld statt daneben: alle Felder gleich breit */
.dlg-grid .unit input { width: 100%; padding-right: 3.4rem; }
.dlg-grid .unit span { position: absolute; right: .75rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.dlg-grid input[readonly] { background: var(--surface-2); color: var(--muted); }
@media (max-width: 560px) { .dlg-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dlg-grid .span2, .dlg-grid .dlg-note { grid-column: 1 / -1; } }
.bk-pick-head { margin-top: .25rem; }
.bk-pick-head .searchwrap { flex: 1 1 22rem; }
.bk-pick { max-height: min(56vh, 560px); overflow: auto; }
.bk-pick tr.on td { background: var(--primary-soft); }
.bk-pick tr.on td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.table tr.hl td { background: var(--surface-2); }
.table tr.total td { border-top: 2px solid var(--text); }
.pos-receipt .row input[type=email] { flex: 1; }
.pos-custlist { display: flex; flex-direction: column; gap: .3rem; max-height: 50vh; overflow-y: auto; margin-top: .5rem; }
.pos-custrow { text-align: left; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: inherit; font: inherit; cursor: pointer; }
.pos-custrow .sub { display: block; font-size: .8rem; color: var(--muted); }
.pos-zlist { display: flex; flex-wrap: wrap; gap: .4rem; }
.pos-lock { max-width: 640px; margin: 2rem auto; display: flex; flex-direction: column; gap: 1rem; }
.pos-lock-head { display: flex; align-items: center; justify-content: space-between; }
.pos-ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; }
.pos-op { min-height: 4rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: inherit; font: inherit; font-size: 1.15rem; font-weight: 600; cursor: pointer; }
.pos-op.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.pos-pin { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.pos-pin-dots { font-size: 2rem; letter-spacing: .4rem; min-height: 2.6rem; }
.pos-keys { display: grid; grid-template-columns: repeat(3, 5rem); gap: .6rem; }
.pos-keys button { height: 4.2rem; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: inherit; font: inherit; font-size: 1.5rem; cursor: pointer; }
.pos-keys button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
ul.plain { list-style: none; padding: 0; margin: .3rem 0 .6rem; display: flex; flex-direction: column; gap: .3rem; }
@media (max-height: 760px) {                      /* kleineres Tablet: Tastatur und Kacheln etwas flacher */
  .pos-keys4 button { height: 2.6rem; font-size: 1.15rem; }
  .pos-big { min-height: 3.1rem; }
  .pos-tile { min-height: 140px; } .pos-tile img, .pos-tile-ph { height: 72px; }
}
@media (max-width: 860px) {                       /* Hochformat/Handy: untereinander */
  .pos-app { height: auto; }
  .pos-body { grid-template-columns: 1fr; }
  .pos-grid { max-height: 45vh; }
  .pos-hbtn span { display: none; } .pos-hbtn { min-width: 3rem; }
}

/* Verwaltung → Verfahrensdoku (views-procdoc.js) */
.pd-chapter h2 { margin-bottom: .4rem; }
.pd-sec { border-top: 1px solid var(--line, rgba(127, 127, 127, .25)); padding: .45rem 0; }
.pd-sec > summary { cursor: pointer; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.pd-sec > summary .badge { font-weight: 400; }
.pd-body { padding: .3rem 0 .4rem 1.1rem; max-width: 62rem; }
.pd-text p { margin: .35rem 0; line-height: 1.45; }
.pd-text ul { margin: .3rem 0 .45rem; padding-left: 1.2rem; line-height: 1.45; }
.pd-text h4 { margin: .7rem 0 .2rem; font-size: .95rem; }
.pd-auto { margin-top: .6rem; }
.pd-auto h5 { margin: .5rem 0 .2rem; font-size: .84rem; color: var(--muted); }
.pd-kv th { width: 34%; font-weight: 600; text-align: left; }
.pd-edit { width: 100%; min-height: 10rem; font: inherit; line-height: 1.45; }
mark.pd-open { background: rgba(255, 170, 60, .28); color: inherit; border-radius: 3px; padding: 0 .15em; }
