/* Tracktonica Library — camada de interface: shell.
 * Moldura comum a todas as telas: barra lateral, barra de busca, player, modais, toasts, login.
 * Carregado depois de assets/ui.css. Usa somente as variáveis do tema. */

:root {
  --sh-side: 260px;
  --sh-top: 64px;
  --sh-gutter: 40px;
  --sh-side-bg: color-mix(in srgb, var(--bg) 62%, #000000);
  --sh-side-hover: var(--panel);
  --sh-side-active: var(--panel-2);
  --sh-play-bg: #ffffff;
  --sh-play-fg: #031116;
  --sh-ease: cubic-bezier(.2, .7, .2, 1);
}

:root[data-theme-mode="light"] {
  --sh-side-bg: color-mix(in srgb, var(--bg) 94%, var(--text) 6%);
  --sh-side-hover: color-mix(in srgb, var(--bg) 86%, var(--text) 8%);
  --sh-side-active: var(--panel);
  --sh-play-bg: var(--text);
  --sh-play-fg: var(--panel);
}

/* ---------- Utilitários ---------- */

.sh-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sh-skip {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 3000;
  padding: 10px 14px;
  border-radius: var(--r-ctl);
  background: var(--button-primary, var(--accent));
  color: var(--on-accent, #fff);
  font-weight: 600;
  text-decoration: none;
}

.sh-skip:focus { top: 12px; }

/* ---------- Estrutura da página ---------- */

body.has-shell {
  padding-left: var(--sh-side);
  background: var(--bg);
  background-image: none;
}

body.has-shell .container {
  box-sizing: border-box;
  width: auto;
  max-width: 1640px;
  margin: 0 auto;
  padding: 28px var(--sh-gutter) 72px;
  animation: none;
}

body.has-shell.has-player .container { padding-bottom: 136px; }

body.is-guest {
  background: var(--bg);
  background-image: none;
}

body.is-guest .container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: block;
  animation: none;
}

/* ---------- Barra lateral ---------- */

.sh-side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1100;
  width: var(--sh-side);
  display: flex;
  flex-direction: column;
  background: var(--sh-side-bg);
  border-right: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  color: var(--text);
}

.sh-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: var(--sh-top);
  padding: 0 16px 0 20px;
}

.sh-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--r-sm);
}

.sh-brand-logo {
  display: block;
  height: auto;
  max-height: 30px;
  max-width: 100%;
  width: auto;
}

.sh-brand-title {
  display: flex;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.15;
  color: var(--text);
}

.sh-brand-title.stacked { flex-direction: column; gap: 0; }
.sh-brand-title.has-logo { font-size: 0.82rem; color: var(--muted); }
.sh-brand-title .brand-line { font-weight: 400; }
.sh-brand-title .brand-line.is-bold { font-weight: 600; }

.sh-side-close { display: none; }

.sh-side-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 12px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.sh-nav {
  display: grid;
  gap: 2px;
}

.sh-nav-item,
.sh-pl-item,
.sh-foot-btn,
.sh-pop-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-ctl);
  color: var(--muted);
  font-size: 0.93rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  transition: background-color .14s ease, color .14s ease;
}

.sh-nav-item .ui-icon { width: 20px; height: 20px; color: var(--muted); }

.sh-nav-item:hover,
.sh-pl-item:hover {
  background: var(--sh-side-hover);
  color: var(--text);
  text-decoration: none;
}

.sh-nav-item:hover .ui-icon { color: var(--text); }

.sh-nav-item.is-current {
  background: var(--sh-side-active);
  color: var(--text);
  font-weight: 600;
}

.sh-nav-item.is-current .ui-icon { color: var(--accent-ink, var(--accent)); }

.sh-side-section {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.sh-side-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 6px 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.sh-pl-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
}

.sh-pl-item {
  min-height: 34px;
  font-weight: 400;
  font-size: 0.9rem;
}

.sh-pl-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sh-pl-item.is-current {
  background: var(--sh-side-active);
  color: var(--text);
  font-weight: 500;
}

.sh-side-more {
  display: inline-block;
  margin: 6px 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

.sh-side-more:hover { color: var(--text); text-decoration: underline; }

.sh-side-empty {
  margin: 4px 12px 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.sh-side-empty a { color: var(--text); }

.sh-side-foot {
  display: grid;
  gap: 4px;
  padding: 10px 12px 14px;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.sh-foot-btn {
  width: 100%;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.sh-foot-btn > span { flex: 1 1 auto; }
.sh-foot-btn .ui-icon { width: 20px; height: 20px; }
.sh-foot-btn:hover { background: var(--sh-side-hover); color: var(--text); }
.sh-foot-btn.is-current { color: var(--text); }
.sh-foot-btn.is-current > .ui-icon:first-child { color: var(--accent-ink, var(--accent)); }

.sh-caret { width: 16px !important; height: 16px !important; color: var(--muted); }

.sh-user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.sh-user-btn:hover,
.sh-pop-wrap.is-open > .sh-user-btn,
.sh-pop-wrap.is-open > .sh-foot-btn { background: var(--sh-side-hover); color: var(--text); }

.sh-avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink, var(--accent));
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.sh-user-text {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.25;
}

.sh-user-text strong,
.sh-user-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sh-user-text strong { font-size: 0.9rem; font-weight: 600; }
.sh-user-text small { color: var(--muted); font-size: 0.8rem; }

/* ---------- Popovers (menus) ---------- */

.sh-pop-wrap { position: relative; }

.sh-pop {
  position: absolute;
  z-index: 1300;
  min-width: 236px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--panel);
  box-shadow: var(--shadow-pop);
}

.sh-pop[hidden] { display: none; }

.sh-pop-up {
  left: 0;
  right: 0;
  bottom: calc(100% + 6px);
}

.sh-pop-item {
  width: 100%;
  min-height: 38px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}

.sh-pop-item .ui-icon { color: var(--muted); }
.sh-pop-item:hover,
.sh-pop-item:focus-visible { background: var(--panel-2); color: var(--text); text-decoration: none; }
.sh-pop-item.is-current { background: var(--accent-soft); }
.sh-pop-item.is-current .ui-icon { color: var(--accent-ink, var(--accent)); }

.sh-pop-head {
  display: grid;
  gap: 2px;
  padding: 10px 12px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.sh-pop-head strong { font-size: 0.92rem; }
.sh-pop-head small { color: var(--muted); font-size: 0.8rem; line-height: 1.35; }

.sh-pop-sep { height: 1px; margin: 4px 6px; background: var(--line); }

.sh-pop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 0 6px 0 12px;
  color: var(--text);
  font-size: 0.9rem;
}

.sh-pop-row-label { display: inline-flex; align-items: center; gap: 12px; }
.sh-pop-row-label .ui-icon { color: var(--muted); }

.sh-seg {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.sh-seg a {
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
}

.sh-seg a:hover { color: var(--text); }
.sh-seg a.is-current { background: var(--accent-soft); color: var(--text); }

/* ---------- Barra superior (busca) ---------- */

.sh-top {
  position: sticky;
  top: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--sh-top);
  padding: 0 var(--sh-gutter);
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.sh-menu-btn { display: none; }

.sh-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 720px;
  min-width: 0;
}

.sh-search-form {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
}

.sh-search-icon {
  position: absolute;
  left: 14px;
  display: inline-flex;
  color: var(--muted);
  pointer-events: none;
}

.sh-search-form input[name="q"] {
  width: 100%;
  height: 42px;
  min-height: 42px;
  padding: 0 44px 0 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.95rem;
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
}

.sh-search-form input[name="q"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.sh-search-form input[name="q"]:hover { border-color: var(--line-strong); }

.sh-search-form input[name="q"]:focus {
  border-color: var(--accent-ink, var(--accent));
  box-shadow: var(--focus-ring);
  background: var(--panel);
}

.sh-search-kbd {
  position: absolute;
  right: 12px;
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  font: 500 0.75rem/1 var(--font-body);
  pointer-events: none;
}

.sh-search-form input[name="q"]:focus ~ .sh-search-kbd { display: none; }

/* Sugestões da busca */
.sh-suggest {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 1200;
  display: grid;
  gap: 4px;
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--panel);
  box-shadow: var(--shadow-pop);
}

.sh-suggest[hidden] { display: none; }

.sh-suggest .nav-suggestion-group { display: grid; gap: 2px; padding: 4px 0; }

.sh-suggest .nav-suggestion-group > strong {
  padding: 4px 10px 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.sh-suggest .nav-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--text);
  text-decoration: none;
}

.sh-suggest .nav-suggestion-item:hover,
.sh-suggest .nav-suggestion-item:focus-visible { background: var(--panel-2); }

.sh-suggest .nav-suggestion-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--muted);
}

