:root {
  color-scheme: light;
  --ink: #231f20;
  --muted: #534e4b;
  --line: #e6dfd6;
  --line-strong: #cfc6bb;
  --paper: #ffffff;
  --surface: #f6f3ee;
  --surface-strong: #ebe4db;
  --accent: #231f20;
  --accent-strong: #0e0c0d;
  --accent-soft: #efeae3;
  --on-accent: #ffffff;
  --danger: #9f1239;
  --danger-bg: #fff1f2;
  --danger-border: #fecdd3;
  --warning: #9a3412;
  --warning-bg: #fff7ed;
  --warning-border: #fed7aa;
  --success: #146c43;
  --success-bg: #eef6f1;
  --success-border: #b7dfc9;
  --success-ink: #145c3a;
  --focus: #231f20;
  --chrome: #231f20;
  --chrome-ink: #f6f3ee;
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: none;
  --radius-sm: 14px;
  --radius: 22px;
  --radius-lg: 28px;
  --font-sans: "Plus Jakarta Sans", "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Iowan Old Style", Palatino, "Palatino Linotype", "Book Antiqua", Georgia, serif;

  /* spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;

  /* One geometry contract for content and the full-width search surface. */
  --content-max-width: 1180px;
  --sidebar-width: 0px;
  --content-gutter: max(var(--space-4), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-strong);
  font-weight: 600;
  text-decoration: none;
  transition: color 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  a:hover {
    color: var(--accent);
  }
}

/* ----- Headings (scoped to content/auth, not global) ----- */
.content h2,
.auth-panel h2 {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
}

/* Section headings that follow content get top spacing */
.content > h2:not(:first-child),
.content > h3 {
  margin-top: var(--space-7);
  margin-bottom: var(--space-4);
}

.content h3,
.card h3,
.auth-panel h3 {
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0;
}

.content p,
.card p,
.auth-panel p {
  line-height: 1.6;
  margin: 0;
}

/* ----- Layout shell ----- */
.shell {
  /* Query units follow the layout width, excluding reserved scrollbars. */
  container-type: inline-size;
  min-height: 100vh;
}

/* Mobile-first: sidebar hidden, top bar + bottom tabs drive nav. */
.sidebar {
  display: none;
}

.icon {
  flex: 0 0 auto;
  height: 1.4rem;
  width: 1.4rem;
}

/* ----- Mobile top bar ----- */
.mobile-bar {
  align-items: center;
  background: var(--chrome);
  color: var(--chrome-ink);
  display: flex;
  gap: var(--space-3);
  justify-content: space-between;
  min-height: 56px;
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 20;
}

.mobile-bar .button_to button {
  background: rgba(255, 255, 255, 0.10);
  font-size: 0.82rem;
  min-height: 2.25rem;
  padding: 0.45rem 0.8rem;
}
@media (hover: hover) and (pointer: fine) {
  .mobile-bar .button_to button:hover {
    background: rgba(255, 255, 255, 0.18);
  }
}

/* ----- Mobile bottom tab bar ----- */
.tab-bar {
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  bottom: 0;
  display: flex;
  left: 0;
  padding: var(--space-1) var(--space-1) max(var(--space-1), env(safe-area-inset-bottom));
  padding-left: max(var(--space-1), env(safe-area-inset-left));
  padding-right: max(var(--space-1), env(safe-area-inset-right));
  position: fixed;
  right: 0;
  z-index: 20;
}

.tab-link {
  align-items: center;
  border-radius: 10px;
  color: var(--muted);
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  font-weight: 600;
  gap: 0.2rem;
  min-height: 3.25rem;
  justify-content: center;
  padding: var(--space-2) var(--space-1);
  text-decoration: none;
}

.tab-link .icon {
  height: 1.5rem;
  width: 1.5rem;
}

.tab-label {
  font-size: 0.68rem;
  letter-spacing: 0.01em;
}

.tab-link-active {
  color: var(--accent);
}

.tab-link:active {
  background: var(--accent-soft);
}

.brand-block {
  align-items: center;
  display: flex;
  gap: var(--space-3);
  min-width: 0;
}

