/* ---------- Layout ---------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.page.wide {
  max-width: 1400px;
}
.page.narrow {
  max-width: 760px;
}
h1 {
  margin: 4px 0 0;
  font-size: 29px;
  letter-spacing: -0.02em;
}
h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.meta {
  font-size: 12px;
  color: var(--ink-3);
}
.empty {
  margin: 0;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink-2);
  font-size: 13.5px;
}

/* ---------- Dashboard ---------- */
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding: 20px 22px;
  margin-bottom: 18px;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--r);
}
.notice p {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: 13.5px;
  max-width: 60ch;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar-msg {
  font-size: 13px;
  color: var(--warn);
}

.run {
  padding: 14px 16px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.run.live {
  border-color: var(--accent);
}
.run.failed {
  border-color: var(--fail);
  background: var(--fail-soft);
}
.run-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
}
.run-title {
  font-weight: 640;
}
.run-meta {
  color: var(--ink-3);
}
.run-error {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--fail);
  overflow-wrap: anywhere;
}
.bar {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.4s ease;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease,
    border-color 0.18s ease;
}
.stat:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
}
.stat-n {
  font-family: var(--display);
  font-size: 34px;
  line-height: 1.1;
}
.stat-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.stat-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--ink-3);
}
.stat.ok .stat-n {
  color: var(--ok);
}
.stat.warn .stat-n {
  color: var(--warn);
}
.stat.fail .stat-n {
  color: var(--fail);
}
.stat.accent .stat-n {
  color: var(--accent);
}

/* ---------- Filters ---------- */
.filters {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px 12px;
  flex-wrap: wrap;
  padding: 10px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  --control-h: 34px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.control,
.chip,
.price,
.override input {
  height: var(--control-h, 34px);
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background-color: var(--field);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  transition:
    border-color 0.12s,
    background-color 0.12s,
    color 0.12s;
}
.control,
.override input {
  padding: 0 10px;
}
.control:hover,
.chip:hover,
.price:hover {
  border-color: var(--ink-3);
}
.control:focus-visible,
.price:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.search {
  flex: 1 1 260px;
  min-width: 0;
}
select.control {
  appearance: none;
  padding-right: 30px;
  cursor: pointer;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  cursor: pointer;
  color: var(--ink-2);
  user-select: none;
}
.chip input {
  margin: 0;
  accent-color: var(--accent);
}
.price {
  display: inline-flex;
  align-items: center;
  padding: 0 4px 0 10px;
  color: var(--ink-3);
}
.price-label {
  margin-right: 6px;
}
.price input {
  width: 64px;
  height: 100%;
  border: none;
  background: none;
  font: inherit;
  color: var(--ink);
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
.price input:focus {
  outline: none;
}
.price input::-webkit-outer-spin-button,
.price input::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.filters select.control.active,
.chip:has(input:checked),
.price:has(input:not(:placeholder-shown)) {
  border-color: var(--accent);
  background-color: var(--accent-soft);
  color: var(--ink);
}

.reset {
  display: none;
  align-items: center;
  height: var(--control-h, 34px);
  padding: 0 6px;
  font-size: 13px;
  color: var(--ink-3);
}
.reset:hover {
  color: var(--ink);
}
.filters:has(
    .search:not(:placeholder-shown),
    select.control.active,
    .chip input:checked,
    .price input:not(:placeholder-shown)
  )
  .reset {
  display: inline-flex;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
}
.check input {
  accent-color: var(--accent);
}

@media (max-width: 760px) {
  .search {
    flex-basis: 100%;
  }
}

.filter-search {
  display: contents;
}
.filters-toggle {
  display: none;
}

/* ---------- Results ---------- */
.results-foot {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
:root:not([data-export]) #results:not(:has(.sel:checked)) .results-foot:not(:has(.pager, .seg)) {
  display: none;
}
.foot-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.working {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 31px;
  font-size: 13px;
  color: var(--ink-2);
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--line-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
table.albums {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.albums th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.albums td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.albums tbody tr:last-child td {
  border-bottom: none;
}
.albums .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sort {
  color: inherit;
  text-decoration: none;
}
.sort:hover,
.sort.active {
  color: var(--ink);
}
.row.ignored td:not(.actions) {
  opacity: 0.5;
}
.row.htmx-request {
  opacity: 0.6;
}

.cover {
  width: 80px;
}
.cover img,
.cover-none {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-3);
}
.album-title,
.release {
  font-weight: 640;
  color: var(--ink);
  text-decoration: none;
}
a.album-title:hover,
a.release:hover {
  text-decoration: underline;
}
.discogs {
  min-width: 260px;
}

.more {
  margin-top: 6px;
}
.more summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--accent);
}
.cands {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 8px 0;
}
.cand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.cand img {
  border-radius: 4px;
  flex: none;
}
.cand a {
  color: var(--ink);
}
.cands .btn {
  align-self: flex-start;
}
.override {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.override input {
  flex: 1;
  min-width: 0;
}
.row-error {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--fail);
}

.pills {
  white-space: nowrap;
}
.pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-3);
  margin: 0 4px 4px 0;
}
.pill.matched,
.pill.wanted {
  color: var(--ok);
  background: var(--ok-soft);
  border-color: var(--ok-line);
}
.pill.ambiguous {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: var(--warn-bar);
}
.pill.not_found {
  color: var(--fail);
  background: var(--fail-soft);
  border-color: var(--fail-line);
}
.pill.owned {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: var(--accent);
}
.pill.approved {
  color: var(--on-solid);
  background: var(--accent);
  border-color: var(--accent);
}
.pill.wanted {
  color: var(--on-solid);
  background: var(--ok);
  border-color: var(--ok);
}

