/* Editor-specific styles, layered on top of ef.css when editing */

/* Acessível só para leitores de tela (oculto visualmente) */
.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;
}

/* ─── Transição entre páginas/rotas (#app) ─── */
#app {
  /* body é display:flex (ef.css) → #app é flex-item. Sem isto ele encolhe
     para a largura do conteúdo e a coluna 1fr do grid colapsa, deixando
     a página estreita com espaço vazio à direita. */
  flex: 1 1 auto;
  min-width: 0;
  transition: opacity 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

#sidebar-root {
  flex-shrink: 0;
}
body.editor-mode #sidebar-root {
  display: none;
}

#app.view-transition-out {
  opacity: 0;
  pointer-events: none;
}

#app.view-transition-in {
  opacity: 1;
}

/* Suppress per-element animations during page nav — the #app fade handles entrance.
   Without this, page-enter + card-enter compound with #app's opacity transition
   and create a quadratic fade that looks like a blink. */
#app[data-transitioning] .app-main,
#app[data-transitioning] .projeto-card,
#app[data-transitioning] .catalog-card,
#app[data-transitioning] .tpl-card,
#app[data-transitioning] .sug-card {
  animation: none;
}

/* Suppress per-element animations during page nav — the #app fade handles entrance.
   Without this, page-enter + card-enter compound with #app's opacity transition
   and create a quadratic fade that looks like a blink. */
#app[data-transitioning] .app-main,
#app[data-transitioning] .projeto-card,
#app[data-transitioning] .catalog-card,
#app[data-transitioning] .tpl-card,
#app[data-transitioning] .sug-card {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  #app,
  #app.view-transition-out,
  #app.view-transition-in {
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* Tipografia da app: `ef.css` (:root --font-app / --font-spec). Aqui só refinamos <select> herdando a stack da app. */

/* Sidebar da app (home, editor, versões): largura única p/ grid + botão hambúrguer. */
:root {
  --app-sidebar-w: 260px;
  --ef-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ef-ease-snap: cubic-bezier(0.34, 1.2, 0.64, 1);
  --ef-dur-fast: 0.16s;
  --ef-dur-med: 0.28s;
  --ef-dur-slow: 0.38s;
}

/* Sidebar: barra fina fosca (home + editor — sem gradiente “metálico” no thumb). */
body.editor-mode .app-side .side-nav,
body.home-mode .app-side .side-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) rgba(0, 0, 0, 0.22);
}
body.editor-mode .app-side .side-nav::-webkit-scrollbar,
body.home-mode .app-side .side-nav::-webkit-scrollbar {
  width: var(--scrollbar-w, 9px);
}
body.editor-mode .app-side .side-nav::-webkit-scrollbar-track,
body.home-mode .app-side .side-nav::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 100px;
  margin: 6px 0 8px;
}
body.editor-mode .app-side .side-nav::-webkit-scrollbar-thumb,
body.home-mode .app-side .side-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.26);
  border-radius: 100px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
body.editor-mode .app-side .side-nav::-webkit-scrollbar-thumb:hover,
body.home-mode .app-side .side-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.36);
  background-clip: padding-box;
}

body.editor-mode {
  display: block;
}

/* O botão hambúrguer fica FORA do grid (position:fixed), senão ele rouba a 1ª coluna e empurra sidebar+main. */
.app-shell {
  display: block;
  min-height: 100vh;
}

.app-shell-grid {
  display: grid;
  grid-template-columns: var(--app-sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .25s ease;
}

.app-side {
  /* Tokens: mesma linguagem visual na home e no editor (minimal, escura). */
  --side-pad-x: 12px;
  --side-item-inset: 10px;
  --side-item-radius: 8px;
  --side-line: rgba(255, 255, 255, 0.09);
  --side-line-strong: rgba(255, 255, 255, 0.13);
  --side-text: rgba(230, 242, 255, 0.92);
  --side-text-link: rgba(220, 235, 255, 0.9);
  --side-muted: rgba(175, 205, 240, 0.55);
  --side-label: rgba(175, 205, 240, 0.48);
  --side-hover: rgba(100, 170, 255, 0.2);
  --side-hover-strong: rgba(100, 170, 255, 0.26);
  --side-active: rgba(100, 170, 255, 0.3);
  background: linear-gradient(180deg, #061e3d 0%, #030d1c 100%);
  color: var(--side-text);
  box-shadow: none;
  position: sticky;
  top: 0;
  align-self: start;
  width: var(--app-sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width .25s ease, opacity .15s ease;
}

/* ── Dark theme unified surface palette ──
   --dark-surface (#0e2040): sidebar, cards, toolbar, buttons
   --dark-canvas  (#071525): body bg — slightly darker so surfaces lift off it  */
html[data-theme="dark"] body.editor-mode,
html[data-theme="dark"] body.home-mode {
  --app-canvas-bg: #071525;
  --white: #0e2040;
  --gray-50:  #071525;
  --gray-100: #0c1d38;
  --gray-200: #1b3a5e;
  --scrollbar-track: rgba(4, 10, 22, 0.95);
  --card-hover-bg: #112548;
  --card-border: rgba(255,255,255,.08);
  --card-border-hover: rgba(255,255,255,.14);
}

html[data-theme="dark"] body.editor-mode .app-side,
html[data-theme="dark"] body.home-mode .app-side {
  background: linear-gradient(180deg, #061e3d 0%, #030d1c 100%);
  border-right: 1px solid rgba(30, 74, 120, 0.55);
  box-shadow: 2px 0 20px rgba(0, 4, 18, 0.5);
}
html[data-theme="light"] body.editor-mode .app-side,
html[data-theme="light"] body.home-mode .app-side {
  background: linear-gradient(180deg, #051f3a 0%, #030d1c 100%);
  border-right: 1px solid rgba(0, 28, 56, 0.22);
  box-shadow: none;
}

.app-side .side-nav {
  flex: 1;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px 0 14px;
}

.app-side {
  min-width: 0;
}

.app-side .side-footer,
.app-side .side-footer-theme-wrap {
  min-width: 0;
  overflow-x: hidden;
}

.app-side .side-footer {
  border-top: 1px solid var(--side-line);
  padding: 3px 0 6px;
  background: rgba(0, 0, 0, 0.12);
}
.app-side .side-footer .side-group-label {
  padding-top: 6px;
  padding-bottom: 2px;
}
.app-side .side-footer .side-link {
  padding-top: 5px;
  padding-bottom: 5px;
  font-size: 12px;
}
.app-side .side-build {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.28);
  padding: 4px calc(var(--side-pad-x) + var(--side-item-inset)) 0;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.3px;
}

/* Mesmo verde dos botões .btn.success — sem gradiente nem brilho “neon”. */
.btn-add-secao {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid rgba(74,222,128,.35);
  border-radius: 8px;
  background: transparent;
  color: #4ade80;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: inherit;
  box-shadow: none;
}
.btn-add-secao:hover {
  background: rgba(74,222,128,.1);
  border-color: rgba(74,222,128,.6);
  box-shadow: none;
  transform: none;
}
.btn-add-secao:active {
  background: rgba(74,222,128,.16);
  box-shadow: none;
}
.btn-add-secao .plus {
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--gray-200, #e5e7eb);
  color: var(--gray-700, #4a5568);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
  user-select: none;
}
.help-icon:hover {
  background: var(--blue, #0057b8);
  color: #fff;
}

/* ── Brand ── */
.side-brand-wrap {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--side-line);
  flex-shrink: 0;
  min-width: 0;
  overflow: hidden;
}
.app-side .side-brand {
  flex: 1;
  min-width: 0;
  padding: 14px 10px 12px calc(var(--side-pad-x) + 2px);
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .15s ease;
  overflow: hidden;
}
.app-side .side-brand:hover { background: rgba(255,255,255,.04); }

.app-side .side-brand .logo-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,.42);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
}
.app-side .side-brand .doc-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #f6f8ff;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
}
.app-side .side-logo-img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.app-side .side-app-name {
  overflow: hidden;
  text-overflow: ellipsis;
}
/* ── Nav items ── */
.app-side a, .app-side .side-link {
  box-sizing: border-box;
  color: rgba(180,210,255,.75);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.15s ease;
  background: transparent;
  border: none;
  width: calc(100% - 16px);
  text-align: left;
  font-family: inherit;
  line-height: 1;
  position: relative;
}

.app-side .side-link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 18px;
  opacity: 0.7;
}
.app-side .side-link-label { flex: 1; min-width: 0; }

.app-side .side-link.sub {
  padding-left: 22px;
  font-size: 12px;
  color: rgba(180,210,255,.65);
}
.app-side .side-link.sub.active { color: #ffffff; }

.app-side a:hover, .app-side .side-link:hover:not(.side-link-muted):not(.active) {
  color: #fff;
  background: rgba(100,160,255,.14);
}
.app-side a:hover .side-link-icon,
.app-side .side-link:hover .side-link-icon { opacity: 1; }

.app-side a.active, .app-side .side-link.active,
.app-side a.active:hover, .app-side .side-link.active:hover {
  color: #fff;
  background: rgba(59,130,246,.22);
  font-weight: 600;
}
.app-side .side-link.active .side-link-icon { opacity: 1; color: #60a5fa; }
.app-side .side-link.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: #3b82f6;
  border-radius: 0 3px 3px 0;
}

/* Small links (backup) */
.app-side .side-link--small {
  font-size: 12px;
  padding: 8px 14px;
  margin: 2px 8px;
  color: rgba(160,195,255,.6);
}
.app-side .side-link--small:hover { color: rgba(200,225,255,.9); }

.app-side .side-group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(140,180,255,.45);
  padding: 16px 16px 5px;
}
.app-side .side-group-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.7;
  color: rgba(140,180,255,.7);
}
.app-side .side-group-label.side-group-label--secoes-root {
  padding-top: 10px;
  padding-bottom: 2px;
}

/* Tela de versões: brand simples (h3 + small) */
.app-side .side-brand h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: #f6f8ff;
  line-height: 1.35;
}
.app-side .side-brand > small {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: rgba(198, 216, 255, 0.78);
}



.app-side .side-link.side-link-muted {
  color: var(--side-muted);
  font-size: 12px;
  padding: 6px 14px;
}
.app-side .side-link.side-link-muted:hover {
  color: rgba(240,248,255,.95);
  background: rgba(255,255,255,.06);
}
.app-side .side-link--logout {
  color: rgba(224,92,92,.7) !important;
}
.app-side .side-link--logout:hover {
  color: #ef4444 !important;
  background: rgba(239,68,68,.1) !important;
}

.side-footer-editor-actions {
  padding: 10px var(--side-pad-x);
}

.app-side .side-actions {
  padding: 12px calc(var(--side-pad-x) + var(--side-item-inset));
  border-top: 1px solid var(--side-line);
  margin-top: auto;
}

/* HAMBÚRGUER — quando aberta fica encostado na borda direita da sidebar; quando colapsada volta pro canto esquerdo da tela */

.app-main {
  padding: 24px 28px 80px;
  /* Mesma largura do conteúdo do editor (.editor-a4-scroll = 860px) */
  max-width: 860px;
  /* Impede o "blowout" do track 1fr do grid: sem isto, conteúdo com
     min-content largo (chips, toolbar) faz a coluna crescer além do 1fr,
     deixando a Home mais larga que as demais páginas. */
  min-width: 0;
  animation: page-enter 0.28s var(--ef-ease-out, ease) both;
}

/* ─── Editor EF: miolo alinhado ao HTML exportado (SPEC · MD3) ─── */
#editor-main.editor-spec-a4 {
  --md-primary: #0041a2;
  --md-primary-container: #0b57d0;
  --md-primary-fixed: #dae2ff;
  --md-on-primary: #ffffff;
  --md-surface-dim: #d7dade;
  --md-surface-lowest: #ffffff;
  --md-surface-low: #f1f4f7;
  --md-surface-container: #ebeef1;
  --md-outline-variant: #c3c6d6;
  --md-on-surface: #181c1f;
  --md-on-surface-variant: #424654;
  max-width: none;
  /* Mesmo respiro da lista Projetos (.app-main): conteúdo encosta à esquerda da coluna */
  padding: 24px 28px 80px;
  background: var(--md-surface-dim);
  font-family: var(--font-app);
  font-size: 10pt;
  color: var(--md-on-surface);
}

#editor-main.editor-spec-a4 .editor-a4-scroll {
  /* Mesma largura da folha .a4-page (860px) — toolbar e spec alinhadas */
  max-width: 860px;
  margin: 0;
}

/* Folha 860px: encolhe proporcionalmente (zoom) quando o miolo é mais estreito — evita truncar. */
#editor-main.editor-spec-a4 .ef-a4-viewport {
  box-sizing: border-box;
  width: 100%;
  max-width: 860px;
  margin: 0 0 32px 0;
  padding: 0;
}

#editor-main.editor-spec-a4 .a4-page {
  width: 860px;
  max-width: none;
  min-height: 400px;
  margin: 0;
  padding: 72px 80px 48px;
  /* Folha: “ilha” clara — mesmos tokens que :root no tema claro (RF, .btn, escopo), independente de html[data-theme="dark"] */
  --navy: #002f5f;
  --navy-dark: #001e3e;
  --blue: #0057b8;
  --blue-light: #e8f0fc;
  --blue-mid: #ccddf5;
  --green: #16a34a;
  --green-dark: #15803d;
  --green-bg: #dafbe1;
  /* Verde sóbrio (download / nova seção): menos saturado e sem brilho neon */
  --green-btn: #2f7d57;
  --green-btn-hover: #266647;
  --red: #c0392b;
  --red-bg: #fde8e6;
  --orange: #9a5700;
  --orange-bg: #fff3cd;
  --yellow: #e6a817;
  --yellow-bg: #fef9e7;
  --gray-50: #f6f8fa;
  --gray-100: #eaeef2;
  --gray-200: #d0d7de;
  --gray-300: #afb8c1;
  --gray-400: #8c959f;
  --gray-500: #6b7280;
  --gray-600: #57606a;
  --gray-800: #24292f;
  --white: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 8px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --md-primary: #0041a2;
  --md-primary-container: #0b57d0;
  --md-primary-fixed: #dae2ff;
  --md-on-primary: #ffffff;
  --md-surface-lowest: #ffffff;
  --md-surface-low: #f1f4f7;
  --md-surface-container: #ebeef1;
  --md-surface-high: #e5e8ec;
  --md-outline-variant: #c3c6d6;
  --md-on-surface: #181c1f;
  --md-on-surface-variant: #424654;
  background: #ffffff;
  color: #181c1f;
  border: 1px solid var(--md-outline-variant);
  box-shadow: 0 4px 24px rgba(24, 28, 31, 0.12);
  position: relative;
  overflow: hidden;
  /* Folha SPEC: Inter (alinhado a refs/EF-2026-01-001-*.html, 10pt) */
  font-family: var(--font-spec);
  font-size: 10pt;
}

#editor-main.editor-spec-a4 .ef-a4-viewport .a4-page {
  margin: 0;
}

/* Vence `html[data-theme="dark"] .btn.primary|success { color: … }` no miolo da folha */
#editor-main.editor-spec-a4 .a4-page .btn.primary,
#editor-main.editor-spec-a4 .a4-page .btn.primary:hover,
#editor-main.editor-spec-a4 .a4-page .btn.success,
#editor-main.editor-spec-a4 .a4-page .btn.success:hover {
  color: #ffffff;
}

/* Painéis claros: no tema claro somem no fundo branco; no escuro = cabeçalho/meta/rodapé editáveis */
#editor-main.editor-spec-a4 .editor-spec-light-panel {
  background: transparent;
}

#editor-main.editor-spec-a4 .editor-spec-sections-matter {
  background: transparent;
  min-height: 120px;
}

/* Ícones Material: alinhado a refs/EF-*.html — FILL 0, wght 400, cor primária opaca no h2 */
#editor-main.editor-spec-a4 .a4-page .material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  font-size: 16px;
  line-height: 1;
  vertical-align: middle;
  display: inline-block;
  opacity: 1;
  color: var(--md-on-surface-variant);
}
#editor-main.editor-spec-a4 .a4-page h2 .material-symbols-outlined,
#editor-main.editor-spec-a4 .a4-page .spec-doc-section h2 .material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  color: var(--md-primary);
  font-size: 15px;
}
#editor-main.editor-spec-a4 .a4-page .spec-sec-emoji {
  opacity: 1;
  filter: none;
}
#editor-main.editor-spec-a4 .a4-page h2 .spec-sec-emoji {
  opacity: 1;
}

#editor-main.editor-spec-a4 .bloco-render .material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  color: var(--md-on-surface-variant);
  opacity: 1;
}

#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .doc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0 0 18px 0;
  margin: 0 0 24px 0;
  border: none;
  border-radius: 0;
  border-bottom: 2px solid var(--md-primary-fixed);
  box-shadow: none;
  background: transparent;
  color: inherit;
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .doc-header-wordmark {
  font-size: 9pt;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--md-on-surface-variant);
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .doc-header-title {
  font-size: 16pt;
  font-weight: 700;
  color: var(--md-primary);
  line-height: 1.2;
  margin-top: 6px;
  letter-spacing: -0.3px;
  max-width: 500px;
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .doc-header-meta {
  text-align: right;
  font-size: 8pt;
  color: var(--md-on-surface-variant);
  line-height: 1.9;
  flex-shrink: 0;
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .doc-header-badge {
  display: inline-block;
  background: var(--md-primary-fixed);
  color: var(--md-primary);
  font-size: 7.5pt;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 9999px;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 28px;
  font-size: 9pt;
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .meta-table td {
  border: 1px solid var(--md-outline-variant);
  padding: 7px 12px;
  vertical-align: top;
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .meta-table td:first-child {
  background: var(--md-surface-low);
  font-weight: 600;
  color: var(--md-on-surface-variant);
  width: 30%;
  text-transform: uppercase;
  font-size: 7.5pt;
  letter-spacing: 0.07em;
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .doc-footer {
  margin-top: 48px;
  padding-top: 14px;
  border-top: 1px solid var(--md-outline-variant);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 7.5pt;
  color: var(--md-on-surface-variant);
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .doc-footer-left {
  display: flex;
  align-items: center;
  gap: 6px;
}
#editor-main.editor-spec-a4 .a4-page .editor-spec-light-panel .doc-footer-left .material-symbols-outlined {
  font-size: 13px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  color: var(--md-primary);
  opacity: 1;
}

#editor-main.editor-spec-a4 .material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 18px;
  line-height: 1;
  vertical-align: middle;
  display: inline-block;
}

/* Barra de ações do EF: mesmo vocabulário visual da sidebar (navy) em claro e escuro */
#editor-main.editor-spec-a4 .editor-spec-toolbar {
  position: sticky;
  top: 8px;
  z-index: 8;
  margin: 0 0 18px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--navy-dark);
  box-shadow: 0 12px 32px rgba(0, 12, 32, 0.38);
}

#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar {
  margin: 0;
  padding: 14px 16px 16px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  color: rgba(255, 255, 255, 0.92);
}

#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar h1.toolbar-proj-titulo {
  color: #ffffff;
  font-weight: 700;
  letter-spacing: -0.02em;
}

#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-proj-codigo {
  font-size: 9pt;
  color: rgba(198, 216, 255, 0.88);
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}

#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-proj-ver {
  color: rgba(198, 216, 255, 0.75);
}

