* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f2f4f7;
  color: #111827;
  transition: background-color 0.3s ease;
}

body.scan-success {
  background: #16a34a;
}

body.scan-error {
  background: #dc2626;
}

.app {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.header {
  margin-bottom: 14px;
}

.header h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.counter {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.counter-value {
  display: block;
  font-size: 32px;
  font-weight: 800;
  line-height: 1.1;
  color: #111827;
}

.counter-label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #4b5563;
}

.status {
  border-radius: 18px;
  padding: 24px 18px;
  margin-bottom: 14px;
  text-align: center;
  border: 2px solid transparent;
  background: white;
}

.status #statusTitle {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 8px;
}

.status #statusText {
  font-size: 18px;
  word-break: break-word;
}

.status.success {
  background: #dcfce7;
  border-color: #16a34a;
  color: #14532d;
}

.status.warning {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #78350f;
}

.status.error {
  background: #fee2e2;
  border-color: #dc2626;
  color: #7f1d1d;
}

.status.neutral {
  background: #ffffff;
  border-color: #d1d5db;
}

.scanner-wrap {
  background: white;
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 14px;
  overflow: hidden;
}

#reader {
  width: 100%;
  min-height: 280px;
}

.manual {
  background: white;
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 14px;
}

.manual label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

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

.manual-row input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  font-size: 16px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 13px 12px;
  font-size: 16px;
  font-weight: 700;
  background: #2563eb;
  color: white;
  cursor: pointer;
}

button.secondary {
  background: #374151;
}

button.danger {
  background: #dc2626;
}

.log {
  background: white;
  border-radius: 18px;
  padding: 14px;
}

.log h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.log-item {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid #e5e7eb;
  align-items: center;
}

.log-item span {
  word-break: break-word;
}

.log-item em {
  color: #6b7280;
  font-style: normal;
  font-size: 13px;
}

.empty {
  color: #6b7280;
  padding: 8px 0;
}

@media (max-width: 480px) {
  .app {
    padding: 12px;
  }

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

  .counter-value {
    font-size: 28px;
  }

  .status #statusTitle {
    font-size: 24px;
  }

  .manual-row,
  .actions {
    grid-template-columns: 1fr;
  }

  .manual-row {
    display: block;
  }

  .manual-row input {
    width: 100%;
    margin-bottom: 8px;
  }

  .manual-row button {
    width: 100%;
  }

  .log-item {
    grid-template-columns: 1fr;
  }
}