.nav-section {
  display: flex;
  gap: var(--space-2);
  margin: 0 calc(-1 * var(--space-4));
  overflow-x: auto;
  padding: 0 var(--space-4) var(--space-1);
  scrollbar-width: none;
}

.nav-section::-webkit-scrollbar {
  display: none;
}

.nav-link {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 2.65rem;
  padding: 0.6rem 0.9rem;
  text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover {
    background: var(--surface);
    color: var(--ink);
  }
}

.nav-link-active {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent-strong);
}

.nav-divider {
  background: var(--line);
  display: none;
  height: 1px;
  margin: var(--space-1) 0;
  width: 100%;
}

.content {
  --content-inset: calc(var(--content-gutter) + max(0px, (100cqw - var(--sidebar-width) - var(--content-max-width)) / 2));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0 auto;
  max-width: var(--content-max-width);
  /* extra bottom space so fixed tab bar never covers content */
  padding: var(--space-5) var(--content-gutter) calc(4.5rem + env(safe-area-inset-bottom));
  width: 100%;
}

/* sidebar nav icon spacing */
.nav-link .icon {
  height: 1.2rem;
  width: 1.2rem;
  margin-right: var(--space-1);
}

/* ----- Auth ----- */
.auth-shell {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 26rem);
  justify-content: center;
  min-height: 100vh;
  min-width: 0;
  padding: var(--space-5);
  width: 100%;
}

.auth-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
  max-width: 100%;
  min-width: 0;
  padding: var(--space-6);
  width: 100%;
}

.auth-brand {
  margin-bottom: var(--space-2);
}

.auth-brand h1 {
  color: var(--ink);
}

.auth-brand p {
  color: var(--muted);
}

/* ----- Toolbar (page header row) ----- */
.toolbar {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  justify-content: space-between;
}

.toolbar > div {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

/* ----- Card grid ----- */
.grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  transition: none;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-3) 0;
}

.push-device-settings {
  margin-top: var(--space-5);
}

/* ----- Tables ----- */
table {
  background: var(--paper);
  border: 1px solid var(--line);
  border-collapse: separate;
  border-radius: var(--radius);
  border-spacing: 0;
  box-shadow: none;
  display: block;
  max-width: 100%;
  overflow-x: auto;
  width: 100%;
}

thead,
tbody,
tr {
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  min-width: 8rem;
  padding: 0.85rem 1rem;
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

tbody tr {
  transition: background-color 120ms ease;
}
@media (hover: hover) and (pointer: fine) {
  tbody tr:hover {
    background: rgba(35, 31, 32, 0.04);
  }
}

tr:last-child td {
  border-bottom: 0;
}

/* ----- Forms ----- */
form:not(.button_to) {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  display: grid;
  gap: var(--space-4);
  max-width: 52rem;
  padding: var(--space-5);
}

/* Forms inside cards / auth panels are bare */
.card form:not(.button_to),
.auth-panel form:not(.button_to) {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

label,
legend {
  color: var(--ink);
  display: grid;
  font-size: 0.88rem;
  font-weight: 600;
  gap: var(--space-2);
}

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-4);
}

fieldset .card {
  box-shadow: none;
}

input,
textarea,
select {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  min-height: 2.75rem;
  padding: 0.65rem 0.85rem;
  transition: border-color 150ms ease;
  width: 100%;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  line-height: 1.55;
  min-height: 7.5rem;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  min-height: auto;
  width: auto;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--ink);
  box-shadow: none;
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ----- Buttons ----- */
button,
input[type="submit"],
.button {
  align-items: center;
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--on-accent);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 600;
  gap: var(--space-2);
  justify-content: center;
  line-height: 1.1;
  min-height: 2.75rem;
  padding: 0.7rem 1.1rem;
  text-decoration: none;
  transition: background-color 150ms ease, transform 120ms ease;
  white-space: nowrap;
  width: fit-content;
}
@media (hover: hover) and (pointer: fine) {
  button:hover,
  input[type="submit"]:hover,
  .button:hover {
    background: var(--accent-strong);
    box-shadow: none;
    color: var(--on-accent);
  }
}

button:active,
input[type="submit"]:active,
.button:active {
  transform: translateY(0);
}

