/* The chat's quick actions and forms (round 3, package C4: docs/CHAT_ROUND3_SPEC.md 5.8).
   The sheet is the page's own #sheet; the fields are the same in the sheet and inside a decision
   card in the thread. No new colour and no new font: the Simple layout's tokens. Every target is
   at least 44 px on a phone. */

/* the sheet: full height on a phone, 560 by at most 720 on a desk */
.sheetcard.qa-sheet { width: min(560px, 100%); }
@media (max-width: 899px) {
  .sheetcard.qa-sheet { height: calc(100% - env(safe-area-inset-top)); max-height: none; }
}
@media (min-width: 900px) {
  .sheetcard.qa-sheet { height: min(720px, calc(100% - 48px)); max-height: 720px; }
}
.qa-sheet .qa-body { flex: 1 1 auto !important; min-height: 0; display: flex; flex-direction: column; }
.qa-quiet { color: var(--muted); font-size: 15px; line-height: 1.45; margin: 12px 0; }
.qa-bad, .qa-quiet.qa-bad { color: var(--bad, #d64545); }

/* the search: 16 px so a phone never zooms, 44 px tall */
.qa-sheet input.qa-search { width: 100%; box-sizing: border-box; font-size: 16px; min-height: 44px; height: 44px; margin: 4px 0 8px;
  padding: 0 14px; border-radius: 12px; }
.qa-list { flex: 1 1 auto; min-height: 0; }
.qa-group[hidden], .qa-li[hidden], .qa-none[hidden] { display: none; }
.qa-head { font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--muted); margin: 14px 4px 4px; text-transform: none; }
.qa-rows { list-style: none; margin: 0; padding: 0; }
.qa-li { margin: 0; padding: 0; }
/* one row a tool: 56 px, its words on one line, its price class at the right */
.qa-sheet .qa-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 12px; margin: 0;
  border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); text-align: left;
  font-size: 16px; line-height: 1.3; justify-content: flex-start; box-shadow: none; }
