*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.hidden { display: none !important; }
html { min-height: 100%; }
body { min-height: 100vh; height: auto; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #ebebeb;
  display: flex;
  flex-direction: column;
  color: #333;
  user-select: none;
  -webkit-user-select: none;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: #fff;
  border-bottom: 1px solid #d4d4d4;
  flex-shrink: 0;
  gap: 12px;
  height: 52px;
}

header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #222;
  flex-shrink: 0;
  white-space: nowrap;
}

.setlist-title {
  font-weight: 400;
  color: #555;
  outline: none;
  cursor: text;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
  min-width: 40px;
}

.setlist-title:focus { border-bottom-color: #ccc; }

.setlist-title:empty:before {
  content: attr(data-placeholder);
  color: #ccc;
  font-weight: 400;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 300px;
}

#search, .search-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d4d4d4;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #f5f5f5;
  color: #333;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#search:focus, .search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.search-hint {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #bbb;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 1px 5px;
  pointer-events: none;
  line-height: 1.4;
}

#eye-btn, #setlist-btn, #songbook-btn, #export-btn, #import-btn, #board-btn, #gigs-btn, #user-btn, #songbook-actions-btn {
  background: none;
  border: none;
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  color: #555;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 400;
  vertical-align: middle;
}

#eye-btn:hover, #setlist-btn:hover, #songbook-btn:hover, #export-btn:hover, #import-btn:hover, #board-btn:hover, #gigs-btn:hover, #user-btn:hover, #songbook-actions-btn:hover { background: #f0f0f0; }
#eye-btn.active { background: #e0e0e0; color: #222; }
#board-btn.nav-active, #songbook-btn.nav-active, #gigs-btn.nav-active { background: #e0e0e0; color: #222; }

.options { position: relative; display: flex; align-items: center; gap: 6px; }

.nav-divider {
  width: 1px;
  height: 20px;
  background: #d4d4d4;
  margin: 0 2px;
}

html.dark-mode .nav-divider { background: #444; }

.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid #d4d4d4;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 10;
  min-width: 200px;
  padding: 4px;
}

.dropdown.hidden { display: none; }

.dropdown-header {
  padding: 6px 12px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #999;
  cursor: default;
}

.setlist-switch {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  color: #333;
  font-family: inherit;
  text-decoration: none;
}

