/* ── riptide design system ────────────────────────────────
 *   Progressive enhancement — all pages work without CSS
 *   (CLI browsers, curl, etc). This file is the full design.
 *   layout.html contains minimal inline fallback styles.
 * ────────────────────────────────────────────────────────── */

:root {
  --bg: #0d0d0d;
  --bg-card: #151515;
  --bg-hover: #1a1a2e;
  --bg-input: #1a1a1a;
  --border: #2a2a2a;
  --border-focus: #4a7abf;
  --text: #e0e0e0;
  --text-dim: #777;
  --text-muted: #555;
  --accent: #4a7abf;
  --accent-hover: #5a8acf;
  --accent-dim: #256;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #eab308;
  --orange: #f97316;
  --blue: #3b82f6;
  --cyan: #06b6d4;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', monospace;
  --nav-height: 48px;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────── */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 1em;
}

/* ── Navigation ──────────────────────────────────────────── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13,13,13,.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1em;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  gap: .25em;
}

nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: .35em .75em;
  border-radius: var(--radius-sm);
  font-size: .9em;
  font-weight: 500;
  transition: color .15s, background .15s;
}

nav a:hover, nav a:focus {
  color: var(--text);
  background: var(--bg-hover);
}

nav .nav-brand {
  color: var(--text);
  font-weight: 700;
  font-size: 1em;
  margin-right: auto;
  padding-left: 0;
}

nav .nav-brand:hover { background: transparent; }

nav .nav-warning {
  color: var(--red);
  font-size: .8em;
  margin-left: .5em;
}

/* ── Typography ──────────────────────────────────────────── */
h1 { font-size: 1.5em; margin: .75em 0 .5em; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.2em; margin: 1em 0 .4em; font-weight: 600; }
h3 { font-size: 1.05em; margin: .75em 0 .3em; font-weight: 600; }

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.meta { color: var(--text-dim); font-size: .88em; }
.muted { color: var(--text-muted); }

/* ── Search Form ─────────────────────────────────────────── */
.search-form {
  display: flex;
  gap: .5em;
  margin: 1.5em 0;
}

.search-form input[type="text"] {
  flex: 1;
  padding: .65em 1em;
  font-size: 1em;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
  font-family: var(--font);
}

.search-form input[type="text"]:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(74,122,191,.15);
}

.search-form button {
  padding: .65em 1.2em;
  font-size: 1em;
  font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  gap: .35em;
  padding: .5em 1em;
  font-size: .9em;
  font-weight: 500;
  font-family: var(--font);
  background: var(--accent-dim);
  color: #fff;
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s;
  line-height: 1.4;
  white-space: nowrap;
}

button:hover, .btn:hover {
  background: var(--accent-hover);
  border-color: var(--accent);
  text-decoration: none;
}

button:active, .btn:active { transform: scale(.97); }

button.btn-primary, .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
}

button.btn-primary:hover { background: var(--accent-hover); }

.btn-sm { padding: .3em .6em; font-size: .82em; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: .75em 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92em;
}

th {
  text-align: left;
  padding: .55em .65em;
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  font-size: .85em;
  text-transform: uppercase;
  letter-spacing: .04em;
}

td {
  padding: .5em .65em;
  border-bottom: 1px solid rgba(42,42,42,.5);
  vertical-align: middle;
}

tr:nth-child(odd) td { background: rgba(255,255,255,.015); }
tr:nth-child(even) td { background: transparent; }
tr:hover td { background: var(--bg-hover); }
tr td:first-child { padding-left: .4em; }

tr:last-child td { border-bottom: none; }

td.actions {
  text-align: right;
  white-space: nowrap;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1em;
  margin: .75em 0;
}

.card-header {
  font-weight: 600;
  margin-bottom: .5em;
  color: var(--text-dim);
  font-size: .85em;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ── Status Badges ────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  padding: .15em .5em;
  border-radius: 3px;
  font-size: .78em;
  font-weight: 600;
  line-height: 1.5;
}