.qa-sheet .qa-row:hover, .qa-sheet .qa-row:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.qa-says { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-cost { flex: none; font-size: 13px; color: var(--muted); white-space: nowrap; }
.qa-cost-money { color: var(--warn, #d9822b); }
.qa-none { color: var(--muted); font-size: 15px; margin: 16px 4px; }

/* a card or a form inside the sheet */
.qa-wrap { list-style: none; margin: 0; padding: 0; }
.qa-cardli { margin: 0; padding: 0; }
.qa-card { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; min-width: 0; }
.qa-verdict { font-size: 17px; line-height: 1.45; margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.qa-facts { margin: 0; display: grid; gap: 8px; }
.qa-facts > div { min-width: 0; }
.qa-facts dt { font-size: 13px; color: var(--muted); }
.qa-facts dd { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
.qa-warn { margin: 0; font-size: 14px; line-height: 1.45; color: var(--warn, #d9822b); }
.qa-issue { margin: 0; font-size: 14px; color: var(--bad, #d64545); }
.qa-issue[hidden] { display: none; }
.qa-issue.qa-todo { color: var(--muted); }
.qa-after { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); min-height: 1em; }
.qa-after.qa-bad { color: var(--bad, #d64545); }
/* the main button stays in view while the fields scroll, as every sheet's actions do */
.qa-sheet .qa-foot { position: sticky; bottom: calc(-22px - env(safe-area-inset-bottom)); z-index: 2; background: var(--panel);
  margin: 4px -20px calc(-22px - env(safe-area-inset-bottom)); padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.qa-acts { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; }
.qa-acts button { min-height: 44px; height: 44px; padding: 0 16px; white-space: nowrap; flex: 0 1 auto; min-width: 0; }
.qa-acts .qa-main { font-variant-numeric: tabular-nums; overflow: hidden; }
/* grey while it waits for its own price: never the primary colour on a button that does nothing */
.qa-acts .qa-main:disabled { background: var(--line, #3a3a3a); border-color: var(--line, #3a3a3a); color: var(--muted); box-shadow: none; opacity: 1; cursor: default; }
.qa-acts .qa-main .qa-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.qa-acts .qa-other { background: transparent; border: 1px solid var(--line-strong, var(--line)); color: var(--ink); }
.qa-wordlab { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
.qa-wordlab input.qa-word { font-size: 16px; min-height: 44px; height: 44px; margin: 0; padding: 0 12px; box-sizing: border-box; width: 100%; }

/* the fields (5.8), in the sheet and in a card in the thread */
.qa-fields, .dc-fields { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.qa-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.qa-label-f { font-size: 14px; color: var(--muted); line-height: 1.3; }
.qa-label-f small { font-size: 12px; }
.qa-ferr { margin: 0; font-size: 13px; color: var(--bad, #d64545); line-height: 1.4; }
.qa-ferr[hidden] { display: none; }
/* chips: one picked, in the primary colour */
.qa-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.qa-field .qa-chip { min-height: 36px; height: auto; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong, var(--line));
  background: transparent; color: var(--ink); font-size: 15px; white-space: nowrap; line-height: 1.2; box-shadow: none; }
.qa-field .qa-chip.on { background: var(--primary, #3167ed); border-color: var(--primary, #3167ed); color: var(--primary-ink, #fff); }
/* a picker */
.qa-field .qa-pick { min-height: 44px; width: 100%; justify-content: flex-start; text-align: left; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line-strong, var(--line)); background: transparent; color: var(--ink); font-size: 16px; box-shadow: none; }
.qa-field .qa-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-picklist { list-style: none; margin: 0; padding: 4px 0; border: 1px solid var(--line); border-radius: 12px; max-height: 264px; overflow: auto; }
.qa-picklist[hidden] { display: none; }
.qa-opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; cursor: pointer; font-size: 15px; }
.qa-opt img { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; flex: none; }
.qa-opt span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-opt[aria-selected="true"] { color: var(--primary, #3167ed); font-weight: 600; }
.qa-opt:hover, .qa-opt:focus { background: color-mix(in srgb, var(--ink) 6%, transparent); outline: none; }
/* a stepper: minus and plus 44 by 44, the value between them in tabular figures */
.qa-stepper { display: flex; align-items: center; gap: 8px; }
.qa-field .qa-step { flex: none; width: 44px; min-width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%;
  border: 1px solid var(--line-strong, var(--line)); background: transparent; color: var(--ink); font-size: 20px; line-height: 1;
  display: grid; place-items: center; box-shadow: none; }
.qa-field input.qa-num { width: 88px; min-height: 44px; height: 44px; margin: 0; padding: 0 8px; text-align: center; font-size: 16px;
  font-variant-numeric: tabular-nums; box-sizing: border-box; }
.qa-unit { font-size: 15px; color: var(--muted); }
/* a switch: 44 px tall, its label left */
.qa-switchrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.qa-field .qa-switch { flex: none; width: 56px; min-width: 56px; height: 44px; min-height: 44px; padding: 0; border: 0; background: transparent;
  position: relative; box-shadow: none; }
.qa-switch::before { content: ''; position: absolute; left: 4px; right: 4px; top: 9px; bottom: 9px; border-radius: 13px;
  background: var(--line-strong, var(--line)); transition: background .16s; }
.qa-switch .qa-knob { position: absolute; top: 12px; left: 8px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: left .16s; }
.qa-switch[aria-checked="true"]::before { background: var(--primary, #3167ed); }
.qa-switch[aria-checked="true"] .qa-knob { left: 28px; }
/* a field */
.qa-field input.qa-text, .qa-field textarea.qa-text { width: 100%; box-sizing: border-box; font-size: 16px; margin: 0; min-height: 44px; padding: 10px 12px; }
.qa-field textarea.qa-text { line-height: 1.45; resize: vertical; }

@media (prefers-reduced-motion: reduce) {
  .qa-switch::before, .qa-switch .qa-knob { transition: none; }
}
@media (max-width: 899px) {
  .qa-field .qa-chip { min-height: 44px; }
}
/* W1: the things a field names, offered under it; free text still allowed */
.qa-names { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.qa-names[hidden] { display: none; }
.qa-name { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 100%; padding: 0 14px;
  border-radius: 999px; border: 1px solid var(--line-strong, var(--line)); background: transparent; color: var(--ink);
  font: inherit; font-size: 14px; cursor: pointer; }
.qa-name img { width: 32px; height: 32px; object-fit: cover; border-radius: 6px; flex: none; }
.qa-name span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-name:focus-visible { outline: 2px solid var(--primary, #3167ed); outline-offset: 2px; }

/* V2: a field's hint, and its suggestions as taps that fill it */
.qa-hint { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted, var(--ink-2, #8a8f98)); }
.qa-suggs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.qa-sugg { display: inline-flex; align-items: center; min-height: 44px; max-width: 100%; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong, var(--line)); background: transparent; color: inherit; font: inherit; font-size: 14px;
  text-align: left; white-space: normal; line-height: 1.3; cursor: pointer; }
.qa-sugg:focus-visible { outline: 2px solid var(--primary, #3167ed); outline-offset: 2px; }

/* the walk (WK): a chip of one character ("1", "2") is still a whole 44 px target on a phone */
@media (max-width: 899px) { .qa-field .qa-chip { min-width: 44px; justify-content: center; } }
