/* Estilos de barra de rolagem limpa */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Estilos exatos do documento Devos dentro do Editor RichText e do Preview */
.devos-doc-surface {
  font-family: Arial, Helvetica, sans-serif;
  color: #1e293b;
  font-size: 12px;
  line-height: 1.45;
}
.devos-doc-surface h1 {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin: 16px 0 8px;
}
.devos-doc-surface h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 18px 0 6px;
  color: #0f172a;
  border-bottom: 2px solid #dd0b56;
  padding-bottom: 3px;
}
.devos-doc-surface h3 {
  font-size: 12.5px;
  font-weight: 700;
  margin: 12px 0 4px;
  color: #1e293b;
}
.devos-doc-surface p {
  margin: 0 0 8px;
  line-height: 1.45;
}
.devos-doc-surface table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 12px;
}
.devos-doc-surface th,
.devos-doc-surface td {
  border: 1px solid #e2e8f0;
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}
.devos-doc-surface th {
  background: #f8fafc;
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
}
.devos-doc-surface td.num,
.devos-doc-surface th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.devos-doc-surface .cabecalho {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-top: 3px solid #111827;
  border-bottom: 2px solid #111827;
  padding: 12px 0 10px;
  margin-bottom: 14px;
}
.devos-doc-surface .marca {
  display: flex;
  align-items: center;
  gap: 12px;
}
.devos-doc-surface .marca svg {
  display: block;
  flex: 0 0 auto;
}
.devos-doc-surface .empresa {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}
.devos-doc-surface .empresa-detalhe {
  margin: 1px 0 0;
  font-size: 10px;
  line-height: 1.35;
  color: #64748b;
}
.devos-doc-surface .titulo {
  text-align: right;
}
.devos-doc-surface .titulo h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.05;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.3px;
}
.devos-doc-surface .titulo p {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
}
#previewHeaderTitle[contenteditable="true"],
#previewHeaderSubtitle[contenteditable="true"] {
  border-radius: 4px;
  padding: 2px 4px;
  margin-right: -4px;
  transition:
    background-color 0.15s ease,
    box-shadow 0.15s ease;
  cursor: text;
}
#previewHeaderTitle[contenteditable="true"]:hover,
#previewHeaderSubtitle[contenteditable="true"]:hover {
  background-color: #fff1f5;
  box-shadow: 0 0 0 1px #fecdd3;
}
#previewHeaderTitle[contenteditable="true"]:focus,
#previewHeaderSubtitle[contenteditable="true"]:focus {
  outline: none;
  background-color: #fff1f5;
  box-shadow: 0 0 0 2px #dd0b56;
}
.devos-doc-surface .destaque {
  background: #fff1f5;
  border: 1px solid #fecdd3;
  border-left: 4px solid #dd0b56;
  padding: 10px 12px;
  margin: 10px 0 14px;
}
.devos-doc-surface .destaque strong {
  font-size: 16px;
  color: #9f1239;
}
.devos-doc-surface .clausula {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 10px 12px;
  margin: 8px 0 12px;
}
.devos-doc-surface .clausula p {
  margin: 0;
}
.devos-doc-surface ol {
  margin: 6px 0 10px;
  padding-left: 18px;
  list-style-type: decimal;
}
.devos-doc-surface ul {
  margin: 6px 0 10px;
  padding-left: 18px;
  list-style-type: disc;
}
.devos-doc-surface li {
  margin-bottom: 4px;
}
.devos-doc-surface blockquote {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #64748b;
  padding: 8px 12px;
  margin: 8px 0 12px;
}
.devos-doc-surface hr {
  border: 0;
  border-top: 1px solid #e2e8f0;
  margin: 14px 0;
}
.devos-doc-surface .rodape-doc {
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px solid #cbd5e1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: #64748b;
}

/* Foco visual no RichText */
#richtextEditor:focus {
  outline: none;
}
#richtextEditor td:focus,
#richtextEditor th:focus {
  outline: 2px solid #dd0b56;
}

/* Pilha de folhas A4 no preview — cada página com fundo próprio */
.a4-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  width: 100%;
  transform-origin: top center;
  transition: transform 0.2s ease;
}
.a4-sheet {
  width: 794px;
  max-width: 100%;
  height: 1123px;
  background: #ffffff;
  box-shadow:
    0 10px 30px -5px rgba(15, 23, 42, 0.22),
    0 4px 10px -2px rgba(15, 23, 42, 0.1);
  padding: 42px 48px;
  margin: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  flex-shrink: 0;
  overflow: hidden;
}
.a4-sheet .sheet-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flow-root;
}
.a4-sheet .rodape-doc {
  margin-top: auto;
}
.a4-sheet-tall {
  height: auto !important;
  min-height: var(--a4-h, 1123px);
  overflow: visible;
}
.a4-sheet-tall .sheet-body {
  overflow: visible;
}

/* Botões da toolbar */
.tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #334155;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  transition: all 0.15s ease;
  cursor: pointer;
  user-select: none;
}
.tb-btn:hover {
  background: #f8fafc;
  color: #0f172a;
  border-color: #cbd5e1;
}
.tb-btn:active {
  transform: translateY(1px);
}
.tb-btn-devos {
  background: #fff1f5;
  color: #9f1239;
  border-color: #fecdd3;
  font-weight: 600;
}
.tb-btn-devos:hover {
  background: #ffe4e6;
  color: #881337;
  border-color: #fda4af;
}