.sh-suggest .nav-suggestion-text { display: grid; min-width: 0; line-height: 1.3; }

.sh-suggest .nav-suggestion-text > span,
.sh-suggest .nav-suggestion-text > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sh-suggest .nav-suggestion-text > span { font-weight: 500; font-size: 0.92rem; }
.sh-suggest .nav-suggestion-text > small { color: var(--muted); font-size: 0.8rem; }

.sh-suggest .nav-suggestion-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 6px 4px; }

.sh-suggest .nav-suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font-size: 0.85rem;
  text-decoration: none;
}

.sh-suggest .nav-suggestion-chip small { color: var(--muted); font-variant-numeric: tabular-nums; }
.sh-suggest .nav-suggestion-chip:hover { border-color: var(--accent-line); background: var(--accent-soft); }

/* Botões genéricos da moldura */
.sh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
}

.sh-btn:hover { text-decoration: none; }

.sh-btn-primary,
a.sh-btn-primary {
  background: var(--button-primary, var(--accent));
  border-color: var(--button-primary, var(--accent));
  color: var(--on-accent, #fff);
}

.sh-btn-primary:hover { background: var(--button-primary-hover, var(--accent-lo)); border-color: var(--button-primary-hover, var(--accent-lo)); color: var(--on-accent, #fff); }

.sh-btn.ghost,
a.sh-btn.ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
}

.sh-btn.ghost:hover { background: var(--panel); border-color: var(--line-strong); color: var(--text); }

.sh-audio-btn,
button.sh-audio-btn {
  flex: none;
  height: 42px;
  min-height: 42px;
  border-radius: 999px;
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--text);
  box-shadow: none;
}

.sh-audio-btn .ui-icon { color: var(--accent-ink, var(--accent)); }

.sh-audio-btn:hover,
button.sh-audio-btn:hover {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
  border-color: var(--accent-ink, var(--accent));
  color: var(--text);
}

.sh-icon-btn,
button.sh-icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  cursor: pointer;
}

.sh-icon-btn:hover,
button.sh-icon-btn:hover { background: var(--panel-2); color: var(--text); }

.sh-icon-btn-sm,
a.sh-icon-btn-sm { width: 28px; height: 28px; min-height: 28px; }
.sh-icon-btn-sm .ui-icon { width: 16px; height: 16px; }

/* Foco visível em toda a moldura */
.sh-side a:focus-visible,
.sh-side button:focus-visible,
.sh-top button:focus-visible,
.sh-player a:focus-visible,
.sh-player button:focus-visible,
.sh-player-handle:focus-visible,
.sh-pop a:focus-visible,
.sh-pop button:focus-visible {
  outline: 2px solid var(--accent-ink, var(--accent));
  outline-offset: 2px;
}

.sh-scrim[hidden] { display: none; }

/* ---------- Player ---------- */

.sh-player {
  position: fixed;
  left: var(--sh-side);
  right: 0;
  bottom: 0;
  z-index: 1050;
  padding: 10px 20px 10px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  color: var(--text);
  transition: transform .2s var(--sh-ease), visibility 0s linear 0s;
}

.sh-player.is-hidden {
  transform: translateY(105%);
  visibility: hidden;
  pointer-events: none;
  transition: transform .18s ease, visibility 0s linear .18s;
}

.sh-player-grid {
  display: grid;
  grid-template-columns: minmax(200px, 300px) minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 60px;
}

.sh-player-track {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.sh-player-cover {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--muted);
}

.sh-player-cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sh-player-cover-img.is-missing,
.sh-player-cover-img:not([src]) { display: none; }
.sh-player-cover-ph { width: 22px; height: 22px; }

