/* ======================================================= */
/* DESIGN SYSTEM: PRODUTOS (HIGH-DENSITY UI SAAS)          */
/* ======================================================= */

.produto-content {
  margin-left: 202px;
  margin-top: 60px; /* Mantém a compensação exata do header (60px) */
  padding: 20px;
  height: calc(100vh - 43px); /* Ajustado para remover a sobra inferior */
  background: var(--body-color);
  transition: margin-left 0.4s ease, background-color 0.4s ease;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden; /* Desktop NÃO ROLA A PÁGINA, só a tabela rola */
}

.sidebar.collapsed+.top-header+.produto-content {
  margin-left: 60px;
}

/* ======================================================= */
/* CABEÇALHO PADRÃO                                        */
/* ======================================================= */
.cabecalho-produtos {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 15px;
}

.consulta-title-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
}

.consulta-title-group h1 {
  margin: 0;
  font-size: 2.2rem;
  color: #64748b;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1;
  transition: color 0.4s ease;
}

.consulta-title-group h1 i {
  color: var(--primary-color);
}

.consulta-title-group p {
  margin: 0;
  color: #94a3b8;
  font-size: 1.05rem;
  font-weight: 500;
  border-left: 2px solid #cbd5e1;
  padding-left: 15px;
  line-height: 1.2;
  transition: color 0.4s ease, border-color 0.4s ease;
}

/* ======================================================= */
/* BOTÕES SUPERIORES                                       */
/* ======================================================= */
.novo-produto {
  padding: 0 20px;
  height: 36px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(96, 197, 163, 0.2);
}

.novo-produto:hover {
  background: var(--primary-color-light);
  color: var(--primary-color);
  transform: translateY(-1px);
}

/* ======================================================= */
/* BARRA BÁSICA DE FILTROS                                 */
/* ======================================================= */
.filtro-pesquisa-basica {
  background: var(--card-bg);
  padding: 10px 15px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  flex-shrink: 0;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.filtros-basicos-linha {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
  flex-wrap: wrap;
}

.filtro-item-tipo {
  width: 180px;
  flex-shrink: 0;
}

.filtro-item-busca {
  flex: 1;
  min-width: 200px;
}

.hide-mobile-text span {
  display: inline;
}

.filtros-basicos-linha .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.filtros-basicos-linha label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--subtitle-color);
  text-transform: uppercase;
  transition: color 0.4s ease;
}

.filtros-basicos-linha input[type="text"],
.filtros-basicos-linha select {
  padding: 0 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--title-color);
  outline: none;
  background-color: var(--input-bg);
  height: 34px;
  box-sizing: border-box;
  transition: 0.2s, background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.filtros-basicos-linha input[type="text"]:focus,
.filtros-basicos-linha select:focus {
  border-color: var(--primary-color);
}

.checkboxes-basicos {
  display: flex;
  gap: 15px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.checkbox-moderno {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-color);
  font-size: 0.8rem;
  font-weight: 600;
  user-select: none;
  transition: color 0.4s ease;
}

.checkbox-moderno input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ======================================================= */
/* AGRUPAMENTO DOS BOTÕES DE PESQUISA                      */
/* ======================================================= */
.filtro-botoes-container {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-end;
}

.btn-abrir-filtros {
  padding: 0 15px;
  height: 34px;
  background: var(--input-bg);
  color: var(--subtitle-color);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-abrir-filtros:hover {
  background: var(--table-header-bg);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-pesquisar {
  padding: 0 20px;
  height: 34px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(96, 197, 163, 0.2);
  flex-shrink: 0;
}

.btn-pesquisar:hover {
  background: var(--primary-color-light);
  color: var(--primary-color);
  transform: translateY(-1px);
}

/* ======================================================= */
/* DRAWER LATERAL (FILTROS AVANÇADOS)                      */
/* ======================================================= */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  z-index: 10400;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.drawer-overlay.active {
  display: block;
  opacity: 1;
}

.drawer-lateral {
  position: fixed;
  top: 0;
  right: -400px;
  width: 280px;
  height: 100vh;
  background: var(--card-bg);
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
  z-index: 10500;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.drawer-lateral.open {
  right: 0;
}

.drawer-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--table-header-bg);
}

.drawer-header h3 {
  margin: 0;
  color: var(--title-color);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-fechar-drawer {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--subtitle-color);
  cursor: pointer;
}

.btn-fechar-drawer:hover {
  color: #ef4444;
}

.drawer-body {
  padding: 15px 20px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group-drawer {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group-drawer label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--subtitle-color);
}

.form-group-drawer input,
.form-group-drawer select {
  padding: 0 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--title-color);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  background: var(--input-bg);
  height: 34px;
}

.drawer-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--card-bg);
}

/* ======================================================= */
/* TABELA CONTAINER E SCROLL                               */
/* ======================================================= */
.tabela-container {
  background: var(--card-bg);
  padding: 0;
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  width: 100%;
}

.tabela-container::-webkit-scrollbar,
.modal-body-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.tabela-container::-webkit-scrollbar-track,
.modal-body-scroll::-webkit-scrollbar-track {
  background: var(--body-color);
  border-radius: 6px;
}

.tabela-container::-webkit-scrollbar-thumb,
.modal-body-scroll::-webkit-scrollbar-thumb {
  background: var(--input-border);
  border-radius: 6px;
}

.tabela-container::-webkit-scrollbar-thumb:hover,
.modal-body-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--subtitle-color);
}

/* ======================================================= */
/* TABELA PRINCIPAL E AÇÕES                                */
/* ======================================================= */
.tabela-grid-moderna {
  width: 100%;
  border-collapse: collapse;
}


.tabela-grid-moderna th {
  position: sticky;
  top: 0;
  background-color: var(--table-header-bg);
  padding: 10px 10px; /* Padding Reduzido */
  text-align: left;
  border-bottom: 2px solid var(--table-border);
  font-weight: 700;
  color: var(--subtitle-color);
  text-transform: uppercase;
  font-size: 0.75rem; /* Fonte Menor */
  letter-spacing: 0.5px;
  z-index: 10;
  white-space: nowrap;
}

.tabela-grid-moderna td {
  padding: 8px 10px; /* Padding Reduzido */
  border-bottom: 1px solid var(--table-border);
  color: var(--text-color);
  vertical-align: middle;
  font-size: 0.85rem; /* Fonte Menor */
}

