/* Design system Diggr — gris macOS + accent vert, composants sobres (esprit daisyUI).
   Primitives : .btn (.btn-primary / .btn-ghost / .btn-sm / .btn-icon), .badge-soft,
   .data-table (tableaux denses à en-tête fixe), icônes via {{ icon("nom") }}.
   Les anciennes classes (.neu, .neu-pill, .tag…) restent supportées. */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500&display=swap');

:root {
  --font-sans:     'Geist', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-mono:     'Geist Mono', ui-monospace, Menlo, monospace;
  --row-h:         40px;
  /* Palette — Apple-style dark, warmer & lighter */
  --bg:            #3a3a3c;       /* macOS "secondary system background" feel */
  --bg-raised:     #48484a;       /* elevated surface */
  --bg-sunken:     #2c2c2e;       /* inset/deepest */
  --bg-surface:    rgba(255,255,255,0.05);
  --bg-surface-2:  rgba(255,255,255,0.08);
  --bg-surface-hover: rgba(0,229,160,0.06);
  --text-main:     #F5F5F7;       /* Apple's off-white */
  --text-muted:    rgba(255,255,255,0.55);
  --accent:        #00E5A0;
  --accent-dim:    rgba(0,229,160,0.12);
  --accent-soft:   rgba(0,229,160,0.2);
  --border:        rgba(255,255,255,0.07);
  --border-accent: rgba(0,229,160,0.25);
  --danger:        #ff6b6b;
  --danger-dim:    rgba(255,107,107,0.12);
  --warn:          #ffb36b;
  --ok:            var(--accent);

  /* Effects */
  --glass-blur:    blur(24px);
  --shadow-out:    6px 6px 14px rgba(0,0,0,0.45), -4px -4px 10px rgba(255,255,255,0.025);
  --shadow-out-sm: 3px 3px 7px rgba(0,0,0,0.4), -2px -2px 5px rgba(255,255,255,0.022);
  --shadow-in:     inset 3px 3px 6px rgba(0,0,0,0.5), inset -2px -2px 5px rgba(255,255,255,0.03);
  --shadow-in-sm:  inset 2px 2px 4px rgba(0,0,0,0.45), inset -1px -1px 3px rgba(255,255,255,0.025);

  /* Geometry */
  --radius:        12px;
  --radius-sm:     8px;
  --radius-pill:   100px;
}

/* ─────────── Icônes ─────────── */
.i {
  width: 16px; height: 16px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
}
.i-sm { width: 14px; height: 14px; vertical-align: -2px; }
.i-lg { width: 20px; height: 20px; }

/* ─────────── Boutons (esprit daisyUI) ─────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  font: 500 0.84rem/1 var(--font-sans); letter-spacing: 0; text-transform: none;
  color: var(--text-main); background: var(--bg-surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: none; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: rgba(255,255,255,0.12); transform: none; filter: none; opacity: 1; }
.btn-primary { background: var(--accent); color: #0d1f18; border-color: transparent; font-weight: 600; }
.btn-primary:hover { background: #2bf0b4; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg-surface-2); color: var(--text-main); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 0.78rem; }
.btn-icon { width: 28px; height: 28px; padding: 0; border-radius: var(--radius-sm); }
.btn-icon.btn-round { border-radius: 50%; }
.btn.is-on { color: var(--accent); background: var(--accent-dim); border-color: var(--border-accent); }

/* Badge discret : pas de majuscules forcées ni de halo */
.badge-soft {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px; border-radius: 6px;
  font: 500 0.72rem/1 var(--font-sans); letter-spacing: 0;
  color: var(--text-muted); background: var(--bg-surface-2);
  white-space: nowrap; text-decoration: none;
}
a.badge-soft:hover { color: var(--text-main); opacity: 1; }
.badge-soft.is-accent { color: var(--accent); background: var(--accent-dim); }
.badge-mono { font-family: var(--font-mono); font-size: 0.66rem; padding: 0 5px; height: 18px; }

/* ─────────── Neumorphic primitives (reusable) ─────────── */

/* Raised element — cards, buttons-ghost, surfaces that must pop */
.neu {
  background: var(--bg-raised);
  border-radius: var(--radius);
  box-shadow: var(--shadow-out);
  border: 1px solid rgba(255,255,255,0.02);
  max-width: 100%;
  min-width: 0;
}
.neu-sm { box-shadow: var(--shadow-out-sm); }

/* Any .neu containing a wide table becomes horizontally scrollable.
   Uses :has() — supported by all modern browsers (Chrome 105+, Safari 15.4+, Firefox 121+). */