.actions {
  white-space: nowrap;
  text-align: right;
}
.row-actions {
  display: inline-flex;
  gap: 6px;
}
.ibtn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.i {
  display: block;
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: none;
}
.btn .i {
  width: 16px;
  height: 16px;
}
.approve {
  color: var(--accent);
}
.own {
  color: var(--ok);
}
.ignore {
  color: var(--fail);
}
.undo {
  color: var(--ink-2);
}
.ibtn.approve:hover,
.btn.tone.approve:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.ibtn.own:hover,
.btn.tone.own:hover {
  background: var(--ok-soft);
  border-color: var(--ok);
}
.ibtn.ignore:hover,
.btn.tone.ignore:hover {
  background: var(--fail-soft);
  border-color: var(--fail);
}
.ibtn.undo:hover,
.btn.tone.undo:hover {
  background: var(--surface-3);
  border-color: var(--line-2);
}
.btn.tone {
  color: var(--ink);
}
.btn.tone.approve .i {
  color: var(--accent);
}
.btn.tone.own .i {
  color: var(--ok);
}
.btn.tone.ignore .i {
  color: var(--fail);
}
.btn.tone.undo .i {
  color: var(--ink-2);
}
.ibtn:disabled,
.ibtn.htmx-request {
  opacity: 0.5;
  cursor: progress;
}

.pager {
  display: flex;
  align-items: center;
  gap: 4px;
}
.page-link,
.page-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  text-decoration: none;
}
.page-link {
  border: 1px solid transparent;
}
a.page-link:hover {
  border-color: var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
}
.page-link.current {
  background: var(--accent);
  color: var(--on-solid);
  font-weight: 640;
}
.page-gap {
  color: var(--ink-3);
}

