:root {
  --bg: #F1F0EC; --surface: #FFFFFF; --sunk: #E7E5DF; --ink: #1E1B18; --muted: #676767; --line: #D8D4CC;
  --accent: #F57C14; --accent-ink: #9A4204; --accent-soft: #FDE3CC; --danger: #B3261E; --ok: #2E7D32;
  --f-display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --f-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 10px;
  /* Plot colours, one per kind of player */
  --k-vocal: #C26A1E; --k-acoustic: #3A7D3A; --k-electric: #9B2C2C; --k-bass: #2F5597;
  --k-horn: #6B4BA3; --k-drums: #6B6B6B; --k-keys: #1F7A7A; --k-other: #8A7A5A;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #151310; --surface: #201C18; --sunk: #2A2520; --ink: #F0EBE3; --muted: #A3A3A3; --line: #3B342D;
  --accent: #FF9433; --accent-ink: #FFBD85; --accent-soft: #422712; --danger: #F2827A; --ok: #7BC67E;
  --k-vocal: #E59248; --k-acoustic: #6DBB6D; --k-electric: #E06A6A; --k-bass: #6E98E0;
  --k-horn: #A88BE0; --k-drums: #A5A5A5; --k-keys: #4FC1C1; --k-other: #C2B08A;
} }
:root[data-theme="dark"] {
  --bg: #151310; --surface: #201C18; --sunk: #2A2520; --ink: #F0EBE3; --muted: #A3A3A3; --line: #3B342D;
  --accent: #FF9433; --accent-ink: #FFBD85; --accent-soft: #422712; --danger: #F2827A; --ok: #7BC67E;
  --k-vocal: #E59248; --k-acoustic: #6DBB6D; --k-electric: #E06A6A; --k-bass: #6E98E0;
  --k-horn: #A88BE0; --k-drums: #A5A5A5; --k-keys: #4FC1C1; --k-other: #C2B08A;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 var(--f-body); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 800; letter-spacing: .01em; margin: 0; line-height: 1.05; }
h2 { font-size: 30px; }
h3 { font-size: 22px; }
.cap { color: var(--muted); font-size: 15px; margin: 4px 0 0; }
[hidden] { display: none !important; }
body:not(.editing) .edit-only { display: none !important; }
html[data-mode="band"] .editor-only { display: none !important; }
.band-sees { display: block; font-size: 13px; color: var(--ok); font-weight: 700; margin-top: 2px; }
.band-sees.warn { color: var(--muted); font-weight: 400; }
.banner.warn-banner { background: color-mix(in srgb, var(--danger) 14%, var(--bg)); }
.band-foot { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 40px; }
.band-foot a { color: var(--accent-ink); }
.print-only { display: none; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: var(--bg); border-bottom: 1px solid var(--line);
  padding: max(10px, env(safe-area-inset-top)) 16px 0; }
.top-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; max-width: 980px; margin: 0 auto; }
.brand h1 { font-size: 30px; text-transform: uppercase; }
.show-btn { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; border: 0; background: none; padding: 2px 0 0;
  cursor: pointer; color: var(--accent-ink); font-weight: 700; text-align: left; }
