:root {
  --pm-bg: #f3f4f6;
  --pm-surface: #ffffff;
  --pm-border: #e5e7eb;
  --pm-text: #111827;
  --pm-text-muted: #6b7280;
  --pm-primary: #22c55e;
  --pm-primary-soft: #dcfce7;
  --pm-danger: #ef4444;
  --pm-radius: 10px;
  --pm-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--pm-bg);
  color: var(--pm-text);
}

/* Header */

.pm-header {
  background: #0f172a;
  color: #e5e7eb;
  padding: 12px 16px;
}

.pm-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.pm-logo {
  font-weight: 700;
  font-size: 20px;
  color: #a5b4fc;
  text-decoration: none;
}

.pm-header-title {
  font-size: 16px;
  margin-top: 4px;
}

.pm-header-subtitle {
  font-size: 13px;
  color: #9ca3af;
}

.pm-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.pm-user-login {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.pm-user-login input {
  width: 90px;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid #4b5563;
  background: #111827;
  color: #e5e7eb;
}

.pm-user-login button {
  padding: 4px 10px;
  border-radius: 999px;
  border: none;
  background: var(--pm-primary);
  color: #052e16;
  font-weight: 500;
  cursor: pointer;
}

/* Status */

.pm-status {
  font-size: 12px;
  min-height: 16px;
}

.pm-status[data-kind="info"] {
  color: #e5e7eb;
}

.pm-status[data-kind="success"] {
  color: #bbf7d0;
}

.pm-status[data-kind="warning"] {
  color: #facc15;
}

.pm-status[data-kind="error"] {
  color: #fecaca;
}

/* Layout principal */

.pm-main {
  max-width: 1100px;
  margin: 0px auto 0px;
  padding: 0 0px;
}

/* Abas */

.pm-tabs {
  max-width: 1100px;
  margin: 8px auto 0;
  padding: 0 12px;
  display: flex;
  gap: 4px;
}

.pm-tab {
  border: 1px solid transparent;
  border-bottom: none;
  padding: 6px 12px;
  border-radius: 10px 10px 0 0;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--pm-text-muted);
}

.pm-tab-active {
  background: var(--pm-surface);
  border-color: var(--pm-border);
  border-bottom-color: var(--pm-surface);
  color: var(--pm-text);
}

/* Seções */

.pm-section {
  margin-top: 0;
  background: var(--pm-surface);
  border-radius: 0 0 var(--pm-radius) var(--pm-radius);
  border: 1px solid var(--pm-border);
  box-shadow: var(--pm-shadow);
  padding: 5px;
}

.pm-section-title {
  margin: 0 0 4px;
  font-size: 18px;
}

.pm-section-subtitle {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--pm-text-muted);
}

.pm-section-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}

.pm-section-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
}

/* Cards */

.pm-card {
  background: var(--pm-surface);
  border-radius: var(--pm-radius);
  border: 1px solid var(--pm-border);
  padding: 12px;
  margin-bottom: 12px;
}

.pm-card-transparent {
  background: transparent;
  border: none;
  box-shadow: none;
}

.pm-card-empty {
  text-align: center;
}

/* Campos */

.pm-field {
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pm-field label {
  font-size: 13px;
}

.pm-field input,
.pm-field textarea,
.pm-field select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--pm-border);
  font-size: 13px;
}

.pm-field small {
  font-size: 11px;
  color: var(--pm-text-muted);
}

.pm-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 12px;
}

.pm-field-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.pm-field-inline select {
  min-width: 120px;
}

/* Botões */

.pm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.pm-btn-primary,
.pm-btn-secondary,
.pm-btn-ghost {
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
}

.pm-btn-primary {
  background: var(--pm-primary);
  border-color: #16a34a;
  color: #052e16;
  font-weight: 500;
}

.pm-btn-secondary {
  background: #e5e7eb;
  color: #111827;
}

.pm-btn-ghost {
  background: transparent;
  border-color: var(--pm-border);
}