#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.08);
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  border-top-color: rgba(255, 255, 255, 0.14);
  padding-top: 12px;
  padding-bottom: 4px;
  --toolbar-actions-h: 36px;
}
/* ── Controle de zoom do documento (estilo Word) ── */
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-zoom {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  height: var(--toolbar-actions-h, 36px);
  padding: 0 3px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-zoom-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.14s ease, color 0.14s ease, transform 0.08s ease;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-zoom-btn .material-symbols-outlined {
  font-size: 18px;
  line-height: 1;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-zoom-btn:hover {
  background: rgba(100, 170, 255, 0.28);
  color: #fff;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-zoom-btn:active { transform: scale(0.92); }
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-zoom-val {
  min-width: 46px;
  height: 26px;
  padding: 0 6px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-zoom-val:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions::-webkit-scrollbar {
  height: 6px;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.32);
  border-radius: 999px;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.48);
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .btn {
  flex-shrink: 0;
  white-space: nowrap;
  box-sizing: border-box;
  min-height: var(--toolbar-actions-h);
  padding: 0 12px;
  font-size: 12px;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .btn.icon-only {
  min-width: var(--toolbar-actions-h);
  width: var(--toolbar-actions-h);
  padding: 0;
  justify-content: center;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .toolbar-btn-buscar .toolbar-buscar-ico {
  font-family: 'Material Symbols Outlined';
  font-size: 22px;
  line-height: 1;
  font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  color: #f1f5ff;
  opacity: 1;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .toolbar-btn-buscar:hover .toolbar-buscar-ico {
  color: #ffffff;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .toolbar-btn-download {
  margin-left: auto;
  font-weight: 500;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .toolbar-btn-download .toolbar-download-ico {
  font-family: 'Material Symbols Outlined';
  font-size: 22px;
  line-height: 1;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  color: #4ade80;
  opacity: 1;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .toolbar-btn-download:hover .toolbar-download-ico {
  opacity: 1;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .select-status-projeto {
  min-width: 118px;
  max-width: 42vw;
  flex-shrink: 0;
  box-sizing: border-box;
  min-height: var(--toolbar-actions-h);
  padding: 0 28px 0 10px;
  font-size: 11px;
  line-height: 1.2;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .toolbar-status-wrap {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--toolbar-actions-h);
}

#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-status-label {
  color: rgba(214, 228, 255, 0.85);
}

#editor-main.editor-spec-a4 .editor-spec-toolbar .select-status-projeto {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-family: inherit;
}

/* ── Toolbar editor buttons: add transition (dark toolbar context) ── */
#editor-main.editor-spec-a4 .editor-spec-toolbar .btn {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.38);
  color: #dbeafe;
  transition:
    background var(--ef-dur-fast, 0.16s) ease,
    border-color var(--ef-dur-fast, 0.16s) ease,
    box-shadow var(--ef-dur-fast, 0.16s) ease,
    transform var(--ef-dur-fast, 0.16s) var(--ef-ease-out, ease);
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .btn:hover {
  background: rgba(59, 130, 246, 0.26);
  border-color: rgba(96, 165, 250, 0.6);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .btn:active {
  transform: translateY(1px) scale(0.97);
  transition-duration: 0.06s;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .btn.primary {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .btn.primary:hover {
  background: #1d4ed8;
  box-shadow: 0 4px 16px rgba(37,99,235,.5);
  transform: translateY(-2px) scale(1.03);
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .btn.success {
  background: transparent;
  border-color: rgba(74,222,128,.35);
  color: #4ade80;
  box-shadow: none;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .btn.success:hover {
  background: rgba(74,222,128,.1);
  border-color: rgba(74,222,128,.6);
  box-shadow: none;
  transform: none;
}
#editor-main.editor-spec-a4 .editor-spec-toolbar .toolbar-actions .btn.icon-only svg {
  stroke: currentColor;
  display: block;
  width: 20px;
  height: 20px;
}

#editor-main.editor-spec-a4 #secoes-render > section {
  background: rgba(0, 41, 102, 0.06);
  border: 1px solid rgba(0, 65, 162, 0.18);
  border-radius: 10px;
  box-shadow: none;
  padding: 12px 14px 16px;
  margin: 0 0 28px;
  transition:
    background var(--ef-dur-med, 0.28s) var(--ef-ease-out, ease),
    border-color var(--ef-dur-med, 0.28s) ease,
    box-shadow var(--ef-dur-med, 0.28s) ease,
    opacity var(--ef-dur-med, 0.28s) ease,
    transform var(--ef-dur-med, 0.28s) var(--ef-ease-out, ease);
}

/* Entrada inicial do documento no editor */
#editor-main.editor-spec-a4 #secoes-render.editor-secoes-enter > section {
  animation: editor-secao-enter 0.42s var(--ef-ease-out, ease) backwards;
}
#editor-main.editor-spec-a4 #secoes-render.editor-secoes-enter > section:nth-child(1) { animation-delay: 0ms; }
#editor-main.editor-spec-a4 #secoes-render.editor-secoes-enter > section:nth-child(2) { animation-delay: 35ms; }
#editor-main.editor-spec-a4 #secoes-render.editor-secoes-enter > section:nth-child(3) { animation-delay: 70ms; }
#editor-main.editor-spec-a4 #secoes-render.editor-secoes-enter > section:nth-child(n+4) { animation-delay: 100ms; }

@keyframes editor-secao-enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Navegação entre seções (sidebar / busca) */
body.editor-mode #secoes-render.secao-navigating > section:not(.secao-nav-target) {
  opacity: 0.42;
}

body.editor-mode #secoes-render.secao-navigating > section.secao-nav-target {
  opacity: 1;
}

#editor-main.editor-spec-a4 #secoes-render > section.secao-nav-highlight {
  border-color: rgba(0, 87, 184, 0.55);
  box-shadow:
    0 0 0 2px rgba(0, 87, 184, 0.2),
    0 8px 24px rgba(0, 65, 162, 0.12);
  animation: secao-nav-pulse 0.9s var(--ef-ease-out, ease);
}

@keyframes secao-nav-pulse {
  0% {
    background: rgba(100, 170, 255, 0.22);
    transform: scale(1.008);
  }
  100% {
    background: rgba(0, 41, 102, 0.06);
    transform: scale(1);
  }
}

#editor-main.editor-spec-a4 #secoes-render > section.spec-doc-section--new {
  background: rgba(0, 41, 102, 0.08);
  border-color: rgba(0, 65, 162, 0.28);
}

/* Seção injetada por estar faltando na importação */
#editor-main.editor-spec-a4 #secoes-render > section.spec-doc-section--faltando {
  background: rgba(245, 158, 11, 0.07);
  border-color: rgba(245, 158, 11, 0.4);
  border-style: dashed;
}
.faltando-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  background: #f59e0b;
  color: #1a1205;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  vertical-align: middle;
}
.section-side-item .side-faltando-tag {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 10px;
  padding: 1px 5px;
  margin-left: 6px;
}
.side-link.faltando-item .side-sec-label {
  color: #f59e0b;
}

#editor-main.editor-spec-a4 .section-edit-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin: 0 0 12px;
  padding: 8px 12px;
  background: rgba(0, 47, 95, 0.14);
  border: 1px solid rgba(0, 65, 162, 0.28);
  border-radius: 8px;
  font-size: 8pt;
  color: var(--md-on-surface-variant);
  transition:
    background var(--ef-dur-fast, 0.16s) ease,
    border-color var(--ef-dur-fast, 0.16s) ease;
}

#editor-main.editor-spec-a4 .section-edit-meta strong {
  color: var(--md-on-surface-variant) !important;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 7pt;
}

#editor-main.editor-spec-a4 .section-edit-meta .grow {
  color: var(--md-on-surface);
  font-weight: 500;
}

#editor-main.editor-spec-a4 .section-meta-grupo {
  color: var(--md-on-surface-variant);
  font-size: 8pt;
  flex: 1 1 auto;
}

#editor-main.editor-spec-a4 .section-edit-meta .btn.small {
  font-size: 8pt;
  padding: 4px 10px;
}

#editor-main.editor-spec-a4 #secoes-render > section h2 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  font-size: 10pt;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--md-on-surface-variant);
  margin: 32px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--md-outline-variant);
}

#editor-main.editor-spec-a4 #secoes-render > section:first-child h2 {
  margin-top: 0;
}

#editor-main.editor-spec-a4 #secoes-render > section h2 .sec-emoji-btn.spec-sec-icon-btn {
  color: var(--md-primary);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  min-height: 26px;
  padding: 0 2px;
  margin: 0 4px 0 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  vertical-align: middle;
  transition: background 0.12s ease;
}
#editor-main.editor-spec-a4 #secoes-render > section h2 .sec-emoji-btn .spec-sec-icon.material-symbols-outlined {
  font-size: 15px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
  color: var(--md-primary);
  opacity: 1;
}
#editor-main.editor-spec-a4 #secoes-render > section h2 .sec-emoji-btn .spec-sec-emoji {
  font-size: 15px;
  line-height: 1;
  opacity: 1;
  filter: none;
}
#editor-main.editor-spec-a4 #secoes-render > section h2 .sec-emoji-btn.spec-sec-icon-btn:hover {
  background: rgba(0, 65, 162, 0.08);
}
#editor-main.editor-spec-a4 #secoes-render > section h2 .sec-emoji-btn.spec-sec-icon-btn:focus-visible {
  outline: 2px solid var(--md-primary);
  outline-offset: 2px;
}

#editor-main.editor-spec-a4 #secoes-render > section h2 .spec-sec-heading {
  flex: 1 1 160px;
  font-size: inherit;
  font-weight: 700;
  letter-spacing: inherit;
  color: inherit;
  cursor: text;
}

#editor-main.editor-spec-a4 #secoes-render > section h2 .spec-sec-num-prefix {
  pointer-events: none;
  user-select: none;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.form-hint--secao-num {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--gray-600);
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

#editor-main.editor-spec-a4 #secoes-render > section h2 .spec-sec-titulo-text {
  border-radius: 4px;
  transition: background var(--ef-dur-fast, 0.16s) ease;
}

#editor-main.editor-spec-a4 #secoes-render > section h2 .spec-sec-heading:hover .spec-sec-titulo-text {
  background: rgba(100, 170, 255, 0.14);
}

#editor-main.editor-spec-a4 #secoes-render > section.secao-titulo-inline-editing .spec-sec-titulo-text.bloco-inline-zone {
  outline: 2px solid rgba(0, 87, 184, 0.45);
  outline-offset: 2px;
  background: rgba(100, 170, 255, 0.14);
}

#editor-main.editor-spec-a4 #secoes-render > section h2 .new-badge {
  font-size: 9px;
  letter-spacing: 0.06em;
}

#editor-main.editor-spec-a4 .bloco-render h3 {
  font-size: 9.5pt;
  font-weight: 600;
  color: var(--md-on-surface);
  margin: 18px 0 6px;
}

#editor-main.editor-spec-a4 .bloco-render h4 {
  font-size: 9pt;
  font-weight: 600;
  color: var(--md-primary);
  margin: 12px 0 4px;
}

#editor-main.editor-spec-a4 .bloco-render p,
#editor-main.editor-spec-a4 .bloco-render li {
  font-size: 10pt;
  line-height: 1.65;
  color: var(--md-on-surface);
}

#editor-main.editor-spec-a4 .bloco-render code:not(.contract-box pre code):not(.contract-box pre code *) {
  background: var(--md-surface-high);
  color: var(--md-primary-container);
  border: 1px solid var(--md-outline-variant);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 8.5pt;
}

#editor-main.editor-spec-a4 .a4-page .contract-box pre code,
#editor-main.editor-spec-a4 .a4-page .contract-box pre code * {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  box-shadow: none !important;
  color: #181c1f !important;
}

#editor-main.editor-spec-a4 .a4-page .table-wrap {
  border: 1px solid var(--md-outline-variant);
  border-radius: 8px;
  overflow: hidden;
  margin: 14px 0;
}

#editor-main.editor-spec-a4 .a4-page .table-wrap table thead th {
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-size: 7.5pt;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-bottom: none;
}

#editor-main.editor-spec-a4 .a4-page .table-wrap table thead th:first-child {
  border-radius: 0;
}

#editor-main.editor-spec-a4 .a4-page .table-wrap table tbody tr:nth-child(even) td {
  background: var(--md-surface-low);
}

#editor-main.editor-spec-a4 .a4-page .table-wrap table tbody td {
  border-color: var(--md-outline-variant);
  font-size: 8.5pt;
}

#editor-main.editor-spec-a4 .a4-page .callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 12px 0;
  font-size: 9pt;
  line-height: 1.55;
}
#editor-main.editor-spec-a4 .a4-page .callout .callout-body {
  flex: 1;
  min-width: 0;
}
#editor-main.editor-spec-a4 .a4-page .callout.info,
#editor-main.editor-spec-a4 .a4-page .callout.callout-info {
  border-left: 3px solid var(--md-primary);
  background: var(--md-primary-fixed);
  color: #001a4d;
  border-radius: 8px;
}
#editor-main.editor-spec-a4 .a4-page .callout.warn,
#editor-main.editor-spec-a4 .a4-page .callout.callout-warning {
  border-left: 3px solid #f59e0b;
  background: #fff8e1;
  color: #78350f;
}
#editor-main.editor-spec-a4 .a4-page .callout.danger,
#editor-main.editor-spec-a4 .a4-page .callout.callout-error {
  border-left: 3px solid #ba1a1a;
  background: #ffdad6;
  color: #93000a;
}
#editor-main.editor-spec-a4 .a4-page .callout.success,
#editor-main.editor-spec-a4 .a4-page .callout.callout-check {
  border-left: 3px solid #22c55e;
  background: #e8f5e9;
  color: #14532d;
}

#editor-main.editor-spec-a4 .a4-page .callout .material-symbols-outlined {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 1;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 20;
}
#editor-main.editor-spec-a4 .a4-page .callout.info .material-symbols-outlined,
#editor-main.editor-spec-a4 .a4-page .callout.callout-info .material-symbols-outlined {
  color: var(--md-primary);
}
#editor-main.editor-spec-a4 .a4-page .callout.warn .material-symbols-outlined,
#editor-main.editor-spec-a4 .a4-page .callout.callout-warning .material-symbols-outlined {
  color: #f59e0b;
}
#editor-main.editor-spec-a4 .a4-page .callout.danger .material-symbols-outlined,
#editor-main.editor-spec-a4 .a4-page .callout.callout-error .material-symbols-outlined {
  color: #ba1a1a;
}
#editor-main.editor-spec-a4 .a4-page .callout.success .material-symbols-outlined,
#editor-main.editor-spec-a4 .a4-page .callout.callout-check .material-symbols-outlined {
  color: #22c55e;
}

#editor-main.editor-spec-a4 .a4-page .diagram-block,
#editor-main.editor-spec-a4 .a4-page pre.mermaid {
  background: var(--md-surface-low);
  border: 1px solid var(--md-outline-variant);
  border-radius: 10px;
  padding: 20px;
  margin: 14px 0;
  overflow-x: auto;
}

#editor-main.editor-spec-a4 .a4-page .diagram-caption {
  font-size: 8pt;
  color: var(--md-on-surface-variant);
  font-style: italic;
  margin-top: 10px;
  text-align: center;
}

#editor-main.editor-spec-a4 .a4-page .lgpd-tag {
  font-size: 7.5pt;
}

#editor-main.editor-spec-a4 .a4-page .pendente {
  background: #dae2ff;
  color: #0041a2;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

#editor-main.editor-spec-a4 .a4-page .rf-block {
  background: var(--md-surface-low);
  border: 1px solid var(--md-outline-variant);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 14px;
}

#editor-main.editor-spec-a4 .a4-page .rf-badge {
  background: var(--md-primary);
  color: var(--md-on-primary);
  font-size: 7.5pt;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#editor-main.editor-spec-a4 .a4-page .rf-title {
  font-size: 10pt;
}

#editor-main.editor-spec-a4 .a4-page .rf-meta {
  font-size: 8pt;
  margin-bottom: 10px;
}

#editor-main.editor-spec-a4 .a4-page .rf-meta .material-symbols-outlined {
  font-size: 13px;
}

#editor-main.editor-spec-a4 .a4-page .badge-alta,
#editor-main.editor-spec-a4 .a4-page .badge-media,
#editor-main.editor-spec-a4 .a4-page .badge-baixa {
  font-size: 7.5pt;
}

#editor-main.editor-spec-a4 .a4-page .checklist {
  list-style: none;
  padding-left: 0;
}

#editor-main.editor-spec-a4 .a4-page .checklist li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid var(--md-surface-high);
  font-size: 9pt;
}

#editor-main.editor-spec-a4 .a4-page .checklist li:last-child {
  border-bottom: none;
}

#editor-main.editor-spec-a4 .a4-page .checklist li > .material-symbols-outlined {
  font-size: 15px;
  color: var(--md-outline-variant);
  flex-shrink: 0;
  margin-top: 1px;
}

#editor-main.editor-spec-a4 .bloco-wrap {
  border-radius: 8px;
  transition:
    background var(--ef-dur-fast, 0.16s) ease,
    transform var(--ef-dur-med, 0.28s) var(--ef-ease-out, ease),
    box-shadow var(--ef-dur-med, 0.28s) ease;
}

#editor-main.editor-spec-a4 .bloco-render[data-inline-editable]:hover {
  background: rgba(100, 170, 255, 0.14);
  border-radius: 6px;
  cursor: text;
  transition: background var(--ef-dur-fast, 0.16s) ease;
}

#editor-main.editor-spec-a4 .bloco-wrap.bloco-inline-editing .bloco-render {
  background: transparent;
}

#editor-main.editor-spec-a4 .bloco-inline-zone[contenteditable="true"] {
  outline: none;
  border-radius: 4px;
  cursor: text;
  caret-color: var(--md-primary, #0041a2);
}

#editor-main.editor-spec-a4 .bloco-inline-zone[contenteditable="true"]:focus {
  outline: 2px solid rgba(0, 87, 184, 0.55);
  outline-offset: 2px;
  /* Não sobrescreve fundo — callouts, badges, cabeçalhos de tabela etc. mantêm a cor original */
  background-color: inherit;
  color: inherit;
}

/* Edição inline: preservar fundos coloridos (o :focus genérico usa inherit, mas estes reforçam o token correto) */
#editor-main.editor-spec-a4 .a4-page .rf-badge.bloco-inline-zone[contenteditable="true"],
#editor-main.editor-spec-a4 .a4-page .rf-badge.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--md-primary) !important;
  color: var(--md-on-primary) !important;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

#editor-main.editor-spec-a4 .a4-page .callout.info .bloco-inline-zone[contenteditable="true"]:focus,
#editor-main.editor-spec-a4 .a4-page .callout.callout-info .bloco-inline-zone[contenteditable="true"]:focus {
  background-color: var(--md-primary-fixed);
  color: inherit;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(0, 87, 184, 0.28);
}

#editor-main.editor-spec-a4 .a4-page .callout.warn .bloco-inline-zone[contenteditable="true"]:focus,
#editor-main.editor-spec-a4 .a4-page .callout.callout-warning .bloco-inline-zone[contenteditable="true"]:focus {
  background-color: #fffbeb;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(146, 64, 14, 0.22);
}

#editor-main.editor-spec-a4 .a4-page .callout.danger .bloco-inline-zone[contenteditable="true"]:focus,
#editor-main.editor-spec-a4 .a4-page .callout.callout-error .bloco-inline-zone[contenteditable="true"]:focus {
  background-color: #fef2f2;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(153, 27, 27, 0.22);
}

