/* Duplicate visitor warning pop-up (Step 3, 2026-11-05).
   JS: resources/views/scripts/partials/visitor_duplicate_warning_js.blade.php
   Plan: documentation/duplicate-visitors-plan.md §5.
   Every rule is scoped to .vdw-popup / .vdw — nothing here touches other SweetAlert dialogs.
   FontAwesome all.js swaps each <i> for an <svg> at runtime, so icon rules list both. */

/* ── SweetAlert2 10 shell: the content sits in .swal2-content (own padding) — zero it ── */
.swal2-popup.vdw-popup {
  padding: 0;
  border-radius: 16px;
  overflow: hidden;
  text-align: left;
  max-width: calc(100vw - 32px);
}
.swal2-popup.vdw-popup .swal2-header,
.swal2-popup.vdw-popup .swal2-actions,
.swal2-popup.vdw-popup .swal2-footer {
  display: none !important;
}
.swal2-popup.vdw-popup .swal2-content {
  padding: 0;
  font-size: 1rem;
  text-align: left;
}
.swal2-popup.vdw-popup .swal2-html-container {
  margin: 0;
  overflow: visible;
}

.vdw {
  font-family: 'Segoe UI', sans-serif;
  color: #1f2937;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

/* ── Header ── */
.vdw-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid #eef0f4;
}
.vdw-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fff4e0;
  color: #d97706;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
}
.vdw-head-text {
  flex: 1 1 auto;
  min-width: 0;
}
.vdw-title {
  margin: 0 0 4px;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.3;
  color: #202B56;
}
.vdw-sub {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: #5b6475;
  overflow-wrap: anywhere;
}
.vdw-sub strong {
  color: #1f2937;
  font-weight: 600;
}
.vdw-close {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #8a93a5;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.vdw-close:hover,
.vdw-close:focus {
  background: #f2f4f8;
  color: #202B56;
  outline: none;
}

/* ── Match cards ── */
.vdw-list {
  list-style: none;
  margin: 0;
  padding: 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  min-height: 0;
  background: #f7f8fb;
}
.vdw-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e3e6ee;
  border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
.vdw-card:hover {
  border-color: #202B56;
  box-shadow: 0 4px 14px rgba(32, 43, 86, .08);
}
.vdw-card-denied {
  border-color: #f5c2c2;
}
.vdw-card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vdw-name-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.vdw-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
  overflow-wrap: anywhere;
}
.vdw-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.6;
  letter-spacing: .02em;
  background: #eef0f4;
  color: #4b5563;
  white-space: nowrap;
}
.vdw-badge-temporary { background: #e8f0fe; color: #1d4ed8; }
.vdw-badge-permanent { background: #e6f6ee; color: #047857; }
.vdw-badge-quick_visitor { background: #f1ecfe; color: #6d28d9; }
.vdw-badge-denied { background: #fde8e8; color: #c81e1e; }
.vdw-badge-top { background: #fff4e0; color: #b45309; }
.vdw-badge i, .vdw-badge svg { font-size: 0.65rem; }

.vdw-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.88rem;
  color: #4b5563;
}
.vdw-fact,
.vdw-plate,
.vdw-visits,
.vdw-reason,
.vdw-more,
.vdw-denied-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.vdw-fact i, .vdw-fact svg,
.vdw-plate i, .vdw-plate svg,
.vdw-visits i, .vdw-visits svg {
  color: #9aa3b5;
  font-size: 0.8rem;
}
.vdw-plate {
  padding: 1px 8px;
  border: 1px solid #d5d9e3;
  border-radius: 6px;
  background: #fafbfc;
  font-family: Consolas, 'Courier New', monospace;
  font-weight: 600;
  letter-spacing: .04em;
  color: #1f2937;
}
.vdw-plate-more {
  font-family: 'Segoe UI', sans-serif;
  letter-spacing: 0;
  color: #5b6475;
  background: #eef0f5;
  cursor: help;
}
/* The field that matched what was typed */
.vdw-fact.vdw-hit { color: #1f2937; font-weight: 600; }
.vdw-plate.vdw-hit { border-color: #d97706; background: #fff8eb; }
.vdw-hit i, .vdw-hit svg { color: #d97706; }

.vdw-visits {
  font-size: 0.84rem;
  color: #6b7280;
}
.vdw-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.vdw-reason {
  padding: 1px 8px;
  border-radius: 6px;
  background: #fff4e0;
  color: #92400e;
  font-size: 0.75rem;
  font-weight: 600;
}
.vdw-reason i, .vdw-reason svg { font-size: 0.65rem; }
/* First / last name only (client review 2026-11-12) — a weaker match than "Same name" */
.vdw-reason.vdw-reason-similar { background: #eef2ff; color: #3949ab; }
.vdw-denied-note {
  align-items: flex-start;
  font-size: 0.8rem;
  line-height: 1.4;
  color: #c81e1e;
}
.vdw-denied-note i, .vdw-denied-note svg { flex: 0 0 auto; margin-top: 3px; }

.vdw .btn.vdw-use {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid #202B56;
  background: #202B56;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  box-shadow: none;
}
.vdw .btn.vdw-use:hover,
.vdw .btn.vdw-use:focus {
  background: #2c3a72;
  border-color: #2c3a72;
  color: #fff;
  box-shadow: 0 0 0 3px rgba(32, 43, 86, .18);
}
.vdw-card-denied .btn.vdw-use {
  background: #fff;
  color: #c81e1e;
  border-color: #e7a3a3;
}
.vdw-card-denied .btn.vdw-use:hover,
.vdw-card-denied .btn.vdw-use:focus {
  background: #fde8e8;
  color: #c81e1e;
  border-color: #c81e1e;
  box-shadow: 0 0 0 3px rgba(200, 30, 30, .12);
}
.vdw-use i, .vdw-use svg { font-size: 0.8rem; }

.vdw-more {
  margin: 0;
  padding: 0 22px 12px;
  background: #f7f8fb;
  font-size: 0.82rem;
  color: #6b7280;
}

/* ── Footer actions ── */
.vdw-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid #eef0f4;
  background: #fff;
}
.vdw-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: none;
}
.vdw .btn.vdw-back {
  margin-right: auto;
  background: #eef0f5;
  border: 1px solid #dfe3eb;
  color: #374151;
}
.vdw .btn.vdw-back:hover,
.vdw .btn.vdw-back:focus {
  background: #e2e6ee;
  border-color: #cfd5e0;
  color: #202B56;
}
.vdw .btn.vdw-new,
.vdw .btn.vdw-merge {
  background: #fff;
  border: 1px solid #c9cedb;
  color: #202B56;
}
.vdw .btn.vdw-new:hover,
.vdw .btn.vdw-new:focus,
.vdw .btn.vdw-merge:hover,
.vdw .btn.vdw-merge:focus {
  border-color: #202B56;
  background: #f5f6fa;
  color: #202B56;
}

/* ── Phone ── */
@media (max-width: 575.98px) {
  .vdw-head { padding: 18px 16px 14px; gap: 12px; }
  .vdw-icon { flex-basis: 38px; width: 38px; height: 38px; font-size: 16px; }
  .vdw-title { font-size: 1.05rem; }
  .vdw-list { padding: 12px 16px; }
  .vdw-more { padding: 0 16px 10px; }
  .vdw-card { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px; }
  .vdw .btn.vdw-use { justify-content: center; width: 100%; }
  .vdw-actions { flex-direction: column-reverse; align-items: stretch; padding: 12px 16px 16px; gap: 8px; }
  .vdw .btn.vdw-back { margin-right: 0; }
}

/* ══ Merge dialog (Step 4) — scripts/partials/visitor_merge_dialog_js.blade.php ══
   Re-uses the .vdw header / facts / badges / footer above; everything new is .vmd-*. */
.vmd-icon {
  background: #e9ecf6;
  color: #202B56;
}
.vmd-body {
  overflow-y: auto;
  min-height: 0;
  padding: 4px 22px 8px;
  background: #f7f8fb;
}
.vmd-section {
  padding: 14px 0 6px;
}
.vmd-section + .vmd-section {
  border-top: 1px solid #e8eaf0;
}
.vmd-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 700;
  font-size: 0.95rem;
  color: #202B56;
}
.vmd-step {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #202B56;
  color: #fff;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Step 1 list — client design 2026-11-13 (tick boxes + master record). Was KEEP/MERGE/LEFT OUT cards. */
.vmd-hint {
  margin: -4px 0 10px;
  font-size: 0.84rem;
  color: #5b6474;
}
.vmd-list {
  background: #fff;
  border: 1px solid #dfe5f0;
  border-radius: 12px;
  overflow: hidden;
}
.vmd-cb {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: #202B56;
  cursor: pointer;
  flex: 0 0 auto;
}
.vmd-row-master .vmd-cb { accent-color: #1e9e5a; cursor: default; }
.vmd-all {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 11px 16px;
  background: #eef3fb;
  border-bottom: 1px solid #dfe5f0;
  cursor: pointer;
}
.vmd-all-label,
.vmd-all-count { text-transform: none; letter-spacing: normal; }
.vmd-all-label { font-weight: 700; font-size: 0.92rem; color: #1f2937; }
.vmd-all-count { margin-left: auto; font-size: 0.82rem; color: #5b6474; }
.vmd-list-head,
.vmd-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 2.3fr) minmax(0, 1.25fr) minmax(0, 1.1fr) minmax(0, 1fr) 210px;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
}
.vmd-list-head {
  background: #f6f8fc;
  border-bottom: 1px solid #e5e9f1;
  font-size: 0.76rem;
  font-weight: 700;
  color: #374151;
}
.vmd-rows { list-style: none; margin: 0; padding: 0; }
.vmd-row { border-bottom: 1px solid #eef0f4; font-size: 0.86rem; color: #1f2937; }
.vmd-row:last-child { border-bottom: 0; }
.vmd-row-master { background: #ecfbf1; }
.vmd-row-off { background: #fafbfc; }
.vmd-row-off .vmd-cell-who,
.vmd-row-off .vmd-cell-plate,
.vmd-row-off .vmd-cell-visits,
.vmd-row-off .vmd-cell-added { opacity: .5; }
.vmd-cell { min-width: 0; }
.vmd-cell-check { display: flex; }
.vmd-row-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.vmd-row-name { font-weight: 700; font-size: 0.95rem; color: #111827; overflow-wrap: anywhere; }
.vmd-row-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 3px;
  font-size: 0.76rem;
  color: #6b7280;
}
.vmd-row-sub i, .vmd-row-sub svg { margin-right: 4px; font-size: 0.72rem; }
.vmd-row-similar { color: #3949ab; }
.vmd-row-email { overflow-wrap: anywhere; }
.vmd-cell-plate { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.vmd-row-more { font-size: 0.74rem; color: #6b7280; cursor: help; }
.vmd-row-none { color: #9ca3af; }
.vmd-cell-visits small { display: block; font-size: 0.74rem; color: #6b7280; }
.vmd-row-added-label { display: none; }
.vmd-make-master {
  width: 100%;
  padding: 7px 8px;
  border: 1.5px solid #202B56;
  border-radius: 8px;
  background: #fff;
  color: #202B56;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.2;
  cursor: pointer;
}
.vmd-make-master:hover { background: #202B56; color: #fff; }
.vmd-make-master:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(32, 43, 86, .2); }
.vmd-master-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #15803d;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.vmd-master-tag i, .vmd-master-tag svg { font-size: 1.1rem; }
.vmd-row-offnote { display: block; margin-top: 4px; font-size: 0.7rem; color: #9ca3af; text-align: center; }

/* Phone: no table head, each row stacks (tick box | name, then plate + visits, then the button) */
@media (max-width: 767.98px) {
  .vmd-list-head { display: none; }
  .vmd-row {
    grid-template-columns: 18px minmax(0, 1fr) auto;
    grid-template-areas: "check who who" "check plate visits" "check added added" "check master master";
    row-gap: 6px;
  }
  .vmd-cell-check { grid-area: check; align-self: start; padding-top: 2px; }
  .vmd-cell-who { grid-area: who; }
  .vmd-cell-plate { grid-area: plate; }
  .vmd-cell-visits { grid-area: visits; text-align: right; }
  .vmd-cell-added { grid-area: added; font-size: 0.76rem; color: #6b7280; }
  .vmd-row-added-label { display: inline; font-size: inherit; }
  .vmd-cell-master { grid-area: master; }
}

.vmd-nothing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.86rem;
  color: #8a5a00;
}

/* details picker */
.vmd-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
}
.vmd-field-label {
  flex: 0 0 110px;
  padding-top: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4b5563;
}
.vmd-choices {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.vmd-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid #d5d9e3;
  border-radius: 10px;
  background: #fff;
  color: #1f2937;
  font-size: 0.88rem;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.vmd-choice:hover {
  border-color: #202B56;
}
.vmd-choice:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(32, 43, 86, .15);
}
.vmd-choice-dot {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #b7bdcc;
}
.vmd-choice.is-active {
  border-color: #202B56;
  background: #eef1fa;
  font-weight: 600;
}
.vmd-choice.is-active .vmd-choice-dot {
  border: 4px solid #202B56;
}
.vmd-choice-denied {
  color: #c81e1e;
}
.vmd-empty {
  color: #8a93a5;
  font-style: italic;
}
.vmd-photo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
}
.vmd-same {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 0.88rem;
  color: #047857;
}
.vmd-denied {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fde8e8;
  color: #9b1c1c;
  font-size: 0.86rem;
  line-height: 1.45;
}
.vmd-denied i, .vmd-denied svg { flex: 0 0 auto; margin-top: 3px; }

/* summary + confirmation */
.vmd-summary {
  padding: 12px 14px;
  border: 1px solid #f3d3a2;
  border-radius: 12px;
  background: #fffaf0;
}
.vmd-summary-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.87rem;
  line-height: 1.45;
  color: #374151;
}
.vmd-summary-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.vmd-summary-list i, .vmd-summary-list svg {
  flex: 0 0 auto;
  margin-top: 3px;
  color: #b45309;
}
.vmd-confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding-top: 10px;
  border-top: 1px dashed #f0c27b;
  font-size: 0.88rem;
  line-height: 1.4;
  color: #92400e;
  cursor: pointer;
}
.vmd-confirm input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: #c81e1e;
  cursor: pointer;
}
.vmd-error {
  display: none;
  margin: 8px 0 6px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fde8e8;
  color: #9b1c1c;
  font-size: 0.86rem;
}
.vmd-error.is-shown {
  display: block;
}

/* irreversible action = red */
.vdw .btn.vmd-merge-btn {
  background: #c81e1e;
  border: 1px solid #c81e1e;
  color: #fff;
}
.vdw .btn.vmd-merge-btn:hover,
.vdw .btn.vmd-merge-btn:focus {
  background: #a51818;
  border-color: #a51818;
  color: #fff;
}
.vdw .btn.vmd-merge-btn:disabled {
  background: #e9a3a3;
  border-color: #e9a3a3;
  color: #fff;
  opacity: 1;
  cursor: not-allowed;
}

@media (max-width: 575.98px) {
  .vmd-body { padding: 2px 16px 8px; }
  .vmd-field { flex-direction: column; gap: 6px; }
  .vmd-field-label { flex-basis: auto; padding-top: 0; }
}

/* "This visit" — Type & dates from the Add Visitor form, offered next to the records' options */
.vmd-form-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e7ebf7;
  color: #202B56;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .02em;
}


/* Visitors List (Step 5): batch Merge icon + a divider above each duplicate group */
.vra-item-icon--merge { color: #202B56; }
#visitor-tbl tbody tr.vdl-group-start > td { border-top: 2px solid #c9cfdd; }

/* Visitors List filter panel wraps to 2 rows (Sort By + Duplicates) — scoped gap, base .filter-item untouched */
.visitor-list-filter .filter-body > .row { row-gap: 18px; }

/* ── Visitor Name suggestions (Add Visitor pop-up) — EXPIRED entries, 2026-11-12 client request ──
   Yellow was hard to read, so expired names + the "E" circle use the theme navy. The hovered / arrow-key row
   is also navy (style.css .ui-widget-content .ui-state-active), so on that row the name turns white and the
   circle flips to white with a navy "E". Only expired entries carry these classes — nothing else changes.
   Markup: resources/views/pages/visitor/create_modal.blade.php (autocomplete source). */
.vn-ac-expired-name {
    font-weight: bold;
    color: #202B56;
}
.vn-ac-expired-circle {
    background: #202B56;
    color: #FFFFFF;
}
.ui-menu-item-wrapper.ui-state-active .vn-ac-expired-name {
    color: #FFFFFF;
}
.ui-menu-item-wrapper.ui-state-active .vn-ac-expired-circle {
    background: #FFFFFF;
    color: #202B56;
}

/* ══ "Duplicate names found" (client 2026-11-16, plan Step 11) — the merge screen opened straight from Save ══
   JS: visitor_merge_dialog_js (options.duplicate). Everything is scoped to .vmd-dup — the Visitors List merge is unchanged. */
.vmd-dup .vmd-dup-more { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; }
.vmd-dup .vmd-plate-sec { margin-top: 16px; }
.vmd-dup .vmd-plate-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #6b7280;
}
.vmd-dup .vmd-list-plate { border-style: dashed; border-color: #c9cfdd; }
.vmd-dup .vmd-plate-note { display: block; font-size: 0.76rem; color: #6b7280; }
.vmd-dup .vmd-use-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid #bdebd6;
  border-radius: 10px;
  background: #ecfbf1;
  color: #0b6e4f;
  font-size: 0.88rem;
}
.vmd-dup .vmd-use-note i, .vmd-dup .vmd-use-note svg { flex: 0 0 auto; color: #15803d; font-size: 1.05rem; }
.vmd-dup .vmd-use-note + .vmd-denied { margin-top: 10px; }
.vmd-dup .vmd-use-hint { margin: 8px 2px 4px; font-size: 0.8rem; color: #6b7280; }
/* footer: Cancel (left) · Add as new visitor · Use this visitor / Merge */
.vmd-dup .btn.vdw-use:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.vmd-dup .btn.vdw-use i + span + i, .vmd-dup .btn.vdw-use span + svg { font-size: 0.8rem; }
.vmd-dup .btn.vdw-use.vmd-use-denied { background: #fff; color: #c81e1e; border-color: #e7a3a3; }
.vmd-dup .btn.vdw-use.vmd-use-denied:hover,
.vmd-dup .btn.vdw-use.vmd-use-denied:focus { background: #fde8e8; color: #c81e1e; border-color: #c81e1e; box-shadow: 0 0 0 3px rgba(200, 30, 30, .12); }
@media (max-width: 575.98px) {
  .vmd-dup .vdw-actions { flex-direction: column-reverse; align-items: stretch; padding: 12px 16px 16px; gap: 8px; }
  .vmd-dup .vdw-actions .btn { width: 100%; }
  .vmd-dup .btn.vdw-back { margin-right: 0; }
}

/* Merge refused (2026-11-16) — "Can't merge" dialog: .vmr-* inside .swal2-popup.vmr-popup only */
.swal2-popup.vmr-popup {
    border-radius: 16px;
    overflow: hidden;
}
.swal2-popup.vmr-popup .swal2-html-container,
.swal2-popup.vmr-popup .swal2-content {
    margin: 0;
    padding: 0;
}
.vmr {
    position: relative;
    text-align: left;
    color: #1f2a44;
}
.vmr .vmr-close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #8a94a6;
    font-size: 18px;
    cursor: pointer;
}
.vmr .vmr-close:hover {
    background: #f1f3f8;
    color: #1f2a44;
}
.vmr .vmr-hero {
    padding: 30px 28px 6px;
    text-align: center;
}
.vmr .vmr-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fff4e5;
    box-shadow: 0 0 0 8px #fffaf2;
    color: #e07b00;
    margin-bottom: 16px;
}
.vmr .vmr-badge i,
.vmr .vmr-badge svg {
    font-size: 28px;
}
.vmr .vmr-title {
    margin: 0 0 8px;
    font-size: 21px;
    font-weight: 700;
    color: #1f2a44;
}
.vmr .vmr-sub {
    margin: 0 auto;
    max-width: 440px;
    font-size: 15px;
    line-height: 1.5;
    color: #5b6478;
}
.vmr .vmr-sub.vmr-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: none;
    margin-top: 6px;
    padding: 12px 16px;
    border: 1px solid #f5c26b;
    border-left: 4px solid #e07b00;
    border-radius: 10px;
    background: #fff6e6;
    color: #5a3a00;
    font-size: 15.5px;
    text-align: left;
}
.vmr .vmr-sub.vmr-note i,
.vmr .vmr-sub.vmr-note svg {
    flex-shrink: 0;
    margin-top: 3px;
    color: #e07b00;
    font-size: 17px;
}
.vmr .vmr-sub.vmr-note strong {
    color: #3d2700;
}
.vmr .vmr-sub.vmr-note .vmr-em {
    color: #b45309;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
}
.vmr .vmr-cards {
    display: grid;
    gap: 12px;
    padding: 18px 28px 0;
}
.vmr .vmr-card {
    border: 1px solid #e4e8f0;
    border-radius: 12px;
    background: #f8f9fc;
    overflow: hidden;
}
.vmr .vmr-card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-bottom: 1px solid #e4e8f0;
}
.vmr .vmr-num {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #2b3a6b;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}
.vmr .vmr-addr {
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.vmr .vmr-addr strong {
    font-size: 15px;
    color: #1f2a44;
    overflow-wrap: anywhere;
}
.vmr .vmr-addr span {
    font-size: 13px;
    color: #6b7489;
}
.vmr .vmr-people {
    list-style: none;
    margin: 0;
    padding: 8px 14px;
}
.vmr .vmr-people li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
    font-size: 15px;
}
.vmr .vmr-people li i,
.vmr .vmr-people li svg {
    color: #9aa3b5;
    font-size: 13px;
    width: 14px;
}
.vmr .vmr-name {
    font-weight: 600;
    min-width: 0;
    overflow-wrap: anywhere;
}
.vmr .vmr-type {
    margin-left: auto;
    flex-shrink: 0;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: #e8eefc;
    color: #2f5bd3;
}
.vmr .vmr-type-permanent {
    background: #e3f6ec;
    color: #1d8a4e;
}
.vmr .vmr-type-denied,
.vmr .vmr-type-temporary_denied {
    background: #fdecec;
    color: #c0392b;
}
.vmr .vmr-tip {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 16px 28px 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: #eef3ff;
    color: #2b3a6b;
    font-size: 14px;
    line-height: 1.45;
}
.vmr .vmr-tip i,
.vmr .vmr-tip svg {
    color: #f0a500;
    font-size: 16px;
    margin-top: 2px;
}
.vmr .vmr-actions {
    display: flex;
    justify-content: center;
    padding: 22px 28px 26px;
}
.vmr .vmr-ok-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 180px;
    height: 48px;
    border-radius: 10px;
    background: #2b3a6b;
    color: #fff;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}
.vmr .vmr-ok-btn i,
.vmr .vmr-ok-btn svg {
    top: 0;
}
.vmr .vmr-ok-btn:hover,
.vmr .vmr-ok-btn:focus {
    background: #1f2b52;
    color: #fff;
}
@media (max-width: 520px) {
    .vmr .vmr-hero {
        padding: 26px 18px 4px;
    }
    .vmr .vmr-cards {
        padding: 16px 18px 0;
    }
    .vmr .vmr-tip {
        margin: 14px 18px 0;
    }
    .vmr .vmr-actions {
        padding: 20px 18px 22px;
    }
    .vmr .vmr-ok-btn {
        width: 100%;
    }
}

/* ══ Step 15 (client 2026-11-17) — Visitors List: merge many groups at once + in-page merge queue ═══════════════
   documentation/duplicate-visitors-plan.md Step 15. Scoped to .vmg-* (group screen, .vmg-popup), .vmq-* (queue chip +
   row states, only rendered on the Visitors List) and #visitor-batch-menu.vbl-actions (that page's buttons). */

/* Merge / Export / Delete buttons (instead of the Batch Actions dropdown) — Visitors List only */
#visitor-batch-menu.vbl-actions { display: inline-flex; flex-wrap: wrap; gap: 8px; vertical-align: middle; }
/* Same box as the Batch Actions button on the other lists (btn btn-custom btn-sm vra-batch-toggle, measured
   2026-11-17): 50px high, padding 8px 12px, Segoe UI 16px / 400, line-height 2, radius 8px, 6px icon gap, 16px icon. */
#visitor-batch-menu .vbl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 50px; padding: 8px 12px; border-radius: 8px; border: 1px solid #d5dbe7;
  font-family: 'Segoe UI', sans-serif; font-size: 16px; font-weight: 400; line-height: 2;
  background: #fff; color: #202B56; transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
#visitor-batch-menu .vbl-btn i,
#visitor-batch-menu .vbl-btn svg { position: static; top: 0; font-size: 16px; line-height: 1; }
/* Merge = the Batch Actions colours (btn-custom navy, darker on hover) */
#visitor-batch-menu .vbl-btn--merge { background: #202B56; border-color: #202B56; color: #FEFEFE; }
#visitor-batch-menu .vbl-btn--merge:hover,
#visitor-batch-menu .vbl-btn--merge:focus { background: #161F40; border-color: #161F40; color: #FEFEFE; }
#visitor-batch-menu .vbl-btn--export { color: #15803d; border-color: #b7e4c7; }
#visitor-batch-menu .vbl-btn--export:hover { background: #f0fdf4; border-color: #16a34a; color: #15803d; }
#visitor-batch-menu .vbl-btn--delete { color: #c62828; border-color: #f1c4c4; }
#visitor-batch-menu .vbl-btn--delete:hover { background: #fdecec; color: #a61b1b; }
/* nothing ticked: still visible (so officers know they are there), greyed */
#visitor-batch-menu:not(.ba-has-selection) .vbl-btn { opacity: .5; }

/* ── "Merge N groups" screen ── (2026-11-18: each card holds the single merge's own .vmd-all / .vmd-list-head /
   .vmd-row markup and step 2 is the single merge's .vmd-summary + .vmd-confirm, so they look the same — nothing
   below restyles those; it only frames the cards.) */
.vmg .vmd-body { max-height: min(62vh, 640px); overflow-y: auto; }
.vmg-cards { display: flex; flex-direction: column; gap: 12px; }
.vmg-card { border: 1px solid #dfe5f0; border-radius: 12px; overflow: hidden; background: #fff; }
.vmg-card-head { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: #fff; border-bottom: 1px solid #dfe5f0; }
.vmg-num {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%;
  background: #202B56; color: #fff; font-size: 0.75rem; font-weight: 700;
}
.vmg-addr { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.vmg-addr strong { font-size: 0.9rem; color: #111827; overflow-wrap: anywhere; }
.vmg-addr span { font-size: 0.76rem; color: #6b7280; }
/* fewer than 2 ticked: the group is not merged — dim its rows, keep the boxes / buttons usable */
.vmg-card.is-off .vmd-rows { opacity: .6; }
.vmg-note { display: flex; gap: 8px; padding: 8px 16px; background: #fff6f6; color: #a61b1b; font-size: 0.8rem; border-top: 1px solid #f6d5d5; }
.vmg-note--off { background: #f6f8fc; color: #4b5563; border-top-color: #e5e9f1; }
.vmg-note i, .vmg-note svg { margin-top: 3px; flex: 0 0 auto; }
.vmg-skipped { margin-top: 12px; border: 1px dashed #d5dbe7; border-radius: 10px; padding: 10px 14px; font-size: 0.8rem; color: #4b5563; background: #fff; }
.vmg-skipped-title { font-weight: 700; color: #202B56; margin-bottom: 4px; }
.vmg-skipped-title i, .vmg-skipped-title svg { margin-right: 6px; }
.vmg-skipped ul { margin: 0; padding-left: 18px; }
@media (max-width: 680px) {
  .vmg-card-head { flex-wrap: wrap; }
}

/* ── merge queue: row states (Visitors List table) ── */
#visitor-tbl tr.vmq-busy > td { opacity: .55; }
#visitor-tbl tr.vmq-busy > td:first-child { opacity: 1; }
#visitor-tbl .vmq-lock { cursor: not-allowed; }
#visitor-tbl .vmq-pill {
  display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.7rem; font-weight: 700; white-space: nowrap; vertical-align: middle;
}
#visitor-tbl .vmq-pill i, #visitor-tbl .vmq-pill svg { top: 0; }
#visitor-tbl .vmq-pill--busy { background: #e8ecf7; color: #202B56; }
#visitor-tbl .vmq-pill--done { background: #e6f6ee; color: #047857; }
#visitor-tbl .vmq-pill--failed { background: #fde8e8; color: #c81e1e; cursor: help; }
#visitor-tbl tr.vmq-done > td { background: #f2fbf6; }

/* ── merge queue: progress chip (bottom-right) ── */
.vmq-chip {
  position: fixed; right: 80px; bottom: 18px; z-index: 1060; /* right: 80px keeps the page's scroll-to-top button free */ display: none; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  max-width: min(420px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 12px; background: #202B56; color: #fff;
  font-size: 0.84rem; box-shadow: 0 10px 28px rgba(15, 23, 42, .25);
}
.vmq-chip.is-shown { display: flex; }
@media (max-width: 575.98px) { .vmq-chip { right: 16px; bottom: 76px; } }
.vmq-chip.is-done { background: #146c35; }
.vmq-chip.is-failed { background: #8a1c1c; }
.vmq-bar { flex: 1 0 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.vmq-bar > span { display: block; height: 100%; background: #1AD598; transition: width .2s ease; }
.vmq-link { background: none; border: 0; padding: 0; color: #fff; font-weight: 700; text-decoration: underline; cursor: pointer; }
.vmq-x { margin-left: auto; background: none; border: 0; color: #fff; opacity: .8; cursor: pointer; padding: 0 2px; }
.vmq-fails { flex: 1 0 100%; margin: 4px 0 0; padding-left: 18px; font-size: 0.78rem; max-height: 160px; overflow-y: auto; }

/* ══ Step 17 (client 2026-11-20) — "Duplicate names found": the person being added on top + "Why it matched" ══
   JS: visitor_merge_dialog_js (options.duplicate.newRow). Scoped to .vmd-dup .vmd-list-why — the Step 11 screen
   without newRow and the Visitors List merge are unchanged. */
.vmd-dup .vmd-list-why .vmd-list-head,
.vmd-dup .vmd-list-why .vmd-row {
  grid-template-columns: 18px minmax(0, 2fr) minmax(0, 1.55fr) minmax(0, 1.1fr) minmax(0, 0.95fr) minmax(0, 0.95fr) 196px;
}
.vmd-dup .vmd-cell-why { font-size: 0.8rem; color: #374151; overflow-wrap: anywhere; }
.vmd-dup .vmd-group {
  padding: 7px 16px;
  background: #f6f8fc;
  border-bottom: 1px solid #eef0f4;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #4b5563;
}
.vmd-dup .vmd-group-new { background: #ecfbf1; color: #0b6e4f; }
.vmd-dup .vmd-rows + .vmd-group { border-top: 1px solid #e5e9f1; }
.vmd-dup .vmd-row-new { border-bottom: 0; }
.vmd-dup .vmd-badge-new { background: #202B56; color: #fff; }
.vmd-dup .vmd-new-note { background: #f3f5f9; border-color: #dfe5f0; color: #374151; }
.vmd-dup .vmd-new-note i, .vmd-dup .vmd-new-note svg { color: #202B56; }
/* nothing ticked → "Add {name} as new visitor" is the main button (same look as Use this visitor) */
.vdw.vmd-dup .btn.vdw-new.vmd-new-primary { background: #202B56; border-color: #202B56; color: #fff; }
.vdw.vmd-dup .btn.vdw-new.vmd-new-primary:hover,
.vdw.vmd-dup .btn.vdw-new.vmd-new-primary:focus { background: #2c3a72; border-color: #2c3a72; color: #fff; }
@media (max-width: 767.98px) {
  .vmd-dup .vmd-list-why .vmd-row {
    grid-template-columns: 18px minmax(0, 1fr) auto;
    grid-template-areas: "check who who" "check why why" "check plate visits" "check added added" "check master master";
  }
  .vmd-dup .vmd-list-why .vmd-cell-why { grid-area: why; font-size: 0.76rem; color: #4b5563; }
}
/* "Add {name} as new visitor" — option B (user 2026-11-20): with ticked records a 2nd line "Not … — saved as a separate visitor" */
.vmd-dup .vmd-new-main { display: inline-flex; align-items: center; gap: 8px; }
.vmd-dup .vmd-new-sub { display: none; }
.vdw.vmd-dup .btn.vmd-new-btn.vmd-new-2line {
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  max-width: 360px;
  padding-top: 7px;
  padding-bottom: 7px;
  line-height: 1.2;
  text-align: left;
  border-color: #202B56;
}
.vdw.vmd-dup .btn.vmd-new-btn.vmd-new-2line .vmd-new-main { font-weight: 700; }
.vdw.vmd-dup .btn.vmd-new-btn.vmd-new-2line .vmd-new-sub {
  display: block;
  max-width: 100%;
  padding-left: 26px;
  font-size: 0.74rem;
  font-weight: 500;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 575.98px) {
  .vdw.vmd-dup .btn.vmd-new-btn.vmd-new-2line { max-width: none; }
}
/* user 2026-11-20: footer buttons share one height (the 2-line "Add … as new visitor" sets it) + light fill on it */
.vdw.vmd-dup .vdw-actions { align-items: stretch; }
.vdw.vmd-dup .btn.vmd-new-btn.vmd-new-2line { background: #eef1f8; }
.vdw.vmd-dup .btn.vmd-new-btn.vmd-new-2line:hover,
.vdw.vmd-dup .btn.vmd-new-btn.vmd-new-2line:focus { background: #e2e7f2; border-color: #202B56; color: #202B56; }
/* user 2026-11-20: no jump / flash when ticking — every footer button has the same fixed height in every state
   (fits the 2-line "Add … as new visitor"), and the theme's colour/opacity fade is off so it never shows a
   half-way state (dark 2-line button next to a faded "Use this visitor"). Only the Step 17 screen (.vmd-dup-new). */
.vdw.vmd-dup-new .vdw-actions .btn {
  min-height: 52px;
  transition: none;
}
.vdw.vmd-dup-new .btn.vmd-new-btn.vmd-new-2line { padding-top: 4px; padding-bottom: 4px; }
