*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #16213e;
  color: #fff;
  padding: 1.25rem 1rem;
  text-align: center;
}

header h1 {
  font-size: 1.6rem;
}

header .subtitle {
  font-size: 0.9rem;
  color: #a0aec0;
  margin-top: 0.25rem;
}

.status-bar {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.status-badge {
  font-size: 0.78rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  color: #a0aec0;
  letter-spacing: 0.01em;
}

.status-badge.ok {
  background: rgba(56, 161, 105, 0.25);
  color: #9ae6b4;
}

.status-badge.error {
  background: rgba(229, 62, 62, 0.25);
  color: #feb2b2;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: #fff;
  border-radius: 0.75rem;
  padding: 1.25rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: #16213e;
}

.placeholder {
  color: #718096;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 0.5rem;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary {
  background: #3182ce;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #2b6cb0;
}

.btn:disabled {
  background: #cbd5e0;
  color: #a0aec0;
  cursor: not-allowed;
}

footer {
  text-align: center;
  padding: 0.75rem;
  font-size: 0.8rem;
  color: #718096;
}

.manual-input {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.manual-input input {
  flex: 1;
  padding: 0.45rem 0.6rem;
  border: 1px solid #cbd5e0;
  border-radius: 0.4rem;
  font-size: 1rem;
}

.manual-input input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 2px rgba(49,130,206,0.2);
}

/* Scanner */
#reader {
  width: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

/* html5-qrcode erzeugt inline border – überschreiben */
#reader video {
  border-radius: 0.5rem;
}

.scanner-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.scan-hint {
  font-size: 0.85rem;
  color: #718096;
}

.btn-danger {
  background: #e53e3e;
  color: #fff;
}

.btn-danger:hover {
  background: #c53030;
}

.btn-secondary {
  background: #e2e8f0;
  color: #2d3748;
}

.btn-secondary:hover {
  background: #cbd5e0;
}

/* Speicher-Formular */
.inventory-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.inventory-form label {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: #4a5568;
  gap: 0.2rem;
}

.inventory-form input {
  padding: 0.45rem 0.6rem;
  border: 1px solid #cbd5e0;
  border-radius: 0.4rem;
  font-size: 1rem;
  width: 100%;
}

.inventory-form input:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 2px rgba(49,130,206,0.2);
}

.result-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.form-divider {
  border: none;
  border-top: 1px solid #e2e8f0;
  margin: 0.25rem 0;
}

.input-readonly {
  background: #f7fafc !important;
  color: #718096 !important;
}

.label-optional {
  font-size: 0.73rem;
  color: #a0aec0;
  font-weight: normal;
  margin-left: 0.25rem;
}

.inv-expiry {
  font-size: 0.78rem;
  color: #e67e22;
}

/* Bestandsliste */
.inv-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #e2e8f0;
}

.inv-row:last-child {
  border-bottom: none;
}

.inv-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.inv-name {
  font-weight: 600;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inv-brand, .inv-location, .inv-note {
  font-size: 0.78rem;
  color: #718096;
}

.inv-qty {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.qty-btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid #cbd5e0;
  border-radius: 0.4rem;
  background: #f7fafc;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.qty-btn:hover {
  background: #e2e8f0;
}

.qty-value {
  min-width: 1.5rem;
  text-align: center;
  font-weight: 600;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: #a0aec0;
  flex-shrink: 0;
  padding: 0.2rem;
}

.btn-icon:hover {
  color: #e53e3e;
}

/* Artikel-Ergebnis */
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.result-table tr:not(:last-child) td {
  border-bottom: 1px solid #e2e8f0;
}

.result-table td {
  padding: 0.4rem 0.25rem;
}

.result-table td:first-child {
  color: #718096;
  width: 40%;
}

.result-source {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: #ebf4ff;
  color: #3182ce;
}

.result-source.local {
  background: #f0fff4;
  color: #38a169;
}
