/*! StiffStruct, (c) 2026 Mohammad Asad. All rights reserved. Proprietary: copying, mirroring or reusing this code is not permitted without written permission (see terms.html#intellectual-property). build 20261018-2109 */
/* report.css — calculation report page (js/ui/report-view.js) and its print / standalone-HTML styling.
   Uses the design tokens of app.css (works in light and dark theme); the print block forces a light palette. */

.rv-root {
  --rv-serif: "Source Serif 4", "Charter", "Georgia", "Cambria", "Times New Roman", serif;
  min-height: 100%;
  color: var(--fg);
  background: var(--bg);
  font-family: var(--font-ui);
}

/* ---- toolbar ------------------------------------------------------------------------------- */
.rv-toolbar {
  position: sticky; top: 0; z-index: 8;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 8px 18px;
  background: var(--bg-elev); border-bottom: 1px solid var(--border);
}
.rv-field { display: inline-flex; align-items: center; gap: 6px; }
.rv-field-l { font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.rv-toolbar .select { height: 30px; max-width: 250px; }
.rv-toolbar .rv-dec { width: 62px; }
.rv-spacer { flex: 1 1 auto; }
.rv-toolbar .btn[disabled] { opacity: 0.5; pointer-events: none; }
.rv-toolbar .btn .icon { flex: none; }

/* ---- layout -------------------------------------------------------------------------------- */
.rv-layout {
  display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 26px;
  max-width: 1260px; margin: 0 auto; padding: 20px 20px 72px;
}
.rv-main { min-width: 0; }
.rv-status { min-height: 0; font-size: 13px; color: var(--fg-muted); }
.rv-status.is-busy { padding: 10px 2px; }

.rv-toc {
  position: sticky; top: 62px; align-self: start;
  max-height: calc(100vh - 150px); overflow: auto; padding-right: 6px;
  font-size: 12.5px;
}
.rv-toc-title { margin: 4px 0 8px 8px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg-subtle); }
.rv-toc-list { list-style: none; margin: 0; padding: 0; }
.rv-toc a {
  display: block; padding: 4px 8px; border-left: 2px solid transparent; border-radius: 0 6px 6px 0;
  color: var(--fg-muted); text-decoration: none; line-height: 1.35;
}
.rv-toc a:hover { color: var(--fg); background: var(--bg-hover); }
.rv-toc a.is-active { color: var(--accent-text); border-left-color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.rv-toc .rv-toc-l2 { padding-left: 20px; font-size: 12px; }

@media (max-width: 960px) {
  .rv-layout { grid-template-columns: minmax(0, 1fr); padding: 12px 10px 56px; }
  .rv-toc { display: none; }
  .rv-toolbar { padding: 8px 10px; }
}

/* ---- the document -------------------------------------------------------------------------- */
.rv-doc {
  max-width: 940px; margin: 0 auto; padding: 40px 50px 48px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-1);
  font-family: var(--rv-serif); font-size: 15px; line-height: 1.62; color: var(--fg);
}
@media (max-width: 700px) { .rv-doc { padding: 22px 16px 30px; font-size: 14.5px; } }
.rv-doc p { margin: 0.55em 0; }
.rv-doc code { font-family: var(--font-mono); font-size: 0.86em; padding: 1px 4px; border-radius: 4px; background: var(--bg-sunken); }
.rv-doc strong { font-weight: 650; }
.rv-doc .muted { color: var(--fg-muted); }
.rv-doc a { color: var(--accent-text); }
.rv-list { margin: 0.5em 0 0.8em; padding-left: 1.3em; }
.rv-list li { margin: 0.25em 0; }