button:focus-visible,
input[type="submit"]:focus-visible,
.button:focus-visible,
a:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.button.secondary,
button.secondary,
input.secondary {
  background: var(--paper);
  border-color: var(--line-strong);
  color: var(--ink);
}
@media (hover: hover) and (pointer: fine) {
  .button.secondary:hover,
  button.secondary:hover,
  input.secondary:hover {
    background: var(--surface-strong);
    color: var(--ink);
    box-shadow: none;
  }
}

.button_to {
  display: inline-block;
  margin: 0;
}

/* ----- Notices ----- */
.notice {
  background: var(--success-bg);
  border: 1px solid var(--success-border);
  border-radius: var(--radius);
  color: var(--success-ink);
  font-weight: 600;
  padding: 0.85rem 1.1rem;
}

.alert {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}

audio {
  display: block;
  max-width: 100%;
  width: 100%;
}

.upload-slot progress {
  accent-color: var(--accent);
  appearance: none;
  background: var(--line);
  border: 0;
  border-radius: 999px;
  display: block;
  height: 0.75rem;
  overflow: hidden;
  width: 100%;
}

.upload-slot progress::-webkit-progress-bar {
  background: var(--line);
  border-radius: 999px;
}

.upload-slot progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
}

.upload-slot progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}

.upload-slot progress[hidden],
.upload-slot .notice[hidden] {
  display: none;
}

.upload-slot summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  min-height: 44px;
}

.upload-current {
  overflow-wrap: anywhere;
}

.upload-current span {
  color: var(--muted);
  display: block;
  font-size: 0.85rem;
}

.song-number {
  background: var(--accent-soft);
  border-radius: 999px;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  width: fit-content;
}

.repertoire-card {
  position: relative;
}

.card-link::after {
  content: "";
  inset: 0;
  position: absolute;
}

.search-form {
  max-width: none !important;
}

