/* Shared form layout and controls (module forms, auth, e-way bill, connectors), the generic record screen and the
   generic list (core/modules.js, core/list_view.js), in the control-tower look (docs/UI_CONTROL_TOWER.md 4.5, 5.4, 5.6)
   and the brand (docs/UI_BRAND.md 8.3): 28 px controls with a turquoise edge on hover and the teal focus border and ring,
   12 px labels, sections as white cards with turquoise-tinted edges, dense tables under an ice head, record numbers as
   teal links. Tokens only (css/tokens.css). */

/* ─── Grid & field shell ─────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 232px), 1fr));
  gap: 12px 14px;
  align-items: start;
}
.fld {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.fld.wide { grid-column: 1 / -1; }
/* the label above a control: 12 px (--fs-small), 600, the secondary ink (docs/UI_CONTROL_TOWER.md 5.6; caps stay for
   table heads, KPI and tile labels and the region headings) */
.fld > label:not(.check-row):not(.ewb2-chk) {
  font: 600 var(--fs-small)/16px var(--font-ui);
  letter-spacing: 0;
  color: var(--ink-2);
}
html:lang(hi) .fld > label:not(.check-row):not(.ewb2-chk) { font-size: var(--fs-body); line-height: 18px; }
.fld label .req { color: var(--crit-text); margin-left: 2px; font-weight: 600; }
/* the auto-fill badge and the "(auto if blank)" note stay quieter than the label */
.fld > label .muted { font-weight: 400; }
.fld .help {
  font-size: var(--fs-meta);
  line-height: var(--lh-meta);
  color: var(--muted);
}
.fld .help.auto { font-style: italic; color: var(--ink-2); }
.fld .err {
  font-size: var(--fs-meta);
  line-height: var(--lh-meta);
  color: var(--crit-text);
  font-weight: 500;
  min-height: 0;
}
.fld .err:empty { display: none; }

/* ─── Text inputs, selects, textareas: 28 px (44 px on a phone, from the tokens) ─── */
.fld input:not([type=checkbox]):not([type=file]):not([type=radio]),
.fld select,
.fld textarea,
.auth-form .fld input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 0 9px;
  background: var(--surface);
  color: var(--ink);
  font: 400 var(--fs-body)/18px var(--font-ui);
  min-height: var(--control-h);
  height: var(--control-h);
  box-shadow: none;
  transition: border-color var(--t-fast) ease, box-shadow var(--t-fast) ease, background var(--t-fast) ease;
}
/* a calm screen (docs/UI_PRO.md 1.2): the control's edge at 3:1 (--edge). Zero weight for .calm and placed here, before
   the hover, focus, disabled and invalid rules, so each of them still wins; a cell of a lines sheet has no box at rest,
   only a hairline under it (the sizes of a calm control are at the end of this sheet) */
:where(.calm) .fld input:not([type=checkbox]):not([type=file]):not([type=radio]),
:where(.calm) .fld select,
:where(.calm) .fld textarea { border-color: var(--edge); }
@media (min-width: 768px) {
  :where(.calm) .fld :where(.lines.sheet td) input:not([type=checkbox]):not([type=file]):not([type=radio]) { border-color: transparent; border-bottom-color: var(--hair); }
}
.fld select[multiple] { height: auto; padding: 4px 6px; }
.fld textarea {
  height: auto;
  padding: 6px 9px;
  min-height: 64px;
  resize: vertical;
}
/* the select's chevron is drawn in the muted token (light and dark), not an image */
.fld select:not([multiple]) {
  appearance: none;
  padding-right: 26px;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.fld input[type=date], .fld input[type=datetime-local], .fld input[type=time], .fld input[type=number] { font-variant-numeric: tabular-nums; }
.fld input:not([type=checkbox]):not([type=file]):not([type=radio]):not(:disabled):hover,
.fld select:not(:disabled):hover, .fld textarea:not(:disabled):hover { border-color: var(--accent-line); }
/* the keyboard's field: the teal border plus a 1 px teal ring (4.8:1 on the field) inside the soft halo (modern.css's) */
.fld input:not([type=checkbox]):not([type=file]):focus,
.fld select:focus,
.fld textarea:focus,
.auth-form .fld input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft);
}
/* a system-filled (readonly) or locked field: the inset fill, a dashed edge, never a hover */
.fld input:not([type=checkbox]):not([type=file]):not([type=radio]):disabled,
.fld select:disabled,
.fld textarea:disabled {
  background-color: var(--surface-2);
  border-style: dashed;
  border-color: var(--line-2);
  color: var(--ink-2);
  cursor: not-allowed;
  box-shadow: none;
}
.fld.invalid input:not([type=checkbox]):not([type=file]),
.fld.invalid select,
.fld.invalid textarea {
  border-color: var(--crit);
  box-shadow: 0 0 0 3px var(--crit-soft);
}
.fld.invalid > label:not(.check-row) { color: var(--crit-text); }

/* every plain checkbox, radio and progress bar in the action teal, not the browser's blue (the toggles below draw their own;
   :where() keeps it at zero specificity, so a sheet that sets its own accent-color, such as the map chrome, still wins) */
:where(input[type=checkbox], input[type=radio], progress) { accent-color: var(--accent); }
/* a rule inside a card (my account's company setting, …): the turquoise-tinted hairline, not the browser's grey groove */
.card-b > hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }

/* ─── Toggle checkboxes ──────────────────────────────────── */
.fld-check .check-row,
.fld > label.ewb2-chk {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding: 4px 9px;
  min-height: var(--control-h);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--t-fast) ease, background var(--t-fast) ease;
}
/* in a grid row the toggle has no label above it: it starts where its neighbours' inputs start (label 16 px + gap 4 px) */
@media (min-width: 768px) {
  .form-grid > .fld-check { padding-top: 20px; }
}
.fld-check .check-row:hover,
.fld > label.ewb2-chk:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}
.fld-check .check-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.fld-check .check-title {
  font: 500 var(--fs-body)/18px var(--font-ui);
  color: var(--ink);
}
.fld-check .check-meta {
  font-size: var(--fs-meta);
  line-height: var(--lh-meta);
  color: var(--muted);
}
.fld-check .check-meta:empty { display: none; }
.fld-check input[type=checkbox],
.fld > label.ewb2-chk input[type=checkbox] {
  flex-shrink: 0;
  width: 30px;
  height: 18px;
  min-height: 0;
  margin: 0;
  appearance: none;
  border: none;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
  cursor: pointer;
  position: relative;
  transition: background var(--t-fast) ease;
}
.fld-check input[type=checkbox]::before,
.fld > label.ewb2-chk input[type=checkbox]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--e1);
  transition: transform var(--t-fast) ease;
}
.fld-check input[type=checkbox]:checked,
.fld > label.ewb2-chk input[type=checkbox]:checked {
  background: var(--accent);
  box-shadow: none;
}
.fld-check input[type=checkbox]:checked::before,
.fld > label.ewb2-chk input[type=checkbox]:checked::before {
  transform: translateX(12px);
}
.fld-check input[type=checkbox]:disabled { opacity: .5; cursor: not-allowed; }
.fld-check input[type=checkbox]:focus-visible,
.fld > label.ewb2-chk input[type=checkbox]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.fld > label.ewb2-chk {
  align-items: center;
  font: 500 var(--fs-body) var(--font-ui);
  color: var(--ink);
}