.setlist-switch:hover { background: #f0f0f0; }
.setlist-switch.active { background: #dbeafe; color: #1a56db; font-weight: 600; }

html.dark-mode .setlist-switch { color: #ddd; }
html.dark-mode .setlist-switch:hover { background: #333; }
html.dark-mode .setlist-switch.active { background: rgba(59,130,246,0.2); color: #93c5fd; }

.dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  color: #333;
  font-family: inherit;
}

.dropdown button:hover { background: #f0f0f0; }
.dropdown button.active { background: #dbeafe; color: #1a56db; font-weight: 600; }

#btn-new-setlist {
  border-top: 1px solid #e8e8e8;
  margin-top: 4px;
  padding-top: 8px;
  color: #3b82f6;
  font-weight: 500;
}

.dropdown-action {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  color: #666;
  font-family: inherit;
}

.dropdown-action:hover { color: #3b82f6; background: #f0f0f0; }

button.dropdown-action-danger { color: #e11d48; }
button.dropdown-action-danger:hover { color: #e11d48; background: #fee2e2; }

html.dark-mode .dropdown-action { color: #999; }
html.dark-mode .dropdown-action:hover { color: #60a5fa; background: #333; }
html.dark-mode button.dropdown-action-danger { color: #f87171; }
html.dark-mode button.dropdown-action-danger:hover { color: #f87171; background: #3b1a1a; }

.dropdown-divider {
  border: none;
  border-top: 1px solid #e8e8e8;
  margin: 6px 0;
}

.dropdown-label {
  font-size: 10px;
  font-weight: 600;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 12px 4px;
}

.set-count-options {
  display: flex;
  gap: 4px;
  padding: 0 12px 6px;
}

.set-count-btn {
  flex: 1;
  background: none;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 4px 0;
  font-size: 12px;
  cursor: pointer;
  color: #666;
  font-family: inherit;
}

.set-count-btn:hover { background: #f0f0f0; }
.set-count-btn.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }

html.dark-mode .dropdown-divider { border-top-color: #333; }
html.dark-mode .dropdown-label { color: #666; }
html.dark-mode .set-count-btn { border-color: #444; color: #999; }
html.dark-mode .set-count-btn:hover { background: #333; }
html.dark-mode .set-count-btn.active { background: #3b82f6; color: #fff; border-color: #3b82f6; }

.settings-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  cursor: pointer;
  font-size: 14px;
  color: #333;
}

.settings-toggle span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.settings-toggle input {
  display: none;
}

.toggle-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: #ccc;
  border-radius: 10px;
  transition: background 0.2s;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.settings-toggle input:checked + .toggle-track {
  background: #3b82f6;
}

.settings-toggle input:checked + .toggle-track::after {
  transform: translateX(16px);
}

html.dark-mode .settings-toggle {
  color: #ccc;
}

html.dark-mode .toggle-track {
  background: #555;
}

html.dark-mode .settings-toggle input:checked + .toggle-track {
  background: #3b82f6;
}

#board {
  display: flex;
  gap: 14px;
  padding: 14px;
  overflow: auto;
  flex: 1;
  align-items: stretch;
  position: relative;
  cursor: grab;
}

.column {
  position: relative;
  flex: 1;
  min-width: 260px;
  max-width: 400px;
  background: #dfdfdf;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}

.column[data-col="icebox"] { background: #d4eaf7; }
.column[data-col="spare"].view-icebox { background: #d4eaf7; }
.column[data-col="spare"].view-learn { background: #d4f0d4; }
.column[data-col="needs-practice"] { background: #f7e0d4; }

.column-header {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.column-header .count {
  font-weight: 400;
  color: #999;
  font-size: 12px;
}

.column-header .dur { text-transform: none; font-weight: 400; color: #999; font-size: 12px; }

.column-body {
  flex: 1;
  padding: 4px 10px 10px;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card {
  background: #fff;
  border-radius: 7px;
  padding: 8px 10px;
  cursor: grab;
  position: relative;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: box-shadow 0.15s, opacity 0.15s;
}

.card:active { cursor: grabbing; }
.card:hover { box-shadow: 0 2px 6px rgba(0,0,0,0.1); }

.card-focused {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

html.dark-mode .card-focused {
  outline-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
}


.column:not([data-col="needs-practice"]) .card.card-practice {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.practice-badge {
  font-size: 10px;
  font-weight: 600;
  color: #cc6b1a;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.card-note-body {
  font-size: 12px;
  color: #666;
  margin-top: 6px;
  padding: 4px 6px;
  background: #f5f5f5;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.4;
}

.card-mood {
  display: inline-block;
  vertical-align: middle;
  margin-right: 3px;
  line-height: 1;
}

.card-note-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #f9f9f9;
  color: #333;
  resize: none;
  outline: none;
  min-height: 40px;
  cursor: text;
}

.card-note-input:focus { border-color: #aaa; background: #fff; }

.card-user-note-body {
  font-size: 12px;
  color: #8b5cf6;
  margin-top: 4px;
  padding: 4px 6px;
  background: #f5f3ff;
  border-radius: 4px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.4;
}

.card-user-note-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid #d8b4fe;
  border-radius: 4px;
  background: #faf5ff;
  color: #333;
  resize: none;
  outline: none;
  min-height: 40px;
  cursor: text;
}
.card-user-note-input:focus { border-color: #a855f7; background: #fff; }

.card.compact .card-user-note-body { display: none; }

html.dark-mode .card-user-note-body { background: #2d1b3a; color: #c4b5fd; }
html.dark-mode .card-user-note-input { background: #2d1b3a; border-color: #6b21a8; color: #ddd; }
html.dark-mode .card-user-note-input:focus { background: #3b2255; border-color: #a855f7; }

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  padding-right: 50px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-singer {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  padding: 0 6px;
  line-height: 1.6;
}

.card-artist {
  font-size: 12px;
  color: #777;
  margin-top: 1px;
}

.card-meta {
  font-size: 11px;
  color: #999;
  margin-top: 5px;
  display: flex;
  gap: 4px;
  align-items: center;
}

.card-meta span { white-space: nowrap; }
.card-meta .sep { color: #ccc; }

.card-url-group { display: inline-flex; align-items: center; gap: 3px; vertical-align: middle; }
.card-url-link { color: #999; text-decoration: none; display: inline-flex; align-items: center; }
.card-url-link:hover { color: #3b82f6; }
.card-url-icon { width: 14px; height: 14px; vertical-align: middle; opacity: 0.6; transition: opacity 0.15s; }
.card-url-link:hover .card-url-icon { opacity: 1; }
.card-url-copy {
  background: none; border: none; cursor: pointer; padding: 1px; display: inline-flex; align-items: center;
  color: #bbb; border-radius: 3px; transition: color 0.15s, background 0.15s;
}
.card-url-copy:hover { color: #3b82f6; background: #e8e8e8; }
.card-url-copy.copied { color: #2b8a3e; }
.card-url-copy svg { display: block; }

.card.compact .card-artist,
.card.compact .card-meta,
.card.compact .card-note-body { display: none; }

.dragging {
  opacity: 0.35;
  transform: scale(0.95);
}

.sortable-ghost {
  opacity: 0.25;
  background: #bbb;
  border: 2px dashed #999;
}

@media (max-width: 700px) {
  #board { padding: 10px; gap: 10px; }
  .column { min-width: 240px; }
  header { padding: 10px 14px; }
  header h1 { font-size: 16px; }
}

/* Dark mode */
html.dark-mode body { background: #1a1a1a; color: #ddd; }
html.dark-mode header { background: #222; border-color: #333; }
html.dark-mode header h1 { color: #eee; }
html.dark-mode .setlist-title { color: #aaa; }
html.dark-mode .setlist-title:focus { border-bottom-color: #555; }
html.dark-mode .setlist-title:empty:before { color: #555; }
html.dark-mode #search, html.dark-mode .search-input { background: #333; border-color: #444; color: #ddd; }
html.dark-mode #search:focus, html.dark-mode .search-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.25); }
html.dark-mode .search-hint { background: #222; border-color: #444; color: #666; }
html.dark-mode .dropdown button:disabled { color: #555; }
html.dark-mode .dropdown button:disabled:hover { background: none; }
html.dark-mode .dropdown { background: #222; border-color: #444; }
html.dark-mode .dropdown button { color: #ddd; }
html.dark-mode .dropdown button:hover { background: #333; }
html.dark-mode .dropdown button.active { background: rgba(59,130,246,0.2); color: #93c5fd; }
html.dark-mode .dropdown-header { color: #888; }
html.dark-mode #btn-new-setlist { border-top-color: #333; }
html.dark-mode #download-btn, html.dark-mode #load-btn { color: #aaa; }
html.dark-mode #eye-btn, html.dark-mode #setlist-btn, html.dark-mode #songbook-btn, html.dark-mode #export-btn, html.dark-mode #import-btn, html.dark-mode #board-btn, html.dark-mode #gigs-btn, html.dark-mode #user-btn, html.dark-mode #songbook-actions-btn { color: #aaa; }
html.dark-mode #eye-btn:hover, html.dark-mode #setlist-btn:hover, html.dark-mode #songbook-btn:hover, html.dark-mode #export-btn:hover, html.dark-mode #import-btn:hover, html.dark-mode #board-btn:hover, html.dark-mode #gigs-btn:hover, html.dark-mode #user-btn:hover, html.dark-mode #songbook-actions-btn:hover { background: #333; }
html.dark-mode #eye-btn.active { background: #3a3a3a; color: #eee; }
html.dark-mode #board-btn.nav-active, html.dark-mode #songbook-btn.nav-active, html.dark-mode #gigs-btn.nav-active { background: #3a3a3a; color: #eee; }
html.dark-mode .column { background: #2a2a2a; }
html.dark-mode .column[data-col="icebox"] { background: #1e2a33; }
html.dark-mode .column[data-col="spare"].view-icebox { background: #1e2a33; }
html.dark-mode .column[data-col="spare"].view-learn { background: #1e2f1e; }
html.dark-mode .column[data-col="needs-practice"] { background: #33261e; }
html.dark-mode .column-header { color: #aaa; }
html.dark-mode .column-header .count { color: #666; }
html.dark-mode .card { background: #333; border-color: #444; }
html.dark-mode .column:not([data-col="needs-practice"]) .card.card-practice {
  opacity: 0.5;
  filter: grayscale(0.6);
}
html.dark-mode .practice-badge { color: #e8a040; }
html.dark-mode .card-note-input { background: #444; border-color: #555; color: #ddd; }
html.dark-mode .card-note-input:focus { background: #3a3a3a; border-color: #777; }
html.dark-mode .card-note-body { background: #3a3a3a; color: #aaa; }
html.dark-mode .card-title { color: #eee; }
html.dark-mode .card-artist { color: #999; }
html.dark-mode .card-meta { color: #777; }
html.dark-mode .card-meta .sep { color: #555; }
html.dark-mode .card-url-link { color: #777; }
html.dark-mode .card-url-link:hover { color: #93c5fd; }
html.dark-mode .card-url-icon { opacity: 0.5; }
html.dark-mode .card-url-link:hover .card-url-icon { opacity: 0.9; }
html.dark-mode .card-url-copy { color: #666; }
html.dark-mode .card-url-copy:hover { color: #93c5fd; background: #3a3a3a; }
html.dark-mode .card-url-copy.copied { color: #69db7c; }

.ctx-menu {
  position: fixed;
  z-index: 200;
  min-width: 140px;
  background: #fff;
  border: 1px solid #d4d4d4;
  border-radius: 7px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  padding: 4px;
}

.ctx-menu.hidden { display: none; }

.ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  color: #333;
  font-family: inherit;
}

.ctx-menu button:hover { background: #f0f0f0; }

html.dark-mode .ctx-menu { background: #222; border-color: #444; }
html.dark-mode .ctx-menu button { color: #ddd; }
html.dark-mode .ctx-menu button:hover { background: #333; }

.help-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.help-modal.hidden { display: none; }

.help-content {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  min-width: 220px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  font-size: 14px;
  color: #333;
}

.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.help-title { font-size: 15px; font-weight: 600; }

.help-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #999;
  line-height: 1;
  padding: 0 2px;
}

.help-close:hover { color: #333; }

.gig-setlist-content { position: relative; }

.gig-setlist-close {
  position: absolute;
  top: 6px;
  right: 10px;
  z-index: 10;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: #999;
  line-height: 1;
  padding: 4px 8px;
}

.gig-setlist-close:hover { color: #333; }

.help-section { margin-bottom: 14px; }
.help-section:last-child { margin-bottom: 0; }

.help-section h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  margin: 0 0 6px 0;
}

.help-section td { padding: 2px 0; }
.help-section td:first-child { width: 36px; text-align: center; }

.help-section kbd {
  background: #f0f0f0;
  border: 1px solid #d4d4d4;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: inherit;
}

html.dark-mode .help-content { background: #222; color: #ddd; }
html.dark-mode .help-close { color: #777; }
html.dark-mode .help-close:hover { color: #eee; }
html.dark-mode .help-section kbd { background: #333; border-color: #555; color: #ddd; }

.help-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid #eee;
}

html.dark-mode .help-footer { border-top-color: #333; }

.print-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.print-modal.hidden { display: none; }

.print-body {
  max-height: 60vh;
  overflow-y: auto;
}

.print-set { margin-bottom: 18px; }
.print-set:last-child { margin-bottom: 0; }

.print-set-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 2px solid #333;
}

html.dark-mode .print-set-title { border-bottom-color: #555; }

.print-song {
  padding: 3px 0;
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.print-song-title { font-weight: 500; }
.print-song-artist { color: #666; }
html.dark-mode .print-song-artist { color: #999; }

.print-song-details {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin-left: auto;
  color: #777;
  font-size: 12px;
  white-space: nowrap;
}

html.dark-mode .print-song-details { color: #888; }

.print-detail { display: inline-flex; align-items: center; gap: 2px; }

#chord-chart-modal .help-content {
  width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}

#chord-chart-editor-modal .help-content {
  width: 90vw;
  max-width: 1200px;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

#chord-chart-modal .chord-chart-body {
  overflow-y: auto;
  flex: 1;
  user-select: text;
  -webkit-user-select: text;
}

.chord-editor-textarea {
  overflow-y: auto;
  flex: 1;
  min-height: 200px;
  font-size: 14px;
  line-height: 1.8;
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
}
.chord-editor-textarea:focus {
  outline: none;
  border-color: #e11d48;
  box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.15);
}
html.dark-mode .chord-editor-textarea {
  background: #1e1e1e;
  color: #ddd;
  border-color: #444;
}
html.dark-mode .chord-editor-textarea:focus {
  border-color: #fb7185;
  box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.15);
}

.chord-chart-body {
  font-size: 14px;
  font-weight: bold;
  line-height: 1.8;
  white-space: pre-wrap;
  color: #333;
  padding: 4px 0;
}

.chord-chart-body hr.page-break {
  border: none;
  border-top: 2px dashed #999;
  margin: 1em 0;
  opacity: 0.6;
}

html.dark-mode .chord-chart-body hr.page-break {
  border-top-color: #666;
}

html.dark-mode .chord-chart-body { color: #ddd; }

.chord-chart-body .chord { color: #e11d48; }
.chord-chart-body .backing { font-weight: normal; }
.chord u { text-decoration: none; border-bottom: 2px solid currentColor; }
html.dark-mode .chord-chart-body .chord { color: #fb7185; }
.chord-chart-body .chord-upper { font-weight: normal; }
.chord-chart-body .directive { font-weight: normal; }

html.dark-mode .chord-chart-body .chord-upper { font-weight: normal; }
html.dark-mode .chord-chart-body .backing { font-weight: normal; }
html.dark-mode .chord-chart-body .directive { font-weight: normal; }
.chord-diagrams-toggle {
  font-size: 12px;
  padding: 4px 0;
}

.chord-diagrams-toggle a {
  color: #e11d48;
  text-decoration: none;
  cursor: pointer;
}

.chord-diagrams-toggle a:hover {
  text-decoration: underline;
}

html.dark-mode .chord-diagrams-toggle a {
  color: #fb7185;
}

.chord-diagrams-toggle #chord-count {
  color: #888;
  font-size: 11px;
}

html.dark-mode .chord-diagrams-toggle #chord-count {
  color: #666;
}

.chord-diagrams {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
  align-items: center;
}

html.dark-mode .chord-diagrams {
  border-bottom-color: #333;
}

.chord-diagrams .diagrams-label {
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

html.dark-mode .chord-diagrams .diagrams-label {
  color: #666;
}

.chord-diagrams svg.chord-diagram {
  flex-shrink: 0;
}

.chord-diagrams svg.chord-diagram .cd-string,
.chord-diagrams svg.chord-diagram .cd-fret,
.chord-diagrams svg.chord-diagram .cd-dot,
.chord-diagrams svg.chord-diagram .cd-x,
.chord-diagrams svg.chord-diagram .cd-o,
.chord-diagrams svg.chord-diagram .cd-label,
.chord-diagrams svg.chord-diagram .cd-chord-name {
  color: #333;
}

html.dark-mode .chord-diagrams svg.chord-diagram .cd-string,
html.dark-mode .chord-diagrams svg.chord-diagram .cd-fret,
html.dark-mode .chord-diagrams svg.chord-diagram .cd-dot,
html.dark-mode .chord-diagrams svg.chord-diagram .cd-x,
html.dark-mode .chord-diagrams svg.chord-diagram .cd-o,
html.dark-mode .chord-diagrams svg.chord-diagram .cd-label,
html.dark-mode .chord-diagrams svg.chord-diagram .cd-chord-name {
  color: #ccc;
}

@media print {
  body > * { visibility: hidden; }
  .print-modal, .print-modal * { visibility: visible; }
  .print-modal {
    position: fixed;
    inset: 0;
    display: block !important;
    background: none;
    z-index: 9999;
    padding: 20px;
    align-items: initial;
    justify-content: initial;
  }
  .print-modal .help-content {
    box-shadow: none;
    border: none;
    padding: 0;
    max-width: 100% !important;
    width: 100%;
  }
  .print-modal .help-header { display: none; }
  .print-modal .help-footer { display: none; }
  .print-body { max-height: none; overflow: visible; }
  .print-song-details { color: #555; }
}

.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.3px; color: #999; margin-bottom: 3px; }
.form-input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #d4d4d4;
  border-radius: 5px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #f9f9f9;
  color: #333;
}
.form-input:focus { border-color: #3b82f6; background: #fff; }
.form-user-note {
  font-size: 13px;
  color: #7c3aed;
  padding: 8px 10px;
  background: #f5f3ff;
  border: 1px solid #e9d5ff;
  border-radius: 5px;
  line-height: 1.4;
  white-space: pre-wrap;
}
html.dark-mode .form-user-note { background: #2d1b3a; border-color: #5b21b6; color: #c4b5fd; }
.form-row { display: flex; gap: 8px; }
.form-row .form-group { flex: 1; }
.song-link-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.song-link-add-btn,
.song-link-move-btn,
.song-link-remove-btn {
  font-size: 12px;
}
.song-link-row {
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 8px;
  background: #fafafa;
}
.song-link-row-fields {
  display: flex;
  gap: 8px;
}
.song-link-row-url {
  flex: 1;
}
.song-link-row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.form-actions { display: flex; gap: 8px; margin-top: 14px; }
.btn-primary {
  flex: 1;
  padding: 8px 16px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:hover { background: #2563eb; }
.btn-secondary {
  padding: 8px 16px;
  background: #f0f0f0;
  color: #555;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}
.btn-secondary:hover { background: #e0e0e0; }
.btn-danger {
  padding: 4px 10px;
  background: #e11d48;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: #be123c; }
html.dark-mode .form-input { background: #333; border-color: #444; color: #ddd; }
html.dark-mode .form-input:focus { background: #3a3a3a; border-color: #3b82f6; }
html.dark-mode .btn-secondary { background: #3a3a3a; color: #aaa; }
html.dark-mode .btn-secondary:hover { background: #444; }

.match-count {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 6px;
  background: #3b82f6;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  z-index: 2;
}

.match-count.hidden { display: none; }

.card.match {
  background: #dbeafe;
  border-color: #93c5fd;
}

.column.has-match {
  box-shadow: 0 0 14px 4px rgba(59,130,246,0.25);
}

html.dark-mode .card.match { background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.4); }
html.dark-mode .column.has-match { box-shadow: 0 0 14px 4px rgba(59,130,246,0.35); }

/* Spare column filter menu */
.spare-menu {
  position: fixed;
  z-index: 200;
  min-width: 170px;
  background: #fff;
  border: 1px solid #d4d4d4;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.12);
  padding: 6px 0;
}
.spare-menu.hidden { display: none; }
.spare-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  color: #444;
  font-family: inherit;
}
.spare-menu button:hover { background: #f0f0f0; }
.spare-menu .spare-label {
  display: block;
  padding: 6px 14px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #bbb;
  cursor: default;
}
.spare-menu hr { border: none; border-top: 1px solid #e0e0e0; margin: 4px 0; }
.spare-section { margin: 0; padding: 0; }
.spare-section button { padding-left: 20px; }
.spare-menu .spare-active {
  background: #dbeafe !important;
  color: #1a56db;
  font-weight: 600;
}

.spare-toggle {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 3px 5px;
  cursor: pointer;
  color: #888;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}
.spare-toggle:hover { background: #d0d0d0; color: #555; }

.icebox-toggle {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 3px 5px;
  cursor: pointer;
  color: #888;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}
.icebox-toggle:hover { background: #d0d0d0; color: #555; }
.column[data-col="spare"].view-icebox .icebox-toggle { background: #b8d4e8; color: #2b5f8a; border-color: #9fc0d8; }

.learn-toggle {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 3px 5px;
  cursor: pointer;
  color: #888;
  display: inline-flex;
  align-items: center;
}
.learn-toggle:hover { background: #d0d0d0; color: #555; }
.column[data-col="spare"].view-learn .learn-toggle { background: #b8e0b8; color: #2b6f3a; border-color: #9fd0a8; }

.sort-btn {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 3px 5px;
  cursor: pointer;
  color: #888;
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}
.sort-btn:hover { background: #d0d0d0; color: #555; }

.column-songbook-link {
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 3px 5px;
  cursor: pointer;
  color: #888;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.column-songbook-link:hover { background: #d0d0d0; color: #555; }
.column[data-col="needs-practice"].col-empty { display: none; }

html.dark-mode .spare-menu { background: #222; border-color: #444; }
html.dark-mode .spare-menu button { color: #ddd; }
html.dark-mode .spare-menu button:hover { background: #333; }
html.dark-mode .spare-menu .spare-label { color: #888; }
html.dark-mode .spare-menu hr { border-top-color: #444; }
html.dark-mode .spare-menu .spare-active { background: rgba(59,130,246,0.2) !important; color: #93c5fd; }
html.dark-mode .spare-toggle { border-color: #444; color: #666; }
html.dark-mode .spare-toggle:hover { background: #3a3a3a; color: #aaa; }
html.dark-mode .icebox-toggle { border-color: #444; color: #666; }
html.dark-mode .icebox-toggle:hover { background: #3a3a3a; color: #aaa; }
html.dark-mode .column[data-col="spare"].view-icebox .icebox-toggle { background: #1e2a33; color: #93c5fd; border-color: #2a4a5a; }
html.dark-mode .learn-toggle { border-color: #444; color: #666; }
html.dark-mode .learn-toggle:hover { background: #3a3a3a; color: #aaa; }
html.dark-mode .column[data-col="spare"].view-learn .learn-toggle { background: #1e2f1e; color: #69db7c; border-color: #2a5a3a; }
html.dark-mode .sort-btn { border-color: #444; color: #666; }
html.dark-mode .sort-btn:hover { background: #3a3a3a; color: #aaa; }
html.dark-mode .column-songbook-link { border-color: #444; color: #666; }
html.dark-mode .column-songbook-link:hover { background: #3a3a3a; color: #aaa; }

/* Login page */
.flash {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  animation: flash-in 0.25s ease-out;
}

@keyframes flash-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.flash-alert { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-notice { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

html.dark-mode .flash-alert { background: #3b1a1a; color: #fca5a5; border-color: #5c2a2a; }
html.dark-mode .flash-notice { background: #1a2a3b; color: #93c5fd; border-color: #2a3a5c; }

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 20px;
  background: linear-gradient(135deg, #ebebeb 0%, #d4d4d4 100%);
}

html.dark-mode .login-page {
  background: linear-gradient(135deg, #1a1a1a 0%, #222 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.1);
  padding: 36px 32px 28px;
  animation: login-in 0.35s ease-out;
}

@keyframes login-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

html.dark-mode .login-card { background: #222; box-shadow: 0 4px 24px rgba(0,0,0,0.3); }

.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.login-logo { color: #3b82f6; }

.login-title {
  font-size: 22px;
  font-weight: 700;
  color: #222;
}

html.dark-mode .login-title { color: #eee; }

.login-form { display: flex; flex-direction: column; gap: 18px; }

.login-field { display: flex; flex-direction: column; gap: 6px; }

.login-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #888;
}

html.dark-mode .login-label { color: #999; }

.login-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d4d4d4;
  border-radius: 8px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  background: #f9f9f9;
  color: #333;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
  background: #fff;
}

html.dark-mode .login-input {
  background: #333;
  border-color: #444;
  color: #ddd;
}

html.dark-mode .login-input:focus {
  background: #3a3a3a;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.login-input::placeholder { color: #bbb; }
html.dark-mode .login-input::placeholder { color: #666; }

.login-submit {
  width: 100%;
  padding: 11px 16px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.login-submit:hover { background: #2563eb; }
.login-submit:active { background: #1d4ed8; }

html.dark-mode .login-submit:hover { background: #2563eb; }

.login-footer {
  text-align: center;
  margin-top: -6px;
}

.login-link {
  font-size: 13px;
  color: #3b82f6;
  text-decoration: none;
}

.login-link:hover { text-decoration: underline; }

html.dark-mode .login-link { color: #93c5fd; }

/* Card highlighting for grouping */
.card-highlighted {
  outline: 3px solid #3b82f6;
  outline-offset: 1px;
  box-shadow: 0 0 0 4px rgba(59,130,246,0.2);
}

html.dark-mode .card-highlighted {
  outline-color: #60a5fa;
  box-shadow: 0 0 0 4px rgba(96,165,250,0.25);
}

/* Card grouping indicator */
.card-grouped {
  border-left: 4px solid var(--group-color, #3b82f6);
  border-radius: 7px 3px 3px 7px;
}

html.dark-mode .card-grouped {
  border-left-width: 4px;
}

/* Group link icon on cards */
.card-group-icon {
  position: absolute;
  bottom: 4px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  opacity: 0.75;
  color: var(--group-color, #3b82f6);
  pointer-events: none;
}

.card-group-icon svg {
  display: block;
}

html.dark-mode .card-group-icon {
  opacity: 0.9;
}

/* Grouping mode banner */
.grouping-banner {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #3b82f6;
  color: #fff;
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(59,130,246,0.35);
  transition: opacity 0.2s ease;
}

html.dark-mode .grouping-banner {
  background: #2563eb;
  box-shadow: 0 2px 12px rgba(37,99,235,0.4);
}

.grouping-banner.hidden { display: none; }

#gigs-btn {
  background: none;
  border: none;
  border-radius: 6px;
  padding: 4px 6px;
  cursor: pointer;
  color: #555;
  text-decoration: none;
  transition: background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

#gigs-dropdown a {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  border-radius: 4px;
  color: #333;
  font-family: inherit;
  text-decoration: none;
}

#gigs-dropdown a:hover { background: #f0f0f0; }
#gigs-dropdown a.active { background: #dbeafe; color: #1a56db; font-weight: 600; }

html.dark-mode #gigs-dropdown a { color: #ddd; }
html.dark-mode #gigs-dropdown a:hover { background: #333; }
html.dark-mode #gigs-dropdown a.active { background: rgba(59,130,246,0.2); color: #93c5fd; }

#btn-new-gig {
  border-top: 1px solid #e8e8e8;
  margin-top: 4px;
  padding-top: 8px;
  color: #3b82f6;
  font-weight: 500;
}

html.dark-mode #btn-new-gig { border-top-color: #333; }

.gig-badge {
  font-size: 12px;
  font-weight: 400;
  color: #666;
  margin-left: 8px;
  white-space: nowrap;
}

.gig-badge a {
  color: #3b82f6;
  text-decoration: none;
  padding: 2px 8px;
  border-radius: 4px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
}

.gig-badge a:hover { background: #dbeafe; }

html.dark-mode .gig-badge { color: #999; }
html.dark-mode .gig-badge a { color: #93c5fd; background: rgba(59,130,246,0.1); border-color: rgba(59,130,246,0.2); }
html.dark-mode .gig-badge a:hover { background: rgba(59,130,246,0.2); }

[data-controller="board"] {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* ── Calendar page ───────────────────── */

.cal-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.cal-page header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #d4d4d4;
  flex-shrink: 0;
}

.cal-page header h1 {
  font-size: 18px;
  font-weight: 700;
  color: #222;
}

html.dark-mode .cal-page header { background: #222; border-color: #333; }
html.dark-mode .cal-page header h1 { color: #eee; }

.cal-board-link, .cal-new-btn {
  text-decoration: none;
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.cal-board-link {
  color: #3b82f6;
  background: none;
  border: 1px solid #d4d4d4;
  font-family: inherit;
}

.cal-board-link:hover { background: #f0f0f0; }

.cal-new-btn {
  background: #3b82f6;
  color: #fff;
  border: none;
  font-weight: 700;
  font-size: 16px;
  line-height: 1;
  margin-left: 6px;
}

.cal-new-btn:hover { background: #2563eb; }

html.dark-mode .cal-board-link { color: #93c5fd; border-color: #444; }
html.dark-mode .cal-board-link:hover { background: #333; }

.cal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 14px 20px;
  flex-shrink: 0;
}

.cal-nav-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  min-width: 180px;
  text-align: center;
}

.cal-nav-arrow {
  text-decoration: none;
  color: #888;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #d4d4d4;
  display: inline-flex;
  align-items: center;
}

.cal-nav-arrow:hover { background: #f0f0f0; color: #333; }

html.dark-mode .cal-nav-title { color: #ddd; }
html.dark-mode .cal-nav-arrow { color: #666; border-color: #444; }
html.dark-mode .cal-nav-arrow:hover { background: #333; color: #ddd; }

.cal-grid {
  flex: 1;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  border: 1px solid #d4d4d4;
  border-top: none;
  min-height: 0;
}

.cal-header {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid #d4d4d4;
  background: #f5f5f5;
}
.cal-header span {
  flex: 1;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #999;
  text-align: center;
  line-height: 1;
}

.cal-day {
  vertical-align: top;
  padding: 4px 6px;
  height: 80px;
  border: 1px solid #e8e8e8;
  border-top: none;
  background: #fff;
  position: relative;
}

.cal-day.cal-other { background: #f9f9f9; }
.cal-day.cal-today { background: #eff6ff; }

.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 4px;
}

.cal-other .cal-day-num { color: #bbb; }

.cal-has-gigs { box-shadow: inset 0 3px 0 #1a56db; }

.cal-day-gigs {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 52px;
}

.cal-gig {
  font-size: 12px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 4px;
  border-radius: 4px;
  background: #f5f5f5;
  cursor: grab;
  touch-action: manipulation;
}

.cal-gig-chosen { cursor: grabbing; }
.cal-gig-ghost { opacity: 0.35; }
.cal-gig-drag { cursor: grabbing; }
.cal-dragging-gig .cal-day-gigs { background: rgba(59, 130, 246, 0.05); }

.cal-gig-row {
  display: flex;
  align-items: center;
  gap: 3px;
}

.cal-gig-venue {
  font-weight: 600;
  color: #1a56db;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-gig-venue:hover { text-decoration: underline; }

.cal-gig-no-setlist { color: #888; }
.cal-gig-no-setlist:hover { text-decoration: none; }

html.dark-mode .cal-grid { border-color: #444; }
html.dark-mode .cal-header {
  background: #2a2a2a;
  border-bottom-color: #444;
}
html.dark-mode .cal-header span { color: #888; }
html.dark-mode .cal-day { background: #222; border-color: #333; }
html.dark-mode .cal-day.cal-other { background: #1a1a1a; }
html.dark-mode .cal-day.cal-today { background: rgba(59,130,246,0.08); }
html.dark-mode .cal-day-num { color: #ccc; }
html.dark-mode .cal-other .cal-day-num { color: #555; }

html.dark-mode .cal-has-gigs { box-shadow: inset 0 3px 0 #93c5fd; }

html.dark-mode .cal-gig { background: #2a2a2a; }
html.dark-mode .cal-gig-del { color: #666; }
html.dark-mode .cal-gig-del:hover { color: #f87171; }
html.dark-mode .cal-gig-venue { color: #93c5fd; }
html.dark-mode .cal-gig-no-setlist { color: #777; }


/* ── Gig panel (bottom half) ─────────── */

.panel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: #999;
  font-size: 14px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  flex-shrink: 0;
  gap: 12px;
}

.panel-header-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

form.inline {
  display: inline;
}

.panel-gig-info {
  font-size: 13px;
  font-weight: 600;
  color: #222;
  white-space: nowrap;
}

.panel-setlist-select {
  font-size: 12px;
  font-family: inherit;
  border: 1px solid #d4d4d4;
  border-radius: 3px;
  padding: 1px 4px;
  background: #fff;
  color: #555;
  cursor: pointer;
  max-width: 160px;
}

.panel-board {
  flex: 1;
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  overflow-x: auto;
  min-height: 0;
}

.panel-column {
  min-width: 200px;
  max-width: 300px;
  background: #e8e8e8;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.panel-column-header {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}

.panel-count, .panel-dur {
  font-weight: 400;
  color: #aaa;
  font-size: 10px;
}

.panel-column-body {
  flex: 1;
  padding: 2px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.panel-card {
  background: #fff;
  border-radius: 5px;
  padding: 6px 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.panel-card-title {
  font-size: 13px;
  font-weight: 600;
  color: #222;
}

.panel-card-artist {
  font-size: 11px;
  color: #888;
  margin-top: 1px;
}

.panel-card-meta {
  font-size: 10px;
  color: #999;
  margin-top: 3px;
  display: flex;
  gap: 6px;
}

.cal-gig-active {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
  border-radius: 3px;
}

html.dark-mode .panel-header { background: #222; border-bottom-color: #333; }
html.dark-mode .panel-footer { background: #222; border-top-color: #333; }
html.dark-mode .panel-gig-info { color: #eee; }
html.dark-mode .panel-setlist-select { background: #333; border-color: #444; color: #ddd; }
html.dark-mode .panel-column { background: #2a2a2a; }
html.dark-mode .panel-column-header { color: #aaa; }
html.dark-mode .panel-count, html.dark-mode .panel-dur { color: #666; }
html.dark-mode .panel-card { background: #333; }
html.dark-mode .panel-card-title { color: #eee; }
html.dark-mode .panel-card-artist { color: #999; }
html.dark-mode .panel-card-meta { color: #777; }
html.dark-mode .panel-empty { color: #666; }
html.dark-mode .cal-gig-active { outline-color: #93c5fd; }

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: #fff;
  border-top: 1px solid #e0e0e0;
  flex-shrink: 0;
}

.panel-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-gig-details {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 140px 100px minmax(160px, 1fr) auto;
  align-items: end;
  gap: 8px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
}

.panel-gig-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-gig-field label {
  font-size: 11px;
  font-weight: 600;
}

.panel-gig-notes-input {
  grid-column: 1 / -2;
  min-height: 38px;
  resize: vertical;
}

html.dark-mode .panel-gig-details {
  background: #222;
  border-bottom-color: #333;
}

@media (max-width: 800px) {
  .panel-gig-details {
    grid-template-columns: 1fr;
  }

  .panel-gig-notes-input {
    grid-column: auto;
  }
}

#gig-setlist-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#gig-setlist-panel-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

#gig-setlist-panel-content .panel-header,
#gig-setlist-panel-content .panel-footer {
  flex-shrink: 0;
}

#gig-setlist-panel-content > .shared-page {
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
}

/* Public shared setlist view */
.shared-page {
  max-width: 640px;
  margin: 40px auto;
  padding: 0 20px;
}

.shared-title {
  font-size: 28px;
  font-weight: 700;
  color: #222;
  margin-bottom: 32px;
}

.shared-set {
  margin-bottom: 28px;
}

.shared-set-title {
  font-size: 18px;
  font-weight: 600;
  color: #444;
  border-bottom: 2px solid #d4d4d4;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

.shared-count {
  font-size: 14px;
  font-weight: 400;
  color: #888;
  margin-left: 8px;
}

.shared-song-list {
  list-style: none;
  padding: 0;
}

.shared-song {
  padding: 6px 0 6px 8px;
  font-size: 15px;
  line-height: 1.5;
  border-bottom: 1px solid #eee;
  counter-increment: song-counter;
}

.shared-song-list {
  counter-reset: song-counter;
}

.shared-song::before {
  content: counter(song-counter) ".";
  color: #888;
  margin-right: 6px;
  font-variant-numeric: tabular-nums;
}

.shared-artist {
  color: #666;
}

.shared-details {
  color: #888;
  font-size: 13px;
}

.shared-page, .shared-page * {
  user-select: text;
  -webkit-user-select: text;
}

/* ── Tune section in song modal ──────────────── */

/* ── Multi-tune chord chart display ──────────── */

.tune-divider {
  border: none;
  border-top: 1px solid #ddd;
  margin: 16px 0;
}

.tune-chart-header {
  font-size: 14px;
  font-weight: 600;
  color: #444;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #eee;
}

.chart-edit-btn {
  font-size: 11px;
  font-weight: 500;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1px 8px;
  cursor: pointer;
  color: #555;
  float: right;
}

.chart-edit-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}

.empty-state {
  color: #888;
  text-align: center;
  padding: 40px 0;
}

/* ── Songbook ───────────────────────────────────── */

.songbook-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.songbook-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid #d4d4d4;
  background: #fafafa;
  gap: 16px;
}
.songbook-page-header h1 { font-size: 20px; font-weight: 700; color: #222; margin: 0; flex-shrink: 0; }
.songbook-filter-input {
  flex: 1;
  max-width: 400px;
  padding: 6px 12px;
  font-size: 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-family: inherit;
  outline: none;
}
.songbook-filter-wrap { position: relative; flex: 1; max-width: 400px; }
.songbook-filter-wrap .songbook-filter-input { width: 100%; max-width: none; padding-right: 32px; }
.songbook-filter-wrap .search-hint {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.songbook-filter-input:focus { border-color: #1a56db; box-shadow: 0 0 0 2px rgba(26,86,219,0.15); }
.songbook-filter-input::placeholder { color: #999; }
.songbook-page-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.songbook-mobile-nav-btn {
  display: none;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  background: none;
  border: 1px solid #ccc;
  border-radius: 7px;
  padding: 6px 10px;
  cursor: pointer;
  color: #444;
  font-family: inherit;
}
.songbook-mobile-nav-btn:hover { background: #f0f0f0; border-color: #bbb; }
.songbook-back-btn {
  font-size: 14px;
  color: #1a56db;
  text-decoration: none;
  font-weight: 500;
}
.songbook-back-btn:hover { text-decoration: underline; }
.songbook-layout { display: flex; flex: 1; overflow: hidden; position: relative; min-height: 0; }

html.dark-mode .songbook-page-header { background: #1a1a1a; border-color: #333; }
html.dark-mode .songbook-page-header h1 { color: #eee; }
html.dark-mode .songbook-filter-input { background: #2a2a2a; border-color: #555; color: #ddd; }
html.dark-mode .songbook-filter-input:focus { border-color: #60a5fa; box-shadow: 0 0 0 2px rgba(96,165,250,0.15); }
html.dark-mode .songbook-filter-input::placeholder { color: #777; }
html.dark-mode .songbook-back-btn { color: #60a5fa; }
html.dark-mode .songbook-mobile-nav-btn { border-color: #555; color: #ddd; }
html.dark-mode .songbook-mobile-nav-btn:hover { background: #333; border-color: #666; }

.songbook-overlay {
  position: absolute;
  inset: 0;
  z-index: 19;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(15, 23, 42, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.songbook-nav {
  width: 260px;
  border-right: 1px solid #d4d4d4;
  display: flex;
  flex-direction: column;
  background: #fafafa;
  flex-shrink: 0;
  user-select: text;
  -webkit-user-select: text;
}
.songbook-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid #d4d4d4;
}
.songbook-view-label { font-size: 15px; font-weight: 600; color: #222; }
.songbook-view-hint { font-weight: 400; color: #999; font-size: 12px; margin-left: 4px; }
.songbook-view-hint kbd {
  font-family: inherit;
  font-size: 11px;
  padding: 1px 4px;
  border: 1px solid #ccc;
  border-radius: 3px;
  background: #f5f5f5;
  color: #888;
}
.songbook-close-btn {
  background: none;
  border: none;
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  color: #555;
  display: inline-flex;
  align-items: center;
}
.songbook-close-btn:hover { background: #e8e8e8; }
.songbook-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.songbook-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 16px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  font-family: inherit;
  border-radius: 0;
  line-height: 1.3;
}
.songbook-item:hover { background: #e8e8e8; }
.songbook-item.active { background: #dbeafe; color: #1a56db; font-weight: 600; }
.songbook-detail {
  flex: 1;
  overflow: hidden;
  background: #fff;
  user-select: text;
  -webkit-user-select: text;
}
.songbook-detail-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.songbook-detail-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 32px;
  overscroll-behavior: contain;
}
.songbook-detail-footer {
  position: sticky;
  bottom: 0;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-height: 48px;
  padding: 10px 32px;
  background: #fff;
  border-top: 1px solid #e5e5e5;
}
.songbook-detail-footer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.songbook-detail-nav-btn {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 84px;
  max-width: 220px;
  font-size: 12px;
  font-weight: 500;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 5px 10px;
  cursor: pointer;
  color: #555;
  font-family: inherit;
}
.songbook-detail-nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.songbook-detail-nav-arrow {
  flex: 0 0 auto;
}
.songbook-detail-nav-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}
.songbook-detail-nav-btn:disabled {
  cursor: default;
  color: #aaa;
  border-color: #ddd;
  background: transparent;
}
.songbook-detail-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  font-size: 16px;
}
.songbook-detail-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 24px;
  font-weight: 700;
  color: #222;
  margin-bottom: 4px;
}
.songbook-detail-heading-line {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: 0;
}
.songbook-detail-title-text {
  flex: 0 1 auto;
}
.songbook-detail-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}
.songbook-detail-subtitle {
  display: inline;
  font-weight: 400;
  font-size: 18px;
  color: #666;
  white-space: nowrap;
}
.songbook-detail-title .songbook-detail-edit-btn {
  font-size: 12px;
  font-weight: 500;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1px 8px;
  cursor: pointer;
  color: #666;
  font-family: inherit;
  vertical-align: middle;
  margin-left: 8px;
}
.songbook-detail-title .songbook-detail-edit-btn:hover { background: #f0f0f0; color: #333; }
.songbook-detail-title .songbook-detail-delete-btn {
  font-size: 12px;
  font-weight: 500;
  background: none;
  border: 1px solid #e0b0b0;
  border-radius: 4px;
  padding: 1px 8px;
  cursor: pointer;
  color: #c0392b;
  font-family: inherit;
  vertical-align: middle;
  margin-left: 4px;
}
.songbook-detail-title .songbook-detail-delete-btn:hover { background: #fff0f0; color: #a00; }
html.dark-mode .songbook-detail-title .songbook-detail-edit-btn { border-color: #555; color: #999; }
html.dark-mode .songbook-detail-title .songbook-detail-edit-btn:hover { background: #333; color: #ddd; }
html.dark-mode .songbook-detail-title .songbook-detail-delete-btn { border-color: #633; color: #e07070; }
html.dark-mode .songbook-detail-title .songbook-detail-delete-btn:hover { background: #2a1a1a; color: #f88; }
.songbook-detail-artist {
  font-size: 16px;
  color: #666;
  margin-bottom: 16px;
}
.songbook-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.songbook-detail-singer {
  margin-bottom: 16px;
}
.songbook-detail-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  background: #f0f0f0;
  color: #555;
}
.songbook-detail-tag.singer-tag {
  color: #333;
}
.songbook-detail-note {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  color: #333;
  line-height: 1.5;
  margin-bottom: 16px;
  white-space: pre-wrap;
}
.songbook-detail-user-note {
  background: #f5f3ff;
  border: 1px solid #e9d5ff;
  border-radius: 6px;
  padding: 12px;
  font-size: 13px;
  color: #7c3aed;
  line-height: 1.5;
  margin-bottom: 16px;
  white-space: pre-wrap;
}
.songbook-detail-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.songbook-detail-link-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.songbook-detail-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #3b82f6;
  font-size: 13px;
  text-decoration: none;
}
.songbook-detail-link:hover { text-decoration: underline; }
.songbook-detail-link-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  opacity: 0.75;
}
.songbook-detail-link-label { font-weight: 500; }
.songbook-detail-link-copy {
  color: #999;
}
.songbook-detail-chart h3 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}
.songbook-chart-title-label {
  display: inline;
}
.songbook-detail-chart {
  margin-top: 16px;
}
.songbook-medley-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.songbook-medley-song {
  padding-top: 18px;
  border-top: 1px solid #ededed;
}
.songbook-medley-song:first-child {
  border-top: none;
  padding-top: 0;
}
.songbook-medley-song-header {
  margin-bottom: 6px;
}
.songbook-medley-song-title {
  margin-bottom: 0;
  font-size: 20px;
}
.songbook-detail-chart .chord-text { color: #e11d48; font-weight: 600; }
.songbook-detail-chart .chord-upper { font-weight: normal; }
.songbook-chart-empty { color: #999; font-size: 13px; padding: 4px 0; }

.songbook-chart-diagrams-toggle {
  font-size: 12px;
  padding: 2px 0 4px;
}
.songbook-chart-diagrams-toggle a {
  color: #e11d48;
  text-decoration: none;
  cursor: pointer;
}
.songbook-chart-diagrams-toggle a:hover { text-decoration: underline; }
.songbook-diagrams-count { color: #888; font-size: 11px; }
.songbook-chart-diagrams {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
  align-items: center;
}

html.dark-mode .songbook-chart-diagrams-toggle a { color: #fb7185; }
html.dark-mode .songbook-diagrams-count { color: #666; }
html.dark-mode .songbook-chart-diagrams { border-bottom-color: #333; }

.songbook-chart-body {
  font-size: 14px;
  font-weight: bold;
  line-height: 1.8;
  white-space: pre-wrap;
  color: #333;
  padding: 4px 0;
  user-select: text;
  -webkit-user-select: text;
}
.songbook-chart-body-tune {
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  font-weight: bold;
  font-size: 13px;
}
.songbook-chart-body .chord { color: #e11d48; }
.songbook-chart-body .backing { font-weight: normal; }
.songbook-chart-body .chord-upper { font-weight: normal; }
.songbook-chart-body .directive { font-weight: normal; }
.songbook-chart-body hr.page-break { border: none; border-top: 2px dashed #999; margin: 1em 0; opacity: 0.6; }

html.dark-mode .songbook-chart-body { color: #ddd; }
html.dark-mode .songbook-chart-body .chord { color: #fb7185; }
html.dark-mode .songbook-chart-body .backing { font-weight: normal; }
html.dark-mode .songbook-chart-body .directive { font-weight: normal; }

.songbook-edit-chart-btn {
  font-size: 11px;
  font-weight: 500;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1px 8px;
  cursor: pointer;
  color: #555;
  margin-left: 8px;
  vertical-align: middle;
  font-family: inherit;
}

.songbook-edit-chart-btn:hover,
.songbook-import-chart-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}

.songbook-big-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1px 8px;
  cursor: pointer;
  color: #555;
  margin-left: 8px;
  vertical-align: middle;
  font-family: inherit;
}

.songbook-big-mode-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}

.songbook-metronome-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1px 8px;
  cursor: pointer;
  color: #555;
  vertical-align: middle;
  font-family: inherit;
}

.songbook-metronome-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}

.songbook-metronome-btn.active {
  background: #111;
  border-color: #111;
  color: #fff;
}

.songbook-big-mode-size-btn {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  color: #555;
  font-family: inherit;
}

.songbook-big-mode-size-btn:hover {
  background: #f0f0f0;
  border-color: #999;
}

.songbook-import-chart-btn {
  font-size: 11px;
  font-weight: 500;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1px 8px;
  cursor: pointer;
  color: #555;
  margin-left: 4px;
  vertical-align: middle;
  font-family: inherit;
}

.songbook-pdf-link {
  font-size: 11px;
  font-weight: 500;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 1px 8px;
  color: #555;
  margin-left: 4px;
  vertical-align: middle;
  text-decoration: none;
  display: inline-block;
}

.songbook-pdf-link:hover {
  background: #f0f0f0;
  border-color: #999;
}

.songbook-import-area { margin-top: 8px; }
.songbook-import-hint {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
  line-height: 1.5;
}
.songbook-import-hint code {
  background: #eee;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 12px;
  color: #e11d48;
}

html.dark-mode .songbook-import-chart-btn { border-color: #555; color: #999; }
html.dark-mode .songbook-import-chart-btn:hover { background: #333; border-color: #777; color: #ddd; }
html.dark-mode .songbook-metronome-btn { border-color: #555; color: #bbb; }
html.dark-mode .songbook-metronome-btn:hover { background: #333; border-color: #777; color: #eee; }
html.dark-mode .songbook-metronome-btn.active { background: #f4f4f5; border-color: #f4f4f5; color: #111; }
html.dark-mode .songbook-big-mode-btn { border-color: #555; color: #bbb; }
html.dark-mode .songbook-big-mode-btn:hover { background: #333; border-color: #777; color: #eee; }
html.dark-mode .songbook-big-mode-size-btn { border-color: #555; color: #bbb; }
html.dark-mode .songbook-big-mode-size-btn:hover { background: #333; border-color: #777; color: #eee; }
html.dark-mode .songbook-pdf-link { border-color: #555; color: #999; }
html.dark-mode .songbook-pdf-link:hover { background: #333; border-color: #777; color: #ddd; }
html.dark-mode .songbook-import-hint { color: #888; }
html.dark-mode .songbook-import-hint code { background: #3a3a3a; color: #fb7185; }

.songbook-chart-edit-layout {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}
.songbook-chart-edit-layout .songbook-chart-editor-wrap {
  flex: 1;
  min-width: 0;
}
.songbook-chart-edit-layout .songbook-chart-editor {
  width: 100%;
  box-sizing: border-box;
}
.songbook-chart-preview-wrap {
  flex: 1;
  min-width: 0;
  margin-top: 0;
}
.songbook-chart-preview-body {
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 14px;
  font-size: 14px;
  font-weight: bold;
  line-height: 1.8;
  white-space: pre-wrap;
  color: #333;
  user-select: text;
  -webkit-user-select: text;
}
.songbook-chart-preview-body .chord { color: #e11d48; }
.songbook-chart-preview-body .backing { font-weight: normal; }
.songbook-chart-preview-body .chord-upper { font-weight: normal; }
.songbook-chart-preview-body .directive { font-weight: normal; }
.songbook-chart-preview-body hr.page-break { border: none; border-top: 2px dashed #999; margin: 1em 0; opacity: 0.6; }

html.dark-mode .songbook-chart-preview-body { background: #2a2a2a; border-color: #444; color: #ddd; }
html.dark-mode .songbook-chart-preview-body .chord { color: #fb7185; }
html.dark-mode .songbook-chart-preview-body .backing { font-weight: normal; }

/* ── Medley manager kanban ───────────────────── */
.medleys-page {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.medleys-page .new-medley-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 520px;
}

.medleys-page .new-medley-form select {
  flex: 1;
  min-width: 220px;
}

#medleys-board {
  display: flex;
  gap: 14px;
  padding: 14px;
  overflow: auto;
  flex: 1;
  align-items: stretch;
}

.medleys-list-column {
  flex: 0 0 280px;
}

.medley-selected-wrap {
  display: flex;
  flex: 1;
  min-width: 300px;
  max-width: 400px;
  flex-direction: column;
}

.medley-selected-wrap .medley-kanban-column {
  flex: 1;
}

.medley-kanban-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.medley-kanban-column--available {
  flex: 1.2;
  max-width: none;
}

.medley-kanban-column-header {
  justify-content: space-between;
}

.medley-song-filter {
  margin: 0 10px 6px;
}

.medleys-list-body {
  gap: 6px;
}

.medley-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  color: #222;
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
}

.medley-item:hover,
.medley-item.active {
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.medley-item.active {
  outline: 2px solid #3b82f6;
  outline-offset: 1px;
}

.medley-item-title,
.medley-item-count {
  display: block;
}

.medley-item-title {
  font-weight: 600;
}

.medley-item-count {
  margin-top: 3px;
  color: #999;
  font-size: 12px;
}

.medley-kanban-empty,
.medley-kanban-loading {
  display: none;
  padding: 16px 8px;
  color: #888;
  text-align: center;
}

.medley-kanban-body.is-empty .medley-kanban-empty {
  display: block;
}

.medley-kanban-card--ghost {
  opacity: 0.45;
}

.medley-kanban-card-title {
  font-weight: 600;
}

.medley-kanban-card-artist {
  margin-top: 2px;
  color: #777;
  font-size: 12px;
}

.medley-kanban-card-meta {
  margin-top: 6px;
}

.medley-kind-badge {
  color: #999;
  font-size: 11px;
  text-transform: uppercase;
}

html.dark-mode .medley-item {
  background: #222;
  color: #ddd;
}

html.dark-mode .medley-item-count,
html.dark-mode .medley-kanban-card-artist,
html.dark-mode .medley-kind-badge,
html.dark-mode .medley-kanban-empty,
html.dark-mode .medley-kanban-loading {
  color: #777;
}

@media (max-width: 900px) {
  #medleys-board {
    flex-direction: column;
  }

  .medleys-list-column,
  .medley-selected-wrap,
  .medley-kanban-column--available {
    flex: none;
    max-width: none;
  }
}

.songbook-chart-help { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; }
.songbook-chart-help-toggle,
.songbook-chart-preview-btn,
.songbook-chart-chorus-btn {
  font-size: 12px;
  font-weight: 500;
  background: none;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 2px 10px;
  cursor: pointer;
  color: #666;
  font-family: inherit;
  transition: background 0.15s;
}
.songbook-chart-help-toggle:hover,
.songbook-chart-preview-btn:hover { background: #f0f0f0; color: #333; }
.songbook-chart-help-body {
  flex: 0 0 100%;
  background: #f9f9f9;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px 14px;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.7;
  color: #555;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.songbook-chart-help-body p { margin: 0; }
.songbook-chart-help-body ul { margin: 0; padding-left: 16px; list-style: none; }
.songbook-chart-help-body li { margin-bottom: 4px; }
.songbook-chart-help-body .help-shortcuts { color: #888; }
.songbook-chart-help-body .help-shortcuts kbd {
  display: inline-block;
  background: #eee;
  border: 1px solid #ddd;
  border-radius: 3px;
  padding: 0 5px;
  font-size: 11px;
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  color: #555;
  line-height: 1.6;
}
.songbook-chart-help-body code {
  background: #eee;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
  color: #e11d48;
}

html.dark-mode .songbook-chart-help-toggle,
html.dark-mode .songbook-chart-preview-btn { border-color: #555; color: #999; }
html.dark-mode .songbook-chart-help-toggle:hover,
html.dark-mode .songbook-chart-preview-btn:hover { background: #333; color: #ddd; }
html.dark-mode .songbook-chart-help-body { background: #2a2a2a; border-color: #444; color: #bbb; }
html.dark-mode .songbook-chart-help-body code { background: #3a3a3a; color: #fb7185; }
html.dark-mode .songbook-chart-help-body .help-shortcuts kbd { background: #3a3a3a; border-color: #555; color: #ccc; }

.songbook-chart-editor {
  width: 100%;
  min-height: 200px;
  font-size: 14px;
  line-height: 1.8;
  font-family: "SF Mono", "Menlo", "Monaco", "Consolas", monospace;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  resize: vertical;
  tab-size: 2;
  white-space: pre;
  background: #f9f9f9;
  color: #333;
  outline: none;
  box-sizing: border-box;
  margin-top: 8px;
}

.songbook-chart-editor:focus {
  border-color: #e11d48;
  box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.15);
}

.songbook-editor-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.songbook-editor-actions .btn-primary { flex: 0 1 auto; }
.songbook-editor-actions .btn-secondary { flex: 0 1 auto; }

html.dark-mode .songbook-overlay {
  background: rgba(0, 0, 0, 0.48);
}
html.dark-mode .songbook-nav {
  background: #222;
  border-right-color: #333;
}
html.dark-mode .songbook-nav-header {
  color: #ddd;
  border-bottom-color: #333;
}
html.dark-mode .songbook-view-label { color: #ddd; }
html.dark-mode .songbook-view-hint { color: #666; }
html.dark-mode .songbook-view-hint kbd { border-color: #555; background: #2a2a2a; color: #777; }
html.dark-mode .songbook-close-btn { color: #999; }
html.dark-mode .songbook-close-btn:hover { background: #333; }
html.dark-mode .songbook-item { color: #ccc; }
html.dark-mode .songbook-item:hover { background: #333; }
html.dark-mode .songbook-item.active { background: rgba(59,130,246,0.2); color: #93c5fd; }
html.dark-mode .songbook-detail { background: #1a1a1a; }
html.dark-mode .songbook-detail-footer { background: #1a1a1a; border-top-color: #333; }
html.dark-mode .songbook-detail-empty { color: #666; }
html.dark-mode .songbook-detail-title { color: #eee; }
html.dark-mode .songbook-detail-artist { color: #999; }
html.dark-mode .songbook-detail-tag { background: #333; color: #bbb; }
html.dark-mode .songbook-detail-tag.singer-tag { color: #ddd; }
html.dark-mode .songbook-detail-note { background: #3b3520; border-color: #5c5228; color: #ddd; }
html.dark-mode .songbook-detail-user-note { background: #2d1b3a; border-color: #5b21b6; color: #c4b5fd; }
html.dark-mode .songbook-detail-chart h3 { color: #ccc; }
html.dark-mode .songbook-medley-song { border-top-color: #333; }
html.dark-mode .songbook-edit-chart-btn { border-color: #555; color: #999; }
html.dark-mode .songbook-edit-chart-btn:hover { background: #333; border-color: #777; color: #ddd; }
html.dark-mode .songbook-chart-editor { background: #1e1e1e; color: #ddd; border-color: #444; }
html.dark-mode .songbook-chart-editor:focus { border-color: #fb7185; box-shadow: 0 0 0 2px rgba(251, 113, 133, 0.15); }

body.songbook-big-mode {
  overflow: hidden;
}

.songbook-big-mode .songbook-page {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: #fff;
}

.songbook-big-mode .songbook-page-header,
.songbook-big-mode .songbook-nav,
.songbook-big-mode .songbook-overlay,
.songbook-big-mode .songbook-detail-meta,
.songbook-big-mode .songbook-detail-note,
.songbook-big-mode .songbook-detail-url,
.songbook-big-mode .songbook-detail-title .songbook-detail-edit-btn,
.songbook-big-mode .songbook-detail-title .songbook-detail-delete-btn,
.songbook-big-mode .songbook-edit-chart-btn,
.songbook-big-mode .songbook-import-chart-btn,
.songbook-big-mode .songbook-chart-diagrams-toggle,
.songbook-big-mode .songbook-chart-diagrams {
  display: none !important;
}

.songbook-big-mode .songbook-layout,
.songbook-big-mode .songbook-detail,
.songbook-big-mode .songbook-detail-shell {
  height: 100%;
}

.songbook-big-mode .songbook-detail {
  width: 100%;
}

.songbook-detail {
  position: relative;
}

.songbook-detail::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #bdbdbd;
  opacity: 0;
  pointer-events: none;
  transition: opacity 70ms linear;
  z-index: 8;
  mix-blend-mode: multiply;
}

.songbook-detail.songbook-metronome-flash::after {
  opacity: 0.4;
}

html.dark-mode .songbook-detail::after {
  background: #767676;
  mix-blend-mode: screen;
}

.songbook-big-mode .songbook-detail-body {
  padding: 20px 24px 28px;
  background: #fff;
}

.songbook-big-mode .songbook-detail-footer {
  position: sticky;
  bottom: 0;
  z-index: 4;
  justify-content: center;
  padding: 10px 18px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.songbook-big-mode .songbook-detail-footer-actions {
  gap: 10px;
}

.songbook-big-mode .songbook-detail-nav-btn {
  display: inline-flex;
  padding: 5px 10px;
  font-size: 12px;
}

.songbook-big-mode .songbook-big-mode-size-btn {
  display: inline-flex;
}

.songbook-big-mode .songbook-pdf-link--footer {
  display: none;
}

.songbook-big-mode .songbook-detail-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: nowrap;
  font-size: 28px;
  margin-bottom: 10px;
}

.songbook-big-mode .songbook-detail-subtitle {
  display: inline;
  margin-top: 0;
  white-space: nowrap;
  font-size: 18px;
  line-height: 1.35;
}

.songbook-big-mode .songbook-detail-chart {
  margin-top: 18px;
}

.songbook-big-mode .songbook-chart-title-label {
  display: none;
}

.songbook-big-mode .songbook-big-mode-btn {
  padding: 5px 10px;
  font-size: 12px;
  background: #111;
  border-color: #111;
  color: #fff;
}

.songbook-big-mode .songbook-metronome-btn {
  padding: 5px 10px;
  font-size: 12px;
}

.songbook-big-mode .songbook-metronome-btn.active {
  background: #111;
  border-color: #111;
  color: #fff;
}

.songbook-big-mode .songbook-big-mode-btn:hover {
  background: #222;
  border-color: #222;
}

.songbook-big-mode .songbook-metronome-btn:hover {
  background: #f0f0f0;
  border-color: #999;
  color: #555;
}

.songbook-big-mode .songbook-metronome-btn.active:hover {
  background: #222;
  border-color: #222;
  color: #fff;
}

.songbook-big-mode .songbook-chart-body {
  font-size: calc(30px * var(--songbook-big-mode-font-scale, 1));
  line-height: 2.05;
}

.songbook-big-mode .songbook-chart-body-tune {
  font-size: calc(26px * var(--songbook-big-mode-font-scale, 1));
}

.songbook-big-mode .songbook-chart-empty {
  font-size: 18px;
  padding-top: 12px;
}

html.dark-mode body.songbook-big-mode,
html.dark-mode .songbook-big-mode .songbook-page {
  background: #111;
}

html.dark-mode .songbook-big-mode .songbook-detail-body,
html.dark-mode .songbook-big-mode .songbook-detail-footer {
  background: #111;
}

html.dark-mode .songbook-big-mode .songbook-metronome-btn {
  border-color: #555;
  color: #bbb;
}

html.dark-mode .songbook-big-mode .songbook-metronome-btn:hover {
  background: #333;
  border-color: #777;
  color: #eee;
}

html.dark-mode .songbook-big-mode .songbook-metronome-btn.active {
  background: #f4f4f5;
  border-color: #f4f4f5;
  color: #111;
}

html.dark-mode .songbook-detail-nav-btn {
  border-color: #555;
  color: #bbb;
}

html.dark-mode .songbook-detail-nav-btn:hover {
  background: #333;
  border-color: #777;
  color: #eee;
}

html.dark-mode .songbook-detail-nav-btn:disabled {
  border-color: #444;
  color: #666;
  background: transparent;
}

html.dark-mode .songbook-big-mode .songbook-big-mode-btn {
  background: #f4f4f5;
  border-color: #f4f4f5;
  color: #111;
}

html.dark-mode .songbook-big-mode .songbook-big-mode-btn:hover {
  background: #fff;
  border-color: #fff;
}

@media (max-width: 900px) {
  body.songbook-mobile-nav-open {
    overflow: hidden;
  }

  .songbook-page-header {
    gap: 10px;
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  .songbook-page-header h1 {
    font-size: 18px;
  }

  .songbook-filter-wrap {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  .songbook-page-actions {
    margin-left: auto;
  }

  .songbook-mobile-nav-btn {
    display: inline-flex;
  }

  .songbook-nav {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, calc(100vw - 48px));
    max-width: 100%;
    z-index: 20;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.18);
  }

  .songbook-close-btn {
    display: inline-flex;
  }

  .songbook-nav-open .songbook-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .songbook-nav-open .songbook-nav {
    transform: translateX(0);
  }

  .songbook-detail {
    width: 100%;
    min-width: 0;
  }

  .songbook-detail-body {
    padding: 16px;
  }

  .songbook-detail-footer {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .songbook-detail-title {
    font-size: 22px;
    line-height: 1.15;
  }

  .songbook-detail-subtitle {
    margin-top: 0;
    font-size: 15px;
    line-height: 1.3;
  }

  .songbook-detail-title .songbook-detail-edit-btn,
  .songbook-detail-title .songbook-detail-delete-btn {
    margin-top: 8px;
    margin-left: 0;
    margin-right: 6px;
  }

  .songbook-medley-list {
    gap: 18px;
  }

  .songbook-medley-song {
    padding-top: 14px;
  }

  .songbook-medley-song-title {
    font-size: 18px;
  }

  .songbook-chart-edit-layout {
    flex-direction: column;
  }

  .songbook-chart-help-body {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .songbook-big-mode .songbook-detail-body {
    padding: 14px 16px 22px;
  }

  .songbook-big-mode .songbook-detail-title {
    font-size: 22px;
    margin-bottom: 8px;
  }

  .songbook-big-mode .songbook-detail-subtitle {
    margin-top: 0;
    white-space: nowrap;
    font-size: 15px;
  }

  .songbook-big-mode .songbook-big-mode-btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .songbook-big-mode .songbook-big-mode-size-btn {
    min-width: 30px;
    padding: 5px 8px;
    font-size: 16px;
  }

  .songbook-big-mode .songbook-chart-body {
    font-size: calc(24px * var(--songbook-big-mode-font-scale, 1));
    line-height: 1.95;
  }

  .songbook-big-mode .songbook-chart-body-tune {
    font-size: calc(20px * var(--songbook-big-mode-font-scale, 1));
  }
}

@media (min-width: 901px) {
  .songbook-close-btn {
    display: none;
  }
}

.import-main {
  max-width: 960px;
  margin: 40px auto;
  padding: 0 20px;
}

.import-dropzone {
  border: 2px dashed #ccc;
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: #fafafa;
}

.import-dropzone--over {
  border-color: #3b82f6;
  background: #eff6ff;
}

.import-dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #888;
}

.import-dropzone-content svg { color: #aaa; }

.import-dropzone-hint {
  font-size: 13px;
  color: #aaa;
}

.import-dropzone code {
  background: #eee;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}

.import-results { margin-top: 24px; }

.import-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.import-results-header h2 { font-size: 20px; font-weight: 600; }

.import-results-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.import-select-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  cursor: pointer;
}

.import-table-wrap {
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
}

.import-table {
  width: 100%;
  border-collapse: collapse;
}

.import-table th {
  background: #f5f5f5;
  text-align: left;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #666;
  border-bottom: 1px solid #ddd;
}

.import-table td {
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}

.import-table tr:last-child td { border-bottom: none; }

.import-table tr:hover td { background: #fafafa; }

.import-col-check { width: 40px; }

.import-badge-new {
  display: inline-block;
  background: #d1fae5;
  color: #065f46;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.import-badge-update {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.import-done {
  margin-top: 40px;
  text-align: center;
}

.import-done h2 { font-size: 24px; margin-bottom: 8px; }
.import-done p { color: #666; margin-bottom: 20px; }

html.dark-mode .import-main { color: #ddd; }

html.dark-mode .import-dropzone {
  border-color: #555;
  background: #2a2a2a;
}

html.dark-mode .import-dropzone--over {
  border-color: #60a5fa;
  background: #1e3a5f;
}

html.dark-mode .import-dropzone-content { color: #888; }
html.dark-mode .import-dropzone-content svg { color: #666; }
html.dark-mode .import-dropzone code { background: #333; color: #ddd; }

html.dark-mode .import-table-wrap { border-color: #444; }
html.dark-mode .import-table th { background: #2a2a2a; color: #999; border-color: #444; }
html.dark-mode .import-table td { border-color: #333; }
html.dark-mode .import-table tr:hover td { background: #2a2a2a; }

html.dark-mode .import-badge-new { background: #064e3b; color: #6ee7b7; }
html.dark-mode .import-badge-update { background: #451a03; color: #fbbf24; }
