/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }
html { font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  background-image: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,255,255,0.85) 0%, transparent 70%);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Design system variables ── */
:root {
  --bg:           #f5f5f3;
  --card:         #ffffff;
  --accent:       #d4a017;
  --accent-soft:  #fef9e3;
  --dark:         #111111;
  --text:         #1a1a1a;
  --muted:        #9ca3af;
  --muted2:       #6b7280;
  --border:       #e8e8e4;
  --border2:      #f0f0ec;
  --red:          #ef4444;
  --green:        #22c55e;
  --orange:       #f97316;
  --r:            22px;
  --r-sm:         11px;
  --r-xs:         8px;
  --shadow:       0 60px 120px rgba(0,0,0,0.10), 0 20px 48px rgba(0,0,0,0.07), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-sm:    0 4px 16px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.04);
  --header-h:     56px;
  --player-h:     80px;
}

/* ── Animations ── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes flipFromLeft {
  from { opacity: 0; transform: perspective(900px) translateX(-70px) rotateY(-18deg); }
  to   { opacity: 1; transform: perspective(900px) translateX(0) rotateY(0deg); }
}
.anim-header { animation: fadeIn       0.45s ease both; }
.anim-card   { animation: flipFromLeft 0.65s cubic-bezier(0.08, 0.92, 0.18, 1) 0.05s both; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--border2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Header ── */
#header {
  height: var(--header-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
  box-shadow: 0 1px 0 var(--border2), 0 4px 16px rgba(0,0,0,0.04);
}

.header-left { justify-self: start; }
.app-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--dark);
}

.tabs { display: flex; gap: 2px; justify-self: center; }
.tab-btn {
  padding: 7px 16px;
  border: none;
  background: transparent;
  color: var(--muted2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-radius: var(--r-xs);
  transition: background .15s, color .15s;
  min-height: 36px;
}
.tab-btn:hover { background: var(--border2); color: var(--text); }
.tab-btn.active { background: var(--dark); color: #fff; }
#btn-trash {
  background: transparent;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--r-xs);
  color: var(--muted);
  opacity: 0.5;
  transition: opacity .15s, background .15s;
  line-height: 1;
}
#btn-trash:hover { opacity: 0.85; background: var(--border2); }
#btn-trash.active { opacity: 1; background: #fef2f2; }
#btn-note {
  background: transparent;
  border: none;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--r-xs);
  color: var(--muted);
  opacity: 0.5;
  transition: opacity .15s, background .15s;
  line-height: 1;
  position: relative;
}
#btn-note:hover { opacity: 0.85; background: var(--border2); }
#btn-note.active { opacity: 1; background: var(--accent-soft); }
#btn-note.has-note::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

/* ── Vue Corbeille ── */
.trash-header { padding: 14px 16px 0; }
.trash-info { font-size: 13px; color: var(--muted2); margin: 0; }
.trash-list { list-style: none; padding: 12px 16px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.trash-empty { text-align: center; padding: 40px 16px; color: var(--muted); font-size: 13px; }
.trash-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 14px;
}
.trash-item-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.trash-item-name { font-size: 14px; font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trash-item-timer { font-size: 11px; color: var(--muted); }
.btn-purge {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  width: 32px;
  height: 32px;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-purge:hover { background: #fef2f2; color: var(--red); border-color: rgba(239,68,68,.3); }
.btn-restore {
  background: #f0fdf4;
  color: #16a34a;
  border: 1.5px solid rgba(22,163,74,.3);
  border-radius: var(--r-xs);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s;
}
.btn-restore:hover { background: #dcfce7; }

.display-mode-toggle { display: flex; align-items: center; gap: 8px; justify-self: end; }
.mode-icon { font-size: 17px; line-height: 1; }
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--dark);
  border-radius: 12px;
  transition: background .2s;
}
.toggle-track::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::before { transform: translateX(20px); }

/* ── Main ── */
#main {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.view {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 20px;
}
.view.active { display: block; }

.view-header { margin-bottom: 16px; }
.view-header h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--muted);
}

