/* NC Select (New_*) */
.nc-select {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--nc-control-font-size-md, 13px);
}

.nc-select.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

.nc-select__trigger {
  position: relative;
}

select[data-nc-select] {
  display: none !important;
  position: static !important;
}

.nc-select__label {
  min-height: var(--nc-control-h-md, 36px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--theme-border-strong, #ced4da);
  border-radius: var(--nc-control-radius-md, 10px);
  padding: 0 var(--nc-control-px-md, 10px);
  background: var(--theme-bg-surface, #fff);
  color: var(--theme-text-primary, #212529);
  font-size: var(--nc-control-font-size-md, 13px);
  line-height: var(--nc-control-line-height, 1.35);
  cursor: pointer;
}

.nc-select__label:focus {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-accent-base) 18%, transparent);
}

.nc-select__value {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.nc-select__trigger-glyph {
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.nc-select__value-text {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nc-select__value-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}

/* Картинка выбранного пункта в свёрнутом поле — тот же вид, что в строке списка.
   flex: 0 0 auto обязателен: поле — flex, и длинное имя сплющивало бы аватар в овал. */
.nc-select__value-icon,
.nc-select__value-icon img {
  flex: 0 0 auto;
}
.nc-select__value-icon img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.nc-select__arrow {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-left: 6px;
  opacity: 0.7;
}

.nc-select__count-badge {
  display: none;
  position: absolute;
  top: 0;
  right: 0;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  align-items: center;
  justify-content: center;
  transform: translate(35%, -35%);
  background: var(--theme-primary, #3b5998);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.nc-select__count-badge.is-visible {
  display: inline-flex;
}

.nc-select.is-open .nc-select__arrow {
  transform: rotate(-135deg);
}

.nc-select__dropdown {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: var(--theme-bg-surface, #fff);
  border: 1px solid var(--theme-border-strong, #ced4da);
  border-radius: 10px;
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.12);
  z-index: 1055;
  display: none;
  max-height: 340px;
  overflow: hidden;
  transform: translateX(var(--nc-select-dropdown-shift-x, 0));
}

.nc-select.is-open .nc-select__dropdown {
  display: flex;
  flex-direction: column;
}

.nc-select--dropdown-min-width .nc-select__dropdown {
  left: 0;
  right: auto;
  width: max(100%, var(--nc-select-dropdown-min-width, 320px));
  max-width: calc(100vw - 16px);
}

.nc-select--dropdown-min-width.nc-select--align-right .nc-select__dropdown {
  left: auto;
  right: 0;
}

.nc-select.is-above .nc-select__dropdown {
  top: auto;
  bottom: calc(100% + 6px);
}

.nc-select__search {
  padding: 8px;
  border-bottom: 1px solid var(--theme-border-strong, #ced4da);
}

.nc-select__search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--theme-border-strong, #ced4da);
  border-radius: 8px;
  background: var(--theme-bg-surface, #fff);
  padding: 4px 6px;
}

.nc-select__search-row:focus-within {
  border-color: var(--theme-primary, #3b5998);
}

.nc-select__search input {
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 4px 6px;
  font-size: 13px;
  background: transparent;
  color: var(--theme-text-primary, #212529);
  box-shadow: none;
  outline: none;
}

.nc-select__actions {
  display: flex;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--theme-border-strong, #ced4da);
}

.nc-select__actions--search {
  padding: 0;
  border-bottom: 0;
  margin-left: auto;
}

.nc-select__actions.is-hidden {
  display: none !important;
}

.nc-select__action-btn {
  border: 1px solid var(--theme-border-strong, #ced4da);
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: 12px;
  padding: 4px 8px;
  cursor: pointer;
}

.nc-select__actions--search .nc-select__action-btn {
  padding: 3px 8px;
  line-height: 1.1;
}

/* Подсветка hover/active для [data-action="all"|"none"] переехала в
   New_Styles/nc-allnone.css — общий компонент «Все / Ничего», чтобы теми же
   стилями пользовались потребители вне селекторов (класс .nc-allnone). */

.nc-select__list {
  overflow: auto;
  max-height: 260px;
  padding: 6px 0;
}

.nc-select__create {
  padding: 6px 8px;
  border-top: 1px solid var(--theme-border-strong, #ced4da);
  background: color-mix(in srgb, var(--theme-bg-surface, #fff) 96%, var(--theme-accent-base) 4%);
}

.nc-select__create-btn {
  width: 100%;
  border: 1px dashed var(--theme-border-strong, #ced4da);
  border-radius: 8px;
  background: transparent;
  color: var(--theme-text-primary, #212529);
  font-size: 12px;
  padding: 6px 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.nc-select__create-btn:hover {
  border-color: var(--theme-accent-base);
  color: var(--theme-accent-base);
  background: color-mix(in srgb, var(--theme-accent-base) 8%, transparent);
}

.nc-select__group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--theme-text-primary, #212529);
}

.nc-select__group-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.6;
}

.nc-select__group-actions {
  display: inline-flex;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.nc-select__group:hover .nc-select__group-actions,
.nc-select__group:focus-within .nc-select__group-actions,
.nc-select__group.is-all-selected .nc-select__group-actions {
  opacity: 1;
  pointer-events: auto;
}

.nc-select__group-action {
  border: 1px solid var(--theme-border-strong, #ced4da);
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 11px;
  padding: 1px 6px;
  line-height: 1.2;
  cursor: pointer;
  text-transform: none;
  letter-spacing: normal;
}

.nc-select__group.is-hidden {
  display: none !important;
}

.nc-select__option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.nc-select__option.is-hidden {
  display: none;
}

.nc-select__option.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.nc-select__option.is-selected {
  background: color-mix(in srgb, var(--theme-accent-base) 12%, transparent);
}

[data-layout-mode="dark"] .nc-select__option.is-selected {
  background: color-mix(in srgb, var(--theme-accent-base) 22%, transparent);
}

.nc-select__option:hover:not(.is-disabled),
.nc-select__option.is-highlighted:not(.is-disabled) {
  background: color-mix(in srgb, var(--theme-accent-base) 8%, transparent);
}

.nc-select__option.is-highlighted:not(.is-disabled) {
  outline: 2px solid color-mix(in srgb, var(--theme-accent-base) 30%, transparent);
  outline-offset: -2px;
}

.nc-select__option-check {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.nc-select__option-media {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nc-select__option-icon {
  color: var(--theme-color-resolved, var(--nc-option-color, currentColor));
}

.nc-select__option-media,
.nc-select__option-media img {
  flex: 0 0 auto;
}

.nc-select__option-media img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

/* Флаг страны (data-image-shape="flag") — прямоугольник: в круге флаг не читается.
   Раскрытый список живёт в body (portal), поэтому правило глобальное, не от контейнера. */
.nc-select__option-media img.is-flag,
.nc-select__value-icon img.is-flag {
  width: 22px;
  height: 15px;
  border-radius: 2px;
}

.nc-select__option-text {
  font-size: 14px;
  line-height: 1.3;
}

.nc-select__option-desc {
  font-size: 12px;
  opacity: 0.75;
  margin-top: 2px;
}

.nc-select__option-badge {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid var(--nc-option-color, var(--theme-border-strong, #ced4da));
  color: var(--nc-option-color, inherit);
  padding: 1px 8px;
  line-height: 1.25;
}

.nc-select--chip .nc-select__label {
  border-color: var(--theme-border-strong, #ced4da);
  background: var(--theme-bg-surface, #fff);
  color: var(--theme-text-primary, #212529);
}

.nc-select--chip.is-colored-label .nc-select__label {
  border-color: var(--theme-color-resolved, var(--theme-border-strong, #ced4da));
  background: var(--theme-color-bg, var(--theme-bg-surface, #fff));
  color: var(--theme-color-resolved, var(--theme-text-primary, #212529));
}

.nc-select.is-colored-label .nc-select__label {
  border-color: var(--theme-color-resolved, var(--theme-border-strong, #ced4da));
  background: var(--theme-color-bg, var(--theme-bg-surface, #fff));
  color: var(--theme-color-resolved, var(--theme-text-primary, #212529));
}

/* Декоративный цвет пункта (data-color-scope="icon", филиал): только иконка, поле обычное. */
.nc-select.is-colored-icon .nc-select__value-icon,
.nc-select.is-colored-icon .nc-select__trigger-glyph {
  color: var(--theme-color-resolved, currentColor);
}

.nc-select--chip .nc-select__value-text {
  font-weight: 600;
}

.nc-select-mini .nc-select__label {
  min-height: var(--nc-control-h-sm, 32px);
  padding: 0 var(--nc-control-px-sm, 9px);
  font-size: var(--nc-control-font-size-sm, 12px);
}

.nc-select-mini .nc-select__arrow {
  width: 8px;
  height: 8px;
}

.nc-select--trigger-icon {
  gap: 0;
}

.nc-select--trigger-icon .nc-select__label {
  width: var(--nc-select-trigger-size, var(--nc-control-h-md, 36px));
  min-width: var(--nc-select-trigger-size, var(--nc-control-h-md, 36px));
  height: var(--nc-select-trigger-size, var(--nc-control-h-md, 36px));
  min-height: var(--nc-select-trigger-size, var(--nc-control-h-md, 36px));
  padding: 0;
  justify-content: center;
  position: relative;
}

.nc-select--trigger-icon .nc-select__value {
  flex: 0 0 auto;
  justify-content: center;
}

.nc-select--trigger-icon .nc-select__trigger-glyph {
  display: inline-flex;
}

.nc-select--trigger-icon .nc-select__trigger-glyph > i {
  font-size: 16px;
  line-height: 1;
}

.nc-select--trigger-icon .nc-select__value-icon,
.nc-select--trigger-icon .nc-select__value-text,
.nc-select--trigger-icon .nc-select__arrow {
  display: none;
}

.nc-select--hide-chips .nc-select__chips {
  display: none;
}

.nc-select--trigger-icon.nc-select--chip:not(.is-colored-label) .nc-select__label {
  border-color: var(--theme-border-strong, #ced4da);
  background: var(--theme-bg-surface, #fff);
  color: var(--theme-text-primary, #212529);
}

/* Tree mode: parent node styling */
.nc-select__option--parent .nc-select__option-text {
  font-weight: 600;
}

.nc-select__option--parent.is-tree-partial .nc-select__option-check {
  opacity: 0.45;
}

.nc-select__option--parent.is-tree-all .nc-select__option-check {
  opacity: 1;
}
