* { box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f4f6f8;
  /*background: #343a40;*/
  margin: 0;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
  padding: 24px;
  width: 100%;
  max-width: 480px;
}

.card.table-card { max-width: 900px; margin-top: 16px; }

.table-card h2 { font-size: 18px; margin: 0 0 12px; }

#savedTable { width: 100% !important; font-size: 14px; }

.btn-del {
  width: auto; padding: 4px 10px; font-size: 13px; background: #e53935;
}

.btn-del:hover { background: #c62828; }

.dt-buttons .dt-button {
  width: auto; background: #27ae60 !important; color: #fff !important; border: none; border-radius: 6px;
}

.dataTables_wrapper .dataTables_filter input { width: auto; padding: 6px 10px; font-size: 14px; }

.dataTables_wrapper .dataTables_paginate .paginate_button { padding: 4px 10px; }

body { flex-direction: column; align-items: center; }

h1 { font-size: 20px; margin: 0 0 20px; text-align: center; }

label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }

input {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #cfd6dd;
  border-radius: 8px;
  outline: none;
}

input:focus { border-color: #2f80ed; box-shadow: 0 0 0 3px rgba(47,128,237,.15); }

input.invalid { border-color: #e53935; }

.field { margin-bottom: 18px; }

.hint { font-size: 12px; color: #667; margin-top: 4px; min-height: 16px; }

.hint.error { color: #e53935; }

.barcode-preview {
  display: flex;
  justify-content: center;
  margin-top: 10px;
  min-height: 60px;
}

.barcode-preview svg { max-width: 100%; }

button {
  width: 100%;
  padding: 13px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: #2f80ed;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

button:hover { background: #1f6fd8; }

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

.input-row input { flex: 1; }

.btn-scan {
  width: auto;
  padding: 0 14px;
  white-space: nowrap;
  background: #27ae60;
}

.btn-scan:hover { background: #219a52; }

.btn-scan.active { background: #e53935; }

#reader {
  display: none;
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
}

#reader.show { display: block; }

.cam-controls {
  display: none; gap: 10px; align-items: center; margin-top: 8px;
}

.cam-controls.show { display: flex; }
.cam-controls button { width: auto; padding: 8px 12px; font-size: 14px; background: #555; }
.cam-controls button.on { background: #f39c12; }
.cam-controls .zoom { flex: 1; display: none; align-items: center; gap: 6px; font-size: 13px; }
.cam-controls .zoom.show { display: flex; }
.cam-controls input[type=range] { flex: 1; padding: 0; border: none; }
#reader video { width: 100% !important; }
.ocr-cam { display: none; margin-top: 10px; }
.ocr-cam.show { display: block; }
.ocr-cam video { width: 100%; border-radius: 8px; background: #000; display: block; }
.ocr-cam-actions { display: flex; gap: 8px; margin-top: 8px; }
.ocr-cam-actions button { flex: 1; padding: 10px; font-size: 15px; }
.ocr-cam-actions button.secondary { background: #777; }
.ocr-lines { display: none; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ocr-lines.show { display: flex; }
.ocr-lines button {
  width: auto; padding: 6px 10px; font-size: 13px; font-weight: 500;
  background: #eef3f8; color: #223; border: 1px solid #cfd6dd;
}

.ocr-lines button:hover { background: #dde7f1; }

.result {
  margin-top: 16px;
  padding: 12px;
  background: #f0f7ff;
  border-radius: 8px;
  font-size: 14px;
  display: none;
  white-space: pre-line;
}