#editor-main.editor-spec-a4 .a4-page .callout.success .bloco-inline-zone[contenteditable="true"]:focus,
#editor-main.editor-spec-a4 .a4-page .callout.callout-check .bloco-inline-zone[contenteditable="true"]:focus {
  background-color: #f0fdf4;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(21, 128, 61, 0.22);
}

#editor-main.editor-spec-a4 .a4-page .contract-box-header.request.bloco-inline-zone[contenteditable="true"]:focus {
  background: #e8f0fc !important;
  color: var(--blue) !important;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(0, 87, 184, 0.25);
}

#editor-main.editor-spec-a4 .a4-page .contract-box-header.response.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--green-bg) !important;
  color: var(--green) !important;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(22, 97, 40, 0.22);
}

#editor-main.editor-spec-a4 .a4-page .contract-box-header.error.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--red-bg) !important;
  color: var(--red) !important;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(185, 28, 28, 0.22);
}

#editor-main.editor-spec-a4 .a4-page .flow-box .bloco-inline-zone[contenteditable="true"]:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(0, 87, 184, 0.28);
}

#editor-main.editor-spec-a4 .a4-page .flow-box.team-api .bloco-inline-zone[contenteditable="true"]:focus {
  background-color: var(--blue-light);
}

#editor-main.editor-spec-a4 .a4-page .flow-box.team-app .bloco-inline-zone[contenteditable="true"]:focus {
  background-color: #f5f3ff;
}

#editor-main.editor-spec-a4 .a4-page .flow-box.team-client .bloco-inline-zone[contenteditable="true"]:focus {
  background-color: var(--green-bg);
}

#editor-main.editor-spec-a4 .a4-page .flow-tag.bloco-inline-zone[contenteditable="true"]:focus,
#editor-main.editor-spec-a4 .a4-page .team-api .flow-tag.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--blue) !important;
  color: #fff !important;
  outline: none;
}

#editor-main.editor-spec-a4 .a4-page .team-app .flow-tag.bloco-inline-zone[contenteditable="true"]:focus {
  background: #7c3aed !important;
  color: #fff !important;
  outline: none;
}

#editor-main.editor-spec-a4 .a4-page .team-client .flow-tag.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--green) !important;
  color: #fff !important;
  outline: none;
}

#editor-main.editor-spec-a4 .a4-page .http-badge.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--blue) !important;
  color: var(--white) !important;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
}

#editor-main.editor-spec-a4 .a4-page .http-badge.red.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--red) !important;
}

#editor-main.editor-spec-a4 .a4-page .header-key.bloco-inline-zone[contenteditable="true"]:focus,
#editor-main.editor-spec-a4 .a4-page .chain-step.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--blue-light) !important;
  color: var(--navy) !important;
  border-color: var(--blue-mid);
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(0, 87, 184, 0.28);
}

#editor-main.editor-spec-a4 .a4-page .rule-id.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--blue-light) !important;
  color: var(--blue) !important;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(0, 87, 184, 0.28);
}

/* Edição inline em tabelas: preserva cabeçalho, zebra e bordas; só a célula focada destaca */
#editor-main.editor-spec-a4 .table-wrap .bloco-inline-zone[contenteditable="true"] {
  outline: none;
  outline-offset: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

#editor-main.editor-spec-a4 .table-wrap thead th.bloco-inline-zone[contenteditable="true"],
#editor-main.editor-spec-a4 .table-wrap thead th.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--md-primary) !important;
  color: var(--md-on-primary) !important;
}

#editor-main.editor-spec-a4 .table-wrap thead th.bloco-inline-zone[contenteditable="true"]:focus {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.4);
}

#editor-main.editor-spec-a4 .table-wrap tbody td.bloco-inline-zone[contenteditable="true"]:focus {
  background: inherit;
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(0, 87, 184, 0.38);
}

#editor-main.editor-spec-a4 .table-wrap tbody tr:nth-child(even) td.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--md-surface-low);
}

#editor-main.editor-spec-a4 .table-wrap tbody tr.row-warn td.bloco-inline-zone[contenteditable="true"]:focus {
  background: #fffbeb;
}

#editor-main.editor-spec-a4 .table-wrap tbody tr.row-error td.bloco-inline-zone[contenteditable="true"]:focus {
  background: #fff5f5;
}

#editor-main.editor-spec-a4 .table-wrap tbody tr.row-critical td.bloco-inline-zone[contenteditable="true"]:focus {
  background: #fff1f2;
}

#editor-main.editor-spec-a4 .table-wrap tbody tr.in-scope td.bloco-inline-zone[contenteditable="true"]:focus {
  background: #f0fdf4;
}

#editor-main.editor-spec-a4 .table-wrap tbody tr.out-scope td.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--gray-50);
}

#editor-main.editor-spec-a4 .table-wrap .rule-id.bloco-inline-zone[contenteditable="true"]:focus {
  background: var(--blue-light) !important;
  color: var(--blue) !important;
  box-shadow: inset 0 0 0 2px rgba(0, 87, 184, 0.35);
}

#editor-main.editor-spec-a4 .bloco-wrap.bloco-inline-editing .table-wrap {
  outline: none;
}

#editor-main.editor-spec-a4 .bloco-actions {
  background: var(--md-surface-lowest);
  border-color: var(--md-outline-variant);
}

#editor-main.editor-spec-a4 .add-block-zone {
  border-color: var(--md-outline-variant);
  color: var(--md-on-surface-variant);
}
#editor-main.editor-spec-a4 .add-block-zone {
  transition:
    border-color var(--ef-dur-fast, 0.16s) ease,
    color var(--ef-dur-fast, 0.16s) ease,
    background var(--ef-dur-fast, 0.16s) ease,
    transform var(--ef-dur-med, 0.28s) var(--ef-ease-out, ease);
}
#editor-main.editor-spec-a4 .add-block-zone:hover {
  border-color: var(--md-primary);
  color: var(--md-primary);
  background: var(--md-primary-fixed);
}

#editor-main.editor-spec-a4 #secoes-render .empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--md-on-surface-variant);
  font-size: 11pt;
}
#editor-main.editor-spec-a4 #secoes-render .empty-state h2 {
  all: revert;
  font-size: 14pt;
  font-weight: 700;
  color: var(--md-on-surface);
  margin-bottom: 10px;
  border: none;
  padding: 0;
  text-transform: none;
  letter-spacing: normal;
}

/* Seletor de emoji da seção (popover flutuante + grade no modal) */
#secao-emoji-popover {
  max-width: min(400px, calc(100vw - 20px));
  max-height: min(72vh, 540px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 14px 48px rgba(15, 23, 42, 0.22);
  padding: 10px 12px 12px;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition:
    opacity 0.22s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

#secao-emoji-popover.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#secao-emoji-popover.is-closing {
  opacity: 0;
  transform: translateY(4px) scale(0.98);
  transition-duration: 0.16s;
}
.secao-emoji-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.secao-emoji-picker-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--navy);
}
.secao-emoji-picker-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.secao-emoji-picker-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--gray-600);
  line-height: 1.3;
}
.secao-emoji-picker-body {
  padding-right: 2px;
}
.secao-emoji-picker-group {
  margin-bottom: 12px;
}
.secao-emoji-picker-glabel {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--gray-600);
  margin-bottom: 5px;
}
.secao-emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}
.secao-emoji-pick {
  font-size: 19px;
  line-height: 1;
  padding: 5px 2px;
  border: 1px solid transparent;
  background: var(--gray-50);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  opacity: 1;
  transition:
    border-color 0.1s ease,
    background 0.1s ease,
    transform 0.1s ease;
}
.secao-emoji-pick:hover {
  border-color: var(--blue);
  background: var(--blue-light);
  transform: scale(1.04);
}
.secao-emoji-pick:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.secao-emoji-pick .secao-pick-ms {
  font-family: 'Material Symbols Outlined';
  font-size: 22px;
  line-height: 1;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  color: var(--gray-700);
  display: inline-block;
  vertical-align: middle;
}
.secao-emoji-pick-material {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
}
.secao-emoji-pick-material:hover .secao-pick-ms {
  color: var(--blue);
}
.secao-emoji-picker-foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--gray-100);
}
.form-checks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.form-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.form-check:hover {
  border-color: var(--blue-mid);
  background: var(--blue-light);
}
.form-check input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
  cursor: pointer;
}
.form-check .check-text {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
}
.form-check .check-sub {
  display: block;
  font-size: 11px;
  color: var(--gray-400);
  margin-top: 1px;
}
.form-row--muted label {
  color: var(--gray-400);
}
.form-row--muted input[type="text"] {
  background: var(--gray-50);
  color: var(--gray-500);
  font-size: 12px;
}
.secao-modal-icon-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.secao-modal-icon-preview {
  font-size: 26px;
  line-height: 1;
  min-width: 36px;
  text-align: center;
  opacity: 1;
}
.secao-modal-icon-preview .material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  color: var(--blue);
}
.secao-emoji-picker-wrap {
  margin-top: 10px;
  max-height: 280px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  background: var(--gray-50);
}
html[data-theme="dark"] .modal-overlay {
  background: rgba(4, 10, 22, 0.68);
  backdrop-filter: blur(16px) saturate(1.1);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
}
html[data-theme="dark"] .modal-paleta-blocos {
  border-color: rgba(100, 165, 235, 0.35);
  box-shadow:
    0 28px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(100, 165, 235, 0.2),
    0 0 0 4px rgba(0, 87, 184, 0.2);
}
html[data-theme="dark"] .modal-paleta-blocos .modal-header {
  background: linear-gradient(180deg, rgba(0, 87, 184, 0.22) 0%, #1a2434 100%);
}
html[data-theme="dark"] .modal-body--paleta {
  background: rgba(0, 0, 0, 0.15);
}
html[data-theme="dark"] .bloco-palette-instanciar {
  background: linear-gradient(135deg, rgba(0, 87, 184, 0.2) 0%, rgba(0, 0, 0, 0.12) 100%);
  border-color: rgba(100, 165, 235, 0.35);
}

html[data-theme="dark"] .modal-overlay > .modal {
  background: #0e2040;
  border-color: rgba(100, 165, 235, 0.22);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(100, 165, 235, 0.12);
}

html[data-theme="dark"] .modal-header h3 {
  color: #e8f4ff;
}

html[data-theme="dark"] .modal-footer {
  background: rgba(0, 0, 0, 0.2);
}

/* Dark mode: form elements inside modals */
html[data-theme="dark"] .modal-overlay .form-row label {
  color: rgba(185, 215, 250, 0.65);
}
html[data-theme="dark"] .modal-overlay .form-row input[type="text"],
html[data-theme="dark"] .modal-overlay .form-row input[type="date"],
html[data-theme="dark"] .modal-overlay .form-row select,
html[data-theme="dark"] .modal-overlay .form-row textarea {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(100, 165, 235, 0.22);
  color: #e8f4ff;
}
html[data-theme="dark"] .modal-overlay .form-row input::placeholder,
html[data-theme="dark"] .modal-overlay .form-row textarea::placeholder {
  color: rgba(185, 215, 250, 0.35);
}
html[data-theme="dark"] .modal-overlay .form-row .hint {
  color: rgba(185, 215, 250, 0.5);
}
html[data-theme="dark"] .modal-overlay .form-hint--secao-num {
  background: rgba(0, 0, 0, 0.2);
  border-color: rgba(100, 165, 235, 0.15);
  color: rgba(185, 215, 250, 0.55);
}
/* Dark mode: form-check cards */
html[data-theme="dark"] .form-check {
  border-color: rgba(100, 165, 235, 0.2);
  background: rgba(255, 255, 255, 0.04);
}
html[data-theme="dark"] .form-check:hover {
  border-color: rgba(100, 165, 235, 0.45);
  background: rgba(100, 165, 235, 0.1);
}
html[data-theme="dark"] .form-check .check-text {
  color: #e8f4ff;
}
html[data-theme="dark"] .form-check .check-sub {
  color: rgba(185, 215, 250, 0.5);
}
/* Dark mode: muted field */
html[data-theme="dark"] .form-row--muted label {
  color: rgba(185, 215, 250, 0.35);
}
html[data-theme="dark"] .form-row--muted input[type="text"] {
  background: rgba(0, 0, 0, 0.2);
  color: rgba(185, 215, 250, 0.45);
  border-color: rgba(100, 165, 235, 0.12);
}

html[data-theme="dark"] #secao-emoji-popover {
  background: #1a2434;
  border-color: #3d4a5e;
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.55);
}
html[data-theme="dark"] #secao-emoji-popover .secao-emoji-picker-title {
  color: #e8f4ff;
}
html[data-theme="dark"] #secao-emoji-popover .secao-emoji-picker-sub {
  color: rgba(185, 215, 250, 0.82);
}
html[data-theme="dark"] #secao-emoji-popover .secao-emoji-picker-glabel {
  color: #9fb0c9;
}
html[data-theme="dark"] #secao-emoji-popover .secao-emoji-pick {
  background: #243044;
  border-color: transparent;
  opacity: 1;
}
html[data-theme="dark"] #secao-emoji-popover .secao-emoji-pick:hover {
  border-color: #7ab8ff;
  background: rgba(122, 184, 255, 0.18);
}
html[data-theme="dark"] #secao-emoji-popover .secao-emoji-pick .secao-pick-ms {
  color: rgba(214, 228, 255, 0.88);
}
html[data-theme="dark"] #secao-emoji-popover .secao-emoji-pick-material:hover .secao-pick-ms {
  color: #b8d8ff;
}
html[data-theme="dark"] .secao-emoji-picker-wrap {
  background: #121a26;
  border-color: #3d4a5e;
}

html[data-theme="dark"] #editor-main.editor-spec-a4 {
  --md-surface-dim: var(--app-canvas-bg, #050a14);
  background: var(--app-canvas-bg, #050a14);
}

/* Barra EF no escuro: mesmo gradiente da sidebar (menu ≠ painel claro) */
html[data-theme="dark"] #editor-main.editor-spec-a4 .editor-spec-toolbar {
  background: linear-gradient(180deg, #061e3d 0%, #030d1c 100%);
  border: 1px solid rgba(30, 74, 120, 0.55);
  box-shadow: 0 12px 36px rgba(0, 4, 18, 0.65);
}

/* ─── Toolbar/cabeçalho de página — ÚNICO padrão para TODAS as telas ───
   (Projetos, Templates, Canais, Funcionalidades, Autocompletar)
   Estrutura fixa: <h1> + .toolbar-spacer + .toolbar-actions
   Mesma largura (100% da coluna .app-main), mesmo estilo. */
.toolbar {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  background: var(--white);
  padding: 18px 20px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  box-sizing: border-box;
}
.toolbar > h1 {
  margin: 0;
  white-space: nowrap;
  flex-shrink: 0;
}
/* Espaçador entre o título e os botões: empurra as ações para a direita */
.toolbar .toolbar-spacer {
  flex: 1 1 auto;
  min-width: 12px;
}
/* Grupo de ações à direita (botões, filtros) */
.toolbar > .toolbar-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Toolbar do editor EF (duas linhas — só dentro de #editor-main) */
#editor-main .toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

#editor-main .toolbar-head {
  width: 100%;
}

#editor-main .toolbar-btn-download {
  flex-shrink: 0;
  font-weight: 500;
}

#editor-main .toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-evenly;
  gap: 10px 12px;
  padding-top: 12px;
  border-top: 1px solid var(--gray-100);
}

.toolbar h1 { font-size: 22px; font-weight: 900; color: var(--navy); letter-spacing: -0.02em; }
.toolbar h1.toolbar-proj-titulo {
  font-size: 18px;
  margin-top: 2px;
  line-height: 1.25;
  color: var(--navy);
}
.toolbar-proj-codigo {
  font-size: 11px;
  color: var(--gray-600);
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
}
.toolbar-proj-ver {
  color: var(--gray-400);
  font-weight: 600;
  font-size: 13px;
}
.toolbar-badge-ef-simp {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 9999px;
  background: #e8f5e9;
  color: #1b5e20;
  vertical-align: middle;
}
.toolbar .grow { flex: 1; }
.toolbar .btn.icon-only {
  padding: 6px 10px;
}
.toolbar .btn.icon-only svg {
  display: block;
}

.toolbar-status-wrap {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.toolbar-status-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  margin: 0;
  white-space: nowrap;
}
.toolbar .toolbar-status-select {
  min-width: 140px;
}
/* Status picker quando embutido na toolbar */
#toolbar-proj-status-wrap .status-picker-drop {
  z-index: 1100;
}
#toolbar-proj-status-wrap .status-picker-btn {
  font-size: 12px;
}

/* Select de status (toolbar, cards da home, modais) */
.select-status-projeto {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
  min-width: 158px;
  max-width: 100%;
  font-family: var(--font-app);
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.select-status-projeto:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.select-status-projeto:focus {
  outline: 2px solid rgba(0, 87, 184, 0.25);
  outline-offset: 1px;
}

/* ── Global select base: appearance uniforme em todos os <select> do app ── */
select {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background-color: var(--white);
  color: var(--gray-800);
  cursor: pointer;
  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='%23666' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px 12px;
  transition: border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}
select:hover { border-color: var(--blue); }
select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,87,184,.12);
}

/* Opções: cores explícitas (não herdam CSS vars — renderizadas pelo browser) */
option {
  background-color: #ffffff;
  color: #1a1a2e;
}

