/*
 * LOFA CODE — client portal document views (invoice / quotation / proposal / contract).
 * CSS only: markup, actions (accept/decline, pay, download, print, sign) remain native.
 */
body.viewinvoice, body.viewestimate, body.proposal-view, body.contract-view {
  --lcd-navy: #1f285b;
  --lcd-royal: #3f64af;
  --lcd-light: #70aedf;
  --lcd-ink: #1d2433;
  --lcd-body: #3a4256;
  --lcd-muted: #6b7591;
  --lcd-rule: #dde3ee;
  --lcd-tint: #f2f6fb;
}

/* Document sheet */
.viewinvoice .panel_s > .panel-body,
.viewestimate .panel_s > .panel-body,
.proposal-view #proposal-wrapper .panel_s > .panel-body,
.contract-view .contract-html-content {
  border-top: 3px solid var(--lcd-royal);
  box-shadow: 0 1px 2px rgba(31, 40, 91, .06);
}

/* Titles & numbers */
.viewinvoice .invoice-html-number,
.viewestimate h3, .viewestimate h4.tw-font-semibold,
.proposal-view .proposal-html-number,
.contract-view .contract-html-subject {
  color: var(--lcd-navy) !important;
  letter-spacing: .01em;
}
.viewinvoice .invoice-html-bill-to,
.viewinvoice .invoice-html-ship-to,
.viewestimate .estimate_to,
.viewestimate .estimate_ship_to {
  text-transform: uppercase;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--lcd-royal) !important;
  font-weight: 700;
}

/* Items table */
.viewinvoice table.items thead th,
.viewestimate table.items thead th,
.proposal-view table.items thead th {
  background: var(--lcd-navy) !important;
  color: #fff !important;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  border: 0 !important;
  padding: 10px 12px !important;
}
.viewinvoice table.items tbody td,
.viewestimate table.items tbody td,
.proposal-view table.items tbody td {
  border-top: 0 !important;
  border-bottom: 1px solid var(--lcd-rule) !important;
  padding: 10px 12px !important;
  color: var(--lcd-body);
  vertical-align: top;
}
.viewinvoice table.items tbody td.description span:first-child strong,
.viewestimate table.items tbody td.description span:first-child strong,
.proposal-view table.items tbody td.description span:first-child strong { color: var(--lcd-ink); }
.viewinvoice table.items tbody td.amount,
.viewestimate table.items tbody td.amount,
.proposal-view table.items tbody td.amount { font-weight: 600; color: var(--lcd-ink); font-variant-numeric: tabular-nums; }

/* Totals */
.viewinvoice table.table.text-right td,
.viewestimate table.table.text-right td,
.proposal-view table.table.text-right td {
  border-top: 0 !important;
  border-bottom: 1px solid var(--lcd-rule);
  font-variant-numeric: tabular-nums;
}
.viewinvoice table.table.text-right tr.total td,
.viewestimate table.table.text-right tr.total td,
.proposal-view table.table.text-right tr.total td {
  border-top: 2px solid var(--lcd-navy) !important;
  color: var(--lcd-navy);
  font-weight: 700;
}
.viewinvoice table.table.text-right tr:last-child td {
  background: var(--lcd-tint);
  color: var(--lcd-navy);
  font-weight: 700;
  font-size: 1.08em;
}
.viewinvoice table.table.text-right tr:last-child td:first-child { border-left: 3px solid var(--lcd-royal); }

/* Payments table */
.viewinvoice .invoice-payments-table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--lcd-muted);
  border-bottom: 1px solid var(--lcd-rule);
}

/* Rich content (proposal / contract) */
.proposal-view .proposal-content h1, .proposal-view .proposal-content h2,
.contract-view .contract-html-content h1, .contract-view .contract-html-content h2 {
  color: var(--lcd-navy);
  font-weight: 700;
}
.proposal-view .proposal-content h2 { border-bottom: 1px solid var(--lcd-light); padding-bottom: 6px; margin-top: 28px; }
.contract-view .contract-html-content h2 { font-size: 1.15em; margin-top: 24px; }
.proposal-view .proposal-content h3, .contract-view .contract-html-content h3 { color: var(--lcd-royal); }
.proposal-view .proposal-content, .contract-view .contract-html-content { color: var(--lcd-body); line-height: 1.65; }

/* Keep long descriptions and tables inside the viewport on phones */
.viewinvoice .table-responsive, .viewestimate .table-responsive, .proposal-view .table-responsive { -webkit-overflow-scrolling: touch; }
.proposal-view .proposal-content img, .contract-view .contract-html-content img { max-width: 100%; height: auto; }
.proposal-view .proposal-content table, .contract-view .contract-html-content table { max-width: 100%; }

@media print {
  .viewinvoice table.items thead th, .viewestimate table.items thead th, .proposal-view table.items thead th {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Native theme nests .row inside .preview-top-wrapper (itself a row child): cancel the doubled gutters */
.viewinvoice .preview-top-wrapper > .row,
.viewestimate .preview-top-wrapper > .row { margin-left: 0; margin-right: 0; }
