/* Kawan Worship Chords — Ang Kawan ng Panginoon
   Layout: the church's forest green carries the shell (header band, buttons, labels);
   the chart stays on clean paper with chords in warm gold so they read at a glance on stage. */
:root {
  --bg: #f2f5f1;
  --surface: #ffffff;
  --surface-2: #f4f7f3;
  --ink: #12261a;
  --muted: #536357;
  --line: #d6e0d7;
  --brand: #0d3416;          /* logo green */
  --brand-ink: #fdf2dd;      /* logo cream */
  --brand-deep: #08260f;
  --lime: #a2bb53;           /* logo accent ("CHORDS" pill) */
  --accent: #1d5a2c;
  --accent-ink: #ffffff;
  --accent-soft: #e6f0e2;
  --chord: #9a5300;          /* warm gold-brown, 5:1 on white */
  --label: #1d5a2c;
  --danger: #b42318;
  --ok: #157f3c;
  --shadow: 0 1px 2px rgba(14, 40, 22, .06), 0 6px 20px rgba(14, 40, 22, .07);

  --font-brand: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-display: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --chart-size: 19px;
  --radius: 12px;
  --topbar-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1610; --surface: #122019; --surface-2: #182a20; --ink: #e6efe8; --muted: #9db0a2;
    --line: #23382b; --brand: #0a2a12; --brand-ink: #fdf2dd; --brand-deep: #061c0b; --lime: #a2bb53;
    --accent: #a2bb53; --accent-ink: #0b1610; --accent-soft: #173a25;
    --chord: #f2c14e; --label: #a2bb53; --danger: #ff8a80; --ok: #6fd69a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1610; --surface: #122019; --surface-2: #182a20; --ink: #e6efe8; --muted: #9db0a2;
  --line: #23382b; --brand: #0a2a12; --brand-ink: #fdf2dd; --brand-deep: #061c0b; --lime: #a2bb53;
  --accent: #a2bb53; --accent-ink: #0b1610; --accent-soft: #173a25;
  --chord: #f2c14e; --label: #a2bb53; --danger: #ff8a80; --ok: #6fd69a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 var(--font-body);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--brand);
}
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--brand); color: var(--brand-ink);
  border-bottom: 2px solid var(--lime);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: 16px;
  min-height: calc(var(--topbar-h) - 2px); padding-block: 6px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--brand-ink); min-width: 0; }
.brand-logo {
  width: 40px; height: 40px; border-radius: 20%; flex: none;
  box-shadow: 0 0 0 1px rgba(162, 187, 83, .55);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; min-width: 0; }
