/* ========================================
   Contact Audit Mode Styling
   Integrates with existing property-geofence-manager.css
   Uses CSS Grid layout (grid-area: map-area)
   ======================================== */

/* ========================================
   MODE TOGGLE
   ======================================== */
.mode-toggle {
    display: inline-flex;
    background: white;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.mode-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 14px;
    border: none;
    background: white;
    color: #6c757d;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    outline: none;
}

.mode-toggle-btn:hover {
    background: #f8f9fa;
}

.mode-toggle-btn.active {
    background: #007bff;
    color: white;
}

/* Color-by toggle (By Manager / By Type) — same look as the mode toggle,
   separate class so the contact-mode jQuery handler doesn't bind to it. */
.color-mode-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 14px;
    border: none;
    background: white;
    color: #6c757d;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    outline: none;
}

.color-mode-btn:hover {
    background: #f8f9fa;
}

.color-mode-btn.active {
    background: #007bff;
    color: white;
}

.mode-icon {
    font-size: 16px;
}

/* ========================================
   CONTACT MODE CONTAINER
   Occupies same grid area as map
   ======================================== */
#contact-mode-container {
    grid-area: map-area;
    display: none; /* Hidden by default */
    background: white;
    overflow: hidden;
    position: relative; /* For absolute positioning of tools panel */
}

/* When active, show as block */
#contact-mode-container.active {
    display: block;
}

/* ========================================
   CENTER AREA (Contact Table)
   Takes full width, tools panel floats over it
   ======================================== */
#contact-center-area {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Contact Mode Header */
.contact-mode-header {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.property-info-header h2 {
    margin: 0 0 10px 0;
    font-size: 24px;
    color: #212529;
}

#contact-stats {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: #6c757d;
}

#duplicates-stat {
    color: #dc3545;
    font-weight: 600;
}

.contact-mode-actions {
    display: flex;
    gap: 10px;
}

/* Alert Banner */
.alert {
    padding: 15px 20px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.alert-warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-icon {
    font-size: 24px;
}

.alert-action-btn {
    margin-left: auto;
    padding: 6px 12px;
    background: #856404;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
}

.alert-action-btn:hover {
    background: #6d5203;
}

/* Contact Table Container */
.contact-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 20px;
}

.contact-table {
    width: 100%;
    min-width: 1200px; /* Prevent squishing */
    border-collapse: collapse;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.contact-table thead {
    background: #343a40;
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.contact-table th {
    padding: 10px 6px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    border-right: 1px solid #495057;
}

.contact-table th:last-child {
    border-right: none;
}

.contact-table tbody tr {
    border-bottom: 1px solid #dee2e6;
    transition: background 0.15s;
}

.contact-table tbody tr:hover {
    background: #f8f9fa;
}

.contact-table td {
    padding: 8px 6px;
    font-size: 13px;
    color: #212529;
}

.duplicate-row {
    background: #fff3cd !important;
    border-left: 4px solid #ffc107;
}

.duplicate-row:hover {
    background: #fff8dc !important;
}

.missing-info-row {
    background: #ffe6e6 !important;
    border-left: 4px solid #dc3545;
}

.missing-info-row:hover {
    background: #ffd6d6 !important;
}

.editable {
    cursor: pointer;
    position: relative;
}

.editable:hover {
    background: #e9ecef;
}

.checkbox-field {
    text-align: center;
    font-weight: 500;
}

.actions-cell {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.action-icon-btn {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.action-icon-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

/* ========================================
   ACTION BUTTONS
   ======================================== */
.action-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    outline: none;
}

.action-btn.primary {
    background: #007bff;
    color: white;
}

.action-btn.primary:hover {
    background: #0056b3;
}

.action-btn.cancel {
    background: #6c757d;
    color: white;
}

.action-btn.cancel:hover {
    background: #5a6268;
}

.action-btn.small {
    padding: 4px 10px;
    font-size: 12px;
}

.action-btn.active {
    background: #ffc107;
    color: #000;
}

/* ========================================
   MODALS
   ======================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #212529;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 1;
}

.modal-close:hover {
    color: #212529;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Custom Role Multi-Select */
.role-multi-select {
    position: relative;
    width: 100%;
}

.role-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s;
}

.role-display:hover {
    border-color: #adb5bd;
}

.role-display.active {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.role-display-text {
    flex: 1;
    font-size: 14px;
    color: #495057;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-display-text.has-selection {
    color: #212529;
}

.role-dropdown-arrow {
    font-size: 10px;
    color: #6c757d;
    margin-left: 8px;
    transition: transform 0.2s;
}

.role-display.active .role-dropdown-arrow {
    transform: rotate(180deg);
}

.role-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
}

.role-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    font-size: 14px;
    color: #212529;
}

.role-option:hover {
    background: #f8f9fa;
}

.role-option input[type="checkbox"] {
    margin-right: 8px;
    cursor: pointer;
}

/* Merge Modal */
.merge-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.merge-column h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: #212529;
}