.search-controls,
.section-heading {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.search-controls input[type="search"] {
  flex: 1 1 18rem;
}

.audio-groups {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.audio-group {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
}

.audio-group h4 {
  font-size: 1rem;
  margin: 0;
}

.audio-track {
  border-top: 1px solid var(--line);
  display: grid;
  gap: var(--space-3);
  padding-top: var(--space-4);
}

.audio-track > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.section-heading {
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.pdf-viewer {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: min(72vh, 56rem);
  min-height: 32rem;
  width: 100%;
}

.empty-state {
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  padding: var(--space-6);
  text-align: center;
}

.setlist-picker {
  max-height: none;
  overflow: visible;
}

.setlist-search {
  display: grid;
  gap: 0.75rem;
}

.setlist-search[hidden] {
  display: none;
}

.setlist-search-results {
  display: grid;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  max-height: 18rem;
  overflow: auto;
  padding: 0;
}

.setlist-search-results li {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-height: 44px;
}

.setlist-search-title {
  flex: 1;
  min-width: 0;
}

.setlist-selected {
  display: grid;
}

.setlist-selected .setlist-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 0;
}

.setlist-selected .setlist-song {
  flex: 1 1 12rem;
  min-width: 0;
}

.setlist-selected .setlist-position {
  flex: 1 1 6rem;
  max-width: 8rem;
}

.setlist-selected button {
  flex: 0 0 auto;
  min-height: 44px;
}

.setlist-row {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: var(--space-3);
  grid-template-columns: minmax(0, 1fr) 6rem;
  padding: var(--space-2) 0;
}

.setlist-row:last-child {
  border-bottom: 0;
}

.setlist-song {
  align-items: center;
  display: flex;
  flex-direction: row;
}

.setlist-song > span {
  align-items: center;
  display: flex;
  gap: var(--space-2);
}

.setlist-position {
  font-size: 0.72rem;
}

.setlist-position input {
  min-height: 2.25rem;
  padding: 0.4rem;
}

.inline-check {
  align-items: center;
  display: flex;
  flex-direction: row;
}

.compact-list {
  margin-bottom: 0;
  padding-left: 1.4rem;
}

/* ----- Responsive ----- */
@media (min-width: 640px) {
  :root { --content-gutter: max(var(--space-6), env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px)); }

  .toolbar {
    align-items: center;
    flex-direction: row;
  }

  .content {
    padding: var(--space-6) var(--content-gutter) calc(4.5rem + env(safe-area-inset-bottom));
  }
}

@media (min-width: 1024px) {
  /* Desktop: real sidebar, hide mobile chrome. */
  .mobile-bar,
  .tab-bar {
    display: none;
  }

  .sidebar {
    align-content: start;
    background: var(--chrome);
    border-right: 0;
    color: var(--chrome-ink);
    display: grid;
    gap: var(--space-5);
    height: 100dvh;
    overflow-y: auto;
    padding: var(--space-5);
    position: sticky;
    top: 0;
  }

  .brand-block {
    margin-bottom: var(--space-1);
  }

  .nav-section {
    display: grid;
    gap: var(--space-2);
    margin: 0;
    overflow: visible;
    padding: 0;
  }

  .nav-link {
    width: 100%;
  }

  .nav-divider {
    display: block;
  }

  .nav-footer {
    align-self: stretch;
    margin-top: auto;
  }

  .nav-footer .button_to,
  .nav-footer button {
    width: 100%;
  }

  .content {
    padding: var(--space-7) var(--space-6);
  }
}

/* Shared member UI */
body { font-size: 16px; }
.shell, .content, .card, .toolbar > div, fieldset { min-width: 0; }
.content { gap: 1.5rem; }
.content h2, .auth-panel h2 { font-weight: 600; letter-spacing: -0.045em; line-height: 1.2; }
.content h3 { line-height: 1.4; }
.content p, .content a, .audio-track strong { overflow-wrap: anywhere; }
.mobile-bar { border-bottom: 0; padding-top: max(.65rem, env(safe-area-inset-top)); padding-left: max(1rem, env(safe-area-inset-left)); padding-right: max(1rem, env(safe-area-inset-right)); }
.mobile-bar .button_to button { background: transparent; border-color: rgba(246, 243, 238, 0.35); color: var(--chrome-ink); min-height: 44px; }
@media (hover: hover) and (pointer: fine) {
  .mobile-bar .button_to button:hover { background: rgba(246, 243, 238, 0.12); color: #fff; }
}

.tab-link-active { background: var(--accent-soft); color: var(--accent-strong); }
.tab-bar { gap: .25rem; box-shadow: none; }
.tab-label { font-size: .7rem; }
.nav-link { gap: .5rem; min-height: 44px; }
.nav-caption, .eyebrow { color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; }
.nav-caption { margin: .5rem .9rem; }
.member-profile { display: flex; align-items: center; gap: .75rem; padding: 1rem 0; border-top: 1px solid var(--line); color: var(--ink); }
@media (hover: hover) and (pointer: fine) {
  .member-profile:hover { color: var(--accent-strong); }
}

.member-profile small { display: block; color: var(--muted); margin-top: .25rem; }
.avatar { background: var(--surface-strong); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0; font-weight: 600; }
input:disabled, input[readonly]:disabled { background: var(--surface); color: var(--muted); cursor: not-allowed; }
.page-heading { display: flex; flex-direction: column; align-items: flex-start !important; gap: .4rem !important; }
.welcome-panel { background: var(--ink); border: 0; border-radius: var(--radius-lg); color: var(--paper); padding: clamp(1.5rem, 4vw, 2.75rem); display: grid; gap: .75rem; }
.welcome-panel h2,
.welcome-panel .eyebrow,
.welcome-panel .muted { color: var(--paper); }
.welcome-panel .muted { color: rgba(246, 243, 238, 0.78); }
.welcome-panel .eyebrow { color: rgba(246, 243, 238, 0.62); }
.event-heading { display: flex; align-items: center; gap: 1rem; }
.date-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--surface-strong); border-radius: 14px; width: 58px; min-height: 64px; flex-shrink: 0; color: var(--accent-strong); }
.date-tile span { font-size: .65rem; text-transform: uppercase; letter-spacing: .08em; }
.date-tile strong { font-size: 1.5rem; font-weight: 600; }
.status-badge { display: inline-flex; width: fit-content; border-radius: 99px; padding: .35rem .7rem; background: var(--surface-strong); color: var(--accent-strong); font-size: .78rem; font-weight: 600; }
.card { gap: 1rem; }

