/* inTakt:Inventory — inTakt-CI (Petrol-Grün, identisch zu BelegBox / inTakt:Finance) */
:root {
  /* Brand (Petrol Green) — exakt die Werte aus dem inTakt-Designsystem */
  --brand-50:  #EEF4F1;
  --brand-100: #D6E5DF;
  --brand-200: #AAC8BC;
  --brand-300: #7EAB99;
  --brand-400: #528E76;
  --brand-500: #2F8F7A; /* Gradient-Ende, Focus-Ringe */
  --brand-600: #1F6F5F; /* PRIMARY — Gradient-Start, Header, Hero */
  --brand-700: #174439; /* Hover, Links */
  --brand-800: #113028;
  --brand-900: #0A1E18;

  /* Marken-Gradient — das visuelle Leitmotiv der inTakt-Familie */
  --brand-gradient: linear-gradient(135deg, #1F6F5F 0%, #2F8F7A 100%);
  --brand-gradient-hover: linear-gradient(135deg, #185749 0%, #267362 100%);

  /* Slate neutrals (CTA & body) */
  --slate-50:  #F8FAFC;
  --slate-100: #F1F5F9;
  --slate-200: #E2E8F0;
  --slate-300: #CBD5E1;
  --slate-400: #94A3B8;
  --slate-500: #64748B;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1E293B;
  --slate-900: #0F172A;

  /* Semantic — inTakt-Statusfarben */
  --success: #22C55E;
  --warning: #F59E0B;
  --danger:  #EF4444;
  --info:    #3B82F6;

  /* Legacy-Aliase (werden im Bestand noch referenziert) */
  --pos: #16A34A;
  --pos-bg: #DCFCE7;
  --neg: #DC2626;
  --neg-bg: #FEE2E2;
  --warn: #CA8A04;
  --warn-bg: #FEF9C3;

  /* Radien — Premium-Spec, alles auf dem 4/8-px-Raster */
  --r-sm: 8px;
  --r-md: 12px;   /* input */
  --r-lg: 14px;   /* button */
  --r-xl: 24px;   /* card */
  --r-card: 24px;
  --r-input: 12px;
  --r-btn: 14px;
  --r-pill: 999px;

  /* Schatten — mehrlagig und weich, nie hart */
  --shadow-soft: 0 1px 2px rgb(15 23 42 / 0.04), 0 2px 6px -1px rgb(15 23 42 / 0.04);
  --shadow-card: 0 1px 2px rgb(15 23 42 / 0.03), 0 4px 12px -2px rgb(15 23 42 / 0.05);
  --shadow-lift: 0 2px 4px rgb(15 23 42 / 0.04), 0 12px 28px -8px rgb(15 23 42 / 0.10);
  --shadow-pop:  0 8px 16px -4px rgb(15 23 42 / 0.08), 0 24px 48px -12px rgb(15 23 42 / 0.18);
  --shadow-glass: inset 0 1px 0 rgb(255 255 255 / 0.6), 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px -6px rgb(15 23 42 / 0.08);

  /* Legacy-Schatten-Aliase */
  --shadow-sm: var(--shadow-card);
  --shadow-md: var(--shadow-lift);
  --shadow-lg: 0 24px 48px -12px rgba(10, 30, 24, 0.20);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Canvas & Chrome */
  --bg: #F6F8FA;           /* sehr helles Grau, ruhiger Untergrund */
  --topbar-bg: #174439;    /* dunkles Brand-Grün für Header */
  --card-line: #EEF1F4;    /* haarfeine Kartenkante */
  --accent: #0F6B53;       /* Premium-Akzent */
  --glass: rgba(255,255,255,0.72);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* html bekommt Brand-Grün, damit iOS-Overscroll (bounce) und der Notch-Bereich
   in CI-Farbe bleiben — verhindert den weißen Streifen über der Topbar. */
html { background: var(--brand-600); }
body {
  font-family: 'Montserrat', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--slate-800);
  font-size: 13.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: inherit;
  font-weight: 700;
  color: var(--slate-900);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
h1 { font-size: 22px; letter-spacing: -0.02em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.08em; }

a { color: var(--brand-700); text-decoration: none; transition: color 0.15s var(--ease); font-weight: 500; }
a:hover { color: var(--brand-800); }

/* ---- Login ---- */
/* ===================================================================
   LOGIN — inTakt-Look: dunkle Bühne, Glow, Glasmorphism-Karte
=================================================================== */
.login-body {
  margin: 0;
  background: #04211B;
  color: #fff;
  min-height: 100dvh;
}
.login-stage {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: #04211B;
}
.login-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
}
.login-glow-1 {
  width: 620px; height: 620px;
  bottom: -230px; left: -190px;
  background: radial-gradient(circle, rgba(16,185,129,0.26) 0%, transparent 70%);
  animation: glowDrift 18s ease-in-out infinite alternate;
}
.login-glow-2 {
  width: 520px; height: 520px;
  top: -180px; right: -140px;
  background: radial-gradient(circle, rgba(47,143,122,0.20) 0%, transparent 70%);
  animation: glowDrift 22s ease-in-out infinite alternate-reverse;
}
@keyframes glowDrift {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(40px,-30px,0) scale(1.12); }
}
/* Feines Punktraster — gibt der Fläche Textur ohne Unruhe */
.login-grid-overlay {
  position: absolute; inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,0.045) 1px, transparent 0);
  background-size: 26px 26px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 30%, transparent 100%);
}

.login-layout {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 40px;
  align-items: stretch;
}

/* ---- Linke Spalte: Branding ---- */
.login-brand-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 54px 20px 44px 56px;
  min-width: 0;
}
.login-logo { height: 68px; width: auto; filter: brightness(0) invert(1); opacity: 0.95; }
.login-brand-main { padding: 24px 0; }
.login-wordmark {
  font-size: clamp(38px, 5.4vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0;
  color: #fff;
  font-weight: 300;
}
.lw-light { font-weight: 300; color: rgba(255,255,255,0.72); }
.lw-colon { font-weight: 800; color: #6EE7B7; }
.lw-bold  { font-weight: 800; color: #fff; }
.login-tagline {
  font-size: clamp(15px, 1.5vw, 19px);
  color: rgba(255,255,255,0.62);
  letter-spacing: 0.02em;
  margin: 18px 0 0;
  font-weight: 400;
}
.login-quote {
  margin-top: 34px;
  max-width: 380px;
  padding-left: 18px;
  border-left: 2px solid rgba(110,231,183,0.65);
}
.login-quote p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.65;
  color: rgba(255,255,255,0.78);
  font-weight: 300;
}
.login-brand-foot {
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
}

/* ---- Rechte Spalte: Formular ---- */
.login-form-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 56px 40px 20px;
  min-width: 0;
}
.login-card {
  width: 100%;
  max-width: 400px;
  border-radius: 26px;
  padding: 36px 34px 30px;
  background:
    radial-gradient(circle 420px at 30% 0%, rgba(52,211,153,0.07) 0%, transparent 60%),
    linear-gradient(180deg, rgba(28,42,38,0.62) 0%, rgba(16,26,24,0.72) 100%);
  -webkit-backdrop-filter: blur(26px) saturate(140%);
  backdrop-filter: blur(26px) saturate(140%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.08),
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 40px 90px -30px rgba(0,0,0,0.6);
}
.login-card.shake { animation: cardShake 0.42s cubic-bezier(0.36,0.07,0.19,0.97); }
@keyframes cardShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

/* Wortmarke in der Karte — nur auf Mobile sichtbar */
.login-card-brand {
  display: none;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  letter-spacing: -0.02em;
  margin-bottom: 22px;
}
.login-logo-sm { height: 30px; width: auto; filter: brightness(0) invert(1); }

.login-title {
  font-size: 25px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.login-hint {
  font-size: 13.5px;
  color: rgba(255,255,255,0.55);
  margin: 0 0 26px;
}

.login-body label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.62);
  margin: 0 0 7px;
  letter-spacing: 0.01em;
}
.login-field {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 18px;
}
.login-field > svg {
  position: absolute;
  left: 14px;
  width: 17px; height: 17px;
  color: rgba(255,255,255,0.40);
  pointer-events: none;
}
.login-body .login-field input {
  width: 100%;
  height: 50px;
  padding: 0 14px 0 42px;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.login-body .login-field input::placeholder { color: rgba(255,255,255,0.30); font-weight: 400; }
.login-body .login-field input:hover { border-color: rgba(255,255,255,0.18); }
.login-body .login-field input:focus {
  outline: none;
  border-color: rgba(110,231,183,0.55);
  background: rgba(255,255,255,0.07);
  box-shadow: 0 0 0 3px rgba(52,211,153,0.14);
}
/* Autofill in WebKit würde sonst weiß einfärben */
.login-body .login-field input:-webkit-autofill,
.login-body .login-field input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px rgba(30,45,40,0.96) inset;
  caret-color: #fff;
}
.login-eye {
  position: absolute;
  right: 8px;
  width: 34px; height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.42);
  cursor: pointer;
  border-radius: 10px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.login-eye svg { width: 17px; height: 17px; }
.login-eye:hover { color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.07); }
.login-eye.on { color: #6EE7B7; }

.login-submit {
  position: relative;
  width: 100%;
  height: 50px;
  margin-top: 6px;
  border: none;
  border-radius: 15px;
  background: linear-gradient(135deg, #2F8F7A 0%, #34D399 100%);
  color: #04211B;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.14s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
  box-shadow: 0 8px 22px -8px rgba(52,211,153,0.55);
}
.login-submit:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 28px -8px rgba(52,211,153,0.65); }
.login-submit:active:not(:disabled) { transform: translateY(0); }
.login-submit:disabled { cursor: default; opacity: 0.85; }
.ls-spinner {
  position: absolute;
  top: 50%; left: 50%;
  width: 19px; height: 19px;
  margin: -9.5px 0 0 -9.5px;
  border: 2px solid rgba(4,33,27,0.25);
  border-top-color: #04211B;
  border-radius: 50%;
  opacity: 0;
  animation: loginSpin 0.7s linear infinite;
}
@keyframes loginSpin { to { transform: rotate(360deg); } }
.login-submit.loading .ls-label { opacity: 0; }
.login-submit.loading .ls-spinner { opacity: 1; }
.login-submit.success { background: linear-gradient(135deg, #22C55E 0%, #6EE7B7 100%); }
.login-submit.success .ls-label { opacity: 0; }
.login-submit.success::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 9px; height: 17px;
  margin: -11px 0 0 -5px;
  border: solid #04211B;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg) scale(0);
  animation: checkPop 0.32s var(--ease-out) forwards;
}
@keyframes checkPop { to { transform: rotate(45deg) scale(1); } }

.login-error {
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 13px;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(248,113,113,0.32);
  color: #FCA5A5;
  font-size: 13px;
  font-weight: 500;
}
.login-card-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.07);
  font-size: 11.5px;
  color: rgba(255,255,255,0.40);
  text-align: center;
}

/* Gestaffeltes Einblenden */
.login-rise {
  opacity: 0;
  animation: loginRise 0.62s cubic-bezier(0.16,1,0.3,1) forwards;
  animation-delay: var(--rise-delay, 0ms);
}
@keyframes loginRise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* Nach erfolgreichem Login sanft ausblenden */
body.login-leaving .login-layout {
  animation: loginLeave 0.5s cubic-bezier(0.4,0,0.6,1) forwards;
}
@keyframes loginLeave {
  to { opacity: 0; transform: scale(0.985); }
}

@media (max-width: 940px) {
  .login-layout { grid-template-columns: 1fr; gap: 0; }
  .login-brand-col { display: none; }
  .login-form-col { padding: 28px 20px calc(28px + env(safe-area-inset-bottom)); align-items: center; }
  .login-card { padding: 30px 24px 26px; border-radius: 22px; max-width: 440px; }
  .login-card-brand { display: flex; }
  .login-title { font-size: 22px; }
  /* iOS zoomt sonst beim Fokus rein */
  .login-body .login-field input { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-glow, .login-rise, .login-card.shake { animation: none !important; }
  .login-rise { opacity: 1; }
}

/* ---- Forms ---- */
label {
  display: block;
  font-weight: 500;
  font-size: 13px;
  color: var(--slate-700);
  margin: 16px 0 6px;
}
input[type="text"], input[type="password"], input[type="number"], input[type="search"], input[type="file"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-input);
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  color: var(--slate-900);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  font-variant-numeric: tabular-nums;
}
input:hover, select:hover, textarea:hover { border-color: var(--slate-300); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(47, 143, 122, 0.20);
}
input[disabled], select[disabled], textarea[disabled] {
  background: var(--slate-50);
  color: var(--slate-500);
  cursor: not-allowed;
}
input[type="file"] { padding: 8px 10px; cursor: pointer; }
/* iOS Safari zoomt automatisch rein, sobald ein Eingabefeld < 16 px ist
   und fokussiert wird. Auf Touch-Geräten (Handy/Tablet) deshalb auf 16 px hoch. */
@media (max-width: 840px) {
  input[type="text"], input[type="password"], input[type="number"],
  input[type="search"], input[type="file"], select, textarea {
    font-size: 16px;
  }
}

