/* ZenithTracker Canopy v1 · task components (ux-task-first-v7): entries with visible units,
   short help, the item cart, the item picker, choices, consequence summaries, next actions
   and the sticky task bar. Tokens only; every state also has words. */

/* An entry and its unit read as one control; the unit is never only a placeholder. */
.entry { display: flex; align-items: stretch; max-width: 20rem; }
.entry > input { flex: 1 1 6rem; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; font-variant-numeric: tabular-nums; }
.entry__unit, .entry__prefix {
  display: flex; align-items: center; padding: 0 var(--zt-space-3); background: var(--zt-soft);
  border: 1px solid var(--zt-control-border); color: var(--zt-ink); white-space: nowrap; font-weight: 600;
}
.entry__unit { border-left: 0; border-radius: 0 var(--zt-radius-sm) var(--zt-radius-sm) 0; }
.entry__prefix { border-right: 0; border-radius: var(--zt-radius-sm) 0 0 var(--zt-radius-sm); }
.entry__prefix + input { border-radius: 0; }
.entry--money > input:last-child { border-radius: 0 var(--zt-radius-sm) var(--zt-radius-sm) 0; }
.entry-note { margin: var(--zt-space-1) 0 0; color: var(--zt-muted); font-size: var(--zt-type-sm); }

/* Optional help: a tap or Enter opens it; essential guidance stays visible elsewhere. */
.help { margin: var(--zt-space-1) 0; }
.help > summary {
  display: inline-flex; align-items: center; gap: var(--zt-space-2); min-height: var(--zt-touch);
  cursor: pointer; color: var(--zt-info); font-weight: 600; font-size: var(--zt-type-sm); list-style: none;
}
.help > summary::-webkit-details-marker { display: none; }
.help > summary::before { content: "?"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; font-size: .75rem; font-weight: 800; }
.help[open] > summary::before { content: "−"; }
.help > div { border-left: 3px solid var(--zt-info); background: var(--zt-info-bg); padding: var(--zt-space-3) var(--zt-space-4); border-radius: 0 var(--zt-radius-sm) var(--zt-radius-sm) 0; }
.help > div > :last-child { margin-bottom: 0; }

/* A task page: what it is, then the work, then one bar of actions. */
.task { display: grid; gap: var(--zt-space-5); }
.task-meta { display: flex; flex-wrap: wrap; gap: var(--zt-space-2) var(--zt-space-4); align-items: center; color: var(--zt-muted); font-size: var(--zt-type-sm); }
.state-pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--zt-radius-pill); font-size: var(--zt-type-sm); font-weight: 700; background: var(--zt-neutral-bg); color: var(--zt-neutral); }
.state-pill--draft { background: var(--zt-warning-bg); color: var(--zt-warning); }
.state-pill--ok { background: var(--zt-success-bg); color: var(--zt-success); }
.state-pill--info { background: var(--zt-info-bg); color: var(--zt-info); }
.state-pill--danger { background: var(--zt-danger-bg); color: var(--zt-danger); }
.save-state { min-height: 1.5em; margin: 0; color: var(--zt-muted); font-size: var(--zt-type-sm); }

/* The cart: one compact row per item, its editor opened only when asked. */
.cart { display: grid; gap: var(--zt-space-3); margin: 0; padding: 0; list-style: none; }
.cart-line { border: 1px solid var(--zt-border); border-radius: var(--zt-radius); background: var(--zt-surface); padding: var(--zt-space-3) var(--zt-space-4); }
.cart-line[data-editing="true"] { border-color: var(--zt-brand); box-shadow: inset 0 0 0 1px var(--zt-brand); }
.cart-line--attention { border-color: var(--zt-warning); background: var(--zt-warning-bg); }
.cart-line--error { border-color: var(--zt-danger); }
.cart-line__summary { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--zt-space-3); align-items: start; }
.cart-line__body { display: grid; gap: 2px; min-width: 0; }
.cart-line__name { font-weight: 700; overflow-wrap: anywhere; }
.cart-line__facts { color: var(--zt-muted); font-size: var(--zt-type-sm); }
.cart-line__money { font-variant-numeric: tabular-nums; font-weight: 700; }
.cart-line__actions { display: flex; flex-wrap: wrap; gap: var(--zt-space-2); margin-top: var(--zt-space-2); }
.cart-line__editor { display: grid; gap: var(--zt-space-3); margin-top: var(--zt-space-3); padding-top: var(--zt-space-3); border-top: 1px dashed var(--zt-border); }
.cart-line__editor .inline-fields { align-items: start; }
/* A field save can answer while the person reaches for Done: the note it fills keeps its
   space, so nothing under the pointer moves (D-08). While a line is edited its summary
   keeps the pack; the amounts are said in this note. */
