/* ── Custom Select ────────────────────────────────────────────────────────── */

.csel {
  flex: 1;
  display: flex;
  min-width: 0;
  height: 36px;
  border: 1.5px solid var(--color-border, #eee);
  border-radius: 6px;
  background: var(--color-surface, #fff);
  overflow: hidden;
  box-sizing: border-box;
}

.csel-field {
  flex: 1;
  display: flex;
  align-items: stretch;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  min-width: 0;
}

.csel.is-disabled .csel-field { cursor: default; }

.csel-text {
  flex: 1;
  display: flex;
  align-items: center;
  font-size: 16px;
  color: var(--color-text);
  padding: 0 8px 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.csel-placeholder { color: var(--color-text-muted, #999); }
.csel.is-disabled .csel-text { opacity: 0.5; }

.csel-btn {
  flex-shrink: 0;
  width: 36px;
  align-self: stretch;
  background: var(--color-primary, #004D81);
  display: flex;
  align-items: center;
  justify-content: center;
}

.csel.is-disabled .csel-btn { background: var(--color-border, #ccc); }
.csel-field:active .csel-btn { opacity: 0.8; }

.csel-chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  background-color: #fff;
  -webkit-mask-image: url('/img/dropdown-icon-256.png');
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  mask-image: url('/img/dropdown-icon-256.png');
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  transition: transform 0.15s ease;
  pointer-events: none;
}

.csel.is-open .csel-chevron             { transform: rotate(180deg); }
.csel.is-open.opens-up .csel-chevron   { transform: rotate(0deg); }

/* Portal-Liste (position fixed, per JS gesetzt) */
.csel-list {
  position: fixed;
  z-index: 9000;
  background: var(--color-surface, #fff);
  border: 1.5px solid var(--color-border, #eee);
  border-radius: 6px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-height: 240px; /* Fallback; wird per JS überschrieben */
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  min-width: 160px;
}

.csel-item {
  padding: 12px 14px;
  font-size: 16px;
  color: var(--color-text);
  cursor: pointer;
  border-bottom: 1px solid var(--color-divider, #eee);
  -webkit-tap-highlight-color: transparent;
}

.csel-item:last-child { border-bottom: none; }
.csel-item:active { background: var(--color-divider, #eee); }
.csel-item.is-selected {
  color: var(--color-primary, #004D81);
  font-weight: 500;
}