/* Buttons — primary = slate-900 (per CI) */
/* ---- Buttons — inTakt-Spec: 44px Höhe, 12px Radius, Gradient-Primary ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  background: var(--brand-gradient);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  user-select: none;
  text-decoration: none;
  letter-spacing: -0.005em;
  box-shadow: var(--shadow-soft);
  transition: background-image 0.18s var(--ease), background 0.18s var(--ease),
              transform 0.12s var(--ease), box-shadow 0.18s var(--ease),
              color 0.18s var(--ease), opacity 0.18s var(--ease);
}
.btn:hover {
  color: #fff;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}
.btn:active { transform: translateY(0); box-shadow: var(--shadow-soft); }
.btn:disabled, .btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--shadow-soft);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 143, 122, 0.28), var(--shadow-soft);
}

.btn.primary { background: var(--brand-gradient); color: #fff; }
.btn.primary:not(:disabled):hover { background: var(--brand-gradient-hover); }

/* .brand ist historisch dasselbe wie .primary */
.btn.brand { background: var(--brand-gradient); color: #fff; }
.btn.brand:not(:disabled):hover { background: var(--brand-gradient-hover); }

.btn.secondary {
  background: #EEF2F1;
  color: var(--slate-800);
  box-shadow: none;
}
.btn.secondary:hover { background: #E2E8E5; color: var(--slate-900); box-shadow: var(--shadow-soft); }

.btn.ghost { background: transparent; color: var(--slate-700); box-shadow: none; }
.btn.ghost:hover { background: var(--slate-100); color: var(--slate-900); box-shadow: none; transform: none; }

.btn.danger {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #B91C1C;
  box-shadow: none;
}
.btn.danger:hover { background: #FEE2E2; color: #991B1B; }

.btn.success { background: var(--success); color: #fff; }
.btn.success:hover { background: #16A34A; }

.btn.small { height: 36px; padding: 0 12px; font-size: 13px; }
.btn.tiny  { height: 30px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn.large { height: 48px; padding: 0 28px; font-size: 15px; }
.btn.full  { width: 100%; }

.error, .notice, .warning {
  padding: 12px 14px;
  border-radius: var(--r-input);
  font-size: 13px;
  margin-top: 12px;
  border: 1px solid transparent;
  font-weight: 500;
}
.error { background: var(--neg-bg); color: #991B1B; border-color: #FECACA; }
.notice { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-200); }
.warning { background: var(--warn-bg); color: #854D0E; border-color: #FEF08A; }

/* ---- App layout ---- */
.app { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; background: var(--slate-50); }

/* Shell: Sidebar + Hauptbereich nebeneinander */
.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 0;
}
.shell > main.container { min-width: 0; }

/* Linke Sidebar für Inventur-Auswahl */
/* Sidebar im inTakt-Look: dunkler Grün-Verlauf, weiße Schrift,
   Mint-Balken als Aktiv-Marker (identisch zu inTakt:Finance). */
/* Sidebar: Vollhöhen-Flexspalte.
   WICHTIG: Scrollen passiert ausschließlich in .sb-scroll — hätte die
   .sidebar selbst overflow-y, würde der Konto-Block unten mit wegscrollen. */
.sidebar {
  position: sticky;
  top: 0;
  align-self: stretch;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: linear-gradient(180deg, #063C32 0%, #042E27 45%, #031F1B 100%);
  border-right: none;
  padding: 16px 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
  color: #fff;
}

/* Kopf der Inventurliste — sitzt im Scrollbereich und richtet sich
   optisch nach den .sb-section-Überschriften darüber. */
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px;
  margin: 18px 0 6px;
  border-bottom: none;
}
.sidebar-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.34);
}
.sidebar .muted,
.sidebar-empty { color: rgba(255,255,255,0.55); }
.btn.tiny { padding: 4px 10px; font-size: 12px; }
.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-empty { padding: 12px 8px; font-size: 12.5px; }

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  cursor: pointer;
  user-select: none;
  border: none;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
  position: relative;
  color: rgba(255,255,255,0.72);
  background: transparent;
  font-size: 13px;
}
.sidebar-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
  transform: none;
}
/* Aktiv = leicht aufgehellt + 3px Mint-Balken links */
.sidebar-item.active {
  background: rgba(255,255,255,0.10);
  color: #fff;
  font-weight: 600;
  box-shadow: none;
}
.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 3px;
  border-radius: 0 99px 99px 0;
  background: #6EE7B7;
}
.sidebar-item .si-dot {
  width: 7px; height: 7px;
  border-radius: 99px;
  background: #6EE7B7;
  box-shadow: none;
  flex: 0 0 auto;
}
.sidebar-item.closed .si-dot { background: rgba(255,255,255,0.30); box-shadow: none; }
.sidebar-item.active .si-dot { background: #6EE7B7; box-shadow: none; }
.sidebar-item .si-meta,
.sidebar-item.active .si-meta { color: rgba(255,255,255,0.50); }
.sidebar-item .si-body {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-item .si-name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-item .si-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.50);
  font-variant-numeric: tabular-nums;
}
.sidebar-item .si-delete {
  width: 22px; height: 22px;
  border-radius: 99px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.45);
  font-size: 12px;
  cursor: pointer;
  border: none;
  background: transparent;
  opacity: 0;
  transition: background 0.12s var(--ease), color 0.12s var(--ease), opacity 0.12s var(--ease);
  flex: 0 0 auto;
}
.sidebar-item:hover .si-delete { opacity: 1; }
.sidebar-item .si-delete:hover { background: rgba(239,68,68,0.20); color: #FCA5A5; }

/* Toggle-Schalter: Admin aktiviert eine Session als Team-Inventur
   Look: iOS-Style-Switch. Grau = aus, Brand-Grün = an. */
.sidebar-item .si-toggle {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  border: none;
  padding: 0;
  flex: 0 0 auto;
  cursor: pointer;
  background: rgba(255,255,255,0.20);
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: none;
  display: inline-block;
}
.sidebar-item .si-toggle:hover { background: rgba(255,255,255,0.30); }
.sidebar-item .si-toggle .si-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 99px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.25), 0 0 0 0.5px rgba(15, 23, 42, 0.05);
  transition: transform 0.22s cubic-bezier(0.34, 1.4, 0.5, 1);
}
.sidebar-item .si-toggle.on {
  background: #34D399;
  box-shadow: none;
}
.sidebar-item .si-toggle.on:hover { background: #6EE7B7; }
.sidebar-item .si-toggle.on .si-toggle-knob { transform: translateX(14px); }
.sidebar-item .si-toggle:active .si-toggle-knob { width: 18px; }
.sidebar-item .si-toggle.on:active .si-toggle-knob { transform: translateX(12px); }
.sidebar-item .si-toggle:focus-visible {
  outline: 2px solid var(--brand-400, #4d8575);
  outline-offset: 2px;
}

/* Team-Aktiv-Zustand: dezenter Mint-Akzent auf der Zeile */
.sidebar-item.team-active {
  background: linear-gradient(90deg, rgba(110, 231, 183, 0.14) 0%, rgba(110, 231, 183, 0) 65%);
}
.sidebar-item.team-active .si-dot {
  background: #6EE7B7;
  box-shadow: 0 0 0 3px rgba(110, 231, 183, 0.22);
}
.sidebar-item .si-team-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: rgba(110, 231, 183, 0.20);
  color: #6EE7B7;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  vertical-align: 1px;
}


/* Schlanker Dashboard-Header (ohne Card-Hintergrund, nur Titel + Status + Erfassen) */
.active-session-head-slim {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

/* Sidebar-Fuß: N offen · N abgeschlossen.
   Kein margin-top:auto — der Fuß gehört direkt unter die Liste, nicht
   ans Ende des Scrollbereichs. Trennlinie hell auf dunklem Grund. */
.sidebar-foot {
  margin-top: 10px;
  padding: 9px 10px 2px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: rgba(255,255,255,0.40);
  font-variant-numeric: tabular-nums;
}

/* Toggle-Button im Topbar (nur Mobile sichtbar) */
.sidebar-toggle { display: none; margin-right: 4px; }
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 45;
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  /* Drawer: liegt über allem, deshalb 100dvh (nicht vh) — sonst
     schiebt die iOS-Browserleiste den Konto-Block aus dem Bild. */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100dvh;
    max-height: 100dvh;
    width: 286px;
    z-index: 60;
    padding: calc(16px + env(safe-area-inset-top)) 11px calc(12px + env(safe-area-inset-bottom));
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: 0 0 36px rgba(4, 33, 27, 0.45);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop.open { display: block; }
  .sidebar-toggle { display: inline-flex; }
}

/* Topbar im inTakt-Look: sehr dunkles Grün, haarfeine Trennlinie unten.
   Notch-sicher über safe-area-inset. */
.topbar {
  background: #04211B;
  color: #fff;
  padding: env(safe-area-inset-top) calc(28px + env(safe-area-inset-right)) 0 calc(28px + env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: calc(58px + env(safe-area-inset-top));
  height: auto;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  box-shadow: none;
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: 0.02em;
}
.topbar .brand img {
  height: 32px;
  width: auto;
  display: block;
  /* Logo ist dunkelgrün auf transparent → auf der grünen Topbar nach weiß umfärben */
  filter: brightness(0) invert(1);
}
.topbar .brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  min-width: 0;
}
.topbar .brand-name {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.topbar .brand .sep { color: #6EE7B7; font-weight: 400; }
.topbar .brand .sub {
  color: rgba(255,255,255,0.55);
  font-weight: 400;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar nav { display: flex; gap: 2px; }
.topbar nav a {
  color: rgba(255,255,255,0.72);
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.topbar nav a:hover { color: #fff; background: rgba(255,255,255,0.07); text-decoration: none; }
.topbar nav a.active { color: #fff; background: rgba(255,255,255,0.10); font-weight: 600; }

/* Avatar-Kreis mit Initialen (wie in inTakt:Finance) */
.topbar .avatar {
  width: 34px; height: 34px;
  border-radius: 12px;
  background: rgba(52, 211, 153, 0.18);
  box-shadow: inset 0 0 0 1px rgba(110, 231, 183, 0.30);
  color: #A7F3D0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
  user-select: none;
}
.topbar nav a.nav-disabled {
  color: rgba(255,255,255,0.32);
  cursor: not-allowed;
  background: transparent;
}
.topbar nav a.nav-disabled:hover { background: transparent; color: rgba(255,255,255,0.32); }
.topbar .user { display: flex; align-items: center; gap: 14px; font-size: 13px; color: rgba(255,255,255,0.80); }
.topbar .user .name { color: #fff; font-weight: 500; }
.topbar .btn.ghost { color: rgba(255,255,255,0.85); }
.topbar .btn.ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* PWA Install-Button im Header */
.topbar .install-btn {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font-weight: 600;
}
.topbar .install-btn:hover { background: rgba(255, 255, 255, 0.22); }
@media (max-width: 640px) {
  .topbar .install-btn { display: none !important; }
}

main.container { padding: 24px 24px 40px; max-width: 1200px; margin: 0 auto; width: 100%; }

.card {
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
  margin-bottom: 16px;
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.card h2 { margin-top: 0; }

/* Hero-Karte im Marken-Gradient (Dashboard-Kopf, Login) */
.card-hero {
  background: var(--brand-gradient);
  color: #fff;
  border: none;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-soft);
  padding: 22px 24px;
}
.card-hero h1, .card-hero h2, .card-hero h3 { color: #fff; }
.card-hero .muted { color: rgba(255,255,255,0.78); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 840px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  main.container { padding: 20px 16px; }
  .topbar {
    padding: env(safe-area-inset-top) calc(16px + env(safe-area-inset-right)) 0 calc(16px + env(safe-area-inset-left));
    min-height: calc(60px + env(safe-area-inset-top));
    height: auto;
  }
  .topbar nav { display: none; }
}

.stat {
  padding: 18px 20px;
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.2s var(--ease), transform 0.2s var(--ease);
}
.stat:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.stat .label { font-size: 12px; color: var(--slate-500); font-weight: 500; letter-spacing: 0.02em; }
.stat .value {
  font-size: 30px; font-weight: 700;
  color: var(--slate-900);
  margin-top: 4px;
  letter-spacing: -0.03em; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat.accent .value { color: var(--brand-600); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--slate-100); font-size: 13px; vertical-align: middle; }
th {
  font-weight: 600;
  font-size: 11px;
  color: var(--slate-500);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--slate-200);
  background: transparent;
}
tbody tr { transition: background 0.1s var(--ease); }
tbody tr:hover td { background: #F6F6F7; }
td.right, th.right { text-align: right; }
td, .mono, .count-input { font-variant-numeric: tabular-nums; }
.diff-pos { color: var(--pos); font-weight: 600; }
.diff-neg { color: var(--neg); font-weight: 600; }
.diff-zero { color: var(--slate-400); }

.count-input { width: 100px; text-align: right; padding: 7px 10px; }

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--slate-100);
  color: var(--slate-600);
  text-transform: uppercase;
}
.tag.open { background: var(--brand-100); color: var(--brand-800); }
.tag.closed { background: var(--slate-100); color: var(--slate-500); }

.scan-bar { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.scan-bar > div { flex: 1; min-width: 220px; }
.scan-bar label { margin-top: 0; }

.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--slate-900);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
  z-index: 1000;
  max-width: 380px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--brand-600); }
.toast.error { background: var(--neg); }

.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--slate-500); }
.mono { font-family: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; color: var(--slate-600); }
hr { border: none; border-top: 1px solid var(--slate-200); margin: 20px 0; }

h1 + .muted { margin-top: -6px; font-size: 14px; }

.progress-bar {
  height: 8px;
  background: var(--slate-100);
  border-radius: 99px;
  overflow: hidden;
  margin: 12px 0 20px;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: var(--brand-600);
  border-radius: 99px;
  transition: width 0.4s var(--ease);
}

/* ========== Erfassen: Modern Redesign ========== */

/* Scan hero - weiße Karte mit Brand-Akzent (kein Voll-Grün mehr) */
.scan-hero {
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: var(--r-card);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  color: var(--slate-900);
  position: sticky;
  top: 8px;
  z-index: 50;
}
.scan-hero-inner {
  display: grid;
  grid-template-columns: 1fr 140px auto auto;
  gap: 10px;
  align-items: center;
}
.scan-field { position: relative; display: flex; }
.scan-field input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-size: 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--slate-300);
  background: #fff;
  color: var(--slate-900);
  font-family: inherit;
  font-weight: 600;
  transition: all 0.18s var(--ease);
}
.scan-field input::placeholder { font-weight: 500; color: var(--slate-400); }
.scan-field input:hover { border-color: var(--slate-400); }
.scan-field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(46, 115, 91, 0.12);
}
.scan-field.qty input { text-align: right; font-variant-numeric: tabular-nums; }

