:root {
  --bg: #f3f4f1;
  --surface: #ffffff;
  --surface-2: #f7f8f6;
  --text: #1a201d;
  --muted: #5e6862;
  --border: #dde1dc;
  --brand: #16382f;
  --brand-ink: #e8f1ec;
  --primary: #1f6b52;
  --primary-hover: #185a45;
  --primary-soft: #e3f1ea;
  --ok: #1e7a4c;
  --ok-soft: #e1f3e8;
  --warn: #9a5b00;
  --warn-soft: #fdf0d9;
  --danger: #b3261e;
  --danger-soft: #fbe5e3;
  --info: #23589c;
  --info-soft: #e3edf9;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 1px 1px rgb(20 30 25 / 4%), 0 2px 12px rgb(20 30 25 / 5%);
  --shadow-lg: 0 24px 64px rgb(10 20 15 / 22%), 0 2px 8px rgb(10 20 15 / 8%);
  --separator: rgb(60 67 63 / 14%);
  --fill: rgb(118 128 122 / 12%);
  --bar: rgb(249 250 248 / 72%);
  --scrim: rgb(10 20 15 / 38%);
  /* Federkurven: ohne Überschwingen (Dämpfung 1.0) und Spiegelkurve für den Rückweg */
  --ease-spring: cubic-bezier(.22, 1, .36, 1);
  --ease-spring-in: cubic-bezier(.64, 0, .78, 0);
  --press: 100ms;
  --nav-h: 64px;
  --top-h: 56px;
  color-scheme: light;
}

/* Dunkel: per System oder per Umschalter (data-theme wird in app.js gesetzt) */
:root[data-theme="dark"] {
    /* Karten deutlich vom Hintergrund absetzen, Texte und Linien kräftiger */
    --bg: #0e1110;
    --surface: #1b2220;
    --surface-2: #242c29;
    --text: #edf1ef;
    --muted: #aab5af;
    --border: #39433e;
    --brand: #0f2620;
    --primary: #5ccb9d;
    --primary-hover: #6fd6ab;
    --primary-soft: #1d3a2f;
    --ok: #4cc287;
    --ok-soft: #173426;
    --warn: #e2a443;
    --warn-soft: #3a2c13;
    --danger: #ef7a72;
    --danger-soft: #3f1f1c;
    --info: #8dbcf2;
    --info-soft: #1c2d44;
    /* feiner heller Rand statt Schatten – im Dunkeln sieht man Schatten kaum */
    --shadow: 0 0 0 1px rgb(255 255 255 / 7%), 0 2px 10px rgb(0 0 0 / 45%);
    --shadow-lg: 0 24px 64px rgb(0 0 0 / 60%), 0 0 0 1px rgb(255 255 255 / 9%);
    --separator: rgb(255 255 255 / 14%);
    --fill: rgb(255 255 255 / 10%);
    --bar: rgb(24 30 28 / 80%);
    --scrim: rgb(0 0 0 / 50%);
    --btn-primary: #1f7a5a;
    --btn-primary-hover: #24896a;
    --btn-ok: #1d7a4b;
    --btn-danger: #b3352d;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  /* Systemschrift (SF Pro auf Apple-Geräten) mit optischer Größe */
  font: 100%/1.47 -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI Variable", "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
a { color: var(--primary); text-decoration: none; }
/* Laufweite abhängig von der Größe: große Schrift enger, kleine etwas weiter */
h1, h2, h3 { margin: 0; font-weight: 700; }
h1 { font-size: 1.85rem; line-height: 1.12; letter-spacing: -0.024em; }
h2 { font-size: 1.12rem; line-height: 1.25; letter-spacing: -0.012em; margin: 1.15rem 0 .5rem; }
h3 { letter-spacing: -0.006em; }
small { font-size: .82rem; letter-spacing: .006em; }
@media (min-width: 900px) { h1 { font-size: 2rem; } }
a, button, label, summary, select, [role=button] { touch-action: manipulation; }
button, .btn, .nav-link, .tab, .chip, .action-item { -webkit-user-select: none; user-select: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }
code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 .3em; font-size: .9em; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.text-warn { color: var(--warn); font-weight: 600; }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  height: calc(var(--top-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  /* Material: Inhalt scrollt sichtbar darunter durch */
  background: color-mix(in srgb, var(--brand) 84%, transparent); color: var(--brand-ink);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; font-weight: 700; font-size: 1.05rem; }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* Abo gesperrt: Hinweisleiste unter der Kopfzeile, deaktivierte Eingaben deutlich ausgegraut */
.lock-banner { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--danger-soft); color: var(--danger); font-size: .9rem; font-weight: 600; }
.lock-banner[hidden] { display: none; }
.lock-banner .ic { width: 18px; height: 18px; flex: none; }
.lock-banner span { flex: 1; min-width: 0; }
.lock-banner .btn { min-height: 32px; background: var(--surface); color: var(--danger); }
.readonly [data-locked] { opacity: .45; cursor: not-allowed; }
.lock-contacts { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 8px; }
.lock-contacts li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--fill); color: var(--text); }
.lock-contacts .ic { width: 18px; height: 18px; margin-top: 2px; color: var(--muted); flex: none; }
.sub-line { display: inline-flex; align-items: center; gap: 6px; margin: -4px 0 12px; padding: 5px 12px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.sub-line .ic { width: 16px; height: 16px; }
.sub-line.ok { background: var(--ok-soft); color: var(--ok); }
.sub-line.warn { background: var(--warn-soft); color: var(--warn); }
.sub-line.danger { background: var(--danger-soft); color: var(--danger); }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.company-name { opacity: .8; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.company-switch {
  min-width: 0; max-width: 220px; flex: 0 1 auto;
  background: rgb(255 255 255 / 12%); color: inherit; border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 8px; padding: 6px 8px; font: inherit; font-size: .9rem;
}
.company-switch option { color: #1a201d; }
.topbar-actions { margin-left: auto; display: flex; gap: 4px; }
.topbar .icon-btn { color: inherit; }
@media (hover: hover) { .topbar .icon-btn:hover { background: rgb(255 255 255 / 12%); } }
.topbar .icon-btn:active { background: rgb(255 255 255 / 18%); }
.badge-count {
  position: absolute; top: 2px; right: 0;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: #e5484d; color: #fff; font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center;
}

.layout { display: block; }
.view { padding: 14px 16px calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); max-width: 1100px; margin: 0 auto; }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bar);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 -0.5px 0 var(--separator);
}
.nav-link {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .01em;
  transition: color .2s, transform var(--press) ease-out;
}
.nav-link .ic { width: 23px; height: 23px; transition: transform .25s var(--ease-spring); }
.nav-link:active .ic { transform: scale(.88); }
.nav-link.active { color: var(--primary); }
.nav-link.active .ic { stroke-width: 2.3; }
.nav-link.secondary { display: none; }
.nav-link .lbl-full { display: none; }

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); }
  .nav {
    /* inset vor top: die Kurzschreibweise würde top sonst wieder auf auto setzen.
       align-self: start – sonst streckt das Grid die Leiste auf Seitenhöhe. */
    position: sticky; inset: auto; top: var(--top-h); height: calc(100vh - var(--top-h)); align-self: start;
    flex-direction: column; justify-content: flex-start; gap: 2px; padding: 16px 10px;
    /* Seitenleiste: schwereres, ruhiges Material trennt die Struktur */
    background: var(--surface-2); box-shadow: inset -0.5px 0 0 var(--separator);
    -webkit-backdrop-filter: none; backdrop-filter: none; overflow-y: auto;
  }
  .nav-link, .nav-link.secondary {
    flex: none; display: flex; flex-direction: row; justify-content: flex-start; gap: 12px;
    padding: 8px 12px; border-radius: 10px; font-size: .94rem; font-weight: 500; letter-spacing: -0.003em; color: var(--text);
  }
  .nav-link .ic { width: 20px; height: 20px; color: var(--muted); }
  .nav-link:active .ic { transform: none; }
  .nav-link:active { transform: scale(.98); }
  .nav-link:hover { background: var(--fill); }
  .nav-link.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
  .nav-link.active .ic { color: var(--primary); }
  .nav-link.main + .nav-link.secondary { margin-top: 12px; }
  .nav-link .lbl-full { display: inline; }
  .nav-link .lbl-short { display: none; }
  .nav-link.more { display: none; }
  .view { padding: 28px 32px 48px; width: 100%; }
}