/* ---------- Sources ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.card h2:not(:first-child) {
  margin-top: 14px;
}
.check.off {
  opacity: 0.55;
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
}

@media (max-width: 760px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Wantlist ---------- */
.crate {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
  align-items: start;
}
.record {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition:
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.22s ease,
    border-color 0.18s ease;
}
.record:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow-lift);
}
.record-cover {
  position: relative;
  display: block;
  aspect-ratio: 1;
  background: var(--surface-3);
}
.record-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.record-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--on-solid);
  background: var(--accent);
}
.record-badge.owned {
  top: auto;
  bottom: 8px;
  left: 8px;
  right: auto;
  background: var(--ok);
}
.record-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px 12px;
  min-width: 0;
  font-size: 13px;
}
.record-title,
.record-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.record-title {
  font-weight: 660;
  color: var(--ink);
  text-decoration: none;
}
.record-title:hover {
  text-decoration: underline;
}
.record-artist {
  color: var(--ink-2);
}
.versions {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
}
@media (max-width: 620px) {
  .crate {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
}
.record-format {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Bulk actions ---------- */
.sel-cell {
  width: 36px;
  padding-right: 0 !important;
}
.sel-cell input {
  margin: 0;
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
td.sel-cell {
  padding-top: 30px !important;
}
.bulk {
  display: none;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.bulk-count {
  margin-right: 6px;
  font-size: 13px;
  color: var(--ink-2);
}
.sel-clear {
  font: inherit;
  font-size: 13px;
  padding: 0 6px;
  border: none;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}
.sel-clear:hover {
  color: var(--ink);
}
#results:has(.sel:checked) .bulk {
  display: flex;
}
#results:has(.sel:checked) .showing {
  display: none;
}
.row:has(.sel:checked) td {
  background: var(--accent-soft);
}
.bulk-result {
  margin: 0 0 12px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
}

/* ---------- Sign in ---------- */
.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 16px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 36px 32px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.auth-logo {
  height: 36px;
  width: auto;
  filter: invert(1);
}
.auth-lead {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}
.auth-msg {
  margin: 0;
  font-size: 13px;
  color: var(--warn);
}
.auth-fine {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-3);
}
.btn-wide {
  width: 100%;
  justify-content: center;
  padding: 10px 14px;
  font-size: 14px;
}

/* ---------- Settings ---------- */
.page.narrow .card + .card {
  margin-top: 16px;
}
.card p {
  margin: 0;
}
.state-line {
  font-size: 13.5px;
  color: var(--ink-2);
}
.state-line .pill {
  margin-right: 6px;
}
code {
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.steps {
  margin: 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink-2);
}
.copy-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.inline-form .control {
  flex: 1 1 260px;
  height: 34px;
}
.card-actions form {
  display: inline;
}
.danger-zone {
  margin-top: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.danger-zone summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--fail);
}
.danger-zone[open] > * + * {
  margin-top: 10px;
}
.btn.danger {
  background: var(--fail);
  border-color: var(--fail);
  color: var(--on-solid);
}
.bulk-result.bad {
  border-left-color: var(--fail);
}

/* ---------- Grid / list layout ---------- */
.view-toggle {
  margin-left: auto;
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
}
.vt {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
}
.vt .i {
  width: 18px;
  height: 18px;
}
.vt:hover {
  color: var(--ink);
}
.vt[data-view="grid"],
:root[data-view="list"] .vt[data-view="list"] {
  background: var(--accent-soft);
  color: var(--accent);
}
:root[data-view="list"] .vt[data-view="grid"] {
  background: none;
  color: var(--ink-3);
  box-shadow: none;
}
.list-only {
  display: none;
}

.crate-head {
  display: none;
}
:root[data-view="list"] .crate.listenable {
  --list-cols: 44px minmax(0, 2fr) minmax(0, 1.5fr) 56px minmax(0, 1.5fr) 172px;
}
:root[data-view="list"] .crate.wanted {
  --list-cols: 44px minmax(0, 2fr) minmax(0, 1.5fr) 120px minmax(0, 1.2fr) 172px;
}
:root[data-view="list"] .crate {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
  --list-cols: 44px minmax(0, 2.2fr) minmax(0, 1.6fr) 56px minmax(0, 1.8fr);
}
:root[data-view="list"] .crate-head {
  display: grid;
  grid-template-columns: var(--list-cols);
  column-gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-2);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}
:root[data-view="list"] .record {
  display: grid;
  grid-template-columns: var(--list-cols);
  column-gap: 20px;
  align-items: center;
  margin: 0;
  padding: 10px 20px;
  border: none;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}