.scan-hero .btn.scan-submit {
  height: 48px;
  padding: 0 22px;
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-700);
  font-size: 15px;
  font-weight: 700;
}
.scan-hero .btn.scan-submit:hover { background: var(--brand-700); color: #fff; }

.scan-match {
  margin-top: 6px;
  font-size: 13px;
  color: var(--slate-600);
  min-height: 0;
  font-weight: 500;
}
.scan-match:empty { display: none; }
.scan-match strong { color: var(--brand-700); font-weight: 700; }


/* KPI grid: 3 gleich breite Kacheln (Bewertungspreis wurde entfernt) */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card { padding: 18px 20px; display: flex; flex-direction: column; justify-content: center; }
.eta-card {
  background: linear-gradient(135deg, var(--brand-50) 0%, #fff 70%);
  border: 1px solid var(--brand-100);
}
.eta-card .kpi-number { color: var(--brand-700); font-size: 22px; }
/* KPI-Kacheln im inTakt-Stil: ruhiges Label (kein Uppercase-Sperrsatz),
   darunter die große Zahl. */
.kpi-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-500);
  letter-spacing: 0;
  text-transform: none;
  margin-bottom: 6px;
}
.kpi-number {
  font-size: 26px;
  font-weight: 600;
  color: var(--slate-900);
  letter-spacing: -0.025em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.kpi-number .kpi-of {
  font-size: 18px;
  font-weight: 500;
  color: var(--slate-400);
  letter-spacing: 0;
}
.kpi-sub { font-size: 12px; color: var(--slate-500); margin-top: 4px; }

/* Dash grid: Abweichungs-Tabelle + Aktivität */
.dash-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.card-head-sm {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.card-head-sm h2 { margin: 0; font-size: 15px; }
.small { font-size: 12px; }

/* Abweichungs-Tabelle */
.deviations-table th { font-size: 11px; }
.deviations-table td { font-size: 13px; }
.deviations-table .emp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--slate-600);
  font-weight: 500;
}
.deviations-table .emp::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 99px;
  background: var(--brand-500);
}
.deviations-table .prod-name { font-weight: 600; color: var(--slate-900); }
.deviations-table .prod-unit { color: var(--slate-500); font-size: 11px; font-weight: 500; }

/* (Alte .sessions-bar / .session-pill entfernt — ersetzt durch .sidebar) */

.btn.danger-text { color: var(--neg); }
.btn.danger-text:hover { background: var(--neg-bg); color: var(--neg); }

/* Activity feed */
.activity-card { overflow: hidden; }
.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}
.activity-list li {
  display: flex;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--slate-100);
  font-size: 13px;
  align-items: center;
}
.activity-list li:last-child { border-bottom: none; }
.activity-list .act-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--slate-800);
}
.activity-list .act-meta {
  font-size: 11px;
  color: var(--slate-500);
}
.activity-list .act-badge {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--slate-100);
  color: var(--slate-600);
}
.activity-list .act-badge.pos { background: var(--pos-bg); color: var(--pos); }
.activity-list .act-badge.neg { background: var(--neg-bg); color: var(--neg); }
.activity-list .act-badge.zero { background: var(--brand-50); color: var(--brand-700); }
.activity-list .act-del {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--slate-400);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.activity-list .act-del:hover { background: var(--neg-bg); color: var(--neg); }

/* Count table: simpler, click-to-edit */
.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--slate-700);
  cursor: pointer;
  user-select: none;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}
.switch-label input[type="checkbox"] { width: auto; cursor: pointer; accent-color: var(--brand-600); }

.count-table tbody tr {
  cursor: pointer;
}
.count-table tbody tr.counted { background: linear-gradient(90deg, var(--brand-50), transparent); }
.count-table tbody tr.counted td:first-child { box-shadow: inset 3px 0 0 var(--brand-500); }
.count-table tbody tr.active td { background: rgba(255, 218, 94, 0.25) !important; }
.count-table tbody tr.active { animation: pulse 1.4s ease-out; }
@keyframes pulse {
  0% { background: rgba(255, 218, 94, 0.6); }
  100% { background: rgba(255, 218, 94, 0.15); }
}
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate-500);
}
.status-dot::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 99px;
  background: var(--slate-300);
  box-shadow: 0 0 0 2px var(--slate-100);
}
.status-dot.counted { color: var(--brand-700); }
.status-dot.counted::before { background: var(--brand-500); box-shadow: 0 0 0 2px var(--brand-50); }

.count-input {
  width: 100%;
  max-width: 140px;
  text-align: right;
  padding: 8px 12px;
  font-weight: 600;
}
.count-input:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(30, 88, 73, 0.12);
}

/* ===================================================================
   MOBILE BOTTOM-TAB-NAV (fix unten, nur auf schmalen Screens sichtbar)
=================================================================== */
.mobile-tabs {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 120;
  background: rgba(255,255,255,0.98);
  border-top: 1px solid var(--slate-200);
  box-shadow: 0 -8px 24px -8px rgba(15, 23, 42, 0.10);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  gap: 2px;
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}
.mobile-tabs .mt-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  border-radius: var(--r-md);
  color: var(--slate-500);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.mobile-tabs .mt-item .mt-icon {
  font-size: 22px;
  line-height: 1;
  display: block;
}
.mobile-tabs .mt-item.active {
  color: var(--brand-700);
  background: var(--brand-50);
}
.mobile-tabs .mt-item:active { transform: scale(0.96); }
.mobile-tabs .mt-item.nav-disabled {
  color: var(--slate-300);
  cursor: not-allowed;
  background: transparent;
}
.mobile-tabs .mt-item.nav-disabled:active { transform: none; }

/* ===================================================================
   RESPONSIVE
=================================================================== */

/* Tablet / mittlere Breite */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* Mobile-First-Breakpoint: 840px — hier wird aus Desktop mobile App */
@media (max-width: 840px) {
  /* Body: verhindert horizontales Scrollen beim Tippen + iOS-Rubber-Band */
  html, body { overscroll-behavior-y: contain; }
  body { overflow-x: hidden; }

  /* Topbar: kompakter, Top-Nav-Links weg (kommen nach unten) */
  .topbar {
    padding: env(safe-area-inset-top) calc(14px + env(safe-area-inset-right)) 0 calc(14px + env(safe-area-inset-left));
    min-height: calc(56px + env(safe-area-inset-top));
    height: auto;
  }
  .topbar .brand { gap: 10px; font-size: 14px; }
  .topbar .brand img { height: 32px; }
  .topbar .brand .sub { font-size: 12px; }
  .topbar nav { display: none; }
  .topbar .user .name { display: none; } /* Name weg, Avatar + Logout reichen */
  .topbar .user { gap: 8px; }
  .topbar .avatar { width: 30px; height: 30px; font-size: 11.5px; border-radius: 10px; }

  /* Install-Button auf Mobile via Manifest → kein separater Button */
  .topbar .install-btn { display: none !important; }

  /* Bottom-Nav zeigen */
  .mobile-tabs { display: flex; }

  /* Container: Platz nach unten für die Bottom-Nav */
  main.container {
    padding: 16px 14px;
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  /* Überschriften kleiner */
  h1 { font-size: 22px; }
  h2 { font-size: 16px; }
  .card { padding: 18px 16px; border-radius: var(--r-lg); }
  .card-head { flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
  .card-head > .inline { width: 100%; flex-wrap: wrap; }

  /* Active-Session-Head Slim: Buttons auf eigene Zeile */
  .active-session-head-slim { flex-direction: column; align-items: stretch; gap: 10px; }
  .active-session-head-slim > .inline { flex-wrap: wrap; width: 100%; }
  .active-session-head-slim .btn.small { flex: 1 1 auto; min-width: 0; }

  /* KPIs: weiter 2-spaltig */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 14px; }
  .kpi-number { font-size: 24px; }
  .eta-card .kpi-number { font-size: 20px; }

  .dash-grid { grid-template-columns: 1fr; }

  /* =======================================================
     SCAN-HERO auf zwei Zeilen — für Einhand-Bedienung
     Zeile 1: Input (voll) + Kamera-Button
     Zeile 2: Menge + Erfassen-Button
  ======================================================= */
  .scan-hero {
    padding: 12px;
    position: sticky;
    top: 56px; /* direkt unter topbar */
    margin-bottom: 14px;
    border-radius: var(--r-lg);
  }
  .scan-hero-inner {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "input   input"
      "qty     submit";
    gap: 8px;
    align-items: stretch;
  }
  .scan-hero .scan-field:not(.qty) { grid-area: input; }
  .scan-hero .scan-field.qty { grid-area: qty; }
  .scan-hero .scan-field.qty input { text-align: left; padding-left: 16px; }
  .scan-hero .btn.scan-submit { grid-area: submit; height: 52px; font-size: 16px; }
  .scan-field input { height: 52px; font-size: 16px; } /* iOS: 16px verhindert Auto-Zoom */
  .scan-match { margin-top: 8px; font-size: 12px; }

  /* Dropdown/Autocomplete: voll in Scan-Hero */
  .scan-suggest { max-height: 260px; }

  /* =======================================================
     PRODUKT-TABELLE → KARTEN
  ======================================================= */
  .count-table thead { display: none; }
  .count-table, .count-table tbody { display: block; width: 100%; }
  .count-table tbody tr {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "status product diff"
      "meta   meta    meta"
      "input  input   input";
    column-gap: 12px;
    row-gap: 6px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border: 1px solid var(--slate-200);
    border-radius: var(--r-md);
    background: #fff;
    box-shadow: var(--shadow-sm);
    position: relative;
    cursor: default;
  }
  .count-table tbody tr.counted {
    background: linear-gradient(135deg, var(--brand-50) 0%, #fff 55%);
    border-color: var(--brand-200);
  }
  .count-table tbody tr.counted td:first-child { box-shadow: none; }
  .count-table tbody tr.active { animation: pulse 1.4s ease-out; }
  .count-table tbody td {
    display: block;
    padding: 0;
    border: none;
    text-align: left;
    width: auto;
  }
  .count-table tbody td:nth-child(1) { grid-area: status; align-self: start; }
  .count-table tbody td:nth-child(2) { grid-area: product; min-width: 0; } /* Produkt */
  .count-table tbody td:nth-child(2) > div:first-child {
    font-size: 15px;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
  }
  .count-table tbody td:nth-child(3) { /* Einheit: versteckt, bleibt in Meta mit Soll */
    display: none;
  }
  .count-table tbody td:nth-child(4) { /* Soll */
    grid-area: meta;
    font-size: 12px;
    color: var(--slate-600);
    font-weight: 500;
  }
  .count-table tbody td:nth-child(4)::before {
    content: "Soll: ";
    color: var(--slate-500);
    font-weight: 500;
  }
  .count-table tbody td:nth-child(5) { /* Ist-Input */
    grid-area: input;
    margin-top: 4px;
  }
  .count-table tbody td:nth-child(5) .count-input {
    width: 100%;
    max-width: none;
    height: 52px;
    font-size: 18px;
    font-weight: 700;
    text-align: right;
    padding: 0 18px;
    border-width: 1.5px;
  }
  .count-table tbody td:nth-child(6) { /* Diff */
    grid-area: diff;
    font-size: 13px;
    font-weight: 700;
    align-self: start;
    white-space: nowrap;
  }

  /* Filter-Bar: Filter-Input voll, Checkboxen darunter */
  #filter { width: 100% !important; }
  .card-head .inline > label.switch-label { flex: 0 0 auto; }

  /* (Sessions-Pills entfernt — jetzt Sidebar-Drawer) */

  /* Deviations-Table: horizontal scrollbar statt umbrechen */
  .deviations-table { font-size: 12px; }
  .deviations-table .emp { font-size: 11px; padding: 2px 6px; }

  /* Activity-List bleibt — nur kleiner */
  .activity-list li { padding: 10px 12px; }

  /* Modal auf ganze Höhe, bleibt aber zentriert */
  .modal { padding: 16px; }
  .modal-box { max-height: calc(100dvh - 32px); border-radius: var(--r-lg); }
  .modal-head { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-foot { padding: 14px 18px; margin: 18px -18px -18px; }
  .modal-foot .btn { flex: 1; }

  /* Buttons: Touch-Targets */
  .btn { min-height: 40px; }
  .btn.small { min-height: 36px; }
  .btn.full { padding: 14px 20px; font-size: 16px; }

  /* Grid-2 (Benutzerverwaltung): 1-spaltig */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 14px; }

  /* iOS: kein globaler Tap-Highlight, nur wo sinnvoll */
  a, button, .sidebar-item, tr, .scan-suggest li { -webkit-tap-highlight-color: transparent; }

  /* Toast (z. B. Fehler) über der Bottom-Nav, voll breit, mittig */
  .toast {
    left: 16px;
    right: 16px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    max-width: none;
    text-align: center;
    font-size: 13px;
    padding: 12px 16px;
  }
}

/* Sehr schmale Screens (iPhone SE, etc.) */
@media (max-width: 380px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .scan-hero-inner {
    grid-template-columns: 1fr;
    grid-template-areas: "input" "qty" "submit";
  }
}

/* ===================================================================
   PALETTEN-MODUS: Lagerplatz + Produkt + 3-Feld-Rechnung
   =================================================================== */
.scan-hero.palette-mode {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

/* Lagerplatz-Zeile — hervorgehoben mit linker Brand-Akzentkante */
.scan-hero.palette-mode .loc-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px 12px 16px;
  background: var(--brand-50);
  border: 1px solid var(--brand-200);
  border-left: 4px solid var(--brand-600);
  border-radius: var(--r-md);
}
.scan-hero.palette-mode .loc-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand-700);
  padding-left: 2px;
}
.scan-hero.palette-mode .loc-field {
  display: flex;
}
.scan-hero.palette-mode .loc-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  font-size: 15px;
  font-weight: 700;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  letter-spacing: 0.02em;
  border-radius: var(--r-sm);
  border: 1px solid var(--slate-300);
  background: #fff;
  color: var(--slate-900);
  transition: all 0.18s var(--ease);
}
.scan-hero.palette-mode .loc-field input:hover { border-color: var(--slate-400); }
.scan-hero.palette-mode .loc-field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(46, 115, 91, 0.14);
}
.scan-hero.palette-mode .loc-field input.filled {
  background: #fff;
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(46, 115, 91, 0.08);
}
.scan-hero.palette-mode .btn.loc-clear {
  height: 46px;
  width: 46px;
  padding: 0;
  font-size: 16px;
  background: #fff;
  color: var(--slate-500);
  border: 1px solid var(--slate-300);
}
.scan-hero.palette-mode .btn.loc-clear:hover {
  background: var(--slate-50);
  color: var(--slate-700);
  border-color: var(--slate-400);
}