.tabela-grid-moderna tbody tr:hover td {
  background-color: var(--table-header-bg);
}

.tabela-grid-moderna th[onclick] {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.tabela-grid-moderna th[onclick]:hover {
    background-color: var(--table-border, #f1f5f9);
}

.acoes-prod {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.acoes-prod button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background-color: var(--input-bg);
}

.btn-acao-ver {
  color: #3b82f6;
}

.btn-acao-ver:hover {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  transform: translateY(-2px);
}

.btn-acao-editar {
  color: #f59e0b;
}

.btn-acao-editar:hover {
  background-color: #fffbeb;
  border-color: #fde68a;
  transform: translateY(-2px);
}

.btn-acao-excluir {
  color: #ef4444;
}

.btn-acao-excluir:hover {
  background-color: #fef2f2;
  border-color: #fecaca;
  transform: translateY(-2px);
}

.btn-acao-ativar {
  color: var(--primary-color);
}

.btn-acao-ativar:hover {
  background-color: #ecfdf5;
  border-color: #a7f3d0;
  transform: translateY(-2px);
}

/* ======================================================= */
/* MODAIS E POPUPS (HIGH-DENSITY)                          */
/* ======================================================= */
.popup {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(15, 23, 42, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 999999 !important;
  backdrop-filter: blur(4px);
}

.popup-content {
  background: var(--card-bg);
  padding: 20px 25px;
  border-radius: 6px;
  width: 95%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.popup-content-large {
  background-color: var(--body-color);
  max-width: 1100px;
  width: 95%;
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border-radius: 6px;
}

.popup-header-loja {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.popup-header-loja h2 {
  margin: 0;
  color: var(--title-color);
  font-size: 1.3rem;
}

.fechar-popup,
.btn-fechar-moderno {
  background: #fef2f2 !important;
  color: #ef4444 !important;
  border: 1px solid #fecaca !important;
  border-radius: 6px !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  cursor: pointer !important;
  font-size: 1.1rem !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

.fechar-popup:hover,
.btn-fechar-moderno:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
}

/* Timeline Modern */
.linha-do-tempo {
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
  gap: 80px;
}

.etapa {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--subtitle-color);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.2s;
}

.etapa:hover {
  color: var(--primary-color);
  transform: translateY(-2px);
}

.etapa span {
  width: 28px;
  height: 28px;
  background: var(--table-header-bg);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  font-weight: 700;
  transition: 0.3s;
}

.etapa.etapa-ativa {
  color: var(--primary-color);
}

.etapa.etapa-ativa span {
  background: var(--primary-color);
  color: white;
}

/* GRID E CAMPOS (HIGH DENSITY) */
.form-grid-loja {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
}

.col-span-2 {
  grid-column: span 2;
}

.col-span-3 {
  grid-column: span 3;
}

.col-span-4 {
  grid-column: span 4;
}

.col-span-5 {
  grid-column: span 5;
}

.col-span-6 {
  grid-column: span 6;
}

.col-span-8 {
  grid-column: span 8;
}

.col-span-9 {
  grid-column: span 9;
}

.col-span-12 {
  grid-column: span 12;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--subtitle-color);
  margin-bottom: 4px;
}

.form-group label .req {
  color: #ef4444;
}

.form-group input,
.form-group select,
.select-customizado {
  width: 100%;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  outline: none;
  color: var(--title-color);
  background: var(--input-bg);
  height: 34px !important;
  font-size: 0.85rem;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-color);
}

/* AGRUPAMENTO SELECT + BOTÃO (34px) */
.input-group-modern {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  height: 34px !important;
}

.input-group-modern select,
.input-group-modern input,
.input-group-modern .dropdown-customizado {
  flex: 1;
  min-width: 0;
  margin: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.input-group-modern .btn-add-inline {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--primary-color);
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  box-sizing: border-box;
  height: 34px !important;
}

.input-group-modern .btn-add-inline:hover {
  filter: brightness(1.1);
}

.input-group-modern .dropdown-customizado .dropdown-trigger {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-right: none !important;
  height: 100%;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-link:hover {
  filter: brightness(1.1);
  text-decoration: underline;
}

/* Image Upload Area */
.image-upload-area {
  width: 100%;
  aspect-ratio: 1;
  border: 2px dashed var(--input-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--table-header-bg);
  position: relative;
  overflow: hidden;
}

.image-upload-area:hover {
  border-color: var(--primary-color);
}

.placeholder-img {
  text-align: center;
  color: var(--subtitle-color);
  font-size: 0.85rem;
  font-weight: 500;
}

.placeholder-img i {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--input-border);
}

.image-upload-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Switch Moderno */
.switch-container-modern {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--input-border);
  transition: 0.4s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--primary-color);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* Variações Box */
.box-gerador-matriz {
  background: var(--card-bg);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  margin-bottom: 10px;
}

.btn-gerar {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  width: 100%;
  height: 34px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-gerar:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ======================================================= */
/* INPUTS DA TABELA DE VARIAÇÕES                           */
/* ======================================================= */
.tabela-variacoes-input {
  width: 100%;
  padding: 0 6px !important;
  font-size: 0.8rem !important;
  height: 28px !important;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--title-color);
  box-sizing: border-box;
}

.tabela-variacoes-input:focus {
  border-color: var(--primary-color);
  outline: none;
}

.tabela-variacoes-input.var-sku {
  min-width: 120px !important;
  letter-spacing: 0px !important;
}

.tabela-variacoes-input.var-ean {
  min-width: 100px !important;
}

.tabela-variacoes-input.var-cod-secundario {
  min-width: 80px !important;
}

.tabela-variacoes-input.input-moeda {
  min-width: 80px !important;
  text-align: right;
}

#formEtapa2 .tabela-grid-moderna th,
#formEtapa2 .tabela-grid-moderna td {
  padding: 6px 4px !important;
  font-size: 0.8rem !important;
}