:root[data-view="list"] .record + .record {
  border-top: 1px solid var(--line);
}
:root[data-view="list"] .record:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--line);
  background: var(--surface-2);
}
:root[data-view="list"] .record-cover {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  overflow: hidden;
}
:root[data-view="list"] .record-badge {
  display: none;
}
:root[data-view="list"] .record-body {
  display: contents;
}
:root[data-view="list"] .record-body > * {
  min-width: 0;
}
:root[data-view="list"] .record-title {
  font-size: 13.5px;
}
:root[data-view="list"] .record-body .meta {
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
:root[data-view="list"] .record-body .more {
  margin: 0;
  font-size: 12.5px;
}
:root[data-view="list"] .record-format {
  color: var(--ink-3);
}
:root[data-view="list"] .list-only {
  display: inline-block;
  margin: 0 0 0 6px;
  vertical-align: middle;
}
@media (max-width: 760px) {
  :root[data-view="list"] .crate {
    --list-cols: 44px minmax(0, 1fr);
  }
  :root[data-view="list"] .crate-head {
    display: none;
  }
  :root[data-view="list"] .record-body > :not(.record-title) {
    grid-column: 2;
  }
}

/* ---------- Combobox ---------- */
.combo {
  position: relative;
  max-width: 340px;
}
.combo-input {
  width: 100%;
  height: 34px;
  padding-right: 30px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-3) 50%),
    linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position:
    calc(100% - 15px) 50%,
    calc(100% - 10px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.combo-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  max-height: 280px;
  overflow-y: auto;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
}
.combo-list li {
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}
.combo-list li:hover,
.combo-list li.active {
  background: var(--accent-soft);
  color: var(--accent);
}
.combo-list li[data-value=""] {
  color: var(--ink-3);
}

/* ---------- Listen links ---------- */
.sprite {
  display: none;
}
.listen {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin: 6px 0 0 -5px;
}
.listen-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--ink-3);
  transition:
    background 0.12s,
    color 0.12s;
}
.listen-icon svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}
.listen-icon:hover,
.listen-icon:focus-visible {
  background: var(--surface-2);
}
.listen-icon:focus {
  outline: none;
}
.listen-icon.spotify:hover {
  color: #1db954;
}
.listen-icon.youtube:hover {
  color: #ff0000;
}
.listen-icon.apple:hover {
  color: #fa243c;
}
button.listen-icon {
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}
.listen-icon.soulseek svg {
  shape-rendering: crispEdges;
}
.listen-icon.soulseek:hover,
.listen-icon.soulseek.copied {
  color: #2f2fe6;
}
.listen-icon.copied {
  position: relative;
}
.listen-icon.copied::after {
  content: "Copied";
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--ink);
  color: var(--surface);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}
.listen-icon.deezer:hover {
  color: #a238ff;
}
.listen-icon.bandcamp:hover {
  color: #1da0c3;
}
:root[data-view="list"] .crate .listen {
  margin: 0;
  justify-content: flex-end;
  flex-wrap: nowrap;
}
:root[data-view="list"] .crate.listenable .crate-head span:last-child {
  text-align: right;
}
.shelf-status {
  margin-bottom: 14px;
}
.shelf-status .toolbar {
  margin-bottom: 0;
}
.shelf-status .toolbar:not(:has(*)) {
  display: none;
}
.shelf-status:not(:has(.toolbar > *, .run)) {
  display: none;
}
#shelf-filters {
  flex-wrap: nowrap;
}
#shelf-filters .view-toggle {
  flex: none;
  margin: 0;
}
.shelf-status .run {
  margin: 12px 0 0;
}
.shelf-foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
.shelf-foot .seg {
  justify-self: end;
}

/* ---------- Records stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface-2);
  color: inherit;
  text-decoration: none;
}
a.kv:hover {
  border-color: var(--accent);
}
.kv.wide {
  grid-column: 1 / -1;
}
.kv-n {
  font-family: var(--display);
  font-size: 26px;
  line-height: 1.15;
}
.kv-l {
  font-size: 12px;
  color: var(--ink-3);
}
.spinner.inline {
  display: inline-block;
  width: 11px;
  height: 11px;
  vertical-align: -1px;
  margin-right: 4px;
}

/* ---------- Segmented control ---------- */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
}
.seg-label {
  padding: 0 6px 0 7px;
  font-size: 12px;
  color: var(--ink-3);
}
.seg-btn {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 28px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  text-decoration: none;
  transition:
    background 0.12s,
    color 0.12s;
}
.seg-btn:hover {
  color: var(--ink);
}
.seg-btn[aria-current="true"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 640;
}

