/* Shared interaction rules */
body {
  font-family: var(--font-sans);
}
button,
input,
select {
  font-family: inherit;
}
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: -2px;
}
button:focus:not(:focus-visible) {
  outline: none;
}

/* Directory tabs: content defines height; labels and counts never shrink. */
.tabs {
  display: flex;
  align-items: stretch;
  height: auto;
  min-height: 52px;
  gap: var(--space-6);
  padding: 0 var(--space-5);
  overflow-x: auto;
  border-bottom: 1px solid var(--color-border);
}
.tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: var(--space-2);
  min-height: 52px;
  height: auto;
  padding: var(--space-3) var(--space-1);
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-secondary);
  font-size: var(--text-label);
  font-weight: var(--weight-semibold);
  line-height: var(--line-label);
  white-space: nowrap;
}
.tab:hover {
  background: var(--color-surface-hover);
}
.tab.active {
  color: var(--color-action);
  border-bottom-color: var(--color-action);
}
.tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 24px;
  min-height: 24px;
  padding: 2px 6px;
  margin: 0;
  border-radius: var(--radius-small);
  background: #f1f4fb;
  color: var(--color-text-secondary);
  font-size: var(--text-meta);
  font-weight: var(--weight-bold);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.tab.active span {
  color: var(--color-action-strong);
  background: #e7edff;
}
.listnote {
  align-self: center;
  white-space: nowrap;
}

/* Addresses retain their full value. Overflow belongs to the table viewport. */
.addressrow {
  display: block;
  min-width: 0;
}
.addr {
  display: block;
  max-width: 100%;
  margin: 0;
  padding: 2px 4px;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--color-text-muted);
  font: var(--weight-medium) var(--text-label)/1.5 var(--font-mono);
  letter-spacing: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
.addr:hover {
  background: var(--color-surface-hover);
  color: var(--color-text-secondary);
}
.addressmeta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-1) 0 0;
  padding-left: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--text-meta);
  font-weight: var(--weight-semibold);
  line-height: var(--line-label);
}
.role {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-small);
  background: #f2f5fa;
  color: var(--color-text-secondary);
  font-size: var(--text-meta);
  font-weight: var(--weight-semibold);
  line-height: var(--line-label);
  white-space: nowrap;
}
.selected .role {
  background: #e5edff;
  border-color: #dce6ff;
  color: #426cae;
}
.addressmeta .iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: var(--space-1);
  border-radius: var(--radius-small);
}
.directory td {
  padding-block: var(--space-2);
}
.coinbadges {
  flex-wrap: wrap;
}
.toolbar input,
.toolbar select {
  min-height: var(--control-height);
}
@media (max-width: 760px) {
  .tabs {
    gap: var(--space-3);
    padding-inline: var(--space-3);
  }
  .tab {
    font-size: var(--text-label);
  }
  .listnote {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Searchable dropdown (select.js). The native <select> stays in the DOM, hidden, as the source of truth. */
.xsel {
  position: relative;
  display: inline-flex;
  min-width: 0;
  vertical-align: middle;
}
.xsel > select.xsel-native {
  position: absolute !important;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  pointer-events: none;
  margin: 0 !important;
}
.xsel-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  min-width: 0;
  min-height: var(--control-height, 38px);
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--line, var(--color-border));
  border-radius: 7px;
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 13px;
  font-weight: var(--weight-medium);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.xsel-trigger:hover:not(:disabled) {
  background: var(--color-surface);
  border-color: #c9d3ea;
}
.xsel.open .xsel-trigger,
.xsel-trigger:focus-visible {
  border-color: var(--color-action);
  box-shadow: 0 0 0 3px rgba(63, 98, 254, 0.14);
  outline: none;
}
.xsel-trigger:disabled {
  background: #f6f8fc;
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 1;
}
.xsel-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.xsel-chevron {
  flex: none;
  width: 14px;
  height: 14px;
  color: var(--color-text-muted);
  transition: transform 0.15s;
}
.xsel.open .xsel-chevron {
  transform: rotate(180deg);
}

/* Where it sits: full width in forms, compact in toolbars, small inline pickers. */
.panel .xsel,
.modal .xsel,
.fieldrow .xsel {
  display: flex;
  width: 100%;
}
.panel .xsel-trigger,
.modal .xsel-trigger {
  min-height: 44px;
  padding-inline: 12px;
  font-size: 14px;
  color: #34496b;
}
.toolbar .xsel {
  max-width: 190px;
}
.toolbar .xsel-trigger {
  font-size: 12px;
  color: #5d7092;
}
.xsel-mini .xsel-trigger {
  min-height: 0;
  padding: 3px 6px 3px 8px;
  gap: 4px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: var(--weight-semibold);
  color: #5d7092;
}
.xsel-mini .xsel-chevron {
  width: 11px;
  height: 11px;
}
.xsel-pagesize {
  margin-left: 12px;
}

/* The list: attached to <body> with fixed positioning, so tables and dialogs never clip it. */
.xsel-pop {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 12px 32px rgba(24, 39, 75, 0.16), 0 2px 6px rgba(24, 39, 75, 0.08);
  animation: xsel-in 0.12s ease-out;
}
.xsel-pop.up {
  animation-name: xsel-in-up;
}
@keyframes xsel-in {
  from { opacity: 0; transform: translateY(-4px); }
}
@keyframes xsel-in-up {
  from { opacity: 0; transform: translateY(4px); }
}
.xsel-search {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.xsel-search svg {
  flex: none;
  width: 14px;
  height: 14px;
}
.xsel-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  padding: 4px 0;
  background: none;
  color: var(--color-text);
  font-size: 13px;
  outline: none;
}
.xsel-list {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  outline: none;
}
.xsel-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--color-text);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.xsel-option.active {
  background: var(--color-surface-hover);
}
.xsel-option.selected {
  color: var(--color-action);
  font-weight: var(--weight-semibold);
}
.xsel-option.disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
  opacity: 0.55;
}
.xsel-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.xsel-text mark {
  background: rgba(63, 98, 254, 0.14);
  color: inherit;
  border-radius: 2px;
}
.xsel-hint {
  flex: none;
  color: var(--color-text-muted);
  font-size: 11.5px;
  font-weight: var(--weight-medium);
}
.xsel-check {
  flex: none;
  width: 14px;
  height: 14px;
  visibility: hidden;
}
.xsel-option.selected .xsel-check {
  visibility: visible;
}
.xsel-group {
  padding: 8px 10px 4px;
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.xsel-empty {
  padding: 14px 10px;
  color: var(--color-text-muted);
  font-size: 13px;
  text-align: center;
}
@media (prefers-reduced-motion: reduce) {
  .xsel-pop,
  .xsel-chevron {
    animation: none;
    transition: none;
  }
}