.cart-line__editor [data-derived] { min-height: 1lh; }
.cart-empty { border: 2px dashed var(--zt-border); border-radius: var(--zt-radius); padding: var(--zt-space-5); text-align: center; color: var(--zt-muted); }
.cart-totals { display: grid; gap: var(--zt-space-1); justify-items: end; font-variant-numeric: tabular-nums; }
.cart-totals strong { font-size: var(--zt-type-lg); }
.cart-limit { color: var(--zt-muted); font-size: var(--zt-type-sm); }
.removed-note { display: flex; flex-wrap: wrap; gap: var(--zt-space-2); align-items: center; padding: var(--zt-space-2) var(--zt-space-3); border-radius: var(--zt-radius-sm); background: var(--zt-neutral-bg); }

/* The item picker: search, items bought before, items suggested to reorder. */
.picker { display: grid; gap: var(--zt-space-3); }
.picker__tabs { display: flex; flex-wrap: wrap; gap: var(--zt-space-2); }
.picker__tabs button[aria-pressed="true"] { background: var(--zt-brand); border-color: var(--zt-brand); color: #fff; }
.picker__results { display: grid; gap: var(--zt-space-2); margin: 0; padding: 0; list-style: none; }
.picker__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--zt-space-3); align-items: center; padding: var(--zt-space-2) var(--zt-space-3); border: 1px solid var(--zt-border); border-radius: var(--zt-radius-sm); background: var(--zt-surface); min-height: var(--zt-touch); }
.picker__row--chosen { border-color: var(--zt-brand); background: var(--zt-mint); }
.picker__row label { display: contents; cursor: pointer; }
.picker__empty { color: var(--zt-muted); }

/* A short set of answers (reasons, problems, departments) as large touch targets. */
/* Ordinary radio buttons and checkboxes (ux-refinement-v8 D8-07): a choice is not a pill.
   Each keeps a full touch height; the native control shows what is chosen. */
.choices { display: flex; flex-wrap: wrap; gap: 0 var(--zt-space-5); border: 0; padding: 0; margin: 0; }
.choices > legend { margin-bottom: var(--zt-space-1); font-weight: 700; }
.choices label { display: inline-flex; align-items: center; gap: var(--zt-space-2); min-height: var(--zt-touch); cursor: pointer; }
.choices input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--zt-brand); }

/* What will change, said before the commit. */
.consequence { border-left: 4px solid var(--zt-brand); background: var(--zt-mint); padding: var(--zt-space-3) var(--zt-space-4); border-radius: 0 var(--zt-radius-sm) var(--zt-radius-sm) 0; }
.consequence--warn { border-left-color: var(--zt-warning); background: var(--zt-warning-bg); }
.consequence > :last-child { margin-bottom: 0; }
.consequence ul { margin: var(--zt-space-2) 0 0; padding-left: 1.2rem; }

