/* ═══════════════════════════════════════════════════════════════════════════
   ESTÚDIO 195 — STYLES.CSS  (v4.1 ULTRA-RESPONSIVO CORRIGIDO)
   Mobile-first, gestos touch, layout adaptativo PC/Tablet/Celular
   Refatorado e Corrigido (Altura Dinâmica)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Paleta — dark moderno premium */
  --bg0: #0a0b0f;
  --bg1: #14161e;
  --bg2: #1c1f29;
  --bg3: #262a37;
  --bg4: #323748;
  --border: #2e3245;
  --border-soft: #1e2130;
  --accent: #ff4757;
  --accent-h: #ff6171;
  --accent2: #ff8c00;
  --green: #2ed573;
  --blue: #3742fa;
  --purple: #a55eea;
  --yellow: #ffc312;
  --text: #e8e8f0;
  --text-soft: #b8bac8;
  --muted: #7a7d96;
  --shadow-sm: 0 2px 6px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
  --shadow-xl: 0 10px 40px rgba(0, 0, 0, 0.5);

  /* Dimensões */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --tab-h: 56px;
  --toolbar-h: 50px;
  --slides-w: 160px;
  --painel-w: 290px;

  /* Tipografia */
  --font-display: 'Montserrat', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Montserrat', -apple-system, sans-serif;

  /* Transições */
  --t-fast: 0.12s cubic-bezier(.4,0,.2,1);
  --t: 0.2s cubic-bezier(.4,0,.2,1);
  --t-slow: 0.4s cubic-bezier(.4,0,.2,1);

  /* Safe areas (notch) */
  --safe-top: env(safe-area-inset-top, 0);
  --safe-bot: env(safe-area-inset-bottom, 0);
}

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

html, body {
  height: 100%;
  height: 100dvh; /* FIX: Evita que a barra do Safari/Chrome esconda o rodapé */
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body {
  display: flex; /* FIX: Transforma o body em flex para o tab-content se ajustar sozinho */
  flex-direction: column;
  font-family: var(--font-body);
  background: var(--bg0);
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
  position: relative;
  /* Gradiente sutil de atmosfera */
  background-image:
    radial-gradient(at 20% 0%, rgba(255,71,87,.06) 0%, transparent 50%),
    radial-gradient(at 80% 100%, rgba(55,66,250,.05) 0%, transparent 50%);
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }

/* ABAS DE TRABALHOS ABERTOS */
.worktabs-bar {
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  background: #10121a;
  overflow: hidden;
}
.worktabs-list {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
}
.worktab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 220px;
  min-width: 130px;
  height: 30px;
  padding: 0 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  background: var(--bg1);
  color: var(--text-soft);
  cursor: pointer;
  transition: var(--t-fast);
}
.worktab.active {
  background: var(--bg2);
  border-color: var(--accent);
  color: var(--text);
}
.worktab-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
}
.worktab-close {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--muted);
  flex-shrink: 0;
  font-size: 13px;
}
.worktab-close:hover {
  background: rgba(255,71,87,.18);
  color: var(--accent);
}
.worktabs-add,
.worktabs-save {
  height: 30px;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  padding: 0 10px;
}
.worktabs-add {
  width: 32px;
  padding: 0;
}
.worktabs-save {
  color: var(--green);
}
.worktabs-count {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMAÇÕES
   ═══════════════════════════════════════════════════════════════════════════ */
@keyframes slideIn { from { transform: translateX(-20px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }
@keyframes slideInUp { from { transform: translateY(20px); opacity: 0 } to { transform: translateY(0); opacity: 1 } }
@keyframes slideInRight { from { transform: translateX(30px); opacity: 0 } to { transform: translateX(0); opacity: 1 } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .65 } }
@keyframes pulseRing {
  0%   { box-shadow: 0 0 0 0 rgba(255,71,87,.7) }
  70%  { box-shadow: 0 0 0 16px rgba(255,71,87,0) }
  100% { box-shadow: 0 0 0 0 rgba(255,71,87,0) }
}
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes shimmer {
  0% { background-position: -200% 0 }
  100% { background-position: 200% 0 }
}
@keyframes gradientFlow {
  0%, 100% { background-position: 0% 50% }
  50% { background-position: 100% 50% }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: calc(20px + var(--safe-bot));
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 40px);
}
.toast {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  color: var(--text);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  max-width: 340px;
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: slideInRight .3s ease;
  backdrop-filter: blur(8px);
}
.toast.success { border-left-color: var(--green) }
.toast.warning { border-left-color: var(--accent2) }
.toast.error   { border-left-color: var(--accent) }
.toast.info    { border-left-color: var(--blue) }

@media (max-width: 768px) {
  #toast-container { bottom: 16px; right: 12px; left: 12px; }
  .toast { max-width: 100%; font-size: 13px; padding: 14px 16px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   BOTÕES BASE
   ═══════════════════════════════════════════════════════════════════════════ */
.btn-primario, .btn-secundario, .btn-header, .tb-btn {
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 700;
  transition: var(--t);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  user-select: none;
  outline: none;
  font-family: inherit;
  letter-spacing: .2px;
  min-height: 32px;
}
.btn-primario:disabled, .btn-secundario:disabled { opacity: .4; cursor: not-allowed; }

.btn-primario {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  background-size: 200% 200%;
  color: #fff;
  padding: 11px 20px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
  box-shadow: 0 2px 12px rgba(255,71,87,.25);
}
.btn-primario:hover { animation: gradientFlow 3s ease infinite; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,71,87,.4); }
.btn-primario:active { transform: translateY(0); }

.btn-secundario {
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 16px;
  font-size: 12px;
}
.btn-secundario:hover { background: var(--bg3); border-color: var(--accent); color: var(--accent); }

.btn-header {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 14px;
  font-size: 12px;
  border-radius: 8px;
}
.btn-header:hover { border-color: var(--accent); color: var(--accent); background: rgba(255,71,87,.06); }
.btn-header.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  color: white;
  box-shadow: 0 2px 12px rgba(255,71,87,.3);
}
.btn-header.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(255,71,87,.45); color: white; }

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER PRINCIPAL
   ═══════════════════════════════════════════════════════════════════════════ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  padding-top: calc(10px + var(--safe-top));
  background: rgba(20,22,30,.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
  min-height: var(--tab-h); /* FIX: Alterado de height para min-height */
  height: auto;
  flex-shrink: 0;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.app-logo .mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  box-shadow: 0 4px 14px rgba(255,71,87,.35);
}
.app-logo .txt h2 {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--text);
}
.app-logo .txt span {
  font-size: 10px;
  color: var(--muted);
  display: block;
  margin-top: 1px;
}

