* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  max-width: 520px;
  margin-inline: auto;
  padding: 16px;
}

header {
  text-align: center;
  margin-bottom: 16px;
}

header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.sub {
  color: #94a3b8;
  margin: 4px 0 0;
  font-size: 0.9rem;
}

.stats {
  margin-bottom: 16px;
}

.card {
  background: #1e293b;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
}

.card .num {
  display: block;
  font-size: 2.6rem;
  font-weight: 700;
  color: #38bdf8;
}

.card .label {
  color: #94a3b8;
  font-size: 0.9rem;
}

.scanner-box {
  background: #1e293b;
  border-radius: 14px;
  padding: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}

#reader {
  width: 100%;
}

.result {
  padding: 14px;
  border-radius: 14px;
  text-align: center;
  margin-bottom: 16px;
  font-weight: 600;
}

.result.success {
  background: #064e3b;
  color: #6ee7b7;
}

.result.warn {
  background: #78350f;
  color: #fcd34d;
}

.result.error {
  background: #7f1d1d;
  color: #fca5a5;
}

.hidden {
  display: none !important;
}

.scan-btn {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: #38bdf8;
  color: #0f172a;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.scan-btn:hover {
  background: #0ea5e9;
}

.list-box {
  background: #1e293b;
  border-radius: 14px;
  padding: 14px;
}

.list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.list-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

.list-head button {
  background: #334155;
  color: #e2e8f0;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
}

#scanList {
  list-style: none;
  margin: 0;
  padding: 0;
}

#scanList li {
  padding: 10px 0;
  border-bottom: 1px solid #334155;
}

#scanList li:last-child {
  border-bottom: none;
}

#scanList .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

#scanList .code {
  font-weight: 700;
  color: #e2e8f0;
}

#scanList .meta {
  color: #94a3b8;
  font-size: 0.8rem;
  margin-top: 2px;
}

#scanList .note {
  color: #fcd34d;
  font-size: 0.8rem;
  margin-top: 2px;
}

.del-btn {
  background: #7f1d1d;
  color: #fca5a5;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.del-btn:hover {
  background: #991b1b;
}

/* النافذة المنبثقة */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal {
  background: #1e293b;
  border-radius: 16px;
  padding: 22px;
  width: 100%;
  max-width: 400px;
}

.modal h3 {
  margin: 0 0 16px;
  text-align: center;
}

.modal label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.modal input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 1rem;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.modal-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: #38bdf8;
  color: #0f172a;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: default;
}

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