/* ── Drop Zone ── */
#drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-sm);
  padding: 20px;
  text-align: center;
  margin-bottom: 16px;
  transition: border-color .2s, background .2s;
  background: var(--card);
}
#drop-zone:hover, #drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.drop-zone-inner { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.drop-icon { font-size: 28px; }
#drop-zone p { color: var(--muted2); font-size: 13px; font-weight: 500; }

/* ── Song List ── */
#song-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.song-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, opacity .15s, transform .15s;
  min-height: 56px;
  cursor: default;
  user-select: none;
}
.song-card:hover { border-color: #d0d0cc; box-shadow: 0 8px 24px rgba(0,0,0,0.09), 0 2px 6px rgba(0,0,0,0.05); }
.song-card.is-current {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 8px 24px rgba(212,160,23,0.15), 0 2px 6px rgba(212,160,23,0.1);
}
.song-card.is-current .song-name { color: var(--dark); font-weight: 800; }
.song-card.disabled { opacity: 0.45; }
.song-card.dragging { opacity: 0.25; transform: scale(0.98); }
.song-card.drop-above { border-top: 3px solid var(--accent); }
.song-card.drop-below { border-bottom: 3px solid var(--accent); }

.drag-handle {
  font-size: 16px;
  color: var(--muted);
  cursor: grab;
  padding: 4px 2px;
  flex-shrink: 0;
  transition: color .15s;
}
.drag-handle:active { cursor: grabbing; }
.song-card:hover .drag-handle { color: var(--muted2); }
.song-num { color: var(--muted); font-size: 12px; font-weight: 700; min-width: 20px; text-align: right; flex-shrink: 0; }
.song-name { font-size: 15px; font-weight: 700; flex: 1 1 auto; min-width: 0; white-space: normal; word-break: break-word; color: var(--text); }
.song-tags { display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0; margin-left: auto; }
.song-duration { color: var(--muted); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 36px; }

.tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.tag-key  { background: #eff6ff; color: #3b82f6; text-transform: none; letter-spacing: 0; }
.tag-bpm  { background: #f0fdf4; color: #16a34a; text-transform: none; letter-spacing: 0; }
.tag-mode { background: var(--border2); color: var(--muted2); }
.tag-pause { background: #fff7ed; color: #ea580c; }
.tag-file { background: transparent; font-size: 13px; padding: 0 2px; }
.tag-capo { background: #eff6ff; color: #3b82f6; text-transform: none; letter-spacing: 0; }
.tag-cd    { background: #f5f3ff; color: #7c3aed; }
.tag-ov    { background: #fdf4ff; color: #a21caf; }
.tag-delay { background: #fff7ed; color: #c2410c; }
.tag-editable { cursor: pointer; transition: opacity .15s; }
.tag-editable:hover { opacity: 0.75; }
.tag[data-editing] { padding: 0; background: transparent; overflow: visible; min-width: 0; }
.tag-empty { opacity: 0.45; font-style: normal; }
.song-name-editable { cursor: text; }
.inline-input {
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid var(--accent);
  border-radius: 4px;
  padding: 4px 8px;
  background: var(--card);
  color: var(--text);
  outline: none;
  min-width: 0;
  height: 32px;
  box-sizing: border-box;
  -moz-appearance: textfield;
}
.inline-input[type="number"]::-webkit-inner-spin-button,
.inline-input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.song-actions { display: flex; gap: 4px; flex-shrink: 0; }

.btn-icon {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted2);
  cursor: pointer;
  border-radius: var(--r-xs);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-icon:hover { background: var(--border2); color: var(--text); border-color: #d0d0cc; }
.btn-danger { color: var(--red); border-color: rgba(239,68,68,.2); }
.btn-danger:hover { background: #fef2f2; border-color: rgba(239,68,68,.4); }
.btn-toggle { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; }
.btn-toggle[aria-label="Désactiver"] { color: #16a34a; border-color: rgba(22,163,74,.35); background: #f0fdf4; }
.btn-toggle[aria-label="Désactiver"]:hover { background: #dcfce7; }
.btn-toggle[aria-label="Activer"] { color: var(--muted); background: var(--bg); }

/* ── Player Bar ── */
#player-bar {
  height: var(--player-h);
  background: var(--card);
  border-top: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
  transition: border-top-color .3s;
}
#player-bar.counting-down { border-top-color: var(--accent); }

.player-controls { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.ctrl-btn {
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--border);
  background: var(--border2);
  color: var(--muted2);
  font-size: 13px;
  border-radius: var(--r-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.ctrl-btn:hover { background: var(--border); color: var(--text); border-color: #d0d0cc; }
.ctrl-play {
  width: 50px;
  height: 50px;
  font-size: 17px;
  background: var(--dark);
  color: #fff;
  font-weight: 800;
  border: none;
  border-radius: 50%;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  transition: transform .12s, box-shadow .12s, background .15s;
}
.ctrl-play:hover { transform: scale(1.06); box-shadow: 0 10px 28px rgba(0,0,0,0.22); }
.ctrl-play.playing { background: var(--accent); box-shadow: 0 6px 20px rgba(212,160,23,0.35); }

.player-progress-area {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.player-progress-area span {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  flex-shrink: 0;
  min-width: 32px;
}
#progress-bar {
  flex: 1;
  height: 4px;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
#progress-bar::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dark);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.player-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex-shrink: 0;
  max-width: 200px;
}
#now-playing {
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dark);
}
#up-next {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-volumes {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Delay Overlay ── */
#delay-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245,245,243,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
}
#delay-overlay.hidden { display: none; }
.delay-box {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 40px 52px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}
.delay-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); }
.delay-countdown { font-size: 52px; font-weight: 900; letter-spacing: -2px; color: var(--dark); line-height: 1; }

/* ── Waiting Next Overlay ── */
#waiting-next-overlay {
  position: fixed;
  inset: 0;
  background: rgba(245,245,243,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(8px);
}
#waiting-next-overlay.hidden { display: none; }
.waiting-box {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 40px 52px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}
.waiting-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: var(--muted); }
.waiting-song { font-size: 24px; font-weight: 900; letter-spacing: -0.5px; color: var(--dark); }
.overlay-song-meta { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.overlay-meta-tuning { font-size: 15px; font-weight: 700; color: var(--accent); letter-spacing: 0.3px; }
.overlay-meta-notes  { font-size: 13px; font-weight: 500; color: var(--muted2); font-style: italic; max-width: 280px; text-align: center; line-height: 1.4; }
.waiting-hint { font-size: 13px; color: var(--muted2); font-weight: 500; }
.waiting-hint kbd {
  background: var(--border2);
  border: 1.5px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--r-xs);
  font-family: inherit;
  color: var(--dark);
  font-weight: 700;
}

/* ── Buttons ── */
.btn-primary {
  padding: 10px 24px;
  background: var(--dark);
  color: #fff;
  border: none;
  border-radius: var(--r-xs);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, transform .12s;
  min-height: 44px;
}
.btn-primary:hover { background: #2a2a2a; transform: translateY(-1px); }
.btn-large { font-size: 16px; padding: 14px 32px; border-radius: var(--r-sm); }

.btn-secondary {
  padding: 8px 18px;
  background: var(--border2);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--border); }

/* ── Modal ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  backdrop-filter: blur(4px);
}
#modal-overlay.hidden { display: none; }
#modal {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  width: 100%;
  max-width: 640px;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
}
#modal-title { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; color: var(--dark); }
#modal-body { overflow-y: auto; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
#modal-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--border2);
  flex-shrink: 0;
  background: var(--bg);
}

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 2px;
}
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 76px; }

input[type="text"],
input[type="number"],
select,
textarea {
  background: var(--card);
  border: 1.5px solid var(--border);
  color: var(--text);
  border-radius: var(--r-xs);
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  transition: border-color .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  padding-top: 18px;
  color: var(--text);
}
.checkbox-label input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.metro-fieldset, .file-fieldset {
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  background: var(--bg);
}
.metro-fieldset legend, .file-fieldset legend {
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  padding: 0 6px;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* ── File rows ── */
.file-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border2);
  flex-wrap: wrap;
}
.file-row:last-of-type { border-bottom: none; }
.file-label { font-size: 13px; font-weight: 700; flex-shrink: 0; min-width: 80px; color: var(--text); }
.file-name { flex: 1; font-size: 12px; color: var(--muted2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }

.btn-small {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: var(--r-xs);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s;
}
.btn-small:hover { background: var(--border2); }
.btn-small.btn-danger { border-color: rgba(239,68,68,.25); color: var(--red); }
.btn-small.btn-danger:hover { background: #fef2f2; }

/* ── Doc Drop Zone ── */
.doc-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--r-sm);
  padding: 14px 20px;
  text-align: center;
  margin-bottom: 16px;
  transition: border-color .2s, background .2s;
  background: var(--card);
}
.doc-drop-zone:hover, .doc-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.doc-drop-zone .drop-icon { font-size: 22px; }
.doc-drop-zone p { font-size: 12px; color: var(--muted2); font-weight: 500; }

/* ── View toolbar (grille/liste toggle) ── */
.view-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}
.doc-search {
  flex: 1;
  height: 32px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--card);
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.doc-search:focus { border-color: var(--accent); }
.doc-search::placeholder { color: var(--muted); }
.btn-view-toggle {
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted2);
  border-radius: var(--r-xs);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-view-toggle:hover { background: var(--border2); color: var(--text); }
.btn-view-toggle.active { background: var(--dark); color: #fff; border-color: var(--dark); }

/* ── Doc Grid ── */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

/* ── Doc List ── */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.doc-list .doc-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  text-align: left;
}
.doc-list .doc-tile-icon { font-size: 20px; margin-bottom: 0; flex-shrink: 0; }
.doc-list .doc-tile-name { flex: 1; font-size: 13px; white-space: normal; }
.doc-list .doc-tile-badge { margin-top: 0; margin-left: 4px; }
.doc-list .doc-tile-link-btn { margin-top: 0; width: auto; }
.doc-tile {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.doc-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(212,160,23,0.12), 0 2px 6px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}
.doc-tile-icon { font-size: 32px; margin-bottom: 10px; }
.doc-tile-name { font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }

.doc-tile-orphan { border-style: dashed; opacity: 0.8; }
.doc-tile-orphan:hover { opacity: 1; }
.doc-tile-badge {
  margin-top: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}
.doc-tile-link-btn {
  margin-top: 10px;
  width: 100%;
  font-size: 11px;
  padding: 5px 8px;
}
.doc-tile-del-btn {
  margin-top: 6px;
  width: 100%;
  font-size: 11px;
  padding: 4px 8px;
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}
.doc-tile-del-btn:hover {
  color: #e05252;
  border-color: #e05252;
  background: #fff0f0;
}
.doc-list .doc-tile-del-btn { margin-top: 0; width: auto; }

.doc-no-content {
  padding: 32px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}
.doc-no-content span { font-size: 12px; color: var(--muted2); }

/* ── Link picker ── */
.link-picker {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  min-width: 260px;
  max-width: min(420px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.link-picker-search {
  border: none;
  border-bottom: 1.5px solid var(--border2);
  border-radius: 0;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text);
  outline: none;
  width: 100%;
  font-family: inherit;
}
.link-picker-search:focus { border-bottom-color: var(--accent); }
.link-picker-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.link-picker button {
  text-align: left;
  padding: 9px 14px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border2);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  white-space: normal;
  word-break: break-word;
  line-height: 1.4;
  transition: background .12s;
}
.link-picker button:last-child { border-bottom: none; }
.link-picker button:hover { background: var(--accent-soft); color: var(--dark); }
.link-picker-empty { padding: 12px 16px; font-size: 13px; color: var(--muted2); font-weight: 500; }

.empty-msg { color: var(--muted); font-size: 14px; font-weight: 500; padding: 24px 0; }

/* ── Doc Panel (flottant) ── */
#doc-panel {
  position: fixed;
  right: 16px;
  top: calc(var(--header-h) + 12px);
  width: 460px;
  height: calc(100dvh - var(--header-h) - var(--player-h) - 28px);
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: var(--shadow);
  overflow: hidden;
  resize: both;
}
#doc-panel.hidden { display: none; }
#doc-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
  cursor: move;
  background: var(--bg);
  border-radius: var(--r) var(--r) 0 0;
  gap: 8px;
}
#doc-panel-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.doc-panel-controls { display: flex; gap: 4px; flex-shrink: 0; }
.mode-btn-sm {
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--muted2);
  border-radius: var(--r-xs);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.mode-btn-sm.active { background: var(--accent); color: var(--dark); border-color: var(--accent); }
#doc-panel-content {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
#doc-panel-content img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; margin: auto; }

#note-panel {
  position: fixed;
  right: 16px;
  top: calc(var(--header-h) + 12px);
  width: 300px;
  height: 320px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
  border-radius: var(--r-xs);
  display: flex;
  flex-direction: column;
  z-index: 60;
  box-shadow: var(--shadow);
  overflow: hidden;
  resize: both;
}
#note-panel.hidden { display: none; }
#note-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--dark);
  border-bottom: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}
#note-textarea {
  flex: 1;
  width: 100%;
  border: none;
  background: transparent;
  resize: none;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dark);
}
#note-textarea:focus { outline: none; }
#note-panel-status {
  padding: 4px 12px 8px;
  font-size: 11px;
  color: var(--muted2);
  text-align: right;
  flex-shrink: 0;
  min-height: 16px;
}
#doc-panel-content pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text);
  padding: 20px;
  width: 100%;
  align-self: flex-start;
}
.lyrics-editor {
  flex: 1;
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  padding: 20px;
  box-sizing: border-box;
}
.mode-btn-save { background: var(--accent); color: var(--dark); border-color: var(--accent); }
.mode-btn-save:hover { background: var(--gold); }
.pdf-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 8px;
  width: 100%;
  align-self: flex-start;
}
.pdf-page-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 10px rgba(0,0,0,.18);
  background: #fff;
}
.pdf-loading {
  padding: 32px;
  color: var(--muted2);
  font-size: 13px;
}
.pdf-error {
  padding: 20px;
  color: var(--muted2);
  font-size: 13px;
  text-align: center;
  line-height: 1.8;
}
.pdf-zoom-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted2);
  min-width: 34px;
  text-align: center;
}

