/* calc.css: page-local layout for the ERP shadow-run and cutover planner, on the desk.css
   tokens (--dk-*). The same design language as the tolerance policy builder
   (calculators/three-way-match-tolerance-policy-builder/calc.css). Load after desk.css. The
   page puts class="dk cx sr" on <main>. Shared classes use the cx- prefix. Classes that only
   this page has use the sr- prefix. */

/* 1. Form on the left, plan 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: 5 number fields and 2 lists. */
.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); }
/* The note under a field that holds a number above its largest value. It is not an error: the
   colour is the info colour, and the field keeps its plain border. */
.dk p.cx-clamp { margin: 6px 0 0; max-width: none; font-size: 13.5px; line-height: 1.45; font-weight: 600; color: var(--dk-info); }
.dk p.cx-clamp:empty { margin: 0; }
.cx-form-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }

/* 3. Plan */
.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); }
.sr-banner { margin: 0 0 18px; padding: 16px 18px; background: var(--dk-panel); border: 1px solid var(--dk-line); border-left: 5px solid var(--dk-good); border-radius: var(--dk-radius); box-shadow: var(--dk-shadow); }
.dk p.sr-total { margin: 0 0 6px; max-width: none; font-size: clamp(17px, 2vw, 20px); line-height: 1.35; font-weight: 700; letter-spacing: -.01em; color: var(--dk-ink); overflow-wrap: anywhere; }
.dk p.sr-route { margin: 0; max-width: none; font-size: 14.5px; line-height: 1.5; color: var(--dk-ink-2); overflow-wrap: anywhere; }
.dk p.sr-noscript { margin: 0 0 12px; max-width: none; font-size: 14px; color: var(--dk-ink-2); }
.sr-noscript-table { margin: 0 0 16px; }
.sr-copy { margin: 18px 0 16px; }
.sr-copy .btn { min-height: 44px; }
.dk p.sr-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); }
.sr-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 plan. */
.cx-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* 4. The schedule. The cell "ERP writes" is green: the count is 0 in each stage. The 3 lanes
   keep the colours of the site: green for Auto-Matched, blue for 1-Click Confirm, red for Hard
   Stop. The colour is never the only sign: each item names its lane. */
.sr-schedule td.sr-writes { background: var(--dk-good-soft); color: var(--dk-good); font-weight: 650; }
.dk ul.sr-lanes { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; max-width: 820px; list-style: none; }
.dk ul.sr-lanes li { margin: 0; padding: 10px 14px; border: 1px solid var(--dk-line); border-left-width: 5px; border-radius: var(--dk-radius-sm); font-size: 15px; line-height: 1.5; }
.dk ul.sr-lanes li[data-lane="auto"] { background: var(--dk-good-soft); border-color: #c5dfcd; border-left-color: var(--dk-good); color: var(--dk-good); }
.dk ul.sr-lanes li[data-lane="confirm"] { background: var(--dk-info-soft); border-color: var(--dk-info-line); border-left-color: var(--dk-info); color: var(--dk-info); }
.dk ul.sr-lanes li[data-lane="hard"] { background: var(--dk-bad-soft); border-color: #efcbc3; border-left-color: var(--dk-bad); color: var(--dk-bad); }
.dk ul.sr-lanes li strong { color: inherit; }
.dk p.sr-sample { max-width: 820px; margin: 0 0 10px; padding: 12px 16px; background: var(--dk-panel); border: 1px solid var(--dk-line); border-radius: var(--dk-radius-sm); font-size: 15px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dk p.sr-sample:last-of-type { margin-bottom: 16px; }

/* 5. The 2 checklists */
.sr-check { min-width: 0; padding: 18px 20px; background: var(--dk-panel); border: 1px solid var(--dk-line); border-radius: var(--dk-radius); box-shadow: var(--dk-shadow); }
.dk .sr-check h3 { margin: 0 0 10px; }
.dk .sr-check .sr-list { margin: 0; padding-left: 20px; max-width: none; font-size: 15px; line-height: 1.5; color: var(--dk-ink-2); }
.dk .sr-check .sr-list li { margin: 0 0 8px; overflow-wrap: anywhere; }

/* 6. Tables wrap where there is no room. */
.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-card h3 { overflow-wrap: anywhere; }
.dk .dk-closing .dk-note { margin-top: 18px; font-size: 14px; color: var(--dk-ink-2); }

@media (max-width: 860px) {
  .cx-grid { grid-template-columns: 1fr; }
  .sr-checks { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .cx-form { padding: 16px; }
  .cx-form-actions .btn, .sr-copy .btn { width: 100%; }
}
@media print {
  .cx-form-actions, .sr-copy { display: none !important; }
  .cx-form, .sr-banner, .sr-check { break-inside: avoid; }
}
