/* calc.css: page-local layout for the AP payback calculator, on the desk.css tokens (--dk-*).
   The same design language as the EIS calculator (calculators/eis-400-ai-tax-deduction/calc.css).
   Load after desk.css. The page puts class="dk cx" on <main>. Classes use the cx- 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 */
.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 { display: block; width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid #7d857a; border-radius: var(--dk-radius-sm); background: var(--dk-panel); color: var(--dk-ink); font: 16px/1.3 var(--dk-sans); font-variant-numeric: tabular-nums; }
.cx-field input: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); }
/* One error for the 2 share fields together. */
.dk p.cx-error-group { margin: -6px 0 16px; }
.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 .v { font-size: clamp(22px, 2.6vw, 30px); overflow-wrap: anywhere; }
.dk p.cx-note { margin: 0 0 14px; font-size: 14.5px; }
.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; }
.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 { flex: 1 1 100%; }
}
@media print {
  .cx-form-actions { display: none !important; }
  .cx-results { position: static; }
  .cx-form, .cx-results { break-inside: avoid; }
}
