/* ================================================================
   PEDAGOGIA TEC — SISTEMA DE DESIGN
   Base de TODAS as páginas (home, ferramentas, perfil, admin, suporte).
   home.css adiciona apenas o layout exclusivo da página inicial.

   Sumário
    1. Tokens (cores, raios, sombras)
    2. Base e reset
    3. Layout das ferramentas
    4. Cabeçalho das ferramentas
    5. Título da ferramenta (hero)
    6. Formulários
    7. Botões e chips
    8. Pré-visualização e modal ampliado
    9. Áreas de upload
   10. Agrupador de atividades (pdf-imagem-comp)
   11. Carregamento e avisos (toast)
   12. Barra fixa do celular
   13. Conteúdo educativo e FAQ
   14. Rodapé
   15. Login, menu do usuário e modal
   16. Utilitários e animações
   17. Responsivo
   ================================================================ */

/* ================================================================
   1. TOKENS
   ================================================================ */
:root, body.dark-theme {
  --bg: #0a0a0a;
  --bg-dark: #0a0a0a;
  --surface: #141414;
  --surface-2: #1b1b1b;
  --surface-hover: #1f1f1f;
  --field-bg: #0f0f0f;
  --glass-bg: rgba(20, 20, 20, 0.92);
  --border: #262626;
  --border-hover: #3a3a3a;
  --glass-border: #262626;
  --glass-border-hover: #3a3a3a;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-contrast: #ffffff;
  --primary-light: rgba(59, 130, 246, 0.12);
  --primary-border: rgba(59, 130, 246, 0.35);

  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: rgba(59, 130, 246, 0.1);

  --secondary: #1f1f1f;
  --secondary-hover: #2a2a2a;

  --text: #ededed;
  --text-main: #ededed;
  --text-body: #d4d4d4;
  --text-secondary: #b3b3b3;
  --text-muted: #8f8f8f;
  --text-subtle: #6b6b6b;

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-soft: rgba(245, 158, 11, 0.12);
  --accent-gold: #f59e0b;
  --accent-gold-soft: rgba(245, 158, 11, 0.15);

  --tag-new: #fbbf24;
  --tag-new-bg: rgba(245, 158, 11, 0.12);
  --tag-essential: #60a5fa;
  --tag-essential-bg: rgba(59, 130, 246, 0.12);

  --gradient-accent: linear-gradient(135deg, #ededed, #b3b3b3);

  --radius: 6px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-full: 9999px;

  --transition: all 0.15s ease;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
  --card-shadow: none;
  --card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.35);

  --header-height: 56px;
  color-scheme: dark;
}

/* ================================================================
   2. BASE E RESET
   ================================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text-body);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
  line-height: 1.25;
  letter-spacing: -0.015em;
}

a {
  color: var(--accent);
}

img,
canvas,
svg,
video {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  background: rgba(59, 130, 246, 0.35);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2e2e2e; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3d3d3d; }

/* Fundos decorativos antigos: desativados no design atual */
.bg-blobs,
.blob {
  display: none !important;
}

/* ================================================================
   3. LAYOUT DAS FERRAMENTAS
   ================================================================ */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.tool-page {
  min-height: 100vh;
  background-color: var(--bg);
}

.tool-main {
  padding: 2rem 0 3rem;
}

.main-content {
  display: grid;
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.left-panel,
.right-panel,
.glass-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  min-width: 0;
}

