/* Anzeigemodi: data-theme="light" | "dim" | "dark" auf <html>, gesetzt per JS
   (Auswahl Hell / Grau / Dunkel / System, gespeichert im Browser).
   Farbrollen: --teal = Akzent für Text/Links, --btn = Button-Fläche (immer weiße Schrift),
   --heading = Überschriften, --band = Navy-Bänder (Kopfzeile, Abschnittstitel). */
:root {
  --navy: #1b2f4e; --navy2: #16273f; --orange: #e8842b; --teal: #0f8a86; --purple: #5f4b93;
  --ink: #233043; --muted: #6b7789; --line: #e2e7ef; --card: #f6f8fb; --bg: #ffffff; --surface: #ffffff;
  --teal: #0d7773; /* Text/Links; Brand-Teal #0f8a86 wäre auf Weiß nur 4,2:1 */
  --heading: #1b2f4e; --band: #1b2f4e; --btn: #0c7672; --btn-orange: #b0580f; --chip-on: #1b2f4e;
  --ok: #18703d; --warn: #9a5a0c; --bad: #c0392b;
  --ok-bg: #e5f4ec; --warn-bg: #fdf1e2; --bad-bg: #fbe8e6; --info-bg: #e6f3f3; --purple-bg: #efebf7; --grey-bg: #eef1f5;
  --blue: #1f5fa8; --blue-bg: #e4effb; --blue-line: #b5d0f0; /* Kundengruppen */
  --radius: 10px; --shadow: 0 1px 2px rgba(22, 39, 63, .06), 0 4px 14px rgba(22, 39, 63, .06);
  color-scheme: light;
}
/* Grau: hellgrauer Grund mit dunkler Schrift – bewusst ohne reines Weiß und reines Schwarz (weiche
   Kontraste, blendet nicht). Hell UND gut lesbar geht nur mit dunkler Schrift: auf mittlerem Grau
   bleibt jede Schriftfarbe unter ~4,6:1. Werte: Fließtext 12:1, Nebentext 7:1, Links/Etiketten >= 5,2:1. */
