/* Toolbar filters disclosure.
   toolbar.js injects button.toolbar-filters-toggle as the first child of
   .neu-toolbar-filters and toggles .is-open + aria-expanded. Desktop keeps
   the inline filter row; phones fold the selects behind the toggle. Linked
   after modern.css by the pages that load toolbar.js (contacts,
   organizations, projects, tasks, pipeline). */

.toolbar-filters-toggle {
  display: none;
}

/* Number of non-empty selects: a quiet jade badge (.neu-badge--jade). The
   [hidden] rule is required: .neu-badge's display would beat the UA's. */
.toolbar-filters-count {
  min-width: 20px;
  justify-content: center;
  padding: 0 6px;
  line-height: 16px;
  font-variant-numeric: tabular-nums lining-nums;
}

.toolbar-filters-count[hidden] {
  display: none;
}

@media (max-width: 640px) {
  /* Ghost control on its own row: hairline at rest, strong glass on hover. */
  .toolbar-filters-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 100%;
    width: 100%;
    min-height: 36px;
    padding: 0 10px 0 12px;
    border: 1px solid var(--border);
    border-color: color-mix(in srgb, currentColor 22%, transparent);
    border-radius: 8px;
    background: transparent;
    color: var(--foreground);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
  }

  .toolbar-filters-chevron {
    flex-shrink: 0;
    margin-left: auto;
    color: var(--foreground-secondary);
    transition: transform 0.18s ease;
  }

  .neu-toolbar-filters.is-open .toolbar-filters-chevron {
    transform: rotate(180deg);
  }

  /* Folded: the selects go; the segmented control, "My cards", Clear, the
     count chip and Export stay. Keyed to the toggle, so a row whose script
     never ran keeps its selects. */
  .neu-toolbar-filters:not(.is-open) > .toolbar-filters-toggle ~ .neu-form-group {
    display: none;
  }

  /* Open: one select per row (modern.css says the same at this width). */
  .neu-toolbar-filters.is-open > .neu-form-group {
    flex: 1 1 100%;
  }
}

@media (max-width: 640px) and (hover: hover) {
  .toolbar-filters-toggle:hover {
    background: var(--surface-strong);
    border-color: var(--surface-border);
  }
}

@media (prefers-reduced-motion: reduce) {
  .toolbar-filters-toggle,
  .toolbar-filters-chevron {
    transition: none;
  }
}