.tab-bar {
  display: flex;
  gap: 4px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
}
.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: var(--t);
  font-family: inherit;
}
.tab-btn:hover { color: var(--text); background: rgba(255,255,255,.04); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  box-shadow: 0 2px 8px rgba(255,71,87,.4);
}
.tab-num {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 900;
}
.tab-btn:not(.active) .tab-num { background: rgba(255,255,255,.05); }

.app-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  transition: var(--t);
}
.menu-toggle:hover { background: rgba(255,71,87,.08); border-color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════════════
   ABAS - CONTAINER
   ═══════════════════════════════════════════════════════════════════════════ */
.tab-content {
  display: none;
  flex: 1; /* FIX: Preenche exatamente o espaço restante da tela sem cálculos manuais */
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}
.tab-content.active { display: flex; animation: fadeIn .3s ease; }

.tab-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-bottom: calc(12px + var(--safe-bot));
  background: var(--bg1);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  gap: 12px;
  z-index: 10; /* FIX: Garante que o footer fique por cima de rolagens */
}
.tab-footer .info {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tab-footer .info strong { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════════════════
   ABA 1 - MODELOS
   ═══════════════════════════════════════════════════════════════════════════ */
.aba-modelos-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
  -webkit-overflow-scrolling: touch;
}
.aba-modelos-body h1 {
  font-size: 22px;
  font-weight: 900;
  margin-bottom: 4px;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--text), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.aba-modelos-body p.sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 22px;
}

.modelo-grupo { margin-bottom: 26px; }
.modelo-grupo-titulo {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modelos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.modelo-card {
  background: var(--bg1);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: var(--t);
  position: relative;
  overflow: hidden;
}
.modelo-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.modelo-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
}
.modelo-card:hover::before { transform: scaleX(1); }
.modelo-card.selected {
  border-color: var(--accent);
  background: rgba(255,71,87,.06);
  box-shadow: 0 0 0 4px rgba(255,71,87,.15);
}
.modelo-card.selected::before { transform: scaleX(1); }

.modelo-preview {
  width: 100%;
  aspect-ratio: 4/5;
  background: var(--bg0);
  border-radius: var(--radius);
  margin-bottom: 10px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.modelo-preview svg { max-width: 90%; max-height: 90%; }

.modelo-card h3 { font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.modelo-card p { font-size: 11px; color: var(--muted); line-height: 1.4; }

.modelo-card .badge,
.modelo-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--accent);
  color: white;
  font-size: 9px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.auto-home-card,
.auto-theme-home {
  min-height: 178px;
}
.auto-home-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 10px;
  background: linear-gradient(135deg, rgba(255,71,87,.14), rgba(0,207,255,.10)), var(--bg0);
}
.auto-home-preview strong {
  font-size: 13px;
  font-weight: 900;
  color: var(--text);
}
.auto-home-preview span {
  font-size: 11px;
  color: var(--muted);
}
.auto-theme-home-preview {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
}
.auto-theme-home-preview i {
  display: block;
  width: 28px;
  height: 42px;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 8px 16px rgba(0,0,0,.18);
}

.recent-actions {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-top: 10px;
}
.btn-mini {
  flex: 1;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: var(--t);
  font-family: inherit;
}
.btn-mini:hover { background: var(--accent-h); transform: translateY(-1px); }
.btn-mini.btn-secondary { background: var(--bg2); color: var(--text); border: 1px solid var(--border); }
.btn-mini.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.acoes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.acao-card {
  min-height: 112px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: var(--t);
  font-family: inherit;
}
.acao-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0,0,0,.28);
}
.acao-card.primary {
  border-color: rgba(255,71,87,.45);
  background: linear-gradient(135deg, rgba(255,71,87,.14), rgba(0,207,255,.08)), var(--bg1);
}
.acao-card .ico {
  font-size: 24px;
  margin-bottom: 10px;
}
.acao-card .ttl {
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 4px;
}
.acao-card .dsc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}
.auto-entry-card {
  grid-column: span 2;
}

.footer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.auto-footer-btn {
  background: linear-gradient(135deg, #00a86b, #00a5cf);
}

/* ═══════════════════════════════════════════════════════════════════════════
   ABA 2 - PRODUTOS
   ═══════════════════════════════════════════════════════════════════════════ */
.aba-produtos-body {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 0;
  overflow: hidden;
  min-height: 0;
}

.aba2-sidebar {
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.aba2-sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-soft);
}
.aba2-sidebar-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 800;
}

.modo-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  background: var(--bg0);
  border-radius: 10px;
  padding: 3px;
  border: 1px solid var(--border);
  margin-bottom: 8px;
}
.modo-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 9px 8px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--t);
}
.modo-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
}
.modo-info { font-size: 10px; color: var(--muted); margin-top: 4px; line-height: 1.5; }

.aba2-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.aba2-busca {
  display: flex;
  gap: 8px;
  padding: 16px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.busca-input-grande {
  flex: 1;
  background: var(--bg1);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  transition: var(--t);
}
.busca-input-grande:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,71,87,.15);
}
.btn-buscar-grande {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 800;
  cursor: pointer;
  font-size: 13px;
  transition: var(--t);
  font-family: inherit;
}
.btn-buscar-grande:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(255,71,87,.4); }

