/* ==========================================================================
   Tokens — thème sombre (par défaut) et thème clair
   Ni blanc pur ni noir pur : on reste sur des gris chauds, dans les deux
   thèmes, pour une lisibilité confortable des deux côtés.
   ========================================================================== */
:root,
[data-theme="dark"] {
  color-scheme: dark;

  --bg-void: #121110;
  --bg-surface: #1a1714;
  --bg-raised: #221e19;
  --bg-raised-2: #2c261f;
  --line: #3c352b;
  --text: #e9e4da;
  --text-muted: #a89d8c;
  --text-faint: #726a5c;
  --amber: #e8a33d;
  --amber-strong: #ffbf5c;
  --on-accent: #211705;
  --red: #d16257;
  --green: #7bb877;
  --info: #7fb3d9;
  --shadow: rgba(10, 9, 7, 0.45);
  --grain-opacity: 0.05;
  --atmosphere-opacity: 0.16;
}

[data-theme="light"] {
  color-scheme: light;

  --bg-void: #e7e3da;
  --bg-surface: #efece5;
  --bg-raised: #f6f4ef;
  --bg-raised-2: #dfdbd0;
  --line: #cdc6b6;
  --text: #2b2721;
  --text-muted: #635b4c;
  --text-faint: #8b8272;
  --amber: #a3690f;
  --amber-strong: #7d4f0a;
  --on-accent: #fbf3e3;
  --red: #a53d31;
  --green: #3e7a3c;
  --info: #2d6690;
  --shadow: rgba(60, 52, 36, 0.14);
  --grain-opacity: 0.035;
  --atmosphere-opacity: 0.1;
}

:root {
  --font: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Space Grotesk", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-num: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;

  --radius: 10px;
  --radius-sm: 6px;

  --shell-max: 1600px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-void);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  transition: background-color 0.25s ease, color 0.25s ease;
}

/* Décor : léger halo de couleur en fond + grain — purement atmosphérique,
   n'affecte jamais la lisibilité du texte au premier plan. */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--atmosphere-opacity);
  background:
    radial-gradient(60vw 60vh at 8% -10%, var(--amber) 0%, transparent 60%),
    radial-gradient(50vw 50vh at 100% 10%, var(--green) 0%, transparent 55%);
}
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.app-shell {
  position: relative;
  z-index: 2;
}

button,
input,
textarea,
select {
  font-family: inherit;
  color: inherit;
}

a {
  color: var(--amber);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: var(--bg-surface);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-raised-2);
  border-radius: 8px;
  border: 3px solid var(--bg-surface);
}

:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 0.6em 1em;
  font-size: 1rem;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}
button:hover {
  border-color: var(--amber);
  transform: translateY(-1px);
}
button:active {
  transform: translateY(0);
}
button.primary {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--on-accent);
  font-weight: 700;
  box-shadow: 0 6px 16px -8px var(--shadow);
}
button.primary:hover {
  background: var(--amber-strong);
  border-color: var(--amber-strong);
}
button.ghost {
  background: transparent;
  border-color: transparent;
}
button.ghost:hover {
  border-color: var(--line);
}
button.danger {
  border-color: var(--red);
  color: var(--red);
  background: transparent;
}
button.danger:hover {
  background: var(--red);
  color: var(--text);
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input[type="text"],
input[type="number"],
textarea,
select {
  background: var(--bg-void);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55em 0.75em;
  width: 100%;
}
textarea {
  resize: vertical;
  min-height: 5em;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  line-height: 1.5;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Shell / Topbar
   ========================================================================== */
.app-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  white-space: nowrap;
}
.brand-mark {
  width: 24px;
  height: 24px;
  color: var(--amber);
  flex-shrink: 0;
}
.brand-word {
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: -0.01em;
}
.brand-word b {
  font-weight: 700;
}
.brand-word i {
  font-style: normal;
  font-weight: 500;
  color: var(--text-faint);
  font-size: 0.88em;
  margin: 0 0.02em;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.6em;
  padding: 0.5em;
}
.icon-btn svg {
  width: 19px;
  height: 19px;
}
[data-theme="dark"] .icon-btn .icon-moon,
[data-theme="light"] .icon-btn .icon-sun {
  display: none;
}

main.view {
  flex: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 1.5rem;
}

/* ==========================================================================
   Bibliothèque
   ========================================================================== */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.song-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.song-card:hover {
  border-color: var(--amber);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -14px var(--shadow);
}
.song-card-main {
  text-align: left;
  background: none;
  border: none;
  width: 100%;
  padding: 1.1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.song-card-main:hover {
  border-color: transparent;
  transform: none;
}
.song-card .title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-right: 1.6rem;
}
.song-card .artist {
  color: var(--text-muted);
}
.song-card .meta {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-variant-numeric: tabular-nums;
}
.setlist-toggle {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  width: 1.9em;
  height: 1.9em;
  padding: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  line-height: 1;
  z-index: 2;
}
.setlist-toggle.in-setlist {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--on-accent);
  font-weight: 700;
}