.left-panel,
.right-panel {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

/* Painel de configurações acompanha a rolagem no desktop */
@media (min-width: 1025px) {
  .main-content > .right-panel {
    position: sticky;
    top: calc(var(--header-height) + 1rem);
  }
}

.left-panel h3,
.right-panel h3,
.left-panel h4,
.right-panel h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.panel-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.subtitle {
  color: var(--text-muted);
  font-weight: 500;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ================================================================
   4. CABEÇALHO DAS FERRAMENTAS
   ================================================================ */
.slim-header {
  position: sticky;
  top: 0;
  z-index: 900;
  height: var(--header-height);
  display: flex;
  align-items: center;
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.slim-header-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 1rem;
  text-decoration: none;
  transition: var(--transition);
}

.back-link:hover {
  color: var(--text);
  border-color: var(--border-hover);
  background: var(--surface-hover);
}

.header-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.header-logo img {
  width: 24px;
  height: 24px;
}

.header-logo:hover {
  color: #fff;
}

.tool-title {
  flex: 1;
  min-width: 0;
  padding-left: 0.75rem;
  margin-left: 0.25rem;
  border-left: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#themeToggleSlot:empty {
  display: none;
}

.tool-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.tool-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 32px;
  padding: 0 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.tool-action-btn:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.tool-action-btn.is-active {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ================================================================
   5. TÍTULO DA FERRAMENTA (HERO)
   ================================================================ */
.tool-hero {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 1.75rem;
}

.tool-hero h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.tool-hero p {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 660px;
  margin: 0 auto;
}

.tool-hero strong {
  color: var(--text-secondary);
}

.bncc-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  background: var(--success-soft);
  color: #86efac;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ================================================================
   6. FORMULÁRIOS
   ================================================================ */
.left-panel label,
.right-panel label,
.form-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
}

.input-dark,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="password"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  background: var(--field-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.4;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
}

select option {
  background: var(--surface);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.input-dark::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--text-subtle);
}

.input-dark:hover,
select:hover,
textarea:hover,
input[type="text"]:hover,
input[type="number"]:hover {
  border-color: var(--border-hover);
}

.input-dark:focus,
select:focus,
textarea:focus,
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input[type="color"] {
  width: 44px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--field-bg);
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
}

input[type="file"] {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.input-large {
  font-size: 0.95rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.form-row > div,
.control-group-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Blocos recolhíveis (ex.: "Cabeçalho da Folha") */
.left-panel details,
.right-panel details {
  background: var(--surface-2) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  padding: 0.75rem 0.9rem !important;
}

.left-panel details > summary,
.right-panel details > summary {
  cursor: pointer;
  color: var(--text) !important;
  font-weight: 600;
  font-size: 0.85rem;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.left-panel details > summary::-webkit-details-marker,
.right-panel details > summary::-webkit-details-marker {
  display: none;
}

.left-panel details > summary::after,
.right-panel details > summary::after {
  content: '▾';
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.15s ease;
}

.left-panel details:not([open]) > summary::after,
.right-panel details:not([open]) > summary::after {
  transform: rotate(-90deg);
}

/* ================================================================
   7. BOTÕES E CHIPS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--secondary);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--secondary-hover);
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.w-full {
  width: 100%;
}

.btn-primary,
.btn-download-pulse,
.btn-accent,
.btn-export-all {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-contrast) !important;
  box-shadow: none;
}

.btn-primary:hover,
.btn-download-pulse:hover,
.btn-accent:hover,
.btn-export-all:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  transform: none;
}

.btn-download-pulse {
  animation: none;
  font-weight: 700;
}

.btn-secondary {
  background: var(--secondary);
  border-color: var(--border);
  color: var(--text);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text);
}

.btn-outline.active,
.btn-outline[aria-pressed="true"] {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--accent-hover);
}

.btn-danger-icon {
  background: transparent;
  color: var(--text-muted);
  padding: 0.25rem;
  font-size: 1.1rem;
}

.btn-danger-icon:hover {
  color: var(--danger);
  background: transparent;
}

/* Chips de modelos prontos */
.btn-preset,
.preset-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border) !important;
  background: var(--surface-2) !important;
  color: var(--text-secondary) !important;
  font-family: inherit;
  font-size: 0.78rem !important;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-preset:hover,
.preset-chip:hover {
  color: var(--text) !important;
  border-color: var(--border-hover) !important;
}

.btn-preset.active,
.preset-chip.active {
  background: var(--primary-light) !important;
  border-color: var(--primary-border) !important;
  color: var(--accent-hover) !important;
}

/* Linha de ações principais do painel (baixar, gabarito...) */
.panel-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.panel-actions .btn {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
}

/* ================================================================
   8. PRÉ-VISUALIZAÇÃO E MODAL AMPLIADO
   ================================================================ */
.preview-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.preview-box > div:first-child h4,
#previewTitle {
  color: var(--text) !important;
  font-size: 0.95rem;
  font-weight: 700;
}

.preview-box canvas,
.preview-box img.preview-page {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Barra de ações do preview: quebra linha no celular */
.preview-toolbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.preview-toolbar > div {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tutorial-overlay,
#previewModal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: ptecFade 0.2s ease;
}

.tutorial-overlay.hidden,
#previewModal.hidden {
  display: none !important;
}

.tutorial-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.75rem;
  box-shadow: var(--shadow-lg);
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.tutorial-header h2 {
  font-size: 1.25rem;
}

.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 1.25rem;
}