.merge-contact-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
}

.merge-field {
    padding: 8px 0;
    border-bottom: 1px solid #dee2e6;
}

.merge-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.merge-field input[type="radio"] {
    cursor: pointer;
}

.merge-field-label {
    padding: 6px 0;
    font-size: 13px;
    color: #6c757d;
}

.merge-instructions {
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #007bff;
    border-radius: 4px;
}

.merge-instructions p {
    margin: 0;
    color: #004085;
    font-size: 14px;
}

/* Cross-Property Modal */
.property-list {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 15px 0;
}

.property-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    cursor: pointer;
}

.property-checkbox-item:hover {
    background: #e9ecef;
}

.update-summary {
    margin: 15px 0;
    font-weight: 600;
    color: #212529;
}

.value-change {
    display: flex;
    gap: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.old-value {
    flex: 1;
    color: #dc3545;
}

.new-value {
    flex: 1;
    color: #28a745;
}

/* Contact Edit Form */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #212529;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="tel"],
.form-group input[type="email"],
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

.checkbox-group {
    display: flex;
    gap: 15px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-group input[type="checkbox"] {
    cursor: pointer;
}

/* ========================================
   CROSS-PROPERTY INDICATORS
   ======================================== */
.cross-property-indicator {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 6px;
    border: 1px solid currentColor;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
}

.cross-property-indicator:hover {
    filter: brightness(0.88);
}

.cross-property-indicator.needs-reconciliation {
    color: #1976d2;
    animation: pulse 2s infinite;
}

.cross-property-indicator.reconciled {
    color: #4caf50;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ========================================
   RECONCILIATION PANEL
   ======================================== */
.reconciliation-content {
    max-width: 1000px;
    max-height: 85vh;
}

.reconciliation-header {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.reconciliation-header h3 {
    margin: 0 0 8px 0;
    font-size: 22px;
    color: #212529;
}

.reconciliation-header p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

#reconciliation-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.reconciliation-field {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    border-left: 4px solid #007bff;
    overflow: hidden;
}

.reconciliation-field.no-differences {
    border-left-color: #28a745;
    opacity: 0.7;
}

.reconciliation-field.verified {
    border-left-color: #6c757d;
    background: #e9ecef;
}

.reconciliation-field-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.reconciliation-field-name {
    font-size: 15px;
    font-weight: 600;
    color: #212529;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.reconciliation-field-status {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: 500;
}

.reconciliation-field-status.aligned {
    background: #d4edda;
    color: #155724;
}

.reconciliation-field-status.differs {
    background: #fff3cd;
    color: #856404;
}

.reconciliation-field-status.verified-different {
    background: #e2e3e5;
    color: #383d41;
}

.reconciliation-values {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Property-First Layout */
.reconciliation-properties {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reconciliation-property-row {
    background: white;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
}

.reconciliation-property-row:hover {
    border-color: #adb5bd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.reconciliation-property-row.current {
    border-color: #007bff;
    background: #f0f7ff;
}

.reconciliation-property-row.verified {
    border-color: #6c757d;
    background: #f8f9fa;
}

.property-info {
    flex: 1;
    min-width: 0;
}

.property-name {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
}

.current-badge {
    color: #007bff;
    font-size: 11px;
    font-weight: 500;
}

.property-value {
    font-size: 14px;
    color: #212529;
    word-break: break-word;
}

.verified-badge {
    display: inline-block;
    margin-left: 6px;
    color: #28a745;
    font-size: 12px;
}

.property-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-left: 15px;
}

.property-action-btn {
    padding: 5px 10px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    background: white;
    color: #495057;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.property-action-btn:hover {
    border-color: #adb5bd;
    background: #f8f9fa;
}

.property-action-btn.keep-btn {
    border-color: #6c757d;
    color: #6c757d;
}

.property-action-btn.keep-btn:hover {
    background: #6c757d;
    color: white;
}

.property-action-btn.unkeep-btn {
    border-color: #dc3545;
    color: #dc3545;
}

.property-action-btn.unkeep-btn:hover {
    background: #dc3545;
    color: white;
}

.property-action-btn.change-btn {
    border-color: #ffc107;
    color: #856404;
}

.property-action-btn.change-btn:hover {
    background: #ffc107;
    color: #212529;
}

.property-action-btn.align-btn {
    border-color: #007bff;
    color: #007bff;
}

.property-action-btn.align-btn:hover {
    background: #007bff;
    color: white;
}

.property-edit-inline {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-top: 8px;
}

.reconciliation-value-group {
    background: white;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.reconciliation-value-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.reconciliation-value-text {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    word-break: break-word;
}

.reconciliation-value-text.empty {
    color: #adb5bd;
    font-style: italic;
}

.reconciliation-property-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.reconciliation-property-badge {
    display: inline-block;
    padding: 3px 8px;
    background: #e7f3ff;
    color: #004085;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.reconciliation-property-badge.current {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
}

.reconciliation-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.reconciliation-align-btn {
    padding: 5px 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s;
}

.reconciliation-align-btn:hover {
    background: #0056b3;
}

.reconciliation-align-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.reconciliation-whitelist {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6c757d;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #dee2e6;
}

.reconciliation-whitelist input[type="checkbox"] {
    cursor: pointer;
}

.reconciliation-whitelist label {
    cursor: pointer;
    user-select: none;
}

/* Reconciliation Inline Editing */
.reconciliation-edit-btn {
    padding: 3px 8px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 10px;
    transition: all 0.2s;
}

.reconciliation-edit-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.reconciliation-edit-container {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-top: 10px;
}

.reconciliation-edit-container input[type="text"],
.reconciliation-edit-container textarea,
.reconciliation-edit-container select {
    padding: 6px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
}

.reconciliation-edit-container input[type="text"]:focus,
.reconciliation-edit-container textarea:focus,
.reconciliation-edit-container select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.property-select-container {
    margin-top: 10px;
    padding: 10px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.property-select-container input[type="checkbox"] {
    cursor: pointer;
}

/* Property Context Enhancement */
.property-list-label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.property-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.reconciliation-property-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    background: #e9ecef;
    color: #495057;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.reconciliation-property-badge.current {
    background: #007bff;
    color: white;
    font-weight: 600;
}

/* ========================================
   CONTACT GROUPING & REVIEW
   ======================================== */

/* Contact audit toolbar */
.contact-audit-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #fff3cd;
    border-bottom: 1px solid #ffc107;
    margin-bottom: 0;
}

.toolbar-message {
    flex: 1;
}

#duplicate-message {
    font-size: 14px;
    color: #856404;
    font-weight: 500;
}

#duplicate-message .alert-icon {
    font-size: 16px;
    margin-right: 6px;
}

#review-all-contacts-btn {
    background: #ffc107;
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#review-all-contacts-btn:hover {
    background: #ffca2c;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Group headers in table */
.contact-group-header {
    background: #fff3cd;
    border-top: 2px solid #ffc107;
    border-bottom: 2px solid #ffc107;
    border-left: 4px solid #ff9800;
}

.contact-group-header td {
    padding: 10px 16px !important;
    font-weight: 700;
    color: #333;
    position: relative;
}

.contact-group-header td > * {
    vertical-align: middle;
}

.group-title {
    font-size: 13px;
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #1a1a1a;
    line-height: 32px;
}

.group-title::before {
    content: '▸';
    color: #ff9800;
    font-size: 14px;
    margin-right: 6px;
}

.review-group-btn {
    float: right;
    background: #ffc107;
    color: #000;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.review-group-btn:hover {
    background: #ffca2c;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.grouped-row {
    background: #f8f9fa;
}

.grouped-row:hover {
    background: #e9ecef !important;
}

.cross-property-row {
    background: #fffbeb !important;
    border-left: 4px solid #ff9800;
}

.cross-property-row:hover {
    background: #fff9e6 !important;
}

/* ========================================
   CAROUSEL MODAL
   ======================================== */

.carousel-modal-content {
    max-width: 950px;
    width: 92%;
    max-height: 92vh;
    overflow-y: auto;
}

.carousel-header-content {
    flex: 1;
}

.carousel-header-content h2 {
    margin: 0 0 6px 0;
    font-size: 22px;
}

.queue-progress {
    font-size: 13px;
    color: #666;
    font-weight: normal;
}

.carousel-property-info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 18px 20px;
    border-radius: 6px;
    margin-bottom: 24px;
    border-left: 5px solid #2196F3;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.carousel-property-info .property-name {
    margin: 0 0 10px 0;
    color: #1565c0;
    font-size: 18px;
    font-weight: 600;
}

.carousel-property-info .duplicate-info {
    color: #495057;
    font-size: 14px;
    font-weight: 500;
}

.merge-container-carousel {
    min-height: 320px;
    padding: 12px 0;
}

.carousel-navigation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 28px;
    padding: 24px 0 12px 0;
    border-top: 2px solid #dee2e6;
}