/* ── Inline Popovers (décompte / overlay) ── */
.inline-popover {
  position: fixed;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 220px;
}
.popover-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
}
.popover-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}
.popover-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.popover-row { display: flex; gap: 10px; flex-wrap: wrap; }
.popover-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 60px; }
.popover-field label { font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 1.5px; }
.popover-field input, .popover-field select {
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--card);
  color: var(--text);
  outline: none;
  width: 100%;
}
.popover-field input:focus, .popover-field select:focus { border-color: var(--accent); }
.popover-save { align-self: flex-end; padding: 7px 16px; font-size: 12px; min-height: auto; }

/* ── Settings popover (volume) ── */
.player-volumes { position: relative; }
.settings-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 200px;
  z-index: 30;
}
.settings-row { display: flex; align-items: center; gap: 10px; }
.settings-row label { font-size: 13px; font-weight: 700; color: var(--text); min-width: 95px; cursor: pointer; }
.settings-row input[type="range"] { flex: 1; height: 4px; appearance: none; background: var(--border); border-radius: 2px; outline: none; cursor: pointer; }
.settings-row input[type="range"]::-webkit-slider-thumb { appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--muted2); }
.settings-row input[type="range"]:hover::-webkit-slider-thumb { background: var(--dark); }

/* ── Toast undo ── */
#undo-toast {
  position: fixed;
  bottom: calc(var(--player-h) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a18;
  color: #f5f5f3;
  border-radius: var(--r-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  z-index: 200;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  white-space: nowrap;
}
#undo-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
#undo-toast-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  width: 100%;
  transform-origin: left;
  transition: transform linear;
}
#undo-btn {
  background: var(--accent);
  color: var(--dark);
  border: none;
  border-radius: var(--r-xs);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