.btn-img-variacao,
.btn-remover-variacao {
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.btn-remover-variacao {
  background: #fee2e2;
  color: #ef4444;
}

.btn-remover-variacao:hover {
  background: #ef4444;
  color: #ffffff;
}

.badge-tamanho {
  background: var(--primary-color);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
}

.badge-tamanho i {
  cursor: pointer;
  transition: 0.2s;
}

.badge-tamanho i:hover {
  color: #fee2e2;
}

/* Botões Padrão Premium */
.btn-cancelar-outline,
.btn-avancar-primary {
  height: 34px;
  padding: 0 20px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-cancelar-outline {
  background: transparent;
  color: var(--subtitle-color);
  border: 1px solid var(--input-border);
}

.btn-cancelar-outline:hover {
  background: var(--table-header-bg);
  color: var(--title-color);
  border-color: var(--subtitle-color);
}

.btn-avancar-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-avancar-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* =================================================== */
/* ABAS E MODAL DE CONSULTA                            */
/* =================================================== */
.aba-btn {
  background: transparent;
  border: none;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--subtitle-color);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px 8px 0 0;
}

.aba-btn:hover {
  color: var(--primary-color);
  background-color: var(--table-header-bg);
}

.aba-btn.ativo {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background-color: var(--card-bg);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.02);
}

.modal-card-conteudo {
  background: var(--card-bg);
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--card-border);
  overflow: hidden;
  padding: 15px;
}

/* =================================================== */
/* LISTA INTERATIVA DE CORES (ETAPA 2)                 */
/* =================================================== */
.item-lista-cor {
  background-color: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  padding: 4px 8px !important;
}

.item-lista-cor span {
  color: var(--title-color) !important;
}

.item-lista-cor:hover {
  border-color: var(--subtitle-color) !important;
  background: var(--table-header-bg) !important;
}

.checkbox-cor-matriz {
  display: none;
}

/* FOOTER DA TABELA (PAGINAÇÃO) */
.tabela-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 15px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  margin-top: 10px;
}

.tabela-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--subtitle-color);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.select-limite {
  padding: 0 10px !important;
  height: 28px !important;
  width: auto !important;
  font-size: 0.75rem !important;
  border-radius: 4px !important;
}

.paginacao {
  display: flex;
  gap: 5px;
}

.btn-page {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  color: var(--subtitle-color);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
  font-weight: 700;
  font-size: 0.8rem;
}

.btn-page:hover:not(:disabled) {
  background: var(--table-header-bg);
  color: var(--title-color);
  border-color: var(--subtitle-color);
}

.btn-page.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-page:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.drag-handle {
  color: #cbd5e1;
  cursor: grab;
  font-size: 1rem;
  transition: color 0.2s;
}

.drag-handle:hover {
  color: var(--primary-color);
}

.tr-dragging {
  opacity: 0.6;
  background-color: var(--table-header-bg) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.hover-text-primary:hover {
  color: var(--primary-color) !important;
}

.modal-footer-botoes {
  background: var(--card-bg);
  padding: 12px 20px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}

.modal-footer-botoes .footer-right {
  display: flex;
  gap: 10px;
}

/* ======================================================================= */
/* DESKTOP: ALTURA DINÂMICA E BLINDAGEM DO FLEXBOX                         */
/* ======================================================================= */
.layout-etapa2 {
  align-items: stretch !important;
  height: calc(100vh - 290px) !important;
  min-height: 280px !important;
}

.box-etapa-2-left,
.box-etapa-2-right {
  height: 100% !important;
  display: flex;
  flex-direction: column;
  min-height: 0 !important;
}

.compact-box {
  padding: 12px !important;
  height: 100% !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0 !important;
}

.compact-cores {
  max-height: none !important;
  flex: 1;
  overflow-y: auto;
  min-height: 0 !important;
}

.compact-table {
  height: 100% !important;
  max-height: none !important;
  flex: 1;
  overflow: auto;
  min-height: 0 !important;
}

.box-etapa-3 {
  padding: 12px !important;
}

#popupProduto .popup-content-large>div:first-child {
  border-top-left-radius: 8px !important;
  border-top-right-radius: 8px !important;
}

#popupProduto .modal-footer-botoes {
  border-bottom-left-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
}

/* ======================================================================= */
/* MOTOR DE RESPONSIVIDADE EXTREMA (MOBILE E TABLETS)                      */
/* ======================================================================= */
@media (max-width: 1024px) {

  /* Libera o scroll global no mobile se a classe no-scroll estiver no body */
  body.no-scroll {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  /* Altera a estrutura do painel principal para permitir o scroll total da tela */
  .produto-content {
    margin-left: 0 !important;
    padding: 80px 15px 15px 15px !important;
    /* Padding reduzido para grudar a paginação no fundo */
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
  }

  #sidebar-container:has(.sidebar.collapsed)~.produto-content {
    margin-left: 0 !important;
  }

  /* Impede que a tabela tente rolar internamente e trave a tela no mobile */
  .tabela-container {
    flex: none !important;
    height: auto !important;
    overflow-y: visible !important;
  }

  /* Garante que a paginação fique absolutamente colada ao final sem deixar espaço cinza sobrando */
  .tabela-footer {
    margin-top: auto !important;
    margin-bottom: 0 !important;
  }

  /* Layout Etapa 2 do Modal (Empilha) */
  .layout-etapa2 {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    gap: 10px;
  }

  .box-etapa-2-left,
  .box-etapa-2-right {
    width: 100% !important;
    height: auto !important;
  }

  .compact-box {
    height: auto !important;
    flex: none !important;
  }

  .compact-cores {
    max-height: 200px !important;
  }

  .compact-table {
    height: auto !important;
    flex: none !important;
    max-height: 400px !important;
  }
}