/* Dark mode: todos os <select> */
html[data-theme="dark"] select {
  background-color: #0d1e38;
  border-color: rgba(100,165,235,.28);
  color: #e8f4ff;
  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='%2393c5fd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}
html[data-theme="dark"] select:hover { border-color: rgba(147,197,253,.6); }
html[data-theme="dark"] select:focus {
  border-color: #4da3ff;
  box-shadow: 0 0 0 3px rgba(77,163,255,.15);
}

/* Opções em dark mode: cores literais (não vars) */
html[data-theme="dark"] option {
  background-color: #0e2040;
  color: #e8f4ff;
}
/* Lista nativa do <select>: fundo claro + texto escuro (Chrome/Win com tema escuro herdava texto branco = invisível) */
.select-status-projeto option,
.toolbar-status-select option,
.home-filtro-select option {
  background-color: #ffffff;
  color: #181c1f;
}
html[data-theme="dark"] .select-status-projeto option,
html[data-theme="dark"] .toolbar-status-select option,
html[data-theme="dark"] .home-filtro-select option {
  background-color: #0e2040;
  color: #e8f4ff;
}

/* ── Inline table editor (tabela_generica form) ── */
.te-wrap {
  margin-top: 4px;
}
.te-scroll {
  overflow-x: auto;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
}
.te-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 300px;
  table-layout: auto;
}
.te-th {
  background: rgba(0,87,184,.07);
  border-right: 1px solid var(--gray-200);
  padding: 0;
  min-width: 110px;
}
.te-th:last-child { border-right: none; }
.te-th-action {
  width: 34px;
  min-width: 34px;
  background: rgba(0,87,184,.04);
}
.te-head-input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  background: transparent;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-800);
  font-family: inherit;
  outline: none;
  min-width: 0;
}
.te-head-input::placeholder { color: var(--gray-400); font-weight: 500; }
.te-head-input:focus { background: rgba(0,87,184,.06); }
.te-td {
  border-top: 1px solid var(--gray-200);
  border-right: 1px solid var(--gray-200);
  padding: 0;
}
.te-td:last-child { border-right: none; }
.te-td-action {
  width: 34px;
  text-align: center;
  vertical-align: middle;
}
.te-cell-input {
  width: 100%;
  box-sizing: border-box;
  border: none;
  background: transparent;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--gray-800);
  font-family: inherit;
  outline: none;
  min-width: 0;
}
.te-cell-input:focus { background: rgba(0,87,184,.05); }
.te-rm-row {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; margin: 0 auto;
  border: none; border-radius: 5px;
  background: transparent;
  color: var(--gray-400);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
}
.te-rm-row:hover { background: rgba(220,38,38,.12); color: #ef4444; }
.te-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Dark mode */
html[data-theme="dark"] .te-scroll { border-color: rgba(100,165,235,.22); }
html[data-theme="dark"] .te-th { background: rgba(0,87,184,.18); border-right-color: rgba(100,165,235,.18); }
html[data-theme="dark"] .te-th-action { background: rgba(0,87,184,.10); }
html[data-theme="dark"] .te-head-input { color: #c8e0ff; }
html[data-theme="dark"] .te-head-input:focus { background: rgba(0,87,184,.18); }
html[data-theme="dark"] .te-td { border-color: rgba(100,165,235,.14); }
html[data-theme="dark"] .te-cell-input { color: #dbeafe; }
html[data-theme="dark"] .te-cell-input:focus { background: rgba(0,87,184,.14); }
html[data-theme="dark"] .te-rm-row { color: rgba(200,224,255,.3); }
html[data-theme="dark"] .te-rm-row:hover { background: rgba(239,68,68,.18); color: #f87171; }

/* ── Custom status picker ── */
.status-picker {
  position: relative;
  display: inline-block;
}
.status-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px 6px 9px;
  border-radius: 9999px;
  border: 1.5px solid var(--sp-border, rgba(148,163,184,.4));
  background: var(--sp-bg, rgba(148,163,184,.12));
  color: var(--sp-text, #64748b);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background var(--ef-dur-fast, 0.16s) ease,
    border-color var(--ef-dur-fast, 0.16s) ease,
    box-shadow var(--ef-dur-fast, 0.16s) ease,
    transform var(--ef-dur-fast, 0.16s) var(--ef-ease-out, ease);
}
.status-picker-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(0,0,0,.1);
}
.status-picker-btn:active {
  transform: translateY(1px);
  transition-duration: 0.06s;
}
.status-picker-btn .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sp-dot, #94a3b8);
  flex-shrink: 0;
}
.status-picker-btn svg { opacity: .65; flex-shrink: 0; }
.status-picker-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.status-picker-drop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 200;
  min-width: 210px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.14), 0 2px 8px rgba(0,0,0,.08);
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.22s cubic-bezier(0.34, 1.18, 0.64, 1);
}
.status-picker-drop.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.status-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--sp-bg, rgba(148,163,184,.1));
  color: var(--sp-text, #64748b);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  transition: background var(--ef-dur-fast, 0.16s) ease,
              border-color var(--ef-dur-fast, 0.16s) ease,
              transform var(--ef-dur-fast, 0.16s) ease,
              box-shadow var(--ef-dur-fast, 0.16s) ease;
}
.status-option:hover {
  background: var(--sp-bg, rgba(148,163,184,.18));
  border-color: var(--sp-border, rgba(148,163,184,.4));
  transform: translateX(3px);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.status-option.is-selected {
  font-weight: 700;
  background: var(--sp-bg, rgba(148,163,184,.18));
  border-color: var(--sp-border, rgba(148,163,184,.45));
}
.status-option .status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-option-check {
  margin-left: auto;
  flex-shrink: 0;
  color: var(--blue);
}

/* Dark mode status picker */
html[data-theme="dark"] .status-picker-btn {
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
html[data-theme="dark"] .status-picker-drop {
  background: #1a2e50;
  border-color: rgba(59,130,246,.25);
  box-shadow: 0 10px 32px rgba(0,0,0,.5), 0 2px 8px rgba(0,0,0,.3);
}
html[data-theme="dark"] .status-option { filter: brightness(1.15) saturate(1.1); }

/* Animações em botões do sistema (app + modais + paleta) */
/* ── Universal transition base: every interactive element ── */
button:not(:disabled),
input[type="button"]:not(:disabled),
input[type="submit"]:not(:disabled),
input[type="reset"]:not(:disabled),
.btn,
.side-link,
.side-brand,
.bloco-palette button,
.busca-ef-item,
.tabs button,
.btn-add-secao,

.secao-emoji-pick,
.home-btn-filtros,
.projeto-card-preview,
.help-icon,
.theme-side-toggle,
.picker-list .picker-item,
.matriz-editor-grid .cell-btn,
.section-side-item .side-sec-sidebar-edit,
.checklist-done-toggle,
[data-add-row],
[data-rm-row],
.matriz-editor-grid .btn-rm-row,
.matriz-editor-grid .btn-rm-col {
  transition:
    background var(--ef-dur-fast, 0.16s) var(--ef-ease-out, ease),
    border-color var(--ef-dur-fast, 0.16s) ease,
    color var(--ef-dur-fast, 0.16s) ease,
    box-shadow var(--ef-dur-fast, 0.16s) ease,
    opacity var(--ef-dur-fast, 0.16s) ease,
    outline-color var(--ef-dur-fast, 0.16s) ease,
    filter var(--ef-dur-fast, 0.16s) ease,
    transform var(--ef-dur-fast, 0.16s) var(--ef-ease-out, ease);
}

/* Hover Tier 1: buttons lift up */
.btn:not(:disabled):hover,
.bloco-palette button:hover,
.busca-ef-item:hover,
.tabs button:hover,
.btn-add-secao:hover,
.secao-emoji-pick:hover,
[data-add-row]:hover,
[data-rm-row]:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,.16), 0 2px 5px rgba(0,0,0,.1);
}
/* Footer-action buttons: scale em vez de lift (sobrescreve Tier 1) */
.card-footer-actions .btn:not(:disabled):hover {
  transform: scale(1.1);
  box-shadow: none;
}

/* Hover Tier 2: sidebar/list items slide right */
.side-link:hover:not(.active),
.home-btn-filtros:hover,
.picker-list .picker-item:hover,
.theme-side-toggle:hover {
  transform: translateX(3px);
}

/* Hover Tier 3: icon/utility buttons — scale for editor icons, glow for card preview */
.help-icon:hover,
.section-side-item .side-sec-sidebar-edit:hover,
.matriz-editor-grid .cell-btn:hover,
.checklist-done-toggle:hover {
  transform: scale(1.14);
}
.projeto-card-preview:hover {
  color: #3b82f6;
  filter: drop-shadow(0 0 7px rgba(59,130,246,.75));
  transform: scale(1.1);
}
html[data-theme="dark"] .projeto-card-preview:hover {
  color: #93c5fd;
  filter: drop-shadow(0 0 8px rgba(147,197,253,.7));
}

/* Pin e preview do header: sem translateY (ficam no lugar) */
.projeto-card-pin:hover,
.projeto-card-pin:active,
.projeto-card-preview:active {
  transform: scale(1.1);
}
/* Footer actions: scale permitido, mas sem translateY */
.card-footer-actions .btn:active {
  transform: scale(0.95);
}

/* Hover Tier 4: generic catch-all for any bare <button> not explicitly styled above */
button:not(:disabled):not(.btn):not(.side-link):not(.side-brand):not([class*="btn-"]):not(.secao-emoji-pick):not(.busca-ef-item):not([data-add-row]):not([data-rm-row]):not(.home-btn-filtros):not(.help-icon):not(.theme-side-toggle):not(.cell-btn):not(.side-sec-sidebar-edit):not(.checklist-done-toggle):not(.projeto-card-preview):hover {
  box-shadow: 0 4px 10px rgba(0,0,0,.12);
}

/* Active: buttons press down */
.btn:not(:disabled):active,
.bloco-palette button:active,
.busca-ef-item:active,
.tabs button:active,
.btn-add-secao:active,

.secao-emoji-pick:active,
[data-add-row]:active,
[data-rm-row]:active {
  transform: translateY(2px) scale(0.95);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  transition-duration: 0.06s;
}

/* Active: sidebar/list items push back */
.side-link:active,
.side-brand:active,
.home-btn-filtros:active,
.picker-list .picker-item:active,
.theme-side-toggle:active {
  transform: translateX(1px) scale(0.98);
  transition-duration: 0.06s;
}

/* Active: scale-type buttons shrink on press */
.help-icon:active,
.section-side-item .side-sec-sidebar-edit:active,
.matriz-editor-grid .cell-btn:active,
.checklist-done-toggle:active {
  transform: scale(0.93);
  transition-duration: 0.06s;
}

@media (prefers-reduced-motion: reduce) {
  button:not(:disabled),
  input[type="button"]:not(:disabled),
  input[type="submit"]:not(:disabled),
  .btn, .side-link, .side-brand,
  .bloco-palette button, .busca-ef-item, .tabs button,
  .btn-add-secao, .home-btn-filtros,
  .help-icon, .theme-side-toggle, .picker-list .picker-item,
  .matriz-editor-grid .cell-btn, .section-side-item .side-sec-sidebar-edit,
  .checklist-done-toggle, [data-add-row], [data-rm-row] {
    transition: background 0.01s, border-color 0.01s, color 0.01s, opacity 0.01s !important;
    transform: none !important;
    box-shadow: none !important;
  }
}

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: 6px;
  border: 1px solid var(--gray-200);
  background: var(--white); color: var(--gray-800);
  cursor: pointer; text-decoration: none;
  font-family: inherit;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.btn:not(:disabled):hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn.primary { background: var(--blue); color: var(--white); border-color: var(--blue); box-shadow: 0 1px 3px rgba(0,87,184,.2); }
.btn.primary:not(:disabled):hover { background: #004fa3; border-color: #004fa3; box-shadow: 0 6px 22px rgba(0,87,184,.55), 0 2px 6px rgba(0,0,0,.12); }
.btn.danger { color: var(--red); border-color: rgba(192,57,43,.35); box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.btn.danger:not(:disabled):hover { background: rgba(192,57,43,.08); border-color: rgba(192,57,43,.6); box-shadow: none; }
.btn.success { background: var(--green); color: var(--white); border-color: var(--green); box-shadow: 0 1px 3px rgba(26,127,55,.2); }
.btn.success:not(:disabled):hover { background: #146128; border-color: #146128; box-shadow: 0 6px 22px rgba(26,127,55,.52); }
/* Download btn no card — outline, cores por tema */
.card-footer-actions .btn.success {
  background: transparent;
  color: #16a34a;
  border-color: rgba(22,163,74,.4);
  box-shadow: none;
}
.card-footer-actions .btn.success:not(:disabled):hover {
  background: rgba(22,163,74,.09);
  border-color: rgba(22,163,74,.6);
  color: #15803d;
  box-shadow:
    0 0 0 3px rgba(22,163,74,.2),
    0 4px 16px rgba(22,163,74,.38);
  transform: scale(1.07);
}
.card-footer-actions .btn.danger:not(:disabled):hover {
  background: rgba(192,57,43,.08);
  border-color: rgba(192,57,43,.6);
  box-shadow:
    0 0 0 3px rgba(192,57,43,.18),
    0 4px 16px rgba(192,57,43,.36);
  transform: scale(1.07);
}
html[data-theme="dark"] .card-footer-actions .btn.success {
  color: #4ade80;
  border-color: rgba(74,222,128,.35);
}
html[data-theme="dark"] .card-footer-actions .btn.success:not(:disabled):hover {
  background: rgba(74,222,128,.1);
  box-shadow:
    0 0 0 3px rgba(74,222,128,.18),
    0 4px 16px rgba(74,222,128,.32);
  transform: scale(1.07);
}
html[data-theme="dark"] .card-footer-actions .btn.danger:not(:disabled):hover {
  background: rgba(240,80,60,.1);
  border-color: rgba(240,80,60,.55);
  box-shadow:
    0 0 0 3px rgba(240,80,60,.15),
    0 4px 16px rgba(240,80,60,.32);
  transform: scale(1.07);
}
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn.ghost { border-color: transparent; box-shadow: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.bloco-wrap {
  position: relative;
  padding-top: 4px;
}
.bloco-wrap:hover { background: rgba(0, 87, 184, 0.02); border-radius: 6px; }

.bloco-actions {
  position: absolute;
  top: -8px;
  right: 8px;
  display: flex;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 4px;
  box-shadow: var(--shadow);
  z-index: 5;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  pointer-events: none;
  transition:
    opacity var(--ef-dur-fast, 0.16s) ease,
    transform var(--ef-dur-med, 0.28s) var(--ef-ease-out, ease),
    visibility var(--ef-dur-fast, 0.16s) ease;
}
.bloco-wrap:hover .bloco-actions,
.bloco-wrap:focus-within .bloco-actions,
.bloco-wrap.dragging .bloco-actions {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.bloco-wrap.busca-highlight {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
  border-radius: 8px;
  transition: outline-color var(--ef-dur-med, 0.28s) ease, outline-offset var(--ef-dur-med, 0.28s) ease;
  animation: busca-highlight-pulse 1.2s var(--ef-ease-out, ease) 2;
}
@keyframes busca-highlight-pulse {
  0%, 100% { outline-color: var(--blue); }
  50% { outline-color: rgba(0, 87, 184, 0.45); }
}

.bloco-render .ef-figure {
  margin: 12px 0;
  text-align: center;
}
.bloco-render .ef-figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
/* No editor, a largura/alinhamento da imagem é controlada pelo bloco (flex item).
   Neutralizamos os estilos inline da <figure> para não encolher a imagem duas vezes. */
.bloco-wrap[data-bloco-tipo="imagem"] .bloco-render .ef-figure {
  width: auto !important;
  max-width: 100% !important;
  margin: 12px auto !important;
  overflow: visible !important; /* permite overlay e toolbar flutuarem para fora */
}
.bloco-wrap[data-bloco-tipo="imagem"] .bloco-render .ef-figure img {
  cursor: pointer;
}
.bloco-wrap[data-bloco-tipo="imagem"].img-selected .bloco-render .ef-figure img {
  cursor: move;
}
.bloco-render .ef-inline-img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  border-radius: 4px;
  border: 1px solid var(--gray-200);
}

.add-block-zone {
  margin: 12px 0;
  padding: 10px;
  border: 2px dashed var(--gray-200);
  border-radius: 6px;
  text-align: center;
  color: var(--gray-600);
  font-size: 13px;
  cursor: pointer;
  transition:
    border-color var(--ef-dur-fast, 0.16s) ease,
    color var(--ef-dur-fast, 0.16s) ease,
    background var(--ef-dur-fast, 0.16s) ease,
    transform var(--ef-dur-med, 0.28s) var(--ef-ease-out, ease);
}
.add-block-zone:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
}

.bloco-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.bloco-palette button {
  text-align: left;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--white);
  cursor: pointer;
  font-size: 13px;
  transition: all .12s;
  font-family: inherit;
}
.bloco-palette button:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}
.bloco-palette .b-name { font-weight: 700; color: var(--navy); display: block; margin-bottom: 2px; }
.bloco-palette .b-desc { font-size: 11.5px; color: var(--gray-600); }
.bloco-palette .b-group {
  grid-column: 1 / -1;
  font-size: 10px; font-weight: 700; color: var(--gray-600);
  letter-spacing: .8px; text-transform: uppercase;
  padding: 4px 0; border-bottom: 1px solid var(--gray-100);
}

/* Seção “Instanciar” no modal de adicionar bloco */
.bloco-palette-instanciar {
  margin-bottom: 20px;
  padding: 14px 16px 16px;
  border-radius: 10px;
  border: 1px solid rgba(0, 87, 184, 0.28);
  background: linear-gradient(135deg, var(--blue-light) 0%, rgba(0, 87, 184, 0.06) 100%);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
}
.bloco-palette-instanciar .b-group {
  color: var(--blue);
  border-bottom-color: rgba(0, 87, 184, 0.2);
  margin-bottom: 6px;
}
.bloco-palette-instanciar-hint {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--gray-700);
}
.bloco-palette--instanciar button {
  border-left: 3px solid var(--blue);
  background: var(--white);
  box-shadow: 0 1px 4px rgba(0, 87, 184, 0.08);
}
.bloco-palette--instanciar button:hover {
  box-shadow: 0 4px 14px rgba(0, 87, 184, 0.18);
}