.show-date { color: var(--muted); font-weight: 400; font-size: 15px; }
.chev { font-size: 13px; }
.icon-btn { border: 0; background: none; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  cursor: pointer; color: var(--muted); flex: none; font-size: 18px; }
.icon-btn:hover { background: var(--sunk); }
.icon-btn.alert { color: var(--danger); }
.tabs { display: flex; gap: 2px; overflow-x: auto; max-width: 980px; margin: 8px auto 0; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 12px 11px; cursor: pointer; white-space: nowrap; color: var(--muted);
  font-weight: 700; border-bottom: 3px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

main { margin: 0 auto; padding: 18px 16px 80px; }
.panel { max-width: 948px; margin: 0 auto; }
/* The setlist lines up with the other tabs' left edge, and is centred only when 3+ sets make it wider than them */
#panel-set:not(.wide) { margin-left: max(0px, calc((100% - 948px) / 2)); }
.setcols { display: grid; gap: 14px; align-items: start; margin-bottom: 12px; grid-template-columns: minmax(0, 620px); }
.setcols.multi { grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.head-btns, .row-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row-btns.spread { justify-content: space-between; margin-top: 18px; }
.hint { color: var(--muted); font-size: 15px; margin: 0 0 8px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 700; font-size: 15px;
  text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1E1B18; }
.btn.danger { color: var(--danger); }
.btn.armed { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }

/* Setlist */
.setlist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.setlist li { display: flex; align-items: center; gap: 10px; padding: 0 8px 0 12px; border-top: 1px solid var(--line); background: var(--surface); min-height: 58px; }
.setlist li:first-child { border-top: 0; }
.setlist li.dragging { position: relative; z-index: 5; box-shadow: 0 6px 24px rgba(0,0,0,.25); border-radius: 8px; border: 1px solid var(--line); }
.setcols:has(.dragging) .setlist { overflow: visible; }
.setlist li.break-row { min-height: 44px; background: var(--sunk); border-top: 2px dashed var(--line); border-bottom: 2px dashed var(--line); }
.setlist li.break-row + li { border-top: 0; }
.break-label { flex: 1; text-align: center; font-family: var(--f-display); font-weight: 800; font-size: 20px; letter-spacing: .25em;
  text-transform: uppercase; color: var(--muted); }
body.editing .break-label { padding-left: 76px; }
.setlist li.note-row { min-height: 44px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); box-shadow: inset 4px 0 0 var(--accent); padding-left: 16px; }
.note-text { flex: 1; font-style: italic; font-weight: 700; color: var(--accent-ink); padding: 10px 0 10px 32px; }
.note-input { flex: 1; min-width: 0; min-height: 36px; border: 1px dashed var(--line); border-radius: 6px; padding: 4px 8px; margin-left: 32px;
  background: transparent; font-style: italic; font-weight: 700; color: var(--accent-ink); }
.note-input:focus { border-style: solid; outline: none; border-color: var(--accent); background: var(--surface); }
.num { font-family: var(--f-display); font-size: 24px; width: 30px; text-align: right; color: var(--accent-ink); flex: none; }
.song-btn { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 8px 0; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.song-txt { flex: 1; min-width: 0; }
.song-title { font-weight: 700; display: block; }
.song-artist { color: var(--muted); font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { flex: none; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; border: 1.5px solid var(--kc, var(--line));
  color: var(--kc, var(--muted)); background: color-mix(in srgb, var(--kc, transparent) 10%, var(--surface)); white-space: nowrap; }
.chip.none { --kc: var(--line); color: var(--muted); font-weight: 400; }
.chip.out { --kc: var(--line); color: var(--muted); background: var(--surface); opacity: .6; }
.keytag { flex: none; font-size: 14px; font-weight: 700; color: var(--muted); min-width: 24px; text-align: center; }
.grip { flex: none; width: 40px; height: 44px; border: 0; background: none; cursor: grab; color: var(--muted); font-size: 20px; touch-action: none; }
.rm { flex: none; width: 36px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 50%; font-size: 16px; }
.rm:hover { background: var(--sunk); color: var(--danger); }
.empty { color: var(--muted); }
.lib-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 8px 0 10px; }
.search { width: 100%; min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); margin-bottom: 10px; }
.library { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.library li { display: flex; align-items: center; gap: 6px; padding: 0 6px 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); min-height: 56px; }
.library li.inset { opacity: .55; }
.add { flex: none; min-width: 64px; }

/* Metronome */
.top-icons { display: flex; gap: 2px; flex: none; }
#panel-met { max-width: 620px; margin: 0 auto; }
.icon-btn.on { color: var(--accent-ink); background: var(--accent-soft); }
.met-box { background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 12px 12px 18px; text-align: center; }
.met-box.flash { animation: met-flash .18s ease-out; }
.met-box.flash1 { animation: met-flash1 .22s ease-out; }
@keyframes met-flash { from { background: var(--accent-soft); border-color: var(--accent); } }
@keyframes met-flash1 { from { background: var(--accent); border-color: var(--accent); color: #1E1B18; } }
.met-song { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.met-song-name { flex: 1; min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.met-song-name.none { color: var(--muted); font-weight: 400; }
.met-step { flex: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--bg); cursor: pointer; font-size: 26px; line-height: 1; }
.met-step:disabled { opacity: .35; cursor: default; }
.met-bpm { font-family: var(--f-display); font-weight: 800; font-size: 120px; line-height: 1; margin: 6px 0 4px; font-variant-numeric: tabular-nums; }
.met-bpm small { font-size: 26px; margin-left: 8px; letter-spacing: .05em; color: var(--muted); }
.met-box.flash1 .met-bpm small { color: inherit; }
.met-dots { display: flex; justify-content: center; gap: 14px; min-height: 22px; }
.met-dots i { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); background: var(--bg); }
.met-dots i:first-child { border-color: var(--accent); }
.met-dots i.on { background: var(--accent); border-color: var(--accent); }
.met-tempo { display: flex; align-items: center; gap: 10px; margin: 16px 0 12px; }
.met-tempo input { flex: 1; min-width: 0; accent-color: var(--accent); height: 44px; }
.met-pm { width: 52px; padding: 0; font-size: 24px; }
.met-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.met-row .seg button { padding: 8px 14px; }
.met-start { margin-left: auto; min-width: 110px; font-size: 18px; }
.met-start.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.met-list-h { margin: 26px 0 0; }
#met-list { margin-top: 10px; grid-template-columns: minmax(0, 620px); }
#met-list.multi { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.met-songs li { min-height: 52px; }
.met-songs li.cur { box-shadow: inset 4px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.bpm-input { flex: none; width: 76px; min-height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: var(--bg); text-align: right; font-weight: 700; }
.bpm-row { display: flex; gap: 8px; align-items: stretch; }
.sheet .bpm-row input { flex: 1; min-width: 0; }
.bpm-row .btn { flex: none; margin-top: 4px; min-width: 120px; }
.btn.tapped { animation: tap-flash .15s ease-out; }
@keyframes tap-flash { from { background: var(--accent); border-color: var(--accent); color: #1E1B18; } }
.bpm-input::placeholder { color: var(--muted); font-weight: 400; opacity: .7; }
.bpm-tag { flex: none; font-family: var(--f-display); font-weight: 800; font-size: 24px; min-width: 52px; text-align: right; padding-right: 6px; color: var(--accent-ink); }
.bpm-tag.none { color: var(--muted); font-weight: 700; }
@media (max-width: 560px) {
  .met-bpm { font-size: 96px; }
  .met-row .seg button { padding: 8px 12px; }
  .met-start { flex: 1 0 100%; margin-left: 0; }
  #panel-met .panel-head .seg { width: 100%; }
  #panel-met .panel-head .seg button { flex: 1; }
}
/* Phones on their side: the big tempo on the left, every control on the right, all on one screen (song list below) */
@media (orientation: landscape) and (max-height: 520px) {
  body:has(#panel-met:not([hidden])) main { padding-top: 10px; }
  body:has(#panel-met:not([hidden])) .band-sees { display: none; }
  #panel-met { max-width: 860px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: 10px;
    grid-template-areas: "box tempo tempo" "box beats tap" "box mode start"; align-items: center; }
  #panel-met .panel-head, #panel-met .met-row { display: contents; }
  #panel-met .panel-head > div:first-child { display: none; }
  .met-box { grid-area: box; align-self: stretch; display: flex; flex-direction: column; justify-content: center; padding: 8px 10px 12px; margin-right: 6px; }
  .met-bpm { font-size: 92px; margin: 2px 0; }
  .met-tempo { grid-area: tempo; margin: 0; }
  #met-beats { grid-area: beats; }
  #met-tap { grid-area: tap; }
  #met-mode { grid-area: mode; }
  #met-start { grid-area: start; margin: 0; }
  #met-beats, #met-mode { display: flex; width: 100%; }
  #met-beats button, #met-mode button { flex: 1; padding: 8px 6px; min-height: 44px; white-space: nowrap; }
  #met-tap, #met-start { width: 100%; min-width: 110px; }
  #panel-met > :not(.panel-head):not(.met-box):not(.met-tempo):not(.met-row) { grid-column: 1 / -1; }
  .met-list-h { margin-top: 16px; }
}

/* Stage plot: drawn on a fixed shape that scales with its width */
.plot-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px 8px; }
.plot { min-width: 0; page: plot; container-type: inline-size; background: var(--surface); border: 2px solid var(--ink); border-radius: 4px; padding: 2.4cqw 3cqw 3cqw; }
.plot-title { text-align: center; }
.plot-h { font-size: 3.4cqw; text-transform: uppercase; }
.plot-sub { color: var(--muted); font-size: 1.8cqw; margin: .6cqw 0 1.4cqw; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: .6cqw 2cqw; font-size: 1.6cqw; margin-bottom: 1.6cqw; }
.legend span { display: inline-flex; align-items: center; gap: .6cqw; }
.legend i { width: 1.6cqw; height: 1.6cqw; border: 2px solid var(--kc); border-radius: 3px; background: color-mix(in srgb, var(--kc) 10%, var(--surface)); }
.stage { position: relative; aspect-ratio: 10 / 6.8; border: 3px solid var(--ink); border-radius: 1.2cqw; background: var(--bg); }
.stage-label { position: absolute; left: 50%; transform: translateX(-50%); font-weight: 700; letter-spacing: .3em; text-transform: uppercase;
  font-size: 1.5cqw; color: var(--muted); white-space: nowrap; background: var(--bg); padding: 0 1.2cqw; }
.stage-label.up { top: -1.1cqw; background: var(--surface); }
.stage-label.down { bottom: 1.2cqw; }
.stage::after { content: ""; position: absolute; left: 3%; right: 3%; bottom: 5.4%; border-top: 2px dashed var(--line); }
.pcard { position: absolute; width: 12%; transform: translateX(-50%); background: color-mix(in srgb, var(--kc) 8%, var(--surface));
  border: 3px solid var(--kc); border-radius: 1cqw; padding: .8cqw .7cqw .9cqw; text-align: center; user-select: none; -webkit-user-select: none; }
.pcard .ic { font-size: 1.8cqw; line-height: 1.1; }
.pcard .nm { font-family: var(--f-body); font-weight: 700; font-size: 1.6cqw; line-height: 1.15; }
.pcard .in { font-weight: 700; font-size: 1.05cqw; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: .5cqw; }
.pcard ul { list-style: none; margin: 0; padding: 0; text-align: left; font-size: 1.1cqw; line-height: 1.5; }
.pcard li::before { content: "• "; color: var(--muted); }
body.editing .pcard { cursor: grab; touch-action: none; }
.pcard.dragging { cursor: grabbing; box-shadow: 0 8px 28px rgba(0,0,0,.3); z-index: 3; }

/* Gear table */
.gear-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-bottom: 18px; font-size: 16px; }
.gear-table th { text-align: left; background: var(--ink); color: var(--bg); padding: 9px 12px; font-size: 14px; letter-spacing: .03em; }
.gear-table td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.gear-table td.q, .gear-table th.q { text-align: right; font-weight: 700; width: 64px; }
.gear-table td.how { color: var(--muted); }
.gear-table tr.sec th { background: var(--sunk); color: var(--ink); text-transform: uppercase; }
.gear-table input { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: var(--bg); }
.gear-table input.qty { width: 64px; text-align: right; }
.gear-table td.x { width: 44px; padding: 4px; }
.notes-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; color: var(--muted); }
.notes-box textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px; background: var(--bg); color: var(--ink); }
.add-row { margin: 0 0 18px; }

/* Mixers */
.mixers { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 14px; }
.mixer { background: var(--surface); border: 2px solid var(--line); border-radius: var(--r); padding: 14px; }
.mixer:nth-child(odd) { border-color: var(--k-acoustic); }
.mixer:nth-child(even) { border-color: var(--k-vocal); }
.mixer h3 { font-size: 24px; text-transform: uppercase; }
.mixer .role { color: var(--muted); margin: 2px 0 10px; }
.mixer ol { list-style: none; margin: 0; padding: 0; }
.mixer li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); min-height: 44px; }
.ch { flex: none; font-weight: 700; font-size: 13px; background: var(--ink); color: var(--bg); border-radius: 5px; padding: 2px 7px; min-width: 34px; text-align: center; }
.spare { color: var(--muted); font-style: italic; }
.mixer li input { flex: 1; min-width: 0; min-height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: var(--bg); }
.mixer .out { margin: 10px 0 0; font-size: 15px; }
.mixer .out b { color: var(--accent-ink); }
.mixer-edit { display: grid; gap: 8px; margin-bottom: 10px; }
.mixer-edit select { min-height: 40px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: var(--bg); width: 100%; }
.mixer-edit input { min-height: 40px; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; background: var(--bg); width: 100%; }
.mixer li .pick { flex: 1; min-width: 0; display: grid; gap: 6px; }
.mixer li select { width: 100%; min-height: 36px; border: 1px solid var(--line); border-left: 5px solid var(--kc, var(--line)); border-radius: 6px; padding: 4px 8px; background: var(--bg); }
.mixer li .what { color: var(--muted); font-size: 15px; }
.mixer li option.used { color: var(--muted); }
.mixer li.twice select { border-color: var(--danger); border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 8%, var(--bg)); }
.mixer li.ret .ch { background: var(--accent); color: #1E1B18; }
.mixer .out-edit { margin: 10px 0 0; }
.out-lbl { display: grid; gap: 3px; font-size: 14px; }
.out-lbl b { color: var(--accent-ink); }
.mix-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 14px; }
.mix-bar .cap { flex-basis: 100%; margin: 0; }
.mix-msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; margin: 0 0 10px; font-size: 15px; }
.mix-msg.warn { border-color: var(--danger); color: var(--danger); font-weight: 700; }
.pcard .chs { font-weight: 700; font-size: 1.1cqw; color: var(--accent-ink); margin: -.2cqw 0 .5cqw; }
/* Narrow plots (phones): the plot fits the screen; cards show who and where, the gear list is a tap away (and on the Gear tab) */
/* (Screen only: printing always shows the full cards.) */
@media screen {
@container (max-width: 760px) {
  .plot-h { font-size: 20px; }
  .plot-sub { font-size: 13px; margin: 4px 0 10px; }
  .legend { font-size: 12px; gap: 4px 12px; margin-bottom: 14px; }
  .legend span { gap: 5px; }
  .legend i { width: 11px; height: 11px; }
  .stage { border-width: 2px; border-radius: 8px; }
  .stage-label { font-size: 9px; letter-spacing: .2em; padding: 0 6px; }
  .stage-label.up { top: -7px; }
  .stage-label.down { bottom: 4px; }
  .pcard { width: 17%; border-width: 2px; border-radius: 7px; padding: 4px 2px 5px; cursor: pointer; }
  .pcard .ic { font-size: 12px; }
  .pcard .nm { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .pcard .in { font-size: 8px; letter-spacing: .02em; margin: 1px 0 0; line-height: 1.2; }
  .pcard .chs { font-size: 9px; margin: 2px 0 0; }
  .pcard ul { display: none; }
}
@container (max-width: 560px) { .stage { aspect-ratio: 10 / 9; } }
}
@media (max-width: 560px) { .plot { padding: 12px 10px 14px; border-width: 1.5px; } }
.who-gear { margin: 0; padding-left: 1.2em; line-height: 1.6; }

/* Band */
.members { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.members li { background: var(--surface); border: 2px solid var(--kc); border-radius: var(--r); display: flex; flex-direction: column; align-items: stretch; padding: 6px 10px 6px; }
.members li.off { border-style: dashed; opacity: .7; }
.members .who { min-width: 0; border: 0; background: none; text-align: left; padding: 2px 0; cursor: pointer; }
body:not(.editing) .members .who { cursor: default; }
.members .who b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.members .who span { display: block; color: var(--muted); font-size: 13px; line-height: 1.3; }
.members li > .cap { font-size: 12px; margin: 2px 0 0; }
.playing { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; padding: 4px 0 0; min-height: 32px; }
.playing input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Dialogs */
dialog.sheet { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 40px); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
dialog.sheet::backdrop { background: rgba(20,18,16,.5); }
.sheet-in { padding: 18px 20px 22px; }
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.sheet label { display: block; font-weight: 700; font-size: 15px; margin: 12px 0 0; }
.sheet input:not([type=checkbox]):not([type=file]), .sheet select, .sheet textarea { display: block; width: 100%; margin-top: 4px; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-weight: 400; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.lbl { display: block; font-weight: 700; font-size: 15px; margin: 14px 0 4px; }
.file-btn { position: relative; margin-top: 6px !important; }
.file-btn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.sv-artist { color: var(--muted); margin: 0 0 12px; }
.facts { display: flex; gap: 28px; margin: 0 0 12px; }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 2px 0 0; font-weight: 700; }
#sv-gig-lead-wrap { display: block; font-weight: 700; margin: 0 0 14px; }
#sv-gig-lead-wrap[hidden] { display: none; }
.sv-notes { white-space: pre-wrap; background: var(--bg); border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; }
.sv-notes:empty { display: none; }
#me-gear { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
#me-gear li { display: flex; gap: 6px; align-items: center; }
#me-gear li input.qty { width: 64px; flex: none; }
#me-gear li input { margin: 0 !important; }
.f-error { color: var(--danger); margin: 10px 0 0; }
.shows { list-style: none; margin: 0 0 6px; padding: 0; }
.shows button { width: 100%; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 10px 4px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.shows button[aria-current="true"] { font-weight: 700; color: var(--accent-ink); }
.shows .d { color: var(--muted); font-weight: 400; }
.show-form { border-top: 2px solid var(--line); padding-top: 14px; margin-top: 8px; }
.set-block { padding: 12px 0; border-top: 1px solid var(--line); }
.set-block:first-of-type { border-top: 0; }
.set-block h3 { font-size: 20px; margin-bottom: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 8px 18px; min-height: 44px; cursor: pointer; font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #1E1B18; }
.sync-box { display: grid; gap: 10px; margin-top: 8px; }
.sync-box .ok { color: var(--ok); }
.sync-box .problem { color: var(--danger); }
.help { font-size: 15px; color: var(--muted); }
.help summary { cursor: pointer; color: var(--accent-ink); font-weight: 700; }

.banner { position: relative; z-index: 30; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 8px 16px; background: var(--accent-soft); }
.toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 12px; z-index: 50; max-width: calc(100vw - 32px); display: flex; gap: 14px; align-items: center; }

/* Chart viewer */
.viewer { position: fixed; inset: 0; z-index: 60; background: var(--sunk); display: flex; flex-direction: column; }
body.viewing { overflow: hidden; }
.viewer-bar { display: flex; align-items: center; gap: 10px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.viewer-bar h2 { flex: 1; min-width: 0; font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-btns { display: flex; gap: 8px; }
.viewer-pages { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 8px 8px max(16px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.viewer-page { background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.2); max-width: 100%; }
.viewer-page canvas { width: 100%; height: 100%; display: block; }
.viewer-exit { display: none; position: absolute; top: max(10px, env(safe-area-inset-top)); right: 12px; z-index: 2; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: rgba(30,27,24,.6); color: #fff; font-size: 18px; cursor: pointer; }
.viewer.full .viewer-bar { display: none; }
.viewer.full .viewer-exit { display: grid; place-items: center; }
.viewer.full .viewer-pages { padding-top: 0; }
@media (max-width: 560px) { .vf-label { display: none; } .viewer-bar h2 { font-size: 18px; } }
.viewer-msg { margin: 40px 16px; color: var(--muted); text-align: center; }
@media (max-width: 560px) {
  .setlist li { gap: 6px; padding: 0 2px 0 8px; }
  .setlist .num { width: 24px; }
  .setlist .rm { width: 30px; }
  .setlist .grip { width: 30px; }
  .song-btn { gap: 6px; }
  .brand h1 { font-size: 26px; }
  h2 { font-size: 26px; }
  .two { grid-template-columns: 1fr; }
  .head-btns { width: 100%; }
}

/* Printing: only the open section, in black on white */
@media print {
  :root { --bg: #fff; --surface: #fff; --sunk: #eee; --ink: #000; --muted: #444; --line: #bbb; --accent-ink: #000;
    --k-vocal: #C26A1E; --k-acoustic: #3A7D3A; --k-electric: #9B2C2C; --k-bass: #2F5597; --k-horn: #6B4BA3; --k-drums: #6B6B6B; --k-keys: #1F7A7A; --k-other: #8A7A5A; }
  @page { margin: 12mm; }
  @page plot { size: landscape; margin: 10mm; }
  body { background: #fff; font-size: 12pt; }
  .top, .banner, .toast, .viewer, .btn, .hint, .search, .no-print, .edit-only, .rm, .grip, .add, .panel-head .head-btns, dialog { display: none !important; }
  main { padding: 0; max-width: none; }
  .print-only { display: block; }
  .print-title { margin-bottom: 10px; }
  .plot-scroll { overflow: visible; margin: 0; padding: 0; }
  /* Small enough to fit one page either way round (Safari ignores the landscape setting) */
  .plot { min-width: 0; break-inside: avoid; width: 8.4in; max-width: 100%; margin: 0 auto; }
  .band-foot { display: none; }
  .gear-table th { background: #000 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pcard, .legend i, .chip, .ch, .mixer li select { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.print-list main { display: none; }
  body:not(.print-list) #print-setlist { display: none; }
  body:not(.print-pdf) #print-pdf { display: none; }
  body.print-pdf > :not(#print-pdf) { display: none !important; }
  #print-pdf img { display: block; max-width: 100%; max-height: 9.8in; margin: 0 auto; break-after: page; }
  #print-pdf img:last-child { break-after: auto; }
  #print-setlist h1 { font-size: 30pt; text-transform: uppercase; }
  #print-setlist p { margin: 2px 0 14px; color: #444; }
  #print-setlist ol { margin: 0; padding-left: 1.6em; font-size: 20pt; line-height: 1.55; }
  #print-setlist .brk { display: block; list-style: none; margin-left: -1.6em; font-size: 14pt; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; border-top: 1px dashed #888; border-bottom: 1px dashed #888; padding: 4px 0; margin: 10px 0; text-align: center; }
  #print-setlist .pnote { display: block; font-style: italic; font-size: 14pt; margin: 4px 0 4px -1.6em; padding-left: 1.6em; }
  #print-setlist li small { font-size: 12pt; color: #444; margin-left: 10px; }
}

/* Perform: charts full screen on a dark background; the bar and the little metronome float over the page */
.perform { position: fixed; inset: 0; z-index: 70; background: #1A1714; color: #F0EBE3; user-select: none; -webkit-user-select: none; }
.pf-stage { position: absolute; inset: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: grid; place-items: center; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pf-page { display: grid; place-items: center; }
.pf-page canvas { display: block; background: #fff; }
.pf-msg { margin: 0; display: grid; gap: 8px; text-align: center; font-size: 20px; padding: 20px; }
.pf-msg b { font-family: var(--f-display); font-size: 44px; line-height: 1.05; }
.pf-dim { color: #A3A3A3; font-size: 17px; }
.pf-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px; background: rgba(26, 23, 20, .92); color: #F0EBE3;
  transform: translateY(-110%); transition: transform .2s ease; }
.pf-bar.show { transform: none; }
.pf-bar .btn { background: #2A2520; border-color: #3B342D; color: #F0EBE3; }
.pf-bar select { min-height: 40px; max-width: min(360px, 50vw); border: 1px solid #3B342D; border-radius: 999px; padding: 4px 14px; background: #2A2520; color: #F0EBE3; font-weight: 700; }
.pf-count { flex: 1; min-width: 0; color: #A3A3A3; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-icon { width: 44px; height: 44px; border-radius: 50%; border: 1px solid #3B342D; background: #2A2520; color: #FF9433; display: grid; place-items: center; cursor: pointer; }
/* Pops up just under its icon at the top right, with a little pointer up to it */
.pf-met { position: absolute; right: max(12px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 54px); width: 210px;
  background: var(--surface); color: var(--ink); border: 2px solid var(--line); border-radius: 14px; padding: 8px 10px 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45); display: grid; gap: 8px; }
.pf-met::before { content: ""; position: absolute; top: -8px; right: 15px; width: 14px; height: 14px; background: inherit;
  border-left: 2px solid var(--line); border-top: 2px solid var(--line); transform: rotate(45deg); }
/* When the bar slides away, the metronome slides up into the corner */
.pf-met { transition: top .2s ease; }
.pf-bar:not(.show) ~ .pf-met { top: max(12px, env(safe-area-inset-top)); }
.pf-bar:not(.show) ~ .pf-met::before { display: none; }
.pf-met.flash { animation: met-flash .18s ease-out; }
.pf-met.flash1 { animation: met-flash1 .22s ease-out; }
.pf-met-top { display: flex; align-items: center; justify-content: space-between; }
.pf-bpm { color: var(--muted); font-weight: 700; }
.pf-bpm b { font-family: var(--f-display); font-size: 44px; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.pf-met.flash1 .pf-bpm, .pf-met.flash1 .pf-bpm b { color: #1E1B18; }
.pf-x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; font-size: 16px; }
.pf-met-row { display: flex; gap: 6px; }
.pf-dots { gap: 10px; min-height: 18px; }
.pf-dots i { width: 18px; height: 18px; }
.pf-met-song { margin: -6px 0 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-met.flash1 .pf-met-song { color: #1E1B18; }
.pf-met-row .btn { flex: 1; padding: 4px 6px; }
#pf-silent[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #1E1B18; }
#pf-start.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
@media print { .perform { display: none !important; } }
