@font-face { font-family: "Schola"; src: url(/static/fonts/texgyreschola-regular.otf); font-display: swap; }
@font-face { font-family: "Schola"; font-style: italic; src: url(/static/fonts/texgyreschola-italic.otf); font-display: swap; }
@font-face { font-family: "Schola"; font-weight: bold; src: url(/static/fonts/texgyreschola-bold.otf); font-display: swap; }
@font-face { font-family: "Schola"; font-weight: bold; font-style: italic; src: url(/static/fonts/texgyreschola-bolditalic.otf); font-display: swap; }

:root {
  --bg: #fbf8f3; --paper: #ffffff; --ink: #1f1a17; --muted: #75695f; --line: #e6ded3;
  --accent: #7a1f1f; --accent-ink: #fff; --head: #7a1f1f; --head-ink: #fff; --mark: #f6e3a6; --chip: #f1e9de;
  --ok: #2e7d32; --no: #b3261e; --maybe: #9a6b00;
  --shadow: 0 6px 24px rgba(40,20,10,.12);
  --img-filter: none; --lyr-size: 19px; --score-h: 45vh; --header-h: 60px; --nav-h: 0px;
  --serif: "Schola", "Century Schoolbook", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --p-introit: #2e7d32; --p-offertorium: #c62828; --p-communio: #9e9e9e; --p-adoracio: #1565c0; --p-exodus: #6d4c41;
  --p-ordinarium: #b8860b; --p-psalm: #7b1fa2; --p-other: #757575;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14110f; --paper: #1c1815; --ink: #ece4da; --muted: #a39686; --line: #332c26;
    --accent: #d27a6a; --accent-ink: #14110f; --head: #3a1616; --head-ink: #f3e7dc; --mark: #5b4a1a; --chip: #2a241f;
    --ok: #81c784; --no: #f2b8b5; --maybe: #e6c06a; --shadow: 0 6px 24px rgba(0,0,0,.5);
    --img-filter: invert(.9) sepia(.15);
  }
}
:root[data-theme="dark"] {
  --bg: #14110f; --paper: #1c1815; --ink: #ece4da; --muted: #a39686; --line: #332c26;
  --accent: #d27a6a; --accent-ink: #14110f; --head: #3a1616; --head-ink: #f3e7dc; --mark: #5b4a1a; --chip: #2a241f;
  --ok: #81c784; --no: #f2b8b5; --maybe: #e6c06a; --shadow: 0 6px 24px rgba(0,0,0,.5);
  --img-filter: invert(.9) sepia(.15);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.4; padding-bottom: var(--nav-h); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- header & navigation (tablet first) ---------- */
#top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  min-height: var(--header-h); padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  background: var(--head); color: var(--head-ink);
}
.brand { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; flex: none; }
.brand svg, .iconbtn svg { width: 24px; height: 24px; fill: currentColor; }
.scholabtn {
  background: none; border: 0; text-align: left; padding: 4px 8px; border-radius: 10px; cursor: pointer; min-width: 0;
  display: flex; flex-direction: column; line-height: 1.15; max-width: 34vw;
}
.scholabtn:hover { background: rgba(255,255,255,.1); }
.sname { font-family: var(--serif); font-weight: bold; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srole { font-size: 12px; opacity: .8; }
.nav { flex: 1; display: flex; gap: 2px; justify-content: center; min-width: 0; }
.nav a {
  display: flex; align-items: center; gap: 7px; padding: 9px 12px; border-radius: 10px; text-decoration: none;
  font-size: 15px; white-space: nowrap; opacity: .85;
}
.nav a svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
.nav a:hover { background: rgba(255,255,255,.1); opacity: 1; }
.nav a.on { background: rgba(255,255,255,.18); opacity: 1; font-weight: 600; }
.iconbtn { background: none; border: 0; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; cursor: pointer; flex: none; color: inherit; }
.iconbtn:hover { background: rgba(255,255,255,.12); }
.popmenu {
  position: absolute; right: 10px; top: calc(100% - 2px); background: var(--paper); color: var(--ink);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 250px; display: flex; flex-direction: column; z-index: 40;
}
.popmenu.left { right: auto; left: 56px; }
.popmenu .who { padding: 10px 12px 8px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; word-break: break-all; }
.popmenu a, .popmenu button { text-align: left; padding: 12px; border-radius: 9px; text-decoration: none; background: none; border: 0; cursor: pointer; font-size: 15px; }
.popmenu a:hover, .popmenu button:hover { background: var(--chip); }
.popmenu .on { font-weight: 700; color: var(--accent); }
.popmenu small { display: block; color: var(--muted); font-size: 12px; }

@media (max-width: 1100px) {
  :root { --nav-h: calc(62px + env(safe-area-inset-bottom)); }
  .scholabtn { max-width: none; flex: 1; }
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--paper); color: var(--ink);
    border-top: 1px solid var(--line); justify-content: space-around; gap: 0; height: var(--nav-h);
    padding: 4px 4px env(safe-area-inset-bottom); box-shadow: 0 -2px 12px rgba(0,0,0,.06);
  }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 4px; flex: 1; justify-content: center; min-width: 0; opacity: .7; }
  .nav a svg { width: 24px; height: 24px; }
  .nav a:hover { background: none; }
  .nav a.on { background: none; color: var(--accent); opacity: 1; }
  .nav a span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
}
@media (min-width: 641px) and (max-width: 1100px) {
  .nav a { flex-direction: row; font-size: 14px; gap: 8px; }
}
@media (max-width: 640px) { :root { --header-h: 54px; } }