@media (max-width: 768px) {

  /* 1. Modal: Quebra as colunas para 100% de largura */
  .col-span-2,
  .col-span-3,
  .col-span-4,
  .col-span-5,
  .col-span-6,
  .col-span-7,
  .col-span-8,
  .col-span-9 {
    grid-column: span 12 !important;
  }

  .form-grid-loja {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
  }

  /* 2. Cabeçalho Principal */
  .cabecalho-produtos {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .consulta-title-group {
    flex-direction: column;
    align-items: center !important;
    gap: 8px;
    text-align: center !important;
    width: 100%;
  }

  .consulta-title-group h1 {
    justify-content: center !important;
    width: 100%;
    font-size: 1.8rem;
  }

  .consulta-title-group p {
    border-left: none !important;
    padding-left: 0 !important;
    text-align: center !important;
  }

  .novo-produto {
    width: 100%;
    justify-content: center;
    height: 42px;
  }

  /* 3. Barra de Pesquisa */
  .filtro-pesquisa-basica {
    padding: 15px;
  }

  .filtros-basicos-linha {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px;
  }

  .filtro-item-tipo,
  .filtro-item-busca {
    width: 100% !important;
  }

  /* Botões de Pesquisa (Dividem a tela Lado a Lado no Celular) */
  .filtro-botoes-container {
    width: 100%;
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
    margin-top: 5px;
  }

  .btn-abrir-filtros,
  .btn-pesquisar {
    flex: 1;
    /* Divide o espaço meio a meio */
    width: auto !important;
    justify-content: center;
    height: 40px;
  }

  .checkboxes-basicos {
    align-self: flex-start;
    margin-top: 5px;
    margin-bottom: 0;
  }

  /* 4. Layout do Modal no Celular */
  .popup-content-large {
    max-height: 92vh !important;
    margin: auto;
    border-radius: 6px;
    width: 95% !important;
  }

  .linha-do-tempo {
    gap: 5px !important;
    width: 100%;
    justify-content: space-between;
    margin-bottom: 0 !important;
  }

  .etapa {
    flex: 1;
    font-size: 0.70rem !important;
  }

  .modal-body-scroll {
    padding: 15px !important;
  }

  /* 5. Botões de Rodapé (Footer do Modal) */
  .modal-footer-botoes {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }

  .modal-footer-botoes>div {
    width: 100%;
    display: flex;
    gap: 10px;
  }

  .modal-footer-botoes button {
    flex: 1;
    justify-content: center;
    height: 40px;
  }

  /* 6. Libera as Tabelas para Scroll Horizontal via Toque */
  .tabela-container {
    overflow-x: auto !important;
    width: 100% !important;
    -webkit-overflow-scrolling: touch;
    overflow-y: hidden !important;
  }

  .tabela-grid-moderna {
    min-width: 800px;
  }

  #tabelaVariacoes {
    min-width: 900px;
  }

  /* ======================================================= */
  /* RODAPÉ E PAGINAÇÃO MOBILE (Minimalista e Responsivo)    */
  /* ======================================================= */
  .tabela-footer { 
    flex-direction: column !important; 
    gap: 10px !important; 
    padding: 10px !important; 
    align-items: center !important; 
  }
  
  .tabela-footer-left { 
    width: 100% !important; 
    justify-content: center !important; 
    flex-wrap: wrap !important; 
    gap: 5px !important;
  }
  
  .tabela-footer-right { 
    width: 100% !important; 
    display: flex !important; 
    justify-content: center !important; 
  }
  
  .paginacao { 
    flex-wrap: wrap !important; 
    justify-content: center !important; 
    gap: 4px !important; 
  }

  .btn-page {
    padding: 6px 12px !important; 
    font-size: 0.8rem !important;
  }
}

/* ======================================================= */
/* BLINDAGEM MODO ESCURO                                   */
/* ======================================================= */
[data-theme="dark"] .box-gerador-matriz,
[data-theme="dark"] .etapa-form-prod div[style*="background: #ffffff"],
[data-theme="dark"] .popup-content-large>div[style*="background: white"],
[data-theme="dark"] .form-buttons-modern[style*="background: white"] {
  background-color: var(--card-bg) !important;
  border-color: var(--card-border) !important;
}

[data-theme="dark"] .consulta-title-group h1 {
  color: var(--title-color) !important;
}

[data-theme="dark"] .etapa-form-prod label,
[data-theme="dark"] .box-gerador-matriz h4,
[data-theme="dark"] .etapa-form-prod h4[style*="color: #475569"] {
  color: var(--subtitle-color) !important;
}

[data-theme="dark"] .etapa-form-prod h4[style*="color: var(--primary-color)"] {
  color: var(--primary-color) !important;
}

[data-theme="dark"] .image-upload-area {
  background-color: var(--table-header-bg) !important;
  border-color: var(--card-border) !important;
}

[data-theme="dark"] .placeholder-img,
[data-theme="dark"] .placeholder-img i {
  color: var(--subtitle-color) !important;
}

[data-theme="dark"] input#prodPrecoVenda[style*="background: #f0fdf4"] {
  background-color: rgba(105, 190, 157, 0.1) !important;
  border-color: var(--primary-color) !important;
  color: var(--primary-color) !important;
}

[data-theme="dark"] .popup-content-large[style*="background-color: #f1f5f9"] {
  background-color: var(--body-color) !important;
}

[data-theme="dark"] .popup-content[style*="background-color: #ffffff"] {
  background-color: var(--card-bg) !important;
}

[data-theme="dark"] .modal-card-conteudo div[style*="background: #f8fafc"] {
  background-color: var(--table-header-bg) !important;
  border-color: var(--card-border) !important;
}

[data-theme="dark"] h2[style*="color: #1e293b"],
[data-theme="dark"] h3[style*="color: #334155"],
[data-theme="dark"] span[style*="color: #334155"],
[data-theme="dark"] td[style*="color: #334155"] {
  color: var(--title-color) !important;
}

[data-theme="dark"] p[style*="color: #64748b"],
[data-theme="dark"] span[style*="color: #64748b"],
[data-theme="dark"] td[style*="color: #64748b"] {
  color: var(--subtitle-color) !important;
}

[data-theme="dark"] input[style*="background: #f1f5f9"],
[data-theme="dark"] input[readonly],
[data-theme="dark"] input:disabled {
  background-color: var(--table-header-bg) !important;
  color: var(--subtitle-color) !important;
  border-color: var(--card-border) !important;
}

[data-theme="dark"] .fechar-popup,
[data-theme="dark"] .btn-fechar-moderno {
  background-color: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}
/* ======================================================= */
/* DESIGN SYSTEM: PRODUTOS (HIGH-DENSITY UI SAAS)          */
/* ======================================================= */

.produto-content {
  margin-left: 202px;
  margin-top: 60px;
  padding: 20px;
  height: calc(101vh - 50px);
  background: var(--body-color);
  transition: margin-left 0.4s ease;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.sidebar.collapsed+.top-header+.produto-content {
  margin-left: 60px;
}

/* ======================================================= */
/* CABEÇALHO PADRÃO                                        */
/* ======================================================= */
.cabecalho-produtos {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 15px;
}

.consulta-title-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
}