:root[data-theme="dim"] {
  --ink: #17202b; --muted: #3b4654; --line: #a8b0ba; --card: #d2d7dd; --bg: #cbd0d7; --surface: #d9dde2; --input: #eaedf0;
  --heading: #14233a; --band: #2b3d57; --teal: #0a5f5c; --orange: #b0580f; --purple: #4b3a7a; --chip-on: #3b4654;
  --btn: #0c7672; --btn-orange: #b0580f;
  --ok: #145c32; --warn: #7a4608; --bad: #9b2c20;
  --ok-bg: #c9e0d2; --warn-bg: #ecdcc6; --bad-bg: #ecd0cc; --info-bg: #c3dcdb; --purple-bg: #ddd6ee; --grey-bg: #c8ced5;
  --blue: #16467e; --blue-bg: #c9daee; --blue-line: #8fb0d8;
  --shadow: 0 1px 2px rgba(22, 39, 63, .10), 0 3px 10px rgba(22, 39, 63, .06); color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #dfe6f0; --muted: #98a4b6; --line: #2c3a50; --card: #1a2638; --bg: #111a27; --surface: #162131;
  --heading: #ffffff; --band: #1b2f4e; --teal: #3cb8b2; --orange: #ef9443; --purple: #a391d8; --chip-on: #2f4a70;
  --btn: #0c7672; --btn-orange: #b0580f;
  --ok: #5fcf8e; --warn: #f0ae5c; --bad: #f08a7e;
  --ok-bg: #173527; --warn-bg: #3a2a14; --bad-bg: #3b1d1a; --info-bg: #123332; --purple-bg: #2a2340; --grey-bg: #222f42;
  --blue: #9cc6f2; --blue-bg: #17283f; --blue-line: #2f5585;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--teal); }
h1, h2, h3 { color: var(--heading); line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.container { max-width: 1240px; margin: 0 auto; padding: 24px 16px 64px; }

/* Kopfzeile: eine Zeile ab 1100 px, darunter Menü-Knopf */
.topbar { background: var(--band); border-bottom: 4px solid var(--orange); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; font-weight: 700; white-space: nowrap; flex: none; }
.brand img { height: 28px; display: block; filter: brightness(0) invert(1); } /* Logo transparent in Weiß auf dem Navy-Band */
nav { display: flex; gap: 2px; flex: 1; flex-wrap: nowrap; min-width: 0; }
nav a { color: #d6deea; text-decoration: none; padding: 8px 10px; border-radius: 8px; font-size: .92rem; white-space: nowrap; }
nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
nav a.active { background: rgba(255, 255, 255, .16); color: #fff; }
nav a .badge { margin-left: 4px; }
.who { display: flex; align-items: center; gap: 12px; color: #d6deea; font-size: .8rem; line-height: 1.25; flex: none; }
.who-text { display: flex; flex-direction: column; text-align: right; max-width: 190px; }
.who-text b { color: #fff; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-actions { display: flex; align-items: center; gap: 6px; }
.who .theme-switch button { font-size: .9rem; padding: 3px 7px; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.3); color: #fff; font-size: 1.2rem; border-radius: 8px; padding: 2px 10px; }
.demo-banner { background: var(--warn-bg); color: var(--ink); text-align: center; font-size: .82rem; padding: 5px 16px; border-bottom: 1px solid var(--line); }
@media (max-width: 1100px) {
  .topbar-inner { flex-wrap: wrap; }
  .nav-toggle { display: block; }
  nav { display: none; flex-basis: 100%; flex-direction: column; }
  nav.open { display: flex; }
  .who { display: none; flex-basis: 100%; justify-content: space-between; padding: 6px 0 8px; border-top: 1px solid rgba(255,255,255,.15); }
  .who-text { text-align: left; max-width: none; }
  nav.open ~ .who { display: flex; }
}
/* Bausteine */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card.flat { box-shadow: none; background: var(--card); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 960px) { .g3, .g4, .detail-grid { grid-template-columns: minmax(0, 1fr); } .g4.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g2 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

.stat { border-left: 4px solid var(--teal); }
.stat .n { font-size: 1.9rem; font-weight: 800; color: var(--heading); line-height: 1.1; }
.stat.orange { border-left-color: var(--orange); }
.stat.purple { border-left-color: var(--purple); }
.stat.navy { border-left-color: var(--chip-on); }
.stat .l { color: var(--muted); font-size: .85rem; }

.tile { display: block; text-decoration: none; color: inherit; border-left: 5px solid var(--teal); transition: transform .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(22, 39, 63, .12); }
.tile.orange { border-left-color: var(--orange); }
.tile.purple { border-left-color: var(--purple); }
.tile .ic { font-size: 1.6rem; }
.tile.soon { opacity: .55; pointer-events: none; border-left-color: var(--line); }

.pill { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; background: var(--grey-bg); color: var(--muted); }
.pill.teal, .pill.in_bearbeitung { background: var(--info-bg); color: var(--teal); }
.pill.orange, .pill.genehmigung, .pill.offen, .pill.zu_bestellen { background: var(--warn-bg); color: var(--warn); }
.pill.purple, .pill.bestellt { background: var(--purple-bg); color: var(--purple); }
.pill.ok, .pill.erledigt, .pill.genehmigt, .pill.geliefert { background: var(--ok-bg); color: var(--ok); }
.pill.bad, .pill.abgelehnt, .pill.storniert { background: var(--bad-bg); color: var(--bad); }
.badge { display: inline-block; min-width: 19px; padding: 0 6px; border-radius: 999px; background: var(--btn-orange); color: #fff; font-size: .72rem; font-weight: 800; text-align: center; line-height: 19px; }

/* Tabellen */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--card); }
td b { white-space: nowrap; } /* Auftragsnummern nicht am Bindestrich umbrechen */
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 800; border-bottom: none; }
dl.kv { display: grid; grid-template-columns: minmax(140px, 38%) 1fr; gap: 6px 14px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: .88rem; }
dl.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

/* Formulare */
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
.req::after { content: " *"; color: var(--orange); }
.hint { font-size: .8rem; color: var(--muted); margin-top: 3px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--input, var(--surface));
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: -1px; border-color: var(--teal); }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; accent-color: var(--teal); transform: scale(1.15); }
.field { margin-bottom: 14px; }
.yesno { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.yesno button { border: 0; border-radius: 0; background: var(--input, var(--surface)); color: var(--ink); padding: 7px 18px; font-weight: 600; }
.yesno button.on { background: var(--btn); color: #fff; }
fieldset { border: 0; padding: 0; margin: 0; }
.section-title { display: flex; align-items: center; gap: 10px; background: var(--band); color: #fff; padding: 8px 14px; border-radius: 8px; margin: 0 0 14px; font-size: .95rem; font-weight: 700; }
.section-title .no { background: var(--orange); border-radius: 6px; padding: 0 8px; font-size: .8rem; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer;
  border: 1px solid transparent; border-radius: 8px; padding: 8px 16px; background: var(--btn); color: #fff; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.orange { background: var(--btn-orange); }
.btn.navy { background: var(--band); }
.btn.bad { background: var(--bad); }
.btn.ghost { background: transparent; color: var(--teal); border-color: var(--line); }
.btn.small { padding: 4px 10px; font-size: .8rem; }
.who .btn.ghost { color: #fff; border-color: rgba(255,255,255,.35); }

/* Positionen im Formular */
.item-add { display: grid; grid-template-columns: 1.2fr 1.6fr 80px auto; gap: 8px; align-items: end; }
@media (max-width: 700px) { .item-add { grid-template-columns: 1fr; } }
.items-list td { vertical-align: middle; }

/* Fortschritt */
.steps { display: flex; gap: 0; margin: 6px 0 4px; }
.steps .s { flex: 1; text-align: center; font-size: .78rem; color: var(--muted); position: relative; padding-top: 26px; }
.steps .s::before { content: ""; position: absolute; top: 7px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--line); z-index: 1; }
.steps .s::after { content: ""; position: absolute; top: 14px; left: -50%; width: 100%; height: 3px; background: var(--line); }
.steps .s:first-child::after { display: none; }
.steps .s.done::before, .steps .s.done::after { background: var(--teal); }
.steps .s.cur::before { background: var(--orange); box-shadow: 0 0 0 4px var(--warn-bg); }
.steps .s.cur::after { background: var(--teal); }
.steps .s.cur { color: var(--ink); font-weight: 700; }
.steps .s.bad::before { background: var(--bad); }

.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; min-width: 60px; }
.progress > i { display: block; height: 100%; background: var(--teal); }

/* Genehmigungskette */
.chain { list-style: none; padding: 0; margin: 0; }
.chain li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.chain li:last-child { border-bottom: 0; }
.chain .dot { flex: 0 0 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--grey-bg); color: var(--muted); }
.chain .genehmigt .dot { background: var(--ok-bg); color: var(--ok); }
.chain .offen .dot { background: var(--warn-bg); color: var(--warn); }
.chain .abgelehnt .dot { background: var(--bad-bg); color: var(--bad); }

/* Aufgaben */
.tasks { list-style: none; padding: 0; margin: 0; }
.tasks li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.tasks li:last-child { border-bottom: 0; }
.tasks li.done .t { text-decoration: line-through; color: var(--muted); }
.tasks input { margin-top: 4px; }
.tasks input:disabled { opacity: .45; }

/* Verlauf */
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 10px; font-size: .88rem; white-space: pre-line; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); border: 2px solid var(--surface); }
.timeline li.internal::before { background: var(--purple); }
.timeline li.abgelehnt::before, .timeline li.storniert::before, .timeline li.fehler::before { background: var(--bad); }
.timeline li.mail::before { background: var(--muted); }
.timeline li.kommentar::before { background: var(--orange); }
.timeline .when { color: var(--muted); font-size: .76rem; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 260px; }
.chip { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 5px 13px; font: inherit; font-size: .85rem; cursor: pointer; }
.chip.on { background: var(--chip-on); color: #fff; border-color: var(--chip-on); }

.alert { padding: 10px 14px; border-radius: 8px; background: var(--info-bg); border-left: 4px solid var(--teal); font-size: .9rem; }
.alert.warn { background: var(--warn-bg); border-left-color: var(--orange); }
.alert.bad { background: var(--bad-bg); border-left-color: var(--bad); white-space: pre-line; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--band); color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: var(--shadow); z-index: 50; max-width: 90vw; white-space: pre-line; }
.toast.bad { background: var(--bad); }

/* Login */
.login { max-width: 860px; margin: 40px auto; }
.login-head { text-align: center; margin-bottom: 26px; }
.login-head img { height: 54px; }
.user-pick { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; cursor: pointer; margin-bottom: 8px; }
.user-pick:hover { border-color: var(--teal); }

.mail { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--surface); }
.mail + .mail { margin-top: 10px; }
.empty { text-align: center; color: var(--muted); padding: 26px; }
.inline-input { padding: 4px 7px; font-size: .85rem; min-width: 90px; }
td select.inline-input { min-width: 125px; }

/* Umschalter Anzeigemodus */
.theme-switch { display: inline-flex; border: 1px solid rgba(255, 255, 255, .3); border-radius: 8px; overflow: hidden; }
.theme-switch button { background: transparent; border: 0; color: #cfd8e6; font: inherit; font-size: .78rem; padding: 3px 8px; cursor: pointer; }
.theme-switch button:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.theme-switch button.on { background: rgba(255, 255, 255, .2); color: #fff; font-weight: 700; }
.theme-switch.on-light { border-color: var(--line); }
.theme-switch.on-light button { color: var(--muted); }
.theme-switch.on-light button:hover { color: var(--ink); background: var(--card); }
.theme-switch.on-light button.on { background: var(--chip-on); color: #fff; }
.login-theme { display: flex; justify-content: flex-end; margin-bottom: -10px; }
/* Katalog-Gliederung (Kategorie -> Bereich -> Kacheln) */
.cat-block + .cat-block { margin-top: 26px; }
.cat-block .grid + .area-title { margin-top: 18px; }
.area-title { font-size: .95rem; color: var(--muted); font-weight: 700; margin: 4px 0 10px; letter-spacing: .01em; }
.free-add { margin-top: 8px; }

/* Katalogpflege: Kategorie-Schalter */
.toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; margin-top: 12px; }
.toggle { display: flex; gap: 10px; align-items: flex-start; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--input, var(--surface)); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.toggle:hover { border-color: var(--teal); }
.toggle .tick { flex: 0 0 20px; height: 20px; border-radius: 5px; border: 2px solid var(--line); display: grid; place-items: center; font-size: .8rem; font-weight: 800; color: #fff; }
.toggle.on { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.toggle.on .tick { background: var(--btn); border-color: var(--btn); }
/* Auftrag: Artikelbeschreibung bei der Auswahl, Listen, Hilfsklassen */
.var-desc { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--teal); background: var(--card); border-radius: 6px; font-size: .86rem; white-space: pre-line; }
ul.plain { margin: 4px 0 6px; padding-left: 18px; }
ul.plain li { margin: 3px 0; }
.pre { white-space: pre-line; }
.nowrap { white-space: nowrap; }

/* Katalogpflege: Artikelzeile + Beschreibungszeile gehören zusammen */
.catalog-table tr.item-main td { border-bottom: 0; padding-bottom: 4px; }
.catalog-table tr.item-desc td { padding-top: 0; }
.catalog-table tr.new-row td { padding-top: 14px; border-top: 2px dashed var(--line); }
.desc-input { width: 100%; min-height: 48px; font-size: .85rem; resize: vertical; }
details.archive > summary { cursor: pointer; list-style: none; }
details.archive > summary::-webkit-details-marker { display: none; }
details.archive > summary::before { content: "▸ "; color: var(--muted); }
details.archive[open] > summary::before { content: "▾ "; }
/* Preisfelder: Text mit deutschem Format, €-Zeichen rechts im Feld, linksbündig */
.money { position: relative; display: inline-block; }
.money input { width: 118px; padding-right: 22px; font-variant-numeric: tabular-nums; }
.money span { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .85rem; pointer-events: none; }
/* Häkchen unter dem Freigabelimit (Benutzerverwaltung) */
label.check { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-weight: 400; white-space: nowrap; cursor: pointer; }
.money input:disabled { opacity: .45; }
input.invalid { border-color: var(--bad); outline: 2px solid var(--bad); outline-offset: -1px; }
/* Katalogpflege: Aktiv-Schalter, inaktive Artikel ausgegraut (bleiben aber bearbeitbar) */
.switch { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; font-size: .82rem; cursor: pointer; margin: 0; white-space: nowrap; }
.catalog-table tr.inactive td { background: var(--grey-bg); }
.catalog-table tr.inactive input:not([type=checkbox]), .catalog-table tr.inactive textarea { color: var(--muted); }
.catalog-table tr.item-main td .pill { margin-top: 4px; }
/* Verwaltung: Reiter */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin: -4px 0 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--heading); border-bottom-color: var(--orange); }

/* Kunden & Benutzer, Auftragsbausteine: aufklappbare Karten */
details.tenant > summary, details.svc > summary { cursor: pointer; list-style: none; }
details.tenant > summary::-webkit-details-marker, details.svc > summary::-webkit-details-marker { display: none; }
details.tenant > summary::before, details.svc > summary::before { content: "▸"; float: left; margin-right: 10px; color: var(--muted); }
details.tenant[open] > summary::before, details.svc[open] > summary::before { content: "▾"; }
.tenant-body, .svc-body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.cat-block details.svc { margin-top: 10px; }
.users-table th.c, .users-table td.c { text-align: center; }
.users-table .user-cell { display: grid; gap: 4px; min-width: 230px; }
.users-table tr.inactive td { background: var(--grey-bg); }
.users-table tr.new-row td { border-top: 2px dashed var(--line); }
/* Standort-Zugriff als eigene Zeile direkt unter dem Benutzer */
.users-table tr:has(+ tr.user-locs) td { border-bottom: 0; }
.users-table tr.user-locs td { padding-top: 0; padding-bottom: 14px; }
.users-table tr.user-locs .tags { min-width: 0; }
.cc-list { display: grid; gap: 6px; max-width: 1000px; }
/* Häkchen-Feld im Auftragsformular */
.check-field { display: flex; flex-direction: column; justify-content: center; min-height: 100%; }
.check-label { display: flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 600; cursor: pointer; padding: 4px 0; margin: 0; }
.check-label input { width: 15px; height: 15px; margin: 0; flex: 0 0 auto; }
/* Mehrere Felder in einer Zeile (z. B. Häkchen-Optionen), getrennt durch einen senkrechten Strich */
.field-row { display: flex; flex-wrap: wrap; align-items: center; row-gap: 6px; margin-bottom: 14px; }
.field-row > div { padding: 0 16px; border-left: 1px solid var(--line); }
.field-row > div:first-child { padding-left: 0; border-left: 0; }
.field-row .field { margin: 0; }
/* graues „optional" vor der Beschriftung */
.opt { color: var(--muted); font-weight: 400; font-size: .8rem; margin-right: 3px; }
/* Artikelkatalog: Kategorie als farbiger Balken, Gruppenkopf mit Name/Hinweis/Kategorie */
.cat-band { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 28px 0 12px; padding: 9px 16px;
  border-radius: 10px; background: var(--btn); color: #fff; font-size: 1.1rem; }
.cat-band span { font-size: .8rem; font-weight: 600; opacity: .9; }
.group-head { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.6fr) 160px auto auto; gap: 8px; align-items: center; }
.group-head .group-name { font-weight: 700; font-size: 1.02rem; color: var(--heading); }
@media (max-width: 900px) { .group-head { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
/* Tag-Feld (Kundengruppen, Sichtbarkeit von Artikeln) */
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 34px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); flex: 1; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 10px; border-radius: 999px; background: var(--info-bg); color: var(--teal); font-size: .82rem; font-weight: 700; }
.tag.group { background: var(--blue-bg); color: var(--blue); border: 1px solid var(--blue-line); }
.group-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; margin-left: 6px; }
.group-tags .tag { padding: 1px 10px; font-size: .78rem; }
.tag-x { border: 0; background: transparent; color: inherit; font-size: 1rem; line-height: 1; cursor: pointer; padding: 0 5px; border-radius: 999px; }
.tag-x:hover { background: rgba(0, 0, 0, .08); }
.tags select.tag-add { width: auto; min-width: 170px; border: 0; background: transparent; padding: 3px 4px; font-size: .85rem; color: var(--muted); }
.vis-row { display: flex; gap: 10px; align-items: center; }
.catalog-table tr.item-desc:has(+ tr.item-vis) td { border-bottom: 0; padding-bottom: 6px; }
.catalog-table tr.item-vis td { padding-top: 6px; padding-bottom: 16px; }
/* Standorte: zwei Zeilen je Standort – Name, Straße, PLZ, Ort, Status / Zusatz, Telefon, E-Mail, Speichern */
.loc-list { display: grid; gap: 10px; }
.loc { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.4fr) 90px minmax(0, 1.1fr) 110px; gap: 6px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.loc .inline-input:nth-of-type(7) { grid-column: span 2; }
.loc .loc-state { display: flex; align-items: center; justify-content: flex-end; }
.loc.inactive .inline-input { color: var(--muted); background: var(--grey-bg); }
.loc.new-row { border-bottom: 0; border-top: 2px dashed var(--line); padding-top: 10px; }
@media (max-width: 760px) { .loc { grid-template-columns: minmax(0, 1fr); } .loc .inline-input:nth-of-type(7) { grid-column: auto; } .loc .loc-state { justify-content: flex-start; } }
.cc { display: flex; gap: 10px; align-items: center; }
.cc .inline-input { flex: 0 1 280px; min-width: 160px; }
.cc .tags { flex: 1; min-width: 220px; }
.cc.inactive .inline-input { color: var(--muted); background: var(--grey-bg); }
.tasks-table td { vertical-align: middle; }
.tasks-table th:nth-child(3), .tasks-table td:nth-child(3) { width: 36%; }
.tasks-table td:nth-child(1) select, .tasks-table td:nth-child(2) select { min-width: 0; width: 110px; }
.cond { display: flex; gap: 6px; flex-wrap: wrap; }
.cond select, .cond input { width: auto; max-width: 210px; min-width: 0; }
.fields-info { margin-top: 14px; }
.fields-info summary { cursor: pointer; color: var(--teal); }
/* Anmeldung */
.login-card { max-width: 440px; margin: 0 auto; }
.code-input { font-size: 1.6rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
details.demo-login { margin-top: 26px; }
details.demo-login > summary { cursor: pointer; }/* Anzeigemodus auf der Anmeldeseite: mittig in der Fußzeile */
.login-foot { display: flex; justify-content: center; margin: 36px 0 8px; padding-top: 18px; border-top: 1px solid var(--line); }
/* Microsoft-Anmeldung */
.ms-btn { width: 100%; justify-content: center; gap: 10px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); padding: 10px 16px; }
.ms-btn:hover { border-color: var(--teal); filter: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .82rem; margin: 16px 0 12px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
/* Bestellungen: kompakte Spalten (EK/VK bzw. Lieferant/Bestell-Nr. untereinander) */
.pp { display: flex; justify-content: flex-end; align-items: center; gap: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pp + .pp { margin-top: 3px; }
.ptag { font-size: .66rem; font-weight: 800; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; }
.ptag.ek { background: var(--purple-bg); color: var(--purple); }
.ptag.vk { background: var(--info-bg); color: var(--teal); }
.stack-in { display: grid; gap: 4px; }
.orders-table .stack-in .inline-input { width: 150px; }
.orders-table .money input { width: 108px; }
.orders-table td { padding: 8px 8px; }
/* Auftrag: Verlauf zugeklappt unter den Positionen */
details.history > summary { cursor: pointer; list-style: none; }
details.history > summary::-webkit-details-marker { display: none; }
details.history > summary h2::before { content: "▸ "; color: var(--muted); }
details.history[open] > summary h2::before { content: "▾ "; }
details.history[open] .history-last { display: none; }
.history-last { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Bearbeiten: Positionen */
.edit-items th.c, .edit-items td.c { text-align: center; }
.edit-items tr.inactive td { color: var(--muted); text-decoration: line-through; }
/* Erfassen im Auftrag eines Kunden / Positionen nachträglich hinzufügen */
.card.behalf { border-left: 5px solid var(--orange); }
/* Auswahlfelder im Kasten eine Nummer kleiner, damit lange Namen und Adressen hineinpassen */
.card.behalf select { font-size: .85rem; }
/* Standort braucht mehr Platz (lange Adressen), Anlass weniger; auf schmalen Bildschirmen untereinander */
.card.behalf .grid.g4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, .7fr); }
@media (max-width: 960px) { .card.behalf .grid.g4 { grid-template-columns: minmax(0, 1fr); } }
.add-block { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
/* Bestellungen: Sendungsverfolgung unter dem Status (nur intern) */
.track { margin-top: 5px; font-size: .74rem; line-height: 1.35; display: grid; gap: 2px; justify-items: start; }
.track a[data-track-edit] { font-size: .72rem; }
.track-btn { display: inline-block; padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; font-weight: 700; }
.track-btn:hover { border-color: var(--teal); }
.track-edit { margin-top: 6px; display: grid; gap: 4px; }
.track-edit .inline-input { width: 170px; font-size: .78rem; padding: 4px 7px; }
/* Übersicht: 5 Kacheln mit Hover */
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .g5 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat.teal { border-left-color: var(--teal); }
a.card.stat { text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s, border-color .12s; }
a.card.stat:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(22, 39, 63, .14); border-color: var(--teal); }
a.card.stat:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.stat .l b { color: var(--ink); font-weight: 700; }/* Neue manuelle Kommentare: Sprechblase in der Auftragsliste, Hinweis neben dem Stichtag, Hervorhebung im Verlauf */
.cmt-new { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: var(--btn-orange); color: #fff; font-size: .75rem; font-weight: 800; line-height: 19px; cursor: help; white-space: nowrap; }
.new-cmt-box { padding: 8px 14px; max-width: 360px; text-align: left; font: inherit; color: inherit; cursor: pointer; border-left: 4px solid var(--orange); }
.new-cmt-box:hover { border-color: var(--orange); }
.new-cmt-box + .card { margin-top: 0; }
.new-cmt-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0; font-weight: 600; overflow-wrap: anywhere; }
.timeline li.new { background: var(--warn-bg); border-radius: 6px; padding-top: 4px; padding-right: 8px; margin-bottom: 6px; }
.timeline .new-tag { color: var(--warn); }