.tutorial-step {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  padding: 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.step-number {
  min-width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.step-content h3 {
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.step-content p {
  font-size: 0.86rem;
  color: var(--text-muted);
}

.tutorial-tips {
  background: var(--success-soft);
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  margin-bottom: 1.25rem;
}

.tutorial-tips h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: #86efac;
}

.tutorial-tips ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.tutorial-tips li {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 1.1rem;
  position: relative;
}

.tutorial-tips li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--success);
}

.tutorial-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.disclaimer-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.disclaimer-section h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.disclaimer-section p,
.disclaimer-section li {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.disclaimer-section ul {
  padding-left: 1.2rem;
}

.disclaimer-date {
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* ================================================================
   9. ÁREAS DE UPLOAD
   ================================================================ */
.upload-container,
.upload-area {
  position: relative;
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  transition: var(--transition);
}

.upload-area {
  padding: 1.75rem 1rem;
}

.upload-container:hover,
.upload-container.drag-active,
.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-container .upload-content,
.upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.upload-area .upload-content {
  pointer-events: none;
}

.upload-icon {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--text-muted);
}

.upload-container h3 {
  font-size: 1.15rem;
}

.upload-container p,
.upload-hint {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.hidden-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

/* ================================================================
   10. AGRUPADOR DE ATIVIDADES (pdf-imagem-comp)
   ================================================================ */
.pool-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.thumbnails-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 0.6rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.thumbnail-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  background: #fff;
  transition: var(--transition);
}

.thumbnail-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumbnail-item .filename {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.62rem;
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thumbnail-item.selected {
  border-color: var(--primary);
}

.thumbnail-item.in-group {
  border-color: var(--success);
  opacity: 0.55;
  pointer-events: none;
}

.thumbnail-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: var(--danger);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  cursor: pointer;
  opacity: 0;
  transition: var(--transition);
  z-index: 2;
}

.thumbnail-item:hover .thumbnail-remove,
.thumbnail-item:focus-within .thumbnail-remove {
  opacity: 1;
}

@media (hover: none) {
  .thumbnail-remove { opacity: 1; }
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius-md);
}

.grouping-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.groups-area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.group-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.group-title {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}

.group-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-full);
}

.group-images {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.group-thumb-wrapper {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fff;
  cursor: grab;
}

.group-thumb-wrapper.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}

