/* ldu/pages-grid.css: Daniel's legal grids (review_grids: New grid, one grid; 11 Nov 2026).
   Layout and the page's own pieces only; the table, chips, fields, alerts and the modal are the DS components (ldu/components.css). Tokens only
   (bin/ds-lint). A cell's status is a 6px dot in its tone, as the DS chip does, never a fill: standard and answered ok, fallback accent, deviation
   warn, missing and not found neutral, Needs Daniel danger. The table scrolls sideways inside its frame when the columns outgrow the page. */

/* ── New grid ─────────────────────────────────────────────────── */
.grid-new > .ldu-seg { justify-self: start; align-self: start; width: max-content; }
.grid-new__list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.grid-new__list small { display: block; margin-top: 2px; font-size: var(--fs-meta); }
.grid-new__kind { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; max-width: 360px; }
.grid-new__kind .field { flex: 1 1 auto; }
.grid-new__form { gap: 24px; }
.grid-new__form fieldset { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.grid-new__form legend { margin-bottom: 12px; padding: 0; }
.grid-new__docs .field--inline { align-items: flex-start; }
.grid-new__docs .check { margin-top: 2px; }
.grid-new__questions { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .grid-new__questions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── the grid table ───────────────────────────────────────────── */
.grid__table > table { min-width: max-content; }
.grid__table thead th { white-space: normal; min-width: 140px; max-width: 220px; vertical-align: bottom; padding-block: 8px; }
.grid__table thead th:first-child { min-width: 200px; }
.ldu-table th.grid__doc { min-width: 200px; max-width: 280px; vertical-align: top; }
.grid__doc .inline-form { margin-top: 8px; }
.grid__title { display: block; font-weight: 600; color: var(--ink); }
.grid__notice { display: block; margin-top: 4px; font-size: var(--fs-meta); font-weight: 400; line-height: 1.4; color: var(--ink-2); }
.grid__notice[data-tone="warn"] { color: color-mix(in srgb, var(--warn) 70%, var(--ink)); }
.grid__notice[data-tone="danger"] { color: var(--danger); }
.ldu-table td.grid__cell { padding: 0; vertical-align: top; }
.grid__open {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; box-sizing: border-box; width: 100%; min-width: 140px; max-width: 240px;
  padding: 12px; border: 0; background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: background-color var(--dur);
}
.grid__open:hover { background: var(--ldu-wash); }
.grid__open:focus-visible { outline: var(--ring-w) solid var(--ring); outline-offset: calc(var(--ring-w) * -1); }
.ldu-table td.grid__cell[data-required] { background: linear-gradient(var(--danger), var(--danger)) left top / 2px 100% no-repeat; } /* a 2px bar the cell's full height */
.grid__answer { font-size: var(--fs-meta); line-height: 1.4; color: var(--ink-2); }
.grid__flag { font-size: var(--fs-meta); font-weight: 600; color: var(--danger); }
.grid__verdict { font-size: var(--fs-meta); font-weight: 500; color: var(--ink); }
.grid__verdict:empty { display: none; }

/* a status: the word after a dot in its tone */
.grid__status { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-ui); font-weight: 500; color: var(--ink); white-space: nowrap; }
.grid__status::before { content: ""; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--grid-tone, var(--ink-3)); }
.grid__status:is([data-status="standard"], [data-status="answered"]) { --grid-tone: var(--ok); }
.grid__status[data-status="fallback"] { --grid-tone: var(--accent); }
.grid__status[data-status="deviation"] { --grid-tone: var(--warn); }
.grid__status[data-status="needs_daniel"] { --grid-tone: var(--danger); }

/* ── a cell's dialog ──────────────────────────────────────────── */
.grid__dialog .ldu-modal__body { display: grid; gap: 16px; }
.grid__dialog .ldu-modal__body > p { margin: 0; }
.grid__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.grid__meta small { font-size: var(--fs-meta); }
.grid__note { color: var(--ink-2); }
.grid__unverified { display: grid; gap: 8px; padding: 12px 16px; border: 1px dashed var(--line-3); border-radius: var(--r-2); }
.grid__unverified > p { margin: 0; }
.grid__passage {
  margin: 0; padding: 12px 16px; border-left: 2px solid var(--line-3); background: var(--ldu-recess); border-radius: 0 var(--r-2) var(--r-2) 0;
  font-size: var(--fs-ui); line-height: 1.6; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere;
}
.grid__verdict-form { display: grid; gap: 12px; min-width: 0; margin: 0; padding: 16px 0 0; border: 0; border-top: 1px solid var(--line); }
.grid__verdict-form legend { float: left; width: 100%; margin-bottom: 4px; padding: 0; }
.grid__change { display: none; gap: 12px; }
.grid__verdict-form:has(select[data-cell] option[value="change"]:checked) .grid__change { display: grid; }

.grid__release { gap: 12px; }
.grid__release form { display: grid; gap: 12px; justify-items: start; }

/* a phone: the document column narrows so a column of cells shows beside it */
@media (max-width: 639px) {
  .grid__table thead th:first-child, .ldu-table th.grid__doc { min-width: 128px; max-width: 150px; }
}

/* ── the client's side: the released grids under the checks table (portal_reviews/index) and the empty cell of their grid ── */
.ldu-table td.grid__cell--empty { min-width: 140px; }
.grid-list { display: grid; gap: 12px; margin-top: 32px; }
.grid-list__title { margin: 0; font-family: var(--display); font-size: var(--fs-h3); font-weight: 600; color: var(--ink); }
.grid-list__lead { margin: -4px 0 0; font-size: var(--fs-ui); color: var(--ink-2); }
.grid-list__rows { display: grid; margin: 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: var(--ldu-r-xl); background: var(--bg-2); overflow: hidden; }
.grid-list__rows li + li { border-top: 1px solid var(--line); }
.grid-list__link { display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--ink); text-decoration: none; transition: background-color var(--dur); }
.grid-list__link:hover { background: var(--ldu-wash); }
.grid-list__link:focus-visible { outline: var(--ring-w) solid var(--ring); outline-offset: calc(var(--ring-w) * -1); }
.grid-list__main { display: grid; flex: 1 1 auto; min-width: 0; gap: 2px; }
.grid-list__main strong { font-size: var(--fs-ui); font-weight: 600; }
.grid-list__main small { font-size: var(--fs-meta); color: var(--ink-2); }

/* wave 2: dates. A date in a cell, the form's question rows with their "answer as", and the dates list under the table */
.grid__date { font-size: var(--fs-meta); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.grid-new__sets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.grid-new__question { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 8px; }
.grid__dates { display: grid; gap: 12px; }
.grid__dates-head { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-ui); font-weight: 600; color: var(--ink); }
.grid__dates-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.grid__dates-line { display: grid; grid-template-columns: 140px minmax(0, 1fr) auto; align-items: center; gap: 12px; width: 100%; padding: 8px 10px;
  border: 0; border-radius: var(--r-2); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.grid__dates-line:hover { background: var(--bg-2); }
.grid__dates-when { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--ink); }
.grid__dates-matter { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 10px 8px 162px; }
.grid__dates-add { display: flex; align-items: center; gap: 8px; }
.grid__dates-add .select { max-width: 240px; }
@media (max-width: 720px) {
  .grid-new__question { grid-template-columns: 1fr; }
  .grid__dates-line { grid-template-columns: 1fr auto; }
  .grid__dates-when { grid-column: 1 / -1; }
  .grid__dates-matter { justify-content: flex-start; padding-left: 10px; }
  .grid__dates-add { flex: 1 1 100%; }
  .grid__dates-add .select { flex: 1; max-width: none; }
}
