:root {
  --ink: #14213d;
  --ink-2: #2b3a5c;
  --accent: #fca311;
  --accent-ink: #1a1300;
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --line: #dfe2e9;
  --line-strong: #c4c9d4;
  --text: #1b2130;
  --muted: #677086;
  --danger: #c0392b;
  --ok: #1e8a5a;
  --focus: #3d6bff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .06), 0 4px 14px rgba(20, 33, 61, .06);
  --tap: 48px;
  --sel: #14213d;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #0d1526;
    --ink-2: #1c2842;
    --bg: #0f1420;
    --surface: #171e2d;
    --surface-2: #1d2536;
    --line: #2a344a;
    --line-strong: #3a4661;
    --text: #e6e9f0;
    --muted: #97a0b5;
    --danger: #ff6b5b;
    --ok: #3ec98a;
    --focus: #7d9bff;
    --sel: #3b4f80;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
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 Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
a { color: inherit; }
.muted { color: var(--muted); margin: .25rem 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* --- Brand / Topbar --- */
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; letter-spacing: -.01em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 6 26 11v10l-10 5-10-5V11z' fill='none' stroke='%2314213d' stroke-width='2.4' stroke-linejoin='round'/%3E%3Cpath d='M6 11l10 5 10-5M16 16v10' fill='none' stroke='%2314213d' stroke-width='2.4' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat;
}
.brand-lg { font-size: 1.1rem; margin-bottom: 1.5rem; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .6rem;
  padding: .65rem max(16px, env(safe-area-inset-right)) .65rem max(16px, env(safe-area-inset-left));
  background: var(--ink); color: #fff;
}
.mainnav { display: flex; gap: .25rem; margin-left: 1rem; flex: 1; }
.mainnav a {
  text-decoration: none; padding: .55rem 1rem; border-radius: 999px; color: rgba(255,255,255,.75); font-weight: 600;
  min-height: 40px; display: inline-flex; align-items: center;
}
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav a.is-active { background: rgba(255,255,255,.14); color: #fff; }
.topbar .btn-ghost { color: rgba(255,255,255,.85); border-color: rgba(255,255,255,.25); }
.topbar .btn-ghost:hover { background: rgba(255,255,255,.08); }

main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 7rem; }

/* --- Buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: var(--tap); padding: 0 1.25rem; border-radius: 10px;
  border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn-sm { min-height: 38px; padding: 0 .9rem; font-size: .92rem; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(.96); }
.btn-primary:disabled { opacity: .6; cursor: progress; }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost:disabled { opacity: .4; cursor: default; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: transparent; }
.btn-danger-ghost:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-icon {
  flex: none; width: var(--tap); height: var(--tap); border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 1.2rem; cursor: pointer; display: grid; place-items: center; text-decoration: none;
}
.btn-icon:hover { background: var(--surface-2); }

/* --- Page head / Toolbar --- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.search { flex: 1 1 320px; }
.search input {
  width: 100%; min-height: var(--tap); padding: 0 1rem 0 2.6rem; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23677086' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 1rem center/18px no-repeat;
  color: var(--text); font: inherit;
}
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.chip {
  min-height: 40px; padding: 0 1rem; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .4rem;
}
.chip small { color: var(--muted); font-weight: 600; }
.chip.is-active { background: var(--sel); border-color: var(--sel); color: #fff; }
.chip.is-active small { color: rgba(255,255,255,.7); }

/* --- Adressliste --- */
.rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: .8rem; }
.row {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; padding: .9rem 1.1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
  min-height: 110px; align-content: start;
}
.row:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.row.is-invalid { opacity: .62; }
.row-nr { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; font-size: .82rem; color: var(--muted); }
.row-title { grid-column: 1 / -1; font-weight: 700; font-size: 1.08rem; line-height: 1.25; overflow-wrap: anywhere; }
.row-sub { grid-column: 1 / -1; color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.row-contact { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .2rem 1rem; font-size: .9rem; margin-top: .35rem; }
.row-contact span { overflow-wrap: anywhere; }
.badges { display: flex; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
.badge { font-size: .74rem; font-weight: 700; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.badge-kat { background: color-mix(in srgb, var(--focus) 13%, transparent); border-color: transparent; color: var(--focus); }
.badge-bad { background: color-mix(in srgb, var(--danger) 13%, transparent); border-color: transparent; color: var(--danger); }
.badge-mail { background: color-mix(in srgb, var(--ok) 14%, transparent); border-color: transparent; color: var(--ok); }
.empty { text-align: center; padding: 3rem 1rem; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* --- Form head --- */
.form-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1.25rem; }
.form-title { min-width: 0; }
.form-title h1 { overflow-wrap: anywhere; }
.back {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  text-decoration: none; font-size: 1.8rem; line-height: 1; border: 1px solid var(--line-strong); background: var(--surface);
}
.vnr {
  display: inline-block; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; font-size: .85rem;
  background: var(--ink); color: var(--accent); padding: .15rem .55rem; border-radius: 6px; margin-bottom: .3rem; letter-spacing: .04em;
}
.vnr.is-invalid { background: var(--danger); color: #fff; }

/* --- Tabs --- */
.tabs {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: .35rem; padding: .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 1rem;
  position: sticky; top: 57px; z-index: 10; box-shadow: var(--shadow);
}
.tab {
  min-height: 52px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .5rem; position: relative; padding: 0 .4rem;
}
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab[aria-selected="true"] { background: var(--sel); color: #fff; }
.tab-num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .82rem; flex: none;
  border: 2px solid currentColor;
}
.tab[aria-selected="true"] .tab-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tab-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); display: none; flex: none; }
.tab.has-error .tab-dot { display: block; }
.tab-mark { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.tab-short { display: none; }

/* --- Panels / Fields --- */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: var(--shadow);
}
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1.4rem; }
.span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: .4rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.field > span, .field > label, .field > legend { font-weight: 600; font-size: .9rem; color: var(--ink-2); padding: 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .field > span, :root:not([data-theme="light"]) .field > label, :root:not([data-theme="light"]) .field > legend { color: var(--muted); } }
.field > legend { margin-bottom: .4rem; }
.field small { color: var(--muted); font-size: .8rem; font-weight: 500; }
.field input, .field select, .master input {
  width: 100%; min-height: var(--tap); padding: 0 .9rem; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 1rem;
  appearance: none; -webkit-appearance: none;
}
.field input[type="date"] { display: block; line-height: var(--tap); }
.field select {
  padding-right: 2.4rem;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23677086' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right .8rem center/18px no-repeat;
}
.field input:focus, .field select:focus, .field textarea:focus, .master input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.field input.readonly { background: var(--surface-2); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; color: var(--muted); }
.field.is-invalid input, .field.is-invalid select, .field.is-invalid textarea { border-color: var(--danger); }
.field .err { color: var(--danger); font-size: .82rem; font-weight: 600; }
.field textarea {
  width: 100%; padding: .8rem .9rem; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; resize: vertical; min-height: 280px; line-height: 1.5;
}
.field-group {
  margin: .4rem 0 -.3rem; padding-top: 1rem; border-top: 1px solid var(--line);
  font-weight: 700; font-size: 1rem;
}
.plz-ort { display: grid; grid-template-columns: minmax(90px, 1fr) 3fr; gap: .8rem; min-width: 0; }
.input-action { display: flex; gap: .5rem; }
.input-action input { flex: 1; min-width: 0; }
.affix { display: flex; align-items: stretch; }
.affix input { border-radius: 10px 0 0 10px; }
.affix-post {
  display: grid; place-items: center; padding: 0 .9rem; background: var(--surface-2); color: var(--muted);
  border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 10px 10px 0; font-weight: 600; font-size: .9rem;
}
.quick { display: flex; gap: .4rem; flex-wrap: wrap; }
.quick button {
  min-height: 36px; min-width: 48px; padding: 0 .7rem; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.quick button.is-active { background: var(--sel); border-color: var(--sel); color: #fff; }
.ok-hint { color: var(--ok) !important; font-weight: 600 !important; }
.meta { font-size: .85rem; margin-top: 1rem; }

/* Ja/Nein */
.segmented { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; width: 100%; max-width: 280px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-height: var(--tap); font-weight: 700; color: var(--muted); background: var(--surface); cursor: pointer; }
.segmented label + label span { border-left: 1px solid var(--line-strong); }
.segmented input:checked + span { background: var(--sel); color: #fff; }
.segmented input[value="1"]:checked + span { background: var(--ok); }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: -3px; }

/* Mehrfachauswahl (Stammdaten, Fahrausweis) */
.toggles { display: flex; flex-wrap: wrap; gap: .55rem; }
.toggle { position: relative; }
.toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.toggle span {
  display: inline-flex; align-items: center; gap: .5rem; min-height: var(--tap); padding: 0 1.1rem 0 .9rem;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 600; cursor: pointer;
}
.toggle span::before {
  content: ""; width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line-strong); flex: none;
}
.toggle input:checked + span { border-color: var(--sel); background: var(--sel); color: #fff; }
.toggle input:checked + span::before {
  border-color: var(--accent);
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2314213d' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5 9-10'/%3E%3C/svg%3E") center/14px no-repeat;
}
.toggle input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.toggles-sm .toggle span { min-height: 42px; padding: 0 .9rem 0 .7rem; font-size: .92rem; }
.toggles-sm .toggle span::before { width: 16px; height: 16px; border-radius: 5px; }
.liste-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.liste-head a { font-size: .82rem; font-weight: 600; color: var(--focus); text-decoration: none; }
.liste-empty { color: var(--muted); font-size: .9rem; }

/* Action bar */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; gap: .6rem; align-items: center;
  padding: .75rem max(16px, env(safe-area-inset-right)) calc(.75rem + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.actionbar .spacer { flex: 1; }
.actionbar .btn-primary { min-width: 150px; }

/* --- Stammdaten --- */
.master-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.master { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .6rem; }
.master h2 { margin: 0; }
.master-add { display: flex; gap: .4rem; }
.master-add input { min-height: 44px; }
.master-add .btn-icon { width: 44px; height: 44px; }
.master-list { list-style: none; margin: 0; padding: 0; max-height: 460px; overflow: auto; border-top: 1px solid var(--line); }
.master-list li { display: flex; justify-content: space-between; align-items: center; gap: .4rem; padding: .3rem 0 .3rem .2rem; border-bottom: 1px solid var(--line); min-height: 48px; }
.m-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.m-use { color: var(--muted); font-size: .75rem; font-weight: 600; white-space: nowrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: .05rem .45rem; }
.m-btns { display: flex; gap: .1rem; flex: none; }
.master-list button { border: 0; background: transparent; color: var(--muted); width: 36px; height: 38px; border-radius: 8px; cursor: pointer; font-size: 1rem; }
.master-list button:hover { color: var(--focus); background: color-mix(in srgb, var(--focus) 10%, transparent); }
.master-list .m-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.master-list button:disabled, .master-list button:disabled:hover { opacity: .3; cursor: not-allowed; background: transparent; color: var(--muted); }
.m-edit { display: flex; gap: .4rem; align-items: center; width: 100%; }
.m-edit input { flex: 1; min-height: 40px; }
.master-list .m-save { background: var(--accent); color: var(--accent-ink); }

/* --- Auth --- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--ink); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 18px; padding: 2rem; display: flex; flex-direction: column; gap: 1rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.auth-card h1 { font-size: 1.4rem; }
.form-error { color: var(--danger); font-weight: 600; margin: 0; min-height: 1.2em; font-size: .92rem; }

/* --- Dialog / Toast --- */
dialog { border: 0; border-radius: 16px; padding: 1.5rem; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10, 16, 30, .5); }
dialog form { display: flex; flex-direction: column; gap: 1rem; }
dialog h2 { margin: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; }
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: .8rem 1.2rem; border-radius: 10px; font-weight: 600; z-index: 50;
  transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

/* --- Responsive --- */
@media (max-width: 900px) {
  .tab-num { display: none; }
  .tab { font-size: .95rem; }
}
@media (max-width: 720px) {
  .grid, .grid-3 { grid-template-columns: 1fr; }
  .brand-text { display: none; }
  .topbar { gap: .4rem; }
  .mainnav { margin-left: 0; gap: 0; min-width: 0; }
  .mainnav a { padding: .5rem .7rem; font-size: .95rem; }
  .topbar .btn-sm { padding: 0 .65rem; font-size: .85rem; }
  .actionbar { gap: .4rem; }
  .actionbar .btn { padding: 0 .9rem; }
  .actionbar .btn-danger-ghost { padding: 0 .5rem; }
  #btn-prev, #btn-next { display: none; }
  .actionbar .btn-primary { min-width: 0; flex: 1; }
  h1 { font-size: 1.35rem; }
  .panel { padding: 1rem; }
  .tabs { top: 57px; gap: .2rem; padding: .25rem; }
  .tab { font-size: .82rem; gap: .25rem; padding: 0 .15rem; min-height: 46px; }
  .tab-long { display: none; }
  .tab-short { display: inline; }
  .segmented { max-width: none; }
  .rows { grid-template-columns: 1fr; }
}
.field-label { font-weight: 600; font-size: .9rem; color: var(--ink-2); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .field-label { color: var(--muted); } }
.empty-full { grid-column: 1 / -1; text-align: center; }


/* ===================== Artikelverwaltung ===================== */
.btn:disabled { opacity: .4; cursor: not-allowed; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem 1.4rem; }
.field-spacer { min-height: 0; }
.field textarea.ta-sm { min-height: 90px; }
.field textarea.ta-md { min-height: 130px; }
.field input.num, .rabatt input.num { text-align: right; font-variant-numeric: tabular-nums; }
.field select:disabled { opacity: .6; }
.field-group small { font-weight: 600; }
.panel > .field-group:first-of-type { margin-top: 1.2rem; }
.panel > .field-group { margin: 1.4rem 0 .9rem; }
.panel > .grid + .grid { margin-top: 1.1rem; }
.chip-warn:not(.is-active) { border-color: color-mix(in srgb, var(--danger) 45%, transparent); color: var(--danger); }
.tab-warn { background: var(--danger); }

/* Ja/Nein mit drei Feldern (Qualität A/B/C) */
.segmented-3 { grid-template-columns: repeat(3, 1fr); }
.segmented-3 input:checked + span { background: var(--sel); }
.grid-yn { grid-template-columns: repeat(4, 1fr); }
.grid-yn .segmented { max-width: none; }
.preise { margin-top: 1.4rem; }

/* Präfix «CHF» vor dem Eingabefeld */
.affix-pre .affix-post { order: -1; border-left: 1px solid var(--line-strong); border-right: 0; border-radius: 10px 0 0 10px; }
.affix-pre input { border-radius: 0 10px 10px 0; }

/* Liste (Tabelle, sortierbar) */
main:has(#view-list:not([hidden])) { max-width: 1600px; }
.vt-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; -webkit-overflow-scrolling: touch; }
.vt-flat { box-shadow: none; }
.vt { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.vt th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap; z-index: 1; vertical-align: bottom; }
.vt th button, .vt th > span {
  display: flex; align-items: flex-end; gap: .3rem; width: 100%; min-height: 44px; padding: .45rem .55rem; border: 0; background: transparent;
  font: inherit; font-size: .78rem; font-weight: 700; color: var(--muted); cursor: pointer; text-align: left; line-height: 1.15;
}
.vt th > span { cursor: default; }
.vt th button:hover { color: var(--text); }
.vt th[aria-sort="ascending"] button, .vt th[aria-sort="descending"] button { color: var(--text); }
.vt th.c-num button, .vt th.c-num > span { justify-content: flex-end; }
.sort-ind { font-size: .7rem; opacity: .45; }
.vt th[aria-sort="ascending"] .sort-ind, .vt th[aria-sort="descending"] .sort-ind { opacity: 1; color: var(--focus); }
.vt td { padding: .5rem .55rem; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.vt tbody tr { cursor: pointer; transition: background .1s; }
.vt tbody tr:hover, .vt tbody tr:focus-visible { background: color-mix(in srgb, var(--focus) 6%, transparent); outline: none; }
.vt tbody tr:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--focus); }
.vt tbody tr:last-child td { border-bottom: 0; }
.vt .c-nr { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: 1px 0 0 var(--line); }
.vt th.c-nr { background: var(--surface-2); z-index: 2; }
.vt tbody tr:hover td.c-nr { background: color-mix(in srgb, var(--focus) 6%, var(--surface)); }
.vt .c-nr a { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; text-decoration: none; color: var(--text); }
.vt td.c-bez { white-space: normal; min-width: 180px; max-width: 360px; }
.vt .c-mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .86rem; }
.vt .c-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.vt .c-q { text-align: center; }
.vt .c-status .badge { font-size: .7rem; margin-right: .2rem; }
.vt td.is-warn { color: var(--danger); }
.vt td.is-warn::before { content: "▼ "; font-size: .7rem; }
.vt-empty { color: var(--line-strong); }
.q { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-weight: 800; font-size: .8rem; }
.q-A { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.q-B { background: color-mix(in srgb, var(--accent) 22%, transparent); color: color-mix(in srgb, var(--accent) 55%, var(--text)); }
.q-C { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.empty-full { text-align: center; margin-top: 1rem; }
#list-empty, #lager-empty { margin-top: .5rem; }

/* Passend für Fahrzeugmodell */
.modelle { display: flex; flex-direction: column; gap: .7rem; }
.modell-tools { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.search-sm { flex: 1 1 260px; }
.search-sm input { min-height: 42px; }
.modell-tools .is-active { background: var(--sel); border-color: var(--sel); color: #fff; }
.modell-gruppen { display: flex; flex-direction: column; gap: .5rem; max-height: 460px; overflow: auto; padding: .1rem .2rem .1rem 0; }
.modell-gruppe { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .75rem .75rem; background: var(--surface-2); }
.modell-gruppe.has-sel { border-color: color-mix(in srgb, var(--sel) 55%, var(--line)); }
.modell-reihe { display: flex; align-items: center; gap: .6rem; min-height: 40px; cursor: pointer; margin-bottom: .4rem; }
.modell-reihe input { width: 20px; height: 20px; accent-color: var(--sel); flex: none; margin: 0; }
.modell-reihe small { color: var(--muted); font-weight: 600; margin-left: .3rem; }
.modell-weg { cursor: default; color: var(--danger); }
.modell-gruppe .toggles-sm .toggle span { background: var(--surface); }
.modell-gruppe .toggles-sm .toggle input:checked + span { background: var(--sel); }
.inhalt-text { margin: -.3rem 0 0; font-size: .9rem; }

/* Rabattstufen */
.rabatt-head { display: flex; justify-content: space-between; align-items: center; gap: .8rem; }
.rabatt-hint { font-size: .85rem; margin: -.4rem 0 .8rem; }
.rabatte { display: flex; flex-direction: column; gap: .6rem; }
.rabatt {
  display: grid; grid-template-columns: 76px 1fr 1fr 1.3fr 1.3fr var(--tap); gap: .4rem .7rem; align-items: end;
  padding: .75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
}
.rabatt.is-alt { opacity: .65; }
.rabatt.is-invalid { border-color: var(--danger); }
.rabatt .err { grid-column: 1 / -1; color: var(--danger); font-size: .82rem; font-weight: 600; }
.rabatt .field > span { font-size: .8rem; }
.r-info { grid-column: 1 / -1; color: var(--muted); font-size: .8rem; }
.r-info:empty { display: none; }
.r-del { color: var(--muted); }
.r-del:hover { color: var(--danger); }

/* Lager-Reiter */
.stepper { display: grid; grid-template-columns: var(--tap) 1fr var(--tap); }
.stepper input { border-radius: 0; text-align: center !important; font-weight: 700; }
.stepper button {
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: 1.3rem; font-weight: 700; cursor: pointer;
}
.stepper button:first-child { border-radius: 10px 0 0 10px; border-right: 0; }
.stepper button:last-child { border-radius: 0 10px 10px 0; border-left: 0; }
.stepper button:hover { background: var(--line); }
.bestand { margin: 1.2rem 0 .4rem; }
.bestand-info { margin: .6rem 0 1.1rem; padding: .55rem .8rem; border-radius: 10px; font-weight: 600; font-size: .92rem;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.bestand-info.is-ok { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); border-color: transparent; }
.bestand-info.is-warn { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); border-color: transparent; }
.lp-links { margin: -.4rem 0 0; font-size: .88rem; }
.lp-links a { color: var(--focus); font-weight: 600; text-decoration: none; }

/* Lager-Seite */
.subtabs { display: inline-flex; gap: .25rem; padding: .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; margin-bottom: 1rem; }
.subtab { min-height: 40px; padding: 0 1.1rem; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.subtab[aria-selected="true"] { background: var(--sel); color: #fff; }
.select-pill {
  min-height: var(--tap); padding: 0 2.4rem 0 1rem; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--text); font: inherit;
  appearance: none; -webkit-appearance: none;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23677086' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") right .8rem center/18px no-repeat;
}
.master-wide { max-width: 720px; }
.raum-add { display: grid; grid-template-columns: 120px 1fr auto; gap: .5rem; }
.raum-add input { min-height: var(--tap); }
.master-list .m-nr { font-weight: 700; width: 3.2rem; flex: none; }
.raum-edit .raum-nr { flex: 0 0 110px; }
.raum-nr input { min-width: 0; }
.raum-edit .raum-nr input, .raum-edit .raum-nr .affix-post { min-height: 40px; }
.lp-teile { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; }
.lp-teile input { text-align: center; font-weight: 700; }
.lp-gross { font-size: 1.9rem; font-weight: 800; letter-spacing: .06em; color: var(--ink-2); padding: .2rem 0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lp-gross { color: var(--accent); } }
.lp-artikel-panel { margin-top: 1rem; }
.lp-artikel-panel h2 small { font-weight: 600; }
.field-label a, .field small a { color: var(--focus); }

@media (max-width: 900px) {
  .grid-yn { grid-template-columns: 1fr 1fr; }
  .rabatt { grid-template-columns: 1fr 1fr; }
  .rabatt .r-del { justify-self: end; }
}
@media (max-width: 720px) {
  .tabs { top: 57px; grid-template-columns: repeat(3, 1fr); }
  .tab .tab-long { display: inline; }
  .tab .tab-short { display: none; }
  .grid-yn { grid-template-columns: 1fr 1fr; }
  .field-spacer { display: none; }
  .lp-teile { grid-template-columns: 1fr 1fr; }
  .lp-gross { font-size: 1.5rem; }
  #btn-copy { display: none; }
  .vt { font-size: .86rem; }
  .raum-add { grid-template-columns: 110px 1fr; }
  .raum-add .btn { grid-column: 1 / -1; }
  .toolbar .select-pill { flex: 1 1 100%; }
  #btn-desktop { display: none; }
  .mainnav { overflow-x: auto; scrollbar-width: none; }
  .mainnav a { padding: .5rem .55rem; }
}
a.brand { text-decoration: none; color: inherit; }
@media (max-width: 420px) {
  .topbar .brand { display: none; }
  .mainnav a { padding: .5rem .5rem; font-size: .92rem; }
}

/* --- Fotos (wie Fahrzeugverwaltung) --- */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; max-width: 760px; }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: #fff; border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.photo-badge {
  position: absolute; left: .5rem; top: .5rem; font-size: .72rem; font-weight: 700;
  background: var(--accent); color: var(--accent-ink); padding: .15rem .5rem; border-radius: 999px;
}
.photo-badge.pending { background: var(--sel); color: #fff; }
.photo-actions { position: absolute; right: .4rem; bottom: .4rem; display: flex; gap: .35rem; }
.photo-actions button {
  min-height: 36px; min-width: 36px; padding: 0 .6rem; border-radius: 8px; border: 0; cursor: pointer; font: inherit;
  font-size: .9rem; font-weight: 700; background: rgba(15, 20, 32, .72); color: #fff; backdrop-filter: blur(4px);
}
.photo-actions button:hover { background: rgba(15, 20, 32, .9); }
.photo-add {
  aspect-ratio: 4 / 3; border-radius: 10px; border: 2px dashed var(--line-strong); background: var(--surface);
  color: var(--muted); font: inherit; font-weight: 600; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
}
.photo-add:hover { border-color: var(--focus); color: var(--focus); }
.photo-add svg { width: 30px; height: 30px; }
.photo-empty { aspect-ratio: 4 / 3; border-radius: 10px; border: 1px dashed var(--line); }
.photo-hint { font-size: .82rem; margin-top: .5rem; }
.lightbox { padding: 0; width: min(1100px, calc(100vw - 24px)); max-width: none; background: #000; overflow: hidden; }
.lightbox::backdrop { background: rgba(0, 0, 0, .85); }
.lightbox img { display: block; width: 100%; max-height: calc(100vh - 48px); object-fit: contain; }
.lightbox-close, .lightbox-nav {
  position: absolute; border: 0; background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
  width: 48px; height: 48px; border-radius: 50%; font-size: 1.4rem; display: grid; place-items: center;
}
.lightbox-close { top: .6rem; right: .6rem; }
.lightbox-nav { top: 50%; transform: translateY(-50%); font-size: 2rem; }
.lightbox-nav.prev { left: .6rem; }
.lightbox-nav.next { right: .6rem; }

/* Titelbild in der Liste */
.vt .c-img { width: 66px; padding-top: .3rem; padding-bottom: .3rem; }
.vt-img { position: relative; width: 56px; height: 42px; border-radius: 6px; overflow: hidden; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; }
.vt-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.vt-noimg { color: var(--line-strong); display: grid; place-items: center; width: 100%; height: 100%; background: var(--surface-2); }
.vt-noimg svg { width: 24px; height: 24px; }
.vt-cnt { position: absolute; right: 2px; bottom: 2px; font-size: .62rem; font-weight: 700; background: rgba(15,20,32,.72); color: #fff; padding: 0 .3rem; border-radius: 999px; line-height: 1.4; }
.vt .c-img + .c-nr { left: 0; }
@media (max-width: 720px) {
  .photos { gap: .5rem; }
  .photo-actions { right: .25rem; bottom: .25rem; gap: .25rem; }
  .photo-actions button { min-height: 30px; min-width: 30px; padding: 0; font-size: .85rem; }
  .photo-badge { left: .3rem; top: .3rem; font-size: .65rem; padding: .1rem .4rem; }
  .photo-add span { font-size: .8rem; }
  .vt .c-img { position: static; }
}

/* --- Rubrik Verbauung / Produkteblatt-Knopf --- */
.tab-count { min-width: 20px; height: 20px; padding: 0 .35rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: .72rem; display: inline-grid; place-items: center; flex: none; }
.tab[aria-selected="true"] .tab-count { background: #fff; color: var(--sel); }
.verbau-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.verbau-head h2 { margin: 0; }
.vt-static tbody tr { cursor: default; }
.vt-static td { white-space: normal; }
.danger-text { color: var(--danger); font-weight: 600; }
.verbau-link { margin: 1.1rem 0 0; }
.verbau-link a { color: var(--focus); font-weight: 600; text-decoration: none; }
.verbau-link a:hover { text-decoration: underline; }
.form-head .print-btn { margin-left: auto; }
@media (max-width: 720px) {
  .form-head { flex-wrap: wrap; }
  .form-head .print-btn { margin-left: 0; }
}

/* =====================================================================
   Werkstatt
   ===================================================================== */
.af-body, .af-abschluss { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
#af > .panel, .af-body > .panel { margin: 0; }
#af { display: flex; flex-direction: column; gap: 1rem; }
#af .form-head { margin-bottom: 0; }
.form-head .status-badge { margin-left: auto; }
.grp { display: flex; align-items: center; gap: .6rem; font-size: 1.15rem; margin-bottom: 1rem; flex-wrap: wrap; }
.grp-num {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); font-size: .9rem; font-weight: 800;
}
.grp-hint { font-size: .8rem; font-weight: 500; margin: 0 0 0 auto; }
.upper { text-transform: uppercase; }

/* Status-Ablauf */
.stepper {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: .3rem; padding: .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.step {
  display: flex; align-items: center; justify-content: center; gap: .5rem; min-height: 50px; padding: 0 .4rem;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer;
}
.step:hover:not([aria-disabled="true"]) { background: var(--surface-2); color: var(--text); }
.step[aria-disabled="true"] { cursor: default; }
.step-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 2px solid currentColor; font-size: .8rem; flex: none; }
.step.is-past { color: var(--ok); }
.step.is-past .step-dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.is-current { background: var(--sel); color: #fff; }
.step.is-current .step-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* Status-Etiketten */
.st { display: inline-block; font-size: .74rem; font-weight: 800; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; letter-spacing: .01em; }
.st-offen { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--ink-2); }
.st-uebergeben { background: color-mix(in srgb, #8e3fd0 15%, transparent); color: #8e3fd0; }
.st-angenommen { background: color-mix(in srgb, var(--focus) 15%, transparent); color: var(--focus); }
.st-in_bearbeitung { background: color-mix(in srgb, var(--accent) 26%, transparent); color: color-mix(in srgb, var(--accent) 50%, var(--text)); }
.st-abgeschlossen { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.st-fibu { background: var(--ink); color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .st-offen { color: var(--text); } :root:not([data-theme="light"]) .st-uebergeben { color: #c58af5; } }
.status-badge { font-size: .85rem; padding: .35rem .8rem; }
.fibu-bar {
  padding: .8rem 1rem; border-radius: var(--radius); font-weight: 600;
  background: color-mix(in srgb, var(--ok) 12%, var(--surface)); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); color: var(--ok);
}
.fibu-bar.is-done { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Fahrzeug- und Kundenkarte */
.ref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1.2rem 0; }
.ref { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; background: var(--surface-2); min-width: 0; }
.ref-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .6rem; }
.ref-head h3 { margin: 0; font-size: 1rem; }
.ref-head .spacer { flex: 1; }
.ref-link { font-size: .85rem; font-weight: 600; color: var(--focus); text-decoration: none; }
.ref-link:hover { text-decoration: underline; }
.ref-empty { margin: .2rem 0; font-size: .92rem; }
.ref-data { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem 1rem; margin: 0; }
.ref-data dt { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.ref-data dd { margin: .1rem 0 0; font-weight: 600; overflow-wrap: anywhere; min-height: 1.4em; }
.ref-data dd a { color: var(--focus); text-decoration: none; }
.ref-data .affix-sm input { min-height: 38px; max-width: 130px; padding: 0 .6rem; }
.ref-data .affix-sm .affix-post { min-height: 38px; }
.plate {
  display: inline-block; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; font-size: .82rem;
  padding: .05rem .45rem; border: 2px solid var(--text); border-radius: 5px; background: var(--surface); color: var(--text); white-space: nowrap;
}
.btn-icon-sm { width: 36px; height: 36px; font-size: .95rem; }

/* Positionen */
.pos-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -.3rem; }
.pos { width: 100%; border-collapse: collapse; font-size: .94rem; }
.pos th { text-align: left; font-size: .75rem; font-weight: 700; color: var(--muted); padding: .3rem .3rem .45rem; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.pos td { padding: .3rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.pos input:not([type=checkbox]) {
  width: 100%; min-height: 42px; padding: 0 .6rem; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); font: inherit;
}
.pos input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.pos input[readonly] { background: var(--surface-2); }
.pos input.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos td.is-invalid input { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.pos .c-ok { width: 40px; text-align: center; }
.pos .c-ok input { width: 24px; height: 24px; accent-color: var(--ok); cursor: pointer; }
.pos .c-besch { min-width: 220px; }
.pos .c-artnr { width: 130px; min-width: 110px; position: relative; }
.pos .c-artnr input { padding-right: 1.6rem; }
.pos-link { position: absolute; right: .7rem; top: 50%; transform: translateY(-50%); text-decoration: none; color: var(--focus); font-weight: 700; }
.pos .c-anz { width: 90px; min-width: 76px; }
.pos .c-zeit { width: 100px; min-width: 84px; text-align: right; }
.pos .c-chf { width: 130px; min-width: 104px; text-align: right; font-variant-numeric: tabular-nums; }
.pos th.c-chf, .pos th.c-zeit, .pos th.c-anz { text-align: right; }
.pos td.betrag { font-weight: 700; white-space: nowrap; padding-right: .5rem; }
.pos .c-del { width: 44px; text-align: center; }
.pos tr.is-done td.c-besch input { border-color: color-mix(in srgb, var(--ok) 45%, var(--line-strong)); }
.pos-tag { display: inline-block; margin-top: .2rem; font-size: .72rem; font-weight: 700; color: var(--muted); }
.pos tfoot td { border-bottom: 0; padding-top: .7rem; font-weight: 700; }
.pos .sub-label { text-align: right; color: var(--muted); }
.pos td.sub { font-size: 1.05rem; padding-right: .5rem; }
.pos-empty { margin: .2rem 0 .6rem; }
.pos-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .8rem; }
.pos-actions #arbeit-alle, .pos-actions #material-alle { margin-left: auto; }

/* Total */
.totals { width: 100%; max-width: 480px; margin-left: auto; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.totals th { text-align: left; font-weight: 600; padding: .45rem 0; color: var(--ink-2); }
.totals td { text-align: right; padding: .45rem 0; font-weight: 700; white-space: nowrap; }
.totals tr + tr th, .totals tr + tr td { border-top: 1px solid var(--line); }
.totals .t-total th, .totals .t-total td { border-top: 2px solid var(--text); font-size: 1.3rem; font-weight: 800; color: var(--text); padding: .7rem 0; }
.totals .t-total small { font-size: .8rem; font-weight: 600; color: var(--muted); }
.totals .t-mwst th, .totals .t-mwst td, .totals .t-rund th, .totals .t-rund td { font-size: .88rem; font-weight: 500; color: var(--muted); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .totals th { color: var(--muted); } }
.mwst-note { text-align: right; font-size: .85rem; margin: .6rem 0 1.2rem; }
.notiz-field { margin-top: .5rem; }

/* Abschluss / Signatur */
.abschluss.is-off .af-abschluss { opacity: .55; }
.abschluss > .muted { margin: -.4rem 0 1rem; }
.check-field { flex-direction: row; align-items: flex-start; gap: .7rem; cursor: pointer; }
.check-field input { width: 24px; height: 24px; min-height: 0; flex: none; margin: .1rem 0 0; accent-color: var(--ok); }
.check-field > span { font-weight: 600; font-size: .95rem; color: var(--text); }
.field.check-field.is-invalid { color: var(--danger); }
.sig { position: relative; height: 190px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; overflow: hidden; }
.sig.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 20%, transparent); }
.sig canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; z-index: 1; }
.sig-line { position: absolute; left: 6%; right: 6%; bottom: 46px; border-bottom: 1.5px dashed #b9bfcc; }
.sig-ph { position: absolute; left: 6%; bottom: 20px; color: #9aa1b1; font-size: .85rem; pointer-events: none; }
.sig-clear { position: absolute; right: 8px; top: 8px; z-index: 2; background: #fff; color: #1b2130; }
.af-abschluss:disabled .sig canvas { cursor: not-allowed; }
.sig-img { display: block; max-width: 100%; height: 160px; object-fit: contain; object-position: left; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .4rem; }
.is-locked .edit-only, .is-locked .pos-del, .is-locked .c-del { display: none; }
.is-locked .pos input:not([type=checkbox]) { border-color: transparent; background: transparent; padding: 0 .2rem; }

/* Verlauf */
.verlauf summary { cursor: pointer; list-style: none; }
.verlauf summary::-webkit-details-marker { display: none; }
.verlauf summary h2 { display: inline; margin: 0; }
.verlauf summary::after { content: " ▾"; color: var(--muted); }
.verlauf[open] summary::after { content: " ▴"; }
.verlauf-list { list-style: none; margin: .8rem 0 0; padding: 0; }
.verlauf-list li { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; padding: .45rem 0; border-top: 1px solid var(--line); font-size: .92rem; }
.verlauf-list time { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 150px; }

/* Liste */
.vt .c-date { font-variant-numeric: tabular-nums; }
.vt td.c-fz { white-space: normal; min-width: 200px; max-width: 340px; }
.sub-line { color: var(--muted); font-size: .84rem; margin-top: .1rem; white-space: normal; }
.fort { font-size: .82rem; color: var(--muted); }
.fort-ok { color: var(--ok); }

/* Auswahl-Dialoge */
.dlg-pick { width: min(640px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 1.1rem; display: none; flex-direction: column; gap: .7rem; }
.dlg-pick[open] { display: flex; }
.dlg-pick.dlg-wide, .dlg-kat { width: min(860px, calc(100vw - 24px)); }
.pick-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pick-info { margin: 0; font-size: .85rem; }
.pick-list { overflow-y: auto; min-height: 120px; max-height: 60vh; display: flex; flex-direction: column; gap: .35rem; margin: 0 -.2rem; padding: 0 .2rem; }
.pk {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; padding: .65rem .8rem; min-height: 56px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
button.pk:hover, button.pk:focus-visible, label.pk:hover { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 5%, var(--surface)); }
.pk-nr { font-weight: 700; font-size: .85rem; color: var(--muted); flex: none; min-width: 72px; }
.pk-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pk-sub { display: block; color: var(--muted); font-size: .84rem; margin-top: .1rem; }
.pk-tags { display: flex; gap: .25rem; flex-wrap: wrap; justify-content: flex-end; }
.pk-art { cursor: default; flex-wrap: wrap; }
.pk-btns { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: flex-end; }
.pk-bestand { display: inline-block; font-size: .78rem; font-weight: 700; margin-top: .2rem; color: var(--ok); }
.pk-bestand.is-warn { color: var(--danger); }
.pk-kat input { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.pk-kat:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.pk-preis { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pk.is-inaktiv { opacity: .6; }
.kat-gruppen { margin: 0; }
.kat-actions { align-items: center; }
.kat-actions .spacer { flex: 1; }

/* Stammdaten */
.sd-tabs { display: flex; gap: .35rem; padding: .35rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 1rem; box-shadow: var(--shadow); overflow-x: auto; }
.sd-tab { flex: 1; min-height: 46px; padding: 0 1rem; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; white-space: nowrap; }
.sd-tab:hover { background: var(--surface-2); color: var(--text); }
.sd-tab[aria-selected="true"] { background: var(--sel); color: #fff; }
.sd-panel .toolbar { margin-bottom: .8rem; }
.vt tr.is-inaktiv td { opacity: .55; }
.small-note { font-size: .84rem; margin-top: .6rem; }
.gruppe-add { max-width: 520px; margin-bottom: 1rem; }
.gruppen { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1rem; }
.gruppe { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .6rem; }
.gruppe-head { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.gruppe-name { margin: 0; font-size: 1.05rem; flex: 1; min-width: 0; }
.gruppe-sum { width: 100%; order: 3; margin: 0; font-size: .85rem; }
.gruppe .m-btns button { border: 0; background: transparent; color: var(--muted); width: 36px; height: 38px; border-radius: 8px; cursor: pointer; font-size: 1rem; }
.gruppe .m-btns button:hover { color: var(--focus); background: color-mix(in srgb, var(--focus) 10%, transparent); }
.gruppe .m-btns .m-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.gruppe .m-btns button:disabled { opacity: .3; cursor: not-allowed; background: transparent; }
.gruppe .m-save { border: 0; border-radius: 8px; width: 40px; height: 40px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.gruppe-arbeiten { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.gruppe-arbeiten li { display: flex; align-items: center; gap: .5rem; padding: .35rem 0; border-bottom: 1px solid var(--line); min-height: 48px; }
.ga-anz { width: 64px; min-height: 38px; padding: 0 .5rem; border: 1px solid var(--line-strong); border-radius: 8px; text-align: right; font: inherit; background: var(--surface); color: var(--text); }
.ga-x { color: var(--muted); }
.ga-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ga-preis { font-weight: 700; font-size: .88rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ga-add { min-height: 44px; border-radius: 10px; border: 1px dashed var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; padding: 0 .7rem; }
.mech-add { display: flex; gap: .8rem; align-items: flex-end; flex-wrap: wrap; max-width: 720px; margin-bottom: 1rem; }
.mech-add .field:first-child { flex: 2; min-width: 200px; }
.mech-add .field:nth-child(2) { flex: 1; min-width: 110px; }
.mech-list { max-width: 720px; max-height: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 .8rem; }
.mech-list li:last-child { border-bottom: 0; }
.mech-list li.is-inaktiv .m-name, .mech-list li.is-inaktiv .m-kz { opacity: .55; }
.m-kz { font-weight: 700; min-width: 56px; }
.mech-edit input[name="kuerzel"] { flex: 0 0 90px; }
.einst { max-width: 900px; }
.einst .grid { grid-template-columns: repeat(3, 1fr); }
.actionbar-inline { position: static; background: none; backdrop-filter: none; border: 0; padding: 1rem 0 0; }
.grid-2c { grid-template-columns: 1fr 1fr; }

@media (max-width: 820px) {
  .ref-grid { grid-template-columns: 1fr; }
  .stepper { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .step { flex-direction: column; gap: .2rem; font-size: .72rem; min-height: 58px; padding: .3rem .1rem; }
  .einst .grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .ref-data { grid-template-columns: 1fr 1fr; }
  .grp-hint { margin-left: 0; width: 100%; }
  .pos-actions #arbeit-alle, .pos-actions #material-alle { margin-left: 0; }
  .actionbar { flex-wrap: wrap; }
  .actionbar .btn-primary { min-width: 0; flex: 1; }
  .step-label { font-size: .66rem; text-align: center; line-height: 1.1; }
  .gruppen { grid-template-columns: 1fr; }
}
.ref-data input { border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-align: right; }
.ref-data input:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.is-locked .ref-data input { border-color: transparent; background: transparent; }
.dlg-pick .search, .dlg-pick .chips { flex: none; }
.ref-head h3 { margin-right: auto; }
.ref-head .spacer { display: none; }
.field.check-field input { appearance: auto; -webkit-appearance: checkbox; padding: 0; border-radius: 4px; }
.gruppen { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.gruppe-add input { flex: 1; min-height: 44px; padding: 0 .9rem; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; }
.gruppe-arbeiten .ga-anz { flex: 0 0 64px; }
.gruppe-head .m-edit input { min-height: 40px; padding: 0 .7rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; }
.mech-edit input { min-height: 40px; padding: 0 .7rem; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; }
@media (max-width: 600px) { .gruppen { grid-template-columns: 1fr; } }
.pick-filter { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; flex: none; padding: .5rem .7rem; border-radius: 10px; background: color-mix(in srgb, var(--focus) 8%, var(--surface)); font-weight: 600; font-size: .9rem; }
.pick-filter span { flex: 1; min-width: 0; }
.form-head .print-btn { flex: none; }
.form-head .status-badge + .print-btn { margin-left: .2rem; }
@media (max-width: 600px) { .form-head { flex-wrap: wrap; } .form-head .print-btn { margin-left: auto; } }
/* Artikelauswahl: Auswahl links über die Artikelnummer */
.pk-art { cursor: pointer; flex-wrap: nowrap; }
.pk-art:hover { border-color: var(--focus); background: color-mix(in srgb, var(--focus) 5%, var(--surface)); }
.pk-wahl {
  flex: none; display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; padding: 0 .8rem; border-radius: 10px;
  border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--text);
  font-weight: 700; font-size: .9rem; cursor: pointer;
}
.pk-wahl:hover, .pk-wahl:focus-visible { background: var(--accent); color: var(--accent-ink); }
.pk-plus { font-size: 1rem; line-height: 1; }
.pk-preise { flex: none; text-align: right; font-size: .84rem; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; }
.pk-aus { border: 0; background: none; color: var(--focus); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; padding: .2rem 0; text-decoration: underline; }
@media (max-width: 600px) { .pk-art { flex-wrap: wrap; } .pk-preise { width: 100%; flex-direction: row; justify-content: space-between; } }

/* =====================================================================
   Shop
   ===================================================================== */
.seg-wide { max-width: none; }
.seg-wide span, .seg-status span { padding: 0 .4rem; text-align: center; font-size: .92rem; }
.ref-kunde { margin: 1.2rem 0 0; }
.kd-frei .grid { margin-top: .9rem; }
.kd-frei .grid:first-child { margin-top: .2rem; }
.kd-ort { grid-template-columns: 110px 140px 1fr; }
@media (max-width: 600px) { .kd-ort { grid-template-columns: 90px 1fr; } .kd-ort .field:last-child { grid-column: 1 / -1; } }
.kd-frei .check-field > span { font-weight: 500; font-size: .88rem; color: var(--ink-2); }

.st-erledigt { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }

/* Abschluss: Art als Karten */
.art-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.art-card { position: relative; }
.art-card input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.art-card span {
  display: flex; flex-direction: column; gap: .15rem; min-height: 72px; justify-content: center; padding: .7rem 1rem .7rem 2.8rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; position: relative;
}
.art-card span::before {
  content: ''; position: absolute; left: 1rem; top: 50%; width: 18px; height: 18px; margin-top: -9px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: var(--surface);
}
.art-card b { font-size: 1rem; }
.art-card small { color: var(--muted); font-size: .8rem; font-weight: 500; }
.art-card input:checked + span { border-color: var(--sel); box-shadow: 0 0 0 2px var(--sel) inset; }
.art-card input:checked + span::before { border-color: var(--sel); background: var(--sel); box-shadow: 0 0 0 3px var(--surface) inset; }
.art-card input[value="kauf"]:checked + span { border-color: var(--ok); box-shadow: 0 0 0 2px var(--ok) inset; }
.art-card input[value="kauf"]:checked + span::before { border-color: var(--ok); background: var(--ok); }
.art-card input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.field.is-invalid .art-card span { border-color: var(--danger); }
.abschluss-grid { margin-top: 1.1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.status-field { margin-top: 1.2rem; }
.status-field .segmented { max-width: 520px; }
.seg-status input[value="erledigt"]:checked + span { background: var(--ok); }
.seg-status input[value="in_bearbeitung"]:checked + span { background: var(--accent); color: var(--accent-ink); }
.bestaetigt-bar {
  margin: 0 0 1rem; padding: .7rem 1rem; border-radius: var(--radius); font-size: .92rem;
  background: color-mix(in srgb, var(--ok) 12%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent);
}
.bestaetigt-bar b { color: var(--ok); }
@media (max-width: 900px) { .abschluss-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .art-cards { grid-template-columns: 1fr; } .art-card span { min-height: 58px; } }

/* Liste */
.art { display: inline-block; font-size: .74rem; font-weight: 800; padding: .2rem .6rem; border-radius: 999px; white-space: nowrap; }
.art-kauf { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.art-reservierung { background: color-mix(in srgb, #8e3fd0 15%, transparent); color: #8e3fd0; }
.art-bestellung { background: color-mix(in srgb, var(--focus) 15%, transparent); color: var(--focus); }
.art-offen { opacity: .6; outline: 1px dashed currentColor; }
.c-artikel { max-width: 320px; }
.art-liste { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .9rem; }
.pk.is-picked { box-shadow: inset 4px 0 0 var(--ok); }
.pos .pos-tag { display: block; }
@media (max-width: 420px) { .actionbar .btn { padding-left: .8rem; padding-right: .8rem; } }