.consulta-title-group h1 {
  margin: 0;
  font-size: 2.2rem;
  color: #64748b;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 12px;
  line-height: 1;
  transition: color 0.4s ease;
}

.consulta-title-group h1 i {
  color: var(--primary-color);
}

.consulta-title-group p {
  margin: 0;
  color: #94a3b8;
  font-size: 1.05rem;
  font-weight: 500;
  border-left: 2px solid #cbd5e1;
  padding-left: 15px;
  line-height: 1.2;
  transition: color 0.4s ease, border-color 0.4s ease;
}

/* ======================================================= */
/* BOTÕES SUPERIORES                                       */
/* ======================================================= */
.novo-produto {
  padding: 0 20px;
  height: 36px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(96, 197, 163, 0.2);
}

.novo-produto:hover {
  background: var(--primary-color-light);
  color: var(--primary-color);
  transform: translateY(-1px);
}

/* ======================================================= */
/* BARRA BÁSICA DE FILTROS                                 */
/* ======================================================= */
.filtro-pesquisa-basica {
  background: var(--card-bg);
  padding: 10px 15px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  flex-shrink: 0;
  transition: background-color 0.4s ease, border-color 0.4s ease;
}

.filtros-basicos-linha {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
  flex-wrap: wrap;
}

.filtro-item-tipo {
  width: 180px;
  flex-shrink: 0;
}

.filtro-item-busca {
  flex: 1;
  min-width: 200px;
}

.hide-mobile-text span {
  display: inline;
}

.filtros-basicos-linha .form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
}

.filtros-basicos-linha label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--subtitle-color);
  text-transform: uppercase;
  transition: color 0.4s ease;
}

.filtros-basicos-linha input[type="text"],
.filtros-basicos-linha select {
  padding: 0 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--title-color);
  outline: none;
  background-color: var(--input-bg);
  height: 34px;
  box-sizing: border-box;
  transition: 0.2s, background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease;
}

.filtros-basicos-linha input[type="text"]:focus,
.filtros-basicos-linha select:focus {
  border-color: var(--primary-color);
}

.checkboxes-basicos {
  display: flex;
  gap: 15px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.checkbox-moderno {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--text-color);
  font-size: 0.8rem;
  font-weight: 600;
  user-select: none;
  transition: color 0.4s ease;
}

.checkbox-moderno input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* ======================================================= */
/* AGRUPAMENTO DOS BOTÕES DE PESQUISA                      */
/* ======================================================= */
.filtro-botoes-container {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-end;
}

.btn-abrir-filtros {
  padding: 0 15px;
  height: 34px;
  background: var(--input-bg);
  color: var(--subtitle-color);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-abrir-filtros:hover {
  background: var(--table-header-bg);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-pesquisar {
  padding: 0 20px;
  height: 34px;
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.85rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(96, 197, 163, 0.2);
  flex-shrink: 0;
}

.btn-pesquisar:hover {
  background: var(--primary-color-light);
  color: var(--primary-color);
  transform: translateY(-1px);
}

/* ======================================================= */
/* DRAWER LATERAL (FILTROS AVANÇADOS)                      */
/* ======================================================= */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.4);
  z-index: 10400;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  backdrop-filter: blur(2px);
}

.drawer-overlay.active {
  display: block;
  opacity: 1;
}

.drawer-lateral {
  position: fixed;
  top: 0;
  right: -400px;
  width: 280px;
  height: 100vh;
  background: var(--card-bg);
  box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
  z-index: 10500;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.drawer-lateral.open {
  right: 0;
}

.drawer-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--table-header-bg);
}

.drawer-header h3 {
  margin: 0;
  color: var(--title-color);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-fechar-drawer {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--subtitle-color);
  cursor: pointer;
}

.btn-fechar-drawer:hover {
  color: #ef4444;
}

.drawer-body {
  padding: 15px 20px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-group-drawer {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group-drawer label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--subtitle-color);
}

.form-group-drawer input,
.form-group-drawer select {
  padding: 0 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--title-color);
  outline: none;
  width: 100%;
  box-sizing: border-box;
  background: var(--input-bg);
  height: 34px;
}

.drawer-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--card-bg);
}

/* ======================================================= */
/* TABELA CONTAINER E SCROLL                               */
/* ======================================================= */
.tabela-container {
  background: var(--card-bg);
  padding: 0;
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  flex: 1;
  overflow-y: auto;
  overflow-x: auto;
  border: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  width: 100%;
}

.tabela-container::-webkit-scrollbar,
.modal-body-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.tabela-container::-webkit-scrollbar-track,
.modal-body-scroll::-webkit-scrollbar-track {
  background: var(--body-color);
  border-radius: 6px;
}

.tabela-container::-webkit-scrollbar-thumb,
.modal-body-scroll::-webkit-scrollbar-thumb {
  background: var(--input-border);
  border-radius: 6px;
}

.tabela-container::-webkit-scrollbar-thumb:hover,
.modal-body-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--subtitle-color);
}

/* ======================================================= */
/* TABELA PRINCIPAL E AÇÕES                                */
/* ======================================================= */
.tabela-grid-moderna {
  width: 100%;
  border-collapse: collapse;
}

.tabela-grid-moderna th {
  position: sticky;
  top: 0;
  background-color: var(--table-header-bg);
  padding: 12px 15px;
  text-align: left;
  border-bottom: 2px solid var(--table-border);
  font-weight: 700;
  color: var(--subtitle-color);
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  z-index: 10;
  white-space: nowrap;
}

.tabela-grid-moderna td {
  padding: 10px 15px;
  border-bottom: 1px solid var(--table-border);
  color: var(--text-color);
  vertical-align: middle;
  font-size: 0.9rem;
}

.tabela-grid-moderna tbody tr:hover td {
  background-color: var(--table-header-bg);
}

.acoes-prod {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.acoes-prod button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  background-color: var(--input-bg);
}

.btn-acao-ver {
  color: #3b82f6;
}

.btn-acao-ver:hover {
  background-color: #eff6ff;
  border-color: #bfdbfe;
  transform: translateY(-2px);
}

.btn-acao-editar {
  color: #f59e0b;
}