.neu:has(> table),
.neu:has(> table.popular-table),
.neu:has(> table.tracks) {
  overflow-x: auto;
}
/* Fallback style on tables themselves : keep them from forcing page scroll */
table.popular-table,
table.tracks {
  max-width: 100%;
}
/* Helper utility class si on veut forcer le wrap sur un container quelconque */
.tbl-scroll {
  overflow-x: auto;
  max-width: 100%;
  border-radius: 8px;
}

/* Compact density + sticky pour la table /tracks.
   Sticky requires: border-collapse:separate + scroll container with fixed height
   (on place max-height sur #tracks-wrap dans le template). */
table.tracks,
table.tracks-compact {
  border-collapse: separate !important;
  border-spacing: 0;
  width: max-content;
  min-width: 100%;
  font-size: 0.82rem;
}
table.tracks th,
table.tracks td {
  padding: 6px 10px;                         /* compact */
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: middle;
  white-space: nowrap;                       /* pas de wrap par défaut */
}
/* Autoriser le wrap sur les colonnes textes longs (Titre, Remixer, Tags) */
table.tracks td[data-col="titre"],
table.tracks td[data-col="remixer"],
table.tracks td[data-col="tags"] {
  white-space: normal;
  max-width: 260px;
}
/* Largeurs serrées pour les colonnes numériques/pills */
table.tracks th[data-col="lang"],
table.tracks td[data-col="lang"],
table.tracks th[data-col="bpm"],
table.tracks td[data-col="bpm"],
table.tracks th[data-col="plays"],
table.tracks td[data-col="plays"],
table.tracks th[data-col="protected"],
table.tracks td[data-col="protected"],
table.tracks th[data-col="id"],
table.tracks td[data-col="id"] {
  text-align: center;
  width: 1%;                                 /* shrink-to-fit */
}
/* Player column : audio tag compact */
table.tracks td[data-col="player"] audio { width: 200px; height: 30px; }

/* Sticky header vertical (contre le scroll container #tracks-wrap qui a max-height) */
#tracks-wrap { position: relative; }
#tracks-wrap table.tracks thead th {
  position: sticky;
  top: 0;
  background: #1a1a1f;
  z-index: 3;
}
/* Sticky colonne Titre (première colonne) horizontal */
#tracks-wrap table.tracks thead th[data-col="titre"],
#tracks-wrap table.tracks tbody td[data-col="titre"] {
  position: sticky;
  left: 0;
  background: #1a1a1f;
  z-index: 2;
  box-shadow: 2px 0 6px rgba(0,0,0,0.5);
  border-right: 1px solid rgba(255,255,255,0.08);
}
#tracks-wrap table.tracks thead th[data-col="titre"] {
  z-index: 4;                                /* coin haut-gauche = maximum */
}

/* Inset (sunken) — badges, tags, chips, pressed state */
.neu-inset {
  background: var(--bg-sunken);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-in);
  border: 1px solid rgba(0,0,0,0.15);
}

/* Pill-shape variant (for inline tags/badges) — version sobre */
.neu-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0; text-transform: none;
  background: var(--bg-surface-2);
  color: var(--text-muted);
  box-shadow: none;
  border: 1px solid var(--border);
  text-decoration: none;
}
a.neu-pill:hover { color: var(--text-main); background: rgba(255,255,255,0.12); opacity: 1; }
.neu-pill.is-danger  { color: var(--danger); }
.neu-pill.is-accent  { color: var(--accent); }
.neu-pill.is-warn    { color: var(--warn); }
.neu-pill.is-muted   { color: var(--text-muted); }
.neu-pill.is-accent { background: var(--accent-dim); border-color: var(--border-accent); }
.neu-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}

/* Small numeric/indicator chip */
.neu-chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: 0.75rem; font-weight: 600;
  background: var(--bg-sunken); color: var(--text-main);
  box-shadow: var(--shadow-in-sm);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg); color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14.5px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
  overflow-x: hidden;
}

/* Nav */
header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(50,50,52,0.88);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border);
  height: 56px; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
header h1 { font-weight: 700; font-size: 1.05rem; letter-spacing: -0.02em; }
header h1 a { color: var(--text-main); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
header h1 .logo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
header nav { display: flex; align-items: center; gap: 2px; }
header nav > a, .nav-menu > summary {
  display: inline-flex; align-items: center; gap: 7px;
  height: 32px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); text-decoration: none;
  font-weight: 500; font-size: 0.84rem; transition: color .15s, background .15s;
  cursor: pointer; list-style: none;
}
header nav > a:hover, .nav-menu > summary:hover { color: var(--text-main); background: var(--bg-surface); opacity: 1; }
header nav > a.is-active { color: var(--text-main); background: var(--bg-surface-2); }
header nav > a.is-active .i { color: var(--accent); }
.nav-menu { position: relative; }
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu[open] > summary { color: var(--text-main); background: var(--bg-surface-2); }
.nav-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 120;
  min-width: 220px; padding: 6px;
  background: #2f2f31; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
