:root {
  color-scheme: dark;
  --bg: #0b0d11;
  --panel: #11141a;
  --panel-2: #181c24;
  --line: #292e39;
  --text: #f5f7fa;
  --muted: #9ca4b2;
  --accent: #e79024;
  --accent-soft: rgba(231, 144, 36, 0.14);
  --green: #65b998;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
}

body.locked { overflow: hidden; }
body.locked .app-shell,
body.locked .sidebar-scrim,
body.locked .save-notice { visibility: hidden; }

button, input { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(11, 13, 17, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: #16110b;
  font-size: 25px;
  font-weight: 700;
}

.eyebrow, .song-type {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.brand h1 { margin: 0; font-size: 1.23rem; line-height: 1; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
/* Proyectos y Nueva cancion viven a la izquierda, pegados a la marca; el
   margin-right empuja al resto contra el borde derecho. */
.topbar-left { display: flex; align-items: center; gap: 8px; margin: 0 auto 0 18px; }
.setlist-action, .organize-action, .online-action, .logout-action, .project-switch, .new-song-action, .calendar-action {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  font-weight: 600;
  cursor: pointer;
}
.organize-action { color: var(--accent); }
.calendar-action { color: #8ebce8; }
.calendar-action::before { content: "▣"; margin-right: 7px; }
.project-switch { color: var(--muted); }
.project-switch::before { content: "◫"; margin-right: 7px; }
/* Volver al portal: solo en Dos Corazones. Es un enlace con forma de botón. */
.volver-portal { display: inline-flex; align-items: center; justify-content: center; color: var(--accent); text-decoration: none; }
.volver-portal::before { content: "←"; }
.volver-portal[hidden] { display: none; }
.new-song-action { color: var(--accent); }
.new-song-action::before { content: "+"; margin-right: 7px; font-weight: 700; }
.online-action { color: var(--muted); }
.online-action::before { content: "☁"; margin-right: 7px; }
.online-action.syncing { color: #f4aa4d; }
.online-action.online { border-color: rgba(101, 185, 152, 0.55); background: rgba(101, 185, 152, 0.12); color: #8bd0b5; }
.logout-action { color: #e98585; }
.logout-action::before { content: "↪"; margin-right: 7px; }

.setlist-action span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  margin-left: 7px;
  place-items: center;
  border-radius: 999px;
  background: #2b303a;
  color: var(--muted);
  font-size: 0.75rem;
}
.setlist-action.active { border-color: var(--accent); background: var(--accent-soft); }

.workspace {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  min-height: calc(100vh - 82px);
}

.sidebar {
  position: sticky;
  top: 82px;
  height: calc(100vh - 82px);
  overflow-y: auto;
  padding: 22px 18px 30px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.sidebar-head { display: flex; gap: 8px; }
.search-box {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0d1015;
  color: var(--muted);
}
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search-box input::placeholder { color: #747c89; }

/* Quien canta, sobre la lista. Reutiliza el aire del chip que ya existe en
   el arbol; volver a tocar el que esta puesto quita el filtro. */
.vocalist-filter { display: flex; flex-wrap: wrap; gap: 5px; margin: 22px 4px 0; }
.vocalist-tag {
  min-height: 26px;
  padding: 3px 11px;
  border: 1px solid #303743;
  border-radius: 999px;
  background: #12161c;
  color: #aeb8c6;
  cursor: pointer;
  font: 600 0.7rem/1 "Inter", sans-serif;
}
.vocalist-tag:hover { border-color: #596474; color: var(--text); }
.vocalist-tag.pendiente { border-style: dashed; border-color: #4a5060; color: #8f99a8; }
.vocalist-tag.pendiente small { font-size: 0.85em; opacity: 0.75; }
.vocalist-tag.active {
  border-color: rgba(240, 148, 44, 0.65);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.list-heading { display: flex; align-items: center; justify-content: space-between; margin: 12px 4px 12px; }
.list-heading h2 { margin: 0; font-size: 0.87rem; text-transform: uppercase; letter-spacing: 0.08em; }
.list-heading span { color: var(--muted); font-size: 0.8rem; }

.song-list { display: grid; gap: 7px; }
.song-card-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 2px;
}
.song-card {
  width: 100%;
  min-height: 70px;
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.song-card:hover { background: var(--panel-2); }
.song-card[draggable="true"] { cursor: grab; }
.song-card.dragging { opacity: 0.45; cursor: grabbing; }
.song-delete {
  width: 34px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #e98585;
  cursor: pointer;
  font-size: 0.95rem;
}
.song-delete:hover, .song-delete:focus-visible { background: rgba(233, 133, 133, 0.14); outline: 0; }
.song-card.active { border-color: rgba(231, 144, 36, 0.45); background: var(--accent-soft); }
.song-number { color: #6f7784; font-family: "Roboto Mono", monospace; font-size: 0.76rem; }
.song-card.active .song-number { color: var(--accent); }
.song-card-copy { min-width: 0; display: grid; gap: 5px; }
.song-card-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.92rem; }
.song-card-copy small { color: var(--muted); font-size: 0.74rem; line-height: 1.35; white-space: normal; }
.song-vocalist { color: #dce3ed; }
.song-style { color: var(--accent); }
.song-arrow { color: #6d7581; font-size: 1.4rem; }
.empty-list { padding: 24px 12px; color: var(--muted); line-height: 1.5; }

.folder-browser { display: grid; gap: 3px; margin-top: 16px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.folder-link {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}
.folder-link:hover { background: var(--panel-2); color: var(--text); }
.folder-link.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.vocalist-link { font-size: 0.76rem; }
.folder-link.drag-target { outline: 2px solid var(--green); background: rgba(101, 185, 152, 0.16); color: #9ee1c6; }
.event-link.drag-target, .event-songs-link.drag-target, .setlist-action.drag-target, #setlistsRoot.drag-target {
  outline: 2px solid var(--green);
  outline-offset: -2px;
  background: rgba(101, 185, 152, 0.18);
  color: #a8e0c9;
}
.drag-hint { margin: -3px 0 8px; color: #737c89; font-size: 0.68rem; }
.folder-icon { margin-right: 7px; color: #737c89; }
.tree-browser { gap: 4px; }
.tree-root { min-height: 44px; color: var(--text); letter-spacing: 0.05em; }
.tree-section { padding-left: 24px; color: #c8d0dc; }
.tree-branch[hidden] { display: none !important; }
.tree-chevron { display: inline-block; width: 14px; margin-right: 7px; text-align: center; }
.event-link { display: flex; align-items: center; gap: 2px; padding-left: 24px; }
.event-link > span:last-child { display: grid; min-width: 0; gap: 2px; }
.event-link strong, .event-link small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-link small, .event-songs-link small { color: #7f8a99; font-size: 0.68rem; font-weight: 500; }
.event-songs-link { padding-left: 42px; }
.event-style-link { padding-left: 60px; }
#setlistTree .vocalist-link { padding-left: 78px; }
.new-event-tree {
  width: calc(100% - 24px);
  min-height: 38px;
  margin: 4px 0 5px 24px;
  border: 1px dashed #4b5360;
  border-radius: 9px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}
.tree-empty { margin: 7px 10px 8px 44px; color: #747d8b; font-size: 0.73rem; line-height: 1.4; }

.song-view { min-width: 0; padding: 22px clamp(22px, 5vw, 72px) 55px; }
/* La barra de la cancion se queda arriba al bajar la letra. Va pegada
   debajo de la barra superior -82px, 72 en pantalla chica- y no dentro:
   en un monitor de 1280 quedaban 182px libres arriba y esto ocupa 798. */
.song-toolbar {
  position: sticky;
  z-index: 15;
  top: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 940px;
  margin: 0 auto 17px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.song-position { color: var(--muted); font-size: 0.8rem; }
.view-actions { display: flex; gap: 7px; }
.speed-slider {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
}
.speed-mark { font-size: 0.85rem; line-height: 1; opacity: 0.65; }
.speed-slider input[type="range"] {
  width: 132px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}
.speed-value {
  min-width: 20px;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.speed-select, .scroll-button {
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
.scroll-button { min-width: 116px; color: #f4aa4d; font-weight: 700; }
.scroll-button.active { border-color: var(--accent); background: var(--accent); color: #171109; }
.tool-button, .icon-button, .close-sidebar {
  min-width: 43px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
}
.tool-button:hover { border-color: #4a515f; }

.song-sheet { max-width: 940px; margin: 0 auto; }
.song-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 30px 0 27px; border-bottom: 1px solid var(--line); }
.song-header h2 { margin: 4px 0 7px; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.03; letter-spacing: -0.045em; }
.song-artist { margin: 0; color: var(--muted); }
.song-header-actions { display: flex; flex: 0 0 auto; gap: 8px; }
.add-setlist, .edit-song {
  flex: 0 0 auto;
  min-height: 43px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  cursor: pointer;
}
.add-setlist.selected { border-color: rgba(101, 185, 152, 0.55); background: rgba(101, 185, 152, 0.12); color: #8bd0b5; }
.edit-song { border-color: rgba(231, 144, 36, 0.5); background: var(--accent-soft); color: #f4aa4d; }

.song-meta { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; border-bottom: 1px solid var(--line); }
.song-meta div { padding: 17px 19px 17px 0; }
.song-meta dt { margin-bottom: 5px; color: var(--muted); font-size: 0.69rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; }
.song-meta dd { margin: 0; font-size: 0.9rem; font-weight: 600; }

.song-content { --lyrics-size: 22px; padding: 34px 0 50px; }
.song-section + .song-section { margin-top: 42px; }
.song-section h3 { margin: 0 0 25px; color: var(--accent); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.13em; }
.lyrics { display: grid; gap: 17px; }
.lyric-line { display: grid; min-height: 34px; font-size: var(--lyrics-size); line-height: 1.52; }
.chord { height: 1.25em; color: var(--accent); font-family: "Roboto Mono", monospace; font-size: 0.8em; font-weight: 600; }
.chord-sheet {
  overflow: visible;
  color: #f4f4f2;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: var(--lyrics-size);
  font-weight: 500;
  line-height: 1.55;
  white-space: pre;
  tab-size: 4;
}
.chord-inline { color: var(--accent); font-weight: 700; }
.line-comment-help { margin: -15px 0 18px; color: #7f8997; font: 500 0.72rem/1.4 "Inter", sans-serif; }
.song-line {
  position: relative;
  min-height: 1.55em;
  padding: 0 28px 0 4px;
  border-radius: 6px;
  white-space: pre;
  touch-action: pan-y;
}
.song-line.commentable { cursor: pointer; }
.song-line.commentable:hover { background: rgba(255, 255, 255, 0.035); }
.song-line.has-comment { background: rgba(231, 144, 36, 0.07); }
.comment-corner {
  position: absolute;
  top: 0;
  right: 2px;
  width: 0;
  height: 0;
  border-top: 12px solid var(--accent);
  border-left: 12px solid transparent;
}
.line-comment-bubble {
  position: absolute;
  z-index: 20;
  top: calc(100% + 7px);
  right: 8px;
  display: none;
  width: min(320px, calc(100vw - 55px));
  padding: 13px 15px;
  border: 1px solid #b9a66b;
  border-radius: 3px;
  background: #fffbd7;
  color: #24251f;
  font: 500 0.78rem/1.45 "Inter", sans-serif;
  white-space: normal;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
}
.line-comment-bubble::before {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 100%;
  border-right: 8px solid transparent;
  border-bottom: 8px solid #b9a66b;
  border-left: 8px solid transparent;
}
.line-comment-bubble strong { display: block; margin-bottom: 5px; color: #6c5620; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.07em; }
.song-line.show-comment .line-comment-bubble { display: block; }
.song-part-label {
  display: inline-block;
  margin: 18px 0 5px;
  padding: 2px 1px 4px;
  border-bottom: 2px solid var(--accent);
  color: #f0a13e;
  font-family: "Inter", sans-serif;
  font-size: 0.72em;
  font-weight: 800;
  letter-spacing: 0.09em;
  line-height: 1.1;
  text-transform: uppercase;
}

.editor-dialog {
  width: min(900px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  max-height: calc(100vh - 28px);
  margin: auto;
  padding: 0;
  overflow-x: hidden;
  border: 1px solid #353b47;
  border-radius: 16px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.6);
}
.editor-dialog::backdrop { background: rgba(0, 0, 0, 0.76); backdrop-filter: blur(4px); }
.editor-panel { display: grid; min-width: 0; gap: 15px; padding: 22px; }
.editor-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.editor-heading h2 { margin: 4px 0 0; font-size: 1.45rem; }
.close-editor { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); font-size: 1.5rem; cursor: pointer; }
.editor-help, .editor-storage-note { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }
.editor-help code { color: var(--accent); font-family: "Roboto Mono", monospace; }
.song-details-fields { display: grid; grid-template-columns: 0.55fr 0.75fr 1fr 1.2fr 1.2fr; gap: 10px; }
.song-location-fields { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 10px; }
.song-details-fields > *, .song-location-fields > * { min-width: 0; }
.song-details-fields label, .song-location-fields label, .new-folder-form label { display: grid; gap: 7px; color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.song-details-fields input, .song-details-fields select, .song-location-fields select, .song-location-fields input, .new-folder-form select, .new-folder-form input {
  width: 100%;
  min-width: 0;
  min-height: 43px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: #0c0f14;
  color: var(--text);
}
#lyricsEditor {
  width: 100%;
  max-width: 100%;
  min-height: min(56vh, 560px);
  resize: vertical;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: 0;
  background: #0c0f14;
  color: var(--text);
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.55;
  white-space: pre;
  overflow: auto;
}
#lyricsEditor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rehearsal-notes-field { display: grid; gap: 7px; color: var(--muted); font-size: 0.8rem; font-weight: 700; }
#editRehearsalNotes {
  width: 100%;
  min-height: 115px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: #0c0f14;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}
#editRehearsalNotes:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rehearsal-notes {
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px dashed rgba(231, 144, 36, 0.5);
  border-radius: 12px;
  background: rgba(231, 144, 36, 0.08);
}
.rehearsal-notes h3 { margin: 0 0 10px; color: var(--accent); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; }
.rehearsal-notes p { margin: 0; color: #e4e6ea; line-height: 1.6; }
.editor-actions { display: flex; justify-content: flex-end; gap: 9px; }

/* La ficha de la cancion es mas alta que la pantalla: el boton de guardar
   quedaba bajo el pliegue y habia que desplazar el dialogo para llegar. Se
   queda pegado abajo mientras el contenido corre por debajo. */
#editorDialog .editor-actions,
#calendarDialog .editor-actions {
  position: sticky;
  z-index: 3;
  bottom: 0;
  margin: 2px -22px -22px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}
.editor-actions button { min-height: 44px; padding: 0 17px; border-radius: 10px; cursor: pointer; }
.cancel-edit { border: 1px solid var(--line); background: var(--panel-2); }
.save-edit { border: 1px solid var(--accent); background: var(--accent); color: #171109; font-weight: 700; }
.save-notice {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  max-width: calc(100vw - 32px);
  padding: 13px 18px;
  border: 1px solid rgba(101, 185, 152, 0.55);
  border-radius: 11px;
  background: #173229;
  color: #a8e0c9;
  font-weight: 700;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}
.save-notice.visible { opacity: 1; transform: translate(-50%, 0); }
.organizer-dialog { width: min(760px, calc(100vw - 28px)); }
.login-dialog { width: min(470px, calc(100vw - 28px)); }
.project-dialog { width: min(760px, calc(100vw - 28px)); }
.project-panel { display: grid; gap: 20px; padding: 28px; }
.project-panel h2 { margin: -12px 0 2px; font-size: clamp(1.55rem, 4vw, 2.15rem); }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.project-card {
  display: grid;
  min-height: 220px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  place-items: center;
  align-content: center;
  gap: 9px;
  background: #0d1015;
  cursor: pointer;
  text-align: center;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}
.project-card:hover, .project-card:focus-visible { transform: translateY(-2px); border-color: var(--accent); background: var(--accent-soft); outline: 0; }
.project-icon { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 18px; background: var(--accent); color: #14100a; font-size: 1.5rem; font-weight: 800; }
.project-card strong { font-size: 1.25rem; }
.project-card small { color: var(--muted); }
.project-card > span:last-child { min-height: 18px; color: var(--accent); font-size: 0.78rem; font-weight: 700; }
.dos-corazones-card .project-icon { background: #d96b78; color: white; }
.project-note { margin: 0; color: var(--muted); font-size: 0.82rem; text-align: center; }
.login-fields { display: grid; gap: 12px; }
.new-song-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.new-song-fields > * { min-width: 0; }
.new-song-fields label { display: grid; gap: 7px; color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.new-song-fields input, .new-song-fields select {
  width: 100%;
  min-width: 0;
  min-height: 45px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: #0c0f14;
  color: var(--text);
  font: inherit;
}
.new-song-fields input:focus, .new-song-fields select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-fields label { display: grid; gap: 7px; color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.login-fields input {
  width: 100%;
  min-height: 45px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: #0c0f14;
  color: var(--text);
}
.login-fields input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.login-error { min-height: 20px; margin: 0; color: #ef9898; font-size: 0.84rem; }
.new-folder-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 92px auto; align-items: end; gap: 9px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #0d1015; }
.new-folder-form button { min-height: 43px; padding: 0 15px; border-radius: 9px; cursor: pointer; }
.folder-manager { display: grid; gap: 6px; max-height: 44vh; overflow-y: auto; }
.managed-folder { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 48px; padding: 7px 9px 7px calc(12px + var(--folder-depth) * 22px); border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.managed-folder strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-controls { display: flex; gap: 5px; }
.folder-controls button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; background: #11141a; cursor: pointer; }
.folder-controls .delete-folder { color: #e98585; }
.folder-manager-empty { padding: 25px 10px; color: var(--muted); text-align: center; }

.song-navigation { display: flex; justify-content: space-between; max-width: 940px; margin: 0 auto; padding-top: 20px; border-top: 1px solid var(--line); }
.song-navigation button {
  min-height: 44px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
}
.song-navigation button:disabled { opacity: 0.3; cursor: default; }

.mobile-only, .sidebar-scrim { display: none; }


.video-url-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}
.video-url-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  background: #0c0f14;
  color: var(--text);
  font: inherit;
}
.video-url-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.video-url-field small { color: #77808d; font-weight: 400; }
.song-video { width: min(100%, 820px); margin: 0 auto 32px; }
.song-video-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.song-video-heading h3 { margin: 0; color: var(--accent); font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.13em; }
.song-video-heading a { color: #8ebce8; font-size: 0.78rem; text-decoration: none; }
.song-video-heading a:hover { text-decoration: underline; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: #050608; }
.video-frame iframe { width: 100%; height: 100%; border: 0; }

.comment-dialog { width: min(560px, calc(100vw - 28px)); }
.comment-line-preview {
  margin: 0;
  padding: 13px 15px;
  border-left: 3px solid var(--accent);
  border-radius: 0 9px 9px 0;
  background: #0c0f14;
  color: #f0f1f3;
  font-family: "Roboto Mono", monospace;
}
.line-comment-editor {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: 0;
  background: #0c0f14;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}
.line-comment-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.calendar-dialog { width: min(1080px, calc(100vw - 28px)); }
.calendar-panel { display: grid; gap: 16px; padding: 24px; }
.calendar-toolbar { display: grid; grid-template-columns: 42px minmax(0, 1fr) 42px; align-items: center; gap: 10px; }
.calendar-toolbar strong { text-align: center; text-transform: capitalize; font-size: 1.05rem; }
.calendar-toolbar button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  cursor: pointer;
}
.calendar-legend { display: flex; justify-content: center; gap: 18px; color: var(--muted); font-size: 0.75rem; }
.calendar-legend span { display: flex; align-items: center; gap: 6px; }
.calendar-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; }
.calendar-dot.rehearsal { background: #559bd8; }
.calendar-dot.performance { background: var(--accent); }
.calendar-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, 0.75fr); gap: 20px; align-items: start; }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.calendar-weekdays span { padding: 7px 2px; color: #7f8997; font-size: 0.68rem; text-align: center; text-transform: uppercase; }
.calendar-grid { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--line); gap: 1px; }
.calendar-day {
  position: relative;
  min-height: 68px;
  padding: 8px;
  border: 0;
  background: #101319;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.calendar-day:hover { background: #181c23; }
.calendar-day.outside { color: #555e6b; background: #0c0f14; }
.calendar-day-number {
  position: relative;
  z-index: 2;
  display: inline-grid;
  min-width: 25px;
  height: 25px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  background: rgba(8, 11, 15, 0.78);
  font-weight: 800;
}
.calendar-day.today .calendar-day-number { background: #29313d; color: #fff; }
.calendar-day.selected { box-shadow: inset 0 0 0 2px var(--accent); }
.day-markers {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  overflow: hidden;
  pointer-events: none;
}
.calendar-activity-icon {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  font-size: clamp(2.35rem, 4.5vw, 3.8rem);
  font-style: normal;
  line-height: 1;
  opacity: 0.9;
  filter: drop-shadow(0 3px 7px rgba(0, 0, 0, 0.5));
}
.day-markers:has(.calendar-activity-icon + .calendar-activity-icon) .calendar-activity-icon {
  width: 54%;
  font-size: clamp(1.65rem, 3.2vw, 2.65rem);
}
.calendar-day.outside .calendar-activity-icon { opacity: 0.35; }
.calendar-day-events { display: grid; gap: 7px; margin-top: 15px; }
.calendar-day-events h3 { margin: 0 0 3px; font-size: 0.83rem; text-transform: capitalize; }
.calendar-event-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 9px;
  background: #11151b;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.calendar-event-card.ensayo { border-left-color: #559bd8; }
.calendar-event-card.presentacion { border-left-color: var(--accent); }
.calendar-event-card small { grid-column: 2 / -1; color: var(--muted); }
.calendar-event-card em { color: var(--accent); font-size: 0.62rem; font-style: normal; font-weight: 800; letter-spacing: 0.08em; }
.calendar-event-time { color: #8e98a6; font-size: 0.7rem; }
.calendar-empty { margin: 0; padding: 14px; color: #747d8b; background: #0d1015; border-radius: 9px; }
.calendar-event-form { display: grid; gap: 11px; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: #0d1015; }
.calendar-event-form h3 { margin: 0 0 3px; }
.calendar-event-form label { display: grid; gap: 6px; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.calendar-event-form input, .calendar-event-form select, .calendar-event-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: #080b0f;
  color: var(--text);
  font: inherit;
}
.calendar-event-form textarea { min-height: 95px; padding: 11px; resize: vertical; }
.calendar-event-form input:focus, .calendar-event-form select:focus, .calendar-event-form textarea:focus { border-color: var(--accent); }
.calendar-date-time { display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 8px; }

/* La hora como dos listas: un input type="time" se dibuja en 12 o 24 horas
   segun el sistema de quien mira, y en formato 12 h no deja escribir "22". */
.hora-24 { display: flex; align-items: center; gap: 4px; }
.hora-24 select { flex: 1 1 0; min-width: 0; text-align: center; }
.hora-sep { color: var(--muted); font-weight: 700; }
.calendar-form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 3px; }
.calendar-form-actions button { min-height: 40px; padding: 0 12px; border-radius: 9px; cursor: pointer; }
.delete-calendar-event { border: 1px solid rgba(222, 93, 93, 0.5); background: rgba(222, 93, 93, 0.1); color: #ef9898; }
.read-only-hidden { display: none !important; }

@media (max-width: 850px) {
  .topbar { height: 72px; padding: 0 16px; }
  .topbar-left { margin-left: 10px; gap: 6px; }
  .song-toolbar { top: 72px; }
  .brand-mark { width: 37px; height: 37px; border-radius: 10px; }
  .brand .eyebrow { display: none; }
  .workspace { display: block; min-height: calc(100vh - 72px); }
  .mobile-only { display: block; }
  .icon-button { display: grid; place-content: center; gap: 4px; padding: 0 11px; }
  .icon-button span { display: block; width: 18px; height: 2px; background: var(--text); }
  .sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    left: 0;
    width: min(94vw, 430px);
    height: 100vh;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.45);
  }
  .sidebar.open { transform: translateX(0); }
  .close-sidebar { flex: 0 0 44px; font-size: 1.55rem; }
  .sidebar-scrim { position: fixed; z-index: 40; inset: 0; background: rgba(0, 0, 0, 0.55); }
  .sidebar-scrim.visible { display: block; }
  .song-view { padding: 16px 22px 45px; }
  .editor-dialog { width: calc(100vw - 20px); max-width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .editor-panel { padding: 16px; }
  .song-details-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 590px) {
  /* Cada pixel de margen son caracteres que no caben en la linea. */
  .song-view { padding: 16px 12px 45px; }
  .song-toolbar { overflow-x: auto; scrollbar-width: none; }
  .song-toolbar::-webkit-scrollbar { display: none; }
  .song-toolbar > * { flex: 0 0 auto; }
  .view-actions { flex-wrap: nowrap; }
  .chord-sheet { -webkit-overflow-scrolling: touch; }
  .project-panel { padding: 20px; }
  .project-grid { grid-template-columns: 1fr; }
  .project-card { min-height: 150px; padding: 18px; }
  .project-icon { width: 52px; height: 52px; border-radius: 14px; }
  .brand-mark { display: none; }
  .brand h1 { font-size: 1rem; }
  .setlist-action { padding: 0 11px; }
  .organize-action { padding: 0 10px; font-size: 0.82rem; }
  .calendar-action { width: 42px; padding: 0; font-size: 0; }
  .calendar-action::before { margin: 0; font-size: 1rem; }
  .project-switch { width: 42px; padding: 0; font-size: 0; }
  .project-switch::before { margin: 0; font-size: 1rem; }
  .online-action { width: 42px; padding: 0; font-size: 0; }
  .online-action::before { margin: 0; font-size: 1rem; }
  .new-song-action { width: 42px; padding: 0; font-size: 0; }
  .new-song-action::before { margin: 0; font-size: 1.25rem; }
  .new-song-fields { grid-template-columns: 1fr; }
  .brand { min-width: 0; }
  .brand h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { overflow-x: auto; scrollbar-width: none; }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions > * { flex: 0 0 auto; }
  .song-header { display: grid; padding-top: 20px; }
  .song-header h2 { font-size: 2.35rem; }
  .song-header-actions { width: 100%; flex-wrap: wrap; }
  .add-setlist, .edit-song { flex: 1 1 auto; }
  .new-folder-form { grid-template-columns: 1fr 90px; }
  .new-folder-form label:first-child, .new-folder-form label:nth-child(2), .new-folder-form button { grid-column: 1 / -1; }
  .song-location-fields { grid-template-columns: 1fr 90px; }
  .song-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .song-meta div:nth-child(2n) { padding-left: 10px; }
  .song-content { padding-top: 28px; }
  .song-toolbar { align-items: flex-start; gap: 10px; }
  .view-actions { flex-wrap: wrap; justify-content: flex-end; }
  .speed-select { max-width: 105px; }
  .speed-slider { padding: 0 10px; gap: 6px; }
  .speed-slider input[type="range"] { width: 96px; }
  .scroll-button { min-width: 108px; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Acceso de solo lectura: se mira el repertorio, no se toca. El servidor
   igual responde 403; esto evita ofrecer botones que no harían nada. */
body.solo-lectura #newSongButton,
body.solo-lectura #organizeButton,
body.solo-lectura #changeProjectButton,
body.solo-lectura #editSong,
body.solo-lectura #addToSetlist,
body.solo-lectura .song-delete,
body.solo-lectura .drag-hint,
body.solo-lectura .line-comment-help { display: none; }
body.solo-lectura .song-card { cursor: pointer; }

@media (max-width: 760px) {
  .calendar-panel { padding: 16px; }
  .calendar-layout { grid-template-columns: 1fr; }
  .calendar-day { min-height: 50px; padding: 5px; }
  .calendar-event-form { order: -1; }
  .line-comment-help { font-size: 0.67rem; }
  .song-line { padding-right: 22px; }
  .line-comment-bubble { right: 0; }
}
@media (max-width: 430px) {
  .calendar-weekdays span { font-size: 0.58rem; }
  .calendar-day { min-height: 43px; }
  .calendar-date-time { grid-template-columns: 1fr 118px; }
  .hora-24 select { padding: 0 4px; }
}


/* Comentarios de ensayo: compactos, flotantes y táctiles */
.line-comment-bubble {
  right: 4px;
  width: max-content;
  min-width: 120px;
  max-width: min(260px, calc(100vw - 44px));
  padding: 9px 11px;
  border: 1px solid rgba(240, 148, 44, 0.42);
  border-radius: 10px;
  background: #1a1e25;
  color: #edf0f4;
  font: 500 0.72rem/1.4 "Inter", sans-serif;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}
.line-comment-bubble::before {
  right: 10px;
  border-right-width: 7px;
  border-bottom: 7px solid rgba(240, 148, 44, 0.72);
  border-left-width: 7px;
}
.line-comment-bubble strong {
  margin-bottom: 3px;
  color: var(--accent);
  font-size: 0.62rem;
}
.line-comment-popover {
  position: fixed;
  z-index: 120;
  width: min(330px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid #414956;
  border-radius: 14px;
  background: #171b22;
  color: var(--text);
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.62);
}
.line-comment-popover[hidden] { display: none !important; }
.line-comment-popover form { display: grid; gap: 9px; }
.comment-popover-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.comment-popover-heading strong { color: var(--accent); font-size: 0.82rem; }
.comment-popover-heading button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  background: #242a33;
  color: var(--text);
  cursor: pointer;
  font-size: 1.2rem;
}
.line-comment-popover .comment-line-preview {
  overflow: hidden;
  margin: 0;
  padding: 7px 9px;
  border-left: 2px solid var(--accent);
  border-radius: 0 7px 7px 0;
  background: #0d1015;
  color: #cbd2dc;
  font: 500 0.72rem/1.35 "Roboto Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-comment-popover .line-comment-editor {
  min-height: 86px;
  max-height: 180px;
  padding: 10px;
  border-radius: 9px;
  resize: vertical;
  font-size: 0.82rem;
}
.comment-popover-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.comment-popover-actions button {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.72rem;
}

/* Árbol y filtros compactos */
.tree-browser { gap: 1px; }
.folder-link { min-height: 32px; padding-top: 5px; padding-bottom: 5px; }
.tree-root { min-height: 36px; }
.tree-section { padding-left: 19px; }
.folder-icon { margin-right: 4px; }
.tree-chevron { width: 12px; margin-right: 4px; }
.vocalist-filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 2px;
  margin-right: 6px;
  margin-bottom: 5px;
}
.vocalist-filter-grid.setlist-vocalists { margin-left: 60px; }
.vocalist-chip {
  min-width: 0;
  min-height: 27px;
  padding: 4px 7px;
  overflow: hidden;
  border: 1px solid #303743;
  border-radius: 999px;
  background: #12161c;
  color: #aeb8c6;
  cursor: pointer;
  font-size: 0.63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vocalist-chip:hover { border-color: #596474; color: var(--text); }
.vocalist-chip.active { border-color: rgba(240, 148, 44, 0.65); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.event-link { padding-left: 19px; }
.event-songs-link { padding-left: 34px; }
.event-style-link { padding-left: 48px; }
.new-event-tree {
  width: calc(100% - 19px);
  min-height: 33px;
  margin: 3px 0 4px 19px;
}

/* Edición visible de actividades */
.calendar-event-card {
  grid-template-columns: 58px minmax(0, 1fr);
  cursor: default;
}
.calendar-event-main { display: grid; min-width: 0; gap: 3px; }
.calendar-event-main strong, .calendar-event-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-event-main small { grid-column: auto; }
.calendar-event-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}
.calendar-event-actions button {
  min-height: 31px;
  padding: 0 9px;
  border: 1px solid #3b4350;
  border-radius: 7px;
  background: #1b2028;
  color: #d7dde6;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
}
.calendar-event-actions .open-setlist-calendar {
  border-color: rgba(240, 148, 44, 0.5);
  color: var(--accent);
}
#calendarSetlistField small {
  color: #7f8997;
  font-size: 0.68rem;
  font-weight: 500;
}

@media (max-width: 590px) {
  .line-comment-popover { width: min(310px, calc(100vw - 20px)); padding: 10px; }
  .vocalist-filter-grid { gap: 3px; }
  .vocalist-chip { font-size: 0.61rem; }
}


/* Controles de canción integrados en la barra superior */
.topbar {
  display: grid;
  grid-template-columns: auto auto minmax(600px, 1fr) auto;
  gap: 12px;
  justify-content: initial;
}
.topbar-left { margin: 0; }
.topbar .song-toolbar {
  position: static;
  top: auto;
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 0 12px;
  overflow-x: auto;
  border-bottom: 0;
  border-left: 1px solid var(--line);
  background: transparent;
  scrollbar-width: none;
}
.topbar .song-toolbar::-webkit-scrollbar { display: none; }
.topbar .song-toolbar > * { flex: 0 0 auto; }
.topbar .song-position { min-width: 42px; }
.topbar .song-header-actions,
.topbar .view-actions { flex-wrap: nowrap; }
.topbar .add-setlist,
.topbar .edit-song { min-height: 40px; }
.topbar .speed-slider { height: 40px; }

/* Selector de eventos */
.event-picker-dialog { width: min(560px, calc(100vw - 24px)); }
.event-picker-panel { display: grid; gap: 14px; padding: 20px; }
.event-picker-list { display: grid; gap: 7px; max-height: min(56vh, 520px); overflow-y: auto; }
.event-picker-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #11151b;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.event-picker-item:hover,
.event-picker-item.active { border-color: rgba(240, 148, 44, 0.62); background: var(--accent-soft); }
.event-picker-item span { display: grid; min-width: 0; gap: 4px; }
.event-picker-item strong,
.event-picker-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-picker-item small { color: var(--muted); font-size: 0.72rem; }
.event-picker-item b { color: var(--accent); font-size: 0.68rem; white-space: nowrap; }
.event-picker-empty { margin: 0; padding: 18px; border-radius: 10px; background: #0d1015; color: var(--muted); text-align: center; }
.calendar-picker-link {
  min-height: 42px;
  border: 1px dashed #596270;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 1600px) {
  .topbar { grid-template-columns: auto auto minmax(470px, 1fr) auto; padding-inline: 18px; gap: 8px; }
  .topbar .song-toolbar { padding-inline: 8px; gap: 6px; }
  .topbar .speed-mark { display: none; }
  .topbar .speed-slider { padding-inline: 8px; gap: 5px; }
  .topbar .speed-slider input[type="range"] { width: 82px; }
  .topbar .add-setlist, .topbar .edit-song { padding-inline: 10px; }
  .topbar .scroll-button { min-width: 105px; }
}

@media (max-width: 1300px) {
  .topbar {
    height: 132px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: 62px 58px;
    align-content: center;
  }
  .topbar-left { margin-left: 8px; }
  .topbar-actions { min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .topbar-actions::-webkit-scrollbar { display: none; }
  .topbar-actions > * { flex: 0 0 auto; }
  .topbar .song-toolbar {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 8px;
  }
  .workspace { min-height: calc(100vh - 132px); }
  .sidebar { top: 132px; height: calc(100vh - 132px); }
}

@media (max-width: 850px) {
  .topbar {
    height: 126px;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-rows: 60px 58px;
    padding: 0 12px;
  }
  .topbar-actions { justify-content: flex-end; }
  .topbar .song-toolbar { justify-content: flex-start; }
  .workspace { min-height: calc(100vh - 126px); }
}

@media (max-width: 590px) {
  .topbar { gap: 5px; padding-inline: 8px; }
  .topbar-left { margin-left: 0; }
  .topbar .song-toolbar { align-items: center; gap: 7px; }
  .topbar .view-actions { flex-wrap: nowrap; }
  .topbar .speed-slider input[type="range"] { width: 72px; }
  .topbar .speed-value { display: none; }
  .setlist-action { min-width: 108px; font-size: 0.76rem; }
}


/* Ajuste responsive integral: PC, tablet y teléfono */
.mobile-sidebar-actions { display: none; }

@media (min-width: 1301px) {
  .topbar .song-toolbar { justify-content: center; }
}

@media (min-width: 851px) and (max-width: 1300px) {
  .song-view { padding: 18px clamp(20px, 4vw, 52px) 48px; }
  .topbar .song-toolbar { overflow-x: auto; justify-content: center; }
  .song-sheet { max-width: 980px; }
  .calendar-dialog { width: min(1000px, calc(100vw - 24px)); }
}

@media (max-width: 850px) {
  .topbar {
    height: 150px;
    min-height: 150px;
    grid-template-areas:
      "menu brand globals"
      "song song song";
    grid-template-columns: 42px minmax(0, 1fr) auto;
    grid-template-rows: 56px 86px;
    align-content: center;
    gap: 4px 8px;
    padding: 0 10px;
  }
  #menuButton {
    grid-area: menu;
    width: 40px;
    min-width: 40px;
    height: 40px;
    place-self: center start;
    padding: 0;
  }
  .brand {
    grid-area: brand;
    min-width: 0;
    gap: 8px;
  }
  .brand-mark { flex: 0 0 auto; }
  .brand h1 {
    overflow: hidden;
    font-size: 1rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar-left { display: none; }
  .topbar-actions {
    grid-area: globals;
    min-width: 0;
    justify-content: flex-end;
    overflow: visible;
    gap: 5px;
  }
  .topbar-actions #organizeButton,
  .topbar-actions #setlistButton { display: none; }
  .topbar-actions .online-action,
  .topbar-actions .calendar-action {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    font-size: 0;
  }
  .topbar-actions .online-action::before,
  .topbar-actions .calendar-action::before {
    margin: 0;
    font-size: 1rem;
  }
  .topbar .song-toolbar {
    grid-area: song;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: 38px 40px;
    align-items: center;
    justify-content: stretch;
    width: 100%;
    min-width: 0;
    gap: 5px 7px;
    padding: 5px 0 0;
    overflow: visible;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .topbar .song-position {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    font-size: 0.7rem;
    white-space: nowrap;
  }
  .topbar .song-header-actions {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    justify-content: flex-end;
    gap: 5px;
  }
  .topbar .edit-song,
  .topbar .add-setlist {
    min-height: 36px;
    height: 36px;
    min-width: 0;
    padding: 0 10px;
    overflow: hidden;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .topbar .view-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: minmax(72px, 1fr) 96px repeat(3, 36px);
    align-items: center;
    gap: 5px;
    min-width: 0;
  }
  .topbar .speed-slider {
    width: 100%;
    min-width: 0;
    height: 36px;
    padding: 0 8px;
    gap: 4px;
  }
  .topbar .speed-mark,
  .topbar .speed-value { display: none; }
  .topbar .speed-slider input[type="range"] {
    width: 100%;
    min-width: 0;
  }
  .topbar .scroll-button {
    width: 96px;
    min-width: 0;
    height: 36px;
    padding: 0 5px;
    font-size: 0.72rem;
  }
  .topbar .tool-button {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    font-size: 0.78rem;
  }
  .workspace { min-height: calc(100vh - 150px); }
  .song-view { padding: 12px 14px 42px; }
  .song-sheet { width: 100%; max-width: none; }
  .song-header {
    display: block;
    padding: 17px 0 18px;
  }
  .song-header h2 {
    margin-top: 3px;
    font-size: clamp(2rem, 10vw, 2.75rem);
    line-height: 1;
  }
  .song-artist { font-size: 0.92rem; }
  .song-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .song-meta div {
    min-width: 0;
    padding: 12px 8px 12px 0;
  }
  .song-meta div:nth-child(2n) { padding-left: 8px; }
  .song-meta div:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .song-meta dt { margin-bottom: 3px; font-size: 0.62rem; }
  .song-meta dd {
    overflow-wrap: anywhere;
    font-size: 0.8rem;
  }
  .song-content { padding: 24px 0 40px; }
  .song-section + .song-section { margin-top: 30px; }
  .song-section h3 { margin-bottom: 17px; }
  .line-comment-help { margin-top: -9px; }

  .mobile-sidebar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    margin: 10px 0 13px;
  }
  .mobile-sidebar-actions button {
    min-height: 38px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel-2);
    color: var(--text);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
  }
  .mobile-sidebar-actions #mobileEventButton {
    grid-column: 1 / -1;
    border-color: rgba(240, 148, 44, 0.48);
    color: var(--accent);
  }
  .sidebar { padding: 14px 12px 24px; }
  .search-box { min-height: 42px; }
  .folder-link { min-height: 36px; }
  .song-card { min-height: 62px; }
  .song-card-copy strong { font-size: 0.82rem; }

  .editor-dialog,
  .calendar-dialog,
  .event-picker-dialog {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
    border-radius: 13px;
  }
  .editor-panel,
  .calendar-panel,
  .event-picker-panel { padding: 13px; }
  .editor-heading { gap: 10px; }
  .editor-heading h2 { font-size: 1.2rem; }
  .close-editor { width: 38px; height: 38px; }
  .song-details-fields,
  .song-location-fields,
  .new-song-fields,
  .event-fields {
    grid-template-columns: 1fr;
  }
  #lyricsEditor {
    min-height: 43dvh;
    padding: 12px;
    font-size: 14px;
  }
  .calendar-layout { gap: 12px; }
  .calendar-event-form { padding: 12px; }
  .calendar-event-form textarea { min-height: 74px; }
  .event-picker-item { padding: 10px; }
  .event-picker-item b { font-size: 0.62rem; }
}

@media (max-width: 430px) {
  .topbar {
    height: 146px;
    min-height: 146px;
    grid-template-rows: 52px 86px;
    padding-inline: 8px;
  }
  .brand-mark { display: none; }
  .topbar .song-header-actions { gap: 4px; }
  .topbar .edit-song,
  .topbar .add-setlist { padding-inline: 8px; font-size: 0.68rem; }
  .topbar .view-actions {
    grid-template-columns: minmax(64px, 1fr) 91px repeat(3, 34px);
    gap: 4px;
  }
  .topbar .scroll-button { width: 91px; font-size: 0.68rem; }
  .topbar .tool-button { width: 34px; min-width: 34px; }
  .workspace { min-height: calc(100vh - 146px); }
  .song-view { padding: 10px 11px 38px; }
  .song-header h2 { font-size: 2.15rem; }
  .song-meta div { padding-block: 10px; }
  .song-content { padding-top: 20px; }
  .calendar-date-time { grid-template-columns: 1fr; }
  .calendar-day { min-height: 48px; padding: 4px; }
  .calendar-day-number { min-width: 21px; height: 21px; padding: 0 4px; font-size: 0.72rem; }
  .calendar-activity-icon { font-size: 2rem; }
  .day-markers:has(.calendar-activity-icon + .calendar-activity-icon) .calendar-activity-icon { font-size: 1.4rem; }
  .calendar-grid { border-radius: 9px; }
  .calendar-event-card { grid-template-columns: 50px minmax(0, 1fr); }
  .event-picker-item { grid-template-columns: 1fr; }
  .event-picker-item b { justify-self: start; }
}

body.solo-lectura #mobileProjectsButton,
body.solo-lectura #mobileNewSongButton,
body.solo-lectura #mobileOrganizeButton { display: none; }


/* Teléfono: todos los controles visibles, sin desplazamiento horizontal */
@media (max-width: 850px) {
  .topbar {
    height: 180px;
    min-height: 180px;
    grid-template-rows: 56px 116px;
  }
  .topbar .song-toolbar {
    grid-template-rows: 34px 76px;
    gap: 4px 7px;
  }
  .topbar .view-actions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-rows: 36px 34px;
    gap: 5px;
    width: 100%;
    overflow: visible;
  }
  .topbar .view-actions .speed-slider {
    grid-column: 1 / 5;
    grid-row: 1;
    width: 100%;
  }
  .topbar #autoScrollButton {
    grid-column: 5 / 7;
    grid-row: 1;
    width: 100%;
  }
  .topbar #decreaseFont {
    grid-column: 1 / 3;
    grid-row: 2;
    justify-self: center;
  }
  .topbar #increaseFont {
    grid-column: 3 / 5;
    grid-row: 2;
    justify-self: center;
  }
  .topbar #fullscreenButton {
    grid-column: 5 / 7;
    grid-row: 2;
    justify-self: center;
  }
  .workspace { min-height: calc(100vh - 180px); }
}

@media (max-width: 430px) {
  .topbar {
    height: 176px;
    min-height: 176px;
    grid-template-rows: 52px 116px;
  }
  .workspace { min-height: calc(100vh - 176px); }
  .topbar .scroll-button {
    width: 100%;
    font-size: 0.67rem;
  }
}


/* Corrección definitiva de ancho en celular y tablet */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.app-shell,
.topbar,
.workspace,
.song-view,
.song-sheet,
.song-header,
.song-meta,
.song-content,
.song-toolbar,
.view-actions {
  min-width: 0;
  max-width: 100%;
}
.chord-sheet {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}
img,
iframe,
video { max-width: 100%; }

@media (max-width: 1300px) {
  .topbar {
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }
  .topbar .song-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, auto) minmax(280px, 1fr);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
  }
  .topbar .song-position,
  .topbar .song-header-actions,
  .topbar .view-actions { min-width: 0; }
  .topbar .song-header-actions {
    overflow: hidden;
  }
  .topbar .view-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 100px repeat(3, 36px);
    gap: 5px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .topbar .view-actions > * { min-width: 0; }
  .topbar .speed-slider {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .topbar .speed-slider input[type="range"] {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }
  .topbar .scroll-button {
    width: 100px;
    min-width: 0;
  }
  .topbar .tool-button {
    width: 36px;
    min-width: 36px;
  }
}

@media (max-width: 850px) {
  .topbar {
    height: 144px;
    min-height: 144px;
    grid-template-rows: 52px 84px;
  }
  .topbar .song-toolbar {
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-rows: 34px 40px;
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    gap: 5px 6px;
    overflow: hidden;
  }
  .topbar .song-position {
    grid-column: 1;
    grid-row: 1;
  }
  .topbar .song-header-actions {
    grid-column: 2;
    grid-row: 1;
    max-width: 100%;
  }
  .topbar .song-header-actions button {
    min-width: 0;
    max-width: 50%;
  }
  .topbar .view-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    grid-template-columns: minmax(0, 1fr) 92px repeat(3, 34px);
    grid-template-rows: 36px;
    width: 100%;
    gap: 4px;
    overflow: hidden;
  }
  .topbar .view-actions .speed-slider,
  .topbar #autoScrollButton,
  .topbar #decreaseFont,
  .topbar #increaseFont,
  .topbar #fullscreenButton {
    grid-row: 1;
    justify-self: stretch;
  }
  .topbar .view-actions .speed-slider { grid-column: 1; }
  .topbar #autoScrollButton {
    grid-column: 2;
    width: 92px;
  }
  .topbar #decreaseFont {
    grid-column: 3;
    width: 34px;
    min-width: 34px;
  }
  .topbar #increaseFont {
    grid-column: 4;
    width: 34px;
    min-width: 34px;
  }
  .topbar #fullscreenButton {
    grid-column: 5;
    width: 34px;
    min-width: 34px;
  }
  .workspace { width: 100%; min-height: calc(100vh - 144px); }
  .song-view { width: 100%; overflow-x: hidden; }
  .song-header h2,
  .song-artist,
  .song-meta dd { max-width: 100%; overflow-wrap: anywhere; }
}

@media (max-width: 430px) {
  .topbar .song-toolbar {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
  }
  .topbar .view-actions {
    grid-template-columns: minmax(0, 1fr) 88px repeat(3, 32px);
    gap: 3px;
  }
  .topbar #autoScrollButton {
    width: 88px;
    font-size: 0.62rem;
  }
  .topbar #decreaseFont,
  .topbar #increaseFont,
  .topbar #fullscreenButton {
    width: 32px;
    min-width: 32px;
    font-size: 0.68rem;
  }
}


/* Panel móvil/tablet compacto y estable */
body.sidebar-open { overflow: hidden; }

@media (max-width: 850px) {
  .sidebar {
    top: 0;
    width: min(88vw, 380px);
    height: 100dvh;
    padding: 0 12px 24px;
    overscroll-behavior: contain;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .sidebar-head {
    position: sticky;
    z-index: 3;
    top: 0;
    padding: 12px 0 10px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .close-sidebar {
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 10px;
    background: var(--panel-2);
  }
  .vocalist-filter { margin-top: 14px; }
  .song-list { padding-bottom: max(28px, env(safe-area-inset-bottom)); }
  .song-video { width: 100%; }
}


/* Salida de la sesión */
@media (max-width: 850px) {
  .topbar-actions .logout-action {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    font-size: 0;
  }
  .topbar-actions .logout-action::before {
    margin: 0;
    font-size: 1.05rem;
  }
  .mobile-sidebar-actions #mobileLogoutButton {
    grid-column: 1 / -1;
    border-color: rgba(233, 133, 133, 0.45);
    color: #e98585;
  }
}


/* Calendario y evento comparten una fila en celular y tablet */
@media (max-width: 850px) {
  .mobile-sidebar-actions #mobileCalendarButton,
  .mobile-sidebar-actions #mobileEventButton {
    grid-column: auto;
  }
}


/* Filtros compactos del repertorio */
.compact-filters {
  display: grid;
  gap: 11px;
  margin: 18px 4px 0;
}
.compact-filter-group {
  display: grid;
  gap: 6px;
}
.compact-filter-label {
  color: #8993a2;
  font: 700 0.64rem/1 "Inter", sans-serif;
  letter-spacing: 0.09em;
}
.compact-filter-row,
.video-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.filter-chip {
  min-height: 28px;
  max-width: 100%;
  padding: 4px 11px;
  overflow: hidden;
  border: 1px solid #303743;
  border-radius: 999px;
  background: #12161c;
  color: #aeb8c6;
  cursor: pointer;
  font: 600 0.7rem/1 "Inter", sans-serif;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.filter-chip:hover { border-color: #596474; color: var(--text); }
.filter-chip.active {
  border-color: rgba(240, 148, 44, 0.65);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.filter-chip.pending {
  border-style: dashed;
  border-color: #4a5060;
}
.filter-chip.event-filter-chip { max-width: min(100%, 150px); }
.filter-chip.add-event-chip {
  border-style: dashed;
  border-color: rgba(240, 148, 44, 0.48);
  color: var(--accent);
}
.vocalist-filter { margin-top: 12px; }
.video-filter {
  align-items: center;
  margin: 8px 4px 0;
}
.video-filter .compact-filter-label { margin-right: 3px; }
.video-filter .vocalist-tag small { margin-left: 2px; opacity: 0.72; }

@media (max-width: 850px) {
  .compact-filters { margin-top: 14px; }
  .filter-chip,
  .vocalist-tag { min-height: 30px; }
}


/* Alineación final del menú móvil */
.vocalist-filter-group { margin: 11px 4px 0; }
.vocalist-filter-group .vocalist-filter { margin: 0; }

@media (max-width: 850px) {
  .mobile-sidebar-actions #mobileCalendarButton,
  .mobile-sidebar-actions #mobileLogoutButton {
    grid-column: auto;
  }
}


/* VIDEO conserva la misma jerarquía visual que los demás filtros */
.video-filter .compact-filter-label {
  flex: 0 0 100%;
  margin: 0;
}


.calendar-delete-action {
  border-color: rgba(222, 93, 93, 0.48) !important;
  background: rgba(222, 93, 93, 0.1) !important;
  color: #ef9898 !important;
  min-width: 36px;
}
.calendar-delete-action:hover {
  background: rgba(222, 93, 93, 0.22) !important;
}


/* Pagos de ensayos ------------------------------------------------------- */
.payments-action {
  color: #f6ad42;
}
.payments-dialog {
  width: min(980px, calc(100vw - 28px));
  max-width: 980px;
}
.payments-panel {
  width: 100%;
  max-height: min(88vh, 920px);
  overflow: auto;
  padding: 24px;
  background: #10141a;
  color: #f5f7fb;
}
.payments-help {
  margin: -4px 0 20px;
  color: #9aa5b6;
}
.payment-rotation-card {
  padding: 16px;
  margin-bottom: 20px;
  border: 1px solid #29313d;
  border-radius: 14px;
  background: #151a22;
}
.payment-section-title {
  display: block;
  margin-bottom: 10px;
  color: #929dad;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
}
.payment-rotation {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 3px;
}
.payment-turn {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid #343d4a;
  border-radius: 999px;
  color: #c4cbd5;
  font-size: 13px;
  font-weight: 600;
}
.payment-turn b {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: #262e39;
  font-size: 11px;
}
.payment-turn.current {
  border-color: #d48219;
  color: #ffad38;
  background: #2f2619;
}
.payments-list {
  display: grid;
  gap: 18px;
}
.payments-empty {
  padding: 34px 18px;
  border: 1px dashed #384251;
  border-radius: 14px;
  color: #9aa5b6;
  text-align: center;
}
.rehearsal-payment {
  overflow: hidden;
  border: 1px solid #29313d;
  border-radius: 16px;
  background: #12171e;
}
.rehearsal-payment-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 18px;
  border-bottom: 1px solid #29313d;
  background: #171d25;
}
.rehearsal-payment-head small {
  display: block;
  margin-top: 5px;
  color: #8994a5;
}
.payment-date {
  display: block;
  color: #f4f6f9;
  font-size: 17px;
  font-weight: 700;
  text-transform: capitalize;
}
.payment-responsible {
  display: grid;
  gap: 5px;
  min-width: 190px;
  color: #9aa5b6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.payment-responsible select {
  min-height: 38px;
  padding: 7px 34px 7px 10px;
  border: 1px solid #3a4452;
  border-radius: 9px;
  background: #0d1117;
  color: #ffad38;
  font: inherit;
  font-size: 13px;
  text-transform: none;
}
.transfer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
}
.transfer-card {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  min-width: 0;
  padding: 13px;
  border: 1px solid #2b3440;
  border-radius: 12px;
  background: #0e1319;
}
.transfer-card.paid {
  border-color: #2f7564;
  background: #10201e;
}
.transfer-member {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}
.transfer-member strong,
.transfer-member small {
  display: block;
}
.transfer-member small {
  margin-top: 2px;
  color: #8f9bac;
  font-size: 11px;
}
.transfer-card.paid .transfer-member small {
  color: #74c7ae;
}
.transfer-avatar {
  display: grid;
  flex: 0 0 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: #252d38;
  color: #ffad38;
  font-weight: 800;
}
.transfer-check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #b8c0cb;
  font-size: 12px;
}
.receipt-upload,
.view-receipt,
.save-transfer {
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}
.receipt-upload {
  overflow: hidden;
  position: relative;
  border: 1px dashed #465263;
  color: #c6ced8;
}
.receipt-upload input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.view-receipt {
  border: 1px solid #3a4656;
  background: #1a212b;
  color: #9dccff;
}
.save-transfer {
  border: 1px solid #a96312;
  background: #402b13;
  color: #ffad38;
}
.save-transfer:disabled {
  opacity: .5;
  cursor: wait;
}

@media (max-width: 760px) {
  .payments-dialog {
    width: 100vw;
    max-width: none;
    height: 100dvh;
    max-height: none;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .payments-panel {
    max-height: 100dvh;
    padding: 18px 14px 34px;
  }
  .rehearsal-payment-head {
    align-items: stretch;
    flex-direction: column;
  }
  .payment-responsible {
    min-width: 0;
  }
  .transfer-grid {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .transfer-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 420px) {
  .transfer-card {
    grid-template-columns: 1fr;
  }
  .transfer-check {
    justify-self: start;
  }
}


/* El botón Pagos usa únicamente su ícono de tarjeta. */
.payments-action::before {
  content: none !important;
  display: none !important;
}


/* Vista compacta de pagos por ensayo */
.payments-panel {
  max-width: 860px;
}
.payment-rotation-card {
  padding: 0 0 14px;
  margin-bottom: 16px;
  border: 0;
  border-bottom: 1px solid #29313d;
  border-radius: 0;
  background: transparent;
}
.payment-section-title {
  margin-bottom: 8px;
}
.rehearsal-payment-head {
  align-items: center;
  padding: 15px 16px;
}
.payment-date {
  font-size: 16px;
  text-transform: none;
}
.payment-responsible {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 9px;
  color: #aeb7c4;
}
.payment-responsible span {
  white-space: nowrap;
}
.payment-responsible select {
  min-width: 126px;
  border-color: #a96312;
  background: #2f2619;
  font-weight: 800;
}
.payment-explanation {
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid #29313d;
  background: #10151c;
  color: #9ba6b5;
  font-size: 12px;
}
.payment-explanation strong {
  color: #ffad38;
}
.transfer-grid {
  gap: 8px;
  padding: 10px;
}
.transfer-card {
  min-height: 64px;
  padding: 10px;
}
.transfer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.transfer-check {
  white-space: nowrap;
}
.receipt-upload,
.view-receipt {
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 8px;
}
.transfer-card.saving {
  opacity: .55;
  pointer-events: none;
}
.transfer-card.saving::after {
  content: "Guardando…";
  grid-column: 1 / -1;
  color: #ffad38;
  font-size: 10px;
  text-align: right;
}

@media (max-width: 760px) {
  .rehearsal-payment-head {
    gap: 10px;
  }
  .payment-responsible {
    justify-content: space-between;
  }
  .payment-responsible select {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .transfer-card {
    grid-template-columns: 1fr;
  }
  .transfer-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    padding-left: 44px;
  }
}


/* Creación manual de una fecha de pago */
.payment-create {
  margin: 0 0 16px;
}
.new-payment-button {
  width: 100%;
  min-height: 42px;
  border: 1px dashed #a96312;
  border-radius: 11px;
  background: #211a12;
  color: #ffad38;
  font-weight: 800;
  cursor: pointer;
}
.payment-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, .65fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid #a96312;
  border-radius: 12px;
  background: #171b22;
}
.payment-create-form[hidden] {
  display: none;
}
.payment-create-form label {
  display: grid;
  gap: 6px;
  color: #9aa5b6;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.payment-create-form select {
  min-height: 40px;
  padding: 8px 32px 8px 10px;
  border: 1px solid #394453;
  border-radius: 9px;
  background: #0d1117;
  color: #f4f6f9;
  font: inherit;
  font-size: 13px;
  text-transform: none;
}
.payment-create-actions {
  display: flex;
  gap: 7px;
}
.payment-create-actions button {
  min-height: 40px;
  padding: 8px 12px;
}

@media (max-width: 680px) {
  .payment-create-form {
    grid-template-columns: 1fr;
  }
  .payment-create-actions button {
    flex: 1;
  }
}


/* El contenido de Pagos debe ocupar todo el cuadro, sin franja vacía. */
.payments-dialog[open] {
  display: block;
}
.payments-panel {
  width: 100%;
  min-width: 0;
  max-width: none;
  box-sizing: border-box;
}

/* Entrada con sesión del portal: mientras se verifica, sin formulario. */
.login-verificando { display: none; align-items: center; gap: 12px; padding: 18px 2px 8px; color: var(--muted); font-weight: 600; }
.login-dialog.verificando .login-verificando { display: flex; }
.login-dialog.verificando .editor-heading,
.login-dialog.verificando .editor-help,
.login-dialog.verificando .login-fields,
.login-dialog.verificando .login-error,
.login-dialog.verificando .editor-actions { display: none; }
.login-spinner { width: 20px; height: 20px; border-radius: 50%; border: 3px solid var(--accent-soft, rgba(255,152,30,.25));
  border-top-color: var(--accent, #ff981e); animation: login-girar .8s linear infinite; flex: 0 0 auto; }
@keyframes login-girar { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .login-spinner { animation: none; } }

/* ==========================================================================
   EL ESTUDIO DE II CORAZONES
   Los diez colores estan MEDIDOS sobre las portadas del disco (OneDrive,
   08.Musico / 02.Ahora / 01.dos corazones / 03.Tematica), no elegidos: el
   negro ocupa entre 13% y 25% de cada imagen y el rojo nunca pasa del 2%.
   Las fotos viven en assets/img/ como archivos del sitio estatico (~310 KB en
   total): no pasan por el portal ni por la base.
   Todo va bajo .estudio para no tocar una sola regla del cancionero.
   ========================================================================== */
.estudio {
  --papel: #0B0907;      /* tinta: el fondo, el material dominante */
  --papel-2: #1B1411;    /* brea: la sombra de los pliegues */
  --panel: #16100D;      /* el panel, un paso sobre el fondo */
  --tinta: #E3CAB5;      /* papel: el texto, la sabana */
  --tinta-suave: #9A7F6D; /* sepia: las cartas atadas con cordel */
  --marco: #3A2E26;      /* el filo de las cosas */
  --c1: #BE9874;   /* guitarra   - laton de las charreteras */
  --c2: #8A6A4E;   /* bajo       - cuero del abrigo, aclarado para que se lea */
  --c3: #D9C9B6;   /* teclado    - marfil de las teclas */
  --c4: #6E6568;   /* bateria    - hierro del flight case */
  --c5: #A8201A;   /* voz        - rojo de la herida */
  --c6: #9A7F6D;   /* accesorios - sepia de las cartas */
  --hecho: #791311;      /* sangre seca: marca lo que ya esta hecho */
  --est-sombra: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 26px rgba(0, 0, 0, .45);

  display: block;
  background: var(--papel);
  color: var(--tinta);
  font-family: "Inter", system-ui, sans-serif;
  overflow-y: auto;
}
/* El display de arriba le gana al atributo hidden, asi que hay que decirlo. */
.estudio[hidden] { display: none }
body.en-estudio .workspace { display: none }
body.en-estudio .song-toolbar,
body.en-estudio .view-actions,
body.en-estudio .organize-action { display: none }
/* La barra reserva una fila para los controles de la cancion; en el estudio
   no existen y dejaban una franja negra encima de la estampa. */
body.en-estudio .topbar { grid-template-rows: auto }

.estudio::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 3;
  opacity: .40; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23f)' opacity='.34'/%3E%3C/svg%3E");
}

/* ---------- la estampa ---------- */
.estudio .estampa {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: clamp(300px, 42vw, 470px);
  display: flex; align-items: flex-end;
  border-bottom: 1px solid var(--marco);
}
/* La portada entera, una sola vez. El mosaico de encima no repite la imagen:
   son veladuras de tinta que se retiran, por eso los pedazos calzan siempre
   aunque cambie el numero de canciones. */
.estudio .foto {
  position: absolute; inset: 0; z-index: -2;
  background: url("img/portada.jpg?v=2") center 54% / cover no-repeat;
}
.estudio .mosaico {
  position: absolute; inset: 0; z-index: -1;
  display: grid; grid-template-columns: repeat(var(--cols, 5), 1fr);
}
.estudio .tesela { position: relative; outline: 1px solid rgba(190, 152, 116, .20); outline-offset: -1px }
.estudio .tesela::before {
  content: ""; position: absolute; inset: 0; background: var(--papel);
  opacity: calc(.88 - var(--p, 0) * .0088);
  transition: opacity .6s cubic-bezier(.4, 0, .2, 1);
}
.estudio .velo {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 80% 120% at 50% 0%, rgba(11,9,7,.30), transparent 62%),
    linear-gradient(180deg,
      rgba(11,9,7,.40) 0%, rgba(11,9,7,.10) 34%,
      rgba(11,9,7,.58) 68%, rgba(11,9,7,.92) 88%, var(--papel) 100%);
}
.estudio .banda {
  width: 100%; padding-top: clamp(48px, 9vw, 96px);
  background: linear-gradient(180deg, rgba(11,9,7,0) 0%,
    rgba(11,9,7,.58) 34%, rgba(11,9,7,.90) 66%, var(--papel) 100%);
}
.estudio .titulo-zona {
  width: 100%; max-width: 1380px; margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 34px) 20px;
  display: flex; align-items: flex-end; gap: 18px 26px; flex-wrap: wrap;
}
.estudio .rotulo { min-width: 0; flex: 1 1 300px }
.estudio .rotulo .eyebrow {
  margin: 0 0 4px; font-size: .64rem; letter-spacing: .26em; font-weight: 700;
  color: var(--c1); text-transform: uppercase;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .85);
}
.estudio .rotulo h1 {
  margin: 0; font-family: "Cinzel", Georgia, "Times New Roman", serif; font-weight: 700;
  font-size: clamp(1.7rem, 5.4vw, 3.2rem); line-height: 1;
  letter-spacing: .1em; color: var(--c5);
  text-shadow: 0 2px 18px rgba(0, 0, 0, .85);
}
.estudio .rotulo h1 em { font-style: normal; color: var(--tinta) }
.estudio .rotulo p.sub {
  margin: 10px 0 0; color: var(--tinta); font-size: .95rem; max-width: 46ch; line-height: 1.55;
  text-shadow: 0 1px 12px rgba(0, 0, 0, .9);
}
.estudio .hanko {
  flex: 0 0 auto; width: 58px; transform: rotate(-5deg);
  filter: drop-shadow(0 3px 14px rgba(0, 0, 0, .75));
}
.estudio .hanko img { display: block; width: 100%; height: auto; mix-blend-mode: screen }

/* ---------- cuerpo ---------- */
.estudio .estudio-cuerpo {
  position: relative; z-index: 1; max-width: 1380px; margin: 0 auto;
  padding: 22px clamp(16px, 3vw, 34px) 48px;
}
.estudio .cartela {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
  border-left: 3px solid var(--c5); padding: 2px 0 2px 13px; margin: 0 0 22px;
}
.estudio .cartela .obra {
  font-family: "Cinzel", Georgia, serif; font-size: 1rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--c1);
}
.estudio .cartela .autor { font-size: .9rem }
.estudio .cartela .anio { font-size: .75rem; color: var(--tinta-suave); font-variant-numeric: tabular-nums }

.estudio .taller {
  display: grid; gap: 26px;
  grid-template-columns: minmax(0, 310px) minmax(0, 1fr); align-items: start;
}
@media (max-width: 880px) { .estudio .taller { grid-template-columns: minmax(0, 1fr) } }

.estudio .muro h2, .estudio .mesa h2.seccion {
  font-family: "Cinzel", Georgia, serif; font-size: .78rem; font-weight: 600; letter-spacing: .16em;
  text-transform: uppercase; margin: 0 0 12px; color: var(--tinta-suave);
  display: flex; align-items: center; gap: 9px;
}
.estudio .muro h2::after, .estudio .mesa h2.seccion::after {
  content: ""; flex: 1 1 auto; height: 1px; background: var(--marco);
}
.estudio .muro-vacio { font-size: .88rem; color: var(--tinta-suave); margin: 0 }

/* ---------- muro: cada cancion se llena de agua ---------- */
.estudio .lienzos { display: grid; gap: 10px }
.estudio .lienzo-btn {
  position: relative; overflow: hidden; isolation: isolate;
  display: grid; gap: 9px; width: 100%; text-align: left; cursor: pointer;
  font: inherit; color: var(--tinta); background: var(--panel);
  border: 1px solid var(--marco); border-radius: 13px; padding: 12px 13px 13px;
  transition: border-color .15s ease, transform .15s ease;
}
.estudio .lienzo-btn:hover { transform: translateX(3px); border-color: var(--c1) }
.estudio .lienzo-btn[aria-current="true"] { border-color: var(--c1); box-shadow: var(--est-sombra) }
/* La tarjeta se mancha de izquierda a derecha. */
.estudio .lienzo-btn .agua {
  position: absolute; inset: 0 auto 0 0; z-index: -1; width: calc(var(--p, 0) * 1%);
  background: linear-gradient(90deg, color-mix(in srgb, var(--hecho) 46%, transparent),
                                     color-mix(in srgb, var(--c5) 30%, transparent));
  transition: width .45s cubic-bezier(.4, 0, .2, 1);
}
/* La calavera del cuello marca la cancion terminada. */
.estudio .lienzo-btn .calavera {
  flex: none; width: 18px; height: 18px; object-fit: cover; border-radius: 3px;
  mix-blend-mode: screen;
}
.estudio .lienzo-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px }
.estudio .lienzo-btn strong { font-size: .98rem; font-weight: 600; line-height: 1.28; min-width: 0 }
.estudio .lienzo-btn .pct {
  font-size: .73rem; color: var(--tinta-suave); font-variant-numeric: tabular-nums; flex: none;
}
.estudio .manchas { display: flex; gap: 4px }
.estudio .mancha {
  width: 100%; height: 7px; border-radius: 99px;
  background: color-mix(in srgb, var(--m) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--m) 30%, transparent);
}
.estudio .mancha[data-on="boceto"] { background: color-mix(in srgb, var(--m) 50%, transparent); border-color: var(--m) }
.estudio .mancha[data-on="lista"] { background: var(--m); border-color: var(--m) }

/* ---------- mesa de trabajo ---------- */
.estudio .mesa { min-width: 0; display: grid; gap: 24px }
.estudio .obra-cab { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 16px }
.estudio .obra-cab h2.titulo-obra {
  font-family: "Cinzel", Georgia, serif; font-weight: 600; font-size: clamp(1.3rem, 3.6vw, 2rem);
  line-height: 1.14; margin: 0; letter-spacing: .06em; color: var(--tinta); text-transform: none;
}
.estudio .obra-cab .cinta {
  font-size: .72rem; padding: 4px 10px; border-radius: 99px;
  background: color-mix(in srgb, var(--c1) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--c1) 38%, transparent);
  letter-spacing: .03em; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.estudio .est-letra {
  margin-left: auto; font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer;
  color: var(--c1); background: transparent; border: 1px solid var(--marco);
  border-radius: 10px; padding: 7px 13px;
}
.estudio .est-letra:hover { border-color: var(--c1) }

.estudio .siguiente {
  display: grid; gap: 3px; position: relative; overflow: hidden; isolation: isolate;
  background: var(--panel); border: 1px solid color-mix(in srgb, var(--c1) 42%, var(--marco));
  border-radius: 16px; padding: 17px 19px 17px 25px; box-shadow: var(--est-sombra);
}
.estudio .siguiente::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 6px; background: var(--c5); z-index: 1;
}
/* Impresa sobre las cartas atadas con cordel de la portada. */
.estudio .siguiente::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("img/papel.jpg?v=1") center / cover no-repeat; opacity: .13;
}
.estudio .siguiente .et {
  font-size: .63rem; letter-spacing: .22em; text-transform: uppercase; font-weight: 700; color: var(--c5);
}
.estudio .siguiente strong {
  font-family: "Cinzel", Georgia, serif; font-size: 1.15rem; font-weight: 600; line-height: 1.25;
  letter-spacing: .09em; text-transform: uppercase; color: var(--tinta);
}
.estudio .siguiente p { margin: 4px 0 0; color: var(--tinta-suave); font-size: .92rem; max-width: 62ch; line-height: 1.55 }
.estudio .siguiente .acciones { margin-top: 13px; display: flex; gap: 8px; flex-wrap: wrap }
.estudio .est-btn {
  font: inherit; font-weight: 600; font-size: .85rem; cursor: pointer;
  border-radius: 10px; padding: 8px 15px; border: 1px solid var(--c1);
  background: var(--c1); color: #130D09;
}
.estudio .est-btn.fantasma { background: transparent; color: var(--tinta); border-color: var(--marco) }
.estudio .est-btn:hover { filter: brightness(1.12) }

.estudio .ruta { display: grid; gap: 10px }
.estudio .pasos { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 5px }
.estudio .paso {
  flex: 1 1 0; min-width: 96px; cursor: pointer; font: inherit; text-align: left;
  background: var(--panel); color: var(--tinta); border: 1px solid var(--marco);
  border-radius: 11px; padding: 10px 11px; display: grid; gap: 3px; transition: border-color .15s ease;
}
.estudio .paso .n { font-size: .65rem; color: var(--tinta-suave); font-variant-numeric: tabular-nums }
.estudio .paso .nom { font-size: .85rem; font-weight: 600; line-height: 1.2 }
.estudio .paso[data-hecho="si"] {
  background: color-mix(in srgb, var(--hecho) 18%, var(--panel));
  border-color: color-mix(in srgb, var(--hecho) 55%, var(--marco));
}
.estudio .paso[data-hecho="si"] .n::after { content: " \2713"; color: var(--hecho); font-weight: 700 }
.estudio .paso[data-ahora="si"] { border-color: var(--c1); box-shadow: var(--est-sombra) }
.estudio .leyenda { font-size: .79rem; color: var(--tinta-suave); margin: 0 }

/* ---------- pistas ---------- */
.estudio .pistas-cab { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap }
.estudio .pistas { display: grid; gap: 13px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 14px }
.estudio .pista {
  --m: var(--c1);
  background: var(--panel); border: 1px solid var(--marco); border-radius: 15px;
  overflow: hidden; display: grid; min-width: 0; box-shadow: var(--est-sombra);
}
.estudio .pista-top {
  display: flex; align-items: center; gap: 10px; padding: 11px 13px;
  background: color-mix(in srgb, var(--m) 13%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--m) 28%, transparent);
}
.estudio .gota {
  width: 26px; height: 26px; flex: none;
  border-radius: 52% 48% 45% 55% / 50% 54% 46% 50%; background: var(--m);
  box-shadow: inset -3px -3px 6px rgba(0, 0, 0, .22), 0 1px 3px rgba(20, 35, 58, .2);
}
.estudio .pista-top .rot { min-width: 0 }
.estudio .pista-top h3 { margin: 0; font-size: .96rem; font-weight: 700; line-height: 1.15 }
.estudio .pista-top .pigmento {
  display: block; font-size: .63rem; letter-spacing: .02em; color: var(--tinta-suave); margin-top: 1px;
}
.estudio .pista-top .quita {
  margin-left: auto; border: 0; background: transparent; cursor: pointer; font: inherit;
  color: var(--tinta-suave); font-size: 1.1rem; line-height: 1; padding: 2px 5px; border-radius: 6px; flex: none;
}
.estudio .pista-top .quita:hover { color: var(--c5) }
.estudio .pista-cuerpo { padding: 11px 13px 13px; display: grid; gap: 9px }
.estudio .estados { display: flex; gap: 5px }
.estudio .estados button {
  flex: 1 1 0; font: inherit; font-size: .71rem; font-weight: 600; cursor: pointer;
  padding: 5px 4px; border-radius: 8px; border: 1px solid var(--marco);
  background: transparent; color: var(--tinta-suave); text-transform: uppercase; letter-spacing: .04em;
}
.estudio .estados button[aria-pressed="true"] { background: var(--m); border-color: var(--m); color: #130D09 }
.estudio .pista textarea {
  width: 100%; min-height: 78px; resize: vertical; font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: .79rem; line-height: 1.55; color: var(--tinta);
  background: color-mix(in srgb, var(--papel-2) 42%, transparent);
  border: 1px solid var(--marco); border-radius: 9px; padding: 8px 9px;
}
.estudio .pista textarea::placeholder { color: var(--tinta-suave); opacity: .8 }
.estudio .add-acc {
  font: inherit; font-size: .84rem; font-weight: 600; cursor: pointer; color: var(--tinta);
  background: transparent; border: 1px dashed var(--marco); border-radius: 12px; padding: 9px 15px;
}
.estudio .add-acc:hover { border-color: var(--c6); color: var(--c6) }
.estudio .acc-menu { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px }
.estudio .acc-menu button {
  font: inherit; font-size: .8rem; cursor: pointer; padding: 6px 12px; border-radius: 99px;
  border: 1px solid var(--marco); background: var(--panel); color: var(--tinta);
}
.estudio .acc-menu button:hover { border-color: var(--c6); color: var(--c6) }
.estudio .acc-menu span { font-size: .82rem; color: var(--tinta-suave) }

.estudio :focus-visible { outline: 2px solid var(--c5); outline-offset: 2px }

/* Quien entra a mirar no toca nada del estudio. */
body.solo-lectura .estudio .estados,
body.solo-lectura .estudio .add-acc,
body.solo-lectura .estudio .acc-menu,
body.solo-lectura .estudio .quita,
body.solo-lectura .estudio .siguiente .acciones { display: none }
body.solo-lectura .estudio .pista textarea,
body.solo-lectura .estudio .paso { pointer-events: none }

/* Volver al estudio desde la letra */
.volver-estudio {
  font: inherit; font-size: .82rem; font-weight: 600; cursor: pointer;
  border-radius: 10px; padding: 6px 12px; border: 1px solid #BE9874;
  background: transparent; color: #BE9874;
}
.volver-estudio:hover { background: rgba(190, 152, 116, .12) }

@media (prefers-reduced-motion: reduce) {
  .estudio *, .estudio .lienzo-btn .agua,
  .estudio .tesela::before { transition: none !important }
}
