/* =============================================================
   TraceRecord — report.css (Concept 10 v2 · output document)

   The report is deliberately NOT the workspace. The workspace is warm,
   rounded, interactive and exploratory; the report is white, ruled, stable
   and document-like. That difference is semantic: one is a place to think,
   the other is a document a contractor issues under their own name.

   Family tell for external technical output (Concept 10 v2): ruled masthead,
   a reference column, tabular technical pages, no rounded cards.
   ============================================================= */

.tr-report {
  --rp-ink: #14181c;
  --rp-mute: #5c6a74;
  --rp-line: #c9cfd4;
  --rp-hair: #e4e8eb;
  --rp-ref: #2d4a63;
  --rp-bound: #8a5b12;
  background: #fff;
  color: var(--rp-ink);
  font-family: "Source Sans 3", system-ui, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  padding: 30px 34px 26px;
  border: 1px solid var(--rp-line);
  max-width: 940px;
}

/* ---------- masthead: the contractor's, ruled not carded ---------- */
.tr-report-head {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: flex-end;
  padding-bottom: 12px; border-bottom: 3px double var(--rp-ink);
}
.tr-report-firm-name { margin: 0; font-size: 1.02rem; font-weight: 700; letter-spacing: .01em; }
.tr-report-firm-meta { margin: 2px 0 0; font-size: .78rem; color: var(--rp-mute); }
.tr-report-title { text-align: right; }
.tr-report-kicker {
  margin: 0; font-size: .66rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--rp-mute);
}
.tr-report-title h2 {
  margin: 3px 0 0; font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.32rem; font-weight: 600; line-height: 1.15;
}

/* ---------- status marks. A draft must never look issuable. ---------- */
.tr-report-watermark {
  margin: 12px 0 0; padding: 7px 11px;
  border: 1px solid #e5c3ac; background: #fbf1ea; color: #8f3f22;
  font-size: .74rem; font-weight: 700; letter-spacing: .04em;
}
.tr-report-watermark.is-sample {
  border-color: var(--rp-line); background: #f4f6f7; color: var(--rp-mute);
}

/* ---------- job identity ---------- */
.tr-report-meta {
  display: grid; gap: 0 24px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  margin: 14px 0 0; padding: 12px 0; border-top: 1px solid var(--rp-hair); border-bottom: 1px solid var(--rp-hair);
}
.tr-report-meta div { display: grid; gap: 1px; padding: 4px 0; }
.tr-report-meta span {
  font-size: .64rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--rp-mute);
}
.tr-report-meta b { font-size: .86rem; font-weight: 600; }

/* ---------- contents: the reader's entry map ---------- */
.tr-report-contents { margin: 16px 0 0; padding: 14px 16px; border: 1px solid var(--rp-line); background: #fafbfb; }
.tr-report-contents-head {
  margin: 0 0 8px; font-size: .66rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--rp-mute);
}
.tr-report-contents ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.tr-report-contents li {
  display: flex; align-items: baseline; gap: 10px; padding: 4px 6px;
  font-size: .84rem; border-left: 3px solid transparent;
}
.tr-report-contents li.is-entry {
  border-left-color: var(--rp-ink); background: #fff; font-weight: 600;
}
.tr-report-entry-tag {
  margin-left: auto; font-size: .66rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--rp-ref);
}
.tr-report-contents-note { margin: 10px 0 0; font-size: .8rem; color: var(--rp-mute); }
.tr-report-contents-rule {
  margin: 6px 0 0; padding-top: 7px; border-top: 1px dashed var(--rp-line);
  font-size: .76rem; color: var(--rp-mute);
}

/* ---------- sections: numbered, ruled, with a reference column ---------- */
.tr-report-section { margin: 20px 0 0; padding-top: 12px; border-top: 1px solid var(--rp-hair); }
.tr-report-section > h3 {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 9px;
  font-family: "Source Serif 4", Georgia, serif; font-size: 1.02rem; font-weight: 600;
}
.tr-report-section-num {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .74rem; font-weight: 700; color: var(--rp-mute);
}
.tr-report-section.is-entry > h3 { border-left: 3px solid var(--rp-ink); margin-left: -12px; padding-left: 9px; }
.tr-report-subhead {
  margin: 14px 0 7px; font-size: .68rem; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--rp-mute);
}

/* ---------- object references keep one identity everywhere ---------- */
.tr-report-ref {
  display: inline-block; padding: 1px 6px; margin-right: 6px;
  border: 1px solid var(--rp-line); background: #f4f6f7;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: .72rem; font-weight: 700; color: var(--rp-ref); white-space: nowrap;
}