.filtros-rapidos {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.filtros-rapidos select,
.filtros-rapidos input {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  flex: 1;
  min-width: 120px;
}
.filtros-rapidos select:focus, .filtros-rapidos input:focus {
  outline: none; border-color: var(--accent);
}
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 800;
  min-height: 36px;
  flex: 1 1 170px;
}
.check-inline input {
  min-width: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.auto-prod-actions {
  display: flex;
  gap: 8px;
  padding: 0 16px 12px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.auto-prod-actions button {
  min-height: 38px;
  flex: 1 1 150px;
}

.busca-resumo {
  min-height: 22px;
  padding: 0 16px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.produtos-resultado {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  -webkit-overflow-scrolling: touch;
}

.produtos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.produto-card {
  background: var(--bg1);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: var(--t);
  position: relative;
}
.produto-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.produto-card.selected {
  border-color: var(--green);
  background: rgba(46,213,115,.08);
}
.produto-card.selected::after {
  content: '✓';
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  background: var(--green);
  color: white;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(46,213,115,.5);
  animation: pulseRing 2s infinite;
}

.produto-img-wrap {
  width: 100%;
  aspect-ratio: 1;
  background: white;
  display: grid;
  place-items: center;
  position: relative;
}
.produto-img-wrap img {
  max-width: 92%;
  max-height: 92%;
  object-fit: contain;
}

.produto-img-wrap.sem-foto {
  background: #f8fafc;
  color: #667085;
  text-align: center;
  padding: 10px;
}
.produto-sem-foto {
  display: grid;
  gap: 5px;
  line-height: 1.25;
}
.produto-sem-foto strong {
  color: #344054;
  font-size: 11px;
  text-transform: uppercase;
}
.produto-sem-foto span {
  color: #667085;
  font-size: 10px;
  font-weight: 700;
}
.produto-card.photo-recovered {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(46,213,115,.18);
}
.produto-card.photo-removing {
  opacity: 0;
  transform: scale(.98);
  transition: opacity .18s ease, transform .18s ease;
}

.produto-multi-foto {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(0,0,0,.75);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  backdrop-filter: blur(4px);
}

.produto-info { padding: 10px; }
.produto-info h5 {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.produto-info .preco {
  font-size: 14px;
  font-weight: 900;
  color: var(--green);
  margin-bottom: 2px;
}
.produto-info .meta { font-size: 10px; color: var(--muted); }
.produto-status-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 7px;
}
.produto-status {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.status-alerta {
  background: rgba(255, 184, 28, .16);
  color: #f4b740;
  border: 1px solid rgba(255, 184, 28, .35);
}
.status-neutro {
  background: rgba(0, 207, 255, .12);
  color: var(--accent2);
  border: 1px solid rgba(0, 207, 255, .28);
}
.produto-card.photo-not-found {
  border-color: rgba(255, 184, 28, .55);
}

.produtos-paginacao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 0 4px;
}
.page-list {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
}
.page-chip,
.page-nav {
  border: 1px solid var(--border);
  background: var(--bg1);
  color: var(--text);
  border-radius: 8px;
  min-height: 34px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.page-chip.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  color: #fff;
}
.page-nav:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.empty-busca {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.empty-busca .ico { font-size: 48px; opacity: .4; margin-bottom: 12px; }
.empty-busca h3 { font-size: 16px; margin-bottom: 4px; color: var(--text); }
.empty-busca p { font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════════════════
   ABA 3 - EDITOR
   ═══════════════════════════════════════════════════════════════════════════ */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--bg1);
  border-bottom: 1px solid var(--border);
  height: var(--toolbar-h);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
  scrollbar-width: thin;
}
.editor-toolbar::-webkit-scrollbar { height: 4px; }

.tb-group {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-right: 1px solid var(--border-soft);
}
.tb-group:last-of-type { border-right: none; }

.tb-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-soft);
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 7px;
  cursor: pointer;
  transition: var(--t);
}
.tb-btn:hover {
  background: var(--bg2);
  color: var(--accent);
  border-color: var(--border);
}
.tb-btn:active { transform: scale(.96); }

.tb-spacer { flex: 1; min-width: 8px; }

.tb-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: var(--bg2);
  border-radius: 8px;
  height: 34px;
  min-width: 200px;
  border: 1px solid var(--border);
}
.tb-zoom input {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  outline: none;
}
.tb-zoom input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(255,71,87,.5);
}
.tb-zoom input::-moz-range-thumb {
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}
.tb-zoom-val {
  font-size: 11px;
  color: var(--text);
  font-weight: 700;
  min-width: 40px;
  text-align: right;
}

.aba-editor-body {
  flex: 1;
  display: grid;
  grid-template-columns: var(--slides-w) 1fr var(--painel-w);
  overflow: hidden;
  min-height: 0;
}

/* SLIDES */
.slides-panel {
  background: var(--bg1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.slides-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.slides-header h4 { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.slides-header .count {
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}
.slides-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.slide-item {
  background: var(--bg2);
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--t);
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  display: grid;
  grid-template-rows: 1fr 24px;
}
.slide-item:hover { border-color: var(--border); }
.slide-item.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,71,87,.2); }
.slide-item.dragging { opacity: .5; }
.slide-item.drag-over { border-color: var(--green); transform: translateY(2px); }
.slide-item .thumb-wrap {
  min-height: 0;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #777;
  font-size: 10px;
  text-align: center;
}
.slide-item img { width: 100%; height: 100%; object-fit: contain; background: white; }
.slide-item .nome {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 0 6px;
  background: rgba(0,0,0,.22);
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.slide-item .num {
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,.75);
  color: white; font-size: 10px; font-weight: 800;
  padding: 2px 6px; border-radius: 4px;
}
.slide-item .del-btn,
.slide-item .dup-btn {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,.75); color: white;
  border: none; border-radius: 50%;
  width: 20px; height: 20px; cursor: pointer;
  opacity: 0; transition: var(--t);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}