.rv-cover { margin: 0 0 26px; padding-bottom: 20px; border-bottom: 2px solid var(--fg); }
.rv-kicker { font-family: var(--font-ui); font-size: 11.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-text); }
.rv-title { margin: 6px 0 4px; font-family: var(--rv-serif); font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.rv-subtitle { margin: 0; font-size: 16px; color: var(--fg-muted); }
.rv-meta { margin: 8px 0 0; font-family: var(--font-ui); font-size: 12.5px; color: var(--fg-subtle); }

.rv-h { font-family: var(--font-ui); line-height: 1.25; scroll-margin-top: 76px; }
.rv-doc h2.rv-h1 { margin: 40px 0 10px; padding-bottom: 6px; font-size: 21px; font-weight: 700; border-bottom: 1px solid var(--border-strong); }
.rv-doc h3.rv-h2 { margin: 26px 0 6px; font-size: 16.5px; font-weight: 650; }
.rv-doc h4.rv-h3 { margin: 20px 0 4px; font-size: 13.5px; font-weight: 650; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rv-num { display: inline-block; min-width: 1.7em; margin-right: 0.2em; color: var(--accent-text); font-variant-numeric: tabular-nums; }

/* collapsible member sections */
.rv-details { margin: 10px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elev); scroll-margin-top: 76px; }
.rv-details > summary {
  display: flex; align-items: baseline; gap: 6px; padding: 9px 14px; cursor: pointer; list-style: none;
  font-family: var(--font-ui); font-size: 15px; font-weight: 650; background: var(--bg-sunken); border-radius: var(--radius-sm);
}
.rv-details > summary::-webkit-details-marker { display: none; }
.rv-details > summary::before { content: "▸"; color: var(--fg-muted); font-size: 12px; transition: transform 0.12s; }
.rv-details[open] > summary::before { transform: rotate(90deg); }
.rv-details[open] > summary { border-bottom: 1px solid var(--border); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.rv-details > :not(summary) { margin-left: 14px; margin-right: 14px; }
.rv-details > :last-child { margin-bottom: 14px; }

/* ---- tables -------------------------------------------------------------------------------- */
.rv-tablewrap { margin: 14px 0 18px; overflow-x: auto; }
.rv-doc .rv-table {
  width: 100%; border-collapse: collapse; font-family: var(--font-ui); font-size: 12.5px; line-height: 1.4; font-variant-numeric: tabular-nums;
}
.rv-doc .rv-table caption { caption-side: top; padding: 0 0 6px; text-align: left; font-size: 12.5px; color: var(--fg-muted); }
.rv-doc .rv-table th, .rv-doc .rv-table td { padding: 5px 9px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: baseline; }
.rv-doc .rv-table thead th { position: static; background: var(--bg-sunken); color: var(--fg-muted); font-weight: 650; border-top: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); }
.rv-doc .rv-table tbody tr:last-child td { border-bottom: 1px solid var(--border-strong); }
.rv-doc .rv-table tbody tr:hover { background: var(--bg-hover); }
.rv-doc .rv-table .num { text-align: right; white-space: nowrap; }
.rv-doc .rv-table .ctr { text-align: center; }
.rv-doc .rv-table .math { font-size: 0.95em; }
.rv-kv td:first-child { width: 190px; color: var(--fg-muted); font-weight: 600; }
.rv-okc { color: var(--success); font-weight: 700; }
.rv-badc { color: var(--danger); font-weight: 700; }

/* ---- matrices ------------------------------------------------------------------------------ */
.rv-mat { margin: 14px 0 20px; }
.rv-mat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; font-family: var(--font-ui); font-size: 12.5px; color: var(--fg-muted); }
.rv-mat-cap { min-width: 0; }
.rv-mat-head .btn { flex: none; height: 24px; padding: 0 8px; font-size: 12px; }
.rv-mat-scroll { overflow-x: auto; padding: 4px 6px 8px; }
.rv-matrix { border-collapse: separate; border-spacing: 0; margin: 0 auto 0 0; font-family: var(--font-mono); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--fg); }
.rv-matrix th, .rv-matrix td { padding: 3px 9px; text-align: right; white-space: nowrap; position: relative; line-height: 1.35; }
.rv-matrix thead th { font-weight: 600; color: var(--fg-muted); text-align: right; vertical-align: bottom; border-bottom: 1px solid var(--border); }
.rv-matrix th .lm { display: block; }
.rv-matrix th .ls { display: block; font-size: 9.5px; font-weight: 500; color: var(--fg-subtle); }
.rv-matrix th.rl { padding-right: 12px; border-right: 1px solid var(--border); text-align: right; color: var(--fg-muted); font-weight: 600; }
.rv-matrix th.rl .lm, .rv-matrix th.rl .ls { display: inline; }
.rv-matrix th.rl .ls { margin-left: 4px; }
.rv-matrix td.z { color: var(--fg-subtle); }
.rv-matrix td.mf { border-left: 2px solid var(--fg); }
.rv-matrix td.ml { border-right: 2px solid var(--fg); }
.rv-matrix tbody tr:first-child td.mf::before, .rv-matrix tbody tr:first-child td.ml::before,
.rv-matrix tbody tr:last-child td.mf::after, .rv-matrix tbody tr:last-child td.ml::after { content: ""; position: absolute; width: 6px; height: 0; border-top: 2px solid var(--fg); }
.rv-matrix tbody tr:first-child td.mf::before { top: 0; left: -2px; }
.rv-matrix tbody tr:first-child td.ml::before { top: 0; right: -2px; }
.rv-matrix tbody tr:last-child td.mf::after { bottom: 0; left: -2px; }
.rv-matrix tbody tr:last-child td.ml::after { bottom: 0; right: -2px; }
.rv-matrix td.pc, .rv-matrix th.pc { border-left: 1.5px dashed var(--accent); }
.rv-matrix tr.pr td, .rv-matrix tr.pr th { border-top: 1.5px dashed var(--accent); }
.rv-matrix.wide { font-size: 11px; }
.rv-matrix.wide th, .rv-matrix.wide td { padding: 2px 6px; }
.rv-matrix.xwide { font-size: 10px; }
.rv-matrix.xwide th, .rv-matrix.xwide td { padding: 2px 4px; }

