/* ═══════════════════════════════════════════════════════════════════════════════
   MATCH DEAL PRO — LC & GUARANTEE ANALYSIS / AI DOCUMENT EXAMINATION

   The thirteenth stylesheet, added for the two instrument workspaces — which is what the
   manifest in `index.html` asks a new module to do rather than editing a shared blob.

   EVERY SELECTOR IN THIS FILE IS PREFIXED `.mdp-ins-`. No exceptions. Nothing here matches an
   element any earlier screen renders, so every screen that shipped before these two paints
   identically with this file loaded or absent. That is the property `developer.css`
   established and every sheet since has kept: a new sheet may only add, and a sheet that
   reached `.mdp-badge` or `.mdp-card` would be a refactor of the component library wearing a
   stylesheet's clothes.

   WHAT THIS FILE IS NOT

   It is not a second design. The two workspaces are built from the existing component
   library — cards, fields, badges, callouts, lists, segmented controls, empty states — and
   what is defined below is only the vocabulary that library has no element for: an upload
   tray, a report section, a finding, a quoted clause, a count strip.

   NO ILLUSTRATIONS AND NO OVERSIZED GLYPHS. There is not one rule in this file that sizes an
   `<svg>`, sets a decorative background, or draws a shape for its own sake. The largest text
   here is the count figure on the examination result, at `--mdp-fs-xl`, which is a number a
   customer reads rather than a graphic.

   THE STATUS COLOURS ARE A RAIL, NOT A FILL

   Every status-carrying block is marked with a 3px border on its inline start and nothing
   else. A discrepancy is not a red panel: a customer scanning ten findings needs to locate
   the two that matter without the page becoming a traffic light, and a filled red card also
   makes the reasoning inside it harder to read. `unable_to_determine` deliberately gets the
   plain border — it is the correct professional answer when a document is silent, and
   colouring it would teach a customer to read absence of evidence as a problem.

   TOKENS ONLY, AND LOGICAL PROPERTIES ONLY

   Every value below is a token from `tokens.css`, so the customer's theme choice works
   without a second set of rules. Every inset, margin, padding and border uses its logical
   form (`inline-start`, not `left`), so both workspaces mirror in Arabic with no entry in
   `rtl.css` — which is a completed module.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── The set-up card: one step per block ─────────────────────────────────────── */

.mdp-ins-step {
  padding-block: var(--mdp-sp-3);
  border-block-end: 1px solid var(--mdp-border-subtle);
}

.mdp-ins-step:last-of-type { border-block-end: 0; }

.mdp-ins-step-label {
  margin: 0 0 var(--mdp-sp-2);
  font-size: var(--mdp-fs-sm);
  font-weight: var(--mdp-fw-semibold);
  color: var(--mdp-text-strong);
}

/* The candidate rulebooks. Muted on purpose: it is a qualification of the choice above it,
   not a claim about the instrument. */
.mdp-ins-type-note:empty { display: none; }

.mdp-ins-candidates {
  margin: var(--mdp-sp-2) 0 0;
  font-size: var(--mdp-fs-xs);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text-muted);
}

/* ── The upload tray ─────────────────────────────────────────────────────────── */

.mdp-ins-tray { display: block; }

.mdp-ins-files {
  list-style: none;
  margin: var(--mdp-sp-2) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--mdp-sp-1);
}

.mdp-ins-file {
  display: flex;
  align-items: center;
  gap: var(--mdp-sp-2);
  padding: var(--mdp-sp-2) var(--mdp-sp-3);
  background: var(--mdp-surface-2);
  border: 1px solid var(--mdp-border-subtle);
  border-radius: var(--mdp-r-sm);
}

/* The name takes the room and truncates; the size and the control never do. A file called
   `MT700 amendment 3 final (signed).pdf` should not push Remove off the card. */
.mdp-ins-file-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--mdp-fs-sm);
  color: var(--mdp-text);
}

.mdp-ins-file-size {
  flex: 0 0 auto;
  font-size: var(--mdp-fs-2xs);
  font-variant-numeric: tabular-nums;
  color: var(--mdp-text-faint);
}

.mdp-ins-tray-empty,
.mdp-ins-tray-busy,
.mdp-ins-tray-count {
  margin: var(--mdp-sp-2) 0 0;
  font-size: var(--mdp-fs-xs);
  color: var(--mdp-text-muted);
}

.mdp-ins-tray-count { color: var(--mdp-text-faint); }

/* ── The document-kinds disclosure ───────────────────────────────────────────── */

.mdp-ins-kinds {
  margin-block-start: var(--mdp-sp-3);
  font-size: var(--mdp-fs-xs);
  color: var(--mdp-text-muted);
}

