.pq-wrap {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 16px;
  max-width: 1120px;
  box-sizing: border-box;
  /* respiro nas bordas: evita a sensação de conteúdo colado no topo/laterais */
  padding: 32px 20px 48px;
  margin: 0 auto;
  font-family: system-ui, sans-serif;
}
/* barra lateral: concentra as ações (adicionar, baixar, voltar, admin) */
.pq-sidebar {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 230px;
  padding: 14px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fafafa;
  position: sticky;
  top: 32px;
}
/* área principal: galeria ou editor */
.pq-main {
  position: relative; /* âncora do overlay de carregamento da troca de modo */
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
/* campo de seleção de arquivos (UI própria, em português) */
.pq-file {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px 14px;
  border: 1px dashed #bbb;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: #555;
  text-align: center;
  cursor: pointer;
}
.pq-file:hover {
  border-color: #22aa77;
}
.pq-file:focus-within {
  border-color: #22aa77;
  box-shadow: 0 0 0 3px rgba(34, 170, 119, 0.15);
}
/* o input nativo fica invisível, mas segue clicável através do <label> */
.pq-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.pq-file-btn {
  flex: none;
  padding: 8px 14px;
  border-radius: 6px;
  background: #22aa77;
  color: #fff;
  font-weight: 600;
}
.pq-file:hover .pq-file-btn {
  background: #1f8a63;
}
.pq-file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* lista de arquivos: tabela no estilo do explorer */
.pq-files {
  display: none;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
}
.pq-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}
.pq-table thead th {
  padding: 10px 12px;
  background: #fafafa;
  border-bottom: 1px solid #e6e6e6;
  font-size: 12px;
  font-weight: 700;
  color: #666;
  text-align: left;
  white-space: nowrap;
}
/* A coluna "Nome" é a única com largura automática: ela fica com o que sobra
   depois destas. Mantê-las enxutas é o que garante sobra real ao nome. */
