/* Dropdowns (shared/js/select.js): a clean replacement for the browser's own select list, on every page of the platform.
   Looks like the text inputs (same height, border and focus ring); the list is a soft white panel with a check on the chosen item.
   Logo colours: indigo for the chosen and highlighted item. */

.dd { position: relative; display: block; width: 100%; min-width: 0; }
.dd.dd-inline { display: inline-block; width: auto; min-width: 150px; vertical-align: middle; }

/* the real <select> stays for forms and validation, but is not seen or clicked */
.dd .dd-native { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; pointer-events: none; }

.dd-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; height: 40px; padding: 0 12px; margin: 0;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-xs); font: inherit; font-size: 14px; text-align: left; cursor: pointer;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
.dd-btn:hover { border-color: var(--faint); }
.dd-btn:focus-visible, .dd.is-open .dd-btn { outline: none; border-color: var(--accent); box-shadow: var(--ring) !important; }
.dd-btn:disabled { background: var(--subtle); color: var(--muted); cursor: not-allowed; opacity: .8; }
.dd-btn .dd-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn.dd-placeholder .dd-val { color: var(--faint); }
.dd-btn svg { flex: none; width: 16px; height: 16px; color: var(--faint); transition: transform var(--mid) var(--ease), color var(--fast); }
.dd.is-open .dd-btn svg { transform: rotate(180deg); color: var(--accent); }
.field.invalid .dd-btn, .touched .dd-native:invalid ~ .dd-btn { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(180, 35, 24, .14) !important; }

/* the list (placed under the button, or above it when there is no room below) */
.dd-menu {
  position: fixed; z-index: 1000; box-sizing: border-box; max-width: min(420px, calc(100vw - 16px)); overflow-y: auto; overscroll-behavior: contain;
  padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  box-shadow: 0 16px 36px -10px rgba(37, 42, 99, .28), 0 2px 6px rgba(16, 24, 40, .08);
  transform-origin: 50% 0; opacity: 0; transform: translateY(-4px) scale(.98); transition: opacity 130ms var(--ease), transform 150ms var(--ease);
}
.dd-menu[hidden] { display: none; }
.dd-menu.dd-up { transform-origin: 50% 100%; transform: translateY(4px) scale(.98); }
.dd-menu.is-open { opacity: 1; transform: none; }
.dd-opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 8px; font-size: 14px; line-height: 1.35; color: var(--text); cursor: pointer; user-select: none; }
.dd-opt .dd-text { flex: 1; min-width: 0; }
.dd-opt svg { flex: none; width: 15px; height: 15px; color: var(--indigo); opacity: 0; }
.dd-opt.dd-empty { color: var(--faint); }
.dd-opt.is-active { background: var(--indigo-tint); }
.dd-opt[aria-selected="true"] { color: var(--indigo); font-weight: 600; }
.dd-opt[aria-selected="true"] svg { opacity: 1; }
.dd-opt[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.dd-group { padding: 8px 10px 3px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.dd-group:not(:first-child) { margin-top: 4px; border-top: 1px solid var(--line); }

@media (pointer: coarse) { .dd-opt { padding: 11px 12px; } .dd-btn { height: 44px; } }
@media (prefers-reduced-motion: reduce), (prefers-reduced-transparency: reduce) { .dd-menu, .dd-btn svg { transition: none; } }
