/* Executive Header Action Controls */
.upload-bespoke {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.action-btn-upload {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--ux-surface);
  border: 1px solid var(--ux-line-2);
  border-radius: 8px;
  padding: 0 12px;
  height: 34px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ux-ink);
  transition: all 0.2s var(--ux-ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
  user-select: none;
}

.action-btn-upload input[type="file"] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.action-btn-upload:hover,
.action-btn-upload.dragover {
  border-color: var(--ux-accent);
  background: var(--ux-surface-2);
  color: var(--ux-accent);
  transform: translateY(-1px);
}

.action-btn-upload.has-file {
  background: color-mix(in srgb, var(--ux-accent) 10%, var(--ux-surface));
  border-color: color-mix(in srgb, var(--ux-accent) 30%, var(--ux-line-2));
  color: var(--ux-accent);
}

.action-btn-upload svg {
  color: var(--ux-accent);
  flex-shrink: 0;
}

.action-btn-mapping {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: var(--ux-surface);
  border: 1px solid var(--ux-line-2);
  border-radius: 8px;
  color: var(--ux-ink);
  cursor: pointer;
  transition: all 0.2s var(--ux-ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.action-btn-mapping:hover {
  background: var(--ux-surface-2);
  border-color: var(--ux-accent);
  color: var(--ux-accent);
  transform: translateY(-1px);
}

.action-btn-mapping svg {
  color: var(--ux-accent);
}

.action-btn-mapping[aria-expanded="true"] {
  background: color-mix(in srgb, var(--ux-accent) 14%, var(--ux-surface));
  border-color: var(--ux-accent);
  color: var(--ux-accent);
}

/* Mapping Container */
/* Mapping Container - Corporate MNC Compact Style */
.mapping-container {
  background: var(--ux-surface);
  border: 1px solid var(--ux-line-2);
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: 0 4px 20px -6px var(--ux-shadow);
  animation: slideFadeIn 0.25s var(--ux-ease);
}

.mapping-container[hidden] {
  display: none;
}

@keyframes slideFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.mapping-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ux-line);
}

.mapping-title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mapping-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ux-ink);
  letter-spacing: -0.01em;
}

.mapping-subtitle {
  font-size: 11.5px;
  color: var(--ux-ink-3);
  margin: 0;
}

.mapping-badge {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ux-accent-2) 14%, var(--ux-surface));
  color: var(--ux-accent-2);
  border: 1px solid color-mix(in srgb, var(--ux-accent-2) 25%, transparent);
}

/* Mapping Sections */
.mapping-section {
  padding: 10px 0;
  border-bottom: 1px solid var(--ux-line);
}

.mapping-section:last-of-type {
  border-bottom: none;
  padding-bottom: 4px;
}

.mapping-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.mapping-section-header.between {
  justify-content: space-between;
}

.mapping-sec-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mapping-section-tag {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1.5px 5px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ux-accent) 14%, var(--ux-surface));
  color: var(--ux-accent);
}

.mapping-section-tag.optional {
  background: var(--ux-surface-2);
  color: var(--ux-ink-3);
}

.mapping-section-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--ux-ink);
}

.required-star {
  color: #ef4444;
  margin-left: 2px;
}

.btn-add-dimension {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid var(--ux-line-2);
  background: var(--ux-surface-2);
  color: var(--ux-ink);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s var(--ux-ease);
}

.btn-add-dimension:hover {
  background: var(--ux-surface-3);
  border-color: var(--ux-accent-2);
  color: var(--ux-accent);
}

.dimensions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dimension-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ux-surface-2);
  border: 1px solid var(--ux-line);
  border-radius: 6px;
  padding: 6px 10px;
  transition: border-color 0.15s ease;
}

.dimension-row:hover {
  border-color: var(--ux-line-2);
}

.dim-index-tag {
  font-size: 11px;
  font-weight: 700;
  color: var(--ux-ink-3);
  width: 22px;
  flex-shrink: 0;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.dim-field-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dim-col-block {
  flex: 1.3;
  min-width: 0;
}

.dim-alias-block {
  flex: 1;
  min-width: 0;
}

.dim-field-sublabel {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ux-ink-3);
}

.dimension-label-input {
  width: 100%;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--ux-line-2);
  border-radius: 5px;
  background: var(--ux-surface);
  color: var(--ux-ink);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s ease;
}

.dimension-label-input:focus {
  border-color: var(--ux-accent);
  box-shadow: 0 0 0 2px var(--ux-accent-soft);
}

.btn-remove-dim {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ux-ink-3);
  cursor: pointer;
  transition: all 0.15s ease;
  flex-shrink: 0;
  margin-top: 14px;
}

.btn-remove-dim:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.field-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-control label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ux-ink-2);
}