/* ─── Actions bar (inside a card: the screens of the e-way bill, report builder, API keys, Quick LR) ─── */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin: 14px -11px -10px;
  padding: 8px 11px;
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-md) var(--r-md);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  bottom: 0;
  z-index: 2;
}
.form-actions > .muted:first-child { margin-right: auto; }
.form-actions .btn.primary { padding: 0 14px; font-weight: 600; }

/* ─── Line-item tables ───────────────────────────────────── */
.lines {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow-x: auto;
  background: var(--surface);
}
.lines table { width: 100%; border-collapse: collapse; }
.lines thead th {
  padding: 6px 8px;
  text-align: left;
  font: 600 var(--fs-cap)/14px var(--font-ui);
  letter-spacing: var(--ls-cap);
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  background: var(--ice-1);
  border-bottom: 1px solid var(--line);
}
.lines thead th .req { color: var(--crit-text); margin-left: 2px; }
.lines tbody td {
  padding: 4px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: var(--fs-table);
  vertical-align: top;
  background: var(--surface);
}
.lines tbody tr:last-child td { border-bottom: none; }
.lines tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.lines td input:not([type=checkbox]):not([type=file]),
.lines td select {
  width: 100%;
  min-width: 88px;
  height: 26px;
  min-height: 26px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 0 7px;
  background: var(--surface);
  color: var(--ink);
  font: 400 var(--fs-table) var(--font-ui);
  font-variant-numeric: tabular-nums;
}
.lines td input:not([type=checkbox]):not([type=file]):not(:focus):hover, .lines td select:not(:focus):hover { border-color: var(--accent-line); }
/* a calm screen: a cell's select takes the same edges as its inputs (the rule after the base control rule); here, after
   the cell's base rule and before its focus rule, for the same reason */
:where(.calm .fld) .lines td select { border-color: var(--edge); }
@media (min-width: 768px) {
  :where(.calm .fld) .lines:where(.sheet) td select { border-color: transparent; border-bottom-color: var(--hair); }
}
.lines td input:focus,
.lines td select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.lines td input:disabled, .lines td select:disabled { background: var(--surface-2); color: var(--ink-2); }
.lines [data-add-row] { margin: 6px 8px; }
.lines [data-del-row] { color: var(--muted); }
.lines [data-del-row]:hover { color: var(--crit-text); border-color: var(--crit-line); }

/* ─── Ref lookup ─────────────────────────────────────────── */
.ref-pick { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ref-pick .ref-q {
  height: 26px;
  min-height: 26px;
  border-radius: var(--r-sm);
  padding: 0 8px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--fs-small);
}

/* ─── File uploads ───────────────────────────────────────── */
.file-pick { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.file-cur {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 18px;
  font-size: var(--fs-small);
  min-width: 0;
}
.fld input[type=file],
.lines td input[type=file] {
  padding: 4px 6px;
  min-height: 0;
  font-size: var(--fs-small);
  max-width: 100%;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-2);
}
.fld input[type=file]::file-selector-button, .lines td input[type=file]::file-selector-button {
  height: 20px; margin-right: 8px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r-xs);
  background: var(--surface); color: var(--ink); font: 500 var(--fs-meta) var(--font-ui); cursor: pointer;
}
.lines td .file-pick { min-width: 150px; }
.file-link {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-align: left;
  cursor: pointer;
  word-break: break-all;
}
.file-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ─── Auth (sign-in / sign-up) ───────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.auth-form h2 {
  font: 600 var(--fs-h2)/var(--lh-h2) var(--font-head);
  margin: 0 0 2px;
  letter-spacing: var(--ls-title);
}
.auth-form .fld { gap: 4px; }
.auth-form .fld input { height: 34px; min-height: 34px; }
.auth-form .btn.primary {
  width: 100%;
  height: 34px;
  margin-top: 4px;
  font-weight: 600;
}
.auth-err {
  color: var(--crit-text);
  min-height: 1.2em;
  margin: 0;
  font-size: var(--fs-small);
}

#rec-form .form-grid {
  padding: 2px 0 4px;
}

/* a save a guardrail blocked (core/modules.js guardBox) */
.guard-box { border: 1px solid var(--crit-line); border-left: 3px solid var(--crit); background: var(--crit-soft); color: var(--crit-text); border-radius: var(--r-md); padding: 8px 11px; margin: 0; display: grid; gap: 6px; font-size: var(--fs-small); line-height: var(--lh-small); }
.guard-box label { display: grid; gap: 2px; color: var(--ink); font-size: var(--fs-meta); }
.guard-box input { width: 100%; height: var(--control-h); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 9px; background: var(--surface); color: var(--ink); font-size: var(--fs-body); }
.guard-box .btn { justify-self: start; }

/* ─── The generic form (core/modules.js classicForm): one card, or one card per section, then the actions bar ─── */
#rec-form.gf { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; max-width: 1280px; }
#rec-form.gf > .form-actions {
  margin: 0; padding: 8px 11px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--e2), var(--highlight);
}
#rec-form.gf .card-h .sub { font-family: var(--font-mono); }
#rec-form.gf .card-b { padding: 12px 11px; }

/* ─── Form sections (registry `sections`): on the form a card whose header folds it ─── */
.form-sec > summary { cursor: pointer; list-style: none; }
.form-sec > summary::-webkit-details-marker { display: none; }
.form-sec > summary h3 { margin: 0; font: 600 var(--fs-h3)/var(--lh-h3) var(--font-ui); color: var(--ink); }
.form-sec > summary .sub { color: var(--muted); font: 400 var(--fs-xs)/14px var(--font-mono); white-space: nowrap; }
.form-sec > summary:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-md); }
/* the chevron sits at the right end of the header */
.form-sec > summary::after {
  content: ""; flex: none; margin-left: auto; width: 6px; height: 6px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg); transition: transform var(--t-fast) ease;
}
.form-sec[open] > summary::after { transform: rotate(45deg); }
.form-sec.gf-sec > summary.card-h { user-select: none; }
.form-sec.gf-sec:not([open]) > summary.card-h { border-bottom: 0; }
.form-sec.gf-sec > summary.card-h:hover { background: var(--surface-2); border-radius: var(--r-md) var(--r-md) 0 0; }
.form-sec.gf-sec:not([open]) > summary.card-h:hover { border-radius: var(--r-md); }
/* on the detail screen a folded section is a slim bar that holds its cards */
.form-sec.dt-sec > summary {
  display: flex; align-items: center; gap: 8px; padding: 7px 11px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--e1), var(--highlight);
}
.form-sec.dt-sec > summary:hover { background: var(--surface-2); }
.form-sec.dt-sec > .card { margin-top: 6px; }
.form-sec.dt-sec > .card + .card { margin-top: var(--gap); }

