/* SwarKeys (swarkeys.app) */
:root {
  --bg: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --ink: #121a2e;
  --muted: #5b6683;
  --faint: #8d97b3;
  --line: #dde3ef;
  --line-strong: #c6cfe2;
  --primary: #3a49d6;
  --primary-ink: #ffffff;
  --primary-soft: #e7eaff;
  --accent: #f29d12;          /* playback, highlights */
  --accent-ink: #2a1a00;
  --accent-soft: #fff1d6;
  --now: #c47600;
  --teal: #0f8f7e;
  --danger: #c9372c;
  --warn-bg: #fff6e0;
  --warn-ink: #7a5300;
  --bar-bg: #fbfcff;
  --shadow: 0 1px 2px rgba(18, 26, 46, .06), 0 6px 20px rgba(18, 26, 46, .06);
  --radius: 14px;
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-indic: "Noto Sans Devanagari", "Noto Sans Malayalam", "Noto Sans Tamil", "Noto Sans Kannada";
  /* Triton program categories */
  --c0: #4f6bed; --c1: #8a5cf6; --c2: #d4a017; --c3: #e0567a; --c4: #b07ae0; --c5: #e8833a;
  --c6: #2fa58c; --c7: #3d9be9; --c8: #1d6f8f; --c9: #9b8bd6; --c10: #e05fb8; --c11: #ef6c43;
  --c12: #7d8fe3; --c13: #8a94a8; --c14: #c9851a; --c15: #3fae5c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1020; --surface: #131a2e; --surface-2: #18203a; --ink: #e8ecf7; --muted: #9aa6c4;
    --faint: #6f7a99; --line: #253052; --line-strong: #34406a; --primary: #7d8aff; --primary-ink: #0b1020;
    --primary-soft: #1f2853; --accent: #ffb43b; --accent-ink: #241600; --accent-soft: #3a2c12; --now: #ffb43b;
    --teal: #3cc9b3; --danger: #ff7a6e; --warn-bg: #352a10; --warn-ink: #ffd27a; --bar-bg: #161e36;
    --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: #0b1020; --surface: #131a2e; --surface-2: #18203a; --ink: #e8ecf7; --muted: #9aa6c4;
  --faint: #6f7a99; --line: #253052; --line-strong: #34406a; --primary: #7d8aff; --primary-ink: #0b1020;
  --primary-soft: #1f2853; --accent: #ffb43b; --accent-ink: #241600; --accent-soft: #3a2c12; --now: #ffb43b;
  --teal: #3cc9b3; --danger: #ff7a6e; --warn-bg: #352a10; --warn-ink: #ffd27a; --bar-bg: #161e36;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* component display rules must not show hidden things */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font), var(--font-indic), sans-serif;
}
body.has-song { padding-bottom: 96px; }   /* room for the transport bar */
.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 16px 40px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
a { color: var(--primary); }
h1, h2 { letter-spacing: -.01em; }