.nav-menu-panel a {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 6px;
  color: var(--text-main); font-size: 0.84rem; text-decoration: none;
}
.nav-menu-panel a:hover { background: var(--bg-surface-2); opacity: 1; }
.nav-menu-panel .menu-title {
  padding: 8px 10px 4px; font-size: 0.7rem; font-weight: 500; color: var(--text-muted);
}
.nav-menu-panel hr { border: 0; border-top: 1px solid var(--border); margin: 6px 4px; }
.nav-user { display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; padding-left: 12px;
            border-left: 1px solid var(--border); font-size: 0.82rem; color: var(--text-muted); }
.nav-user .avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center;
                    justify-content: center; background: var(--accent-dim); color: var(--accent); font-weight: 600; font-size: 0.75rem; }

main { padding: 36px 32px 120px; max-width: 1440px; margin: 0 auto; }

h1 { font-weight: 700; letter-spacing: -0.02em; }
h2 {
  font-weight: 700; font-size: 1.6rem; letter-spacing: -0.025em;
  margin: 40px 0 18px;
}
h2:first-child { margin-top: 0; }
h3 {
  font-weight: 600; font-size: 0.82rem; text-transform: none; letter-spacing: 0;
  color: var(--text-muted); margin: 28px 0 12px;
}

a { color: var(--accent); text-decoration: none; transition: opacity .2s; }
a:hover { opacity: 0.8; }

/* Buttons — défaut sobre (les anciennes pages utilisent <button> nu) */
button {
  background: var(--accent); color: #0d1f18;
  border: none; padding: 0 16px; height: 34px;
  font-family: inherit; font-weight: 600; font-size: 0.84rem;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: background .15s, filter .15s;
}
button:hover { filter: brightness(1.08); }
button.ghost, button.secondary {
  background: var(--bg-surface-2);
  color: var(--text-main);
  border: 1px solid var(--border);
  box-shadow: none;
}
button.ghost:hover, button.secondary:hover {
  background: rgba(255,255,255,0.12);
  color: var(--text-main);
  filter: none;
}
button.danger {
  background: transparent; color: var(--danger);
  border: 1px solid rgba(255,107,107,0.2);
}
button.danger:hover { background: var(--danger-dim); border-color: var(--danger); transform: none; filter: none; }

/* KPIs */
.kpis {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 40px;
}
.kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .2s, background .2s;
}
.kpi:hover { border-color: var(--border-accent); }
.kpi b { font-weight: 600; font-size: 1.75rem; letter-spacing: -0.03em; color: var(--text-main);
         font-variant-numeric: tabular-nums; }
.kpi span {
  font-size: 0.8rem; text-transform: none; letter-spacing: 0;
  color: var(--text-muted); font-weight: 400;
}
.kpi small { margin-top: 8px; color: var(--text-muted); font-size: 0.75rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
th {
  text-align: left; padding: 10px 14px; font-weight: 500;
  text-transform: none; font-size: 0.75rem; letter-spacing: 0;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
}
td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--bg-surface); }
.filename { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.76rem; }

/* Champs de saisie */
input[type=text], input[type=search], input[type=number], input[type=email],
input[type=password], select, textarea {
  font-family: inherit; font-size: 0.86rem; color: var(--text-main);
  background: var(--bg-sunken); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 10px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--border-accent); }

/* Filters */
.filters { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select {
  background: var(--bg-sunken); border: 1px solid var(--border); color: var(--text-main);
  height: 34px; padding: 0 12px; font-family: inherit; font-size: 0.86rem;
  border-radius: var(--radius-sm); min-width: 120px;
}
.filters input { min-width: 300px; }
.input-icon { position: relative; display: inline-flex; align-items: center; }
.input-icon .i { position: absolute; left: 10px; color: var(--text-muted); pointer-events: none; }
.input-icon input { padding-left: 32px; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--border-accent); background: var(--bg-surface-2); }

/* Jobs + config */
.jobs { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 56px 0 40px; padding-top: 28px; border-top: 1px solid var(--border); }
.jobs h2 { margin: 0 16px 0 0; }
.jobs form, .jobs a { margin: 0; }
.jobs a { display: inline-flex; }
.jobs form:not(:first-child) button {
  background: var(--bg-raised); color: var(--text-main);
  border: 1px solid rgba(255,255,255,0.04);
  box-shadow: var(--shadow-out-sm);
}
.jobs form:not(:first-child) button:hover {
  background: #38383a; color: var(--accent);
  box-shadow: var(--shadow-out); transform: translateY(-1px); filter: none;
}