/* ─── The generic record screen (core/modules.js classicDetail) ─── */
.page-h h2.gd-no { font: 600 var(--fs-topbar)/22px var(--font-mono); letter-spacing: 0; }
.gd-head p .st, .gd-head p .pill { margin-left: 2px; }
.gd-body { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
.gd-body > :empty { display: none; }
dl.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px 16px; margin: 0; }
dl.detail-grid > div { min-width: 0; }
dl.detail-grid dt { font: 600 var(--fs-xs)/14px var(--font-ui); letter-spacing: var(--ls-cap); text-transform: uppercase; color: var(--muted); }
html:lang(hi) dl.detail-grid dt { letter-spacing: 0; font-size: var(--fs-meta); }
dl.detail-grid dd { margin: 1px 0 0; font-size: var(--fs-body); line-height: 18px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
dl.detail-grid dd .muted { font-weight: 400; }
.gd-hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: var(--fs-small); line-height: var(--lh-small); color: var(--ink-2); }
.gd-hist li { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px; }
.gd-hist time { font: 500 var(--fs-meta)/16px var(--font-mono); color: var(--muted); white-space: nowrap; }
.card.draft-offer { border-left: 3px solid var(--info); }
.card.draft-offer .card-b { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 11px; font-size: var(--fs-small); }
.card.draft-offer .card-b > span { flex: 1 1 260px; min-width: 0; }

/* ─── The generic list (core/modules.js classicList; docs/UI_CONTROL_TOWER.md 4.5, 5.4) ─── */
/* toolbar: one row of compact controls; a set filter lights up like a pressed chip */
#toolbar.lv-tools { gap: 6px; align-items: center; }
#toolbar.lv-tools .lv-search {
  position: relative; display: inline-flex; align-items: center; flex: 1 1 184px; min-width: 150px; max-width: 240px;
}
#toolbar.lv-tools .lv-search svg {
  position: absolute; left: 8px; width: 13px; height: 13px; stroke: var(--muted); fill: none; stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
#toolbar.lv-tools .lv-search input[type=search] {
  width: 100%; height: var(--control-h); padding: 0 8px 0 27px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink); font: 400 var(--fs-small) var(--font-ui);
}
#toolbar.lv-tools .lv-search input[type=search]:not(:focus):hover { border-color: var(--accent-line); }
#toolbar.lv-tools .lv-search input[type=search]:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft); }
#toolbar.lv-tools select.lv-f, #toolbar.lv-tools input.lv-f {
  height: var(--control-h); max-width: 168px; padding: 0 8px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background-color: var(--surface); color: var(--ink-2); font: 500 var(--fs-small) var(--font-ui); cursor: pointer;
}
/* a filter's chevron in the token colour (light and dark), like the form's selects */
#toolbar.lv-tools select.lv-f {
  appearance: none; padding-right: 24px;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 12px) 50%, calc(100% - 8px) 50%; background-size: 4px 4px, 4px 4px; background-repeat: no-repeat;
}
#toolbar.lv-tools input.lv-f { cursor: text; max-width: 140px; }
#toolbar.lv-tools select.lv-f:hover { background-color: var(--surface-2); border-color: var(--accent-line); color: var(--ink); }
/* a set filter: the pressed chip's soft teal inside its teal edge (4.2:1 on the fill, an indicator) */
#toolbar.lv-tools .lv-f.on { background-color: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
#toolbar.lv-tools .lv-f:focus-visible { outline: none; box-shadow: var(--focus-ring); }
#toolbar.lv-tools .ref-pick { flex-direction: row; align-items: center; gap: 4px; }
#toolbar.lv-tools .ref-pick .ref-q { width: 130px; height: var(--control-h); }
/* the status: a segmented control (base.css .seg: the active choice on the soft teal with its 2 px teal underline), each
   choice with its live count */
#toolbar.lv-tools .lv-seg .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
#toolbar.lv-tools .lv-seg .seg::-webkit-scrollbar { display: none; }
#toolbar.lv-tools .lv-seg .seg button { display: inline-flex; align-items: center; gap: 5px; height: calc(var(--control-h) - 2px); padding: 0 9px; font-size: var(--fs-small); }
#toolbar.lv-tools .lv-seg .n { font: 600 var(--fs-xs)/14px var(--font-ui); color: var(--muted); font-variant-numeric: tabular-nums; }
#toolbar.lv-tools .lv-seg .n:empty { display: none; }
#toolbar.lv-tools .lv-seg .n.zero { color: var(--muted); font-weight: 400; }
#toolbar.lv-tools .lv-seg button.on .n { color: var(--accent-text); }
#toolbar.lv-tools .lv-count { font-size: var(--fs-small); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* with a status control the count (and the money total of a list that fits one page) is its muted note */
#toolbar.lv-tools .lv-note { font-variant-numeric: tabular-nums; }
#toolbar.lv-tools .lv-note .lv-count { font-size: inherit; }
#toolbar.lv-tools .lv-note .lv-count:not(.in-title) + .lv-sum:not(:empty)::before { content: ' · '; }
/* in the desk shell the count is beside the title (nav.js syncCount): the note keeps the total only, or goes */
#toolbar.lv-tools .lv-note:has(> .lv-count.in-title):has(> .lv-sum:empty) { display: none; }
#list-actions .btn svg { width: 12px; height: 12px; }

/* the table: a sticky ice head inside its own scroll box on a desktop, 29 px rows, record numbers as teal mono links,
   numbers right-aligned */
#list-body .lv-card { overflow: hidden; }
#list-body .lv-wrap { border-radius: var(--r-md) var(--r-md) 0 0; }
@media (min-width: 768px) {
  #list-body .lv-wrap { max-height: max(360px, calc(100vh - 210px)); overflow: auto; overscroll-behavior: contain; }
}
#list-body .lv-tbl th { position: sticky; top: 0; z-index: 2; background: var(--ice-1); box-shadow: inset 0 -1px 0 var(--line); }
#list-body .lv-tbl th[data-sort] { cursor: pointer; user-select: none; }
#list-body .lv-tbl th[data-sort]:hover { color: var(--ink); }
#list-body .lv-tbl th[aria-sort="ascending"], #list-body .lv-tbl th[aria-sort="descending"] { color: var(--accent-text); }
#list-body .lv-tbl th:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
#list-body .lv-sort { display: inline-block; min-width: 8px; margin-left: 3px; font-family: var(--font-mono); }
#list-body .lv-tbl td { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
#list-body .lv-tbl tbody tr.clickable { cursor: pointer; }
#list-body .lv-tbl tbody tr.clickable:hover td { background: var(--surface-2); }
#list-body .lv-tbl tbody tr.clickable:focus-visible { outline: none; }
#list-body .lv-tbl tbody tr.clickable:focus-visible td { background: var(--sel); }
/* a late or blocked row on a red edge (a due one says it in its pill only, so the edge keeps its meaning); a phone's card
   carries it */