.group-thumb-wrapper img.group-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.group-thumb-rotate,
.group-thumb-del {
  position: absolute;
  top: 3px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.group-thumb-rotate { left: 3px; background: rgba(0, 0, 0, 0.7); }
.group-thumb-del { right: 3px; background: var(--danger); }

.group-controls {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.group-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

/* ================================================================
   11. CARREGAMENTO E AVISOS
   ================================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.loading-overlay.active,
.loading-overlay:not(.hidden) {
  opacity: 1;
  pointer-events: auto;
}

.loading-overlay.hidden:not(.active) {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ptecSpin 0.9s linear infinite;
}

.loading-text {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  max-width: 320px;
  padding: 0 1rem;
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  z-index: 10000;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 2rem);
}

.toast {
  pointer-events: auto;
  background: #1c1c1c;
  color: var(--text);
  border: 1px solid var(--border-hover);
  border-left: 3px solid var(--accent);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.88rem;
  font-weight: 500;
  animation: ptecToastIn 0.25s ease;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--accent); }

.toast-out {
  opacity: 0;
  transform: translateY(8px);
}

.text-danger {
  color: var(--danger);
  font-weight: 700;
}

/* ================================================================
   12. BARRA FIXA DO CELULAR
   ================================================================ */
.mobile-sticky-bar {
  display: none;
}

@media (max-width: 1024px) {
  .mobile-sticky-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 950;
    gap: 0.6rem;
    padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom));
    background: rgba(10, 10, 10, 0.96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }

  .mobile-sticky-bar .btn {
    flex: 1;
    padding: 0.75rem;
    font-size: 0.92rem;
  }

  body:has(.mobile-sticky-bar) {
    padding-bottom: 4.5rem;
  }

  body:has(.mobile-sticky-bar) .toast-container {
    bottom: 5.5rem;
  }
}

/* ================================================================
   13. CONTEÚDO EDUCATIVO (SEO) E FAQ
   ================================================================ */
.seo-content-section {
  max-width: 900px;
  margin: 3rem auto 0;
}

.seo-content-section > .glass-panel,
.seo-content-section.glass-panel {
  padding: 2rem !important;
}

.seo-content-section h2 {
  font-size: 1.35rem;
  margin-bottom: 0.85rem;
}

.seo-content-section h3 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.5rem;
}

.seo-content-section p,
.seo-content-section li {
  color: var(--text-muted);
  font-size: 0.93rem;
  line-height: 1.75;
}

.seo-content-section p + p {
  margin-top: 0.75rem;
}

.seo-content-section ul,
.seo-content-section ol {
  padding-left: 1.3rem;
  margin: 0.5rem 0;
}

.seo-content-section strong {
  color: var(--text-secondary);
}

.faq-accordion,
.faq-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.faq-accordion details,
.faq-container details,
.faq-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-accordion summary,
.faq-container summary,
.faq-question {
  cursor: pointer;
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.faq-accordion summary::-webkit-details-marker,
.faq-container summary::-webkit-details-marker {
  display: none;
}

.faq-accordion summary::after,
.faq-container summary::after {
  content: '+';
  color: var(--text-muted);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.faq-accordion details[open] summary::after,
.faq-container details[open] summary::after {
  content: '−';
}

.faq-accordion details > p,
.faq-accordion details > div,
.faq-container details > p,
.faq-container details > div,
.faq-answer,
.faq-content {
  padding: 0 1rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ================================================================
   14. RODAPÉ
   ================================================================ */
.app-footer,
.footer-rich {
  margin-top: 4rem;
  background: var(--bg);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
}

.footer-rich-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 0 2rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2.5rem;
}

.footer-col h4 {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.footer-col p {
  font-size: 0.86rem;
  line-height: 1.6;
}

.footer-col a {
  display: block;
  font-size: 0.86rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.2rem 0;
  transition: color 0.15s ease;
}

.footer-col a:hover {
  color: var(--text);
}

.footer-bottom-line {
  text-align: center;
  padding: 1.25rem 0 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-subtle);
}

/* ================================================================
   15. LOGIN, MENU DO USUÁRIO E MODAL
   ================================================================ */
.auth-btn-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.btn-google-skin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 34px;
  padding: 0 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-hover);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.btn-google-skin:hover {
  background: var(--surface-hover);
  border-color: #4a4a4a;
}

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

.btn-google-skin .google-icon {
  flex-shrink: 0;
}

/* Botão oficial do Google invisível por cima do botão estilizado */
.google-hidden-anchor {
  position: absolute;
  inset: 0;
  opacity: 0.001;
  overflow: hidden;
  z-index: 2;
  cursor: pointer;
}

.google-hidden-anchor > div,
.google-hidden-anchor iframe {
  width: 100% !important;
  height: 100% !important;
  min-width: 100% !important;
  transform: scale(1.4);
  transform-origin: left center;
}

.user-menu-wrapper {
  position: relative;
}

.user-avatar-btn {
  display: flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: var(--transition);
}

.user-avatar-btn:hover {
  border-color: var(--border-hover);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--surface-2);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 250px;
  padding: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  display: none;
}

