@font-face {
  font-family: Akatab;
  src: url("../fonts/akatab/Akatab-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Akatab;
  src: url("../fonts/akatab/Akatab-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: Akatab;
  src: url("../fonts/akatab/Akatab-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: Akatab;
  src: url("../fonts/akatab/Akatab-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #050a0f;
  --bg-deep: #020609;
  --surface: #0b131b;
  --surface-2: #0e1821;
  --surface-3: #111d27;
  --soft: #081017;
  --line: #1c2b36;
  --line-strong: #2c404e;
  --text: #f3f7f8;
  --muted: #8e9ca6;
  --muted-2: #647681;
  --teal: #10d1c2;
  --teal-bright: #54e8dd;
  --teal-deep: #087e78;
  --blue: #1696ff;
  --danger: #ff5261;
  --warning: #ffc21a;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 7px;
  font-family: Akatab, ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
[hidden]{display:none!important}

.sr-only {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

html,
body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 15% -8%, rgba(20, 148, 171, .13), transparent 32rem),
    radial-gradient(circle at 92% 22%, rgba(16, 209, 194, .055), transparent 25rem),
    linear-gradient(180deg, #061019 0, var(--bg) 32rem);
  color: var(--text);
}

body,
button,
input { font: inherit; }

body.pdf-modal-open { overflow: hidden; }

button { color: inherit; }
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: .5rem;
  left: -9999px;
  z-index: 1000;
}

.skip-link:focus {
  left: .75rem;
  padding: .65rem 1rem;
  border-radius: 10px;
  background: var(--teal);
  color: #02110f;
}

.topbar {
  min-height: 76px;
  position: sticky;
  top: 0;
  z-index: 80;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .8rem;
  padding: 0 max(1rem, calc((100% - 1440px) / 2));
  border-bottom: 1px solid rgba(135, 177, 197, .13);
  background: rgba(3, 9, 14, .88);
  box-shadow: 0 10px 35px rgba(0, 0, 0, .2);
  backdrop-filter: blur(22px) saturate(140%);
}

.brand {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: .72rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1.03rem;
  font-weight: 650;
  letter-spacing: -.015em;
}

.brand > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  flex: 0 0 auto;
  padding: 8px 7px;
  border: 1px solid rgba(16, 209, 194, .32);
  border-radius: 7px;
  background: rgba(16, 209, 194, .08);
  box-shadow: inset 0 0 18px rgba(16, 209, 194, .04);
}

.brand-mark span {
  width: 4px;
  border-radius: 5px;
  background: var(--teal);
  box-shadow: 0 0 10px rgba(16, 209, 194, .32);
}

.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 17px; }
.brand-mark span:nth-child(3) { height: 12px; }

.brand-mark.large {
  width: 56px;
  height: 56px;
  margin-bottom: 1.2rem;
  padding: 12px 11px;
  border-radius: 10px;
}

.brand-mark.large span { width: 6px; }
.brand-mark.large span:nth-child(1) { height: 15px; }
.brand-mark.large span:nth-child(2) { height: 28px; }
.brand-mark.large span:nth-child(3) { height: 20px; }

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.icon-button:hover { border-color: var(--line); background: var(--surface); }

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: .55rem;
}

.status-chip {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .88rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(5, 11, 16, .55);
  font-size: .84rem;
  white-space: nowrap;
}

.status-chip i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ffbf5d;
  box-shadow: 0 0 0 4px rgba(255, 191, 93, .09);
}

.status-chip[data-state="online"] { color: var(--teal-bright); }
.status-chip[data-state="online"] i { background: var(--teal); box-shadow: 0 0 0 4px rgba(16, 209, 194, .1), 0 0 14px rgba(16, 209, 194, .35); }
.status-chip[data-state="offline"] { color: #ff9da6; }
.status-chip[data-state="offline"] i { background: var(--danger); box-shadow: 0 0 0 4px rgba(255, 82, 97, .1); }
.status-chip[data-state="working"] i { animation: pulse 1s ease-in-out infinite; }

.overflow-button {
  width: 40px;
  color: #dbe5e8;
  font-size: 1rem;
  letter-spacing: 2px;
  writing-mode: vertical-rl;
}

.room-menu {
  width: min(280px, calc(100vw - 2rem));
  position: absolute;
  top: calc(100% + .65rem);
  right: 0;
  z-index: 90;
  padding: .65rem;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(10, 18, 25, .98);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .5);
}

.room-menu-copy {
  display: grid;
  gap: .15rem;
  padding: .55rem .65rem .8rem;
  border-bottom: 1px solid var(--line);
}

.room-menu-copy span { color: var(--muted); font-size: .78rem; }

.room-menu-action {
  width: 100%;
  margin-top: .45rem;
  padding: .7rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #ff9aa4;
  text-align: left;
  cursor: pointer;
}

.room-menu-action:hover { background: rgba(255, 82, 97, .09); }
.room-menu-action.refresh-sync-button,
.room-menu-action.create-pdf-button,
.room-menu-action.library-menu-button { color: var(--teal-bright); }
.room-menu-action.refresh-sync-button:hover,
.room-menu-action.create-pdf-button:hover,
.room-menu-action.library-menu-button:hover { background: rgba(16, 209, 194, .08); }

