/* Songs · "Quiet" — modern minimal. Off-white surface, single sage accent,
   DM Sans + DM Mono. Ported pixel-for-pixel from the design prototype. */

:root {
  --bg:          #f7f6f2;
  --surface:     #ffffff;
  --line:        #ebe9e3;
  --rule:        #ddd9cf;
  --ink:         #1a1a17;
  --muted:       #74726b;
  --soft:        #a3a097;
  --accent:      oklch(0.55 0.07 175);
  --accent-ink:  oklch(0.40 0.06 175);
  --accent-soft: oklch(0.94 0.025 175);
  --star:        oklch(0.70 0.13 75);
  --danger:      oklch(0.60 0.16 25);
  --sans: "DM Sans", -apple-system, system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.mono { font-family: var(--mono); }
.cap  { text-transform: capitalize; }
.muted { color: var(--muted); }
.soft  { color: var(--soft); }
.only-mobile { display: none; }

button { font-family: inherit; }

.eyebrow {
  font: 500 11px/1 var(--mono);
  color: var(--soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

kbd {
  font: 500 10px/1 var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 2px 5px;
  border-radius: 4px;
  box-shadow: 0 1px 0 var(--line);
}

/* ── Shell ──────────────────────────────────────────────────────────────── */
.app {
  position: relative;
  display: flex;
  width: 100%;
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
}
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-brand { padding: 0 6px; }
.brand-name {
  font: 500 17px/1.2 var(--sans);
  color: var(--ink);
  margin-top: 4px;
  letter-spacing: -0.01em;
}
.set-open {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 10px; cursor: pointer; text-align: left;
  font: 500 13px/1 var(--sans); color: var(--ink);
}
.set-badge {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font: 500 11px/1 var(--mono);
}
.set-open-label { flex: 1; }
.set-open-arrow { color: var(--muted); font: 400 15px/1 var(--sans); }

.side-group-title {
  font: 500 10px/1 var(--mono); color: var(--soft);
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0 10px 8px;
}
.side-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 8px 10px;
  border: 0; background: transparent; border-radius: 8px;
  cursor: pointer; text-align: left;
  font: 500 13px/1 var(--sans); color: var(--ink);
}
.side-item.active { background: var(--accent-soft); }
.side-ico {
  width: 16px; height: 16px; display: inline-flex;
  align-items: center; justify-content: center; color: var(--muted);
}
.side-glyph { font: 400 13px/1 serif; }
.side-label { flex: 1; }
.side-count { font: 400 11px/1 var(--mono); color: var(--muted); }

.sidebar-user {
  margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font: 500 11px/1 var(--sans);
}
.avatar-img { object-fit: cover; }
.avatar-meta { flex: 1; min-width: 0; }
.avatar-name { font: 500 12px/1.2 var(--sans); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-role { font: 400 11px/1.2 var(--sans); color: var(--muted); text-transform: capitalize; }
.signout { display: inline-flex; align-items: center; color: var(--soft); padding: 4px; border-radius: 6px; text-decoration: none; flex: 0 0 auto; }
.signout:hover { color: var(--ink); background: var(--line); }

/* ── Topbar ─────────────────────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 24px; border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.topbar-titles { display: flex; align-items: baseline; gap: 10px; }
.topbar-h1 { font: 500 22px/1 var(--sans); color: var(--ink); letter-spacing: -0.02em; margin: 0; }
.topbar-count { font: 400 13px/1 var(--mono); color: var(--muted); }

.searchbox {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; width: 340px;
}
.searchbox .ico { color: var(--muted); flex: 0 0 auto; }
.searchbox input {
  flex: 1; border: 0; outline: none; background: transparent;
  font: 400 13px/1 var(--sans); color: var(--ink); min-width: 0;
}
.searchbox input::-webkit-search-cancel-button { -webkit-appearance: none; }

.topbar-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.btn-help {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 12px/1 var(--mono); padding: 8px 9px; border-radius: 10px; cursor: pointer;
}
.btn-primary {
  border: 0; background: var(--ink); color: #fff;
  font: 500 13px/1 var(--sans); padding: 10px 14px; border-radius: 10px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.btn-new .plus { font: 400 16px/1 var(--sans); }
.btn-ghost {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 13px/1 var(--sans); padding: 9px 14px; border-radius: 10px; cursor: pointer;
}

/* ── Chips ──────────────────────────────────────────────────────────────── */
.chips {
  display: flex; gap: 6px; padding: 10px 24px;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.chip {
  font: 500 12px/1 var(--sans); padding: 7px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  cursor: pointer; white-space: nowrap;
}
.chip.active { border-color: var(--ink); background: var(--ink); color: #fff; }

/* ── Workspace ──────────────────────────────────────────────────────────── */
.workspace { flex: 1; display: flex; overflow: hidden; position: relative; }

/* List / table */
.list { flex: 1 1 0; min-width: 0; overflow-y: auto; background: var(--surface); }
.list-head, .row {
  display: grid;
  grid-template-columns: 1fr 1.1fr 70px 110px 90px;
  align-items: center; gap: 4px;
}
.list-head {
  border-bottom: 1px solid var(--line); background: var(--bg);
  position: sticky; top: 0; z-index: 1;
}
.list-head > span {
  font: 500 10px/1 var(--mono); color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase; padding: 12px 12px;
}

.row { position: relative; cursor: pointer; background: transparent; border-bottom: 1px solid var(--line); }
.row:hover { background: #faf9f6; }
.row.selected { background: var(--accent-soft); }
.row-grip { display: none; }
.row-title, .row-author, .row-key, .row-ago {
  padding: 13px 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-title { font: 500 13px/1.3 var(--sans); color: var(--ink); text-decoration: none; display: block; }
.row-author { font: 400 13px/1.3 var(--sans); color: var(--muted); }
.row-ago { font: 400 12px/1.3 var(--sans); color: var(--muted); }
.row-actions {
  padding: 8px 8px; display: flex; justify-content: flex-end; align-items: center; gap: 4px;
}
.row-add {
  border: 0; background: transparent; color: var(--muted);
  cursor: pointer; padding: 4px 6px; border-radius: 6px;
  font: 500 11px/1 var(--mono); opacity: 0; transition: opacity 0.12s;
}
.row:hover .row-add { opacity: 1; }
.row-add.inset { opacity: 1; background: var(--accent); color: #fff; }
.row-fav { border: 0; background: transparent; cursor: pointer; padding: 4px; display: inline-flex; }

/* Set-mode: reorder the Sabbath set in the list by dragging the grip */
.list.set-mode .row { padding-left: 22px; }
.list.set-mode .row-grip {
  display: flex; align-items: center; justify-content: center;
  position: absolute; left: 2px; top: 0; bottom: 0; width: 20px;
  color: var(--soft); cursor: grab; touch-action: none; font: 400 14px/1 var(--sans);
}
.list.set-mode .row-grip:active { cursor: grabbing; }
.list.set-mode .row-add { display: inline-flex; opacity: 1; }
.list.set-mode .row-fav { display: none; }
.row.dragging { opacity: 0.5; background: var(--accent-soft); }

.set-bar { display: none; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.list.set-mode .set-bar { display: flex; }
.set-bar-hint { font: 400 12px/1.3 var(--sans); color: var(--muted); }
.set-bar-clear { border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 12px/1 var(--sans); padding: 7px 11px; border-radius: 8px; cursor: pointer; flex: 0 0 auto; }

.key-chip {
  display: inline-block; font: 500 11px/1 var(--mono);
  padding: 3px 6px; background: var(--accent-soft); color: var(--accent-ink);
  border-radius: 4px; letter-spacing: 0.02em;
}

.star { fill: none; stroke: var(--soft); }
.star.on { fill: var(--star); stroke: var(--star); }

.list-empty { padding: 60px 20px; text-align: center; color: var(--muted); font: 400 14px/1.5 var(--sans); }

/* ── Detail pane ────────────────────────────────────────────────────────── */
.detail { flex: 1.2 1 0; min-width: 420px; display: flex; }
.detail-pane {
  flex: 1; display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line);
  overflow: hidden; min-width: 0;
}
.detail-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--soft); font: 400 14px/1.5 var(--sans);
  background: var(--bg); padding: 40px; text-align: center;
  border-left: 1px solid var(--line);
}
.detail-empty .eyebrow { margin-bottom: 10px; }

.detail-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; border-bottom: 1px solid var(--line); gap: 10px;
}
.ccli { font: 400 11px/1 var(--mono); color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.detail-bar-actions { display: flex; gap: 8px; align-items: center; }
.iconbtn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 12px/1 var(--sans); padding: 6px 9px; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.iconbtn.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.detail-close { border: 0; background: transparent; cursor: pointer; color: var(--muted); font: 400 18px/1 var(--sans); padding: 0 6px; }
.detail-back { display: none; border: 0; background: transparent; color: var(--ink); font: 400 14px/1 var(--sans); cursor: pointer; padding: 0; }

.detail-head {
  padding: 20px 24px 16px; display: flex;
  align-items: flex-start; justify-content: space-between; gap: 20px;
}
.detail-head-text { min-width: 0; flex: 1 1 auto; }

/* Reference video tucked into the header's spare space on the right (desktop).
   Hidden when the song has no video; the URL is set from the Notes tab. */
.detail-video { flex: 0 0 clamp(200px, 32%, 300px); }
.detail-video .video-embed { margin-bottom: 0; }
.detail-title { font: 500 26px/1.15 var(--sans); color: var(--ink); margin: 0; letter-spacing: -0.02em; }
.detail-sub { font: 400 14px/1.4 var(--sans); color: var(--muted); margin-top: 6px; }
.detail-copyright { font: 400 12px/1.4 var(--sans); color: var(--soft); margin-top: 4px; }

/* Prominent category badges under the song title; one soft hue per category. */
.detail-cats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cat-badge {
  font: 600 11px/1 var(--sans); letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-ink);
  border: 1px solid oklch(0.40 0.06 175 / 0.18);
}
.cat-badge[data-cat="modern"]      { background: oklch(0.94 0.03 145);  color: oklch(0.40 0.07 145); border-color: oklch(0.40 0.07 145 / 0.18); }
.cat-badge[data-cat="modern_hymn"] { background: oklch(0.94 0.03 215);  color: oklch(0.43 0.08 215); border-color: oklch(0.43 0.08 215 / 0.20); }
.cat-badge[data-cat="praise"]      { background: oklch(0.94 0.035 255); color: oklch(0.47 0.10 255); border-color: oklch(0.47 0.10 255 / 0.20); }
.cat-badge[data-cat="gospel"]      { background: oklch(0.93 0.04 300);  color: oklch(0.46 0.12 300); border-color: oklch(0.46 0.12 300 / 0.20); }
.cat-badge[data-cat="scripture"]   { background: oklch(0.94 0.035 340); color: oklch(0.47 0.12 340); border-color: oklch(0.47 0.12 340 / 0.20); }
.cat-badge[data-cat="kids"]        { background: oklch(0.94 0.035 65);  color: oklch(0.45 0.09 65);  border-color: oklch(0.45 0.09 65 / 0.20); }
.cat-badge[data-cat="christmas"]   { background: oklch(0.94 0.035 25);  color: oklch(0.46 0.11 25);  border-color: oklch(0.46 0.11 25 / 0.20); }

.transpose {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 6px 6px 14px; flex: 0 0 auto;
}
.transpose-key .eyebrow { font-size: 10px; letter-spacing: 0.06em; }
.key-line { display: flex; align-items: center; }
.key-now { font: 500 18px/1 var(--sans); color: var(--ink); margin-top: 5px; }
.key-delta { color: var(--muted); margin-left: 6px; }
.transpose-btns { display: flex; flex-direction: column; gap: 2px; }
.t-step {
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  width: 28px; height: 22px; border-radius: 5px; color: var(--ink);
  font: 500 12px/1 var(--mono); padding: 0;
}
.t-reset { border: 0; background: transparent; cursor: pointer; color: var(--muted); font: 400 11px/1 var(--sans); padding: 0 4px; }

/* Transpose-to-key button bar */
.transpose-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 24px 14px; }
.t-key {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 11px/1 var(--mono); padding: 6px 8px; border-radius: 6px;
  cursor: pointer; min-width: 30px; text-align: center;
}
.t-key:hover { background: var(--bg); }
.t-key.original { background: var(--soft); color: var(--ink); border-color: var(--soft); }
.t-key.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* Transposer lives at the top of the Chords tab */
.transpose-panel { margin-bottom: 16px; }
.transpose-panel .transpose { display: inline-flex; margin-bottom: 10px; }
.transpose-panel .transpose-bar { padding: 0; }

/* Arrangement selector (sits above the tabs) */
.arr-bar { display: flex; align-items: center; gap: 8px; padding: 12px 24px 0; }
.arr-label {
  font: 500 10px/1 var(--mono); color: var(--muted);
  letter-spacing: 0.1em; text-transform: uppercase;
}
.arr-select {
  font: 500 13px/1.2 var(--sans); color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 7px; padding: 5px 26px 5px 9px; cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2374726b' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.arr-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.arr-manage {
  border: 1px solid var(--rule); background: var(--surface); color: var(--muted);
  font: 500 12px/1 var(--sans); padding: 6px 10px; border-radius: 7px; cursor: pointer;
}
.arr-manage:hover { color: var(--ink); border-color: var(--soft); }
.arr-inset-note { font: 400 11px/1 var(--mono); color: var(--accent-ink); letter-spacing: 0.02em; }

/* Arrangement manager modal */
.modal-arr { max-width: 540px; }
.arr-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.arr-empty { padding: 10px 0; font-size: 13px; }
.arr-row {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px;
}
.arr-row-main { flex: 1; min-width: 0; }
.arr-row-name { font: 500 13px/1.3 var(--sans); color: var(--ink); }
.arr-row-meta { font: 400 11px/1 var(--mono); color: var(--muted); }
.arr-row-seq { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; }
.arr-row-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.arr-del:hover { color: var(--danger); }

.arr-editor { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 14px; display: flex; flex-direction: column; gap: 14px; }
.arr-default { display: inline-flex; align-items: center; gap: 7px; font: 400 13px/1 var(--sans); color: var(--ink); }
.arr-seq {
  display: flex; flex-wrap: wrap; gap: 6px; min-height: 38px;
  border: 1px dashed var(--rule); border-radius: 8px; padding: 8px;
}
.arr-seq-empty { font-size: 12px; align-self: center; }
.arr-seq-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 500 12px/1 var(--mono); color: #fff; background: var(--accent);
  padding: 6px 6px 6px 9px; border-radius: 7px; cursor: grab; user-select: none;
}
.arr-seq-chip:active { cursor: grabbing; }
.arr-seq-rm { border: 0; background: transparent; color: #fff; font: 400 14px/1 var(--sans); cursor: pointer; padding: 0 2px; opacity: 0.8; }
.arr-seq-rm:hover { opacity: 1; }
.arr-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.arr-pal-chip {
  font: 500 12px/1 var(--mono); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 6px 9px; cursor: pointer;
}
.arr-pal-chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.arr-editor-foot { border-top: 0; padding-top: 0; }

.tabs { display: flex; gap: 2px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.tab {
  border: 0; background: transparent; padding: 12px 14px;
  font: 500 13px/1 var(--sans); color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

.tab-body { flex: 1; overflow-y: auto; padding: 22px 24px 28px; }
.tab-panel[hidden] { display: none; }

/* Chord chart */
.chart { font: 400 15px/1 var(--sans); }
.chart-section {
  font: 500 10px/1 var(--mono); color: var(--muted);
  letter-spacing: 0.1em; text-transform: uppercase; margin: 18px 0 10px;
}
.chart-section:first-child { margin-top: 0; }
.chart-line { margin-bottom: 6px; line-height: 1.1; }
.chart-tok { display: inline-block; vertical-align: top; }
.chord { display: block; font: 500 12px/1.2 var(--mono); color: var(--accent-ink); min-height: 14px; padding-right: 6px; }
.lyric { display: block; font: 400 15px/1.5 var(--sans); color: var(--ink); }

/* Lyrics only */
.lyrics-only { font: 400 17px/1.8 var(--sans); color: var(--ink); max-width: 600px; }
.lyrics-only .chart-section { margin: 22px 0 10px; }
.lyrics-only .chart-section:first-child { margin-top: 0; }
/* Section headers coloured to match the editor: blue title, purple chorus.
   Applies in both the Chords and Lyrics views. */
.chart-section.sec-title,
.chart-section.sec-chorus {
  display: inline-block; color: #fff; padding: 3px 10px;
  border-radius: 5px; letter-spacing: 0.06em;
}
.chart-section.sec-title  { background: #357EC7; }
.chart-section.sec-chorus { background: #800080; }

/* History */
.hist-stats { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.hist-stat .eyebrow { font-size: 11px; letter-spacing: 0.06em; }
.hist-stat.divided { border-left: 1px solid var(--line); padding-left: 14px; }
.hist-stat-big { font: 500 28px/1 var(--sans); color: var(--ink); margin-top: 6px; letter-spacing: -0.02em; }
.hist-stat-mid { font: 500 16px/1.2 var(--sans); color: var(--ink); margin-top: 8px; }
.hist-bars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; align-items: end; height: 100px; }
.hist-bar { height: 14%; background: var(--line); border-radius: 2px; }
.hist-bar.on { height: 100%; background: var(--accent); }
.hist-axis {
  display: flex; justify-content: space-between;
  font: 400 10px/1 var(--mono); color: var(--soft);
  margin-top: 8px; letter-spacing: 0.06em; text-transform: uppercase;
}
.hist-recent { margin-top: 26px; }
.hist-recent .eyebrow { font-size: 11px; letter-spacing: 0.06em; margin-bottom: 10px; }
.hist-row {
  display: flex; justify-content: space-between; padding: 10px 0;
  border-bottom: 1px solid var(--line); font: 400 13px/1 var(--sans); color: var(--ink);
}
.hist-row .mono { font: 400 12px/1 var(--mono); }
.muted-note { color: var(--muted); font: 400 13px/1.5 var(--sans); padding: 10px 0; }

/* Reference video + notes */
.video-block { margin-bottom: 20px; }
.video-embed {
  position: relative; padding-top: 56.25%;   /* 16:9 */
  margin-bottom: 8px; border-radius: 10px; overflow: hidden; background: #000;
}
.video-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-add { display: flex; gap: 8px; align-items: stretch; }
.video-add .video-input { flex: 1; font-size: 13px; }
.video-save { white-space: nowrap; padding: 10px 16px; border-radius: 8px; }
.notes-label { font-size: 11px; letter-spacing: 0.06em; margin-bottom: 10px; }
.notes-area {
  width: 100%; min-height: 220px; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; background: var(--bg); font: 400 14px/1.6 var(--sans);
  color: var(--ink); outline: none; resize: vertical; box-sizing: border-box;
}
.notes-saved { font: 400 11px/1 var(--sans); color: var(--soft); margin-top: 8px; }

/* Detail footer */
.detail-foot {
  padding: 10px 22px; border-top: 1px solid var(--line); background: var(--bg);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font: 500 11px/1 var(--mono); letter-spacing: 0.04em;
  padding: 5px 9px; border-radius: 999px; background: var(--surface);
  color: var(--muted); border: 1px solid var(--line);
}
.kbd-hint { display: flex; gap: 6px; align-items: center; font: 400 11px/1 var(--mono); color: var(--soft); white-space: nowrap; }

/* ── Sunday-set drawer ──────────────────────────────────────────────────── */
.setdrawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: 340px;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -10px 0 30px rgba(0,0,0,0.06);
  display: flex; flex-direction: column; z-index: 5;
  transform: translateX(100%); transition: transform 0.22s ease;
}
.setdrawer.open { transform: none; }
.setdrawer-inner { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.set-head {
  padding: 16px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; background: var(--bg);
}
.set-head-title { font: 500 18px/1.2 var(--sans); color: var(--ink); margin-top: 4px; letter-spacing: -0.01em; }
.set-close { border: 0; background: transparent; cursor: pointer; color: var(--muted); font: 400 18px/1 var(--sans); padding: 4px 8px; }
.set-stats { padding: 12px 18px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr 1fr; }
.set-stat { padding: 4px; text-align: center; }
.set-stat.divided { border-left: 1px solid var(--line); }
.set-stat-v { font: 500 16px/1.2 var(--sans); color: var(--ink); margin-top: 6px; }
.set-list { flex: 1; overflow-y: auto; padding: 6px 12px; }
.set-empty { padding: 60px 20px; text-align: center; color: var(--muted); font: 400 13px/1.6 var(--sans); }
.set-empty b { color: var(--ink); }
.set-item { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--line); cursor: grab; }
.set-item:active { cursor: grabbing; }
.set-item.dragging { opacity: 0.45; }
.set-grip { color: var(--soft); cursor: grab; font: 400 13px/1 var(--sans); flex: 0 0 auto; user-select: none; }
.set-num {
  width: 22px; height: 22px; border-radius: 6px; background: var(--bg);
  border: 1px solid var(--line); color: var(--muted); font: 400 11px/1 var(--mono);
  display: flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.set-item-main { flex: 1; min-width: 0; }
.set-item-title { font: 500 13px/1.3 var(--sans); color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-item-author { font: 400 11px/1.3 var(--sans); color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-remove { border: 0; background: transparent; cursor: pointer; color: var(--soft); font: 400 16px/1 var(--sans); padding: 0 4px; }
.set-flow { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--bg); }
.set-flow .eyebrow { font-size: 10px; letter-spacing: 0.08em; margin-bottom: 8px; }
.set-flow-keys { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.flow-key { font: 500 12px/1 var(--mono); padding: 5px 9px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); }
.flow-arrow { color: var(--soft); font: 400 11px/1 var(--mono); }
.set-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; background: var(--surface); align-items: center; }
.set-clear { border: 0; background: transparent; color: var(--muted); cursor: pointer; font: 400 12px/1 var(--sans); padding: 8px 0; }
.set-foot-actions { display: flex; gap: 8px; }
.set-foot .btn-ghost { font: 500 12px/1 var(--sans); padding: 9px 12px; border-radius: 8px; }
.set-save { font: 500 12px/1 var(--sans); padding: 9px 14px; border-radius: 8px; }

/* ── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: absolute; inset: 0; background: rgba(20,20,15,0.32);
  display: flex; align-items: center; justify-content: center; z-index: 15;
}
.modal-overlay[hidden] { display: none; }
.modal { background: var(--bg); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,0.25); overflow: hidden; }
.modal-new { width: 480px; max-width: 90%; }
.modal-shortcuts { width: 380px; background: var(--surface); }
.modal-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-shortcuts .modal-head { padding: 14px 18px; }
.modal-title { font: 500 19px/1.2 var(--sans); color: var(--ink); margin-top: 4px; letter-spacing: -0.01em; }
.modal-title.sm { font: 500 14px/1 var(--sans); margin-top: 0; }
.modal-x { border: 0; background: transparent; cursor: pointer; color: var(--muted); font: 400 18px/1 var(--sans); padding: 0 6px; }
.modal-fields { padding: 20px 22px; }
.field { display: block; margin-bottom: 14px; }
.field-label { font: 400 11px/1 var(--mono); color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 6px; display: block; }
.input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; background: var(--surface); font: 400 14px/1.3 var(--sans);
  color: var(--ink); outline: none; box-sizing: border-box;
}
.input.mono { font: 400 13px/1.3 var(--mono); }
select.input { appearance: none; -webkit-appearance: none; }
.field-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; margin-bottom: 14px; }
.field-grid .field { margin-bottom: 0; }
.cat-toggle { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-toggle input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.cat-toggle label {
  flex: 1 1 22%; min-width: 84px; padding: 10px 0; text-align: center;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 13px/1 var(--sans); border-radius: 8px; cursor: pointer;
}
.cat-toggle input:checked + label { border-color: var(--ink); background: var(--ink); color: #fff; }
.modal-foot { padding: 12px 22px; border-top: 1px solid var(--line); background: var(--surface); display: flex; justify-content: flex-end; gap: 8px; }
.modal-foot .btn-ghost { font: 500 13px/1 var(--sans); padding: 9px 14px; border-radius: 8px; }
.modal-foot .btn-primary { padding: 9px 16px; border-radius: 8px; }

/* Edit-song modal + colour-coded lyrics editor */
.modal-edit { width: 640px; max-width: 92%; }
.field-hint { font: 400 11px/1.5 var(--sans); color: var(--soft); margin-top: 6px; }
.field-hint b { color: var(--accent-ink); font-weight: 500; }
.edit-chart-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 6px;
}
.edit-chart-head .field-label { margin-bottom: 0; }
.chart-tool {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 11px/1 var(--mono); padding: 6px 8px; border-radius: 7px;
  cursor: pointer;
}

.lyric-editor {
  position: relative; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); overflow: hidden;
}
.lyric-highlight, .lyric-input {
  margin: 0; padding: 12px 14px;
  font: 400 14px/1.6 var(--sans);
  white-space: pre-wrap; overflow-wrap: break-word; word-break: break-word;
  box-sizing: border-box; width: 100%; letter-spacing: 0;
}
.lyric-highlight {
  position: absolute; inset: 0; overflow: auto;
  color: var(--ink); pointer-events: none;
}
.lyric-highlight > div { min-height: 1.6em; }
.lyric-highlight .hl-title  { background: #357EC7; color: #fff; }
.lyric-highlight .hl-chorus { background: #800080; color: #fff; }
.lyric-highlight .hl-end    { background: var(--muted); color: #fff; }
.lyric-highlight .hl-chord {
  color: var(--accent-ink); 
  font-family: "DM Sans", -apple-system, system-ui, sans-serif !important;
  font-weight: normal !important;
}
.lyric-highlight .hl-title .hl-chord,
.lyric-highlight .hl-chorus .hl-chord { color: #fff; }
.lyric-input {
  position: relative; display: block; height: 340px; resize: vertical;
  border: 0; outline: 0; background: transparent;
  color: transparent; caret-color: var(--ink); overflow: auto;
}

.shortcut-list { padding: 8px 18px 14px; }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font: 400 13px/1 var(--sans); color: var(--ink); }
.shortcut-row:last-child { border-bottom: 0; }

/* ── Mobile FAB ─────────────────────────────────────────────────────────── */
.fab {
  position: fixed; right: 18px; bottom: 22px; display: none;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--ink); color: #fff; border: 0; cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  font: 400 24px/1 var(--sans); z-index: 8;
  align-items: center; justify-content: center;
}
.fab-set { left: 18px; right: auto; }
.fab-badge {
  position: absolute; top: -3px; right: -3px; box-sizing: border-box;
  min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--accent); color: #fff; border-radius: 9px;
  font: 500 10px/18px var(--mono); text-align: center;
}

/* ── Login page ─────────────────────────────────────────────────────────── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg); padding: 24px;
}
.login-card {
  width: 380px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.06);
}
.login-title { font: 500 26px/1.1 var(--sans); color: var(--ink); letter-spacing: -0.02em; margin: 10px 0 6px; }
.login-sub { font: 400 14px/1.5 var(--sans); color: var(--muted); margin: 0 0 24px; }
.login-error {
  font: 400 13px/1.5 var(--sans); color: var(--danger);
  background: oklch(0.96 0.03 25); border: 1px solid oklch(0.9 0.05 25);
  padding: 10px 12px; border-radius: 10px; margin-bottom: 18px;
}
.login-providers { display: flex; flex-direction: column; gap: 10px; }
.prov {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 14px; border-radius: 10px; cursor: pointer;
  font: 500 14px/1 var(--sans); text-decoration: none;
  border: 1px solid var(--line);
}
.prov-ico { display: inline-flex; align-items: center; }
.prov-google { background: #fff; color: #1f1f1f; border: 1px solid #dadce0; }
.prov-google:hover { background: #f8f8f8; }
.prov-apple { background: #000; color: #fff; border: 0; }
.prov-apple:hover { background: #1a1a1a; }
.prov-telegram { display: flex; justify-content: center; min-height: 40px; }
.login-note {
  font: 400 13px/1.5 var(--sans); color: var(--muted);
  background: var(--bg); border: 1px dashed var(--rule);
  padding: 12px 14px; border-radius: 10px;
}
.login-note code { font: 500 12px/1 var(--mono); color: var(--ink); }

/* ── Mobile nav (hamburger → sidebar) ───────────────────────────────────── */
.nav-toggle {
  border: 0; background: transparent; color: var(--ink); cursor: pointer;
  padding: 6px; border-radius: 8px; align-items: center; justify-content: center;
}
.nav-backdrop { display: none; }

/* ── Responsive: mobile flow (≤ 768px) ──────────────────────────────────── */
@media (max-width: 768px) {
  .only-desktop { display: none !important; }
  .only-mobile  { display: block; }
  .detail-back.only-mobile { display: inline-block; }

  /* Sidebar becomes a left slide-in panel opened by the hamburger. */
  .sidebar {
    display: flex; position: fixed; left: 0; top: 0; bottom: 0;
    width: 270px; max-width: 82%; transform: translateX(-100%);
    transition: transform 0.2s ease; z-index: 45; overflow-y: auto;
    box-shadow: 6px 0 24px rgba(0,0,0,0.14);
  }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(20,20,15,0.32); }
  .nav-toggle { display: inline-flex; flex: 0 0 auto; }

  .setdrawer { display: flex; position: fixed; inset: 0; width: auto; z-index: 40; }
  .fab { display: flex; }

  .topbar { flex-direction: row; align-items: center; gap: 10px; padding: 12px 16px; }
  .searchbox { flex: 1; width: auto; }

  .chips { display: none; }

  .workspace { flex-direction: column; }
  .list { background: var(--bg); padding: 6px 12px 90px; min-height: 0; }
  .list-head { display: none; }

  .row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas:
      "title  title  actions"
      "author author actions"
      "key    ago    actions";
    align-items: start; gap: 0 8px; padding: 12px 8px;
  }
  .row:hover { background: transparent; }
  .row.selected { background: transparent; }
  .row-title { grid-area: title; font: 500 15px/1.25 var(--sans); padding: 0; }
  .row-author { grid-area: author; padding: 0; font: 400 12px/1.4 var(--sans); margin-top: 3px; }
  .row-key { grid-area: key; padding: 0; margin-top: 8px; }
  .row-ago { grid-area: ago; padding: 0; align-self: center; margin-top: 8px; color: var(--soft); font: 400 11px/1 var(--sans); }
  .row-actions { grid-area: actions; align-self: start; padding: 0; }
  .row-add { display: none; }

  /* Detail becomes a full-screen overlay (the mobile detail screen). */
  .detail {
    position: fixed; inset: 0; z-index: 30; min-width: 0; display: block;
    transform: translateX(100%); transition: transform 0.2s ease; background: var(--bg);
  }
  .app.detail-open .detail { transform: none; }
  .detail-close { display: none; }

  /* Reading mode: the whole pane scrolls so the action bar and song title slide
     up out of view, freeing the screen for lyrics/chords. Only the tab bar stays
     pinned, so you can still flip between Lyrics and Chords mid-scroll. */
  .detail-pane {
    border-left: 0; height: 100%;
    display: block; overflow-y: auto; -webkit-overflow-scrolling: touch;
  }
  .tab-body { overflow: visible; }
  .tabs {
    position: sticky; top: 0; z-index: 5;
    overflow-x: auto;
    background: var(--surface);
    box-shadow: 0 6px 12px -10px rgba(20, 20, 15, 0.35);
  }
  .detail-bar { flex-wrap: wrap; gap: 8px; align-items: center; }
  .detail-bar-actions { flex-wrap: wrap; margin-left: auto; justify-content: flex-end; }
  .detail-head { flex-direction: column; align-items: stretch; gap: 14px; }
  .detail-video { flex: 0 0 auto; width: 100%; max-width: 420px; }
  .transpose { align-self: flex-start; }
  .detail-foot { flex-direction: column; align-items: flex-start; gap: 8px; }
  .kbd-hint { display: none; }

  /* New/Edit modals fill the screen on mobile. */
  .modal-new, .modal-edit { width: 100%; max-width: none; height: 100%; border-radius: 0; display: flex; flex-direction: column; }
  .modal-new .modal-fields, .modal-edit .modal-fields { flex: 1; overflow-y: auto; }
}