.carousel-nav-btn {
    padding: 10px 24px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 110px;
}

.carousel-nav-btn:hover:not(:disabled) {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.carousel-nav-btn:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    background: #adb5bd;
}

.carousel-dots {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0 8px;
}

.carousel-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ccc;
    transition: all 0.3s;
    cursor: pointer;
    border: 2px solid transparent;
}

.carousel-dot.active {
    background: #2196F3;
    transform: scale(1.4);
    box-shadow: 0 0 10px rgba(33, 150, 243, 0.6);
    border-color: #1976D2;
}

.carousel-dot.complete {
    background: #28a745;
    border-color: #1e7e34;
}

.carousel-dot:hover:not(.active) {
    transform: scale(1.2);
    background: #999;
}

#finished-merging-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #6c757d;
}

#finished-merging-btn:not(:disabled) {
    background: #28a745;
}

#finished-merging-btn:not(:disabled):hover {
    background: #218838;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1400px) {
    .merge-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1200px) {
    .contact-table {
        min-width: 900px;
        font-size: 12px;
    }

    .contact-table th,
    .contact-table td {
        padding: 6px 8px;
    }
}

/* ========================================
   CONTACT MODE LEGEND (sidebar footer)
   Sits in the "contact-legend" grid row; hidden unless Contacts mode
   ======================================== */