/* Produkt-Zeile */
.scan-hero.palette-mode .prod-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.scan-hero.palette-mode .prod-field input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--r-md);
  border: 1px solid var(--slate-300);
  background: #fff;
  color: var(--slate-900);
  font-family: inherit;
  transition: all 0.18s var(--ease);
}
.scan-hero.palette-mode .prod-field input:hover { border-color: var(--slate-400); }
.scan-hero.palette-mode .prod-field input:disabled {
  background: var(--slate-50);
  color: var(--slate-500);
  border-color: var(--slate-200);
  cursor: not-allowed;
}
.scan-hero.palette-mode .prod-field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(46, 115, 91, 0.12);
}

/* Paletten-Rechnung: 3 Zahlenfelder + Operatoren + Submit */
.scan-hero.palette-mode .palette-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
}
.pal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.pal-field label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--slate-600);
  padding-left: 2px;
}
.pal-field input {
  width: 100%;
  height: 52px;
  padding: 0 10px;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
  border-radius: var(--r-sm);
  border: 1px solid var(--slate-300);
  background: #fff;
  color: var(--slate-900);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  transition: all 0.18s var(--ease);
}
.pal-field input:hover { border-color: var(--slate-400); }
.pal-field input:focus {
  outline: none;
  background: #fff;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(46, 115, 91, 0.14);
}
.pal-op {
  font-size: 22px;
  font-weight: 600;
  color: var(--slate-400);
  padding: 0 2px;
  line-height: 52px;
  user-select: none;
}
.scan-hero.palette-mode .btn.pal-submit {
  height: 52px;
  padding: 0 18px;
  background: var(--brand-600);
  color: #fff;
  border-color: var(--brand-700);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.scan-hero.palette-mode .btn.pal-submit:hover {
  background: var(--brand-700);
  color: #fff;
}
.scan-hero.palette-mode .btn.pal-submit:disabled {
  background: var(--slate-200); color: var(--slate-500); border-color: var(--slate-300); cursor: not-allowed;
}

/* Live-Rechnung "= 35 × 5 + 2 = 177 Trays × 5 L = 885 L" */
.palette-preview {
  margin-top: 2px;
  padding: 10px 14px;
  background: #fff;
  border: 1px dashed var(--brand-300);
  border-radius: var(--r-sm);
  color: var(--slate-700);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}
.palette-preview:empty { display: none !important; }
.palette-preview .pp-formula { color: var(--brand-600); }
.palette-preview .pp-result {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-weight: 800;
  color: var(--brand-800);
}
.palette-preview .pp-result .pp-unit { font-size: 13px; color: var(--slate-500); margin-left: 4px; }

/* Erfassungen an diesem Lagerplatz */
.loc-captures-card { margin-top: 14px; }
.loc-captures-card .activity-list li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-100);
  align-items: center;
}
.loc-captures-card .activity-list li:last-child { border-bottom: none; }
.loc-captures-card .lc-qty {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 700;
  font-size: 13px;
  color: var(--brand-700);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  padding: 3px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.loc-captures-card .lc-name { font-weight: 600; color: var(--slate-900); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc-captures-card .lc-name .lc-formula {
  display: block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  color: var(--slate-500);
  margin-top: 2px;
}
.loc-captures-card .lc-del {
  background: transparent;
  border: none;
  color: var(--slate-400);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
}
.loc-captures-card .lc-del:hover { background: var(--neg-bg); color: var(--neg); }

/* Mobile-Optimierung */
@media (max-width: 720px) {
  .scan-hero.palette-mode { padding: 12px; }
  .scan-hero.palette-mode .loc-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "label  label"
      "input  clear";
    gap: 6px 8px;
    padding: 8px 10px;
  }
  .scan-hero.palette-mode .loc-label { grid-area: label; }
  .scan-hero.palette-mode .loc-field { grid-area: input; }
  .scan-hero.palette-mode .btn.loc-clear { grid-area: clear; }
  .scan-hero.palette-mode .loc-field input { height: 48px; font-size: 16px; }
  .scan-hero.palette-mode .btn.loc-clear { height: 48px; width: 48px; }

  .scan-hero.palette-mode .prod-row { grid-template-columns: 1fr; }
  .scan-hero.palette-mode .prod-field input { height: 52px; font-size: 16px; }

  /* Paletten-Felder mobil: 3 Inputs nebeneinander, Submit darunter voll */
  .scan-hero.palette-mode .palette-row {
    grid-template-columns: 1fr auto 1fr auto 1fr;
    grid-template-areas:
      "f1 op1 f2 op2 f3"
      "sb sb  sb sb  sb";
    row-gap: 10px;
    padding: 10px;
  }
  .scan-hero.palette-mode .palette-row .pal-field:nth-of-type(1) { grid-area: f1; }
  .scan-hero.palette-mode .palette-row .pal-field:nth-of-type(2) { grid-area: f2; }
  .scan-hero.palette-mode .palette-row .pal-field:nth-of-type(3) { grid-area: f3; }
  .scan-hero.palette-mode .palette-row .pal-op:nth-of-type(1) { grid-area: op1; }
  .scan-hero.palette-mode .palette-row .pal-op:nth-of-type(2) { grid-area: op2; }
  .scan-hero.palette-mode .btn.pal-submit { grid-area: sb; width: 100%; height: 52px; font-size: 16px; }
  .pal-field input { height: 54px; font-size: 20px; }

  .palette-preview { font-size: 12px; padding: 8px 10px; }
  .palette-preview .pp-result { font-size: 14px; }
}
@media (max-width: 380px) {
  .scan-hero.palette-mode .palette-row {
    grid-template-columns: 1fr;
    grid-template-areas: "f1" "op1" "f2" "op2" "f3" "sb";
  }
  .scan-hero.palette-mode .palette-row .pal-op { text-align: center; line-height: 1; padding: 2px 0; }
}

/* ---- Live-Indikator (z. B. im Dashboard-Header) ---- */
.tab-status {
  font-size: 12px;
  color: var(--slate-500);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
  padding: 6px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 99px;
  background: #fff;
}
.tab-status::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 99px;
  background: var(--brand-400);
  box-shadow: 0 0 0 3px var(--brand-50);
  animation: live-pulse 2s ease-in-out infinite;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.85); }
}

/* Dashboard-Status: Datum + Live-Uhr */
.dash-status {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  color: var(--slate-600);
  padding: 9px 16px;
  border: 1px solid var(--slate-200);
  border-radius: 99px;
  background: #fff;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(15, 42, 35, 0.04);
}
.dash-status .ds-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--brand-500);
  box-shadow: 0 0 0 3px var(--brand-50);
  animation: live-pulse 2s ease-in-out infinite;
  flex-shrink: 0;
  align-self: center;
}
.dash-status .ds-date {
  color: var(--slate-500);
  font-weight: 500;
  letter-spacing: 0.01em;
}
.dash-status .ds-time {
  color: var(--brand-800);
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ---- Active session panel (Dashboard) ---- */
/* .active-session-head wurde ersetzt durch .active-session-head-slim (siehe oben).
   Die Aktionen (PDF/Excel/CSV/KI/Abschluss/Reopen/Delete) leben jetzt in der
   Kontextleiste über dem Inhalt (.ctxbar / .cb-menu). */
.active-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--brand-700);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---- Meldungen vom Team (Admin + Korrektor) ---- */
.notes-card {
  margin-bottom: 20px;
  border-left: 4px solid var(--brand-500);
}
.notes-card .card-head-sm h2 {
  display: inline-flex;
  align-items: center;
}
.notes-card .card-head-sm h2 svg {
  color: var(--brand-600);
}
.notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notes-empty {
  padding: 20px 4px 6px;
  text-align: center;
  font-size: 14px;
}
.note-item {
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  padding: 12px 14px;
  background: #fff;
  transition: all 0.18s var(--ease);
}
.note-item.is-important {
  border-color: #f4a261;
  background: linear-gradient(180deg, #fff7ec 0%, #fff 100%);
}
.note-item.is-resolved {
  opacity: 0.6;
  background: var(--slate-50);
}
.note-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}
.note-loc {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.04em;
  background: var(--brand-50);
  color: var(--brand-800);
  border: 1px solid var(--brand-100);
  padding: 3px 9px;
  border-radius: 99px;
}
.note-loc-generic {
  background: var(--slate-50);
  color: var(--slate-600);
  border-color: var(--slate-200);
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0;
}
.note-prio {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9a3e10;
  background: #fde4cf;
  border: 1px solid #f4a261;
  padding: 3px 8px;
  border-radius: 99px;
}
.note-meta {
  font-size: 12px;
  color: var(--slate-500);
  margin-left: auto;
}
.note-body {
  font-size: 14px;
  line-height: 1.5;
  color: var(--slate-900);
  white-space: pre-wrap;
  word-break: break-word;
  padding: 4px 0 8px;
}
.note-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.note-resolved-meta {
  font-size: 12px;
  color: var(--slate-500);
  font-style: italic;
}
.note-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.note-del {
  background: transparent;
  border: none;
  color: var(--slate-400);
  cursor: pointer;
  font-size: 15px;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  transition: all 0.15s var(--ease);
}
.note-del:hover {
  background: var(--neg-bg);
  color: var(--neg);
}
@media (max-width: 720px) {
  .note-meta { margin-left: 0; width: 100%; }
  .note-actions { width: 100%; justify-content: flex-end; }
}