.mdp-ins-kinds > summary {
  cursor: pointer;
  color: var(--mdp-text);
  font-weight: var(--mdp-fw-medium);
}

.mdp-ins-kinds-list {
  margin: var(--mdp-sp-2) 0 0;
  padding-inline-start: var(--mdp-sp-5);
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--mdp-sp-1) var(--mdp-sp-4);
}

.mdp-ins-kinds-note {
  margin: var(--mdp-sp-2) 0 0;
  color: var(--mdp-text-faint);
}

/* ── The run control ─────────────────────────────────────────────────────────── */

.mdp-ins-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mdp-sp-3);
  padding-block-start: var(--mdp-sp-4);
}

/* The sentence that says what is still missing. It sits beside the control rather than under
   it, because a disabled button with no reason next to it is a dead end. */
.mdp-ins-actions-note {
  flex: 1 1 240px;
  margin: 0;
  font-size: var(--mdp-fs-xs);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text-muted);
}

.mdp-ins-result:empty { display: none; }

.mdp-ins-processing {
  margin: 0 0 var(--mdp-sp-3);
  font-size: var(--mdp-fs-sm);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text-muted);
}

/* ── The aside: what this does, and what it will not do ──────────────────────── */

.mdp-ins-about {
  margin: 0 0 var(--mdp-sp-2);
  font-size: var(--mdp-fs-sm);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text);
}

.mdp-ins-about-list {
  margin: 0;
  padding-inline-start: var(--mdp-sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--mdp-sp-2);
  font-size: var(--mdp-fs-xs);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text-muted);
}

/* The standing disclaimer. Small, faint and always present — never dismissible. */
.mdp-ins-note {
  margin: var(--mdp-sp-3) 0 0;
  font-size: var(--mdp-fs-2xs);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text-faint);
}

/* ── The report head ─────────────────────────────────────────────────────────── */

.mdp-ins-summary {
  margin: 0 0 var(--mdp-sp-3);
  font-size: var(--mdp-fs-sm);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text);
}

.mdp-ins-read-as,
.mdp-ins-ran-at {
  margin: 0 0 var(--mdp-sp-3);
  font-size: var(--mdp-fs-xs);
  color: var(--mdp-text-muted);
}

.mdp-ins-ran-at { margin: var(--mdp-sp-3) 0 0; }

.mdp-ins-workability { margin-block-start: var(--mdp-sp-3); }

.mdp-ins-sub {
  margin: 0 0 var(--mdp-sp-1);
  font-size: var(--mdp-fs-2xs);
  font-weight: var(--mdp-fw-semibold);
  letter-spacing: var(--mdp-tracking-caps);
  text-transform: uppercase;
  color: var(--mdp-text-faint);
}

.mdp-ins-workability p:last-child,
.mdp-ins-para,
.mdp-ins-recommended {
  margin: 0;
  font-size: var(--mdp-fs-sm);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text);
}

/* The rulebook chips inside the governing-rules callout. */
.mdp-ins-rules {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mdp-sp-1);
}

/* ── The eleven analysis sections ────────────────────────────────────────────── */

.mdp-ins-sections {
  display: flex;
  flex-direction: column;
  gap: var(--mdp-sp-3);
}

.mdp-ins-section {
  padding-inline-start: var(--mdp-sp-3);
  border-inline-start: 3px solid var(--mdp-border);
}

/* Only two statuses take a colour, and neither is `unable_to_determine`. */
.mdp-ins-section[data-status='reported'] { border-inline-start-color: var(--mdp-brand-border); }
.mdp-ins-section[data-status='not_applicable'] { border-inline-start-color: var(--mdp-border-subtle); }

.mdp-ins-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mdp-sp-2);
  margin-block-end: var(--mdp-sp-2);
}

.mdp-ins-section-title,
.mdp-ins-issue-title,
.mdp-ins-finding-title {
  margin: 0;
  font-size: var(--mdp-fs-sm);
  font-weight: var(--mdp-fw-semibold);
  color: var(--mdp-text-strong);
}

.mdp-ins-section-body {
  margin: 0;
  font-size: var(--mdp-fs-sm);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text);
}

.mdp-ins-points,
.mdp-ins-key,
.mdp-ins-requirements,
.mdp-ins-register-list {
  margin: var(--mdp-sp-2) 0 0;
  padding-inline-start: var(--mdp-sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--mdp-sp-1);
  font-size: var(--mdp-fs-sm);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text);
}

.mdp-ins-key,
.mdp-ins-requirements { margin-block-start: 0; }

/* ── Clause issues ───────────────────────────────────────────────────────────── */

