/* Phase 2 enhancement review — near-fullscreen spreadsheet workspace */

.bw-wb-review-modal {
  width: 95vw !important;
  max-width: none !important;
  height: 92vh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

/* Three-step Phase 2 preparation (not clickable buttons) */
.bw-wb-load-steps {
  max-width: 42rem;
  margin: 1.5rem auto;
  padding: 0 1rem;
}
.bw-wb-load-step {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.bw-wb-load-step:last-child {
  border-bottom: none;
}
.bw-wb-load-step__num {
  flex: 0 0 1.75rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted, #9aa3b2);
}
.bw-wb-load-step.is-active .bw-wb-load-step__num {
  background: var(--accent, #3b82f6);
  color: #fff;
}
.bw-wb-load-step.is-done .bw-wb-load-step__num {
  background: #15803d;
  color: #fff;
}
.bw-wb-load-step.is-failed .bw-wb-load-step__num {
  background: #b91c1c;
  color: #fff;
}
.bw-wb-load-step__body {
  flex: 1 1 auto;
  min-width: 0;
}
.bw-wb-load-step__title {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 0.2rem;
  color: var(--text, #e8eaed);
}
.bw-wb-load-step__copy {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted, #9aa3b2);
  line-height: 1.35;
}
.bw-wb-load-step__counts {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: var(--muted, #9aa3b2);
}
.bw-wb-load-dots::after {
  content: "";
  animation: bw-wb-dots 1.2s steps(4, end) infinite;
}
@keyframes bw-wb-dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}
@media (prefers-reduced-motion: reduce) {
  .bw-wb-load-dots::after {
    animation: none;
    content: "...";
  }
}
.bw-wb-load-error {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius, 8px);
  background: rgba(185, 28, 28, 0.15);
  color: #fecaca;
  font-size: 0.85rem;
}

.bw-wb-review-modal .conn-modal-header,
.bw-wb-review-header {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
}

.bw-wb-review-header__titles {
  flex: 1 1 auto;
  min-width: 0;
}

.bw-wb-review-modal .conn-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.25;
}

.bw-wb-modal-close {
  flex: 0 0 auto;
  align-self: flex-start;
  margin-left: auto;
}

/* Alert only renders dismiss when it has visible text (see showError). */
.bw-wb-alert {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin: 0 10px 4px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  background: rgba(185, 28, 28, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.bw-wb-alert.hidden,
.bw-wb-alert[hidden] {
  display: none !important;
}

.bw-wb-alert__text {
  flex: 1 1 auto;
  min-width: 0;
}

.bw-wb-alert__dismiss {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

.bw-wb-review-modal .conn-wizard-helper {
  margin: 2px 0 0;
  font-size: 0.75rem;
  line-height: 1.3;
}

.bw-wb-review-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  padding: 6px 10px 4px;
}

.bw-wb-review-footer {
  flex: 0 0 auto;
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--card, #1b1f27);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 10px;
  align-items: center;
}

.bw-wb-footer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.bw-wb-footer-summary {
  color: var(--muted, #9aa3b2);
  font-size: 0.78rem;
  margin-right: 4px;
}

.bw-wb-footer-hint {
  color: #e8b86d;
  font-size: 0.75rem;
  margin-right: 4px;
  max-width: 16rem;
}

.bw-wb-review-footer .btn {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 0.8rem;
}

.bw-wb-btn-primary {
  background: var(--accent, #e67e22) !important;
  border-color: var(--accent, #e67e22) !important;
  color: #111 !important;
  font-weight: 650;
}

.bw-wb-btn-primary:disabled,
.bw-wb-btn-primary[aria-busy="true"] {
  opacity: 0.65;
  cursor: wait;
}

.bw-wb-confirm-progress {
  margin: 0 0 8px;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  line-height: 1.35;
}

.bw-wb-confirm-progress.hidden {
  display: none;
}

.bw-wb-confirm-progress--busy {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
  color: #dbeafe;
}

.bw-wb-confirm-progress--success {
  background: rgba(21, 128, 61, 0.18);
  border: 1px solid rgba(21, 128, 61, 0.4);
  color: #bbf7d0;
}

.bw-wb-confirm-progress--warn {
  background: rgba(230, 126, 34, 0.15);
  border: 1px solid rgba(230, 126, 34, 0.4);
  color: #fde68a;
}

.bw-wb-confirm-progress--error {
  background: rgba(185, 28, 28, 0.18);
  border: 1px solid rgba(185, 28, 28, 0.4);
  color: #fecaca;
}

.bw-wb-progress,
.bw-wb-result {
  max-width: 42rem;
  margin: 0.75rem auto 1rem;
  padding: 0 0.5rem 1rem;
}

.bw-wb-progress h4,
.bw-wb-result h4 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.bw-wb-progress-steps {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.bw-wb-progress-step {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.55rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted, #9aa3b2);
}

.bw-wb-progress-step.is-active {
  border-color: rgba(59, 130, 246, 0.45);
  background: rgba(59, 130, 246, 0.12);
  color: #dbeafe;
}

.bw-wb-progress-step.is-complete {
  border-color: rgba(21, 128, 61, 0.4);
  background: rgba(21, 128, 61, 0.12);
  color: #bbf7d0;
}

.bw-wb-progress-step.is-failed {
  border-color: rgba(185, 28, 28, 0.45);
  background: rgba(185, 28, 28, 0.14);
  color: #fecaca;
}

.bw-wb-progress-step__icon {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  text-align: center;
  font-weight: 700;
}

.bw-wb-progress-dots::after {
  content: ".";
  animation: bw-wb-dots 1.2s steps(4, end) infinite;
}

.bw-wb-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 0.65rem;
}

.bw-wb-progress-bar__indeterminate {
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3b82f6, #93c5fd);
  animation: bw-wb-indeterminate 1.4s ease-in-out infinite;
}

@keyframes bw-wb-indeterminate {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

.bw-wb-progress-status {
  margin: 0 0 0.25rem;
  font-weight: 600;
  color: var(--text, #e8eaed);
}

.bw-wb-progress-counts {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted, #9aa3b2);
}

.bw-wb-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.bw-wb-muted {
  color: var(--muted, #9aa3b2);
}

.bw-wb-btn-secondary {
  background: transparent !important;
  border: 1px solid rgba(255, 255, 255, 0.28) !important;
  color: var(--text, #f3f5f8) !important;
}

.bw-wb-btn-tertiary {
  background: transparent !important;
  border: 1px solid rgba(230, 126, 34, 0.45) !important;
  color: #f0b27a !important;
}

.bw-wb-summary-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  flex: 0 0 auto;
}

.bw-wb-summary-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  padding: 3px 8px;
  background: rgba(0, 0, 0, 0.18);
  min-width: 0;
  flex: 1 1 110px;
}

.bw-wb-summary-card__label {
  color: var(--muted, #9aa3b2);
  font-size: 0.65rem;
  margin-bottom: 1px;
  line-height: 1.2;
}

.bw-wb-summary-card__value {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text, #f3f5f8);
  line-height: 1.2;
}

.bw-wb-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-bottom: 4px;
  flex: 0 0 auto;
}

.bw-wb-tab {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #f3f5f8);
  border-radius: 4px;
  padding: 2px 7px;
  cursor: pointer;
  font-size: 0.72rem;
  line-height: 1.3;
  min-height: 24px;
}

.bw-wb-tab.is-active {
  outline: 1px solid var(--text, #f3f5f8);
  background: rgba(255, 255, 255, 0.12);
}

.bw-wb-tab__badge {
  opacity: 0.75;
  margin-left: 2px;
  font-weight: 600;
}

.bw-wb-tab__unit {
  opacity: 0.55;
  font-size: 0.65rem;
  margin-left: 1px;
}

.bw-wb-toolbar {
  margin-bottom: 4px;
  flex: 0 0 auto;
}

.bw-wb-toolbar__row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-bottom: 4px;
}

.bw-wb-toolbar label,
.bw-wb-search {
  font-size: 0.7rem;
  color: var(--muted, #9aa3b2);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.bw-wb-toolbar input[type="search"],
.bw-wb-toolbar select {
  background: rgba(0, 0, 0, 0.25);
  color: var(--text, #f3f5f8);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  padding: 2px 6px;
  min-height: 26px;
  font-size: 0.75rem;
}

.bw-wb-search input {
  min-width: 160px;
}

.bw-wb-view-toggle {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  overflow: hidden;
}

.bw-wb-view-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text, #f3f5f8);
  padding: 2px 8px;
  cursor: pointer;
  font-size: 0.72rem;
  min-height: 24px;
}

.bw-wb-view-btn.is-active {
  background: rgba(255, 255, 255, 0.12);
}

.bw-wb-bulk {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.bw-wb-bulk .btn,
.bw-wb-toolbar .btn {
  min-height: 24px;
  padding: 2px 7px;
  font-size: 0.7rem;
}

.bw-wb-showing {
  color: var(--muted, #9aa3b2);
  font-size: 0.72rem;
  margin-left: auto;
}

.bw-wb-dest-toolbar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-left: 12px;
}

/* Destination mapping lives inside sticky blue enhancement headers */
.bw-wb-grid thead th.bw-wb-origin-mailing,
.bw-wb-grid thead th.bw-wb-origin-additional,
.bw-wb-enhancement-header {
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  vertical-align: top !important;
  padding-top: 4px !important;
  padding-bottom: 6px !important;
  height: auto !important;
  max-height: none !important;
  line-height: 1.25;
  z-index: 6;
}

.bw-wb-col-header-row th.bw-wb-enhancement-header,
.bw-wb-col-header-row th.bw-wb-origin-mailing,
.bw-wb-col-header-row th.bw-wb-origin-additional {
  overflow: visible !important;
  white-space: normal !important;
  z-index: 6;
}

.bw-wb-header-top {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  max-width: 100%;
}

.bw-wb-enhancement-header .bw-wb-col-label,
.bw-wb-origin-mailing .bw-wb-col-label,
.bw-wb-origin-additional .bw-wb-col-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.bw-wb-field-name {
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.bw-wb-field-name-edit {
  max-width: 100%;
}

.bw-wb-field-name-edit .editable-field__button {
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  background: transparent;
  color: #c5d4f8;
  cursor: pointer;
  opacity: 0.85;
}

.bw-wb-field-name-edit .editable-field__button:hover,
.bw-wb-field-name-edit .editable-field__button:focus-visible {
  opacity: 1;
  color: #fff;
}

.bw-wb-field-name-edit .editable-field__value {
  color: #e8eefc;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bw-wb-mr-prefix {
  opacity: 0.85;
}

.bw-wb-rename-input {
  width: 7.5rem;
  max-width: 100%;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #0f172a;
  background: #fff;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  padding: 1px 4px;
}

.bw-wb-header--missing-dest {
  box-shadow: inset 0 0 0 2px #fbbf24;
}

.bw-wb-header--flash-missing {
  animation: bw-wb-flash-missing 1.2s ease-in-out 2;
}

@keyframes bw-wb-flash-missing {
  0%,
  100% {
    box-shadow: inset 0 0 0 2px #fbbf24;
  }
  50% {
    box-shadow: inset 0 0 0 3px #f59e0b;
  }
}

.bw-wb-show-missing {
  margin-left: 0.5rem;
  font-size: 0.75rem;
  padding: 0.15rem 0.45rem;
}

.bw-wb-dest-map {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2px;
  margin-top: 4px;
  max-width: 100%;
  min-width: 0;
  position: relative;
  z-index: 7;
}

.bw-wb-dest-map.is-muted {
  opacity: 0.55;
}

.bw-wb-dest-map__label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: #9eb6f0;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bw-wb-dest-map__inactive-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  cursor: help;
  outline: none;
}

.bw-wb-dest-map__inactive-wrap:focus-visible {
  box-shadow: 0 0 0 2px rgba(122, 162, 255, 0.55);
  border-radius: 4px;
}

.bw-wb-dest-map__select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 22px;
  font-size: 11px;
  padding: 3px 4px;
  border-radius: 4px;
  border: 1px solid rgba(122, 162, 255, 0.45);
  background: #0f172a;
  color: #e8eaed;
  box-sizing: border-box;
}

.bw-wb-dest-map__select:disabled {
  cursor: inherit;
  opacity: 0.85;
}

.bw-wb-dest-map.is-muted .bw-wb-dest-map__select:disabled {
  cursor: help;
}

.bw-wb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.bw-wb-dest-error {
  color: #f0b4b4;
}

.bw-wb-origin-additional .bw-wb-dest-map__label {
  color: #f0d2a0;
}

.bw-wb-origin-additional .bw-wb-dest-map__select {
  border-color: rgba(212, 163, 90, 0.45);
}

@supports (container-type: inline-size) {
  .bw-wb-enhancement-header,
  .bw-wb-col-header-row th.bw-wb-origin-mailing,
  .bw-wb-col-header-row th.bw-wb-origin-additional {
    container-type: inline-size;
    container-name: wb-enh-header;
  }

  @container wb-enh-header (max-width: 138px) {
    .bw-wb-dest-map__label {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }
  }
}

.bw-wb-workspace {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}

.bw-wb-workspace.has-detail .bw-wb-grid-pane {
  width: 58%;
  flex: 0 0 58%;
}

.bw-wb-grid-pane {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.bw-wb-grid-wrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: auto;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
  height: 100%;
}

.bw-wb-grid-wrap:has(> .bw-wb-grid-scroll) {
  overflow: hidden;
}

.bw-wb-grid-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.bw-wb-grid {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.75rem;
  color: var(--text, #f3f5f8);
}

/* Grouped review grid: explicit column widths — do not stretch to fill viewport */
.bw-wb-grid--grouped {
  table-layout: fixed;
  width: max-content;
  min-width: 0;
}

.bw-wb-grid th,
.bw-wb-grid td {
  padding: 3px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  white-space: nowrap;
  vertical-align: middle;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bw-wb-grid--grouped th,
.bw-wb-grid--grouped td {
  max-width: none;
  box-sizing: border-box;
}

.bw-wb-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #222833;
  font-weight: 650;
  text-align: left;
  font-size: 0.7rem;
}

.bw-wb-group-header-row .bw-wb-group-th {
  top: 0;
  z-index: 5;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.bw-wb-col-header-row th {
  top: 22px;
  z-index: 4;
}

.bw-wb-group-th--system,
.bw-wb-origin-system {
  background: #2c3340 !important;
  color: rgba(220, 226, 235, 0.95);
}

.bw-wb-group-th--system {
  border-right: 2px solid rgba(255, 255, 255, 0.22);
}

.bw-wb-vis-cell {
  padding: 2px 0 !important;
  text-transform: none;
  letter-spacing: 0;
  text-align: center;
  vertical-align: middle;
}

.bw-wb-select-all-cell,
.bw-wb-vis-cell {
  overflow: visible;
}

.bw-wb-select-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  width: 100%;
  min-height: 22px;
  height: 100%;
  cursor: pointer;
}

.bw-wb-select-all input {
  margin: 0;
  cursor: pointer;
  width: 15px;
  height: 15px;
}

.bw-wb-col-header-row .bw-wb-select-all-cell {
  text-align: center;
  vertical-align: middle;
  padding: 2px 4px !important;
}

.bw-wb-vis-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 20px;
  padding: 0;
  margin: 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.25);
  color: rgba(220, 226, 235, 0.95);
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
}

.bw-wb-vis-btn:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.35);
}

/* Connected source: teal */
.bw-wb-group-th--source,
.bw-wb-origin-source {
  background: #143d38 !important;
  color: #b6ebe3;
}

.bw-wb-group-th--source {
  border-right: 3px solid #e8a45a;
}

/* Mailing records: indigo */
.bw-wb-group-th--mailing,
.bw-wb-origin-mailing {
  background: #1e2a4a !important;
  color: #b8c7f5;
}

.bw-wb-group-th--mailing {
  border-right: 3px solid #7aa2ff;
}

/* Additional enhanced fields: amber/plum */
.bw-wb-group-th--additional,
.bw-wb-origin-additional {
  background: #3a2a18 !important;
  color: #f0d2a0;
}

.bw-wb-group-th--additional {
  border-right: 2px solid rgba(240, 210, 160, 0.45);
}

/* Legacy enhanced class → treat like mailing */
.bw-wb-group-th--enhanced,
.bw-wb-origin-enhanced {
  background: #1e2a4a !important;
  color: #b8c7f5;
}

.bw-wb-col-sep-source-end,
.bw-wb-col-sep-mailing,
.bw-wb-col-sep-additional,
.bw-wb-col-sep-enhanced {
  border-left: 3px solid #e8a45a !important;
}

.bw-wb-col-sep-mailing {
  border-left-color: #7aa2ff !important;
}

.bw-wb-col-sep-additional {
  border-left-color: #d4a35a !important;
}

.bw-wb-grid tbody tr:nth-child(even) td.bw-wb-origin-source {
  background: #152f2c;
}

.bw-wb-grid tbody tr:nth-child(odd) td.bw-wb-origin-source {
  background: #12332f;
}

.bw-wb-grid tbody tr:nth-child(even) td.bw-wb-origin-mailing,
.bw-wb-grid tbody tr:nth-child(even) td.bw-wb-origin-enhanced {
  background: #1a243f;
}

.bw-wb-grid tbody tr:nth-child(odd) td.bw-wb-origin-mailing,
.bw-wb-grid tbody tr:nth-child(odd) td.bw-wb-origin-enhanced {
  background: #162038;
}

.bw-wb-grid tbody tr:nth-child(even) td.bw-wb-origin-additional {
  background: #322416;
}

.bw-wb-grid tbody tr:nth-child(odd) td.bw-wb-origin-additional {
  background: #2a1e12;
}

.bw-wb-mapping-groups {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0 14px;
}

.bw-wb-mapping-groups h5 {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted, #9aa3b2);
}

.bw-wb-mapping-groups ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.8rem;
}

.bw-wb-group-sticky-system {
  left: 0;
  z-index: 6 !important;
}

.bw-wb-grid--grouped tbody td.bw-wb-col-sep-enhanced,
.bw-wb-grid--grouped thead th.bw-wb-col-sep-enhanced,
.bw-wb-grid--grouped thead th.bw-wb-col-sep-mailing,
.bw-wb-grid--grouped thead th.bw-wb-col-sep-additional,
.bw-wb-grid--grouped thead th.bw-wb-col-sep-source-end,
.bw-wb-grid--grouped tbody td.bw-wb-col-sep-source-end,
.bw-wb-grid--grouped tbody td.bw-wb-col-sep-mailing,
.bw-wb-grid--grouped tbody td.bw-wb-col-sep-additional {
  box-shadow: inset 3px 0 0 rgba(232, 164, 90, 0.55);
}

.bw-wb-grid tbody tr.is-selected td.bw-wb-sticky-col {
  background: #243044;
}

.bw-wb-grid tbody tr.is-selected {
  background: rgba(80, 140, 255, 0.12);
}

.bw-wb-grid tbody tr.has-conflict {
  box-shadow: inset 3px 0 0 #e07a5f;
}

.bw-wb-grid tbody tr.is-active-row {
  outline: 1px solid rgba(240, 182, 122, 0.7);
  outline-offset: -1px;
}

.bw-wb-grid tbody tr {
  cursor: pointer;
}

.bw-wb-sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #1b1f27;
}

.bw-wb-grid thead .bw-wb-sticky-col {
  z-index: 5;
}

.bw-wb-grid tbody .bw-wb-sticky-col.bw-wb-origin-source {
  background: #12332f;
  z-index: 3;
}

.bw-wb-grid thead .bw-wb-sticky-col.bw-wb-origin-source {
  background: #143d38 !important;
  z-index: 6;
}

.bw-wb-grid tbody .bw-wb-sticky-col.bw-wb-origin-system,
.bw-wb-grid thead .bw-wb-sticky-col.bw-wb-origin-system {
  background: #2c3340 !important;
  z-index: 7;
}

.bw-wb-col-select {
  width: 44px;
  min-width: 44px;
  max-width: 70px;
  padding-left: 4px !important;
  padding-right: 4px !important;
  text-align: center;
  flex: none;
}

.bw-wb-col-status {
  width: 82px;
  min-width: 82px;
  max-width: 150px;
  flex: none;
}

.bw-wb-col-key {
  width: 96px;
  min-width: 96px;
  max-width: 220px;
  flex: none;
}

/* Restore chips for hidden utility columns — outside the data column model */
.bw-wb-hidden-cols {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 0 6px;
}

.bw-wb-restore-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(44, 51, 64, 0.9);
  color: rgba(220, 226, 235, 0.95);
  font-size: 0.68rem;
  cursor: pointer;
  white-space: nowrap;
}

.bw-wb-restore-chip:hover {
  border-color: rgba(125, 206, 160, 0.55);
  color: #b6ebe3;
}

.bw-wb-col-header-row th,
.bw-wb-group-header-row .bw-wb-vis-cell {
  position: relative;
}

.bw-wb-resize-handle {
  position: absolute;
  top: 0;
  right: -2px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 8;
  user-select: none;
  touch-action: none;
}

.bw-wb-resize-handle:hover,
.bw-wb-is-resizing .bw-wb-resize-handle {
  background: rgba(125, 206, 160, 0.35);
}

body.bw-wb-is-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}

body.bw-wb-is-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.bw-wb-col-expand {
  width: 28px;
}

.bw-wb-col-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 8px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.bw-wb-col-wb-select {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.bw-wb-col-wb-select input {
  width: 12px;
  height: 12px;
  margin: 0;
  accent-color: #9b7bff;
  cursor: pointer;
}

.bw-wb-new-col-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 4px;
  border-radius: 3px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: rgba(125, 206, 160, 0.2);
  color: #7dcea0;
  vertical-align: middle;
}

.bw-wb-row-state {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
}

.bw-wb-row-state--changed {
  color: #f0c674;
}

.bw-wb-row-state--unchanged {
  color: var(--muted, #9aa3b2);
}

.bw-wb-row-state--missing_geocode {
  color: #e07a5f;
}

.bw-wb-row-state--conflict {
  color: #ff8f7a;
}

.bw-wb-row-state--ready {
  color: #7dcea0;
}

.bw-wb-row-state--excluded {
  color: #9aa3b2;
  text-decoration: line-through;
}

.bw-wb-cell {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 100%;
}

.bw-wb-cell__mark {
  font-size: 0.65rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.bw-wb-cell--unchanged .bw-wb-cell__val {
  color: var(--text, #f3f5f8);
}

.bw-wb-cell--changed {
  background: rgba(240, 198, 116, 0.12);
  border-radius: 2px;
  padding: 0 2px;
}

.bw-wb-cell--changed .bw-wb-cell__mark {
  color: #f0c674;
}

.bw-wb-cell--added {
  background: rgba(125, 206, 160, 0.12);
  border-radius: 2px;
  padding: 0 2px;
}

.bw-wb-cell--added .bw-wb-cell__mark {
  color: #7dcea0;
}

.bw-wb-cell--blank .bw-wb-cell__val,
.bw-wb-empty {
  color: var(--muted, #9aa3b2);
  opacity: 0.8;
}

.bw-wb-cell--conflict {
  background: rgba(255, 143, 122, 0.15);
  border-radius: 2px;
}

.bw-wb-expand-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text, #f3f5f8);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 1px 3px;
}

.bw-wb-recipient__name {
  font-weight: 600;
  font-size: 0.75rem;
}

.bw-wb-recipient__sub {
  color: var(--muted, #9aa3b2);
  font-size: 0.68rem;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bw-wb-clip {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bw-wb-cat-badge {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.65rem;
  margin-right: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.bw-wb-change-added,
.bw-wb-change-added .bw-wb-val {
  color: #7dcea0;
}

.bw-wb-change-changed,
.bw-wb-change-changed .bw-wb-val {
  color: #f0c674;
}

.bw-wb-change-removed,
.bw-wb-change-removed .bw-wb-val {
  color: #e07a5f;
}

.bw-wb-change-conflict,
.bw-wb-change-conflict .bw-wb-val {
  color: #ff8f7a;
  font-weight: 650;
}

.bw-wb-expand-panel td {
  background: rgba(0, 0, 0, 0.28);
  white-space: normal;
  padding: 8px 10px;
}

.bw-wb-expand-title {
  font-weight: 650;
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.bw-wb-field-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.bw-wb-field-table th,
.bw-wb-field-table td {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 6px;
  white-space: normal;
}

.bw-wb-conflict-triple {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 4px;
}

.bw-wb-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  color: var(--muted, #9aa3b2);
  font-size: 0.72rem;
  flex: 0 0 auto;
}

.bw-wb-pagination .btn {
  min-height: 24px;
  padding: 2px 8px;
  font-size: 0.72rem;
}

.bw-wb-mapping h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
}

.bw-wb-mapping-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 4px 12px;
  margin-bottom: 8px;
  font-size: 0.78rem;
}

.bw-wb-mapping-meta dt {
  color: var(--muted, #9aa3b2);
  font-size: 0.68rem;
}

.bw-wb-mapping-meta dd {
  margin: 0 0 4px;
}

/* Record comparison drawer */
.bw-wb-detail {
  flex: 0 0 42%;
  width: 42%;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.bw-wb-detail__header {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.bw-wb-detail__key {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.bw-wb-detail__identity {
  font-size: 0.8rem;
  color: var(--muted, #9aa3b2);
  margin: 2px 0 0;
}

.bw-wb-detail__nav {
  display: flex;
  gap: 4px;
  align-items: center;
}

.bw-wb-detail__nav .btn {
  min-height: 24px;
  padding: 2px 7px;
  font-size: 0.7rem;
}

.bw-wb-detail__body {
  flex: 1 1 auto;
  overflow: auto;
  padding: 8px 10px;
  min-height: 0;
}

.bw-wb-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.bw-wb-compare-table th,
.bw-wb-compare-table td {
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 4px 6px;
  vertical-align: top;
  white-space: normal;
}

.bw-wb-compare-table th {
  background: rgba(255, 255, 255, 0.04);
  text-align: left;
  font-size: 0.7rem;
}

.bw-wb-compare-section {
  margin: 10px 0 4px;
  font-size: 0.78rem;
  font-weight: 650;
}

.bw-wb-compare-changed td {
  background: rgba(240, 198, 116, 0.08);
}

.bw-wb-compare-added td {
  background: rgba(125, 206, 160, 0.08);
}

.bw-wb-compare-unchanged.is-collapsed {
  display: none;
}

.bw-wb-status-banner {
  flex: 0 0 auto;
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.bw-wb-status-banner--warn {
  background: rgba(240, 198, 116, 0.15);
  color: #f0c674;
}

.bw-wb-status-banner--error {
  background: rgba(224, 122, 95, 0.18);
  color: #ff8f7a;
}

.bw-wb-status-banner--ok {
  background: rgba(125, 206, 160, 0.15);
  color: #7dcea0;
}

@media (max-width: 1100px) {
  .bw-wb-workspace.has-detail {
    flex-direction: column;
  }

  .bw-wb-workspace.has-detail .bw-wb-grid-pane,
  .bw-wb-detail {
    width: 100%;
    flex: 1 1 50%;
  }
}

@media (max-width: 900px) {
  .bw-wb-review-modal {
    width: 98vw;
    height: 96vh;
  }
}

@media (max-width: 720px) {
  .bw-wb-toolbar input[type="search"],
  .bw-wb-toolbar select,
  .bw-wb-tab,
  .bw-wb-view-btn,
  .bw-wb-footer-summary {
    font-size: 16px;
  }
}
