/* Editor do relatório mensal: uma janela por cima da plataforma, com a folha
   do relatório ao centro. A folha é papel - fundo branco e letra preta nos dois
   temas -, porque é o que vai sair no DOCX e no PDF. */

.reportEditor {
  width: min(1040px, 96vw);
  height: min(92vh, 1100px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
  color: var(--ink);
  overflow: hidden;
}

.reportEditor[open] {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.reportEditor::backdrop { background: rgba(10, 16, 26, .55); }

.reportEditorHead {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.reportEditorTitle h2 { margin: 2px 0 0; font-size: var(--txt-lg); }

.reportEditorToolbar {
  padding: 8px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.reportEditorGroup { display: inline-flex; align-items: center; gap: 4px; }

.reportEditorTool {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--txt-md);
  line-height: 1;
}

@media(hover:hover) and (pointer:fine){.reportEditorTool:hover:not(:disabled){ border-color: var(--accent); }}
.reportEditorTool.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.reportEditorTool:disabled,
.reportEditorTool.isOff,
.reportEditorAlign.isOff { opacity: .45; cursor: default; }
.reportEditorTool.isBold { font-weight: 700; }
.reportEditorTool.isItalic { font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.reportEditorTool.isUnderline { text-decoration: underline; }
.reportEditorTool.isText { font-size: var(--txt-sm); }

.reportEditorTool.isSwatch {
  min-width: 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line);
}

.reportEditorColors { display: inline-flex; align-items: center; gap: 6px; }

.reportEditorColorInput {
  width: 30px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel);
}

.reportEditorSize,
.reportEditorAlign {
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: var(--txt-sm);
}

.reportEditorScroll {
  min-height: 0;
  padding: 22px 16px;
  overflow: auto;
  background: color-mix(in srgb, var(--ink) 9%, var(--bg));
}

.reportEditorPage {
  width: min(794px, 100%);
  min-height: 900px;
  margin: 0 auto;
  padding: 64px 72px 72px;
  background: #ffffff;
  color: #000000;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .22);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11pt;
  line-height: 1.5;
}

.reportEditorPage p { margin: 0; }
.reportEditorLoading { color: #555; text-align: center; padding: 60px 0; }
.reportEditorLoading.isError { color: #c00000; }

/* O que é do modelo aprovado lê-se, mas não se edita: fica ligeiramente mais
   apagado do que o texto em que se pode escrever. */
.reportEditorFixed,
.reportEditorSection,
.reportEditorMark,
.reportEditorLabel,
.reportEditorEnd { color: #3d3d3d; user-select: none; }

.reportEditorFixed.isOrgao { text-align: center; font-weight: 700; }
.reportEditorFixed.isTitulo { margin: 18px 0; text-align: center; font-weight: 700; font-size: 12pt; }
.reportEditorFixed.isIdentificacao { margin-bottom: 10px; }
.reportEditorFixed.isData { margin-top: 30px; }
.reportEditorFixed.isAssinatura { margin-top: 14px; text-align: center; }
.reportEditorFixed.isAssinatura .isLinha { margin-top: 34px; }

.reportEditorSection {
  margin: 16px 0 6px;
  display: flex;
  gap: 8px;
  font-size: 11pt;
  font-weight: 700;
}

.reportEditorSectionName { text-decoration: underline; }
.reportEditorMark { flex: none; width: 22px; font-weight: 700; }

.reportEditorItem { display: flex; gap: 8px; text-align: justify; }
.reportEditorItem.isLevel1 { margin-left: 28px; }
.reportEditorItem.isLevel2 { margin-left: 56px; }
.reportEditorItemBody { min-width: 0; flex: 1; }
.reportEditorLabel.isSublinhado { text-decoration: underline; }
.reportEditorLabel.isNegrito { font-weight: 700; }

.reportEditorField {
  color: #000000;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border-radius: 2px;
  outline: 1px dashed transparent;
  outline-offset: 2px;
  background: rgba(36, 111, 229, .06);
  transition: background .12s, outline-color .12s;
}

@media(hover:hover) and (pointer:fine){.reportEditorField:hover{ outline-color: rgba(36, 111, 229, .45); }}
.reportEditorField:focus { outline: 1px solid #246fe5; background: transparent; }

.reportEditorField.isInline { padding: 0 2px; min-width: 2em; display: inline; }

.reportEditorField.isBlock {
  margin-left: 30px;
  padding: 2px 4px;
  min-height: 1.5em;
  text-align: justify;
}

.reportEditorField.isBlock p + p { margin-top: .5em; }

.reportEditorFoot {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.reportEditorStatus {
  margin: 0;
  flex: 1;
  color: var(--muted);
  font-size: var(--txt-sm);
}

.reportEditorStatus.isWarning { color: var(--vermelho); font-weight: 600; }

/* O botão "Editar" nas listas de relatórios emitidos. */
.eopReportEdit,
.reportRowEdit {
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: var(--txt-xs);
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .eopReportEdit:hover,
  .reportRowEdit:hover { border-color: var(--accent); color: var(--accent); }
}

@media (max-width: 720px) {
  .reportEditor { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .reportEditorPage { padding: 28px 18px 36px; }
  .reportEditorItem.isLevel1 { margin-left: 8px; }
  .reportEditorItem.isLevel2 { margin-left: 24px; }
  .reportEditorField.isBlock { margin-left: 0; }
  .reportEditorFoot { flex-wrap: wrap; }
  .reportEditorStatus { flex-basis: 100%; }
}
