* { box-sizing: border-box; }
body {
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  color: #1a1a1a;
  background: #fafafa;
}
.container { max-width: 900px; margin: 0 auto; padding: 16px; }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: #1f2937; color: white; flex-wrap: wrap;
}
.topbar .brand { color: white; font-weight: bold; text-decoration: none; }
.topbar nav { display: flex; gap: 12px; flex-wrap: wrap; }
.topbar nav a, .topbar .user-menu a { color: #d1d5db; text-decoration: none; }
.topbar nav a:hover { color: white; }
.user-menu { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 0.9em; }

.page-header { display: flex; justify-content: space-between; align-items: center; }

.button, button {
  background: #2563eb; color: white; border: none; padding: 8px 14px;
  border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block;
  font-size: 0.95em;
}
.button-danger, button.button-danger { background: #dc2626; }

.flashes { list-style: none; padding: 0; }
.flash { padding: 8px 12px; border-radius: 6px; margin-bottom: 8px; }
.flash-success { background: #dcfce7; color: #166534; }
.flash-error { background: #fee2e2; color: #991b1b; }
.flash-info { background: #dbeafe; color: #1e40af; }

.tiles { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.tile {
  background: white; border-radius: 8px; padding: 16px; min-width: 200px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.tile-label { display: block; color: #6b7280; font-size: 0.85em; }
.tile-number { display: block; font-size: 1.8em; font-weight: bold; }
.tile-hint { display: block; color: #b45309; font-size: 0.8em; }
.tile-warning .tile-number { color: #b45309; }

.table { width: 100%; border-collapse: collapse; margin: 12px 0; background: white; }
.table th, .table td { padding: 8px; border-bottom: 1px solid #e5e7eb; text-align: left; }

.item-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.item-card {
  background: white; border-radius: 8px; padding: 10px; text-decoration: none; color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1); display: flex; flex-direction: column; gap: 6px;
}
.item-thumb { width: 100%; height: 120px; object-fit: cover; border-radius: 6px; background: #eee; }
.item-thumb-placeholder { display: flex; align-items: center; justify-content: center; font-size: 2em; }
.badge { display: inline-block; background: #e5e7eb; border-radius: 4px; padding: 2px 8px; font-size: 0.8em; }
.badge-low { background: #fee2e2; color: #991b1b; }
.badge-archived { background: #f3f4f6; color: #6b7280; }
.qty-low { color: #dc2626; font-weight: bold; }
.price { color: #166534; font-weight: bold; }

.filter-bar { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }

.item-form label, .inline-form label { display: block; margin-bottom: 10px; }
.item-form input, .item-form select, .item-form textarea,
.inline-form input, .inline-form select { width: 100%; padding: 6px; margin-top: 4px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; margin: 10px 0; }
.inline-form input, .inline-form select { width: auto; }

.detail-grid { display: flex; gap: 24px; flex-wrap: wrap; }
.detail-main { flex: 2; min-width: 300px; }
.detail-side { flex: 1; min-width: 200px; }
.qr-image { width: 200px; height: 200px; }

.tx-form { background: white; padding: 12px; border-radius: 8px; margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }

.image-gallery { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.image-gallery img { width: 100px; height: 100px; object-fit: cover; border-radius: 6px; cursor: zoom-in; }

.lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.lightbox.hidden { display: none; }
.lightbox img { max-width: 90%; max-height: 90%; }

.assignment-list { list-style: none; padding: 0; }
.assignment-list li { background: white; padding: 8px; margin-bottom: 4px; border-radius: 6px; }

.login-box { max-width: 320px; margin: 60px auto; }
.login-box label { display: block; margin-bottom: 10px; }
.login-box input { width: 100%; padding: 8px; margin-top: 4px; }

.hint { color: #6b7280; font-size: 0.9em; }

.catalog-search { margin: 10px 0; }
.catalog-search-input { width: 100%; padding: 6px; }
.catalog-result {
  display: flex; justify-content: space-between; align-items: center;
  background: white; padding: 8px; border-radius: 6px; margin-top: 6px; gap: 8px;
}
.catalog-result form { margin: 0; }

/* --- Scanner ------------------------------------------------------- */
/* Das Videobild bleibt auch ohne laufenden Stream stehen, damit die
   Seite beim Starten der Kamera nicht springt. */
.scanner { margin: 12px 0; }
.scanner-video {
  width: 100%; max-width: 480px; aspect-ratio: 4 / 3;
  background: #111; border-radius: 8px; object-fit: cover; display: block;
}
.scanner-status { margin: 8px 0; min-height: 1.2em; font-size: 0.95em; }
.scanner-status-error { color: #b91c1c; }
.scanner-status-ok { color: #15803d; }

.catalog-suggestion {
  background: white; padding: 12px; border-radius: 8px;
  margin-top: 16px; border-left: 4px solid #2563eb;
}

/* --- Bestand je Ort ------------------------------------------------ */
.stock-table { margin: 8px 0 16px; max-width: 420px; }
.stock-table td, .stock-table th { padding: 6px 10px; }

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Auf dem Handy sollen Bedienelemente gross genug fuer Handschuhe sein. */
@media (max-width: 640px) {
  .tx-form button, .button { min-height: 44px; }
  .tx-form input, .tx-form select { min-height: 40px; font-size: 16px; }
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
