/* Styles for the control screen (step 8). Tokens only, no raw colors.
   Reuses the m- kit: clause coverage row, status pill, table, AI label. */

/* ---------- Screen ---------- */

.ct-marks { display: flex; flex-wrap: wrap; gap: 6px 20px; }

.ct-status { margin: 2px 0 10px; }
.ct-next { margin: -8px 0 14px; }
.ct-next a, .ct-sub a, .ct-empty a, .ct-ledger-empty a { color: var(--cyan); text-underline-offset: 3px; }
.ct-sec { margin-top: 34px; }
.ct-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font: 600 clamp(17px, 1rem + 0.4vw, 20px)/1.3 var(--sans); letter-spacing: -0.01em; margin: 0 0 6px; }
.ct-h:focus { outline: none; }
.ct-h:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; border-radius: 4px; }
.ct-sub { color: var(--soft); max-width: 52em; margin: 0 0 14px; }
.ct-sub b { color: var(--white); font-weight: 600; }
.ct-flush { padding: 0; overflow: hidden; }
.ct-empty, .ct-ledger-empty { color: var(--white); }

/* At a glance. */
.ct-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.ct-stat { display: grid; gap: 2px; align-content: start; min-width: 0; }
.ct-stat b { font-size: 26px; line-height: 1.1; font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.ct-stat span { font-size: 13.5px; }
.ct-stat small { color: var(--soft); font-size: 12px; line-height: 1.35; }
@container (max-width: 760px) { .ct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.ct-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 4px; }

/* Filters and their count line. */
.ct-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 10px; }
.ct-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-f { white-space: normal; }
.ct-f .ct-c { color: var(--soft); font: 500 12px/1 var(--mono); }
.ct-f[aria-pressed="true"] { background: var(--white); border-color: var(--white); color: var(--charcoal); font-weight: 600; }
.ct-f[aria-pressed="true"] .ct-c { color: var(--charcoal); }
button.m-btn.ct-f[aria-pressed="true"]:hover:not(:disabled) { background: var(--white); }

/* Coverage rows: the kit's clause row, with a note and several lines of "covered by". */
.coverage .m-clause { align-items: start; }
.coverage .m-clause .m-pill, .coverage .m-clause .m-mark { align-self: start; }
.coverage .m-clause .m-mark { justify-self: end; white-space: nowrap; }
.ct-row[hidden] { display: none; }
.ct-note { display: block; margin-top: 4px; font-size: 12.5px; line-height: 1.4; overflow-wrap: anywhere; }
.coverage .m-by { display: grid; gap: 3px; }
.ct-by { display: block; overflow-wrap: anywhere; }
.ct-by .m-chip { margin-left: 4px; padding: 0 8px; font-size: 11px; vertical-align: 1px; }
@container (max-width: 620px) {
  .coverage .m-clause { align-items: center; }
  .coverage .m-clause .m-pill, .coverage .m-clause .m-mark { align-self: center; }
  .coverage .m-clause .m-mark { grid-column: 2; grid-row: 1; }
}

/* The matrix scrolls inside its own box on a narrow screen. */
.ct-never { margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--cyan-line); border-radius: 10px; background: var(--cyan-veil); max-width: 52em; line-height: 1.45; }
.ct-never b { font-weight: 600; }
.ct-scroll { overflow-x: auto; }
.ct-scroll:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.approval-matrix { min-width: 760px; }
.approval-matrix th[scope="row"] { width: 28%; min-width: 220px; }
.approval-matrix th[scope="col"] { vertical-align: bottom; }
.approval-matrix .ct-th-n { display: block; margin-top: 2px; font: 400 12px/1.3 var(--sans); letter-spacing: 0; text-transform: none; color: var(--soft); }
.approval-matrix td { min-width: 120px; }
.approval-matrix td.ct-no { color: var(--soft); }
.approval-matrix .ct-ai { min-width: 175px; }
.approval-matrix .ct-ai .m-mark { white-space: nowrap; }
.approval-matrix tr[data-kind="blocked"] td, .approval-matrix tr[data-kind="blocked"] th { border-top-style: dashed; }

/* On a narrow screen each row of the matrix becomes a card: the change, then one line for each role and for the AI. The roles in the
   markup keep the table's meaning for a screen reader. */
@container (max-width: 700px) {
  .ct-scroll { overflow: visible; }
  .approval-matrix { min-width: 0; }
  .approval-matrix, .approval-matrix tbody, .approval-matrix tr, .approval-matrix th, .approval-matrix td { display: block; }
  .approval-matrix thead { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .approval-matrix tbody tr { padding: 12px 14px; border-top: 1px solid var(--hair); }
  .approval-matrix tbody tr:first-child { border-top: 0; }
  .approval-matrix tbody th, .approval-matrix tbody td { border: 0; padding: 0; }
  .approval-matrix th[scope="row"] { width: auto; min-width: 0; margin-bottom: 8px; }
  .approval-matrix td { min-width: 0; display: grid; grid-template-columns: 124px minmax(0, 1fr); gap: 8px; padding: 3px 0; }
  .approval-matrix td::before { content: attr(data-label); color: var(--soft); font: 500 11.5px/1.6 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }
  .approval-matrix .ct-ai { min-width: 0; }
  .approval-matrix .ct-ai .m-mark { justify-self: start; }
}

/* The ledger: a number and the time, the role and the person, then what was done. */
.ledger li { display: grid; grid-template-columns: 150px 200px minmax(0, 1fr); gap: 4px 16px; align-items: start; padding: 12px 16px; border-top: 1px solid var(--hair); }
.ledger li:first-child { border-top: 0; }
.ledger li[hidden] { display: none; }
.ct-t { display: flex; align-items: center; gap: 10px; }
.ct-t .ct-i { flex: none; min-width: 22px; height: 22px; padding: 0 4px; display: grid; place-items: center; border: 1.5px solid var(--soft); border-radius: 11px; font: 500 11px/1 var(--mono); color: var(--soft); }
.ct-t time { font: 400 12.5px/1.4 var(--mono); color: var(--soft); }
.ct-who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.ct-who .m-chip { color: var(--white); border-color: var(--soft); }
.ct-what { display: grid; gap: 3px; min-width: 0; }
.ct-what b { font-weight: 600; overflow-wrap: anywhere; }
.ct-what .m-sub { overflow-wrap: anywhere; }
@container (max-width: 700px) {
  .ledger li { grid-template-columns: minmax(0, 1fr) auto; }
  .ledger li .ct-t { grid-column: 1; grid-row: 1; }
  .ledger li .ct-who { grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .ledger li .ct-what { grid-column: 1 / -1; }
}
@container (max-width: 400px) {
  .ledger li { grid-template-columns: minmax(0, 1fr); }
  .ledger li .ct-who { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .ledger li .ct-what { grid-row: 3; }
}

/* The registry. */
.ct-reg-sum { margin: 0 0 14px; font-weight: 500; max-width: 52em; }
.ct-reg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ct-ai-card { display: grid; gap: 10px; align-content: start; min-width: 0; }
.ct-ai-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.ct-ai-top b { font-size: 15.5px; font-weight: 600; overflow-wrap: anywhere; }
.ct-ai-card p { overflow-wrap: anywhere; }
.ct-ai-card .m-meta { grid-template-columns: 82px minmax(0, 1fr); }
.ct-ai-card .m-meta dd { overflow-wrap: anywhere; }
.ct-ai-card .m-meta dd .m-pill { margin-left: 4px; }
@container (max-width: 820px) { .ct-reg { grid-template-columns: minmax(0, 1fr); } }