/* ------------------------------------------------------------ app bar */
.appbar { background: linear-gradient(100deg, #0f1630 0%, #1b2457 55%, #2a2f7a 100%); color: #e9ecff; }
.appbar-in { max-width: 1240px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 18px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.logo svg { width: 36px; height: 36px; color: #c9d0ff; flex: none; }
.logo-text { font-size: 19px; font-weight: 500; letter-spacing: .01em; }
.logo-text b { font-weight: 800; }
.logo-text i { font-style: normal; font-weight: 800; color: #ffb43b; }
.logo-text small { font-size: 15px; font-weight: 500; color: #c9d0ff; margin-left: 4px; }
.tagline { color: #aab3e6; font-size: 13px; }
.version { margin-left: auto; color: #8f99d6; font-size: 12px; }

/* ------------------------------------------------------------ buttons and inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 7px 14px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, select:focus-visible, input:focus-visible, .tp-btn:focus-visible, .seg button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 1px;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--primary-ink); }
.btn.accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--ink); }
.btn.accent:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.play { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.play:hover { filter: brightness(1.05); color: var(--accent-ink); }
.btn.small { min-height: 32px; padding: 4px 11px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-style: dashed; background: transparent; }
.btn.icon { width: 38px; padding: 0; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: default; pointer-events: none; }
select, input[type="number"] {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 6px 9px; min-height: 36px;
}
input[type="number"] { width: 70px; font-variant-numeric: tabular-nums; }
input[type="range"], input[type="checkbox"] { accent-color: var(--primary); }
.hint { color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------ cards */
.card, .loader {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px;
}
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 16px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 18px; }
.card-head .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; max-width: 64ch; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.eyebrow { display: block; font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--primary); }

/* ------------------------------------------------------------ start screen / file bar */
.loader { padding: 28px; }
.start h1 { margin: 0 0 6px; font-size: clamp(24px, 3.4vw, 34px); font-weight: 800; }
.start .lead { margin: 0 0 22px; color: var(--muted); max-width: 62ch; font-size: 16px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.step {
  display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center;
  padding: 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
}
.step .btn { grid-column: 1 / -1; width: 100%; }
.step-n {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary); font-weight: 800;
}
.step b { display: block; font-size: 15px; }
.step span:not(.step-n) { color: var(--muted); font-size: 13px; }
.step.optional .step-n { background: var(--surface); border: 1px dashed var(--line-strong); color: var(--muted); }
.drop-hint {
  margin: 16px 0 0; padding: 14px; border: 2px dashed var(--line-strong); border-radius: 12px;
  text-align: center; color: var(--muted); font-weight: 500;
}
body.dragging .loader { outline: 3px dashed var(--accent); outline-offset: -8px; }
body.dragging .drop-hint { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.filebar { display: none; }
body.has-song .loader { padding: 12px 16px; }
body.has-song .start { display: none; }
body.has-files:not(.has-song) .filebar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
body.has-files:not(.has-song) .filebar-actions { display: none; }
body.has-song .filebar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.filebar-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 6px 5px 12px; min-height: 32px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-size: 13px;
}
.chip b { font-weight: 700; }
.chip .kind { color: var(--muted); }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 6px; border-radius: 50%; }
.chip button:hover { color: var(--danger); background: var(--surface); }
.status { color: var(--muted); font-size: 14px; }
.status:empty { display: none; }
.loader .status { margin-top: 10px; }
.status.error { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------ song header and facts */
.song-hero { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin: 6px 0 14px; }
.song-title { min-width: 0; max-width: 100%; }
#song-select {
  font-size: clamp(22px, 3vw, 30px); font-weight: 800; border: 0; background: transparent; padding: 0 28px 0 0;
  max-width: 100%; color: var(--ink); min-height: 0; cursor: pointer;
}
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.fact {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px 12px 18px; box-shadow: var(--shadow); overflow: hidden;
}
.fact::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--fc, var(--primary)); }
.fact:nth-child(1) { --fc: var(--accent); }
.fact:nth-child(2) { --fc: var(--teal); }
.fact:nth-child(3) { --fc: var(--primary); }
.fact:nth-child(4) { --fc: var(--c3); }
.fact:nth-child(5) { --fc: var(--c1); }
.fact .k { color: var(--muted); font-size: 12px; font-weight: 600; }
.fact .v { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.fact .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.callout, .note-line { font-size: 13px; color: var(--muted); margin: 0 0 14px; }
.callout:empty, .note-line:empty { display: none; }
.callout { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.callout.warn, .note-line.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.note-line.warn { padding: 8px 12px; border-radius: 9px; }

/* ------------------------------------------------------------ soundfonts + track table */
.fonts-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.fonts-row .label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.chip.font { cursor: pointer; padding-right: 12px; }
.chip.font input { margin: 0; }
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table.tracks { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tracks th {
  text-align: left; padding: 8px 10px; color: var(--muted); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tracks td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tracks .num { text-align: right; font-variant-numeric: tabular-nums; }
.tracks tbody tr { cursor: pointer; transition: background .1s; }
.tracks tbody tr:hover { background: var(--surface-2); }
.tracks tbody tr.sel { background: var(--primary-soft); }
.tracks tbody tr:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.tracks td.tn { font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; position: relative; padding-left: 18px; }
.tracks td.tn::before {
  content: ""; position: absolute; left: 4px; top: 10px; bottom: 10px; width: 5px; border-radius: 4px; background: var(--cat, var(--line-strong));
}
.tracks .tname { font-weight: 700; white-space: nowrap; }
.tracks .sub2 { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tracks .sound { font-weight: 600; }
.tracks .missing { color: var(--muted); font-weight: 500; font-style: italic; }
.badge {
  display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: var(--cat, var(--muted)); background: color-mix(in srgb, var(--cat, var(--muted)) 15%, transparent); white-space: nowrap;
}
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; margin-left: 6px; }
.tracks select.inst { max-width: 220px; font-size: 13px; padding: 4px 8px; min-height: 32px; }
.tracks select.inst.manual { font-weight: 700; border-color: var(--primary); }
.tracks td.ms { white-space: nowrap; }
.tracks .ms button {
  width: 30px; height: 30px; margin-right: 4px; border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 800; cursor: pointer;
}
.tracks .ms button:hover { border-color: var(--primary); color: var(--primary); }
.tracks .ms button.mute[aria-pressed="true"] { background: var(--danger); color: #fff; border-color: var(--danger); }
.tracks .ms button.solo[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tracks .volcell { white-space: nowrap; }
.tracks input.vol { width: 90px; vertical-align: middle; }
.tracks .vol-val { display: inline-block; width: 3.2ch; text-align: right; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tracks .pan { display: inline-block; min-width: 4ch; margin-left: 8px; font-size: 12px; color: var(--muted); }
.tracks tr.silent td:not(.mix) { opacity: .4; }
.tracks .open {
  border: 0; background: var(--primary-soft); color: var(--primary); border-radius: 8px; padding: 6px 11px;
  font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.tracks tr.sel .open { background: var(--primary); color: var(--primary-ink); }

/* ------------------------------------------------------------ notes panel */
.notes-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.notes h2 { margin: 0; font-size: 21px; }
.notes h2 small { color: var(--muted); font-weight: 500; font-size: 15px; }
.seg {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px;
}
.seg button {
  border: 0; background: transparent; color: var(--ink); border-radius: 9px; padding: 9px 10px; cursor: pointer;
  font: inherit; display: flex; flex-direction: column; align-items: center; line-height: 1.2;
}
.seg button b { font-size: 15px; }
.seg button span { font-size: 12px; color: var(--muted); }
.seg button:hover { background: var(--surface); }
.seg button[aria-selected="true"] { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow); }
.seg button[aria-selected="true"] span { color: inherit; opacity: .85; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 10px; }
.controls label, .player label, .tp-opts label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
.stepper { display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.stepper #oct { min-width: 2.5ch; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.notes:not(.sargam) .for-sargam { display: none !important; }
.player {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 12px; margin-bottom: 10px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
}
.player .hint { flex-basis: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin: 4px 0 14px; align-items: center; }

/* lines of bars */
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { display: flex; gap: 8px; align-items: stretch; }
.line-bars { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.line-bars .bar { flex: 1 1 250px; }
.play-line, .play-bar { border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 8px; cursor: pointer; font: inherit; }
.play-line { width: 32px; flex: 0 0 32px; font-size: 12px; }
.play-bar { font-size: 11px; font-weight: 700; padding: 1px 7px; font-variant-numeric: tabular-nums; }
.play-line:hover, .play-bar:hover { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.bar { border: 1px solid var(--line); border-radius: 10px; background: var(--bar-bg); padding: 5px 7px 7px; min-width: 0; }
.bar .n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 6px; }
.beats { display: flex; gap: 5px; }
.beat {
  flex: 1 1 0; min-width: 0; display: flex; justify-content: space-around; align-items: center; flex-wrap: nowrap;
  border-bottom: 2px solid var(--line-strong); padding: 10px 2px 8px;
}
.beat[data-bar] { cursor: pointer; border-radius: 6px 6px 0 0; }
.beat[data-bar]:hover { background: var(--surface-2); }
.beat.multi { border-bottom-color: var(--teal); border-radius: 0 0 10px 10px; }
.tok { display: inline-flex; flex-direction: column-reverse; align-items: center; line-height: 1.05; }
.rest-run {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; color: var(--muted); font-size: 13px;
  border: 1px dashed var(--line-strong); border-radius: 10px; background: transparent;
}
.rest-run::before { content: ""; width: 26px; height: 7px; border-radius: 2px; background: var(--faint); }
.line-bars .rest-run { flex: 0 1 auto; }
.hold { color: var(--muted); font-weight: 400; }
.rest { color: var(--faint); font-weight: 400; }
.names .tok b { font-size: 14px; font-weight: 700; }
.bar.now, .rest-run.now { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.tok.now, .tok.now b { color: var(--now); }

/* a swara: komal underlined, tivra with a stroke above, dots for saptak */
.sw { position: relative; display: inline-block; padding: 7px 1px; font-size: 19px; font-family: var(--font), var(--font-indic), sans-serif; }
.sw b { font-weight: 700; }
.sw.komal b { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.sw.tivra::before { content: ""; position: absolute; top: 0; left: 50%; width: 2px; height: 7px; background: currentColor; transform: translateX(-50%); }
.sw[data-o]::after { position: absolute; left: 0; right: 0; text-align: center; font-size: 13px; line-height: 1; letter-spacing: -1px; }
.sw[data-o="1"]::after { content: "•"; top: -4px; }
.sw[data-o="2"]::after { content: "••"; top: -4px; }
.sw[data-o="3"]::after { content: "•••"; top: -4px; }
.sw[data-o="-1"]::after { content: "•"; bottom: -5px; }
.sw[data-o="-2"]::after { content: "••"; bottom: -5px; }
.sw[data-o="-3"]::after { content: "•••"; bottom: -5px; }
.sw.tivra[data-o="1"]::after, .sw.tivra[data-o="2"]::after { top: -10px; }
.beat.multi .sw { font-size: 16px; }
.beat.dense .sw { font-size: 13px; }
.legend .sw { font-size: 16px; }

#staff { overflow-x: auto; background: #fff; color: #111; border-radius: 10px; padding: 8px; border: 1px solid var(--line); }
#staff svg { max-width: 100%; }
#staff .now { fill: #d97706; }
#staff .abcjs-note, #staff .abcjs-rest { cursor: pointer; }
.empty-msg { color: var(--muted); padding: 24px; text-align: center; }

/* ------------------------------------------------------------ transport bar */
.transport {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: rgba(15, 22, 48, .94); color: #e9ecff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255, 255, 255, .08); box-shadow: 0 -6px 24px rgba(0, 0, 0, .18);
}
.transport[hidden] { display: none; }
.transport-in { max-width: 1240px; margin: 0 auto; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.tp-buttons { display: flex; gap: 6px; align-items: center; }
.tp-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .06); color: #e9ecff; font-size: 15px; cursor: pointer; display: grid; place-items: center;
}
.tp-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .14); }
.tp-btn:disabled { opacity: .4; cursor: default; }
.tp-btn.main { width: 48px; height: 48px; background: #ffb43b; color: #241600; border-color: #ffb43b; font-size: 18px; }
.tp-btn.main:hover { background: #ffc35e; }
.tp-pos { flex: 1 1 260px; display: flex; align-items: center; gap: 12px; min-width: 0; }
.tp-pos .pos { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 150px; }
#song-seek { flex: 1; min-width: 100px; accent-color: #ffb43b; }
.tp-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.tp-opts label { color: #aab3e6; }
.tp-opts input[type="number"], .tp-opts select {
  background: rgba(255, 255, 255, .07); color: #fff; border-color: rgba(255, 255, 255, .2); min-height: 32px; padding: 3px 7px; width: 62px;
}
.tp-opts select { width: auto; }
.tp-opts select option { color: #121a2e; }
.tp-opts input[type="checkbox"] { accent-color: #ffb43b; }
.tp-status { flex-basis: 100%; color: #c9d0ff; font-size: 13px; }
.tp-status.error { color: #ff9d94; }

.foot { max-width: 1240px; margin: 0 auto; padding: 0 16px 30px; color: var(--muted); font-size: 12px; }

/* ------------------------------------------------------------ phones */
@media (max-width: 680px) {
  .tagline { display: none; }
  .version { display: none; }
  .user-chip { max-width: 150px; }
  .appbar-in { justify-content: space-between; }
  .loader { padding: 18px; }
  .line-bars .bar { flex-basis: 100%; }
  .fact .v { font-size: 20px; }
  .seg button b { font-size: 14px; }
  .tp-pos .pos { min-width: 0; }
  .tp-opts { width: 100%; justify-content: space-between; }
  body.has-song { padding-bottom: 150px; }
  .song-hero .toolbar { width: 100%; }
}

/* ------------------------------------------------------------ print sheet */
#print-sheet { display: none; }

@page { size: A4; margin: 13mm 12mm 14mm; }

@media print {
  html, body { background: #fff !important; color: #000 !important; }
  body { padding: 0 !important; font-size: 11pt; }
  body > *:not(#print-sheet) { display: none !important; }
  #print-sheet { display: block !important; }
}

#print-sheet {
  --ink: #000; --muted: #444; --faint: #666; --line: #bbb; --line-strong: #888; --bar-bg: #fff;
  color: #000; background: #fff;
  font-family: var(--font), var(--font-indic), sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.ps-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 8px; }
.ps-head h1 { margin: 0; font-size: 19pt; font-weight: 800; line-height: 1.15; }
.ps-head .ps-track { font-size: 12pt; font-weight: 700; }
.ps-head .ps-brand { font-size: 8pt; color: #555; text-align: right; white-space: nowrap; }
.ps-meta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px 12px; font-size: 9pt; margin-bottom: 8px; }
.ps-meta span { color: #555; }
.ps-meta b { font-weight: 700; }
.ps-legend {
  display: flex; flex-wrap: wrap; gap: 3px 16px; font-size: 8.5pt; color: #222; align-items: center;
  border: 1px solid #bbb; border-radius: 4px; padding: 4px 8px; margin-bottom: 10px;
}
.ps-legend .sw { font-size: 11pt; padding: 5px 1px; }
.ps-legend .mr { display: inline-flex; align-items: center; width: 34px; vertical-align: middle; }
.ps-line { display: flex; margin-bottom: 8px; border-left: 1.5px solid #000; break-inside: avoid; page-break-inside: avoid; }
.ps-fill { border: 0; }
.ps-bar { border-right: 1.5px solid #000; padding: 1px 4px 3px; min-width: 0; }
.ps-bar .ps-n { font-size: 7pt; color: #555; font-variant-numeric: tabular-nums; }
.ps-bar .ps-n i { font-style: normal; margin-left: 4px; font-weight: 700; color: #000; }
.ps-beats { display: flex; gap: 3px; }
.ps-beat { flex: 1 1 auto; min-width: 0; display: flex; justify-content: space-around; align-items: center; flex-wrap: nowrap; border-bottom: 1px solid #999; padding: 6px 1px 4px; }
.ps-beat.multi { border-bottom: 1.5px solid #000; border-radius: 0 0 6px 6px; }
.ps-beat .tok { display: inline-flex; flex-direction: column-reverse; align-items: center; line-height: 1.05; }
.ps-beat .sw { font-size: 12.5pt; padding: 5px .5px; }
.ps-beat.multi .sw { font-size: 11pt; }
.ps-beat.dense .sw { font-size: 9pt; }
.ps-beat b { font-size: 10pt; }
.ps-beat .hold { color: #000; font-weight: 400; }
.ps-beat .rest { color: #000; font-weight: 800; }
/* a rest bar: the multi-measure rest sign with the number of bars */
.ps-rest { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 3px 4px; min-height: 44px; }
.mr { display: flex; align-items: center; width: 70%; max-width: 110px; }
.mr::before, .mr::after { content: ""; width: 1.5px; height: 12px; background: #000; flex: none; }
.mr span { flex: 1; height: 6px; background: #000; }
.ps-rest .mr-count { font-size: 10pt; font-weight: 800; line-height: 1; }
.ps-rest .mr-label { font-size: 7.5pt; color: #333; }
.ps-staff svg { width: 100% !important; height: auto !important; }
.ps-foot { margin-top: 10px; padding-top: 4px; border-top: 1px solid #999; font-size: 7.5pt; color: #555; display: flex; justify-content: space-between; gap: 10px; }

/* ------------------------------------------------------------ toast */
#toast {
  position: fixed; left: 50%; bottom: 110px; transform: translate(-50%, 20px); z-index: 30;
  max-width: min(560px, calc(100% - 32px)); padding: 12px 16px; border-radius: 12px;
  background: #121a2e; color: #fff; font-size: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
@media print { #toast { display: none !important; } }
.ps-staff svg { display: block; break-inside: avoid; page-break-inside: avoid; margin-bottom: 4px; }
.ps-measure { position: absolute; visibility: hidden; display: flex; width: max-content; }
.ps-measure .ps-bar, .ps-measure .ps-beat { flex: none !important; }
.ps-measure .ps-beat { gap: 1px; }
.ps-measure .mr { width: 56px; }
.ps-beat { gap: 1px; }

/* ------------------------------------------------------------ export for another keyboard */
.export-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 12px; }
.export-controls label { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
.export-controls #ex-target { font-weight: 700; color: var(--ink); }
.ex-pcg { display: inline-flex; align-items: center; gap: 8px; }
.ex-table select.ex-sel { max-width: 340px; font-size: 13px; padding: 4px 8px; min-height: 32px; }
.ex-table select.ex-sel.picked { font-weight: 700; border-color: var(--primary); }
.ex-table .arrow { color: var(--faint); font-weight: 700; }
.ex-table .how { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.ex-table .how.picked { color: var(--primary); }
.ex-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 14px; }
.howto { margin-top: 12px; color: var(--muted); font-size: 13px; }
.howto summary { cursor: pointer; font-weight: 700; color: var(--ink); }
.howto p { margin: 8px 0 0; max-width: 80ch; }

/* ------------------------------------------------------------ account, unlock, dialogs */
.account { display: flex; align-items: center; gap: 8px; }
.version + .account { margin-left: 12px; }
.btn.light { background: rgba(255, 255, 255, .12); color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn.light:hover { background: rgba(255, 255, 255, .22); color: #fff; border-color: rgba(255, 255, 255, .5); }
.user-menu { position: relative; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; max-width: 240px; padding: 4px 12px 4px 4px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .25); background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: 13px; cursor: pointer;
}
.user-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #ffb43b; color: #241600; font-weight: 800; flex: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 170px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
}
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 7px; cursor: pointer; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu a { display: block; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 700; padding: 8px 10px; border-radius: 7px; }

.unlock {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 12px 16px; margin-bottom: 14px; border-radius: 12px;
  background: linear-gradient(100deg, var(--accent-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
}
.unlock b { color: var(--ink); }
.unlock span { color: var(--muted); font-size: 14px; }
[data-paid].locked { opacity: .75; }
[data-paid].locked::after { content: "🔒"; font-size: 12px; margin-left: 2px; }

.dialog {
  width: min(440px, calc(100% - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.dialog::backdrop { background: rgba(11, 16, 32, .55); }
.dialog-body { position: relative; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { margin: 0; font-size: 21px; }
.dialog .sub { margin: 0; color: var(--muted); font-size: 14px; }
.dialog .close { position: absolute; right: 12px; top: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.field input {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 10px 12px; font-weight: 500;
}
#auth-code { font-size: 26px; letter-spacing: 10px; text-align: center; font-weight: 800; }
.optional { font-weight: 500; }
.btn.wide { width: 100%; min-height: 44px; }
.dialog-row { display: flex; justify-content: space-between; margin-top: 10px; }
.linkish { border: 0; background: none; color: var(--primary); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px 0; }
.linkish:disabled { color: var(--faint); cursor: default; }
.bought { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow: auto; }
.bought button {
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  border-radius: 10px; padding: 10px 12px; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 2px;
}
.bought button:hover { border-color: var(--primary); }
.bought span { color: var(--muted); font-size: 12px; }
@media print { .dialog { display: none !important; } }

/* service mode, signed out: sign in before opening files */
.login-gate { display: none; }
body.need-login .login-gate {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px;
  padding: 18px; border-radius: 12px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
}
.login-gate b { display: block; font-size: 17px; }
.login-gate span { color: var(--muted); font-size: 14px; }
body.need-login .steps, body.need-login .drop-hint { display: none; }

/* ------------------------------------------------------------ coupon box (unlock banner) */
.unlock-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.coupon-box { display: flex; gap: 6px; align-items: center; }
.coupon-box input { width: 150px; text-transform: uppercase; font-weight: 700; letter-spacing: .04em; }
.coupon-ok { color: var(--teal); font-size: 13px; font-weight: 700; }
.coupon-ok.bad { color: var(--danger); }
.coupon-ok:empty { display: none; }

/* ------------------------------------------------------------ admin portal */
.admin-tabs { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.admin-tabs button {
  border: 0; background: none; color: #c3c9f2; font: inherit; font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: 9px; cursor: pointer;
}
.admin-tabs button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.admin-tabs button[aria-selected="true"] { background: rgba(255, 255, 255, .16); color: #fff; }
.admin-main > .status { margin: 0 0 12px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; border-top: 4px solid var(--primary);
}
.kpi.good { border-top-color: var(--teal); }
.kpi.accent { border-top-color: var(--accent); }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 700; }
.kpi b { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.kpi small { color: var(--muted); font-size: 12px; }
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.legend .key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-left: 8px; }
.legend .key.rev { background: var(--teal); }
.legend .key.up { background: var(--accent); height: 3px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .grid-line { stroke: var(--line); }
.chart .bar-rev { fill: var(--teal); }
.chart .line-up { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.card-head input[type="search"] { min-width: 240px; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 12px; min-height: 40px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
table.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.grid td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.grid td small { display: block; color: var(--muted); font-size: 12px; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
table.grid tr.c-used, table.grid tr.c-off, table.grid tr.c-expired { opacity: .6; }
table.grid .actions { white-space: nowrap; text-align: right; }
table.grid .actions .btn { margin-left: 4px; }
select.role { font-weight: 700; }
select.role-free { border-color: var(--teal); color: var(--teal); }
select.role-admin { border-color: var(--accent); background: var(--accent-soft); }
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.admin { background: var(--accent-soft); color: var(--ink); border: 1px solid var(--accent); }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
code.code { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; letter-spacing: .04em; background: var(--primary-soft); color: var(--primary); padding: 3px 8px; border-radius: 6px; }
.coupon-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 4px 14px; align-items: end; }
.coupon-form .wide-field { grid-column: span 2; }
.coupon-form select, .coupon-form input { min-height: 44px; width: 100%; }
.coupon-form .btn { margin-bottom: 10px; min-height: 40px; }
.field textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 10px; resize: vertical; }
.new-codes { margin-top: 14px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--line-strong); }
.new-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.code-list { display: flex; flex-wrap: wrap; gap: 8px; max-height: 220px; overflow: auto; }
.new-actions { display: flex; gap: 8px; margin-top: 12px; }
@media (max-width: 760px) {
  .appbar-in { flex-wrap: wrap; }
  .admin-tabs { margin-left: 0; order: 3; width: 100%; }
  .coupon-form .wide-field { grid-column: auto; }
  .unlock-actions { align-items: stretch; width: 100%; }
}

/* ------------------------------------------------------------ transpose, chords, lyrics */
.transpose { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.transpose .tlabel { font-size: 13px; font-weight: 700; color: var(--muted); }
.transpose output { min-width: 28px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.transpose output.on { color: var(--now); }
.beat.has-chord { position: relative; }
.beats.chorded .beat { padding-top: 19px; }
.chord { position: absolute; left: 3px; top: 1px; font-size: 12px; font-weight: 800; color: var(--primary); white-space: nowrap; letter-spacing: -.01em; }
.lyric { margin-top: 4px; font-size: 12px; color: var(--muted); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.marker { background: var(--accent-soft); color: var(--ink); border-radius: 5px; padding: 0 6px; font-weight: 700; font-size: 11px; }
.rest-chords { color: var(--primary); font-weight: 700; margin-left: 6px; }
.rest-run .lyric { margin: 0; }

/* ------------------------------------------------------------ practice */
.practice {
  position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column;
  padding: 10px 14px 12px; gap: 8px;
}
body.practising { overflow: hidden; }
body.practising .transport { display: none; }
.pr-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pr-title { display: flex; flex-direction: column; margin-right: auto; min-width: 0; }
.pr-title b { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.pr-top label, .pr-opts label { font-size: 13px; font-weight: 700; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.pr-top select { max-width: 320px; }
.seg.small button { padding: 4px 10px; }
.seg.small button b { font-size: 13px; }
.seg.small button span { font-size: 11px; }
.pr-opts { display: flex; align-items: center; gap: 8px 16px; flex-wrap: wrap; }
.pr-opts .check { font-weight: 600; color: var(--ink); }
.pr-midi-status { font-size: 13px; color: var(--muted); }
.pr-midi-status.warn { color: var(--danger); }
.pr-stage { position: relative; flex: 1 1 auto; min-height: 240px; border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
#pr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.pr-hud { position: absolute; left: 12px; top: 10px; right: 12px; display: flex; align-items: flex-start; gap: 16px; pointer-events: none; z-index: 1; }
.pr-chord b { display: block; font-size: 30px; font-weight: 800; color: var(--primary); line-height: 1; }
.pr-chord small { color: var(--muted); font-weight: 700; }
.pr-lyric { flex: 1; text-align: center; font-size: 20px; font-weight: 700; color: var(--ink); text-shadow: 0 1px 0 var(--surface); }
.pr-score { text-align: right; }
.pr-score b { display: block; font-size: 30px; font-weight: 800; color: var(--teal); line-height: 1; }
.pr-score span { font-size: 12px; color: var(--muted); font-weight: 700; }
.pr-bottom { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-pos { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); }
.pr-msg { font-weight: 700; color: var(--now); }
.pr-msg.error { color: var(--danger); }
.pr-legend { margin-left: auto; font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.pr-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.pr-legend .r { background: var(--accent); } .pr-legend .l { background: var(--teal); } .pr-legend .o { background: var(--faint); opacity: .5; }
@media (max-width: 700px) { .pr-legend { display: none; } .pr-lyric { font-size: 15px; } .pr-chord b, .pr-score b { font-size: 22px; } }
@media print { .practice { display: none !important; } }

/* ------------------------------------------------------------ downloads, book */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.dl-item { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.dl-item > span { color: var(--muted); font-size: 13px; flex: 1; }
.dl-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.dl-row select { max-width: 180px; }
.dl-progress { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.dl-progress .bar { flex: 1; height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.dl-progress .bar i { display: block; height: 100%; width: 0; background: var(--teal); transition: width .3s; }
.dl-progress span { font-size: 13px; color: var(--muted); font-weight: 600; }
.dialog.wide { width: min(680px, calc(100vw - 24px)); }
.book-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.book-row { display: grid; grid-template-columns: auto 1fr minmax(0, 220px); gap: 10px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.book-row:last-child { border-bottom: 0; }
.book-row.locked { opacity: .55; }
.book-row small { display: block; color: var(--muted); font-size: 12px; }
.book-row select { width: 100%; font-size: 13px; }
/* book pages */
.ps-cover { height: 250mm; display: flex; flex-direction: column; justify-content: center; text-align: center; break-after: page; }
.ps-cover h1 { font-size: 34pt; margin: 0 0 6mm; }
.ps-cover p { color: #555; margin: 1mm 0; }
.ps-toc { break-after: page; }
.ps-toc h2 { font-size: 18pt; }
.ps-toc ol { font-size: 12pt; line-height: 1.9; }
.ps-section + .ps-section { break-before: page; }
.ps-chord { display: block; font-size: 8.5pt; font-weight: 800; color: #3a49d6; text-align: left; height: 11pt; }
.ps-lyric { font-size: 8.5pt; font-style: italic; color: #444; margin-top: 1mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-marker { background: #ffe9bf; border-radius: 2px; padding: 0 3px; font-weight: 700; margin-left: 4px; }
.ps-beat { flex-direction: column; align-items: stretch; }
.ps-toks { display: flex; justify-content: space-around; align-items: center; flex-wrap: nowrap; }

/* ------------------------------------------------------------ plans, invite, class */
.credit-pill { background: var(--teal); color: #fff; border-radius: 99px; padding: 0 7px; font-size: 12px; font-weight: 800; margin-left: 4px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.plan { border: 1px solid var(--line-strong); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); }
.plan.best { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }
.plan b { font-size: 17px; }
.plan .price { font-size: 26px; font-weight: 800; color: var(--ink); }
.plan span { color: var(--muted); font-size: 13px; flex: 1; }
.plan .tag { align-self: flex-start; background: var(--accent); color: var(--accent-ink); border-radius: 99px; padding: 1px 8px; font-size: 11px; font-weight: 800; flex: none; }
.invite { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.invite h3, #class-songs-wrap h3 { margin: 0 0 4px; font-size: 16px; }
.invite-row { display: flex; gap: 8px; margin-top: 8px; }
.invite-row input { flex: 1; font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); min-width: 0; }
.invited { margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); font-weight: 700; font-size: 14px; }
.class-list { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.class-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.class-list li:last-child { border-bottom: 0; }
.class-list small { color: var(--muted); display: block; font-size: 12px; }
.class-add { display: flex; flex-direction: column; }
.try-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 18px; }

/* ------------------------------------------------------------ admin: payments, messages */
.pay-filters { display: flex; gap: 8px; flex-wrap: wrap; }
.pay-filters input { min-width: 240px; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 12px; }
.st { display: inline-block; font-size: 12px; font-weight: 800; border-radius: 99px; padding: 1px 9px; text-transform: uppercase; letter-spacing: .03em; }
.st.ok { background: color-mix(in srgb, var(--teal) 20%, transparent); color: var(--teal); }
.st.wait { background: var(--accent-soft); color: var(--now); }
.st.bad { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.msgs { display: flex; flex-direction: column; gap: 12px; }
.msg { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.msg.closed { opacity: .75; }
.msg header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.msg header .st { margin-left: auto; }
.msg-text { white-space: pre-wrap; margin: 8px 0; }
.msg-reply { border-left: 3px solid var(--teal); padding-left: 10px; margin: 8px 0; font-size: 14px; }
.msg-reply p { white-space: pre-wrap; margin: 4px 0 0; }
.msg-actions { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.msg-actions textarea { flex: 1; min-width: 220px; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 10px; }
.tag-kind { font-size: 11px; font-weight: 800; border-radius: 6px; padding: 2px 8px; background: var(--primary-soft); color: var(--primary); }
.tag-kind.k-problem, .tag-kind.k-payment { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

/* ------------------------------------------------------------ help, library, saved */
.foot-links { margin-bottom: 6px; }
.foot-links .linkish { font-size: inherit; }
#help-kind { flex-wrap: wrap; }
#help-kind button[aria-checked="true"] { background: var(--primary); color: var(--primary-ink); }
#help-kind button[aria-checked="true"] b { color: var(--primary-ink); }
.field textarea, #help-msg { font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; resize: vertical; font-weight: 500; }
.my-msgs ul { padding-left: 18px; font-size: 14px; }
.my-msgs li { margin-bottom: 10px; }
.lib-q { width: 100%; font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.library .lib-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.library .lib-item b { display: block; }
.library .lib-item span { color: var(--muted); font-size: 13px; }
.lib-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.saved-note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; margin-bottom: 14px; border-radius: 12px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent); font-size: 14px; }

/* ------------------------------------------------------------ welcome, language */
.lang-wrap { display: inline-flex; align-items: center; gap: 4px; color: #c9d0ff; }
.lang-wrap select { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .3); min-height: 32px; font-size: 13px; padding: 3px 6px; }
.lang-wrap select option { color: #121a2e; }
.lang-wrap.dark { color: var(--muted); }
.lang-wrap.dark select { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.appbar .version + .lang-wrap { margin-left: 12px; }
#about-btn { font-weight: 800; }
.dialog.welcome { width: min(860px, calc(100vw - 20px)); }
.w-top { display: flex; justify-content: space-between; align-items: center; }
.w-top .close { position: static; }
.welcome h2 { font-size: 26px; }
.w-intro { font-size: 16px !important; max-width: 70ch; }
.w-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 6px; }
.w-card { padding: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.w-card .w-ic { font-size: 22px; display: block; }
.w-card b { display: block; margin: 4px 0; font-size: 16px; }
.w-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.w-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.w-hide { margin-left: auto; font-size: 13px; color: var(--muted); }
@media (max-width: 700px) { .appbar .tagline { display: none; } .w-hide { margin-left: 0; } }
.ref-form { display: grid; grid-template-columns: 1fr 180px 220px auto; gap: 8px 16px; align-items: end; }
.ref-form .hint { grid-column: 1 / -1; margin: 0; }
.ref-form .btn { margin-bottom: 10px; min-height: 44px; }
.ref-form input[type="number"] { width: 100%; min-height: 44px; }
.ref-mode { border: 0; padding: 0; margin: 0 0 10px; display: flex; flex-direction: column; gap: 8px; }
.ref-mode legend { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 6px; }
.ref-mode label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.ref-mode small { display: block; color: var(--muted); font-size: 12px; }
@media (max-width: 760px) { .ref-form { grid-template-columns: 1fr; } }
mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 1px; }
.pr-h { margin: 18px 0 8px; font-size: 16px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pr-row { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: end; }
.pr-row .field { min-width: 180px; }
.pr-row .hint { margin: 0 0 14px; }
.pr-packs input { width: 100%; min-width: 70px; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; min-height: 36px; }
.pr-packs td:nth-child(3) { min-width: 180px; }
.pr-pass-on { font-weight: 600; margin-bottom: 8px; display: inline-flex; gap: 8px; align-items: center; }
.pr-warn { margin: 14px 0 0; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: 14px; line-height: 1.6; }
.ok-t { color: var(--teal); } .bad-t { color: var(--danger); }
.step .btn span { color: inherit; font-size: inherit; }

/* ------------------------------------------------------------ PCG library */
.pcg-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pcg-chip { cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); }
.pcg-chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.pcg-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.pcg-head h1 { margin: 2px 0 4px; font-size: 26px; }
.pcg-counts { color: var(--muted); font-size: 14px; }
.pcg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.pcg-bar input[type="search"] { flex: 1; min-width: 220px; font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 12px; }
.pcg-tabs { margin-bottom: 12px; flex-wrap: wrap; }
.pcg-table td.slot { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); white-space: nowrap; }
.pcg-table .badge { border-left: 3px solid var(--cat, var(--line-strong)); }
.pcg-table .uses { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; font-size: 13px; }
.pcg-table .uses small { color: var(--muted); }
.parts { display: flex; flex-wrap: wrap; gap: 4px; }
.part { font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 7px; padding: 2px 7px; white-space: nowrap; }
.part i { font-style: normal; font-weight: 800; color: var(--primary); margin-right: 4px; }
.pcg-body h3 { margin: 18px 0 4px; font-size: 16px; }
.pcg-body h3:first-child { margin-top: 0; }
.dups { padding-left: 18px; line-height: 1.9; font-size: 14px; }
.dup b { font-variant-numeric: tabular-nums; }
@media print {
  .pcg-page .appbar, .pcg-page .pcg-files, .pcg-page .toolbar, .pcg-page .pcg-bar, .pcg-page .pcg-tabs, .pcg-page .foot, .pcg-page #status { display: none !important; }
  .pcg-page, .pcg-page .card { background: #fff !important; color: #000 !important; box-shadow: none !important; border: 0 !important; }
  .pcg-page .grid td, .pcg-page .grid th { color: #000 !important; border-color: #bbb !important; padding: 3px 6px !important; font-size: 10pt; }
  .pcg-page .linkish { color: #000 !important; }
}
.edit-bar { border: 2px solid var(--accent); }
.edit-top { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; }
.edit-top p { margin: 4px 0 0; max-width: 80ch; }
.edit-warn { color: var(--warn-ink); background: var(--warn-bg); padding: 8px 12px; border-radius: 9px; font-size: 13px; }
.edit-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.edit-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.edit-log { margin: 12px 0 0; padding-left: 22px; font-size: 13px; color: var(--muted); max-height: 160px; overflow: auto; }
.edit-btn { margin-left: 10px; font-size: 12px; }
td.pick { width: 28px; }
.copy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.copy-grid .wide-field { grid-column: 1 / -1; }
.copy-grid select[size] { min-height: 150px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

/* ------------------------------------------------------------ PCG library: banks */
.pcg-page .wrap.pcg-wrap { max-width: 1580px; }
.pcg-page .appbar-in { max-width: 1580px; }
.pcg-files { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; }
.pcg-files .pcg-chips { flex: 1; }
.pcg-chip { padding: 5px 12px; }
.pcg-head { margin: 0 0 12px; }

/* menus */
.menu-btn { position: relative; }
.menu-btn summary { list-style: none; cursor: pointer; }
.menu-btn summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 260px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 36px rgba(11, 16, 32, .22); padding: 6px; }
.menu-pop a, .menu-pop button { display: flex; flex-direction: column; gap: 1px; text-align: left; padding: 8px 12px; border-radius: 8px; font: inherit;
  font-size: 14px; color: var(--ink); text-decoration: none; background: none; border: 0; cursor: pointer; }
.menu-pop button span { font-size: 12px; color: var(--muted); }
.menu-pop a:hover, .menu-pop button:hover { background: var(--primary-soft); color: var(--primary); }

/* changes bar */
.changes { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px;
  padding: 10px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); position: sticky; top: 8px; z-index: 30; }
.changes.dirty { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface)); box-shadow: var(--shadow); }
.changes-state { display: flex; gap: 10px; align-items: flex-start; flex: 1; min-width: 260px; }
.changes-state b { display: block; font-size: 14px; }
.changes-state .hint { display: block; max-width: 95ch; }
.changes .dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--teal); flex: none; }
.changes .dot.on { background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 25%, transparent); }
.changes-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.changes .edit-log { flex-basis: 100%; margin: 4px 0 0; }

/* page layout: filters | main */
.pcg-layout { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 16px; align-items: start; }
.filters { position: sticky; top: 84px; max-height: calc(100vh - 96px); overflow: auto; display: flex; flex-direction: column; gap: 14px;
  padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 11px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search-box input { width: 100%; box-sizing: border-box; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 9px 34px 9px 34px; }
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); background: var(--surface); }
.search-box kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
kbd { display: inline-block; min-width: 18px; padding: 1px 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px;
  font: 600 11px/1.4 ui-monospace, Menlo, monospace; color: var(--muted); background: var(--surface); text-align: center; }
.f-count { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
.f-count:empty { display: none; }
.f-count b { color: var(--ink); }
.f-group { display: flex; flex-direction: column; gap: 2px; }
.f-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.f-head span { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.f-head .linkish { font-size: 12px; padding: 0; }
.cat-row, .show-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 8px; border: 0; border-radius: 8px; background: none;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink); text-align: left; cursor: pointer; }
.cat-row span, .show-row span { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--faint); font-variant-numeric: tabular-nums; }
.cat-row i { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--cat); }
.cat-row i.all { background: conic-gradient(var(--c0), var(--c3), var(--c5), var(--c6), var(--c7), var(--c0)); }
.show-row i { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2px solid var(--line-strong); box-sizing: border-box; }
.cat-row:hover, .show-row:hover { background: var(--surface-2); }
.cat-row.on, .show-row.on { background: var(--primary-soft); color: var(--primary); }
.cat-row.on span, .show-row.on span { color: var(--primary); }
.show-row.on i { border: 4px solid var(--primary); }
.f-group .hint.small { margin: 4px 8px 0; }
.f-opts { gap: 8px; }
.switch { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: relative; width: 30px; height: 17px; flex: none; border-radius: 999px; background: var(--line-strong); transition: background .15s; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(13px); }
.switch input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn.ghost { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.btn.ghost:hover { color: var(--danger); border-color: var(--danger); }

/* main: view tabs */
.pcg-main { min-width: 0; }
.view-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.view-tabs button { position: relative; padding: 9px 14px 11px; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 700;
  color: var(--muted); cursor: pointer; white-space: nowrap; }
.view-tabs button:hover { color: var(--ink); }
.view-tabs button[aria-selected="true"] { color: var(--primary); }
.view-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.pill { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: center; }
.pill:empty { display: none; }

/* banks view: grid | details */
.bank-view { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.grid-wrap, .side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.grid-wrap { padding: 14px 16px 16px; min-height: 340px; }
.kind-tabs { display: inline-flex; flex-wrap: wrap; gap: 3px; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); margin-bottom: 12px; }
.kind-tabs button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 0; border-radius: 8px; background: none;
  font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.kind-tabs button span { font-size: 11px; font-weight: 600; opacity: .75; font-variant-numeric: tabular-nums; }
.kind-tabs button:hover { color: var(--ink); }
.kind-tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(18, 26, 46, .15); }
.kind-tabs.small { display: flex; margin-bottom: 0; }
.kind-tabs.small button { font-size: 12px; padding: 4px 10px; }
.bank-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.bank-tab { display: flex; flex-direction: column; align-items: flex-start; min-width: 62px; padding: 6px 12px 7px; border-radius: 10px; cursor: pointer;
  font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); line-height: 1.2; }
.bank-tab b { font-size: 17px; }
.bank-tab span { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bank-tab.all b { font-size: 14px; padding: 2px 0 1px; }
.bank-tab:hover { border-color: var(--primary); }
.bank-tab[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.bank-tab[aria-selected="true"] span { color: inherit; opacity: .85; }
.grid-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 12px;
  padding-top: 12px; border-top: 1px solid var(--line); }
.grid-head b { font-size: 16px; margin-right: 10px; }
.grid-tools { display: flex; gap: 8px; align-items: center; }
.density { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.density button { width: 32px; height: 30px; border: 0; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 15px; }
.density button + button { border-left: 1px solid var(--line-strong); }
.density button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); }

/* slot tiles */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; }
.slot { position: relative; display: flex; flex-direction: column; gap: 1px; min-height: 60px; padding: 7px 9px 7px 12px; text-align: left;
  font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
  user-select: none; overflow: hidden; transition: transform .08s, box-shadow .12s, opacity .15s, border-color .12s; }
.slot::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cat, var(--line-strong)); }
.slot[draggable="true"] { cursor: grab; }
.slot .n { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.slot b { font-size: 13px; font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot small { font-size: 11px; color: color-mix(in srgb, var(--cat, var(--muted)) 75%, var(--muted)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slot .uses-n { position: absolute; top: 6px; right: 7px; font-style: normal; font-size: 10px; font-weight: 800; color: var(--primary);
  background: var(--primary-soft); border-radius: 999px; padding: 0 6px; line-height: 16px; }
.slot.empty { background: transparent; border-style: dashed; }
.slot.empty::before { display: none; }
.slot.empty b { color: var(--faint); font-weight: 500; font-style: italic; }
.slot:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(18, 26, 46, .08); }
.slot:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.slot.sel { background: var(--primary-soft); border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.slot.dim { opacity: .25; }
.slot.match { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 60%, var(--surface-2)); }
.slot.match.sel { border-color: var(--primary); }
.slot.over { transform: scale(1.04); box-shadow: 0 0 0 3px var(--accent); background: var(--accent-soft); z-index: 1; }
.slot.dragging { opacity: .4; }
.slot-grid.compact { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 4px; }
.slot-grid.compact .slot { min-height: 38px; padding: 4px 7px 4px 10px; flex-direction: row; align-items: center; gap: 6px; }
.slot-grid.compact .slot small { display: none; }
.slot-grid.compact .slot b { font-size: 12px; }
.slot-grid.compact .uses-n { position: static; margin-left: auto; }
.grid-sep { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 8px 0 2px; font-size: 12px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.grid-sep:first-child { margin-top: 0; }
.grid-sep span { font-weight: 600; color: var(--faint); }
.grid-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.grid-empty { grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 50px 20px; text-align: center; color: var(--muted); }
.grid-empty b { font-size: 16px; color: var(--ink); }
.grid-empty .linkish { font-size: inherit; padding: 0; }

/* details panel */
.side { position: sticky; top: 84px; max-height: calc(100vh - 96px); overflow: auto; }
.side-tabs { display: flex; gap: 2px; padding: 8px 8px 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.side-tabs button { position: relative; padding: 8px 10px 10px; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.side-tabs button:hover { color: var(--ink); }
.side-tabs button[aria-selected="true"] { color: var(--primary); }
.side-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--primary); }
.side-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.side-body h4 { margin: 10px 0 0; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.side-body p { margin: 0; }
.side-body .small, .hint.small { font-size: 12px; }
.side .dname { margin: 0; font-size: 20px; }
.d-head { display: flex; gap: 12px; align-items: center; }
.slot-big { display: grid; place-items: center; min-width: 64px; height: 52px; padding: 0 8px; border-radius: 12px; font-size: 18px; font-weight: 800;
  font-variant-numeric: tabular-nums; color: var(--cat, var(--primary)); background: color-mix(in srgb, var(--cat, var(--primary)) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--cat, var(--primary)) 35%, transparent); }
.d-head > div { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.d-head .badge { margin-left: 0; }
.d-uses { display: block; }
.d-empty { display: flex; flex-direction: column; gap: 2px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: 10px; text-align: center; }
.d-empty span { font-size: 13px; color: var(--muted); }
.rename { display: flex; gap: 6px; }
.rename input { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 7px 10px; font-family: ui-monospace, Menlo, monospace; }
.rename input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.d-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.act { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 9px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.act b { font-size: 13px; }
.act span { font-size: 11px; color: var(--muted); line-height: 1.25; }
.act:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.links { margin: 0; padding-left: 16px; font-size: 13px; }
.tips { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); line-height: 1.7; }
.tips b { color: var(--ink); }
.part-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.part-list li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.part-list li[draggable="true"] { cursor: grab; }
.part-list li.off { opacity: .6; }
.part-list .pn { width: 20px; height: 20px; flex: none; display: grid; place-items: center; border-radius: 6px; background: var(--primary-soft);
  color: var(--primary); font-size: 11px; font-weight: 800; }
.part-list .linkish { flex: 1; text-align: left; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-list .pst { font-size: 11px; color: var(--muted); }
.part-list .arrows { display: flex; gap: 2px; margin-left: auto; }
.icon-btn { width: 24px; height: 24px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink);
  cursor: pointer; font-size: 12px; line-height: 1; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.src-row { display: flex; gap: 6px; align-items: center; }
.src-row select { flex: 1; min-width: 0; font: inherit; font-size: 13px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); }
.bank-list { display: flex; flex-wrap: wrap; gap: 6px; }
.bank-btn { display: flex; flex-direction: column; align-items: flex-start; padding: 5px 12px; border-radius: 9px; cursor: pointer;
  font: inherit; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); }
.bank-btn b { font-size: 14px; }
.bank-btn:hover { border-color: var(--primary); }
.bank-btn[aria-selected="true"] { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.slot-grid.src { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
.slot-grid.src .slot { min-height: 44px; }
.slot-grid.src .slot small { display: none; }
.back-grid { display: none; align-self: flex-start; }

/* drop menu, slot picker */
.drop-menu { position: fixed; z-index: 60; width: 270px; display: flex; flex-direction: column; padding: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px rgba(11, 16, 32, .25); }
.drop-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; font: inherit; color: var(--ink); cursor: pointer; text-align: left; }
.drop-menu button span { font-size: 12px; color: var(--muted); }
.drop-menu button:hover { background: var(--primary-soft); }
.drop-menu .cancel { color: var(--muted); font-size: 13px; }
.slot-grid.mini { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); max-height: 55vh; overflow: auto; padding: 2px; }
.slot-grid.mini .slot { min-height: 44px; }
.dialog.wide#picker { width: min(940px, calc(100vw - 24px)); }
.slot-c { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted); white-space: nowrap; }

@media (max-width: 1260px) {
  .bank-view { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; }
  .back-grid { display: inline-flex; }
}
@media (max-width: 900px) {
  .pcg-layout { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; max-height: none; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .filters .search-box, .filters .f-count, .filters #reset { grid-column: 1 / -1; }
  .cat-list { display: flex; flex-wrap: wrap; gap: 4px; }
  .cat-row { width: auto; padding: 4px 9px; border: 1px solid var(--line); }
  .cat-row span { margin-left: 4px; }
  .show-list { display: flex; flex-wrap: wrap; gap: 4px; }
  .show-row { width: auto; padding: 4px 9px; border: 1px solid var(--line); }
  .show-row i { display: none; }
  .show-row span { margin-left: 4px; }
  .cat-row, .show-row { font-size: 12px; }
  .changes { position: static; }
}
@media (max-width: 600px) {
  .filters { grid-template-columns: 1fr; }
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .d-actions { grid-template-columns: 1fr 1fr 1fr; }
  .search-box kbd { display: none; }
}
@media print { .pcg-page .changes, .pcg-page .view-tabs, .pcg-page .bank-view, .pcg-page .filters { display: none !important; }
  .pcg-page .pcg-layout { display: block; } }

/* top bar: PCG Library */
.nav-pcg { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; white-space: nowrap; }
.nav-pcg svg { width: 15px; height: 15px; fill: currentColor; opacity: .9; }
.appbar .version + .nav-pcg { margin-left: 12px; }
@media (max-width: 680px) {
  .appbar .nav-pcg { margin-left: auto; padding: 4px 9px; }
  .nav-pcg span { display: none; }
}

.sng-row { grid-template-columns: auto 1fr auto; }

/* "Beta" tag on the Sequencer link */
.beta-tag { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 1px 5px; border-radius: 5px; background: #ffb43b; color: #1b2457; line-height: 1.4; }
