.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
  padding-right: 56px;
}

.user-search-field {
  display: inline-flex;
  align-items: stretch;
}

.user-search-field #userIdInput {
  transition: border-radius .18s ease;
}

.user-search-field #searchBtn {
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  opacity: 0;
  overflow: hidden;
  white-space: nowrap;
  border-radius: 0 12px 12px 0;
  transition: max-width .18s ease, padding .18s ease, opacity .14s ease;
}

.user-search-field:focus-within #userIdInput {
  border-radius: 12px 0 0 12px;
}

.user-search-field:focus-within #searchBtn {
  max-width: 90px;
  padding-left: 14px;
  padding-right: 14px;
  opacity: 1;
}

.dye-search {
  position: absolute;
  top: 28px;
  right: 82px;
  width: 0;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
  transition: width .2s ease, opacity .16s ease;
}

.dye-search.open {
  width: min(260px, calc(100% - 120px));
  opacity: 1;
  pointer-events: auto;
}

.dye-search input {
  width: 100%;
}

input,
textarea {
  min-height: 44px;
  background: rgba(18, 18, 18, .88);
  color: var(--text);
  border: 1px solid rgba(179, 18, 75, .5);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
}

input::placeholder,
textarea::placeholder {
  color: #8e8e8e;
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.filter-pair,
.sort-pair {
  display: inline-flex;
  gap: 10px;
  flex-wrap: nowrap;
}

.filter-toggle:not(.frame-filter) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  background: rgba(18, 18, 18, .56);
  border: 1px solid rgba(179, 18, 75, .35);
  color: var(--text);
  font-size: .95rem;
}

.filter-toggle:not(.frame-filter):hover {
  background: rgba(179, 18, 75, .18);
}

.filter-mark {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(242, 242, 242, .65);
  border-radius: 5px;
  color: white;
  font-size: 13px;
  line-height: 1;
}

.filter-toggle:not(.frame-filter)[data-state="yes"] {
  background: var(--accent);
  border-color: var(--accent);
}

.filter-toggle:not(.frame-filter)[data-state="yes"] .filter-mark::before,
.filter-toggle.frame-filter[data-state="yes"] .filter-mark::before {
  content: "✓";
}

.filter-toggle:not(.frame-filter)[data-state="no"] .filter-mark::before,
.filter-toggle.frame-filter[data-state="no"] .filter-mark::before {
  content: "×";
}


#stats,
#hueControls {
  color: var(--muted);
  margin-bottom: 18px;
}

.collection-title {
  margin: 0;
  font-size: 1.35rem;
}

.collection-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 14px;
}

.collection-actions {
  display: inline-flex;
  gap: 6px;
}

.collection-action {
  width: 34px;
  height: 34px;
  min-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
  background: rgba(18, 18, 18, .88);
  border: 1px solid rgba(179, 18, 75, .35);
  font-size: .95rem;
}

.collection-action:hover,
.collection-action.active {
  background: var(--accent);
}

.owner-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.owner-menu-trigger {
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(255, 255, 255, .26);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.owner-menu-trigger:hover,
.owner-menu-trigger:focus-visible,
.owner-chip.open .owner-menu-trigger {
  color: var(--accent-light);
  text-decoration-color: var(--accent);
}

.owner-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 15;
  min-width: 190px;
  display: none;
  padding: 6px;
  border: 1px solid rgba(179, 18, 75, .42);
  border-radius: 12px;
  background: rgba(10, 10, 10, .97);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .42);
}

.owner-chip.open .owner-menu {
  display: grid;
  gap: 4px;
}

.owner-menu-item {
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: .9rem;
  text-align: left;
  white-space: nowrap;
}

.owner-menu-item:hover,
.owner-menu-item:focus-visible {
  background: rgba(179, 18, 75, .9);
}

.owner-menu-item.danger {
  color: #ffd7e4;
}

.owner-user-message {
  min-height: 16px;
  color: var(--muted);
  font-size: .78rem;
}

#accountFavoritesBtn {
  justify-content: space-between;
  gap: 12px;
}

