/* ---------- App (monocromático minimalista) ---------- */
:root {
  --ink: #111;
  --muted: #6b6b6b;
  --line: #e4e4e4;
  --bg: #fafafa;
  --accent: #f3652b; /* laranja Azion, uso pontual */
  --good: #1d7a4f;
  --bad: #b3261e;
  --warn-bg: #fff7ed;
  --warn-line: #f0c9a8;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.app-chrome { max-width: 880px; margin: 0 auto; padding: 40px 24px 16px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.brand-row { display: flex; align-items: center; gap: 18px; }
.brand-row .azion-logo { width: 108px; height: auto; flex-shrink: 0; }
.topbar h1 { font-size: 22px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.02em; }
.ai-note {
  display: flex; align-items: center; gap: 8px; margin: 0 0 18px;
  font-size: 13px; color: var(--muted);
}
.ai-dot { width: 8px; height: 8px; border-radius: 50%; background: #c9c9c9; flex-shrink: 0; }
.ai-dot.on { background: var(--accent); }
.ai-dot.off { background: #c9c9c9; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }
.small { font-size: 13px; }
.badge {
  font-size: 12px; padding: 4px 10px; border: 1px solid var(--accent);
  border-radius: 999px; background: #fff; color: var(--accent); white-space: nowrap;
}
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input[type="text"] {
  font: inherit; color: var(--ink); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }
.dropzone {
  border: 1px dashed #c9c9c9; border-radius: 10px; padding: 24px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; text-align: center; background: #fff; transition: border-color .15s;
}
.dropzone:hover, .dropzone.dragover { border-color: var(--accent); }
.dropzone.loaded { border-style: solid; border-color: var(--accent); }
.dropzone strong { font-size: 14px; }
.file-status { font-size: 12px; color: var(--muted); min-height: 16px; margin-top: 4px; }
.dropzone.loaded .file-status { color: var(--ink); }
.actions { display: flex; align-items: center; gap: 16px; margin-top: 24px; }
button {
  font: inherit; font-weight: 600; padding: 10px 22px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer;
}
button:hover:not(:disabled) { background: #d9551f; border-color: #d9551f; }
button:disabled { opacity: .35; cursor: not-allowed; }
button.secondary { background: #fff; color: var(--accent); }
button.secondary:hover:not(:disabled) { background: #fff4ef; }
.error { color: var(--bad); font-size: 13px; margin: 12px 0 0; }
.warn {
  font-size: 13px; margin: 14px 0 0; padding: 10px 14px; border-radius: 8px;
  background: var(--warn-bg); border: 1px solid var(--warn-line); color: #7a3c00;
}
a { color: inherit; }
#print-hint { margin-top: 10px; }

/* Auditoria das travas de conteúdo — só na tela, nunca no PDF. */
.guard-note {
  font-size: 13px; margin: 14px 0 0; padding: 12px 14px; border-radius: 8px;
  background: #fafafa; border: 1px solid var(--line); border-left: 3px solid var(--accent);
}
.guard-note p { margin: 0; font-weight: 600; }
.guard-note ul { margin: 10px 0 0; padding-left: 18px; }
.guard-note li { margin-bottom: 8px; }
.guard-note code {
  font-size: 12px; background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 1px 5px;
}

/* ---------- Relatório (identidade do template Azion) ---------- */
#report {
  width: 21cm; max-width: 100%; margin: 44px auto 80px;
  font-size: 14px; line-height: 1.7; counter-reset: sheet;
}
/* Cada .sheet é uma página A4: visível na tela, uma página no PDF. Editável. */
.sheet {
  background: #fff; border: 1px solid var(--line);
  width: 21cm; max-width: 100%; min-height: 29.7cm;
  padding: 1.7cm 1.5cm; margin: 0 auto 40px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .05);
  position: relative; counter-increment: sheet;
}
.sheet::before {
  content: 'Página ' counter(sheet) ' · editável';
  position: absolute; top: -24px; left: 2px;
  font-size: 11px; color: var(--muted);
}
.sheet[contenteditable]:hover { border-color: #d8d8d8; }
.sheet.overflowing { border-color: var(--bad); }
.sheet.overflowing::before {
  content: 'Página ' counter(sheet) ' · conteúdo excede a altura da página';
  color: var(--bad);
}
.sheet[contenteditable]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }
#report .azion-logo { width: 150px; height: auto; display: block; }
#report .cover { min-height: 26cm; display: flex; flex-direction: column; }
#report .cover .brand { padding-top: 8px; }
#report .cover-title { margin-top: 34%; }
#report .cover h2 { font-size: 21px; font-weight: 400; color: #5f5f5f; margin: 0 0 4px; }
#report .cover h1 { font-size: 46px; font-weight: 700; margin: 0 0 22px; letter-spacing: -0.02em; }
#report .cover .date { color: #5f5f5f; font-weight: 700; font-size: 14px; }
#report section { margin-top: 48px; }
.sheet > section:first-child, .sheet > .cover { margin-top: 0; }
#report h3 { font-size: 21px; font-weight: 700; margin: 0 0 16px; }
#report h4 { font-size: 15px; font-weight: 700; margin: 24px 0 10px; }
#report a { color: var(--accent); }
#report p { margin: 10px 0; text-align: justify; }
#report ul { padding-left: 20px; margin: 10px 0; }
#report li { margin-bottom: 9px; text-align: justify; }
#report blockquote {
  margin: 20px 0; padding: 14px 18px; border-left: 3px solid var(--accent);
  background: #fafafa; font-style: italic;
}
#report table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; line-height: 1.55; }
#report th, #report td { border: 1px solid #cfcfcf; padding: 11px 12px; text-align: left; vertical-align: top; }
#report th { background: #fff; font-weight: 700; }
#report td.num { white-space: nowrap; }
#report .footnote { margin-top: 4px; text-align: left; }
#report .toc-list { list-style: none; padding: 0; }
#report .toc-list li { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--line); padding: 7px 0; }

.v-melhora { color: var(--good); font-weight: 600; }
.v-piora { color: var(--bad); font-weight: 600; }
.v-estavel { color: var(--muted); }

.print-footer { display: none; }

/* ---------- Impressão (A4) ---------- */
@page { size: A4; margin: 16mm 15mm 20mm; }
@media print {
  body { background: #fff; font-size: 12.5px; }
  .app-chrome { display: none; }
  #report {
    display: block !important; width: auto; max-width: none;
    margin: 0; padding: 0; font-size: 12.5px;
  }
  .sheet {
    border: none; box-shadow: none; width: auto; max-width: none;
    min-height: 0; margin: 0; padding: 0;
    page-break-after: always;
  }
  .sheet:last-child { page-break-after: auto; }
  .sheet::before, .sheet.overflowing::before { content: none; }
  .sheet.overflowing { border: none; }
  .sheet[contenteditable]:focus { outline: none; }
  #report .cover { min-height: 84vh; justify-content: flex-start; }
  #report section { margin-top: 24px; }
  #report h3 { font-size: 17px; }
  #report table, #report blockquote { page-break-inside: avoid; }
  #report tr { page-break-inside: avoid; }
  #report table { font-size: 10.5px; }
  #report th, #report td { padding: 7px 8px; }
  .print-footer {
    display: block; position: fixed; bottom: 0; left: 0; right: 0;
    border-top: 2px solid var(--accent); padding: 4px 0 0;
    font-size: 9.5px; color: var(--muted); text-align: left; background: #fff;
  }
  .print-footer a { color: var(--accent); text-decoration: underline; }
  #report .cover .brand { padding-top: 24px; }
  #report .cover-title { margin-top: 36%; }
}