/* Modal — overlay embaçado + painel com animação de entrada/saída */
@keyframes modal-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes modal-overlay-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}
@keyframes modal-card-in {
  from { opacity: 0; transform: translateY(32px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes modal-card-out {
  from { opacity: 1; transform: translateY(0)   scale(1); }
  to   { opacity: 0; transform: translateY(10px) scale(0.97); }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 16px 28px;
  z-index: 1000;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  opacity: 0;
}

.modal-overlay.is-open {
  opacity: 1;
  animation: modal-overlay-in 0.24s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal-overlay.is-closing {
  opacity: 0;
  pointer-events: none;
  animation: modal-overlay-out 0.2s ease both;
}

/* Modal card: entra com spring, sai discretamente */
.modal-overlay > .modal {
  opacity: 0;
  will-change: opacity, transform;
}

.modal-overlay.is-open > .modal {
  animation: modal-card-in 0.36s cubic-bezier(0.34, 1.2, 0.64, 1) both;
}

.modal-overlay.is-closing > .modal {
  animation: modal-card-out 0.2s ease both;
}

.modal {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 720px;
  max-height: calc(100vh - 56px);
  max-height: min(90dvh, calc(100vh - 56px));
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow:
    0 24px 64px rgba(15, 23, 42, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
}
/* Paleta “Adicionar bloco”: painel mais destacado no overlay */
.modal-paleta-blocos {
  max-width: 960px;
  border: 1px solid rgba(0, 87, 184, 0.22);
  box-shadow:
    0 28px 80px rgba(15, 23, 42, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 0 4px rgba(0, 87, 184, 0.12);
}
.modal-paleta-blocos .modal-header {
  background: linear-gradient(180deg, var(--blue-light) 0%, var(--white) 100%);
  border-bottom-color: rgba(0, 87, 184, 0.15);
}
.modal-paleta-blocos .modal-header h3 {
  color: var(--navy);
  font-size: 17px;
}
.modal-body--paleta {
  background: var(--gray-50);
}
/* Formulários de bloco / metadados: o <form> é o único filho direto — precisa ser coluna flexível para o body rolar e o footer ficar visível */
.modal > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  max-height: 100%;
  overflow: hidden;
}
.modal.wide { max-width: 920px; }
/* Modal de edição de bloco: mais altura útil para formulários longos */
.modal.wide.modal-bloco-edit {
  min-height: min(78vh, 860px);
}
.modal.wide.modal-bloco-edit .modal-body {
  min-height: min(56vh, 560px);
  display: flex;
  flex-direction: column;
}
.modal-bloco-edit .modal-body .form-row--expand {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.modal-bloco-edit .modal-body .form-row--expand > textarea {
  flex: 1;
  min-height: 180px;
  resize: vertical;
}
.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.modal-header h3 { font-size: 16px; font-weight: 800; color: var(--navy); }
.modal-body {
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
}
.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--gray-50);
  flex-shrink: 0;
}
.modal-footer.modal-footer-spread {
  justify-content: space-between;
  align-items: center;
}
.busca-ef-kbd-hint {
  font-size: 12px;
  color: var(--gray-500);
}
.input-busca-ef {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 15px;
}
#busca-ef-resultados {
  margin-top: 12px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.busca-ef-hint,
.busca-ef-empty {
  font-size: 13px;
  color: var(--gray-600);
  margin: 0;
}
.busca-ef-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.busca-ef-list li { margin-bottom: 6px; }
.busca-ef-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: var(--white);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .12s, background .12s;
}
.busca-ef-item:hover {
  border-color: var(--blue);
  background: var(--blue-light);
}
.busca-ef-item-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}
.busca-ef-item-snippet {
  font-size: 11px;
  color: var(--gray-600);
  font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
  word-break: break-all;
  line-height: 1.35;
}

.form-row { margin-bottom: 14px; }
.form-row-produtos-escopo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.form-row-produtos-escopo-head label {
  margin-bottom: 0;
}
.form-row label {
  display: block; font-size: 12px; font-weight: 700;
  color: var(--gray-600); text-transform: uppercase;
  letter-spacing: .6px; margin-bottom: 4px;
}
.form-row input[type="text"],
.form-row input[type="date"],
.form-row select,
.form-row textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--white);
}
.form-row textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.form-row textarea.code, .form-row input.code { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 12.5px; }
.form-row .hint { font-size: 11.5px; color: var(--gray-600); margin-top: 4px; line-height: 1.4; }
.form-row .hint code { background: var(--gray-100); border: 1px solid var(--gray-200); padding: 1px 4px; border-radius: 3px; font-family: monospace; font-size: 11px; }

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ── Template picker (seleção de modelo de EF no modal Nova EF) ── */
.template-picker {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.template-option {
  flex: 1;
  cursor: pointer;
  display: flex;
}
.template-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.template-option-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 13px;
  border: 2px solid var(--gray-200, #d0d7de);
  border-radius: 8px;
  width: 100%;
  transition: border-color 0.13s, background 0.13s;
  background: transparent;
  white-space: nowrap;
}
.template-option-body strong {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--gray-900, #24292f);
}
.template-option-body span {
  font-size: 11px;
  color: var(--gray-600, #6e7781);
  line-height: 1.3;
}
.template-option:hover .template-option-body {
  border-color: var(--blue, #0057b8);
}
.template-option input[type="radio"]:checked + .template-option-body {
  border-color: var(--blue, #0057b8);
  background: var(--blue-light, #e8f0fc);
}
.template-option input[type="radio"]:checked + .template-option-body strong,
.template-option input[type="radio"]:checked + .template-option-body span {
  color: var(--blue, #0057b8);
}
/* dark mode — usa as variáveis que o modal já tem no tema escuro */
html[data-theme="dark"] .template-option-body {
  border-color: rgba(255,255,255,.12);
}
html[data-theme="dark"] .template-option-body strong { color: #e6edf3; }
html[data-theme="dark"] .template-option-body span   { color: #8b949e; }
html[data-theme="dark"] .template-option:hover .template-option-body {
  border-color: #4d94e6;
}
html[data-theme="dark"] .template-option input[type="radio"]:checked + .template-option-body {
  border-color: #4d94e6;
  background: rgba(77,148,230,.15);
}
html[data-theme="dark"] .template-option input[type="radio"]:checked + .template-option-body strong,
html[data-theme="dark"] .template-option input[type="radio"]:checked + .template-option-body span {
  color: #4d94e6;
}

/* ── Block-form rows: .list-row (glossário) + .row-card (logs/alertas/pontos/header) ── */
[data-dynlist] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
[data-dynlist] > [data-add-row] {
  align-self: flex-start;
  margin-top: 4px;
}

.list-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-left: 3px solid rgba(0,87,184,.4);
  border-radius: 8px;
  background: var(--gray-50);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.list-row:hover {
  border-color: rgba(0,87,184,.3);
  border-left-color: var(--blue);
  box-shadow: 0 2px 8px rgba(0,87,184,.08);
}
.list-row > input,
.list-row > textarea,
.list-row > select {
  flex: 1;
  min-width: 0;
}

/* Formulário checklist: coluna “Concl.” + texto */
.list-row.checklist-form-row > .checklist-done-toggle {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding-top: 8px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  user-select: none;
  white-space: nowrap;
}
.list-row.checklist-form-row > .checklist-done-toggle input {
  margin: 0;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  cursor: pointer;
}
.list-row.checklist-form-row > .checklist-done-toggle:hover {
  color: var(--blue);
}

.row-card {
  border: 1px solid var(--gray-200);
  border-left: 3px solid rgba(0,87,184,.45);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--gray-50);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.row-card:hover {
  border-color: rgba(0,87,184,.3);
  border-left-color: var(--blue);
  box-shadow: 0 2px 8px rgba(0,87,184,.08);
}
.row-card .row-card-head {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* Inputs/selects/textareas inside row-card and list-row */
.row-card input[type="text"],
.row-card input[type="date"],
.row-card input[type="number"],
.row-card select,
.row-card textarea,
.list-row input[type="text"],
.list-row input[type="date"],
.list-row select,
.list-row textarea {
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--white);
  color: var(--gray-800);
  box-sizing: border-box;
  min-width: 0;
}
.row-card textarea,
.list-row textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
  width: 100%;
}
.row-card input[type="text"]:focus,
.row-card select:focus,
.row-card textarea:focus,
.list-row input[type="text"]:focus,
.list-row select:focus,
.list-row textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0,87,184,.12);
}

/* Dark mode: row-card + list-row containers */
html[data-theme="dark"] .row-card,
html[data-theme="dark"] .list-row {
  background: rgba(0,0,0,.18);
  border-color: rgba(59,130,246,.18);
  border-left-color: rgba(59,130,246,.55);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
html[data-theme="dark"] .row-card:hover,
html[data-theme="dark"] .list-row:hover {
  border-color: rgba(59,130,246,.35);
  border-left-color: #60a5fa;
  box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

/* Dark mode: inputs inside row-card and list-row */
html[data-theme="dark"] .row-card input[type="text"],
html[data-theme="dark"] .row-card input[type="date"],
html[data-theme="dark"] .row-card input[type="number"],
html[data-theme="dark"] .row-card select,
html[data-theme="dark"] .row-card textarea,
html[data-theme="dark"] .list-row input[type="text"],
html[data-theme="dark"] .list-row input[type="date"],
html[data-theme="dark"] .list-row select,
html[data-theme="dark"] .list-row textarea {
  background: rgba(0,0,0,.3);
  border-color: rgba(100,165,235,.22);
  color: #e8f4ff;
}
html[data-theme="dark"] .row-card input::placeholder,
html[data-theme="dark"] .row-card textarea::placeholder,
html[data-theme="dark"] .list-row input::placeholder,
html[data-theme="dark"] .list-row textarea::placeholder {
  color: rgba(185,215,250,.32);
}
html[data-theme="dark"] .row-card input:focus,
html[data-theme="dark"] .row-card select:focus,
html[data-theme="dark"] .row-card textarea:focus,
html[data-theme="dark"] .list-row input:focus,
html[data-theme="dark"] .list-row select:focus,
html[data-theme="dark"] .list-row textarea:focus {
  border-color: #4da3ff;
  box-shadow: 0 0 0 3px rgba(77,163,255,.15);
}

/* ─── Motion tokens (home) ─── */
body.home-mode {
  --ef-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ef-ease-snap: cubic-bezier(0.34, 1.2, 0.64, 1);
  --ef-dur-fast: 0.16s;
  --ef-dur-med: 0.28s;
  --ef-dur-slow: 0.38s;
}

@keyframes card-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes page-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Projects grid ─── */
.projetos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 20px;
  align-items: stretch;
}
@media (max-width: 720px) {
  .projetos-grid { grid-template-columns: 1fr; }
}

.projeto-card {
  --card-pad: 20px;
  --status-color: #94a3b8;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  overflow: hidden; /* recorta a barra inferior nos cantos arredondados */
  transition:
    box-shadow 0.22s ease,
    border-color 0.22s ease,
    transform 0.22s ease;
  animation: card-enter 0.32s var(--ef-ease-out, ease) backwards;
  box-shadow: 0 2px 8px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
}
.projeto-card:hover {
  transform: translateY(-3px);
  border-color: rgba(0,87,184,.35);
  box-shadow:
    0 0 0 1px rgba(0,87,184,.18),
    0 14px 34px rgba(0,87,184,.16),
    0 4px 12px rgba(0,0,0,.07);
}

/* Staggered entry */
.projetos-grid .projeto-card:nth-child(1)  { animation-delay: 0ms; }
.projetos-grid .projeto-card:nth-child(2)  { animation-delay: 40ms; }
.projetos-grid .projeto-card:nth-child(3)  { animation-delay: 80ms; }
.projetos-grid .projeto-card:nth-child(4)  { animation-delay: 120ms; }
.projetos-grid .projeto-card:nth-child(5)  { animation-delay: 160ms; }
.projetos-grid .projeto-card:nth-child(6)  { animation-delay: 190ms; }
.projetos-grid .projeto-card:nth-child(n+7) { animation-delay: 220ms; }

/* Accent bar — hidden, cor fica só no border-bottom */
.card-accent-bar { display: none; }

/* Header row */
.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--card-pad) 0;
  gap: 6px;
}
.card-header-left {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  min-width: 0;
}
.card-header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

/* Code chip */
.projeto-card .codigo {
  font-family: monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--blue);
  background: rgba(0,87,184,.07);
  border: 1px solid rgba(0,87,184,.15);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Status chip */
.card-status-chip {
  --chip-color: #94a3b8;
  display: inline-flex;
  align-items: center;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--chip-color) 12%, transparent);
  color: var(--chip-color);
  border: 1px solid color-mix(in srgb, var(--chip-color) 25%, transparent);
  white-space: nowrap;
  margin-top: 0;
  margin-bottom: 0;
}
/* Área fixa do código — sempre reservada, independente da altura do título */
.card-codigo-wrap {
  padding: 0 var(--card-pad) 10px;
  min-height: 28px;
  display: flex;
  align-items: flex-start;
}

/* Código chip */
.card-body-codigo {
  display: inline-block;
  font-family: monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--blue);
  background: rgba(0,87,184,.07);
  border: 1px solid rgba(0,87,184,.15);
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Clickable body */
.card-body {
  padding: 12px var(--card-pad) 4px;
  cursor: pointer;
  outline: none;
}
.card-body:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
  border-radius: 4px;
}
.projeto-card .titulo {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: -0.02em;
  /* Reserva ~2 linhas para que todos os cards mantenham a mesma estrutura */
  min-height: 44px;
}
/* Threshold: títulos maiores encolhem a fonte (e o respiro) p/ caber sem esticar o card */
.projeto-card .titulo.titulo--md { font-size: 15px; min-height: 39px; }
.projeto-card .titulo.titulo--sm { font-size: 13.5px; line-height: 1.28; min-height: 35px; -webkit-line-clamp: 3; }
.projeto-card .titulo.titulo--xs { font-size: 12px;   line-height: 1.25; min-height: 32px; -webkit-line-clamp: 3; }
.card-subtitulo {
  display: none; /* esconde subtítulo "Banco Daycoval" em todos os cards — redundante */
}

/* Tags */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.tag-chip {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 9999px;
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-200);
}

/* Footer */
.card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px var(--card-pad) 12px;
  gap: 8px;
  border-top: 1px solid var(--gray-100);
  margin-top: auto;
}
.card-footer-meta {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  flex: 1;
}
.card-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.card-footer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.card-autor {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
  white-space: normal;
  word-break: break-word;
  line-height: 1.3;
}
.card-date {
  font-size: 10px;
  color: var(--gray-400);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.card-footer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

/* CTA button — always visible */
.card-cta-abrir {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - var(--card-pad) * 2);
  margin: 0 var(--card-pad) 16px;
  padding: 10px 14px;
  background: linear-gradient(135deg, #2b7bff 0%, var(--blue) 55%, #0046b8 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(0,87,184,.28), inset 0 1px 0 rgba(255,255,255,.18);
  transition:
    box-shadow 0.2s ease,
    background 0.2s ease,
    transform 0.18s ease;
}
.card-cta-abrir:hover {
  background: linear-gradient(135deg, #3d8aff 0%, #2470f5 55%, #0b50c4 100%);
  box-shadow:
    0 6px 18px rgba(0,87,184,.4),
    inset 0 1px 0 rgba(255,255,255,.28);
  transform: translateY(-1px);
}
.card-cta-abrir:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(43,123,255,.4), 0 4px 14px rgba(0,87,184,.35);
}
.card-cta-abrir:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(0,87,184,.35);
}
@media (prefers-reduced-motion: reduce) {
  .card-cta-abrir { transition: none; }
}

/* Pin button — always visible, gold when pinned */
.projeto-card-pin {
  color: var(--gray-300);
  opacity: 1;
  transition: color 0.15s ease, filter 0.15s ease;
}
.projeto-card-pin:hover {
  color: #f59e0b;
  filter: drop-shadow(0 0 6px rgba(245,158,11,.65));
}
.projeto-card-pin.pinned { color: #f59e0b; filter: drop-shadow(0 0 4px rgba(245,158,11,.5)); }

.projeto-card--pinned {
  border-color: rgba(245,158,11,.5);
  box-shadow: 0 2px 10px rgba(245,158,11,.12);
}
.projeto-card--pinned:hover {
  border-color: rgba(245,158,11,.7);
}

/* Completion bar — sits at bottom of flex column, no absolute positioning */
.completude-wrap {
  height: 3px;
  background: var(--gray-100);
  /* Full-width: o card (overflow:hidden) recorta a barra nos cantos arredondados. */
  flex-shrink: 0;
}
.completude-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
  transition: width 0.6s var(--ef-ease-out, ease);
}