.account-menu-arrow {
  font-size: .75rem;
  transition: transform .16s ease;
}

#accountFavoritesBtn[aria-expanded="true"] .account-menu-arrow {
  transform: rotate(180deg);
}

.account-favorites-panel {
  display: grid;
  gap: 8px;
  width: min(320px, 78vw);
  max-height: 320px;
  overflow: auto;
  padding: 8px;
}

.account-favorites-panel[hidden] {
  display: none;
}

.favorite-user-block {
  display: grid;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(179, 18, 75, .24);
  border-radius: 8px;
}

.favorite-user-open {
  min-height: 0;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: .95rem;
}

.favorite-user-dyes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted);
  font-size: .78rem;
}

.favorite-user-dyes span {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(84px, 13vh, 140px) 18px 18px;
  background: rgba(0, 0, 0, .56);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: min(520px, 100%);
  max-height: min(620px, 90vh);
  overflow: auto;
  position: relative;
  padding: 24px;
  border: 1px solid rgba(179, 18, 75, .45);
  border-radius: 18px;
  background: rgba(10, 10, 10, .97);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .48);
}

.compact-modal {
  width: min(460px, 100%);
}

.modal-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0 42px 18px 0;
}

.modal-title-row h2 {
  margin: 0;
}

.modal-more-menu {
  position: relative;
}

.modal-more-menu summary {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(179, 18, 75, .55);
  border-radius: 50%;
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.modal-more-menu summary::-webkit-details-marker {
  display: none;
}

.modal-more-menu[open] summary,
.modal-more-menu summary:hover {
  background: var(--accent);
}

.modal-more-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 2;
  width: min(260px, 72vw);
  padding: 8px;
  border: 1px solid rgba(179, 18, 75, .45);
  border-radius: 12px;
  background: rgba(10, 10, 10, .98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .42);
}

.modal-more-panel button {
  width: 100%;
  padding: 10px 12px;
  text-align: left;
}

.collection-user-form {
  display: grid;
  gap: 12px;
  margin-top: 4px;
}

.collection-user-form input {
  width: 100%;
}

.collection-custom-entry {
  display: grid;
  gap: 10px;
}

.collection-user-actions {
  display: grid;
  gap: 8px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  border-radius: 50%;
}

.frame-export-modal {
  display: grid;
  gap: 14px;
}

.frame-export-options {
  display: grid;
  gap: 8px;
}

.frame-export-option {
  width: 100%;
  min-height: 38px;
  justify-content: flex-start;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  text-align: left;
  font-weight: 850;
}

.frame-export-option:hover,
.frame-export-option.active {
  border-color: rgba(179, 18, 75, .48);
  background: rgba(179, 18, 75, .2);
}

.frame-export-preview {
  min-height: 96px;
  max-height: 220px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  background: rgba(0, 0, 0, .34);
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.frame-export-copy {
  width: 100%;
  min-height: 40px;
  border-color: rgba(179, 18, 75, .65);
  border-radius: 8px;
  background: var(--accent);
  color: var(--text);
  font-weight: 900;
}

.frame-export-copy:hover {
  background: #d21d61;
}

.dye-job-block {
  display: grid;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid rgba(179, 18, 75, .22);
}

.dye-job-block:first-of-type {
  border-top: 0;
}

.dye-job-block textarea {
  min-height: 130px;
}

.collection-status {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 24px;
  margin-bottom: 18px;
}

.collection-status #stats {
  margin-bottom: 0;
}

.loading-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .95rem;
}

.loading-status[hidden],
.empty-message[hidden],
.collection-warning[hidden] {
  display: none;
}

.collection-warning {
  margin: -6px 0 18px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 215, 228, .22);
  border-radius: 8px;
  background: rgba(179, 18, 75, .12);
  color: #ffd7e4;
  font-size: .9rem;
  font-weight: 850;
  line-height: 1.35;
}

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(242, 242, 242, .24);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.empty-message {
  margin-top: -4px;
  margin-bottom: 18px;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

#hueControls {
  display: none;
}