.more-settings {
  display: flex;
  flex-direction: column;
}
.more-settings summary {
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-3);
}
.more-settings summary:hover {
  color: var(--ink);
}
.more-settings[open] summary {
  margin-bottom: 10px;
}
.more-settings .copy-field {
  margin: 0 0 10px;
}

/* ---------- Sync card ---------- */
.sync-list {
  display: grid;
  gap: 8px;
  margin: 14px 0 0;
  font-size: 13px;
}
.sync-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 34px;
}
.sync-name {
  color: var(--ink-3);
}
.card-sep {
  height: 1px;
  margin: 16px 0;
  background: var(--line);
}

.export-csv {
  display: none;
}
:root[data-export] .export-csv {
  display: inline-flex;
}

/* ---------- Scan ---------- */
.shots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}
.shot {
  position: relative;
  aspect-ratio: 1;
  max-height: 220px;
  width: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1.5px dashed var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: pointer;
}
.shot.taken {
  border-style: solid;
}
.shot.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.shot-hint {
  display: none;
  font-size: 11px;
}
@media (hover: hover) and (pointer: fine) {
  .shot-hint {
    display: block;
  }
}
.shot input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}
.shot-ph {
  display: grid;
  justify-items: center;
  gap: 6px;
  font-size: 13px;
  pointer-events: none;
}
.shot-ph .i {
  width: 28px;
  height: 28px;
}
.shot.taken .shot-ph {
  display: none;
}
.scan-go {
  width: 100%;
  justify-content: center;
}
#scan-result {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}
.scan-title {
  margin: 8px 0 4px;
}
.scan-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.scan-item {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}
.scan-item + .scan-item {
  border-top: 1px solid var(--line);
}
.scan-thumb img,
.scan-thumb {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-3);
}
.scan-body {
  min-width: 0;
  font-size: 13px;
}
.scan-body .meta {
  margin-top: 2px;
  font-size: 12px;
}
.find-head {
  margin: 0 0 10px;
  color: var(--ink-2);
  font-size: 13px;
}
.scan-link {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 38px;
  padding: 0;
  color: var(--ink-2);
}
.scan-link .i {
  width: 18px;
  height: 18px;
}

.scan-dialog {
  width: min(720px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
}
.scan-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.scan-dialog[open] {
  animation: menu-in 0.16s ease-out;
}
.scan-dialog-in {
  position: relative;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  border-radius: var(--r);
}
.scan-dialog .scan-form {
  margin: 0;
}
.dialog-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
}
.dialog-close:hover,
.dialog-close:focus-visible {
  background: var(--surface-2);
  color: var(--ink);
}
.dialog-close:focus {
  outline: none;
}

