:root {
  --color-primary: #1a5f7a;
  --color-primary-dark: #114055;
  --color-accent: #ff8c42;
  --color-bg: #f4f6f7;
  --color-surface: #ffffff;
  --color-border: #dfe4e6;
  --color-text: #1f2a30;
  --color-text-muted: #6b7c82;
  --color-success: #2e8b57;
  --color-danger: #c0392b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--color-primary);
  color: #fff;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
}

.topbar h1 {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
  white-space: nowrap;
}

.topbar .user {
  font-size: 13px;
  opacity: 0.85;
}

@media (max-width: 420px) {
  .topbar .user { display: none; }
}

.btn-icon {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 20px;
  padding: 4px 8px;
  cursor: pointer;
}

.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 100px;
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 16px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
}

.field input:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.scan-row {
  display: flex;
  gap: 8px;
}

.scan-row input { flex: 1; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  min-height: 46px;
}

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:active { background: var(--color-primary-dark); }
.btn-accent { background: var(--color-accent); color: #fff; }
.btn-secondary { background: #eef1f2; color: var(--color-text); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-scan {
  background: var(--color-primary);
  color: #fff;
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  font-size: 22px;
  flex-shrink: 0;
}

.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.result-item {
  padding: 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  cursor: pointer;
  background: #fff;
}

.result-item:active { background: #f0f3f4; }

.result-item .nr {
  font-size: 12px;
  color: var(--color-text-muted);
}

.result-item .bez {
  font-size: 15px;
  font-weight: 600;
}

.artikel-detail .nr { color: var(--color-text-muted); font-size: 13px; }
.artikel-detail .bez { font-size: 18px; font-weight: 700; margin: 2px 0 14px; }

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: #eef4f6;
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.stat-box .label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.stat-box .value {
  font-size: 22px;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-box.erfasst .value { color: var(--color-success); }
.stat-box.leer .value { color: var(--color-text-muted); font-size: 15px; font-weight: 500; }

.count-input {
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  padding: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--color-text);
  color: #fff;
  padding: 10px 18px;
  border-radius: 30px;
  font-size: 14px;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}

.toast.show { opacity: 1; }
.toast.success { background: var(--color-success); }
.toast.error { background: var(--color-danger); }

.empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 40px 16px;
}

.hidden { display: none !important; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 380px;
}

.login-card h1 {
  text-align: center;
  color: var(--color-primary);
  margin-bottom: 4px;
}

.login-card .sub {
  text-align: center;
  color: var(--color-text-muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.error-msg {
  color: var(--color-danger);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

#video-scanner {
  width: 100%;
  border-radius: var(--radius);
  background: #000;
  margin-bottom: 10px;
}

.scanner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
}

.install-btn {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.4);
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 20px;
}

.status-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 4px 9px;
  border-radius: 20px;
  background: rgba(255,255,255,0.15);
}

.status-badge.online { background: rgba(46, 139, 87, 0.35); }
.status-badge.offline { background: rgba(192, 57, 43, 0.55); }

.pending-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--color-accent);
  color: #fff;
  white-space: nowrap;
}

.cache-info {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  margin: -6px 0 10px;
}

.offline-note {
  font-size: 12px;
  color: var(--color-text-muted);
  text-align: center;
  padding: 8px 0;
}

.offline-hint {
  font-size: 12px;
  color: #7a4a00;
  background: #fff3e0;
  border: 1px solid #ffd9a0;
  border-radius: var(--radius);
  padding: 8px 10px;
  margin-bottom: 12px;
}

.offen-count {
  display: inline-block;
  margin-left: 8px;
  background: var(--color-accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
}

.gruppe-filter {
  width: 100%;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--color-text);
}
