:root {
  --bg: #121110;
  --bg2: #1a1917;
  --panel: #1f1d1b;
  --line: #2f2c29;
  --line2: #3d3934;
  --text: #ece8e3;
  --muted: #9a938b;
  --accent: #f5a524;
  --accent-ink: #1b1305;
  --danger: #ef5b5b;
  --ok: #7cc36a;
  --r: 10px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
a { color: var(--accent); }

#app { display: grid; grid-template-columns: 280px 1fr; height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); padding: 16px; display: flex;
  flex-direction: column; gap: 12px; min-height: 0; }
.brand { font-weight: 800; font-size: 20px; letter-spacing: .3px; display: flex; align-items: center; gap: 10px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  clip-path: none; position: relative; }
.logo::after { content: ""; position: absolute; left: 9px; top: 7px; border-left: 10px solid var(--accent-ink);
  border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
main { overflow: auto; padding: 22px 28px 40px; min-width: 0; }

.btn { background: #2a2724; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 14px; cursor: pointer;
  transition: background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: #34302c; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 650; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: #5a2a2a; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
.input { background: #151413; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; width: 100%; }
.input:focus, .title-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; } .small-gap { gap: 6px; } .wrap { flex-wrap: wrap; } .end { justify-content: flex-end; }
.muted { color: var(--muted); } .tiny { font-size: 12px; } .mt { margin-top: 22px; }

.tabs { display: flex; background: #151413; border-radius: 9px; padding: 3px; }
.tab { flex: 1; background: none; border: 0; padding: 6px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.tab.active { background: #2c2926; color: var(--text); }
.tabpane { display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.list { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.list li { padding: 9px 10px; border-radius: 8px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.list li:hover { background: #24211f; }
.list li.active { background: #2e2a26; box-shadow: inset 3px 0 0 var(--accent); }
.list .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .s { font-size: 12px; color: var(--muted); }
.list .s.err { color: var(--danger); }
.mini-bar { height: 3px; background: #2e2a26; border-radius: 2px; overflow: hidden; }
.mini-bar div { height: 100%; background: var(--accent); }
.side-foot { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 10px; }

.empty { height: 100%; display: grid; place-items: center; }
.drop { max-width: 560px; text-align: center; border: 2px dashed var(--line2); border-radius: 18px; padding: 48px 40px; }
.drop h1 { margin: 0 0 12px; font-size: 26px; }
.drop-overlay { position: fixed; inset: 0; background: rgba(245,165,36,.12); border: 3px dashed var(--accent);
  display: grid; place-items: center; font-size: 26px; font-weight: 700; z-index: 50; pointer-events: none; }

.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.title-input { background: transparent; border: 0; font-size: 24px; font-weight: 750; padding: 2px 4px; margin-left: -4px;
  border-radius: 6px; min-width: 260px; width: 100%; max-width: 640px; }
.chips { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.chip { background: #24211f; border: 1px solid var(--line); border-radius: 99px; padding: 2px 10px; font-size: 12.5px; color: #cfc8bf; }
.chip:empty { display: none; }

.bar { height: 6px; background: #2b2825; border-radius: 4px; overflow: hidden; }
.bar.big { height: 10px; max-width: 520px; margin: 10px 0 14px; }
.bar div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.loading { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--muted); }
.loading .bar { width: 240px; }

.transport { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 12px; flex-wrap: wrap; }
.tbtn { background: #2a2724; border: 1px solid var(--line2); border-radius: 8px; height: 40px; min-width: 44px; cursor: pointer; font-size: 16px; }
.tbtn:hover { background: #34302c; }
.tbtn.play { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); min-width: 58px; font-size: 18px; }
.tbtn.toggle { font-size: 13px; padding: 0 12px; }
.tbtn.toggle.on { border-color: var(--accent); color: var(--accent); background: rgba(245,165,36,.1); }
.time { font-variant-numeric: tabular-nums; margin-left: 8px; color: #cfc8bf; min-width: 96px; }
.now-section { display: flex; flex-direction: column; line-height: 1.15; margin-left: 10px; }
.now-section span { font-size: 20px; font-weight: 750; color: var(--accent); }
.now-section small { color: var(--muted); }
.beat-dots { margin-left: auto; display: flex; gap: 6px; }
.beat-dots i { width: 14px; height: 14px; border-radius: 50%; background: #2e2a26; border: 1px solid var(--line2); }
.beat-dots i.on { background: #e8e6e3; }
.beat-dots i.on.first { background: var(--accent); border-color: var(--accent); }

.timeline { position: relative; height: 120px; margin: 12px 0 16px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; cursor: pointer; }
.timeline canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: 16px; }
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-width: 0; }
.panel h3 { margin: 0 0 10px; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel-head h3 { margin: 0; }

.mixer { display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 6px; }
.strip { width: 78px; flex: 0 0 78px; background: #191715; border: 1px solid var(--line); border-radius: 9px; padding: 8px 6px;
  display: flex; flex-direction: column; align-items: center; gap: 7px; }
.strip .name { font-size: 12px; font-weight: 650; text-align: center; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip .swatch { height: 3px; width: 100%; border-radius: 2px; }
.strip .fader { writing-mode: vertical-lr; direction: rtl; height: 140px; width: 28px; accent-color: var(--accent); }
.strip .val { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip .btns { display: flex; gap: 4px; }
.strip .sb { width: 30px; height: 26px; border-radius: 6px; border: 1px solid var(--line2); background: #2a2724; cursor: pointer;
  font-size: 12px; font-weight: 700; padding: 0; }
.strip .sb.mute.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.strip .sb.solo.on { background: #e8c94a; border-color: #e8c94a; color: #1b1505; }
.strip .route { width: 64px; height: 24px; border-radius: 6px; border: 1px solid var(--line2); background: #232120; cursor: pointer; font-size: 11px; }
.strip .route.inear { color: var(--accent); border-color: rgba(245,165,36,.5); }
.strip .pan { width: 62px; accent-color: #8a837b; }
.strip .meter { width: 6px; height: 140px; background: #121110; border-radius: 3px; position: absolute; overflow: hidden; }
.masters { display: flex; gap: 20px; flex-wrap: wrap; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }
.masters label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.masters input { accent-color: var(--accent); width: 160px; }

.sections { list-style: none; margin: 10px 0; padding: 0; display: flex; flex-direction: column; gap: 5px; max-height: 330px; overflow: auto; }
.sections li { display: grid; grid-template-columns: 10px 54px 1fr auto auto; align-items: center; gap: 8px;
  background: #191715; border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px 4px 8px; }
.sections li.cur { border-color: var(--accent); }
.sections .dot { width: 10px; height: 10px; border-radius: 3px; }
.sections .tm { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.sections input { background: transparent; border: 0; padding: 4px; border-radius: 5px; min-width: 0; }
.sections input:focus { outline: 1px solid var(--accent); }
.sections button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 6px; border-radius: 5px; }
.sections button:hover { color: var(--text); background: #2a2724; }

.out-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.out-grid label, .dlg label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 13px; }

.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); background: #23201e; border: 1px solid var(--line2);
  border-radius: 10px; padding: 6px; z-index: 20; min-width: 290px; box-shadow: 0 12px 30px rgba(0,0,0,.45); }
.menu-list a { display: block; padding: 8px 10px; border-radius: 7px; color: var(--text); text-decoration: none; cursor: pointer; }
.menu-list a:hover { background: #312d29; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 14px; padding: 0; width: min(460px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dlg { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg h2 { margin: 0; }
.filebox { border: 2px dashed var(--line2); border-radius: 10px; padding: 22px; text-align: center; cursor: pointer; color: var(--text) !important; }
.filebox input { display: none; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #2d2a27; border: 1px solid var(--line2);
  padding: 10px 18px; border-radius: 10px; z-index: 60; box-shadow: 0 10px 30px rgba(0,0,0,.5); }

.setlist-songs { margin: 16px 0; padding: 0; list-style: none; counter-reset: n; display: flex; flex-direction: column; gap: 6px; max-width: 720px; }
.setlist-songs li { counter-increment: n; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; }
.setlist-songs li::before { content: counter(n); width: 22px; color: var(--muted); font-variant-numeric: tabular-nums; }
.setlist-songs .t { flex: 1; font-weight: 600; }
.setlist-songs .s { color: var(--muted); font-size: 12px; }
.setlist-songs button { background: none; border: 1px solid transparent; color: var(--muted); cursor: pointer; border-radius: 6px; padding: 3px 8px; }
.setlist-songs button:hover { border-color: var(--line2); color: var(--text); }
#setlistEditor .row select { max-width: 420px; }

.livebar { display: flex; align-items: center; gap: 12px; background: rgba(245,165,36,.08); border: 1px solid rgba(245,165,36,.35);
  border-radius: var(--r); padding: 8px 12px; margin-bottom: 16px; flex-wrap: wrap; }
.live-label { font-weight: 800; color: var(--accent); font-size: 12px; letter-spacing: .1em; }
.live-label span { color: var(--text); letter-spacing: 0; font-weight: 600; margin-left: 6px; }
.live-songs { display: flex; gap: 6px; flex: 1; overflow-x: auto; }
.live-songs button { background: #221f1c; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; white-space: nowrap; }
.live-songs button.cur { border-color: var(--accent); color: var(--accent); }
.check { display: flex; align-items: center; gap: 6px; color: var(--muted); }

/* ---------- v2: ferramentas, linha do tempo por faixa, palco ---------- */
.grow { flex: 1; min-width: 0; }
.mt-s { margin-top: 10px; }
.input.slim { width: auto; padding: 4px 8px; }
.time { display: flex; align-items: baseline; gap: 4px; }
.time small { margin-left: 8px; color: var(--accent); font-weight: 650; font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; background: #151413; border: 1px solid var(--line2); border-radius: 9px; padding: 2px; }
.seg button { background: none; border: 0; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.seg button.on { background: #322e2a; color: var(--text); }
.seg.small button { padding: 4px 10px; font-size: 13px; }

.tools { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.pill { background: #24211f; border: 1px solid var(--line2); border-radius: 99px; padding: 7px 13px; cursor: pointer; font-size: 13px; }
.pill:hover { background: #2e2a27; }
.pill.changed { border-color: var(--accent); color: var(--accent); }
.pill b { font-size: 14px; }
.pop-wrap { position: relative; }
.pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 250px; background: #23201e; border: 1px solid var(--line2);
  border-radius: 12px; padding: 14px; box-shadow: 0 14px 34px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 10px; }
.pop h4 { margin: 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.pop-big { font-size: 40px; font-weight: 800; text-align: center; line-height: 1; }
.pop-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: -4px; }
.stepper { display: flex; align-items: center; justify-content: space-between; background: #171514; border: 1px solid var(--line2); border-radius: 9px; }
.stepper button { background: none; border: 0; width: 42px; height: 36px; font-size: 18px; cursor: pointer; color: var(--text); }
.stepper button:hover { background: #2a2724; }
.stepper span { font-weight: 650; font-variant-numeric: tabular-nums; }
.lbl { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 13px; }
.render-state { margin: 8px 0 0; color: var(--accent); font-size: 13px; }
.menu-note { color: var(--muted); font-size: 12px; padding: 4px 10px 8px; }
.menu-note:empty { display: none; }

.timeline { height: 64px; }
.arr { display: grid; grid-template-columns: 236px 1fr; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.arr-heads { border-right: 1px solid var(--line); background: #1b1917; }
.arr-heads .hh { display: flex; align-items: center; padding: 0 10px; font-size: 11.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .08em; border-bottom: 1px solid var(--line); }
.th { display: grid; grid-template-columns: 4px 1fr; border-bottom: 1px solid var(--line); }
.th .sw { height: 100%; }
.th .in { padding: 5px 8px 4px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.th .r1, .th .r2 { display: flex; align-items: center; gap: 5px; }
.th .nm { font-weight: 650; font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th .sb { width: 24px; height: 22px; border-radius: 5px; border: 1px solid var(--line2); background: #2a2724; cursor: pointer;
  font-size: 11px; font-weight: 700; padding: 0; }
.th .sb.mute.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.th .sb.solo.on { background: #e8c94a; border-color: #e8c94a; color: #1b1505; }
.th .route { height: 22px; border-radius: 5px; border: 1px solid var(--line2); background: #232120; cursor: pointer; font-size: 10.5px; padding: 0 6px; }
.th .route.inear { color: var(--accent); border-color: rgba(245,165,36,.5); }
.th input[type=range] { accent-color: var(--accent); min-width: 0; }
.th .vol { flex: 1; }
.th .pan { width: 52px; accent-color: #8a837b; }
.th .db { font-size: 10.5px; color: var(--muted); width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.th.muted .nm { color: var(--muted); }
.arr-lanes { position: relative; min-width: 0; cursor: pointer; }
.arr-lanes canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.zoom-row { display: flex; align-items: center; gap: 8px; margin: 8px 0 16px; flex-wrap: wrap; }

.stage { display: grid; grid-template-columns: 1.4fr 1fr 1fr; grid-template-rows: auto auto; gap: 14px; margin: 14px 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.card small { color: var(--muted); letter-spacing: .12em; font-size: 12px; font-weight: 650; }
.card .huge { font-size: clamp(48px, 7vw, 104px); font-weight: 850; line-height: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .big { font-size: clamp(30px, 4vw, 56px); font-weight: 800; line-height: 1.05; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card.now { grid-row: span 2; justify-content: center; }
.card.now .huge { color: var(--accent); }
.card.chord .huge { color: #fff; }
.card.mini { justify-content: center; align-items: center; text-align: center; }
.card.mini.accent { background: rgba(245,165,36,.08); border-color: rgba(245,165,36,.35); }
.card.mini.accent .big { color: var(--accent); }
.st-bar { font-size: 22px; color: #cfc8bf; }
.st-in { font-size: 18px; color: #cfc8bf; }
.beat-dots.big { margin: 8px 0 0; }
.beat-dots.big i { width: 22px; height: 22px; }
.sec-progress { height: 6px; background: #2b2825; border-radius: 4px; overflow: hidden; margin-top: 10px; }
.sec-progress div { height: 100%; width: 0; background: var(--accent); }
#stTimeline { height: 90px; }
@media (max-width: 1000px) { .stage { grid-template-columns: 1fr 1fr; } .card.now { grid-column: span 2; grid-row: auto; } }

.card.next .big { white-space: normal; font-size: clamp(26px, 3.2vw, 46px); overflow-wrap: anywhere; }

/* ---------- v3: compartilhar, convidado, celular ---------- */
body.guest .owner-only { display: none !important; }
.mobile-bar { display: none; }
.guest-title { font-weight: 700; font-size: 15px; }
.list.plain li { cursor: pointer; }
.warn { color: #f0b35a; }
.linkbox .input { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.wide-dlg { width: min(640px, 94vw); }
dialog:has(.wide-dlg) { width: min(680px, 96vw); }
.net { display: flex; flex-direction: column; gap: 6px; background: #191715; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.net .ok { color: var(--ok); } .net .no { color: #f0b35a; }
.net code { background: #24211f; padding: 1px 6px; border-radius: 5px; font-size: 12px; }
.pair { display: grid; grid-template-columns: 180px 1fr; gap: 16px; align-items: start; }
.pair img { width: 180px; height: 180px; background: #fff; border-radius: 10px; padding: 6px; }
.share-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; }
.share-list li { display: flex; align-items: center; gap: 8px; background: #191715; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.share-list .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { font-size: 11px; color: var(--ok); margin-left: 6px; }

@media (max-width: 760px) {
  body { overflow-x: hidden; }
  .mobile-bar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 40; background: var(--bg2);
    border-bottom: 1px solid var(--line); padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .brand.small { font-size: 16px; } .brand.small .logo { width: 20px; height: 20px; border-radius: 6px; }
  .brand.small .logo::after { left: 7px; top: 5px; border-left-width: 8px; border-top-width: 5px; border-bottom-width: 5px; }
  #mobileTitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
  #app { display: block; height: auto; }
  .side { position: fixed; inset: 0 25% 0 0; z-index: 50; transform: translateX(-102%); transition: transform .2s; box-shadow: 10px 0 30px rgba(0,0,0,.5);
    padding-top: max(16px, env(safe-area-inset-top)); }
  .side.open { transform: none; }
  main { padding: 12px 12px 90px; overflow: visible; }
  .head-row { gap: 10px; }
  .title-input { font-size: 19px; min-width: 0; }
  .transport { gap: 6px; padding: 8px; position: sticky; top: 49px; z-index: 30; }
  .tbtn { height: 44px; min-width: 46px; }
  .tbtn.toggle { font-size: 12px; }
  .time { min-width: 0; margin-left: 2px; }
  .now-section span { font-size: 17px; }
  .beat-dots { display: none; }
  .tools { width: 100%; margin-left: 0; }
  .pop { right: auto; left: 0; }
  .timeline { height: 54px; }
  .arr { grid-template-columns: 1fr; }
  .arr-lanes, .zoom-row { display: none; }
  .arr-heads .hh { display: none; }
  .th { height: auto !important; }
  .th .in { padding: 8px 10px; }
  .th .sb { width: 34px; height: 30px; font-size: 13px; }
  .th .route { height: 30px; }
  .grid { grid-template-columns: 1fr; }
  .out-grid { grid-template-columns: 1fr; }
  .stage { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 14px; border-radius: 12px; }
  .card.now { grid-column: span 2; grid-row: auto; }
  .card.chord { grid-column: span 2; }
  .card .huge { font-size: 54px; }
  .pair { grid-template-columns: 1fr; }
  .livebar { gap: 8px; }
}
@media (max-width: 760px) {
  .head-row { flex-direction: column; align-items: stretch; }
  .head-row > .row { flex-wrap: wrap; }
  .head-row > .row .btn { flex: 1 1 auto; }
  .chips { flex-wrap: wrap; }
  .title-input { max-width: none; }
}