.brand-church { font: 700 9.5px/1.2 var(--font-brand); letter-spacing: .14em; text-transform: uppercase; color: var(--lime); white-space: nowrap; }
.brand-name { font: 800 18px/1.15 var(--font-brand); letter-spacing: -.01em; }
.mainnav { display: flex; gap: 4px; }
.mainnav a {
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; color: rgba(253, 242, 221, .78); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 15px;
}
.mainnav a svg { opacity: .85; }
.mainnav a:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.mainnav a.active { color: var(--brand); background: var(--lime); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.topbar .icon-btn, .topbar .btn {
  background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .35); color: #fff;
}
.topbar .icon-btn:hover, .topbar .btn:hover { background: rgba(255, 255, 255, .18); border-color: #fff; }
.topbar :focus-visible { outline-color: #fff; }

/* Phone menu (hidden on larger screens) */
.topbar .menu-btn { display: none; }
.mobile-menu {
  position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); color: var(--ink);
  border-bottom: 1px solid var(--line); box-shadow: 0 12px 28px rgba(14, 40, 22, .18);
  padding: 8px max(12px, env(safe-area-inset-right, 0px)) 12px max(12px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 2px;
}
.mobile-menu nav { display: flex; flex-direction: column; gap: 2px; }
.mm-item {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 0 14px;
  border: 0; border-radius: 10px; background: none; color: var(--ink);
  font: 700 17px/1.2 var(--font-body); text-decoration: none; text-align: left; cursor: pointer;
}
.mm-item svg { color: var(--muted); flex: none; }
.mm-item:hover { background: var(--surface-2); }
.mm-item.active { background: var(--accent-soft); color: var(--accent); }
.mm-item.active svg { color: var(--accent); }
.mm-item > span:first-of-type { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mm-item small.role { font-size: 11px; }
.mm-hint { font-weight: 400; font-size: 13px; color: var(--muted); }
.mm-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.mm-switch { width: 44px; height: 26px; border-radius: 13px; background: var(--line); position: relative; flex: none; transition: background .15s; }
.mm-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
[aria-checked="true"] .mm-switch { background: var(--accent); }
[aria-checked="true"] .mm-switch::after { transform: translateX(18px); }
.topbar-inner { position: relative; }
body.menu-open::after { content: ""; position: fixed; inset: 0; z-index: 19; background: rgba(8, 20, 12, .4); }

/* Offline / sync status bar under the header */
.netstatus {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h)); z-index: 18;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  font-size: 14px; font-weight: 700; text-align: center;
  background: var(--accent-soft); color: var(--ink); border-bottom: 1px solid var(--line);
}
.netstatus[data-tone="offline"] { background: #fff4d6; color: #5c3b00; border-color: #f0d48a; }
:root[data-theme="dark"] .netstatus[data-tone="offline"] { background: #3a2c0b; color: #f6dc9c; border-color: #5a4613; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.row-left { display: flex; gap: 8px; flex-wrap: wrap; }
.pending { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.mm-install { display: none; }
body.can-install .mm-install { display: flex; }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  display: inline-grid; place-items: center; cursor: pointer; color: var(--ink);
}
.icon-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink);
}
.textarea { font-family: var(--font-mono); font-size: 14px; line-height: 1.6; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* ---------- Page shell ---------- */
.app {
  max-width: 1100px; margin: 0 auto;
  padding-block: 14px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  outline: none;
}
.loading, .empty { color: var(--muted); }
.page-head { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { font-size: clamp(28px, 5vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.page-head .spacer { flex: 1; }
.page-head.compact { align-items: center; margin-bottom: 12px; gap: 10px; }
.page-head.compact h1 { font-size: clamp(24px, 4vw, 30px); }
.page-head.compact .sub:not(:empty) {
  margin: 0; font: 700 13px/1 var(--font-body); color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 9px; font-variant-numeric: tabular-nums;
}

/* Icon buttons with labels that appear on wider screens */
.btn svg { flex: none; }
.btn-icon .bl { display: none; }
@media (min-width: 900px) { .btn-icon .bl { display: inline; } }
.btn-icon:has(.bl) { min-width: 36px; padding: 0 9px; }
.btn-sm { border-radius: 9px; }

/* Bar above a page: Back on the left, actions on the right */
.pagebar { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; min-height: 36px; }
.pagebar .actions { margin-left: auto; display: flex; gap: 6px; }
.backbtn {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 12px 0 6px; margin-left: -6px;
  border: 0; border-radius: 999px; background: none; color: var(--accent); font-weight: 700; font-size: 15px; cursor: pointer;
  max-width: 60vw; min-width: 0;
}
.backbtn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backbtn:hover { background: var(--accent-soft); }
.setpos { white-space: nowrap; flex: none; font: 700 13px/1 var(--font-body); color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); padding: 5px 9px; border-radius: 999px; font-variant-numeric: tabular-nums; }

/* ---------- Song library ---------- */
.searchrow { display: flex; gap: 8px; margin-bottom: 12px; }
.searchbar { position: relative; flex: 1; min-width: 0; }
.searchbar svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbar input {
  width: 100%; height: 46px; padding: 0 14px 0 40px; font-size: 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
}
.filter-btn { width: 46px; height: 46px; border-radius: 12px; position: relative; color: var(--muted); }
.filter-btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.filter-btn .badge {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--accent); color: var(--accent-ink); font: 700 11px/18px var(--font-body); text-align: center;
}
.searchbar input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.filterbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tagrow { display: flex; flex-wrap: wrap; gap: 6px; }
.filter-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg-sm button { min-height: 30px; font-size: 13px; }
.seg-ctl button[disabled] { opacity: .45; cursor: default; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; }
.chip .chip-n { font-weight: 400; font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.chip .tick { font-size: 12px; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 3px 11px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.letter { font: 800 12px/1 var(--font-display); color: var(--muted); letter-spacing: .1em; padding: 14px 6px 6px; }
.songlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.songlist li + li { border-top: 1px solid var(--line); }
.songrow {
  display: flex; gap: 10px; align-items: center;
  padding: 9px 10px 9px 14px; min-height: 52px; text-decoration: none; color: var(--ink);
}
.songrow:hover { background: var(--surface-2); }
.songrow .t { font-weight: 700; font-size: 16px; min-width: 0; overflow-wrap: anywhere; line-height: 1.3; }
.songrow .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.songrow .a { color: var(--muted); font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.songrow .meta { flex: none; display: flex; gap: 6px; align-items: center; }
.chev { color: var(--line); display: inline-grid; }
.songrow:hover .chev, .card:hover .chev { color: var(--muted); }
.keybadge {
  display: inline-grid; place-items: center; min-width: 32px; height: 24px; padding: 0 7px;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent); font: 700 13px/1 var(--font-body);
}
.yt-dot { display: inline-grid; color: #c4302b; opacity: .8; }
.count { color: var(--muted); font-size: 14px; }

/* ---------- Song view ---------- */
.song-head { margin-bottom: 8px; }
.song-head h1 { font-size: clamp(24px, 4.5vw, 36px); font-weight: 800; letter-spacing: -.02em; }
.song-head .artist { color: var(--muted); margin: 2px 0 0; font-size: 15px; }
.facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.facts > li:not(.edited) { display: inline-flex; }
.facts > li:not(.edited):not(:has(.tag)) { gap: 4px; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.facts .fact-key { background: var(--accent-soft) !important; border-color: transparent !important; color: var(--accent); }
.facts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.facts .fact-key b { color: var(--accent); }
.facts .edited { flex-basis: 100%; font-size: 12px; margin-top: 2px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { display: inline-flex; align-items: center; height: 24px; font-size: 13px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 0 9px; text-decoration: none; }
.tag:hover { color: var(--accent); border-color: var(--accent); }
.tag.yt-find { gap: 4px; color: #b3261e; border-color: rgba(179, 38, 30, .3); background: transparent; }
.tag.yt-find:hover { color: #b3261e; border-color: #b3261e; }
.field-link { float: right; text-transform: none; letter-spacing: 0; font-weight: 700; }

.toolbar {
  position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--topbar-h) + 8px); z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 8px 10px; margin: 0 0 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.tgroup { display: flex; align-items: center; gap: 6px; }
.tgroup > .lbl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.tgroup .select { width: auto; min-height: 36px; padding: 4px 8px; font-weight: 700; }
.seg-ctl { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg-ctl button { border: 0; background: var(--surface); padding: 0 10px; min-height: 34px; cursor: pointer; font-weight: 700; color: var(--muted); }
.seg-ctl button + button { border-left: 1px solid var(--line); }
.seg-ctl button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.step { width: 34px; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; font-weight: 700; display: inline-grid; place-items: center; color: var(--ink); }
.step[disabled] { opacity: .35; cursor: default; }
.step-rm:hover { color: var(--danger); border-color: var(--danger); }
.capo-note { font-size: 14px; color: var(--chord); font-weight: 700; }
.toolbar .push { margin-left: auto; }
/* Desktop: the two toolbar sections flow as one row */
.tb-main, .tb-more { display: contents; }
.tb-morebtn, .tb-mobile-lbl, .tb-copy, .tb-stage-text { display: none; }
.tb-key { order: 1; } .tb-capo { order: 2; } .tb-mode { order: 3; } .tb-size { order: 4; } .tb-chsize { order: 5; } .tb-cols { order: 6; }
.size-val { min-width: 3.2em; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.tb-stage { order: 12; margin-left: auto; } .tb-savekey { order: 1; }
.tb-capo .select { max-width: 110px; }
.tb-key .select { width: 66px; }
/* Desktop: when the "Save key" button shows, drop the small KEY / CAPO labels to keep one row */
.toolbar:has(.tb-savekey:not([hidden])) .tgroup > .lbl:not(.tb-mobile-lbl) { display: none; }

.song-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.song-body.no-side { grid-template-columns: minmax(0, 1fr); }
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel { min-width: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel h2 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.panel p { margin: 0; white-space: pre-wrap; }
.yt-frame { position: relative; width: 100%; max-width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: #000; }
.yt-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-thumb { display: block; position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; max-width: 100%; background: var(--surface-2); cursor: pointer; border: 0; padding: 0; width: 100%; }
.yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-thumb .play { position: absolute; inset: 0; display: grid; place-items: center; }
.yt-thumb .play span { width: 56px; height: 40px; border-radius: 10px; background: rgba(200, 0, 0, .9); display: grid; place-items: center; }

/* The chart */
.chart { font-size: var(--chart-size); line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.chart .ln { display: flex; flex-wrap: wrap; align-items: flex-end; margin: 0 0 .35em; }
.chart .sg { display: inline-flex; flex-direction: column; white-space: pre-wrap; min-width: 0; max-width: 100%; }
.chart .ch {
  color: var(--chord); font-weight: 700; min-height: 1.25em; padding-right: .45em;
  font-size: calc(var(--chord-scale, 1) * 1em);
  font-variant-numeric: tabular-nums;
}
.chart .ly { min-height: 1.25em; }
.chart .ln.chords-only .sg { margin-right: .6em; }
.chart .ln.chords-only .ly { display: none; }
.chart .ln.lyrics-only .ch { display: none; }
.chart .lbl {
  font: 700 .72em/1 var(--font-body); letter-spacing: .1em; text-transform: uppercase; color: var(--label);
  margin: 1.1em 0 .5em;
}
.chart .lbl:first-child { margin-top: 0; }
.chart .blank { height: .8em; }
.chart .section { border-left: 3px solid var(--label); padding-left: .8em; margin: .4em 0 .9em; }
.chart.hide-chords .ch { display: none; }
.chart.hide-chords .ln.chords-only { display: none; }
.chart .empty-chart { color: var(--muted); font-size: 16px; }
/* Two-column chart: lines and sections never split across columns */
.chart.cols-2 { column-count: 2; column-gap: 2em; column-rule: 1px solid var(--line); }
.chart.cols-2 .ln, .chart.cols-2 .section { break-inside: avoid; }
.chart.cols-2 .lbl { break-after: avoid; }
.chart.cols-2 .lbl:first-child { margin-top: 0; }
/* Setlist swipe: quick slide-out as the next / previous song loads */
.chart.swipe-next { transform: translateX(-24px); opacity: .4; transition: transform .15s ease-out, opacity .15s ease-out; }
.chart.swipe-prev { transform: translateX(24px); opacity: .4; transition: transform .15s ease-out, opacity .15s ease-out; }
@media (prefers-reduced-motion: reduce) { .chart.swipe-next, .chart.swipe-prev { transform: none; } }

.setnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.setnav a { flex: 1 1 200px; min-width: 0; }
.setnav .next { text-align: right; justify-content: flex-end; }
.setnav .btn { min-height: 46px; }
.setnav .sn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.setnav .sk { font-size: 12px; opacity: .8; border: 1px solid currentColor; border-radius: 5px; padding: 0 5px; }
.setbanner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
.setbanner a { font-weight: 700; }

/* Stage mode: chart only, large, keep screen awake */
body.stage .topbar, body.stage .pagebar, body.stage .side, body.stage .facts, body.stage .tags, body.stage .setbanner { display: none; }
body.stage .song-body { grid-template-columns: minmax(0, 1fr); }
body.stage .toolbar { top: env(safe-area-inset-top, 0px); }
body.stage .app { max-width: none; }

/* ---------- Editor ---------- */
.editor-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.editor-grid .span2 { grid-column: span 2; }
.editor-grid .span4 { grid-column: 1 / -1; }
.editor-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.editor-split .textarea { min-height: 520px; }
.preview { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; max-height: 620px; overflow: auto; }
.preview .chart { --chart-size: 16px; }
.hint { font-size: 14px; color: var(--muted); margin: 6px 0 0; }
.hint code, .help code { font-family: var(--font-mono); font-size: 13px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.editor-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; align-items: center; }
.formbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 20px; align-items: center; }
.formbar .push { margin-left: auto; }
.err { color: var(--danger); font-weight: 700; margin: 8px 0 0; }

/* ---------- Setlists ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 10px 12px; text-decoration: none; color: var(--ink);
}
.card:hover { border-color: var(--muted); }
.card-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.card-tx { display: flex; flex-direction: column; min-width: 0; }
.card .d { font-size: 12px; font-weight: 700; color: var(--muted); }
.card .n { font: 700 16px/1.25 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .count { font-size: 13px; white-space: nowrap; }
.setdate { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; color: var(--accent); font-weight: 700; font-size: 14px; }
.setitems { list-style: none; padding: 0; margin: 0; counter-reset: s; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.setitems li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 12px; min-height: 54px; }
.setitems li + li { border-top: 1px solid var(--line); }
.setitems .num { counter-increment: s; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 800 13px/1 var(--font-display); }
.setitems .num::before { content: counter(s); }
.setitems .info { min-width: 0; }
.setitems .info a { font-weight: 700; font-size: 16px; color: var(--ink); text-decoration: none; }
.setitems .info a:hover { text-decoration: underline; }
.setitems .info .a { color: var(--muted); font-size: 14px; }
.setitems .ctl { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: end; }
.setitems .ctl .select { width: auto; min-height: 32px; padding: 2px 6px; }
.missing { color: var(--danger); }

/* ---------- People & account ---------- */
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-bottom: 18px; }
.roles .panel p { color: var(--muted); }
.role { display: inline-block; font: 700 12px/1 var(--font-body); letter-spacing: .06em; text-transform: uppercase; padding: 5px 8px; border-radius: 6px; }
.role-editor { background: var(--accent-soft); color: var(--accent); }
.role-admin { background: var(--accent); color: var(--accent-ink); }
.userlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.userlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 16px; }
.userlist li + li { border-top: 1px solid var(--line); }
.userlist .n { font-weight: 700; font-size: 17px; }
.userlist .a { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.userlist li.inactive .n, .userlist li.inactive .role { opacity: .5; }
.panel.narrow { max-width: 460px; display: flex; flex-direction: column; gap: 12px; }
.pw-row { display: flex; gap: 6px; }
.pw-row .input { flex: 1; min-width: 0; font-family: var(--font-mono); }
.check { display: flex; gap: 8px; align-items: center; font-size: 15px; }
.check input { width: 18px; height: 18px; }

/* ---------- Dialog & toast ---------- */
.dialog {
  border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--surface); color: var(--ink);
  width: min(520px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.dialog::backdrop { background: rgba(10, 16, 30, .5); }
.dialog form { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog h2 { font-size: 22px; }
.dialog p { margin: 0; color: var(--muted); }
.dialog .row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.pick-list button { width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.pick-list li + li { border-top: 1px solid var(--line); }
.pick-list button:hover { background: var(--surface-2); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 50;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 700;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}
.help { font-size: 15px; }
.help pre { font-family: var(--font-mono); font-size: 13px; background: var(--surface-2); padding: 10px; border-radius: 8px; overflow-x: auto; margin: 6px 0 0; }
.footer { margin-top: 40px; color: var(--muted); font-size: 14px; display: flex; gap: 8px 16px; flex-wrap: wrap; align-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .brand-church { display: none; }
  .song-body { grid-template-columns: minmax(0, 1fr); }
  .side { order: 2; }
  .editor-split { grid-template-columns: minmax(0, 1fr); }
  .editor-split .textarea { min-height: 360px; }
  .editor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .wide-only { display: none; }
  .topbar-inner { gap: 8px; }
  .mainnav a { padding: 6px 10px; }
  #authBtn { padding: 0 10px; }
  .tgroup > .lbl { display: none; }
  .setitems li:has(.step) { grid-template-columns: 26px minmax(0, 1fr); }
  .setitems li:has(.step) .ctl { grid-column: 2; justify-content: start; }
  .userlist li { grid-template-columns: minmax(0, 1fr) auto; }
  .userlist li .btn { grid-column: 1 / -1; justify-self: start; }
}
/* ---------- Phone: chart controls become a bottom bar ---------- */
@media (max-width: 640px) {
  .song-head h1 { font-size: clamp(24px, 7vw, 30px); }
  .facts { margin-bottom: 16px; }
  .song-body { gap: 20px; }
  .setnav { margin-bottom: 8px; }
}
/* Phones and tablets (and narrow laptop windows, where the full toolbar won't fit on one row):
   the main controls sit in a bar at the bottom, the rest open from the ☰ "More options" button. */
@media (max-width: 1099px) {
  body.has-bottombar .app { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

  .toolbar {
    position: fixed; top: auto; left: 0; right: 0; bottom: 0; z-index: 25;
    margin: 0; border-radius: 16px 16px 0 0; border-width: 1px 0 0;
    display: flex; flex-direction: column; gap: 0;
    padding: 8px max(12px, env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
    box-shadow: 0 -6px 24px rgba(14, 40, 22, .12);
  }
  .tb-main { display: flex; align-items: center; gap: 6px; width: 100%; min-width: 0; }
  .tb-main > *, .tb-more > * { order: 0; margin-left: 0; }
  .tb-more {
    display: none; order: -1; width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 12px;
    padding: 8px 0 14px; margin-bottom: 10px; border-bottom: 1px solid var(--line);
  }
  .toolbar.open .tb-more { display: grid; }
  .tb-more .tgroup { flex-direction: column; align-items: stretch; gap: 6px; min-width: 0; }
  .tb-more .tb-mode { grid-column: 1 / -1; }
  .tb-more .tb-mode .seg-ctl { display: flex; width: 100%; }
  .tb-more .seg-ctl button { flex: 1; min-height: 44px; font-size: 15px; }
  .tb-more .tb-size, .tb-more .tb-chsize { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 6px; }
  .tb-more .tb-size .tb-mobile-lbl, .tb-more .tb-chsize .tb-mobile-lbl { grid-column: 1 / -1; }
  .tb-more .tb-size .step, .tb-more .tb-chsize .step { width: auto; height: 44px; font-size: 16px; }
  .tb-more .tb-cols .seg-ctl { display: flex; width: 100%; }
  .tb-more .tb-stage, .tb-more .tb-copy { justify-content: flex-end; }
  .tb-more .tb-stage .icon-btn { width: 100%; height: 44px; display: flex; gap: 8px; justify-content: center; align-items: center; font-weight: 700; }
  .tb-more .tb-copy { display: flex; }
  .tb-more .tb-copy .btn { width: 100%; min-height: 44px; font-size: 15px; }
  .tb-more .tb-savekey { grid-column: 1 / -1; min-height: 44px; }
  .tgroup > .lbl { display: none; }
  .tgroup > .lbl.tb-mobile-lbl, .tb-mobile-lbl { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .tb-stage-text { display: inline; }
  .tb-morebtn { display: inline-grid; flex: none; }

  .tb-key { flex: 1 1 auto; gap: 4px; min-width: 0; }
  .tb-key .step { width: 40px; height: 44px; font-size: 20px; flex: none; }
  .tb-key .select { min-height: 44px; flex: 1 1 52px; min-width: 52px; width: 52px; padding: 4px 6px; font-size: 17px; }
  .tb-capo { flex: 0 1 104px; min-width: 0; }
  .tb-capo .select { min-height: 44px; width: 100%; padding: 4px 6px; font-size: 15px; }
  .capo-note { display: none; }
  .toolbar .icon-btn { width: 44px; height: 44px; }

  body.stage .toolbar { top: auto; }
}
@media (min-width: 641px) and (max-width: 1099px) {
  .toolbar { max-width: 640px; margin: 0 auto; border-width: 1px 1px 0; }
  .tb-key .select { flex: 0 1 110px; width: 110px; }
  .tb-capo { flex: 0 1 150px; }
  .tb-morebtn { margin-left: auto !important; }
}
/* ---------- Phone header: logo + name + menu button ---------- */
@media (max-width: 720px) {
  .topbar { position: sticky; }
  .topbar-inner { gap: 10px; }
  .mainnav, #themeBtn, #authBtn { display: none; }
  .topbar .menu-btn { display: inline-grid; width: 42px; height: 42px; border-color: transparent; background: none; }
  .brand { flex: 1; }
  .brand-logo { width: 36px; height: 36px; }
  .brand-text { display: flex; min-width: 0; }
  .brand-church { display: none; }
  .brand-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .toolbar.open, body.menu-open .toolbar { z-index: 15; }
}
@media (max-width: 340px) { .brand-name { font-size: 15px; } }
/* Small phones: keep the whole bottom bar on screen */
@media (max-width: 370px) {
  .tb-main { gap: 4px; }
  .tb-key .step { width: 34px; }
  .tb-key .select { flex-basis: 46px; min-width: 46px; width: 46px; padding: 4px 2px; }
  .tb-capo { flex: 1 1 76px; }
  .tb-capo .select { padding: 4px 2px; font-size: 14px; }
  .toolbar .icon-btn { width: 40px; }
  .toolbar { padding-left: 8px; padding-right: 8px; }
}
@media (min-width: 721px) { .mobile-menu { display: none !important; } }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
/* ---------- Print / Save as PDF ---------- */
.print-area { display: none; }
.pr-opts { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.pr-opts legend { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; padding: 0; }
.pr-opts .seg-ctl { align-self: flex-start; }
.pr-opts .seg-ctl button { min-height: 36px; padding: 0 14px; }

@page {
  size: auto;
  margin: 12mm 14mm 14mm;
  @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 9pt "Atkinson Hyperlegible", Arial, sans-serif; color: #6b766e; }
}
@media print {
  html, body { background: #fff !important; color: #111 !important; }
  body::before, body::after { display: none !important; }
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  .pr-doc { color: #111; font-family: "Atkinson Hyperlegible", Arial, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pr-doc.pr-size-small { --pr-chart: 10.5pt; }
  .pr-doc.pr-size-normal { --pr-chart: 12.5pt; }
  .pr-doc.pr-size-large { --pr-chart: 15pt; }

  .pr-page { width: 100%; border-collapse: collapse; break-before: page; }
  .pr-page.pr-first { break-before: auto; }
  .pr-page > thead > tr > td, .pr-page > tfoot > tr > td, .pr-page > tbody > tr > td { padding: 0; }
  .pr-header {
    display: flex; align-items: center; gap: 10pt;
    padding-bottom: 6pt; margin-bottom: 12pt; border-bottom: 2pt solid #0e5a2c;
  }
  .pr-logo { width: 34pt; height: 34pt; border-radius: 22%; }
  .pr-brand { flex: 1; }
  .pr-team { font: 800 15pt/1.1 "Plus Jakarta Sans", Arial, sans-serif; color: #0e5a2c; letter-spacing: -.01em; }
  .pr-church { font: 700 7.5pt/1.3 Arial, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: #5b6b60; }
  .pr-sub { text-align: right; font: 700 9.5pt/1.3 Arial, sans-serif; color: #333; max-width: 45%; }
  .pr-footer {
    position: fixed; left: 0; right: 0; bottom: 0;
    display: flex; justify-content: space-between; gap: 12pt;
    padding-top: 5pt; border-top: 0.75pt solid #b9c7bd; background: #fff;
    font: 8.5pt/1.2 Arial, sans-serif; color: #6b766e;
  }
  .pr-footer-space { height: 26pt; }
  .pr-dim { color: #6b766e; font-weight: 400; }

  .pr-title { font: 800 20pt/1.15 "Plus Jakarta Sans", Arial, sans-serif; margin: 0 0 2pt; color: #111; letter-spacing: -.01em; }
  .pr-num { color: #0e5a2c; }
  .pr-artist { margin: 0 0 4pt; font-size: 10.5pt; color: #444; }
  .pr-meta { margin: 0 0 8pt; font-size: 10.5pt; color: #222; }
  .pr-meta b { color: #0e5a2c; }
  .pr-notes { margin: 0 0 10pt; font-size: 9.5pt; padding: 5pt 8pt; background: #eef4ef; border-left: 2.5pt solid #0e5a2c; }

  .pr-chart { --chart-size: var(--pr-chart, 12.5pt); font-size: var(--pr-chart, 12.5pt); line-height: 1.2; overflow-wrap: normal; }
  .pr-chart.pr-cols-2 { column-count: 2; column-gap: 18pt; column-rule: 0.5pt solid #d5ddd7; }
  .pr-chart .ln { break-inside: avoid; margin-bottom: .3em; }
  .pr-chart .sg { white-space: pre; }
  .pr-chart .ch { color: #8a4a00 !important; font-weight: 800; }
  .pr-chart .lbl { color: #0e5a2c !important; break-after: avoid; margin-top: .9em; }
  .pr-chart .section { border-left-color: #0e5a2c; break-inside: avoid-column; }
  .pr-chart .blank { height: .6em; }
  .pr-chart.hide-chords .ch { display: none; }

  .pr-order { width: 100%; border-collapse: collapse; margin: 10pt 0 14pt; font-size: 12pt; }
  .pr-order th { text-align: left; font: 700 8.5pt Arial, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #5b6b60; border-bottom: 1pt solid #0e5a2c; padding: 4pt 6pt; }
  .pr-order td { padding: 7pt 6pt; border-bottom: 0.5pt solid #d5ddd7; vertical-align: top; }
  .pr-ln { width: 22pt; font-weight: 800; color: #0e5a2c; }
  .pr-lk { width: 50pt; font-weight: 800; color: #8a4a00; text-align: center; }
}
}

/* Install instructions (iPhone) */
.steps { margin: 8px 0 12px; padding-left: 22px; display: grid; gap: 8px; line-height: 1.45; }
.steps li::marker { color: var(--accent); font-weight: 700; }

/* Setlists: church filter, visibility + church badges, church manager */
.churchbar { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.churchbar::-webkit-scrollbar { display: none; }
.churchbar .chip { flex: none; }
.card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.vis { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
.vis-private { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.setdate { flex-wrap: wrap; }
.setdate .vis { margin-left: 4px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row .field { min-width: 0; }
@media (max-width: 420px) { .field-row { grid-template-columns: 1fr; } }
.inline-add { display: flex; gap: 8px; margin-top: 6px; }
.inline-add .input { flex: 1; min-width: 0; }
.vis-ctl { display: flex; width: 100%; }
.vis-ctl button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; }
.church-list { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; max-height: 50vh; overflow: auto; }
.church-list li[data-row] { display: flex; gap: 6px; align-items: center; }
.church-list li[data-row] .input { flex: 1; min-width: 0; min-height: 38px; }
.church-list li[data-row] .count { flex: none; width: 64px; text-align: right; font-size: 12px; white-space: nowrap; }
.church-confirm { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); font-size: 14px; }
.church-confirm span { flex: 1 1 100%; }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Backup panel (admins) */
.backup-opt { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.backup-opt > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.backup-opt .sub { font-size: 14px; margin: 0; }
.backup-opt .btn { flex: none; }
.backup-panel details { margin-top: 8px; }
.backup-panel summary { cursor: pointer; font-weight: 700; }
.backup-panel code { word-break: break-all; }

/* Update available / What's new */
.cl-dialog { max-width: 560px; }
.cl-eyebrow { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 6px; font: 800 12px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.cl-dialog h2 { margin-top: 0; }
.cl-scroll { max-height: 46vh; overflow: auto; margin: 12px 0 4px; padding-right: 4px; }
.cl-entry + .cl-entry { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.cl-entry h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 8px; font: 800 16px/1.3 var(--font-display); }
.cl-ver { font: 400 13px/1.3 var(--font-body); color: var(--muted); }
.cl-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cl-list li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; line-height: 1.45; }
.cl-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font: 800 11px/1 var(--font-display); letter-spacing: .04em; text-transform: uppercase; margin-top: 1px; white-space: nowrap; }
.cl-new { background: var(--accent); color: var(--accent-ink); }
.cl-improved { background: var(--accent-soft); color: var(--accent); }
.cl-fixed { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }

/* Links inside band notes / setlist notes */
.notes-text { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.notes-text a { color: var(--accent); font-weight: 700; text-decoration: underline; overflow-wrap: anywhere; }

/* ---------- Other versions (extra reference links) ---------- */
.ref-open { margin-top: 8px; }
.ref-sub { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
.ref-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ref-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; font-size: 14px; text-align: left; text-decoration: none; cursor: pointer; }
.ref-item > span:not(.ref-arrow) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ref-item svg { flex: none; color: var(--accent); }
.ref-item:hover { border-color: var(--accent); }
.ref-item[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.ref-item[aria-current="true"] svg { color: var(--accent-ink); }
.ref-arrow { flex: none; color: var(--muted); }
.field-hint { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--muted); }
.link-rows { display: flex; flex-direction: column; gap: 8px; }
.link-rows:empty { display: none; }
.link-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) auto; gap: 8px; align-items: center; }
.link-add { align-self: flex-start; margin-top: 2px; }
@media (max-width: 640px) {
  .link-row { grid-template-columns: minmax(0, 1fr) auto; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
  .link-row [data-l="url"] { grid-column: 1 / -1; grid-row: 2; }
  .link-row .step-rm { grid-column: 2; grid-row: 1; }
}
