:root{
  --paper: #f4ecd8;
  --paper-shadow: #e3d6b4;
  --ink: #2b2420;
  --ink-soft: #6b5d4f;
  --chord: #9a3324;
  --title-color: #2b2420;
  --gold: #b08d57;
  --stage-bg-1: #15110d;
  --stage-bg-2: #1f1a14;
  --rail-bg: #100d0a;
  --rail-border: #2c241a;
  --rail-text: #d8cdb8;
  --rail-text-dim: #8a7d6a;
  --accent: #c9a35f;
  --danger: #b5483a;
  --serif: "Iowan Old Style", "Palatino Linotype", "Georgia", "Times New Roman", serif;
  --mono: "JetBrains Mono", "SF Mono", "Consolas", "Menlo", monospace;
  --display: "Playfair Display", var(--serif);
}

/* ============ TEMAS DE COR DA PÁGINA (fundo, letra, cifra, título) ============ */
/* Pergaminho (padrão) já é o :root acima. Os demais sobrescrevem ao aplicar a classe no body. */

body.theme-escuro{
  --paper: #1c1c1e;
  --paper-shadow: #2e2e30;
  --ink: #e8e6e1;
  --ink-soft: #a3a09a;
  --chord: #e8a33d;
  --title-color: #f4ead2;
  --gold: #6b5d3f;
}

body.theme-alto-contraste{
  --paper: #ffffff;
  --paper-shadow: #d0d0d0;
  --ink: #000000;
  --ink-soft: #333333;
  --chord: #c00000;
  --title-color: #000000;
  --gold: #999999;
}

body.theme-sepia{
  --paper: #e8dcc0;
  --paper-shadow: #d4c4a0;
  --ink: #4a3826;
  --ink-soft: #7a6248;
  --chord: #8b4a2b;
  --title-color: #3a2a1a;
  --gold: #a8865c;
}

body.theme-azul-noturno{
  --paper: #16213a;
  --paper-shadow: #233153;
  --ink: #d8e0f0;
  --ink-soft: #8a98b8;
  --chord: #6ec6e8;
  --title-color: #f0f4ff;
  --gold: #4a6a96;
}

body.theme-verde-suave{
  --paper: #eef2e6;
  --paper-shadow: #d8e0c8;
  --ink: #2e3826;
  --ink-soft: #5e6850;
  --chord: #4a7340;
  --title-color: #233018;
  --gold: #8aa070;
}

*{box-sizing:border-box;}
html{
  margin:0; padding:0;
  height: -webkit-fill-available;
  height: 100%;
  background: var(--stage-bg-1);
  font-family: var(--serif);
  color: var(--ink);
}
body{
  margin:0; padding:0;
  height: -webkit-fill-available;
  height: 100%;
  background: var(--stage-bg-1);
  font-family: var(--serif);
  color: var(--ink);
  overflow:hidden;
}

/* ============ LAYOUT SHELL ============ */
#app{
  display:flex;
  height: 100vh;
  height: 100dvh;
  height: calc(var(--vh, 1vh) * 100);
  width:100vw;
}

/* ============ SIDEBAR ============ */
#sidebar{
  width:300px;
  min-width:300px;
  background: var(--rail-bg);
  border-right: 1px solid var(--rail-border);
  display:flex;
  flex-direction:column;
  color: var(--rail-text);
  transition: margin-left .25s ease;
  z-index: 20;
}
#sidebar.collapsed{
  margin-left:-300px;
}
.sidebar-header{
  padding:18px 16px 14px;
  border-bottom:1px solid var(--rail-border);
}
.sidebar-header h1{
  font-family: var(--display);
  font-size:19px;
  margin:0 0 2px;
  color:#efe6d2;
  letter-spacing:.3px;
}
.sidebar-header .sub{
  font-size:11px;
  color: var(--rail-text-dim);
  letter-spacing:.08em;
  text-transform:uppercase;
}
.search-wrap{
  padding:12px 14px;
  border-bottom:1px solid var(--rail-border);
}
.search-wrap input{
  width:100%;
  background:#1b1611;
  border:1px solid #382d20;
  color: var(--rail-text);
  padding:9px 11px;
  border-radius:6px;
  font-size:13.5px;
  font-family: var(--serif);
  outline:none;
}
.search-wrap input:focus{ border-color: var(--accent); }
.search-wrap input::placeholder{ color:#6b5f4d; }

.list-actions{
  display:flex;
  gap:8px;
  padding:10px 14px;
  border-bottom:1px solid var(--rail-border);
}
.btn-mini{
  flex:1;
  background:#1b1611;
  border:1px solid #382d20;
  color:var(--rail-text-dim);
  font-size:11.5px;
  padding:7px 6px;
  border-radius:5px;
  cursor:pointer;
  font-family: var(--serif);
  letter-spacing:.02em;
}
.btn-mini:hover{ color:var(--accent); border-color:var(--accent); }

#song-list{
  flex:1;
  overflow-y:auto;
  padding:8px 8px 16px;
}
#song-list::-webkit-scrollbar{ width:8px; }
#song-list::-webkit-scrollbar-thumb{ background:#332a1d; border-radius:4px; }

