/* ==========================================================================
   Modals, Dialogs, Form Fields, Resolve Cards & Toasts
   ========================================================================== */

.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(13, 27, 45, 0.56);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.dialog {
  background: white;
  border-radius: 14px;
  box-shadow: 0 25px 90px rgba(0, 0, 0, 0.2);
  width: min(720px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
}

.dialog form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.dialog-head {
  padding: 18px 23px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.dialog-head h2 {
  margin: 0;
  font-size: 19px;
}

.dialog-body {
  padding: 22px 23px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  border-top: 1px solid var(--border);
  padding: 15px 23px;
  flex-shrink: 0;
  background: white;
}

/* Form Fields */
.formfield {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.formfield label {
  font-size: 12px;
  font-weight: 750;
  color: #465b71;
}

.formfield input,
.formfield select,
.formfield textarea {
  border: 1px solid #d6dee8;
  border-radius: 8px;
  background: white;
  padding: 9px 10px;
  min-height: 39px;
  color: var(--ink);
  width: 100%;
}

.formfield input[readonly] {
  background: #f7f9fc;
  color: #75859a;
}

.formfield small {
  color: var(--muted);
  font-size: 10px;
}

.formfield input:focus,
.formfield select:focus {
  outline: 2px solid #b6c9e8;
  outline-offset: 0;
}

.fields2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.fields2 .wide {
  grid-column: 1 / -1;
}

.xbtn {
  border: 0;
  background: #f3f5f9;
  border-radius: 7px;
  width: 32px;
  height: 32px;
  font-size: 19px;
  color: #5c6e83;
}

.radio-row {
  display: flex;
  gap: 18px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.radio-row label {
  display: flex;
  gap: 6px;
  align-items: center;
  font-weight: 700;
}

.modal-help {
  background: #f3f6fb;
  border-radius: 8px;
  padding: 11px 13px;
  color: #51637b;
  font-size: 12px;
  margin-bottom: 15px;
}

/* Unknown Barcode Queue Cards */
.unknown-list {
  display: grid;
  gap: 10px;
}

.unknown-card {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  border: 1px solid #f1d8b8;
  border-radius: 9px;
  background: #fffaf4;
}

.unknown-card strong {
  display: block;
  font-size: 12px;
}

.unknown-card p {
  margin: 2px 0 0;
  color: #866341;
  font-size: 11px;
}

/* Interactive Result Card for Barcode Mapping */
.resolve-result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: #f4f8fe;
  border: 2px solid #2b5993;
  border-radius: 9px;
  margin-top: 10px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.resolve-result-card:hover {
  background: #eaf2fc;
  box-shadow: 0 4px 14px rgba(24, 41, 65, 0.08);
  transform: translateY(-1px);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 20;
  padding: 13px 18px;
  color: white;
  border-radius: 10px;
  box-shadow: 0 8px 35px #2b3c5e40;
  background: var(--navy);
  max-width: 340px;
  line-height: 1.4;
}

.toast.warn {
  background: #a75f27;
}

@media (max-width: 600px) {
  .fields2 {
    grid-template-columns: 1fr;
  }
  .fields2 .wide {
    grid-column: auto;
  }
  .unknown-card {
    flex-wrap: wrap;
  }
  .dialog-backdrop {
    padding: 8px;
  }
  .dialog-body {
    padding: 14px;
  }
  .dialog-head,
  .dialog-footer {
    padding: 13px;
  }
}
