@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/nunito-400.ttf") format("truetype"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 500; font-display: swap; src: url("fonts/nunito-500.ttf") format("truetype"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/nunito-600.ttf") format("truetype"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/nunito-700.ttf") format("truetype"); }

:root {
  --ink: #1c1917;
  --ink-soft: #57534e;
  --muted: #7a736c;
  --gold: #0f766e;
  --gold-deep: #0b5f59;
  --gold-soft: #d9efeb;
  --iris: #803c86;
  --iris-soft: #f4e8f6;
  --apricot: #a64b25;
  --apricot-soft: #fbe3d0;
  --on-button: #fff6ec;
  --bg: #f4efe6;
  --surface: #fffcf8;
  --surface-low: #f7f2ea;
  --border: #e4dbcf;
  --danger: #9b2c3a;
  --danger-bg: #fce8e6;
  --ok: #0b5f59;
  --ok-bg: #d9efeb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(28, 25, 23, 0.04), 0 10px 28px rgba(28, 25, 23, 0.06);
  --font: "Nunito", "Avenir Next", "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --bar: 60px;
}

html[data-theme="dark"] {
  --ink: #f7f4ee;
  --ink-soft: #d0c9c0;
  --muted: #9a9288;
  --gold: #5bc4b8;
  --gold-deep: #7dd3c8;
  --gold-soft: #1e3c38;
  --iris: #e0a8ea;
  --iris-soft: #3d2e48;
  --apricot: #f2b48c;
  --apricot-soft: #4a3428;
  --on-button: #2f2924;
  --bg: #241f1b;
  --surface: #322d28;
  --surface-low: #2b2622;
  --border: #4a423b;
  --danger: #f0a0a8;
  --danger-bg: #4a2a2e;
  --ok: #7dd3c8;
  --ok-bg: #1e3c38;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* —— App chrome —— */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1.1rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand-lockup { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.brand-mark {
  width: 10px; height: 10px; border-radius: 99px;
  background: var(--gold);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 22%, transparent);
}
.brand { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; }
.appbar-catalog {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}
.catalog-select {
  max-width: 220px;
  height: 36px;
  padding: 0 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-low);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}
.code-chip {
  height: 36px;
  padding: 0 0.7rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--gold-deep);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.code-chip:hover { background: var(--gold-soft); }