@media (min-width: 768px) {
  #list-body .lv-tbl tr[data-tone="late"] td:first-child, #list-body .lv-tbl tr[data-tone="blocked"] td:first-child { box-shadow: inset 3px 0 0 var(--crit); }
  #list-body .lv-tbl tr.sel td:first-child, #list-body .lv-tbl tr[aria-selected="true"] td:first-child,
  #list-body .lv-tbl tbody tr.clickable:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
}
#list-body .lv-id { color: var(--ink); text-decoration: none; }
#list-body .lv-id.id-no { font: 600 var(--fs-note)/16px var(--font-mono); letter-spacing: 0; color: var(--accent-text); } /* 5.7:1 on white, 5.0:1 on the selected row */
#list-body .lv-id.lv-name { font-weight: 600; }
#list-body .lv-id:hover { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
#list-body .lv-none { color: var(--muted); }
#list-body .lv-yes { color: var(--good-text); font-weight: 500; }
#list-body .lv-more { font-size: var(--fs-meta); color: var(--muted); }
#list-body .lv-tbl .money { font-weight: 600; }
#list-body .lv-tbl .money.none { font-weight: 400; color: var(--muted); }
#list-body .lv-pct { display: inline-grid; grid-template-columns: 34px 56px; align-items: center; gap: 6px; }
#list-body .lv-pct .bar { min-width: 0; }
#list-body .st-sub { margin-left: 5px; }
/* the count line and the compact pager */
#list-body .lv-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-height: 32px; padding: 4px 6px 4px 11px; border-top: 1px solid var(--line); font-size: var(--fs-meta); color: var(--muted); }
#list-body .lv-foot .pager { margin-left: auto; padding: 0; gap: 6px; font-size: var(--fs-meta); }
#list-body .lv-foot .pager[data-one] .btn { display: none; }
#list-body .lv-empty { margin: 10px; }
#list-body .lv-empty + .lv-foot { display: none; }
#list-body .lv-skel { padding: 6px 11px; }
/* the side panel beside the table (core/list_view.js) */
#list-body .lv-with-panel > .card { min-width: 0; }
/* in the brand: the ice top light and the short turquoise hairline of a KPI cell (backgrounds, so the panel needs no
   positioning when it drops into the flow below 1100 px) */
#list-body .lv-panel {
  --lv-rule: color-mix(in srgb, var(--rule) 75%, transparent);
  max-height: calc(100vh - 120px); overflow: auto;
  background: linear-gradient(var(--lv-rule), var(--lv-rule)) 11px 0 / 28px 2px no-repeat, linear-gradient(180deg, var(--ice-1), var(--surface) 56px), var(--surface);
}
#list-body .lv-panel:focus { outline: none; }
#list-body .lv-panel .lv-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#list-body .lv-panel .kv dd .sub { display: block; font-weight: 400; color: var(--muted); font-size: var(--fs-meta); line-height: var(--lh-meta); }
#list-body .lv-panel .kv dd .plate { font-size: var(--fs-meta); }
#list-body .lv-panel .sp-acts { border-top: 1px solid var(--line); padding-top: 9px; }

/* ═══ The calm scale (docs/UI_PRO.md sections 1 and 2): a screen whose root carries "calm" ═══════════════════════════
   14 px text and 38 px controls (44 px and 16 px on a phone, from the tokens), 8 px radii, the 3:1 edge (set above, by
   the base rule), labels in ink. The rules above and modern.css stay as they are for every screen that is not calm.
   No border-color or box-shadow is written here for a focused control: the focus rule above is the one rule for it
   (tests/ui_foundation.test.js reads it), and a face of the control kit (css/controls.css) shows the same ring. */
.calm .form-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--sp-4) var(--sp-5); }
.calm .fld { gap: 6px; }
.calm .fld > label:not(.check-row):not(.ewb2-chk) { color: var(--ink); font: 600 var(--fs-body)/var(--lh-body) var(--font-ui); letter-spacing: 0; }
.calm .fld > label .muted { font-weight: 400; }
.calm .fld .help { color: var(--muted); font-size: var(--fs-small); line-height: var(--lh-small); }
.calm .fld .help.auto { font-style: normal; }
.calm .fld .err { font-size: var(--fs-small); line-height: var(--lh-small); font-weight: 500; }
.calm .fld input:not([type=checkbox]):not([type=file]):not([type=radio]),
.calm .fld select,
.calm .fld textarea {
  height: var(--h-ctl); min-height: var(--h-ctl); padding: 0 12px; border-radius: var(--r-md); font-size: var(--fs-ctl); line-height: var(--lh-ctl);
}
/* a native select that stays (a phone, a cell of a lines table): the same thin chevron the kit's list draws, from the
   token (:not(#\#) because base.css draws every select's chevron at that weight) */
.calm .fld select:not([multiple]):not(#\#) {
  padding-right: 36px;
  background-image: linear-gradient(to bottom left, transparent calc(50% - .75px), var(--muted) calc(50% - .75px), var(--muted) calc(50% + .75px), transparent calc(50% + .75px)),
    linear-gradient(to bottom right, transparent calc(50% - .75px), var(--muted) calc(50% - .75px), var(--muted) calc(50% + .75px), transparent calc(50% + .75px));
  background-size: 5px 5px, 5px 5px; background-position: calc(100% - 19px) calc(50% + 1px), calc(100% - 14px) calc(50% + 1px);
}
/* inside the control kit's wrapper the chevron is the wrapper's: the 16 px outline path the list and the combobox draw
   (css/controls.css section 3), so one row never shows two chevrons of different weight */