/* ---------- Seitenelemente ---------- */
.page-head { margin-bottom: 12px; }
.page-head p { margin: 4px 0 0; max-width: 70ch; font-size: .92rem; line-height: 1.42; }
/* Handy: Erklärtexte unter dem Titel auf 2 Zeilen kürzen – Tippen klappt sie aus */
@media (max-width: 600px) {
  .page-head p.muted:not(.open) { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; cursor: pointer; }
}
.back { display: inline-block; margin-bottom: 6px; font-size: .9rem; font-weight: 600; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 1.1rem 0 .5rem; }
.section-head h2 { margin: 0; }
.link-more { font-size: .85rem; font-weight: 600; margin-left: 8px; }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }
.page-actions { margin-top: 24px; display: flex; gap: 8px; flex-wrap: wrap; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card h2 { margin-top: 0; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input[type=search] { flex: 1 1 220px; max-width: 420px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 0; background: var(--fill); color: var(--primary);
  font: inherit; font-weight: 600; font-size: .95rem; letter-spacing: -0.005em; cursor: pointer; white-space: nowrap;
  transition: background-color .2s, filter .2s, transform .3s var(--ease-spring);
}
/* Rückmeldung beim Drücken, nicht erst beim Loslassen */
.btn:active { transform: scale(.97); filter: brightness(.94); transition-duration: var(--press); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn.primary { background: var(--btn-primary, var(--primary)); color: #fff; }
.btn.danger { background: var(--btn-danger, var(--danger)); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: .86rem; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; font-size: 1.08rem; border-radius: 16px; flex: 1; }
.btn.big .ic { width: 24px; height: 24px; }
.btn.ok { background: var(--btn-ok, var(--ok)); color: #fff; }
.btn.warn { background: var(--warn-soft); color: var(--warn); }
@media (hover: hover) {
  .btn:hover { filter: brightness(.97); }
  .btn.primary:hover, .btn.danger:hover, .btn.ok:hover { filter: brightness(1.08); }
  .btn.ghost:hover { background: var(--fill); }
}
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  transition: background-color .2s, transform .3s var(--ease-spring);
}
.icon-btn:active { transform: scale(.92); background: var(--fill); transition-duration: var(--press); }
@media (hover: hover) { .icon-btn:hover { background: var(--fill); color: var(--text); } }

/* ---------- Formulare ---------- */
input, select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 16px;
  transition: border-color .2s, box-shadow .2s;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: 0; border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent);
}
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; margin-bottom: 5px; font-size: .84rem; font-weight: 600; letter-spacing: .004em; color: var(--muted); }
.hint { display: block; margin-top: 4px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; cursor: pointer; }
.check input { width: 20px; min-height: 20px; height: 20px; accent-color: var(--primary); }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: 8px; font-size: .9rem; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--brand); }
.login { width: 100%; max-width: 380px; padding: 28px 24px; text-align: left; }
.login-logo { width: 56px; height: 56px; border-radius: 14px; display: block; margin-bottom: 14px; }
.login h1 { margin-bottom: 4px; }
.login p.muted { margin: 0 0 20px; }
.login-wrap { grid-template-rows: 1fr auto; }
.login-wrap > .login { align-self: center; }
.login-legal { display: flex; gap: 18px; justify-content: center; padding-top: 18px; font-size: .85rem; }
.login-legal a { color: rgb(255 255 255 / 78%); }
.login-legal a:hover { color: #fff; }

/* ---------- Impressum / Datenschutz ---------- */
.legal-page { background: var(--bg); }
.legal-top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 16px 0;
  background: var(--brand); color: var(--brand-ink);
}
.legal-top .brand { color: inherit; }
.legal-back { color: inherit; font-weight: 600; font-size: .92rem; opacity: .9; }
.legal { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; line-height: 1.6; }
.legal h1 { margin: 6px 0 4px; }
.legal section { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 14px 18px; margin: 12px 0; }
.legal h2 { margin: 0 0 6px; font-size: 1.05rem; }
.legal h3 { margin: 14px 0 2px; font-size: .95rem; }
.legal p { margin: 6px 0; }
.legal ul { margin: 6px 0; padding-left: 20px; }
.legal li { margin: 3px 0; }
.legal-links { text-align: center; margin-top: 20px; }
.nav-legal { display: none; }
@media (min-width: 900px) {
  .nav-legal { display: flex; gap: 14px; margin-top: auto; padding: 14px 12px 4px; font-size: .78rem; }
  .nav-legal a { color: var(--muted); }
  .nav-legal a:hover { color: var(--text); }
}
.legal-foot { display: flex; gap: 18px; justify-content: center; margin: 22px 0 6px; font-size: .88rem; }
.legal-foot a { color: var(--muted); }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  display: flex; flex-direction: column; gap: 1px; padding: 10px 14px; border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
  transition: transform .35s var(--ease-spring);
}
a.stat:active, .quick-btn:active { transform: scale(.97); transition-duration: var(--press); }
.stat-n { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.05; letter-spacing: -0.02em; }
.stat-l { font-size: .8rem; color: var(--muted); letter-spacing: .01em; }
.stat.warn { background: var(--warn-soft); border-color: transparent; }
.stat.warn .stat-n { color: var(--warn); }
.stat.danger { background: var(--danger-soft); border-color: transparent; }
.stat.danger .stat-n { color: var(--danger); }
.stat.info { background: var(--info-soft); border-color: transparent; }
.stat.info .stat-n { color: var(--info); }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.quick-btn {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-lg);
  background: var(--btn-primary, var(--primary)); color: #fff; box-shadow: var(--shadow);
  transition: transform .35s var(--ease-spring), filter .2s;
}
.quick-btn:active { filter: brightness(.92); }
/* Nur die wichtigste Aktion ist gefüllt, die übrigen sind ruhige Karten mit farbigem Symbol */
.quick-btn:not(:first-child) { background: var(--surface); color: var(--text); }
.quick-btn:not(:first-child) .ic { box-sizing: content-box; padding: 7px; border-radius: 10px; width: 22px; height: 22px; background: var(--primary-soft); color: var(--primary); }
.quick-btn:not(:first-child) small { color: var(--muted); opacity: 1; }
.quick-btn:not(:first-child):active { filter: none; background: var(--surface-2); }
.list + .quick, .list + .stats, section + .quick { margin-top: 12px; }
.quick-btn .ic { width: 28px; height: 28px; }
.quick-btn span { display: flex; flex-direction: column; min-width: 0; }
.quick-btn small { opacity: .95; }
/* Scannen als breiter Hauptknopf, darunter kompakte Kacheln: Symbol links, Text rechts */
.quick { margin-bottom: 6px; }
.quick-btn:first-child { grid-column: 1 / -1; }
.quick-btn:not(:first-child) { gap: 10px; padding: 10px 12px; }
.quick-btn:not(:first-child) small { line-height: 1.25; }
.quick-btn:not(:first-child) strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 700px) { .quick { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Listen ---------- */
/* Gruppierte Liste: Haarlinien eingerückt, wie in den iOS-Einstellungen */
.list { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.list-item {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-height: 48px; padding: 10px 16px; border: 0;
  background: none; color: var(--text); font: inherit; text-align: left;
  transition: background-color .25s;
}
.list-item + .list-item::before { content: ''; position: absolute; top: 0; left: 16px; right: 0; border-top: 1px solid var(--separator); }
a.list-item, button.list-item { cursor: pointer; }
a.list-item:active, button.list-item:active { background: var(--fill); transition-duration: 0s; }
@media (hover: hover) { a.list-item:hover, button.list-item:hover { background: var(--fill); } }
.list-item > div:first-child { min-width: 0; }
.list-item strong { display: block; }
.list-item small { color: var(--muted); }
.list-item.unread { background: var(--info-soft); }
.list-item .msg { margin: 6px 0 2px; }
/* Menü wie die iOS-Einstellungen: Symbol im farbigen Quadrat, Name, Pfeil */
.menu-list .list-item { justify-content: flex-start; gap: 14px; min-height: 56px; padding: 10px 14px 10px 16px; }
.menu-list .list-item .grow { flex: 1; min-width: 0; font-weight: 600; }
.menu-list .list-item + .list-item::before { left: 62px; }
.menu-ic { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary); }
.menu-ic .ic { width: 19px; height: 19px; }
.menu-list .list-item > .ic:last-child { width: 18px; height: 18px; color: var(--muted); opacity: .6; }
.list-item > .row { flex: none; flex-wrap: nowrap; }
@media (max-width: 480px) {
  .list-item > .row { flex-direction: column; align-items: flex-end; gap: 6px; }
}

.empty { text-align: center; padding: 24px 20px; color: var(--muted); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.empty strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }
.empty p { margin: 0 0 12px; }

.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  font-size: .76rem; font-weight: 600; letter-spacing: .01em; background: var(--fill); color: var(--muted); border: 1px solid transparent;
}
.pill.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: transparent; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; font-weight: 500; }
.alert .ic { margin-top: 1px; }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.danger { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--info-soft); color: var(--info); }
.alert.small { padding: 8px 12px; font-size: .9rem; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: thin; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; border: 0;
  background: var(--fill); color: var(--text); font-size: .9rem; font-weight: 500; white-space: nowrap;
  transition: background-color .2s, color .2s, transform .3s var(--ease-spring);
}
.chip:active { transform: scale(.95); transition-duration: var(--press); }
.chip small { color: var(--muted); }
.chip.active { background: var(--btn-primary, var(--primary)); border-color: var(--btn-primary, var(--primary)); color: #fff; }
.chip.active small { color: rgb(255 255 255 / 80%); }

/* Tabs als Segment-Steuerung (bekanntes iOS-Muster) */
.tabs {
  display: flex; gap: 2px; padding: 2px; margin-bottom: 14px; border-radius: 11px;
  background: var(--fill); overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 4px;
  min-height: 36px; padding: 6px 12px; border-radius: 9px;
  color: var(--text); font-size: .9rem; font-weight: 500; white-space: nowrap; text-align: center;
  transition: background-color .25s var(--ease-spring), box-shadow .25s, transform .3s var(--ease-spring);
}
.tab:active { transform: scale(.97); transition-duration: var(--press); }
.tab.active { background: var(--surface); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 12%), 0 0 0 .5px rgb(0 0 0 / 4%); }
[data-theme="dark"] .tab.active { background: #46514c; }
button.tab { border: 0; background: none; font: inherit; font-size: .9rem; cursor: pointer; }
.tab .ic { width: 17px; height: 17px; }
.theme-choice { max-width: 420px; margin-bottom: 8px; }
.theme-choice .tab { flex: 1 1 0; }
.small-note { font-size: .85rem; margin: 0; }

.tab-count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--fill); font-size: .74rem; font-weight: 600; text-align: center; color: var(--muted); }
.tab.active .tab-count { background: var(--primary-soft); color: var(--primary); }