.slide-item .dup-btn { right: 28px; }
.slide-item:hover .del-btn,
.slide-item:hover .dup-btn { opacity: 1; }
.slide-item .del-btn:hover { background: var(--accent); }
.slide-item .dup-btn:hover { background: var(--blue); }
.slides-footer { padding: 8px; border-top: 1px solid var(--border); flex-shrink: 0; }
.btn-add-slide {
  width: 100%;
  background: var(--bg3);
  border: 1px dashed var(--border);
  color: var(--muted);
  padding: 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: var(--t);
  font-family: inherit;
}
.btn-add-slide:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }

/* CANVAS */
.editor-center {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  background: var(--bg0);
  position: relative; /* Para o canvas-fab não vazar */
}
#canvasWrap {
  flex: 1;
  background-image:
    radial-gradient(var(--border) 1px, transparent 1px);
  background-size: 22px 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 28px;
  -webkit-overflow-scrolling: touch;
  position: relative;
}
.canvas-frame {
  background: white;
  box-shadow: var(--shadow-xl), 0 0 0 1px rgba(255,255,255,.04);
  border-radius: 3px;
  flex-shrink: 0;
  position: relative;
}
.canvas-frame canvas { display: block; border-radius: 3px; }

/* FIX: Estilo base do FAB do Canvas (a engrenagem que estava faltando CSS principal) */
.canvas-fab {
  display: none; /* Esconde no desktop */
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border: none;
  box-shadow: 0 4px 16px rgba(255,71,87,.4);
  cursor: pointer;
  z-index: 100;
  font-size: 20px;
  align-items: center;
  justify-content: center;
  transition: var(--t);
}
.canvas-fab:active { transform: scale(0.92); }
@media (max-width: 860px) {
  .canvas-fab { display: flex; } /* Ativa no mobile */
}

/* PAINEL DE PROPRIEDADES */
#painelProps {
  background: var(--bg1);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 14px;
}
#painelProps.no-selection { align-items: center; justify-content: center; }
#painelProps::-webkit-scrollbar { width: 5px; }
#painelProps::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.props-empty { text-align: center; color: var(--muted); padding: 20px; }
.props-empty .ico { font-size: 48px; opacity: .3; margin-bottom: 14px; }
.props-empty p { font-size: 12px; line-height: 1.5; }

.props-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.props-header h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.props-header span {
  font-size: 9px; padding: 3px 8px;
  background: var(--accent); border-radius: 20px;
  color: #fff; font-weight: 800; text-transform: uppercase;
}

.props-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.props-section:last-child { border-bottom: none; }
.props-section-title {
  font-size: 9px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}
.props-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ctrl-label {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  display: block;
  margin-bottom: 3px;
}
.ctrl-input, .props-input-mini {
  width: 100%;
  padding: 7px 9px;
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  transition: var(--t);
}
.ctrl-input { padding: 9px 12px; font-size: 13px; }
.props-input-mini:focus, .ctrl-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 2px rgba(255,71,87,.15);
}

.props-btn-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.props-btn {
  background: var(--bg0);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 4px;
  cursor: pointer;
  font-size: 11px;
  transition: var(--t);
  font-family: inherit;
  font-weight: 600;
}
.props-btn:hover {
  border-color: var(--accent);
  background: rgba(255,71,87,.08);
  color: var(--accent);
}
.props-btn.danger:hover { border-color: var(--accent); color: var(--accent); }
.props-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}
.props-toggle-row label { font-size: 11px; color: var(--text); }

.props-slider input {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  outline: none;
}
.props-slider input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MODAIS
   ═══════════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 6000;
  padding: 20px;
  padding-top: calc(20px + var(--safe-top));
  padding-bottom: calc(20px + var(--safe-bot));
  animation: fadeIn .25s ease;
}
.modal-overlay.open, .modal-overlay.active { display: flex; }

.modal-box, .modal-content {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideInUp .3s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-xl);
  -webkit-overflow-scrolling: touch;
}
.modal-box h3, .modal-content h2 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -.3px;
}
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  background: var(--bg1);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: grid;
  place-items: center;
  transition: var(--t);
}
.modal-close:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: rotate(90deg);
}

/* MODAL FOTOS */
.fotos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}
.foto-opcao {
  background: var(--bg0);
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: var(--t);
  aspect-ratio: 1;
}
.foto-opcao:hover { border-color: var(--accent); transform: translateY(-2px); }
.foto-opcao.selected { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,71,87,.25); }
.foto-opcao img { width: 100%; height: 100%; object-fit: contain; background: white; }
.foto-opcao .label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.8);
  color: white; padding: 4px 8px;
  font-size: 10px; font-weight: 700;
  text-align: center;
}