#contact-legend {
    grid-area: contact-legend;
    display: none;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    border-right: 1px solid #ddd;
    padding: 10px 12px;
    box-sizing: border-box;
}

#contact-legend.active {
    display: block;
}

.legend-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 8px;
}

.legend-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.legend-items li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11px;
    color: #495057;
    line-height: 1.35;
}

.legend-icon {
    flex: 0 0 16px;
    text-align: center;
    font-size: 12px;
    line-height: 1.35;
}

/* Colors mirror the property-list indicators (.geofence-indicator.*) */
.legend-icon.dup { color: #f9a825; }
.legend-icon.sync { color: #1976d2; }
.legend-icon.missing { color: #d32f2f; font-weight: bold; }
.legend-icon.ok { color: #388e3c; font-weight: bold; }

.legend-text strong { color: #212529; font-weight: 600; }

/* All-clear state for the contact audit toolbar (green instead of amber) */
.contact-audit-toolbar.all-clear {
    background: #d4edda;
    border-bottom-color: #28a745;
}

.contact-audit-toolbar.all-clear #duplicate-message {
    color: #155724;
}

/* ========================================
   SYNC PANEL — progressive disclosure
   Differences expand; matching fields collapse to one line
   ======================================== */
.sync-all-clear {
    padding: 16px;
    background: #d4edda;
    border: 1px solid #28a745;
    border-radius: 6px;
    color: #155724;
    font-size: 14px;
    font-weight: 500;
}

.sync-matched {
    padding: 10px 14px;
    background: #f1f8f4;
    border: 1px solid #c3e6cb;
    border-radius: 6px;
    color: #2d6a4f;
    font-size: 13px;
}

.sync-diff-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-left: 4px solid #ff9800;
    border-radius: 6px;
    padding: 14px 16px;
}

.sync-diff-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.sync-diff-field {
    font-size: 15px;
    font-weight: 700;
    color: #212529;
}

.sync-diff-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 3px;
    background: #fff3cd;
    color: #856404;
}

.sync-values {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sync-value-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.sync-value-row.recommended {
    background: #e7f3ff;
    border-color: #9ec8f0;
}

.sync-value-info {
    min-width: 0;
    flex: 1;
}

.sync-value-text {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    word-break: break-word;
}

.sync-value-text.empty {
    color: #adb5bd;
    font-style: italic;
    font-weight: 400;
}

.sync-value-props {
    font-size: 12px;
    color: #6c757d;
    margin-top: 2px;
}

.sync-use-btn {
    flex: 0 0 auto;
    padding: 6px 14px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
}

.sync-use-btn:hover {
    background: #0056b3;
}

.sync-recommend {
    margin-top: 10px;
    font-size: 12px;
    color: #495057;
}

.sync-recommend strong {
    color: #212529;
}

.sync-diff-footer {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
}

.sync-intent-btn {
    padding: 5px 12px;
    background: transparent;
    border: 1px solid #ced4da;
    border-radius: 4px;
    color: #6c757d;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.sync-intent-btn:hover {
    background: #6c757d;
    color: #fff;
    border-color: #6c757d;
}

.sync-resolved-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.sync-resolved-text {
    font-size: 13px;
    color: #6c757d;
}

.sync-resolved-icon {
    color: #28a745;
    font-weight: bold;
}

.sync-undo-btn {
    flex: 0 0 auto;
    padding: 4px 12px;
    background: transparent;
    border: 1px solid #ced4da;
    border-radius: 4px;
    color: #495057;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.sync-undo-btn:hover {
    background: #e9ecef;
}

/* ========================================
   CONTACT MODE — first-run guidance
   ======================================== */
.contact-mode-intro {
    margin: 16px 20px;
    padding: 14px 18px;
    background: #e7f3ff;
    border: 1px solid #b3d7f5;
    border-left: 4px solid #1976d2;
    border-radius: 6px;
}

.contact-mode-intro p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: #2c3e50;
}
