/* Shared financial controls: one visual language for filters, pagination and
   inline menus. Popup is rendered in <body> so scrollable tables do not clip it. */
.polished-select-root {
  position: relative;
  display: inline-flex;
  min-width: 0;
  vertical-align: middle;
}

.polished-select-trigger {
  width: 100%;
  min-width: 0;
  min-height: var(--control-height);
  padding: 9px 35px 9px 13px;
  display: inline-flex;
  align-items: center;
  position: relative;
  gap: 7px;
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--surface-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 1px 1px rgba(17, 42, 49, .025);
  transition: border-color var(--motion-fast), background var(--motion-fast), box-shadow var(--motion-fast);
}

.polished-select-caption {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.polished-select-trigger::after {
  content: "";
  width: 7px;
  height: 7px;
  position: absolute;
  right: 15px;
  top: calc(50% - 5px);
  border-right: 1.8px solid var(--text-secondary);
  border-bottom: 1.8px solid var(--text-secondary);
  transform: rotate(45deg);
  transition: transform var(--motion-fast);
  pointer-events: none;
}

.polished-select-trigger.is-open::after {
  transform: translateY(4px) rotate(225deg);
}

.polished-select-trigger:hover,
.inline-category-trigger:hover {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.polished-select-trigger:focus-visible,
.polished-select-trigger.is-open,
.inline-category-trigger:focus-visible,
.inline-category-trigger.is-open {
  border-color: var(--brand-600);
  outline: none;
  box-shadow: var(--focus-ring);
}

.polished-select-menu {
  position: fixed;
  z-index: 10020;
  display: grid;
  align-content: start;
  gap: 2px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 7px;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  background: var(--surface-card);
  box-shadow:
    0 16px 40px rgba(16, 42, 51, .16),
    0 2px 8px rgba(16, 42, 51, .06);
  scrollbar-color: var(--border-strong) transparent;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.polished-select-option {
  width: 100%;
  min-height: 36px;
  padding: 8px 30px 8px 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
  position: relative;
}
.polished-select-option:hover,
.polished-select-option:focus-visible {
  background: var(--surface-muted);
  color: var(--text-primary);
  outline: 0;
}
.polished-select-option[aria-selected="true"] {
  background: var(--brand-100);
  color: var(--brand-800);
  font-weight: 800;
}
.polished-select-option[aria-selected="true"]::after {
  content: "";
  position: absolute;
  right: 14px;
  top: calc(50% - 7px);
  width: 6px;
  height: 11px;
  border: solid var(--brand-600);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.polished-select-color {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(16, 42, 51, .08);
}

/* Filters: search, month and selects use matching neutral borders. */
.filter-bar .polished-select-root {
  flex: 1 1 160px;
  min-width: 150px;
}
.filter-bar .polished-select-trigger { min-height: 44px; }

.filter-bar .filter-search input,
.filter-bar > input,
.filter-bar > select,
.pagination-size select {
  border: 1px solid var(--border-default);
  border-radius: 10px;
  background: var(--surface-card);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  box-shadow: 0 1px 1px rgba(17, 42, 49, .025);
  transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.filter-bar .filter-search input:focus,
.filter-bar > input:focus,
.filter-bar > select:focus,
.pagination-size select:focus {
  border-color: var(--brand-600);
  outline: none;
  box-shadow: var(--focus-ring);
}
.filter-bar > input[type="month"] { padding: 9px 11px; }
.filter-bar input::placeholder { color: var(--text-tertiary); }

.pagination-size .polished-select-root { width: 80px; flex: 0 0 80px; }
.pagination-size .polished-select-trigger {
  min-height: 34px;
  padding: 6px 27px 6px 10px;
  font-size: 12px;
}
.pagination-size .polished-select-trigger::after { right: 11px; }

.data-table-toolbar-mobile .polished-select-root {
  flex: 0 1 145px;
  min-width: 100px;
}
.data-table-toolbar-mobile .polished-select-trigger {
  height: 34px;
  min-height: 34px;
  padding: 6px 28px 6px 9px;
  font-size: 12px;
}

/* Category pill remains a pill while its dropdown is open; never replace
   it with a square native control. */
.inline-category-trigger {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--text-primary);
  line-height: 1.2;
  box-shadow: none;
}
.inline-category-trigger svg {
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  color: var(--text-secondary);
  transition: transform var(--motion-fast);
}
.inline-category-trigger.is-open svg { transform: rotate(180deg); }
.inline-category-feedback:not([hidden]) {
  /* Announced to assistive technology, without changing table row height. */
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Tables keep their normal mobile card layout. */
@media (max-width: 760px) {
  .filter-bar .polished-select-root { flex-basis: 100%; min-width: 100%; }
  .filter-bar .polished-select-trigger { width: 100%; }
  .data-table-toolbar-mobile .polished-select-root { flex: 1 1 145px; }
}