.folder-group{ margin-bottom:4px; }
.folder-header{
  display:flex;
  align-items:center;
  gap:6px;
  padding:9px 10px;
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.09em;
  color: var(--accent);
  cursor:pointer;
  user-select:none;
  border-radius:5px;
}
.folder-header:hover{ background:#1b1611; }
.folder-header .chev{
  transition: transform .15s;
  font-size:10px;
  display:inline-block;
}
.folder-header.closed .chev{ transform: rotate(-90deg); }
.folder-songs.hidden{ display:none; }

.song-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 11px;
  border-radius:6px;
  cursor:pointer;
  margin:1px 0;
  position:relative;
}
.song-item:hover{ background:#1c1712; }
.song-item.active{
  background: linear-gradient(90deg, #2a2014, #1c1712);
  box-shadow: inset 3px 0 0 var(--accent);
}
.song-num{
  font-family:var(--mono);
  font-size:10.5px;
  color: var(--rail-text-dim);
  width:18px;
  flex-shrink:0;
  text-align:right;
}
.song-info{ flex:1; min-width:0; }
.song-title{
  font-size:13.5px;
  color: var(--rail-text);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.song-item.active .song-title{ color:#f4ead2; font-weight:600; }
.song-meta{
  font-size:10.5px;
  color: var(--rail-text-dim);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.song-item .drag-handle{
  opacity:0;
  cursor:grab;
  color:var(--rail-text-dim);
  font-size:13px;
  padding:0 2px;
}
.song-item:hover .drag-handle{ opacity:.6; }
.song-item.dragging{ opacity:.4; }
.drop-target{ box-shadow: inset 0 2px 0 var(--accent); }

.no-results{
  text-align:center;
  color:var(--rail-text-dim);
  font-size:12.5px;
  padding:30px 20px;
}

.sidebar-footer{
  padding:10px 14px;
  border-top:1px solid var(--rail-border);
  font-size:10.5px;
  color: var(--rail-text-dim);
  text-align:center;
}

/* ============ STAGE (main area) ============ */
#stage{
  flex:1;
  position:relative;
  background: radial-gradient(ellipse at 50% 0%, var(--stage-bg-2), var(--stage-bg-1));
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

/* top toolbar */
#toolbar{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 18px;
  background: rgba(16,13,10,0.85);
  border-bottom:1px solid var(--rail-border);
  z-index:15;
  flex-wrap:wrap;
}
#toggle-sidebar{
  background:none; border:1px solid var(--rail-border);
  color: var(--rail-text);
  width:34px; height:34px;
  border-radius:6px;
  cursor:pointer;
  font-size:15px;
  flex-shrink:0;
}
#toggle-sidebar:hover{ border-color: var(--accent); color:var(--accent); }

.toolbar-title{
  flex:1;
  min-width:230px;
  color:#efe6d2;
  font-size:14.5px;
  font-family: var(--display);
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.toolbar-title .key-badge{
  font-family:var(--mono);
  font-size:11px;
  color: var(--accent);
  border:1px solid var(--rail-border);
  padding:2px 7px;
  border-radius:4px;
  margin-left:8px;
}

.transpose-group{
  display:flex;
  align-items:center;
  gap:6px;
  background:#1b1611;
  border:1px solid var(--rail-border);
  border-radius:7px;
  padding:4px 6px;
}
.transpose-group button{
  background:none;
  border:none;
  color: var(--rail-text);
  width:28px; height:28px;
  border-radius:5px;
  cursor:pointer;
  font-size:15px;
  font-family:var(--mono);
}
.transpose-group button:hover{ background:#2a2014; color:var(--accent); }
.transpose-label{
  font-size:11px;
  color: var(--rail-text-dim);
  font-family:var(--mono);
  min-width:46px;
  text-align:center;
}
.transpose-reset{
  font-size:10.5px !important;
  width:auto !important;
  padding:0 8px !important;
  color:var(--rail-text-dim) !important;
}

.tool-btn{
  background:#1b1611;
  border:1px solid var(--rail-border);
  color: var(--rail-text);
  padding:8px 12px;
  border-radius:7px;
  cursor:pointer;
  font-size:12.5px;
  font-family: var(--serif);
  display:flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}
.tool-btn:hover{ border-color: var(--accent); color: var(--accent); }
.tool-btn.active{ background: var(--accent); color:#1b1611; border-color:var(--accent); }

.font-group{
  display:flex; align-items:center; gap:4px;
  background:#1b1611; border:1px solid var(--rail-border);
  border-radius:7px; padding:4px 6px;
}
.font-group button{
  background:none; border:none; color:var(--rail-text);
  width:26px; height:26px; border-radius:5px; cursor:pointer; font-size:13px;
}
.font-group button:hover{ background:#2a2014; color:var(--accent); }

.capo-group{
  display:flex;
  align-items:center;
  gap:6px;
  background:#1b1611;
  border:1px solid var(--rail-border);
  border-radius:7px;
  padding:4px 6px;
}
.capo-group .capo-icon{ font-size:13px; color:var(--rail-text-dim); padding-left:2px; }
.capo-group button{
  background:none;
  border:none;
  color: var(--rail-text);
  width:24px; height:24px;
  border-radius:5px;
  cursor:pointer;
  font-size:14px;
  font-family:var(--mono);
}
.capo-group button:hover{ background:#2a2014; color:var(--accent); }
.capo-label{
  font-size:11px;
  color: var(--rail-text-dim);
  font-family:var(--mono);
  min-width:58px;
  text-align:center;
}


/* book viewport */
#book-viewport{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  position:relative;
  padding:18px;
  overflow:hidden;
}

#book{
  display:flex;
  height:100%;
  max-height:100%;
  width:100%;
  max-width:1500px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 8px 24px rgba(0,0,0,0.4);
  border-radius:3px;
  overflow:hidden;
  position:relative;
}

.page{
  flex:1;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 8% 12%, rgba(176,141,87,0.06), transparent 40%),
    radial-gradient(circle at 95% 90%, rgba(176,141,87,0.05), transparent 40%);
  position:relative;
  padding:38px 42px 30px;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}
.page.left-page{ border-right: 1px solid var(--paper-shadow); }
.page-spine-shadow{
  position:absolute;
  top:0; bottom:0; width:24px;
  pointer-events:none;
}
.page.left-page .page-spine-shadow{
  right:-12px;
  background: linear-gradient(to right, transparent, rgba(0,0,0,0.12));
}
.page.right-page .page-spine-shadow{
  left:-12px;
  background: linear-gradient(to left, transparent, rgba(0,0,0,0.12));
}

.page-header{
  display:flex;
  justify-content:space-between;
  align-items:baseline;
  border-bottom: 1px solid var(--paper-shadow);
  padding-bottom:8px;
  margin-bottom:14px;
  flex-shrink:0;
}
.page-header .ph-title{
  font-family: var(--display);
  font-size:18px;
  color: var(--title-color, var(--ink));
  font-weight:700;
}
.page-header .ph-key{
  font-family: var(--mono);
  font-size:12px;
  color: var(--chord);
  border:1px solid var(--gold);
  padding:1px 7px;
  border-radius:10px;
}
.page-header .ph-artist{
  font-size:11px;
  color: var(--ink-soft);
  font-style:italic;
}

.page-content{
  flex:1;
  overflow:hidden;
  position:relative;
}

.page-number{
  position:absolute;
  bottom:10px;
  font-family:var(--mono);
  font-size:10px;
  color: var(--ink-soft);
}
.page.left-page .page-number{ left:42px; }
.page.right-page .page-number{ right:42px; }

.page-empty{
  display:flex;
  align-items:center;
  justify-content:center;
  height:100%;
  color: var(--ink-soft);
  font-style:italic;
  font-size:13px;
}

/* cifra rendering */
.cifra-block{
  font-family: var(--mono);
  white-space:pre;
  font-size: var(--cifra-size, 14px);
  line-height:1.55;
  overflow-x:auto;
}
.cifra-line{ position:relative; }
.cifra-line.chord-line .ch{
  color: var(--chord);
  font-weight:700;
}
.cifra-line.section-marker{
  color: var(--ink-soft);
  font-style:italic;
  font-family: var(--serif);
  font-size: calc(var(--cifra-size, 14px) * 0.92);
  margin-top:10px;
  display:block;
}
.bracket-label{
  color: var(--ink-soft);
  opacity: 0.75;
}
.cifra-line.blank{ height: calc(var(--cifra-size, 14px) * 1.1); }
.cifra-line.performance-note{ color: var(--ink-soft); font-style: italic; font-family: var(--serif); }



/* ============ DOCUMENT EDITOR (modo edição como documento único, tipo Word) ============ */
#document-editor{
  width:100%;
  max-width:900px;
  height:100%;
  margin:0 auto;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 8% 12%, rgba(176,141,87,0.06), transparent 40%),
    radial-gradient(circle at 95% 90%, rgba(176,141,87,0.05), transparent 40%);
  box-shadow: 0 30px 80px rgba(0,0,0,0.55), 0 8px 24px rgba(0,0,0,0.4);
  border-radius:3px;
  display:flex;
  flex-direction:column;
  padding:38px 42px 30px;
  overflow:hidden;
}
.document-editor-header{
  border-bottom:1px solid var(--paper-shadow);
  padding-bottom:8px;
  margin-bottom:14px;
  flex-shrink:0;
  display:flex;
  align-items:baseline;
  gap:14px;
  flex-wrap:wrap;
}
.de-title-input{
  font-family: var(--display);
  font-size:18px;
  color: var(--title-color, var(--ink));
  font-weight:700;
  background:transparent;
  border:none;
  outline:none;
  border-bottom:1px dashed transparent;
  padding:2px 0;
  flex:1;
  min-width:160px;
}
.de-title-input:hover, .de-title-input:focus{ border-bottom-color: var(--gold); }
.de-title-input::placeholder{ color: var(--ink-soft); opacity:0.6; }
.de-artist-input{
  font-family: var(--serif);
  font-size:13px;
  font-style:italic;
  color: var(--ink-soft);
  background:transparent;
  border:none;
  outline:none;
  border-bottom:1px dashed transparent;
  padding:2px 0;
  min-width:120px;
}
.de-artist-input:hover, .de-artist-input:focus{ border-bottom-color: var(--gold); }
.de-artist-input::placeholder{ color: var(--ink-soft); opacity:0.5; }
.document-textarea{
  flex:1;
  width:100%;
  background: rgba(176,141,87,0.06);
  border:1px dashed var(--gold);
  border-radius:4px;
  outline:none;
  resize:none;
  font-family: var(--mono);
  font-size: var(--cifra-size, 14px);
  line-height:1.6;
  color: var(--ink);
  white-space:pre;
  overflow:auto;
  padding:14px;
  tab-size:4;
}
.document-textarea::-webkit-scrollbar{ width:10px; }
.document-textarea::-webkit-scrollbar-thumb{ background: var(--paper-shadow); border-radius:5px; }

@media (max-width: 900px){
  #document-editor{ max-width:100%; }
}

/* ============ NOTAS ADESIVAS ============ */
.sticky-note{
  position:absolute;
  z-index:30;
  background: #f5e6a8;
  border: 1px solid #d4c170;
  border-radius:3px;
  box-shadow: 2px 4px 10px rgba(0,0,0,0.3);
  padding:8px 9px 18px;
  font-family: var(--serif);
  font-size:12.5px;
  color:#4a3f1f;
  cursor:move;
  display:flex;
  flex-direction:column;
  min-width:70px;
  min-height:50px;
  transform: rotate(-1deg);
}
.sticky-note:nth-of-type(even){ transform: rotate(1deg); background:#e8f0c8; border-color:#c3d49a; color:#3d4a1f; }
.sticky-note textarea{
  flex:1;
  width:100%;
  background:transparent;
  border:none;
  outline:none;
  resize:none;
  font-family: var(--serif);
  font-size: inherit;
  color: inherit;
  line-height:1.4;
}
.sticky-note .sn-remove{
  position:absolute;
  top:2px; right:4px;
  background:none;
  border:none;
  font-size:11px;
  color:#8a7a3f;
  cursor:pointer;
  line-height:1;
  padding:2px;
}
.sticky-note .sn-remove:hover{ color:#9a3324; }
.sticky-note .sn-resize{
  position:absolute;
  bottom:2px; right:3px;
  width:14px; height:14px;
  cursor:nwse-resize;
  color:#8a7a3f;
  font-size:13px;
  line-height:14px;
  user-select:none;
}
.sticky-note.dragging-note{ opacity:0.85; box-shadow: 4px 8px 18px rgba(0,0,0,0.4); }

/* click navigation overlay zones (invisible, cover whole book except interactive children) */
.nav-zone{
  position:absolute;
  top:0; bottom:0;
  width:50%;
  z-index:5;
  cursor:pointer;
}
.nav-zone.left{ left:0; }
.nav-zone.right{ right:0; }
.nav-zone.disabled{ cursor:default; }
.nav-zone.edit-locked{ pointer-events:none; }

/* tokens de acorde precisam ficar acima da nav-zone para responder a hover/toque */
.ch-token{
  position:relative;
  z-index:10;
  cursor:help;
  border-bottom: 1px dotted transparent;
}
.ch-token:hover{ border-bottom-color: var(--chord); }

/* popover do diagrama de acorde */
#chord-popover{
  position:fixed;
  z-index:200;
  background: var(--paper);
  border:1px solid var(--gold);
  border-radius:8px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  padding:6px;
  pointer-events:none;
  opacity:0;
  transform: translateY(4px) scale(0.96);
  transition: opacity .12s ease, transform .12s ease;
}
#chord-popover.show{
  opacity:1;
  transform: translateY(0) scale(1);
}
.chord-diagram-note{font:italic 11px Georgia,serif;color:#6b5d4f;text-align:center;max-width:150px;margin-top:2px;}
.chord-diagram-missing{
  width:150px; padding:30px 10px; text-align:center;
  font-size:11.5px; color:#6b5d4f; font-family:var(--serif);
}

/* page turn flash feedback */
.page.flash{
  animation: flashPage .25s ease;
}
@keyframes flashPage{
  0%{ filter:brightness(1); }
  50%{ filter:brightness(1.06); }
  100%{ filter:brightness(1); }
}

/* progress bar bottom */
#progress-bar{
  height:3px;
  background: var(--rail-border);
  position:relative;
}
#progress-fill{
  height:100%;
  background: var(--accent);
  width:0%;
  transition: width .2s ease;
}

#page-indicator{
  position:absolute;
  bottom:14px;
  left:50%;
  transform:translateX(-50%);
  background: rgba(16,13,10,0.85);
  color: var(--rail-text);
  font-family:var(--mono);
  font-size:11px;
  padding:5px 14px;
  border-radius:20px;
  border:1px solid var(--rail-border);
  z-index:16;
  pointer-events:none;
  opacity:0;
  transition:opacity .3s;
}
#page-indicator.show{ opacity:1; }

/* ============ MOBILE (≤ 640px) ============ */
@media (max-width: 640px) {

  /* sidebar deslizante com overlay */
  #sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    height: 100dvh;
    height: calc(var(--vh, 1vh) * 100);
    width: 82vw;
    max-width: 320px;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    /* safe area iOS: respeita notch e home bar */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #sidebar.open { transform: translateX(0); }

  /* overlay escuro atrás da sidebar */
  #sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 299;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    /* Safari: sem transform para não criar stacking context */
    -webkit-transform: none;
    transform: none;
  }
  #sidebar-overlay.show { opacity: 1; pointer-events: auto; }

  /* toolbar compacta */
  #toolbar {
    padding: 8px 10px;
    padding-top: calc(8px + env(safe-area-inset-top));
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  /* esconde grupos secundários da toolbar — vão para o menu ⋯ */
  #transpose-group,
  #capo-group,
  #font-group,
  #btn-edit,
  #btn-insert-page-break,
  #btn-reflow,
  #btn-note,
  #btn-delete,
  #btn-backup,
  #btn-restore,
  #btn-fullscreen,
  #btn-theme {
    display: none !important;
  }

  /* botão ⋯ menu mobile — sempre visível */
  #btn-mobile-menu {
    display: flex;
  }

  /* título da toolbar truncado */
  .toolbar-title {
    font-size: 13px;
    min-width: 0;
  }

  /* página única: fica só a página esquerda (é ela que a paginação mede) */
  .page.right-page { display: none; }
  #book { max-width: 100%; border-radius: 0; box-shadow: none; }
  #book-viewport { padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }

  /* padding menor dentro da página */
  .page { padding: 22px 18px 20px; }
  .page.left-page .page-number { left: 18px; }
  .page.right-page .page-number { right: 18px; }

  /* fonte padrão um pouco menor em mobile */
  .cifra-block { font-size: var(--cifra-size, 13px); }

  /* modal cobre a tela toda */
  .modal-box { width: 92vw; }
  .import-box { width: 92vw; max-width: 92vw; }

  /* menu mobile deslizante (bottom sheet) */
  /* Safari fix: position:fixed direto, sem transform no pai */
  #mobile-menu {
    display: block;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #1b1611;
    border-top: 1px solid var(--rail-border);
    border-radius: 16px 16px 0 0;
    padding: 12px 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 400;
    /* Safari: usar translateY via classe, não transform inicial */
    visibility: hidden;
    opacity: 0;
    -webkit-transform: translateY(100%);
    transform: translateY(100%);
    transition: transform .25s ease, opacity .25s ease, visibility .25s;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
    /* scroll interno se conteúdo for longo */
    max-height: 80vh;
    max-height: 80dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #mobile-menu.open {
    visibility: visible;
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }

  #mobile-menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 399;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
    -webkit-transform: none;
    transform: none;
  }
  #mobile-menu-overlay.show { opacity: 1; pointer-events: auto; }
}

/* tela tablet intermediária (641–900px) — versão atual já funciona bem */
@media (min-width: 641px) and (max-width: 900px) {
  /* uma página por vez: fica a da ESQUERDA (é nela que o app coloca o conteúdo) */
  .page.right-page { display: none; }
  #book { max-width: 600px; }
  #btn-mobile-menu { display: none !important; }
  #mobile-menu { display: none !important; }
  #mobile-menu-overlay { display: none !important; }
  #sidebar-overlay { display: none !important; }
}

/* desktop — esconde tudo mobile */
@media (min-width: 901px) {
  #btn-mobile-menu { display: none !important; }
  #mobile-menu { display: none !important; }
  #mobile-menu-overlay { display: none !important; }
  #sidebar-overlay { display: none !important; }
}