.user-dropdown.open {
  display: block;
  animation: ptecFade 0.15s ease;
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem;
}

.user-dropdown-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.user-dropdown-name {
  color: var(--text);
  font-weight: 600;
  font-size: 0.88rem;
}

.user-dropdown-email {
  color: var(--text-muted);
  font-size: 0.75rem;
  word-break: break-all;
}

.user-dropdown-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.3rem 0;
}

.user-dropdown-item {
  display: block;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.user-dropdown-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.user-dropdown-admin {
  color: var(--accent);
  font-weight: 600;
}

.user-dropdown-logout:hover {
  color: #fca5a5;
  background: var(--danger-soft);
}

.auth-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9995;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.auth-modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.auth-modal-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  padding: 2rem 1.75rem 1.5rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  transform: translateY(8px);
  transition: transform 0.2s ease;
}

.auth-modal-overlay.open .auth-modal-card {
  transform: translateY(0);
}

.auth-modal-close {
  position: absolute;
  top: 0.6rem;
  right: 0.7rem;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.auth-modal-close:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.auth-modal-icon {
  font-size: 2rem;
  margin-bottom: 0.6rem;
}

.auth-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-modal-desc {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 1.4rem;
}

.auth-modal-actions {
  display: flex;
  justify-content: center;
}

.auth-modal-actions .btn-google-skin {
  height: 42px;
  padding: 0 1.3rem;
  font-size: 0.92rem;
}

.auth-modal-note {
  margin-top: 1.1rem;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.auth-modal-note a {
  color: var(--text-muted);
}

/* ================================================================
   16. UTILITÁRIOS E ANIMAÇÕES
   ================================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.animate-in {
  animation: ptecRise 0.35s ease both;
}

@keyframes ptecSpin { to { transform: rotate(360deg); } }
@keyframes ptecFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ptecRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes ptecToastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

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

/* ================================================================
   17. RESPONSIVO
   ================================================================ */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: minmax(0, 1fr);
  }

  .tool-action-label {
    display: none;
  }

  .tool-action-btn {
    width: 34px;
    padding: 0;
    justify-content: center;
    font-size: 0.95rem;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 52px;
  }

  .container,
  .slim-header-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .tool-main {
    padding-top: 1.25rem;
  }

  .header-logo span,
  .tool-title {
    display: none;
  }

  /* No celular o nome da ferramenta aparece no lugar do logo */
  .slim-header-content {
    gap: 0.5rem;
  }

  .slim-header-content::after {
    content: none;
  }

  .left-panel,
  .right-panel {
    padding: 1rem;
  }

  .form-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .seo-content-section > .glass-panel,
  .seo-content-section.glass-panel {
    padding: 1.25rem !important;
  }

  .footer-rich-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    padding: 2.25rem 0 1.5rem;
  }

  .btn-google-skin .google-btn-text {
    font-size: 0.78rem;
  }
}

@media (max-width: 420px) {
  .btn-google-skin {
    padding: 0 0.6rem;
  }

  .btn-google-skin .google-btn-text {
    display: none;
  }

  .tool-hero h1 {
    font-size: 1.45rem;
  }
}

/* ================================================================
   18. CHAT DE SUPORTE (js/chat-widget.js)
   ================================================================ */
.chat-fab {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 9990;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, background 0.15s ease;
}

.chat-fab:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.chat-fab-close {
  display: none;
  font-size: 1.1rem;
}

.chat-fab.is-open .chat-fab-icon { display: none; }
.chat-fab.is-open .chat-fab-close { display: block; }

.chat-fab-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--danger);
  border: 2px solid var(--bg);
}