.offline { background: var(--mark); color: var(--ink); text-align: center; font-size: 14px; padding: 7px 12px; }

/* ---------- generic page parts ---------- */
.page { max-width: 920px; margin: 0 auto; padding: 18px 20px 60px; }
.pagehead { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin: 6px 0 16px; }
.pagehead h1 { font-family: var(--serif); font-size: 30px; line-height: 1.1; margin: 0; flex: 1; min-width: 200px; }
.pagehead .sub { color: var(--muted); font-size: 14px; width: 100%; margin-top: -8px; }
h2 { font-family: var(--serif); font-size: 21px; margin: 26px 0 10px; }
.hint { color: var(--muted); font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; background: var(--paper); border: 1px dashed var(--line); border-radius: 16px; }
.loading { text-align: center; color: var(--muted); padding: 60px 16px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 9px 16px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--paper); cursor: pointer; font-size: 15px; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--chip); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--no); }
.btn.small { min-height: 36px; padding: 5px 12px; font-size: 14px; }
.btn svg { width: 18px; height: 18px; fill: currentColor; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }
.field { display: block; margin: 14px 0; }
.field > span { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 16px;
}
textarea { min-height: 70px; resize: vertical; }
.box { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--nav-h)); transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 11px 18px; border-radius: 11px; z-index: 60; font-size: 15px; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.pill { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }

/* volume/page badge for the paper songbook */
.tp {
  display: inline-flex; align-items: baseline; gap: 4px; flex: none; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 15px;
  padding: 4px 10px; border-radius: 9px; background: var(--chip); color: var(--ink); white-space: nowrap; font-family: var(--sans);
}
.tp small { font-weight: 500; color: var(--muted); font-size: 12px; }