.btn-acao-editar:hover {
  background-color: #fffbeb;
  border-color: #fde68a;
  transform: translateY(-2px);
}

.btn-acao-excluir {
  color: #ef4444;
}

.btn-acao-excluir:hover {
  background-color: #fef2f2;
  border-color: #fecaca;
  transform: translateY(-2px);
}

.btn-acao-ativar {
  color: var(--primary-color);
}

.btn-acao-ativar:hover {
  background-color: #ecfdf5;
  border-color: #a7f3d0;
  transform: translateY(-2px);
}

/* ======================================================= */
/* MODAIS E POPUPS (HIGH-DENSITY)                          */
/* ======================================================= */
.popup {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background: rgba(15, 23, 42, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 999999 !important;
  backdrop-filter: blur(4px);
}

.popup-content {
  background: var(--card-bg);
  padding: 20px 25px;
  border-radius: 6px;
  width: 95%;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
}

.popup-content-large {
  background-color: var(--body-color);
  max-width: 1100px;
  width: 95%;
  max-height: 96vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border-radius: 6px;
}

.popup-header-loja {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 15px;
  margin-bottom: 15px;
}

.popup-header-loja h2 {
  margin: 0;
  color: var(--title-color);
  font-size: 1.3rem;
}

.fechar-popup,
.btn-fechar-moderno {
  background: #fef2f2 !important;
  color: #ef4444 !important;
  border: 1px solid #fecaca !important;
  border-radius: 6px !important;
  width: 32px !important;
  height: 32px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  cursor: pointer !important;
  font-size: 1.1rem !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
}

.fechar-popup:hover,
.btn-fechar-moderno:hover {
  background: #ef4444 !important;
  color: #ffffff !important;
}

/* Timeline Modern */
.linha-do-tempo {
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
  gap: 80px;
}

.etapa {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--subtitle-color);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: 0.2s;
}

.etapa:hover {
  color: var(--primary-color);
  transform: translateY(-2px);
}

.etapa span {
  width: 28px;
  height: 28px;
  background: var(--table-header-bg);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
  font-weight: 700;
  transition: 0.3s;
}

.etapa.etapa-ativa {
  color: var(--primary-color);
}

.etapa.etapa-ativa span {
  background: var(--primary-color);
  color: white;
}

/* GRID E CAMPOS (HIGH DENSITY) */
.form-grid-loja {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
}

.col-span-2 {
  grid-column: span 2;
}

.col-span-3 {
  grid-column: span 3;
}

.col-span-4 {
  grid-column: span 4;
}

.col-span-5 {
  grid-column: span 5;
}

.col-span-6 {
  grid-column: span 6;
}

.col-span-8 {
  grid-column: span 8;
}

.col-span-9 {
  grid-column: span 9;
}

.col-span-12 {
  grid-column: span 12;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--subtitle-color);
  margin-bottom: 4px;
}

.form-group label .req {
  color: #ef4444;
}

.form-group input,
.form-group select,
.select-customizado {
  width: 100%;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  outline: none;
  color: var(--title-color);
  background: var(--input-bg);
  height: 34px !important;
  font-size: 0.85rem;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-color);
}

/* AGRUPAMENTO SELECT + BOTÃO (34px) */
.input-group-modern {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  height: 34px !important;
}

.input-group-modern select,
.input-group-modern input,
.input-group-modern .dropdown-customizado {
  flex: 1;
  min-width: 0;
  margin: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: none;
}

.input-group-modern .btn-add-inline {
  background: var(--primary-color);
  color: white;
  border: 1px solid var(--primary-color);
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
  padding: 0 12px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
  box-sizing: border-box;
  height: 34px !important;
}

.input-group-modern .btn-add-inline:hover {
  filter: brightness(1.1);
}

.input-group-modern .dropdown-customizado .dropdown-trigger {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-right: none !important;
  height: 100%;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary-color);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.8rem;
}

.btn-link:hover {
  filter: brightness(1.1);
  text-decoration: underline;
}

/* Image Upload Area */
.image-upload-area {
  width: 100%;
  aspect-ratio: 1;
  border: 2px dashed var(--input-border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--table-header-bg);
  position: relative;
  overflow: hidden;
}

.image-upload-area:hover {
  border-color: var(--primary-color);
}

.placeholder-img {
  text-align: center;
  color: var(--subtitle-color);
  font-size: 0.85rem;
  font-weight: 500;
}

.placeholder-img i {
  font-size: 2rem;
  margin-bottom: 8px;
  color: var(--input-border);
}

.image-upload-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Switch Moderno */
.switch-container-modern {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 34px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--input-border);
  transition: 0.4s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked+.slider {
  background-color: var(--primary-color);
}

input:checked+.slider:before {
  transform: translateX(20px);
}

/* Variações Box */
.box-gerador-matriz {
  background: var(--card-bg);
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  margin-bottom: 10px;
}

.btn-gerar {
  background: var(--primary-color);
  color: white;
  border: none;
  border-radius: 6px;
  width: 100%;
  height: 34px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-gerar:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* ======================================================= */
/* INPUTS DA TABELA DE VARIAÇÕES                           */
/* ======================================================= */
.tabela-variacoes-input {
  width: 100%;
  padding: 0 6px !important;
  font-size: 0.8rem !important;
  height: 28px !important;
  border: 1px solid var(--input-border);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--title-color);
  box-sizing: border-box;
}

.tabela-variacoes-input:focus {
  border-color: var(--primary-color);
  outline: none;
}

.tabela-variacoes-input.var-sku {
  min-width: 120px !important;
  letter-spacing: 0px !important;
}

.tabela-variacoes-input.var-ean {
  min-width: 100px !important;
}

.tabela-variacoes-input.var-cod-secundario {
  min-width: 80px !important;
}

.tabela-variacoes-input.input-moeda {
  min-width: 80px !important;
  text-align: right;
}

#formEtapa2 .tabela-grid-moderna th,
#formEtapa2 .tabela-grid-moderna td {
  padding: 6px 4px !important;
  font-size: 0.8rem !important;
}