/* GERADOR AUTOMATICO */
.auto-generator-box {
  max-width: 760px;
}
.auto-generator-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-right: 34px;
  margin-bottom: 18px;
}
.auto-generator-head h3 {
  margin-bottom: 6px;
}
.auto-section {
  margin-bottom: 18px;
}
.auto-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.auto-choice-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.auto-choice,
.auto-preset,
.auto-format,
.auto-theme,
.auto-slots button {
  border: 1px solid var(--border);
  background: var(--bg1);
  color: var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: var(--t);
}
.auto-choice {
  min-height: 82px;
  padding: 12px;
  text-align: left;
}
.auto-preset {
  min-height: 78px;
  padding: 12px;
  text-align: left;
}
.auto-format-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.auto-format {
  min-height: 42px;
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 900;
}
.auto-choice strong,
.auto-preset strong,
.auto-theme strong {
  display: block;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
}
.auto-choice span,
.auto-preset span,
.auto-theme small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.35;
}
.auto-choice:hover,
.auto-preset:hover,
.auto-format:hover,
.auto-theme:hover,
.auto-slots button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.auto-choice.active,
.auto-preset.active,
.auto-format.active,
.auto-theme.active,
.auto-slots button.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,71,87,.18);
}
.auto-theme-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.auto-theme {
  padding: 10px;
  text-align: left;
  min-height: 112px;
}
.auto-theme-swatch {
  height: 34px;
  border: 2px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 6px;
  margin-bottom: 8px;
}
.auto-theme-swatch i {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
}
.auto-slots {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.auto-slots button {
  min-width: 58px;
  min-height: 40px;
  padding: 8px 12px;
  font-weight: 900;
}
.auto-summary {
  display: grid;
  gap: 4px;
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}
.auto-summary strong {
  font-size: 13px;
}
.auto-summary span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Central IA/APIs */
.ai-integrations-box {
  width: min(1120px, calc(100vw - 28px));
  max-width: 1120px;
  max-height: 90vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}
.ai-integrations-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-right: 36px;
}
.ai-integrations-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255,71,87,.14);
  color: #ffd6dc;
  border: 1px solid rgba(255,71,87,.28);
  font-size: 11px;
  font-weight: 900;
}
.ai-integrations-badge.ready {
  background: rgba(46,213,115,.14);
  color: #cffff0;
  border-color: rgba(46,213,115,.28);
}
.ai-integrations-body {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}
.ai-integrations-empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  gap: 8px;
  text-align: center;
  color: var(--text-soft);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(255,255,255,.025);
  padding: 26px;
}
.ai-loading-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 rgba(255,71,87,.55);
  animation: pulseRing 1.2s infinite;
  vertical-align: middle;
}
.ai-integrations-form {
  display: grid;
  gap: 12px;
}
.ai-integrations-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, .9fr) minmax(150px, .8fr) minmax(120px, .45fr) minmax(120px, .45fr) auto;
  gap: 8px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg1);
}
.ai-integrations-toolbar label,
.ai-integrations-field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-integrations-toolbar input,
.ai-integrations-toolbar select,
.ai-integrations-field input {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg0);
  color: var(--text);
  padding: 8px 9px;
  outline: none;
}
.ai-integrations-toolbar input:focus,
.ai-integrations-toolbar select:focus,
.ai-integrations-field input:focus {
  border-color: var(--accent);
}
.ai-integrations-toggle {
  min-height: 36px;
  grid-template-columns: auto 1fr;
  align-items: center;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg0);
  padding: 8px 9px;
  text-transform: none;
  color: var(--text-soft);
  font-size: 11px;
}
.ai-integrations-toggle input {
  min-height: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.ai-integrations-feedback {
  min-height: 18px;
  color: var(--text-soft);
  font-size: 12px;
}
.ai-integrations-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.ai-integrations-section strong { color: var(--text-soft); }
.ai-integrations-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
.ai-integrations-card {
  min-width: 0;
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg1);
}
.ai-integrations-card.ready {
  border-color: rgba(46,213,115,.35);
  background: linear-gradient(135deg, rgba(46,213,115,.08), rgba(255,255,255,.015)), var(--bg1);
}
.ai-integrations-card-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: start;
}
.ai-integrations-card-head strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
  color: var(--text);
}
.ai-integrations-card-head small,
.ai-integrations-note,
.ai-integrations-field small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.ai-integrations-card-head span {
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(255,71,87,.12);
  color: #ffd6dc;
  font-size: 10px;
  font-weight: 900;
}
.ai-integrations-card.ready .ai-integrations-card-head span {
  background: rgba(46,213,115,.14);
  color: #cffff0;
}
.ai-integrations-fields {
  display: grid;
  gap: 7px;
}
.ai-integrations-card a {
  justify-self: start;
  color: #ffd0d6;
  font-size: 11px;
  font-weight: 900;
}
.ai-integrations-public-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}
.ai-integrations-public {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg0);
  color: var(--text);
}
.ai-integrations-public strong { font-size: 12px; }
.ai-integrations-public small {
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.3;
}
.ai-integrations-public em {
  color: var(--green);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

@media (max-width: 980px) {
  .ai-integrations-toolbar,
  .ai-integrations-grid,
  .ai-integrations-public-grid {
    grid-template-columns: 1fr;
  }
  .ai-integrations-head {
    display: grid;
    padding-right: 34px;
  }
}

/* ABA 4 - PALAVRAS-CHAVE */
.keywords-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  background: var(--bg0);
}
.keywords-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.keywords-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.15;
}
.keywords-actions,
.keywords-run,
.kw-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.keywords-grid {
  display: grid;
  grid-template-columns: minmax(320px, 460px) minmax(0, 1fr);
  gap: 16px;
}
.keywords-panel {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}
.keywords-preview {
  min-height: 520px;
}
.kw-field {
  display: grid;
  gap: 6px;
  min-width: 140px;
}
.kw-field strong {
  color: var(--accent);
  margin-left: 4px;
}
.kw-textarea {
  min-height: 270px;
  resize: vertical;
  border: 1px solid var(--border);
  background: var(--bg0);
  color: var(--text);
  border-radius: var(--radius);
  padding: 12px;
  font: 13px/1.55 Consolas, 'Courier New', monospace;
  outline: none;
}
.kw-textarea:focus,
#kwThemeSelect:focus,
#kwLimit:focus,
#kwSetor:focus,
#kwAndar:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,71,87,.16);
}
.kw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
  max-height: 96px;
  overflow: auto;
}
.kw-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(212,175,55,.16);
  border: 1px solid rgba(212,175,55,.34);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}
.kw-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.kw-preview-head h3 {
  margin: 0;
  font-size: 16px;
}
.kw-preview-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.kw-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.kw-product {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 74px;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg0);
}
.kw-product img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  flex-shrink: 0;
}
.kw-product div {
  min-width: 0;
}
.kw-product strong,
.kw-product span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kw-product strong {
  font-size: 12px;
  line-height: 1.3;
}
.kw-product span,
.kw-more,
.kw-empty {
  color: var(--muted);
  font-size: 11px;
}
.kw-more,
.kw-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.kw-health {
  display: grid;
  gap: 4px;
  min-height: 68px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg0);
}
.kw-health.ok {
  border-color: rgba(46,213,115,.35);
}
.kw-health.bad {
  border-color: rgba(255,71,87,.45);
}
.kw-health strong {
  font-size: 12px;
  text-transform: capitalize;
}
.kw-health span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TUTORIAL OVERLAY
   ═══════════════════════════════════════════════════════════════════════════ */