.badge-tidal {
  background: rgba(0,255,255,.08);
  color: var(--cyan);
  border: 1px solid rgba(0,255,255,.2);
}

.badge-qobuz {
  background: rgba(59,130,246,.08);
  color: var(--blue);
  border: 1px solid rgba(59,130,246,.2);
}

.badge-deezer {
  background: rgba(160,0,255,.08);
  color: #a0f;
  border: 1px solid rgba(160,0,255,.2);
}

.badge-bandcamp {
  background: rgba(97,146,156,.08);
  color: #7fc1ca;
  border: 1px solid rgba(97,146,156,.2);
}

.status-queued { color: var(--text-dim); }
.status-running { color: var(--yellow); }
.status-processing { color: var(--orange); }
.status-completed { color: var(--green); }
.status-error { color: var(--red); }

/* ── Flash Messages ──────────────────────────────────────── */
.flash-container { position: relative; }

.flash {
  padding: .65em 1em;
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.25);
  border-radius: var(--radius-sm);
  margin: .5em 0;
  font-size: .9em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  animation: fadeIn .25s ease;
}

.flash-error {
  background: rgba(239,68,68,.1);
  border-color: rgba(239,68,68,.25);
}

.flash .dismiss {
  cursor: pointer;
  opacity: .5;
  font-size: 1.2em;
  line-height: 1;
  background: none;
  border: none;
  color: inherit;
  padding: 0 .2em;
}

.flash .dismiss:hover { opacity: 1; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Job Status Page ─────────────────────────────────────── */
.status-bar {
  display: flex;
  align-items: center;
  gap: .75em;
  padding: .75em 1em;
  border-radius: var(--radius);
  margin: .5em 0;
  font-weight: 600;
  font-size: .95em;
}

.status-bar.active {
  background: rgba(234,179,8,.08);
  border: 1px solid rgba(234,179,8,.2);
}

.status-bar.done {
  background: rgba(34,197,94,.08);
  border: 1px solid rgba(34,197,94,.2);
}

.status-bar.fail {
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.1);
  border-top-color: var(--yellow);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

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

/* ── Progress Bar ─────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: .5em 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width .5s ease;
  width: 0%;
}

/* ── Checkbox Grid ───────────────────────────────────────── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .4em;
  margin: .5em 0;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: .5em;
  padding: .3em .5em;
  border-radius: var(--radius-sm);
  transition: background .1s;
}

.checkbox-item:hover { background: var(--bg-hover); }

.checkbox-item input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* ── Pre / Log Output ────────────────────────────────────── */
pre {
  background: #000;
  padding: .75em;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: .82em;
  line-height: 1.5;
  font-family: var(--font-mono);
  max-height: 400px;
  border: 1px solid var(--border);
}

/* ── Footer ───────────────────────────────────────────────── */
footer {
  margin-top: 2em;
  padding: 1em 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .82em;
}

.footer-disclaimer {
  margin-top: .3em;
  font-size: .78em;
  color: var(--text-muted);
  opacity: .55;
}

/* ── Breadcrumbs ─────────────────────────────────────────── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: .4em;
  font-size: .85em;
  color: var(--text-dim);
  margin: .5em 0;
  flex-wrap: wrap;
}

.breadcrumbs a { color: var(--accent); }
.breadcrumbs .sep { color: var(--text-muted); user-select: none; }

/* ── Hero / Home page ────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 2em 0 1.5em;
}

.hero h1 {
  font-size: 2em;
  margin: 0 0 .2em;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p { color: var(--text-dim); font-size: 1.05em; margin: 0 0 1.5em; }

/* ── Status Cards (home page) ──────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75em;
  margin: 1em 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1em;
  text-align: center;
}

.stat-card .stat-value {
  font-size: 1.5em;
  font-weight: 700;
  display: block;
}

.stat-card .stat-label {
  font-size: .82em;
  color: var(--text-dim);
  margin-top: .2em;
}

.stat-card.stat-ok .stat-value { color: var(--green); }
.stat-card.stat-warn .stat-value { color: var(--yellow); }
.stat-card.stat-err .stat-value { color: var(--red); }

/* ── Service indicators ──────────────────────────────────── */
.service-row {
  display: flex;
  align-items: center;
  gap: .75em;
  padding: .65em .85em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: .4em 0;
}

.service-row .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.service-row .dot.on { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.4); }
.service-row .dot.off { background: var(--text-muted); }
.service-row .dot.err { background: var(--red); }