.jobs-status ul { list-style: none; padding: 0; }
.jobs-status li { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 0.85rem; background: var(--bg-surface); border-radius: var(--radius); margin-bottom: 6px; border: 1px solid var(--border); }
.err { color: var(--danger); }

/* Health + folders */
.health table td, .folders table td { padding: 8px 16px; }
.config { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 26px; margin-top: 24px; }
.config dl { display: grid; grid-template-columns: 220px 1fr; gap: 8px 20px; font-size: 0.88rem; }
.config dt { color: var(--text-muted); }
.config dd { font-family: var(--font-mono); font-size: 0.82rem; }

/* Dedup — badges reuse the neumorphic pill primitive */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 6px;
  font-size: 0.74rem; font-weight: 500; letter-spacing: 0; text-transform: none;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.badge-duplicate { color: var(--danger); }
.badge-probable  { color: var(--accent); }
.badge-version   { color: var(--warn); }

.kind-duplicate td:first-child { box-shadow: inset 2px 0 0 var(--danger); }
.kind-probable  td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.kind-version   td:first-child { box-shadow: inset 2px 0 0 var(--warn); }

.dedup-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; margin-top: 20px; }
.card {
  background: var(--bg-surface); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px;
  transition: border-color .2s;
}
.card:hover { border-color: var(--border-accent); }
.card-keep  { border-color: var(--border-accent); }
.card-trash { opacity: 0.72; }
.card-head  { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card h3 {
  font-weight: 600; font-size: 1.15rem; color: var(--text-main);
  text-transform: none; letter-spacing: -0.01em; margin: 0 0 4px;
}
.card .artist { color: var(--text-muted); margin: 0 0 14px; font-size: 0.9rem; }
.tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.74rem; text-transform: none; letter-spacing: 0;
  padding: 3px 9px; border-radius: 6px; font-weight: 500;
  background: var(--bg-surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.tag::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.tag-keep  { color: var(--accent); }
.tag-trash { color: var(--danger); }
.sim { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.78rem; }
.meta { display: grid; grid-template-columns: 90px 1fr; gap: 5px 12px; font-size: 0.82rem; margin: 14px 0; }
.meta dt { color: var(--text-muted); font-weight: 500; }
.meta dd { margin: 0; }
.card audio { width: 100%; margin: 10px 0; height: 34px; }

.spectro {
  margin: 10px 0 6px;
  background: var(--bg-sunken); border-radius: var(--radius-sm);
  padding: 8px; box-shadow: var(--shadow-in-sm);
  border: 1px solid rgba(0,0,0,0.2);
  display: grid;
  grid-template-columns: 44px 1fr;
  grid-template-rows: 1fr auto;
  gap: 4px 6px;
}
.spectro-yaxis {
  grid-column: 1; grid-row: 1;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 2px 0;
  font-size: 0.62rem; font-family: var(--font-mono);
  color: var(--text-muted); letter-spacing: 0.03em; text-align: right;
}
.spectro img { grid-column: 2; grid-row: 1; width: 100%; height: auto; display: block; border-radius: 4px; }
.spectro-xaxis {
  grid-column: 2; grid-row: 2;
  display: flex; justify-content: space-between;
  font-size: 0.62rem; font-family: var(--font-mono);
  color: var(--text-muted); padding-top: 2px;
}
.card .actions { display: flex; gap: 10px; margin-top: 16px; }
.shortcuts { color: var(--text-muted); font-size: 0.82rem; margin-top: 28px; }
.detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.detail-head .back { font-size: 0.85rem; }
.flash { padding: 18px 22px; margin-bottom: 28px; font-size: 0.95rem; color: var(--accent); }

/* Pin (Extended request) */
.head-right { display: flex; align-items: center; gap: 12px; }
.pin-btn {
  background: var(--bg-sunken); color: var(--text-muted);
  border: 1px solid rgba(0,0,0,0.25); box-shadow: var(--shadow-in-sm);
  width: 34px; height: 34px; padding: 0;
  border-radius: 50%;
  font-family: var(--font-sans);
  font-weight: 600; font-size: 18px; line-height: 1;
  cursor: pointer;
  transition: color .2s, background .2s, transform .15s, box-shadow .2s;
}
.pin-btn:hover { color: var(--warn); background: var(--bg-raised); box-shadow: var(--shadow-out-sm); transform: translateY(-1px) scale(1.08); filter: none; }
.pin-btn-d:hover { color: var(--danger); }
.pin-done {
  display: inline-flex; align-items: center; padding: 5px 12px;
  border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--bg-sunken); color: var(--warn); box-shadow: var(--shadow-in-sm);
}

/* Subnav on /extended */
.subnav { display: flex; gap: 4px; margin: 20px 0 28px; }
.subnav a {
  padding: 8px 16px; border-radius: var(--radius-pill); font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-raised); box-shadow: var(--shadow-out-sm);
  border: 1px solid rgba(255,255,255,0.04);
}
.subnav a:hover { color: var(--text-main); }
.subnav a.active { color: var(--accent); box-shadow: var(--shadow-in-sm); background: var(--bg-sunken); }
.subnav a .count { margin-left: 6px; font-family: var(--font-mono); font-size: 0.75rem; opacity: 0.7; }