.calm .fld .cc > select:not([multiple]):not(#\#) { background-image: none; }
.calm .fld select[multiple] { height: auto; padding: 6px 8px; }
.calm .fld textarea { height: auto; min-height: 80px; max-height: 240px; padding: 9px 12px; field-sizing: content; }
.calm .fld input:not([type=checkbox]):not([type=file]):not([type=radio]):not(:focus):not(:disabled):hover,
.calm .fld select:not(:focus):not(:disabled):hover,
.calm .fld textarea:not(:focus):not(:disabled):hover { border-color: var(--edge-2); }
/* a value the system fills: a quiet inset block, no dashed box */
.calm .fld input:not([type=checkbox]):not([type=file]):not([type=radio]):disabled,
.calm .fld select:disabled,
.calm .fld textarea:disabled { background-color: var(--inset); border-style: solid; border-color: var(--hair); color: var(--ink-2); }
.calm .ref-pick .ref-q { background: var(--surface); }
/* the switch (2.10): no box round the row, a 36 by 20 track, the whole row the click target */
.calm .fld-check .check-row { align-items: center; gap: 12px; min-height: var(--h-ctl); padding: 0; border: 0; border-radius: var(--r-md); background: transparent; }
.calm .fld-check .check-row:hover { border-color: transparent; background: transparent; }
.calm .fld-check input[type=checkbox] { width: 36px; height: 20px; background: var(--edge); box-shadow: none; }
.calm .fld-check input[type=checkbox]::before { width: 16px; height: 16px; box-shadow: var(--e-card); }
.calm .fld-check input[type=checkbox]:checked { background: var(--accent); }
.calm .fld-check input[type=checkbox]:checked::before { transform: translateX(16px); }
.calm .fld-check input[type=checkbox]:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.calm .fld-check .check-copy { gap: 0; }
.calm .fld-check .check-title { font: 600 var(--fs-body)/var(--lh-body) var(--font-ui); }
.calm .fld-check .check-meta { display: flex; flex-wrap: wrap; gap: 0 8px; font-size: var(--fs-small); line-height: var(--lh-small); }
.calm .form-grid > .fld-check { grid-column: 1 / -1; padding-top: 0; }
@media (min-width: 768px) {
  /* a cell of a lines sheet: 32 px, its box and the ring only with the focus */
  .calm .fld .lines.sheet td input:not([type=checkbox]):not([type=file]):not([type=radio]),
  .calm .fld .lines.sheet td select { height: var(--h-ctl-sm); min-height: var(--h-ctl-sm); min-width: 64px; padding: 0 8px; border-radius: var(--r-sm); background-color: transparent; }
  /* a select is as wide as its longest choice (never cut), and fills its cell when the cell is wider */
  .calm .fld .lines.sheet td select:not([multiple]):not(#\#) { width: auto; min-width: 100%; padding-right: 30px; background-position: calc(100% - 14px) calc(50% + 1px), calc(100% - 9px) calc(50% + 1px); }
  .calm .fld .lines.sheet td input[type=number] { min-width: 72px; }
  .calm .fld .lines.sheet td input[type=date], .calm .fld .lines.sheet td input[type=datetime-local], .calm .fld .lines.sheet td input[type=time] { min-width: 120px; }
  .calm .fld .lines.sheet td input:not([type=checkbox]):not([type=file]):not([type=radio]):focus,
  .calm .fld .lines.sheet td select:focus { background-color: var(--surface); }
  /* a column the system fills reads as plain text */
  .calm .fld .lines.sheet td input:not([type=checkbox]):not([type=file]):not([type=radio]):disabled,
  .calm .fld .lines.sheet td select:disabled { border-color: transparent; background-color: transparent; background-image: none; color: var(--ink-2); }
}

/* ─── The generic form (docs/UI_PRO.md section 3; core/modules.js classicForm, core/form_plan.js) ───────────────────
   The page: a section index on a wide screen and the form column. The column: a lede, the first card (what a person
   must answer, with the status), the opened sections as cards, the folded ones as named tiles two across, and the
   action bar docked on the pane's bottom edge (core/controls.js dockBar() measures the pane's padding into --dock-l,
   --dock-r and --dock-b). Tokens only. */
.cf { min-width: 0; max-width: var(--w-form); }
.cf-col { display: flex; flex-direction: column; gap: var(--sp-3); min-width: 0; }
/* a short form keeps its bar on the pane's bottom edge: the screen is as tall as the pane and the column fills it */
.main > .screen:has(> .cf) { display: flex; flex-direction: column; min-height: 100%; }
.screen > .cf { flex: 1 0 auto; display: flex; flex-direction: column; }
.cf > .cf-col, .cf-col > #rec-form.gf { flex: 1 0 auto; }
.cf-index { display: none; }
.cf svg { fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.cf-lede { margin: var(--sp-1) 2px var(--sp-1); max-width: 86ch; color: var(--ink-2); font: 400 var(--fs-ctl)/var(--lh-ctl) var(--font-ui); }
.cf-lede .id-no { color: var(--ink); }
html[lang="hi"] .cf-lede .cf-about { display: none; } /* the registry's own sentence about the module is English only */
#rec-form.gf.calm { max-width: none; gap: var(--sp-3); }

/* the first card and every opened section: a white card on a hairline */
.cf-card, .cf-sec { min-width: 0; border: 1px solid var(--hair); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--e-card); }
.cf-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--sp-4) var(--sp-4); padding: var(--sp-5) var(--sp-6) var(--sp-6); }
.cf-card > * { grid-column: 1 / -1; min-width: 0; }
.cf-card-h { display: flex; align-items: center; gap: 10px; min-height: 30px; }
.cf-card-h h3, .cf-sec > summary h3 { margin: 0; color: var(--ink); font: 600 var(--fs-sec)/var(--lh-sec) var(--font-ui); letter-spacing: 0; }
#rec-form.gf.calm .form-grid { padding: 0; }
/* the status: a few short words sit on the head's line, at its right; a longer list is the first cell of the grid */
.cf-status.is-seg { flex-direction: row; align-items: center; gap: 10px; }
.cf-status.is-seg > label:not(.check-row):not(.ewb2-chk) { color: var(--muted); font-weight: 400; }
@media (min-width: 768px) {
  .cf-card > .cf-card-h { grid-column: 1; grid-row: 1; }
  .cf-card > .cf-status.is-seg { grid-column: 2; grid-row: 1; justify-self: end; margin: -4px 0; }
  .cf-first { position: relative; }
  .cf-first > .card-b > .cf-status.is-seg { position: absolute; top: var(--sp-4); right: var(--sp-6); }
  .cf-first > summary { padding-right: 320px; }
}
/* a sub-head inside a long card */
.cf-sub { grid-column: 1 / -1; margin: var(--sp-2) 0 calc(-1 * var(--sp-1)); padding-top: var(--sp-4); border-top: 1px solid var(--hair); color: var(--ink); font: 600 var(--fs-body)/var(--lh-body) var(--font-ui); }
.cf-sub:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.cf-fix { flex: none; }

