:root {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

body {
  margin: 0;
  padding: 16px;
  background: #f4f4f5;
  color: #1f2937;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #1f2937;
  padding: 0;
}
.login-box {
  background: white;
  padding: 32px;
  border-radius: 10px;
  width: 280px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.login-box h1 { font-size: 20px; margin: 0 0 4px; }
.login-box input, .login-box button { padding: 10px; font-size: 16px; }
.login-box button {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.topbar h1 { font-size: 22px; margin: 0; }
.logout-link { color: #6b7280; text-decoration: none; font-size: 14px; }

.scan-bar {
  background: #1f2937;
  color: white;
  padding: 14px;
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
}
.scan-bar label { display: flex; flex-direction: column; gap: 4px; }
.scan-bar input[type="text"] {
  font-size: 18px;
  padding: 8px;
  width: 220px;
  border-radius: 4px;
  border: none;
}
.scan-bar input[type="number"] {
  font-size: 16px;
  padding: 8px;
  width: 70px;
  border-radius: 4px;
  border: none;
}
.mode-toggle { display: flex; flex-direction: column; gap: 4px; }
.mode-toggle label { flex-direction: row; align-items: center; gap: 6px; }

.status {
  font-weight: bold;
  margin-bottom: 12px;
  min-height: 1.2em;
}
.status.ok { color: #15803d; }
.status.error { color: #b91c1c; }

.actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.actions button {
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: white;
  cursor: pointer;
}
.actions button:hover { background: #f3f4f6; }

.table-wrap { overflow-x: auto; border-radius: 8px; }
table {
  border-collapse: collapse;
  width: 100%;
  background: white;
}
th, td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
  font-size: 14px;
}
tr.low-stock { background: #fee2e2; }
tr.selected { outline: 2px solid #2563eb; outline-offset: -2px; }
tbody tr:hover { background: #f3f4f6; cursor: pointer; }

.swatch-box {
  display: inline-block;
  width: 26px;
  height: 16px;
  border: 1px solid #9ca3af;
  border-radius: 3px;
  vertical-align: middle;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10;
}
.modal.hidden { display: none; }
.modal-box {
  background: white;
  padding: 20px;
  border-radius: 8px;
  width: 100%;
  max-width: 380px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-box h2 { margin: 0 0 6px; font-size: 18px; }
.modal-box label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #4b5563;
}
.modal-box input, .modal-box textarea {
  padding: 8px;
  font-size: 15px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-family: inherit;
}
.hex-row { display: flex; align-items: center; gap: 8px; }
.hex-row input { flex: 1; }
.swatch {
  display: inline-block;
  width: 26px;
  height: 26px;
  border: 1px solid #9ca3af;
  border-radius: 4px;
  flex-shrink: 0;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.modal-actions button {
  padding: 9px 16px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: white;
  cursor: pointer;
  font-size: 14px;
}
#saveModal { background: #2563eb; color: white; border-color: #2563eb; }

.error { color: #b91c1c; font-size: 13px; margin: 0; min-height: 1em; }

@media (max-width: 640px) {
  body { padding: 10px; }
  .scan-bar input[type="text"] { width: 100%; }
  .actions button { flex: 1 1 calc(50% - 4px); }
}