.appbar-actions { display: flex; align-items: center; gap: 0.25rem; margin-left: auto; }
.lang-switch-manage { display: flex; gap: 0.2rem; margin-right: 0.3rem; font-size: 0.8rem; }
.lang-switch-manage a { text-decoration: none; color: var(--text-dim, #6b6560); padding: 0.15rem 0.4rem; border-radius: 0.4rem; font-weight: 600; }
.lang-switch-manage a[aria-current="true"] { background: var(--sand, #e7ddd0); color: var(--text, #1c1917); }
body[data-view="auth"] .appbar-catalog,
body[data-view="auth"] #btn-logout,
body[data-view="auth"] #btn-open-account,
body[data-view="loading"] .appbar-catalog,
body[data-view="loading"] #btn-logout,
body[data-view="loading"] #btn-open-account { display: none !important; }

.workspace {
  min-height: calc(100vh - var(--bar));
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.15rem 3rem;
}

/* —— Buttons —— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  min-height: 36px; padding: 0 0.85rem;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font: inherit; font-weight: 700; cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--gold); color: var(--on-button); }
.btn-primary:hover:not(:disabled) { background: var(--gold-deep); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-low); }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--ink); }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-icon-only { width: 36px; padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.85rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--gold-deep); font: inherit; font-weight: 700; cursor: pointer; }

/* —— Toast —— */
.toast {
  position: fixed; top: calc(var(--bar) + 12px); left: 50%; transform: translateX(-50%);
  z-index: 50; min-width: min(420px, calc(100vw - 2rem));
  padding: 0.7rem 1rem; border-radius: var(--radius-sm);
  font-weight: 600; box-shadow: var(--shadow);
}
.toast.alert-error { background: var(--danger-bg); color: var(--danger); }
.toast.alert-success { background: var(--ok-bg); color: var(--ok); }
.toast.alert-info { background: var(--gold-soft); color: var(--gold-deep); }

/* —— Auth —— */
#view-auth { display: grid; place-items: center; min-height: calc(100vh - var(--bar) - 2rem); }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); padding: 1.6rem 1.4rem; }
.auth-kicker { margin: 0 0 0.25rem; color: var(--gold-deep); font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.auth-card h1 { margin: 0 0 0.85rem; font-size: 1.45rem; letter-spacing: -0.03em; }
.auth-note, .hint-sm, .import-desc { color: var(--muted); font-size: 0.88rem; }
.auth-forgot { margin: 0.9rem 0 0; text-align: center; }
.btn-auth { width: 100%; min-height: 44px; margin-top: 1rem; }
.oauth-block { margin-bottom: 0.4rem; }
.oauth-divider { display: flex; align-items: center; gap: 0.7rem; color: var(--muted); font-size: 0.8rem; }
.oauth-divider::before, .oauth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.oauth-buttons { display: flex; flex-direction: column; gap: 0.5rem; }
.btn-oauth { width: 100%; height: 44px; min-height: 44px; font-weight: 600; }
.btn-oauth-apple { background: #000; color: #fff; }
.btn-oauth-google { background: #fff; color: #1f1f1f; border: 1px solid #747775; }
/* Sans taille, le SVG prend 300×150 (défaut navigateur) et gonfle le bouton. */
.oauth-mark { width: 18px; height: 18px; flex: 0 0 18px; }

/* —— Page —— */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; }
.page-kicker { margin: 0; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.page-title { margin: 0.1rem 0 0; font-size: 1.7rem; letter-spacing: -0.03em; }
.page-title .count { color: var(--muted); font-size: 1rem; font-weight: 700; }
.page-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.toolbar { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; margin-bottom: 0.75rem; }
.search-field { position: relative; flex: 1 1 260px; margin: 0; }
.search-field-icon { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--gold); pointer-events: none; }
.search-inline {
  width: 100%; height: 40px; padding: 0 2.3rem 0 2.4rem;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--ink); font: inherit;
}
.search-inline:focus { outline: none; border-color: var(--gold); }
.search-clear { position: absolute; right: 0.3rem; top: 50%; transform: translateY(-50%); width: 28px; height: 28px; border: 0; background: none; color: var(--muted); cursor: pointer; display: none; }
.search-field.has-value .search-clear { display: grid; place-items: center; }
.pills { display: flex; gap: 0.25rem; }
.seg-btn {
  height: 32px; padding: 0 0.7rem; border: 1px solid var(--border);
  background: transparent; color: var(--ink-soft); border-radius: 999px;
  font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer;
}
.seg-btn.is-on { background: var(--gold-soft); color: var(--gold-deep); border-color: transparent; }

/* —— List —— */
.song-browser { position: relative; display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; min-height: 52vh; }
.song-scroller { flex: 1; min-width: 0; max-height: min(68vh, 720px); overflow: auto; }
.song-list { padding: 0.15rem 0 1rem; }
.song-group-label {
  position: sticky; top: 0; z-index: 2; margin: 0; padding: 0.45rem 1rem 0.3rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(8px);
  color: var(--gold-deep); font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em;
}
.song-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.7rem 1rem; cursor: pointer; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.song-item:hover { background: var(--gold-soft); }
.song-item-main { min-width: 0; flex: 1; }
.song-item-main strong { display: block; font-size: 0.98rem; }
.song-meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; margin-top: 0.2rem; color: var(--muted); font-size: 0.8rem; }
.song-actions { opacity: 0; transition: opacity .15s; }
.song-item:hover .song-actions, .song-item:focus-within .song-actions { opacity: 1; }
.key-chip, .badge {
  display: inline-flex; align-items: center; min-height: 20px;
  padding: 0 0.4rem; border-radius: 6px; font-size: 0.7rem; font-weight: 800;
}
.key-chip { background: var(--gold-soft); color: var(--gold-deep); }
.key-chip-minor { background: var(--iris-soft); color: var(--iris); }
.badge { background: var(--surface-low); color: var(--ink-soft); }
.badge-draft { background: var(--apricot-soft); color: var(--apricot); }
.badge-adv { background: var(--iris-soft); color: var(--iris); }
.section-rail {
  width: 22px; display: flex; flex-direction: column; align-items: center;
  border-left: 1px solid var(--border); user-select: none; touch-action: none;
}
.section-rail button {
  flex: 1; width: 100%; border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 0.58rem; font-weight: 700; padding: 0; cursor: pointer;
}
.section-rail button.is-active { color: var(--gold-deep); }
.section-rail button:disabled { opacity: .25; cursor: default; }
.rail-bubble {
  position: absolute; right: 1.8rem; z-index: 3; min-width: 2rem;
  padding: 0.3rem 0.45rem; border-radius: 8px; background: var(--gold); color: var(--on-button);
  font-weight: 800; text-align: center; pointer-events: none;
}
.empty-card, .import-card {
  max-width: 520px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 1.4rem; box-shadow: var(--shadow);
}

/* —— Studio editor —— */
.studio { max-width: none; }
.studio-form { display: flex; flex-direction: column; gap: 0.75rem; }
.studio-bar {
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  position: sticky; top: var(--bar); z-index: 8;
  background: var(--bg); padding: 0.35rem 0 0.55rem;
}
.studio-bar h2 { flex: 1; margin: 0; font-size: 1.15rem; }
.studio-bar-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.studio-body {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 1rem;
}
.editor-tabs { display: flex; gap: 0.2rem; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 0.4rem 0.7rem; font: inherit; font-weight: 800; color: var(--muted); cursor: pointer;
}
.tab.active { color: var(--gold-deep); border-bottom-color: var(--gold); }
.editor-split { display: grid; grid-template-columns: 1fr; gap: 0; }
@media (min-width: 960px) {
  .editor-split { grid-template-columns: 1fr 1fr; }
  .editor-split .chord-preview { margin: 0; max-height: none; border-left: 1px solid var(--border); border-radius: 0; }
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
@media (max-width: 640px) {
  .grid-2, .media-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: stretch; }
  .song-actions { opacity: 1; }
}

label { display: block; font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); margin: 0.55rem 0 0.3rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], textarea, select {
  width: 100%; padding: 0.65rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-low); color: var(--ink); font: inherit;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); background: var(--surface); }
textarea { min-height: 280px; resize: vertical; font-family: var(--mono); font-size: 0.88rem; }
.key-head { display: flex; justify-content: space-between; align-items: center; }
.key-flats { display: inline-flex; align-items: center; gap: 0.35rem; margin: 0; cursor: pointer; }
.bpm-row { display: flex; align-items: center; gap: 0.35rem; }
.bpm-row input { flex: 1; min-width: 0; }
.bpm-fold { padding: 0.35rem 0.6rem; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.7rem; }
.checkbox-row input { width: auto; }
.advanced-panel { margin-top: 0.85rem; padding: 0.85rem; background: var(--surface-low); border-radius: var(--radius-sm); }
.media-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.85rem; }
.media-card { padding: 0.9rem; border: 1px solid var(--border); border-radius: var(--radius); }
.media-card h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }
.file-pick { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.file-pick-name { color: var(--muted); font-size: 0.82rem; }
.field-spaced { margin-top: 0.75rem; }
#section-normal-lyrics.is-advanced-only,
#section-normal-media.is-advanced-only { opacity: .4; pointer-events: none; }

.chordpro-field { display: flex; flex-direction: column; }
.chord-toolbar {
  display: flex; flex-wrap: nowrap; align-items: center; gap: 0.15rem;
  overflow-x: auto; padding: 0.3rem; background: var(--surface-low);
  border: 1px solid var(--border); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0;
}
.chord-toolbar-sep { width: 1px; height: 1rem; background: var(--border); margin: 0 0.25rem; }
.chord-tool { border: 0; background: none; color: var(--ink-soft); font: inherit; font-size: 0.8rem; font-weight: 700; padding: 0.28rem 0.45rem; border-radius: 6px; cursor: pointer; }
.chord-tool:hover, .chord-tool.is-current { background: var(--gold-soft); color: var(--gold-deep); }
.chord-chip { font-family: var(--mono); }
.chordpro-field textarea { border-radius: 0; min-height: 320px; }
.chord-preview { padding: 0.85rem; max-height: 240px; overflow: auto; font-size: 0.95rem; }
.preview-empty { margin: 0; color: var(--muted); }
.preview-section { font-weight: 800; color: var(--gold-deep); margin-top: 0.35rem; }
.preview-chord { color: var(--iris); font-weight: 800; font-size: 0.75em; vertical-align: super; }
.preview-unknown { color: var(--danger); text-decoration: underline wavy; }
.preview-gap { height: 0.65rem; }
.section-pop, .transpose-pop { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.4rem; }
.chordpro-field.is-fullscreen {
  position: fixed; inset: 0; z-index: 40; margin: 0; padding: 0.8rem; background: var(--surface);
}
.chordpro-field.is-fullscreen textarea { min-height: 50vh; }

/* —— Drawer —— */
.drawer-scrim { position: fixed; inset: 0; background: rgba(28,25,23,.28); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; z-index: 31; width: min(420px, 100vw);
  height: 100%; background: var(--surface); border-left: 1px solid var(--border);
  padding: 1rem 1.1rem 2rem; overflow: auto; box-shadow: var(--shadow);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer h2 { margin: 0; }
.drawer h3 { margin: 1.1rem 0 0.4rem; font-size: 0.95rem; }
.catalog-switch-label { margin-top: 1rem; font-weight: 800; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.pending-badge { display: inline-flex; min-width: 1.3rem; justify-content: center; padding: 0.05rem 0.4rem; border-radius: 99px; background: var(--apricot-soft); color: var(--apricot); font-size: 0.72rem; font-weight: 800; }
.member-list { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.member-list li, .song-item.member {
  display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--border);
  flex-wrap: wrap; cursor: default;
}
.member-list .song-main { min-width: 12rem; flex: 1; }
.member-list .song-main strong { display: block; }
.member-list .song-actions {
  opacity: 1;
  display: flex; flex-wrap: wrap; gap: 0.35rem;
  justify-content: flex-end; align-items: center;
}
.role-select {
  font: inherit;
  font-size: 0.85rem;
  width: auto;
  min-width: 12.5rem;
  max-width: 100%;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: inherit;
}
.danger-block { margin-top: 1.6rem; padding-top: 1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; align-items: flex-start; gap: 0.45rem; }
.import-preview { list-style: none; padding: 0.6rem 0.8rem; margin: 0.8rem 0 0; max-height: 220px; overflow: auto; background: var(--surface-low); border-radius: var(--radius-sm); }
.changes-card { margin: 0 0 1rem; padding: 0.85rem 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.change-dialog { width: min(720px, calc(100vw - 2rem)); border: 0; border-radius: var(--radius); padding: 1rem 1.1rem; background: var(--surface); color: var(--ink); }
.change-dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.change-dialog .chord-preview { max-height: 280px; }

.legal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  justify-content: center;
  padding: 0.6rem 1rem 1rem;
  font-size: 0.8rem;
}
.legal-foot a { color: var(--muted, #6b645c); }

@media (max-width: 720px) {
  .appbar-catalog .code-chip { display: none; }
  .catalog-select { max-width: none; flex: 1 1 auto; min-width: 0; }
  /* Deux rangées : marque + compte en haut, base + réglages dessous (plus de chevauchement). */
  body:not([data-view="auth"]):not([data-view="loading"]) { --bar: 104px; }
  body:not([data-view="auth"]):not([data-view="loading"]) .appbar {
    flex-wrap: wrap;
    align-content: center;
    row-gap: 0.4rem;
    padding: 0.4rem 0.75rem;
  }
  body:not([data-view="auth"]):not([data-view="loading"]) .appbar-actions { order: 2; margin-left: auto; }
  body:not([data-view="auth"]):not([data-view="loading"]) .appbar-catalog { order: 3; flex: 1 1 100%; }
  .appbar .btn { padding: 0 0.6rem; font-size: 0.88rem; white-space: nowrap; }
}

/* ═══════════ Habillage 2026-10 : aligné sur le site public ═══════════ */
:root { --radius: 14px; --radius-sm: 10px; --bar: 64px; }
body { font-size: 15.5px; background: var(--bg); }

/* Barre du haut */
.appbar { gap: 0.9rem; padding: 0 1.25rem; box-shadow: 0 1px 0 var(--border); border-bottom: 0; }
.brand-logo { width: 32px; height: 32px; border-radius: 50%; display: block; box-shadow: 0 0 0 1px var(--border); background: #fff; }
.brand { font-size: 1.12rem; }
.catalog-select { height: 38px; border-radius: 999px; padding: 0 2rem 0 0.95rem; background-color: var(--surface-low); }
.code-chip { height: 34px; border-radius: 999px; border-style: solid; background: var(--gold-soft); border-color: transparent; color: var(--gold-deep); padding: 0 0.85rem; }
.code-chip:hover { filter: brightness(0.97); }
.lang-switch-manage { padding: 0.18rem; background: var(--surface-low); border: 1px solid var(--border); border-radius: 999px; margin-right: 0.35rem; }
.lang-switch-manage a { padding: 0.22rem 0.6rem; border-radius: 999px; color: var(--ink-soft); }
.lang-switch-manage a[aria-current="true"] { background: var(--gold); color: var(--on-button); }

/* Boutons : arrondis, contrastés, jamais blancs sur blanc */
.btn { min-height: 40px; padding: 0 1rem; border-radius: 999px; font-size: 0.94rem; }
.btn-primary { box-shadow: 0 1px 2px color-mix(in srgb, var(--gold-deep) 35%, transparent); }
.btn-secondary { background: var(--gold-soft); color: var(--gold-deep); border-color: transparent; }
.btn-secondary:hover:not(:disabled) { background: color-mix(in srgb, var(--gold-soft) 80%, var(--gold) 20%); }
.btn-ghost { color: var(--ink-soft); }
.btn-danger { border-color: transparent; }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-icon-only { width: 40px; }
.link-btn { color: var(--gold); }
.link-btn:hover { text-decoration: underline; }

/* Connexion : présentation + formulaire */
#view-auth { min-height: calc(100vh - var(--bar) - 4rem); }
.auth-shell { display: grid; gap: 1.5rem; width: min(980px, 100%); align-items: center; }
.auth-intro { padding: 0.5rem 0.25rem; }
.auth-intro-logo { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border), 0 10px 30px color-mix(in srgb, var(--gold) 25%, transparent); background: #fff; }
.auth-intro h2 { margin: 1rem 0 0.6rem; font-size: 1.9rem; line-height: 1.15; letter-spacing: -0.03em; }
.auth-intro > p { margin: 0 0 1.25rem; color: var(--ink-soft); font-size: 1.05rem; max-width: 30rem; }
.auth-intro-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.auth-intro-list li { position: relative; padding: 0.85rem 1rem 0.85rem 2.9rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.auth-intro-list li::before { content: ""; position: absolute; left: 1rem; top: 1.05rem; width: 1.1rem; height: 1.1rem; border-radius: 50%; background: var(--gold) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 70% no-repeat; }
.auth-intro-list strong { display: block; font-size: 0.98rem; }
.auth-intro-list span { display: block; color: var(--muted); font-size: 0.9rem; }
.auth-card { width: 100%; max-width: 440px; justify-self: center; border-radius: 20px; padding: 1.9rem 1.6rem; }
.auth-card h1 { font-size: 1.6rem; }
.btn-auth, .btn-oauth { min-height: 48px; border-radius: 999px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], select { min-height: 44px; border-radius: var(--radius-sm); }
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 20%, transparent); }
@media (min-width: 900px) {
  .auth-shell { grid-template-columns: 1.1fr 1fr; gap: 3rem; }
  .auth-intro h2 { font-size: 2.4rem; }
}
@media (max-width: 899px) {
  .auth-intro-list { display: none; }
  .auth-intro { text-align: center; }
  .auth-intro > p { margin: 0 auto 0.5rem; }
  .auth-intro h2 { font-size: 1.5rem; }
}

/* Catalogue */
.page-head { margin: 0.25rem 0 1.1rem; }
.page-title { font-size: 1.9rem; }
.page-title .count { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 1.6rem; padding: 0 0.55rem; margin-left: 0.35rem; border-radius: 999px; background: var(--gold-soft); color: var(--gold-deep); font-size: 0.85rem; vertical-align: middle; }
.toolbar { gap: 0.6rem; margin-bottom: 1rem; }
.search-inline { height: 44px; box-shadow: var(--shadow); border-color: transparent; }
.seg-btn { height: 34px; background: var(--surface); }
.song-browser { border-radius: 18px; box-shadow: var(--shadow); border-color: transparent; }
.song-item { padding: 0.85rem 1.1rem; transition: background .12s; }
.song-item:hover { background: color-mix(in srgb, var(--gold-soft) 60%, var(--surface)); }
.song-item-main strong { font-size: 1rem; }
.key-chip, .badge { min-height: 22px; padding: 0 0.5rem; border-radius: 999px; }
.empty-card, .import-card, .changes-card { border-radius: 18px; border-color: transparent; box-shadow: var(--shadow); }

/* Éditeur */
.studio-bar { padding: 0.6rem 0 0.75rem; }
.studio-bar h2 { font-size: 1.3rem; }
.studio-body { border-radius: 18px; border-color: transparent; box-shadow: var(--shadow); padding: 1.15rem; }
.tab { padding: 0.55rem 0.9rem; border-radius: 999px; border-bottom: 0; }
.tab.active { background: var(--gold-soft); color: var(--gold-deep); }
.chord-toolbar { padding: 0.35rem; }
.chord-tool { padding: 0.35rem 0.6rem; border-radius: 999px; }
.media-card, .advanced-panel { border-radius: var(--radius); }

/* Tiroirs et dialogues */
.drawer-scrim { background: rgba(28, 25, 23, 0.4); backdrop-filter: blur(2px); }
.drawer { padding: 1.25rem 1.35rem 2.25rem; border-left: 0; box-shadow: -20px 0 40px rgba(28, 25, 23, 0.12); }
.drawer h3 { margin-top: 1.4rem; }
.danger-block { padding: 1rem; margin-top: 2rem; border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); border-radius: var(--radius); background: color-mix(in srgb, var(--danger-bg) 50%, transparent); }
.danger-block h3 { margin: 0; color: var(--danger); }
.change-dialog { border-radius: 20px; padding: 1.25rem 1.35rem; box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25); }
.toast { border-radius: 999px; padding: 0.75rem 1.2rem; text-align: center; }

.legal-foot { padding: 1.25rem 1rem 1.75rem; }
.legal-foot a { text-decoration: none; font-weight: 600; }
.legal-foot a:hover { color: var(--gold); text-decoration: underline; }

/* ── Mobile : gestes au pouce ── */
@media (max-width: 720px) {
  body:not([data-view="auth"]):not([data-view="loading"]) { --bar: 112px; }
  .workspace { padding: 1rem 0.85rem 6rem; }
  .page-title { font-size: 1.55rem; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  /* « Nouveau chant » devient un bouton flottant en bas à droite. */
  #btn-new-song {
    position: fixed; right: 1rem; bottom: calc(1rem + env(safe-area-inset-bottom)); z-index: 25;
    min-height: 54px; padding: 0 1.35rem; flex: none;
    font-size: 1rem; box-shadow: 0 10px 24px color-mix(in srgb, var(--gold-deep) 40%, transparent);
  }
  #btn-new-song::before { content: "+"; font-size: 1.35rem; line-height: 1; margin-right: 0.15rem; }
  .toolbar .pills { overflow-x: auto; flex-wrap: nowrap; max-width: 100%; scrollbar-width: none; }
  .toolbar .pills::-webkit-scrollbar { display: none; }
  .seg-btn { height: 38px; flex: none; }
  .song-scroller { max-height: none; }
  .song-item { padding: 0.95rem 1rem; min-height: 64px; }
  .song-actions .btn { min-height: 36px; }
  /* Les tiroirs remontent du bas, comme une feuille d'app. */
  .drawer {
    top: auto; bottom: 0; width: 100vw; height: auto; max-height: 88vh;
    border-radius: 22px 22px 0 0; padding-bottom: calc(2rem + env(safe-area-inset-bottom));
    box-shadow: 0 -20px 40px rgba(28, 25, 23, 0.18);
  }
  .drawer::before { content: ""; display: block; width: 44px; height: 5px; margin: -0.35rem auto 0.9rem; border-radius: 99px; background: var(--border); }
  .studio-bar { flex-wrap: wrap; }
  .studio-bar h2 { flex: 1 1 100%; order: -1; }
  .studio-bar-actions { width: 100%; }
  .studio-bar-actions .btn-primary { flex: 1 1 100%; min-height: 46px; }
  .studio-body { padding: 0.85rem; border-radius: 16px; }
  .auth-card { padding: 1.5rem 1.2rem; }
}

.copyright{flex-basis:100%;text-align:center;font-size:.8rem;opacity:.7;margin-top:6px}

.loading-view { display: grid; place-items: center; align-content: center; gap: 1rem; min-height: calc(100vh - var(--bar) - 4rem); text-align: center; color: var(--muted); font-weight: 600; }
.loading-view p { margin: 0; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--gold) 20%, transparent); border-top-color: var(--gold); animation: miyah-spin 0.8s linear infinite; }
@keyframes miyah-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }
.btn-auth:disabled { opacity: 0.75; cursor: progress; }

.name-dialog { width: min(440px, calc(100vw - 2rem)); border: 0; border-radius: 20px; padding: 1.4rem 1.5rem 1.25rem; background: var(--surface); color: var(--ink); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.25); }
.name-dialog::backdrop { background: rgba(20, 30, 28, 0.45); backdrop-filter: blur(3px); }
.name-dialog h3 { margin: 0 0 0.35rem; font-size: 1.2rem; }
.name-dialog .hint-sm { margin: 0 0 1rem; }
.name-dialog label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.name-dialog input { width: 100%; box-sizing: border-box; }
.name-dialog .btn-row { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 1.1rem; }
@media (max-width: 720px) {
  .name-dialog { margin: auto auto 0; width: 100vw; max-width: 100vw; border-radius: 20px 20px 0 0; }
  .name-dialog .btn-row .btn { flex: 1; }
}