.mdp-ins-issues,
.mdp-ins-findings {
  display: flex;
  flex-direction: column;
  gap: var(--mdp-sp-4);
}

.mdp-ins-issue,
.mdp-ins-finding {
  padding-inline-start: var(--mdp-sp-3);
  border-inline-start: 3px solid var(--mdp-border);
}

.mdp-ins-issue[data-severity='high'] { border-inline-start-color: var(--mdp-danger); }
.mdp-ins-issue[data-severity='medium'] { border-inline-start-color: var(--mdp-warn); }

.mdp-ins-finding[data-status='complying'] { border-inline-start-color: var(--mdp-success); }
.mdp-ins-finding[data-status='discrepancy'] { border-inline-start-color: var(--mdp-danger); }
.mdp-ins-finding[data-status='observation'] { border-inline-start-color: var(--mdp-warn); }

.mdp-ins-issue-head,
.mdp-ins-finding-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mdp-sp-2);
  margin-block-end: var(--mdp-sp-2);
}

.mdp-ins-issue-body {
  margin: 0 0 var(--mdp-sp-2);
  font-size: var(--mdp-fs-sm);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text);
}

/* A clause quoted out of the customer's own instrument. Monospaced and inset so it is
   visibly a quotation rather than the platform's own wording — the distinction matters when
   the sentence is going to be repeated back to a bank. */
.mdp-ins-clause {
  margin: 0 0 var(--mdp-sp-2);
  padding: var(--mdp-sp-2) var(--mdp-sp-3);
  background: var(--mdp-surface-inset);
  border-radius: var(--mdp-r-sm);
  font-family: var(--mdp-font-mono);
  font-size: var(--mdp-fs-xs);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mdp-ins-ref,
.mdp-ins-issue-action {
  margin: 0 0 var(--mdp-sp-1);
  font-size: var(--mdp-fs-xs);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text-muted);
}

/* ── The examination count strip ─────────────────────────────────────────────── */

.mdp-ins-counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: var(--mdp-sp-2);
  margin-block-end: var(--mdp-sp-3);
}

.mdp-ins-count {
  padding: var(--mdp-sp-3);
  background: var(--mdp-surface-2);
  border: 1px solid var(--mdp-border-subtle);
  border-inline-start: 3px solid var(--mdp-border);
  border-radius: var(--mdp-r-sm);
}

.mdp-ins-count[data-status='complying'] { border-inline-start-color: var(--mdp-success); }
.mdp-ins-count[data-status='discrepancy'] { border-inline-start-color: var(--mdp-danger); }
.mdp-ins-count[data-status='observation'] { border-inline-start-color: var(--mdp-warn); }

.mdp-ins-count-value {
  display: block;
  font-size: var(--mdp-fs-xl);
  font-weight: var(--mdp-fw-bold);
  font-variant-numeric: tabular-nums;
  line-height: var(--mdp-lh-tight);
  color: var(--mdp-text-strong);
}

.mdp-ins-count-label {
  display: block;
  margin-block-start: var(--mdp-sp-1);
  font-size: var(--mdp-fs-2xs);
  color: var(--mdp-text-muted);
}

/* ── One finding, field by field ─────────────────────────────────────────────── */

/* Requirement, finding, reference, reasoning and action are separate rows and stay separate.
   A customer disputing a discrepancy with their bank has to be able to point at the
   requirement and the reasoning independently. */
.mdp-ins-finding-row {
  display: grid;
  grid-template-columns: minmax(120px, 22%) 1fr;
  gap: var(--mdp-sp-1) var(--mdp-sp-3);
  padding-block: var(--mdp-sp-1);
}

@media (max-width: 640px) {
  .mdp-ins-finding-row { grid-template-columns: 1fr; }
}

.mdp-ins-finding-label {
  font-size: var(--mdp-fs-2xs);
  font-weight: var(--mdp-fw-semibold);
  letter-spacing: var(--mdp-tracking-caps);
  text-transform: uppercase;
  color: var(--mdp-text-faint);
}

.mdp-ins-finding-value {
  margin: 0;
  font-size: var(--mdp-fs-sm);
  line-height: var(--mdp-lh-normal);
  color: var(--mdp-text);
}

/* ── The three registers ─────────────────────────────────────────────────────── */

.mdp-ins-register {
  padding-inline-start: var(--mdp-sp-3);
  border-inline-start: 3px solid var(--mdp-border);
}

.mdp-ins-register + .mdp-ins-register { margin-block-start: var(--mdp-sp-4); }

.mdp-ins-register[data-tone='danger'] { border-inline-start-color: var(--mdp-danger); }
.mdp-ins-register[data-tone='warn'] { border-inline-start-color: var(--mdp-warn); }