.card .button_to, .card .button_to button { width: 100%; }
.card details { border-top: 1px solid var(--line); padding-top: .5rem; }
summary { cursor: pointer; color: var(--muted); min-height: 44px; padding: .75rem 0; font-weight: 600; }
details form { margin-top: .5rem; }
.compact-list li { padding: .35rem 0; }
.repertoire-card { gap: .75rem; }
.repertoire-card .card-link { margin-top: auto; padding-top: .5rem; font-size: .85rem; }
.repertoire-card h3 a { color: var(--ink); }
.repertoire-card .song-number { border-radius: 10px; padding: .5rem .7rem; }
.search-form label { gap: .75rem; }
.search-controls { flex-wrap: nowrap; }
.search-controls input[type="search"] { min-width: 0; flex: 1; }
.search-controls .button { flex-shrink: 0; }
.auth-panel { padding: 2rem; box-shadow: none; }
.auth-panel input[type="submit"] { width: 100%; }
.auth-shell { min-height: 100dvh; }
input, textarea, select { min-width: 0; font-size: 16px; }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; flex-shrink: 0; }
label:has(input[type="checkbox"]), label:has(input[type="radio"]) { min-height: 44px; }
.skip-link { position: fixed; top: -100px; left: 1rem; z-index: 50; padding: 1rem; background: var(--paper); }
.skip-link:focus { top: 1rem; }
.admin-shortcuts { display: flex; flex-wrap: wrap; gap: .5rem; }
.admin-shortcuts a { background: var(--paper); border: 1px solid var(--line); border-radius: 99px; padding: .75rem 1rem; font-size: .85rem; }
@media (max-width: 639px) {
  .card { padding: 1.25rem; }
  .toolbar > .button { align-self: flex-start; }
  .search-controls { flex-wrap: wrap; }
  .search-controls input[type="search"] { flex-basis: 100%; }
  .pdf-viewer { min-height: 20rem; height: 60dvh; }
  .setlist-row { grid-template-columns: minmax(0, 1fr) 4rem; }
  .auth-shell { padding: 1rem; }
}
@media (min-width: 1024px) {
  :root { --sidebar-width: 250px; --content-gutter: clamp(2rem, 4vw, 4rem); }
  .shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
  .sidebar { display: flex; flex-direction: column; height: 100dvh; overflow-y: auto; }
  .content { padding: 3rem var(--content-gutter); }
  .nav-footer { margin-top: auto; }
  .admin-shortcuts { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* ----- Admin statistics ----- */
.statistics-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.statistics-summary {
  margin-top: var(--space-4);
}

.visually-hidden {
  border: 0;
  clip: rect(0, 0, 0, 0);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

html[data-custom-audio-player] .audio-fallback {
  display: none;
}

.audio-player {
  background: var(--paper);
  border-top: 1px solid var(--line);
  bottom: calc(4.5rem + env(safe-area-inset-bottom));
  box-shadow: none;
  display: grid;
  gap: 0.15rem;
  left: 0;
  padding: 0.75rem 1rem 0.5rem;
  position: fixed;
  right: 0;
  z-index: 25;
}

.audio-player[hidden] {
  display: none;
}

.audio-player audio {
  height: 1px;
  opacity: 0;
  pointer-events: none;
  position: absolute;
  width: 1px;
}

.audio-player-main {
  align-items: center;
  display: flex;
  gap: 0.75rem;
  min-width: 0;
}

.audio-player-toggle,
.audio-player-close {
  flex: 0 0 44px;
  height: 44px;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  width: 44px;
}

.audio-player-toggle {
  background: var(--ink);
  color: var(--paper);
  gap: 0;
}
@media (hover: hover) and (pointer: fine) {
  .audio-player-toggle:hover {
    background: var(--accent-strong);
    color: var(--paper);
  }
}

.audio-player-close {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
  margin-left: auto;
}
@media (hover: hover) and (pointer: fine) {
  .audio-player-close:hover {
    background: var(--surface-strong);
    color: var(--ink);
  }
}

.audio-player-toggle:focus-visible,
.audio-player-close:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.audio-player-glyph {
  display: block;
  height: 1.25rem;
  width: 1.25rem;
}

.audio-player-toggle .audio-player-glyph {
  display: none;
}

.audio-player-toggle[data-state="playing"] [data-icon="pause"],
.audio-player-toggle[data-state="paused"] [data-icon="play"] {
  display: block;
}

.audio-player-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.audio-player-meta p {
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.audio-player-seek {
  margin: 0;
}

.audio-player input[type="range"] {
  accent-color: var(--accent);
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: 44px;
  padding: 0.85rem 0;
}

.audio-player-times {
  color: var(--muted);
  display: flex;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  justify-content: space-between;
  margin-top: -0.35rem;
}

body.has-mini-player .content {
  padding-bottom: calc(4.5rem + 12rem + env(safe-area-inset-bottom));
}

@media (min-width: 1024px) {
  .audio-player {
    bottom: 0;
    left: 250px;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  }

  body.has-mini-player .content {
    padding-bottom: calc(12rem + env(safe-area-inset-bottom));
  }
}

.statistics-metric {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
}

.statistics-filters .statistics-filter-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  align-items: end;
}

.statistics-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.statistics-chart-card,
.statistics-heatmap-card {
  gap: var(--space-3);
}

.statistics-chart {
  position: relative;
  height: 16rem;
  width: 100%;
}

.table-scroll,
.heatmap-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.heatmap-table {
  border-collapse: separate;
  border-spacing: 2px;
  min-width: 100%;
}

.heatmap-table th,
.heatmap-table td {
  border: none;
  padding: 0.35rem 0.45rem;
  text-align: center;
  white-space: nowrap;
}

.heatmap-table th[scope="row"],
.heatmap-table thead th:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--paper);
  z-index: 1;
}

.heatmap-cell {
  background: color-mix(in srgb, var(--accent) calc(var(--heatmap-intensity) * 85%), var(--accent-soft));
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  min-width: 2.75rem;
}

.heatmap-cell[style*="--heatmap-intensity: 0"] {
  background: var(--surface-strong);
  color: var(--muted);
}

.heatmap-value {
  display: inline-block;
  min-width: 1.5rem;
}

/* ----- Official lockup and ink chrome ----- */
.brand-lockup {
  color: inherit;
  display: flex;
  max-width: 100%;
  min-height: 44px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  color: var(--ink);
  display: block;
  line-height: 0;
  max-width: 100%;
  min-width: 0;
}

.brand-logo svg {
  display: block;
  height: auto;
  max-width: 100%;
  min-width: 0;
}

.on-ink .brand-logo {
  color: #fff;
}

.brand-logo--horizontal svg {
  height: 32px;
  width: auto;
}

.brand-logo--stacked {
  width: 100%;
}

.brand-logo--stacked svg {
  height: auto;
  margin-inline: auto;
  max-height: 8.75rem;
  width: min(12rem, 100%);
}

.mobile-bar .brand-lockup {
  align-items: center;
  flex: 1 1 auto;
  overflow: hidden;
}

.mobile-bar .button_to {
  flex: 0 0 auto;
}

.sidebar .brand-lockup {
  align-items: flex-start;
  flex-direction: column;
  gap: 0.35rem;
}

.sidebar .brand-tagline {
  color: rgba(246, 243, 238, 0.62);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  margin: 0;
}

.sidebar .nav-caption,
.sidebar .nav-link,
.sidebar .member-profile,
.sidebar .member-profile small {
  color: rgba(246, 243, 238, 0.72);
}
@media (hover: hover) and (pointer: fine) {
  .sidebar .nav-link:hover,
  .sidebar .member-profile:hover {
    background: rgba(246, 243, 238, 0.08);
    color: #fff;
  }
}

.sidebar .nav-link-active {
  background: rgba(246, 243, 238, 0.14);
  color: #fff;
}

.sidebar .nav-divider,
.sidebar .member-profile {
  border-color: rgba(246, 243, 238, 0.16);
}

.sidebar .avatar {
  background: rgba(246, 243, 238, 0.14);
  color: var(--chrome-ink);
}

.sidebar .nav-footer .button_to button {
  background: transparent;
  border-color: rgba(246, 243, 238, 0.35);
  color: var(--chrome-ink);
  min-height: 44px;
  width: 100%;
}
@media (hover: hover) and (pointer: fine) {
  .sidebar .nav-footer .button_to button:hover {
    background: rgba(246, 243, 238, 0.12);
    color: #fff;
  }
}

.auth-brand {
  align-items: center;
  justify-content: center;
}

.auth-intro {
  display: grid;
  gap: 0.45rem;
  text-align: center;
}

.auth-intro h2,
.auth-intro .muted,
.auth-intro .eyebrow {
  text-align: center;
}

.auth-shell {
  background:
    radial-gradient(70rem 24rem at 50% -8rem, rgba(35, 31, 32, 0.06), transparent 60%),
    var(--surface);
  padding:
    max(1.25rem, env(safe-area-inset-top))
    max(1rem, env(safe-area-inset-right))
    max(1.25rem, env(safe-area-inset-bottom))
    max(1rem, env(safe-area-inset-left));
}

.auth-panel input:not([type="checkbox"]):not([type="radio"]) {
  max-width: 100%;
  width: 100%;
}

button,
input[type="submit"],
.button,
.tab-link,
.nav-link,
summary,
.card-link {
  min-height: 44px;
}

.card-link,
.repertoire-card h3 a,
.setlist a {
  align-items: center;
  display: inline-flex;
}

.date-tile {
  background: var(--ink);
  color: var(--paper);
}

.empty-state {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}

.empty-state p {
  margin: 0;
}

.setlist {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  list-style: none;
  margin: 0;
  padding: 0;
}

.setlist li {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 0.75rem;
  min-height: 44px;
  padding: 0.35rem 1rem;
}

.setlist li:last-child {
  border-bottom: 0;
}

.definition-list {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.definition-list div {
  display: grid;
  gap: 0.1rem;
}

.definition-list dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.definition-list dd {
  margin: 0;
}

turbo-frame[aria-busy="true"] {
  cursor: progress;
  opacity: 0.6;
}

.turbo-progress-bar {
  background: var(--ink);
  height: 3px;
}

.audio-player {
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.skip-link:focus {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #f6f3ee;
    --muted: #c8bfb6;
    --line: #3a342f;
    --line-strong: #524a44;
    --paper: #1c1917;
    --surface: #121110;
    --surface-strong: #2a2623;
    --accent: #f6f3ee;
    --accent-strong: #ffffff;
    --accent-soft: #2a2623;
    --on-accent: #231f20;
    --danger: #fecdd3;
    --danger-bg: #3f1d24;
    --danger-border: #9f1239;
    --warning: #fed7aa;
    --warning-bg: #3b2414;
    --warning-border: #9a3412;
    --success: #b7dfc9;
    --success-bg: #14261e;
    --success-border: #1f6b4a;
    --success-ink: #b7dfc9;
    --focus: #f6f3ee;
    --chrome: #0e0c0d;
    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: none;
  }

  .welcome-panel .muted,
  .welcome-panel .eyebrow {
    color: rgba(18, 17, 16, 0.72);
  }

  .date-tile {
    background: var(--chrome-ink);
    color: var(--chrome);
  }

  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible {
    box-shadow: none;
  }
}

@media (prefers-color-scheme: dark) and (hover: hover) and (pointer: fine) {
  tbody tr:hover {
    background: rgba(246, 243, 238, 0.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  .turbo-progress-bar {
    display: none;
  }

  turbo-frame[aria-busy="true"] {
    opacity: 1;
  }
}

/* ----- Install guide ----- */
.install-guide {
  bottom: calc(4.5rem + var(--mini-player-offset, 0px) + env(safe-area-inset-bottom) + var(--space-3));
  display: none;
  left: max(var(--space-3), env(safe-area-inset-left));
  max-width: 28rem;
  pointer-events: none;
  position: fixed;
  right: max(var(--space-3), env(safe-area-inset-right));
  z-index: 30;
}

.install-guide[data-state="open"] {
  display: block;
  pointer-events: auto;
}

.install-guide[data-state="open"] .install-guide-card {
  animation: install-guide-in 180ms ease;
}

@keyframes install-guide-in {
  from {
    opacity: 0;
    transform: translateY(0.65rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.install-guide-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  position: relative;
}

.install-guide-eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  margin: 0;
  padding-right: 3.25rem;
  text-transform: uppercase;
}

.install-guide-title {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
  padding-right: 3.25rem;
}

.install-guide-body {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.45;
  margin: 0;
}

.install-guide-close {
  background: transparent;
  border-color: transparent;
  border-radius: 999px;
  color: var(--ink);
  height: 44px;
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  position: absolute;
  right: 0.35rem;
  top: 0.35rem;
  width: 44px;
}
@media (hover: hover) and (pointer: fine) {
  .install-guide-close:hover {
    background: var(--surface-strong);
    color: var(--ink);
  }
}

.install-guide-steps {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.install-step {
  align-items: center;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: 1.75rem minmax(0, 1fr);
}

.install-step-index {
  align-items: center;
  background: var(--surface-strong);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 700;
  height: 1.75rem;
  justify-content: center;
  width: 1.75rem;
}

.install-step-copy {
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
  margin: 0;
}

.install-step-copy strong {
  font-weight: 700;
}

.install-glyph {
  display: inline-block;
  height: 1.05rem;
  margin: 0 0.12rem;
  vertical-align: -0.2em;
  width: 1.05rem;
}

.install-guide [data-state="off"] {
  display: none;
}

.install-guide-actions {
  display: flex;
  flex-direction: column;
}

.install-guide-primary {
  min-height: 44px;
  width: 100%;
}

.install-guide-quiet {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.install-guide-text {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  flex: 1 1 8.5rem;
  font-size: 0.92rem;
  min-height: 44px;
  padding: 0.45rem 0.7rem;
  white-space: normal;
}
@media (hover: hover) and (pointer: fine) {
  .install-guide-text:hover {
    background: var(--surface);
    color: var(--ink);
  }
}

.install-guide-fallback {
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.4;
  margin: 0;
  overflow-wrap: anywhere;
  padding: var(--space-2) var(--space-3);
  user-select: text;
}

body.has-install-guide .content {
  padding-bottom: calc(4.5rem + var(--install-guide-block, 18rem) + env(safe-area-inset-bottom) + var(--space-3));
}

body.has-mini-player.has-install-guide .content {
  padding-bottom: calc(4.5rem + 12rem + var(--install-guide-block, 18rem) + env(safe-area-inset-bottom) + var(--space-3));
}

.settings-install {
  margin: var(--space-5) 0;
}

.settings-install-row {
  align-items: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
  color: var(--ink);
  display: flex;
  gap: var(--space-3);
  min-height: 4.25rem;
  padding: var(--space-3) var(--space-4);
  text-align: left;
  width: 100%;
  white-space: normal;
}
@media (hover: hover) and (pointer: fine) {
  .settings-install-row:hover {
    background: var(--surface);
    color: var(--ink);
  }
}

.settings-install-icon {
  align-items: center;
  background: var(--surface-strong);
  border-radius: 999px;
  color: var(--ink);
  display: inline-flex;
  flex: 0 0 2.75rem;
  height: 2.75rem;
  justify-content: center;
  width: 2.75rem;
}

.settings-install-text {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.settings-install-text strong {
  font-size: 1rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.settings-install-text span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
}

.settings-install-chevron {
  color: var(--muted);
  flex: 0 0 auto;
}

@media (min-width: 1024px) {
  .install-guide {
    display: none;
  }

  .install-guide[data-manual="true"][data-state="open"] {
    bottom: calc(var(--mini-player-offset, 0px) + var(--space-4) + env(safe-area-inset-bottom));
    display: block;
    left: calc(250px + var(--space-5));
    right: auto;
    width: min(26rem, calc(100vw - 290px));
  }

  body.has-install-guide .content,
  body.has-mini-player.has-install-guide .content {
    padding-bottom: calc(var(--mini-player-offset, 0px) + var(--install-guide-block, 0px) + var(--space-6));
  }
}

@media (prefers-reduced-motion: reduce) {
  .install-guide[data-state="open"] .install-guide-card {
    animation: none;
  }
}