/* sections: the stack of opened cards, then the tiles two across */
.cf-open, .cf-tiles { display: grid; gap: var(--sp-3); min-width: 0; }
.cf-open:empty, .cf-tiles:empty { display: none; }
.cf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.cf-sec > summary { display: flex; align-items: center; gap: 12px; min-height: 56px; box-sizing: border-box; padding: 8px 14px 8px 16px; border-radius: inherit; list-style: none; cursor: pointer; user-select: none; }
.cf-sec > summary::after { content: none; }
.cf-sec > summary:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--r-lg); }
.cf-sec:not([open]) > summary:hover { background: var(--inset); }
.cf-ti { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-md); background: var(--inset-2); color: var(--ink-2); }
.cf-ti svg { width: 16px; height: 16px; }
.cf-sec.has-value .cf-ti { background: var(--accent-soft); color: var(--accent-text); }
.cf-sec-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cf-sec:not([open]) > summary h3 { font-size: var(--fs-ctl); line-height: var(--lh-ctl); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-sec-p { overflow: hidden; color: var(--muted); font: 400 var(--fs-small)/var(--lh-small) var(--font-ui); text-overflow: ellipsis; white-space: nowrap; }
.cf-sec-p b { color: var(--ink-2); font-weight: 600; }
.cf-sec-p:empty { display: none; }
.cf-sec-m { flex: none; color: var(--muted); font: 400 var(--fs-small)/var(--lh-small) var(--font-ui); font-variant-numeric: tabular-nums lining-nums; white-space: nowrap; }
.cf-sec-x { flex: none; display: grid; place-items: center; width: 20px; height: 20px; color: var(--muted); }
.cf-sec-x svg { width: 16px; height: 16px; transition: transform var(--t-fast) var(--ease); }
.cf-sec-x svg + svg, .cf-sec.is-lines.is-empty:not([open]) .cf-sec-x svg:first-child { display: none; }
.cf-sec.is-lines.is-empty:not([open]) .cf-sec-x svg + svg { display: block; }
/* Find a field: a tile without a match steps back (its mark fades, its title goes quiet: the words keep their contrast),
   a tile with one takes the accent */
.cf-sec.cf-dim { box-shadow: none; }
.cf-sec.cf-dim .cf-ti { opacity: .4; }
.cf-sec.cf-dim > summary h3 { color: var(--ink-2); font-weight: 400; }
.cf-sec.cf-match { border-color: var(--accent); }
.cf-sec.cf-match .cf-ti { background: var(--accent-soft); color: var(--accent-text); }
/* an opened section is a full card: its title in the card's size, no preview, the chevron folds it */
.cf-sec[open] > summary { min-height: 0; padding: var(--sp-5) var(--sp-5) 0 var(--sp-6); }
.cf-sec[open] > summary .cf-ti, .cf-sec[open] > summary .cf-sec-p, .cf-sec[open] > summary .cf-sec-m { display: none; }
.cf-sec[open] > summary .cf-sec-x svg { transform: rotate(180deg); }
.cf-sec[open] > summary:hover .cf-sec-x { color: var(--ink); }
.cf-sec.cf-first > summary { cursor: default; }
#rec-form.gf.calm .cf-sec > .card-b { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6) var(--sp-6); }
/* a child table in its own card: the card's title names it */
.cf-sec.is-lines .cf-lines > label, .cf-card .cf-lines:only-child > label { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* the heading of the folded part: what is in it, Find a field, Open all */
.cf-more-h { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: var(--h-ctl-sm); margin: var(--sp-2) 2px 0; }
.cf-more-h[hidden] { display: none; }
.cf-more-h h3 { margin: 0; color: var(--ink); font: 600 var(--fs-sec)/var(--lh-sec) var(--font-ui); }
.cf-more-h p { flex: 1 1 160px; min-width: 0; margin: 0; color: var(--muted); font: 400 var(--fs-body)/var(--lh-body) var(--font-ui); }
.cf-find { position: relative; flex: 0 1 200px; display: inline-flex; align-items: center; min-width: 140px; }
.cf-find svg { position: absolute; left: 10px; width: 14px; height: 14px; color: var(--muted); pointer-events: none; }
.cf-find input { width: 100%; height: var(--h-ctl-sm); box-sizing: border-box; padding: 0 10px 0 30px; border: 1px solid var(--edge-2); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: 400 var(--fs-body)/var(--lh-body) var(--font-ui); }
.cf-find input:hover { border-color: var(--ink-2); }
.cf-find input:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring-ctl); }
.fld.cf-hit { border-radius: var(--r-md); box-shadow: 0 0 0 6px var(--accent-soft); background: var(--accent-soft); }

/* values the system fills: the label over the value as text, three across; the disabled control stays, out of sight */
.cf-auto { grid-column: 1 / -1; padding: 14px var(--sp-4) var(--sp-4); border-radius: var(--r-lg); background: var(--inset); }
.cf-auto-h { display: flex; align-items: flex-start; gap: 2px 7px; margin: 0 0 10px; color: var(--ink-2); font: 600 var(--fs-small)/var(--lh-small) var(--font-ui); }
.cf-auto-h svg { flex: none; width: 14px; height: 14px; margin-top: calc((var(--lh-small) - 14px) / 2); color: var(--muted); } /* (beside its sentence's first line, at any width) */
.cf-auto-h b { flex: none; }
.cf-auto-h span { min-width: 0; color: var(--muted); font-weight: 400; }
.cf-auto-g { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px var(--sp-5); }
.calm .cf-auto .fld { gap: 1px; }
.calm .cf-auto .fld > label:not(.check-row):not(.ewb2-chk) { color: var(--muted); font: 400 var(--fs-small)/var(--lh-small) var(--font-ui); }
.cf-ro-v { color: var(--ink); font: 500 var(--fs-ctl)/var(--lh-ctl) var(--font-ui); font-variant-numeric: tabular-nums lining-nums; overflow-wrap: anywhere; }
.cf-ro-v .muted { font-weight: 400; }
.cf-ro-c { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cf-auto.is-later { padding: 10px var(--sp-4); }
.cf-auto.is-later .cf-auto-h { margin: 0; font-weight: 400; }
.cf-auto.is-later .cf-auto-g { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); }

/* a field's error says so in words, with a mark; GSTIN: Fetch details and its answer under the field */
.calm .fld.invalid .err:not(:empty), .calm .fld.has-err > .err:not(:empty) { display: flex; align-items: flex-start; gap: 6px; }
.calm .fld.invalid .err:not(:empty)::before, .calm .fld.has-err > .err:not(:empty)::before { content: "!"; flex: none; display: grid; place-items: center; width: 14px; height: 14px; margin-top: 1px; border-radius: 50%; background: var(--crit-soft); color: var(--crit-text); font: 600 var(--fs-xs)/1 var(--font-ui); }
.calm .cc.cf-gst { display: flex; align-items: center; gap: 8px; }
.calm .cc.cf-gst > input { flex: 1 1 0; min-width: 0; }
.calm .cc.cf-gst > .cf-gst-b { flex: none; }
.cf-gst-r { color: var(--muted); font: 400 var(--fs-small)/var(--lh-small) var(--font-ui); }
.cf-gst-r[hidden] { display: none; }
.cf-gst-r.ok { color: var(--good-text); }
.cf-gst-r.bad { color: var(--crit-text); font-weight: 500; }

/* a refused line of a child table: the message under the table, a red edge on the table and on the one cell the server named */
.calm .fld.has-err > .lines { border-color: var(--crit-line); }
.calm .fld.has-err td.cf-bad input:not([type=checkbox]):not([type=file]):not([type=radio]):not(:focus),
.calm .fld.has-err td.cf-bad select:not(:focus),
.calm .fld.has-err td.cf-bad textarea:not(:focus),
.calm .fld.has-err td.cf-bad .cc-affix:not(:focus-within),
.calm .fld.has-err td.cf-bad .cc-face:not(:focus-visible) { border-color: var(--crit); box-shadow: var(--ring-crit); }
.calm .fld.has-err td.cf-bad::before { color: var(--crit-text); }