.chat-panel {
  position: fixed;
  right: 1.25rem;
  bottom: 5.25rem;
  z-index: 9991;
  width: 370px;
  max-width: calc(100vw - 2rem);
  max-height: min(600px, calc(100vh - 7rem));
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.chat-panel.open {
  display: flex;
  animation: ptecRise 0.2s ease;
}

.chat-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.1rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.chat-panel-header h3 {
  font-size: 0.98rem;
}

.chat-panel-header p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.chat-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  border-radius: var(--radius);
}

.chat-panel-close:hover {
  color: var(--text);
}

.chat-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.chat-tab {
  flex: 1;
  position: relative;
  padding: 0.65rem 0.5rem;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.chat-tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.chat-tab-badge {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 0.3rem;
  border-radius: 50%;
  background: var(--danger);
  vertical-align: middle;
}

.chat-panel-body {
  padding: 1rem 1.1rem 1.1rem;
  overflow-y: auto;
  flex: 1;
}

.chat-view {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.chat-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.3rem;
}

.chat-pill {
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.chat-pill:hover {
  color: var(--text);
  border-color: var(--border-hover);
}

.chat-pill.active {
  border-color: var(--primary-border);
  background: var(--primary-light);
  color: var(--accent-hover);
}

.chat-guest-fields {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

.chat-label span {
  font-weight: 400;
  color: var(--text-subtle);
}

.chat-input {
  font-size: 0.86rem !important;
}

.chat-logged-as {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
}

.chat-logged-as strong {
  color: var(--text);
}

.chat-context {
  font-size: 0.74rem;
  color: var(--text-subtle);
}

.chat-context strong {
  color: var(--text-muted);
  font-weight: 600;
}

.chat-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.chat-error {
  font-size: 0.8rem;
  color: #fca5a5;
}

.chat-send-btn {
  width: 100%;
  margin-top: 0.25rem;
}

.chat-success {
  align-items: center;
  text-align: center;
  padding: 1.5rem 0.5rem;
}

.chat-success-icon {
  font-size: 2.2rem;
}

.chat-success h4 {
  font-size: 1rem;
}

.chat-success p {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.chat-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  padding: 1.5rem 0.5rem;
}

.chat-thread-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.chat-thread:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.chat-thread-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.chat-status {
  font-weight: 700;
  color: var(--text-muted);
}

.chat-status-respondido { color: #86efac; }
.chat-status-novo { color: var(--tag-new); }

.chat-bubble {
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.84rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-bubble-me {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.chat-bubble-team {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--text);
}

.chat-bubble-team strong {
  display: block;
  font-size: 0.72rem;
  color: var(--accent-hover);
  margin-bottom: 0.2rem;
}

.chat-bubble-date {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

body:has(.mobile-sticky-bar) .chat-fab {
  bottom: 1.25rem;
}

@media (max-width: 1024px) {
  body:has(.mobile-sticky-bar) .chat-fab {
    bottom: 5rem;
  }

  body:has(.mobile-sticky-bar) .chat-panel {
    bottom: 9rem;
  }
}

@media (max-width: 480px) {
  .chat-panel,
  body:has(.mobile-sticky-bar) .chat-panel {
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    z-index: 9995;
  }

  .chat-fab {
    right: 1rem;
    bottom: 1rem;
    width: 48px;
    height: 48px;
  }

  .chat-fab.is-open {
    display: none;
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Linhas de título dos painéis e botões longos quebram no celular */
.left-panel > div[style*="space-between"],
.right-panel > div[style*="space-between"] {
  flex-wrap: wrap;
  gap: 0.5rem;
}

@media (max-width: 600px) {
  .btn {
    white-space: normal;
    text-align: center;
  }
}

/* Enquanto o login é pedido, avisos das ferramentas ficam ocultos */
body.ptec-login-open .toast-container {
  display: none;
}

/* ================================================================
   19. ÍCONES (assets/icons.svg — Lucide, licença ISC)
   Uso: <svg class="ico"><use href="assets/icons.svg#download"/></svg>
   ================================================================ */
.ico {
  width: 1.1em;
  height: 1.1em;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.18em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ico-lg {
  width: 1.4em;
  height: 1.4em;
}

.tc-fav-btn.favorited .ico,
.tool-action-btn.is-active .ico {
  fill: currentColor;
}

.auth-modal-icon {
  color: var(--accent);
}

.user-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.user-dropdown-item .ico {
  color: var(--text-muted);
}

.chat-pill .ico {
  width: 0.95em;
  height: 0.95em;
}

/* Rótulos, títulos e botões com ícone */
.btn .ico,
.btn-google-skin .ico,
.preset-chip .ico,
.btn-preset .ico {
  width: 1em;
  height: 1em;
}

.left-panel h3 .ico,
.right-panel h3 .ico,
.preview-box h4 .ico,
summary .ico,
.hero-badge .ico {
  color: var(--accent);
}

/* ================================================================
   20. CARTÃO "GERAR COM IA" (js/ptec-ia.js)
   ================================================================ */
.left-panel details.ia-card,
.right-panel details.ia-card,
details.ia-card {
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.02)) !important;
  border: 1px solid var(--primary-border) !important;
  border-radius: var(--radius-md) !important;
  padding: 0.75rem 0.9rem !important;
  margin-bottom: 0.9rem;
  width: 100%;
}

details.ia-card > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text) !important;
  font-weight: 700;
  font-size: 0.88rem;
}

details.ia-card > summary .ico {
  color: var(--accent);
}

.ia-badge {
  margin-left: auto;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--accent-hover);
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-full);
  padding: 0.08rem 0.45rem;
}

details.ia-card > summary::after {
  display: none !important;
}

.ia-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.ia-desc,
.ia-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.ia-note {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.ia-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.ia-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.ia-field-wide {
  grid-column: 1 / -1;
}

.ia-field label {
  font-size: 0.74rem !important;
  font-weight: 600;
  color: var(--text-secondary);
}

.ia-field label small {
  font-weight: 400;
  color: var(--text-subtle);
}

.ia-field input,
.ia-field select {
  padding: 0.45rem 0.6rem;
  font-size: 0.84rem;
}

.ia-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ia-count {
  font-size: 0.72rem;
  color: var(--text-subtle);
}

.ia-card.is-loading .ia-btn .ico {
  animation: ptecSpin 1.2s linear infinite;
}

/* ================================================================
   21. CONTROLE PELO CELULAR (js/ptec-remote.js)
   ================================================================ */
#ptecRemoteBtn.is-active {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.45);
  background: var(--success-soft);
}

.remote-modal {
  position: fixed;
  inset: 0;
  z-index: 9994;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(4px);
}

.remote-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  padding: 1.75rem 1.5rem 1.4rem;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.remote-card h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
}

.remote-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.remote-qr {
  display: flex;
  justify-content: center;
  margin: 1.1rem auto 0.9rem;
  padding: 10px;
  width: max-content;
  background: #fff;
  border-radius: var(--radius-md);
}

.remote-code {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  color: var(--text);
}

.remote-link {
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.remote-status {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
}

.remote-status.ok {
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.4);
}

.remote-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.1rem;
}

/* ================================================================
   22. MINHAS ATIVIDADES (salvar/abrir)
   ================================================================ */
.salvar-card {
  text-align: left;
  max-width: 440px;
}

.salvar-card h3 {
  justify-content: flex-start;
}

.salvar-form {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0 0.5rem;
}

.salvar-form input {
  flex: 1;
}

.salvar-sobrescrever {
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.salvar-subtitulo {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 1rem 0 0.5rem;
}

.salvar-lista {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 260px;
  overflow-y: auto;
}

.salvar-item {
  display: flex;
  gap: 0.35rem;
}

.salvar-abrir {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.86rem;
  text-align: left;
  cursor: pointer;
}

.salvar-abrir span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.salvar-abrir:hover {
  border-color: var(--border-hover);
}

.salvar-excluir {
  width: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}

.salvar-excluir:hover {
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

.salvar-vazio {
  font-size: 0.84rem;
  color: var(--text-muted);
}