.btn-img-variacao,
.btn-remover-variacao {
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.btn-remover-variacao {
  background: #fee2e2;
  color: #ef4444;
}

.btn-remover-variacao:hover {
  background: #ef4444;
  color: #ffffff;
}

.badge-tamanho {
  background: var(--primary-color);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
}

.badge-tamanho i {
  cursor: pointer;
  transition: 0.2s;
}

.badge-tamanho i:hover {
  color: #fee2e2;
}

/* Botões Padrão Premium */
.btn-cancelar-outline,
.btn-avancar-primary {
  height: 34px;
  padding: 0 20px;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-cancelar-outline {
  background: transparent;
  color: var(--subtitle-color);
  border: 1px solid var(--input-border);
}

.btn-cancelar-outline:hover {
  background: var(--table-header-bg);
  color: var(--title-color);
  border-color: var(--subtitle-color);
}

.btn-avancar-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-avancar-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

/* =================================================== */
/* ABAS E MODAL DE CONSULTA                            */
/* =================================================== */
.aba-btn {
  background: transparent;
  border: none;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--subtitle-color);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px 8px 0 0;
}

.aba-btn:hover {
  color: var(--primary-color);
  background-color: var(--table-header-bg);
}

.aba-btn.ativo {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  background-color: var(--card-bg);
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.02);
}

.modal-card-conteudo {
  background: var(--card-bg);
  border-radius: 6px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--card-border);
  overflow: hidden;
  padding: 15px;
}

/* =================================================== */
/* LISTA INTERATIVA DE CORES (ETAPA 2)                 */
/* =================================================== */
.item-lista-cor {
  background-color: var(--input-bg) !important;
  border-color: var(--input-border) !important;
  padding: 4px 8px !important;
}

.item-lista-cor span {
  color: var(--title-color) !important;
}

.item-lista-cor:hover {
  border-color: var(--subtitle-color) !important;
  background: var(--table-header-bg) !important;
}

.checkbox-cor-matriz {
  display: none;
}

/* FOOTER DA TABELA (PAGINAÇÃO) */
.tabela-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 15px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  margin-top: 10px;
}

.tabela-footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--subtitle-color);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.select-limite {
  padding: 0 10px !important;
  height: 28px !important;
  width: auto !important;
  font-size: 0.75rem !important;
  border-radius: 4px !important;
}

.paginacao {
  display: flex;
  gap: 5px;
}

.btn-page {
  background: var(--card-bg);
  border: 1px solid var(--input-border);
  color: var(--subtitle-color);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: 0.2s;
  font-weight: 700;
  font-size: 0.8rem;
}

.btn-page:hover:not(:disabled) {
  background: var(--table-header-bg);
  color: var(--title-color);
  border-color: var(--subtitle-color);
}

.btn-page.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-page:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.drag-handle {
  color: #cbd5e1;
  cursor: grab;
  font-size: 1rem;
  transition: color 0.2s;
}

.drag-handle:hover {
  color: var(--primary-color);
}

.tr-dragging {
  opacity: 0.6;
  background-color: var(--table-header-bg) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.hover-text-primary:hover {
  color: var(--primary-color) !important;
}

.modal-footer-botoes {
  background: var(--card-bg);
  padding: 12px 20px;
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  z-index: 10;
}

.modal-footer-botoes .footer-right {
  display: flex;
  gap: 10px;
}

/* ======================================================================= */
/* DESKTOP: ALTURA DINÂMICA E BLINDAGEM DO FLEXBOX                         */
/* ======================================================================= */
.layout-etapa2 {
  align-items: stretch !important;
  height: calc(100vh - 290px) !important;
  min-height: 280px !important;
}

.box-etapa-2-left,
.box-etapa-2-right {
  height: 100% !important;
  display: flex;
  flex-direction: column;
  min-height: 0 !important;
}

.compact-box {
  padding: 12px !important;
  height: 100% !important;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0 !important;
}

.compact-cores {
  max-height: none !important;
  flex: 1;
  overflow-y: auto;
  min-height: 0 !important;
}

.compact-table {
  height: 100% !important;
  max-height: none !important;
  flex: 1;
  overflow: auto;
  min-height: 0 !important;
}

.box-etapa-3 {
  padding: 12px !important;
}

#popupProduto .popup-content-large>div:first-child {
  border-top-left-radius: 8px !important;
  border-top-right-radius: 8px !important;
}

#popupProduto .modal-footer-botoes {
  border-bottom-left-radius: 8px !important;
  border-bottom-right-radius: 8px !important;
}

/* Força a cor primária no nome do produto, sobrepondo o styles.css global */
.tabela-grid-moderna td .produto-nome-destaque {
    color: var(--primary-color) !important;
}

/* ======================================================================= */
/* MOTOR DE RESPONSIVIDADE EXTREMA (MOBILE E TABLETS)                      */
/* ======================================================================= */
@media (max-width: 1024px) {

  /* Libera o scroll global no mobile se a classe no-scroll estiver no body */
  body.no-scroll {
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  /* Altera a estrutura do painel principal para permitir o scroll total da tela */
  .produto-content {
    margin-left: 0 !important;
    padding: 80px 15px 15px 15px !important;
    /* Padding reduzido para grudar a paginação no fundo */
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
  }

  #sidebar-container:has(.sidebar.collapsed)~.produto-content {
    margin-left: 0 !important;
  }

  /* Impede que a tabela tente rolar internamente e trave a tela no mobile */
  .tabela-container {
    flex: none !important;
    height: auto !important;
    overflow-y: visible !important;
  }

  /* Garante que a paginação fique absolutamente colada ao final sem deixar espaço cinza sobrando */
  .tabela-footer {
    margin-top: auto !important;
    margin-bottom: 0 !important;
  }

  /* Layout Etapa 2 do Modal (Empilha) */
  .layout-etapa2 {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    gap: 10px;
  }

  .box-etapa-2-left,
  .box-etapa-2-right {
    width: 100% !important;
    height: auto !important;
  }

  .compact-box {
    height: auto !important;
    flex: none !important;
  }

  .compact-cores {
    max-height: 200px !important;
  }

  .compact-table {
    height: auto !important;
    flex: none !important;
    max-height: 400px !important;
  }
}