.segmented { display: inline-flex; gap: 2px; padding: 2px; border-radius: 11px; background: var(--fill); }
.segmented a { padding: 7px 12px; border-radius: 9px; color: var(--text); font-weight: 500; font-size: .9rem; transition: background-color .25s; }
.segmented a.active { background: var(--surface); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
[data-theme="dark"] .segmented a.active { background: #46514c; }
/* Weicher Wechsel zwischen hell und dunkel statt hartem Helligkeitssprung */
html.theme-fade, html.theme-fade *, html.theme-fade *::before { transition: background-color .35s ease, color .35s ease, border-color .35s ease, box-shadow .35s ease !important; }

/* ---------- Kleiderkammer: Ausgaben ---------- */
.issue-list { display: grid; gap: 10px; }
@media (min-width: 900px) { .issue-list { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); } }
.issue-card {
  display: flex; flex-direction: column; gap: 10px; padding: 14px 16px;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow);
  border-left: 4px solid var(--info);
}
.issue-card.returned { border-left-color: var(--fill); }
.issue-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.issue-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.issue-fields .field { margin: 0; }
@media (max-width: 420px) { .issue-fields { grid-template-columns: 1fr; } }
.issue-ro { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.issue-ro > div { display: flex; flex-direction: column; }
.issue-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ---------- Tabellen (auf dem Handy als Karten) ---------- */
.table-wrap { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; vertical-align: middle; }
th { font-size: .8rem; font-weight: 600; letter-spacing: .01em; color: var(--muted); background: var(--surface); border-bottom: 1px solid var(--separator); }
td { border-bottom: 1px solid var(--separator); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover, th.sortable:focus-visible { color: var(--text); }
th.sortable::after { content: '↕'; margin-left: 5px; opacity: .35; font-size: .9em; }
th.sortable.sorted { color: var(--primary); }
th.sortable.sorted::after { content: '▲'; opacity: 1; font-size: .75em; }
th.sortable.sorted.desc::after { content: '▼'; }
.sort-select { width: auto; min-width: 150px; }
@media (min-width: 721px) { .mobile-only { display: none !important; } }
td.actions { text-align: right; white-space: nowrap; }
tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.row-danger td:first-child { box-shadow: inset 3px 0 0 var(--danger); }

@media (max-width: 720px) {
  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .table-wrap table, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; }
  .table-wrap thead { display: none; }
  .table-wrap tr {
    background: var(--surface); border-radius: var(--radius-lg);
    margin-bottom: 10px; padding: 10px 16px; box-shadow: var(--shadow);
  }
  .table-wrap tr.row-warn { border-left: 4px solid var(--warn); }
  .table-wrap tr.row-danger { border-left: 4px solid var(--danger); }
  .table-wrap tr td:first-child { box-shadow: none; }
  .table-wrap td { border: 0; padding: 4px 0; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 6px; text-align: right; }
  .table-wrap td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: .85rem; text-align: left; flex: none; margin-right: auto; padding-right: 12px; }
  .table-wrap td:first-child { font-size: 1.02rem; text-align: left; justify-content: flex-start; align-items: baseline; }
  .table-wrap td:first-child::before { display: none; }
  .table-wrap td.actions { justify-content: flex-end; padding-top: 8px; margin-top: 4px; border-top: 1px solid var(--separator); flex-wrap: wrap; }
}

/* ---------- Bestand: rot unter Mindestbestand, +1, Icons, kompakte Karten ---------- */
.stock-legend { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--danger); font-size: .9rem; font-weight: 500; }
.stock-legend .ic { width: 18px; height: 18px; }
.stock-table tr.row-low td { background: var(--danger-soft); }
.stock-table tr.row-low td:first-child { box-shadow: inset 4px 0 0 var(--danger); }
.stock-table tr.row-low .qty-val strong { color: var(--danger); }
.stock-table .meta { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.stock-table .meta .ic { width: 15px; height: 15px; color: var(--muted); flex: none; }
.stock-table .c-min .meta + .meta { margin-left: 8px; }
.stock-table .pill .ic { margin-right: 3px; }
.stock-table .c-qty { white-space: nowrap; }
.stock-table td.c-item small { display: block; margin: 2px 0 0 40px; font-size: .78rem; }
.qty-val strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.plus-one {
  margin-left: 8px; min-width: 44px; height: 32px; padding: 0 10px; border-radius: 999px; border: 0;
  background: var(--primary-soft); color: var(--primary); font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer;
  transition: transform var(--press) ease-out, background-color .2s;
}
.plus-one:active { transform: scale(.92); }
.row-low .plus-one { background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.plus-one:disabled { opacity: .5; }
.plus-one.bump { animation: plus-bump .35s var(--ease-spring); }
@keyframes plus-bump { 0% { transform: scale(.85); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .plus-one.bump { animation: none; } }

@media (max-width: 720px) {
  /* Karte in zwei Zeilen: Artikel + Menge/+1 · darunter Lagerort, Min./Max., Ablauf als kleine Angaben mit Icon */
  .stock-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; padding: 8px 12px; margin-bottom: 8px; }
  .stock-table tr.row-low { border-left: 4px solid var(--danger); background: var(--danger-soft); }
  .stock-table tr.row-low td { background: none; }
  .stock-table td { padding: 0; display: block; text-align: left; }
  .stock-table td[data-label]::before { display: none; }
  .stock-table tr.row-low td:first-child { box-shadow: none; }
  /* Zeile 1: Artikel + Menge/+1 (feste Breiten erzwingen den Umbruch), Zeile 2: Angaben + Aktionen */
  .stock-table td.c-item { order: 1; flex: 1 0 calc(100% - 132px); min-width: 0; font-size: 1rem; display: flex; align-items: center; }
  .stock-table td.c-item .item-link { min-width: 0; }
  .stock-table td.c-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .stock-table td.c-item small { display: none; }
  .stock-table .thumb.sm { width: 36px; height: 36px; margin-right: 10px; }
  .stock-table td.c-qty { order: 2; flex: 0 0 120px; display: flex; align-items: center; justify-content: flex-end; }
  /* Lagerort nimmt nur den Restplatz und kürzt mit „…“ – so bleiben Angaben und Aktionen in einer Zeile */
  .stock-table td.c-loc { order: 3; flex: 1 1 0; min-width: 0; overflow: hidden; }
  .stock-table td.c-loc .meta { display: flex; }
  .stock-table td.c-loc .meta > :not(.ic) { overflow: hidden; text-overflow: ellipsis; }
  .stock-table td.c-min { order: 4; }
  .stock-table td.c-exp { order: 5; }
  .stock-table td.c-loc, .stock-table td.c-min, .stock-table td.c-exp { font-size: .82rem; color: var(--muted); }
  .stock-table td.c-loc .meta { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .stock-table td.is-empty { display: none; }
  .stock-table td.c-exp .pill, .stock-table td.c-min .pill { font-size: .75rem; padding: 1px 7px; }
  .stock-table td.c-min .pill.danger { display: none; } /* die rote Karte sagt es schon – spart eine Zeile */
  .stock-table tr.row-low .c-min { color: var(--danger); }
  .stock-table tr.row-low .c-min .ic { color: var(--danger); }
  .stock-table td.actions { order: 6; margin: 0 -6px 0 auto; padding: 0; border: 0; display: flex; gap: 0; }
  .stock-table td.actions .icon-btn { width: 36px; height: 36px; }
  .stock-table td.actions .icon-btn .ic { width: 18px; height: 18px; }
}

/* ---------- Inventur ---------- */
.count-list { display: grid; gap: 10px; }
.count-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 16px; border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow); border-left: 4px solid var(--fill);
  transition: border-color .3s;
}
.count-card.done { border-left-color: var(--ok); }
.count-card.done.dev { border-left-color: var(--warn); }
.count-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 220px; }
.count-info small { color: var(--muted); }
.inline-date { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: .85rem; color: var(--muted); }
.inline-date input { width: auto; min-height: 36px; padding: 4px 8px; }
.count-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.stepper { display: flex; align-items: stretch; border-radius: 12px; overflow: hidden; background: var(--fill); }
.stepper button {
  width: 48px; border: 0; background: transparent; color: var(--primary); font-size: 1.4rem; cursor: pointer;
  transition: background-color .25s;
}
.stepper button:active { background: var(--primary-soft); transition-duration: 0s; }
.stepper input { background: transparent; }
.stepper input {
  width: 84px; min-height: 48px; border: 0; border-radius: 0; text-align: center; font-size: 1.2rem; font-weight: 700;
  font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield;
}
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input:focus { outline: 0; background: var(--primary-soft); }