.sh-player-meta {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.sh-player-meta strong,
.sh-player-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sh-player-meta strong { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.sh-player-meta span { font-size: 0.84rem; color: var(--muted); }

.sh-player-center {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.sh-player-transport {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.sh-pbtn,
button.sh-pbtn,
a.sh-pbtn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .14s ease, color .14s ease;
}

.sh-pbtn .ui-icon { width: 20px; height: 20px; }

.sh-pbtn:hover,
button.sh-pbtn:hover,
a.sh-pbtn:hover { background: var(--panel-2); color: var(--text); }

.sh-pbtn.is-disabled { opacity: .4; pointer-events: none; }

.sh-pbtn-play,
button.sh-pbtn-play {
  width: 42px;
  height: 42px;
  min-height: 42px;
  margin: 0 2px;
  background: var(--sh-play-bg);
  color: var(--sh-play-fg);
}

.sh-pbtn-play .ui-icon { width: 18px; height: 18px; }
.sh-pbtn-play .ui-icon-play { transform: translateX(1px); }

.sh-pbtn-play:hover,
button.sh-pbtn-play:hover {
  background: var(--sh-play-bg);
  color: var(--sh-play-fg);
  transform: scale(1.04);
}

#playerFav.is-active { color: var(--accent-ink, var(--accent)); }
#playerFav.is-active .ui-icon { fill: currentColor; }

.sh-player-wave {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
}

.sh-player-time {
  flex: none;
  min-width: 40px;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.sh-waveform {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  cursor: pointer;
}

.sh-waveform > div { width: 100%; min-width: 100%; }

.sh-player-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.sh-player-sep {
  width: 1px;
  height: 22px;
  margin: 0 6px;
  background: var(--line);
}

/* ---------- Toasts ---------- */

.sh-toasts,
.toast-stack {
  position: fixed;
  top: calc(var(--sh-top) + 12px);
  right: 24px;
  z-index: 2500;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.sh-toasts .toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  max-width: none;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--panel-2);
  box-shadow: var(--shadow-pop);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.4;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .16s ease, transform .16s ease;
}

.sh-toasts .toast.toast-show { opacity: 1; transform: translateY(0); }

.toast-icon {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink, var(--accent));
}

.toast-icon .ui-icon { width: 14px; height: 14px; stroke-width: 2.2; }
.toast-success .toast-icon { background: var(--accent-soft); color: var(--accent-ink, var(--accent)); }
.toast-error .toast-icon,
.toast-warning .toast-icon { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.toast-info .toast-icon { background: var(--surface-3); color: var(--text); }
.toast-text { padding-top: 1px; }

/* Flash antes de virar toast (sem JS) */
body.has-shell > .flash {
  margin: 16px var(--sh-gutter) 0;
  width: auto;
}

/* ---------- Modais ---------- */

dialog.playlist-modal {
  padding: 0;
  margin: auto;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 48px);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  backdrop-filter: none;
  overflow: auto;
}

dialog.playlist-modal::backdrop {
  background: color-mix(in srgb, var(--bg) 40%, rgba(0, 0, 0, 0.62));
  backdrop-filter: none;
}

dialog.playlist-modal .playlist-modal-inner {
  box-sizing: border-box;
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.sh-modal-inner { width: min(480px, calc(100vw - 32px)); }
.similarity-upload-modal.sh-modal-inner { width: min(560px, calc(100vw - 32px)); }
.player-info-modal.sh-modal-inner { width: min(640px, calc(100vw - 32px)); }

dialog.playlist-modal h3 {
  margin: 0;
  padding-right: 44px;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 500;
}

.sh-modal-lead { margin: -6px 0 0; font-size: 0.92rem; line-height: 1.5; }

dialog.playlist-modal .playlist-modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

dialog.playlist-modal .modal-close-x,
.modal-close-x {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  box-shadow: none;
}

.modal-close-x:hover { background: var(--panel-2); color: var(--text); }

.sh-field {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
}

.sh-field input,
.sh-field select {
  width: 100%;
  box-sizing: border-box;
  height: 42px;
  font-weight: 400;
}

.sh-field-hint { color: var(--muted); font-weight: 400; }

.sh-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.9rem;
}

.sh-modal-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 6px 0 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.sh-modal-divider::before,
.sh-modal-divider::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--line);
}

/* Detalhes da faixa */
.sh-info-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.sh-info-cover {
  width: 160px;
  height: 160px;
  border-radius: var(--r-ctl);
  object-fit: cover;
  background: var(--panel-2);
}

.sh-info-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
  font-size: 0.9rem;
}

.sh-info-list dt { color: var(--muted); font-weight: 400; }
.sh-info-list dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.sh-info-mono { font-size: 0.82rem; color: var(--muted) !important; }
.sh-info-badges { display: flex; flex-wrap: wrap; gap: 4px; }

.sh-info-badges .badge {
  padding: 2px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.78rem;
}

/* Busca por áudio */
.sh-dropzone,
.dropzone-audio.sh-dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 200px;
  padding: 24px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-card);
  background: color-mix(in srgb, var(--bg) 50%, var(--panel));
  text-align: center;
  cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease;
}

.sh-dropzone:hover,
.sh-dropzone.is-dragover { border-color: var(--accent-ink, var(--accent)); background: var(--accent-soft); }

.sh-dropzone.has-file { border-style: solid; border-color: var(--accent-line); background: var(--accent-soft); }

.sh-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.sh-dropzone .dropzone-audio-inner { display: grid; justify-items: center; gap: 6px; pointer-events: none; }

.sh-dropzone-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink, var(--accent));
}

.sh-dropzone-icon .ui-icon { width: 22px; height: 22px; }
.sh-dropzone .dropzone-audio-inner strong { font-size: 1rem; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.sh-dropzone .dropzone-audio-inner small { color: var(--muted); font-size: 0.85rem; }

/* Espera da busca por áudio */
.sim-wait-overlay {
  background: color-mix(in srgb, var(--bg) 40%, rgba(0, 0, 0, 0.62));
  backdrop-filter: none;
  z-index: 2400;
}

.sim-wait-overlay .sim-wait-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: min(420px, calc(100vw - 32px));
  padding: 28px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.sim-wait-panel h3 { margin: 4px 0 0; font-family: var(--font-display); font-weight: 500; font-size: 1.2rem; }
.sim-wait-panel p { margin: 0; }
.sim-wait-panel .sim-wait-progress { width: 100%; height: 6px; margin-top: 6px; }

/* Créditos */
.credits-modal .credits-grid { grid-template-columns: max-content minmax(0, 1fr); }
.credits-modal .credits-grid a { color: var(--text); }

/* ---------- Páginas da moldura (senha, aparência, mensagens) ---------- */

.sh-page { display: grid; gap: 28px; }
.sh-page-narrow { max-width: 520px; }

.sh-page-head { display: grid; gap: 8px; }

.sh-page-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 2.6vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.02em;
}

.sh-page-head p { margin: 0; max-width: 62ch; line-height: 1.55; }

.sh-form { display: grid; gap: 18px; }

.sh-field-note {
  display: flex;
  gap: 8px;
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.sh-field-note .ui-icon { width: 16px; height: 16px; margin-top: 2px; }

.sh-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.sh-form-actions button { height: 40px; min-height: 40px; padding: 0 18px; }

.sh-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.45;
}

