/* calc.css: page-local layout for the invoice exception estimator, on the desk.css tokens (--dk-*).
   The same design language as the AP payback calculator (calculators/ap-three-way-match-payback/calc.css).
   Load after desk.css. The page puts class="dk cx xe" on <main>. Shared classes use the cx- prefix.
   Classes that only this page has use the xe- prefix. */

/* 1. Form on the left, results on the right. One column on a narrow screen. */
.cx-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px 32px; align-items: start; margin-top: 20px; }
.cx-form { padding: 20px 22px; background: var(--dk-panel); border: 1px solid var(--dk-line); border-radius: var(--dk-radius); box-shadow: var(--dk-shadow); }
.cx-form fieldset { min-width: 0; margin: 0 0 6px; padding: 0; border: 0; }
.cx-form legend { margin: 0 0 12px; padding: 0; font-size: 13px; line-height: 1.4; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--dk-muted); }
.cx-form fieldset + fieldset { padding-top: 18px; border-top: 1px solid var(--dk-line); }

/* 2. Fields: 6 number fields and 1 list. */
.cx-field { margin: 0 0 16px; }
.cx-field label { display: block; margin: 0 0 5px; font-size: 15px; line-height: 1.4; font-weight: 650; color: var(--dk-ink); }
.cx-field input, .cx-field select { display: block; width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #7d857a; border-radius: var(--dk-radius-sm); background-color: var(--dk-panel); color: var(--dk-ink); font: 16px/1.3 var(--dk-sans); font-variant-numeric: tabular-nums; }
.cx-field select { max-width: 100%; text-overflow: ellipsis; cursor: pointer; }
.cx-field input:hover, .cx-field select:hover { border-color: var(--dk-ink-2); }
.cx-field input[aria-invalid="true"] { border-color: var(--dk-bad); box-shadow: inset 0 0 0 1px var(--dk-bad); }
.dk p.cx-hint { margin: 6px 0 0; max-width: none; font-size: 13.5px; line-height: 1.45; color: var(--dk-muted); }
.dk p.cx-error { margin: 6px 0 0; max-width: none; font-size: 13.5px; line-height: 1.45; font-weight: 600; color: var(--dk-bad); }
.cx-form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

/* 3. Results */
.cx-results { min-width: 0; }
.dk .cx-results > h3 { margin: 0 0 12px; font-size: 13px; line-height: 1.4; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--dk-muted); }
.cx-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cx-stats .dk-stat:first-child { grid-column: 1 / -1; border-left: 5px solid var(--dk-good); }
.cx-stats .dk-stat .v { font-size: clamp(22px, 2.6vw, 30px); overflow-wrap: anywhere; }
.dk p.cx-note { margin: 0 0 14px; font-size: 14.5px; }
.dk p.xe-noscript { margin: 0 0 12px; max-width: none; font-size: 14px; color: var(--dk-ink-2); }
.xe-copy { margin: 0 0 16px; }
.xe-copy .btn { min-height: 44px; }
.dk p.xe-copy-status { margin: 8px 0 0; max-width: none; min-height: 1.45em; font-size: 14px; line-height: 1.45; font-weight: 600; color: var(--dk-good); }
.xe-copy-box { display: block; width: 100%; margin: 8px 0 0; padding: 10px 12px; border: 1px solid #7d857a; border-radius: var(--dk-radius-sm); background: var(--dk-panel); color: var(--dk-ink); font: 13px/1.5 var(--dk-mono); resize: vertical; }
.dk .cx-disclaimer { margin-bottom: 0; }
.dk .cx-disclaimer p { margin: 0; }
/* The status line is for screen readers: it reports each new estimate. */
.cx-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* 4. Tables: the arithmetic is one line where there is room, and wraps where there is none. */
.cx .dk-data th, .cx .dk-data td, .cx .dk-kv th, .cx .dk-kv td { overflow-wrap: anywhere; }
.cx .dk-data thead th { white-space: normal; }
.cx .dk-data td { font-variant-numeric: tabular-nums; }
.cx-steps tbody th { width: 38%; }
.cx-lanes tbody th { white-space: nowrap; }
/* The last row of the bucket table is the total of the 5 buckets. */
.xe-buckets tbody tr:last-child > * { font-weight: 700; border-top: 2px solid var(--dk-line); }
.cx .dk-card h3 { overflow-wrap: anywhere; }
.dk .dk-closing .dk-note { margin-top: 18px; font-size: 14px; color: var(--dk-ink-2); }

@media (min-width: 861px) {
  .cx-results { position: sticky; top: 16px; }
}
@media (max-width: 860px) {
  .cx-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .cx-form { padding: 16px; }
  .cx-stats { grid-template-columns: 1fr; }
  .cx-steps tbody th { width: auto; }
  .cx-lanes tbody th { white-space: normal; }
  .cx-form-actions .btn, .xe-copy .btn { width: 100%; }
}
@media print {
  .cx-form-actions, .xe-copy { display: none !important; }
  .cx-results { position: static; }
  .cx-form, .cx-results { break-inside: avoid; }
}