/* estilos do bottom sheet mobile */
#mobile-menu-handle {
  width: 40px; height: 4px;
  background: var(--rail-border);
  border-radius: 2px;
  margin: 0 auto 14px;
}
.mm-section {
  padding: 4px 16px 8px;
  border-bottom: 1px solid var(--rail-border);
  margin-bottom: 4px;
}
.mm-section:last-child { border-bottom: none; margin-bottom: 0; }
.mm-section-title {
  font-size: 10px;
  color: var(--rail-text-dim);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
  font-family: var(--mono);
}
.mm-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.mm-btn {
  background: #2a2014;
  border: 1px solid var(--rail-border);
  color: var(--rail-text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--serif);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex: 1;
  min-width: 110px;
  justify-content: center;
  white-space: nowrap;
}
.mm-btn:active { background: var(--accent); color: #1b1611; border-color: var(--accent); }
.mm-btn.active { background: var(--accent); color: #1b1611; border-color: var(--accent); }
.mm-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  background: #2a2014;
  border: 1px solid var(--rail-border);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
}
.mm-stepper button {
  background: none;
  border: none;
  color: var(--rail-text);
  width: 40px; height: 40px;
  font-size: 18px;
  cursor: pointer;
  font-family: var(--mono);
}
.mm-stepper button:active { background: var(--accent); color: #1b1611; }
.mm-stepper span {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--rail-text-dim);
  font-family: var(--mono);
  pointer-events: none;
}

/* empty state when no song selected */
.welcome-screen{
  flex:1;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  color: var(--rail-text-dim);
  text-align:center;
  padding:40px;
}
.welcome-screen h2{
  font-family:var(--display);
  color:#efe6d2;
  font-size:26px;
  margin-bottom:8px;
}
.welcome-screen p{ font-size:13px; max-width:380px; }

/* edit mode toggle highlight on textarea */
.editing .page-content{
  background: rgba(176,141,87,0.05);
  border-radius:4px;
}

/* small toast */
#toast{
  position:fixed;
  bottom:24px;
  left:50%;
  transform:translateX(-50%) translateY(20px);
  background:#1b1611;
  color:#efe6d2;
  border:1px solid var(--accent);
  padding:10px 20px;
  border-radius:8px;
  font-size:12.5px;
  z-index:100;
  opacity:0;
  pointer-events:none;
  transition: all .25s ease;
}
#toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

