.calculation-step { min-width: 0; margin: 0 0 18px; color: #263957; }
.calculation-step h4 { margin: 14px 0 8px; font-size: 13px; line-height: 1.5; }
.calculation-text { margin: 8px 0; padding: 10px; background: #f4f7fb; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.6 ui-monospace, Consolas, monospace; }
.math-equation { overflow-x: auto; padding: 5px 8px; margin: 6px 0; background: #f6f8fc; border-radius: 6px; font-size: 14px; }
.math-equation.result { background: #edf4ff; color: #0845a3; }
.math-equation .katex-display { margin: .6em 0; text-align: left; }
.math-equation .katex-display > .katex { text-align: left; }
.calculation-transcript { margin-top: 10px; }
.calculation-transcript > summary { color: #315784; cursor: pointer; font-size: 12px; padding: 5px 0; }
.calculation-figure { margin: 10px 0; overflow-x: auto; background: #fff; border: 1px solid #dce5f1; border-radius: 6px; }
.calculation-figure img { display: block; width: 100%; min-width: 420px; height: auto; }
.calculation-table { max-width: 100%; overflow-x: auto; margin: 16px 0; }
.calculation-table table { width: 100%; border-collapse: collapse; color: #233450; font-size: 12px; }
.calculation-table caption { text-align: left; font-weight: 700; padding: 0 0 8px; }
.calculation-table th,.calculation-table td { padding: 7px 9px; border: 1px solid #dbe3ee; text-align: right; font-variant-numeric: tabular-nums; }
.calculation-table thead th { background: #eef3fa; }
.calculation-table th:first-child { text-align: left; }
.matrix-table th,.matrix-table td { white-space: nowrap; font-size: 11px; }
.calculation-matrices > p { font-size: 12px; line-height: 1.6; }
.report-dialog { width: min(1000px,96vw); max-width: 96vw; max-height: 94vh; padding: 0; color: #172b47; background: #e9eef5; }
.report-tools { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 12px; padding: 12px 20px; background: #fff; border-bottom: 1px solid #cfd9e7; }
.report-tools strong { margin-right: auto; }
.report-tools button { min-height: 36px; padding: 6px 12px; font-size: 12px; }
.calculation-report { background: #fff; max-width: 850px; margin: 24px auto; padding: 40px; font: 14px/1.6 Inter,"Segoe UI",sans-serif; }
.report-kicker { margin: 0; color: #2458a0; font-size: 11px; letter-spacing: .1em; font-weight: 700; }
.calculation-report h1 { margin: 12px 0; font-size: 27px; line-height: 1.25; overflow-wrap: anywhere; }
.report-meta { font-size: 12px; color: #53627b; }
.calculation-report h2 { border-top: 2px solid #174b92; padding-top: 12px; margin: 32px 0 18px; font-size: 19px; }
.calculation-report h3 { margin-top: 24px; font-size: 16px; }
.calculation-report .calculation-step h4 { font-size: 14px; }
.report-drawing { margin: 20px 0; }
.report-structure { display: block; width: 100%; height: auto; max-height: 460px; }
.report-drawing figcaption { color: #53627b; font-size: 11px; }
.calculation-report .chart-card { margin: 12px 0; }
.calculation-report .chart-card svg { display: block; width: 100%; }
.calculation-report .chart-card text { font: 11px Inter,"Segoe UI",sans-serif; }
.calculation-report .calculation-figure img { min-width: 0; }
body.structcalc-dark .solution-panel .calculation-step { color: #dbe6f7; }
body.structcalc-dark .solution-panel .math-equation,body.structcalc-dark .solution-panel .calculation-text { background: #20314c; color: #e5edfb; }
body.structcalc-dark .solution-panel .calculation-transcript > summary { color: #9ec5ff; }
body.structcalc-dark .calculation-report .chart-card { background: #fff; }
body.structcalc-dark .calculation-report .chart-card h3 { color: #172b47; }
@media (max-width: 590px) {
  .calculation-report { padding: 18px; margin: 8px; }
  .report-tools { padding: 10px; gap: 8px; flex-wrap: wrap; }
  .report-tools strong { width: 100%; }
}
@page { size: A4; margin: 15mm 12mm; }
@media print {
  html,body[data-page="editor"] { height: auto!important; min-width: 0; overflow: visible!important; background: #fff!important; }
  body[data-page="editor"] > :not(.report-dialog) { display: none!important; }
  .report-dialog { display: block!important; position: static!important; width: 100%!important; max-width: none!important; height: auto!important; max-height: none!important; overflow: visible!important; margin: 0!important; border: 0; box-shadow: none; background: #fff; }
  .report-dialog::backdrop,.report-tools { display: none!important; }
  .calculation-report { width: auto; max-width: none; margin: 0; padding: 0; font-size: 10pt; }
  .calculation-report h1 { font-size: 21pt; }
  .calculation-report h2 { font-size: 15pt; break-before: page; }
  .calculation-report h2:first-of-type { break-before: auto; }
  .calculation-report h2,.calculation-report h3,.calculation-report h4,caption { break-after: avoid; }
  .calculation-report .calculation-text { font-size: 8pt; }
  .calculation-report .calculation-table { overflow: visible; }
  .calculation-report table { width: 100%; font-size: 8pt; }
  .calculation-report th,.calculation-report td { padding: 3px; overflow-wrap: anywhere; }
  .calculation-report .matrix-table table { table-layout: fixed; }
  .calculation-report .matrix-table th,.calculation-report .matrix-table td { white-space: normal; font-size: clamp(5pt,calc(95pt / var(--matrix-columns)),9pt); }
  .calculation-report thead { display: table-header-group; }
  .calculation-report tr,.calculation-report figure,.calculation-report .chart-card,.calculation-report .math-equation { break-inside: avoid; }
  .calculation-report .math-equation { overflow: visible; font-size: 10pt; }
  .calculation-report .katex-display > .katex { white-space: normal; }
  .calculation-report .calculation-transcript > summary { display: none; }
  .calculation-report .calculation-figure { overflow: visible; }
  .calculation-report .report-structure { max-height: 95mm; }
  .calculation-report * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Relatório: a primeira página responde antes de detalhar. */
.report-summary h2 { border-top: 0; padding-top: 0; }
.report-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 18px; margin: 0 0 18px; }
.report-facts div { padding: 10px 12px; border: 1px solid #dfe6f0; border-radius: 8px; background: #f8fafd; }
.report-facts dt { margin: 0 0 2px; color: #53627b; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.report-facts dd { margin: 0; color: #10203c; font-weight: 600; overflow-wrap: anywhere; }
.report-answer { padding: 12px 16px; border-left: 3px solid #174b92; background: #f5f8fd; }
.report-answer h3 { margin: 0 0 6px; font-size: 14px; }
.report-answer-line { margin: 4px 0; }
.report-range { margin: 14px 0 2px; color: #53627b; font-size: 12px; font-weight: 600; }
.calculation-report .effort-line { margin: 2px 0; overflow-x: auto; }
@media print {
  .report-facts { grid-template-columns: repeat(2, 1fr); }
  .report-facts div, .report-answer { break-inside: avoid; }
}

@media (max-width: 560px) {
  .report-facts { grid-template-columns: 1fr 1fr; gap: 8px; }
  .report-facts div { padding: 8px 10px; }
  .report-facts div:first-child { grid-column: 1 / -1; }
  .report-facts dd { font-size: 13px; }
}
