* { box-sizing: border-box; outline: none; }
body {
  margin: 4px 4px 98px 4px;
  padding: 0;
  font-size: 12pt;
  font-family: Arial, Helvetica, sans-serif;
  background: #fff;
  transition: margin-right 0.3s ease;
}
body.menu-open {
  margin-right: 280px;
}
body.scanner-open,
body.entry-gate-open,
body.missing-warning-open { overflow: hidden; }
.title {
  margin: 0.2em 0 0 0;
  font-weight: bold;
  text-shadow: 0 -1px rgba(0,0,0,.6);
  font-size: 14pt;
  line-height: 32px;
  background: #115f97;
  padding: 5px 15px 5px 36px;
  color: #fff;
  border-radius: 10px 10px 0 0;
  box-shadow: inset 0 0 5px rgba(53,86,129,.5);
}
.memo {
  font-size: 12pt;
  font-weight: bold;
  border: solid 1px silver;
  background-color: #eee;
  padding: 10px;
  word-wrap: break-word;
  white-space: pre-line;
  overflow: hidden;
  min-height: 40px;
  margin-bottom: 10px;
  border-radius: 0 0 10px 10px;
}
.selected { background-color: yellow; font-weight: bold; }
.gs { color: red; font-weight: bold; }
.rs { color: green; font-weight: bold; }
.eot { color: blue; font-weight: bold; }
.gray { color: silver; font-weight: bold; }
table { width: 100%; border-collapse: collapse; }
table, th, td { border: solid 1px silver; }
th { background-color: #eee; padding: 8px; }
td { word-break: break-all; white-space: pre-line; }
.ct { text-align: center; }
.bottomArea {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 0;
  text-align: center;
  background: #d9edf5;
  border-top: solid 4px #24A7D3;
  z-index: 20;
}
.tabButtonArea {
  position: fixed;
  bottom: 86px;
  left: 0;
  right: 0;
  padding: 6px 4px;
  overflow-x: auto;
  white-space: nowrap;
  background-color: #ccc;
  z-index: 19;
}
button {
  box-shadow: inset 0 1px 0 0 #54a3f7;
  background: linear-gradient(to bottom, #007dc1 5%, #0061a7 100%);
  background-color: #007dc1;
  border-radius: 6px;
  border: 1px solid #124d77;
  color: #fff;
  cursor: pointer;
  font-size: 14pt;
  font-weight: bold;
  text-shadow: 0 1px 0 #154682;
}
button:active { transform: scale(.95); }
.bottomArea button { width: 32%; height: 60px; }
.tabButtonArea button { width: 80px; height: 50px; }
.tabButtonArea button.selected {
  box-shadow: inset 0 1px 0 0 #f9eca0;
  background: linear-gradient(to bottom, #f0c911 5%, #f2ab1e 100%);
  background-color: #f0c911;
  border: 1px solid #e65f44;
  color: #c92200;
  text-shadow: 0 1px 0 #ded17c;
}
.dim-layer {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
}
.dimBg {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #000;
  opacity: .5;
}
.pop-layer {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(420px, 92vw);
  transform: translate(-50%, -50%);
  background-color: #fff;
  border: 5px solid #3571B5;
  z-index: 110;
  max-height: 90vh;
  overflow: auto;
}
.pop-container { padding: 20px 25px; }
.pop-btns { display: flex; gap: 8px; margin-top: 10px; }
.pop-btns button { flex: 1; height: 52px; }
#txtBarcodeData { width: 100%; min-height: 160px; font-size: 12pt; }
#historyListArea {
  margin-top: 8px;
  border: solid 1px silver;
  background-color: #eee;
  padding: 10px;
  max-height: 40vh;
  overflow: auto;
  white-space: pre-wrap;
  font-family: Consolas, monospace;
  font-size: 10pt;
}
.history-item {
  width: 100%;
  text-align: left;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 4px;
  border: 1px solid #999;
  background: #fff;
  color: #222;
  text-shadow: none;
  box-shadow: none;
  font-family: Consolas, monospace;
  font-size: 10pt;
  line-height: 1.35;
}
.history-item:last-child { margin-bottom: 0; }
.history-item-title {
  display: block;
  margin-bottom: 4px;
  font-weight: bold;
}
.history-item-data {
  display: block;
  word-break: break-all;
}
.history-item:hover { background: #f3f9ff; border-color: #3571B5; }
.history-item:active { transform: none; background: #e8f3ff; }
.hidden { display: none !important; }

#cameraModal .dimBg { opacity: .82; }
#cameraModal .scanner-panel {
  width: min(760px, 96vw);
  max-height: 96dvh;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: #101315;
  color: #fff;
}
.scanner-shell {
  display: flex;
  flex-direction: column;
  max-height: 96dvh;
  min-height: 520px;
  background: #101315;
}
.scanner-header {
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  min-height: 56px;
  padding: 4px 8px;
  background: #151a1d;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.scanner-title {
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13pt;
  font-weight: bold;
}
.scanner-header-spacer { width: 48px; }
.scanner-icon-button {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: none;
  background: transparent;
  color: #fff;
  font-size: 25pt;
  font-weight: normal;
  line-height: 40px;
  text-shadow: none;
}
.scanner-icon-button:hover { background: rgba(255,255,255,.1); }
.scanner-icon-button:active { transform: none; background: rgba(255,255,255,.16); }

.video-wrapper {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  height: min(68dvh, 680px);
  min-height: 360px;
  overflow: hidden;
  background: #000;
}
.video-wrapper video,
.scan-snapshot {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}
.scan-snapshot {
  position: absolute;
  inset: 0;
}
.scan-line {
  position: absolute;
  top: 10%;
  left: 8%;
  width: 84%;
  height: 2px;
  background: #24c978;
  box-shadow: 0 0 8px rgba(36,201,120,.9);
  animation: scanMove 2.1s ease-in-out infinite;
  pointer-events: none;
  z-index: 6;
}
.video-wrapper.is-selecting .scan-line { display: none; }
@keyframes scanMove {
  0%, 100% { top: 12%; opacity: .2; }
  50% { top: 86%; opacity: 1; }
}
.scan-status,
.multi-code-prompt {
  position: absolute;
  left: 50%;
  z-index: 20;
  max-width: calc(100% - 32px);
  transform: translateX(-50%);
  border-radius: 6px;
  background: rgba(12,16,18,.76);
  color: #fff;
  font-size: 10.5pt;
  line-height: 1.4;
  text-align: center;
  backdrop-filter: blur(4px);
}
.scan-status {
  top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
}
.status-spinner {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #24c978;
  border-radius: 50%;
  animation: scannerSpin .8s linear infinite;
}
@keyframes scannerSpin { to { transform: rotate(360deg); } }
.multi-code-prompt {
  bottom: 20px;
  padding: 10px 16px;
  font-weight: bold;
}
.barcode-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}
.barcode-outlines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.barcode-outline {
  fill: rgba(36,201,120,.1);
  stroke: #24c978;
  stroke-width: 4;
  vector-effect: non-scaling-stroke;
}
.barcode-marker {
  position: absolute;
  width: 48px;
  height: 48px;
  padding: 0;
  transform: translate(-50%, -50%);
  border: 3px solid #fff;
  border-radius: 50%;
  background: #16b866;
  box-shadow: 0 2px 12px rgba(0,0,0,.45);
  color: #fff;
  font-size: 25pt;
  line-height: 39px;
  text-align: center;
  text-shadow: none;
  pointer-events: auto;
}
.barcode-marker:active { transform: translate(-50%, -50%) scale(.92); }

.zoom-control {
  display: grid;
  grid-template-columns: auto 1fr 48px;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 14px;
  background: #151a1d;
  color: #fff;
  font-size: 10pt;
}
.zoom-control input { width: 100%; accent-color: #24c978; }
.zoom-control output { text-align: right; font-variant-numeric: tabular-nums; }
.scanner-actions {
  display: flex;
  gap: 8px;
  min-height: 68px;
  padding: 8px max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: #151a1d;
}
.scanner-tool {
  flex: 1 1 0;
  min-width: 0;
  height: 48px;
  overflow: hidden;
  padding: 0 8px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 6px;
  background: #252c30;
  box-shadow: none;
  color: #fff;
  font-size: 10.5pt;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-shadow: none;
}
.scanner-tool:hover { background: #303a3f; }
.scanner-tool[aria-pressed="true"] { border-color: #24c978; background: #16633f; }
.scanner-tool:active { transform: scale(.97); }

@media (max-width: 640px) {
  #cameraModal .scanner-panel {
    top: 0;
    left: 0;
    width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    transform: none;
    border-radius: 0;
  }
  .scanner-shell { height: 100dvh; max-height: 100dvh; min-height: 0; }
  .scanner-header { padding-top: max(4px, env(safe-area-inset-top)); }
  .video-wrapper { height: auto; min-height: 0; }
}
.top-controls {
  position: fixed;
  top: 8px;
  right: 8px;
  z-index: 30;
  display: flex;
  gap: 8px;
  align-items: center;
}
.menu-toggle {
  font-size: 16pt;
  padding: 6px 10px;
  height: 36px;
  min-width: 44px;
  background: linear-gradient(to bottom, #115f97 5%, #0d4a75 100%);
  background-color: #115f97;
  border: 1px solid #0a3d5f;
  color: #fff;
  text-shadow: 0 1px 0 #0a3d5f;
}
.lang-switch {
  display: none;
}
.lang-switch button {
  font-size: 10pt;
  padding: 6px 10px;
  height: 36px;
  min-width: 78px;
}
.mode-switch {
  display: none;
}
.mode-switch button {
  font-size: 10pt;
  padding: 6px 10px;
  height: 34px;
  min-width: 78px;
}
.mode-switch button.selected {
  box-shadow: inset 0 1px 0 0 #f9eca0;
  background: linear-gradient(to bottom, #f0c911 5%, #f2ab1e 100%);
  background-color: #f0c911;
  border: 1px solid #e65f44;
  color: #c92200;
  text-shadow: 0 1px 0 #ded17c;
}
.side-menu {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: #fff;
  box-shadow: -2px 0 10px rgba(0,0,0,0.3);
  z-index: 1001;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
}
.side-menu.open {
  transform: translateX(0);
}
.side-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: #115f97;
  color: #fff;
  font-size: 14pt;
  font-weight: bold;
  flex-shrink: 0;
}
.menu-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 18pt;
  padding: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  box-shadow: none;
  text-shadow: none;
}
.menu-close:active {
  transform: scale(1);
  background: rgba(255,255,255,0.2);
}
.side-menu-section {
  padding: 20px;
  border-bottom: 1px solid #eee;
}
.side-menu-label {
  font-size: 11pt;
  font-weight: bold;
  color: #1f3f62;
  margin-bottom: 10px;
}
.side-menu-buttons {
  display: flex;
  gap: 8px;
}
.side-menu-buttons button {
  flex: 1;
  font-size: 10pt;
  padding: 8px 12px;
  height: 42px;
}
.side-menu-buttons button.selected {
  box-shadow: inset 0 1px 0 0 #f9eca0;
  background: linear-gradient(to bottom, #f0c911 5%, #f2ab1e 100%);
  background-color: #f0c911;
  border: 1px solid #e65f44;
  color: #c92200;
  text-shadow: 0 1px 0 #ded17c;
}
.missing-validation-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.setting-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  color: #34485d;
  font-size: 9.5pt;
  cursor: pointer;
}
.setting-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.setting-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border: 1px solid #8b98a5;
  border-radius: 12px;
  background: #aab2ba;
  transition: background .18s ease, border-color .18s ease;
}
.setting-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.28);
  transition: transform .18s ease;
}
.setting-switch input:checked + .setting-switch-track {
  border-color: #0b6f47;
  background: #138a59;
}
.setting-switch input:checked + .setting-switch-track::after {
  transform: translateX(18px);
}
.setting-switch input:focus-visible + .setting-switch-track {
  outline: 3px solid rgba(17,95,151,.28);
  outline-offset: 2px;
}
.setting-switch-text {
  min-width: 30px;
  white-space: nowrap;
}
.missing-field-menu-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
  height: 42px;
  padding: 0 10px;
  overflow: hidden;
  border: 1px solid #7a98b8;
  background: #fff;
  box-shadow: none;
  color: #1f3f62;
  font-size: 9.5pt;
  text-shadow: none;
}
.missing-field-menu-button:active { transform: none; background: #edf5fc; }
#missingFieldSummary {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.missing-field-chevron {
  flex: 0 0 auto;
  font-size: 11pt;
  transition: transform .18s ease;
}
.missing-field-menu-button[aria-expanded="true"] .missing-field-chevron {
  transform: rotate(180deg);
}
.missing-field-menu {
  margin-top: 9px;
  border: 1px solid #b8c6d4;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(22,48,75,.14);
}
.missing-field-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  padding: 6px 8px 6px 12px;
  border-bottom: 1px solid #e2e8ef;
  color: #1f3f62;
  font-size: 10pt;
  font-weight: bold;
}
.missing-field-menu-header button {
  height: 32px;
  padding: 0 11px;
  border: 1px solid #7a98b8;
  background: #edf5fc;
  box-shadow: none;
  color: #115f97;
  font-size: 9pt;
  text-shadow: none;
}
.missing-field-menu-header button:active { transform: none; background: #dcecf9; }
.missing-field-menu-header button:disabled {
  opacity: .48;
  cursor: default;
}
.missing-field-options {
  max-height: min(42vh, 330px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 5px 0;
}
.missing-field-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 12px;
  color: #24384c;
  font-size: 10pt;
  cursor: pointer;
}
.missing-field-option:hover { background: #f1f6fb; }
.missing-field-option input {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: #115f97;
}
.missing-field-option.is-disabled {
  cursor: default;
  color: #687888;
}
.side-menu-footer {
  margin-top: auto;
  padding: 18px 20px 22px;
  text-align: center;
  border-top: 1px solid #eef1f5;
  background: linear-gradient(to bottom, #fbfcfe 0%, #f4f7fb 100%);
}
.dev-credit {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 9.5pt;
  color: #5a6b7f;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(17,95,151,0.06);
  transition: color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.dev-credit:hover {
  color: #115f97;
  border-color: #115f97;
  box-shadow: 0 2px 8px rgba(17,95,151,0.18);
  transform: translateY(-1px);
}
.dev-credit .dev-credit-label {
  color: #9aa7b6;
}
.dev-credit .dev-credit-name {
  font-weight: bold;
  color: #1f3f62;
}
.dev-credit:hover .dev-credit-name {
  color: #115f97;
}
.dev-credit .dev-credit-heart {
  color: #e65f44;
  font-size: 8.5pt;
}
.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}
.menu-overlay.open {
  display: block;
}

#entryGateModal {
  z-index: 2000;
}
#entryGateModal .pop-layer {
  z-index: 2010;
}
#missingDataModal {
  z-index: 1900;
}
#missingDataModal .dimBg {
  opacity: .62;
}
#missingDataModal .pop-layer {
  z-index: 1910;
}
.missing-warning-panel {
  border-color: #b66a00;
}
.missing-warning-title {
  background: #8a5100;
}
.missing-warning-segment {
  margin-top: 14px;
  color: #714600;
  font-size: 11pt;
  font-weight: bold;
}
.missing-warning-message {
  margin: 10px 0 8px;
  line-height: 1.5;
}
.missing-warning-list {
  max-height: min(42vh, 320px);
  margin: 0;
  padding: 8px 8px 8px 30px;
  overflow-y: auto;
  border: 1px solid #e1c18f;
  background: #fff9ee;
  color: #322719;
  line-height: 1.65;
}
.missing-warning-list li::marker {
  color: #b66a00;
}
@media (max-width: 640px) {
  .missing-warning-panel {
    width: min(94vw, 420px);
    max-height: calc(100dvh - 32px);
  }
  .missing-warning-panel .pop-container {
    padding: 16px 18px;
  }
}
.gate-tip {
  margin-top: 10px;
}
.gate-form {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gate-form label {
  font-weight: bold;
  color: #1f3f62;
}
.gate-form input {
  width: 100%;
  height: 42px;
  padding: 8px 10px;
  font-size: 12pt;
  border: 1px solid #7a98b8;
  border-radius: 6px;
}
