/* Reconciliation (03) — rebuilt to the prototype export.
 *
 * Spacing and structure are VERBATIM from the export's `rowStyle` objects, not
 * measured off a screenshot:
 *
 *   statementLines.rowStyle  display:flex; align-items:center; gap:12px;
 *                            width:100%; padding:12px 14px;
 *                            border-bottom:1px solid var(--p-line);
 *                            selected background var(--p-brand-soft)
 *   ledgerLines.rowStyle     display:flex; align-items:center; gap:10px;
 *                            padding:12px 14px; same border
 *
 * The export's `--p-*` names are its own prototype palette. They map onto this
 * repo's tokens one-for-one — `--p-line` is the hairline, `--p-brand-soft` the
 * selected tint, `--p-ok` / `--p-risk` the two figure tones — so nothing here
 * is a new colour. A hex outside design-system/tokens/ is a mistake.
 *
 * Logical properties throughout: this screen is read right-to-left too, and
 * the three columns must reverse with it.
 */

.rec__head {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-block-end: 16px;
}
.rec__title { font-size: 20px; font-weight: 600; margin: 0; }
.rec__sub { color: var(--text-dim); font-size: 13px; margin: 4px 0 0; }

.rec__actions { display: flex; gap: 8px; align-items: center; }
.rec__back,
.rec__finish {
  min-block-size: 44px;
  padding-inline: 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.rec__back { background: none; border: 1px solid var(--border); color: var(--text); }
.rec__back:focus-visible,
.rec__finish:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
/* The export's disabled finish: line-2 fill, ink-3 text, not-allowed. */
.rec__finish.is-disabled {
  background: var(--surface-raised);
  border: none;
  color: var(--text-faint);
  cursor: not-allowed;
}

/* ---- The seven summary cells ------------------------------------------- */

/* `repeat(7, 1fr)` VERBATIM from the export's strip container, which is
   `display:grid; grid-template-columns:repeat(7, 1fr); gap:0`. It was
   `repeat(auto-fit, minmax(9rem, 1fr))`, which is a different layout: auto-fit
   reflows to however many cells fit, so the seven cells silently became two
   rows of four and three on a narrow window. The strip is one reconciliation
   read left-to-right — opening → closing → difference — and wrapping it puts
   Difference under Opening. Below the sidebar breakpoint it stacks explicitly
   instead of reflowing arbitrarily. */
.rec__summary {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  margin: 0 0 16px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.rec__sum-cell { background: var(--surface-card); padding: 14px 16px; }
.rec__sum-label {
  display: block;
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 500;
  margin-block-end: 6px;
}
.rec__sum-value { display: block; font-size: 15px; font-weight: 600; }
.rec__sum-value--ok { color: var(--ok); }
.rec__sum-value--risk { color: var(--risk); }

/* ---- The three columns -------------------------------------------------- */

/* `1fr 250px 1fr` and `gap:14px`, VERBATIM from the export's three-pane
   container. The middle pane is a FIXED 250px in the design because it holds
   the suggestion and its reasons at a fixed measure; `minmax(15rem, 18rem)`
   let it grow to 288px and took the width off the two lists either side. */
.rec__cols {
  display: grid;
  grid-template-columns: 1fr 250px 1fr;
  gap: 14px;
  align-items: start;
}
/* Below the sidebar's own breakpoint the three columns stack: the panel is
   about ONE line, so it must not be stranded beside a list it cannot reach.
   The export has no breakpoint at all — it is a fixed 1440px artboard — so
   this is ours, and it is a stack rather than a reflow for the same reason
   the strip stacks. */
@media (max-width: 1200px) {
  .rec__cols { grid-template-columns: minmax(0, 1fr); }
  .rec__summary { grid-template-columns: repeat(2, 1fr); }
}

.rec__col { padding: 0; overflow: hidden; }
.rec__col-head {
  display: flex;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 14px 10px;
}
.rec__col-title { font-size: 14px; font-weight: 600; margin: 0; }
.rec__col-count { color: var(--text-dim); font-size: 12px; }

/* statementLines.rowStyle, verbatim. */
.rec__line {
  display: flex;
  align-items: center;
  gap: 12px;
  inline-size: 100%;
  /* 44px minimum target; the export's 12px padding on a 20px line clears it. */
  min-block-size: 44px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-block-end: 1px solid var(--border-subtle);
  color: var(--text);
  text-align: start;
  font: inherit;
  cursor: pointer;
}
.rec__line:hover { background: var(--surface-raised); }
.rec__line:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.rec__line.is-selected { background: var(--brand-soft); }
/* An agreed line is quieter, never hidden: it is still part of the statement. */
.rec__line.is-matched .rec__line-desc { color: var(--text-dim); }

/* ledgerLines.rowStyle, verbatim — gap 10px rather than 12px. */
.rec__entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-block-end: 1px solid var(--border-subtle);
}

.rec__line-main { flex: 1; min-inline-size: 0; }
.rec__line-desc {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rec__line-meta {
  display: block;
  color: var(--text-dim);
  font-size: 11.5px;
  margin-block-start: 2px;
}
.rec__num { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rec__num--ok { color: var(--ok); }

/* ---- The suggestion panel ---------------------------------------------- */

.rec__panel {
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
}
.rec__panel-eyebrow {
  color: var(--text-dim);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 8px;
}
.rec__panel-title { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
.rec__panel-body { color: var(--text-dim); font-size: 12.5px; line-height: 1.55; margin: 0 0 12px; }
.rec__panel-confidence { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; }
.rec__panel-judgment { color: var(--text-dim); font-size: 11.5px; line-height: 1.4; }
.rec__panel-refusal { color: var(--text-dim); font-size: 12px; line-height: 1.5; margin: 0; }

.rec__match { inline-size: 100%; min-block-size: 44px; }

.rec__panel-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-block-start: 10px;
}
.rec__panel-action {
  min-block-size: 44px;
  padding-inline: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 12px;
}
/* Disabled and explained, never hidden — the panel's composition is the
   design, and the title says which contract is missing. */
.rec__panel-action.is-disabled { color: var(--text-faint); cursor: not-allowed; }

/* ---- The chooser and its empty state ------------------------------------ */

.rec__stmts { padding: 8px; }
.rec__stmt {
  display: flex;
  gap: 12px;
  align-items: center;
  inline-size: 100%;
  min-block-size: 44px;
  padding: 10px 12px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text);
  text-align: start;
  font: inherit;
  cursor: pointer;
}
.rec__stmt + .rec__stmt { margin-block-start: 8px; }
.rec__stmt:hover { background: var(--surface-raised); }
.rec__stmt:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.rec__stmt-account { flex: 1; font-weight: 500; }
.rec__stmt-date { color: var(--text-dim); font-size: 12.5px; }

.rec__note { color: var(--text-dim); font-size: 12px; line-height: 1.55; margin: 12px 14px; }
.rec__note--risk { color: var(--risk); }
