.commune-search {
  position: relative;
  min-width: 0;
  font: 0.9rem var(--site-font);
}

.commune-search > :is(input, [contenteditable]) {
  appearance: textfield;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--border, #ddd7d9);
  border-radius: 8px;
  background: var(--account-field, #f9f7f7);
  color: var(--text, #1f1f1f);
  font: inherit;
}

.commune-search > [contenteditable] {
  min-height: calc(1lh + 22px);
  overflow: auto hidden;
  scrollbar-width: none;
  white-space: nowrap;
}

.commune-search > [contenteditable]:empty::before {
  content: attr(data-placeholder);
  color: var(--muted, #666);
  pointer-events: none;
}

.commune-search label {
  display: block;
  margin-bottom: 5px;
  font-weight: 600;
}

/* Safari peut afficher son bouton Contacts même avec autocomplete="off". */
.commune-search > input::-webkit-contacts-auto-fill-button,
#listing-form input[autocomplete="off"]::-webkit-contacts-auto-fill-button {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
}

.commune-options {
  max-height: min(230px, 40vh);
  overflow-y: auto;
  margin: 5px 0 0;
  padding: 4px;
  list-style: none;
  border: 1px solid var(--border, #ddd7d9);
  border-radius: 10px;
  background: var(--account-surface, #fff);
  color: var(--text, #1f1f1f);
}

.commune-options [role="option"] {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.commune-options [role="option"]:hover,
.commune-options [aria-selected="true"] {
  background: var(--account-field, #f4eef0);
}

.commune-status {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--muted, #666);
}

.commune-status:empty {
  display: none;
}

.editor-section .commune-options,
.commune-picker .filter-panel:has(.selected-communes:not([hidden])) .commune-options {
  position: absolute;
  inset-inline: 0;
  z-index: 5;
  box-shadow: 0 8px 18px rgb(0 0 0 / 12%);
}

@media (prefers-color-scheme: dark) {
  .commune-search {
    --border: #403a41;
    --text: #f5eff2;
    --muted: #c1b7be;
    --account-field: #2a272b;
    --account-surface: #201e21;
  }
}