/* the block of a refused save and the draft offer */
.guard-box.cf-guard { margin: 0; padding: 14px var(--sp-4); font: 400 var(--fs-ctl)/var(--lh-ctl) var(--font-ui); }
.guard-box.cf-guard .guard-msg { color: var(--ink); }
.guard-box.cf-guard .cf-guard-why { flex: 1 1 260px; display: grid; gap: 4px; min-width: 0; color: var(--ink); font: 600 var(--fs-body)/var(--lh-body) var(--font-ui); }
.guard-box.cf-guard .cf-guard-why input { width: 100%; height: var(--h-ctl); box-sizing: border-box; padding: 0 12px; border: 1px solid var(--edge); border-radius: var(--r-md); background: var(--surface); color: var(--ink); font: 400 var(--fs-ctl)/var(--lh-ctl) var(--font-ui); }
.guard-box.cf-guard .cf-guard-why input:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring-ctl); }
.guard-box.cf-guard .acts { align-items: flex-end; }
.guard-box.cf-guard .acts .btn { height: var(--h-ctl); justify-self: auto; }
.card.draft-offer.calm { border: 1px solid var(--hair); border-left: 3px solid var(--info); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--e-card); }
.card.draft-offer.calm .card-b { gap: 8px 10px; padding: 12px var(--sp-4); font: 400 var(--fs-ctl)/var(--lh-ctl) var(--font-ui); }
.card.draft-offer.calm .card-b > .pill { flex: none; }
.card.draft-offer.calm .card-b > .cf-draft-t { flex: 1 1 260px; min-width: 0; color: var(--ink); }

/* the action bar, docked: one sentence about the form's state, Cancel, Save and add another, the one primary */
#rec-form.gf.calm > .form-actions {
  position: sticky; bottom: calc(-1 * var(--dock-b, 0px)); z-index: 20; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px;
  min-height: 64px; box-sizing: border-box; margin: auto calc(-1 * var(--dock-r, 0px)) calc(-1 * var(--dock-b, 0px)) calc(-1 * var(--dock-l, 0px));
  padding: 12px var(--dock-r, var(--sp-4)) 12px var(--dock-l, var(--sp-4)); border: 0; border-top: 1px solid var(--hair); border-radius: 0;
  background: var(--surface); box-shadow: var(--e-bar); backdrop-filter: none;
}
#rec-form.gf.calm > .form-actions .btn.primary { padding: 0 16px; }
.cf-bar-s { flex: 1 1 220px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; margin: 0; color: var(--muted); font: 400 var(--fs-body)/var(--lh-body) var(--font-ui); }
.cf-bar-s [hidden] { display: none; }
.cf-bar-s b { color: var(--ink); font-weight: 600; }
.cf-bar-go { min-width: 0; min-height: 32px; margin: 0 -6px; padding: 4px 6px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-2); font: inherit; text-align: left; cursor: pointer; }
.cf-bar-go:hover { text-decoration: underline; text-underline-offset: 3px; }
.cf-bar-go:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.cf-bar-go.bad, .cf-bar-go.bad b { color: var(--crit-text); }
.cf-bar-ok { color: var(--ink-2); }
.cf-bar-bad, .cf-bar-bad b { color: var(--crit-text); } /* a save that failed without naming a field */
/* a bar too narrow to keep its buttons on one row (a tablet, the agent panel open) drops "Save and add another", as a
   phone does; and the pane keeps what has the keyboard clear of the bar, however tall the bar is (core/modules.js
   fitBar() measures both; the kit's dockBar() writes a fixed 88 px inline, so this rule is the one that must win) */
#rec-form.gf.calm > .form-actions.is-tight [data-cf-again] { display: none; }
.cf-pane { scroll-padding-bottom: var(--cf-clear, 88px) !important; }
.cf-bar-s [data-draft-hint]:not(:empty)::before { content: "·"; margin-right: 10px; }
/* a refused save's sentence can be long: the draft hint then takes a line of its own, without a dot to start it */
.cf-bar-s:has([data-cf-failed]) [data-draft-hint] { flex-basis: 100%; }
.cf-bar-s:has([data-cf-failed]) [data-draft-hint]::before { content: none; }
.cf-bar-ask { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }
/* a toast sits above the docked bar, never over its sentence */
body:has(#rec-form.gf.calm > .form-actions.is-docked) #toast.toast { bottom: 80px; }

@media (min-width: 1280px) {
  /* the section index beside the column (a form of four or more sections) */
  .screen > .cf.has-index { display: grid; grid-template-columns: var(--w-index) minmax(0, var(--w-form)); gap: 0 var(--sp-8); align-items: start; max-width: calc(var(--w-index) + var(--sp-8) + var(--w-form)); }
  .cf.has-index > .cf-col { align-self: stretch; }
  .cf.has-index > .cf-index { position: sticky; top: 0; display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - var(--topbar-h) - 100px); padding: var(--sp-1) 0 var(--sp-2); overflow-y: auto; scrollbar-width: thin; font: 400 var(--fs-body)/var(--lh-body) var(--font-ui); }
}
@media (min-width: 1280px) and (max-width: 1639px) {
  /* with the agent panel open the column keeps its width and the index folds */
  .app.copilot-open .screen > .cf.has-index { display: flex; max-width: var(--w-form); }
  .app.copilot-open .cf.has-index > .cf-index { display: none; }
}
.cf-index-t { margin: 0; padding: 0 10px 6px; color: var(--muted); font: 600 var(--fs-small)/var(--lh-small) var(--font-ui); }
.cf-index a + .cf-index-t { padding-top: 14px; }
.cf-index a { flex: none; display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 0 10px; border-radius: var(--r-md); color: var(--ink-2); text-decoration: none; }
.cf-index a:hover { background: var(--inset-2); color: var(--ink); }
.cf-index a[aria-current="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--e-card), inset 0 0 0 1px var(--hair); }
.cf-index a:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
.cf-index-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-index-p { margin: var(--sp-4) 10px 0; padding-top: 14px; border-top: 1px solid var(--hair); color: var(--muted); font: 400 var(--fs-small)/var(--lh-small) var(--font-ui); }
.cf-index-p b { color: var(--ink); font-weight: 600; }
.cf-meter { flex: none; height: 4px; margin: 8px 10px 0; border-radius: 2px; background: var(--inset-2); overflow: hidden; }
.cf-meter > i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
/* a bullet says state only: a ring (empty), a tick (holds a value), a filled dot (here), a red mark (to fix) */
.cf-b { flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--edge); color: var(--muted); font: 600 var(--fs-xs)/1 var(--font-ui); }
.cf-b svg { width: 12px; height: 12px; stroke-width: 2.4; }
.cf-b.done { background: var(--accent-soft); box-shadow: none; color: var(--accent-text); }
.cf-b.now { background: var(--surface); box-shadow: inset 0 0 0 5.5px var(--accent); }
.cf-b.err { background: var(--crit-soft); box-shadow: none; color: var(--crit-text); }