/* ── Card favoritado: borda + brilho dourado ── */
.projeto-card--pinned {
  border-color: rgba(245,158,11,.5);
  box-shadow: 0 2px 8px rgba(0,0,0,.07), 0 0 0 1px rgba(245,158,11,.28), 0 6px 22px rgba(245,158,11,.18);
}
.projeto-card--pinned:hover {
  border-color: rgba(245,158,11,.7);
  box-shadow:
    0 0 0 1px rgba(245,158,11,.4),
    0 14px 34px rgba(245,158,11,.22),
    0 4px 12px rgba(0,0,0,.07);
}
.projeto-card--pinned .completude-bar {
  background: linear-gradient(90deg, #fbbf24, #f59e0b);
}

/* Dark mode */
html[data-theme="dark"] .projeto-card {
  border-color: var(--card-border);
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
html[data-theme="dark"] .projeto-card:hover {
  background: var(--card-hover-bg);
  border-color: rgba(59,130,246,.45);
  box-shadow:
    0 0 0 1px rgba(59,130,246,.3),
    0 16px 38px rgba(0,0,0,.4),
    0 4px 14px rgba(59,130,246,.16);
}
html[data-theme="dark"] .card-cta-abrir {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 52%, #1d4ed8 100%);
  box-shadow: 0 2px 8px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.14);
}
html[data-theme="dark"] .card-cta-abrir:hover {
  background: linear-gradient(135deg, #4f93ff 0%, #2f74ff 55%, #1c4fe4 100%);
  box-shadow:
    0 6px 20px rgba(0,0,0,.5),
    0 0 0 1px rgba(59,130,246,.4),
    inset 0 1px 0 rgba(255,255,255,.22);
}
html[data-theme="dark"] .card-footer { border-color: rgba(255,255,255,.07); }
html[data-theme="dark"] .completude-wrap { background: rgba(255,255,255,.05); }
html[data-theme="dark"] .projeto-card--pinned {
  border-color: rgba(251,191,36,.4);
  box-shadow: 0 2px 8px rgba(0,0,0,.2), 0 0 0 1px rgba(251,191,36,.3), 0 6px 24px rgba(251,191,36,.22);
}
html[data-theme="dark"] .projeto-card--pinned:hover {
  border-color: rgba(251,191,36,.65);
  box-shadow: 0 12px 30px rgba(251,191,36,.28), 0 0 0 1px rgba(251,191,36,.45);
}
html[data-theme="dark"] .tag-chip { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); color: var(--gray-400); }
html[data-theme="dark"] .card-status-chip {
  background: color-mix(in srgb, var(--chip-color) 20%, transparent);
  border-color: color-mix(in srgb, var(--chip-color) 40%, transparent);
  color: color-mix(in srgb, var(--chip-color) 90%, #fff);
}
/* Avatar dark */
html[data-theme="dark"] .card-avatar {
  background: rgba(255,255,255,.1);
  color: rgba(255,255,255,.6);
}

/* Badges */
.proj-badge-spec-sistema,
.proj-badge-ef-simplificada,
.proj-badge-ef-cartoes {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 9999px;
  vertical-align: middle;
}
.proj-badge-ef-simplificada { background: #e8f5e9; color: #1b5e20; }
.proj-badge-ef-cartoes { background: #fff3e0; color: #e65100; }
.proj-badge-spec-sistema { background: #e3f2fd; color: #0d47a1; }

html[data-theme="dark"] .proj-badge-ef-simplificada { background: rgba(34,197,94,.12); color: #4ade80; }
html[data-theme="dark"] .proj-badge-ef-cartoes { background: rgba(249,115,22,.12); color: #fb923c; }
html[data-theme="dark"] .proj-badge-spec-sistema { background: rgba(59,130,246,.12); color: #60a5fa; }
.btn.icon-only {
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.btn.icon-only svg { display: block; }

/* ── Flow diagram edit form ── */
.flow-edit-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,87,184,.12);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.flow-type-select { max-width: 120px; }
.flow-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 2px;
}
.flow-edit-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.flow-edit-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.flow-edit-arrow-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--gray-200);
}
.flow-edit-arrow-icon {
  font-size: 18px;
  color: var(--blue);
  flex-shrink: 0;
  line-height: 1;
}
.flow-edit-arrow-row input { flex: 1; }

html[data-theme="dark"] .flow-edit-num {
  background: rgba(59,130,246,.18);
  color: #60a5fa;
}
html[data-theme="dark"] .flow-edit-label { color: rgba(185,215,250,.45); }
html[data-theme="dark"] .flow-edit-arrow-row { border-top-color: rgba(59,130,246,.2); }
html[data-theme="dark"] .flow-edit-arrow-icon { color: #60a5fa; }

/* ── Image block upload form ── */
.img-upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 24px 16px;
  border: 2px dashed var(--gray-200);
  border-radius: 10px;
  color: var(--gray-400);
  cursor: default;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
  margin-bottom: 4px;
}
.img-upload-dropzone p { margin: 0; font-size: 13px; }
.img-upload-dropzone:hover,
.img-upload-dropzone.drag-over {
  border-color: var(--blue);
  background: rgba(0,87,184,.05);
  color: var(--blue);
}
.img-upload-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  font-size: 11px;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.img-upload-sep::before,
.img-upload-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}
.img-preview-wrap {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
}
.img-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.img-preview-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
/* ── Crop inline direto na imagem ── */
.img-crop-overlay {
  /* position/size set inline by JS to exactly cover the image */
  position: absolute;
  z-index: 10;
  border-radius: var(--radius, 8px);
  overflow: hidden;
}
.img-crop-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
}
.img-crop-hint {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  background: rgba(10,16,30,.82);
  color: rgba(255,255,255,.8);
  font-size: 11px;
  font-family: inherit;
  border-radius: 6px;
  padding: 3px 10px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 2;
}

/* ── Handle de largura (drag) nas imagens ── */
/* ── Seleção de imagem: overlay com handles (bolinhas) e toolbar ── */
.bloco-wrap.img-selected .bloco-render .ef-figure img {
  outline: 2px solid var(--blue);
  outline-offset: 0;
}
/* Overlay vive dentro da <figure> (position:relative). A posição/tamanho são
   calculados em JS para casar EXATAMENTE com a <img> renderizada. */
.img-select-overlay {
  position: absolute;
  z-index: 7;
  pointer-events: none;
  border-radius: inherit;
}
.img-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--white);
  border: 2px solid var(--blue);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  pointer-events: auto;
  z-index: 2;
}
.img-handle--nw { left: -6px;  top: -6px;  cursor: nwse-resize; }
.img-handle--n  { left: 50%;   top: -6px;  transform: translateX(-50%); cursor: ns-resize; }
.img-handle--ne { right: -6px; top: -6px;  cursor: nesw-resize; }
.img-handle--e  { right: -6px; top: 50%;   transform: translateY(-50%); cursor: ew-resize; }
.img-handle--se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.img-handle--s  { left: 50%;   bottom: -6px; transform: translateX(-50%); cursor: ns-resize; }
.img-handle--sw { left: -6px;  bottom: -6px; cursor: nesw-resize; }
.img-handle--w  { left: -6px;  top: 50%;   transform: translateY(-50%); cursor: ew-resize; }

.img-float-toolbar {
  position: absolute;
  left: 50%;
  top: -42px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 5px;
  background: var(--navy, #0a1424);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0,0,0,.28);
  pointer-events: auto;
  white-space: nowrap;
  z-index: 3;
}
.img-float-toolbar::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--navy, #0a1424);
}
.img-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,.85);
  font-size: 14px;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.img-tool:hover { background: rgba(255,255,255,.14); color: #fff; }
.img-tool.active { background: var(--blue); color: #fff; }
.img-tool-sep { width: 1px; height: 16px; background: rgba(255,255,255,.18); margin: 0 2px; }
.img-size-badge {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  padding: 0 6px;
  min-width: 38px;
  text-align: center;
}

html[data-theme="dark"] .img-upload-dropzone {
  border-color: rgba(59,130,246,.25);
  color: rgba(185,215,250,.45);
}
html[data-theme="dark"] .img-upload-dropzone:hover,
html[data-theme="dark"] .img-upload-dropzone.drag-over {
  border-color: #4da3ff;
  background: rgba(77,163,255,.08);
  color: #93c5fd;
}
html[data-theme="dark"] .img-upload-sep { color: rgba(185,215,250,.35); }
html[data-theme="dark"] .img-upload-sep::before,
html[data-theme="dark"] .img-upload-sep::after { background: rgba(59,130,246,.2); }
html[data-theme="dark"] .img-preview-wrap {
  border-color: rgba(59,130,246,.2);
  background: rgba(0,0,0,.2);
}

/* ── Imagens lado a lado no editor ── */
[data-blocos-container] {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
}
[data-blocos-container] > .bloco-wrap {
  flex: 1 0 100%;
  min-width: 0;
  box-sizing: border-box;
}
[data-blocos-container] > .bloco-wrap[data-img-largura="75"] { flex: 0 0 75%; max-width: 75%; }
[data-blocos-container] > .bloco-wrap[data-img-largura="50"] { flex: 0 0 50%; max-width: 50%; }
[data-blocos-container] > .bloco-wrap[data-img-largura="33"] { flex: 0 0 33.333%; max-width: 33.333%; }
[data-blocos-container] > .bloco-wrap[data-img-largura="25"] { flex: 0 0 25%; max-width: 25%; }
/* A zona "Adicionar bloco" sempre ocupa linha inteira, independente de blocos de imagem menores. */
[data-blocos-container] > [data-add-bloco] {
  flex: 0 0 100%;
  width: 100%;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-600);
  background: var(--white);
  border: 1px dashed var(--gray-200);
  border-radius: var(--radius);
}
.empty-state h2 { font-size: 18px; color: var(--navy); margin-bottom: 8px; }
.empty-state p { line-height: 1.6; }
html[data-theme="dark"] .empty-state {
  background: #1a2434;
  border-color: rgba(100,165,235,.18);
  color: rgba(185,215,250,.55);
}
html[data-theme="dark"] .empty-state h2 { color: #e8f4ff; }

/* ─── Motion tokens (editor) ─── */
body.editor-mode {
  --ef-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ef-ease-snap: cubic-bezier(0.34, 1.2, 0.64, 1);
  --ef-dur-fast: 0.16s;
  --ef-dur-med: 0.28s;
  --ef-dur-slow: 0.38s;
}

/* Drag and drop — reordenação suave (FLIP) */
body.editor-mode [draggable="true"] {
  cursor: grab;
  -webkit-user-drag: element;
}
body.editor-mode [draggable="true"]:active {
  cursor: grabbing;
}

body.editor-mode .bloco-wrap,
body.editor-mode .section-side-item {
  transition:
    transform var(--ef-dur-med) var(--ef-ease-out),
    box-shadow var(--ef-dur-med) var(--ef-ease-out),
    opacity var(--ef-dur-fast) ease,
    background var(--ef-dur-fast) ease,
    outline-color var(--ef-dur-fast) ease;
}

body.editor-mode .bloco-wrap.dnd-flipping,
body.editor-mode .section-side-item.dnd-flipping {
  will-change: transform;
  z-index: 2;
}

body.editor-mode .dnd-list-active .bloco-wrap:not(.dragging),
body.editor-mode .dnd-list-active .section-side-item:not(.dragging) {
  transition:
    transform var(--ef-dur-med) var(--ef-ease-out),
    box-shadow var(--ef-dur-med) var(--ef-ease-out),
    opacity var(--ef-dur-fast) ease,
    margin var(--ef-dur-med) var(--ef-ease-out);
}

body.editor-mode.editor-dnd-active {
  cursor: grabbing !important;
  user-select: none;
}
body.editor-mode.editor-dnd-active * {
  cursor: grabbing !important;
}

body.editor-mode.editor-dnd-active .bloco-wrap.dragging,
body.editor-mode.editor-dnd-active .section-side-item.dragging {
  cursor: grabbing !important;
}

/* Lugar de origem vira um espaço-guia limpo (drop slot). O bloco "real"
   que o usuário arrasta é o ghost flutuante (nítido, com sombra forte). */
body.editor-mode .bloco-wrap.dragging,
body.editor-mode .section-side-item.dragging {
  opacity: 1 !important;
  transform: none !important;
  box-shadow: none !important;
  z-index: 1;
  pointer-events: none;
  outline: 2px dashed rgba(0,120,255,.55);
  outline-offset: -2px;
  border-radius: var(--radius, 8px);
  background: rgba(0,120,255,.07) !important;
}

/* Conteúdo do bloco de origem fica apagado — só o slot tracejado guia o drop */
body.editor-mode .bloco-wrap.dragging .bloco-render {
  opacity: 0.25;
}

body.editor-mode.editor-dnd-active .dnd-list-active .bloco-wrap:not(.dragging) {
  transition: opacity var(--ef-dur-fast) ease;
}

body.editor-mode.editor-dnd-active #editor-side .dnd-list-active .section-side-item:not(.dragging) {
  transition: opacity var(--ef-dur-fast) ease;
}

body.editor-mode .bloco-render img,
body.editor-mode .bloco-render a {
  -webkit-user-drag: none;
  user-select: text;
}

body.editor-mode .section-side-item.dragging .side-link {
  opacity: 0.3;
}

/* Indicador de inserção (linha azul) */
body.editor-mode .bloco-wrap.dnd-over-before,
body.editor-mode .section-side-item.dnd-over-before {
  position: relative;
}
body.editor-mode .bloco-wrap.dnd-over-before::before,
body.editor-mode .section-side-item.dnd-over-before::before {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  top: -2px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #0057b8, #3b82f6);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
  animation: dnd-insert-pulse 0.9s var(--ef-ease-out) infinite alternate;
  pointer-events: none;
  z-index: 5;
}

body.editor-mode .bloco-wrap.dnd-over-after,
body.editor-mode .section-side-item.dnd-over-after {
  position: relative;
}
body.editor-mode .bloco-wrap.dnd-over-after::after,
body.editor-mode .section-side-item.dnd-over-after::after {
  content: '';
  position: absolute;
  left: 4px;
  right: 4px;
  bottom: -2px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #0057b8, #3b82f6);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
  animation: dnd-insert-pulse 0.9s var(--ef-ease-out) infinite alternate;
  pointer-events: none;
  z-index: 5;
}

@keyframes dnd-insert-pulse {
  from { opacity: 0.75; transform: scaleX(0.98); }
  to { opacity: 1; transform: scaleX(1); }
}

body.editor-mode .add-block-zone.dnd-anchor-active {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-light);
  transform: scale(1.01);
  transition:
    border-color var(--ef-dur-fast) ease,
    background var(--ef-dur-fast) ease,
    color var(--ef-dur-fast) ease,
    transform var(--ef-dur-med) var(--ef-ease-out);
}

/* Legado: highlight antigo (fallback) */
.drag-over {
  background: var(--blue-light) !important;
  outline: 2px dashed var(--blue);
}

.drag-handle {
  color: var(--gray-400);
  padding: 0 6px;
  font-size: 14px;
  user-select: none;
  cursor: grab;
  transition: color var(--ef-dur-fast) ease, transform var(--ef-dur-fast) var(--ef-ease-out);
}
.drag-handle:hover {
  color: var(--gray-800);
  transform: scale(1.08);
}
.drag-handle:active {
  cursor: grabbing;
  transform: scale(0.96);
}

/* Ghost flutuante que segue o cursor */
.dnd-ghost {
  border-radius: var(--radius, 8px);
  cursor: grabbing !important;
  opacity: 1 !important;
}
.dnd-ghost .bloco-actions,
.dnd-ghost .sec-emoji-btn,
.dnd-ghost .section-edit-meta,
.dnd-ghost .drag-handle,
.dnd-ghost .side-sec-sidebar-edit {
  display: none !important;
}
html[data-theme="dark"] .dnd-ghost {
  box-shadow: 0 14px 44px rgba(0,0,0,.55), 0 3px 12px rgba(0,0,0,.4) !important;
}

.section-side-item {
  display: flex;
  align-items: stretch;
  gap: 0;
}

/* Mesmo ritmo visual do menu “Navegação” (.app-side .side-link), com coluna de arrastar + editar. */
.section-side-item {
  transition: transform var(--ef-dur-med, 0.28s) var(--ef-ease-out, ease);
}

.section-side-item .side-sec-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  margin: 1px var(--side-item-inset);
  border-radius: var(--side-item-radius);
  overflow: visible;
  border: 1px solid transparent;
  transition:
    background var(--ef-dur-med, 0.28s) var(--ef-ease-out, ease),
    border-color var(--ef-dur-med, 0.28s) ease,
    box-shadow var(--ef-dur-med, 0.28s) ease;
}

.section-side-item:hover .side-sec-row {
  background: var(--side-hover);
}
.section-side-item .side-link {
  flex: 1;
  width: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  margin: 0;
  text-align: left;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  border-radius: var(--side-item-radius);
  border-left: none;
  cursor: grab;
  position: relative;
  transition: background 0.18s ease, color 0.18s ease;
}
.section-side-item .side-link:active { cursor: grabbing; }
.section-side-item .side-link:hover:not(.active) {
  background: var(--side-hover);
}
/* Active: mesma barrinha azul do menu principal */
.section-side-item .side-link.active {
  background: rgba(59,130,246,.18);
  color: #fff;
  font-weight: 600;
}
.section-side-item .side-link.active::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: #3b82f6;
  border-radius: 0 3px 3px 0;
}
.section-side-item .side-sec-label {
  flex: 1;
  min-width: 0;
}
/* Group icon inside section item */
.section-side-item .side-sec-ico {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: 0.55;
  color: rgba(175,210,255,.8);
}
.section-side-item .side-sec-ico .material-symbols-outlined,
.section-side-item .side-sec-ico .spec-sec-icon {
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
  font-size: 14px;
  line-height: 1;
}
.section-side-item .side-sec-ico .spec-sec-emoji {
  font-size: 12px;
  line-height: 1;
}
.section-side-item .side-sec-row:has(.side-link.active) .side-sec-ico {
  opacity: 0.9;
}

/* Bloco no editor: clique no texto = edição inline; lápis = modal (tipo, estrutura, opções) */
#editor-main .bloco-render[data-inline-editable] {
  cursor: text;
}
#editor-main .bloco-btn-editar {
  min-width: 34px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#editor-main .bloco-btn-editar .material-symbols-outlined {
  font-size: 18px;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.versao-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--gray-100);
  background: var(--white);
}
.versao-row:last-child { border-bottom: none; }
.versao-row .v-num {
  font-weight: 700; color: var(--navy); margin-right: 10px;
  background: var(--blue-light); border: 1px solid var(--blue-mid);
  padding: 2px 10px; border-radius: 20px; font-size: 12px;
}
.versao-row .v-num.atual { background: var(--green-bg); border-color: #86efac; color: var(--green); }
.versao-row .v-desc { color: var(--gray-600); font-size: 13px; flex: 1; padding: 0 12px; }
.versao-row .v-data,
.versao-row .v-meta { font-size: 11px; color: var(--gray-400); margin-right: 8px; white-space: nowrap; }

.preview-bar {
  display: flex; gap: 10px; align-items: center;
  padding: 10px 18px;
  background: var(--navy);
  color: var(--white);
  position: sticky; top: 0; z-index: 50;
}
.preview-bar .grow { flex: 1; }
.preview-bar h2 { font-size: 14px; font-weight: 700; color: white; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  left: auto;
  width: fit-content;
  max-width: min(92vw, 22rem);
  box-sizing: border-box;
  padding: 9px 14px;
  background: var(--gray-800);
  color: var(--white);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
  z-index: 2000;
  font-size: 13px;
  line-height: 1.35;
  word-break: break-word;
  opacity: 0;
  transform: translateY(12px) scale(0.96);
  transition:
    opacity 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.toast.is-hiding {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition-duration: 0.18s;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }

.tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200);
  margin-bottom: 16px;
}
.tabs button {
  background: none; border: none; padding: 8px 14px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--gray-600);
  border-bottom: 2px solid transparent;
  font-family: inherit;
}
.tabs button.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}
.tabs button:hover { color: var(--navy); }

.section-edit-meta {
  background: var(--blue-light);
  border: 1px solid var(--blue-mid);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
}
.section-edit-meta .grow { flex: 1; }

/* MATRIZ - editor */
.matriz-editor-grid {
  width: 100%; border-collapse: collapse;
  font-size: 12px; margin-top: 10px;
  background: var(--white);
}
.matriz-editor-grid th,
.matriz-editor-grid td { border: 1px solid var(--gray-200); padding: 4px 6px; }
.matriz-editor-grid thead th {
  background: var(--gray-50); color: var(--gray-600);
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; text-align: center;
  position: sticky; top: 0; z-index: 2;
}
.matriz-editor-grid thead th.col-fixa { text-align: left; background: var(--gray-100); }
.matriz-editor-grid tbody td.txt { font-weight: 600; color: var(--navy); white-space: nowrap; }
.matriz-editor-grid tbody td.txt.sub { color: var(--gray-800); font-weight: 500; }
.matriz-editor-grid tbody td.txt.perfil { color: var(--gray-600); font-weight: 400; }
.matriz-editor-grid .cell-btn {
  width: 100%; min-height: 28px; min-width: 38px;
  border: none; cursor: pointer; font-weight: 700; font-size: 13px;
  font-family: inherit; padding: 4px 6px; border-radius: 3px;
  background: transparent; color: var(--gray-400);
}
.matriz-editor-grid .cell-btn.cell-disponivel     { background: var(--green-bg);  color: var(--green); }
.matriz-editor-grid .cell-btn.cell-em_dev         { background: var(--yellow-bg); color: var(--orange); }
.matriz-editor-grid .cell-btn.cell-nao_disponivel { background: var(--red-bg);    color: var(--red); }
.matriz-editor-grid .cell-btn.cell-nao_aplica     { background: var(--gray-100);  color: var(--gray-400); }
.matriz-editor-grid .cell-btn:hover { outline: 2px solid var(--blue); outline-offset: -2px; }
.matriz-editor-grid .col-acao { width: 38px; text-align: center; }
.matriz-editor-grid .row-acao { width: 38px; text-align: center; padding: 2px; }
.matriz-editor-grid .btn-rm-row,
.matriz-editor-grid .btn-rm-col {
  background: transparent; border: 1px solid transparent; color: var(--gray-400);
  cursor: pointer; padding: 2px 6px; border-radius: 3px; font-family: inherit;
}
.matriz-editor-grid .btn-rm-row:hover,
.matriz-editor-grid .btn-rm-col:hover { color: var(--red); border-color: #fca5a5; background: var(--red-bg); }

.matriz-editor-toolbar {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px; align-items: center;
}
.matriz-editor-toolbar .pill {
  background: var(--gray-100); color: var(--gray-600);
  font-size: 11px; padding: 3px 9px; border-radius: 20px;
}

.picker-list {
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--gray-200); border-radius: 6px;
  background: var(--white);
}
.picker-list .picker-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--gray-600);
  background: var(--gray-50); padding: 6px 12px;
  border-bottom: 1px solid var(--gray-100);
  position: sticky; top: 0; z-index: 1;
}
.picker-list .picker-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-bottom: 1px solid var(--gray-100);
  font-size: 13px; cursor: pointer;
}
.picker-list .picker-item:last-child { border-bottom: none; }
.picker-list .picker-item:hover { background: var(--blue-light); }
.picker-list .picker-item.disabled { opacity: 0.5; cursor: not-allowed; }
.picker-list .picker-item .picker-meta {
  font-size: 11px; color: var(--gray-400); margin-left: auto;
}

/* Barra de rascunho: centro na horizontal, presa ao fundo da viewport */
.editor-draft-bar {
  position: fixed;
  z-index: 900;
  /* Centraliza no conteúdo (após o sidebar de 260px), não na janela inteira */
  left: calc(50% + var(--app-sidebar-w, 260px) / 2);
  right: auto;
  top: auto;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 18px;
  margin: 0;
  max-width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  color: var(--navy);
  font-size: 13px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(37, 99, 235, 0.12);
}
html[data-theme="dark"] .editor-draft-bar {
  border-color: rgba(59, 130, 246, 0.35);
  background: linear-gradient(180deg, #1e3a5f 0%, #172554 100%);
  color: rgba(255, 252, 240, 0.95);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(59, 130, 246, 0.2);
}
.editor-draft-bar[hidden] {
  display: none !important;
}
.editor-draft-bar-msg {
  font-weight: 600;
}
.editor-draft-bar .grow {
  display: none;
}
.editor-draft-bar .btn.small {
  padding: 6px 10px;
}
body.editor-mode.editor-has-unsaved-content .app-main {
  padding-bottom: 100px;
}

/* Toggle de tema na sidebar (home + editor) */
.side-footer-theme-wrap {
  padding: 4px var(--side-pad-x) 6px;
  border-bottom: 1px solid var(--side-line);
}
.theme-side-toggle {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px calc(var(--side-item-inset) - 2px);
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--side-item-radius);
}
.theme-side-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.theme-toggle-icons {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.theme-toggle-icons .theme-icon-sun {
  display: block;
}
.theme-toggle-icons .theme-icon-moon {
  display: none;
}
html[data-theme="dark"] .theme-toggle-icons .theme-icon-sun {
  display: none;
}
html[data-theme="dark"] .theme-toggle-icons .theme-icon-moon {
  display: block;
}
.theme-side-label {
  font-size: 13px;
  font-weight: 500;
}

/* Tema escuro: ajustes que não resolvem só com tokens (--white virou superfície escura) */
/* Sidebar: mesmo gradiente no claro e no escuro — sem regras separadas */
/* Editor clássico (sem folha MD3): gradiente. Com `.editor-spec-a4` o miolo MD3 define a toolbar. */
html[data-theme="dark"] #editor-main:not(.editor-spec-a4) .toolbar {
  background: linear-gradient(180deg, #061e3d 0%, #030d1c 100%);
  border-color: rgba(30, 74, 120, 0.55);
  box-shadow: 0 4px 22px rgba(0, 8, 24, 0.55);
}
html[data-theme="dark"] #editor-main:not(.editor-spec-a4) .toolbar-actions {
  border-top-color: rgba(255, 255, 255, 0.08);
}