.pq-col-check { width: 40px; }
.pq-col-name { width: auto; }
.pq-col-ext { width: 80px; }
.pq-col-size { width: 76px; }
.pq-col-date { width: 132px; }
.pq-col-act { width: 120px; text-align: right; }
.pq-row {
  border-bottom: 1px solid #f0f0f0;
}
.pq-row:hover {
  background: #f7fdfa;
}
.pq-row.is-selected {
  background: #e9f7f1;
}
.pq-row.is-downloading {
  opacity: 0.6;
}
/* pastas listadas como linhas normais da tabela (modo Arquivos) */
.pq-row-folder {
  cursor: pointer;
}
.pq-row-folder .pq-file-label {
  font-weight: 600;
}
.pq-row td {
  padding: 8px 12px;
  color: #333;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-cell-check { text-align: center; }
.pq-cell-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.pq-file-icon {
  flex: none;
  width: 22px;
  text-align: center;
}
.pq-file-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-cell-ext { color: #888; font-size: 11px; font-weight: 700; }
.pq-cell-size { color: #666; font-variant-numeric: tabular-nums; }
.pq-cell-date { color: #888; }
.pq-cell-act { text-align: right; white-space: nowrap; }
.pq-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  min-width: 26px;
  padding: 0 8px;
  margin-left: 4px;
  border: 1px solid #dcdcdc;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pq-act:hover {
  border-color: #22aa77;
  background: #f7fdfa;
}
.pq-act.is-bingo {
  border-color: #22aa77;
  background: #22aa77;
  color: #fff;
}
.pq-act.is-bingo:hover {
  background: #1f8a63;
}
.pq-act.is-del:hover {
  border-color: #c0392b;
  background: #c0392b;
  color: #fff;
}
.pq-check {
  width: 16px;
  height: 16px;
  accent-color: #22aa77;
  cursor: pointer;
}
/* ---- navegação por pastas ---- */
.pq-folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.pq-folder {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.pq-folder:hover {
  border-color: #22aa77;
  box-shadow: 0 12px 26px rgba(16, 24, 40, 0.12);
  transform: translateY(-3px);
}
/* ícone dentro de um "chip" suave: dá peso visual e alinha os cards */
.pq-folder-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: rgba(34, 170, 119, 0.12);
  font-size: 22px;
  line-height: 1;
}
.pq-folder-name {
  font-size: 14px;
  font-weight: 600;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-folder-meta {
  margin-top: 2px;
  font-size: 12px;
  color: #8a8f98;
}
/* ações do card de pasta (renomear/excluir), no canto superior direito.
   Ficam sempre visíveis: no toque não existe hover. */
.pq-folder-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}
.pq-folder-act {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  color: #9aa0a6;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.pq-folder-act:hover {
  background: #22aa77;
  color: #fff;
}
.pq-folder-act.is-del:hover {
  background: #c0392b;
  color: #fff;
}
/* marcador de seleção nas pastas do modo Bingo (canto inferior direito, para
   não disputar espaço com o ícone nem com as ações de renomear/excluir) */
.pq-folder .pq-card-select {
  top: auto;
  bottom: 10px;
  left: auto;
  right: 10px;
}
.pq-folder.is-selected {
  border-color: #22aa77;
  box-shadow: 0 0 0 3px rgba(34, 170, 119, 0.35);
}
.pq-folder.is-selected .pq-card-select::after {
  content: '\2713';
}
/* linha de criação de pasta, acima da lista */
.pq-newfolder {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.pq-newfolder-input {
  flex: 1 1 160px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: #333;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.pq-newfolder-input::placeholder {
  color: #aaa;
}
.pq-newfolder-input:focus {
  outline: none;
  border-color: #22aa77;
  box-shadow: 0 0 0 3px rgba(34, 170, 119, 0.15);
}
.pq-newfolder-btn {
  flex: none;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  background: #22aa77;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.pq-newfolder-btn:hover:not(:disabled) {
  background: #1f8a63;
}
.pq-newfolder-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
/* a linha "Nova pasta" mora na barra lateral: cria uma subpasta da pasta
   aberta (some no editor e no modo visualização) */
.pq-wrap.is-editing .pq-newfolder,
.pq-wrap.is-view .pq-newfolder {
  display: none;
}
/* trilha de navegação da pasta aberta */
.pq-crumb {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 2px;
}
.pq-crumb-back {
  flex: none;
  padding: 8px 14px;
  border: 1px solid #dcdcdc;
  border-radius: 8px;
  background: #fff;
  color: #333;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.pq-crumb-back:hover {
  border-color: #22aa77;
  background: #f7fdfa;
}
.pq-crumb-name {
  font-size: 16px;
  font-weight: 700;
  color: #222;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-grid-empty {
  grid-column: 1 / -1;
  padding: 24px 12px;
  text-align: center;
  color: #888;
  font-size: 14px;
}
.pq-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.pq-card:hover {
  border-color: #22aa77;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  transform: translateY(-2px);
}
.pq-card-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #f4f4f4;
}
.pq-card-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.pq-card-thumb.is-empty::after {
  content: 'PDF';
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #bbb;
}
/* enquanto a miniatura é gerada/servida */
.pq-card-thumb.is-loading::after {
  content: '';
  width: 28px;
  height: 28px;
  box-sizing: border-box;
  border: 3px solid rgba(34, 170, 119, 0.2);
  border-top-color: #22aa77;
  border-radius: 50%;
  animation: pq-spin 0.8s linear infinite;
}
.pq-card-name {
  padding: 8px 10px;
  font-size: 13px;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* ações do card de PDF (renomear/remover), no canto superior direito */
.pq-card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 6px;
}
.pq-card-act {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.pq-card-act:hover {
  background: #22aa77;
}
.pq-card-act.is-del:hover {
  background: #c0392b;
}
/* permissão de baixar a página está ligada para este PDF */
.pq-card-act.is-on {
  background: #22aa77;
}
/* marcação de PDFs para download: usuário comum não edita, só seleciona */
.pq-card-select {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  /* agora é um alvo clicável: alterna a seleção sem abrir o editor */
  pointer-events: auto;
  cursor: pointer;
  z-index: 2;
}
.pq-card.is-selected {
  border-color: #22aa77;
  box-shadow: 0 0 0 3px rgba(34, 170, 119, 0.35);
}
.pq-card.is-selected .pq-card-select::after {
  content: '\2713';
}
.pq-stage {
  position: relative;
  width: 100%;
  background: #f4f4f4;
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden;
  touch-action: none;
}
/* contêiner que agrupa página + QR: é ele que sofre o zoom no modo visualização */
.pq-page {
  position: relative;
  transform-origin: 0 0;
  will-change: transform;
}
.pq-canvas {
  display: block;
  width: 100%;
}
.pq-qr {
  position: absolute;
  display: none;
  box-sizing: border-box;
  cursor: move;
  touch-action: none;
  user-select: none;
}
.pq-qr-img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.pq-loading {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(244, 244, 244, 0.94);
  z-index: 5;
}
/* garante altura visível no overlay mesmo com o canvas zerado */
.pq-stage.is-loading {
  min-height: 320px;
}
.pq-stage.is-loading .pq-loading {
  display: flex;
}
.pq-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(34, 170, 119, 0.2);
  border-top-color: #22aa77;
  border-radius: 50%;
  animation: pq-spin 0.8s linear infinite;
}
.pq-loading-text {
  font-size: 15px;
  font-weight: 600;
  color: #1f8a63;
}
.pq-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
/* botão flutuante para baixar só a página atual, no modo visualização (aberto
   por QR). Só aparece quando o PDF libera o download da página. */
.pq-page-dl {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border: none;
  border-radius: 999px;
  background: #22aa77;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(34, 170, 119, 0.4);
  transition: background 0.15s ease;
}
.pq-page-dl:hover {
  background: #1f8a63;
}
.pq-wrap.is-view.can-page-download .pq-page-dl {
  display: inline-flex;
}
.pq-download {
  display: none;
  width: 100%;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  background: #22aa77;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.pq-download:disabled {
  opacity: 0.6;
  cursor: default;
}
/* botão de baixar os PDFs marcados (usuário comum, sem edição) */
.pq-download-selected {
  display: none;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #22aa77;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.pq-download-selected.is-visible {
  display: block;
}
.pq-download-selected:hover {
  background: #1f8a63;
}
/* botão de excluir os arquivos marcados (exige permissão de remoção) */
.pq-delete-selected {
  display: none;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #c0392b;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}
.pq-delete-selected.is-visible {
  display: block;
}
.pq-delete-selected:hover {
  background: #a93226;
}
.pq-download.is-loading::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -1px;
  animation: pq-spin 0.7s linear infinite;
}
@keyframes pq-spin {
  to { transform: rotate(360deg); }
}
.pq-status {
  flex: 1 1 100%;
  min-height: 18px;
  font-size: 13px;
  color: #555;
}
.pq-status.is-error {
  color: #c0392b;
}
.pq-back {
  display: none;
  width: 100%;
  padding: 8px 14px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-weight: 600;
  cursor: pointer;
}
/* navegação: por padrão só a lista de pastas; a grade e o upload só aparecem
   com uma pasta aberta (.is-folder no wrapper) */
.pq-crumb,
.pq-file,
.pq-files,
.pq-stage,
.pq-bar {
  display: none;
}
/* dentro de uma pasta: subpastas + grade de PDFs + upload. A lista de pastas
   (.pq-folders-view) continua visível, mostrando as subpastas do nível atual. */
.pq-wrap.is-folder .pq-crumb {
  display: flex;
}
.pq-wrap.is-folder .pq-files {
  display: block;
}
.pq-wrap.is-folder .pq-file {
  display: flex;
}
/* modo bingo: árvore de pastas própria (separada da aba Arquivos); a grade de
   arquivos vira cartões com a miniatura da 1ª página */
.pq-cards {
  display: none;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.pq-wrap.mode-bingo .pq-files {
  display: none;
}
/* com subpastas, a tabela reaparece no bingo (mesma tabela do modo Arquivos):
   as pastas ficam em linhas e os cartões com miniatura vêm logo abaixo */
.pq-wrap.mode-bingo.has-folders.is-folder:not(.is-editing) .pq-files {
  display: block;
}
.pq-wrap.mode-bingo.is-folder:not(.is-editing) .pq-cards {
  display: grid;
}
/* editor: sobrepõe a navegação (por vir depois no arquivo, vence o empate) */
.pq-wrap.is-editing .pq-folders-view,
.pq-wrap.is-editing .pq-crumb,
.pq-wrap.is-editing .pq-files,
.pq-wrap.is-editing .pq-file {
  display: none;
}
.pq-wrap.is-editing .pq-back,
.pq-wrap.is-editing .pq-download {
  display: flex;
}
.pq-wrap.is-editing .pq-stage {
  display: block;
}
.pq-wrap.is-editing .pq-bar {
  display: flex;
}
/* sem permissão de baixar arquivos: o botão de download não aparece */
.pq-wrap.no-download .pq-download {
  display: none;
}
.pq-saving {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: #2b2b2b;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  opacity: 0;
  transform: translateY(-10px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 6;
}
.pq-saving.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.pq-saving.is-saving {
  background: #f0a500;
  color: #3a2a00;
}
.pq-saving.is-saved {
  background: #22aa77;
}
.pq-saving.is-error {
  background: #c0392b;
}
.pq-saving-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}
.pq-saving.is-saving .pq-saving-dot {
  animation: pq-pulse 0.8s ease-in-out infinite;
}
@keyframes pq-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.6); opacity: 0.35; }
}
/* ---- seção de downloads (cada um roda em segundo plano) ---- */
.pq-downloads {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
}
.pq-downloads.is-visible {
  display: flex;
}
.pq-downloads-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #333;
}
.pq-downloads-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 168px;
  overflow-y: auto;
}
.pq-dl {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.pq-dl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #444;
}
.pq-dl-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-dl-status {
  flex: none;
  font-size: 12px;
  color: #888;
}
.pq-dl.is-done .pq-dl-status {
  color: #1f8a63;
}
.pq-dl.is-error .pq-dl-status {
  color: #c0392b;
}
.pq-dl-bar {
  height: 6px;
  border-radius: 999px;
  background: #eee;
  overflow: hidden;
}
.pq-dl-bar-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: #22aa77;
  transition: width 0.2s ease;
}
.pq-dl.is-error .pq-dl-bar-fill {
  background: #c0392b;
}
/* trava visual no card do PDF que está sendo baixado */
.pq-card.is-downloading {
  cursor: progress;
}
.pq-card-lock {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f0a500;
  color: #3a2a00;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}
/* notificação flutuante no canto inferior esquerdo */
.pq-toast {
  position: fixed;
  left: 16px;
  bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 10px;
  background: #22aa77;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 50;
}
.pq-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.pq-toast.is-error {
  background: #c0392b;
}
.pq-toast-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}
/* botão que abre o modal do admin (só para admins), na barra lateral */
.pq-admin-open {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 16px;
  border: none;
  border-radius: 6px;
  background: #2b2b2b;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.pq-admin-open.is-visible {
  display: flex;
}
/* modo visualização (acessado por QR/hash, mesmo deslogado): só a página */
.pq-wrap.is-view .pq-sidebar {
  display: none;
}
.pq-wrap.is-view .pq-file,
.pq-wrap.is-view .pq-files,
.pq-wrap.is-view .pq-folders-view,
.pq-wrap.is-view .pq-crumb {
  display: none;
}
.pq-wrap.is-view .pq-stage {
  display: block;
}
.pq-wrap.is-view .pq-qr {
  cursor: default;
}
/* painel do admin: modal sobre a tela, só aparece para quem é admin */
.pq-admin {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}
.pq-admin.is-visible {
  display: flex;
}
.pq-admin-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 440px;
  max-height: min(80vh, 560px);
  padding: 16px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.pq-admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pq-admin-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pq-admin-title {
  font-size: 14px;
  font-weight: 700;
  color: #333;
}
/* quem está logado, exibido ao lado dos botões do topo */
.pq-admin-me {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  min-width: 0;
  margin-right: 4px;
  font-size: 12px;
  line-height: 1.25;
  text-align: right;
}
.pq-admin-me-name {
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-admin-me-email {
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-admin-refresh {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #333;
  font-weight: 600;
  cursor: pointer;
}
.pq-admin-close {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: #2b2b2b;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.pq-admin-logout {
  display: none;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #c0392b;
  border-radius: 6px;
  background: #fff;
  color: #c0392b;
  font-weight: 600;
  cursor: pointer;
}
.pq-admin-logout.is-visible {
  display: block;
}
.pq-admin-logout:hover {
  background: #c0392b;
  color: #fff;
}
/* quem está logado (me), exibido no topo da barra lateral */
.pq-me {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  background: #fff;
}
.pq-me.is-visible {
  display: flex;
}
.pq-me-avatar {
  flex: none;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #22aa77, #1f8a63);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}
.pq-me-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.pq-me-name {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-me-email {
  font-size: 11px;
  color: #8a8f98;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}
.pq-user {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 8px 10px;
  border: 1px solid #eee;
  border-radius: 6px;
}
.pq-user.is-saving {
  opacity: 0.6;
}
.pq-user-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pq-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  color: #333;
}
.pq-user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  color: #888;
}
.pq-user-perm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
}
/* linha de criação de usuário, logo acima da lista */
.pq-admin-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.pq-admin-add-input {
  flex: 1 1 120px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
}
.pq-admin-add-input:focus {
  outline: none;
  border-color: #22aa77;
  box-shadow: 0 0 0 3px rgba(34, 170, 119, 0.15);
}
.pq-admin-add-btn {
  flex: none;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #22aa77;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.pq-admin-add-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.pq-user-del {
  flex: none;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: #f2f2f2;
  color: #c0392b;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.pq-user-del:hover {
  background: #c0392b;
  color: #fff;
}
/* modal de login: aparece só quando o usuário ainda não está autorizado */
.pq-login {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 24, 40, 0.6);
  backdrop-filter: blur(8px);
}
.pq-login.is-visible {
  display: flex;
}
/* enquanto o login aparece, o conteúdo do app fica escondido de verdade —
   não é só um overlay escuro por cima da galeria */
.pq-wrap.is-locked > .pq-sidebar,
.pq-wrap.is-locked > .pq-main,
.pq-wrap.is-locked > .pq-saving,
.pq-wrap.is-locked > .pq-toast {
  visibility: hidden;
}
.pq-login-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 380px;
  padding: 34px 28px 30px;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(16, 24, 40, 0.04);
  overflow: hidden;
  animation: pq-login-pop 0.22s ease;
}
/* faixa de destaque no topo do card, no tom da marca */
.pq-login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #22aa77, #1f8a63);
}
@keyframes pq-login-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.pq-login-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
  text-align: center;
}
/* ícone dentro de um "chip" suave, no mesmo padrão dos cards de pasta */
.pq-login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, #22aa77, #1f8a63);
  box-shadow: 0 8px 18px rgba(34, 170, 119, 0.35);
  font-size: 26px;
  line-height: 1;
}
.pq-login-subtitle {
  font-size: 14px;
  line-height: 1.45;
  color: #8a8f98;
}
/* rótulo em volta do campo: clicar no texto foca o input */
.pq-login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pq-login-label {
  font-size: 13px;
  font-weight: 600;
  color: #444;
}
.pq-login-email,
.pq-login-pass {
  padding: 12px 14px;
  border: 1px solid #dcdcdc;
  border-radius: 10px;
  background: #fafbfc;
  font-size: 14px;
  color: #333;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.pq-login-email::placeholder,
.pq-login-pass::placeholder {
  color: #aaa;
}
.pq-login-email:focus,
.pq-login-pass:focus {
  outline: none;
  border-color: #22aa77;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(34, 170, 119, 0.15);
}
.pq-login-error {
  min-height: 18px;
  font-size: 13px;
  color: #c0392b;
  text-align: center;
}
.pq-login-submit {
  margin-top: 2px;
  padding: 13px 16px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #22aa77, #1f8a63);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(34, 170, 119, 0.3);
  transition: filter 0.15s ease, transform 0.1s ease;
}
.pq-login-submit:hover:not(:disabled) {
  filter: brightness(1.06);
}
.pq-login-submit:active:not(:disabled) {
  transform: translateY(1px);
}
.pq-login-submit:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}
/* botão "Permissões" (pastas): mora na barra lateral e só aparece para admin
   quando há uma pasta aberta */