@media (max-width: 768px) {

  .produto-content {
    margin-left: 0 !important;
    padding: 80px 15px 15px 15px !important;
    /* Padding reduzido para grudar a paginação no fundo */
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
  }

  /* 1. Modal: Quebra as colunas para 100% de largura */
  .col-span-2,
  .col-span-3,
  .col-span-4,
  .col-span-5,
  .col-span-6,
  .col-span-7,
  .col-span-8,
  .col-span-9 {
    grid-column: span 12 !important;
  }

  .form-grid-loja {
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
  }

  /* 2. Cabeçalho Principal */
  .cabecalho-produtos {
    flex-direction: column;
    align-items: stretch;
    gap: 15px;
  }

  .consulta-title-group {
    flex-direction: column;
    align-items: center !important;
    gap: 8px;
    text-align: center !important;
    width: 100%;
  }

  .consulta-title-group h1 {
    justify-content: center !important;
    width: 100%;
    font-size: 1.8rem;
  }

  .consulta-title-group p {
    border-left: none !important;
    padding-left: 0 !important;
    text-align: center !important;
  }

  .novo-produto {
    width: 100%;
    justify-content: center;
    height: 42px;
  }

  /* 3. Barra de Pesquisa */
  .filtro-pesquisa-basica {
    padding: 15px;
  }

  .filtros-basicos-linha {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px;
  }

  .filtro-item-tipo,
  .filtro-item-busca {
    width: 100% !important;
  }

  /* Botões de Pesquisa (Dividem a tela Lado a Lado no Celular) */
  .filtro-botoes-container {
    width: 100%;
    display: flex !important;
    flex-direction: row !important;
    gap: 10px;
    margin-top: 5px;
  }

  .btn-abrir-filtros,
  .btn-pesquisar {
    flex: 1;
    /* Divide o espaço meio a meio */
    width: auto !important;
    justify-content: center;
    height: 40px;
  }

  .checkboxes-basicos {
    align-self: flex-start;
    margin-top: 5px;
    margin-bottom: 0;
  }

  /* 4. Layout do Modal no Celular */
  .popup-content-large {
    max-height: 92vh !important;
    margin: auto;
    border-radius: 6px;
    width: 95% !important;
  }

  .linha-do-tempo {
    gap: 5px !important;
    width: 100%;
    justify-content: space-between;
    margin-bottom: 0 !important;
  }

  .etapa {
    flex: 1;
    font-size: 0.70rem !important;
  }

  .modal-body-scroll {
    padding: 15px !important;
  }

  /* 5. Botões de Rodapé (Footer do Modal) */
  .modal-footer-botoes {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }

  .modal-footer-botoes>div {
    width: 100%;
    display: flex;
    gap: 10px;
  }

  .modal-footer-botoes button {
    flex: 1;
    justify-content: center;
    height: 40px;
  }

  /* 6. Libera as Tabelas para Scroll Horizontal via Toque */
  .tabela-container {
    overflow-x: auto !important;
    width: 100% !important;
    -webkit-overflow-scrolling: touch;
    overflow-y: hidden !important;
  }

  .tabela-grid-moderna {
    min-width: 800px;
  }

  #tabelaVariacoes {
    min-width: 900px;
  }

  /* ======================================================= */
  /* RODAPÉ E PAGINAÇÃO MOBILE (Minimalista e Responsivo)    */
  /* ======================================================= */
  .tabela-footer {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 10px !important;
    align-items: center !important;
  }

  .tabela-footer-left {
    width: 100% !important;
    justify-content: center !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
  }

  .tabela-footer-right {
    width: 100% !important;
    display: flex !important;
    justify-content: center !important;
  }

  .paginacao {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 4px !important;
  }

  .btn-page {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
  }
}

/* ======================================================= */
/* BLINDAGEM MODO ESCURO                                   */
/* ======================================================= */
[data-theme="dark"] .box-gerador-matriz,
[data-theme="dark"] .etapa-form-prod div[style*="background: #ffffff"],
[data-theme="dark"] .popup-content-large>div[style*="background: white"],
[data-theme="dark"] .form-buttons-modern[style*="background: white"] {
  background-color: var(--card-bg) !important;
  border-color: var(--card-border) !important;
}

[data-theme="dark"] .consulta-title-group h1 {
  color: var(--title-color) !important;
}

[data-theme="dark"] .etapa-form-prod label,
[data-theme="dark"] .box-gerador-matriz h4,
[data-theme="dark"] .etapa-form-prod h4[style*="color: #475569"] {
  color: var(--subtitle-color) !important;
}

[data-theme="dark"] .etapa-form-prod h4[style*="color: var(--primary-color)"] {
  color: var(--primary-color) !important;
}

[data-theme="dark"] .image-upload-area {
  background-color: var(--table-header-bg) !important;
  border-color: var(--card-border) !important;
}

[data-theme="dark"] .placeholder-img,
[data-theme="dark"] .placeholder-img i {
  color: var(--subtitle-color) !important;
}

[data-theme="dark"] input#prodPrecoVenda[style*="background: #f0fdf4"] {
  background-color: rgba(105, 190, 157, 0.1) !important;
  border-color: var(--primary-color) !important;
  color: var(--primary-color) !important;
}

[data-theme="dark"] .popup-content-large[style*="background-color: #f1f5f9"] {
  background-color: var(--body-color) !important;
}

[data-theme="dark"] .popup-content[style*="background-color: #ffffff"] {
  background-color: var(--card-bg) !important;
}

[data-theme="dark"] .modal-card-conteudo div[style*="background: #f8fafc"] {
  background-color: var(--table-header-bg) !important;
  border-color: var(--card-border) !important;
}

[data-theme="dark"] h2[style*="color: #1e293b"],
[data-theme="dark"] h3[style*="color: #334155"],
[data-theme="dark"] span[style*="color: #334155"],
[data-theme="dark"] td[style*="color: #334155"] {
  color: var(--title-color) !important;
}

[data-theme="dark"] p[style*="color: #64748b"],
[data-theme="dark"] span[style*="color: #64748b"],
[data-theme="dark"] td[style*="color: #64748b"] {
  color: var(--subtitle-color) !important;
}

[data-theme="dark"] input[style*="background: #f1f5f9"],
[data-theme="dark"] input[readonly],
[data-theme="dark"] input:disabled {
  background-color: var(--table-header-bg) !important;
  color: var(--subtitle-color) !important;
  border-color: var(--card-border) !important;
}

[data-theme="dark"] .fechar-popup,
[data-theme="dark"] .btn-fechar-moderno {
  background-color: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}