.actions-row { display: flex; gap: 6px; flex-wrap: wrap; }
.actions-row button { padding: 6px 12px; font-size: 0.75rem; }
.muted { color: var(--text-muted); }
.empty { padding: 40px 0; color: var(--text-muted); text-align: center; }

/* XL stats (big numbers) in dedup cards */
.xl-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin: 18px 0 20px;
}
.xl-stat b { font-size: 1.45rem; }  /* slightly smaller to fit 4 columns */
.xl-stat {
  padding: 14px 16px; border-radius: var(--radius);
  background: var(--bg-sunken); box-shadow: var(--shadow-in-sm);
  border: 1px solid rgba(0,0,0,0.2);
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  transition: color .2s, box-shadow .2s;
}
.xl-stat b {
  font-family: var(--font-sans); font-weight: 600;
  font-size: 1.6rem; letter-spacing: -0.03em; line-height: 1;
  color: var(--text-main);
}
.xl-stat span {
  font-size: 0.65rem; text-transform: none; letter-spacing: 0;
  color: var(--text-muted); font-weight: 600;
}
.xl-stat.is-best {
  background: linear-gradient(135deg, rgba(0,229,160,0.18), rgba(0,229,160,0.06));
  box-shadow: inset 1px 1px 2px rgba(0,229,160,0.2), inset -1px -1px 2px rgba(0,0,0,0.3);
  border: 1px solid rgba(0,229,160,0.25);
}
.xl-stat.is-best b    { color: var(--accent); }
.xl-stat.is-best span { color: var(--accent); opacity: 0.8; }

.inbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 18px; }
.inbox-kind-trashed { border-left: 2px solid var(--danger); }
.inbox-kind-active  { border-left: 2px solid var(--warn); }
.inbox-kind-none    { border-left: 2px solid var(--accent); }