.pq-crumb-perms {
  display: none;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #22aa77;
  border-radius: 6px;
  background: #fff;
  color: #1f8a63;
  font-weight: 600;
  cursor: pointer;
}
.pq-crumb-perms.is-visible {
  display: block;
}
.pq-crumb-perms:hover {
  background: #22aa77;
  color: #fff;
}
/* modal com as permissões de acesso por pasta */
.pq-perms {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}
.pq-perms.is-visible {
  display: flex;
}
.pq-perms-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 460px;
  max-height: min(80vh, 600px);
  padding: 16px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.pq-perms-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pq-perms-title {
  font-size: 14px;
  font-weight: 700;
  color: #333;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-perms-close {
  flex: none;
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  background: #2b2b2b;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
.pq-perms-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}
/* diálogo próprio (prompt/confirm/alert): substitui os popups nativos do
   navegador, que não seguem a identidade da página */
.pq-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(16, 24, 40, 0.6);
  backdrop-filter: blur(6px);
}
.pq-dialog.is-visible {
  display: flex;
}
.pq-dialog-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 400px;
  padding: 22px 22px 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(16, 24, 40, 0.04);
  animation: pq-login-pop 0.2s ease;
}
.pq-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.pq-dialog-title {
  font-size: 16px;
  font-weight: 700;
  color: #222;
}
.pq-dialog-close {
  flex: none;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: #f2f2f2;
  color: #666;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.pq-dialog-close:hover {
  background: #e6e6e6;
  color: #333;
}
.pq-dialog-msg {
  font-size: 14px;
  line-height: 1.5;
  color: #555;
}
.pq-dialog-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #dcdcdc;
  border-radius: 10px;
  background: #fafbfc;
  font-size: 14px;
  color: #333;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.pq-dialog-input::placeholder {
  color: #aaa;
}
.pq-dialog-input:focus {
  outline: none;
  border-color: #22aa77;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(34, 170, 119, 0.15);
}
.pq-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 2px;
}
.pq-dialog-btn {
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, filter 0.15s ease;
}
.pq-dialog-cancel {
  border-color: #dcdcdc;
  background: #fff;
  color: #444;
}
.pq-dialog-cancel:hover {
  background: #f7f7f7;
}
.pq-dialog-ok {
  background: linear-gradient(135deg, #22aa77, #1f8a63);
  color: #fff;
  box-shadow: 0 8px 18px rgba(34, 170, 119, 0.3);
}
.pq-dialog-ok:hover {
  filter: brightness(1.06);
}
.pq-dialog-ok.is-danger {
  background: linear-gradient(135deg, #e05a4a, #c0392b);
  box-shadow: 0 8px 18px rgba(192, 57, 43, 0.3);
}
/* ---- uso de armazenamento da pasta (barra lateral) ---- */
.pq-storage {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  background: #fff;
}
.pq-storage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #8a8f98;
}
.pq-storage-title {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #333;
}
.pq-storage-free {
  flex: none;
}
.pq-storage-bar {
  height: 6px;
  border-radius: 999px;
  background: #eee;
  overflow: hidden;
}
.pq-storage-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: #22aa77;
  transition: width 0.25s ease, background 0.25s ease;
}
.pq-storage-fill.is-near {
  background: #f0a500;
}
.pq-storage-fill.is-full {
  background: #c0392b;
}
.pq-storage-text {
  font-size: 12px;
  color: #555;
}
/* Em table-layout: fixed as larguras em px não encolhem sozinhas, então em
   telas mais estreitas elas comeriam toda a sobra e a coluna "Nome" ficaria
   com 0px (nome invisível). A cada faixa, a coluna menos essencial sai de
   cena para o nome manter sempre uma largura utilizável. */