.chip {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15em 0.75em;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.chip.accent {
  border-color: var(--amber);
  color: var(--amber-strong);
}
.status-chip.status-work {
  border-color: var(--amber);
  color: var(--amber-strong);
}
.status-chip.status-ready {
  border-color: var(--green);
  color: var(--green);
}
.status-chip.status-new {
  border-color: var(--info);
  color: var(--info);
}

.empty-state {
  color: var(--text-muted);
  padding: 3rem 1rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  margin-top: 1.25rem;
}
.empty-state.small {
  padding: 1rem;
  margin-top: 0;
  font-size: 0.9rem;
}

.library-toolbar {
  margin-bottom: 1rem;
}
.status-filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.filter-chip {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 0.4em 0.9em;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.filter-chip:hover {
  border-color: var(--amber);
  color: var(--text);
}
.filter-chip.active {
  background: var(--bg-raised);
  border-color: var(--amber);
  color: var(--text);
  font-weight: 700;
}

.setlist-panel {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
}
.setlist-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.setlist-head .panel-title {
  margin: 0;
}
.setlist-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}
button.small {
  padding: 0.35em 0.8em;
  font-size: 0.85rem;
}
.setlist-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.setlist-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-raised);
}
.setlist-row .pos {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  width: 1.4em;
  text-align: right;
}
.setlist-row-title {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  padding: 0.2em 0;
  font-weight: 600;
}
.setlist-row-title:hover {
  color: var(--amber-strong);
  transform: none;
  border-color: transparent;
}
.setlist-row .row-actions {
  display: flex;
  gap: 0.3rem;
}
.setlist-row .row-actions button {
  padding: 0.15em 0.5em;
  font-size: 0.8rem;
}

/* ==========================================================================
   Écran de répétition
   ========================================================================== */
.song-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.song-header h1 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: clamp(1.4rem, 2.5vw, 2rem);
  margin: 0;
}
.song-header .artist {
  color: var(--text-muted);
  font-size: 1.1rem;
}
.song-header-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.setlist-nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.15rem 0.4rem;
}
.setlist-nav .icon-btn {
  width: 1.8em;
  padding: 0.3em;
}
.setlist-nav .icon-btn svg {
  width: 14px;
  height: 14px;
}
.setlist-pos {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  padding: 0 0.2rem;
}

.song-notes {
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 0.7rem 1rem;
  margin: -0.75rem 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.92rem;
  white-space: pre-wrap;
}

.layout-song {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.25rem;
  align-items: start;
}

.side-rail {
  position: sticky;
  top: 5.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
}
.panel-title {
  font-size: 0.8rem;
  color: var(--text-faint);
  margin: 0 0 0.6rem;
  font-weight: 700;
}

.section-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.section-pill {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.55em 0.7em;
  display: flex;
  align-items: center;
  gap: 0.6em;
  color: var(--text-muted);
}
.section-pill .marker {
  width: 6px;
  align-self: stretch;
  border-radius: 3px;
  background: var(--line);
}
.section-pill .label {
  flex: 1;
}
.section-pill .loop-btn {
  opacity: 0.35;
  font-size: 0.85rem;
  padding: 0.1em 0.2em;
  border-radius: 4px;
}
.section-pill .loop-btn:hover {
  opacity: 1;
}
.section-pill:hover {
  border-color: var(--line);
  color: var(--text);
}
.section-pill.active {
  background: var(--bg-raised);
  color: var(--text);
  border-color: var(--amber);
  font-weight: 700;
}
.section-pill.active .marker {
  background: var(--amber);
}
.section-pill.looping {
  border-color: var(--green);
}
.section-pill.looping .loop-btn {
  opacity: 1;
  background: var(--green);
  border-radius: 50%;
}
.section-block.looping {
  border-left-color: var(--green);
}

/* Module tempo */
.tempo-module {
  text-align: center;
}
.bpm-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  margin: 0.2rem 0;
  transition: transform 60ms ease-out;
}
.bpm-value.pulse {
  transform: scale(1.08);
  color: var(--amber-strong);
}
.bpm-label {
  color: var(--text-faint);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.bpm-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin: 0.6rem 0;
}
.bpm-controls button {
  font-size: 1.3rem;
  width: 2.6em;
  height: 2.6em;
  border-radius: 999px;
  line-height: 1;
}
.bpm-origin {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}
.bpm-origin button.small {
  padding: 0.15em 0.6em;
  font-size: 0.78rem;
  border-color: var(--line);
}
.bpm-origin button.small:hover {
  border-color: var(--amber);
  color: var(--amber-strong);
}
.beat-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--line);
  display: inline-block;
  margin: 0 3px;
  transition: background 40ms, transform 40ms;
}
.beat-dot.on {
  background: var(--amber);
  transform: scale(1.3);
}
.beat-row {
  margin: 0.5rem 0 0.75rem;
}
.tempo-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.tempo-actions button {
  flex: 1;
}
#metronomeToggle.playing {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--on-accent);
  font-weight: 700;
}