.pm-btn-small {
  padding: 4px 10px;
  font-size: 12px;
}

/* Tags / chips */

.pm-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #b02104;
}

.pm-tag-muted {
  background: #f3f4f6;
  color: var(--pm-text-muted);
}

.pm-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--pm-primary-soft);
  margin-right: 4px;
  margin-bottom: 4px;
}

.pm-chips {
  display: flex;
  flex-wrap: wrap;
}

.pm-chip-media {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 2px;
  border-radius: 999px;
  background: var(--pm-primary-soft);
  border: 1px solid rgba(22, 163, 74, 0.25);
}

.pm-chip-thumb {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  display: block;
}

.pm-chip-label {
  font-size: 11px;
}

/* botõezinhos nos CRUD de lista */
.pm-btn-xxs {
  font-size: 11px;
  padding: 2px 6px;
}
.pm-btn-danger {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}
.pm-btn-danger:hover {
  background: #fecaca;
}

/* Lista simples */

.pm-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pm-list-item {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--pm-border);
  font-size: 13px;
}

.pm-list-sub {
  font-size: 11px;
  color: var(--pm-text-muted);
}

/* Produtos */

.pm-products-toolbar,
.pm-products-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.pm-product-card {
  border-radius: 10px;
  border: 1px solid var(--pm-border);
  padding: 8px;
  margin-bottom: 8px;
}

.pm-product-card-inner {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
}

.pm-product-thumb {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pm-product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pm-product-thumb-placeholder {
  font-size: 10px;
  color: var(--pm-text-muted);
  text-align: center;
  padding: 4px;
}

.pm-product-thumb-main {
  flex: 1;
}

.pm-product-thumb-main img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.pm-product-thumb-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 2px;
  background: #f3f4f6;
}

.pm-product-thumb-strip-item {
  border-radius: 4px;
  overflow: hidden;
}

.pm-product-thumb-strip-item img {
  width: 100%;
  height: 32px;
  object-fit: cover;
  display: block;
}


.pm-product-info {
  font-size: 13px;
}

.pm-product-title-line {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: baseline;
}

.pm-product-sub {
  font-size: 11px;
  color: var(--pm-text-muted);
  margin-top: 2px;
}

.pm-product-desc {
  margin-top: 4px;
  font-size: 12px;
}

.pm-product-actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
}

/* Subabas */

.pm-subtabs {
  margin-bottom: 8px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.pm-subtab {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 4px 10px;
  font-size: 12px;
  background: #e5e7eb;
  cursor: pointer;
}

.pm-subtab-active {
  background: var(--pm-primary-soft);
  border-color: var(--pm-primary);
}

/* Footer */

.pm-footer {
  text-align: center;
  font-size: 12px;
  color: var(--pm-text-muted);
  margin: 24px 0 12px;
}

/* Modal */

.pm-modal[hidden] {
  display: none;
}

.pm-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.pm-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
}

.pm-modal-dialog {
  position: relative;
  max-width: 900px;
  margin: 40px 8px;
  background: #ffffff;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--pm-border);
  max-height: calc(100vh - 80px);
  overflow: auto;
}

.pm-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* modal detalhes de mídia */
.pm-media-details-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 12px;
}
.pm-media-details-main img {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  display: block;
  border-radius: 12px;
}
.pm-media-details-placeholder {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e5e7eb;
  border-radius: 12px;
}
.pm-media-details-meta > div {
  font-size: 13px;
  margin-bottom: 4px;
}

.pm-media-preview {
  margin-top: 8px;
  font-size: 12px;
}

.pm-media-preview img {
  display: block;
  margin-top: 4px;
  max-width: 140px;
  max-height: 140px;
  border-radius: 6px;
  object-fit: cover;
}

.hidden {
  display: none !important;
}

.pm-media-item-actions {
  margin-top: 4px;
  font-size: 11px;
}