/* ─── Phone: a list's rows become cards (identity and status on the first line, the rest as labelled cells) ─── */
@media (max-width: 767px) {
  .form-grid { gap: 12px; }
  .form-actions {
    margin-left: -11px;
    margin-right: -11px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }
  #rec-form.gf > .form-actions { margin: 0 calc(-1 * var(--gutter)); border-radius: 0; border-width: 1px 0 0; padding: 8px var(--gutter) max(8px, env(safe-area-inset-bottom)); }
  #rec-form.gf > .form-actions .btn { flex: 1 1 0; }
  #rec-form.gf > .form-actions > .muted:first-child { flex-basis: 100%; }
  .fld-check .check-row { min-height: var(--control-h-touch); align-items: center; }
  .gd-hist li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  /* a file field is a 44 px touch target like the other controls, its button a 36 px small button */
  .fld input[type=file] { min-height: var(--control-h-touch); padding: 5px 8px; }
  .fld input[type=file]::file-selector-button { height: 32px; padding: 0 10px; font-size: var(--fs-small); }
  #toolbar.lv-tools .lv-search { flex: 0 0 auto; min-width: 0; max-width: none; }
  /* the desk shell's toolbar is already a sideways strip on a phone: the status control rides in it whole instead of
     scrolling a second time inside it */
  .app.shell.desk #toolbar.lv-tools .lv-seg { max-width: none; flex-wrap: nowrap; }
  .app.shell.desk #toolbar.lv-tools .lv-seg .seg { flex: none; max-width: none; overflow: hidden; }
  #list-body .lv-tbl, #list-body .lv-tbl tbody { display: block; width: 100%; }
  #list-body .lv-tbl thead { display: none; }
  #list-body .lv-tbl tbody tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line);
  }
  #list-body .lv-tbl tbody tr:last-child { border-bottom: 0; }
  #list-body .lv-tbl tbody tr:nth-child(even) td, #list-body .lv-tbl tbody tr:hover td { background: transparent; }
  #list-body .lv-tbl tbody tr:hover { background: var(--surface-2); }
  #list-body .lv-tbl tbody tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  #list-body .lv-tbl tbody tr.clickable:focus-visible td { background: transparent; }
  #list-body .lv-tbl tr[data-tone="late"], #list-body .lv-tbl tr[data-tone="blocked"] { box-shadow: inset 3px 0 0 var(--crit); }
  #list-body .lv-tbl tbody tr td, #list-body .lv-tbl tbody tr td:first-child { display: block; height: auto; max-width: none; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; text-align: left; box-shadow: none; }
  #list-body .lv-tbl td::before { content: attr(data-label); display: block; margin-bottom: 1px; font: 600 var(--fs-xs)/14px var(--font-ui); letter-spacing: var(--ls-cap); text-transform: uppercase; color: var(--muted); }
  #list-body .lv-tbl td.lv-idc { grid-column: 1; grid-row: 1; font-size: var(--fs-body); }
  #list-body .lv-tbl td.lv-stc { grid-column: 2; grid-row: 1; text-align: right; }
  #list-body .lv-tbl td.lv-idc::before, #list-body .lv-tbl td.lv-stc::before { display: none; }
  #list-body .lv-tbl td.lv-stc .st-sub { display: block; margin: 2px 0 0; white-space: normal; }
  #list-body .lv-foot .pager .btn { min-height: 36px; }
  /* the calm scale on a phone: one field across, 44 px controls (--control-h is the touch height here), 16 px text */
  .calm .fld input:not([type=checkbox]):not([type=file]):not([type=radio]),
  .calm .fld select { min-height: var(--control-h); height: var(--control-h); font-size: 16px; }
  .calm .fld textarea { font-size: 16px; }
  .calm .fld-check .check-row { min-height: var(--control-h-touch); }
  /* the generic form on a phone (3.13): cards edge to edge with 16 px padding, the status under the title, tiles one
     across, an opened section's title bar sticks under the top bar (-12 px: the pane's own top padding), the bar's
     sentence above its two buttons */
  .cf { margin: 0 calc(-1 * var(--gutter)); }
  .cf-lede, .cf-more-h { margin-left: var(--gutter); margin-right: var(--gutter); }
  .card.draft-offer.calm { border-radius: 0; border-right: 0; }
  .cf-card, .cf-sec { border-radius: 0; border-left: 0; border-right: 0; }
  .cf-card { padding: var(--sp-4); }
  .cf-status.is-seg { flex-direction: column; align-items: stretch; gap: 6px; }
  .cf-tiles { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cf-tiles > .cf-sec + .cf-sec { border-top: 0; }
  .cf-tiles > .cf-sec { box-shadow: none; }
  .cf-sec > summary { padding: 8px var(--gutter); }
  .cf-sec[open] > summary { position: sticky; top: -12px; z-index: 3; min-height: 48px; padding: var(--sp-3) var(--gutter); border-bottom: 1px solid var(--hair); border-radius: 0; background: var(--surface); }
  .cf-sec.cf-first > summary { position: static; border-bottom: 0; padding-bottom: 0; }
  .cf-sec-x { width: 28px; height: 28px; }
  /* a tile's title is never larger than the card titles above it (the control size is 16 px on a phone) */
  .cf-sec:not([open]) > summary h3 { font-size: var(--fs-sec); line-height: var(--lh-sec); }
  /* the registry's sentence about the module stays off a phone: the first field comes sooner */
  .cf-lede .cf-about { display: none; }
  .cf-bar-go { min-height: 36px; }
  #rec-form.gf.calm .cf-sec > .card-b { padding: var(--sp-4); }
  .cf-auto-g { grid-template-columns: minmax(0, 1fr); }
  .cf-more-h p { flex: 1 1 60%; }
  .cf-find { flex: 1 1 180px; }
  .cf-find input { height: var(--control-h-touch); font-size: 16px; }
  .guard-box.cf-guard { border-radius: 0; border-right: 0; }
  .guard-box.cf-guard .cf-guard-why input { height: var(--control-h-touch); font-size: 16px; }
  #rec-form.gf.calm > .form-actions { gap: 8px 10px; padding: 10px max(var(--dock-r, 0px), var(--gutter)) max(10px, env(safe-area-inset-bottom)) max(var(--dock-l, 0px), var(--gutter)); }
  #rec-form.gf.calm > .form-actions .btn { flex: 1 1 0; height: var(--control-h-touch); }
  #rec-form.gf.calm > .form-actions .btn.primary { flex: 1.6 1 0; }
  #rec-form.gf.calm > .form-actions [data-cf-again] { display: none; }
  .cf-bar-s { flex: 1 0 100%; }
  .cf-what.is-long { display: none; }
  body:has(#rec-form.gf.calm > .form-actions.is-docked) #toast.toast { bottom: 190px; }
  .cf-bar-ask .btn { flex: none; }
}