/* ── Album Cards ───────────────────────────────────────── */
.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .75em;
  margin: .75em 0;
}

.album-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1em;
  transition: border-color .15s, box-shadow .15s;
}

.album-card:hover {
  border-color: var(--border-focus);
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
}

.album-card .album-title {
  font-weight: 600;
  font-size: 1em;
  margin-bottom: .2em;
}

.album-card .album-artist {
  font-size: .88em;
  color: var(--text-dim);
  margin-bottom: .4em;
}

.album-card .album-meta {
  display: flex;
  align-items: center;
  gap: .5em;
  font-size: .82em;
  color: var(--text-muted);
  margin-bottom: .6em;
}

.album-card .album-actions {
  display: flex;
  align-items: center;
  gap: .5em;
  flex-wrap: wrap;
}

/* ── Quick Actions ────────────────────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .5em;
  margin: 1em 0;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .3em;
  padding: 1em .5em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .1s;
  font-size: .9em;
}

.quick-action:hover {
  border-color: var(--border-focus);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--text);
}

.quick-action .qa-icon {
  font-size: 1.5em;
}

.quick-action .qa-label {
  font-weight: 500;
}

/* ── Search Results Toolbar ──────────────────────────────── */
.results-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  margin: 1em 0 .75em;
  flex-wrap: wrap;
}

.filter-chips {
  display: flex;
  gap: .4em;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  padding: .35em .8em;
  font-size: .85em;
  font-weight: 500;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
}

.chip:hover {
  color: var(--text);
  border-color: var(--border-focus);
}

.chip.active {
  background: var(--accent-dim);
  color: #fff;
  border-color: var(--accent);
}