/* ---------- Guide ---------- */
.guide-intro p {
  margin: 8px 0 0;
  color: var(--ink-2);
  line-height: 1.55;
}
.guide-progress {
  height: 6px;
  margin: 16px 0 6px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.guide-progress span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--ok);
}
.guide-steps {
  counter-reset: step;
  list-style: none;
  margin: 14px 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.guide-step {
  counter-increment: step;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.guide-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 700;
}
.guide-mark:empty::before {
  content: counter(step);
}
.guide-step.done .guide-mark {
  border-color: var(--ok);
  background: var(--ok);
  color: var(--on-solid);
}
.guide-mark .i {
  width: 18px;
  height: 18px;
}
.guide-body h3 {
  margin: 4px 0 6px;
  font-size: 15px;
}
.guide-step.done .guide-body h3 {
  color: var(--ink-2);
}
.guide-body p,
.guide-sub,
.guide-legend {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.guide-sub {
  padding-left: 18px;
}
.guide-legend {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 8px;
}
.guide-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
}
.guide-legend .ibtn {
  flex: none;
  cursor: default;
}
.guide-body .btn {
  margin-top: 4px;
}
.guide-tips dl {
  margin: 12px 0 14px;
  font-size: 13.5px;
  line-height: 1.55;
}
.guide-tips dt {
  margin-top: 12px;
  font-weight: 700;
}
.guide-tips dd {
  margin: 4px 0 0;
  color: var(--ink-2);
}
.guide-icons {
  margin: 0 0 4px -5px;
}
.guide-tips .btn + .btn {
  margin-left: 8px;
}

.guide-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Tour ---------- */
.tour-hole {
  position: fixed;
  z-index: 90;
  border-radius: 10px;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.85),
    0 0 0 9999px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  transition:
    top 0.2s ease,
    left 0.2s ease,
    width 0.2s ease,
    height 0.2s ease;
}
.tour-card {
  position: fixed;
  z-index: 91;
  width: min(340px, calc(100vw - 24px));
  padding: 14px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
  animation: menu-in 0.16s ease-out;
}
.tour-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tour-count {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.tour-x {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--ink-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.tour-x:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.tour-card h3 {
  margin: 4px 0 6px;
  font-size: 15px;
}
.tour-card p {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
}
.tour-nav {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.tour-card .btn:focus {
  outline: none;
}
@media (prefers-reduced-motion: reduce) {
  .tour-hole {
    transition: none;
  }
}

/* ---------- Dashboard ---------- */
.page.dash {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding-top: clamp(24px, 6vh, 72px);
  padding-bottom: clamp(48px, 14vh, 160px);
}
.page.dash .stats {
  gap: clamp(12px, 1.6vw, 22px);
}
.page.dash .stat {
  padding: clamp(16px, 2vw, 28px) clamp(18px, 2.2vw, 30px);
}
.page.dash .stat-n {
  font-size: clamp(30px, 3.4vw, 52px);
}

/* ---------- Back to top ---------- */
.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-lift);
  cursor: pointer;
  animation: menu-in 0.14s ease-out;
}
.to-top[hidden] {
  display: none;
}
.to-top:hover {
  color: var(--accent);
  border-color: var(--accent);
}
:root:has(.results-foot) .to-top {
  bottom: 84px;
}

/* ---------- Phones ---------- */
@media (max-width: 760px) {
  .masthead {
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .filters::before {
    content: "";
    position: absolute;
    left: -17px;
    right: -17px;
    top: -10px;
    height: 9px;
    background: var(--ground);
  }
  .filters {
    position: sticky;
    top: 65px;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }
  .filter-search {
    display: flex;
    gap: 8px;
  }
  #shelf-filters {
    display: flex;
  }
  .filters-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: none;
    cursor: pointer;
  }
  .filters-toggle .i {
    width: 18px;
    height: 18px;
    color: var(--ink-3);
  }
  .filters.open .filters-toggle {
    border-color: var(--accent);
    color: var(--accent);
  }
  .filters.open .filters-toggle .i {
    color: currentColor;
  }
  .filters-count {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--on-solid);
    font-size: 11px;
    font-weight: 700;
  }
  .filter-group {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filters.open .filter-group {
    display: grid;
  }
  .filter-group > * {
    width: 100%;
    min-width: 0;
  }
  .filter-group .chip {
    justify-content: center;
  }
  .filter-group .price input {
    flex: 1;
    width: 0;
    min-width: 0;
  }
  .filter-group .reset {
    grid-column: 1 / -1;
    display: block;
    text-align: center;
  }
  .page {
    padding: 16px 16px 40px;
  }
  .results-foot {
    position: static;
    justify-content: space-between;
    padding: 4px 0 0;
    background: none;
    border: none;
    box-shadow: none;
  }
  main.page.wide {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    padding-bottom: 12px;
  }
  main.page.wide > #results {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  .results-foot {
    margin-top: auto;
    padding-top: 14px;
  }
  .results-foot .foot-actions:empty,
  .results-foot .foot-actions:not(:has(*)) {
    display: none;
  }
  :root:has(.results-foot) .to-top {
    bottom: 16px;
  }
  .to-top {
    right: 16px;
    bottom: 16px;
  }
  .shelf-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .shelf-foot > span:empty {
    display: none;
  }

  .table-wrap {
    overflow: visible;
  }
  table.albums,
  .albums tbody {
    display: block;
  }
  .albums thead {
    display: none;
  }
  .albums tr.row {
    display: grid;
    grid-template-columns: 20px 56px minmax(0, 1fr) minmax(0, 1fr) 104px;
    column-gap: 10px;
    row-gap: 8px;
    align-items: start;
    padding: 14px 12px;
    border-bottom: 1px solid var(--line);
  }
  .albums tbody tr.row:last-child {
    border-bottom: none;
  }
  .albums td {
    padding: 0;
    border: none;
  }
  .albums td.sel-cell {
    grid-area: 1 / 1 / span 4;
    align-self: stretch;
    display: flex;
    align-items: center;
    width: auto;
    padding: 0 !important;
  }
  .albums td.cover {
    grid-area: 1 / 2 / span 4;
    width: auto;
  }
  .albums tr.row {
    grid-template-rows: 1fr auto auto 1fr;
  }

  .albums td.spotify {
    display: contents;
  }
  .albums td.spotify > .album-title {
    grid-area: 2 / 3 / auto / -1;
    min-width: 0;
  }
  .albums td.spotify > .meta {
    grid-area: 3 / 3 / auto / -1;
    align-self: start;
    min-width: 0;
  }
  .albums td.spotify > .listen {
    grid-area: 5 / 2 / auto / -1;
    align-self: center;
    margin: 0 0 0 -5px;
    flex-wrap: nowrap;
  }
  .albums .listen-icon {
    width: 24px;
  }
  .albums td.pills {
    grid-area: 5 / 2 / auto / -1;
    justify-self: end;
    align-self: center;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    max-width: calc(100% - 150px);
  }
  .albums td.pills .pill {
    margin: 0;
  }
  .albums td.discogs {
    grid-area: 6 / 2 / auto / -1;
    min-width: 0;
  }
  .albums td.score {
    display: none;
  }
  .albums td.pills:has(.pill:not(.matched)) .pill.matched {
    display: none;
  }
  .albums tr.row {
    row-gap: 0;
  }
  .albums td.spotify > .listen,
  .albums td.pills,
  .albums td.discogs {
    margin-top: 10px;
  }
  .albums td.lowest,
  .albums td.forsale,
  .albums td.actions {
    margin-top: 12px;
  }
  .albums td.lowest {
    grid-area: 7 / 2 / auto / 4;
  }
  .albums .row-actions {
    gap: 4px;
  }
  .albums .ibtn {
    width: 32px;
    height: 32px;
  }
  .albums td.forsale {
    grid-area: 7 / 4;
  }
  .albums td.actions {
    grid-area: 7 / 5;
    align-self: center;
    justify-self: end;
  }
  .albums td[data-label] {
    text-align: left;
  }
  .albums td.lowest .meta {
    display: inline;
    margin-left: 6px;
  }
  .albums td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
  }

  :root[data-view="list"] .crate.listenable,
  :root[data-view="list"] .crate.wanted {
    --list-cols: 44px minmax(0, 1fr);
  }
  :root[data-view="list"] .record {
    row-gap: 2px;
    align-items: start;
    padding: 12px 16px;
  }
  :root[data-view="list"] .record-cover {
    grid-row: 1 / span 6;
  }
  :root[data-view="list"] .record-body > * {
    grid-column: 2;
  }
  :root[data-view="list"] .crate .listen {
    justify-content: flex-start;
    margin: 4px 0 0 -5px;
  }
}
@media (max-width: 620px) {
  .crate .listen {
    justify-content: space-between;
    gap: 0;
    margin-right: -5px;
  }
  .crate .listen-icon {
    width: 22px;
    height: 24px;
  }
  .crate .listen-icon svg {
    width: 14px;
    height: 14px;
  }
}

/* ---------- Sellers ---------- */
.seller-add {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.seller-add .control {
  flex: 1;
  min-width: 0;
}
.sellers {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 14px;
}
.seller-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.seller-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.seller .more {
  margin-top: 10px;
}
.seller-list {
  margin-top: 8px;
}
.seller-price {
  white-space: nowrap;
}