.sh-alert .ui-icon { margin-top: 1px; color: var(--muted); }

.sh-alert-error {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.sh-alert-error .ui-icon { color: var(--danger); }

.sh-message {
  display: grid;
  justify-items: start;
  gap: 12px;
  max-width: 560px;
  padding: 48px 0;
}

body.is-guest .sh-message { margin: 0 auto; padding: 96px 24px; }

.sh-message h1 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
}

.sh-message p { margin: 0 0 8px; line-height: 1.55; }

.sh-message-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink, var(--accent));
}

/* Aparência */
.sh-theme-form { display: grid; gap: 32px; max-width: 980px; }

.sh-theme-group {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.sh-theme-group legend {
  padding: 0;
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
}

.sh-theme-modes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

button.sh-theme-mode {
  position: relative;
  display: grid;
  gap: 12px;
  height: auto;
  min-height: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--panel);
  color: var(--text);
  font-weight: 400;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

button.sh-theme-mode:hover { background: var(--panel); border-color: var(--line-strong); color: var(--text); }
button.sh-theme-mode.is-selected { border-color: var(--accent-ink, var(--accent)); background: var(--accent-soft); }

.sh-theme-mode-text { display: grid; gap: 2px; line-height: 1.35; }
.sh-theme-mode-text strong { font-size: 0.95rem; font-weight: 600; }
.sh-theme-mode-text small { color: var(--muted); font-size: 0.82rem; }

.sh-theme-check {
  position: absolute;
  top: 18px;
  right: 18px;
  display: none;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent, #fff);
}

.sh-theme-check .ui-icon { width: 14px; height: 14px; stroke-width: 2.4; }
.sh-theme-mode.is-selected .sh-theme-check { display: inline-grid; }

/* Miniaturas: cores fixas que representam cada predefinição de tema. */
.sh-theme-thumb {
  display: grid;
  grid-template-columns: 26% 1fr;
  grid-template-rows: 1fr 14px;
  gap: 5px;
  height: 72px;
  padding: 6px;
  border-radius: var(--r-ctl);
  background: #031116;
}

.sh-theme-thumb i { display: block; border-radius: 3px; background: #0A242B; }
.sh-theme-thumb i:first-child { grid-row: 1 / 3; background: #020D11; }
.sh-theme-thumb i:last-child { background: #945ADD; width: 46%; }
.sh-theme-thumb.is-light { background: #F3F7F8; }
.sh-theme-thumb.is-light i { background: #FFFFFF; }
.sh-theme-thumb.is-light i:first-child { background: #E4ECEE; }
.sh-theme-thumb.is-light i:last-child { background: #7A3FC9; }
.sh-theme-thumb.is-color { background: color-mix(in srgb, #090909 82%, var(--accent)); }
.sh-theme-thumb.is-color i { background: color-mix(in srgb, #191919 70%, var(--accent)); }
.sh-theme-thumb.is-color i:first-child { background: color-mix(in srgb, #000000 80%, var(--accent)); }
.sh-theme-thumb.is-color i:last-child { background: var(--accent); }

.sh-theme-note { margin: 0; font-size: 0.86rem; }

.sh-theme-colors {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

#themeColorGroup.is-off .sh-theme-colors { opacity: .45; }

button.sh-swatch {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
}

button.sh-swatch:hover { background: transparent; border-color: var(--line-strong); }
button.sh-swatch.is-selected { border-color: var(--text); }
button.sh-swatch[disabled] { cursor: not-allowed; }

.sh-swatch-dot { width: 28px; height: 28px; border-radius: 50%; }
/* Cores predefinidas oferecidas ao usuário (valores do seletor). */
.sh-swatch-945add { background: #945ADD; }
.sh-swatch-2f9e8f { background: #2F9E8F; }
.sh-swatch-d9822b { background: #D9822B; }
.sh-swatch-d9486a { background: #D9486A; }
.sh-swatch-4c7bd9 { background: #4C7BD9; }

.sh-color-custom input[type="color"] {
  width: 40px;
  height: 40px;
  padding: 2px;
  border-radius: 50%;
  cursor: pointer;
}

.sh-color-custom input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.sh-color-custom input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; }

.sh-field-inline { width: 140px; margin-left: 6px; }
.sh-field-inline input { height: 40px; font-variant-numeric: tabular-nums; text-transform: uppercase; }

.sh-theme-preview { display: grid; gap: 12px; }
.sh-theme-preview h2 { margin: 0; font-size: 1.15rem; }

.sh-theme-sample {
  display: grid;
  gap: 2px;
  max-width: 640px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--bg);
}

.sh-theme-sample-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto 48px;
  align-items: center;
  gap: 14px;
  padding: 8px;
  border-radius: var(--r-ctl);
}

/* Prévia igual à lista real (ADENDO 3): linha tocando em fundo neutro, botão de play branco, progresso em roxo. */
.sh-theme-sample-row { position: relative; }
.sh-theme-sample-row.is-playing { background: color-mix(in srgb, var(--text) 9%, transparent); }
.sh-theme-sample-row.is-playing::after {
  content: "";
  position: absolute;
  left: 62px;
  right: 76px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--accent) 0 38%, var(--line-strong) 38% 100%);
}

.sh-theme-sample-cover {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--muted);
}

.sh-theme-sample-row.is-playing .sh-theme-sample-cover { border-radius: 50%; background: var(--text); color: var(--bg); }
.sh-theme-sample-cover .ui-icon { width: 16px; height: 16px; }
.sh-theme-sample-text { display: grid; line-height: 1.3; min-width: 0; }
.sh-theme-sample-text strong { font-size: 0.92rem; font-weight: 600; }
.sh-theme-sample-text small { color: var(--muted); font-size: 0.82rem; }
.sh-theme-sample-row .badge { background: var(--panel-2); border: 0; color: var(--muted); }
.sh-theme-sample-time { color: var(--muted); font-size: 0.82rem; font-variant-numeric: tabular-nums; text-align: right; }
.sh-theme-sample-actions { display: flex; gap: 8px; padding: 10px 8px 6px; }
.sh-theme-sample-actions button { pointer-events: none; height: 36px; min-height: 36px; padding: 0 14px; }

/* ---------- Login ---------- */

.sh-login {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(0, 1.15fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sh-login-form-col {
  display: grid;
  place-items: center;
  padding: 48px 32px;
}

.sh-login-box {
  display: grid;
  gap: 14px;
  width: min(380px, 100%);
}

.sh-login-brand { display: grid; gap: 8px; margin-bottom: 28px; }

.sh-login-logo {
  display: block;
  height: 32px;
  width: auto;
  max-width: 100%;
}

.sh-login .login-brand-heading { margin: 0; text-align: left; }
.sh-login .login-brand-heading .brand-title { font-family: var(--font-display); font-size: 1rem; color: var(--muted); }

.sh-login-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.sh-login-lead { margin: -4px 0 10px; color: var(--muted); font-size: 0.98rem; }

.sh-login-form { display: grid; gap: 16px; }

.sh-login-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 500;
}

.sh-login-form input {
  box-sizing: border-box;
  width: 100%;
  height: 46px;
  font-size: 1rem;
  font-weight: 400;
}

.sh-login-form button.sh-login-submit {
  height: 46px;
  min-height: 46px;
  margin-top: 6px;
  font-size: 1rem;
  font-weight: 600;
}

.sh-login-help { margin: 8px 0 0; color: var(--muted); font-size: 0.85rem; }
.sh-login-demo {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.sh-login-demo__lead { margin: 0 0 10px; color: var(--muted); font-size: 0.88rem; line-height: 1.45; }
a.sh-login-demo__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--accent-ink) 55%, transparent);
  border-radius: var(--radius-control, 10px);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
a.sh-login-demo__btn:hover { background: color-mix(in srgb, var(--accent) 14%, transparent); text-decoration: none; }

.sh-login-art {
  display: grid;
  align-items: end;
  padding: 64px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow: hidden;
}

.sh-login-art-inner { display: grid; gap: 16px; max-width: 620px; }

.sh-login-art-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.4vw, 3.1rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--text);
}

.sh-login-art-sub { margin: 0 0 32px; color: var(--muted); font-size: 1.05rem; }

.sh-login-wave {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 120px;
}

.sh-login-wave span {
  flex: 1 1 0;
  min-width: 2px;
  max-width: 8px;
  border-radius: 3px;
  background: var(--line-strong);
}

.sh-login-wave span.is-played { background: var(--accent); }

.sh-login-wave-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

/* ---------- Responsivo ---------- */

@media (max-width: 1279px) {
  :root { --sh-gutter: 28px; }
  .sh-player-grid { grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) auto; gap: 16px; }
  #playerInfo { display: none; }
}

@media (max-width: 1023px) {
  :root { --sh-gutter: 20px; }

  body.has-shell { padding-left: 0; }

  .sh-side {
    width: min(300px, 86vw);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform .2s var(--sh-ease), visibility 0s linear .2s;
    box-shadow: var(--shadow-lg);
  }

  body.sh-drawer-open .sh-side {
    transform: translateX(0);
    visibility: visible;
    transition: transform .2s var(--sh-ease), visibility 0s linear 0s;
  }

  .sh-side-close { display: inline-grid; }

  .sh-scrim {
    position: fixed;
    inset: 0;
    z-index: 1090;
    background: rgba(0, 0, 0, 0.55);
  }

  body.sh-drawer-open { overflow: hidden; }

  .sh-menu-btn { display: inline-grid; margin-left: -6px; }
  .sh-search { max-width: none; }

  .sh-player { left: 0; }
  #playerInfo { display: inline-grid; }
}

@media (max-width: 899px) {
  .sh-player-grid { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .sh-player-center { grid-column: 1 / -1; grid-row: 2; }
  .sh-player-actions { grid-column: 2; grid-row: 1; }
}

@media (max-width: 719px) {
  :root { --sh-top: 60px; --sh-gutter: 16px; }

  .sh-top { gap: 8px; }
  .sh-search-kbd { display: none; }
  .sh-search-form input[name="q"] { padding-right: 14px; font-size: 16px; }

  .sh-audio-btn,
  button.sh-audio-btn { width: 42px; padding: 0; }
  .sh-audio-btn > span { display: none; }

  .sh-toasts, .toast-stack { right: 16px; left: 16px; width: auto; }

  body.has-shell.has-player .container { padding-bottom: 200px; }

  .sh-player { padding: 10px 12px calc(8px + env(safe-area-inset-bottom)); }

  .sh-player-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "track transport"
      "wave wave"
      "actions actions";
    gap: 6px 8px;
  }

  .sh-player-center { display: contents; }
  .sh-player-track { grid-area: track; }
  .sh-player-transport { grid-area: transport; gap: 2px; }
  .sh-player-wave { grid-area: wave; gap: 8px; }
  .sh-player-actions { grid-area: actions; justify-content: space-between; }
  .sh-player-cover { width: 44px; height: 44px; }
  .sh-player-time { min-width: 34px; font-size: 0.75rem; }
  .sh-player-sep { display: none; }
  .sh-pbtn-play, button.sh-pbtn-play { width: 40px; height: 40px; min-height: 40px; }

  .sh-info-grid { grid-template-columns: 1fr; }
  .sh-info-cover { width: 120px; height: 120px; }

  dialog.playlist-modal .playlist-modal-inner { padding: 20px 18px; }

  .sh-login { grid-template-columns: 1fr; }
  .sh-login-art { display: none; }
  .sh-login-form-col { place-items: start center; padding: 56px 24px 32px; }
  .sh-login-title { font-size: 1.9rem; }

  .sh-field-inline { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .sh-side,
  .sh-player,
  .sh-toasts .toast { transition: none !important; }
}

/* Ordem de cascata: estes estados vêm depois das regras genéricas de botão. */
button.sh-audio-btn { width: auto; }
button.sh-menu-btn,
button.sh-side-close { display: none; }

@media (max-width: 1023px) {
  button.sh-menu-btn,
  button.sh-side-close { display: inline-grid; }
}

@media (max-width: 719px) {
  button.sh-audio-btn { width: 42px; }
}

/* Botão tocar/pausar do player: vence as regras legadas por id em app.css. */
#playerDock #playerPlay,
#playerDock #playerPlay.is-playing {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--sh-play-bg);
  color: var(--sh-play-fg);
  box-shadow: none;
}

#playerDock #playerPlay:hover { background: var(--sh-play-bg); color: var(--sh-play-fg); transform: scale(1.04); }

/* =====================================================================
 * ADENDO 3 — linguagem neutra + vidro (liquid glass) só no que flutua.
 * ===================================================================== */

:root {
  --sh-dim: color-mix(in srgb, var(--text) 64%, transparent);
  --sh-faint: color-mix(in srgb, var(--text) 42%, transparent);
  --sh-hover: color-mix(in srgb, var(--text) 6%, transparent);
  --sh-active-bg: color-mix(in srgb, var(--text) 8%, transparent);
  --sh-active-line: color-mix(in srgb, var(--text) 12%, transparent);
  --sh-wave: color-mix(in srgb, var(--text) 30%, transparent);
  --sh-glass-bg: color-mix(in srgb, var(--panel) 55%, transparent);
  --sh-glass-border: rgba(255, 255, 255, 0.08);
  --sh-glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 20px 50px rgba(0, 0, 0, 0.45);
  --sh-glass-filter: blur(24px) saturate(160%);
  --sh-side-bg: color-mix(in srgb, var(--bg) 70%, #000000);
  --sh-side-hover: var(--sh-hover);
  --sh-side-active: var(--sh-active-bg);
}

:root[data-theme-mode="light"] {
  --sh-glass-bg: color-mix(in srgb, var(--panel) 62%, transparent);
  --sh-glass-border: rgba(10, 34, 41, 0.10);
  --sh-glass-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 16px 40px rgba(10, 34, 41, 0.16);
  --sh-side-bg: color-mix(in srgb, var(--bg) 94%, var(--text) 6%);
}

.sh-glass,
.sh-player,
.sh-top.is-scrolled,
.sh-pop,
.sh-suggest,
.sh-toasts .toast {
  background: var(--sh-glass-bg);
  -webkit-backdrop-filter: var(--sh-glass-filter);
  backdrop-filter: var(--sh-glass-filter);
  border: 1px solid var(--sh-glass-border);
  box-shadow: var(--sh-glass-shadow);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sh-glass,
  .sh-player,
  .sh-top.is-scrolled,
  .sh-pop,
  .sh-suggest,
  .sh-toasts .toast { background: var(--panel); }
}

/* Barra lateral estilo Artlist: neutra; roxo só no ícone ativo. */
.sh-side { border-right-color: color-mix(in srgb, var(--text) 6%, transparent); }
.sh-nav-item, .sh-pl-item, .sh-foot-btn { color: var(--sh-dim); }
.sh-nav-item .ui-icon { color: var(--sh-dim); }
.sh-nav-item.is-current,
.sh-pl-item.is-current {
  background: var(--sh-active-bg);
  box-shadow: inset 0 0 0 1px var(--sh-active-line);
  color: var(--text);
}
.sh-nav-item.is-current .ui-icon { color: var(--accent-ink, var(--accent)); }
.sh-side-label, .sh-side-more, .sh-side-empty, .sh-user-text small, .sh-caret { color: var(--sh-faint); }
.sh-side-section, .sh-side-foot { border-top-color: color-mix(in srgb, var(--text) 6%, transparent); }
.sh-avatar { background: var(--sh-active-bg); color: var(--text); }
.sh-foot-btn.is-current { box-shadow: inset 0 0 0 1px var(--sh-active-line); background: var(--sh-active-bg); }

/* Barra superior: some no fundo no topo da página; vira vidro ao rolar. */
.sh-top {
  border: 0;
  border-bottom: 1px solid transparent;
  background: var(--bg);
  transition: background-color .16s ease, box-shadow .16s ease;
}

.sh-top.is-scrolled {
  border-width: 0 0 1px;
  border-radius: 0;
  box-shadow: inset 0 -1px 0 var(--sh-glass-border), 0 12px 32px rgba(0, 0, 0, 0.28);
}

.sh-search-form input[name="q"] {
  border-color: color-mix(in srgb, var(--text) 10%, transparent);
  background: color-mix(in srgb, var(--text) 5%, transparent);
}

.sh-search-form input[name="q"]:hover { border-color: color-mix(in srgb, var(--text) 18%, transparent); }
.sh-search-form input[name="q"]:focus { background: color-mix(in srgb, var(--text) 7%, transparent); }
.sh-search-icon, .sh-search-kbd { color: var(--sh-faint); }

.sh-audio-btn,
button.sh-audio-btn {
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  background: color-mix(in srgb, var(--text) 5%, transparent);
  color: var(--text);
}

.sh-audio-btn:hover,
button.sh-audio-btn:hover {
  border-color: color-mix(in srgb, var(--text) 24%, transparent);
  background: color-mix(in srgb, var(--text) 9%, transparent);
}

/* Popovers e sugestões */
.sh-pop-item:hover, .sh-pop-item:focus-visible,
.sh-suggest .nav-suggestion-item:hover,
.sh-suggest .nav-suggestion-item:focus-visible { background: var(--sh-hover); }
.sh-pop-item.is-current { background: var(--sh-active-bg); }
.sh-pop-head, .sh-pop-sep { border-color: var(--sh-glass-border); }
.sh-pop-sep { background: var(--sh-glass-border); }
.sh-suggest .nav-suggestion-chip:hover { border-color: color-mix(in srgb, var(--text) 24%, transparent); background: var(--sh-hover); }
.sh-seg a.is-current { background: var(--sh-active-bg); }

/* Player flutuante em vidro */
.sh-player {
  left: calc(var(--sh-side) + 12px);
  right: 12px;
  bottom: 12px;
  padding: 10px 16px 10px 10px;
  border-radius: 16px;
}

.sh-player.is-hidden { transform: translateY(calc(100% + 24px)); }
.sh-player-meta span, .sh-player-time { color: var(--sh-dim); }
.sh-pbtn, button.sh-pbtn, a.sh-pbtn { color: var(--sh-dim); }
.sh-pbtn:hover, button.sh-pbtn:hover, a.sh-pbtn:hover { background: var(--sh-hover); color: var(--text); }
.sh-player-cover { border-radius: 10px; background: var(--sh-active-bg); }
.sh-player-sep { background: var(--sh-glass-border); }
body.has-shell.has-player .container { padding-bottom: 148px; }

/* Toasts em vidro */
.sh-toasts .toast { border-left-width: 1px; }
.toast-success .toast-icon,
.toast-info .toast-icon { background: var(--sh-active-bg); color: var(--text); }
.toast-success .toast-icon { color: var(--accent-ink, var(--accent)); }

@media (max-width: 1023px) {
  .sh-player { left: 12px; }
}

@media (max-width: 719px) {
  .sh-player { left: 8px; right: 8px; bottom: calc(8px + env(safe-area-inset-bottom)); padding: 10px 10px 8px; }
  body.has-shell.has-player .container { padding-bottom: 210px; }
}

dialog.playlist-modal .playlist-modal-actions > button,
dialog.playlist-modal .playlist-modal-actions > a {
  width: auto;
  flex: 0 0 auto;
  height: 40px;
  min-height: 40px;
  padding: 0 18px;
}

.sh-login-form label { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 8px; row-gap: 6px; }
.sh-login-form label > input { flex: 1 0 100%; }
.sh-login-form .sh-field-hint { color: var(--sh-faint); font-size: 0.82rem; }
.sh-login-help, .sh-login-lead, .sh-login-art-sub, .sh-login-wave-meta { color: var(--sh-dim); }

.sh-form-actions > button,
.sh-form-actions > a,
.sh-theme-sample-actions > button { width: auto; flex: 0 0 auto; }
button.sh-theme-mode.is-selected { background: var(--sh-active-bg); border-color: var(--accent-ink, var(--accent)); }
.sh-page-head p.muted, .sh-theme-note, .sh-theme-mode-text small, .sh-field-note { color: var(--sh-dim); }

/* =====================================================================
 * Rodada 2 — logo empilhado, onda do player, player compacto no celular.
 * ===================================================================== */

:root {
  --sh-wave: color-mix(in srgb, var(--text) 25%, transparent);
  --sh-wave-hover: color-mix(in srgb, var(--text) 45%, transparent);
  --sh-player-h: 84px;
}

/* Logo empilhado (~6.5:1): ocupa a largura útil da barra lateral. */
.sh-side-head { min-height: 0; padding: 22px 12px 18px 20px; align-items: center; }
.sh-brand { flex: 1 1 auto; }
.sh-brand-logo { width: 100%; max-width: 226px; max-height: none; height: auto; }
.sh-login-logo { width: 300px; max-width: 100%; height: auto; }
.sh-login-brand { margin-bottom: 36px; }

/* Onda do player: canvas próprio. O contêiner do WaveSurfer fica invisível (só motor de áudio). */
.sh-wave {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 36px;
  cursor: pointer;
  border-radius: 4px;
  touch-action: none;
}

.sh-wave:focus-visible { outline: 2px solid var(--accent-ink, var(--accent)); outline-offset: 4px; }
.sh-wave-canvas { display: block; width: 100%; height: 100%; }

.sh-wave .sh-waveform {
  position: absolute;
  inset: 0;
  height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.sh-wave-tip {
  position: absolute;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  background: var(--text);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  white-space: nowrap;
}

.sh-wave-tip[hidden] { display: none; }

.sh-player-expand,
.sh-player-progress { display: none; }

/* Garante que o conteúdo nunca fique sob o player flutuante. */
body.has-shell.has-player .container { padding-bottom: calc(var(--sh-player-h) + 48px); }

/* ---------- Celular: player compacto + tela cheia ---------- */
@media (max-width: 719px) {
  :root { --sh-player-h: 64px; }

  .sh-side-head { padding: 16px 8px 14px 16px; }
  .sh-brand-logo { max-width: 200px; }
  .sh-login-logo { width: 240px; }

  .sh-player:not(.is-expanded) {
    padding: 8px 8px 8px 8px;
    overflow: hidden;
  }

  .sh-player:not(.is-expanded) .sh-player-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "track transport";
    gap: 8px;
    min-height: 48px;
  }

  .sh-player:not(.is-expanded) .sh-player-track { position: relative; }
  .sh-player:not(.is-expanded) .sh-player-cover { width: 44px; height: 44px; border-radius: 8px; }
  .sh-player:not(.is-expanded) #playerPrev,
  .sh-player:not(.is-expanded) #playerNext,
  .sh-player:not(.is-expanded) .sh-player-wave,
  .sh-player:not(.is-expanded) .sh-player-actions { display: none; }

  .sh-player:not(.is-expanded) .sh-player-expand {
    display: block;
    position: absolute;
    inset: -8px 0 -8px -8px;
    width: auto;
    height: auto;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
  }

  .sh-player:not(.is-expanded) .sh-player-progress {
    display: block;
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: var(--sh-wave);
    overflow: hidden;
  }

  .sh-player-progress i {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left center;
  }

  body.has-shell.has-player .container { padding-bottom: calc(var(--sh-player-h) + 40px); }

  /* Tela cheia */
  .sh-player.is-expanded {
    inset: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2200;
    padding: calc(16px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom));
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    overflow-y: auto;
  }

  .sh-player.is-expanded .sh-player-grid {
    min-height: 100%;
    grid-template-columns: 1fr;
    grid-template-areas: "track" "wave" "transport" "actions";
    grid-template-rows: 1fr auto auto auto;
    align-content: end;
    gap: 22px;
    padding-top: 40px;
  }

  .sh-player.is-expanded .sh-player-track {
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 18px;
  }

  .sh-player.is-expanded .sh-player-cover {
    width: min(100%, 360px);
    height: auto;
    aspect-ratio: 1 / 1;
    align-self: center;
    border-radius: 14px;
  }

  .sh-player.is-expanded .sh-player-cover-ph { width: 48px; height: 48px; }
  .sh-player.is-expanded .sh-player-meta { width: 100%; }
  .sh-player.is-expanded .sh-player-meta strong { font-family: var(--font-display); font-weight: 500; font-size: 1.5rem; white-space: normal; }
  .sh-player.is-expanded .sh-player-meta span { font-size: 0.95rem; white-space: normal; }
  .sh-player.is-expanded .sh-player-wave { gap: 10px; }
  .sh-player.is-expanded .sh-wave { height: 48px; }
  .sh-player.is-expanded .sh-player-transport { justify-content: center; gap: 28px; }
  .sh-player.is-expanded .sh-player-transport .sh-pbtn .ui-icon { width: 24px; height: 24px; }
  #playerDock.is-expanded #playerPlay { width: 64px; height: 64px; min-height: 64px; }
  #playerDock.is-expanded #playerPlay .ui-icon { width: 24px; height: 24px; }
  .sh-player.is-expanded .sh-player-actions { justify-content: space-around; }
  .sh-player.is-expanded .sh-pbtn { width: 44px; height: 44px; min-height: 44px; }

  .sh-player.is-expanded #playerToggle {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top));
    left: 12px;
  }

  body.sh-player-open { overflow: hidden; }
}

/* Barra de carregamento da navegação (assets/navigation.js) */
.tt-nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0;
  z-index: 3000;
  background: var(--accent);
  opacity: 0;
  pointer-events: none;
}
.tt-nav-progress.is-active {
  opacity: 1;
  width: 80%;
  transition: width 8s cubic-bezier(.1, .7, .2, 1), opacity .15s ease;
}
.tt-nav-progress.is-done {
  width: 100%;
  opacity: 0;
  transition: width .18s ease, opacity .25s ease .1s;
}
@media (prefers-reduced-motion: reduce) {
  .tt-nav-progress.is-active { transition: opacity .15s ease; width: 100%; }
}

/* Entre 900 e 1365px o transporte + onda do player descem para uma 2ª linha de largura total,
   para a onda não ficar espremida. */
@media (min-width: 900px) and (max-width: 1365px) {
  .sh-player-grid { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
  .sh-player-center { grid-column: 1 / -1; grid-row: 2; }
  .sh-player-actions { grid-column: 2; grid-row: 1; }
  /* Nesta disposição em duas linhas sobra espaço: "Detalhes da faixa" volta a aparecer (sumia entre 1024 e 1279px). */
  #playerInfo { display: inline-grid; }
}
@media (min-width: 1366px) and (max-width: 1439px) {
  .sh-player-grid { grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) auto; }
}

/* Ajuda de atalhos de teclado (menu do usuário › Atalhos de teclado, ou tecla "?") */
.sh-keys { display: grid; gap: 2px; margin: 0; }
.sh-keys > div {
  display: grid;
  grid-template-columns: minmax(150px, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.sh-keys > div:last-child { border-bottom: 0; }
.sh-keys dt { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 0.85rem; }
.sh-keys dd { margin: 0; color: var(--text); font-size: 0.9rem; }
.sh-keys kbd {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--text);
  font: 500 0.78rem/1 var(--font-body);
}
.sh-keys kbd .ui-icon { width: 14px; height: 14px; }
@media (max-width: 520px) {
  .sh-keys > div { grid-template-columns: 1fr; gap: 6px; }
}

/* Campos de arquivo nativos (Marca, Importar planilha, Enviar arquivos): botão no visual do produto,
   em vez do botão branco "Escolher arquivo" do navegador. */
input[type="file"] { color: var(--muted); font: inherit; font-size: 0.88rem; }
input[type="file"]::file-selector-button {
  margin-right: 12px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-ctl);
  background: transparent;
  color: var(--text);
  font: 500 0.86rem var(--font-body);
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease;
}
input[type="file"]:hover::file-selector-button { background: var(--panel-2); border-color: var(--muted); }
input[type="file"]:focus-visible { outline: none; }
input[type="file"]:focus-visible::file-selector-button { box-shadow: var(--focus-ring); }

/* ---------- Mini player (player recolhido) ----------
   Pílula de vidro no canto inferior direito: capa, título, tocar/pausar,
   seta para abrir o player completo e progresso fino na base. */
.sh-player-mini {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1060;
  display: flex;
  align-items: center;
  gap: 4px;
  width: min(380px, calc(100vw - var(--sh-side) - 32px));
  padding: 6px 6px 6px 6px;
  border-radius: 14px;
  border: 1px solid var(--sh-glass-border);
  background: var(--sh-glass-bg);
  -webkit-backdrop-filter: var(--sh-glass-filter);
  backdrop-filter: var(--sh-glass-filter);
  box-shadow: var(--sh-glass-shadow);
  color: var(--text);
  overflow: hidden;
  animation: sh-mini-in .18s var(--sh-ease);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sh-player-mini { background: var(--panel); }
}
.sh-player-mini[hidden],
body.has-shell.has-player .sh-player-mini { display: none; }
@keyframes sh-mini-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.sh-player-mini button { width: auto; min-height: 0; box-shadow: none; transform: none; }

.sh-mini-open {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 0 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.sh-mini-open:hover { background: transparent; }
.sh-mini-cover {
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--sh-active-bg);
  display: grid;
  place-items: center;
}
.sh-mini-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sh-mini-cover img[hidden] { display: none; }
.sh-mini-cover .sh-mini-cover-ph { width: 18px; height: 18px; color: var(--sh-dim); }
.sh-mini-meta { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.sh-mini-meta strong {
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sh-mini-meta span {
  font-size: 0.78rem;
  color: var(--sh-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sh-mini-play,
button.sh-mini-play {
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: #0b1215;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.sh-mini-play:hover { background: #ffffff; transform: scale(1.04); }
.sh-mini-play .ui-icon { width: 16px; height: 16px; }
.sh-mini-play .ui-icon-play { transform: translateX(1px); }

.sh-mini-up,
button.sh-mini-up {
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sh-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.sh-mini-up:hover { background: var(--sh-hover); color: var(--text); }

.sh-mini-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--sh-active-line);
  pointer-events: none;
}
.sh-mini-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
}

.sh-mini-open:focus-visible,
.sh-mini-play:focus-visible,
.sh-mini-up:focus-visible { outline: 2px solid var(--accent-ink, var(--accent)); outline-offset: 2px; }

@media (max-width: 719px) {
  .sh-player-mini { left: 12px; right: 12px; width: auto; bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .sh-player-mini { animation: none; }
}
/* O mini player não cobre a última linha da página. */
body.has-shell:has(.sh-player-mini:not([hidden])) .container { padding-bottom: 88px; }

/* ---------- Alinhamento do topo com o conteúdo ----------
   A barra de busca usa as mesmas margens do .container (largura máxima de 1640px
   centralizada + gutter): a busca começa na mesma linha do título e o botão
   "Buscar por áudio" termina na mesma borda da lista. */
.sh-top {
  padding-inline: max(var(--sh-gutter), calc((100% - 1640px) / 2 + var(--sh-gutter)));
}
.sh-search { max-width: none; }
.sh-audio-btn { flex: none; }

/* Logo da barra lateral centralizado na mesma altura da busca (centro em --sh-top / 2). */
.sh-side-head {
  min-height: var(--sh-top);
  padding-top: 0;
  padding-bottom: 0;
  display: flex;
  align-items: center;
}

/* Marca: o logo não é selecionável nem arrastável (barra lateral, login, gaveta). */
.sh-brand,
.sh-brand-logo,
.sh-login-logo {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}

/* Prévia (corte feito no servidor): aviso discreto ao lado da duração do player. */
.sh-player-preview {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--radius-pill, 999px);
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.4;
  white-space: nowrap;
}
.sh-player-preview[hidden] { display: none; }
@media (max-width: 640px) {
  .sh-player-preview { padding: 1px 6px; font-size: 0.68rem; }
}

/* Download indisponível nesta sessão (demonstração ou acesso sem download): visível, mas desabilitado. */
.is-unavailable,
body[data-download-off] .js-download-track,
body[data-download-off] #playerDownload,
body[data-download-off] [data-download-zip],
body[data-download-off] [data-download-album-zip] {
  opacity: .42;
  cursor: not-allowed;
}
body[data-download-off] #playerDownload.is-disabled { pointer-events: auto; }

.sh-pop-head small.sh-pop-quota { color: var(--muted); }