.sticky-footer {
  position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-lg);
  background: var(--bar); box-shadow: 0 8px 28px rgb(0 0 0 / 14%), 0 0 0 .5px var(--separator);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
}
@media (min-width: 900px) { .sticky-footer { bottom: 16px; } }

/* ---------- Prüfung ---------- */
.progress { position: relative; height: 30px; border-radius: 999px; background: var(--fill); overflow: hidden; margin-bottom: 14px; }
.progress-bar { position: absolute; inset: 0 auto 0 0; background: var(--primary-soft); transition: width .5s var(--ease-spring); }
.progress span { position: relative; display: block; text-align: center; line-height: 28px; font-size: .85rem; font-weight: 600; }

.step-card {
  background: var(--surface); border-radius: 22px; padding: 16px;
  box-shadow: var(--shadow); max-width: 640px;
}
.step-count { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .86rem; font-weight: 600; letter-spacing: .01em; }
.step-title { font-size: 1.65rem; line-height: 1.15; letter-spacing: -0.02em; margin: 8px 0 6px; }
.step-req { font-size: 1.1rem; margin-bottom: 16px; }
.step-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.step-actions .row { flex-wrap: nowrap; }
.step-nav { display: flex; justify-content: space-between; margin-top: 12px; }
.step-card.done { text-align: center; padding: 32px 20px; }
.step-card.done h2 { margin: 10px 0 6px; font-size: 1.3rem; }
.done-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.done-icon .ic { width: 34px; height: 34px; }

.check-overview { list-style: none; margin: 0; padding: 0; background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; max-width: 640px; box-shadow: var(--shadow); }
.check-overview li { border-bottom: 1px solid var(--separator); }
.check-overview li:last-child { border-bottom: 0; }
.check-overview button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px;
  border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.check-overview button.current { background: var(--primary-soft); }
.ov-name { flex: 1; min-width: 0; }
.ov-qty { color: var(--muted); font-size: .88rem; font-variant-numeric: tabular-nums; }

/* ---------- Import ---------- */
.stats-list { margin: 8px 0; padding-left: 20px; }
.error-list { color: var(--danger); font-size: .9rem; padding-left: 20px; }
.help { margin-top: 16px; }
.help summary { cursor: pointer; font-weight: 600; }
.help table td { padding: 6px 8px; border-bottom: 1px solid var(--separator); font-size: .9rem; overflow-wrap: anywhere; vertical-align: top; }
.help table td:first-child { width: 38%; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }

/* ---------- Dialog ---------- */
/* Desktop: Dialog erscheint mittig und verschwindet auf demselben Weg.
   Handy: Sheet fährt von unten herein, lässt sich nach unten wegziehen und verlässt den Bildschirm nach unten. */