#undo-btn:hover { background: var(--gold); }

/* ── Focus ── */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Responsive ── */
@media (max-width: 640px) {

  /* Header : 2 lignes (nom + mode / onglets) */
  #header {
    height: auto;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    grid-template-areas: "left mode" "tabs tabs";
    padding: 10px 14px 0;
    gap: 0;
  }
  .header-left  { grid-area: left;  align-self: center; }
  .display-mode-toggle {
    grid-area: mode;
    justify-self: end;
    align-self: center;
  }
  .tabs {
    grid-area: tabs;
    justify-self: stretch;
    border-top: 1px solid var(--border2);
    margin: 8px -14px 0;
    padding: 0;
    gap: 0;
  }
  .tab-btn {
    flex: 1;
    text-align: center;
    padding: 11px 6px;
    font-size: 13px;
    border-radius: 0;
    min-height: 44px;
    border-bottom: 3px solid transparent;
  }
  .tab-btn.active {
    background: transparent;
    color: var(--dark);
    border-bottom-color: var(--accent);
  }
  /* Song cards : 3 lignes sur mobile */
  .song-card {
    flex-wrap: wrap;
    min-height: auto;
    padding: 12px 14px;
    column-gap: 8px;
    row-gap: 0;
    align-items: center;
  }
  /* Ligne 1 : drag + numéro + titre + durée */
  .drag-handle   { order: 0; align-self: center; }
  .song-num      { order: 0; }
  .song-name     { order: 0; flex: 1; min-width: 0; font-size: 16px; }
  .song-duration { order: 0; flex-shrink: 0; font-size: 13px; }
  /* Ligne 2 : tous les tags sur toute la largeur */
  .song-tags {
    order: 1;
    flex: 0 0 100%;
    flex-wrap: wrap;
    margin: 8px 0 0;
    gap: 6px;
    padding: 8px 0 4px;
    border-top: 1px solid var(--border2);
  }
  .song-tags .tag { font-size: 13px; padding: 4px 10px; }
  /* Ligne 3 : boutons pleine largeur */
  .song-actions {
    order: 2;
    flex: 0 0 100%;
    justify-content: stretch;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border2);
  }
  .song-actions .btn-icon {
    flex: 1;
    min-height: 44px;
    font-size: 18px;
  }

  /* Drop zone : compact */
  #drop-zone { padding: 14px; }
  .drop-icon  { font-size: 22px; }

  /* Player bar : empilé */
  #player-bar {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px 12px;
    gap: 0;
    row-gap: 8px;
  }
  .player-info {
    display: flex;
    flex: 0 0 100%;
    max-width: 100%;
    order: 0;
  }
  #now-playing { font-size: 14px; white-space: normal; }
  #up-next { white-space: normal; }
  .player-progress-area {
    flex: 0 0 100%;
    order: 1;
  }
  .player-controls { order: 2; flex-shrink: 0; }
  .player-volumes  { order: 3; margin-left: auto; }
  .settings-popover { right: 0; min-width: 180px; }

  /* Doc panel : plein écran sur mobile */
  #doc-panel {
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    right: 0;
    top: 0;
    border-radius: 0;
    border: none;
    resize: none;
  }

  #note-panel {
    width: calc(100% - 24px);
    right: 12px;
    left: 12px;
  }

  /* Modal */
  .form-row { flex-direction: column; }
  .waiting-box  { padding: 28px 22px; }
  .waiting-song { font-size: 20px; }
}