/* Zone paroles */
.lyrics-stage {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 12rem);
  min-height: 420px;
}

.scroll-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.scroll-toolbar .spacer {
  flex: 1;
}
.scroll-toolbar label,
.toolbar-field {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.scroll-toolbar input[type="range"] {
  width: 120px;
}
.checkbox-field {
  gap: 0.35rem;
}
.checkbox-field input[type="checkbox"] {
  width: 1.1em;
  height: 1.1em;
  accent-color: var(--amber);
}

.lyrics-scroll {
  position: relative;
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.75rem 60vh;
  scroll-behavior: smooth;
}

.section-block {
  margin-bottom: 2.25rem;
  padding-left: 1rem;
  border-left: 3px solid var(--line);
}
.section-block.current {
  border-left-color: var(--amber);
}
.section-block .section-label {
  color: var(--amber-strong);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 0.4rem;
  font-size: 1.05rem;
}
.section-block .section-note {
  color: var(--text-faint);
  font-style: italic;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}
.section-block .chords-line {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color: var(--green);
  white-space: pre-wrap;
  margin-bottom: 0.4rem;
  font-size: 1rem;
}
.section-block .lyrics-text {
  white-space: pre-wrap;
  font-size: calc(var(--lyrics-scale, 1) * clamp(1.15rem, 1.6vw, 1.5rem));
  max-width: 62ch;
}
.section-block .no-lyrics {
  color: var(--text-faint);
  font-style: italic;
}

.next-preview {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.55rem 1.25rem;
  background: linear-gradient(to top, var(--bg-surface) 60%, transparent);
  backdrop-filter: blur(2px);
  font-size: 0.9rem;
  color: var(--text-muted);
  pointer-events: none;
}
.next-preview .tag {
  color: var(--text-faint);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

/* ==========================================================================
   Mode Live (plein écran)
   ========================================================================== */
body.live-mode .topbar,
body.live-mode [data-hide-live] {
  display: none !important;
}

body.controls-hidden .side-rail,
body.controls-hidden .scroll-toolbar {
  display: none !important;
}
body.controls-hidden .layout-song {
  grid-template-columns: 1fr;
}
body.live-mode main.view {
  padding: 0;
  max-width: none;
}
body.live-mode .layout-song {
  grid-template-columns: 260px 1fr;
  gap: 0;
  height: 100vh;
}
body.live-mode .side-rail {
  position: static;
  height: 100vh;
  border-right: 1px solid var(--line);
  border-radius: 0;
  overflow-y: auto;
}
body.live-mode .panel {
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
}
body.live-mode .lyrics-stage {
  height: 100vh;
  border: none;
  border-radius: 0;
}
body.live-mode .song-header {
  padding: 0.9rem 1.75rem 0;
  margin-bottom: 0;
}
body.live-mode .section-block .lyrics-text {
  font-size: calc(var(--lyrics-scale, 1) * clamp(1.8rem, 3vw, 3rem));
}
body.live-mode .section-block .chords-line {
  font-size: 1.3rem;
}
body.live-mode .bpm-value {
  font-size: 4.2rem;
}
body.live-mode .lyrics-scroll {
  padding-top: 2rem;
}

.live-hint {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  z-index: 30;
  pointer-events: none;
  text-align: center;
  max-width: 90vw;
}

/* Flash métronome sur les bords de l'écran — discret par défaut,
   réglable (Désactivé / Discret / Moyen / Fort) depuis le module tempo. */
.beat-flash {
  --flash-w: 2px;
  --flash-b: 28px;
  --flash-s: 0px;
  --flash-o: 0.4;
  --flash-c: var(--amber);
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 0 var(--flash-w) var(--flash-c), inset 0 0 var(--flash-b) var(--flash-s) var(--flash-c);
  transition: opacity 180ms ease-out;
}
.beat-flash[data-level="medium"] {
  --flash-w: 4px;
  --flash-b: 55px;
  --flash-s: 2px;
  --flash-o: 0.7;
}
.beat-flash[data-level="strong"] {
  --flash-w: 6px;
  --flash-b: 80px;
  --flash-s: 6px;
  --flash-o: 1;
}
.beat-flash.accent {
  --flash-c: var(--amber-strong);
}
.beat-flash.on {
  opacity: var(--flash-o);
  transition: none;
}

/* Décompte de 2 mesures avant le métronome */
.countdown-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--shadow);
  pointer-events: none;
}
.countdown-overlay span {
  font-family: var(--font-display);
  font-size: 20vw;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  text-shadow: 0 8px 40px var(--shadow);
}
.countdown-overlay.downbeat span {
  color: var(--amber-strong);
}
.countdown-overlay small {
  font-size: 1.1rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}
