/* Marktkontor ERP – Oberfläche */
:root {
  --bg: #f4f5f0;
  --surface: #ffffff;
  --surface-2: #f8f9f5;
  --border: #e1e4da;
  --border-strong: #c9cec0;
  --text: #1d2420;
  --muted: #5f6b63;
  --primary: #23633f;
  --primary-hover: #1b4f32;
  --primary-soft: #e3f0e7;
  --sidebar: #163828;
  --sidebar-text: #c9dacd;
  --accent: #e3a12f;
  --blue: #2563a8; --blue-soft: #e4eef9;
  --green: #23753f; --green-soft: #e0f1e5;
  --amber: #9a6200; --amber-soft: #fbf0d9;
  --red: #b42318; --red-soft: #fde8e6;
  --grey: #5f6b63; --grey-soft: #eceee8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 40, 30, .06), 0 1px 1px rgba(20, 40, 30, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --primary-light: #23633f;
  --primary-soft-dark: #1b3527;
  --link: var(--primary);
  --input-bg: #ffffff;
  --row-hover: #fafbf7;
  --label: #374139;
  --nav-group: #8fae98;
  --sidebar-foot: #7f9a87;
  --sidebar-active: rgba(124,196,143,.18);
  --plain-glow: #e5efe5;
  --green-border: #b5dcc0; --green-text: #17502b;
  --red-border: #f4bcb5; --red-text: #8a1c12; --red-line: #f0b6b0;
  --amber-border: #efd39b; --amber-text: #6d4600;
  --blue-border: #bcd3ee; --blue-text: #1c4a7e;
  --code-bg: #1f2a24; --code-text: #e8efe9;
  --on-primary: #ffffff;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .6rem; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8rem; }
small, .muted { color: var(--muted); }
code, .mono { font-family: var(--mono); font-size: .9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.2rem 0; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 240px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; flex: none; }
.brand { display: flex; align-items: center; gap: .65rem; padding: 1.1rem 1rem 1rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand span { display: flex; flex-direction: column; line-height: 1.15; }
.brand small { color: var(--sidebar-text); font-size: .75rem; }
.sidebar nav { padding: .3rem .6rem 1rem; flex: 1; }
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--nav-group); margin: 1rem .6rem .35rem; }
.sidebar nav a { display: flex; align-items: center; gap: .65rem; padding: .5rem .6rem; border-radius: 8px; color: var(--sidebar-text); font-size: .94rem; }
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-foot { padding: .8rem 1rem; font-size: .75rem; color: var(--sidebar-foot); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 1rem; padding: .7rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.search { flex: 1; max-width: 560px; display: flex; align-items: center; gap: .5rem; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 0 .7rem; color: var(--muted); }
.search input { border: 0; background: transparent; padding: .55rem 0; flex: 1; font: inherit; outline: none; color: var(--text); }
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.user-menu { margin-inline-start: auto; display: flex; align-items: center; gap: .4rem; }
.user-chip { display: flex; align-items: center; gap: .55rem; color: var(--text); padding: .25rem .5rem; border-radius: 8px; }
.user-chip:hover { background: var(--surface-2); text-decoration: none; }
.user-name { display: flex; flex-direction: column; line-height: 1.15; font-size: .9rem; }
.user-name small { font-size: .75rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; }
.icon-btn { background: none; border: 0; padding: .45rem; border-radius: 8px; color: var(--muted); cursor: pointer; display: inline-flex; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.menu-toggle { display: none; }
.content { padding: 1.5rem; max-width: 1400px; width: 100%; }

/* Seitenkopf */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin-top: .25rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: .85rem; color: var(--muted); margin-bottom: .3rem; }

/* Karten */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem; margin-bottom: 1.2rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .8rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 1rem 1.2rem 0; }
.grid { display: grid; gap: 1.2rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.stat { padding: 1rem 1.2rem; }
.stat .label { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .4rem; }
.stat .value { font-size: 1.6rem; font-weight: 650; margin-top: .2rem; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: .8rem; color: var(--muted); }
.stat.warn .value { color: var(--amber); }
.stat.bad .value { color: var(--red); }
a.stat { display: block; color: inherit; }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: .6rem .75rem; text-align: start; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; background: var(--surface-2); white-space: nowrap; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.nowrap { white-space: nowrap; }
tfoot td { font-weight: 600; background: var(--surface-2); }
tr.clickable { cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.row-warn td { background: var(--amber-soft); }
.row-bad td { background: var(--red-soft); }

/* Formulare */
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: .9rem 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; grid-column: span 6; }
.field.s2 { grid-column: span 2; } .field.s3 { grid-column: span 3; } .field.s4 { grid-column: span 4; }
.field.s5 { grid-column: span 5; } .field.s6 { grid-column: span 6; } .field.s7 { grid-column: span 7; }
.field.s8 { grid-column: span 8; } .field.s9 { grid-column: span 9; } .field.s12 { grid-column: span 12; }
label, .label-like { font-size: .85rem; font-weight: 550; color: var(--label); }
.req::after { content: " *"; color: var(--red); }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], input[type=search], input[type=tel], input[type=url], input[type=file], select, textarea {
  font: inherit; color: var(--text); background: var(--input-bg); border: 1px solid var(--border-strong); border-radius: 8px; padding: .5rem .65rem; width: 100%; min-height: 38px;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
input.num { text-align: end; font-variant-numeric: tabular-nums; }
.help { font-size: .8rem; color: var(--muted); }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-actions { display: flex; gap: .6rem; justify-content: flex-end; margin-top: 1.2rem; flex-wrap: wrap; }
.inline-form { display: inline; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; }
.filters .field { grid-column: auto; min-width: 160px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: .45rem; font: inherit; font-weight: 550; font-size: .92rem; padding: .5rem .95rem; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--input-bg); color: var(--text); cursor: pointer; white-space: nowrap; min-height: 38px; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--red); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-soft); }
.btn-sm { padding: .3rem .6rem; font-size: .85rem; min-height: 30px; }
.btn-lg { padding: .75rem 1.3rem; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Hinweise */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; font-size: .94rem; }
.alert-success { background: var(--green-soft); border-color: var(--green-border); color: var(--green-text); }
.alert-error { background: var(--red-soft); border-color: var(--red-border); color: var(--red-text); }
.alert-warning { background: var(--amber-soft); border-color: var(--amber-border); color: var(--amber-text); }
.alert-info { background: var(--blue-soft); border-color: var(--blue-border); color: var(--blue-text); }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: .15rem .5rem; border-radius: 999px; white-space: nowrap; }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-grey { background: var(--grey-soft); color: var(--grey); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.dot-green { background: #2e9b55; } .dot-red { background: var(--red); } .dot-amber { background: var(--accent); } .dot-grey { background: #aab3ab; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .55rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 550; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs a:hover { text-decoration: none; color: var(--text); }

/* Definitionslisten */
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .4rem 1.2rem; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* Positionen-Editor */
.lines-table input, .lines-table select { min-height: 34px; padding: .35rem .5rem; }
.lines-table td { padding: .4rem .4rem; vertical-align: middle; }
.lines-table .col-art { min-width: 240px; }
.lines-table .col-qty, .lines-table .col-price { width: 120px; }
.lines-table .col-unit { width: 70px; color: var(--muted); }
.lines-table .col-sum { width: 120px; }
.totals { display: grid; grid-template-columns: auto auto; gap: .3rem 1.5rem; justify-content: end; margin-top: 1rem; font-variant-numeric: tabular-nums; }
.totals .grand { font-weight: 700; font-size: 1.1rem; }

/* Pagination */
.pagination { display: flex; gap: .3rem; justify-content: flex-end; align-items: center; padding: .8rem 1.2rem; font-size: .9rem; color: var(--muted); }

/* Balkendiagramm */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .bar span.b { width: 100%; max-width: 38px; background: var(--primary); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars .bar span.m { width: 100%; max-width: 38px; background: var(--accent); border-radius: 0; min-height: 0; }
.bars .bar small { font-size: .7rem; margin-top: .3rem; white-space: nowrap; }
.legend { display: flex; gap: 1rem; font-size: .8rem; color: var(--muted); margin-top: .6rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; }
.hbar { background: var(--grey-soft); border-radius: 4px; height: 8px; overflow: hidden; min-width: 60px; }
.hbar span { display: block; height: 100%; background: var(--primary); }

/* Login / Installer */
.plain { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; background: radial-gradient(ellipse at top, var(--plain-glow), var(--bg) 60%); }
.plain-wrap { width: 100%; max-width: 440px; }
.plain-wrap.wide { max-width: 760px; }
.plain-brand { display: flex; gap: .8rem; align-items: center; margin-bottom: 1.2rem; justify-content: center; }
.plain-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.plain-brand strong { font-size: 1.3rem; }
.plain-brand small { color: var(--muted); }
.plain-card { padding: 1.6rem; }
.plain-card .field { grid-column: span 12; margin-bottom: .9rem; }
.code-input { font-size: 1.6rem !important; letter-spacing: .4em; text-align: center; font-family: var(--mono) !important; }
.qr-box { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; margin: 1rem 0; }
.qr { background: #fff; padding: 10px; border: 1px solid var(--border); border-radius: 8px; width: 200px; height: 200px; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }
.secret { font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--border-strong); padding: .5rem .7rem; border-radius: 6px; word-break: break-all; font-size: .95rem; }
.steps { padding-inline-start: 1.2rem; margin: 0 0 1rem; }
.steps li { margin-bottom: .45rem; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; font-family: var(--mono); font-size: 1.05rem; margin: 1rem 0; }
.codes span { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: .45rem; text-align: center; }
.check-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.check-list li { padding: .35rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: 1rem; }

/* Hilfe */
.doc { max-width: 860px; }
.doc h1 { font-size: 1.6rem; margin-top: 0; }
.doc h2 { font-size: 1.25rem; margin-top: 2rem; padding-bottom: .3rem; border-bottom: 1px solid var(--border); }
.doc h3 { font-size: 1.05rem; margin-top: 1.4rem; }
.doc p, .doc li { line-height: 1.6; }
.doc table { margin: 1rem 0; border: 1px solid var(--border); }
.doc pre { background: var(--code-bg); color: var(--code-text); padding: 1rem; border-radius: 8px; overflow-x: auto; font-size: .88rem; }
.doc code { background: var(--surface-2); padding: .1rem .3rem; border-radius: 4px; }
.doc pre code { background: none; padding: 0; }
.doc blockquote { margin: 1rem 0; padding: .6rem 1rem; border-inline-start: 4px solid var(--accent); background: var(--amber-soft); border-radius: 0 8px 8px 0; }
.doc-nav { position: sticky; top: 80px; }
.doc-nav a { display: block; padding: .3rem 0; font-size: .9rem; }

/* Druck */
@media print {
  .sidebar, .topbar, .actions, .form-actions, .no-print, .alert { display: none !important; }
  .content { padding: 0; }
  .card { box-shadow: none; border: 0; padding: 0; }
  body { background: #fff; }
}

/* Responsive */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: -260px; z-index: 50; transition: left .2s; box-shadow: 0 0 30px rgba(0,0,0,.25); }
  .sidebar.open { left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 1rem; }
  .topbar { padding: .6rem 1rem; gap: .6rem; }
  .user-name { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .field, .field.s2, .field.s3, .field.s4, .field.s5, .field.s6, .field.s7, .field.s8, .field.s9 { grid-column: span 12; }
  .page-head { flex-direction: column; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
  .codes { grid-template-columns: 1fr; }
}

/* Sprachwahl auf der Anmeldeseite */
.lang-switch { display: flex; flex-wrap: wrap; gap: .3rem .7rem; justify-content: center; margin: 1.2rem 0 0; font-size: .85rem; }
.lang-switch a { color: var(--muted); }
.lang-switch a.active { color: var(--primary); font-weight: 600; }

/* Rechts-nach-links (Arabisch) */
[dir=rtl] body { font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", Arial, sans-serif; }
[dir=rtl] .sidebar nav a.active { box-shadow: inset -3px 0 0 var(--accent); }
[dir=rtl] .doc blockquote { border-radius: 8px 0 0 8px; }
[dir=rtl] .icon-btn svg, [dir=rtl] .btn svg { transform: none; }
[dir=rtl] .mono, [dir=rtl] .secret, [dir=rtl] .codes, [dir=rtl] code, [dir=rtl] input[type=email], [dir=rtl] input[type=url] { direction: ltr; unicode-bidi: embed; }
[dir=rtl] td.num, [dir=rtl] th.num { text-align: left; }
[dir=rtl] td.num, [dir=rtl] .totals .num, [dir=rtl] .stat .value { direction: ltr; unicode-bidi: isolate; }
@media (max-width: 860px) {
  [dir=rtl] .sidebar { left: auto; right: -260px; transition: right .2s; }
  [dir=rtl] .sidebar.open { right: 0; }
}
[dir=rtl] .stat .value { text-align: right; }

/* lange Werte (E-Mail, IBAN) dürfen das Layout nicht sprengen */
.card { min-width: 0; }
html[dir=rtl] body { overflow-x: hidden; }

/* ---------- Benachrichtigung & Auftragsabarbeitung (1.2) ---------- */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-red { color: var(--red); font-weight: 600; }
.notif { margin-inline-start: auto; position: relative; display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .75rem .4rem .55rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); font-size: .88rem; font-weight: 550; white-space: nowrap; }
.notif:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }
.notif .icon { width: 20px; height: 20px; }
.notif + .user-menu { margin-inline-start: 0; }
.notif.has-new { background: var(--red-soft); border-color: var(--red-border); color: var(--red); }
.notif.has-new .icon { animation: ring 1.6s ease-in-out 2; transform-origin: 50% 10%; }
.notif-badge { position: absolute; top: -4px; inset-inline-start: 22px; background: var(--red); color: #fff; font-size: .7rem; min-width: 1.2rem; height: 1.2rem; border-radius: 999px; display: grid; place-items: center; padding: 0 .3rem; box-shadow: 0 0 0 2px var(--surface); }
@keyframes ring { 0%,100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-4deg); } }
.nav-count { margin-inline-start: auto; background: var(--accent); color: #2a1d00; font-size: .72rem; min-width: 1.35rem; height: 1.35rem; border-radius: 999px; display: grid; place-items: center; padding: 0 .3rem; }
.toast { position: fixed; bottom: 1.2rem; inset-inline-end: 1.2rem; z-index: 60; background: var(--sidebar); color: #fff; padding: .85rem 1.1rem; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 360px; font-size: .92rem; border-inline-start: 4px solid var(--accent); }
.toast:hover { text-decoration: none; filter: brightness(1.15); }
.toast strong { display: block; margin-bottom: .15rem; }
.count-pill { display: inline-grid; place-items: center; min-width: 1.35rem; height: 1.35rem; padding: 0 .35rem; margin-inline-start: .35rem; border-radius: 999px; background: var(--grey-soft); color: var(--grey); font-size: .74rem; }
.count-pill.hot { background: var(--red); color: #fff; }
.inbox-alert { display: flex; align-items: center; gap: .9rem; background: var(--red-soft); border: 1px solid var(--red-border); color: var(--red-text); border-radius: var(--radius); padding: .9rem 1.1rem; margin-bottom: 1.2rem; }
.inbox-alert:hover { text-decoration: none; border-color: var(--red); }
.inbox-alert .icon { width: 26px; height: 26px; color: var(--red); }
.inbox-alert strong { font-size: 1.05rem; }
.inbox-alert .go { margin-inline-start: auto; font-weight: 600; color: var(--red); white-space: nowrap; }
.bulkbar { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; padding: .7rem 1.2rem; position: sticky; top: 58px; z-index: 5; }
.bulkbar .btn { margin-inline-start: auto; }
.order-card { padding: 0; overflow: hidden; }
.order-card.marked { box-shadow: 0 0 0 2px var(--primary); }
.order-card.short { border-inline-start: 4px solid var(--red); }
.order-head { display: flex; gap: 1rem; align-items: flex-start; padding: 1rem 1.2rem .6rem; flex-wrap: wrap; }
.order-head > input[type=checkbox] { width: 18px; height: 18px; margin-top: .2rem; accent-color: var(--primary); }
.order-title { flex: 1; min-width: 220px; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.order-title > a { font-size: 1.05rem; }
.order-cust { width: 100%; }
.order-facts { display: flex; gap: 1.4rem; margin: 0; flex-wrap: wrap; }
.order-facts dt { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.order-facts dd { margin: 0; font-weight: 550; }
.order-sub { padding: 0 1.2rem .5rem; font-size: .85rem; }
.order-note { display: flex; gap: .5rem; align-items: flex-start; margin: 0 1.2rem .7rem; padding: .55rem .75rem; background: var(--amber-soft); color: var(--amber-text); border-radius: 8px; font-size: .9rem; }
.order-card table.compact th, .order-card table.compact td { padding: .45rem 1.2rem; }
.order-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: flex-end; align-items: center; padding: .8rem 1.2rem; border-top: 1px solid var(--border); background: var(--surface-2); }
.order-actions form { margin: 0; }
.stockdot { display: inline-flex; align-items: center; gap: .35rem; }
.stockdot::before { content: ""; width: .55rem; height: .55rem; border-radius: 50%; background: var(--green); }
.stockdot.warn::before { background: var(--accent); }
.stockdot.bad { color: var(--red); font-weight: 600; }
.stockdot.bad::before { background: var(--red); }
.btn-danger-ghost { color: var(--red); }
details.reject { position: relative; }
details.reject summary { list-style: none; }
details.reject summary::-webkit-details-marker { display: none; }
.reject-form { position: absolute; bottom: calc(100% + .4rem); inset-inline-end: 0; display: flex; gap: .4rem; background: var(--surface); border: 1px solid var(--border); padding: .6rem; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); width: 380px; max-width: 80vw; z-index: 5; }
.shop-pw { background: var(--amber-soft); border: 1px solid var(--amber-border); border-radius: 8px; padding: .8rem 1rem; margin-bottom: .8rem; }
.shop-pw code { font-size: 1.15rem; font-weight: 700; letter-spacing: .04em; user-select: all; }
@media (max-width: 900px) {
  .notif-text { display: none; }
  .notif { padding: .45rem; border: 0; }
  .order-facts { gap: .9rem; }
  .bulkbar { top: 52px; }
}
[dir=rtl] .order-facts dd.num { direction: ltr; unicode-bidi: isolate; }
.toast small { color: #c9dacd; }
#shop .check-list li { flex-wrap: wrap; align-items: center; }
@media (min-width: 901px) { .notif .notif-badge { display: none; } }
.complete-form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
details.crates-inline { position: relative; }
details.crates-inline summary { list-style: none; }
details.crates-inline summary::-webkit-details-marker { display: none; }
details.crates-inline[open] summary { background: var(--primary-soft); border-color: var(--primary); }
.crates-grid { position: absolute; bottom: calc(100% + .4rem); inset-inline-end: 0; z-index: 6; display: grid; grid-template-columns: 1fr 70px 70px; gap: .35rem .5rem; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: .7rem .8rem; box-shadow: 0 8px 24px rgba(0,0,0,.12); width: 330px; max-width: 85vw; }
.crates-grid input { padding: .3rem .4rem; text-align: center; }
.license-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .6rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.shop-pw textarea { width: 100%; font-size: .8rem; word-break: break-all; }

/* E-Mail-Modul */
.mail-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.mail-boxes { padding: .5rem; }
.mail-boxes a { display: flex; align-items: center; gap: .5rem; padding: .5rem .6rem; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .9rem; }
.mail-boxes a:hover { background: var(--surface-2); }
.mail-boxes a.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.mail-boxes .addr { display: block; font-size: .75rem; color: var(--muted); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-boxes .box-name { flex: 1; min-width: 0; }
.mail-list td { vertical-align: top; }
.mail-list tr.unread td { font-weight: 600; }
.mail-list tr.unread td.subj a { color: var(--text); }
.mail-list .subj { max-width: 0; width: 45%; }
.mail-list .subj a, .mail-list .subj .prev { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-list .prev { color: var(--muted); font-weight: 400; font-size: .82rem; }
.dir { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none; }
.dir .icon { width: 15px; height: 15px; }
.dir-in { background: var(--green-soft); color: var(--green); }
.dir-out { background: var(--blue-soft); color: var(--blue); }
.dir-label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.dir-label.in { color: var(--green); } .dir-label.out { color: var(--blue); }
.mail-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .25rem 1rem; margin: 0 0 1rem; font-size: .9rem; }
.mail-meta dt { color: var(--muted); }
.mail-meta dd { margin: 0; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; }
.mail-body { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; font-size: .95rem; line-height: 1.55; margin: 0; }
.mail-frame { width: 100%; min-height: 480px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.att-list { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.att-list li a { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 8px; font-size: .85rem; background: var(--surface-2); }
.att-list li.danger a { border-color: var(--red-line); background: var(--red-soft); }
.view-switch { display: inline-flex; gap: .25rem; }
.chain-hash { font-family: var(--mono); font-size: .8rem; overflow-wrap: anywhere; background: var(--surface-2); padding: .4rem .6rem; border-radius: 6px; }
.wizard-steps { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.wizard-steps span { padding: .35rem .8rem; border-radius: 99px; background: var(--grey-soft); color: var(--muted); font-size: .85rem; }
.wizard-steps span.on { background: var(--primary); color: #fff; }
.test-result { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .8rem; border-radius: 8px; margin-bottom: .5rem; }
.test-result.ok { background: var(--green-soft); } .test-result.bad { background: var(--red-soft); }
.partner-mails li { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.partner-mails li:last-child { border-bottom: 0; }
.partner-mails { list-style: none; margin: 0; padding: 0; }
.partner-mails .pm-main { flex: 1; min-width: 0; }
.partner-mails .pm-main a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 900px) { .mail-layout { grid-template-columns: 1fr; } .mail-list .subj { max-width: none; width: auto; } }

/* Analyse */
.analyse-form details summary, .saved-views summary { cursor: pointer; }
.analyse-table th.sorted, .analyse-table td.sorted { background: var(--primary-soft); }
.analyse-table thead th a { color: inherit; }
.analyse-table tfoot th { border-top: 2px solid var(--border); }
.crosstab td, .crosstab th { white-space: nowrap; }
.saved-views { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .65rem; border: 1px solid var(--border); border-radius: 99px; background: var(--surface-2); font-size: .85rem; }
.chip.on { border-color: var(--primary); background: var(--primary-soft); }
.chip-x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1rem; line-height: 1; padding: 0 .1rem; }
.inline-details { display: inline-block; }
.text-green { color: var(--green); font-weight: 600; }
@media print { .analyse-table { font-size: 10pt; } }

/* SQL-Abfragen */
.sql-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.sql-side h2 { font-size: 1rem; margin-top: .4rem; }
.sql-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.sql-list li { padding: .35rem .45rem; border-radius: 6px; display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; }
.sql-list li small { width: 100%; }
.sql-list li.on { background: var(--primary-soft); }
.sql-editor { font-size: .9rem; line-height: 1.45; tab-size: 2; white-space: pre; }
.sql-readonly { background: var(--surface-2); padding: .8rem; border-radius: 8px; overflow-x: auto; font-size: .85rem; }
.sql-result { max-height: 70vh; overflow: auto; }
.sql-result thead th { position: sticky; top: 0; background: var(--surface); }
.schema ul { margin: .2rem 0 .5rem 1rem; padding: 0; font-size: .8rem; list-style: none; }
.schema details summary { cursor: pointer; font-size: .85rem; }
@media (max-width: 900px) { .sql-layout { grid-template-columns: 1fr; } }
.analyse-table tfoot th { font-size: .9rem; text-transform: none; letter-spacing: 0; color: var(--text); font-weight: 700; }
.analyse-table td:first-child { min-width: 160px; }

/* ---------- Darstellung: Dunkelmodus, Farbschemata, Dichte, Schriftgröße (ab 1.6) ---------- */
html[data-theme=dunkel] {
  --bg: #121614; --surface: #1a1f1c; --surface-2: #202622; --border: #2c342f; --border-strong: #3d4740;
  --text: #e3e8e4; --muted: #9aa69e; --label: #c3ccc6; --input-bg: #151a17; --row-hover: #212824;
  --primary-soft: var(--primary-soft-dark); --link: var(--primary-light);
  --blue: #7fb0ea; --blue-soft: #1a2a3d; --blue-border: #2c4766; --blue-text: #b9d4f5;
  --green: #6fcf8e; --green-soft: #17301f; --green-border: #285c38; --green-text: #a9e4bb;
  --amber: #f0b64f; --amber-soft: #33270f; --amber-border: #5c4519; --amber-text: #f6d595;
  --red: #f08a7e; --red-soft: #3a1714; --red-border: #6b2a23; --red-text: #f7bab2; --red-line: #6b2a23;
  --grey: #a7b0aa; --grey-soft: #262d29;
  --plain-glow: #1d2a22; --code-bg: #0d110f; --sidebar: #0e1411; --sidebar-active: rgba(124,196,143,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html[data-theme=auto] {
    --bg: #121614; --surface: #1a1f1c; --surface-2: #202622; --border: #2c342f; --border-strong: #3d4740;
    --text: #e3e8e4; --muted: #9aa69e; --label: #c3ccc6; --input-bg: #151a17; --row-hover: #212824;
    --primary-soft: var(--primary-soft-dark); --link: var(--primary-light);
    --blue: #7fb0ea; --blue-soft: #1a2a3d; --blue-border: #2c4766; --blue-text: #b9d4f5;
    --green: #6fcf8e; --green-soft: #17301f; --green-border: #285c38; --green-text: #a9e4bb;
    --amber: #f0b64f; --amber-soft: #33270f; --amber-border: #5c4519; --amber-text: #f6d595;
    --red: #f08a7e; --red-soft: #3a1714; --red-border: #6b2a23; --red-text: #f7bab2; --red-line: #6b2a23;
    --grey: #a7b0aa; --grey-soft: #262d29;
    --plain-glow: #1d2a22; --code-bg: #0d110f; --sidebar: #0e1411; --sidebar-active: rgba(124,196,143,.14);
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
html[data-theme=dunkel] .qr, html[data-theme=dunkel] .mail-frame { background: #fff; }
/* Farbschemata (überschreiben die Firmenfarbe) */
html[data-scheme=gruen] { --primary: #23633f; --primary-hover: #1b4f32; --primary-soft: #e3f0e7; --sidebar: #163828; --sidebar-text: #c9dacd; --primary-light: #6fcf8e; --primary-soft-dark: #1b3527; }
html[data-scheme=blau] { --primary: #1f5fa6; --primary-hover: #194d87; --primary-soft: #e4eef9; --sidebar: #142a45; --sidebar-text: #c8d7ea; --primary-light: #8bb8f0; --primary-soft-dark: #1a2a3d; }
html[data-scheme=neutral] { --primary: #3f4a52; --primary-hover: #2f383e; --primary-soft: #e9ecee; --sidebar: #22282c; --sidebar-text: #cfd6da; --primary-light: #b6c2ca; --primary-soft-dark: #262d32; --accent: #6b8fb3; }
html[data-scheme=kontrast] { --primary: #0b3d22; --primary-hover: #062a17; --primary-soft: #d6eadc; --sidebar: #000; --sidebar-text: #fff; --text: #000; --muted: #2d3430; --border: #8a958d; --border-strong: #4a544d; --label: #000; --primary-light: #8ff0ac; --nav-group: #d0e8d6; --sidebar-foot: #d0e8d6; }
html[data-scheme=kontrast][data-theme=dunkel] { --text: #fff; --muted: #d5ddd8; --border: #5f6b63; --border-strong: #9aa69e; --label: #fff; --bg: #000; --surface: #0c0f0d; }
html[data-scheme=kontrast] a { text-decoration: underline; }
/* Dichte und Schriftgröße */
html[data-font=gross] { font-size: 17px; }
html[data-density=kompakt] { font-size: 14px; }
html[data-density=kompakt][data-font=gross] { font-size: 16px; }
html[data-density=kompakt] td, html[data-density=kompakt] th { padding-top: .35rem; padding-bottom: .35rem; }
html[data-density=kompakt] .card { padding: .9rem 1rem; }
html[data-density=kompakt] .content { padding: 1rem; }
html[data-density=kompakt] .grid { gap: .8rem; }
/* Konto: Auswahlfelder */
.choice-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.choice { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .75rem; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-weight: 450; background: var(--surface-2); }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.swatch { width: 22px; height: 16px; border-radius: 4px; border: 1px solid var(--border-strong); display: inline-block; }
.swatch-auto { background: linear-gradient(90deg, #f4f5f0 50%, #121614 50%); }
.swatch-hell { background: #f4f5f0; } .swatch-dunkel { background: #121614; }
.scheme-firma { background: var(--primary); } .scheme-gruen { background: #23633f; } .scheme-blau { background: #1f5fa6; } .scheme-neutral { background: #3f4a52; } .scheme-kontrast { background: linear-gradient(90deg, #000 50%, #fff 50%); }
/* Erscheinungsbild (Administration) */
.color-pick { display: flex; gap: .5rem; align-items: center; }
.color-pick input[type=color] { width: 48px; height: 38px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--input-bg); }
.brand-preview { display: grid; grid-template-columns: 160px 1fr; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; min-height: 110px; }
.pv-side { background: var(--pv-sidebar); color: #fff; padding: .8rem; display: flex; gap: .5rem; align-items: flex-start; font-size: .85rem; }
.pv-side small { display: block; color: var(--pv-text); font-size: .7rem; }
.pv-side img { width: auto; max-width: 70px; height: 28px; border-radius: 6px; background: rgba(255,255,255,.1); object-fit: contain; }
.pv-main { padding: .9rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: var(--surface); }
.pv-btn { background: var(--pv-primary); color: #fff; padding: .4rem .8rem; border-radius: 8px; font-size: .85rem; }
.pv-badge { background: var(--pv-soft); color: var(--pv-primary); padding: .15rem .5rem; border-radius: 99px; font-size: .75rem; font-weight: 600; }
.pv-main a { color: var(--pv-primary); text-decoration: underline; }
/* Profilmenü */
.profile { position: relative; margin-inline-start: auto; }
.notif + .profile { margin-inline-start: 0; }
.profile > summary { list-style: none; display: flex; align-items: center; gap: .55rem; padding: .25rem .5rem; border-radius: 8px; cursor: pointer; color: var(--text); }
.profile > summary::-webkit-details-marker { display: none; }
.profile > summary:hover, .profile[open] > summary { background: var(--surface-2); }
.profile .chev { width: 14px; height: 14px; color: var(--muted); }
.profile-menu { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); z-index: 70; width: 260px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); padding: .4rem; }
.profile-menu .pm-head { padding: .6rem .7rem .7rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.profile-menu .pm-head strong { display: block; }
.profile-menu .pm-head small { color: var(--muted); }
.profile-menu a, .profile-menu button { display: flex; align-items: center; gap: .6rem; width: 100%; padding: .55rem .7rem; border-radius: 8px; color: var(--text); background: none; border: 0; font: inherit; text-align: start; cursor: pointer; }
.profile-menu a:hover, .profile-menu button:hover, .profile-menu a:focus-visible, .profile-menu button:focus-visible { background: var(--surface-2); text-decoration: none; outline: none; }
.profile-menu hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }
.profile-menu .pm-logout { color: var(--red); }
.profile-menu .pm-theme { display: flex; gap: .25rem; padding: .3rem .7rem .5rem; }
.profile-menu .pm-theme button { flex: 1; justify-content: center; padding: .35rem; border: 1px solid var(--border); font-size: .8rem; }
.profile-menu .pm-theme button.on { border-color: var(--primary); background: var(--primary-soft); }
.brand img.brand-logo { object-fit: contain; border-radius: 6px; }
@media print { html[data-theme] { --bg: #fff; --surface: #fff; --text: #000; --muted: #444; --border: #ccc; } }
/* Artikelfotos */
.photo-grid { list-style: none; margin: 0 0 .8rem; padding: 0; display: flex; flex-wrap: wrap; gap: .8rem; }
.photo-grid li { position: relative; width: 150px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.photo-grid li.dragging { opacity: .4; }
.photo-grid li.over { outline: 2px dashed var(--primary); }
.photo-grid img { display: block; width: 150px; height: 120px; object-fit: cover; background: #fff; }
.photo-main { position: absolute; top: 6px; inset-inline-start: 6px; }
.photo-actions { display: flex; gap: .25rem; padding: .35rem; justify-content: center; }
.photo-actions .btn-sm { padding: .15rem .5rem; min-height: 26px; }
.brand img.brand-logo { width: auto; max-width: 120px; height: 30px; }
.plain-brand img.brand-logo { width: auto; max-width: 180px; height: 40px; }

/* 1.7: Sortieren und Filtern in Spaltenköpfen */
.th-in { display: inline-flex; align-items: center; gap: .25rem; }
th.num .th-in { flex-direction: row-reverse; }
.th-sort { color: inherit; display: inline-flex; align-items: center; gap: .3rem; }
.th-sort:hover { color: var(--text); text-decoration: none; }
.sort-ic { width: 7px; height: 11px; fill: currentColor; }
.sort-ic path { opacity: .28; }
.th-sort.on { color: var(--primary); }
.th-sort.on.asc .sort-ic .up, .th-sort.on.desc .sort-ic .down { opacity: 1; }
.th-sort:hover .sort-ic path { opacity: .6; }
.th-f { position: relative; display: inline-block; }
.th-f > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; color: var(--muted); opacity: .55; }
.th-f > summary::-webkit-details-marker { display: none; }
th:hover .th-f > summary, .th-f[open] > summary, .th-f > summary:focus-visible { opacity: 1; }
.th-f > summary:hover { background: var(--surface); }
.th-f > summary svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.th-f.on > summary { opacity: 1; color: var(--primary); background: var(--primary-soft); }
.th-f.on > summary svg { fill: currentColor; }
.th-pop { position: absolute; top: 100%; inset-inline-start: 0; z-index: 40; margin-top: 4px; min-width: 230px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18); padding: .7rem; display: grid; gap: .5rem; text-transform: none; letter-spacing: normal; font-size: .9rem; font-weight: 400; color: var(--text); white-space: normal; }
.th-pop strong { font-size: .8rem; color: var(--muted); }
.th-pop input, .th-pop select { width: 100%; }
.th-range { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.th-range label { display: grid; gap: .15rem; font-size: .78rem; color: var(--muted); }
.th-act { display: flex; gap: .4rem; justify-content: flex-end; }
.filter-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: -.3rem 0 .8rem; font-size: .88rem; }
.fchip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; background: var(--primary-soft); color: var(--primary); border: 1px solid transparent; }
.fchip:hover { border-color: var(--primary); text-decoration: none; }
.fchip span { font-weight: 700; }
.fchip-reset { font-size: .82rem; margin-inline-start: .3rem; }
.tsort-empty td { text-align: center; color: var(--muted); font-style: italic; }
@media print { .th-f, .sort-ic, .filter-chips { display: none !important; } }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
.card .filter-chips { margin: 0; padding: .7rem .9rem .1rem; }
.days { font-weight: 600; }
.days-green { color: var(--green, #2f7d4a); }
.days-amber { color: var(--amber, #a86400); }
.days-red { color: var(--red, #b42318); }
.lic-table td:first-child { min-width: 200px; max-width: 300px; }
.lic-table .badge { white-space: nowrap; }
/* 1.7: anklickbare Kacheln */
a.card.stat { position: relative; transition: border-color .15s, box-shadow .15s, transform .15s; }
a.card.stat:hover, a.card.stat:focus-visible { border-color: var(--primary); box-shadow: 0 4px 14px rgba(0, 0, 0, .08); }
a.card.stat > .label::after { content: '→'; margin-inline-start: auto; opacity: .0; transition: opacity .15s, transform .15s; color: var(--primary); }
a.card.stat:hover > .label::after, a.card.stat:focus-visible > .label::after { opacity: 1; transform: translateX(2px); }
[dir=rtl] a.card.stat > .label::after { content: '←'; }
@media (hover: none) { a.card.stat > .label::after { opacity: .6; } }
.stat .hint a { position: relative; z-index: 1; }
.subtabs { display: flex; flex-wrap: wrap; gap: .3rem; margin: -.4rem 0 1rem; }
.subtabs a { padding: .35rem .8rem; border-radius: 999px; color: var(--muted); border: 1px solid var(--border); background: var(--surface); font-size: .9rem; }
.subtabs a:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }
.subtabs a.active { background: var(--primary-soft); color: var(--primary); border-color: transparent; font-weight: 600; }
/* 1.7: Diagramme (SVG) */
.chart-wrap { position: relative; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .ch-grid { stroke: var(--border); stroke-width: 1; }
.chart .ch-base { stroke: var(--border-strong, var(--muted)); stroke-width: 1; }
.chart .ch-ax { fill: var(--muted); font-size: 11px; font-family: inherit; }
.chart .ch-bar { fill: var(--primary); }
.chart .ch-area { fill: var(--primary); opacity: .12; }
.chart .ch-line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .ch-dot, .chart .ch-focus { fill: var(--primary); stroke: var(--surface); stroke-width: 2; }
.chart .ch-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .ch-hit { fill: transparent; cursor: crosshair; }
.chart .ch-hit.on + .ch-hit, .chart .ch-bar { transition: opacity .1s; }
.ch-tip { position: absolute; pointer-events: none; background: var(--text); color: var(--surface); font-size: .82rem; padding: .35rem .6rem; border-radius: 6px; white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); box-shadow: 0 4px 12px rgba(0, 0, 0, .2); z-index: 5; }
.chart-card h2 { margin-bottom: .1rem; }
.chart-card > .muted { margin-top: 0; font-size: .88rem; }
.share-bar { display: block; height: 4px; border-radius: 2px; background: var(--primary); width: var(--w); margin-top: .25rem; margin-inline-start: auto; opacity: .7; }
.period-form .field input[type=date] { min-width: 9.5rem; }
.contact-row { padding: .5rem 0; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.contact-row > div:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.contact-act { display: flex; align-items: flex-start; gap: .2rem; flex: none; }
.inline-edit > summary { list-style: none; }
.inline-edit > summary::-webkit-details-marker { display: none; }
.inline-edit[open] { flex-basis: 100%; order: 3; }
.contact-row:has(.inline-edit[open]) .contact-act { flex-basis: 100%; flex-direction: column; }
.addr-chips { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .4rem; font-size: .85rem; }
.addr-chips .fchip { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); cursor: pointer; font: inherit; }
.addr-chips .fchip.on { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }
.trend { font-weight: 600; white-space: nowrap; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
a.card.stat.on { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.code-preview { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: .7rem .9rem; margin-bottom: .8rem; }
.code-preview ul { margin: .3rem 0 0; padding-inline-start: 1.1rem; }
.code-preview.warn { border-color: var(--amber); background: var(--amber-soft); }
.check-steps { list-style: none; padding: 0; margin: .2rem 0 1rem; }
.check-steps li { padding: .2rem 0; }
.check-steps li.ok { color: var(--green); }
.check-steps li.bad { color: var(--red); }
ol.steps > li { margin-bottom: 1rem; }
.btn.disabled { opacity: .5; pointer-events: none; }

/* 1.8: E-Mail – Lesebereich und eigenes Fenster */
.pane-switch { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; margin: 0 0 .6rem; font-size: .85rem; }
.pane-switch button { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: .15rem .65rem; cursor: pointer; font: inherit; }
.pane-switch button.on { background: var(--primary-soft); color: var(--primary); border-color: transparent; font-weight: 600; }
.pane-switch .hint-dbl { margin-inline-start: auto; font-size: .78rem; }
.mail-splitter, .mail-pane { display: none; }
@media (min-width: 900px) {
  .mail-split[data-pane=rechts] { display: grid; grid-template-columns: minmax(0, 1fr) 8px minmax(280px, var(--pane-size)); align-items: start; }
  .mail-split[data-pane=unten] { display: grid; grid-template-rows: minmax(120px, 1fr) 8px minmax(140px, var(--pane-size)); height: calc(100vh - 250px); min-height: 520px; }
  .mail-split[data-pane=unten] .mail-split-list { overflow: auto; min-height: 0; }
  .mail-split[data-pane=unten] .mail-split-list .card { margin-bottom: .4rem; }
  .mail-split:not([data-pane=aus]) .mail-splitter, .mail-split:not([data-pane=aus]) .mail-pane { display: block; }
  .mail-split[data-pane=rechts] .mail-pane { position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow: auto; margin: 0; }
  .mail-split[data-pane=unten] .mail-pane { overflow: auto; margin: 0; min-height: 0; }
  .mail-splitter { border-radius: 4px; position: relative; cursor: col-resize; touch-action: none; }
  .mail-split[data-pane=rechts] .mail-splitter { align-self: stretch; min-height: 200px; }
  .mail-split[data-pane=unten] .mail-splitter { cursor: row-resize; }
  .mail-splitter::after { content: ''; position: absolute; inset: 0; margin: auto; background: var(--border-strong, var(--border)); border-radius: 2px; }
  .mail-split[data-pane=rechts] .mail-splitter::after { width: 3px; height: 48px; top: 40vh; bottom: auto; }
  .mail-split[data-pane=unten] .mail-splitter::after { height: 3px; width: 48px; }
  .mail-splitter:hover::after, .mail-splitter:focus-visible::after, .mail-splitter.drag::after { background: var(--primary); }
  .mail-split.dragging, .mail-split.dragging * { user-select: none; cursor: inherit; }
  .mail-split[data-pane=rechts] .mail-list th:nth-child(4) { display: none; }
  .mail-list tr.sel td { background: var(--primary-soft); }
  .mail-list tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
}
.pane-empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.pane-empty .icon { width: 40px; height: 40px; opacity: .4; }
.pane-head { border-bottom: 1px solid var(--border); padding-bottom: .6rem; margin-bottom: .8rem; }
.pane-subject { font-size: 1.15rem; margin: .5rem 0 .2rem; display: flex; gap: .4rem; align-items: flex-start; }
.pane-tools, .win-menu { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }
.pane-tools .spacer { flex: 1; }
.pane-tools form, .win-menu form { display: contents; }
.mbtn { display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .6rem; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; cursor: pointer; line-height: 1.2; }
.mbtn:hover { border-color: var(--primary); text-decoration: none; }
.mbtn .icon { width: 16px; height: 16px; }
.mbtn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.mbtn.danger { color: var(--red); }
.mbtn.disabled { opacity: .4; pointer-events: none; }
.mail-pane .mail-body { max-height: none; }
@container (max-width: 420px) { .hide-narrow { display: none; } }
.mail-pane { container-type: inline-size; }
body.window { background: var(--bg); }
.window-main { max-width: 1100px; margin: 0 auto; padding: 0 1rem 2rem; }
.win-menu { position: sticky; top: 0; z-index: 30; background: var(--surface); border-bottom: 1px solid var(--border); padding: .5rem 1rem; margin: 0 -1rem 1rem; box-shadow: 0 2px 8px rgba(0, 0, 0, .05); }
.win-menu .grp { display: flex; gap: .25rem; align-items: center; padding-inline-end: .5rem; margin-inline-end: .25rem; border-inline-end: 1px solid var(--border); }
.win-menu .grp:last-child { border: 0; }
.win-menu .grp.end { margin-inline-start: auto; }
.win-subject { font-size: 1.35rem; display: flex; gap: .5rem; align-items: flex-start; margin: .2rem 0 .3rem; }
.mdrop { position: relative; }
.mdrop > summary { list-style: none; }
.mdrop > summary::-webkit-details-marker { display: none; }
.mdrop-pop { position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 40; width: min(380px, 90vw); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .18); padding: .8rem; }
.mdrop-pop .card { border: 0; box-shadow: none; padding: 0; margin: 0; }
@media print { .win-menu, .pane-switch { display: none !important; } }
.mail-pane.loading { opacity: .55; transition: opacity .15s; }
@media (min-width: 900px) {
  /* Liste neben dem Lesebereich: zweizeilig wie in Mailprogrammen (Absender + Datum, darunter Betreff) */
  .mail-split[data-pane=rechts] .mail-list thead tr { display: flex; flex-wrap: wrap; gap: 0 .6rem; padding: .3rem .6rem; background: var(--surface-2); }
  .mail-split[data-pane=rechts] .mail-list thead th { display: block; border: 0; padding: .25rem 0; background: none; }
  .mail-split[data-pane=rechts] .mail-list thead th:first-child:empty { display: none; }
  .mail-split[data-pane=rechts] .mail-list tbody tr { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; column-gap: .4rem; padding: .45rem .6rem; border-bottom: 1px solid var(--border); cursor: pointer; }
  .mail-split[data-pane=rechts] .mail-list tbody td { border: 0; padding: 0; }
  .mail-split[data-pane=rechts] .mail-list tbody td:nth-child(1) { grid-row: span 2; }
  .mail-split[data-pane=rechts] .mail-list tbody td:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mail-split[data-pane=rechts] .mail-list tbody td:nth-child(2) br, .mail-split[data-pane=rechts] .mail-list tbody td:nth-child(2) small { display: none; }
  .mail-split[data-pane=rechts] .mail-list tbody td:nth-child(5) { grid-column: 3; grid-row: 1; font-size: .78rem; color: var(--muted); }
  .mail-split[data-pane=rechts] .mail-list tbody td.subj { grid-column: 2 / span 2; max-width: none; width: auto; }
  .mail-split[data-pane=rechts] .mail-list tbody td.empty { display: block; grid-column: 1 / -1; }
  .mail-split[data-pane=rechts] .mail-list tbody td:nth-child(4) { grid-column: 2 / span 2; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mail-split[data-pane=rechts] .mail-list tbody td:nth-child(4) .muted { display: none; }
  .mail-split[data-pane=rechts] .mail-list tr.sel { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
  .mail-split[data-pane=rechts] .mail-list tr.sel td { background: none; box-shadow: none; }
}

/* 1.8 Rechtliches */
.legal-links { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; font-size: .85rem; }
.legal-links a { color: var(--muted); }
.sidebar-foot a { color: inherit; }
.legal { max-width: 46rem; line-height: 1.55; }
.legal h1 { margin-bottom: 1rem; }
.legal h2 { font-size: 1.1rem; margin: 1.4rem 0 .4rem; }
.legal ul { padding-inline-start: 1.3rem; }
.legal-back { margin-top: 2rem; }
.help-btn { width: 34px; height: 34px; justify-content: center; align-items: center; border: 1px solid var(--border); border-radius: 999px; font-weight: 700; font-size: 1rem; text-decoration: none; flex: none; }
.topbar .search + .help-btn { margin-inline-start: auto; }
.help-btn + .profile { margin-inline-start: 0; }
.doc :target { scroll-margin-top: 1rem; animation: help-hl 2.4s ease-out; }
@keyframes help-hl { from { background: var(--primary-soft); } to { background: transparent; } }
.field.s1 { grid-column: span 1; } .field.s10 { grid-column: span 10; }
@media (max-width: 760px) { .field.s1, .field.s10 { grid-column: span 12; } }

/* 1.8 Einrichtung & Erste Schritte */
.wizard-steps { list-style: none; display: flex; gap: .5rem; padding: 0; margin: 0 0 1rem; flex-wrap: wrap; }
.wizard-steps a { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .9rem .45rem .5rem; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); text-decoration: none; font-weight: 550; }
.wizard-steps b { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--surface-2); color: var(--text); font-size: .85rem; }
.wizard-steps .on a { border-color: var(--primary); color: var(--text); }
.wizard-steps .on b, .wizard-steps .done b { background: var(--primary); color: #fff; }
.wizard-card { max-width: 920px; }
.form-actions { display: flex; gap: .6rem; align-items: center; margin-top: 1.2rem; flex-wrap: wrap; }
.btn-link { background: none; border-color: transparent; color: var(--muted); }
.checklist { list-style: none; padding: 0; margin: .4rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .5rem; }
.checklist a { display: flex; gap: .7rem; align-items: flex-start; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; height: 100%; }
.checklist a:hover { border-color: var(--primary); background: var(--surface-2); }
.checklist small { display: block; color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.checklist .ck { flex: none; width: 1.35rem; height: 1.35rem; border-radius: 50%; border: 2px solid var(--border-strong); display: inline-grid; place-items: center; margin-top: .1rem; }
.checklist .done .ck { background: var(--primary); border-color: var(--primary); color: #fff; }
.checklist .ck .icon { width: 14px; height: 14px; stroke-width: 3; }
.checklist .done strong { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.checklist-progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.checklist-progress span { display: block; height: 100%; width: var(--p); background: var(--primary); }
.onboarding .card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.admin-quick { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }

/* 1.8 Update & Neuigkeiten */
.news-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.news-list li { display: flex; gap: .7rem; align-items: baseline; line-height: 1.45; }
.news-kind { flex: none; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .12rem .45rem; border-radius: 6px; background: var(--surface-2); color: var(--muted); min-width: 5.5rem; text-align: center; }
.news-neu { background: var(--primary-soft); color: var(--primary); }
.news-behoben { background: #fdeccf; color: #8a5a00; }
.news-new { border-color: var(--primary); }
.news-banner { display: flex; align-items: center; gap: .8rem; padding: .6rem .9rem; margin-bottom: 1rem; border-radius: 10px; background: var(--primary-soft); border: 1px solid var(--primary); }
.news-banner a.go { font-weight: 600; }
.news-banner form { margin-inline-start: auto; }
details.inline-confirm { display: inline-block; }
details.inline-confirm > summary { list-style: none; }
details.inline-confirm[open] > form { margin-top: .5rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; max-width: 380px; text-align: start; }

/* 1.8 Standardaufträge */
.weekday-pick { display: flex; gap: .4rem; flex-wrap: wrap; }
.weekday-pick label { cursor: pointer; }
.weekday-pick input { position: absolute; opacity: 0; pointer-events: none; }
.weekday-pick span { display: inline-grid; place-items: center; min-width: 2.8rem; padding: .45rem .6rem; border: 1px solid var(--border-strong); border-radius: 8px; font-weight: 600; }
.weekday-pick input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.weekday-pick input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.lines-mini td { padding: .3rem .4rem; }
.lines-mini select { width: 100%; }
.lines-mini .col-qty { width: 8rem; }
.plain-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .35rem; }
.copy-links { display: flex; gap: .8rem; flex-wrap: wrap; }
.table.compact th, .table.compact td { padding: .3rem .5rem; font-size: .85rem; } .table.compact th { text-align: start; white-space: nowrap; }

/* 1.8 Bank, Mahnwesen */
.bank-upload { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.bank-upload > div { display: flex; flex-direction: column; gap: .3rem; flex: 1; min-width: 260px; }
.bank-upload label { font-weight: 600; display: flex; align-items: center; gap: .4rem; }
.bank-purpose { color: var(--muted); max-width: 46ch; overflow-wrap: anywhere; }
.bank-table td { vertical-align: top; }
.bank-table .pos { color: var(--green); font-weight: 600; }
.bank-table .neg { color: var(--muted); }
.bank-act { min-width: 300px; }
.bank-suggest { display: flex; gap: .6rem; align-items: flex-start; justify-content: space-between; margin-bottom: .3rem; }
.bank-manual select { width: 100%; margin: .3rem 0; }
.bank-manual form { display: grid; gap: .3rem; }
.tab-count { display: inline-block; min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--surface-2); font-size: .75rem; text-align: center; }
.muted-row td { color: var(--muted); }
.check-col { width: 2rem; }
form.inline { display: inline; }
.linkbtn { background: none; border: 0; color: var(--primary); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* 1.8 Lager-App (Tablet/Smartphone) */
body.mobile-app { background: var(--bg); min-height: 100vh; font-size: 17px; }
.m-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; padding-top: max(.7rem, env(safe-area-inset-top)); background: var(--sidebar); color: #fff; }
.m-top strong { font-size: 1.1rem; flex: 1; }
.m-top .m-user { font-size: .85rem; opacity: .8; }
.m-back { color: #fff; display: inline-flex; padding: .3rem; border-radius: 8px; }
.m-back .icon { width: 26px; height: 26px; }
.m-main { max-width: 760px; margin: 0 auto; padding: 1rem; padding-bottom: 3rem; }
.m-tiles { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.m-tile { display: grid; gap: .3rem; padding: 1.4rem 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; color: var(--text); text-decoration: none; }
.m-tile .icon { width: 36px; height: 36px; color: var(--primary); }
.m-tile strong { font-size: 1.25rem; }
.m-tile small { color: var(--muted); }
.m-tile:active { transform: scale(.98); }
.m-hint { color: var(--muted); margin-top: 1rem; }
.m-form { display: grid; gap: .6rem; }
.m-form h2 { margin: 1rem 0 0; font-size: 1.1rem; }
.m-form input, .m-form select { font-size: 1.05rem; min-height: 48px; }
.m-two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.m-two > div { display: grid; gap: .3rem; }
.m-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.m-three label { display: grid; gap: .2rem; font-size: .8rem; }
@media (max-width: 520px) { .m-three { grid-template-columns: 1fr 1fr; } }
.m-scan-row { display: flex; gap: .5rem; }
.m-scan-row input { flex: 1; font-size: 1.1rem; min-height: 52px; }
.m-cam { min-width: 56px; min-height: 52px; }
.m-cam .icon { width: 26px; height: 26px; }
.m-video { position: relative; margin-top: .6rem; border-radius: 12px; overflow: hidden; background: #000; }
.m-video video { width: 100%; max-height: 50vh; display: block; object-fit: cover; }
.m-video .btn { position: absolute; bottom: .6rem; inset-inline-end: .6rem; }
.m-results { display: grid; gap: .4rem; margin-top: .6rem; }
.m-result { display: grid; gap: .15rem; text-align: start; padding: .8rem 1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font: inherit; color: var(--text); cursor: pointer; }
.m-result small { color: var(--muted); }
.m-lots { margin: 0 0 .4rem; padding: .5rem 1rem .5rem 2rem; background: var(--surface-2); border-radius: 10px; font-size: .9rem; }
.m-lines { display: grid; gap: .6rem; margin: .4rem 0 1rem; }
.m-line { padding: .8rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); display: grid; gap: .5rem; }
.m-line-h { display: flex; gap: .5rem; align-items: baseline; }
.m-line-h .icon-btn { margin-inline-start: auto; font-size: 1.4rem; }
.m-big { min-height: 56px; font-size: 1.1rem; }
.m-seg { display: flex; gap: .4rem; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; }
.m-seg a { padding: .55rem 1rem; border: 1px solid var(--border); border-radius: 999px; color: var(--text); text-decoration: none; font-weight: 600; }
.m-seg a.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.m-seg form { margin-inline-start: auto; }
.m-list { display: grid; gap: .5rem; }
.m-item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; }
.m-item small { display: block; color: var(--muted); }
.m-item.done { border-color: var(--green); }
.m-prog { display: inline-flex; align-items: center; gap: .4rem; font-size: 1.1rem; }
.m-prog .icon { color: var(--green); }
.m-head { display: grid; gap: .2rem; margin-bottom: .8rem; }
.m-head strong { font-size: 1.2rem; }
.m-head small { color: var(--muted); }
.m-progress { margin: .8rem 0 .4rem; font-weight: 600; }
.m-pick { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.m-pick li { display: grid; grid-template-columns: 56px 6.5rem 1fr; gap: .6rem; align-items: center; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.m-pick li.done { background: var(--green-soft); border-color: var(--green); }
.m-pick li.done .m-name { text-decoration: line-through; color: var(--muted); }
.m-check { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--border-strong); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: transparent; }
.m-pick li.done .m-check { background: var(--green); border-color: var(--green); color: #fff; }
.m-check .icon { width: 26px; height: 26px; stroke-width: 3; }
.m-qty { font-size: 1.25rem; font-weight: 700; text-align: end; }
.m-qty small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.m-name small { display: block; color: var(--muted); font-size: .8rem; }
.m-actions { display: grid; gap: .6rem; }
.sig-pad { position: relative; border: 2px dashed var(--border-strong); border-radius: 12px; background: #fff; touch-action: none; }
.sig-pad canvas { width: 100%; height: auto; aspect-ratio: 900 / 360; display: block; touch-action: none; cursor: crosshair; border-radius: 10px; }
.sig-line { position: absolute; left: 6%; right: 6%; bottom: 18%; border-top: 1px solid #9aa; font-size: .75rem; color: #789; padding-top: .2rem; pointer-events: none; }

/* 1.8 Befehlspalette */
.palette { position: fixed; inset: 0; z-index: 200; background: rgba(10, 20, 14, .45); display: none; align-items: flex-start; justify-content: center; padding: 10vh 1rem 1rem; }
.palette.open { display: flex; }
.palette-box { width: 100%; max-width: 620px; background: var(--surface); border-radius: 14px; box-shadow: 0 24px 60px rgba(0,0,0,.35); overflow: hidden; border: 1px solid var(--border); }
.palette-input { width: 100%; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; padding: 1rem 1.1rem; font-size: 1.1rem; background: transparent; color: var(--text); }
.palette-input:focus { outline: none; box-shadow: none; }
.palette-list { list-style: none; margin: 0; padding: .35rem; max-height: 55vh; overflow-y: auto; }
.palette-list li[data-i] { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem .75rem; border-radius: 8px; cursor: pointer; }
.palette-list li[data-i] small { color: var(--muted); white-space: nowrap; }
.palette-list li.on { background: var(--primary-soft); }
.palette-group { padding: .5rem .75rem .2rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.palette-empty { padding: 1rem; color: var(--muted); text-align: center; }
.palette-all span { color: var(--primary); font-weight: 600; }
.palette-foot { padding: .45rem .9rem; border-top: 1px solid var(--border); font-size: .75rem; color: var(--muted); }
.inline-search { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; } .inline-search select { flex: 1; min-width: 240px; }

/* 1.8 Seitenleiste: anpinnen oder automatisch ausblenden */
.sb-pin { position: absolute; top: .9rem; inset-inline-end: .5rem; background: none; border: 0; color: var(--sidebar-text); opacity: .55; padding: .3rem; border-radius: 6px; cursor: pointer; display: inline-flex; }
.sb-pin .icon { width: 17px; height: 17px; transition: transform .15s; }
.sb-pin:hover, .sb-pin:focus-visible { opacity: 1; background: rgba(255,255,255,.08); }
.sb-pin[aria-pressed=false] .icon { transform: rotate(45deg); }
.brand { padding-inline-end: 2.4rem; }
@media (min-width: 861px) {
  html[data-sidebar=auto] .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: 60px; z-index: 60; overflow-x: hidden; transition: width .18s ease, box-shadow .18s; }
  html[data-sidebar=auto] .main { margin-inline-start: 60px; }
  html[data-sidebar=auto] .sidebar:not(:hover):not(:focus-within) .brand span,
  html[data-sidebar=auto] .sidebar:not(:hover):not(:focus-within) nav a span,
  html[data-sidebar=auto] .sidebar:not(:hover):not(:focus-within) .nav-count,
  html[data-sidebar=auto] .sidebar:not(:hover):not(:focus-within) .sidebar-foot,
  html[data-sidebar=auto] .sidebar:not(:hover):not(:focus-within) .sb-pin { display: none; }
  html[data-sidebar=auto] .sidebar:not(:hover):not(:focus-within) .nav-group { font-size: 0; margin: .7rem .6rem .3rem; border-top: 1px solid rgba(255,255,255,.12); }
  html[data-sidebar=auto] .sidebar:not(:hover):not(:focus-within) .brand { padding-inline: 15px; }
  html[data-sidebar=auto] .sidebar:not(:hover):not(:focus-within) nav { padding-inline: .45rem; }
  html[data-sidebar=auto] .sidebar:not(:hover):not(:focus-within) nav a { justify-content: center; padding-inline: 0; }
  html[data-sidebar=auto] .sidebar:hover, html[data-sidebar=auto] .sidebar:focus-within { width: 240px; box-shadow: 0 0 34px rgba(0,0,0,.28); }
  html[data-sidebar=auto] .sidebar nav a, html[data-sidebar=auto] .brand { white-space: nowrap; }
}
@media (max-width: 860px) { .sb-pin { display: none; } }

/* 1.8 Logo-Editor */
.cropper { position: fixed; inset: 0; z-index: 210; background: rgba(10, 20, 14, .55); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.cropper-box { background: var(--surface); border-radius: 14px; padding: 1.2rem 1.4rem; box-shadow: 0 24px 60px rgba(0,0,0,.35); max-width: 100%; }
.cropper-box h2 { margin: 0 0 .8rem; font-size: 1.1rem; }
.cropper-stage { position: relative; margin: 0 auto; user-select: none; touch-action: none; background: repeating-conic-gradient(#e8e8e8 0% 25%, #fff 0% 50%) 50% / 16px 16px; cursor: crosshair; }
.cropper-stage canvas { display: block; }
.crop-rect { position: absolute; border: 2px solid #fff; outline: 1px solid rgba(0,0,0,.6); box-shadow: 0 0 0 9999px rgba(0,0,0,.45); cursor: move; }
.crop-rect:focus-visible { outline: 2px solid var(--primary); }
.crop-rect .h { position: absolute; width: 14px; height: 14px; background: #fff; border: 1px solid #333; border-radius: 3px; }
.crop-rect .nw { left: -8px; top: -8px; cursor: nwse-resize; } .crop-rect .ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-rect .sw { left: -8px; bottom: -8px; cursor: nesw-resize; } .crop-rect .se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.cropper-tools { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; margin-top: .8rem; }
.cropper-prev-wrap { margin-inline-start: auto; border: 1px solid var(--border); border-radius: 8px; background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 12px 12px; display: inline-flex; }
.crop-note { font-size: .82rem; color: var(--primary); }

/* 1.8 Analyse: Drilldowns */
.bars a.bar { text-decoration: none; color: inherit; border-radius: 4px; }
.bars a.bar:hover span.b, .bars a.bar:focus-visible span.b { background: var(--primary-hover); box-shadow: 0 0 0 2px var(--primary-soft); }
.stat .go { display: block; margin-top: .35rem; font-size: .78rem; color: var(--primary); }
.filter-chips { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: 0 0 1rem; }
.filter-chips a.chip { color: var(--text); text-decoration: none; }
.filter-chips a.chip:hover { border-color: var(--red); }
.drill-cell { display: flex; align-items: center; gap: .3rem; }
.row-menu { position: relative; margin-inline-start: auto; }
.row-menu > summary { list-style: none; cursor: pointer; padding: 0 .45rem; border-radius: 6px; color: var(--muted); font-weight: 700; line-height: 1.4; }
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu > summary:hover, .row-menu[open] > summary { background: var(--surface-2); color: var(--text); }
.row-menu-pop { position: absolute; z-index: 40; inset-inline-start: 0; top: calc(100% + 4px); min-width: 250px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.18); padding: .35rem; display: grid; }
.row-menu-pop strong { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: .35rem .6rem .2rem; }
.row-menu-pop a { padding: .4rem .6rem; border-radius: 6px; color: var(--text); text-decoration: none; font-weight: 400; }
.row-menu-pop a:hover { background: var(--surface-2); }
.row-menu-pop hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }
.crosstab .cell-link { color: inherit; text-decoration: none; display: block; }
.crosstab .cell-link:hover { text-decoration: underline; }


/* 1.8.1 Pfadleiste (horizontale Navigation): jede Ebene eine Schaltfläche */
.crumbs { display: flex; align-items: center; gap: .5rem; margin: -.2rem 0 1rem; }
.crumbs ol { list-style: none; display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; margin: 0; padding: 0; min-width: 0; }
.crumbs li { display: flex; align-items: center; gap: .25rem; min-width: 0; }
.crumb { display: inline-flex; align-items: center; gap: .4rem; height: 34px; padding: 0 .85rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .88rem; font-weight: 550; text-decoration: none; white-space: nowrap; max-width: 280px; box-shadow: 0 1px 2px rgba(0,0,0,.04); transition: background .12s, border-color .12s, transform .08s; }
.crumb > span { overflow: hidden; text-overflow: ellipsis; }
.crumb .icon { width: 16px; height: 16px; color: var(--primary); flex: none; }
a.crumb:hover { background: var(--primary-soft); border-color: var(--primary); text-decoration: none; }
a.crumb:active { transform: translateY(1px); }
a.crumb:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.crumb.current { background: var(--primary); border-color: var(--primary); color: #fff; }
.crumb.current .icon { color: #fff; }
.crumb.plain { color: var(--muted); }
.crumb-sep { display: inline-flex; color: var(--muted); }
.crumb-sep .icon { width: 14px; height: 14px; }
[dir=rtl] .crumb-sep .icon { transform: scaleX(-1); }
.crumb-up { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--sidebar); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.crumb-up:hover { filter: brightness(1.15); text-decoration: none; }
.crumb-up .icon { width: 18px; height: 18px; }
.has-crumbs .page-head .breadcrumb { display: none; }
@media (max-width: 860px) {
  .crumbs { min-width: 0; }
  .crumbs ol { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; flex: 1; }
  .crumbs li { flex: none; }
  .crumb { height: 32px; padding: 0 .7rem; max-width: 200px; }
}
@media print { .crumbs { display: none; } }