/* ── Sync button ── */
#btn-sync {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px 7px;
  border-radius: var(--r-xs);
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted2);
  font-size: 14px;
  transition: background .15s;
}
#btn-sync:hover { background: var(--border2); }

#sync-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background .3s;
}
#sync-status-dot[data-mode="pilot"]    { background: var(--green); }
#sync-status-dot[data-mode="follower"] { background: #3b82f6; }

/* ── Sync panel ── */
#sync-panel {
  position: fixed;
  top: calc(56px + 8px);
  right: 12px;
  width: 270px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  z-index: 300;
  overflow: hidden;
}
#sync-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--border2);
}
.sync-panel-title { font-size: 12px; font-weight: 700; color: var(--text); text-transform: uppercase; letter-spacing: .5px; }
#sync-panel-body  { padding: 14px; display: flex; flex-direction: column; gap: 14px; }

.sync-section { display: flex; flex-direction: column; gap: 6px; }
.sync-label   { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted2); }
.sync-hint    { font-size: 11px; color: var(--muted); margin: 0; }

.sync-name-row { display: flex; gap: 6px; }
.sync-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.sync-input:focus { border-color: var(--accent); }

.sync-mode-group { display: flex; gap: 4px; }
.sync-mode-btn {
  flex: 1;
  padding: 7px 4px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--bg);
  color: var(--muted2);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  text-align: center;
}
.sync-mode-btn:hover { background: var(--border2); color: var(--text); }
.sync-mode-btn.active { background: var(--dark); color: #fff; border-color: var(--dark); }
.sync-mode-btn[data-mode="pilot"].active    { background: var(--green); border-color: var(--green); }
.sync-mode-btn[data-mode="follower"].active { background: #3b82f6; border-color: #3b82f6; }

.sync-pilot-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
}
.sync-pilot-item {
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: all .15s;
  font-size: 13px;
  font-weight: 600;
}
.sync-pilot-item:hover    { background: var(--border2); }
.sync-pilot-item.selected { border-color: #3b82f6; background: #eff6ff; color: #1d4ed8; }
.sync-no-pilots   { font-size: 12px; color: var(--muted); padding: 6px 0; text-align: center; }
.sync-status-text { font-size: 11px; color: var(--muted2); margin: 0; font-style: italic; }

/* ── Connected avatars (header) ── */
.connected-avatars {
  display: flex;
  align-items: center;
  padding: 0 8px;
  flex-shrink: 0;
}
.avatar-bubble {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background-color: var(--border);
  background-size: cover;
  background-position: center;
  border: 2px solid var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-left: -8px;
  box-shadow: 0 1px 4px rgba(0,0,0,.18);
  cursor: default;
  transition: transform .15s;
  flex-shrink: 0;
}
.avatar-bubble:first-child { margin-left: 0; }
.avatar-bubble:hover { transform: translateY(-2px); z-index: 1; }
.avatar-bubble.self { border-color: var(--accent); }

/* ── Avatar dans le panneau sync ── */
.sync-avatar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.sync-avatar-preview {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--border);
  background-size: cover;
  background-position: center;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--muted2);
  flex-shrink: 0;
}