/* ---- callouts, equations, figures ---------------------------------------------------------- */
.rv-callout {
  display: flex; gap: 11px; align-items: flex-start; margin: 14px 0; padding: 10px 14px;
  font-family: var(--font-ui); font-size: 13.5px; line-height: 1.5;
  background: var(--bg-sunken); border: 1px solid var(--border); border-left: 4px solid var(--fg-subtle); border-radius: var(--radius-sm);
}
.rv-callout > div { min-width: 0; flex: 1 1 auto; }
.rv-callout .math.display { margin-top: 4px; text-align: left; }
.rv-callout-ic {
  flex: none; display: grid; place-items: center; width: 20px; height: 20px; margin-top: 1px; border-radius: 50%;
  font-size: 12px; font-weight: 700; line-height: 1; color: var(--bg-elev); background: var(--fg-subtle);
}
.rv-ok { border-left-color: var(--success); background: var(--success-soft); }
.rv-ok .rv-callout-ic { background: var(--success); }
.rv-bad { border-left-color: var(--danger); background: var(--danger-soft); }
.rv-bad .rv-callout-ic { background: var(--danger); }
.rv-warn { border-left-color: var(--warning); background: var(--warning-soft); }
.rv-warn .rv-callout-ic { background: var(--warning); }
.rv-formula { border-left-color: var(--accent); background: var(--accent-soft); }
.rv-formula .rv-callout-ic { background: var(--accent); font-style: italic; font-family: var(--rv-serif); }
.rv-note { border-left-color: var(--info); background: var(--info-soft); }
.rv-note .rv-callout-ic { background: var(--info); font-family: var(--rv-serif); font-style: italic; }

.math { font-size: 1.04em; }
.math[data-tex]:not([data-rendered]) { font-family: var(--font-mono); font-size: 0.82em; color: var(--fg-muted); }
.math.display { display: block; margin: 12px 0; padding: 4px 0; overflow-x: auto; overflow-y: hidden; text-align: center; }
.math.display[data-rendered] { font-size: 1.02em; }
.math.display .katex-display { margin: 0; }
.math.display.wide { text-align: left; }
.math.display.wide .katex-display { text-align: left; }
.math.display.wide .katex-display > .katex { text-align: left; }

.rv-eqlines {
  margin: 6px 0 14px; padding: 8px 12px; overflow-x: auto; white-space: pre;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6; background: var(--bg-sunken); border-radius: var(--radius-sm);
}

.rv-figure { margin: 18px 0 22px; text-align: center; }
.rv-fig-img { display: inline-block; max-width: 100%; overflow-x: auto; padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elev); }
.rv-fig-img svg, .rv-fig-img img { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.rv-figure figcaption { margin-top: 6px; font-family: var(--font-ui); font-size: 12.5px; color: var(--fg-muted); }

/* ---- empty / error state -------------------------------------------------------------------- */
.rv-empty { max-width: 560px; margin: 64px auto; padding: 26px 28px; text-align: center; background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); }
.rv-empty h2 { margin: 0 0 8px; font-size: 19px; }
.rv-empty p { margin: 0 0 14px; color: var(--fg-muted); white-space: pre-line; text-align: left; }
.rv-empty.rv-warn h2 { color: var(--warning); }
.rv-empty.rv-error h2 { color: var(--danger); }
.rv-empty-actions { display: flex; gap: 8px; justify-content: center; }

