:root {
  --bg: #0f0f0d;
  --surface: #171714;
  --surface-2: #1f1f1b;
  --line: #2b2a25;
  --line-2: #3a3933;
  --text: #f3f0e7;
  --muted: #8f8b7e;
  --faint: #55524a;
  --accent: #d6ff3d;
  --accent-ink: #11120a;
  --danger: #ff6b4a;
  --display: 'Archivo', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--display); font-size: 14px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 26px 18px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; }
.logo { font-weight: 800; font-variation-settings: 'wdth' 125; font-size: 18px; letter-spacing: -.01em; text-transform: uppercase; display: flex; align-items: center; gap: 10px; }
.logo svg { width: 22px; height: 22px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { text-decoration: none; padding: 9px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; display: flex; justify-content: space-between; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.on { color: var(--text); background: var(--surface-2); }
.nav a.on::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); align-self: center; }
.side-foot { margin-top: auto; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.main { padding: 34px 40px 80px; min-width: 0; max-width: 1240px; }

/* ---------- typo ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
h1 { font-weight: 800; font-variation-settings: 'wdth' 125; font-size: 34px; line-height: 1; letter-spacing: -.02em; margin: 0; text-transform: uppercase; }
h2 { font-size: 13px; font-family: var(--mono); font-weight: 500; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 14px; }
.sub { color: var(--muted); margin: 8px 0 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.section { margin-top: 38px; }
.back { font-family: var(--mono); font-size: 12px; color: var(--muted); text-decoration: none; display: inline-block; margin-bottom: 14px; }
.back:hover { color: var(--text); }

/* ---------- boutons / champs ---------- */
.btn { text-decoration: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: var(--surface); padding: 9px 14px; border-radius: 6px; font-weight: 500; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: var(--line-2); }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn svg { width: 14px; height: 14px; }
.icon-btn { width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn svg { width: 14px; height: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field .btn { font-family: var(--display); font-size: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); font-family: var(--mono); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select, textarea {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 6px; padding: 9px 11px; color: var(--text); font-family: var(--display); font-size: 14px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--text); font-family: var(--display); font-size: 14px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.search { max-width: 280px; }

/* ---------- cartes / tableaux ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.kpi b { display: block; font-weight: 800; font-variation-settings: 'wdth' 125; font-size: 38px; line-height: 1; letter-spacing: -.02em; }
.kpi span { display: block; font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 10px; text-transform: uppercase; letter-spacing: .08em; }
.two { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255,255,255,.015); }
td.num, th.num { text-align: right; font-family: var(--mono); white-space: nowrap; }
td .t { font-weight: 600; }
td .s { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
tr.revoked td { opacity: .45; }
.link-row { cursor: pointer; }

.pct { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.pct i { display: block; width: 70px; height: 5px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.pct i::after { content: ''; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--accent); }
.pill { font-family: var(--mono); font-size: 11px; padding: 3px 7px; border-radius: 4px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.pill.hot { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.pill.off { color: var(--danger); border-color: rgba(255,107,74,.4); }

/* ---------- playlists ---------- */
.pl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.pl-card { text-decoration: none; display: block; }
.pl-card .cv { aspect-ratio: 1; border-radius: 8px; overflow: hidden; margin-bottom: 12px; border: 1px solid var(--line); }
.pl-card:hover .cv { border-color: var(--muted); }
.pl-card .tt { font-weight: 600; font-size: 15px; }
.pl-card .mm { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 4px; }
.cv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cv.gen { display: flex; align-items: flex-end; padding: 14px; background: radial-gradient(120% 90% at 100% 0%, rgba(214,255,61,.85) 0%, rgba(214,255,61,0) 55%), radial-gradient(90% 80% at 0% 100%, #3d3a2e 0%, rgba(0,0,0,0) 70%), #1c1c18; }
.cv.gen span { font-weight: 800; font-variation-settings: 'wdth' 125; text-transform: uppercase; font-size: 18px; line-height: .95; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

.pl-head { display: grid; grid-template-columns: 180px 1fr; gap: 28px; align-items: start; }
.cover-edit { position: relative; width: 180px; }
.cover-edit .cv { width: 180px; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.cover-edit .btn { position: absolute; right: 8px; top: 8px; background: rgba(15,15,13,.75); backdrop-filter: blur(6px); }
.title-input { font-weight: 800 !important; font-variation-settings: 'wdth' 125; font-size: 28px !important; text-transform: uppercase; border-color: transparent !important; padding: 4px 8px !important; margin-left: -9px; background: transparent !important; }
.title-input:hover { border-color: var(--line-2) !important; }
.title-input:focus { border-color: var(--accent) !important; }

.tl { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tl li { display: grid; grid-template-columns: 30px 1fr auto auto; gap: 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tl li:last-child { border-bottom: 0; }
.tl .n { font-family: var(--mono); color: var(--faint); font-size: 12px; }
.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: 10px; }

/* ---------- upload ---------- */
.drop { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 34px; text-align: center; transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: rgba(214,255,61,.04); }
.drop p { margin: 6px 0; }
.queue { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.q { display: grid; grid-template-columns: 1fr 160px 90px; gap: 14px; align-items: center; font-family: var(--mono); font-size: 12px; }
.q .bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.q .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ---------- activité ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 13px; }
.feed .dot.download { background: var(--accent); color: var(--accent-ink); }
.feed .dot.complete { border: 1px solid var(--accent); color: var(--accent); }
.feed .txt { line-height: 1.45; }
.feed .txt b { font-weight: 600; }
.feed .meta { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.feed a { text-decoration: none; }
.feed a:hover { text-decoration: underline; }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.chart div { flex: 1; background: var(--line-2); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.chart div.has { background: var(--accent); }
.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); align-items: center; }
.rank li:last-child { border-bottom: 0; }

/* ---------- modale ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; width: min(560px, 100%); max-height: 88vh; overflow: auto; padding: 24px; }
.modal h3 { margin: 0 0 18px; font-weight: 800; font-variation-settings: 'wdth' 125; text-transform: uppercase; font-size: 20px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.pick { list-style: none; padding: 0; margin: 0; max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.pick li { border-bottom: 1px solid var(--line); }
.pick li:last-child { border-bottom: 0; }
.pick label, .pick [data-id] { display: flex; gap: 12px; align-items: center; padding: 10px 12px; cursor: pointer; }
.pick label:hover, .pick [data-id]:hover { background: var(--surface-2); }
.pick input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login form { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 40px; margin-bottom: 6px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

#toast { visibility: hidden; opacity: 0; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-weight: 500; transition: transform .25s ease; z-index: 100; max-width: calc(100vw - 32px); }
#toast.on { transform: translateX(-50%); visibility: visible; opacity: 1; }
#toast.bad { background: var(--danger); color: #fff; }

audio { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 14px 16px; gap: 16px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; }
  .nav a.on::after { display: none; }
  .side-foot { display: none; }
  .main { padding: 24px 16px 80px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .two, .grid2, .grid3, .pl-head { grid-template-columns: 1fr; }
  .q { grid-template-columns: 1fr 80px; }
  .q .st { display: none; }
}