/* ── Lyrics label row ── */
.lyrics-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.lyrics-label-row label { margin-bottom: 0; }

/* ── Setlist tab label ── */
.tab-btn[data-tab="setlist"] { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setlist-chevron { font-size: 9px; opacity: 0.6; margin-left: 2px; }

/* ── Setlist menu dropdown ── */
.setlist-menu {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow);
  min-width: 240px;
  max-width: min(360px, calc(100vw - 24px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.setlist-menu-list { display: flex; flex-direction: column; max-height: 240px; overflow-y: auto; }
.setlist-menu-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border2);
  cursor: default;
  transition: background .12s;
}
.setlist-menu-item:hover { background: var(--border2); }
.setlist-menu-item.active { background: var(--accent-soft); }
.setlist-menu-item.active .setlist-menu-name { font-weight: 800; color: var(--dark); }
.setlist-menu-name { flex: 1; font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.setlist-menu-count {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: var(--border2);
  border-radius: 10px;
  padding: 1px 7px;
  flex-shrink: 0;
  cursor: pointer;
}
.setlist-menu-rename, .setlist-menu-delete {
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--border);
  background: var(--card);
  border-radius: var(--r-xs);
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
  opacity: 0;
  color: var(--muted2);
}
.setlist-menu-item:hover .setlist-menu-rename,
.setlist-menu-item:hover .setlist-menu-delete { opacity: 1; }
.setlist-menu-rename:hover { background: var(--border2); color: var(--text); }
.setlist-menu-delete:hover { background: #fef2f2; color: var(--red); border-color: rgba(239,68,68,.3); }
.setlist-menu-sep { height: 1px; background: var(--border2); }
.setlist-menu-add {
  padding: 10px 14px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  transition: background .12s;
}
.setlist-menu-add:hover { background: var(--accent-soft); }

/* ── Setlist toolbar (bouton ajouter depuis bibliothèque) ── */
.setlist-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  justify-content: flex-end;
}
.btn-add-library {
  padding: 6px 14px;
  background: var(--border2);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.btn-add-library:hover { background: var(--border); border-color: #c8c8c4; }

/* ── Modal footer — bouton suppression bibliothèque ── */
.btn-danger-text { color: var(--red); border-color: rgba(239,68,68,.25); }
.btn-danger-text:hover { background: #fef2f2; }
.modal-footer-spacer { flex: 1; }

/* ── Drop zone actions (boutons côte à côte) ── */
.drop-zone-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}
.drop-zone-sep {
  font-size: 12px;
  color: var(--muted2);
}

/* ── Modale saisie paroles ── */
#lyrics-compose-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#lyrics-compose-overlay.hidden { display: none; }

#lyrics-compose-dialog {
  background: #fff;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.compose-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--dark);
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.compose-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
}
.compose-header .btn-icon {
  color: rgba(255,255,255,.7);
  font-size: 20px;
  line-height: 1;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.compose-header .btn-icon:hover { background: rgba(255,255,255,.15); color: #fff; }

.compose-body {
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: #fff;
}

#compose-lyrics-text {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.7;
  min-height: 220px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--bg);
  color: var(--text);
  transition: border-color .15s;
}
#compose-lyrics-text:focus { outline: none; border-color: var(--accent); }

.compose-hint {
  font-size: 11px;
  color: var(--muted2);
  margin: 3px 0 0;
}

.compose-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  background: #fff;
}

/* ── Bouton YouTube ── */
.btn-youtube {
  background: #ff0000;
  color: #fff;
  border: none;
  border-radius: var(--r-xs);
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-youtube:hover { background: #cc0000; }

/* ── Modal YouTube ── */
#yt-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.45);
  display: flex; align-items: center; justify-content: center;
}
#yt-modal {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  width: min(560px, 96vw);
  max-height: 80dvh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
#yt-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
#yt-header h2 { font-size: 16px; font-weight: 700; }
#yt-body { display: flex; flex-direction: column; padding: 16px 20px; gap: 12px; overflow: hidden; }
#yt-search {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--r-xs);
  font-size: 14px; font-family: inherit; background: var(--bg); color: var(--text);
  outline: none; transition: border-color .15s;
}
#yt-search:focus { border-color: var(--accent); }
#yt-results { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.yt-loading, .yt-empty { color: var(--muted2); font-size: 13px; text-align: center; padding: 12px 0; }
.yt-result {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--r-xs);
  transition: background .12s; cursor: default;
}
.yt-result:hover { background: var(--border2); }
.yt-thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.yt-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.yt-title { font-size: 13px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yt-channel { font-size: 11px; color: var(--muted2); }
#yt-preview {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--r-xs);
  overflow: hidden;
  background: #000;
}
#yt-iframe { width: 100%; height: 100%; border: none; display: block; }
.yt-actions { display: flex; gap: 6px; flex-shrink: 0; }
.btn-yt-preview {
  flex-shrink: 0; padding: 5px 10px;
  background: #cc0000; color: #fff;
  border: none; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-yt-preview:hover { background: #aa0000; }
.btn-yt-preview.active { background: #880000; }
.btn-yt-import {
  flex-shrink: 0; padding: 5px 11px;
  background: var(--dark); color: #fff;
  border: none; border-radius: var(--r-xs);
  font-size: 12px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.btn-yt-import:hover { background: #333; }
.btn-yt-import:disabled { background: var(--muted); cursor: default; }

/* ── Tags stem split ── */
.tag-stem { font-size: 10px; font-weight: 600; border-radius: 4px; padding: 2px 6px; }
.tag-stem-processing { background: #fef3c7; color: #92400e; animation: pulse 1.5s ease-in-out infinite; }
.tag-stem-done       { background: #dcfce7; color: #166534; }
.tag-stem-error      { background: #fee2e2; color: #991b1b; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.5; } }

/* ── Bouton Tap Sync ── */
.player-tap { display: flex; align-items: center; }
.btn-tap-sync {
  background: var(--dark); color: #fff;
  border: none; border-radius: var(--r-xs);
  padding: 6px 14px; font-size: 13px; font-weight: 700;
  cursor: pointer; letter-spacing: 0.03em;
  transition: background .1s, transform .1s;
}
.btn-tap-sync:hover { background: #333; }
.btn-tap-sync.tapped { background: var(--accent); transform: scale(0.95); }