.sort-control select {
  padding: .35em .6em;
  font-size: .85em;
  font-family: var(--font);
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

/* ── Track List (column layout) ──────────────────────────── */
.track-list {
  margin: .5em 0;
}

.track-list-header {
  display: grid;
  grid-template-columns: 40px 40px 1fr 1fr auto 80px 90px;
  gap: .5em;
  padding: .4em .6em;
  font-size: .78em;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}

.track-row {
  display: grid;
  grid-template-columns: 40px 40px 1fr 1fr auto 80px 90px;
  gap: .5em;
  padding: .5em .6em;
  align-items: center;
  border-bottom: 1px solid rgba(42,42,42,.5);
  transition: background .1s;
}

.track-row:hover {
  background: var(--bg-hover);
}

.track-row:nth-child(odd) {
  background: rgba(255,255,255,.015);
}

.track-row:nth-child(even) {
  background: transparent;
}

.track-row:hover {
  background: var(--bg-hover);
}

.col-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.col-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

.col-num {
  text-align: right;
  color: var(--text-muted);
  font-size: .88em;
}

.col-info {
  display: flex;
  flex-direction: column;
  gap: .1em;
  min-width: 0;
}

.track-title {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: .88em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-album {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-source {
  display: flex;
  gap: .3em;
}

.col-duration {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.col-action {
  text-align: right;
}

/* ── Bulk Action Bar ─────────────────────────────────────── */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: .75em;
  padding: .6em 1em;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: .5em;
  position: sticky;
  bottom: 1em;
  z-index: 50;
}

.bulk-count {
  font-size: .88em;
  font-weight: 500;
  color: var(--text-dim);
}

.bulk-count span {
  color: var(--accent);
  font-weight: 600;
}

/* ── Empty states ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2em 1em;
  color: var(--text-dim);
}

.empty-state .empty-icon { font-size: 2.5em; margin-bottom: .5em; opacity: .3; }
.empty-state h3 { color: var(--text-dim); margin: .5em 0; }
.empty-state p { font-size: .9em; }

/* ── Search hint / keyboard ───────────────────────────────── */
.search-hint {
  font-size: .78em;
  color: var(--text-muted);
  margin-top: .3em;
  text-align: center;
}

kbd {
  display: inline-block;
  padding: .1em .35em;
  font-size: .82em;
  font-family: var(--font);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-dim);
}

/* ── Utility ─────────────────────────────────────────────── */
.flex { display: flex; align-items: center; gap: .5em; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: .3em; }
.gap-md { gap: .75em; }
.gap-lg { gap: 1.25em; }
.mt-sm { margin-top: .5em; }
.mt-md { margin-top: 1em; }
.mb-sm { margin-bottom: .5em; }
.mb-md { margin-bottom: 1em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hidden { display: none !important; }

/* ── Search Loading State ─────────────────────── */
.search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25em;
  padding: 4em 1em;
  text-align: center;
}

.search-loading .loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.search-loading .loading-text {
  font-size: .95em;
  color: var(--text-dim);
  font-weight: 500;
}

.search-loading .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  margin: 0 1px;
  vertical-align: middle;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.search-loading .dot:nth-child(1) { animation-delay: 0s; }
.search-loading .dot:nth-child(2) { animation-delay: .3s; }
.search-loading .dot:nth-child(3) { animation-delay: .6s; }

@keyframes pulse-dot {
  0%, 80%, 100% { opacity: .25; transform: scale(.75); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* ── Player page ──────────────────────────────────────────── */
.player-page { max-width: 720px; margin: 0 auto; }

.player-track-info { text-align: center; margin: 1em 0 1.5em; }

.player-track-name {
  font-size: 1.3em;
  font-weight: 700;
  letter-spacing: -.01em;
}

.player-artist {
  font-size: 1em;
  color: var(--text-dim);
  margin-top: .2em;
}

.player-album {
  font-size: .88em;
  color: var(--text-muted);
  margin-top: .1em;
}

.waveform-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75em;
  margin: 1em 0;
  min-height: 80px;
}

.waveform-container wave {
  overflow: hidden;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 1em;
  margin: 1em 0;
  flex-wrap: wrap;
}

.play-btn {
  min-width: 100px;
  justify-content: center;
  font-size: 1em;
  padding: .6em 1.4em;
}

.player-time {
  font-variant-numeric: tabular-nums;
  font-size: .92em;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.time-sep {
  color: var(--text-muted);
  margin: 0 .15em;
}

.player-volume {
  display: flex;
  align-items: center;
  gap: .5em;
  margin-left: auto;
}

.volume-label {
  font-size: .82em;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .04em;
}

#volume-slider {
  width: 80px;
  accent-color: var(--accent);
  cursor: pointer;
}

.player-links {
  display: flex;
  gap: .5em;
  margin: .75em 0;
  flex-wrap: wrap;
}

.player-links .btn {
  font-size: .85em;
}

@media (max-width: 640px) {
  .player-controls { gap: .6em; }
  .player-time { font-size: .85em; }
  .player-volume { margin-left: 0; }
  #volume-slider { width: 60px; }
  .player-track-name { font-size: 1.1em; }
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .container { padding: 0 .6em; }
  nav { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  nav::-webkit-scrollbar { display: none; }
  nav a { font-size: .82em; padding: .3em .5em; }
  h1 { font-size: 1.25em; }
  .hero h1 { font-size: 1.45em; }
  .hero p { font-size: .92em; }
  table { font-size: .82em; }
  th, td { padding: .35em .35em; }
  td.actions { white-space: normal; }
  td.actions .btn { white-space: nowrap; }
  .search-form { flex-direction: column; }
  .search-form input[type="text"] { width: 100%; }
  .search-form button { width: 100%; justify-content: center; padding: .75em 1.2em; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .checkbox-item { padding: .5em .5em; min-height: 44px; }
  .truncate { max-width: 120px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: .5em; }
  .stat-card { padding: .75em; }
  .stat-card .stat-value { font-size: 1.2em; }
  .album-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); gap: .4em; }
  .quick-action { padding: .75em .4em; font-size: .85em; }
  .service-row { padding: .5em .65em; }
  pre { font-size: .75em; max-height: 300px; }
  .breadcrumbs { font-size: .8em; }
  .flash { font-size: .82em; padding: .5em .75em; }
  .status-bar { font-size: .88em; padding: .6em .75em; }
  button, .btn { min-height: 44px; padding: .6em 1em; }
  .btn-sm { min-height: auto; padding: .35em .6em; }

  .results-toolbar { flex-direction: column; align-items: flex-start; gap: .5em; }
  .track-list-header { display: none; }
  .track-row {
    display: flex;
    flex-wrap: wrap;
    gap: .25em .5em;
    padding: .6em;
  }
  .track-row .col-check { order: -1; }
  .track-row .col-num { display: none; }
  .track-row .col-info { flex: 1; min-width: 120px; order: 1; }
  .track-row .col-source { order: 2; }
  .track-row .col-duration { order: 3; }
  .track-row .col-album { display: none; }
  .track-row .col-action { order: 4; }
  .bulk-bar { flex-wrap: wrap; gap: .5em; }
  .search-loading { padding: 2.5em .6em; }
  .search-loading .loading-spinner { width: 28px; height: 28px; border-width: 2px; }
}

@media (max-width: 480px) {
  .container { padding: 0 .4em; }
  nav a { font-size: .78em; padding: .25em .4em; }
  h1 { font-size: 1.1em; }
  .hero h1 { font-size: 1.25em; }
  .hero { padding: 1.25em 0 1em; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: .35em; }
  .stat-card { padding: .6em .4em; }
  .stat-card .stat-value { font-size: 1.1em; }
  .album-grid { gap: .5em; }
  .album-card { padding: .75em; }
  .quick-actions { grid-template-columns: 1fr 1fr; gap: .35em; }
  td.actions { display: flex; flex-wrap: wrap; gap: .25em; }
  td.actions .btn { font-size: .78em; padding: .35em .5em; min-height: auto; }
  .table-wrap { margin: .5em -0.4em; border-radius: 0; }
  .service-row { font-size: .88em; }
  footer { font-size: .75em; }
}

/* ── Filter chips ──────────────────────────────────────────── */
.filter-chips { margin: .5em 0; }
.chip {
  display: inline-flex; align-items: center; gap: .35em;
  padding: .25em .65em; border-radius: 999px;
  font-size: .82em; font-weight: 500; text-decoration: none;
  background: var(--bg-card); color: var(--text-dim);
  border: 1px solid var(--border); transition: .15s;
  cursor: pointer;
}
.chip:hover { background: var(--bg-hover); color: var(--text); }
.chip-active {
  background: var(--accent-dim); color: var(--accent);
  border-color: var(--accent);
}
.chip-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.35em; height: 1.35em; border-radius: 999px;
  font-size: .78em; font-weight: 600;
  background: rgba(255,255,255,.1); padding: 0 .3em;
}
.chip-active .chip-count { background: rgba(74,122,191,.25); }

/* ── Pagination ────────────────────────────────────────────── */
.pagination { align-items: center; gap: .5em; }
.pagination .meta { font-size: .85em; }
.justify-center { justify-content: center; }

/* ── Utility extras ────────────────────────────────────────── */
.flex-wrap { flex-wrap: wrap; }
.gap-xs { gap: .3em; }
.self-center { align-self: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