.pm-media-item-actions button {
  font-size: 11px;
  padding: 2px 6px;
  margin-right: 4px;
  cursor: pointer;
}

.pm-input-disabled {
  opacity: 0.4;
  pointer-events: none;
}


.pm-media-input {
  position: relative;
  display: inline-flex;
  flex-direction: column;   /* 👈 imagem em cima, texto embaixo */
  align-items: center;      /* 👈 centraliza horizontal */
  text-align: center;       /* 👈 texto centralizado */
  gap: 6px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #e0ffe0;
  cursor: pointer;
  overflow: hidden;
}

/* Esconde o input real, o label vira o "botão" */
.pm-media-input > input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Ajustes visuais internos */
.pm-media-input-row .pm-media-input input[type="file"] {
  display: block;
}

/* Ícone alinhado */
.pm-media-input-icon {
  width: 22px;
  height: 22px;
  margin-right: 6px;
}

.pm-media-input-label {
  display: block;
  margin-bottom: 4px;
}

.pm-media-input-text {
  font-size: 13px;
  color: #111827;
  line-height: 1.3;
}

/* já existia, mas reforçando para o caso da câmera desativada */
.pm-input-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Linha dos inputs sempre em linha, mesmo no mobile */
.pm-media-input-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  width: 100%;
}

/* Cada botão ocupa 50% da largura */
.pm-media-input-row .pm-media-input {
  flex: 0 0 50%;
  max-width: 50%;
}


/* Texto embaixo centralizado */
.pm-media-input-row .pm-media-input > span:first-child {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
}

.pm-media-input-row .pm-media-input .small {
  font-size: 11px;
  color: var(--pm-text-muted, #6b7280);
}


/* Em telas muito pequenas manter 50/50 */
@media (max-width: 480px) {
  .pm-media-input-row {
    flex-wrap: nowrap;
  }

  .pm-media-input-row .pm-media-input {
    flex: 0 0 50%;
  }

}


/* Cabeçalho da prévia (título + "Limpar todas") */
.pm-media-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

/* Grid das miniaturas da prévia */
.pm-media-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Cada item da prévia */
.pm-media-preview-item {
  width: 110px;
  font-size: 11px;
  border: 1px solid #d1d5db;  /* <<< adicionado */
  border-radius: 8px;         /* <<< combina com layout */
  padding: 4px;               /* <<< leve compensação */
}


/* Thumb com posição relativa para o botão "X" */
.pm-media-preview-thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
}

/* Imagem dentro da thumb */
.pm-media-preview-thumb img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
}

/* Botão de remoção individual no canto superior direito */
.pm-media-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  padding: 0;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
}

/* Metadados (nome + tamanho) embaixo da imagem */
.pm-media-preview-meta {
  margin-top: 4px;
  font-size: 11px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; /* máximo de 2 linhas */
  line-clamp: 2;         /* padrão */
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}
/* Nome do arquivo na prévia (mantém até 2 linhas, com "..." no final) */
.pm-media-preview-meta div:first-child {
  display: -webkit-box;
  -webkit-line-clamp: 2;   /* máximo 2 linhas */
  line-clamp: 2;           /* padrão */
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}



/* Modal de zoom fullscreen (lupa) */
.pm-modal-zoom {
  z-index: 50;
}

.pm-modal-zoom .pm-modal-backdrop {
  background: rgba(0, 0, 0, 0.9);
}

/* Conteúdo centralizado com a imagem */
.pm-media-zoom-content {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pm-media-zoom-content img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

/* Botão X no canto superior direito */
.pm-media-zoom-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  border: none;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 16px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.85);
  color: #f9fafb;
}

.pm-media-zoom-close:hover {
  background: rgba(34, 197, 94, 0.9);
}


.pm-help-btn {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: none;
  background: #e5e7eb;
  cursor: pointer;
  font-weight: bold;
  font-size: 13px;
}

.pm-help-btn:hover {
  background: #d1d5db;
}