/* ── Dark mode: A4 canvas — um tom acima do fundo, ainda escuro ── */
html[data-theme="dark"] #editor-main.editor-spec-a4 .a4-page {
  background: #122742;
  border-color: transparent;
  box-shadow: none;
}
/* Seções: fundo claro explícito para manter a aparência como cards */
html[data-theme="dark"] #editor-main.editor-spec-a4 #secoes-render > section {
  background: #f5f8ff;
  border-color: rgba(0, 65, 162, 0.18);
}
html[data-theme="dark"] #editor-main.editor-spec-a4 #secoes-render > section.spec-doc-section--new {
  background: rgba(0, 41, 102, 0.07);
  border-color: rgba(0, 65, 162, 0.22);
}
/* Painel de rodapé do documento */
html[data-theme="dark"] #editor-main.editor-spec-a4 .editor-spec-light-panel {
  background: #f5f8ff;
  border-radius: 8px;
}

/* ── Toggle pill de tema na toolbar do editor ── */
#editor-main .toolbar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.theme-pill-toggle {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}
.theme-pill-track {
  position: relative;
  display: flex;
  align-items: center;
  width: 52px;
  height: 28px;
  border-radius: 100px;
  background: #2c3a50;
  transition: background .22s ease;
  flex-shrink: 0;
}
html[data-theme="dark"] .theme-pill-track {
  background: #cdd9eb;
}
.theme-pill-toggle:hover .theme-pill-track {
  background: #3b4e67;
}
html[data-theme="dark"] .theme-pill-toggle:hover .theme-pill-track {
  background: #baccde;
}
.theme-pill-knob {
  position: absolute;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  color: #1a2740;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.28);
  transition: transform .22s cubic-bezier(0.34, 1.1, 0.64, 1), background .22s ease, color .22s ease;
}
html[data-theme="dark"] .theme-pill-knob {
  background: #0e1f3a;
  color: #c8dfff;
  transform: translateX(24px);
}
.theme-pill-knob .theme-icon-sun  { display: block; }
.theme-pill-knob .theme-icon-moon { display: none;  }
html[data-theme="dark"] .theme-pill-knob .theme-icon-sun  { display: none;  }
html[data-theme="dark"] .theme-pill-knob .theme-icon-moon { display: block; }

html[data-theme="dark"] .toolbar h1.toolbar-proj-titulo {
  color: #f0f7ff;
}
html[data-theme="dark"] .toolbar-proj-ver {
  color: #8ab4db;
}
html[data-theme="dark"] .toolbar-badge-ef-simp {
  background: rgba(46, 125, 50, 0.35);
  color: #c8e6c9;
}
html[data-theme="dark"] .toolbar-proj-codigo {
  color: #7a9ec8;
}
html[data-theme="dark"] .toolbar-status-label {
  color: #b6d0eb;
}
html[data-theme="dark"] .app-main {
  background: transparent;
}
html[data-theme="dark"] .btn.primary,
html[data-theme="dark"] .btn.success {
  color: #f0f6fc;
}
html[data-theme="dark"] .btn:not(:disabled):hover {
  box-shadow: 0 6px 18px rgba(0,0,0,.5), 0 2px 6px rgba(0,0,0,.3);
}
html[data-theme="dark"] .btn.primary:not(:disabled):hover {
  box-shadow: 0 6px 24px rgba(0,120,255,.65), 0 2px 8px rgba(0,0,0,.3);
}
html[data-theme="dark"] .btn.success:not(:disabled):hover {
  box-shadow: 0 6px 24px rgba(40,200,90,.55);
}
html[data-theme="dark"] .btn.danger:not(:disabled):hover {
  background: rgba(220, 38, 38, .15);
  border-color: rgba(220, 38, 38, .45);
  color: #f87171;
  box-shadow: none;
}
html[data-theme="dark"] .toast {
  background: #30363d;
  color: #e6edf3;
}
html[data-theme="dark"] .toast.success,
html[data-theme="dark"] .toast.error {
  color: #fff;
}
html[data-theme="dark"] .preview-bar {
  color: #f0f6fc;
}
html[data-theme="dark"] .preview-bar h2 {
  color: #f0f6fc;
}