/* new folder modal */
.modal-overlay{
  position:fixed; inset:0; background:rgba(0,0,0,0.6);
  display:none; align-items:center; justify-content:center; z-index:200;
}
.modal-overlay.show{ display:flex; }
.modal-box{
  background:#1b1611; border:1px solid var(--rail-border);
  border-radius:10px; padding:22px; width:320px;
  color:var(--rail-text);
}
.modal-box h3{ margin:0 0 14px; font-family:var(--display); color:#efe6d2; font-size:16px; }
.modal-box input{
  width:100%; background:#100d0a; border:1px solid #382d20;
  color:var(--rail-text); padding:9px 11px; border-radius:6px;
  font-size:13.5px; margin-bottom:14px; outline:none;
}
.modal-box input:focus{ border-color:var(--accent); }
.modal-actions{ display:flex; gap:8px; justify-content:flex-end; }
.modal-actions button{
  padding:8px 14px; border-radius:6px; border:1px solid var(--rail-border);
  background:none; color:var(--rail-text); cursor:pointer; font-size:12.5px;
}
.modal-actions button.primary{ background:var(--accent); color:#1b1611; border-color:var(--accent); }

/* folder select dropdown inside song item context */
.folder-select-menu{
  position:absolute; background:#1b1611; border:1px solid var(--rail-border);
  border-radius:6px; padding:6px; z-index:50; min-width:160px;
  box-shadow:0 8px 24px rgba(0,0,0,0.5);
}
.folder-select-menu button{
  display:block; width:100%; text-align:left; background:none; border:none;
  color:var(--rail-text); padding:7px 9px; border-radius:4px; cursor:pointer; font-size:12px;
}
.folder-select-menu button:hover{ background:#2a2014; color:var(--accent); }
.folder-select-menu .folder-menu-edit-info{ color: var(--accent); }
.folder-menu-divider{ height:1px; background:var(--rail-border); margin:5px 2px; }

/* indicadores visuais de reordenação por drag-and-drop na sidebar */
.song-item.drop-target-item{ background: rgba(201,163,95,0.08); }
.song-item.drop-above{ border-top: 2px solid var(--accent); }
.song-item.drop-below{ border-bottom: 2px solid var(--accent); }

.song-options-btn{
  opacity:0; background:none; border:none; color:var(--rail-text-dim);
  cursor:pointer; font-size:14px; padding:2px 4px; flex-shrink:0;
}
.song-item:hover .song-options-btn{ opacity:1; }

/* ============ IMPORT MODAL ============ */
.import-box{ width:480px; max-width:90vw; }

.import-tabs{
  display:flex; gap:4px; margin-bottom:14px;
  border-bottom:1px solid var(--rail-border);
}
.import-tab{
  flex:1; background:none; border:none; color:var(--rail-text-dim);
  padding:9px 4px; cursor:pointer; font-size:12.5px;
  border-bottom:2px solid transparent;
  font-family: var(--serif);
}
.import-tab:hover{ color:var(--rail-text); }
.import-tab.active{ color:var(--accent); border-bottom-color:var(--accent); }

.import-panel{ display:none; }
.import-panel.active{ display:block; }

.import-textarea{
  width:100%; min-height:200px; resize:vertical;
  background:#100d0a; border:1px solid #382d20; color:var(--rail-text);
  border-radius:6px; padding:10px; font-family:var(--mono); font-size:12.5px;
  line-height:1.5; outline:none; margin-bottom:6px;
}
.import-textarea:focus{ border-color:var(--accent); }

.import-dropzone{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:8px; padding:32px 16px; border:2px dashed #382d20; border-radius:8px;
  cursor:pointer; color:var(--rail-text-dim); font-size:12.5px; text-align:center;
  transition: all .15s;
}
.import-dropzone:hover, .import-dropzone.dragover{
  border-color: var(--accent); color: var(--accent); background:#1b1611;
}
.dz-icon{ font-size:28px; }
.import-filename{
  margin-top:10px; font-size:12px; color:var(--accent); text-align:center;
  min-height:16px;
}
.import-status{
  margin-top:8px; font-size:11.5px; color:var(--rail-text-dim); text-align:center;
}

.import-preview{ margin-top:6px; }
.import-preview-header{
  display:flex; justify-content:space-between; align-items:center;
  font-size:12px; color:var(--rail-text-dim); margin-bottom:8px;
}
.import-preview-list{
  max-height:240px; overflow-y:auto; display:flex; flex-direction:column; gap:6px;
}
.preview-song-card{
  background:#100d0a; border:1px solid #382d20; border-radius:6px; padding:8px 10px;
}
.preview-song-title{
  width:100%; background:none; border:none; color:#efe6d2; font-size:13px;
  font-family:var(--serif); font-weight:600; outline:none; padding:2px 0; margin-bottom:2px;
  border-bottom:1px solid transparent;
}
.preview-song-title:focus{ border-bottom-color:var(--accent); }
.preview-song-meta{ font-size:10.5px; color:var(--rail-text-dim); }
.preview-song-lines{ font-size:10.5px; color:var(--rail-text-dim); margin-top:2px; }
.preview-remove-btn{
  float:right; background:none; border:none; color:var(--rail-text-dim);
  cursor:pointer; font-size:13px;
}
.preview-remove-btn:hover{ color: var(--danger); }

/* ============ THEME PICKER ============ */
.theme-box{ width:340px; }
.theme-options{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
  margin-bottom:6px;
}
.theme-option{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:8px;
  background:#100d0a;
  border:1px solid var(--rail-border);
  border-radius:8px;
  padding:12px 8px;
  cursor:pointer;
  transition: border-color .15s;
}
.theme-option:hover{ border-color: var(--accent); }
.theme-option.active{ border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.theme-swatch{
  width:100%;
  height:46px;
  border-radius:5px;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  gap:5px;
  padding-bottom:6px;
  border:1px solid rgba(0,0,0,0.15);
}
.theme-swatch span{
  width:9px;
  height:9px;
  border-radius:50%;
  display:inline-block;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2);
}
.theme-name{
  font-size:12px;
  color: var(--rail-text);
}
/* ===================== v19 ===================== */
.moved-to-more{ display:none !important; }
#song-jump-banner{
  position:fixed; left:50%; bottom:28px; transform:translate(-50%, 20px);
  background:#1b1611; border:1px solid var(--accent); color:var(--rail-text);
  padding:10px 18px; border-radius:12px; z-index:400; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; gap:2px; text-align:center;
  opacity:0; pointer-events:none; transition:opacity .2s, transform .2s;
  box-shadow:0 8px 24px rgba(0,0,0,.45); max-width:90vw;
}
#song-jump-banner.show{ opacity:1; pointer-events:auto; transform:translate(-50%, 0); }
#song-jump-banner .sjb-label{ font-size:11px; color:var(--rail-text-dim); text-transform:uppercase; letter-spacing:.08em; }
#song-jump-banner strong{ font-family:var(--display); font-size:16px; color:#f4ead2; }
#song-jump-banner .sjb-hint{ font-size:11px; color:var(--accent); }

#sidebar-tabs{ display:flex; gap:4px; padding:8px 14px 0; }
#sidebar-tabs button{
  flex:1; background:none; border:1px solid var(--rail-border); color:var(--rail-text-dim);
  padding:7px 0; border-radius:6px; cursor:pointer; font-size:12px; font-family:var(--serif);
}
#sidebar-tabs button.active{ background:var(--accent); color:#1b1611; border-color:var(--accent); font-weight:600; }
.setlist-header{ gap:8px; }
.setlist-header .sl-name{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.setlist-header .sl-date{ font-size:10.5px; color:var(--rail-text-dim); text-transform:none; letter-spacing:0; }
.setlist-header.past{ opacity:.55; }
.setlist-header .sl-edit{ opacity:.7 !important; position:static !important; }
.no-results.small{ font-size:11.5px; padding:8px 14px; }
.setlist-badge{ font-family:var(--serif); font-size:11px; color:#1b1611; background:var(--accent); padding:2px 7px; border-radius:4px; margin-left:6px; }

.minister-select{
  background:#1b1611; color:var(--rail-text); border:1px solid var(--rail-border);
  border-radius:7px; padding:7px 8px; font-size:12px; font-family:var(--serif); max-width:190px; cursor:pointer;
}
.minister-select.mm-wide{ width:100%; max-width:none; padding:10px; font-size:14px; }
.capo-suggest{
  width:auto !important; padding:0 8px !important; font-size:11px !important;
  color:var(--accent) !important; border:1px dashed var(--accent) !important; border-radius:5px !important; font-family:var(--serif) !important;
}
#btn-more{ position:relative; }
#sync-dot{ width:8px; height:8px; border-radius:50%; display:inline-block; background:#888; }
#sync-dot.ok{ background:#5fae63; } #sync-dot.err{ background:#d0543f; } #sync-dot.busy{ background:var(--accent); }

.more-menu{
  position:fixed; z-index:500; background:#1b1611; border:1px solid var(--rail-border);
  border-radius:9px; padding:6px; min-width:260px; box-shadow:0 10px 30px rgba(0,0,0,.5);
}
.more-menu button{
  display:block; width:100%; text-align:left; background:none; border:none; color:var(--rail-text);
  padding:9px 10px; border-radius:6px; cursor:pointer; font-size:13px; font-family:var(--serif);
}
.more-menu button:hover{ background:#2a2014; color:var(--accent); }
.more-menu hr{ border:none; border-top:1px solid var(--rail-border); margin:5px 2px; }

.v19-modal.wide{ width:min(560px, 94vw); }
.v19-modal{ max-height:88vh; overflow:auto; }
.v19-body label{ display:block; font-size:12px; color:var(--rail-text-dim); margin-bottom:2px; }
.v19-body label input, .v19-body label select{ margin-top:4px; }
.v19-body select{
  width:100%; background:#100d0a; border:1px solid #382d20; color:var(--rail-text);
  padding:8px 9px; border-radius:6px; font-size:13px; margin-bottom:12px;
}
.v19-body .ei-row{ display:flex; gap:10px; align-items:flex-start; }
.v19-body .ei-row > label{ flex:1; min-width:0; }
.v19-body .ei-row input{ margin-bottom:12px; }
.v19-body .ei-row .btn-mini{ height:36px; margin-top:4px; }
.v19-body .ei-ministers-title{ font-size:12px; color:var(--accent); margin:4px 0 8px; text-transform:uppercase; letter-spacing:.06em; }
.v19-body .ei-minister{ display:flex; gap:6px; }
.v19-body .ei-minister input{ flex:2; margin-bottom:8px; }
.v19-body .ei-minister select{ flex:1; margin-bottom:8px; }
.v19-body .ei-minister button, .sl-row button{
  background:none; border:1px solid var(--rail-border); color:var(--rail-text); border-radius:6px; cursor:pointer; padding:0 9px; height:34px;
}
.v19-body .dim, .dim{ color:var(--rail-text-dim); }
.v19-body .small, .small{ font-size:11.5px; line-height:1.5; }
.v19-body pre{ background:#100d0a; padding:8px; border-radius:6px; white-space:pre-wrap; font-size:11px; }
.v19-body details{ margin:6px 0 14px; color:var(--rail-text); }
.v19-body summary{ cursor:pointer; color:var(--accent); }
.v19-body ol{ padding-left:18px; }
.modal-actions button.danger{ border-color:var(--danger); color:#e88; }
.hist-item{ display:flex; justify-content:space-between; align-items:center; gap:10px; padding:9px 0; border-bottom:1px solid var(--rail-border); font-size:12.5px; }
.hist-actions{ display:flex; gap:6px; }
.hist-actions button{ padding:6px 10px; border-radius:6px; border:1px solid var(--rail-border); background:none; color:var(--rail-text); cursor:pointer; font-size:12px; }
.hist-actions button.primary{ background:var(--accent); color:#1b1611; border-color:var(--accent); }
.hist-preview{ max-height:260px; overflow:auto; margin-top:10px; }
.sl-row{ display:flex; align-items:center; gap:6px; padding:6px 0; border-bottom:1px solid var(--rail-border); }
.sl-row .sl-title{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
.sl-row select{ width:auto !important; margin:0 !important; padding:6px !important; font-size:12px !important; max-width:120px; }
.sl-row .song-num{ color:var(--rail-text-dim); font-size:11px; width:16px; }

/* cabeçalho da música: BPM / compasso / estrutura */
.page-header{ flex-wrap:wrap; column-gap:10px; }
.ph-metas{ display:flex; gap:6px; align-items:center; }
.ph-bpm, .ph-meta{
  font-family:var(--mono); font-size:11px; color:var(--ink-soft); background:none;
  border:1px solid var(--paper-shadow); border-radius:10px; padding:1px 7px; cursor:default;
}
.ph-bpm{ cursor:pointer; transition:background .08s; }
.ph-bpm.pulse{ background:var(--chord); color:var(--paper); }
.ph-structure{ flex-basis:100%; font-size:11.5px; color:var(--ink-soft); font-style:italic; margin-top:4px; }

/* popover: violão + teclado */
.diagram-pair{ display:flex; flex-direction:column; align-items:center; gap:6px; }
.kbd-wrap{ display:flex; flex-direction:column; align-items:center; gap:3px; }
.kbd-notes{ font:11px var(--mono); color:#2b2420; }
.kbd-bass{ color:#4a6fa5; }

@media (max-width: 640px){
  #btn-more, #btn-degrees, #minister-select{ display:none !important; }
}
/* ===================== v20 ===================== */
/* marcas de dinâmica */
.dyn-mark{
  display:inline-block; font-family:var(--serif); font-style:italic; font-weight:600;
  font-size:calc(var(--cifra-size, 14px) * .82); line-height:1.35; padding:0 8px; border-radius:10px;
  border:1px solid currentColor; vertical-align:middle; white-space:nowrap;
}
.dyn-stop{ color:#b3261e; background:rgba(179,38,30,.08); }
.dyn-soft{ color:#2f5d8a; background:rgba(47,93,138,.08); }
.dyn-build{ color:#b86e00; background:rgba(184,110,0,.09); }
.dyn-full{ color:#2e7d32; background:rgba(46,125,50,.08); }
.dyn-other{ color:var(--ink-soft); background:rgba(0,0,0,.04); }
.cifra-line.mark-line{ display:block; margin:2px 0; }
.more-menu .dyn-mark{ font-size:12px; }

/* notas da banda */
.cifra-line.band-note{
  display:block; white-space:normal; position:relative; z-index:10; cursor:pointer;
  font-family:var(--serif); font-size:calc(var(--cifra-size, 14px) * .86); line-height:1.35;
  color:#5a4a12; background:#f6e7a6; border-left:3px solid #c9a227; border-radius:4px;
  padding:3px 8px; margin:3px 0;
}
.theme-escuro .cifra-line.band-note, .theme-azul-noturno .cifra-line.band-note{ background:#3d3517; color:#f1e3a6; }

/* barra de ferramentas do editor */
.editor-tools{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; margin:6px 0 8px; }
.editor-tools button{
  background:var(--paper); border:1px solid var(--gold); color:var(--ink); border-radius:6px;
  padding:5px 10px; cursor:pointer; font-family:var(--serif); font-size:12.5px;
}
.editor-tools .et-hint{ font-size:11px; color:var(--ink-soft); font-style:italic; }

/* perfis */
.profile-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:8px; margin:10px 0 14px; }
.profile-card{
  display:flex; flex-direction:column; align-items:flex-start; gap:3px; text-align:left;
  background:#100d0a; border:1px solid var(--rail-border); color:var(--rail-text); border-radius:9px;
  padding:10px; cursor:pointer; font-family:var(--serif);
}
.profile-card.active{ border-color:var(--accent); box-shadow:0 0 0 1px var(--accent) inset; }
.profile-card .pc-icon{ font-size:22px; }
.profile-card .pc-desc{ font-size:11px; color:var(--rail-text-dim); line-height:1.35; }
.profile-chip{ font-size:13px; margin-left:4px; opacity:.85; }
body.profile-voz .cifra-block{ line-height:1.45; }

/* metrônomo */
#btn-metro{ font-family:var(--mono); min-width:64px; justify-content:center; }
#btn-metro.pulse, .ph-bpm.pulse{ background:var(--accent); color:#1b1611; }
#btn-metro.pulse-strong, .ph-bpm.pulse-strong{ background:var(--chord); color:#fff; }
.metro-panel{ padding:12px; min-width:270px; }
.metro-panel .mt-row{ display:flex; gap:6px; align-items:center; margin-bottom:9px; flex-wrap:wrap; }
.metro-panel button{
  display:inline-block !important; width:auto !important; background:#100d0a !important; border:1px solid var(--rail-border) !important;
  color:var(--rail-text); padding:7px 11px !important; border-radius:6px; font-family:var(--serif);
}
.metro-panel button.primary{ background:var(--accent) !important; color:#1b1611 !important; border-color:var(--accent) !important; font-weight:600; }
.metro-panel input[type=number]{ width:70px; background:#100d0a; border:1px solid #382d20; color:var(--rail-text); padding:7px; border-radius:6px; font-size:15px; text-align:center; }
#count-in{
  position:fixed; inset:0; display:flex; align-items:center; justify-content:center; pointer-events:none;
  font-family:var(--display); font-size:34vmin; color:var(--accent); z-index:600; opacity:0;
}
#count-in.show{ animation: countpop .45s ease-out; }
@keyframes countpop{ 0%{ opacity:.95; transform:scale(1.15);} 100%{ opacity:0; transform:scale(.9);} }

/* referências */
.ph-ref{
  font-family:var(--serif); font-size:11px; color:var(--chord); background:none; cursor:pointer;
  border:1px solid var(--chord); border-radius:10px; padding:1px 8px; position:relative; z-index:10;
}
.ph-bpm{ position:relative; z-index:10; }

/* ao vivo */
.live-badge{
  border:none; border-radius:12px; padding:5px 10px; font-size:11.5px; cursor:pointer; font-family:var(--serif); white-space:nowrap;
}
.live-badge.lead{ background:#b3261e; color:#fff; animation: livepulse 2s infinite; }
.live-badge.follow{ background:#2e7d32; color:#fff; }
@keyframes livepulse{ 50%{ opacity:.7; } }

/* o que mudou */
.changed-chip{ font-size:11px; background:#2f5d8a; color:#fff; border:none; border-radius:4px; padding:2px 7px; margin-left:6px; cursor:pointer; font-family:var(--serif); }
.unseen-dot{ color:#6fa8dc; font-size:10px; }
.ch-block{ border-bottom:1px solid var(--rail-border); padding:10px 0; }
.ch-head{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; margin-bottom:6px; }
.ch-head button{ padding:5px 10px; border-radius:6px; border:1px solid var(--rail-border); background:none; color:var(--rail-text); cursor:pointer; font-size:12px; }
.ch-head button.primary{ background:var(--accent); color:#1b1611; border-color:var(--accent); }
.diff-view{ font-family:var(--mono); font-size:11.5px; white-space:pre; overflow-x:auto; background:#100d0a; border-radius:6px; padding:6px 0; max-height:320px; overflow-y:auto; }
.diff-view > div{ padding:0 8px; }
.df-del{ background:rgba(208,84,63,.16); color:#f0a597; }
.df-add{ background:rgba(95,174,99,.16); color:#a8e0aa; }
.df-same{ color:var(--rail-text-dim); }
.df-skip{ color:var(--rail-text-dim); text-align:center; }
.diff-view mark{ background:rgba(255,255,255,.22); color:inherit; border-radius:2px; }

/* revisor */
.rv-item{ display:flex; gap:10px; align-items:flex-start; padding:9px 0; border-bottom:1px solid var(--rail-border); font-size:12.5px; }
.rv-item .rv-msg{ flex:1; line-height:1.45; }
.rv-item button{ padding:6px 10px; border-radius:6px; border:1px solid var(--accent); background:none; color:var(--accent); cursor:pointer; font-size:12px; white-space:nowrap; }
.rv-erro .rv-msg{ color:#f0a597; }
.rv-row{ cursor:pointer; }
.rv-row:hover{ background:#1c1712; }
.v19-body textarea{
  width:100%; background:#100d0a; border:1px solid #382d20; color:var(--rail-text); padding:9px 11px;
  border-radius:6px; font-size:13.5px; margin-bottom:10px; font-family:var(--serif); resize:vertical;
}

@media (max-width: 640px){
  #btn-metro{ display:none !important; }
  .live-badge{ padding:4px 7px; font-size:10.5px; max-width:120px; overflow:hidden; text-overflow:ellipsis; }
  .editor-tools .et-hint{ display:none; }
}
/* ===================== v22 — login e acessos ===================== */
#auth-screen{
  position:fixed; inset:0; z-index:2000; display:none; align-items:center; justify-content:center;
  background:radial-gradient(ellipse at top, #2a2014 0%, #100d0a 70%); padding:20px; overflow:auto;
}
body.auth-locked #app, body.auth-locked #mobile-menu{ visibility:hidden; }
.auth-card{
  width:min(420px, 100%); background:#1b1611; border:1px solid var(--rail-border); border-radius:14px;
  padding:26px 24px; color:var(--rail-text); box-shadow:0 20px 60px rgba(0,0,0,.5); margin:auto;
}
.auth-brand{ display:flex; gap:12px; align-items:center; margin-bottom:18px; }
.auth-logo{ width:46px; height:46px; border-radius:12px; background:var(--paper); color:var(--chord); display:flex; align-items:center; justify-content:center; font-size:26px; font-weight:700; }
.auth-brand h1{ margin:0; font-family:var(--display); font-size:22px; color:#f4ead2; }
.auth-sub{ font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--rail-text-dim); }
.auth-card label{ display:block; font-size:12px; color:var(--rail-text-dim); margin-bottom:12px; }
.auth-card input, .auth-card select{
  display:block; width:100%; margin-top:5px; background:#100d0a; border:1px solid #382d20; color:var(--rail-text);
  padding:11px 12px; border-radius:8px; font-size:15px; outline:none; box-sizing:border-box;
}
.auth-card input:focus{ border-color:var(--accent); }
.auth-primary{
  width:100%; padding:12px; border:none; border-radius:8px; background:var(--accent); color:#1b1611;
  font-weight:700; font-size:15px; cursor:pointer; font-family:var(--serif); margin-top:4px;
}
.auth-primary:disabled{ opacity:.6; }
.auth-link{ display:block; margin:12px auto 0; background:none; border:none; color:var(--rail-text-dim); cursor:pointer; text-decoration:underline; }
.auth-error{ display:none; background:rgba(208,84,63,.14); border:1px solid rgba(208,84,63,.5); color:#f0a597; padding:9px 11px; border-radius:8px; font-size:13px; margin-bottom:12px; }
.auth-hint, .auth-intro{ font-size:12.5px; color:var(--rail-text-dim); line-height:1.5; }
.auth-intro code{ color:var(--accent); }
.auth-section{ font-size:12px; color:var(--accent); text-transform:uppercase; letter-spacing:.06em; margin:6px 0 8px; }

.inst-chips{ display:flex; flex-wrap:wrap; gap:6px; margin-bottom:12px; }
.inst-chip{
  background:#100d0a; border:1px solid var(--rail-border); color:var(--rail-text); border-radius:16px;
  padding:6px 11px; font-size:12.5px; cursor:pointer; font-family:var(--serif);
}
.inst-chip.on{ background:var(--accent); color:#1b1611; border-color:var(--accent); font-weight:600; }

#account-chip{
  display:flex; align-items:center; gap:9px; width:100%; margin-top:12px; background:#1b1611; border:1px solid var(--rail-border);
  border-radius:9px; padding:7px 9px; cursor:pointer; color:var(--rail-text); text-align:left; font-family:var(--serif);
}
#account-chip:hover{ border-color:var(--accent); }
.ac-avatar{
  width:30px; height:30px; flex-shrink:0; border-radius:50%; background:var(--accent); color:#1b1611;
  display:inline-flex; align-items:center; justify-content:center; font-weight:700; font-size:14px;
}
.ac-avatar.big{ width:44px; height:44px; font-size:20px; }
.ac-info{ display:flex; flex-direction:column; min-width:0; }
.ac-info b{ font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ac-info span{ font-size:11px; color:var(--rail-text-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.acct-head{ display:flex; gap:12px; align-items:center; margin-bottom:8px; }

.v19-modal.xwide{ width:min(820px, 96vw); }
.adm-tabs{ display:flex; gap:6px; margin-bottom:12px; }
.adm-tabs button{ flex:1; padding:9px; border-radius:8px; border:1px solid var(--rail-border); background:none; color:var(--rail-text); cursor:pointer; font-family:var(--serif); }
.adm-tabs button.active{ background:var(--accent); color:#1b1611; border-color:var(--accent); font-weight:600; }
.adm-row{ display:flex; gap:10px; align-items:center; padding:10px 0; border-bottom:1px solid var(--rail-border); }
.adm-row.inactive{ opacity:.5; }
.adm-main{ flex:1; min-width:0; line-height:1.45; }
.adm-row button{ padding:6px 12px; border-radius:6px; border:1px solid var(--rail-border); background:none; color:var(--rail-text); cursor:pointer; }
.role-grid-wrap{ overflow-x:auto; margin-bottom:12px; }
.role-grid{ border-collapse:collapse; width:100%; font-size:12.5px; }
.role-grid th, .role-grid td{ border-bottom:1px solid var(--rail-border); padding:8px 6px; text-align:center; vertical-align:middle; }
.role-grid td:first-child{ text-align:left; min-width:190px; }
.role-grid th input.role-name{ width:110px; margin:0 0 3px; padding:6px; font-size:12px; text-align:center; }
.role-grid input[type=checkbox]{ width:18px; height:18px; accent-color:var(--accent); cursor:pointer; }
.danger-mini{ border-color:var(--danger) !important; color:#e88 !important; }
.danger-mini:disabled{ opacity:.35; cursor:not-allowed; }
.temp-pw{ background:#100d0a; border:1px dashed var(--accent); border-radius:8px; padding:12px; font-size:15px; line-height:1.8; margin:10px 0 14px; }
.mono{ font-family:var(--mono); letter-spacing:.05em; }
.btn-like{ padding:8px 14px; border-radius:6px; border:1px solid #25d366; color:#25d366; text-decoration:none; font-size:12.5px; }

/* permissões: some com o que a pessoa não pode fazer */
body.no-edit_songs [data-perm="edit_songs"],
body.no-delete_songs [data-perm="delete_songs"],
body.no-manage_folders.no-edit_songs [data-perm="manage_folders"],
body.no-manage_setlists [data-perm="manage_setlists"],
body.no-manage_setlists .sl-edit,
body.no-manage_users [data-perm="manage_users"],
body.no-organize .song-options-btn,
body.no-organize .drag-handle,
body.no-edit_songs .rv-item button,
body.no-edit_songs .hist-actions button[data-act="restore"],
body.no-delete_songs #modal-trash .hist-actions,
body.no-edit_songs #capo-suggest-save { display:none !important; }
/* ===================== v23 — segurança ===================== */
.v19-body label.small input[type=checkbox]{ width:auto; display:inline-block; margin:0 6px 0 0; vertical-align:middle; }
.au-filters{ display:flex; gap:12px; align-items:center; }
.au-filters select{ width:auto !important; margin:0 !important; padding:5px 8px !important; font-size:12px !important; }
.lock-badge{ margin-top:4px; font-size:12px; color:#f0a597; display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.adm-tabs button{ font-size:12.5px; }
.audit-list{ max-height:52vh; overflow-y:auto; margin:8px 0 12px; border-top:1px solid var(--rail-border); }
.audit-row{ display:grid; grid-template-columns:92px 1fr auto; gap:10px; padding:7px 4px; border-bottom:1px solid var(--rail-border); font-size:12.5px; align-items:baseline; }
.audit-row.alert{ background:rgba(208,84,63,.08); }
.audit-row.alert .au-text b:first-child{ color:#f0a597; }
.au-time{ color:var(--rail-text-dim); font-family:var(--mono); font-size:11px; }
.au-ip{ font-family:var(--mono); font-size:10.5px; }
#modal-reauth .v19-modal input{ width:100%; box-sizing:border-box; }
@media (max-width: 640px){ .audit-row{ grid-template-columns:70px 1fr; } .au-ip{ display:none; } }
/* ===================== v25 — senhas ===================== */
.auth-cmd{ background:#100d0a; border:1px dashed var(--accent); color:var(--accent); padding:10px 12px; border-radius:8px; font-family:var(--mono); font-size:12.5px; white-space:pre-wrap; word-break:break-all; }
.auth-ok{ display:none; background:rgba(95,174,99,.14); border:1px solid rgba(95,174,99,.5); color:#a8e0aa; padding:9px 11px; border-radius:8px; font-size:13px; margin-bottom:12px; line-height:1.45; }
.pw-wrap{ position:relative; display:block; }
.pw-wrap input{ padding-right:40px !important; }
.pw-eye{ position:absolute; right:6px; top:5px; bottom:0; display:flex; align-items:center; background:none; border:none; cursor:pointer; font-size:15px; opacity:.6; padding:0 4px; }
.ro-input{ opacity:.7; cursor:default; }
.pw-eye:hover{ opacity:1; }
.pw-rules{ list-style:none; margin:-4px 0 12px; padding:0; display:flex; flex-wrap:wrap; gap:5px 12px; font-size:12px; color:var(--rail-text-dim); }
.pw-rules li::before{ content:"○ "; }
.pw-rules li.ok{ color:#7fc882; }
.pw-rules li.ok::before{ content:"✓ "; }
.link-box{ width:100%; box-sizing:border-box; margin-top:8px; background:#1b1611; border:1px solid var(--rail-border); color:var(--rail-text); padding:8px; border-radius:6px; font-family:var(--mono); font-size:11.5px; }
#modal-change-password .v19-body input{ width:100%; box-sizing:border-box; }
/* ===================== v26 — página inicial e login ===================== */
#landing, #auth-screen{
  --nave: #1e1838;        /* noite de culto */
  --nave-deep: #161229;
  --luz: #f0a93b;         /* luz âmbar do palco: o único destaque */
  --luz-soft: rgba(240,169,59,.14);
  --papel: #f4ead3;       /* a cifra */
  --acorde: #9a3324;
  --texto: #ece8f6;
  --texto-2: #a49cc4;
  --linha: rgba(236,232,246,.12);
  --f-title: "Young Serif", "Iowan Old Style", Georgia, serif;
  --f-body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}
body.landing-open{ overflow:hidden; }
#landing{
  position:fixed; inset:0; z-index:2100; overflow-y:auto; display:none;
  background:var(--nave); color:var(--texto); font-family:var(--f-body); font-size:17px; line-height:1.55;
  -webkit-font-smoothing:antialiased;
}
#landing a{ color:inherit; }
#landing :focus-visible, #auth-screen :focus-visible{ outline:2px solid var(--luz); outline-offset:3px; border-radius:6px; }

/* ---- navegação ---- */
.ld-nav{
  position:sticky; top:0; z-index:5; display:flex; align-items:center; gap:28px;
  padding:14px clamp(20px,5vw,64px); background:rgba(30,24,56,.86); backdrop-filter:blur(10px);
  border-bottom:1px solid var(--linha);
}
.ld-brand{ display:inline-flex; align-items:center; gap:10px; font-family:var(--f-title); font-size:21px; text-decoration:none; color:var(--texto); }
.ld-logo{ width:34px; height:34px; border-radius:9px; background:var(--papel); color:var(--acorde); display:inline-flex; align-items:center; justify-content:center; font-size:20px; font-family:var(--f-body); font-weight:700; }
.ld-links{ display:flex; gap:24px; margin-left:auto; font-size:15px; }
.ld-links a{ text-decoration:none; color:var(--texto-2); }
.ld-links a:hover{ color:var(--texto); }

/* ---- botões ---- */
.ld-btn{ font:600 16px/1 var(--f-body); border-radius:999px; padding:14px 26px; cursor:pointer; text-decoration:none; display:inline-flex; align-items:center; border:1px solid transparent; transition:background .15s, color .15s; }
.ld-btn-main{ background:var(--luz); color:#231a0a; }
.ld-btn-main:hover{ background:#f6bd5e; }
.ld-btn-ghost{ background:none; border-color:var(--linha); color:var(--texto); padding:10px 20px; font-size:15px; }
.ld-btn-ghost:hover{ border-color:var(--luz); }
.ld-btn-quiet{ background:none; color:var(--texto); }
.ld-btn-quiet:hover{ color:var(--luz); }

/* ---- hero ---- */
.ld-hero{
  display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.15fr); gap:clamp(28px,5vw,72px); align-items:center;
  padding:clamp(48px,8vw,104px) clamp(20px,5vw,64px) clamp(56px,7vw,96px);
  background:radial-gradient(ellipse 60% 70% at 78% 40%, rgba(240,169,59,.16), transparent 70%);
}
.ld-hero h1{ font-family:var(--f-title); font-weight:400; font-size:clamp(42px,6.2vw,80px); line-height:1.02; letter-spacing:-.015em; margin:0 0 24px; max-width:13ch; }
.ld-lead{ font-size:clamp(17px,1.5vw,20px); color:var(--texto-2); max-width:34em; margin:0 0 32px; }
.ld-cta{ display:flex; gap:12px; flex-wrap:wrap; align-items:center; }
.ld-invite{ font-size:14px; color:var(--texto-2); margin:18px 0 0; }

/* palco: tablet do líder + celulares da banda */
.ld-stage{ position:relative; }
.ld-devices{ position:relative; height:420px; }
.dv{ position:absolute; background:#0f0c1d; border:1px solid rgba(255,255,255,.14); box-shadow:0 30px 60px rgba(8,5,20,.55); overflow:hidden; }
.dv-tablet{ left:0; top:0; width:66%; height:300px; border-radius:22px; padding:12px; }
.dv-phone{ width:30%; height:270px; border-radius:26px; padding:10px 8px; }
.dv-p1{ right:0; top:24px; }
.dv-p2{ left:54%; top:140px; z-index:2; }
.dv-bar{ display:flex; justify-content:space-between; align-items:center; font-size:11.5px; color:var(--texto-2); padding:2px 6px 8px; }
.dv-live{ color:#231a0a; background:var(--luz); border-radius:99px; padding:1px 8px; font-weight:600; }
.dv-follow{ color:#8fd6a0; }
.dv-follow::before{ content:"● "; }
.dv-page{ background:var(--papel); color:#2b2420; border-radius:12px; height:calc(100% - 28px); padding:14px 14px; overflow:hidden; }
.dv-phone .dv-page{ border-radius:16px; padding:12px 10px; }
.dv-title{ font-family:var(--f-title); font-size:19px; margin-bottom:8px; }
.dv-title em{ font-style:normal; font-family:var(--f-mono); font-size:12px; border:1px solid #c9b58f; border-radius:99px; padding:1px 8px; color:var(--acorde); vertical-align:middle; }
.dv pre, .ld-sheet pre, .as-sheet pre{ margin:0; font-family:var(--f-mono); font-size:13px; line-height:1.55; white-space:pre-wrap; }
/* cifra nunca quebra linha: o acorde tem que ficar em cima da sílaba certa */
.dv-phone pre{ font-size:9.5px; white-space:pre; overflow:hidden; }
.dv-tablet pre{ white-space:pre; overflow:hidden; }
.dv-phone pre.dm-big{ white-space:pre-wrap; }  /* voz: só letra, pode quebrar */
.dm-chords{ color:var(--acorde); font-weight:700; }
.dm-lyric{ color:#2b2420; }
.dv-phone pre.dm-big{ font-family:var(--f-body); font-size:15px; line-height:1.4; font-weight:500; }
.ld-sheet pre.dm-big{ font-family:var(--f-body); font-size:21px; line-height:1.45; font-weight:500; }
.dm-turn{ animation:dmTurn .55s ease-out; }
@keyframes dmTurn{ from{ opacity:.1; transform:translateX(14px); } to{ opacity:1; transform:none; } }

.ld-controls{
  position:relative; margin-top:8px; width:max-content; max-width:100%; display:flex; align-items:center; gap:8px; flex-wrap:wrap;
  background:rgba(22,18,41,.92); border:1px solid var(--linha); border-radius:999px; padding:6px 8px 6px 6px; z-index:3;
}
.ld-ctl{ min-width:36px; height:36px; border-radius:99px; border:1px solid var(--linha); background:var(--nave); color:var(--texto); font:600 18px var(--f-body); cursor:pointer; }
.ld-ctl:hover{ border-color:var(--luz); }
.ld-ctl-wide{ font-size:14px; padding:0 14px; }
.ld-ctl-key{ font-size:14px; color:var(--texto-2); padding:0 4px; }
.ld-ctl-key b{ color:var(--luz); font-family:var(--f-mono); font-size:15px; }
.ld-ctl-page{ font-size:12.5px; color:var(--texto-2); padding-right:8px; }

/* ---- seções ---- */
.ld-section{ padding:clamp(56px,8vw,104px) clamp(20px,5vw,64px); border-top:1px solid var(--linha); }
.ld-section-head{ max-width:640px; margin-bottom:40px; }
.ld-section h2, .ld-final h2{ font-family:var(--f-title); font-weight:400; font-size:clamp(30px,3.6vw,46px); line-height:1.1; margin:0 0 14px; }
.ld-section-head p{ color:var(--texto-2); margin:0; }

.ld-profiles{ background:var(--nave-deep); }
.ld-profile-box{ display:grid; grid-template-columns:200px minmax(0,1fr); gap:28px; align-items:start; max-width:960px; }
.ld-tabs{ display:flex; flex-direction:column; gap:4px; }
.ld-tabs button{ text-align:left; background:none; border:none; border-left:3px solid transparent; color:var(--texto-2); font:500 18px var(--f-body); padding:10px 16px; cursor:pointer; }
.ld-tabs button[aria-selected="true"]{ color:var(--texto); border-left-color:var(--luz); background:var(--luz-soft); }
.ld-sheet{ background:var(--papel); border-radius:14px; padding:26px 28px; min-height:190px; box-shadow:0 20px 50px rgba(8,5,20,.45); }
.ld-sheet pre{ font-size:15px; }
.ld-prof-note{ color:var(--texto-2); margin:16px 2px 0; font-size:15.5px; }

.ld-steps{ list-style:none; counter-reset:passo; margin:0; padding:0; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:clamp(20px,3vw,40px); max-width:1100px; }
.ld-steps li{ counter-increment:passo; border-top:2px solid var(--linha); padding-top:22px; }
.ld-steps li::before{ content:counter(passo); font-family:var(--f-title); font-size:44px; color:var(--luz); line-height:1; display:block; margin-bottom:14px; }
.ld-steps h3{ font-size:21px; margin:0 0 8px; font-weight:600; }
.ld-steps p{ color:var(--texto-2); margin:0; font-size:16px; }

.ld-details-wrap{ background:var(--nave-deep); }
.ld-details{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:44px 56px; max-width:1000px; }
.ld-detail{ max-width:440px; }
.ld-detail h3{ font-size:19px; margin:14px 0 6px; font-weight:600; }
.ld-detail p{ color:var(--texto-2); margin:0; font-size:16px; }
.ld-chip{ display:inline-block; font:600 13px var(--f-mono); color:var(--luz); border:1px solid rgba(240,169,59,.45); border-radius:99px; padding:3px 12px; }
.ld-chip-full{ font-family:var(--f-body); font-style:italic; color:#7fc882; border-color:rgba(127,200,130,.5); }
.dm-inline{ margin-bottom:6px; }
.ld-note{ display:inline-block; background:#f6e7a6; color:#5a4a12; border-left:3px solid #c9a227; border-radius:4px; padding:4px 10px; font-size:14px; }
.ld-diff{ display:inline-block; font:600 14px var(--f-mono); }
.ld-diff s{ color:#f0a597; margin-right:8px; }
.ld-diff{ color:#a8e0aa; }

.ld-security{ display:grid; grid-template-columns:minmax(0,.8fr) minmax(0,1.6fr); gap:clamp(24px,5vw,72px); align-items:start; }
.ld-security h2{ margin:0; }
.ld-sec-list{ margin:0; display:grid; gap:28px; }
.ld-sec-list div{ border-left:2px solid var(--luz); padding-left:20px; }
.ld-sec-list dt{ font-weight:600; font-size:19px; margin-bottom:4px; }
.ld-sec-list dd{ margin:0; color:var(--texto-2); }
.ld-final{ text-align:center; padding:clamp(64px,9vw,120px) 20px; border-top:1px solid var(--linha);
  background:radial-gradient(ellipse 50% 80% at 50% 100%, rgba(240,169,59,.14), transparent 70%); }
.ld-final h2{ margin-bottom:28px; }
.ld-foot{ display:flex; justify-content:space-between; padding:22px clamp(20px,5vw,64px); font-size:13.5px; color:var(--texto-2); border-top:1px solid var(--linha); }

/* ---- novo login (todas as telas de acesso) ---- */
#auth-screen{
  position:fixed; inset:0; z-index:2000; display:none; padding:0;
  background:var(--nave); color:var(--texto); font-family:var(--f-body); overflow:auto;
}
.as-side{
  flex:1.1; min-height:100vh; display:flex; flex-direction:column; justify-content:space-between; padding:32px clamp(28px,4vw,56px);
  background:radial-gradient(ellipse 70% 60% at 50% 45%, rgba(240,169,59,.18), transparent 70%), var(--nave-deep);
  border-right:1px solid var(--linha);
}
.as-sheet{ align-self:center; width:min(420px,90%); background:var(--papel); color:#2b2420; border-radius:14px; padding:24px 26px; transform:rotate(-2deg); box-shadow:0 40px 80px rgba(8,5,20,.6); }
.as-sheet-title{ font-family:var(--f-title); font-size:22px; margin-bottom:10px; }
.as-sheet-title em{ font-style:normal; font:600 12px var(--f-mono); border:1px solid #c9b58f; border-radius:99px; padding:1px 8px; color:var(--acorde); vertical-align:middle; }
.as-sheet pre{ font-size:14px; }
.as-quote{ font-family:var(--f-title); font-size:24px; margin:0; color:var(--texto); }
.as-main{ flex:1; min-height:100vh; display:flex; flex-direction:column; justify-content:center; align-items:center; padding:40px 24px; }
.as-brand-mobile{ display:none; margin-bottom:28px; }
.as-back{ margin-top:22px; background:none; border:none; color:var(--texto-2); font:500 14px var(--f-body); cursor:pointer; text-decoration:underline; text-underline-offset:3px; }
.as-back:hover{ color:var(--texto); }
.as-h1{ font-family:var(--f-title); font-weight:400; font-size:36px; margin:0 0 6px; }
.as-sub{ color:var(--texto-2); margin:0 0 26px; font-size:15.5px; }

#auth-screen .auth-card{ width:min(400px,100%); background:none; border:none; box-shadow:none; padding:0; color:var(--texto); margin:0; }
#auth-screen .auth-card label{ font-size:14px; color:var(--texto-2); margin-bottom:16px; font-family:var(--f-body); }
#auth-screen .auth-card input, #auth-screen .auth-card select{
  background:var(--nave-deep); border:1px solid rgba(236,232,246,.18); color:var(--texto); border-radius:10px; padding:13px 14px; font:16px var(--f-body);
}
#auth-screen .auth-card input:focus{ border-color:var(--luz); outline:none; box-shadow:0 0 0 3px var(--luz-soft); }
#auth-screen .auth-primary{ background:var(--luz); color:#231a0a; border-radius:999px; padding:15px; font:600 16px var(--f-body); margin-top:8px; }
#auth-screen .auth-primary:hover{ background:#f6bd5e; }
#auth-screen .auth-link{ color:var(--texto-2); font-family:var(--f-body); font-size:14px; }
#auth-screen .auth-hint, #auth-screen .auth-intro{ color:var(--texto-2); font-size:15px; line-height:1.55; }
#auth-screen .auth-intro b{ color:var(--texto); }
#auth-screen .auth-error{ border-radius:10px; }
#auth-screen .auth-ok{ border-radius:10px; }
#auth-screen .inst-chip{ background:var(--nave-deep); border-color:rgba(236,232,246,.18); color:var(--texto); font-family:var(--f-body); }
#auth-screen .inst-chip.on{ background:var(--luz); border-color:var(--luz); color:#231a0a; }
#auth-screen .pw-rules li.ok{ color:#8fd6a0; }
#auth-screen .auth-cmd{ border-color:var(--luz); color:var(--luz); background:var(--nave-deep); }
#auth-screen .auth-brand{ display:none; }

/* ---- telas estreitas ---- */
@media (max-width: 900px){
  .ld-hero{ grid-template-columns:1fr; }
  .ld-hero h1{ max-width:14ch; }
  .ld-stage{ min-height:450px; max-width:560px; }
  .ld-profile-box{ grid-template-columns:1fr; }
  .ld-tabs{ flex-direction:row; overflow-x:auto; }
  .ld-tabs button{ border-left:none; border-bottom:3px solid transparent; white-space:nowrap; }
  .ld-tabs button[aria-selected="true"]{ border-bottom-color:var(--luz); }
  .ld-steps{ grid-template-columns:1fr; }
  .ld-security{ grid-template-columns:1fr; }
  .ld-details{ grid-template-columns:1fr; }
  .as-side{ display:none; }
  .as-brand-mobile{ display:inline-flex; }
}
@media (max-width: 560px){
  .ld-links{ display:none; }
  .ld-nav{ gap:12px; }
  .ld-nav .ld-btn-ghost{ margin-left:auto; }
  .ld-devices{ height:470px; }
  .dv-tablet{ width:100%; height:250px; }
  .dv-phone{ width:48%; height:230px; }
  .dv-p1{ top:236px; right:0; }
  .dv-p2{ top:236px; left:0; }
  .dv-phone pre{ font-size:8.3px; }
  .ld-controls{ width:100%; justify-content:center; border-radius:18px; }
  .ld-foot{ flex-direction:column; gap:6px; }
}
@media (prefers-reduced-motion: reduce){
  .dm-turn{ animation:none; }
}

/* ===================== v28 — lista lateral: fixa (computador) ou gaveta (iPad/celular) ===================== */
#sidebar-overlay{ display:none !important; }           /* fundo antigo, substituído */

/* computador: lista ao lado das cifras */
body.layout-docked #sidebar{
  position:relative; transform:none; width:300px; min-width:300px; height:auto;
  transition:margin-left .28s ease; box-shadow:none;
}
body.layout-docked #sidebar.docked-hidden{ margin-left:-300px; }

/* iPad e celular: gaveta por cima, com fundo escuro */
body.layout-drawer #sidebar{
  position:fixed; top:0; left:0; bottom:0; height:100vh; height:100dvh;
  width:min(360px, 88vw); min-width:0; max-width:none; margin-left:0 !important;
  transform:translateX(-102%); transition:transform .28s cubic-bezier(.2,.8,.2,1), box-shadow .28s;
  z-index:400; box-shadow:none; outline:none;
  padding-top:env(safe-area-inset-top); padding-bottom:env(safe-area-inset-bottom);
}
body.layout-drawer #sidebar.drawer-open{ transform:none; box-shadow:10px 0 40px rgba(0,0,0,.55); }
body.layout-drawer #sidebar.dragging{ transition:none; }
#drawer-backdrop{
  position:fixed; inset:0; z-index:399; background:rgba(8,6,4,.55);
  opacity:0; pointer-events:none; transition:opacity .28s;
}
body.layout-drawer.drawer-is-open #drawer-backdrop{ opacity:1; pointer-events:auto; }
body.layout-docked #drawer-backdrop{ display:none; }

/* ✕ dentro da gaveta */
.sidebar-header{ position:relative; }
#drawer-close{
  display:none; position:absolute; top:12px; right:12px; width:40px; height:40px; border-radius:10px;
  background:none; border:1px solid var(--rail-border); color:var(--rail-text); font-size:18px; cursor:pointer;
}
#drawer-close:hover{ border-color:var(--accent); color:var(--accent); }
body.layout-drawer #drawer-close{ display:inline-flex; align-items:center; justify-content:center; }

/* botão "☰ Músicas": texto visível no tablet e no computador, só o ícone no celular */
#toggle-sidebar{ display:inline-flex; align-items:center; gap:8px; width:auto; min-width:40px; padding:0 12px; }
#toggle-sidebar .tg-icon{ font-size:17px; line-height:1; }
#toggle-sidebar .tg-text{ font-size:13.5px; font-family:var(--serif); }
#toggle-sidebar[aria-expanded="true"]{ border-color:var(--accent); color:var(--accent); }
@media (max-width: 640px){
  #toggle-sidebar{ padding:0; width:40px; justify-content:center; }
  #toggle-sidebar .tg-text{ display:none; }
}

/* toques confortáveis no iPad */
@media (pointer: coarse){
  body.layout-drawer .song-item{ min-height:52px; }
  #toggle-sidebar{ min-height:40px; }
}
@media (prefers-reduced-motion: reduce){
  body.layout-drawer #sidebar, #drawer-backdrop, body.layout-docked #sidebar{ transition:none; }
}

/* ===================== v28 — telas baixas (celular deitado) ===================== */
/* a barra vira uma linha só (rola para o lado) e a página fica compacta: sobra altura para a cifra */
@media (max-height: 520px) and (orientation: landscape){
  #toolbar{ flex-wrap:nowrap; overflow-x:auto; overflow-y:hidden; padding:6px 10px; gap:6px; scrollbar-width:none; -webkit-overflow-scrolling:touch; }
  #toolbar::-webkit-scrollbar{ display:none; }
  #toolbar > *{ flex-shrink:0; }
  #toolbar .toolbar-title{ flex:0 0 auto; min-width:0; max-width:40vw; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  #book-viewport{ padding:6px 10px; }
  .page{ padding:12px 22px 10px; }
  .page-header{ margin-bottom:6px; padding-bottom:4px; }
  .page-number{ bottom:4px !important; }
  #page-indicator{ bottom:4px; }
}

/* ===================== v28.1 — margens seguras do iPad/iPhone (barra de status, cantos, indicador) ===================== */
/* A página ocupa a tela inteira (inclusive embaixo da barra de status translúcida):
   cada barra/área reserva o espaço do sistema. Em computadores esses valores são 0. */
html, body{ background:#100d0a; }            /* nenhuma faixa de outra cor nas bordas */
@media (min-width: 641px){
  #toolbar{
    padding-top:calc(10px + env(safe-area-inset-top));
    padding-left:calc(18px + env(safe-area-inset-left));
    padding-right:calc(18px + env(safe-area-inset-right));
  }
  #book-viewport{ padding-bottom:calc(18px + env(safe-area-inset-bottom)); }
}
@media (max-height: 520px) and (orientation: landscape){
  #toolbar{ padding-top:calc(6px + env(safe-area-inset-top)); padding-left:calc(10px + env(safe-area-inset-left)); padding-right:calc(10px + env(safe-area-inset-right)); }
  #book-viewport{ padding-bottom:calc(6px + env(safe-area-inset-bottom)); }
}
/* lista fixa (computador/iPad deitado grande) */
body.layout-docked #sidebar{ padding-top:env(safe-area-inset-top); padding-left:env(safe-area-inset-left); }
/* gaveta: do topo ao rodapé de verdade, e o fundo escuro cobre a tela toda */
body.layout-drawer #sidebar{ top:0; bottom:0; height:auto; padding-left:env(safe-area-inset-left); }
#drawer-backdrop{ top:-100px; bottom:-100px; left:0; right:0; }
/* página inicial e login */
.ld-nav{ padding-top:calc(14px + env(safe-area-inset-top)); }
.ld-foot{ padding-bottom:calc(22px + env(safe-area-inset-bottom)); }
.as-main{ padding-top:calc(40px + env(safe-area-inset-top)); padding-bottom:calc(40px + env(safe-area-inset-bottom)); }
.as-side{ padding-top:calc(32px + env(safe-area-inset-top)); }

/* ===================== v28.3 — logo ===================== */
img.ld-logo{ width:34px; height:34px; border-radius:9px; background:none; display:block; flex-shrink:0; }
.brand-h1{ display:flex; align-items:center; gap:10px; }
.brand-mark{ width:30px; height:30px; border-radius:8px; flex-shrink:0; }

/* ===================== v28.4 — versão visível ===================== */
.ld-version{ opacity:.7; }
.menu-version{ padding:10px 14px 6px; margin-top:4px; border-top:1px solid var(--rail-border); font-size:11.5px; color:var(--rail-text-dim); }

/* =====================================================================
   v29 — INTERFACE DO APP COM A IDENTIDADE DA PÁGINA INICIAL
   ===================================================================== */
body.ui29{
  --nave:#1e1838; --nave-deep:#161229; --nave-hi:#2a2250;
  --luz:#f0a93b; --luz-soft:rgba(240,169,59,.13);
  --texto:#ece8f6; --texto-2:#a49cc4; --linha:rgba(236,232,246,.11);
  --f-ui:"Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-title:"Young Serif", "Iowan Old Style", Georgia, serif;
  /* variáveis antigas da "moldura" apontando para a nova paleta */
  --rail-bg:var(--nave-deep); --rail-border:var(--linha); --rail-text:var(--texto); --rail-text-dim:var(--texto-2); --accent:var(--luz);
  --stage-bg-1:#171230; --stage-bg-2:#241c45;
}
body.ui29, body.ui29 #sidebar, body.ui29 #toolbar, body.ui29 #console, body.ui29 .more-menu, body.ui29 .modal-overlay{ font-family:var(--f-ui); }

/* ---------- lista lateral (biblioteca) ---------- */
body.ui29 #sidebar{ background:var(--nave-deep); border-right:1px solid var(--linha); display:flex; flex-direction:column; }
body.ui29 .sidebar-header{ padding:18px 18px 10px; border-bottom:none; }
body.ui29 .sidebar-header h1{ font-family:var(--f-title); font-weight:400; font-size:22px; letter-spacing:0; color:var(--texto); margin:0; }
body.ui29 .brand-mark{ width:32px; height:32px; }
body.ui29 .sidebar-header .sub{ display:none; }                 /* o nome da banda vai para a conta */
body.ui29 .search-wrap{ padding:6px 14px 10px; border-bottom:none; }
body.ui29 #search-input{
  background:var(--nave); border:1px solid var(--linha); color:var(--texto); border-radius:10px;
  padding:11px 12px 11px 36px; font:15px var(--f-ui);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23a49cc4' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m11 11 3.5 3.5'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:12px 50%;
}
body.ui29 #search-input:focus{ border-color:var(--luz); outline:none; box-shadow:0 0 0 3px var(--luz-soft); }
body.ui29 #search-input::placeholder{ color:var(--texto-2); opacity:.8; }

/* "o que mudou" em destaque, logo abaixo da busca */
#sb-changes{
  margin:0 14px 10px; display:flex; align-items:center; gap:8px; padding:9px 12px; border-radius:10px;
  background:var(--luz-soft); border:1px solid rgba(240,169,59,.35); color:var(--texto); font:500 13.5px var(--f-ui); cursor:pointer; text-align:left;
}
#sb-changes .sbc-dot{ width:8px; height:8px; border-radius:50%; background:var(--luz); flex-shrink:0; }
#sb-changes .sbc-go{ margin-left:auto; color:var(--luz); font-weight:600; }

/* abas Músicas / Repertórios */
body.ui29 #sidebar-tabs{ margin:0 14px 10px; padding:3px; gap:3px; background:var(--nave); border:1px solid var(--linha); border-radius:11px; }
body.ui29 #sidebar-tabs button{ border:none !important; background:none; color:var(--texto-2); font:500 14px var(--f-ui); border-radius:8px; padding:8px; }
body.ui29 #sidebar-tabs button.active{ background:var(--nave-hi) !important; color:var(--texto) !important; box-shadow:inset 0 0 0 1px var(--linha); }

/* ações de criar: discretas, em linha */
body.ui29 .sidebar-actions, body.ui29 #sidebar .btn-mini{ font-family:var(--f-ui); }
body.ui29 #sidebar .btn-mini{
  background:none; border:1px solid var(--linha); color:var(--texto-2); border-radius:9px; font-size:13px; padding:7px 8px;
}
body.ui29 #sidebar .btn-mini:hover{ color:var(--texto); border-color:rgba(240,169,59,.5); }

/* pastas: texto normal (sem caixa alta), com a contagem */
body.ui29 .folder-header{
  text-transform:none; letter-spacing:0; font:600 13px var(--f-ui); color:var(--texto-2);
  padding:14px 18px 6px; border:none; background:none;
}
body.ui29 .folder-header:hover{ color:var(--texto); }

/* músicas */
body.ui29 .song-item{ margin:1px 8px; border-radius:10px; padding:9px 10px; border-left:3px solid transparent; }
body.ui29 .song-item:hover{ background:rgba(236,232,246,.05); }
body.ui29 .song-item.active{ background:var(--luz-soft); border-left-color:var(--luz); }
body.ui29 .song-num{ font:500 12px var(--f-ui); color:var(--texto-2); opacity:.7; }
body.ui29 .song-title{ font:500 15px var(--f-ui); color:var(--texto); }
body.ui29 .song-item.active .song-title{ color:#fff; }
body.ui29 .song-meta{ font:12.5px var(--f-ui); color:var(--texto-2); }
body.ui29 #song-list{ flex:1; }
body.ui29 .sidebar-footer{ display:none; }

/* conta no rodapé da lista */
#sb-account{ border-top:1px solid var(--linha); padding:10px 12px calc(10px + env(safe-area-inset-bottom)); }
body.ui29 #sb-account #account-chip{
  width:100%; margin:0; display:flex; align-items:center; gap:10px; background:none; border:none; border-radius:10px;
  padding:8px; color:var(--texto); cursor:pointer; text-align:left;
}
body.ui29 #sb-account #account-chip:hover{ background:rgba(236,232,246,.05); }
body.ui29 #sb-account .ac-avatar{ width:36px; height:36px; border-radius:50%; background:var(--luz); color:#231a0a; font:700 15px var(--f-ui); display:flex; align-items:center; justify-content:center; flex-shrink:0; }
body.ui29 #sb-account .ac-info{ display:flex; flex-direction:column; min-width:0; flex:1; }
body.ui29 #sb-account .ac-info b{ font:600 14px var(--f-ui); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
body.ui29 #sb-account .ac-info span{ font:12.5px var(--f-ui); color:var(--texto-2); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
#sb-account .ac-more{ color:var(--texto-2); font-size:18px; padding:0 4px; }

/* ---------- barra de cima: "o que está tocando" ---------- */
body.ui29 #toolbar{ background:rgba(22,18,41,.9); border-bottom:1px solid var(--linha); gap:10px; min-height:60px; }
body.ui29 #toolbar button, body.ui29 #console button, body.ui29 #console select{
  font-family:var(--f-ui); background:none; border:1px solid var(--linha); color:var(--texto); border-radius:10px;
  min-height:38px; padding:0 12px; font-size:14px;
}
body.ui29 #toolbar button:hover, body.ui29 #console button:hover{ border-color:rgba(240,169,59,.55); }
body.ui29 #toolbar-title{ font-family:var(--f-title); font-size:19px; font-weight:400; color:var(--texto); }
body.ui29 #toggle-sidebar{ border-color:var(--linha); }
body.ui29 #toggle-sidebar[aria-expanded="true"]{ border-color:var(--luz); color:var(--luz); }
body.ui29 #toggle-sidebar .tg-text{ font-family:var(--f-ui); }
/* Ao vivo: o botão principal da barra */
#btn-live-top{ margin-left:auto; display:inline-flex; align-items:center; gap:7px; font-weight:600 !important; }
body.ui29 #btn-live-top.off{ background:var(--luz); border-color:var(--luz); color:#231a0a; }
body.ui29 #btn-live-top.off:hover{ background:#f6bd5e; }
body.ui29 #btn-live-top.lead{ border-color:var(--luz); color:var(--luz); }
body.ui29 #btn-live-top.follow{ border-color:#7fc882; color:#a8e0aa; }
#btn-live-top .lt-dot{ width:8px; height:8px; border-radius:50%; background:currentColor; animation:ltPulse 1.6s ease-in-out infinite; }
@keyframes ltPulse{ 50%{ opacity:.35; } }
body.ui29 #live-badge{ display:none !important; }                /* o estado agora aparece no próprio botão */
body.ui29 #btn-delete{ display:none !important; }                /* "Excluir música" fica no ⚙, longe de toques acidentais */
body.ui29 #btn-more{ min-width:44px; }
/* sem música aberta: a barra mostra só o essencial */
body.ui29:not(.song-open) #btn-edit, body.ui29:not(.song-open) #btn-note{ display:none !important; }

/* ---------- barra de baixo: a "mesa" ---------- */
#console{
  display:none; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap;
  padding:10px 18px calc(10px + env(safe-area-inset-bottom)); background:rgba(22,18,41,.94);
  border-top:1px solid var(--linha); position:relative; z-index:5;
}
body.ui29.song-open #console{ display:flex; }
#console .cs-left, #console .cs-right{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
body.ui29 #console .cs-left > div{ display:flex; align-items:center; gap:2px; background:var(--nave); border:1px solid var(--linha); border-radius:11px; padding:2px; }
body.ui29 #console .cs-left > div button{ border:none; min-width:36px; padding:0 10px; background:none; }
body.ui29 #console .cs-left > div button:hover{ background:rgba(236,232,246,.06); }
body.ui29 #console #transpose-label, body.ui29 #console #capo-label{ font:600 13.5px var(--f-ui); color:var(--texto); min-width:64px; text-align:center; }
body.ui29 #console #transpose-label b, body.ui29 #console #transpose-label strong{ color:var(--luz); }
body.ui29 #console #transpose-reset{ color:var(--texto-2); font-size:12.5px; }
body.ui29 #console #btn-profile{ display:inline-flex; align-items:center; gap:6px; }
body.ui29 #console #btn-degrees.active, body.ui29 #console #btn-metro.active, body.ui29 #console #btn-metro.playing{ border-color:var(--luz); color:var(--luz); background:var(--luz-soft); }
@media (max-width:640px){ #console{ display:none !important; } }        /* celular: menu ⋯ */
@media (max-height:520px) and (orientation:landscape){ #console{ padding-top:6px; padding-bottom:calc(6px + env(safe-area-inset-bottom)); } }

/* ---------- menus (⚙ e conta) ---------- */
body.ui29 .more-menu{
  background:#231c44; border:1px solid var(--linha); border-radius:14px; padding:6px; min-width:280px;
  box-shadow:0 18px 50px rgba(6,4,18,.6); max-height:calc(100vh - 90px); overflow:auto;
}
body.ui29 .more-menu button{ font:14.5px var(--f-ui); color:var(--texto); border-radius:9px; padding:10px 12px; }
body.ui29 .more-menu button:hover, body.ui29 .more-menu button:focus-visible{ background:rgba(236,232,246,.07); outline:none; }
body.ui29 .more-menu hr{ border:none; border-top:1px solid var(--linha); margin:6px 4px; }
.m29-sec{ font:600 12px var(--f-ui); color:var(--texto-2); padding:12px 12px 4px; }
.m29-sec:first-child{ padding-top:6px; }
.m29-head{ display:flex; flex-direction:column; padding:10px 12px 8px; border-bottom:1px solid var(--linha); margin-bottom:4px; }
.m29-head b{ font:600 15px var(--f-ui); color:var(--texto); }
.m29-head span{ font:12.5px var(--f-ui); color:var(--texto-2); }
.m29-badge{ background:var(--luz); color:#231a0a; border-radius:99px; padding:1px 7px; font-size:12px; font-weight:700; margin-left:6px; }
.m29-count{ color:var(--texto-2); margin-left:6px; }
body.ui29 .more-menu .m29-danger{ color:#f0a597; }

/* ---------- tela inicial ---------- */
body.ui29 .welcome-screen{ display:block; align-items:stretch !important; justify-content:flex-start !important; overflow:auto; padding:0 !important; }
body.ui29 .welcome-screen[style*="display: none"]{ display:none !important; }
.h29{ display:grid; grid-template-columns:minmax(0,1.3fr) minmax(0,1fr); gap:clamp(24px,5vw,72px); width:100%; max-width:1080px; margin:0 auto; padding:clamp(28px,6vh,72px) clamp(20px,4vw,48px); text-align:left; }
.h29 h2{ font-family:var(--f-title); font-weight:400; font-size:clamp(28px,3vw,38px); color:var(--texto); margin:0 0 6px; }
.h29 h3{ font:600 14px var(--f-ui); color:var(--texto-2); margin:0 0 8px; }
.h29-side h3:not(:first-child){ margin-top:28px; }
.h29-sub{ font:15.5px var(--f-ui); color:var(--texto-2); margin:0 0 20px; line-height:1.5; }
.h29-sub::first-letter{ text-transform:uppercase; }
.h29-list{ list-style:none; margin:0; padding:0; }
.h29-list li + li{ border-top:1px solid var(--linha); }
.h29-list button{
  width:100%; display:flex; align-items:center; gap:14px; background:none; border:none; color:var(--texto);
  padding:12px 6px; text-align:left; cursor:pointer; border-radius:8px; font:500 16px var(--f-ui);
}
.h29-list button:hover{ background:rgba(236,232,246,.05); }
.h29-n{ font-family:var(--f-title); color:var(--luz); font-size:18px; min-width:22px; }
.h29-t{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.h29-k{ font:600 12.5px var(--f-ui); color:var(--texto-2); border:1px solid var(--linha); border-radius:99px; padding:2px 9px; }
.h29-m{ font:13px var(--f-ui); color:var(--texto-2); }
.h29-side .h29-list button{ font-size:14.5px; padding:10px 6px; }
.h29-cta{ background:var(--luz); color:#231a0a; border:none; border-radius:999px; padding:12px 22px; font:600 15px var(--f-ui); cursor:pointer; }
@media (max-width:900px){ .h29{ grid-template-columns:1fr; } }

/* ---------- janelas (modais) ---------- */
body.ui29 .modal-overlay .modal, body.ui29 .modal-overlay .v19-modal{ background:#1d1739; border:1px solid var(--linha); border-radius:16px; color:var(--texto); }
body.ui29 .modal-overlay h2, body.ui29 .modal-overlay h3{ font-family:var(--f-title); font-weight:400; }

/* 4. ações de criar sempre numa linha */
body.ui29 #sidebar .btn-mini{ white-space:nowrap; padding:7px 6px; font-size:12.5px; }
/* a área da cifra centraliza a página; sem música aberta, a tela inicial ocupa tudo, a partir do topo */
body.ui29:not(.song-open) #book-viewport{ align-items:stretch; justify-content:flex-start; padding:0; }
body.ui29:not(.song-open) .welcome-screen{ width:100%; height:100%; }
body.ui29 .h29{ margin:0 auto !important; }

/* ===================== v30 — janela do Ao vivo ===================== */
.lv-status{ display:flex; align-items:center; gap:10px; font-size:16px; margin:4px 0 10px; line-height:1.45; }
.lv-status.off{ color:var(--texto-2, #a49cc4); }
.lv-dot{ width:10px; height:10px; border-radius:50%; background:#7fc882; flex-shrink:0; animation:ltPulse 1.6s ease-in-out infinite; }
.lv-status.lead .lv-dot{ background:var(--luz, #f0a93b); }
.lv-key{ display:block; margin:14px 0 4px; }
.lv-actions{ flex-wrap:wrap; gap:8px; }
body.ui29 #btn-live-top.stale{ border-color:#f0a597; color:#f0a597; }

/* ===================== v30.1 — foco visível para quem usa teclado ===================== */
/* só aparece na navegação por teclado (não ao tocar/clicar) */
body.ui29 :is(button, a, input, select, textarea, summary, [tabindex]):focus-visible{
  outline:2px solid var(--luz) !important; outline-offset:2px;
}
body.ui29 .song-item:focus-visible{ outline-offset:-2px; }