/* ---- standalone HTML export ----------------------------------------------------------------- */
.rv-standalone .rv-layout { padding-top: 28px; }

/* ---- print / save as PDF -------------------------------------------------------------------- */
@media print {
  @page { size: A4; margin: 16mm 14mm; }
  html, body { height: auto !important; overflow: visible !important; background: #fff !important; color: #111 !important; }
  .sh-app { display: block !important; height: auto !important; }
  .sh-header, .sh-modebar, .sh-body, .sh-status, .sh-splash, #page-code, .skip-link, .dlg-overlay, .dlg-toasts, .dlg-menu, .dlg-popover { display: none !important; }
  #page-report, .sh-page-report { display: block !important; overflow: visible !important; background: #fff !important; height: auto !important; }

  .rv-root {
    --bg: #fff; --bg-elev: #fff; --bg-sunken: #f1f3f6; --bg-hover: transparent; --fg: #111827; --fg-muted: #4b5563; --fg-subtle: #6b7280;
    --border: #d9dde4; --border-strong: #aab1bd; --accent: #4f46e5; --accent-soft: #eef0ff; --accent-text: #3730a3;
    --danger: #b91c1c; --danger-soft: #fdecec; --warning: #b45309; --warning-soft: #fdf3e1; --success: #15803d; --success-soft: #e7f6ec;
    --info: #0369a1; --info-soft: #e6f3fb; --shadow-1: none;
    --member: #334155; --node: #0f172a; --grid: #e3e6ec; --load: #dc2626; --support: #475569; --reaction: #0d9488; --deflected: #16a34a;
    --diag-N: #7c3aed; --diag-V: #0284c7; --diag-M: #e11d48; --diag-T: #b45309; --diag-d: #16a34a; --tension: #2563eb; --compression: #ea580c; --zero-force: #94a3b8;
    background: #fff !important; color: #111827 !important; min-height: 0;
  }
  .rv-toolbar, .rv-toc, .rv-copy, .rv-status, .rv-csv { display: none !important; }
  .rv-layout { display: block; max-width: none; padding: 0; }
  .rv-doc { max-width: none; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: #fff; font-size: 10.5pt; line-height: 1.5; }
  .rv-cover { margin-bottom: 14pt; }
  .rv-title { font-size: 24pt; }
  .rv-doc h2.rv-h1 { break-before: page; page-break-before: always; margin-top: 0; font-size: 15pt; }
  .rv-cover + h2.rv-h1 { break-before: auto; page-break-before: auto; }
  .rv-doc h2, .rv-doc h3, .rv-doc h4, .rv-doc caption { break-after: avoid; page-break-after: avoid; }
  .rv-table, .rv-mat, .rv-figure, .rv-callout, .rv-eqlines, .math.display, tr { break-inside: avoid; page-break-inside: avoid; }
  .rv-tablewrap, .rv-mat-scroll, .math.display, .rv-eqlines, .rv-fig-img { overflow: visible !important; }
  .rv-doc .rv-table { font-size: 8.5pt; }
  .rv-matrix { font-size: 8pt; }
  .rv-matrix.wide { font-size: 6.5pt; }
  .rv-matrix.xwide { font-size: 5pt; }
  .rv-matrix.wide th, .rv-matrix.wide td { padding: 1px 3px; }
  .rv-matrix.xwide th, .rv-matrix.xwide td { padding: 1px 2px; }
  .rv-eqlines { font-size: 8pt; white-space: pre-wrap; }
  .rv-details { border: 0; margin: 6pt 0; }
  .rv-details > summary { background: none; padding: 4pt 0; font-size: 12pt; border-bottom: 1px solid #aab1bd; border-radius: 0; }
  .rv-details > summary::before { display: none; }
  .rv-details > :not(summary) { margin-left: 0; margin-right: 0; }
  .rv-fig-img { border: 0; padding: 0; }
  .rv-callout { border-color: #d9dde4; }
  .rv-standalone .rv-layout { padding-top: 0; }
}