.modal {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0;
  border: 0; border-radius: 22px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
  animation: modal-in .38s var(--ease-spring);
}
.modal::backdrop { background: var(--scrim); animation: scrim-in .3s ease-out; }
.modal.closing { animation: modal-out .2s var(--ease-spring-in) forwards; pointer-events: none; }
.modal.closing::backdrop { animation: scrim-out .2s ease-in forwards; }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes modal-out { to { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes scrim-in { from { opacity: 0; } }
@keyframes scrim-out { to { opacity: 0; } }
/* Spaltenaufbau: Kopf und Knöpfe bleiben stehen, der Inhalt dazwischen scrollt (Mausrad, Trackpad, Finger) */
.modal[open] { display: flex; flex-direction: column; overflow: hidden; }
.modal form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; max-height: calc(100dvh - 24px); }
.modal > :not(.modal-head):not(.sheet-grabber):not(form):not(.modal-actions) { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.modal-head, .modal-actions, .modal-intro { flex: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 14px 4px 20px; }
.modal-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: -0.015em; }
.modal-head .icon-btn { width: 32px; height: 32px; border-radius: 50%; background: var(--fill); }
.modal-head .icon-btn .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.modal-intro { padding: 0 20px; color: var(--muted); }
.modal-body { padding: 8px 20px 0; flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.modal .form-error { margin: 0 20px 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }
.sheet-grabber { display: none; }
@media (max-width: 560px) {
  .modal {
    width: 100vw; max-width: 100vw; margin: auto 0 0; max-height: calc(100dvh - 12px - env(safe-area-inset-top));
    border-radius: 22px 22px 0 0; animation: sheet-in .5s var(--ease-spring);
    touch-action: pan-y;
  }
  .modal.closing { animation: sheet-out .28s var(--ease-spring-in) forwards; }
  .modal.dragged { animation: none; }
  .modal form { max-height: inherit; }
  .sheet-grabber {
    display: block; position: absolute; top: 0; left: 0; right: 0; height: 22px; z-index: 2; cursor: grab; touch-action: none;
  }
  .sheet-grabber::after { content: ''; position: absolute; top: 7px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--separator); background: color-mix(in srgb, var(--muted) 45%, transparent); }
  .modal-head { padding-top: 24px; touch-action: none; }
  .modal-actions { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .modal-actions .btn { flex: 1; }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  padding: 12px 18px; border-radius: 16px; color: #fff; font-weight: 500; letter-spacing: -0.003em;
  background: rgb(30 37 34 / 84%); box-shadow: 0 10px 30px rgb(0 0 0 / 22%);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  animation: toast-in .45s var(--ease-spring);
}
.toast.error { background: color-mix(in srgb, var(--btn-danger, var(--danger)) 92%, transparent); }
/* gleicher Weg hinaus wie herein */
.toast.out { animation: toast-out .25s var(--ease-spring-in) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(16px) scale(.96); } }
@media (min-width: 900px) { #toasts { bottom: 24px; } }

/* Seitenwechsel: kurzes Einblenden, ohne Wartezeit für die Eingabe */
.page.enter { animation: page-in .3s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

/* Weniger Bewegung: Überblenden statt Schieben/Skalieren */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-property: opacity, background-color, color, border-color, box-shadow !important; }
  .modal, .modal.closing, .toast, .toast.out, .page.enter { animation-name: fade !important; animation-duration: .2s !important; }
  .modal.closing, .toast.out { animation-name: fade-out !important; }
  .btn:active, .icon-btn:active, .chip:active, .tab:active, a.stat:active, .quick-btn:active { transform: none; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }

/* Weniger Transparenz: feste Flächen statt Glas */
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--brand); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .nav, .sticky-footer { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .toast { background: #1f2a25; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
/* Mehr Kontrast: deutliche Kanten */
@media (prefers-contrast: more) {
  :root { --separator: var(--muted); --fill: rgb(118 128 122 / 22%); }
  .card, .list, .table-wrap, .stat, .step-card, .empty, .modal, .btn, .tab.active { outline: 1px solid var(--text); outline-offset: -1px; }
  .topbar, .nav { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .topbar { background: var(--brand); }
  .nav { background: var(--surface); box-shadow: 0 -1px 0 var(--text); }
}

/* ---------- Ortsbaum ---------- */
.tree-name { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 0 6px; max-width: 100%; padding-left: calc(var(--d, 0) * 18px); }
.tree-branch { color: var(--muted); font-size: .85rem; }
.tree-sub { display: block; padding-left: calc(var(--d, 0) * 18px); }
@media (min-width: 721px) {
  .table-wrap { overflow-x: auto; }
  .tree-table td:first-child { white-space: nowrap; }
}
@media (max-width: 720px) { .tree-name { padding-left: calc(var(--d, 0) * 12px); } }
.group-head {
  display: flex; align-items: center; gap: 8px; margin: 10px 0 0; padding: 6px 4px;
  color: var(--muted); font-size: .85rem; font-weight: 700; text-transform: none;
}
.group-head .ic { width: 16px; height: 16px; }

/* ---------- Artikelbilder ---------- */
.thumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; flex: none; background: var(--surface-2); border: 1px solid var(--border); }
.thumb.sm { width: 32px; height: 32px; border-radius: 6px; vertical-align: middle; margin-right: 8px; }
.withdraw-item .grow { flex: 1; min-width: 0; }
.withdraw-item small { display: block; }
.small-text { font-size: .85rem; display: flex; align-items: center; gap: 6px; margin: 4px 0 0; }
.small-text .ic { width: 16px; height: 16px; }

/* ---------- Prüfung: Ort, Bild, Funktionskontrolle ---------- */
.step-loc { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 6px 10px; border-radius: 8px; background: var(--primary-soft); color: var(--primary); font-size: .85rem; font-weight: 600; }
.step-loc .ic { width: 16px; height: 16px; }
.step-main { display: flex; gap: 16px; align-items: flex-start; }
/* Artikelfoto: groß genug, um das Teil sicher zu erkennen; antippen vergrößert */
.step-img {
  position: relative; flex: none; display: grid; place-items: center; overflow: hidden;
  width: 200px; height: 200px; margin-top: 8px; padding: 0; border: 0; border-radius: 16px;
  background: #fff; box-shadow: inset 0 0 0 1px var(--separator); cursor: zoom-in;
  transition: transform .35s var(--ease-spring);
}
.step-img:active { transform: scale(.98); transition-duration: var(--press); }
.step-img img { width: 100%; height: 100%; object-fit: contain; }
.zoom-hint {
  position: absolute; right: 8px; bottom: 8px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: rgb(20 26 23 / 55%); color: #fff; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.zoom-hint .ic { width: 17px; height: 17px; }
.step-img.no-photo {
  gap: 6px; align-content: center; background: var(--fill); box-shadow: none; color: var(--primary);
  font-size: .85rem; font-weight: 600; cursor: pointer; border: 1.5px dashed var(--separator);
}
.step-img.no-photo .ic { width: 28px; height: 28px; }
.step-img.sm { width: 72px; height: 72px; margin: 0; border-radius: 12px; }
.step-img.sm .zoom-hint { width: 22px; height: 22px; right: 4px; bottom: 4px; }
.step-img.sm .zoom-hint .ic { width: 12px; height: 12px; }
.step-img.sm.no-photo span { display: none; }
.fc-item { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.fc-item .fc-head { margin: 0; }
@media (max-width: 480px) {
  .step-main { flex-direction: column; }
  .step-main > .step-img { width: 100%; height: 240px; }
  .step-main > .step-img.no-photo { height: 88px; display: flex; justify-content: center; gap: 10px; }
}
.thumb.xs { width: 30px; height: 30px; border-radius: 7px; flex: none; }
.thumb-btn { padding: 0; border: 0; background: none; cursor: zoom-in; vertical-align: middle; }

/* Infos auf der Startseite */
.infos { margin-top: 12px; }
.infos .section-head { margin-top: 0; }
.info-list { display: grid; gap: 10px; }
@media (min-width: 900px) { .info-list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }
.info-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: stretch; gap: 6px; width: 100%; padding: 14px 16px;
  border: 0; border-left: 4px solid var(--btn-primary, var(--primary)); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow); font: inherit; text-align: left; cursor: pointer;
  transition: transform .35s var(--ease-spring), background-color .5s ease, border-color .5s ease, box-shadow .5s ease;
}
.info-card:active { transform: scale(.985); transition-duration: var(--press), .5s, .5s, .5s; }
@media (hover: hover) { .info-card.read:hover { background: var(--surface-2); } }
/* Ungelesen: blau hinterlegt mit wanderndem Schimmer – verliert die Farbe beim Antippen */
.info-card.unread {
  background: var(--info-soft); border-left-color: var(--info);
  box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--info) 30%, transparent), 0 0 18px color-mix(in srgb, var(--info) 22%, transparent);
}
.info-card.unread::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, #fff 55%, transparent) 48%, color-mix(in srgb, var(--info) 18%, transparent) 52%, transparent 70%);
  transform: translateX(-100%); animation: info-shimmer 3.2s ease-in-out infinite;
}
:root[data-theme="dark"] .info-card.unread::after {
  background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, var(--info) 22%, transparent) 50%, transparent 70%);
}
@keyframes info-shimmer { 0% { transform: translateX(-100%); } 55%, 100% { transform: translateX(100%); } }
.info-card.unread .info-title { color: var(--info); }
.info-card.unread .info-top .pill { background: var(--info); color: #fff; }
:root[data-theme="dark"] .info-card.unread .info-top .pill { color: #0d1a2b; }
@media (hover: hover) { .info-card.unread:hover { background: color-mix(in srgb, var(--info-soft) 82%, var(--info) 10%); } }
@media (prefers-reduced-motion: reduce) { .info-card.unread::after { animation: none; display: none; } }
.info-card > * { position: relative; z-index: 1; }
.info-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.info-title { font-size: 1.05rem; line-height: 1.3; overflow-wrap: anywhere; }
.info-top .pill { flex: none; }
.info-body { color: var(--text); opacity: .85; white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
/* gelesen: ruhiger; ungelesen: kräftiger Rand */
.info-card.read { border-left-color: var(--separator); }
.info-card.read .info-title { font-weight: 600; }
.info-card.read .info-body { opacity: .7; }
.info-actions { flex-wrap: wrap; }
.info-admin { flex-basis: 100%; display: flex; justify-content: center; gap: 8px; }
.info-admin .btn { flex: 0 1 auto !important; }
.section-head h2 .pill { vertical-align: 3px; margin-left: 6px; }
.info-tabs { max-width: 360px; }
.info-read { padding-bottom: 8px; }
.info-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.info-foot-right { display: inline-flex; align-items: center; gap: 12px; flex: none; }
.info-photo-count { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 600; }
.info-photo-count .ic { width: 16px; height: 16px; }
/* Fotos im Lesefenster */
.info-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.info-photos.one { grid-template-columns: 1fr; }
.info-photo { padding: 0; border: 0; border-radius: 14px; overflow: hidden; background: var(--fill); aspect-ratio: 4 / 3; cursor: zoom-in; }
.info-photos.one .info-photo { aspect-ratio: auto; max-height: 420px; }
.info-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.info-photos.one .info-photo img { object-fit: contain; max-height: 420px; }
/* Fotofeld im Dialog */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; }
.photo-tile, .photo-add { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: rgb(0 0 0 / 55%); color: #fff; cursor: pointer; }
.photo-x .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.photo-add { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1.5px dashed var(--separator);
  background: var(--fill); color: var(--primary); font-size: .85rem; font-weight: 600; cursor: pointer; }
.photo-add .ic { width: 26px; height: 26px; }
/* Lesebestätigung: graue Doppelhaken, blau wenn alle gelesen haben (wie WhatsApp) */
.receipt { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.receipt .ic { width: 18px; height: 18px; stroke-width: 2.2; }
.receipt.all { color: #34b7f1; }
.receipts { margin-top: 14px; border-radius: 12px; background: var(--fill); }
.receipts summary { display: flex; align-items: center; gap: 8px; padding: 10px 12px; cursor: pointer; list-style: none; font-weight: 500; }
.receipts summary::-webkit-details-marker { display: none; }
.receipts summary > .ic:first-child { width: 20px; height: 20px; color: var(--muted); stroke-width: 2.2; }
.receipts.all summary > .ic:first-child { color: #34b7f1; }
.receipts summary span { flex: 1; }
.receipts summary > .ic:last-child { width: 16px; height: 16px; color: var(--muted); transition: transform .3s var(--ease-spring); }
.receipts[open] summary > .ic:last-child { transform: rotate(90deg); }
.receipt-list { padding: 0 12px 10px; }
.receipt-h { display: flex; align-items: center; gap: 6px; margin: 8px 0 4px; font-size: .8rem; font-weight: 600; letter-spacing: .02em; color: var(--muted); text-transform: uppercase; }
.receipt-h .ic { width: 16px; height: 16px; stroke-width: 2.2; }
.receipt-h.read .ic { color: #34b7f1; }
.receipt-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.receipt-row + .receipt-row { border-top: 1px solid var(--separator); }
.receipt-row .avatar { width: 30px; height: 30px; font-size: .85rem; }
.receipt-row small { flex: none; font-variant-numeric: tabular-nums; }
.info-comments-count { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--primary); font-weight: 600; }
.info-comments-count .ic { width: 15px; height: 15px; }
/* Kommentare */
.comments { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--separator); }
.comments h3 { font-size: 1rem; margin: 0 0 10px; }
.comment-count { color: var(--muted); font-weight: 500; }
.comment-list { display: grid; gap: 12px; margin-bottom: 12px; }
.comment { display: flex; gap: 10px; align-items: flex-start; }
.comment .avatar { width: 30px; height: 30px; font-size: .85rem; }
.comment.mine .avatar { background: var(--btn-primary, var(--primary)); color: #fff; }
.comment-main { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 4px 14px 14px 14px; background: var(--fill); }
.comment-head { display: flex; align-items: baseline; gap: 8px; }
.comment-head small { flex: 1; }
.comment-main p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-del { width: 30px; height: 30px; margin: -6px -8px -6px 0; }
.comment-del .ic { width: 16px; height: 16px; }
.comment-form { display: flex; gap: 8px; align-items: flex-end; }
.comment-form textarea { flex: 1; min-height: 44px; resize: none; }
.comment-form .btn { flex: none; }
.info-full { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; margin: 10px 0 0; }

/* Artikel-Links in Listen und Artikel-Überblick */
.item-link { color: inherit; display: inline-flex; align-items: center; }
.item-link strong { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--primary) 45%, transparent); text-underline-offset: 3px; }
@media (hover: hover) { .item-link:hover strong { color: var(--primary); } }
.item-hero { display: flex; gap: 20px; align-items: flex-start; margin: 4px 0 18px; }
.item-hero > .step-img { width: 180px; height: 180px; margin: 0; }
.item-head { flex: 1; min-width: 0; display: grid; gap: 12px; }
.item-head h1 { overflow-wrap: anywhere; }
.item-head .kv { margin: 0; }
.item-nophoto { cursor: default; }
.item-qty { flex: none; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.item-qty small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.item-qty.warn { color: var(--warn); }
.item-steps { margin: 0; padding: 14px 18px 14px 40px; }
.item-steps li { margin: 4px 0; }
.item-hero + .stats { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 560px) {
  .item-hero { flex-direction: column; gap: 14px; }
  .item-hero > .step-img { width: 100%; height: 220px; }
  .item-hero + .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .item-hero + .stats .stat { padding: 12px; }
  .item-hero + .stats .stat-n { font-size: 1.5rem; }
}

/* Vollbild-Foto */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: calc(56px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  border: 0; background: transparent; cursor: zoom-out;
}
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: rgb(0 0 0 / 88%); animation: scrim-in .3s ease-out; }
.lightbox.closing::backdrop { animation: scrim-out .26s ease-in forwards; }
.lightbox img { width: 100%; height: 100%; object-fit: contain; will-change: transform; }
.lightbox-close { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; color: #fff; background: rgb(255 255 255 / 18%); border-radius: 50%; }
.fc-head { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--info); margin-bottom: 10px; }
.fc-progress { display: flex; gap: 4px; margin-bottom: 10px; }
.fc-progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--border); }
.fc-progress span.cur { background: var(--info); }
.fc-progress span.ok { background: var(--ok); }
.fc-progress span.bad { background: var(--danger); }
.fc-step { font-size: 1.35rem; line-height: 1.3; }
.fc-cell { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.fc-res { font-size: .82rem; }
.fc-res.ok { color: var(--ok); }
.fc-res.bad { color: var(--danger); font-weight: 600; }
.check-overview .ov-group { display: flex; align-items: center; gap: 6px; padding: 8px 14px; background: var(--surface-2); color: var(--muted); font-size: .82rem; font-weight: 700; }
.check-overview .ov-group .ic { width: 15px; height: 15px; }
.ov-name .ic { width: 14px; height: 14px; vertical-align: -2px; }

/* ---------- Scanner ---------- */
.scan-cta {
  display: flex; align-items: center; gap: 12px; width: 100%; margin-bottom: 8px; padding: 12px 14px;
  border: 0; border-radius: var(--radius-lg); background: var(--primary-soft); color: var(--text);
  font: inherit; text-align: left; cursor: pointer;
  transition: transform .35s var(--ease-spring), filter .2s;
}
.scan-cta:active { transform: scale(.98); filter: brightness(.96); transition-duration: var(--press); }
.scan-cta .ic { width: 30px; height: 30px; color: var(--primary); flex: none; }
.scan-cta small { line-height: 1.3; }
.scan-cta span { display: flex; flex-direction: column; }
.scan-cta small { color: var(--muted); }
.scan-body { padding: 4px 20px 20px; }
.scan-note { display: flex; gap: 8px; align-items: flex-start; margin: 0 20px 10px; padding: 8px 12px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-size: .9rem; font-weight: 600; }
.scan-note.error { background: var(--danger-soft); color: var(--danger); }
.scan-note .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.scan-video { position: relative; aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden; background: #000; }
.scan-video video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 22% 12%; border: 3px solid rgb(255 255 255 / 85%); border-radius: 12px; box-shadow: 0 0 0 999px rgb(0 0 0 / 35%); }
.scan-status { margin: 10px 0; }
/* NFC */
.scan-nfc { display: flex; align-items: center; gap: 8px; margin: -2px 0 12px; padding: 8px 12px; border-radius: 10px; background: var(--info-soft); color: var(--info); font-size: .9rem; font-weight: 600; }
.scan-nfc .ic { width: 20px; height: 20px; flex: none; animation: nfc-pulse 1.6s ease-in-out infinite; }
@keyframes nfc-pulse { 50% { opacity: .35; } }
.nfc-hero { display: grid; place-items: center; width: 84px; height: 84px; margin: 4px auto 10px; border-radius: 50%; background: var(--info-soft); color: var(--info); }
.nfc-hero .ic { width: 44px; height: 44px; }
.nfc-status { min-height: 1.4em; margin: 6px 0 12px; font-weight: 600; text-align: center; }
.nfc-status.busy { color: var(--info); }
.nfc-status.error { color: var(--danger); }
.nfc-status.busy::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: currentColor; animation: nfc-pulse 1s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .scan-nfc .ic, .nfc-status.busy::before { animation: none; } }
.scan-manual { display: flex; gap: 8px; }
.action-list { display: flex; flex-direction: column; padding: 4px 12px 16px; }
.action-item {
  display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 14px 10px; border: 0; border-bottom: 1px solid var(--separator);
  background: none; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; border-radius: 12px;
  transition: background-color .25s;
}
.action-item:last-child { border-bottom: 0; }
.action-item:active { background: var(--fill); transition-duration: 0s; }
@media (hover: hover) { .action-item:hover { background: var(--fill); } }
.action-item span { flex: 1; }
.action-item .ic:first-child { color: var(--primary); }

/* ---------- Dialog: Prüfschritte & Bild ---------- */
.steps-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.step-row { display: flex; align-items: center; gap: 6px; }
.step-no { width: 24px; flex: none; color: var(--muted); font-weight: 700; text-align: right; }
.image-row { display: flex; align-items: center; gap: 14px; }
.image-preview { width: 84px; height: 84px; flex: none; display: grid; place-items: center; border-radius: 12px; border: 1px dashed var(--border); background: var(--surface-2); color: var(--muted); overflow: hidden; }
.image-preview img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.image-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.image-actions .btn { cursor: pointer; }
.check.small { margin: 0; font-size: .88rem; }
input[type=color] { padding: 4px; height: 44px; cursor: pointer; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.swatch-btn { width: 32px; height: 32px; border-radius: 8px; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer; }
.swatch-btn:hover { transform: scale(1.08); }

/* ---------- Firmen-Design ---------- */
.brand-logo { height: 34px !important; width: auto !important; max-width: 140px; object-fit: contain; background: #fff; padding: 3px 6px; border-radius: 8px !important; }
.design-cell { display: inline-flex; align-items: center; gap: 8px; }
.swatch { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); display: inline-block; }
.logo-mini { height: 22px; max-width: 70px; object-fit: contain; background: #fff; border-radius: 4px; }

/* Dashboard-Schnellzugriff als Button */
button.quick-btn { border: 0; font: inherit; text-align: left; cursor: pointer; width: 100%; }

/* ---------- Mengen mit großen ±1-Knöpfen ---------- */
.qty-stepper { display: flex; align-items: stretch; gap: 8px; }
.qty-stepper input { text-align: center; font-size: 1.3rem; font-weight: 700; min-height: 56px; font-variant-numeric: tabular-nums; flex: 1; min-width: 0; }
.qty-btn {
  min-width: 72px; min-height: 56px; border-radius: 14px; border: 0;
  background: var(--fill); color: var(--primary); font: inherit; font-size: 1.25rem; font-weight: 700; cursor: pointer;
  touch-action: manipulation; transition: background-color .25s, transform .3s var(--ease-spring);
}
.qty-btn:active { background: var(--primary-soft); transform: scale(.95); transition-duration: var(--press); }
.qty-btn:disabled { opacity: .4; cursor: default; }
.qty-stepper.compact { flex: none; gap: 6px; }
.qty-stepper.compact .qty-btn { min-width: 52px; min-height: 48px; font-size: 1.05rem; }
.qty-stepper.compact input { width: 64px; flex: none; min-height: 48px; font-size: 1.1rem; }

/* ---------- Auffüllen ---------- */
.refill-pick { display: grid; gap: 10px; margin-bottom: 14px; }
@media (min-width: 900px) { .refill-pick { grid-template-columns: 1fr 1fr; } }
.refill-step { display: flex; align-items: flex-end; gap: 10px; padding: 12px 14px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.refill-step .field { flex: 1; margin: 0; }
.refill-step .icon-btn { width: 46px; height: 46px; background: var(--fill); color: var(--primary); }
.step-badge { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--btn-primary, var(--primary)); color: #fff; font-weight: 800; margin-bottom: 8px; }
.refill-item { flex-wrap: wrap; }
.refill-item .grow { flex: 1 1 220px; min-width: 0; }
.refill-item small { display: block; margin-top: 2px; }
.refill-item.selected { background: var(--primary-soft); }
.refill-item.disabled { opacity: .55; }
@media (max-width: 560px) { .refill-item .qty-stepper { margin-left: auto; } }
.refill-pick + .scan-cta { margin-bottom: 14px; }
.scan-item { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.scan-item .thumb { width: 64px; height: 64px; }
.scan-item small { display: block; margin-top: 2px; }
.target-list { display: grid; gap: 8px; }
fieldset.dest { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
fieldset.dest legend { padding: 0; margin-bottom: 6px; font-size: .84rem; font-weight: 600; letter-spacing: .004em; color: var(--muted); }
.dest-lager { margin: -2px 0 2px; }
.target-opt {
  display: flex; align-items: center; gap: 10px; padding: 12px; min-height: 56px; cursor: pointer;
  border: 1px solid var(--separator); border-radius: 14px; background: var(--surface);
  transition: background-color .25s, border-color .25s, transform .3s var(--ease-spring);
}
.target-opt:active { transform: scale(.98); transition-duration: var(--press); }
.target-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.target-opt input { width: 22px; height: 22px; flex: none; accent-color: var(--primary); }
.target-opt .grow { flex: 1; min-width: 0; }
.target-opt small { display: block; color: var(--muted); font-weight: 400; margin-top: 2px; }
.field > .input-scan { display: flex; gap: 8px; margin: 0; font-size: inherit; font-weight: inherit; }
.input-scan input { flex: 1; min-width: 0; }
.input-scan .icon-btn { width: 46px; height: 46px; flex: none; background: var(--fill); color: var(--primary); }
.plan { display: grid; gap: 10px; margin-top: 8px; color: var(--text); }
.plan-group { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.plan-to { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--primary); margin-bottom: 4px; font-size: .9rem; }
.plan-to .ic { width: 16px; height: 16px; }
.plan-line { font-size: .92rem; padding: 2px 0; }
.list-item a.grow { flex: 1; min-width: 0; color: inherit; }

/* ---------- Prüfprotokoll ---------- */
.protocol-box {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; margin-bottom: 14px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow);
}
.protocol-box > div:first-child { display: flex; align-items: center; gap: 12px; }
.protocol-box > div:first-child .ic { width: 28px; height: 28px; color: var(--primary); }
.protocol-box span { display: flex; flex-direction: column; }
.protocol-box small { color: var(--muted); }

/* ---------- Unterschrift ---------- */
.sign-box { text-align: left; margin: 16px 0 12px; }
.sig-wrap { position: relative; height: 180px; border: 2px dashed var(--border); border-radius: 12px; background: #fff; overflow: hidden; }
.signed .sig-wrap { border-style: solid; border-color: var(--primary); }
.sig-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sig-hint { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; color: #9aa39e; pointer-events: none; font-size: .95rem; }
.signed .sig-hint { display: none; }
.sig-line { position: absolute; left: 24px; right: 24px; bottom: 36px; border-bottom: 1px solid #c8cec9; pointer-events: none; }
.sig-clear { position: absolute; right: 6px; top: 6px; background: rgb(255 255 255 / 85%) !important; color: #333 !important; }
.sig-preview { height: 54px; max-width: 200px; object-fit: contain; background: #fff; border-radius: 8px; border: 1px solid var(--border); padding: 2px 6px; }
.plan-src { margin: 10px 0 4px; font-size: .9rem; }
.device-item .grow { flex: 1; min-width: 0; }
.device-item small { display: block; }
.list-item .grow strong .ic { width: 16px; height: 16px; vertical-align: -3px; }

/* ---------- Plomben ---------- */
.seal-card { text-align: center; }
.seal-card .step-loc { text-align: left; }
.seal-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--warn-soft); color: var(--warn); margin: 6px 0; }
.seal-icon .ic { width: 32px; height: 32px; }
.pill .ic { width: 12px; height: 12px; vertical-align: -1px; }
.check-overview .ov-group .pill { margin-left: auto; }

/* ---------- Checklisten ---------- */
.cl-img { display: block; width: 100%; max-height: 360px; object-fit: contain; border-radius: 12px; border: 1px solid var(--border); background: #fff; margin: 10px 0; }
.cl-text { white-space: pre-wrap; margin: 8px 0 14px; line-height: 1.55; }
.cl-step .step-actions .row { flex-wrap: nowrap; }
.list-item.inactive { opacity: .6; }
tr.inactive td { opacity: .55; }

/* ---------- Einweisungen ---------- */
.sign-head { text-align: left; font-size: 1rem; margin: 20px 0 -6px; }
.sig-preview.small { height: 40px; max-width: 140px; }
.toolbar .field.inline { display: flex; align-items: center; gap: 8px; margin: 0; }
.toolbar .field.inline > span { margin: 0; white-space: nowrap; }
.toolbar .field.inline select { min-width: 180px; }
.training-link { display: inline-flex; flex-wrap: wrap; gap: 4px; text-decoration: none; }
/* Meine Einweisungen (Benutzer) */
.my-training { align-items: center; gap: 12px; }
.my-training small { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.my-training .meta { display: inline-flex; align-items: center; gap: 4px; }
.my-training .meta .ic { width: 14px; height: 14px; color: var(--muted); }
.mt-pills { margin-top: 6px; }
.mt-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--fill); color: var(--muted); }
.mt-icon .ic { width: 22px; height: 22px; }
.mt-icon.gueltig { background: var(--ok-soft); color: var(--ok); }
.mt-icon.bald { background: var(--warn-soft); color: var(--warn); }
.mt-icon.abgelaufen { background: var(--danger-soft); color: var(--danger); }
.my-training .row.nowrap { flex-wrap: nowrap; }
.account-link { margin: 0 0 16px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); gap: 12px; align-items: center; }
.account-link > .ic:first-child { width: 22px; height: 22px; color: var(--primary); flex: none; }
.account-link > .ic:last-child { width: 18px; height: 18px; color: var(--muted); }
@media (max-width: 480px) {
  .my-training { flex-wrap: wrap; }
  .my-training .grow { flex: 1 1 calc(100% - 52px); }
  .my-training > .row.nowrap { margin-left: 52px; flex-direction: row; align-items: center; }
}
.cl-edit-list { display: grid; gap: 12px; margin-bottom: 12px; }
.cl-edit-step { background: var(--surface); border-radius: var(--radius-lg); padding: 12px 14px; box-shadow: var(--shadow); display: grid; gap: 10px; }
.cl-edit-head { display: flex; align-items: center; gap: 10px; }
.cl-edit-head .step-badge { margin: 0; }
.cl-edit-head input { flex: 1; font-weight: 600; }
@media (max-width: 560px) {
  .cl-edit-head { flex-wrap: wrap; justify-content: space-between; }
  .cl-edit-head input { order: 3; flex-basis: 100%; }
}
.cl-edit-row { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 720px) { .cl-edit-row { grid-template-columns: 260px 1fr; } }
.cl-edit-row .field { margin: 0; }
.row.nowrap { flex-wrap: nowrap; }
.danger-text { color: var(--danger) !important; }

/* ---------- Feedback ---------- */
.fb-list { display: grid; gap: 10px; }
.fb-item { margin: 0; display: grid; gap: 6px; }
.fb-subject { font-size: 1.02rem; }
/* Auffüllen nach der Prüfung */
.refill-card { border-left: 4px solid var(--warn); scroll-margin-top: calc(var(--top-h) + 12px); }
.refill-card.done { border-left-color: var(--ok); }
.refill-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.refill-head h2 { margin: 0; }
.refill-head > .ic { width: 38px; height: 38px; padding: 8px; box-sizing: border-box; border-radius: 12px; background: var(--warn-soft); color: var(--warn); }
.refill-card.done .refill-head > .ic { background: var(--ok-soft); color: var(--ok); }
.refill-line { cursor: pointer; }
.refill-line input { width: 24px; height: 24px; min-height: 0; flex: none; accent-color: var(--primary); }
.refill-line .grow { flex: 1; min-width: 0; }
.refill-line small { display: block; color: var(--muted); }
.refill-line .text-warn { color: var(--warn); }
.refill-line.disabled { opacity: .6; cursor: default; }
.refill-qty { flex: none; font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.refill-qty small { font-size: .78rem; font-weight: 500; color: var(--muted); }
.refill-actions { display: flex; margin: 14px 0 6px; }
.refill-done { margin: 6px 0 10px; padding-left: 18px; }
.refill-done li { margin: 3px 0; }
.fb-author { display: flex; align-items: center; gap: 10px; }
.fb-author > span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.avatar { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .95rem; }
.fb-item.mine .avatar { background: var(--btn-primary, var(--primary)); color: #fff; }
.fb-tabs { max-width: 360px; }
.fb-msg { margin: 0; white-space: pre-wrap; }
.fb-answer { background: var(--primary-soft); border-radius: 8px; padding: 8px 12px; }
.fb-answer p { margin: 2px 0 0; white-space: pre-wrap; }
.push-prefs h3 { font-size: .95rem; margin: 18px 0 6px; }
.push-prefs .check { margin: 6px 0; }

/* ---------- Etiketten ---------- */
.labels { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.label {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 10px 8px;
  background: #fff; color: #000; border: 1px dashed #999; border-radius: 8px; break-inside: avoid; page-break-inside: avoid;
}
.label-name { font-weight: 800; font-size: 1.05rem; text-align: center; line-height: 1.2; }
.label-path { font-size: .75rem; color: #444; text-align: center; }
.label-bc { max-width: 100%; height: auto; }

/* ---------- Druck (Bestellliste, Etiketten) ---------- */
@media print {
  .labels { grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .label { border-color: #bbb; }
}
@media print {
  .topbar, .nav, .toolbar, .tabs, .no-print, #toasts, .page-actions { display: none !important; }
  body { background: #fff; color: #000; }
  .view { padding: 0; }
  .layout { display: block; }
  .table-wrap { border: 0; box-shadow: none; }
  .table-wrap table, .table-wrap tbody { display: table; }
  .table-wrap thead { display: table-header-group; }
  .table-wrap tr { display: table-row; border: 0; box-shadow: none; }
  .table-wrap td { display: table-cell; border-bottom: 1px solid #ccc; }
  .table-wrap td::before { display: none; }
}

/* ---------- Mängel ---------- */
.defect-list { display: grid; gap: 10px; }
.defect-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 6px; }
.defect-card.oos { box-shadow: var(--shadow), inset 4px 0 0 var(--danger); }
.defect-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.defect-head strong { font-size: 1.02rem; }
.defect-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.defect-meta .meta, .meta { display: inline-flex; align-items: center; gap: 4px; }
.defect-meta .ic, .meta .ic { width: 14px; height: 14px; color: var(--muted); flex: none; }
.defect-desc { margin: 0; white-space: pre-wrap; }
.defect-done { display: flex; gap: 6px; align-items: flex-start; margin: 0; color: var(--ok); font-size: .9rem; }
.defect-done .ic { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.defect-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.defect-actions:empty { display: none; }
.btn.small.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- Medizinprodukte ---------- */
.due-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--fill); font-size: .78rem; font-weight: 600; white-space: nowrap; margin: 1px 0; }
.due-chip.warn { background: var(--warn-soft); color: var(--warn); }
.due-chip.danger { background: var(--danger-soft); color: var(--danger); }
.device-actions { align-items: center; margin-bottom: 12px; }

/* ---------- Auswertungen ---------- */
.report-range { margin-bottom: 12px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 10px; align-items: center; font-size: .9rem; }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--btn-primary, var(--primary)); }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.bar-val small { font-weight: 400; }
@media (max-width: 560px) {
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .bar-val small { display: none; }
}

/* ---------- Kleiderkammer: Personen ---------- */
.people-list { display: grid; gap: 10px; }
@media (min-width: 900px) { .people-list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); } }
.person-card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 12px 14px; display: grid; gap: 8px; align-content: start; }
.person-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.size-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.size-chip { display: inline-flex; flex-direction: column; padding: 3px 10px; border-radius: 10px; background: var(--fill); font-weight: 700; font-size: .95rem; line-height: 1.15; }
.size-chip small { font-weight: 500; font-size: .7rem; color: var(--muted); }
.person-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.person-items li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding-top: 4px; border-top: 1px solid var(--separator); }
.person-items li > span { font-weight: 600; }
.pill-btn { border: 0; cursor: zoom-in; font: inherit; font-size: .75rem; }
.pill-btn .ic { width: 12px; height: 12px; margin-right: 3px; }

/* ---------- Verschiedenes ---------- */
.link-btn { display: block; margin: 12px auto 0; border: 0; background: none; color: var(--primary); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.sub-h { margin: 14px 0 4px; font-size: .95rem; }
.card h2 .ic { width: 18px; height: 18px; vertical-align: -3px; color: var(--primary); }
.audit-details summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.audit-details small { display: block; word-break: break-word; }

.card > .section-head:first-child { margin-top: 0; }

/* Benutzer-Import */
.wide-modal { width: min(760px, calc(100vw - 24px)); }
.import-errors { margin: 6px 0; padding-left: 20px; color: var(--danger); font-size: .9rem; }
code.pw { font-size: .95rem; user-select: all; background: var(--fill); padding: 2px 6px; border-radius: 6px; }