.countdown-overlay.pulse span {
  animation: countdownPulse 0.25s ease-out;
}
@keyframes countdownPulse {
  from {
    transform: scale(1.25);
    opacity: 0.2;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

/* Bannière de fin de morceau */
.end-banner {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--amber);
  color: var(--on-accent);
  font-weight: 700;
  border-radius: 999px;
  padding: 0.55rem 1.4rem;
  z-index: 55;
  box-shadow: 0 10px 30px -10px var(--shadow);
  pointer-events: none;
}

/* ==========================================================================
   Admin

   ========================================================================== */
.admin-toolbar {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.admin-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.admin-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
}
.admin-row .info {
  flex: 1;
}
.admin-row .info .title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.admin-row .info .title {
  font-weight: 700;
}
.admin-row .info .sub {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.admin-row .actions {
  display: flex;
  gap: 0.5rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.form-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.form-field label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.form-field.span-2 {
  grid-column: span 2;
}

.sections-editor {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.section-editor-row {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  background: var(--bg-surface);
}
.section-editor-row .row-top {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 0.6rem;
}
.section-editor-row .row-top input[type="text"] {
  flex: 1;
}
.section-editor-row .row-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}
.reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reorder-btns button {
  padding: 0.1em 0.5em;
  font-size: 0.8rem;
}

.form-actions {
  display: flex;
  gap: 0.6rem;
  margin: 1.5rem 0;
}

.io-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 900px) {
  .section-editor-row .row-fields {
    grid-template-columns: 1fr 1fr;
  }
  .layout-song {
    grid-template-columns: 1fr;
  }
  .side-rail {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .side-rail .panel {
    flex: 1;
    min-width: 220px;
  }
  .lyrics-stage {
    height: 60vh;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-field.span-2 {
    grid-column: span 2;
  }
  body.live-mode .layout-song {
    grid-template-columns: 1fr;
  }
  body.live-mode .side-rail {
    height: auto;
  }
}

@media (max-width: 560px) {
  .topbar {
    flex-wrap: wrap;
  }
  .topbar-search {
    order: 3;
    max-width: none;
    width: 100%;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-field.span-2 {
    grid-column: span 1;
  }
  .section-editor-row .row-fields {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}


/* Réglages flash / décompte */
.flash-settings {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  margin-top: 0.9rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line);
  text-align: left;
}
.flash-settings select {
  width: auto;
  padding: 0.25em 0.5em;
  font-size: 0.85rem;
}

/* Collage des paroles */
.paste-panel {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  margin-bottom: 1.5rem;
}
.paste-panel summary {
  cursor: pointer;
  font-weight: 700;
}
.paste-panel .hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0.6rem 0;
}
.paste-panel textarea {
  min-height: 12rem;
}
.paste-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}
.paste-actions .checkbox-field {
  margin-right: auto;
}
.paste-result {
  margin: 0.7rem 0 0;
  padding: 0.5rem 0.8rem;
  border-left: 3px solid var(--green);
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.empty-lyrics-callout {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.empty-lyrics-callout p {
  margin: 0;
}

/* ==========================================================================
   Impression / export PDF d'une fiche morceau
   ========================================================================== */
.print-sheet {
  display: none;
}

@media print {
  body * {
    visibility: hidden;
  }
  .print-sheet,
  .print-sheet * {
    visibility: visible;
  }
  html,
  body {
    background: #fff !important;
    height: auto;
  }
  .atmosphere,
  .grain,
  .beat-flash {
    display: none !important;
  }
  .print-sheet {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5cm;
    color: #222;
    background: #fff;
    font-family: Georgia, "Times New Roman", serif;
  }
  .print-sheet h1 {
    font-size: 24pt;
    margin: 0 0 0.2cm;
  }
  .print-sheet .print-meta {
    font-size: 11pt;
    color: #555;
    margin: 0 0 0.6cm;
  }
  .print-sheet .print-notes {
    font-size: 10pt;
    font-style: italic;
    color: #555;
  }
  .print-sheet .print-section {
    break-inside: avoid;
    margin-bottom: 0.6cm;
  }
  .print-sheet h2 {
    font-size: 12pt;
    margin: 0 0 0.15cm;
    text-transform: none;
    border-bottom: 1px solid #bbb;
  }
  .print-sheet pre {
    font-family: inherit;
    font-size: 12pt;
    line-height: 1.45;
    margin: 0 0 0.2cm;
    white-space: pre-wrap;
  }
  .print-sheet pre.print-chords {
    font-family: "Courier New", monospace;
    font-size: 10.5pt;
    color: #333;
  }
}