/* ---------- summary: the three questions ---------- */
.tr-report-summary { margin: 0; display: grid; gap: 0; }
.tr-report-summary div {
  display: grid; grid-template-columns: 168px 1fr; gap: 14px;
  padding: 8px 0; border-bottom: 1px solid var(--rp-hair);
}
.tr-report-summary span {
  font-size: .64rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--rp-mute); padding-top: 3px;
}
.tr-report-summary b { font-weight: 500; font-size: .88rem; }

/* ---------- tables: technical pages are tabular, not carded ---------- */
.tr-report-table { width: 100%; border-collapse: collapse; margin: 8px 0 0; font-size: .82rem; }
.tr-report-table th, .tr-report-table td {
  padding: 6px 9px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rp-hair);
}
.tr-report-table thead th {
  font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--rp-mute); border-bottom: 1px solid var(--rp-line); background: #fafbfb;
}
.tr-report-table tbody tr.is-conflicting { background: #fdf6f3; }

/* ---------- findings: the engineer's position ---------- */
.tr-report-finding { margin: 10px 0 0; padding: 11px 13px; border: 1px solid var(--rp-line); background: #fff; }
.tr-report-finding + .tr-report-finding { margin-top: 8px; }
.tr-report-finding-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 6px; }
.tr-report-finding-cert {
  font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--rp-ref);
}
.tr-report-origin { margin: 0 0 5px; font-size: .82rem; color: var(--rp-mute); }
.tr-report-body { margin: 0; font-size: .92rem; }
.tr-report-finding-links { margin: 7px 0 0; font-size: .8rem; color: var(--rp-mute); }
.tr-report-rel {
  display: inline-block; margin-left: 4px; padding: 0 5px;
  font-size: .66rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  border: 1px solid var(--rp-line); color: var(--rp-mute);
}
.tr-report-rel.is-primary-support, .tr-report-rel.is-primary { border-color: #2d4a63; color: #2d4a63; }
.tr-report-rel.is-conflicting { border-color: #8f3f22; color: #8f3f22; }
.tr-report-rel.is-inconclusive { border-color: #8a5b12; color: #8a5b12; }
.tr-report-rel.is-not-relied-upon { border-style: dashed; }

/* a boundary is a declared limit, printed in the same weight as the finding */
.tr-report-finding-bound {
  margin: 7px 0 0; padding-left: 9px; border-left: 2px solid var(--rp-bound);
  font-size: .82rem; color: #6b5320;
}

/* ---------- limitations ---------- */
.tr-report-limitation {
  margin: 7px 0 0; padding: 9px 11px; border: 1px solid var(--rp-line);
  border-left: 3px solid var(--rp-bound); background: #fdfaf4;
}
.tr-report-limitation-type {
  font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--rp-bound);
}
.tr-report-limitation p { margin: 4px 0 0; font-size: .86rem; }

.tr-report-next { margin: 4px 0 0; padding-left: 18px; display: grid; gap: 5px; font-size: .86rem; }
.tr-report-next-from { font-size: .72rem; color: var(--rp-mute); }

/* ---------- plate schedule ---------- */
.tr-report-plates {
  display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-top: 8px;
}
.tr-report-plate { margin: 0; border: 1px solid var(--rp-line); background: #fff; }
.tr-report-plate-thumb {
  aspect-ratio: 4 / 3; display: grid; place-items: center;
  background: repeating-linear-gradient(135deg, #f4f6f7 0 8px, #eef1f3 8px 16px);
  border-bottom: 1px solid var(--rp-line);
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; font-weight: 700; color: var(--rp-mute);
}
.tr-report-plate figcaption { padding: 8px 10px; display: grid; gap: 3px; }
.tr-report-plate-ref { margin: 0; display: flex; align-items: baseline; gap: 4px; font-size: .72rem; color: var(--rp-mute); }
.tr-report-plate-cap { margin: 0; font-size: .82rem; }
.tr-report-plate-meta, .tr-report-plate-rel { margin: 0; font-size: .72rem; color: var(--rp-mute); }

/* ---------- boundary statements ---------- */
.tr-report-boundary {
  margin: 9px 0 0; padding: 7px 10px; border-left: 2px solid var(--rp-line);
  font-size: .78rem; color: var(--rp-mute);
}

/* ---------- missing data stays visibly missing ---------- */
.tr-report-not-recorded { color: #9aa3a9; font-style: italic; }

.tr-report-foot {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between;
  margin-top: 20px; padding-top: 9px; border-top: 3px double var(--rp-ink);
  font-size: .72rem; color: var(--rp-mute);
}

/* ---------- reader outputs (workspace-side chrome, not the document) ----------
   One row per reader: selecting it previews that entry into the document,
   and each row carries its own export so a PDF always matches what is shown. */
.tr-report-outputs { display: grid; gap: 6px; margin: 10px 0 12px; }
.tr-report-output-row {
  display: flex; align-items: center; gap: 12px;
  padding: 7px 8px 7px 0;
  border: 1px solid rgba(24, 44, 70, .16);
  border-left: 3px solid rgba(24, 44, 70, .16);
  border-radius: 10px; background: #fff;
  transition: border-color var(--tr-motion-fast, 160ms) var(--tr-ease-control, ease);
}
.tr-report-output-row.is-selected { border-color: rgba(24, 44, 70, .34); border-left-color: #182c46; }
.tr-report-outputs [role="tab"] {
  flex: 1; min-width: 0; min-height: 44px; padding: 6px 13px;
  display: grid; gap: 1px; text-align: left;
  border: 0; background: none; cursor: pointer;
}
.tr-report-outputs [role="tab"] b { font-size: .9rem; font-weight: 700; color: #40525f; }
.tr-report-outputs [role="tab"] small { font-size: .74rem; color: rgba(36, 49, 63, .6); }
.tr-report-output-row.is-selected [role="tab"] b { color: #0f1b2d; }
.tr-report-outputs [role="tab"]:focus-visible,
.tr-output-pdf:focus-visible { outline: 3px solid #b7791f; outline-offset: 2px; }
.tr-output-pdf { flex: none; }

/* the older single-row tab treatment, kept for any page still using it */
.tr-report-audiences { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.tr-report-audiences button {
  min-height: 38px; padding: 8px 13px; border: 1px solid rgba(24, 44, 70, .22);
  border-radius: 999px; background: #fff; color: #40525f;
  font-size: .8rem; font-weight: 600; cursor: pointer;
}
.tr-report-audiences button[aria-selected="true"] {
  border-color: #182c46; border-width: 2px; color: #0f1b2d; font-weight: 700;
}
.tr-report-audiences button:focus-visible { outline: 3px solid #b7791f; outline-offset: 2px; }

@media (max-width: 700px) {
  .tr-report { padding: 20px 16px; font-size: 13px; }
  .tr-report-title { text-align: left; }
  .tr-report-summary div { grid-template-columns: 1fr; gap: 2px; }
  .tr-report-table { display: block; overflow-x: auto; }
}

/* ---------- print: the report alone, on paper ----------
   The report is cloned to a direct child of <body> (#tr-report-print) before
   printing. Hiding siblings deep inside the record shell printed blank pages,
   because the canvas is a scrolled grid item; a top-level clone paginates. */
#tr-report-print { display: none; }

@media print {
  @page { size: A4; margin: 14mm; }
  body.tr-printing-report > *:not(#tr-report-print) { display: none !important; }
  body.tr-printing-report #tr-report-print { display: block !important; }
  #tr-report-print .tr-report { border: 0; padding: 0; max-width: none; font-size: 10.5pt; box-shadow: none; }
  #tr-report-print .tr-report-audiences,
  #tr-report-print .tr-report-outputs,
  #tr-report-print .ws-sig-pad,
  #tr-report-print .ws-sig-row { display: none !important; }
  .tr-report-section { break-inside: auto; }
  .tr-report-finding, .tr-report-limitation, .tr-report-plate,
  .tr-report-review { break-inside: avoid; }
  .tr-report-section > h3 { break-after: avoid; }
  .tr-report-watermark { border-color: #999; }
  .tr-report, .tr-report * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- engineer review + optional signature (document control) ---------- */
.tr-report-review{
  margin-top:14px;padding:14px 16px;border:1px solid var(--rp-line);
  background:#fcfaf6;break-inside:avoid;page-break-inside:avoid;
}
.tr-report-review-kicker{
  margin:0 0 6px;font-size:.68rem;letter-spacing:.14em;text-transform:uppercase;
  color:var(--rp-mute);
}
.tr-report-review-name{margin:0;font-size:.95rem}
.tr-report-review-role,.tr-report-review-date{margin:2px 0 0;font-size:.85rem;color:var(--rp-mute)}
.tr-report-signature{
  display:block;margin:10px 0 4px;max-width:280px;height:auto;
  border-bottom:1px solid var(--rp-line);background:#fff;
}
.tr-report-review-sigcap{margin:0;font-size:.72rem;color:var(--rp-mute)}
.tr-report-review-state{margin:10px 0 0;font-weight:700;font-size:.85rem}

/* ---------- signature capture (record surface, not printed) ---------- */
.ws-sig{margin-top:12px}
.ws-sig-pad{
  width:100%;max-width:420px;height:130px;display:block;
  border:1px dashed rgba(24,44,70,.35);border-radius:3px;background:#fff;
  touch-action:none;cursor:crosshair;
}
.ws-sig-row{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px;align-items:center}
.ws-sig-preview{
  display:block;max-width:280px;height:auto;margin-top:10px;
  border:1px solid rgba(24,44,70,.18);background:#fff;
}
@media print{.ws-sig-pad,.ws-sig-row{display:none}}