.library-modal-backdrop { display: grid; place-items: center; position: fixed; inset: 0; z-index: 930; padding: 1rem; background: rgba(0, 0, 0, .72); backdrop-filter: blur(4px); }
.library-dialog { width: min(780px, 100%); max-height: min(820px, calc(100vh - 2rem)); display: flex; flex-direction: column; overflow: hidden; border: 1px solid rgba(89, 126, 139, .65); border-radius: 12px; background: #081116; box-shadow: 0 24px 80px rgba(0, 0, 0, .55); }
.library-dialog-header { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); background: #0b171d; }
.library-dialog-header .eyebrow { margin: 0 0 .12rem; }
.library-dialog-header h2 { margin: 0; color: #fff; font-size: 1.35rem; }
.library-close-button { width: 36px; height: 36px; flex: 0 0 36px; border: 0; border-radius: 6px; background: transparent; color: #d7e3e7; font-size: 1.65rem; cursor: pointer; }
.library-close-button:hover { background: rgba(255,255,255,.08); color: #fff; }
.library-read-only { margin: 0; padding: .75rem 1rem 0; color: var(--muted); font-size: .82rem; }
.library-search-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; gap: .65rem; padding: .8rem 1rem; }
.library-search-grid label { min-width: 0; display: grid; gap: .3rem; color: #afc0c7; font-size: .72rem; font-weight: 600; }
.library-search-grid input { width: 100%; height: 40px; padding: 0 .72rem; border: 1px solid #29414b; border-radius: 7px; background: #050c10; color: #fff; font: inherit; }
.library-search-grid input:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 2px rgba(16,209,194,.12); }
.library-manage-tags { height: 40px; white-space: nowrap; }
.library-active-filters { display: flex; flex-wrap: wrap; gap: .4rem; min-height: 0; padding: 0 1rem; }
.library-filter-pill { display: inline-flex; align-items: center; gap: .35rem; min-height: 27px; padding: .2rem .35rem .2rem .58rem; border: 1px solid rgba(16,209,194,.38); border-radius: 999px; background: rgba(16,209,194,.08); color: #dffbf8; font-size: .73rem; }
.library-filter-pill strong { font-size: .7rem; }
.library-filter-pill button { width: 20px; height: 20px; border: 0; border-radius: 50%; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; }
.library-clear-filters { border-color: rgba(255,82,97,.42); background: rgba(255,82,97,.1); color: #ffb0b8; cursor: pointer; }
.library-tag-browser { margin: .7rem 1rem 0; padding: .75rem; border: 1px solid #29414b; border-radius: 8px; background: #071015; }
.library-tag-browser > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: .6rem; }
.library-tag-browser > div:first-child span { color: var(--muted); font-size: .72rem; }
#library-tag-index { display: grid; gap: .55rem; max-height: 180px; overflow-y: auto; scrollbar-color: #fff #101b20; }
.library-tag-index-row { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem; }
.library-tag-index-row > button { border: 0; background: transparent; color: var(--teal-bright); font-weight: 700; cursor: pointer; text-decoration: underline; }
.library-tag-value { padding: .22rem .45rem; border: 1px solid #314751; border-radius: 999px; background: #0d1b21; color: #fff; font-size: .72rem; cursor: pointer; }
.library-status { min-height: 1.2rem; margin: .45rem 1rem 0; }
.library-scenes { display: grid; gap: .6rem; min-height: 120px; padding: .35rem 1rem 1rem; overflow-y: auto; scrollbar-color: #fff #101b20; }
.library-scene-card { display: grid; grid-template-columns: 5px minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .72rem; border: 1px solid color-mix(in srgb, var(--library-scene-color) 54%, #263b44); border-radius: 8px; background: color-mix(in srgb, var(--library-scene-color) 15%, #091217); }
.library-scene-accent { align-self: stretch; border-radius: 999px; background: var(--library-scene-color); }
.library-scene-copy { min-width: 0; }
.library-scene-copy h3 { margin: 0; overflow: hidden; color: #fff; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.library-scene-copy p { margin: .15rem 0 .38rem; color: var(--muted); font-size: .75rem; }
.library-scene-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.library-scene-tags span { padding: .15rem .38rem; border-radius: 999px; background: rgba(255,255,255,.07); color: #c9d8de; font-size: .65rem; }
.library-add-button { min-width: 126px; }
.library-empty { padding: 2.4rem 1rem; color: var(--muted); text-align: center; }

@media (max-width: 680px) {
  .library-modal-backdrop { padding: .4rem; }
  .library-dialog { max-height: calc(100vh - .8rem); border-radius: 9px; }
  .library-search-grid { grid-template-columns: 1fr; }
  .library-manage-tags { width: 100%; }
  .library-scene-card { grid-template-columns: 4px minmax(0, 1fr); }
  .library-add-button { grid-column: 2; width: 100%; }
}

.page-shell {
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.55rem 0 7.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  margin: .2rem 0 1rem;
  padding: .45rem .15rem;
  border: 0;
  background: transparent;
  color: var(--teal-bright);
  font-weight: 500;
  cursor: pointer;
}

.back-link span { font-size: 1.25rem; transition: transform .15s ease; }
.back-link:hover span { transform: translateX(-3px); }

.event-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 410px);
  align-items: stretch;
  gap: 1rem;
  margin-bottom: 1rem;
}

.event-copy,
.presence-card,
.timeline-card,
.sidebar-card,
.sync-dock {
  border: 1px solid rgba(106, 144, 162, .16);
  background:
    linear-gradient(135deg, rgba(17, 29, 39, .92), rgba(7, 14, 20, .96)),
    var(--surface);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .18), inset 0 1px rgba(255, 255, 255, .015);
}

.event-copy {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: var(--radius-lg);
}

.eyebrow {
  margin: 0;
  color: var(--teal);
  font-size: .69rem;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.event-copy h1 {
  margin: .35rem 0 .6rem;
  font-size: clamp(2rem, 5vw, 3.75rem);
  font-weight: 650;
  line-height: .98;
  letter-spacing: -.045em;
}

body[data-view="song"] .event-copy h1 { font-size: clamp(1rem, 2.5vw, 1.875rem); }

.event-facts,
.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem 1rem;
}

body[data-view="song"] .event-copy .eyebrow,
body[data-view="song"] .event-copy .event-facts span,
body[data-view="song"] .event-copy .event-facts i,
body[data-view="song"] .event-copy .event-meta,
body[data-view="song"] .event-copy .event-meta span {
  color: #fff;
}

.event-facts span {
  display: inline-flex;
  align-items: center;
  gap: .38rem;
  color: #d9e4e7;
  font-size: .88rem;
}

.event-facts i {
  color: var(--muted);
  font-style: normal;
  font-size: .92rem;
}

.song-key-button {
  min-height: 26px;
  padding: .12rem .48rem;
  border: 1px solid rgba(47, 210, 190, .42);
  border-radius: 999px;
  background: rgba(47, 210, 190, .09);
  color: #91eee1;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
}

.song-key-button:hover,
.song-key-button:focus-visible {
  border-color: var(--teal);
  background: rgba(47, 210, 190, .17);
  color: #c4fff7;
  outline: none;
}

.song-key-menu {
  width: 190px;
  position: fixed;
  z-index: 260;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .3rem;
  padding: .45rem;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #13212b;
  box-shadow: 0 18px 52px rgba(0, 0, 0, .52);
}

.song-key-menu button {
  min-height: 32px;
  padding: .25rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, .045);
  color: var(--text);
  font-size: .8rem;
  cursor: pointer;
}

.song-key-menu button:hover,
.song-key-menu button:focus-visible {
  border-color: var(--teal);
  outline: none;
}

.song-key-menu button.selected {
  border-color: rgba(47, 210, 190, .72);
  background: rgba(47, 210, 190, .18);
  color: #aff8ee;
}

.event-meta {
  margin: .72rem 0 0;
  color: var(--muted-2);
  font-size: .77rem;
}

.presence-card {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
}

.presence-title,
.sidebar-heading,
.arrangement-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.presence-title { color: var(--muted); font-size: .82rem; }
.presence-title strong { color: var(--text); }
.presence-list { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem; }

.person-chip {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .3rem .55rem .3rem .32rem;
  border: 1px solid rgba(83, 120, 137, .32);
  border-radius: 999px;
  background: rgba(6, 12, 18, .62);
  color: #c5d3d8;
  font-size: .76rem;
}

.avatar {
  width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
  flex: unset;
  border: 1px solid hsl(var(--avatar-hue) 75% 58% / .8);
  border-radius: 50%;
  background: hsl(var(--avatar-hue) 48% 26%);
  color: #fff;
  font-size: .42rem;
  font-weight: 700;
  box-shadow: 0 0 0 2px #071018;
}

.avatar.host { border-color: var(--teal); }
.presence-empty { align-self: center; color: var(--muted-2); font-size: .76rem; }

.button {
  min-height: 42px;
  padding: .6rem .95rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  font-weight: 650;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .45; cursor: wait; transform: none; }
.button-primary { background: linear-gradient(135deg, #0cc1b5, #11a9af); color: #02100f; box-shadow: 0 8px 25px rgba(16, 209, 194, .15); }
.button-primary:hover { background: linear-gradient(135deg, #2ce0d3, #18bec4); }
.button-secondary { border-color: var(--line-strong); background: var(--surface); color: var(--text); }
.button-secondary:hover { border-color: #425b6b; background: var(--surface-3); }

.pending-card,
.candidate-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: .95rem 1rem;
  border: 1px solid rgba(255, 194, 26, .36);
  border-radius: var(--radius);
  background: linear-gradient(100deg, rgba(57, 42, 3, .58), rgba(15, 17, 18, .92));
  box-shadow: inset 0 0 40px rgba(255, 194, 26, .025);
}

.pending-card { justify-content: flex-start; }
.pending-card > div,
.candidate-card > div:first-child { display: grid; gap: .12rem; }
.pending-card strong,
.candidate-card strong { font-size: .94rem; }
.pending-card p,
.candidate-card p { margin: 0; color: #c1aa6e; font-size: .8rem; }

.notice-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--warning);
  border-radius: 50%;
  color: var(--warning);
  font-weight: 700;
}

.pending-badge {
  display: none;
  width: max-content;
  color: var(--warning);
  font-size: .67rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.candidate-card {
  border-color: rgba(16, 209, 194, .33);
  background: linear-gradient(100deg, rgba(4, 58, 55, .55), rgba(12, 22, 27, .95));
}

.candidate-card .pending-badge { display: block; color: var(--teal); }
.candidate-card p { color: #9fc7c5; }
.candidate-actions { display: flex; gap: .55rem; flex: 0 0 auto; }

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  align-items: start;
  gap: 1rem;
}
.workspace-grid.sidebar-empty { grid-template-columns: minmax(0, 1fr); }

.timeline-card {
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.15rem 1.3rem;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 13, 19, .38);
}

.section-heading h2,
.sidebar-heading h2,
.arrangement-heading h3 {
  margin: .2rem 0 0;
  font-size: 1.08rem;
  line-height: 1.15;
}

.section-heading > p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.45;
  text-align: right;
}

.timeline-content { min-width: 0; padding: 1rem; }

.setlist-list { display: grid; gap: .6rem; }

.setlist-song {
  min-width: 0;
  display: grid;
  grid-template-columns: 31px 34px minmax(0, 1fr) auto auto 28px;
  align-items: center;
  gap: .68rem;
  padding: .85rem .9rem;
  border: 1px solid var(--line);
  border-left: 3px solid color-mix(in srgb,var(--scene-color) 88%,#fff);
  border-radius: 8px;
  background: rgba(6, 13, 19, .68);
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.setlist-song:hover {
  transform: translateY(-1px);
  border-color: #2e4655;
  border-left-color: color-mix(in srgb,var(--scene-color) 88%,#fff);
  background: rgba(12, 23, 31, .88);
}

.song-number { color: var(--muted-2); font-size: .75rem; font-weight: 650; text-align: center; }
.setlist-song-copy { min-width: 0; }
.setlist-song-copy h3 { margin: 0; overflow: hidden; font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.setlist-song-copy p { display: flex; align-items: center; flex-wrap: wrap; gap: .28rem; margin: .16rem 0 .45rem; color: var(--muted); font-size: .73rem; }

.arrangement-state {
  padding: .24rem .52rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-2);
  font-size: .65rem;
}

.arrangement-state.custom { border-color: rgba(16, 209, 194, .28); background: rgba(16, 209, 194, .07); color: var(--teal-bright); }
.setlist-order-controls { display: flex; gap: .24rem; }

.song-order-button,
.song-drag-handle {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
}

.song-order-button:hover:not(:disabled),
.song-drag-handle:hover { border-color: var(--line-strong); color: var(--text); }
.song-order-button:disabled { opacity: .28; cursor: default; }
.song-drag-handle { cursor: grab; font-size: 1rem; }
.open-song-arrow { color: var(--teal); font-size: 1.15rem; transition: transform .15s ease; }
.setlist-song:hover .open-song-arrow { transform: translateX(3px); }

.song-detail-workspace { display: grid; gap: .9rem; }
.song-timeline-region { min-width: 0; }

.song-timeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .7rem;
  margin-bottom: .55rem;
}

.timeline-zoom-controls {
  display: flex;
  align-items: center;
  gap: 1px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #070d12;
}

.timeline-zoom-button {
  min-width: 84px;
  height: 34px;
  padding: 0 .72rem;
  border: 0;
  background: transparent;
  color: #d7e4e6;
  font-size: .72rem;
  font-weight: 650;
  line-height: 1;
  cursor: pointer;
}

.timeline-zoom-button:hover:not(:disabled) { background: rgba(16, 209, 194, .1); color: var(--teal); }
.timeline-zoom-button:disabled { color: #3c4b53; cursor: default; }

.song-timeline-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #04090d;
  scrollbar-color: #49646d #080d10;
  scrollbar-gutter: stable;
}

.song-timeline-scroll::-webkit-scrollbar { height: 11px; }
.song-timeline-scroll::-webkit-scrollbar-track { background: #080d10; }
.song-timeline-scroll::-webkit-scrollbar-thumb { border: 3px solid #080d10; border-radius: 999px; background: #49646d; }
.song-timeline-scroll:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.song-timeline-surface { min-width: 640px; padding: .65rem; }
.mobile-timeline-scrollbar { display: none; }

.arrangement-lane {
  min-height: 166px;
  display: flex;
  align-items: stretch;
  gap: 1px;
}

.segment {
  min-width: 164px;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 8px;
  background: #151719;
  box-shadow: inset 0 -40px 70px rgba(0, 0, 0, .18);
  cursor: grab;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease, opacity .15s ease;
}

.person-name {
  color: #fff;
  font-weight: 700;
}

.song-timeline-surface .segment {
  min-width: 0;
  flex-basis: 0;
}

.segment:active,
.song-drag-handle:active,
.section-drag-handle:active { cursor: grabbing; }

.segment:hover { transform: translateY(-2px); border-color: rgba(255, 255, 255, .34); }
.segment.selected { border-color: #59c8ff; box-shadow: 0 0 0 2px #159aff, 0 0 28px rgba(21, 154, 255, .34), inset 0 -40px 70px rgba(0, 0, 0, .18); }
.segment-title { display: flex; align-items: baseline; gap: .45rem; padding: .65rem .8rem; background: linear-gradient(145deg, color-mix(in srgb,var(--segment-color) 88%,#fff), color-mix(in srgb, var(--segment-color) 53%, #05090c)); text-shadow: 0 1px 3px rgba(0, 0, 0, .65); }
.segment-title strong { min-width: 0; overflow: hidden; color: #fff; font-size: .95rem; text-overflow: ellipsis; white-space: nowrap; }
.segment-title time { flex: 0 0 auto; color: rgba(255, 255, 255, .82); font-size: .68rem; font-weight: 650; }

.waveform { min-height: 66px; display: flex; align-items: center; gap: 2px; padding: .2rem .75rem; overflow: hidden; }
.waveform i { width: 2px; height: var(--bar); flex: 0 0 2px; border-radius: 3px; background: color-mix(in srgb, var(--segment-color) 42%, #fff); }
.notes-area { min-height: 0; position: relative; margin-top: .65rem; }
.note-track { height: 40px; position: relative; margin-top: .25rem; border-top: 1px dashed rgba(255, 255, 255, .11); }
.note-track-label { width: 96px; position: absolute; top: 7px; left: 0; z-index: 3; overflow: hidden; color: #a9bbc4; font-size: .72rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.note-lane { height: 40px; position: absolute; inset: 0 0 0 100px; }
.note-card { height: 29px; max-width: 250px; position: absolute; top: 4px; z-index: 2; padding: .28rem .5rem; overflow: hidden; border: 1px solid color-mix(in srgb, var(--note-color) 70%, transparent); border-radius: 7px; background: rgba(3, 7, 10, .94); color: var(--note-color); line-height: 1; text-overflow: ellipsis; white-space: nowrap; transform: translateX(-1px); }

.section-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 16, 22, .82);
}

.selected-section-label { min-width: 150px; display: flex; align-items: baseline; gap: .3rem; white-space: nowrap; }
.selected-section-label small { color: var(--muted-2); font-size: .64rem; text-transform: uppercase; letter-spacing: .08em; }
.selected-section-label strong { min-width: 0; overflow: hidden; font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }
.section-actions { display: flex; align-items: center; gap: .35rem; }

.section-actions button {
  min-width: 62px;
  display: grid;
  justify-items: center;
  gap: .18rem;
  padding: .22rem .38rem;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #d8e2e5;
  cursor: pointer;
}

.section-action-icon { width: 21px; height: 21px; display: grid; place-items: center; font-size: 1.05rem; line-height: 1; }
.section-action-icon svg { width: 20px; height: 20px; display: block; }
.section-actions button small { color: inherit; font-size: .66rem; }
.section-actions button:hover:not(:disabled) { border-color: var(--line-strong); background: var(--surface-3); }
.section-actions button.danger { color: var(--danger); }
.section-actions button:disabled { opacity: .28; cursor: default; }

.arrangement-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(7, 14, 20, .78);
}

.arrangement-heading { padding: .9rem 1rem .7rem; }
.arrangement-heading > span { color: var(--muted); font-size: .75rem; }
.arrangement-list { margin: 0; padding: 0 .65rem .65rem; list-style: none; }

.arrangement-row {
  display: grid;
  grid-template-columns: 26px 5px minmax(0, 1fr) auto;
  align-items: start;
  gap: .6rem;
  min-height: 50px;
  padding: .3rem .45rem;
  border-top: 1px solid rgba(94, 125, 140, .12);
  border-radius: 6px;
  transition: background .14s ease, box-shadow .14s ease, opacity .14s ease;
}

.arrangement-row:first-child { border-top-color: transparent; }
.arrangement-row:hover { background: rgba(255, 255, 255, .025); }
.arrangement-row.selected { background: rgba(16, 209, 194, .065); box-shadow: inset 0 0 0 1px rgba(16, 209, 194, .23); }
.section-drag-handle { min-height: 31px; display: grid; place-items: center; color: #6d7d86; font-size: 1rem; cursor: grab; }
.song-drag-handle,
.section-drag-handle { touch-action: none; }
.section-colour { width: 5px; height: 31px; margin-top: .2rem; border-radius: 5px; background: color-mix(in srgb,var(--segment-color) 88%,#fff); }

.arrangement-row-content {
  min-width: 0;
  display: grid;
  gap: .16rem;
  padding: .2rem 0;
  cursor: pointer;
}

.arrangement-row-content:focus-visible { outline: 1px solid var(--teal); outline-offset: 2px; }
.arrangement-row-title { min-width: 0; display: flex; align-items: baseline; justify-content: flex-start; gap: .42rem; }
.arrangement-row-title strong { min-width: 0; overflow: hidden; font-size: .84rem; text-overflow: ellipsis; white-space: nowrap; }
.arrangement-row-title time { flex: 0 0 auto; color: #bbc8cd; font-size: .68rem; font-weight: 600; }
.arrangement-row-notes { min-width: 0; overflow: hidden; }
.arrangement-row-note-stack { min-width: 0; display: grid; gap: 0; }
.arrangement-row .note-track { height: 18px; margin-top: 0; border-top-color: rgba(255, 255, 255, .08); }
.arrangement-row .note-track-label { width: 70px; top: 3px; font-size: .55rem; }
.arrangement-row .note-lane { height: 18px; inset: 0 0 0 72px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; overflow: hidden; }
.arrangement-row .note-card { width: auto; min-width: 0; max-width: none; height: 18px; position: static; padding: 3px .3rem; border-radius: 4px; font-size: .6rem; line-height: 1; transform: none; }
.row-actions { display: flex; gap: .25rem; margin-top: .2rem; opacity: .35; transition: opacity .14s ease; }
.arrangement-row:hover .row-actions,
.arrangement-row.selected .row-actions,
.row-actions:focus-within { opacity: 1; }
.row-actions button { width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--soft); color: var(--muted); cursor: pointer; }
.row-actions button svg { width: 19px; height: 19px; display: block; margin: auto; }
.row-actions button:hover { border-color: var(--line-strong); color: var(--text); }
.row-actions button:last-child:hover { color: var(--danger); }
.arrangement-empty { padding: 1.2rem; color: var(--muted); font-size: .8rem; text-align: center; }

body.is-sorting { user-select: none; overscroll-behavior: none; }
html.is-sorting,
html.is-sorting *,
body.is-sorting,
body.is-sorting * { cursor: grabbing !important; }
.sortable-chosen,
.sortable-dragging,
.sortable-fallback { cursor: grabbing !important; }
.sortable-fallback {
  z-index: 10000 !important;
  opacity: .78 !important;
  pointer-events: none !important;
  transition: none !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .48), 0 0 0 2px rgba(16, 209, 194, .68) !important;
  transform: rotate(.6deg) scale(1.015);
}
.sortable-drop-indicator {
  position: relative !important;
  overflow: visible !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  opacity: 1 !important;
}
.sortable-drop-indicator > * { visibility: hidden !important; }
.sortable-drop-indicator::after {
  content: '';
  position: absolute;
  z-index: 20;
  border-radius: 4px;
  background: var(--teal-bright);
  box-shadow: 0 0 0 1px rgba(1, 17, 16, .9), 0 0 14px rgba(16, 209, 194, .7);
}
.sorting-vertical > .sortable-drop-indicator {
  min-height: 4px !important;
  height: 4px !important;
  margin: 0 !important;
}
.sorting-vertical > .sortable-drop-indicator::after { height: 4px; inset: 0 2px; }
.sorting-horizontal > .sortable-drop-indicator {
  width: 4px !important;
  min-width: 4px !important;
  flex: 0 0 4px !important;
  margin: 0 !important;
}
.sorting-horizontal > .sortable-drop-indicator::after { width: 4px; inset: 2px 0; }

.collab-sidebar {
  min-width: 0;
  position: sticky;
  top: 92px;
  display: grid;
  gap: 1rem;
}

.sidebar-card { overflow: hidden; border-radius: var(--radius); }
.sidebar-heading { padding: .9rem 1rem .75rem; border-bottom: 1px solid var(--line); }
.sidebar-heading h2 { display: flex; align-items: center; gap: .45rem; }

.history-card > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.history-card > summary::-webkit-details-marker { display: none; }
.history-card:not([open]) > summary { border-bottom-color: transparent; }
.history-chevron { color: var(--teal); font-size: 1.15rem; transition: transform .16s ease; }
.history-card[open] .history-chevron { transform: rotate(180deg); }

.count-badge {
  min-width: 23px;
  height: 21px;
  display: inline-grid;
  place-items: center;
  padding: 0 .35rem;
  border-radius: 999px;
  background: #283641;
  color: #d9e3e6;
  font-size: .66rem;
}

.text-button { padding: .3rem; border: 0; background: transparent; color: var(--teal); font-size: .76rem; cursor: pointer; }
.text-button:disabled { color: var(--muted-2); cursor: default; }
.pending-list,
.history-list { max-height: 390px; margin: 0; padding: .45rem .85rem .85rem; overflow: auto; list-style: none; }

.pending-item,
.history-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: .65rem;
  padding: .65rem .2rem;
  border-bottom: 1px solid rgba(98, 129, 144, .12);
}

.pending-item:last-child,
.history-item:last-child { border-bottom: 0; }
.change-icon { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid rgba(16, 209, 194, .26); border-radius: 50%; color: var(--teal); font-size: .9rem; }
.pending-item[data-action="delete"] .change-icon { border-color: rgba(255, 82, 97, .3); color: var(--danger); }
.pending-item[data-action="move"] .change-icon { border-color: rgba(255, 194, 26, .3); color: var(--warning); }
.pending-item strong,
.history-item strong { display: block; font-size: .77rem; line-height: 1.2; }
.pending-item small { display: block; margin-top: .08rem; color: var(--muted); font-size: .67rem; line-height: 1.25; }
.pending-item time,
.history-item time { color: var(--muted-2); font-size: .64rem; white-space: nowrap; }

.history-item { position: relative; grid-template-columns: 31px minmax(0, 1fr) auto; border-radius: 9px; }
.history-item .avatar { width: 29px; height: 29px; flex-basis: 29px; }
.history-item p { margin: .16rem 0 0; color: var(--muted); font-size: .68rem; line-height: 1.3; }
.history-item[data-selectable="true"] { cursor: pointer; }
.history-item[data-selectable="true"]:hover,
.history-item[data-selectable="true"]:focus-visible { padding-right: .45rem; padding-left: .45rem; background: rgba(16, 209, 194, .055); }
.history-item[data-selectable="false"] { opacity: .7; }
.history-item-state { display: inline-flex; margin-top: .28rem; padding: .1rem .35rem; border: 1px solid rgba(16, 209, 194, .24); border-radius: 999px; color: var(--teal); font-size: .57rem; }

.sync-dock {
  width: min(430px, calc(100% - 2rem));
  position: fixed;
  right: auto;
  bottom: max(.7rem, env(safe-area-inset-bottom));
  left: 50%;
  z-index: 75;
  display: grid;
  grid-template-columns: 1fr;
  gap: .7rem;
  margin: 0;
  padding: .7rem;
  border-radius: var(--radius);
  background: rgba(5, 12, 17, .94);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .52);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.dock-action {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7rem;
  padding: .65rem .85rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--soft);
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.dock-action:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--line-strong); background: var(--surface-3); }
.dock-action:disabled { opacity: .38; cursor: wait; }
.dock-action > span:last-child { display: grid; text-align: left; }
.dock-action strong { font-size: .84rem; }
.dock-action small { color: var(--muted); font-size: .66rem; }
.dock-icon { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px; border: 2px solid rgba(16, 209, 194, .42); border-radius: 50%; color: var(--teal); }
.dock-icon svg { width: 21px; height: 21px; display: block; overflow: visible; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.dock-action.primary { border-color: rgba(73, 221, 130, .48); background: #168b4d; color: #fff; box-shadow: 0 10px 30px rgba(16, 150, 78, .2); }
.dock-action.primary small { color: rgba(255, 255, 255, .72); }
.dock-action.primary .dock-icon { border-color: rgba(255, 255, 255, .42); color: #fff; }
.dock-action.primary.pending { background: #1a9e56; }
.dock-action.primary:hover:not(:disabled) { border-color: rgba(112, 242, 161, .72); background: #1da65b; }

.source-view-button {
  width: fit-content;
  display: grid;
  gap: .12rem;
  margin-top: .85rem;
  padding: .55rem .72rem;
  border: 1px solid rgba(16, 209, 194, .34);
  border-radius: 7px;
  background: rgba(16, 209, 194, .07);
  color: var(--teal);
  text-align: left;
  cursor: pointer;
}
.source-view-button:hover { background: rgba(16, 209, 194, .13); border-color: rgba(16, 209, 194, .58); }
.source-view-button:disabled {
  border-color: rgba(16, 209, 194, .2);
  background: rgba(16, 209, 194, .045);
  color: #9fd7d2;
  cursor: default;
}
.source-view-button strong { font-size: .76rem; }
.source-view-button small { color: var(--muted); font-size: .64rem; }

body.source-timeline-view {
  background:
    radial-gradient(circle at 18% 8%, rgba(71, 119, 255, .17), transparent 34rem),
    radial-gradient(circle at 86% 88%, rgba(16, 209, 194, .1), transparent 30rem),
    #08101e;
}
body.source-timeline-view::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 500;
  pointer-events: none;
  background: rgba(255, 255, 255, .10);
}
body.source-timeline-view .source-view-button {
  position: relative;
  z-index: 510;
}
body.source-timeline-view .timeline-card,
body.source-timeline-view .presence-card,
body.source-timeline-view .sidebar-card { border-color: rgba(104, 138, 255, .34); }
body.source-timeline-view .source-view-button { border-color: rgba(255, 191, 71, .48); background: rgba(255, 171, 44, .1); color: #ffc66e; }
body.source-timeline-view .song-drag-handle,
body.source-timeline-view .song-order-button,
body.source-timeline-view .setlist-order-controls,
body.source-timeline-view .arrangement-actions,
body.source-timeline-view .arrangement-row-actions { display: none !important; }
body.source-timeline-view .setlist-song,
body.source-timeline-view .arrangement-row { cursor: default; }
body.source-timeline-view .setlist-song {
  grid-template-columns: 34px minmax(0, 1fr) auto 28px;
}
body.source-timeline-view .setlist-song > .song-number { grid-column: 1; grid-row: 1; }
body.source-timeline-view .setlist-song > .setlist-song-copy { grid-column: 2; grid-row: 1; }
body.source-timeline-view .setlist-song > .arrangement-state { grid-column: 3; grid-row: 1; }
body.source-timeline-view .setlist-song > .open-song-arrow {
  grid-column: 4;
  grid-row: 1;
  justify-self: center;
  white-space: nowrap;
}

.toast.warning { border-color: rgba(255, 166, 46, .52); background: #38230e; color: #ffe0aa; }

.join-overlay,
.closed-overlay {
  min-height: 100svh;
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 1rem;
  background:
    radial-gradient(circle at 20% 10%, rgba(16, 209, 194, .12), transparent 28rem),
    radial-gradient(circle at 80% 90%, rgba(22, 150, 255, .08), transparent 28rem),
    rgba(3, 8, 12, .98);
}

.join-card,
.closed-card {
  width: min(490px, 100%);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(16, 28, 37, .98), rgba(7, 14, 20, .99));
  box-shadow: 0 35px 100px rgba(0, 0, 0, .55);
}

.join-card h1,
.closed-card h1 { margin: .55rem 0 .7rem; font-size: clamp(2rem, 7vw, 3rem); line-height: .95; letter-spacing: -.045em; }
.join-card > p:not(.eyebrow):not(.form-status),
.closed-card p { color: var(--muted); line-height: 1.5; }
.room-limit { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1rem 0; }
.room-limit span { padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 999px; color: #a9bec6; font-size: .69rem; }
.join-card label { display: block; margin: 1.1rem 0 .4rem; color: #d9e5e8; font-size: .8rem; }
.join-card input { width: 100%; min-height: 50px; padding: .75rem .9rem; border: 1px solid var(--line-strong); border-radius: 7px; outline: none; background: #060d12; color: var(--text); }
.join-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(16, 209, 194, .1); }
.join-card .button { width: 100%; min-height: 50px; }
.form-status { min-height: 1.3rem; margin: .5rem 0; color: #ff929c; font-size: .77rem; }

.pdf-modal-backdrop {
  min-height: 100svh;
  position: fixed;
  inset: 0;
  z-index: 220;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(1, 5, 8, .88);
  backdrop-filter: blur(12px);
}

.pdf-dialog {
  width: min(560px, 100%);
  max-height: calc(100svh - 2rem);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: #0a1219;
  box-shadow: 0 35px 100px rgba(0, 0, 0, .62);
}

.pdf-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--line);
}

.pdf-dialog-header h2 { margin: .2rem 0 0; font-size: 1.08rem; }
.pdf-close-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: #d8e4e6;
  font-size: 1.15rem;
  cursor: pointer;
}
.pdf-close-button:hover { border-color: var(--line-strong); background: var(--surface-3); }

.pdf-picker-dialog form { padding: 1rem 1.1rem 1.1rem; }
.pdf-title-field { display: grid; gap: .35rem; margin-bottom: .75rem; color: #c9d5d9; font-size: .76rem; font-weight: 650; }
.pdf-title-field input {
  width: 100%;
  min-height: 42px;
  padding: .55rem .65rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  outline: 0;
  background: #050c11;
  color: var(--text);
}
.pdf-title-field input:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(16, 209, 194, .12); }
.pdf-track-options { max-height: min(52svh, 430px); display: grid; gap: .45rem; overflow-y: auto; }
.pdf-track-option {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem .75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(4, 10, 14, .72);
  cursor: pointer;
}
.pdf-track-option:hover { border-color: var(--line-strong); }
.pdf-track-option input,
.pdf-page-option input { accent-color: var(--teal); }
.pdf-track-option span { min-width: 0; display: grid; }
.pdf-track-option strong { overflow: hidden; font-size: .85rem; text-overflow: ellipsis; white-space: nowrap; }
.pdf-track-option small { color: var(--muted); font-size: .68rem; }
.pdf-track-empty { padding: 1rem; color: var(--muted); font-size: .8rem; text-align: center; }
.pdf-picker-actions { display: flex; justify-content: flex-end; gap: .55rem; margin-top: .7rem; }

.pdf-preview-dialog {
  width: min(96vw, 1240px);
  height: 94svh;
  max-height: 94svh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.pdf-preview-back {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  font-size: .68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .105em;
  cursor: pointer;
}
.pdf-preview-back:hover { color: var(--teal-bright); }
.pdf-preview-back-arrow { font-size: .95rem; line-height: 1; transition: transform .15s ease; }
.pdf-preview-back:hover .pdf-preview-back-arrow { transform: translateX(-2px); }

.pdf-preview-scroll {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 1.1rem;
  background: #03070a;
}

.pdf-preview-sheet {
  width: min(8.5in, 100%);
  position: relative;
  margin: 0 auto;
  overflow: hidden;
  aspect-ratio: 8.5 / 11;
}

.pdf-preview-page {
  width: 8.5in;
  min-height: 11in;
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  padding: .5in;
  background: #fff;
  color: #111;
  box-shadow: 0 20px 55px rgba(0, 0, 0, .42);
  font-family: Arial, Helvetica, sans-serif;
  transform-origin: top left;
}

.pdf-preview-page > h1 { width: fit-content; margin: 0 auto .38in; font-size: 22px; line-height: 1.15; text-align: center; }
.pdf-preview-section { break-inside: avoid; margin-top: 18px; }
.pdf-preview-section:first-of-type { margin-top: 0; }
.pdf-preview-section h2 { width: fit-content; margin: 0 0 7px; font-size: 15px; line-height: 1.2; }
.pdf-note-flow { display: grid; gap: 4px; }
.pdf-note-flow-line { width: 100%; position: relative; }
.pdf-style-target {
  outline: 2px solid transparent;
  outline-offset: 1px;
  cursor: pointer;
}
.pdf-style-target:hover { outline-color: rgba(21, 154, 255, .32); }
.pdf-style-target.selected { outline-color: #159aff; }
.pdf-style-target.style-bold { font-weight: 700; }
.pdf-style-target.style-italic { font-style: italic; }
.pdf-style-target.style-underline { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.pdf-style-target.style-highlight { background: #fff19a; }
.pdf-note-cell { position: absolute; display: block; padding: 0 2px; line-height: 1.22; white-space: nowrap; }
.pdf-preview-empty { margin: 1rem 0; color: #555; text-align: center; }

.pdf-toolbar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .7rem;
  border-top: 1px solid var(--line-strong);
  background: rgba(7, 14, 20, .98);
  box-shadow: 0 -12px 35px rgba(0, 0, 0, .32);
}
.pdf-toolbar-group { display: flex; align-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; }
.pdf-toolbar-group button {
  min-width: 36px;
  height: 36px;
  padding: 0 .55rem;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--soft);
  color: #d7e2e5;
  cursor: pointer;
}
.pdf-toolbar-group button:last-child { border-right: 0; }
.pdf-toolbar-group button:hover,
.pdf-toolbar-group button[aria-pressed="true"] { background: rgba(16, 209, 194, .13); color: var(--teal-bright); }
.pdf-toolbar-group button:disabled { opacity: .28; cursor: default; }
.pdf-font-controls output { min-width: 52px; padding: 0 .45rem; color: var(--muted); font-size: .7rem; text-align: center; }
.pdf-style-controls button:disabled { opacity: .28; cursor: default; }
.pdf-style-controls button[data-pdf-style="highlight"] { color: #ffe764; }
.pdf-gap-controls output {
  width: 40px;
  height: 36px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, .025);
}
.pdf-gap-controls svg { width: 22px; height: 22px; }
.pdf-affect-only-option,
.pdf-page-option { display: inline-flex; align-items: center; gap: .4rem; margin-left: auto; color: #c6d2d6; font-size: .74rem; white-space: nowrap; }
.pdf-affect-only-option { margin-left: 0; }
.pdf-affect-only-option.disabled { opacity: .38; }
.pdf-generate-button { min-height: 38px; padding: .45rem 1rem; }

.initial-loading-overlay,
.network-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 3, 6, .72);
  backdrop-filter: blur(4px);
}
.initial-loading-overlay { z-index: 1000; background: #050b10; }
.initial-loading-overlay .spinner { width: 38px; height: 38px; border-width: 4px; }
.network-overlay { z-index: 500; }

.loading-card {
  min-width: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: rgba(10, 18, 24, .96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55);
}

.loading-card strong { font-size: .86rem; }
.spinner { width: 25px; height: 25px; border: 3px solid rgba(16, 209, 194, .16); border-top-color: var(--teal); border-radius: 50%; animation: spin .75s linear infinite; }

.toast-region { width: min(420px, calc(100% - 2rem)); position: fixed; right: 1rem; bottom: 1rem; z-index: 600; }
.pdf-modal-open .toast-region { right: auto; bottom: 5.25rem; left: 50%; transform: translateX(-50%); }
.pdf-modal-open .toast { text-align: center; }
.toast { padding: .85rem 1rem; border: 1px solid var(--line-strong); border-radius: 8px; background: #11212b; box-shadow: 0 18px 55px rgba(0, 0, 0, .48); color: #dce8ea; font-size: .82rem; }
.toast.error { border-color: rgba(255, 82, 97, .42); background: #30151b; color: #ffd0d4; }
.empty-timeline { display: grid; justify-items: center; gap: .25rem; padding: 4rem 1rem; color: var(--muted); text-align: center; }
.empty-timeline > span { color: var(--teal); font-size: 2rem; }
.empty-timeline strong { color: var(--text); }
.empty-timeline p { max-width: 370px; margin: .1rem 0; font-size: .8rem; }
.noscript { padding: 1rem; color: var(--danger); text-align: center; }

.lc-home { display: grid; place-items: center; }
.home-shell { width: min(820px, calc(100% - 2rem)); position: relative; padding: 5rem 0; text-align: center; }
.home-glow { width: 380px; height: 240px; position: absolute; top: 14%; left: 50%; z-index: -1; border-radius: 50%; background: rgba(16, 209, 194, .09); filter: blur(80px); transform: translateX(-50%); }
.home-shell > .brand-mark { margin: 0 auto 1.3rem; }
.home-shell h1 { margin: .55rem 0; font-size: clamp(3rem, 10vw, 6.7rem); line-height: .83; letter-spacing: -.07em; }
.home-shell h1 span { color: var(--teal); }
.home-copy { max-width: 600px; margin: 1.5rem auto; color: var(--muted); font-size: 1rem; line-height: 1.6; }
.home-card { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 2.2rem; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.home-card > div { display: grid; gap: .15rem; padding: 1.15rem; background: var(--surface); }
.home-card strong { color: var(--teal-bright); font-size: 1.25rem; }
.home-card span { color: var(--muted); font-size: .72rem; }
.home-hint { margin-top: 1.2rem; color: var(--muted-2); font-size: .74rem; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .3; transform: scale(.75); } }

@supports (corner-shape: squircle) {
  *:not(.avatar):not(.status-chip i):not(.notice-icon):not(.change-icon):not(.dock-icon):not(.spinner):not(.home-glow) {
    corner-shape: squircle;
  }
}

@media (pointer: coarse) {
  .song-drag-handle { min-width: 34px; min-height: 38px; font-size: 1.15rem; }
  .section-drag-handle { min-height: 40px; display: grid; place-items: center; font-size: 1.15rem; }
  .arrangement-row { min-height: 58px; }
}

@media (max-width: 1080px) {
  .workspace-grid { grid-template-columns: minmax(0, 1fr) 310px; }
  .event-heading { grid-template-columns: minmax(0, 1fr) 330px; }
  .setlist-song { grid-template-columns: 31px 32px minmax(0, 1fr) auto 28px; }
  .setlist-order-controls { display: none; }
  body.source-timeline-view .setlist-song {
    grid-template-columns: 34px minmax(0, 1fr) auto 28px;
  }
}

@media (max-width: 860px) {
  .event-heading { grid-template-columns: 1fr; }
  .presence-card { min-height: auto; padding: .3rem .45rem; }
  .presence-card .presence-list { gap: .3rem; margin-top: 0; }
  .presence-card .person-chip { gap: .3rem; padding: .16rem .4rem .16rem .2rem; }
  .presence-card .avatar { width: 15px; height: 15px; flex: unset; font-size: .42rem; box-shadow: none; }
  .workspace-grid { grid-template-columns: 1fr; }
  .collab-sidebar { position: static; grid-template-columns: 1fr 1fr; }
  .pending-list,
  .history-list { max-height: 320px; }
}

@media (max-width: 680px) {
  .topbar {
    min-height: unset;
    height: auto;
    grid-template-columns: minmax(0, 1fr) auto;
    padding: max(.25rem, env(safe-area-inset-top)) .55rem .25rem;
  }

  .brand { font-size: 1rem; }
  .brand .brand-mark { display: none; }
  .status-chip { min-height: 34px; padding: .34rem .58rem; }
  .status-chip span { max-width: 74px; overflow: hidden; text-overflow: ellipsis; }
  .overflow-button { width: 34px; }
  .page-shell { width: calc(100% - .7rem); padding-top: .3rem; padding-bottom: 6.5rem; }
  .back-link { gap: .4rem; margin: 0 0 .2rem; padding: .25rem .1rem; }
  .event-heading { gap: .4rem; margin-bottom: .45rem; }
  .event-copy { min-height: 92px; padding: .72rem .8rem; border-radius: 10px; }
  .event-copy h1 { margin: .2rem 0 .35rem; font-size: clamp(2rem, 10vw, 3rem); }
  .event-meta { margin-top: .35rem; }
  body[data-view="song"] .event-copy h1 { font-size: clamp(1rem, 5vw, 1.5rem); }
  .presence-card { padding: .3rem .45rem; border-radius: 10px; }
  .presence-title { display: none; }
  .presence-list { margin-top: 0; flex-wrap: nowrap; overflow-x: auto; }
  .person-chip { flex: 0 0 auto; }
  .pending-card,
  .candidate-card { align-items: flex-start; gap: .55rem; margin-bottom: .45rem; padding: .55rem .65rem; border-radius: 8px; }
  .pending-card > div,
  .candidate-card > div:first-child { display: flex; align-items: baseline; flex-wrap: wrap; gap: .08rem .45rem; }
  .pending-card p,
  .candidate-card p { flex-basis: 100%; }
  .candidate-card { flex-direction: column; }
  .candidate-actions { width: 100%; }
  .candidate-actions .button { flex: 1; }
  .workspace-grid { gap: .45rem; }
  .timeline-card { border-radius: 10px; }
  .section-heading { align-items: flex-start; flex-direction: column; gap: .35rem; padding: .9rem 1rem; }
  .section-heading > p { text-align: left; }
  .timeline-content { padding: .42rem; }
  .setlist-list { gap: .34rem; }
  .setlist-song { grid-template-columns: 30px minmax(0, 1fr) auto 22px; gap: .45rem; padding: .55rem .5rem; }
  body.source-timeline-view .setlist-song {
    grid-template-columns: minmax(0, 1fr) 22px;
  }
  body.source-timeline-view .setlist-song > .setlist-song-copy { grid-column: 1; }
  body.source-timeline-view .setlist-song > .open-song-arrow { grid-column: 2; }
  .song-number,
  .arrangement-state { display: none; }
  .setlist-order-controls { display: flex; }
  .setlist-song-copy p { margin-bottom: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .song-drag-handle { width: 28px; min-width: 28px; height: 31px; min-height: 31px; }
  .song-detail-workspace { gap: .45rem; }
  .song-timeline-toolbar { justify-content: center; margin-bottom: .3rem; }
  .song-timeline-scroll { scrollbar-width: auto; }
  .song-timeline-scroll::-webkit-scrollbar { height: 18px; }
  .mobile-timeline-scrollbar {
    min-height: 30px;
    display: flex;
    align-items: center;
    padding: 0 .35rem;
    border: 1px solid var(--line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: #080d10;
  }
  .mobile-timeline-scrollbar input { width: 100%; height: 28px; margin: 0; appearance: none; background: transparent; cursor: ew-resize; }
  .mobile-timeline-scrollbar input::-webkit-slider-runnable-track { height: 12px; border-radius: 999px; background: #1c2c34; }
  .mobile-timeline-scrollbar input::-webkit-slider-thumb { width: 46px; height: 22px; margin-top: -5px; appearance: none; border: 2px solid #071016; border-radius: 999px; background: var(--teal-bright); box-shadow: 0 0 0 1px rgba(255,255,255,.24); }
  .mobile-timeline-scrollbar input::-moz-range-track { height: 12px; border-radius: 999px; background: #1c2c34; }
  .mobile-timeline-scrollbar input::-moz-range-thumb { width: 46px; height: 22px; border: 2px solid #071016; border-radius: 999px; background: var(--teal-bright); box-shadow: 0 0 0 1px rgba(255,255,255,.24); }
  .mobile-timeline-scrollbar.disabled { opacity: .45; }
  .song-timeline-surface { padding: .35rem; }
  .arrangement-lane { min-height: 138px; }
  .segment { min-width: 154px; }
  .notes-area { margin-top: .35rem; }
  .section-action-bar { align-items: flex-start; flex-direction: column; gap: .35rem; padding: .42rem; }
  .selected-section-label { width: 100%; padding: 0 .15rem; }
  .section-actions { width: 100%; overflow-x: auto; }
  .section-actions button { min-width: 58px; flex: 1 0 58px; padding: .18rem .25rem; }
  .arrangement-heading { padding: .55rem .65rem .4rem; }
  .arrangement-list { padding: 0 .3rem .3rem; }
  .arrangement-row { min-height: 46px; gap: .4rem; padding: .22rem .3rem; }
  .section-drag-handle { min-height: 31px; }
  .arrangement-row-notes { overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; touch-action: pan-x; }
  .arrangement-row-notes::-webkit-scrollbar { display: none; }
  .arrangement-row-note-stack { width: 100%; min-width: var(--arrangement-note-width); }
  .arrangement-row .note-lane { grid-auto-columns: minmax(62px, 1fr); overflow: visible; }
  .row-actions { opacity: 1; }
  .collab-sidebar { grid-template-columns: 1fr; gap: .45rem; }
  .sidebar-card { border-radius: 9px; }
  .sync-dock {
    width: 100%;
    right: 0;
    bottom: 0;
    left: 0;
    grid-template-columns: 1fr;
    gap: .4rem;
    padding: .45rem max(.45rem, env(safe-area-inset-right)) max(.45rem, env(safe-area-inset-bottom)) max(.45rem, env(safe-area-inset-left));
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 0;
    transform: none;
  }
  .dock-action { min-height: 60px; gap: .5rem; padding: .55rem; }
  .dock-action strong { font-size: .76rem; }
  .dock-action small { display: none; }
  .dock-icon { width: 32px; height: 32px; flex-basis: 32px; }
  .dock-icon svg { width: 19px; height: 19px; }
  .toast-region { right: .5rem; bottom: calc(84px + env(safe-area-inset-bottom)); width: calc(100% - 1rem); }
  .join-card,
  .closed-card { border-radius: 12px; }
  .pdf-modal-backdrop { padding: .35rem; }
  .pdf-dialog { max-height: calc(100svh - .7rem); }
  .pdf-dialog-header { padding: .7rem .75rem; }
  .pdf-picker-dialog form { padding: .7rem .75rem .75rem; }
  .pdf-preview-dialog { width: 100%; height: calc(100svh - .7rem); max-height: calc(100svh - .7rem); }
  .pdf-preview-scroll { padding: .6rem; }
  .pdf-preview-sheet { margin: 0 auto; }
  .pdf-toolbar { flex-wrap: wrap; gap: .4rem; padding: .45rem; }
  .pdf-modal-open .toast-region { right: .5rem; bottom: calc(128px + env(safe-area-inset-bottom)); left: auto; transform: none; }
  .pdf-affect-only-option { order: 3; }
  .pdf-page-option { order: 3; margin-left: 0; }
  .pdf-generate-button { order: 4; margin-left: auto; }
  .home-shell { padding: 3rem 0; }
  .home-card { grid-template-columns: 1fr; }
}

@media (max-width: 410px) {
  .brand { font-size: .9rem; }
  .status-chip { padding: .3rem .45rem; font-size: .74rem; }
  .event-facts { gap: .35rem .65rem; }
  .event-facts span { font-size: .79rem; }
  .setlist-song { grid-template-columns: 27px minmax(0, 1fr) auto 20px; gap: .35rem; }
  .setlist-order-controls { gap: .16rem; }
  .song-order-button { width: 26px; height: 28px; }
  .sync-dock { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