/* ---------- plan cards (week, plan view) ---------- */
.plans { display: grid; gap: 18px; }
.plan { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.plan-h { display: flex; align-items: center; gap: 12px; padding: 14px 18px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.plan-h .d { flex: 1; min-width: 180px; }
.plan-h .day { font-family: var(--serif); font-weight: bold; font-size: 22px; line-height: 1.15; }
.plan-h .day .rel { font-family: var(--sans); font-weight: 600; font-size: 12px; color: var(--accent); margin-left: 8px; vertical-align: middle;
  text-transform: uppercase; letter-spacing: .05em; }
.plan-h .ttl { color: var(--muted); font-size: 14px; margin-top: 2px; }
.plan-note { padding: 10px 18px; font-size: 15px; background: var(--bg); border-bottom: 1px solid var(--line); white-space: pre-wrap; }
.items { list-style: none; margin: 0; padding: 4px 0; }
.item { display: flex; align-items: center; gap: 14px; padding: 10px 18px; text-decoration: none; min-height: 58px; }
a.item:hover { background: var(--chip); }
.item + .item { border-top: 1px solid var(--line); }
.item .part { width: 128px; flex: none; font-size: 12.5px; color: var(--muted); font-variant: small-caps; text-transform: lowercase; letter-spacing: .03em;
  display: flex; align-items: center; gap: 7px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--p-other); }
.dot.introit { background: var(--p-introit); } .dot.offertorium { background: var(--p-offertorium); }
.dot.communio { background: var(--p-communio); box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); } .dot.adoracio { background: var(--p-adoracio); }
.dot.exodus { background: var(--p-exodus); } .dot.ordinarium { background: var(--p-ordinarium); } .dot.psalm { background: var(--p-psalm); }
.item .main { flex: 1; min-width: 0; }
.item .t { font-family: var(--serif); font-weight: bold; font-size: 18px; line-height: 1.25; }
.item .n { font-size: 14px; color: var(--muted); font-style: italic; margin-top: 2px; white-space: pre-wrap; }
.item .nomusic { font-size: 12px; color: var(--muted); }
.item .go { width: 20px; height: 20px; fill: var(--muted); flex: none; }
.att { display: flex; gap: 6px; flex-wrap: wrap; }
.att button {
  border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 7px 13px; cursor: pointer; font-size: 14px; min-height: 38px;
  display: inline-flex; align-items: center; gap: 6px;
}
.att button b { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.att button.on.tak { background: var(--ok); border-color: var(--ok); color: #fff; }
.att button.on.nie { background: var(--no); border-color: var(--no); color: #fff; }
.att button.on.moze { background: var(--maybe); border-color: var(--maybe); color: #fff; }
.att button.on b { color: inherit; }
.plan-f { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 14px 12px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .page { padding: 14px 12px 40px; }
  .pagehead h1 { font-size: 25px; }
  .item { flex-wrap: wrap; gap: 4px 10px; padding: 10px 14px; }
  .item .part { width: 100%; }
  .plan-h { padding: 12px 14px; }
}

/* plan list (history) */
.plist { display: grid; gap: 8px; }
.prow { display: flex; gap: 14px; align-items: center; padding: 12px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.prow:hover { background: var(--chip); }
.prow .date { width: 92px; flex: none; font-variant-numeric: tabular-nums; }
.prow .date b { display: block; font-size: 17px; }
.prow .date small { color: var(--muted); font-size: 12px; }
.prow .songs { flex: 1; min-width: 0; font-family: var(--serif); font-size: 15px; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.prow .songs b { color: var(--ink); font-family: var(--sans); font-size: 14px; }
.prow.future { border-color: var(--accent); }

/* ---------- songbook (search + contents) ---------- */
.searchbox { position: relative; }
.searchbox input { padding-left: 42px; height: 52px; font-size: 18px; border-radius: 14px; }
.searchbox svg { position: absolute; left: 13px; top: 15px; width: 22px; height: 22px; fill: var(--muted); }
.results { margin-top: 10px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.res { display: flex; gap: 12px; align-items: center; padding: 11px 16px; text-decoration: none; border-bottom: 1px solid var(--line); cursor: pointer; }
.res:last-child { border-bottom: 0; }
.res:hover, .res.sel { background: var(--chip); }
.res .t { font-family: var(--serif); font-size: 18px; font-weight: bold; }
.res .c { font-size: 12.5px; color: var(--muted); margin-top: 2px; text-transform: lowercase; font-variant: small-caps; letter-spacing: .02em; }
.res .s { font-family: var(--serif); font-size: 15px; color: var(--muted); margin-top: 3px; }
.res .stat { font-size: 12px; color: var(--accent); margin-top: 2px; }
.res-empty { text-align: center; color: var(--muted); padding: 26px 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.card { display: flex; gap: 8px; align-items: flex-start; padding: 12px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 13px; text-decoration: none; }
.card .t { font-family: var(--serif); font-weight: bold; font-size: 16px; flex: 1; }
.part-h { font-family: var(--serif); font-size: 15px; color: var(--accent); letter-spacing: .06em; margin: 26px 0 8px; }
details.chap { background: var(--paper); border: 1px solid var(--line); border-radius: 13px; margin-bottom: 8px; }
details.chap summary { padding: 14px 16px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
details.chap summary::-webkit-details-marker { display: none; }
details.chap summary .n { color: var(--muted); font-weight: normal; font-size: 13px; }
details.chap ol { margin: 0; padding: 0 0 8px; list-style: none; }
details.chap li a { display: flex; gap: 10px; align-items: center; padding: 9px 16px 9px 22px; text-decoration: none; font-family: var(--serif); font-size: 16px; }
details.chap li a span { flex: 1; }
details.chap li a .tp { font-size: 12.5px; padding: 2px 8px; }
details.chap li a:hover { background: var(--chip); }
details.chap li.grp { padding: 10px 16px 2px; font-size: 12px; color: var(--muted); letter-spacing: .05em; }
details.chap li.sub a { padding-left: 34px; }

/* ---------- song ---------- */
.song { max-width: 920px; margin: 0 auto; background: var(--paper); min-height: calc(100vh - var(--header-h) - var(--nav-h)); }
.songbar {
  position: sticky; top: var(--header-h); z-index: 10; display: flex; align-items: center; gap: 4px; padding: 6px 8px;
  background: var(--paper); border-bottom: 1px solid var(--line);
}
.songbar .grow .ttl { font-family: var(--serif); font-weight: bold; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.songbar .grow .ctx { font-size: 11.5px; color: var(--muted); padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb { background: none; border: 1px solid transparent; height: 42px; min-width: 42px; padding: 0 9px; border-radius: 10px; cursor: pointer; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; text-decoration: none; color: var(--ink); flex: none; }
.tb:hover { background: var(--chip); }
.tb.on { background: var(--accent); color: var(--accent-ink); }
.tb[disabled] { opacity: .3; pointer-events: none; }
.tb svg { width: 22px; height: 22px; fill: currentColor; }
.tb .lbl { font-size: 13px; }
@media (max-width: 700px) { .tb .lbl { display: none; } .tb { min-width: 38px; padding: 0 6px; } }
.songhead { padding: 18px 20px 6px; display: flex; gap: 14px; align-items: flex-start; }
.songhead .grow > .grp { font-size: 12px; color: var(--muted); letter-spacing: .05em; }
.songhead h1 { font-family: var(--serif); font-size: 27px; line-height: 1.2; margin: 4px 0 2px; }
.songhead .ch { font-size: 12.5px; color: var(--muted); font-variant: small-caps; text-transform: lowercase; letter-spacing: .03em; }
.songhead .tp { font-size: 17px; padding: 6px 12px; margin-top: 6px; }
.songnote { margin: 4px 20px 6px; padding: 9px 13px; background: var(--chip); border-radius: 10px; font-size: 15px; white-space: pre-wrap; }
.score { padding: 4px 8px 0; }
.score img { display: block; width: 100%; height: auto; filter: var(--img-filter); }
.score img.ornament { width: 60%; margin: 10px auto; }
.lyrics { padding: 8px 20px 60px; }
.flow { font-family: var(--serif); font-size: var(--lyr-size); line-height: 1.38; }
.flow img { filter: var(--img-filter); max-width: 100%; height: auto; }
.lyrics .flow { column-width: 17em; column-gap: 2.2em; }
.flow p { margin: 0; }
.flow .strofa { break-inside: avoid; margin: 0 0 .9em; padding-left: 1.6em; }
.flow .Body-Strofa, .flow .Body-Strofa-bezswiatla { text-indent: -1.6em; }
.flow .noinden, .flow .noinden3 { text-indent: 0; }
.flow .noinden3 { padding-left: 1em; }
.flow .margines20em { padding-left: 2em; }
.flow .margines40em { padding-left: 4em; }
.flow .noindent, .flow .noinden1 { text-indent: 0; }
.flow .space-before { margin-top: .7em; }
.flow .space-after { margin-bottom: .7em; }
.flow .space { margin: .4em 0; }
.flow .kyrie { margin-top: .6em; }
.flow .smaller { font-size: .78em; }
.flow .small { font-size: .88em; }
.flow .large { font-size: 1.12em; }
.flow .italic, .flow em { font-style: italic; }
.flow .bold, .flow strong { font-weight: bold; }
.flow .underline { text-decoration: underline; text-underline-offset: 2px; }
.flow .szary { color: var(--muted); }
.flow .centerit, .flow .a1, .flow .a2, .flow .a3, .flow .IKOS, .flow .Kontakion, .flow .stasis { text-align: center; text-indent: 0; margin: .6em 0; }
.flow .a3, .flow .a2 { font-size: .85em; }
.flow .IKOS, .flow .Kontakion, .flow .stasis { font-weight: bold; font-size: .9em; letter-spacing: .04em; }
.flow .toright { text-align: right; }
.flow .lektor { padding-left: 5em; text-indent: -5em; }
.flow .indent-inv { padding-left: 1em; text-indent: -1em; }
.flow table { border-collapse: collapse; width: 100%; margin: .5em 0; break-inside: avoid; }
.flow td { vertical-align: top; padding: 0 .6em .4em 0; }
.flow .wtabeli, .flow .wtabeliswiatlo { text-indent: 0; }
.flow .wtabeliswiatlo { margin-top: .6em; }
.flow .tytsec2, .flow .subtitle2, .flow .tytsek, .flow .tytsekT1 { font-weight: bold; text-indent: 0; margin: .8em 0 .4em; }
.score .flow { padding: 8px 12px; }
.songnav { display: flex; justify-content: space-between; gap: 10px; padding: 18px 20px 40px; border-top: 1px solid var(--line); }
.songnav a { text-decoration: none; font-size: 14px; color: var(--muted); max-width: 48%; }
.songnav a b { display: block; font-family: var(--serif); color: var(--ink); font-size: 16px; }
.songnav a.nx { text-align: right; margin-left: auto; }
.blocked { max-width: 560px; margin: 60px auto; text-align: center; padding: 30px 20px; }
.blocked h1 { font-family: var(--serif); }

/* pinned mode: score on top (own scroll), lyrics scroll independently below */
body.pinned { overflow: hidden; }
body.pinned .song { display: flex; flex-direction: column; height: calc(100dvh - var(--header-h) - var(--nav-h) - env(safe-area-inset-top)); min-height: 0; }
body.pinned .songbar { position: static; }
body.pinned .songhead, body.pinned .songnote { display: none; }
body.pinned .score { height: var(--score-h); overflow-y: auto; flex: none; border-bottom: 1px solid var(--line); overscroll-behavior: contain; }
body.pinned .lyrics { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-top: 12px; }
body.pinned .songnav { display: none; }
.resizer { display: none; }
body.pinned .resizer {
  display: flex; align-items: center; justify-content: center; flex: none; height: 24px; cursor: row-resize; touch-action: none;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.resizer i { width: 46px; height: 5px; border-radius: 5px; background: var(--muted); opacity: .5; }

/* ---------- plan editor ---------- */
.editor .meta { display: grid; grid-template-columns: 200px 1fr; gap: 0 14px; }
@media (max-width: 640px) { .editor .meta { grid-template-columns: 1fr; } }
.eitems { display: grid; gap: 10px; margin: 8px 0 14px; }
.eitem { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; display: grid;
  grid-template-columns: 170px 1fr auto; gap: 8px 12px; align-items: center; }
.eitem .song-t { font-family: var(--serif); font-weight: bold; font-size: 17px; }
.eitem .song-t small { display: block; font-family: var(--sans); font-weight: normal; font-size: 12px; color: var(--accent); }
.eitem .ctl { display: flex; gap: 2px; }
.eitem .ctl button { width: 40px; height: 40px; border: 0; background: none; border-radius: 9px; cursor: pointer; font-size: 18px; color: var(--muted); }
.eitem .ctl button:hover { background: var(--chip); color: var(--ink); }
.eitem .free { display: grid; grid-template-columns: 1fr 70px 80px; gap: 8px; }
.eitem .note { grid-column: 2 / 4; }
.eitem input, .eitem select { min-height: 42px; padding: 8px 10px; font-size: 15px; }
@media (max-width: 640px) {
  .eitem { grid-template-columns: 1fr auto; }
  .eitem .partcell { grid-column: 1 / 2; }
  .eitem .songcell { grid-column: 1 / 3; }
  .eitem .note { grid-column: 1 / 3; }
  .eitem .ctl { grid-row: 1; grid-column: 2; }
}
.picker { background: var(--paper); border: 2px solid var(--accent); border-radius: 14px; padding: 12px; }
.picker .results { max-height: 50vh; overflow-y: auto; }
.picker .row > select { width: 190px; flex: none; }

/* ---------- attendance grid ---------- */
.gridwrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: 16px; }
table.grid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14px; }
table.grid th, table.grid td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid th.name, table.grid td.name { text-align: left; padding-left: 14px; position: sticky; left: 0; background: var(--paper); z-index: 1; min-width: 130px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
table.grid thead th { font-weight: 600; font-size: 12.5px; color: var(--muted); }
table.grid thead th b { display: block; color: var(--ink); font-size: 14px; }
table.grid tr.me td { background: var(--bg); }
table.grid tr.me td.name { font-weight: 700; background: var(--bg); }
table.grid tfoot td { font-weight: 600; color: var(--muted); border-bottom: 0; }
.mk { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; font-weight: 700; border: 1px solid transparent; }
.mk.tak { background: var(--ok); color: #fff; } .mk.nie { background: var(--no); color: #fff; } .mk.moze { background: var(--maybe); color: #fff; }
button.mk { cursor: pointer; border-color: var(--line); background-color: var(--paper); font-size: 15px; }
button.mk.tak { background: var(--ok); } button.mk.nie { background: var(--no); } button.mk.moze { background: var(--maybe); }

/* ---------- members ---------- */
.mlist { display: grid; gap: 8px; }
.mrow { display: flex; gap: 12px; align-items: center; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; flex-wrap: wrap; }
.mrow .who { flex: 1; min-width: 180px; }
.mrow .who b { display: block; }
.mrow .who small { color: var(--muted); word-break: break-all; }
.mrow select { width: auto; min-width: 190px; min-height: 40px; padding: 6px 10px; }
.invites .mrow code { font-size: 13px; word-break: break-all; background: var(--chip); padding: 3px 6px; border-radius: 6px; }

.tip { display: flex; gap: 12px; align-items: flex-start; background: var(--chip); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; }
.tip .grow b { display: block; margin-bottom: 2px; font-size: 15px; }
.tip button { background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--muted); }