/* Home — filtros da lista de projetos */
.home-btn-filtros {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.home-btn-filtros-ico {
  flex-shrink: 0;
  opacity: 0.9;
}
.home-filtros-panel {
  margin: 12px 0 0;
  padding: 18px 20px 20px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.home-filtros-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 12px 14px;
}
.home-filtro-busca {
  flex: 1 1 220px;
  min-width: 180px;
  padding: 10px 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-app);
  background: var(--white);
  color: var(--navy);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.home-filtro-busca::placeholder {
  color: var(--gray-400);
}
.home-filtro-busca:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 87, 184, 0.18);
}
.home-filtro-select {
  min-width: 170px;
  max-width: 100%;
  font-family: var(--font-app);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
/* "Todos os tipos" não usa .select-status-projeto — espelha o mesmo cromo/hover do outro dropdown */
.home-filtros-panel .home-filtro-select {
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--navy);
  transition: border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.home-filtros-panel .home-filtro-select:hover {
  border-color: var(--blue);
  color: var(--blue);
}
.home-filtros-panel .home-filtro-select:focus {
  outline: 2px solid rgba(0, 87, 184, 0.25);
  outline-offset: 1px;
}
.home-filtros-panel .select-status-projeto,
.home-filtros-panel .home-filtro-select {
  min-width: 170px;
  border-radius: 8px;
  padding: 9px 12px;
  font-family: var(--font-app);
}
.home-filtros-panel .home-filtros-inner > .btn.small {
  align-self: center;
  border-radius: 8px;
  font-weight: 600;
}
.home-filtros-meta {
  margin: 12px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  letter-spacing: 0.02em;
}
.home-filtros-vazio {
  margin-top: 16px;
}
.home-filtros-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html[data-theme="dark"] .home-filtros-panel {
  background: linear-gradient(180deg, #061e3d 0%, #030d1c 100%);
  border: 1px solid rgba(30, 74, 120, 0.55);
  box-shadow:
    0 12px 36px rgba(0, 4, 18, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
html[data-theme="dark"] .home-filtro-busca {
  background: rgba(4, 14, 32, 0.72);
  border: 1px solid rgba(120, 175, 235, 0.32);
  color: #e8f2ff;
}
html[data-theme="dark"] .home-filtro-busca::placeholder {
  color: rgba(175, 205, 245, 0.45);
}
html[data-theme="dark"] .home-filtro-busca:focus {
  border-color: #6bb8ff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
html[data-theme="dark"] .home-filtros-panel .select-status-projeto,
html[data-theme="dark"] .home-filtros-panel .home-filtro-select {
  background: rgba(4, 14, 32, 0.72);
  border-color: rgba(120, 175, 235, 0.32);
  color: #e8f2ff;
}
html[data-theme="dark"] .home-filtros-panel .select-status-projeto:hover,
html[data-theme="dark"] .home-filtros-panel .home-filtro-select:hover {
  border-color: rgba(165, 205, 255, 0.48);
  color: #ffffff;
}
html[data-theme="dark"] .home-filtros-panel .select-status-projeto:focus,
html[data-theme="dark"] .home-filtros-panel .home-filtro-select:focus {
  outline: none;
  border-color: #6bb8ff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}
html[data-theme="dark"] .home-filtros-panel #home-filtro-limpar {
  background: transparent;
  border: 1px solid rgba(140, 190, 255, 0.38);
  color: #d6eaff;
}
html[data-theme="dark"] .home-filtros-panel #home-filtro-limpar:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(185, 218, 255, 0.55);
  color: #ffffff;
}
html[data-theme="dark"] .home-filtros-meta {
  color: rgba(165, 205, 245, 0.78);
}
html[data-theme="dark"] .home-btn-filtros {
  border-color: rgba(130, 180, 240, 0.35);
  color: #e8f2ff;
}
html[data-theme="dark"] .home-btn-filtros:hover {
  border-color: rgba(175, 210, 255, 0.55);
  background: rgba(59, 130, 246, 0.12);
}

/* Home/catálogo toolbar: MESMO estilo da navbar do editor (gradiente navy unificado) */
html[data-theme="dark"] body.home-mode .toolbar {
  background: linear-gradient(180deg, #061e3d 0%, #030d1c 100%);
  border: 1px solid rgba(30, 74, 120, 0.55);
  box-shadow: 0 12px 36px rgba(0, 4, 18, 0.65);
}

/* Home/catálogo toolbar: botões IDÊNTICOS aos da navbar do editor */
html[data-theme="dark"] body.home-mode .toolbar .btn:not(.btn-add-secao) {
  background: rgba(59, 130, 246, 0.14);
  border-color: rgba(96, 165, 250, 0.38);
  color: #dbeafe;
}
html[data-theme="dark"] body.home-mode .toolbar .btn:not(.btn-add-secao):not(:disabled):hover {
  background: rgba(59, 130, 246, 0.26);
  border-color: rgba(96, 165, 250, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}
html[data-theme="dark"] body.home-mode .toolbar .btn:not(.btn-add-secao):not(:disabled):active {
  transform: translateY(1px) scale(0.97);
  transition-duration: 0.06s;
}
html[data-theme="dark"] body.home-mode .toolbar .btn.primary {
  background: #2563eb;
  border-color: #3b82f6;
  color: #ffffff;
}
html[data-theme="dark"] body.home-mode .toolbar .btn.primary:not(:disabled):hover {
  background: #1d4ed8;
  border-color: #60a5fa;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.5);
  transform: translateY(-2px) scale(1.03);
}

/* Impressão (Ctrl+P): só o documento do editor, sem sidebar nem barra de ferramentas */
@media (prefers-reduced-motion: reduce) {
  #editor-main.editor-spec-a4 #secoes-render.editor-secoes-enter > section,
  #editor-main.editor-spec-a4 #secoes-render > section.secao-nav-highlight {
    animation: none !important;
  }
  body.editor-mode #secoes-render.secao-navigating > section {
    opacity: 1 !important;
  }
  .modal-overlay,
  .modal-overlay > .modal,
  #secao-emoji-popover {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

@media print {

  body.editor-mode #editor-side,
  body.editor-mode .editor-spec-toolbar,
  body.editor-mode #editor-draft-bar,
  body.editor-mode #secao-emoji-popover {
    display: none !important;
  }
  body.editor-mode .app-shell-grid {
    display: block !important;
    min-height: 0;
  }
  body.editor-mode .app-main.editor-spec-a4 {
    width: 100% !important;
    max-width: none !important;
    background: #fff !important;
    color: #111 !important;
  }
  body.editor-mode .editor-a4-scroll {
    padding: 0 !important;
    overflow: visible !important;
    background: #fff !important;
  }
  body.editor-mode #editor-main.editor-spec-a4 .ef-a4-viewport {
    width: auto !important;
    min-height: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.editor-mode #editor-main.editor-spec-a4 .a4-page {
    background: #fff !important;
    color: #111 !important;
    border: none !important;
    box-shadow: none !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }
  body.editor-mode #editor-main.editor-spec-a4 .editor-spec-sections-matter,
  body.editor-mode #editor-main.editor-spec-a4 .editor-spec-light-panel {
    background: #fff !important;
    color: #111 !important;
    border: none !important;
    box-shadow: none !important;
    padding: 12px 0 !important;
  }
  body.editor-mode #editor-main.editor-spec-a4 #secoes-render > section.spec-doc-section,
  body.editor-mode #editor-main.editor-spec-a4 #secoes-render > section.spec-doc-section.spec-doc-section--new {
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    margin: 0 0 16px !important;
    padding: 0 !important;
  }
  body.editor-mode #editor-main.editor-spec-a4 .editor-spec-light-panel.editor-spec-end-matter {
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    margin-top: 0 !important;
  }
  body.editor-mode .section-edit-meta,
  body.editor-mode .bloco-actions,
  body.editor-mode .add-block-zone {
    display: none !important;
  }
  body.editor-mode .sec-emoji-btn,
  body.editor-mode .spec-sec-icon-btn {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 6px 0 0 !important;
    pointer-events: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ═══════════════════════════════════════════════════════════════
   TAG CHIPS
═══════════════════════════════════════════════════════════════ */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.tag-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(59,130,246,.12);
  color: #2563eb;
  border: 1px solid rgba(59,130,246,.25);
  white-space: nowrap;
}
html[data-theme="dark"] .tag-chip {
  background: rgba(96,165,250,.15);
  color: #93c5fd;
  border-color: rgba(96,165,250,.3);
}

/* ═══════════════════════════════════════════════════════════════
   DECISÃO EM ABERTO
═══════════════════════════════════════════════════════════════ */
.decisao-wrap {
  border-radius: 8px;
  padding: 14px 18px;
  border-left: 4px solid;
  margin: 4px 0;
}
.decisao-wrap--aberto {
  background: rgba(245,158,11,.07);
  border-color: #f59e0b;
}
.decisao-wrap--resolvido {
  background: rgba(34,197,94,.07);
  border-color: #22c55e;
}
.decisao-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.decisao-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 9999px;
  flex-shrink: 0;
}
.decisao-badge--open { background: #fef3c7; color: #b45309; }
.decisao-badge--ok   { background: #dcfce7; color: #15803d; }
html[data-theme="dark"] .decisao-badge--open { background: rgba(245,158,11,.2); color: #fbbf24; }
html[data-theme="dark"] .decisao-badge--ok   { background: rgba(34,197,94,.2); color: #4ade80; }
.decisao-titulo { font-size: 14px; font-weight: 700; color: var(--navy); }
.decisao-corpo { font-size: 13px; color: var(--gray-700); margin: 6px 0 10px; }
.decisao-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--gray-600); }

/* ═══════════════════════════════════════════════════════════════
   BLOCK HOVER TOOLTIP
═══════════════════════════════════════════════════════════════ */
.bloco-tip {
  position: absolute;
  z-index: 9999;
  max-width: 340px;
  white-space: pre-line;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 12px;
  border-radius: 8px;
  background: #1e293b;
  color: #e2e8f0;
  box-shadow: 0 4px 20px rgba(0,0,0,.4);
  pointer-events: none;
  border: 1px solid rgba(255,255,255,.08);
}

/* ═══════════════════════════════════════════════════════════════
   AUTOSAVE INDICATOR
═══════════════════════════════════════════════════════════════ */
.autosave-ind {
  font-size: 11px;
  color: rgba(255,255,255,.45);
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}
.autosave-ind--show { opacity: 1; }

/* ═══════════════════════════════════════════════════════════════
   BUSCA GLOBAL
═══════════════════════════════════════════════════════════════ */
.busca-global-results {
  max-height: 420px;
  overflow-y: auto;
  margin-top: 8px;
}
.busca-global-hint {
  font-size: 13px;
  color: var(--gray-500);
  padding: 10px 0;
  margin: 0;
}
.busca-global-grupo {
  margin-bottom: 16px;
}
.busca-global-proj {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blue);
  padding: 4px 0 6px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 4px;
}
.busca-global-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--gray-800);
  transition: background 0.12s ease;
}
.busca-global-item:hover { background: var(--gray-100); }
.busca-global-tipo {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(59,130,246,.1);
  color: #2563eb;
  padding: 1px 7px;
  border-radius: 9999px;
}
.busca-global-txt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.busca-global-secao { color: var(--gray-500); font-size: 12px; }
html[data-theme="dark"] .busca-global-proj { color: #60a5fa; border-bottom-color: rgba(255,255,255,.08); }
html[data-theme="dark"] .busca-global-item { color: #e2e8f0; }
html[data-theme="dark"] .busca-global-item:hover { background: rgba(255,255,255,.07); }
html[data-theme="dark"] .busca-global-tipo { background: rgba(96,165,250,.18); color: #93c5fd; }


/* ─────────────── Comentários ─────────────── */
.bloco-btn-comentarios { position: relative; }
.bloco-comentarios-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 1px 4px;
  border-radius: 9999px;
  pointer-events: none;
}
.comentarios-lista { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.comentarios-vazio { color: var(--gray-500); font-size: 13px; text-align: center; padding: 20px 0; }
.comentario-item { border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px 12px; }
.comentario-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.comentario-autor { font-weight: 600; font-size: 13px; color: var(--gray-800); }
.comentario-data { font-size: 11px; color: var(--gray-500); flex: 1; }
.comentario-texto { font-size: 13px; color: var(--gray-700); white-space: pre-wrap; }
html[data-theme="dark"] .comentario-item { border-color: rgba(255,255,255,.1); }
html[data-theme="dark"] .comentario-autor { color: #e2e8f0; }
html[data-theme="dark"] .comentario-texto { color: #cbd5e1; }

/* ─────────────── Diff visual ─────────────── */
.diff-legenda { font-size: 12px; color: var(--gray-500); margin-bottom: 14px; display: flex; align-items: center; gap: 4px; }
.diff-badge { display: inline-block; padding: 1px 7px; border-radius: 9999px; font-size: 11px; font-weight: 700; }
.diff-badge--add { background: #dcfce7; color: #15803d; }
.diff-badge--rm  { background: #fee2e2; color: #dc2626; }
.diff-badge--chg { background: #fef9c3; color: #b45309; }
.diff-corpo { display: flex; flex-direction: column; gap: 6px; }
.diff-secao { border: 1px solid var(--gray-200); border-radius: 8px; padding: 10px 14px; }
.diff-secao--added { border-color: #86efac; background: #f0fdf4; }
.diff-secao--removed { border-color: #fca5a5; background: #fff1f2; }
.diff-secao--changed { border-color: #fde68a; background: #fffbeb; }
.diff-secao-header { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.diff-bloco { font-size: 12px; padding: 3px 0 3px 4px; display: flex; align-items: center; gap: 6px; }
.diff-bloco--added { color: #15803d; }
.diff-bloco--removed { color: #dc2626; }
.diff-bloco--changed { color: #b45309; }
.diff-titulo-rm { color: #dc2626; text-decoration: line-through; }
.diff-titulo-add { color: #15803d; }
.diff-tipo-from { font-size: 11px; color: var(--gray-500); }
html[data-theme="dark"] .diff-secao { border-color: rgba(255,255,255,.1); }
html[data-theme="dark"] .diff-secao--added { border-color: #166534; background: rgba(22,101,52,.2); }
html[data-theme="dark"] .diff-secao--removed { border-color: #991b1b; background: rgba(153,27,27,.2); }
html[data-theme="dark"] .diff-secao--changed { border-color: #92400e; background: rgba(120,53,15,.2); }
html[data-theme="dark"] .diff-badge--add { background: rgba(22,101,52,.3); color: #86efac; }
html[data-theme="dark"] .diff-badge--rm  { background: rgba(153,27,27,.3); color: #fca5a5; }
html[data-theme="dark"] .diff-badge--chg { background: rgba(120,53,15,.3); color: #fde68a; }
html[data-theme="dark"] .diff-bloco--added { color: #86efac; }
html[data-theme="dark"] .diff-bloco--removed { color: #fca5a5; }
html[data-theme="dark"] .diff-bloco--changed { color: #fde68a; }
html[data-theme="dark"] .diff-titulo-rm { color: #fca5a5; }
html[data-theme="dark"] .diff-titulo-add { color: #86efac; }

/* ─────────────── Comentários estilo Google Docs ─────────────── */

.cmt-bloco-highlight {
  background: rgba(255, 193, 7, 0.12) !important;
  outline: 2px solid rgba(245, 158, 11, 0.5) !important;
  outline-offset: 3px;
  border-radius: 6px;
}
html[data-theme="dark"] .cmt-bloco-highlight {
  background: rgba(251, 191, 36, 0.09) !important;
  outline-color: rgba(251, 191, 36, 0.35) !important;
}

/* Card principal */
.cmt-panel {
  position: fixed;
  z-index: 1200;
  width: 308px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12), 0 8px 28px rgba(0,0,0,.10);
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateX(10px);
  transition: opacity .17s ease, transform .17s ease;
  pointer-events: none;
  max-height: 72vh;
  border: 1px solid rgba(0,0,0,.08);
}
.cmt-panel--open { opacity: 1; transform: none; pointer-events: all; }

/* Linha superior: nome do bloco + fechar */
.cmt-panel-top {
  display: flex;
  align-items: center;
  padding: 10px 12px 6px;
  gap: 6px;
  border-bottom: 1px solid #f1f5f9;
}
.cmt-panel-label {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmt-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #94a3b8;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color .12s, background .12s;
}
.cmt-close-btn:hover { background: #f1f5f9; color: #475569; }

/* Lista de comentários */
.cmt-panel-lista {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
  display: flex;
  flex-direction: column;
  max-height: 280px;
}
.cmt-vazio { color: #94a3b8; font-size: 12px; text-align: center; padding: 16px 12px; }

/* Item de comentário */
.cmt-item {
  padding: 10px 14px 8px;
}
.cmt-item + .cmt-item { border-top: 1px solid #f1f5f9; }
.cmt-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}
.cmt-data { font-size: 10px; color: #94a3b8; }
.cmt-item-del {
  background: none; border: none; cursor: pointer;
  color: #cbd5e1; font-size: 12px; padding: 2px 4px; border-radius: 4px;
  transition: color .12s, background .12s; flex-shrink: 0;
}
.cmt-item-del:hover { color: #ef4444; background: #fee2e2; }
.cmt-texto { font-size: 13px; color: #334155; line-height: 1.55; white-space: pre-wrap; }

/* Formulário novo comentário */
.cmt-panel-form {
  padding: 10px 14px 12px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cmt-textarea {
  width: 100%; box-sizing: border-box;
  border: none; border-radius: 0;
  padding: 4px 0; font-size: 13px; font-family: inherit;
  background: transparent; color: #1e293b; outline: none;
  resize: none; min-height: 48px; line-height: 1.5;
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.cmt-textarea:focus { border-bottom-color: #e2e8f0; }
.cmt-form-actions { display: flex; justify-content: flex-end; gap: 6px; }

/* Dark mode */
html[data-theme="dark"] .cmt-panel {
  background: #0f172a;
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
}
html[data-theme="dark"] .cmt-panel-top,
html[data-theme="dark"] .cmt-item + .cmt-item,
html[data-theme="dark"] .cmt-panel-form { border-color: rgba(255,255,255,.07); }
html[data-theme="dark"] .cmt-texto { color: #94a3b8; }
html[data-theme="dark"] .cmt-close-btn:hover { background: rgba(255,255,255,.08); color: #e2e8f0; }
html[data-theme="dark"] .cmt-textarea { color: #e2e8f0; border-color: rgba(255,255,255,.10); }

/* ─────────────── Formatting toolbar ─────────────── */
.fmt-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 5px;
  background: #24292f;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.fmt-toolbar--inline {
  margin: 0 0 6px;
  position: sticky;
  top: 56px;
  z-index: 8;
  width: fit-content;
}
.fmt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  padding: 0 6px;
  border: none;
  background: transparent;
  border-radius: 4px;
  font-size: 13px;
  color: #e6edf3;
  cursor: pointer;
  transition: background 0.12s;
  line-height: 1;
}
.fmt-btn:hover  { background: rgba(255,255,255,.12); }
.fmt-btn:active { background: rgba(255,255,255,.20); }
.fmt-btn strong { font-weight: 800; font-size: 13px; }
.fmt-btn em     { font-style: italic; font-size: 13px; }
.fmt-btn u      { text-decoration: underline; font-size: 13px; }
.fmt-btn--mono  { font-family: monospace; font-size: 12px; letter-spacing: -0.5px; }
.fmt-sep {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,.18);
  margin: 0 3px;
  flex-shrink: 0;
}

/* Campo rico (WYSIWYG) que substitui o textarea de markdown no modal.
   Mantém o mesmo visual do textarea, mas aplica os efeitos diretamente. */
.fmt-rich {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 5px;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.5;
  background: var(--white);
  min-height: 2.4em;
  resize: vertical;
  overflow: auto;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}
.fmt-rich:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(0,87,184,.12);
}
.fmt-rich:empty::before {
  content: attr(data-placeholder);
  color: var(--gray-400);
  pointer-events: none;
}
.fmt-rich code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.92em;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 3px;
  padding: 1px 4px;
}
.modal-bloco-edit .modal-body .form-row--expand > .fmt-rich {
  flex: 1;
  min-height: 180px;
}
/* O textarea original fica fora de vista, só para serialização do form. */
.fmt-rich-source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: -1px !important;
  border: 0 !important;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden !important;
  opacity: 0 !important;
  pointer-events: none;
}

/* Dark mode */
html[data-theme="dark"] .modal-overlay .fmt-rich {
  background: rgba(0, 0, 0, 0.3);
  border-color: rgba(100, 165, 235, 0.22);
  color: #e8f4ff;
}
html[data-theme="dark"] .modal-overlay .fmt-rich:empty::before {
  color: rgba(185, 215, 250, 0.35);
}
html[data-theme="dark"] .modal-overlay .fmt-rich code {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.14);
}


/* ─────────────── Preview de catálogo (templates/canais/funcionalidades) ─────────────── */
.catalog-preview-hint {
  font-size: 12px;
  color: var(--gray-600);
  margin: 0 0 14px;
  font-style: italic;
}
.catalog-preview-render {
  /* Sempre light — mostra como fica no documento EF */
  background: #ffffff;
  color: #24292f;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 20px 24px;
  --blue: #0057b8;
  --blue-light: #e8f0fc;
  --blue-mid: #ccddf5;
  --navy: #002f5f;
  --green: #1a7f37;
  --green-bg: #dafbe1;
  --gray-50: #f6f8fa;
  --gray-100: #eaeef2;
  --gray-200: #d0d7de;
  --gray-300: #afb8c1;
  --gray-400: #8c959f;
  --gray-500: #6b7280;
  --gray-600: #57606a;
  --gray-800: #24292f;
  --white: #ffffff;
  --md-on-surface: #181c1f;
  --md-outline-variant: #c3c6d6;
  --md-surface-container: #ebeef1;
}

/* ─── Autocomplete dropdown ─── */
.ac-dropdown {
  position: fixed;
  z-index: 10000;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #d0d7de);
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  min-width: 180px;
  max-height: 260px;
  overflow-y: auto;
  display: none;
}
.ac-item {
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ac-item:hover,
.ac-item.active {
  background: var(--blue-light, #e8f0fc);
  color: var(--blue, #0057b8);
}
html[data-theme="dark"] .ac-dropdown {
  background: #1e2327;
  border-color: #30363d;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
}
html[data-theme="dark"] .ac-item:hover,
html[data-theme="dark"] .ac-item.active {
  background: #1c3a5e;
  color: #79b8ff;
}

/* ═══════════════════════════════════════════
   AI Chat Panel
   ═══════════════════════════════════════════ */
.ai-chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  z-index: 800;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-left: 1px solid var(--gray-200);
  box-shadow: -4px 0 24px rgba(0,0,0,.18);
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.4,0,.2,1);
}
.ai-chat-panel.ai-chat-open {
  transform: translateX(0);
}

/* Header */
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  background: var(--gray-50);
}
.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
}
.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.ai-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  color: var(--gray-400);
  transition: background .12s, color .12s;
}
.ai-icon-btn:hover { background: var(--gray-100); color: var(--gray-800); }

/* Messages */
.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--gray-300) transparent;
}
.ai-msg { display: flex; }
.ai-msg--user  { justify-content: flex-end; }
.ai-msg--assistant,
.ai-msg--system { justify-content: flex-start; }

.ai-msg-body {
  max-width: 90%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}
.ai-msg--user .ai-msg-body {
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.ai-msg--assistant .ai-msg-body {
  background: var(--gray-100);
  color: var(--gray-800);
  border-bottom-left-radius: 3px;
}
.ai-msg--system .ai-msg-body {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 12px;
  border-radius: 8px;
  max-width: 100%;
}
.ai-msg-body strong { color: inherit; font-weight: 700; }
.ai-msg-body em     { font-style: italic; }
.ai-msg-body code   { background: var(--gray-200); padding: 1px 5px; border-radius: 4px; font-family: monospace; font-size: 12px; }
.ai-msg-body ul     { margin: 6px 0 6px 16px; padding: 0; }
.ai-msg-body li     { margin-bottom: 3px; }
.ai-msg-body p      { margin: 4px 0; }
.ai-msg-body p:first-child { margin-top: 0; }
.ai-msg-body p:last-child  { margin-bottom: 0; }
.ai-code {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: monospace;
  font-size: 12px;
  white-space: pre-wrap;
  margin: 6px 0;
  color: var(--orange);
}
.ai-thinking { color: var(--gray-400); animation: ai-blink 1s steps(1) infinite; }
@keyframes ai-blink { 0%,100%{opacity:1} 50%{opacity:0} }
.ai-error { color: var(--red); font-size: 12px; }

/* Footer / input */
.ai-chat-footer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
  background: var(--gray-50);
}
.ai-chat-input {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  color: var(--gray-800);
  font-size: 13px;
  padding: 8px 11px;
  resize: none;
  outline: none;
  line-height: 1.5;
  font-family: inherit;
  max-height: 120px;
  overflow-y: auto;
}
.ai-chat-input:focus { border-color: var(--blue); }
.ai-chat-input::placeholder { color: var(--gray-400); }
.ai-chat-input:disabled { opacity: .4; }
.ai-send-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

/* Toolbar AI button glow when panel open */
.toolbar-btn-ai.active { color: var(--blue); }

/* Floating AI chat button (FAB) — z-index abaixo do painel (800) */
.ai-chat-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 750;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.ai-chat-fab:hover {
  background: var(--navy);
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.ai-chat-fab:active {
  transform: scale(0.96);
}

/* Config modal */
.ai-config-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-config-modal {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  width: 440px;
  max-width: 95vw;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,.25);
}
.ai-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
}
.ai-config-header h3 { font-size: 15px; font-weight: 700; color: var(--gray-800); margin: 0; }
.ai-config-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.ai-config-body .form-row label { color: var(--gray-600); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.ai-config-body .form-row input,
.ai-config-body .form-row select {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  color: var(--gray-800);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  width: 100%;
  box-sizing: border-box;
}
.ai-config-body .form-row input:focus,
.ai-config-body .form-row select:focus { outline: none; border-color: var(--blue); }
.ai-config-body .hint { color: var(--gray-600); font-size: 11px; margin-top: 4px; }
.ai-config-body .hint a { color: var(--blue); text-decoration: none; }
.ai-config-body .hint a:hover { text-decoration: underline; }
.ai-config-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
}

/* ── Catalog pages (Templates + Autocompletar) ─────────────────────── */

.page-intro {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.6;
  margin: 0 0 20px;
  max-width: 720px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (max-width: 700px) { .catalog-grid { grid-template-columns: 1fr; } }
.catalog-grid .tpl-card:nth-child(1),
.catalog-grid .sug-card:nth-child(1)  { animation-delay: 0ms; }
.catalog-grid .tpl-card:nth-child(2),
.catalog-grid .sug-card:nth-child(2)  { animation-delay: 40ms; }
.catalog-grid .tpl-card:nth-child(3),
.catalog-grid .sug-card:nth-child(3)  { animation-delay: 80ms; }
.catalog-grid .tpl-card:nth-child(4),
.catalog-grid .sug-card:nth-child(4)  { animation-delay: 120ms; }
.catalog-grid .tpl-card:nth-child(5),
.catalog-grid .sug-card:nth-child(5)  { animation-delay: 160ms; }
.catalog-grid .tpl-card:nth-child(6),
.catalog-grid .sug-card:nth-child(6)  { animation-delay: 190ms; }
.catalog-grid .tpl-card:nth-child(n+7),
.catalog-grid .sug-card:nth-child(n+7) { animation-delay: 220ms; }
.catalog-grid .catalog-card:nth-child(1)  { animation-delay: 0ms; }
.catalog-grid .catalog-card:nth-child(2)  { animation-delay: 40ms; }
.catalog-grid .catalog-card:nth-child(3)  { animation-delay: 80ms; }
.catalog-grid .catalog-card:nth-child(4)  { animation-delay: 120ms; }
.catalog-grid .catalog-card:nth-child(5)  { animation-delay: 160ms; }
.catalog-grid .catalog-card:nth-child(6)  { animation-delay: 190ms; }
.catalog-grid .catalog-card:nth-child(n+7) { animation-delay: 220ms; }

/* ── Catalog cards (Canais, Funcionalidades) ── */
.catalog-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: card-enter 0.32s var(--ef-ease-out, ease) backwards;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.catalog-card:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.catalog-card .titulo {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
  margin: 0;
}
.catalog-card .meta {
  font-size: 12px;
  color: var(--gray-500);
  line-height: 1.4;
}
.catalog-card .actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}
html[data-theme="dark"] .catalog-card {
  border-color: var(--card-border);
  box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
html[data-theme="dark"] .catalog-card:hover {
  background: var(--card-hover-bg);
  border-color: var(--card-border-hover);
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
html[data-theme="dark"] .catalog-card .titulo { color: rgba(230,242,255,.9); }
html[data-theme="dark"] .catalog-card .meta   { color: rgba(175,205,240,.5); }
html[data-theme="dark"] .catalog-card .actions { border-top-color: rgba(255,255,255,.07); }

/* ── Template cards ── */
.tpl-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: card-enter 0.32s var(--ef-ease-out, ease) backwards;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.tpl-card:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.tpl-card-header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px 16px 10px;
}
.tpl-card-icon {
  width: 36px;
  height: 36px;
  background: rgba(59,130,246,.1);
  color: var(--blue);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.tpl-card-title-wrap {
  flex: 1;
  min-width: 0;
}
.tpl-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}
.tpl-card-desc {
  font-size: 11.5px;
  color: var(--gray-500);
  margin-top: 2px;
  line-height: 1.4;
}
.tpl-count-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(59,130,246,.1);
  color: var(--blue);
  white-space: nowrap;
  flex-shrink: 0;
}
.tpl-preview-list {
  list-style: none;
  margin: 0;
  padding: 0 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.tpl-preview-item {
  font-size: 12px;
  color: var(--gray-600);
  line-height: 1.4;
  padding-left: 14px;
  position: relative;
}
.tpl-preview-item::before {
  content: '☐';
  position: absolute;
  left: 0;
  color: var(--gray-400);
  font-size: 11px;
}
.tpl-preview-more {
  font-size: 11px;
  color: var(--gray-400);
  padding-left: 14px;
  font-style: italic;
}
.tpl-empty-hint {
  font-size: 12px;
  color: var(--gray-400);
  padding: 0 16px 10px;
  margin: 0;
  flex: 1;
}
.tpl-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--gray-100);
  margin-top: auto;
}

/* ── Suggestions cards ── */
.sug-card {
  --sug-color: #3b82f6;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
  animation: card-enter 0.32s var(--ef-ease-out, ease) backwards;
}
.sug-card:hover {
  box-shadow: 0 6px 18px rgba(0,0,0,.08);
}
.sug-card-accent {
  height: 4px;
  background: var(--sug-color);
}
.sug-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px 8px;
}
.sug-card-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--sug-color) 12%, transparent);
  color: var(--sug-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sug-card-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  flex: 1;
  min-width: 0;
}
.sug-count-badge {
  font-size: 12px;
  font-weight: 700;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 9999px;
  background: color-mix(in srgb, var(--sug-color) 14%, transparent);
  color: var(--sug-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sug-card-body {
  padding: 4px 16px 12px;
  flex: 1;
  min-height: 36px;
}
.sug-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}
.sug-more {
  font-size: 11px;
  color: var(--gray-400);
  font-style: italic;
}
.sug-empty {
  font-size: 12px;
  color: var(--gray-400);
  font-style: italic;
}
.sug-card-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--gray-100);
}

/* Dark mode — catalog cards (Templates + Autocompletar) */
html[data-theme="dark"] .tpl-card,
html[data-theme="dark"] .sug-card {
  border-color: var(--card-border);
}
html[data-theme="dark"] .tpl-card:hover,
html[data-theme="dark"] .sug-card:hover {
  background: var(--card-hover-bg);
  border-color: var(--card-border-hover);
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
}

/* Titles */
html[data-theme="dark"] .tpl-card-name,
html[data-theme="dark"] .sug-card-label { color: #f1f5f9; }

/* Secondary text */
html[data-theme="dark"] .tpl-card-desc,
html[data-theme="dark"] .page-intro { color: #64748b; }

/* Preview items */
html[data-theme="dark"] .tpl-preview-item { color: #94a3b8; }
html[data-theme="dark"] .tpl-preview-item::before { color: #4b5563; }
html[data-theme="dark"] .tpl-preview-more,
html[data-theme="dark"] .tpl-empty-hint,
html[data-theme="dark"] .sug-empty,
html[data-theme="dark"] .sug-more { color: #4b5563; }

/* Dividers */
html[data-theme="dark"] .tpl-card-actions,
html[data-theme="dark"] .sug-card-footer { border-top-color: rgba(255,255,255,.07); }

/* Icons */
html[data-theme="dark"] .tpl-card-icon { background: rgba(96,165,250,.15); color: #60a5fa; }
html[data-theme="dark"] .sug-card-icon {
  background: color-mix(in srgb, var(--sug-color) 16%, #1e2a3a);
}

/* Badges */
html[data-theme="dark"] .tpl-count-badge {
  background: rgba(96,165,250,.15);
  color: #60a5fa;
}
html[data-theme="dark"] .sug-count-badge {
  background: color-mix(in srgb, var(--sug-color) 18%, #1e2a3a);
  color: color-mix(in srgb, var(--sug-color) 80%, #fff);
}

/* Chips inside sug-card */
html[data-theme="dark"] .sug-chips .tag-chip {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
  color: #94a3b8;
}