/* ---- Modal ---- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: modalIn 0.18s var(--ease);
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 30, 24, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-box {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: modalBoxIn 0.22s var(--ease);
}
@keyframes modalIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalBoxIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--slate-100);
}
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-body label { margin-top: 0; }
.modal-body input[type="file"] { background: var(--slate-50); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 24px;
  border-top: 1px solid var(--slate-100);
  background: var(--slate-50);
  margin: 24px -24px -22px;
}

/* ---- Autocomplete (Scan-Feld) ---- */
.scan-suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  list-style: none;
  margin: 0;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-height: 320px;
  overflow-y: auto;
}
.scan-suggest li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--slate-800);
  transition: background 0.1s var(--ease);
}
.scan-suggest li:hover,
.scan-suggest li.highlight {
  background: var(--brand-50);
  color: var(--brand-800);
}
.scan-suggest li .sg-name {
  flex: 1;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scan-suggest li .sg-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--slate-500);
}
.scan-suggest li .sg-target {
  font-size: 11px;
  color: var(--brand-700);
  background: var(--brand-50);
  padding: 2px 8px;
  border-radius: 99px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.scan-suggest li.highlight .sg-meta { color: var(--brand-700); }
.scan-suggest .sg-empty {
  padding: 14px;
  color: var(--slate-400);
  font-style: italic;
  cursor: default;
  background: transparent !important;
}
.scan-suggest mark {
  background: rgba(255, 218, 94, 0.55);
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
}

/* ==================== KI-Features ==================== */

/* "KI-Bericht" Button: dezent mit brand-Akzent */
.ai-btn {
  background: linear-gradient(135deg, #fff 0%, #f8faf7 100%) !important;
  border-color: var(--brand-600) !important;
  color: var(--brand-700) !important;
  font-weight: 600;
}
.ai-btn:hover {
  background: var(--brand-50) !important;
  color: var(--brand-700) !important;
}

/* Wide Modal fürs Report-Fenster */
.modal-box.modal-box-wide { max-width: 720px; }

/* Klickbare Abweichungszeile (Korrektor/Admin → Drill-down zu Einzel-Zählungen) */
.dev-row-clickable { cursor: pointer; transition: background 0.12s ease; }
.dev-row-clickable:hover { background: var(--brand-50, #f0f6ff); }
.dev-row-clickable:hover .prod-name { text-decoration: underline; }

/* Korrektur-View: Filter-Leiste */
.korr-filters { padding: 14px 16px; }
.korr-filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.korr-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 180px;
  flex: 1 1 180px;
}
.korr-filter input[type="text"],
.korr-filter select {
  padding: 8px 10px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  font-size: 14px;
}
.korr-filter.inline-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  min-width: auto;
  flex: 0 0 auto;
}
.korr-filter.inline-check input { margin: 0; }
.table-wrap { overflow-x: auto; }
@media (max-width: 720px) {
  .korr-filter { flex: 1 1 100%; min-width: 0; }
  .korr-filter-row .btn { width: 100%; }
}

/* Korrektur-Badge (neben Zählungen, die als Korrektur markiert sind) */
.corr-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: var(--warn-bg, #fff4cc);
  color: var(--warn, #a86600);
  padding: 3px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  margin-right: 6px;
}
.corr-badge.sm { font-size: 10px; padding: 2px 6px; }
tr.corr-row td,
li.corr-row { background: var(--warn-bg, #fff8e1) !important; }

/* Korrektur-Form im Modal */
.korr-sum-banner {
  padding: 10px 14px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: var(--brand-50, #eef5ff);
  color: var(--slate-800, #1f2937);
  font-size: 14px;
}
.korr-add-form {
  margin-top: 18px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--brand-200, #AAC8BC);
  background: linear-gradient(180deg, var(--brand-50, #EEF4F1) 0%, #fff 100%);
  box-shadow: inset 4px 0 0 var(--brand-600, #1E5849);
  position: relative;
}
.korr-add-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--brand-100, #D6E5DF);
  color: var(--brand-800, #113028);
  letter-spacing: 0.01em;
}
.korr-add-form .korr-field input {
  border-color: var(--brand-200, #AAC8BC);
}
.korr-add-form .korr-field input:focus {
  outline: none;
  border-color: var(--brand-600, #1E5849);
  box-shadow: 0 0 0 3px rgba(30, 88, 73, 0.15);
}
.korr-add-form .korr-sub-head {
  color: var(--brand-700, #174439);
}
.korr-add-form .palette-preview {
  background: #fff;
  border: 1px solid var(--brand-200, #AAC8BC);
  color: var(--brand-800, #113028);
}
.korr-add-form .palette-preview .pp-formula { color: var(--brand-600, #1E5849); }
.korr-add-form .palette-preview .pp-result { color: var(--brand-800, #113028); }
.korr-add-form .palette-preview .pp-result .pp-unit { color: var(--brand-600, #1E5849); opacity: 1; }
.korr-add-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.korr-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
  flex: 1 1 120px;
}
.korr-field-wide { flex: 2 1 200px; }
.korr-field input {
  padding: 8px 10px;
  border: 1px solid var(--slate-200, #d1d5db);
  border-radius: 8px;
  font-size: 14px;
  background: white;
}
.corr-note {
  font-style: italic;
  margin-top: 2px;
}
.korr-sub-head {
  margin: 12px 0 6px;
  font-weight: 600;
  color: var(--slate-600, #475569);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 11px;
}
.korr-preview {
  margin: 8px 0 4px;
}
@media (max-width: 720px) {
  .korr-field { flex: 1 1 100%; min-width: 0; }
  .korr-add-row .btn { width: 100%; }
}

/* Loading-Spinner */
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--slate-200);
  border-top-color: var(--brand-600);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

/* Report-Zusammenfassung */
.ai-summary {
  background: var(--brand-50, #ECF5F1);
  border-left: 4px solid var(--brand-600);
  padding: 14px 16px;
  border-radius: 8px;
  line-height: 1.55;
  color: var(--slate-800);
  margin-bottom: 18px;
}

.ai-h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 22px 0 10px 0;
}

/* Anomalien */
.ai-anomalies, .ai-clusters, .ai-recs {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-anom {
  border: 1px solid var(--slate-200);
  border-left-width: 4px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.ai-anom.sev-high { border-left-color: var(--neg); }
.ai-anom.sev-mid  { border-left-color: #F59E0B; }
.ai-anom.sev-low  { border-left-color: var(--slate-400); }
.ai-anom-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}
.ai-sev {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 99px;
  background: var(--slate-100);
  color: var(--slate-700);
}
.sev-high .ai-sev { background: var(--neg-bg); color: #991B1B; }
.sev-mid  .ai-sev { background: #FEF3C7; color: #92400E; }
.ai-anom-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--slate-700);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-clusters li, .ai-recs li {
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
  background: #fff;
  line-height: 1.5;
}

.ai-meta {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px dashed var(--slate-200);
}

/* NL-Query-Card */
.ai-query-card { margin-top: 16px; }
.ai-query-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.ai-query-form input {
  flex: 1;
  margin: 0;
}
.ai-query-form button { flex-shrink: 0; }

.ai-query-result { margin-top: 16px; }

.ai-sql {
  background: var(--slate-900);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  color: #E2E8F0;
}
.ai-sql-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.ai-sql-head .muted { color: var(--slate-400); }
.ai-sql-head .btn { color: var(--slate-300) !important; }
.ai-sql-head .btn:hover { background: rgba(255,255,255,0.08) !important; color: #fff !important; }
.ai-sql-code {
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 12px;
  color: #CBD5E1;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 6px 0;
}
.ai-sql .muted { color: var(--slate-400); }

.ai-result-meta { margin-bottom: 6px; }
.ai-table-wrap { overflow-x: auto; border: 1px solid var(--slate-200); border-radius: 8px; }
.ai-result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ai-result-table th, .ai-result-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--slate-100);
  text-align: left;
  vertical-align: top;
}
.ai-result-table th {
  background: var(--slate-50);
  font-weight: 600;
  color: var(--slate-700);
  position: sticky;
  top: 0;
}
.ai-result-table tr:last-child td { border-bottom: none; }
.ai-result-table tr:hover td { background: var(--slate-50); }

/* Mobile */
@media (max-width: 840px) {
  .ai-query-form { flex-direction: column; }
  .ai-query-form button { width: 100%; }
  .modal-box.modal-box-wide { max-width: 100%; }
}

/* ---- Lagerplatz-Pills (Dashboard + Top-Abweichungen) ---- */
.loc-pill {
  display: inline-block;
  font-family: "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--brand-700);
  background: var(--brand-50);
  border: 1px solid var(--brand-100);
  padding: 2px 7px;
  border-radius: 99px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  margin-right: 2px;
}
.loc-pill.sm { font-size: 10px; padding: 1px 6px; margin-right: 6px; }
.deviations-table .loc-cell {
  max-width: 180px;
  white-space: normal;
  line-height: 1.6;
}

/* Aktivitäts-Badge: Menge + Einheit */
.activity-list .act-badge .act-unit {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.75;
  margin-left: 3px;
}

/* ---- Rollen-Badges in Benutzerverwaltung ---- */
/* ---- Badge-System (inTakt-Pills) ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--slate-100);
  color: var(--slate-700);
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: middle;
}
.badge.small { font-size: 11px; padding: 3px 8px; }
.badge.brand   { background: var(--brand-100); color: var(--brand-800); }
.badge.success { background: #DCFCE7; color: #166534; }
.badge.warning { background: #FEF3C7; color: #92400E; }
.badge.error,
.badge.danger  { background: #FEE2E2; color: #991B1B; }
.badge.info    { background: #E0F2FE; color: #075985; }
.badge.muted   { background: var(--slate-100); color: var(--slate-500); }

.role-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  margin-right: 6px;
  vertical-align: middle;
}
.role-badge.role-admin {
  color: var(--brand-800);
  background: var(--brand-100);
}
.role-badge.role-corrector {
  color: #92400E;
  background: #FEF3C7;
}
.role-badge.role-user {
  color: var(--slate-600);
  background: var(--slate-100);
}
.role-select {
  font-size: 12px;
  padding: 3px 6px;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  background: #fff;
  color: var(--slate-800);
  vertical-align: middle;
}
.role-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile: Lagerplatz-Spalte auf kleinen Bildschirmen ausblenden */
@media (max-width: 720px) {
  .deviations-table th:nth-child(2),
  .deviations-table td:nth-child(2) { display: none; }  /* Lagerplatz */
}

/* ====================================================================
   Motion & Micro-Interactions
   ==================================================================== */

/* Ein-/Ausblende-Keyframes */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes fadeSlideDown {
  from { opacity: 0; transform: translate3d(0, -6px, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes fadeSlideLeft {
  from { opacity: 0; transform: translate3d(12px, 0, 0); }
  to   { opacity: 1; transform: translate3d(0, 0, 0); }
}
@keyframes popScale {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.08); }
  100% { transform: scale(1); }
}
@keyframes softGlow {
  0%   { box-shadow: 0 0 0 0 rgba(30, 88, 73, 0.35); }
  70%  { box-shadow: 0 0 0 8px rgba(30, 88, 73, 0); }
  100% { box-shadow: 0 0 0 0 rgba(30, 88, 73, 0); }
}
@keyframes shimmer {
  0%   { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

/* Views: sanftes Fade+Slide beim Tab-Wechsel
   (wird von JS bei jedem showView über Klasse .view-enter neu gezündet) */
.view.view-enter {
  animation: fadeSlideUp 0.28s var(--ease) both;
}

/* KPI-Karten: Stagger-Einblendung auf dem Dashboard */
.kpi-grid > * {
  animation: fadeSlideUp 0.32s var(--ease) both;
}
.kpi-grid > *:nth-child(1) { animation-delay: 0.02s; }
.kpi-grid > *:nth-child(2) { animation-delay: 0.06s; }
.kpi-grid > *:nth-child(3) { animation-delay: 0.10s; }
.kpi-grid > *:nth-child(4) { animation-delay: 0.14s; }
.kpi-grid > *:nth-child(5) { animation-delay: 0.18s; }

/* Karten: weicher Hover-Lift */
.card {
  transition:
    transform 0.18s var(--ease),
    box-shadow 0.18s var(--ease),
    border-color 0.18s var(--ease);
}
.card.active-session-head-slim:hover,
.dash-grid .card:hover,
.active-session-panel .card:hover {
  /* dezent, nicht überall — sonst hüpft alles */
}
.stat-card {
  transition:
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    border-color 0.2s var(--ease);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--brand-200);
}

/* KPI-Nummern: nur sanfte Farbübergänge — keine Pop-Animation.
   Grund: der Hintergrund-Refresh (alle 10 s) würde sonst zucken. */
.kpi-number {
  transition: color 0.2s var(--ease);
}

/* Progressbars: weiche Füllung */

/* Sidebar-Active-Card: Ein-/Ausblenden */

/* Sidebar-Liste: nur Hover/Transitions — KEINE Einblende-Animation,
   weil die Liste periodisch neu gerendert wird und sonst zucken würde. */
.sidebar-list .sidebar-item {
  transition:
    background 0.15s var(--ease),
    border-color 0.15s var(--ease),
    transform 0.15s var(--ease),
    box-shadow 0.2s var(--ease);
}
.sidebar-list .sidebar-item:hover {
  transform: translateX(2px);
}

/* Aktivitätsliste: kein Stagger-Fade beim Refresh. Aber ECHT neu eingefügte
   Einträge (SSE-Event) bekommen via JS die Klasse .slide-in bzw. .slide-out. */
@keyframes slideInFromTop {
  from { opacity: 0; transform: translate3d(0, -14px, 0); max-height: 0; }
  40%  { max-height: 80px; }
  to   { opacity: 1; transform: translate3d(0, 0, 0); max-height: 80px; }
}
@keyframes slideOutToLeft {
  from { opacity: 1; transform: translate3d(0, 0, 0); max-height: 80px; }
  to   { opacity: 0; transform: translate3d(-30px, 0, 0); max-height: 0; padding-top: 0; padding-bottom: 0; margin: 0; border: none; }
}
#activityList li {
  transition: background 0.15s var(--ease);
}
#activityList li.slide-in {
  /* Slide von oben + kurzer Brand-Highlight, der danach weggeht */
  animation: slideInFromTop 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.05),
             fadeBg 0.9s ease-out 0.3s forwards;
  background: var(--brand-50);
}
@keyframes fadeBg {
  from { background: var(--brand-50); }
  to   { background: transparent; }
}
#activityList li.slide-out {
  animation: slideOutToLeft 0.22s var(--ease) forwards;
  pointer-events: none;
  overflow: hidden;
}

/* Live-Dot Status: wenn SSE getrennt, wird er grau und pulst langsamer */
.dash-status.live-disconnected .ds-dot {
  background: var(--slate-400);
  box-shadow: 0 0 0 3px var(--slate-100);
  animation-duration: 3s;
}

/* Buttons: Press-Feedback (background-image muss mit, sonst springt der Gradient) */
.btn {
  transition:
    background 0.18s var(--ease),
    background-image 0.18s var(--ease),
    border-color 0.18s var(--ease),
    color 0.18s var(--ease),
    transform 0.12s var(--ease),
    box-shadow 0.18s var(--ease);
}
.btn:not(:disabled):active {
  transform: translateY(0) scale(0.985);
}
.btn.primary:not(:disabled):hover,
.btn.brand:not(:disabled):hover {
  box-shadow: 0 4px 12px -2px rgb(15 23 42 / 0.18);
}

/* Tags / Status-Chips: weiche Farbübergänge */
.tag {
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

/* Deviations-Tabellenzeilen: sanfter Hover */
.count-table tbody tr,
.deviations-table tbody tr {
  transition: background 0.12s var(--ease);
}

/* Modal-Box: sichtbar, aber nicht zappelnd — existierende modalIn/BoxIn bleiben */
.modal-box {
  will-change: transform, opacity;
}

/* Toast: existierende Transition verfeinern */
.toast {
  transition:
    opacity 0.22s var(--ease),
    transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

/* Autocomplete-Dropdown */
.autocomplete-list,
.suggestions,
[role="listbox"] {
  animation: fadeSlideDown 0.16s var(--ease) both;
}

/* Korrektur-Formular: gleitendes Einblenden */
.korr-add-form {
  animation: fadeSlideDown 0.22s var(--ease) both;
}
.korr-add-form .palette-preview {
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

/* Banner/Notices: slide-in */
.banner, .notice, .alert-info {
  animation: fadeSlideDown 0.25s var(--ease) both;
}

/* Skeleton-/Shimmer-Placeholder (falls irgendwo Loading-Boxen eingebaut werden) */
.skeleton {
  background: linear-gradient(90deg, var(--slate-100) 0%, var(--slate-200) 40%, var(--slate-100) 80%);
  background-size: 200px 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 6px;
}

/* Sidebar-Drawer & Backdrop auf Mobile: weicher */
.sidebar,
.sidebar-backdrop {
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
              opacity 0.22s var(--ease);
}

/* === Reduce motion: nutzer-präferenz respektieren === */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================================
   Empty-State-Home — rollenabhängige Startseite wenn keine Inventur offen
   ========================================================================= */
.home-wrap {
  max-width: 880px;
  margin: 0;
  text-align: left;
}
.home-head {
  margin-bottom: 20px;
}
.home-greet {
  font-size: 22px;
  font-weight: 600;
  color: var(--slate-900, #0f172a);
  letter-spacing: -0.01em;
}
.home-sub {
  margin-top: 4px;
  font-size: 13px;
  color: var(--slate-500, #64748b);
}

/* Warte-Banner (Korrektor + Mitarbeiter) */
.home-wait {
  background: #fff;
  border: 0.5px solid var(--slate-200, #e2e8f0);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.home-wait-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: var(--slate-400, #94a3b8);
  box-shadow: 0 0 0 4px var(--slate-100, #f1f5f9);
  flex: 0 0 auto;
  animation: waitPulse 2.4s ease-in-out infinite;
}
@keyframes waitPulse {
  0%, 100% { box-shadow: 0 0 0 4px var(--slate-100, #f1f5f9); }
  50%      { box-shadow: 0 0 0 6px var(--slate-100, #f1f5f9); }
}
.home-wait-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--slate-800, #1e293b);
}
.home-wait-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--slate-500, #64748b);
}
.home-wait.home-wait-big {
  flex-direction: column;
  text-align: center;
  padding: 28px 24px;
  gap: 10px;
  margin-bottom: 28px;
  background: linear-gradient(180deg, #fff 0%, var(--brand-50, #e7f1ee) 100%);
  border: 0.5px solid var(--brand-200, #c2d8d0);
}
.home-wait-big .home-wait-icon {
  width: 48px; height: 48px;
  border-radius: 99px;
  background: #fff;
  color: var(--brand-700, #174439);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
  animation: waitPulse 2.4s ease-in-out infinite;
}
.home-wait-big .home-wait-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--slate-900, #0f172a);
}
.home-wait-big .home-wait-sub {
  font-size: 13px;
  max-width: 420px;
  line-height: 1.5;
}

/* KPI-Kacheln */
.home-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.home-kpi {
  background: #fff;
  border: 0.5px solid var(--slate-200, #e2e8f0);
  border-radius: 12px;
  padding: 14px 16px;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}
.home-kpi:hover { border-color: var(--slate-300, #cbd5e1); }
.hk-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500, #64748b);
  font-weight: 500;
}
.hk-value {
  margin-top: 6px;
  font-size: 24px;
  font-weight: 600;
  color: var(--slate-900, #0f172a);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.hk-small { font-size: 16px; }
.hk-brand { color: var(--brand-700, #174439); }
.hk-warn  { color: #b91c1c; }

/* Sektions-Labels */
.home-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--slate-500, #64748b);
  margin: 0 0 10px;
}

/* Karten-Reihe „Zuletzt abgeschlossen" */
.home-closed-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}
.home-closed-card {
  background: #fff;
  border: 0.5px solid var(--slate-200, #e2e8f0);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.home-closed-card:hover {
  border-color: var(--brand-400, #4d8575);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}
.home-closed-card:active { transform: scale(0.99); }
.hcc-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--slate-900, #0f172a);
}
.hcc-meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--slate-500, #64748b);
}
.hcc-diff {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.hcc-diff.pos { color: #15803d; }
.hcc-diff.neg { color: #b91c1c; }

/* Schnellaktionen (Admin) */
.home-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* Listenform (Korrektor + Mitarbeiter) */
.home-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  background: #fff;
  border: 0.5px solid var(--slate-200, #e2e8f0);
  border-radius: 12px;
  overflow: hidden;
}
.home-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 0.5px solid var(--slate-200, #e2e8f0);
  transition: background 0.12s var(--ease);
}
.home-list-row:last-child { border-bottom: none; }
.home-list-row:hover { background: var(--slate-50, #f8fafc); }
.hlr-body { flex: 1; min-width: 0; }
.hlr-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-900, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hlr-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--slate-500, #64748b);
}
.hlr-qty {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-800, #1e293b);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.hlr-unit {
  margin-left: 3px;
  font-size: 10px;
  font-weight: 500;
  color: var(--slate-500, #64748b);
}
.home-list-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--slate-500, #64748b);
}

/* Kleine How-To-Anleitung (Mitarbeiter-Dashboard) */
.home-howto {
  margin: 0 0 12px;
  padding: 14px 18px 14px 34px;
  background: #fff;
  border: 0.5px solid var(--slate-200, #e2e8f0);
  border-radius: 12px;
  list-style: decimal;
  color: var(--slate-700, #334155);
  font-size: 13px;
  line-height: 1.55;
}
.home-howto li { margin: 4px 0; }
.home-howto li::marker {
  color: var(--brand-700, #174439);
  font-weight: 600;
}
.home-howto b { color: var(--slate-900, #0f172a); font-weight: 600; }
.home-howto kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 1px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-700, #334155);
  background: var(--slate-100, #f1f5f9);
  border: 0.5px solid var(--slate-200, #e2e8f0);
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--slate-200, #e2e8f0);
}
.home-howto code {
  padding: 1px 5px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11.5px;
  color: var(--brand-700, #174439);
  background: var(--brand-50, #e7f1ee);
  border-radius: 4px;
}
.home-hint {
  margin: 0 0 24px;
  padding: 10px 14px;
  background: var(--slate-50, #f8fafc);
  border-left: 3px solid var(--brand-400, #4a8f7e);
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--slate-600, #475569);
  line-height: 1.5;
}

/* Mobile: KPIs 2-spaltig, Cards 1-spaltig */
@media (max-width: 720px) {
  .home-kpis { grid-template-columns: repeat(2, 1fr); }
  .home-closed-grid { grid-template-columns: 1fr; }
  .home-greet { font-size: 20px; }
}

/* =========================================================================
   UI-Feinschliff (2026-07): SVG-Icons + Fokus-Ringe
   ========================================================================= */

/* Mobile-Tab-Icons sind jetzt SVGs statt Text-Glyphen */
.mobile-tabs .mt-item .mt-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}

/* Sichtbarer Fokus-Ring für Tastatur-Nutzer (Scanner = Keyboard-Wedge!) —
   nur bei :focus-visible, stört Maus-/Touch-Bedienung nicht. */
.btn:focus-visible,
a:focus-visible,
.mt-item:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* Icon-Buttons: SVG sauber zentrieren */
.btn svg { flex: 0 0 auto; }

/* Lösch-Buttons (jetzt SVG statt Emoji): Icon sauber zentrieren */
.act-del, .lc-del, .note-del, .si-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.act-del svg, .lc-del svg, .note-del svg, .si-delete svg { display: block; }

/* ===================================================================
   SKELETON-LOADER
   Wird beim ersten Laden statt leerer Flächen gezeigt.
=================================================================== */
@keyframes skeletonShimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--slate-100) 0%,
    var(--slate-200) 50%,
    var(--slate-100) 100%);
  background-size: 800px 100%;
  animation: skeletonShimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
  display: block;
}
.skeleton.text  { height: 12px; margin: 8px 0; }
.skeleton.title { height: 22px; width: 45%; margin: 0 0 14px; }
.skeleton.line  { height: 12px; width: 100%; }
.skeleton.line.short { width: 60%; }
.skeleton.number { height: 32px; width: 70%; margin-top: 6px; }
.skeleton.pill  { height: 22px; width: 84px; border-radius: var(--r-pill); }
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* ===================================================================
   COMMAND PALETTE (⌘K)
=================================================================== */
.cmdk {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 16px 16px;
}
.cmdk.open { display: flex; }
.cmdk-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 30, 24, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: modalIn 0.16s var(--ease);
}
.cmdk-box {
  position: relative;
  width: 100%;
  max-width: 580px;
  background: #fff;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  animation: cmdkIn 0.2s var(--ease-out);
}
@keyframes cmdkIn {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--slate-100);
}
.cmdk-input-row svg { flex: 0 0 auto; color: var(--slate-400); }
.cmdk-input-row input {
  border: none;
  outline: none;
  box-shadow: none;
  padding: 0;
  font-size: 16px;
  font-weight: 500;
  background: transparent;
  color: var(--slate-900);
}
.cmdk-input-row input:focus { box-shadow: none; border: none; }
.cmdk-input-row input::placeholder { color: var(--slate-400); font-weight: 400; }
.cmdk-hint {
  font-size: 11px;
  color: var(--slate-400);
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  padding: 2px 6px;
  white-space: nowrap;
  flex: 0 0 auto;
}
.cmdk-results {
  overflow-y: auto;
  padding: 6px;
  flex: 1 1 auto;
}
.cmdk-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate-400);
  padding: 10px 12px 6px;
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-input);
  cursor: pointer;
  font-size: 14px;
  color: var(--slate-800);
  transition: background 0.1s var(--ease);
}
.cmdk-item .cmdk-ico {
  width: 28px; height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--brand-50);
  color: var(--brand-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.cmdk-item .cmdk-main { flex: 1 1 auto; min-width: 0; }
.cmdk-item .cmdk-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk-item .cmdk-sub {
  font-size: 12px;
  color: var(--slate-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cmdk-item.active { background: var(--brand-50); }
.cmdk-item.active .cmdk-ico { background: var(--brand-600); color: #fff; }
.cmdk-empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--slate-400);
  font-size: 13px;
}
@media (max-width: 600px) {
  .cmdk { padding: 8vh 12px 12px; }
  .cmdk-hint { display: none; }
}

/* ===================================================================
   KI-INSIGHT-ZEILE (Admin-Dashboard)
=================================================================== */
.ai-insight {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-card);
  background: linear-gradient(135deg, var(--brand-50) 0%, #FFFFFF 70%);
  border: 1px solid var(--brand-100);
  margin-bottom: 16px;
  animation: fadeSlideDown 0.35s var(--ease) both;
}
.ai-insight .aii-icon {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--brand-gradient);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: var(--shadow-soft);
}
.ai-insight .aii-body { flex: 1 1 auto; min-width: 0; }
.ai-insight .aii-text {
  font-size: 13.5px;
  color: var(--slate-800);
  font-weight: 500;
  line-height: 1.5;
}
.ai-insight .aii-meta {
  font-size: 11px;
  color: var(--slate-400);
  margin-top: 3px;
}
.ai-insight .aii-refresh {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--slate-400);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  line-height: 1;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.ai-insight .aii-refresh:hover { color: var(--brand-700); background: var(--brand-100); }
.ai-insight.loading .aii-text { color: var(--slate-400); }

/* ===================================================================
   BULK-AKTIONEN (Korrektur)
=================================================================== */
.bulk-bar {
  position: sticky;
  bottom: 16px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  margin-top: 16px;
  border-radius: var(--r-card);
  background: var(--slate-900);
  color: #fff;
  box-shadow: var(--shadow-pop);
  animation: fadeSlideUp 0.25s var(--ease-out) both;
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.bulk-bar .bb-count { font-weight: 600; font-size: 14px; flex: 1 1 auto; }
.bulk-bar .btn { height: 36px; font-size: 13px; }
.bulk-bar .btn.ghost { color: rgba(255,255,255,0.75); }
.bulk-bar .btn.ghost:hover { background: rgba(255,255,255,0.12); color: #fff; }

/* Checkbox-Spalte in Tabellen */
.chk-col { width: 38px; text-align: center; }
input[type="checkbox"].row-chk {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-600);
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
}
tbody tr.row-selected { background: var(--brand-50) !important; }

/* ===================================================================
   MEINE STATISTIKEN (Mitarbeiter-Dashboard)
=================================================================== */
.mystats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 700px) {
  .mystats-grid { grid-template-columns: 1fr 1fr; }
  .mystats-grid > *:last-child { grid-column: 1 / -1; }
}
.mystat {
  background: var(--slate-50);
  border-radius: var(--r-input);
  padding: 14px 16px;
}
.mystat .ms-label {
  font-size: 13px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--slate-500);
}
.mystat .ms-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--slate-900);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.mystat .ms-value small { font-size: 14px; font-weight: 600; color: var(--slate-500); margin-left: 2px; }
.mystat .ms-sub { font-size: 11.5px; color: var(--slate-500); margin-top: 2px; }
.mystat.accent { background: var(--brand-50); }
.mystat.accent .ms-value { color: var(--brand-700); }

/* ===================================================================
   DASHBOARD: Fortschritts-Hero mit Ring
=================================================================== */
.progress-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
}
.ph-ring { flex: 0 0 auto; line-height: 0; }
.ph-track {
  fill: none;
  stroke: var(--slate-100);
  stroke-width: 11;
}
.ph-bar {
  fill: none;
  stroke: var(--brand-500);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.7s var(--ease-out), stroke 0.3s var(--ease);
}
.ph-bar.done { stroke: var(--success); }
.ph-pct {
  font-size: 25px;
  font-weight: 600;
  fill: var(--slate-900);
  font-variant-numeric: tabular-nums;
}
.ph-pct-sub { font-size: 11px; fill: var(--slate-500); }
.ph-body { min-width: 0; }
.ph-sub { font-size: 13px; margin-bottom: 4px; }
.ph-count {
  font-size: 26px;
  font-weight: 600;
  color: var(--slate-900);
  letter-spacing: -0.025em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.ph-of { font-size: 17px; font-weight: 500; color: var(--slate-400); letter-spacing: 0; }
.ph-facts {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-top: 10px;
}
.ph-fact { font-size: 12.5px; color: var(--slate-600); }
.ph-fact b { font-weight: 500; color: var(--slate-800); }
@media (max-width: 640px) {
  .progress-hero { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 14px; }
  .ph-facts { justify-content: center; }
}

/* ---- Team gerade aktiv ---- */
.team-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}
.team-member {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.team-member.idle { opacity: 0.5; }
.tm-avatar {
  width: 32px; height: 32px;
  border-radius: 12px;
  background: var(--brand-100);
  color: var(--brand-800);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
}
.team-member.live .tm-avatar {
  background: var(--brand-gradient);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(47, 143, 122, 0.18);
}
.tm-name { font-size: 13px; color: var(--slate-900); display: block; }
.tm-meta { font-size: 11.5px; color: var(--slate-500); display: block; }

/* ---- Tempo + Warengruppen nebeneinander ---- */
.insight-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
@media (max-width: 900px) { .insight-grid { grid-template-columns: 1fr; } }

.spark-wrap { height: 60px; }
.spark { width: 100%; height: 60px; display: block; overflow: visible; }
.spark-line {
  fill: none;
  stroke: var(--brand-500);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.spark-area { fill: var(--brand-50); stroke: none; }
.spark-dot { fill: var(--brand-600); }
.spark-foot { font-size: 12.5px; color: var(--slate-600); margin-top: 8px; }
.spark-foot b { font-weight: 500; color: var(--slate-800); }
.spark-empty { font-size: 12.5px; color: var(--slate-400); padding: 18px 0; text-align: center; }

/* ---- Warengruppen-Balken ---- */
.catbars { display: flex; flex-direction: column; gap: 9px; }
.catbar-head {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--slate-600);
  margin-bottom: 3px;
  gap: 10px;
}
.catbar-head .cb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catbar-head .cb-pct { font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.catbar-track {
  height: 5px;
  background: var(--slate-100);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.catbar-fill {
  height: 100%;
  border-radius: var(--r-pill);
  transition: width 0.6s var(--ease-out), background 0.3s var(--ease);
}
.catbar-fill.low  { background: var(--danger); }
.catbar-fill.mid  { background: var(--warning); }
.catbar-fill.high { background: var(--brand-500); }
.catbar-fill.done { background: var(--success); }

/* ---- Lagerplatz-Kacheln ---- */
.locgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
}
.locchip {
  background: var(--slate-50);
  border: 1px solid var(--card-line);
  border-radius: var(--r-input);
  padding: 9px 11px;
  min-width: 0;
}
.locchip.fresh {
  background: var(--brand-50);
  border-color: var(--brand-200);
}
.locchip .lc-code {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--slate-900);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.locchip .lc-meta { font-size: 11px; color: var(--slate-500); margin-top: 2px; }

/* ===================================================================
   LOGOUT-OVERLAY — Vollbild-Verabschiedung
   Reveal per Clip-Path von rechts oben (dort sitzt der Abmelden-Button).
=================================================================== */
.logout-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(135deg, #0a1e18 0%, #113028 28%, #1F6F5F 55%, #174439 78%, #04211B 100%);
  color: #fff;
}
.logout-overlay.show {
  display: flex;
  clip-path: circle(0% at calc(100% - 70px) 30px);
  animation: logoutReveal 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes logoutReveal {
  to { clip-path: circle(180% at calc(100% - 70px) 30px); }
}
.lo-glow {
  position: absolute;
  top: 18%; left: 22%;
  width: 560px; height: 560px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, rgba(52,211,153,0.14) 0%, transparent 70%);
  filter: blur(60px);
}
.lo-content {
  position: relative;
  animation: logoutContentIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
  padding: 0 22px;
}
@keyframes logoutContentIn {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.lo-card {
  text-align: center;
  padding: 46px 44px 40px;
  border-radius: 30px;
  max-width: 560px;
  background:
    radial-gradient(circle 460px at 30% 8%, rgba(52,211,153,0.06) 0%, transparent 60%),
    linear-gradient(180deg, rgba(28,42,38,0.52) 0%, rgba(14,24,22,0.72) 100%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  backdrop-filter: blur(28px) saturate(140%);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.07),
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 40px 100px -30px rgba(0,0,0,0.55);
}
.lo-wave {
  font-size: 60px;
  line-height: 1;
  margin-bottom: 18px;
  display: inline-block;
  transform-origin: 70% 70%;
  animation: logoutWave 1.7s ease-in-out 0.45s infinite;
}
@keyframes logoutWave {
  0%, 60%, 100% { transform: rotate(0); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
}
.lo-title {
  font-size: clamp(27px, 4.6vw, 42px);
  font-weight: 300;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: #fff;
}
.lo-title b { font-weight: 800; }
.lo-title .lo-comma { color: #6EE7B7; font-weight: 800; }
.lo-sub {
  margin-top: 18px;
  font-size: 11.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.52);
}
.lo-foot {
  position: absolute;
  bottom: 30px; left: 0; right: 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  pointer-events: none;
}
/* App darunter sanft wegblenden */
body.app-leaving .app {
  animation: appLeave 0.65s cubic-bezier(0.4, 0, 0.6, 1) forwards;
}
@keyframes appLeave {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.985); }
}
@media (prefers-reduced-motion: reduce) {
  .logout-overlay.show { animation: none; clip-path: none; }
  .lo-content, .lo-wave, body.app-leaving .app { animation: none; }
}

/* ===================================================================
   PASSWORT-MODAL, IDLE-WARNUNG, SHORTCUTS, DOPPELERFASSUNG
=================================================================== */

/* Avatar als Button (öffnet Passwort-Dialog) */
.avatar-btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  transition: box-shadow 0.15s var(--ease), transform 0.12s var(--ease);
}
.avatar-btn:hover { box-shadow: inset 0 0 0 1px rgba(110,231,183,0.55); transform: translateY(-1px); }
.avatar-btn:active { transform: translateY(0); }

/* Passwort-Stärke */
.pw-meter {
  height: 4px;
  background: var(--slate-100);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin: 8px 0 6px;
}
.pw-meter > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: var(--danger);
  transition: width 0.3s var(--ease), background 0.3s var(--ease);
}
.pw-meter > span.weak   { background: var(--danger); }
.pw-meter > span.medium { background: var(--warning); }
.pw-meter > span.strong { background: var(--success); }

/* Schmales Modal (Idle-Warnung) */
.modal-box-narrow { max-width: 380px; }
.idle-ico {
  width: 56px; height: 56px;
  margin: 0 auto;
  border-radius: 18px;
  background: var(--brand-50);
  color: var(--brand-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.idle-count {
  font-size: 30px;
  font-weight: 600;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
  margin: 14px 0 18px;
  letter-spacing: -0.02em;
}

/* Tastatur-Kürzel-Liste */
.sc-list { list-style: none; margin: 0; padding: 0; }
.sc-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--slate-100);
  font-size: 13.5px;
  color: var(--slate-700);
}
.sc-list li:last-child { border-bottom: none; }
.sc-list li span { margin-left: auto; color: var(--slate-500); font-size: 13px; }
kbd {
  display: inline-block;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  border-bottom-width: 2px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--slate-700);
  text-align: center;
  line-height: 1.5;
}

/* Doppelerfassungs-Warnung */
.dup-warn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: var(--r-input);
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #78350F;
  font-size: 13px;
  line-height: 1.5;
  animation: fadeSlideDown 0.28s var(--ease) both;
}
.dup-warn svg { flex: 0 0 auto; margin-top: 1px; color: #B45309; }
.dup-warn b { font-weight: 600; }
.dup-warn .dw-close {
  margin-left: auto;
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: #92400E;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0.6;
}
.dup-warn .dw-close:hover { opacity: 1; background: rgba(180,83,9,0.12); }

/* ===================================================================
   SIDEBAR-NAVIGATION (inTakt-Layout)
   Auf Desktop trägt die Sidebar die Hauptnavigation, die Topbar entfällt.
   Auf Mobile ist es umgekehrt: Topbar sichtbar, Sidebar als Drawer.
=================================================================== */

/* Markenkopf in der Sidebar */
.sb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 16px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-width: 0;
}
.sb-brand img {
  height: 32px;
  width: auto;
  flex: 0 0 auto;
  filter: brightness(0) invert(1);
}
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sb-brand-name {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.sb-brand-name .sep { color: #6EE7B7; }
.sb-brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scrollbereich zwischen Marke und Konto-Block */
.sb-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0 -4px;
  padding: 0 4px;
}
.sb-scroll::-webkit-scrollbar { width: 5px; }
.sb-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.14); border-radius: 3px; }
.sb-scroll::-webkit-scrollbar-track { background: transparent; }

/* Abschnitts-Überschrift */
.sb-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.34);
  padding: 0 10px;
  margin: 16px 0 6px;
}
.sb-section:first-of-type { margin-top: 4px; }

.sb-nav { display: flex; flex-direction: column; gap: 1px; }
.sb-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255,255,255,0.66);
  text-decoration: none;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
.sb-link svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: 0.85; }
.sb-link .sb-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
  text-decoration: none;
}
.sb-link.active {
  background: rgba(52,211,153,0.12);
  color: #fff;
  font-weight: 600;
}
.sb-link.active svg { color: #6EE7B7; opacity: 1; }
.sb-link.active::before {
  content: '';
  position: absolute;
  left: 0; top: 7px; bottom: 7px;
  width: 3px;
  border-radius: 0 99px 99px 0;
  background: #6EE7B7;
}
/* Gesperrt (Mitarbeiter ohne freigeschaltete Inventur) */
.sb-link.nav-disabled {
  color: rgba(255,255,255,0.28);
  cursor: not-allowed;
}
.sb-link.nav-disabled:hover { background: transparent; color: rgba(255,255,255,0.28); }
.sb-link.nav-disabled svg { opacity: 0.4; }

.sb-badge {
  flex: 0 0 auto;
  min-width: 19px;
  height: 18px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: #F59E0B;
  color: #451A03;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Konto-Block unten */
.sb-user {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 4px;
  margin-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
  min-width: 0;
}
.sb-user .avatar {
  background: rgba(52,211,153,0.18);
  box-shadow: inset 0 0 0 1px rgba(110,231,183,0.30);
  color: #A7F3D0;
}
.sb-user-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1 1 auto; }
.sb-user-name {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sb-logout {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border: none;
  border-radius: 10px;
  background: rgba(255,255,255,0.07);
  color: rgba(255,255,255,0.70);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.sb-logout svg { width: 16px; height: 16px; }
.sb-logout:hover { background: rgba(239,68,68,0.22); color: #FCA5A5; }

/* --- Desktop: Topbar weg, Sidebar über volle Höhe --- */
@media (min-width: 901px) {
  .topbar { display: none; }
  .app { grid-template-rows: 1fr; }
  .sidebar {
    top: 0;
    height: 100vh;
    max-height: 100vh;
    padding: 18px 12px 14px;
  }
  main.container { padding-top: 26px; }
}

/* --- Mobile: Topbar sichtbar, Marke in der Sidebar unnötig --- */
@media (max-width: 900px) {
  .sb-brand { display: none; }
  .topbar .user .avatar-btn { display: inline-flex; }
}

/* ===================================================================
   KONTEXTLEISTE — aktive Inventur über dem Inhalt
   Ersetzt die frühere Karte in der Sidebar. Sichtbar auf allen Ansichten,
   damit beim Erfassen klar bleibt, in welche Inventur gebucht wird.
=================================================================== */
.ctxbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  margin: -26px -24px 18px;
  background: rgba(255,255,255,0.92);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--slate-100);
  min-width: 0;
}
.cb-dot {
  width: 7px; height: 7px;
  border-radius: 99px;
  background: var(--success);
  flex: 0 0 auto;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.16);
}
.cb-dot.closed { background: var(--slate-400); box-shadow: 0 0 0 3px var(--slate-100); }
.cb-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-900);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  flex: 0 1 auto;
}
.ctxbar .tag { flex: 0 0 auto; }

.cb-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.cb-track {
  width: 90px;
  height: 5px;
  border-radius: var(--r-pill);
  background: var(--slate-100);
  overflow: hidden;
  display: inline-block;
}
.cb-fill {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand-500);
  transition: width 0.5s var(--ease-out), background 0.3s var(--ease);
}
.cb-fill.done { background: var(--success); }
.cb-pct {
  font-size: 12px;
  color: var(--slate-600);
  font-variant-numeric: tabular-nums;
  min-width: 34px;
}
.cb-meta {
  font-size: 12px;
  color: var(--slate-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  min-width: 0;
}
.cb-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}
.ctxbar .btn.small { height: 32px; font-size: 12.5px; padding: 0 12px; }

/* ⋯-Menü */
.cb-menu-wrap { position: relative; }
.cb-menu-btn {
  width: 32px; height: 32px;
  border: none;
  border-radius: 10px;
  background: var(--slate-100);
  color: var(--slate-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.cb-menu-btn svg { width: 17px; height: 17px; }
.cb-menu-btn:hover { background: var(--slate-200); color: var(--slate-900); }
.cb-menu-btn[aria-expanded="true"] { background: var(--slate-200); color: var(--slate-900); }

.cb-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 216px;
  padding: 6px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--slate-100);
  box-shadow: var(--shadow-pop);
  display: none;
  flex-direction: column;
  gap: 1px;
  z-index: 60;
}
.cb-menu.open { display: flex; animation: cbMenuIn 0.16s var(--ease-out) both; }
@keyframes cbMenuIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cb-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--slate-700);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.cb-item svg { width: 16px; height: 16px; flex: 0 0 auto; opacity: 0.75; }
.cb-item:hover { background: var(--slate-50); color: var(--slate-900); text-decoration: none; }
.cb-item.danger { color: #B91C1C; }
.cb-item.danger:hover { background: #FEF2F2; color: #991B1B; }
.cb-sep { height: 1px; background: var(--slate-100); margin: 5px 2px; }

@media (max-width: 900px) {
  .ctxbar {
    margin: -20px -16px 14px;
    padding: 9px 14px;
    gap: 9px;
    flex-wrap: wrap;
  }
  .cb-meta { display: none; }
  .cb-name { max-width: 150px; font-size: 13px; }
  .cb-track { width: 60px; }
  .ctxbar .btn.small { padding: 0 10px; }
  /* KI-Button auf schmalen Schirmen nur als Symbol */
  .ctxbar .ai-btn { font-size: 0; padding: 0 10px; }
  .ctxbar .ai-btn::before { content: '✨'; font-size: 14px; }
}

/* ===================================================================
   ZÄHL-ZONEN
=================================================================== */
.zone-form {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr auto;
  gap: 14px;
  align-items: start;
}
.zone-form > button { margin-top: 22px; }
.zone-form .notice { grid-column: 1 / -1; margin-top: 0; }
@media (max-width: 820px) {
  .zone-form { grid-template-columns: 1fr; }
  .zone-form > button { margin-top: 4px; width: 100%; }
}

.zones-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.zone-card {
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.2s var(--ease);
}
.zone-card:hover { box-shadow: var(--shadow-lift); }
.zone-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.zone-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--slate-900);
  text-transform: none;
  letter-spacing: -0.01em;
  flex: 1 1 auto;
  min-width: 0;
}
.zone-del {
  flex: 0 0 auto;
  width: 28px; height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--slate-400);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.zone-del:hover { background: #FEF2F2; color: #B91C1C; }

.zone-pats { display: flex; flex-wrap: wrap; gap: 5px; }
.zone-pat {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--brand-50);
  color: var(--brand-800);
}
.zone-stats {
  display: flex;
  gap: 16px;
  font-size: 12.5px;
  color: var(--slate-600);
  padding-top: 2px;
}
.zone-stats b { font-weight: 600; color: var(--slate-900); }

.zone-members { border-top: 1px solid var(--slate-100); padding-top: 10px; }
.zone-members-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--slate-400);
  margin-bottom: 7px;
}
.zone-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.zone-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  border-radius: var(--r-pill);
  background: var(--slate-100);
  font-size: 12px;
  color: var(--slate-700);
  cursor: pointer;
  user-select: none;
  border: 1px solid transparent;
  transition: background 0.14s var(--ease), border-color 0.14s var(--ease), color 0.14s var(--ease);
}
.zone-chip .zc-ini {
  width: 20px; height: 20px;
  border-radius: 99px;
  background: var(--slate-200);
  color: var(--slate-600);
  font-size: 9.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.zone-chip:hover { background: var(--slate-200); }
.zone-chip.on {
  background: var(--brand-50);
  border-color: var(--brand-200);
  color: var(--brand-800);
  font-weight: 500;
}
.zone-chip.on .zc-ini { background: var(--brand-600); color: #fff; }

/* Mitarbeiter-Dashboard: mein Bereich */
.myzone-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--slate-100);
}
.myzone-row:last-child { border-bottom: none; }
.myzone-row:first-child { padding-top: 2px; }
.mz-main { flex: 1 1 auto; min-width: 0; }
.mz-name { font-size: 14px; font-weight: 500; color: var(--slate-900); }
.mz-pats { font-size: 11.5px; color: var(--slate-500); margin-top: 2px; }
.mz-num {
  text-align: right;
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.mz-num b { font-size: 18px; font-weight: 600; color: var(--brand-700); display: block; line-height: 1.2; }
.mz-num span { font-size: 11px; color: var(--slate-500); }

/* Warnung: Lagerplatz außerhalb der eigenen Zone */
.zone-warn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: var(--r-input);
  background: #E0F2FE;
  border: 1px solid #7DD3FC;
  color: #075985;
  font-size: 13px;
  line-height: 1.5;
  animation: fadeSlideDown 0.28s var(--ease) both;
}
.zone-warn svg { flex: 0 0 auto; margin-top: 1px; color: #0284C7; }
.zone-warn b { font-weight: 600; }
.zone-warn .zw-close {
  margin-left: auto;
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: #075985;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 6px;
  opacity: 0.6;
}
.zone-warn .zw-close:hover { opacity: 1; background: rgba(2,132,199,0.12); }

/* ===================================================================
   ZULETZT ERFASST (Erfassen-Bereich)
   Kompakte Zeilen — beim Zählen zählt Übersicht, nicht Detailtiefe.
=================================================================== */
.recent-scans { list-style: none; margin: 0; padding: 0; }
.rs-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--slate-100);
  animation: fadeSlideDown 0.25s var(--ease) both;
}
.rs-item:last-child { border-bottom: none; }

.rs-loc {
  flex: 0 0 auto;
  min-width: 74px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--brand-50);
  color: var(--brand-800);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-loc-none { background: var(--slate-100); color: var(--slate-400); }

.rs-main { flex: 1 1 auto; min-width: 0; }
.rs-name {
  display: block;
  font-size: 13.5px;
  color: var(--slate-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-meta { display: block; font-size: 11.5px; color: var(--slate-500); margin-top: 1px; }
.rs-who { color: var(--slate-600); }
.rs-corr {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: #FEF3C7;
  color: #92400E;
  font-size: 9.5px;
  font-weight: 600;
  vertical-align: 1px;
}
.rs-qty {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rs-del {
  flex: 0 0 auto;
  width: 26px; height: 26px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--slate-300);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.rs-item:hover .rs-del { color: var(--slate-500); }
.rs-del:hover { background: #FEF2F2; color: #B91C1C; }

@media (max-width: 640px) {
  .rs-loc { min-width: 60px; font-size: 10.5px; padding: 3px 6px; }
  .rs-qty { font-size: 13px; }
  .rs-del { opacity: 1; color: var(--slate-400); }
}

/* ===================================================================
   AUSWERTUNGS-KARTE MIT REITERN (Tempo / Warengruppen / Lagerplätze)
=================================================================== */
.insight-card { padding-top: 8px; }
.insight-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--slate-100);
  margin: 0 -22px 16px;
  padding: 0 22px;
}
.itab {
  position: relative;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--slate-500);
  padding: 10px 12px 12px;
  cursor: pointer;
  transition: color 0.15s var(--ease);
  white-space: nowrap;
}
.itab:hover { color: var(--slate-800); }
.itab.active { color: var(--brand-700); font-weight: 600; }
.itab.active::after {
  content: '';
  position: absolute;
  left: 8px; right: 8px; bottom: -1px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--brand-600);
}
.itab:focus-visible { outline: 2px solid var(--brand-500); outline-offset: -2px; border-radius: 6px; }
.itab-meta { margin-left: auto; padding-left: 10px; white-space: nowrap; }

.itab-panel { display: none; }
.itab-panel.active { display: block; animation: fadeSlideDown 0.2s var(--ease) both; }

@media (max-width: 640px) {
  .insight-tabs { margin: 0 -18px 14px; padding: 0 12px; overflow-x: auto; }
  .insight-tabs::-webkit-scrollbar { display: none; }
  .itab { font-size: 13px; padding: 9px 10px 11px; }
  .itab-meta { display: none; }
}

/* ===================================================================
   PREMIUM-DASHBOARD: Begrüßung + KPI-Reihe
   Alles auf 8-px-Raster, weiche Schatten, keine harten Kanten.
=================================================================== */
.dash-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.dh-greet h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--slate-900);
  line-height: 1.15;
}
.dh-wave { display: inline-block; animation: dhWave 2.6s ease-in-out 1s infinite; transform-origin: 70% 70%; }
@keyframes dhWave {
  0%, 60%, 100% { transform: rotate(0); }
  10% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); }
  30% { transform: rotate(14deg); } 40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
}
.dh-sub { margin: 6px 0 0; font-size: 14px; color: var(--slate-500); }

/* --- KPI-Reihe --- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(184px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--card-line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-card);
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  transition: box-shadow 0.24s var(--ease), transform 0.24s var(--ease), border-color 0.24s var(--ease);
}
.kpi:hover { box-shadow: var(--shadow-lift); transform: translateY(-2px); }
/* Die Fortschritts-Karte darf breiter sein */
.kpi.ktall { grid-column: span 2; }
@media (max-width: 780px) { .kpi.ktall { grid-column: span 2; } }
@media (max-width: 520px) { .kpi.ktall { grid-column: 1 / -1; } }

.kpi-click { cursor: pointer; }
.kpi-click:hover { border-color: var(--brand-200); }
.kpi-click:active { transform: translateY(0); }

.kpi-top { display: flex; align-items: center; gap: 9px; min-width: 0; }
.kpi-ico {
  width: 32px; height: 32px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.kpi-ico svg { width: 16px; height: 16px; }
.ico-brand { background: var(--brand-50);  color: var(--brand-700); }
.ico-blue  { background: #E0F2FE;          color: #0369A1; }
.ico-amber { background: #FEF3C7;          color: #B45309; }
.ico-green { background: #DCFCE7;          color: #15803D; }
.ico-red   { background: #FEE2E2;          color: #B91C1C; }
.ico-slate { background: var(--slate-100); color: var(--slate-600); }

.kpi-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kpi-num {
  font-size: 32px;
  font-weight: 600;
  color: var(--slate-900);
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.kpi-foot { margin-top: -2px; }
.kpi-trend { font-size: 12.5px; color: var(--slate-500); }
.kpi-trend.up   { color: #15803D; font-weight: 500; }
.kpi-trend.down { color: #B91C1C; font-weight: 500; }

.kpi-bar {
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--slate-100);
  overflow: hidden;
  margin-top: auto;
}
.kpi-bar > span {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--brand-500);
  transition: width 0.7s var(--ease-out);
}
.kpi-bar > span.amber { background: var(--warning); }

/* Fortschritts-Karte mit Ring */
.kpi-ringwrap {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.kpi-ring { width: 104px; height: 104px; flex: 0 0 auto; }
.kpi-ringside { min-width: 0; }
.krs-count {
  font-size: 30px;
  font-weight: 600;
  color: var(--slate-900);
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.krs-of { font-size: 18px; font-weight: 500; color: var(--slate-400); letter-spacing: 0; }
.krs-label { font-size: 12.5px; color: var(--slate-500); margin-top: 3px; }
.krs-eta {
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-700);
  margin-top: 12px;
  letter-spacing: -0.01em;
}
.krs-eta-sub { font-size: 11.5px; margin-top: 1px; }

/* Team-Avatare in der KPI-Karte */
.kpi-avatars { display: flex; margin-top: auto; padding-top: 2px; }
.kpi-avatars .ka {
  width: 26px; height: 26px;
  border-radius: 9px;
  background: var(--brand-100);
  color: var(--brand-800);
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px #fff;
  margin-right: -6px;
}
.kpi-avatars .ka.live { background: var(--brand-gradient); color: #fff; }
.kpi-avatars .ka.more { background: var(--slate-100); color: var(--slate-500); }

@media (max-width: 640px) {
  .dh-greet h1 { font-size: 23px; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 12px; }
  .kpi { padding: 15px 16px 16px; border-radius: 20px; }
  .kpi-num { font-size: 26px; }
  .kpi-ring { width: 84px; height: 84px; }
  .krs-count { font-size: 24px; }
}

/* Klickbare Kennzahlen — dezent, erst beim Hover erkennbar */
.tm-click, .lc-click { cursor: pointer; }
.tm-click { border-radius: 12px; padding: 4px 8px; margin: -4px -8px; transition: background 0.15s var(--ease); }
.tm-click:hover { background: var(--slate-50); }
.lc-click { transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.lc-click:hover {
  border-color: var(--brand-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

/* Karten und Modals folgen dem größeren Radius mit */
.modal-box { border-radius: 24px; }
.cb-menu { border-radius: 18px; }
.ai-insight { border-radius: var(--r-card); }

/* ===================================================================
   LIVE-FEED — vertikale Buchungsliste
   Neue Buchungen erscheinen oben. Jede Zeile beantwortet: wann, wer,
   was, wo, wie viel — in dieser Reihenfolge lesbar.
=================================================================== */
.live-feed { padding-bottom: 8px; }
.lt-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 4px 10px 4px 8px;
  border-radius: var(--r-pill);
  background: #DCFCE7;
  color: #166534;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.lt-dot {
  width: 7px; height: 7px;
  border-radius: 99px;
  background: #22C55E;
  animation: ltPulse 2s infinite;
}
@keyframes ltPulse {
  0%   { box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.live-feed.offline .lt-badge { background: var(--slate-100); color: var(--slate-500); }
.live-feed.offline .lt-dot { background: var(--slate-400); animation: none; }

.lf-list { list-style: none; margin: 0; padding: 0; }
.lf-item {
  display: grid;
  grid-template-columns: 68px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 2px;
  border-bottom: 1px solid var(--slate-100);
  animation: lfIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.lf-item:last-child { border-bottom: none; }
@keyframes lfIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lf-item.fresh {
  background: linear-gradient(90deg, var(--brand-50) 0%, transparent 70%);
  border-radius: 10px;
  margin: 0 -8px;
  padding-left: 10px;
  padding-right: 10px;
}

.lf-time {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.lf-item.fresh .lf-time { color: var(--brand-700); font-weight: 500; }

.lf-body { min-width: 0; }
.lf-line1 { display: flex; align-items: center; gap: 7px; min-width: 0; }
.lf-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--slate-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lf-corr {
  flex: 0 0 auto;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: #FEF3C7;
  color: #92400E;
  font-size: 9.5px;
  font-weight: 600;
}
.lf-line2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
}
.lf-who {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--slate-600);
}
.lf-ini {
  width: 17px; height: 17px;
  border-radius: 5px;
  background: var(--brand-100);
  color: var(--brand-800);
  font-size: 8.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.lf-item.fresh .lf-ini { background: var(--brand-gradient); color: #fff; }
.lf-loc {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--brand-800);
  background: var(--brand-50);
  padding: 2px 7px;
  border-radius: 6px;
}
.lf-loc-none { background: var(--slate-100); color: var(--slate-400); font-family: inherit; }
.lf-sku {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--slate-400);
}

.lf-qtybox { text-align: right; white-space: nowrap; }
.lf-qty {
  font-size: 15px;
  font-weight: 600;
  color: var(--slate-900);
  font-variant-numeric: tabular-nums;
}
.lf-qty.zero { color: var(--slate-400); }
.lf-unit { font-size: 11px; font-weight: 500; color: var(--slate-400); margin-left: 3px; }
.lf-formula {
  display: block;
  font-size: 10.5px;
  color: var(--slate-400);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.lt-empty { font-size: 12.5px; color: var(--slate-400); padding: 14px 2px; display: block; }

@media (max-width: 640px) {
  .lf-item { grid-template-columns: 56px 1fr auto; gap: 9px; }
  .lf-time { font-size: 11px; }
  .lf-name { font-size: 13px; }
  .lf-sku { display: none; }
  .lf-qty { font-size: 14px; }
  .lf-formula { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .lt-dot, .lf-item { animation: none; }
}

/* Klickbare Kennzahlen — dezent, erst beim Hover erkennbar */
.tm-click, .lc-click { cursor: pointer; }
.tm-click { border-radius: 12px; padding: 4px 8px; margin: -4px -8px; transition: background 0.15s var(--ease); }
.tm-click:hover { background: var(--slate-50); }
.lc-click { transition: border-color 0.15s var(--ease), transform 0.15s var(--ease), box-shadow 0.15s var(--ease); }
.lc-click:hover {
  border-color: var(--brand-300);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

/* Karten und Modals folgen dem größeren Radius mit */
.modal-box { border-radius: 24px; }
.cb-menu { border-radius: 18px; }
.ai-insight { border-radius: var(--r-card); }

/* Einheit in KPI-Zahlen (z. B. "3:59 Std") dezent kleiner */
.kpi-num small {
  font-size: 15px;
  font-weight: 500;
  color: var(--slate-400);
  letter-spacing: 0;
}

/* Status der Offline-Warteschlange */
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  background: var(--slate-100);
  color: var(--slate-600);
  vertical-align: middle;
  margin-left: 10px;
}
.sync-badge.warn { background: #FEF3C7; color: #92400E; }
.sync-badge.busy { background: #E0F2FE; color: #075985; }
.sync-badge.busy::before,
.sync-badge.warn::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 99px;
  background: currentColor;
  opacity: 0.75;
}
.sync-badge.busy::before { animation: ltPulse 1.4s infinite; }