/* After saving: the next useful actions, none of them compulsory. */
.next-actions { display: grid; gap: var(--zt-space-3); grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
ul.next-actions { margin: 0; padding: 0; list-style: none; }
.next-actions > a, .next-actions > li > a, .next-actions > form > button { display: grid; gap: 2px; min-height: 4.5rem; padding: var(--zt-space-3) var(--zt-space-4); border: 1px solid var(--zt-border); border-radius: var(--zt-radius); background: var(--zt-surface); text-align: left; text-decoration: none; color: var(--zt-ink); width: 100%; }
.next-actions strong { color: var(--zt-brand-deep); }
.next-actions span { color: var(--zt-muted); font-size: var(--zt-type-sm); }

/* One bar of task actions that stays reachable above the phone navigation and keyboard. */
.task-actions {
  position: sticky; bottom: calc(var(--zt-bottom-nav) + 4px + env(safe-area-inset-bottom)); z-index: 20;
  display: flex; flex-wrap: wrap; gap: var(--zt-space-2) var(--zt-space-3); align-items: center; justify-content: flex-end;
  padding: var(--zt-space-3) var(--zt-space-4); background: var(--zt-surface); border: 1px solid var(--zt-border);
  border-radius: var(--zt-radius); box-shadow: 0 -3px 14px rgb(23 47 72 / 10%);
}
.task-actions__note { flex: 1 1 14rem; margin: 0; color: var(--zt-muted); font-size: var(--zt-type-sm); }
/* What the last action did, above whether the draft is saved: a quiet save changes only
   the second line (pr10-corrective D10-04). An empty line takes no room. */
.task-actions__notes { flex: 1 1 14rem; display: grid; gap: 2px; min-width: 0; }
/* Typing a reply could not put back where it still meant the same (D10-01). */
.task-actions__note--warn { color: var(--zt-ink); font-weight: 600; border-left: 3px solid var(--zt-warning); padding-left: var(--zt-space-2); }
/* The actions of one of several forms on a page (each price to check, each settings
   section): they stay below their own questions. A sticky bar per form would pin over
   that form's questions while the page scrolls. */
.task-actions--inline { position: static; padding: 0; border: 0; background: none; box-shadow: none; }
@media (min-width: 701px) { .task-actions { bottom: var(--zt-space-4); } }
@media (max-height: 560px) { .task-actions { position: static; } }
:root[data-zt-text="large"] .task-actions { position: static; }

/* Rows that compare what was recorded with what was seen (counts, corrections). */
.compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: var(--zt-space-2) var(--zt-space-4); }
.compare dt { color: var(--zt-muted); font-size: var(--zt-type-sm); }
.compare dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.difference--up { color: var(--zt-success); }
.difference--down { color: var(--zt-danger); }

@media (max-width: 700px) {
  .cart-line { padding: var(--zt-space-3); }
  .cart-line__editor [data-derived] { min-height: 2lh; }
  .entry { max-width: none; }
  .task-actions .button { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .cart-line, .help > div { transition: none; } }
@media print { .task-actions, .picker { display: none; } }

/* Controls only needed without the page script (ux-task-first-v7 D-08). */
.js-task-draft [data-nojs] { display: none; }

/* Getting-started steps (ux-task-first-v7 UX-03): where a new person is in setup. */
.steps { display: flex; flex-wrap: wrap; gap: var(--zt-space-2) var(--zt-space-4); margin: 0 0 var(--zt-space-3); padding: 0; list-style: none; counter-reset: step; color: var(--zt-muted); }
.steps > li { counter-increment: step; }
.steps > li::before { content: counter(step) ". "; }
.steps > li[aria-current="step"] { color: var(--zt-ink); }

/* Paper record (ux-task-first-v7 UX-37): only the fields for the kind chosen; the server reads only those. */
[data-form="late"]:has(input[name="kind"][value="WITHDRAWAL"]:checked) [data-late-write-off],
[data-form="late"]:has(input[name="kind"][value="WRITE_OFF"]:checked) [data-late-withdrawal] { display: none; }

/* A table's include box (To order): the whole cell-sized label is the touch target. */
label.check-cell { display: inline-flex; align-items: center; justify-content: center; min-width: var(--zt-touch); min-height: var(--zt-touch); cursor: pointer; }
label.check-cell input { width: 20px; height: 20px; margin: 0; accent-color: var(--zt-brand); }
