:root {
  --bg: #f5f3ee; --surface: #ffffff; --surface-2: #ece9e1; --text: #1d1d1f; --muted: #6b6a66;
  --line: #d9d5cb; --accent: #d9601c; --accent-text: #ffffff; --now: #fff1e6; --danger: #b3261e;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161c; --surface: #1d2028; --surface-2: #272b35; --text: #eeeae2; --muted: #9a978f;
    --line: #333845; --accent: #ff8a3d; --accent-text: #1a1206; --now: #3a2a1d; --danger: #ff7b72;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.wrap { max-width: 760px; margin: 0 auto; padding: 16px; }

/* ---- cabeçalho ---- */
.topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; max-width: 760px; margin: 0 auto; }
.topbar h1 { font-size: 1.05rem; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin: 8px 0 4px; }
.brand span { color: var(--accent); }
.sub { color: var(--muted); margin: 0 0 18px; }
.icon-btn {
  border: 0; background: var(--surface-2); border-radius: 999px; width: 40px; height: 40px;
  display: inline-grid; place-items: center; flex: none; font-size: 1.1rem;
}

/* ---- cartões e formulários ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 0.95rem; margin: 0 0 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > input { flex: 1 1 200px; min-width: 0; }
input[type=text], input[type=url], input[type=password] {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%;
}
.btn {
  border: 0; border-radius: 10px; padding: 12px 18px; background: var(--accent); color: var(--accent-text);
  font-weight: 700;
}
.btn.secondary { background: var(--surface-2); color: var(--text); font-weight: 600; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn:disabled { opacity: 0.5; }
.senha-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; }
.senha-row input[type=password], .senha-row input[type=text] { flex: 1 1 180px; width: auto; }
.senha-row .hint { flex-basis: 100%; }
.or { text-align: center; color: var(--muted); margin: 10px 0; font-size: 0.9rem; }
.file-btn { display: block; text-align: center; }
.error { color: var(--danger); margin-top: 8px; }
.hint { color: var(--muted); font-size: 0.9rem; }

/* ---- listas de músicas ---- */
.songs { list-style: none; margin: 0; padding: 0; }
.songs li a {
  display: flex; gap: 12px; align-items: center; padding: 10px 4px; text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.songs li:last-child a { border-bottom: 0; }
.thumb { width: 56px; height: 42px; border-radius: 8px; background: var(--surface-2) center/cover; flex: none; display: grid; place-items: center; color: var(--muted); }
.songs .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.songs .m { color: var(--muted); font-size: 0.85rem; }
.songs .info { min-width: 0; flex: 1; }
.empty { color: var(--muted); font-size: 0.95rem; }

/* ---- processamento ---- */
.status { text-align: center; padding: 40px 16px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid var(--surface-2); border-top-color: var(--accent); margin: 0 auto 16px; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- tela da música ---- */
.now {
  display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
}
.now .cur-name { font-size: clamp(2.6rem, 13vw, 4rem); font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.now .label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
.now .next { display: flex; flex-direction: column; align-items: flex-end; color: var(--muted); }
.now .next b { color: var(--text); font-size: 1.6rem; }

.shapes {
  display: flex; align-items: flex-end; justify-content: center; gap: 12px; margin-top: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 8px 8px;
}
.shape { margin: 0; text-align: center; min-width: 0; }
.shape .diagram { max-width: 100%; height: auto; margin: 0 auto; }
.shape figcaption { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.shape.cur figcaption { color: var(--text); font-weight: 700; }
.shape.cur { flex: 0 1 184px; }
.shape.nxt { flex: 0 1 115px; opacity: 0.6; }
.no-chord { height: 224px; display: grid; place-items: center; color: var(--muted); width: 184px; max-width: 100%; }

.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgb(0 0 0 / 0.18);
}
.dock .label { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
.dock-cur { min-width: 0; flex: 0 1 auto; }
.dock-cur b { display: block; font-size: 2.2rem; line-height: 1.05; font-weight: 800; white-space: nowrap; }
.dock-next { text-align: center; opacity: 0.65; flex: none; }
.dock-next b { display: block; font-size: 1rem; }
.dock .play { width: 52px; height: 52px; }
body.has-dock { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
.player { margin: 14px 0; }
.player .controls { display: flex; align-items: center; gap: 12px; }
.play {
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-text);
  font-size: 1.4rem; flex: none; display: grid; place-items: center;
}
.seek { flex: 1; min-width: 0; }
.seek input { width: 100%; accent-color: var(--accent); }
.times { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

.tools { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-bottom: 14px; }
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; text-align: center; min-width: 0; }
.tool .label { color: var(--muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 2px; margin-top: 4px; }
.stepper button { border: 0; background: var(--surface-2); border-radius: 8px; width: 32px; height: 34px; font-size: 1.1rem; flex: none; padding: 0; }
.stepper b { font-variant-numeric: tabular-nums; font-size: 0.9rem; white-space: nowrap; min-width: 0; overflow: hidden; }

.meta-line { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 0.9rem; margin: 0 0 12px; }
.meta-line b { color: var(--text); }

.sheet-row { margin-bottom: 14px; }
.sheet-row .bars { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 6px; }
.bar-col { min-width: 0; }
.row-chords { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.rc {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 2px 0;
  text-align: center; flex: 0 0 auto;
}
.rc b { display: block; font-size: 0.85rem; }
.rc.on { border-color: var(--accent); background: var(--now); }
.rc.on b { color: var(--accent); }
.bar {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px;
  min-height: 52px; display: flex; flex-wrap: wrap; gap: 0 6px; align-items: center; cursor: pointer;
  position: relative; min-width: 0; padding-top: 16px;
}
.bar .n { position: absolute; top: 2px; left: 6px; font-size: 0.6rem; color: var(--muted); }
.bar .slot {
  font-weight: 700; font-size: 0.95rem; white-space: nowrap; border-radius: 6px; text-align: left; min-height: 1.3em;
}
.bar .slot.long { font-size: 0.78rem; }
.bar .slot.rep { color: var(--muted); font-weight: 500; }
.bar.cur { background: var(--now); border-color: var(--accent); }
.bar .slot.on { color: var(--accent); }
@media (max-width: 520px) {
  .tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.chord-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chord-list .cl { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px 4px 2px; text-align: center; }
.chord-list .cl b { display: block; }

.section-title { font-size: 0.95rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin: 22px 0 10px; display: flex; justify-content: space-between; align-items: center; }
.toggle { font-size: 0.85rem; text-transform: none; letter-spacing: 0; display: flex; gap: 6px; align-items: center; font-weight: 500; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 14px; }
.actions .btn { flex: 1 1 auto; }
.share-box { margin-bottom: 14px; }
.share-box input { font-size: 0.9rem; }

/* ---- diagramas ---- */
.diagram { display: block; }
.dg-fret { stroke: var(--muted); stroke-width: 1; }
.dg-nut { stroke: var(--text); stroke-width: 4; }
.dg-string { stroke: var(--muted); stroke-width: 1; }
.dg-dot { fill: var(--text); }
.dg-open { fill: none; stroke: var(--text); stroke-width: 1.4; }
.dg-mark { fill: var(--muted); font-size: 11px; }
.dg-base { fill: var(--muted); font-size: 10px; }
.dg-none { fill: var(--muted); font-size: 10px; }

#toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 0.9rem; z-index: 10;
  max-width: calc(100% - 32px);
}

/* ---- contas ---- */
.wrap.narrow { max-width: 440px; padding-top: 32px; }
.brand.big { font-size: 2.2rem; }
.userbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.userbar .brand { margin: 0; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.9rem; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-btn { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 4px 0; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 10px; padding: 3px; margin-bottom: 14px; }
.tab { border: 0; background: none; border-radius: 8px; padding: 9px; font-weight: 600; color: var(--muted); }
.tab.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.15); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack > label:not(.toggle) { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
.stack input[type=email], .stack input[type=password], .stack input[type=text] {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; color: var(--text); font-size: 1rem;
}

/* ---- playlists ---- */
.list-gap { margin-top: 10px; }
.thumb.pl { font-size: 1.2rem; }
.pl-item { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.pl-item:last-child { border-bottom: 0; }
.pl-item .song-link { flex: 1; min-width: 0; border-bottom: 0 !important; }
.pl-item .pos { color: var(--muted); font-size: 0.85rem; width: 1.4em; text-align: right; flex: none; }
.pl-actions { display: flex; gap: 4px; flex: none; }
.icon-btn.sm { width: 34px; height: 34px; font-size: 0.95rem; }
.icon-btn:disabled { opacity: 0.35; }
.pl-songs { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 10px; margin-bottom: 14px; }
.checks { display: flex; flex-direction: column; gap: 4px; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.pl-nav {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; font-size: 0.85rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 10px;
}
.pl-nav a { text-decoration: none; color: var(--accent); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-nav .pl-next { text-align: right; }
.pl-nav .pl-name { color: var(--muted); white-space: nowrap; }

/* ---- assinatura ---- */
:root { --ok: #1f7a3d; --ok-bg: #e6f4ea; --warn: #8a5a00; --warn-bg: #fff4d6; --bad-bg: #fde8e7; }
@media (prefers-color-scheme: dark) {
  :root { --ok: #6fd28f; --ok-bg: #16301f; --warn: #ffcf66; --warn-bg: #352a10; --bad-bg: #3a1c1b; }
}
.trial-bar {
  display: block; text-decoration: none; background: var(--warn-bg); color: var(--warn); border-radius: 10px;
  padding: 10px 12px; margin: -4px 0 14px; font-size: 0.92rem;
}
.test-banner {
  background: var(--warn-bg); color: var(--warn); border: 1px dashed currentColor; border-radius: 10px;
  padding: 8px 10px; font-size: 0.9rem; margin-bottom: 12px;
}
.plan-box { display: flex; flex-direction: column; gap: 2px; background: var(--now); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; }
.plan-box span { color: var(--muted); font-size: 0.9rem; }
.code-input { font-size: 1.8rem !important; letter-spacing: 0.4em; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.plan-status { display: flex; flex-direction: column; gap: 4px; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.plan-status b { font-size: 1.1rem; }
.plan-status.ok { background: var(--ok-bg); color: var(--ok); }
.plan-status.warn { background: var(--warn-bg); color: var(--warn); }
.plan-status.bad { background: var(--bad-bg); color: var(--danger); }
.plan-status span { color: var(--text); }
.pix-card .qr { display: grid; place-items: center; margin: 4px 0 14px; }
.pix-card .qr svg { width: min(260px, 100%); height: auto; border-radius: 8px; background: #fff; }
.pix-card .row input { font-size: 0.8rem; }
.waiting { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; flex: none; }
@keyframes pulse { 50% { opacity: 0.25; } }
.inv-list { list-style: none; margin: 0; padding: 0; }
.inv-list li { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.inv-list li:last-child { border-bottom: 0; }
.inv { font-weight: 600; }
.inv.paga { color: var(--ok); }
.inv.pendente { color: var(--warn); }
.inv.expirada, .inv.cancelada { color: var(--muted); }

/* ---- admin ---- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; }
table.adm { border-collapse: collapse; width: 100%; font-size: 0.85rem; }
table.adm th, table.adm td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.adm th { color: var(--muted); font-weight: 600; }
table.adm .sub-row td { border-bottom: 1px solid var(--line); padding-top: 0; color: var(--muted); }
.btn.sm { padding: 6px 10px; font-size: 0.85rem; }
.wrap-code { word-break: break-all; font-size: 0.8rem; }
.who { flex-wrap: wrap; justify-content: flex-end; }
.link-btn { text-decoration: none; }