.artist-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 16px; }
.artist-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; position: relative; }
.artist-avatar { flex-shrink: 0; width: 52px; height: 52px; border-radius: 50%; overflow: hidden; background: var(--bg-sunken); box-shadow: var(--shadow-in-sm); }
.artist-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-placeholder { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--font-sans); font-weight: 600; font-size: 1.3rem; color: var(--text-muted); }
.artist-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.artist-name { color: var(--text-main); font-weight: 700; font-size: 0.95rem; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artist-name:hover { color: var(--accent); }
.artist-handle { color: var(--text-muted); font-size: 0.75rem; font-family: var(--font-mono); }
.artist-stats { margin-top: 4px; font-size: 0.75rem; color: var(--accent); }
.artist-card button.danger { padding: 4px 10px; font-size: 0.9rem; border-radius: 50%; width: 28px; height: 28px; line-height: 1; position: absolute; top: 10px; right: 10px; }
.tag-form { margin: 6px 0 4px; }
.tag-form input { width: 100%; background: var(--bg-sunken); border: 1px solid rgba(0,0,0,0.2); box-shadow: var(--shadow-in-sm); color: var(--text-main); padding: 5px 10px; font-size: 0.72rem; font-family: inherit; border-radius: var(--radius-pill); }
.tag-form input:focus { outline: none; box-shadow: var(--shadow-in-sm), 0 0 0 1px var(--border-accent); }
.artist-tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.artist-tags a { text-decoration: none; font-size: 0.62rem; padding: 2px 8px; }
.tag-bar { margin: 20px 0 28px; flex-wrap: wrap; }
.tag-bar a { text-transform: lowercase; font-weight: 500; letter-spacing: 0.03em; }

.older-feed { margin-top: 36px; }
.older-feed summary {
  cursor: pointer; padding: 14px 20px; list-style: none;
  background: var(--bg-raised); border-radius: var(--radius-pill);
  box-shadow: var(--shadow-out-sm); display: inline-block;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em;
  transition: background .2s, color .2s;
}
.older-feed summary:hover { background: #38383a; color: var(--accent); }
.older-feed summary::-webkit-details-marker { display: none; }
.older-feed summary::before { content: "▸ "; display: inline-block; margin-right: 4px; transition: transform .2s; }
.older-feed[open] summary::before { transform: rotate(90deg); }

.tag-mini-form input {
  background: var(--bg-sunken); border: 1px solid rgba(0,0,0,0.2);
  box-shadow: var(--shadow-in-sm); color: var(--text-main);
  padding: 5px 10px; font-size: 0.72rem; font-family: inherit;
  border-radius: var(--radius-pill);
}
.tag-mini-form input:focus { outline: none; box-shadow: var(--shadow-in-sm), 0 0 0 1px var(--border-accent); }
.follow-btn:hover { color: var(--accent); }

.sc-badge {
  display: inline-flex; align-items: center; gap: 5px;
  margin-left: 8px; padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-sunken); box-shadow: var(--shadow-in-sm);
  border: 1px solid rgba(0,0,0,0.2);
  color: #FF5500; /* SoundCloud orange */
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.12em;
  text-decoration: none;
  vertical-align: middle;
}
.sc-badge:hover { background: var(--bg-raised); text-decoration: none; }
.sc-badge img { width: 12px; height: 12px; display: block; }
.sc-badge span { line-height: 1; }

.sc-feed { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; margin-top: 20px; }
.sc-card iframe { background: var(--bg-sunken); }
.sc-artist { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 600; font-size: 0.85rem; }
.sc-artist-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--bg-sunken); box-shadow: var(--shadow-in-sm); flex-shrink: 0; }
.sc-artist-avatar.avatar-placeholder { display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; }
.sc-artist:hover .sc-artist-name { color: var(--accent); }
.sc-link { display: inline-flex; align-items: center; color: var(--text-muted); margin-left: 6px; vertical-align: middle; transition: color .15s; }
.sc-link:hover { color: #ff5500; }
.artist-link { color: var(--text); text-decoration: none; border-bottom: 1px dashed rgba(0,229,160,0.5); }
.artist-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.tier-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.7rem; font-weight: 500; text-transform: none; letter-spacing: 0; margin-left: 6px; }
.tier-indé    { background: rgba(0,229,160,0.15); color: #00e5a0; }
.tier-gros-indé { background: rgba(255,184,0,0.18); color: #ffb800; }
.tier-reconnu { background: rgba(255,80,120,0.18); color: #ff5078; }
.tier-inconnu { background: var(--bg-sunken); color: var(--text-muted); }
.tier-deezer-mainstream { background: rgba(239,84,102,0.18); color: #ef5466; }
.tier-deezer-confirme   { background: rgba(255,184,0,0.18); color: #ffb800; }
.tier-deezer-inde       { background: rgba(0,229,160,0.15); color: #00e5a0; }
.tier-deezer-inconnu    { background: var(--bg-sunken); color: var(--text-muted); }
.dz-badge { display: inline-flex; align-items: center; padding: 2px; border-radius: 6px; background: transparent; text-decoration: none; margin-left: 4px; vertical-align: middle; }
.dz-badge img { width: 18px; height: 18px; display: block; border-radius: 4px; }
.dz-badge:hover { background: rgba(239,84,102,0.18); }
.follow-btn.pill-sc, .follow-btn.pill-dz { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; font-size: 0.65rem; line-height: 1; margin-left: 4px; border-radius: 999px; }
.follow-btn.pill-sc img, .follow-btn.pill-dz img { width: 14px; height: 14px; display: block; }
.follow-btn.pill-sc { color: #ff5500; border: 1px solid rgba(255,85,0,0.35); }
.follow-btn.pill-sc:hover { background: rgba(255,85,0,0.1); }
.follow-btn.pill-dz { color: #ef5466; border: 1px solid rgba(239,84,102,0.35); }
.follow-btn.pill-dz:hover { background: rgba(239,84,102,0.1); }
.genre-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.tag-classic { background: rgba(255,184,0,0.18); color: #ffb800; }
.row-player { height: 28px; width: 200px; transform: scale(0.85); transform-origin: left center; }
.popular-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.popular-table th, .popular-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.06); }
.popular-table th { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; }
.popular-table tr.row-owned { opacity: 0.55; }
.popular-table tr.player-row td { padding: 0 12px 14px; border-bottom: 1px solid rgba(255,255,255,0.06); }
.popular-table tr.row-missing td a { font-weight: 600; }
.track-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; display: block; }
.badge-owned   { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; background: rgba(0,229,160,0.15); color: #00e5a0; }
.badge-missing { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 0.7rem; font-weight: 700; background: rgba(255,80,120,0.18); color: #ff5078; }
.dl-links { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.dl-links a { text-decoration: none; font-size: 0.7rem; }

/* Drop zone */
.dropzone {
  margin: 28px 0; padding: 0; cursor: pointer;
  transition: background .2s, box-shadow .2s, border-color .2s;
}
.dropzone input[type=file] { display: none; }
.dropzone-inner {
  padding: 72px 40px; text-align: center;
  border: 2px dashed var(--border); border-radius: var(--radius);
  transition: border-color .2s, background .2s;
}
.dropzone:hover .dropzone-inner,
.dropzone.drag-over .dropzone-inner {
  border-color: var(--accent); background: var(--bg-surface-hover);
}
.dropzone-title { font-family: var(--font-sans); font-weight: 600; font-size: 1.4rem; letter-spacing: -0.02em; }
.dropzone-sub { margin-top: 8px; color: var(--text-muted); font-size: 0.9rem; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: block; }
.htmx-request.htmx-indicator  { display: block; }
.mismatch { color: #ffb36b; }
.warn { font-size: 0.7rem; letter-spacing: 0; color: #ffb36b; margin-left: 6px; }

/* ─────────── Page header + toolbar ─────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0; }
.page-head .sub { color: var(--text-muted); font-size: 0.86rem; margin-top: 4px; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .spacer { flex: 1; }
.toolbar .count { color: var(--text-muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

/* Segmented control (daisyUI "join") */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg-sunken);
       border: 1px solid var(--border); border-radius: 10px; }
.seg a { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
         border-radius: 7px; color: var(--text-muted); font-size: 0.82rem; text-decoration: none; }
.seg a:hover { color: var(--text-main); opacity: 1; }
.seg a.is-active { background: var(--bg-raised); color: var(--text-main); box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.seg a .n { font-family: var(--font-mono); font-size: 0.72rem; color: var(--text-muted); }

/* Dropdown générique (details/summary) */
.dropdown { position: relative; display: inline-block; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  min-width: 200px; padding: 6px;
  background: #2f2f31; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
}
.dropdown-panel label { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
                        font-size: 0.84rem; cursor: pointer; }
.dropdown-panel label:hover { background: var(--bg-surface-2); }
.dropdown-panel input[type=checkbox] { accent-color: var(--accent); }

/* ─────────── Data table : largeur fixe, en-tête collant, scroll vertical seul ─────────── */
.table-wrap {
  max-height: calc(100vh - 230px); overflow-y: auto; overflow-x: hidden;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: rgba(0,0,0,0.08);
}
table.data-table {
  width: 100%; table-layout: fixed;
  border-collapse: separate; border-spacing: 0;
  font-size: 0.84rem;
}
.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  height: 36px; padding: 0 10px;
  background: #333335; border-bottom: 1px solid var(--border);
  font-size: 0.74rem; font-weight: 500; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.data-table td {
  height: var(--row-h); padding: 0 10px;
  border-bottom: 1px solid rgba(255,255,255,0.045);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  vertical-align: middle;
}
.data-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.012); }
.data-table tbody tr:hover td { background: rgba(255,255,255,0.045); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table a { color: inherit; }
.data-table a:hover { color: var(--accent); opacity: 1; }
.data-table .num { text-align: right; font-family: var(--font-mono); font-size: 0.78rem;
                   color: var(--text-muted); font-variant-numeric: tabular-nums; }
.data-table .muted { color: var(--text-muted); }
.data-table .t-main { font-weight: 500; color: var(--text-main); }
.data-table .cell-flex { display: flex; align-items: center; gap: 6px; min-width: 0; }
.data-table .cell-flex > .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.data-table .col-play { width: 48px; padding: 0 4px 0 12px; overflow: visible; text-overflow: clip; }
/* Actions secondaires : posées PAR-DESSUS la fin de la cellule au survol (ne prennent pas de place) */
.data-table td:has(> .cell-flex > .hover-actions) { position: relative; }
.data-table .hover-actions {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; gap: 2px;
  padding-left: 14px; background: linear-gradient(to right, transparent, #3f3f41 14px);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.data-table tr:hover .hover-actions, .data-table .hover-actions:focus-within { opacity: 1; pointer-events: auto; }
/* Outils de ligne (tags, shazam, protéger) : discrets, nets au survol ; un état actif reste visible */
.data-table .row-tools .btn-icon:not(.is-on) { opacity: 0.25; transition: opacity .12s; }
.data-table tr:hover .row-tools .btn-icon, .data-table .row-tools[open] .btn-icon { opacity: 1; }
.data-table .hover-actions .btn-icon { width: 24px; height: 24px; color: var(--text-muted); }
.data-table .hover-actions .btn-icon:hover { color: var(--text-main); background: var(--bg-surface-2); }
.data-table .hover-actions img { width: 14px; height: 14px; display: block; }
.data-table .hover-actions .sc-badge, .data-table .hover-actions .dz-badge { margin-left: 0; }
.data-table td.has-pop { overflow: visible; }
.data-table .medals { display: flex; gap: 3px; overflow: hidden; }

/* Bouton play rond */
.play-btn {
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-surface-2); color: var(--text-main); border: 1px solid var(--border);
}
.play-btn .i { width: 11px; height: 11px; margin-left: 1px; }
.play-btn:hover { background: var(--accent); color: #0d1f18; filter: none; }
.play-btn.is-playing { background: var(--accent); color: #0d1f18; }

/* Popover d'édition des tags */
.pop { position: relative; display: inline-block; }
.pop > summary { list-style: none; }
.pop > summary::-webkit-details-marker { display: none; }
.pop-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  width: 260px; padding: 10px; white-space: normal;
  background: #2f2f31; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0,0,0,0.5);
}
.pop-panel .quick { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.pop-panel input[type=text] { width: 100%; }
.tag-list { display: flex; gap: 3px; overflow: hidden; min-width: 0; }

/* Ligne en cours de lecture */
.data-table tbody tr.is-current td { background: var(--accent-dim); }
.data-table tbody tr.is-current td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.data-table tbody tr.is-current .t-main { color: var(--accent); }

.data-table tbody tr.is-missing td { opacity: 0.5; }
.play-btn.is-missing { color: var(--danger); border-color: var(--danger-dim); }
.player.is-error .pl-artist { color: var(--danger); }

/* ─────────── Lecteur persistant ─────────── */
.player {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9998;
  height: 76px; padding: 0 20px;
  display: grid; grid-template-columns: minmax(200px, 300px) 1fr minmax(200px, 300px); align-items: center; gap: 24px;
  background: rgba(38,38,40,0.94); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.player[hidden] { display: none; }
body.has-player main { padding-bottom: 110px; }
body.has-player .table-wrap { max-height: calc(100vh - 300px); }
.pl-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pl-cover { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; background: var(--bg-sunken); flex-shrink: 0; }
.pl-meta { min-width: 0; }
.pl-title { font-weight: 500; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-artist { display: block; font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-artist:hover { color: var(--text-main); }
.pl-center { display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; }
.pl-controls { display: flex; justify-content: center; align-items: center; gap: 10px; }
.pl-controls .btn-icon { color: var(--text-muted); }
.pl-controls .btn-icon:hover { color: var(--text-main); }
.pl-toggle {
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--text-main); color: #222;
}
.pl-toggle .i { width: 13px; height: 13px; }
.pl-toggle:hover { background: #fff; filter: none; }
.pl-timeline { display: flex; align-items: center; gap: 10px; }
.pl-cur, .pl-dur { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); width: 44px; flex-shrink: 0; }
.pl-cur { text-align: right; }
.pl-wave { flex: 1; height: 30px; cursor: pointer; touch-action: none; }
.pl-wave canvas { width: 100%; height: 100%; display: block; }
.pl-right { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.pl-vol { display: inline-flex; align-items: center; gap: 4px; }
.pl-vol .btn-icon { color: var(--text-muted); }
.pl-vol.is-muted .btn-icon { color: var(--danger); }
.pl-vol input[type=range] { width: 90px; accent-color: var(--accent); padding: 0; border: 0; background: none; }
.pl-keys { color: var(--text-muted); display: inline-flex; padding: 4px; cursor: help; }
@media (max-width: 900px) {
  .player { grid-template-columns: 1fr; height: auto; padding: 8px 12px; gap: 6px; }
  .pl-right { display: none; }
}

/* Écrans plus étroits : on retire les colonnes secondaires plutôt que de scroller à l'horizontale */
@media (max-width: 1280px) {
  .data-table [data-col="dossier"], .data-table [data-col="infos"] { display: none; }
}
@media (max-width: 1100px) {
  header { padding: 0 16px; }
  header nav > a span.lbl { display: none; }
  main { padding: 24px 16px 120px; }
  .data-table [data-col="lang"], .data-table [data-col="plays"] { display: none; }
}
@media (max-width: 760px) {
  .data-table [data-col="remixer"], .data-table [data-col="genre"], .data-table [data-col="tags"] { display: none; }
}
