/* Styled select menu — replaces native <select> with a fully styled
   dropdown panel. Uses native <details> for open/close + a small
   click handler to update a hidden input that posts on form submit. */
.dropdown { position: relative; display: block; }
.dropdown > details { margin: 0; }
.dropdown > details > summary {
  list-style: none;
  cursor: pointer;
}
.dropdown > details > summary::-webkit-details-marker { display: none; }

.dropdown__trigger {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
  width: 100%;
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  line-height: 1.4;
}
.dropdown > details[open] > summary > .dropdown__trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(233, 78, 27, 0.18);
}
.dropdown__label {
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dropdown__label.is-placeholder { color: var(--ink-faint); }
.dropdown__caret {
  font-size: 0.7rem;
  color: var(--ink-muted);
  flex-shrink: 0;
}
.dropdown__menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  margin: 0;
  padding: 0.5rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.1);
  z-index: 25;
  max-height: 18rem;
  overflow-y: auto;
}
/* `.dropdown--up` is set by dropdown_controller when the menu would
   hang off the bottom of the viewport (or otherwise look awkward
   below the trigger — e.g. a dropdown near the bottom of a modal).
   Anchors the menu above the trigger instead. */
.dropdown--up .dropdown__menu {
  top: auto;
  bottom: calc(100% + 0.35rem);
}
.dropdown__menu > li { margin: 0; }
.dropdown__item {
  display: block;
  width: 100%;
  min-height: 2rem;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1rem;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.3;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.08s ease;
}
.dropdown__item:hover {
  background: rgba(28, 27, 24, 0.06);
}
/* Keep the selected pill on hover — neutral overlay fights with the
   accent-soft background otherwise. */
.dropdown__item.is-selected:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.dropdown__item:hover { color: var(--ink); }
.dropdown__item.is-selected {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}
/* Override the global button focus/active behavior — no translation,
   inset focus ring so it doesn't clip past the rounded panel edge. */
.dropdown__item:active { transform: none; }
.dropdown__item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

/* Multi-select item — checkbox + label side-by-side. Same hover/
   focus rules as the regular item but no .is-selected accent state
   (the checkbox checked-ness is the visual signal). */
.dropdown__item--check {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
  white-space: normal;
  cursor: pointer;
}
.dropdown__item--check > input[type="checkbox"] {
  margin: 0;
  flex: 0 0 auto;
}