@media (max-width: 960px) {
  .pq-col-date,
  .pq-cell-date {
    display: none;
  }
}
@media (max-width: 800px) {
  .pq-col-size,
  .pq-cell-size {
    display: none;
  }
}
@media (max-width: 700px) {
  .pq-col-ext,
  .pq-cell-ext {
    display: none;
  }
}
/* telas estreitas: a barra lateral vira uma faixa no topo */
@media (max-width: 640px) {
  .pq-wrap {
    flex-direction: column;
    padding: 20px 14px 36px;
  }
  .pq-sidebar {
    position: static;
    width: auto;
    align-self: stretch;
  }
}
/* ---- alternância de modo (Arquivos / Bingo) ---- */
.pq-modes {
  display: flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
}
.pq-mode {
  flex: 1;
  padding: 8px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #555;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.pq-mode:hover {
  background: #f2f2f2;
}
.pq-mode.is-active {
  background: #22aa77;
  color: #fff;
}
.pq-mode:disabled,
.pq-mode.is-disabled {
  opacity: 0.5;
  cursor: default;
}
/* overlay exibido enquanto o outro modo (Arquivos/Bingo) é montado */
.pq-mode-loading {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(250, 250, 250, 0.85);
  z-index: 8;
}
.pq-mode-loading.is-visible {
  display: flex;
}
.pq-mode-loading-spinner {
  width: 36px;
  height: 36px;
  box-sizing: border-box;
  border: 3px solid rgba(34, 170, 119, 0.2);
  border-top-color: #22aa77;
  border-radius: 50%;
  animation: pq-spin 0.8s linear infinite;
}
.pq-mode-loading-text {
  font-size: 13px;
  font-weight: 600;
  color: #1f8a63;
}