#tutorialOverlay { background: rgba(0,0,0,.92); }
#tutorialOverlay.active { display: flex; }
.tutorial-box {
  background: var(--bg2);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 60px rgba(255,71,87,.3), var(--shadow-xl);
  animation: slideInUp .4s cubic-bezier(.4,0,.2,1);
}
#tutorialTitle {
  color: var(--accent);
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 12px;
}
#tutorialText {
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 24px;
  min-height: 60px;
  font-size: 14px;
}
.tutorial-controls { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.tutorial-progress {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  justify-content: center;
}
.tut-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: var(--t);
}
.tut-dot.active {
  background: var(--accent);
  transform: scale(1.4);
  box-shadow: 0 0 8px var(--accent);
}
.tut-dot.done { background: var(--green); }

/* highlight do elemento alvo */
.tutorial-highlight {
  position: relative;
  z-index: 6500 !important;
  box-shadow:
    0 0 0 4px var(--accent),
    0 0 0 9999px rgba(0,0,0,.85) !important;
  border-radius: 8px;
  animation: pulseRing 2s infinite;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GRID EDITOR / AREA DESIGNER
   ═══════════════════════════════════════════════════════════════════════════ */
#gridEditorOverlay.open, #gridEditorOverlay.active { display: flex; }
#gridEditorOverlay .modal-box { max-width: 800px; }

.grid-preview {
  position: relative;
  width: 100%;
  height: 320px;
  background: white;
  border-radius: 6px;
  margin-bottom: 12px;
  overflow: hidden;
  cursor: crosshair;
}
.grid-cell {
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: rgba(0,0,0,.4);
  user-select: none;
  border-radius: 4px;
}

/* Area Designer (NOVO) */
.area-canvas {
  position: relative;
  width: 100%;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
}
.area-zone {
  position: absolute;
  border: 2px solid var(--accent);
  background: rgba(255,71,87,.12);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: move;
  user-select: none;
  transition: border-color var(--t-fast);
}
.area-zone.tipo-foto    { border-color: var(--accent); background: rgba(255,71,87,.12); }
.area-zone.tipo-nome    { border-color: var(--blue); background: rgba(55,66,250,.10); }
.area-zone.tipo-preco   { border-color: var(--green); background: rgba(46,213,115,.10); }
.area-zone.tipo-logo    { border-color: var(--yellow); background: rgba(255,195,18,.10); }
.area-zone.tipo-ean     { border-color: var(--purple); background: rgba(165,94,234,.10); }
.area-zone.tipo-livre   { border-color: var(--muted); background: rgba(255,255,255,.05); border-style: dashed; }
.area-zone.selecionada { box-shadow: 0 0 0 3px rgba(255,71,87,.3); border-style: solid; z-index: 10; }
.area-zone .area-label {
  background: rgba(0,0,0,.85);
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  pointer-events: none;
}
.area-zone .resize-handle {
  position: absolute;
  width: 12px; height: 12px;
  background: white;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.area-zone .resize-handle.se { bottom: -7px; right: -7px; cursor: se-resize; }
.area-zone .resize-handle.sw { bottom: -7px; left: -7px; cursor: sw-resize; }
.area-zone .resize-handle.ne { top: -7px; right: -7px; cursor: ne-resize; }
.area-zone .resize-handle.nw { top: -7px; left: -7px; cursor: nw-resize; }
.area-zone .delete-btn {
  position: absolute;
  top: -10px; right: -10px;
  width: 20px; height: 20px;
  background: var(--bg2);
  color: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 50%;
  cursor: pointer;
  font-size: 11px;
  display: grid;
  place-items: center;
  font-weight: 900;
}
.area-zone .delete-btn:hover { background: var(--accent); color: white; }

.area-tipo-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 8px;
  background: var(--bg0);
  border-radius: 8px;
  border: 1px solid var(--border);
}
.area-tipo-btn {
  flex: 1;
  min-width: 70px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition: var(--t);
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.area-tipo-btn:hover { border-color: var(--accent); color: var(--text); }
.area-tipo-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════════════════
   GIF & PDF MODALS
   ═══════════════════════════════════════════════════════════════════════════ */
.gif-frames-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.gif-frame-item {
  background: var(--bg0);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}
.gif-frame-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  background: white;
  margin-bottom: 6px;
}
.gif-frame-thumb img { width: 100%; height: 100%; object-fit: contain; }
.gif-frame-num, .gif-frame-duration {
  position: absolute;
  background: rgba(0,0,0,.85);
  color: white;
  font-size: 9px; font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
}
.gif-frame-num { top: 4px; left: 4px; }
.gif-frame-duration { bottom: 4px; left: 4px; }
.gif-frame-controls {
  display: flex;
  gap: 4px;
  font-size: 10px;
}
.gif-frame-controls input {
  flex: 1;
  padding: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 10px;
}
.gif-btn-small {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 7px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 800;
}
.gif-btn-small:hover { background: var(--accent-h); }

/* ═══════════════════════════════════════════════════════════════════════════
   PROGRESSO
   ═══════════════════════════════════════════════════════════════════════════ */
.progress-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 7000;
}
.progress-overlay.open { display: flex; }
.progress-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  padding: 28px;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 420px;
  text-align: center;
  box-shadow: var(--shadow-xl);
}
.progress-box h3 { font-size: 18px; font-weight: 800; margin-bottom: 6px; }
.progress-box .desc, .progress-box .progress-msg { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.progress-bar-wrap {
  height: 22px;
  background: var(--bg0);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.progress-bar-fill, .progress-bar-fill-gif, .progress-bar-fill-pdf {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  background-size: 200% 100%;
  animation: gradientFlow 2s ease infinite;
  width: 0%;
  transition: width .3s;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   EXCEL / SELETOR
   ═══════════════════════════════════════════════════════════════════════════ */
#excelSelectorModal.open { display: flex; }
.excels-selector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.excel-card {
  background: var(--bg1);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: var(--t);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.excel-card:hover {
  border-color: var(--accent);
  background: var(--bg2);
  transform: translateY(-2px);
}
.excel-card-icon { font-size: 32px; }
.excel-card-name { font-weight: 700; font-size: 12px; word-break: break-word; }
.excel-card-info { font-size: 10px; color: var(--muted); }

.upload-zone-compact {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg2);
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 14px;
  cursor: pointer;
  transition: var(--t);
  position: relative;
}
.upload-zone-compact:hover {
  border-color: var(--accent);
  background: rgba(255,71,87,.05);
}
.upload-zone-compact input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.excel-section .excel-list { padding: 8px 0; }
.excel-empty { color: var(--muted); text-align: center; padding: 8px; font-size: 11px; }
.excel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE NAV / DRAWER
   ═══════════════════════════════════════════════════════════════════════════ */
.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  flex-direction: column;
  background: rgba(11,12,16,.97);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: 24px;
  padding-top: calc(24px + var(--safe-top));
  padding-bottom: calc(24px + var(--safe-bot));
  gap: 18px;
  animation: fadeIn .25s ease;
}
.mobile-nav.open { display: flex; }
.mobile-nav-close {
  align-self: flex-end;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
}
.mobile-nav-close:hover { background: var(--accent); color: white; border-color: var(--accent); }
.mobile-nav-content h3 {
  color: var(--accent);
  margin-bottom: 16px;
  font-size: 22px;
  font-weight: 900;
}
.mobile-nav nav { display: grid; gap: 10px; }
.mobile-nav-link {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 18px;
  border-radius: 10px;
  text-align: left;
  cursor: pointer;
  transition: var(--t);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
}
.mobile-nav-link:hover, .mobile-nav-link:active {
  background: rgba(255,71,87,.08);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(4px);
}

/* ═══════════════════════════════════════════════════════════════════════════
   LEGACY (escondidos)
   ═══════════════════════════════════════════════════════════════════════════ */
.legacy-hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════
   FAB MOBILE (Floating Action Button)
   ═══════════════════════════════════════════════════════════════════════════ */
.fab-mobile {
  display: none;
  position: fixed;
  bottom: calc(20px + var(--safe-bot));
  right: 20px;
  z-index: 5000;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  border: none;
  cursor: pointer;
  font-size: 24px;
  box-shadow: 0 8px 24px rgba(255,71,87,.5);
  transition: var(--t);
}
.fab-mobile:hover { transform: scale(1.08); }
.fab-mobile:active { transform: scale(.96); }

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVO — TABLET (≤ 1024px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root {
    --painel-w: 250px;
    --slides-w: 130px;
  }
  .aba-produtos-body { grid-template-columns: 240px 1fr; }
  .modelos-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .produtos-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVO — MOBILE LANDSCAPE / SMALL TABLET (≤ 860px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .tab-bar { display: none; }
  .menu-toggle { display: inline-flex; }

  .app-header {
    padding: 8px 14px;
    padding-top: calc(8px + var(--safe-top));
  }
  .app-logo .txt { display: none; }
  .worktabs-bar {
    padding: 5px 8px;
  }
  .worktab {
    min-width: 116px;
    max-width: 170px;
  }
  .worktabs-count,
  .worktabs-save {
    display: none;
  }

  /* Aba 2: sidebar vira topo recolhível */
  .aba-produtos-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .aba2-sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 35vh;
  }

  /* Aba 3: paineis vira drawers */
  .aba-editor-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .slides-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 130px;
    background: var(--bg1);
    border-top: 1px solid var(--border);
    border-right: none;
    z-index: 50;
    box-shadow: 0 -4px 20px rgba(0,0,0,.4);
  }
  .slides-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px;
  }
  .slide-item {
    width: 90px;
    aspect-ratio: 3/4;
    flex-shrink: 0;
    height: auto;
  }
  .slides-header { padding: 8px 12px; }
  .slides-footer { display: none; }

  #painelProps {
    position: fixed;
    bottom: 130px;
    left: 0;
    right: 0;
    max-height: 50vh;
    transform: translateY(100%);
    transition: transform .3s;
    border-left: none;
    border-top: 1px solid var(--border);
    z-index: 49;
    box-shadow: 0 -8px 30px rgba(0,0,0,.5);
  }
  #painelProps.show-mobile { transform: translateY(0); }
  #painelProps.no-selection { display: none; }

  #canvasWrap { padding: 16px; padding-bottom: 150px; }

  .editor-toolbar {
    padding: 6px 10px;
    height: auto;
    flex-wrap: nowrap;
  }
  .tb-group {
    padding: 0 4px;
    border-right: 1px solid var(--border-soft);
  }
  .tb-btn { padding: 8px 10px; font-size: 11px; }
  .tb-zoom { min-width: 150px; }

  .auto-choice-grid,
  .auto-preset-grid,
  .auto-format-grid,
  .auto-theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .auto-entry-card {
    grid-column: span 1;
  }
  .keywords-grid {
    grid-template-columns: 1fr;
  }
  .keywords-preview {
    min-height: 360px;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVO — MOBILE PORTRAIT (≤ 580px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 580px) {
  .app-header {
    padding: 8px 12px;
    padding-top: calc(8px + var(--safe-top));
  }
  .app-logo .mark { width: 30px; height: 30px; font-size: 11px; }

  .btn-header {
    min-width: 36px;
    min-height: 36px;
    padding: 8px;
    font-size: 11px;
  }
  .btn-header .lbl { display: none; }

  .aba-modelos-body { padding: 16px; }
  .aba-modelos-body h1 { font-size: 19px; }
  .modelos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .modelo-card { padding: 10px; }

  .aba2-busca { padding: 12px; }
  .filtros-rapidos { padding: 0 12px 10px; }
  .filtros-rapidos select, .filtros-rapidos input { font-size: 11px; padding: 7px 10px; min-width: 100px; }
  .auto-prod-actions { padding: 0 12px 10px; }
  .auto-prod-actions button { flex-basis: 100%; }

  .produtos-resultado { padding: 10px 12px; }
  .produtos-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }

  .modal-box, .modal-content {
    padding: 18px;
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius);
  }

  .tab-footer { padding: 10px 12px; flex-wrap: wrap; }
  .tab-footer .info { width: 100%; font-size: 11px; }
  .tab-footer button { flex: 1; }
  .footer-actions { width: 100%; }
  .auto-generator-head {
    display: grid;
    padding-right: 28px;
  }
  .auto-choice-grid,
  .auto-preset-grid,
  .auto-format-grid,
  .auto-theme-grid {
    grid-template-columns: 1fr;
  }
  .auto-choice,
  .auto-preset,
  .auto-theme {
    min-height: auto;
  }
  .auto-slots button {
    flex: 1 1 64px;
  }
  .keywords-body {
    padding: 16px;
  }
  .keywords-header {
    display: grid;
  }
  .keywords-actions,
  .keywords-run,
  .kw-row {
    align-items: stretch;
  }
  .keywords-actions button,
  .keywords-run button,
  .kw-row button {
    flex: 1 1 100%;
  }
  .kw-results {
    grid-template-columns: 1fr;
  }
  .kw-textarea {
    min-height: 220px;
  }

  .editor-toolbar { gap: 4px; padding: 6px 8px; }
  .tb-btn { padding: 7px 8px; font-size: 10px; }
  .tb-zoom { min-width: 120px; gap: 6px; padding: 0 8px; }

  /* FAB para mobile pequeno */
  .fab-mobile { display: grid; place-items: center; }

  /* Slides menores no celular */
  .slides-panel { height: 110px; }
  .slide-item { width: 75px; }
  .slides-header h4 { font-size: 10px; }

  /* Excel cards menores */
  .excels-selector-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .excel-card { padding: 10px; }
  .excel-card-icon { font-size: 26px; }
  .excel-card-name { font-size: 11px; }

  /* Tutorial smaller */
  .tutorial-box { padding: 18px; }
  #tutorialTitle { font-size: 16px; }
  #tutorialText { font-size: 13px; min-height: 40px; }
  .tutorial-controls button { flex: 1; padding: 10px 12px; font-size: 11px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ULTRA-MOBILE (≤ 380px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .app-header { gap: 8px; padding: 6px 10px; }
  .modelos-grid, .produtos-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .modelo-card { padding: 8px; }
  .modelo-card h3 { font-size: 12px; }
  .modelo-card p { font-size: 10px; }
  .produto-info { padding: 8px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT & ACESSIBILIDADE
   ═══════════════════════════════════════════════════════════════════════════ */
@media print {
  body { background: white !important; }
  .app-header, .editor-toolbar, .slides-panel, #painelProps,
  #toast-container, .tab-footer, .mobile-nav, .fab-mobile { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg1); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* SELEÇÃO */
::selection { background: var(--accent); color: white; }
::-moz-selection { background: var(--accent); color: white; }

/* FOCUS VISIBLE (acessibilidade) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* INPUTS COM TIPO TEL/NUMBER em mobile (sem spinner feio) */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

/* ═══════════════════════════════════════════════════════════
   MEDIA QUERIES EXPANDIDAS — RESPONSIVIDADE AVANÇADA
   ═══════════════════════════════════════════════════════════ */

/* === EXTRA SMALL (320px - 479px) === */
@media (max-width: 479px) {
  :root {
    --tab-h: 48px;
    --toolbar-h: 44px;
    --painel-w: 100%;
  }
  
  .app-header {
    flex-direction: column;
    height: auto;
    padding: 8px;
  }
  
  .tab-bar {
    width: 100%;
    justify-content: space-around;
  }
  
  .tab-label {
    display: none; /* Mostrar apenas ícone */
  }
  
  .app-actions {
    width: 100%;
    justify-content: space-between;
    margin-top: 8px;
  }
  
  .mobile-nav {
    width: 100%;
    left: 0;
  }
  
  .modal-box {
    margin: 10px;
    max-width: calc(100vw - 20px);
  }
  
  .canvas-fab {
    bottom: 20px;
    right: 20px;
  }
}

/* === SMALL (480px - 767px) === */
@media (min-width: 480px) and (max-width: 767px) {
  .editor-toolbar {
    flex-wrap: wrap;
  }
  
  .tb-group {
    min-width: 45%;
  }
  
  #painelProps { /* FIX: renomeado de .painel-drawer */
    width: 280px;
  }
  
  .modelos-grid { /* FIX: renomeado de .modelo-grid */
    grid-template-columns: repeat(2, 1fr);
  }
}

/* === MEDIUM (768px - 1023px) === */
@media (min-width: 768px) and (max-width: 1023px) {
  #painelProps { /* FIX: renomeado de .painel-drawer */
    width: 320px;
  }
  
  .modelos-grid { /* FIX: renomeado de .modelo-grid */
    grid-template-columns: repeat(3, 1fr);
  }
  
  .tab-bar {
    font-size: 12px;
  }
}

/* === LARGE (1024px - 1439px) === */
@media (min-width: 1024px) and (max-width: 1439px) {
  /* FIX: removido o .app-container quebrando layout */
  
  #painelProps { /* FIX: renomeado de .painel-drawer */
    position: sticky;
    top: 0;
    height: 100dvh; /* FIX: adaptado para dvh */
  }
}

/* === EXTRA LARGE (1440px+) === */
@media (min-width: 1440px) {
  /* FIX: removido o .app-container max-width limitando a tela toda */
  
  #painelProps { /* FIX: renomeado de .painel-drawer */
    width: 360px;
  }
}

/* === LANDSCAPE FIX (altura limitada) === */
@media (max-height: 500px) and (orientation: landscape) {
  .app-header {
    height: 44px;
  }
  
  .tab-bar {
    flex-direction: row;
    overflow-x: auto;
  }
  
  .modal-box {
    max-height: calc(100vh - 40px);
    overflow-y: auto;
  }
}

/* === TOUCH DEVICES === */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px; /* Apple guideline */
    padding: 12px 16px;
  }
  
  .tab-btn {
    min-width: 60px;
    padding: 12px;
  }
  
  .canvas-fab {
    width: 56px;
    height: 56px;
  }
}