.select-wrapper {
  position: relative;
  width: 100%;
}

/* Hide native select visually while keeping accessible for form logic */
.select-wrapper select {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

/* Custom Select Trigger Button */
.custom-select-trigger {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--ux-line-2);
  border-radius: 6px;
  background: var(--ux-surface-2);
  color: var(--ux-ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 0 10px;
  cursor: pointer;
  transition: all 0.18s var(--ux-ease);
  text-align: left;
  user-select: none;
}

.custom-select-trigger:hover {
  border-color: var(--ux-accent-2);
  background: var(--ux-surface);
}

.select-wrapper.is-open .custom-select-trigger {
  border-color: var(--ux-accent);
  background: var(--ux-surface);
  box-shadow: 0 0 0 3px var(--ux-accent-soft);
}

.custom-select-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-select-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ux-ink-2);
  transition: transform 0.22s var(--ux-ease);
  flex-shrink: 0;
}

.select-wrapper.is-open .custom-select-arrow {
  transform: rotate(180deg);
  color: var(--ux-accent);
}

.select-wrapper.is-disabled .custom-select-trigger {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--ux-surface-2);
  border-color: var(--ux-line);
}

/* Custom Select Menu Popup */
.custom-select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  min-width: 200px;
  max-width: calc(100vw - 32px);
  background: var(--ux-surface);
  border: 1px solid var(--ux-line-2);
  border-radius: 10px;
  box-shadow: 0 10px 30px -5px var(--ux-shadow-strong), 0 4px 12px var(--ux-shadow);
  z-index: 100;
  overflow: hidden;
  animation: dropdownIn 0.2s var(--ux-ease);
}

/* Align right if near screen edge */
.custom-select-menu.align-right {
  left: auto;
  right: 0;
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Search Input Bar inside dropdown */
.custom-select-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--ux-line);
  background: var(--ux-surface-2);
}

.custom-select-search-wrap .search-icon {
  position: absolute;
  left: 18px;
  color: var(--ux-ink-3);
  pointer-events: none;
}

.custom-select-search {
  width: 100%;
  min-height: 32px;
  padding: 0 10px 0 28px;
  border: 1px solid var(--ux-line-2);
  border-radius: 6px;
  background: var(--ux-surface);
  color: var(--ux-ink);
  font: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.custom-select-search:focus {
  border-color: var(--ux-accent);
  box-shadow: 0 0 0 2px var(--ux-accent-soft);
}

/* Options List & Bespoke Scrollbar */
.custom-select-list {
  max-height: 220px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--ux-line-2) transparent;
}

.custom-select-list::-webkit-scrollbar {
  width: 6px;
}

.custom-select-list::-webkit-scrollbar-track {
  background: transparent;
}

.custom-select-list::-webkit-scrollbar-thumb {
  background: var(--ux-line-2);
  border-radius: 6px;
}

.custom-select-list::-webkit-scrollbar-thumb:hover {
  background: var(--ux-ink-3);
}

/* Option Items */
.custom-select-option {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ux-ink);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.custom-select-option:hover,
.custom-select-option.is-focused {
  background: var(--ux-accent-soft);
  color: var(--ux-accent);
}

.custom-select-option.is-selected {
  background: color-mix(in srgb, var(--ux-accent) 15%, var(--ux-surface));
  color: var(--ux-accent);
  font-weight: 600;
}

.custom-select-empty {
  padding: 16px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--ux-ink-3);
}

.mapping-footer {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ux-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.calc-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  border-radius: 6px;
  min-height: 32px;
  padding: 0 14px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s var(--ux-ease);
}

.calc-btn.primary {
  background: var(--ux-accent);
  color: var(--ux-accent-ink);
  box-shadow: 0 1px 3px var(--ux-shadow);
}

.calc-btn.primary:hover {
  background: var(--ux-accent-2);
  box-shadow: 0 2px 6px var(--ux-shadow);
}

.calc-btn.secondary {
  background: var(--ux-surface-2);
  color: var(--ux-ink-2);
  border: 1px solid var(--ux-line-2);
}

.calc-btn.secondary:hover {
  background: var(--ux-surface-3);
  color: var(--ux-ink);
  border-color: var(--ux-line);
}

.upload-summary-bar {
  margin: 0;
  padding: 5px 10px;
  border-radius: 4px;
  background: var(--ux-surface-2);
  border-left: 2px solid var(--ux-accent);
  font-size: 11px;
  color: var(--ux-ink-2);
  flex: 1;
  min-width: 240px;
}

.upload-error {
  font-size: 12px;
  line-height: 1.5;
  color: var(--ux-danger);
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--ux-danger) 8%, var(--ux-surface));
  border: 1px solid color-mix(in srgb, var(--ux-danger) 20%, transparent);
}
