/* Task Helper — the Stock view + quantity control (job-intake.md §27; BRIEF-925). Copyright Rapid Surveys Pty Ltd.
 * App tokens only (--bg --card --ink --muted --line --accent --accent-ink --ok --err). Namespaced .stk / .tsq. Phone first. */
.stk { max-width: 760px; margin: 0 auto; padding: 12px 16px 96px; }
.stk-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 4px 0 10px; }
.stk-head h2 { margin: 0; font-size: 20px; }
.stk-co { color: var(--muted); font-size: 14px; }
.stk-tabs { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 0 0 14px; background: var(--card); }
.stk-tab { flex: 1; width: auto; margin: 0; min-height: 44px; padding: 0 8px; border: 0; border-radius: 0; background: transparent; color: var(--ink); font-weight: 600; font-size: 15px; }
.stk-tab + .stk-tab { border-left: 1px solid var(--line); }
.stk-tab.on { background: var(--ink); color: #fff; }
.stk-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.stk-actions:empty { display: none; }
.stk-btn { width: auto; margin: 0; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 15px; }
.stk-btn.ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.stk-btn:disabled { opacity: .6; }
/* BRIEF-1289 G3: a greyed button (THGate's gt-off look) — never the solid accent, so the muted words stay readable; still focusable. */
.stk-btn.gt-off { background: var(--card); border-color: var(--line); cursor: default; display: inline-flex; align-items: center; gap: 0; }
.stk-link { width: auto; margin: 0; min-height: 44px; padding: 0 6px; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 14px; }
.stk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.stk-loc, .stk-item { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; margin: 0; padding: 12px 14px; text-align: left;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; font: inherit; }
.stk-loc:hover, button.stk-item:hover { background: var(--hover, var(--bg)); }
.stk-items li { display: flex; align-items: stretch; gap: 6px; }
.stk-items .stk-item { flex: 1; min-width: 0; }
.stk-loc.retired, .stk-item.retired { opacity: .7; }
.stk-loc-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.stk-loc-sub { color: var(--muted); font-size: 13px; }
.stk-pill { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.stk-pill.mine { color: var(--accent); border-color: var(--accent); background: var(--card); }
.stk-pill.bad { color: #fff; background: var(--err); border-color: var(--err); }
.stk-back { width: auto; margin: 0 0 6px; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 15px; }
.stk-lochead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stk-lochead h3 { margin: 0; font-size: 19px; }
.stk h4 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stk-muted { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }
.stk-empty { color: var(--muted); padding: 10px 0; margin: 0; }
.stk-warn { margin: 0 0 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--err); color: var(--err); background: var(--card); font-size: 14px; }
.stk-err { color: var(--err); font-size: 14px; margin: 8px 0; }
.stk-contents { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.stk-contents li { padding: 10px 14px; }
.stk-contents li + li { border-top: 1px solid var(--line); }
/* a CLEAR COUNT (§27): name left (wraps), count right (large, bold, tabular, never wraps), breakdown small under it */
.stk-line-c { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; width: 100%; }
.stk-iname { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; display: flex; flex-direction: column; gap: 2px; }
.stk-count { flex: none; display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.stk-n { font-size: 22px; line-height: 1.15; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); }
.stk-bd { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stk-bd.bad { color: var(--err); font-weight: 600; }
.stk-count.neg .stk-n, .stk-line-c.neg > .stk-iname { color: var(--err); }
.stk-lines-c { display: flex; flex-direction: column; width: 100%; margin-top: 6px; border-top: 1px solid var(--line); }
.stk-lines-c .stk-line-c { padding: 8px 0; border-bottom: 1px solid var(--line); }
.stk-lines-c .stk-line-c:last-child { border-bottom: 0; }
.stk-lines-c .stk-n { font-size: 20px; }
.stk-nothing { color: var(--muted); font-size: 14px; margin-top: 6px; }
.stk-more { color: var(--muted); font-size: 13px; padding: 6px 0 0; }
.stk-item .stk-line-c { align-items: center; }
.stk-hist { list-style: none; margin: 0; padding: 0; }
.stk-hist li { position: relative; padding: 10px 0; border-bottom: 1px solid var(--line); }
.stk-hist li.undone .stk-h-top strong { text-decoration: line-through; color: var(--muted); }
.stk-h-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.stk-h-sub, .stk-h-why { color: var(--muted); font-size: 13px; margin-top: 2px; }
.stk-hist .stk-link { min-height: 36px; padding: 0; }
.stk-kind { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.stk-kind.k-bought, .stk-kind.k-found { color: var(--ok); }
.stk-kind.k-written_off, .stk-kind.k-missing { color: var(--err); }
.stk-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.stk-filters label { flex: 1 1 140px; display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; }
.stk-filters select { margin: 0; min-height: 44px; }
.stk-old { margin-top: 14px; } .stk-old summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted); }
.stk-sr, .tsq-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
/* the sheet: anchored to the TOP (house rule), full width on a phone */
.stk-ov { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto;
  background: rgba(20,28,40,.45); padding: max(12px, env(safe-area-inset-top)) 0 24px; }
.stk-sheet { width: 100%; max-width: 520px; margin: 0 12px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.stk-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.stk-sheet-head h3 { margin: 0; font-size: 18px; }
.stk-x { width: 44px; height: 44px; margin: 0; padding: 0; flex: none; border: 0; background: none; color: var(--muted); font-size: 18px; }
.stk-form { display: flex; flex-direction: column; gap: 10px; }
.stk-fl { display: flex; flex-direction: column; gap: 4px; margin: 0; font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.stk-fl input, .stk-fl select { margin: 0; font-size: 16px; min-height: 44px; font-weight: 400; }
.stk-fl small, .stk-hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.stk-two { display: flex; gap: 10px; }
.stk-check { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; font-size: 14px; }
.stk-check input { width: auto; margin: 0; }
.stk-btns { display: flex; gap: 10px; margin-top: 6px; }
.stk-btns .stk-btn { flex: 1; }
.stk-line { border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: var(--bg); }
.stk-line-top { display: flex; align-items: flex-end; gap: 6px; }
.stk-have { margin: 6px 0 0; }
.stk-have:empty { display: none; }
.stk-when summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--accent); font-weight: 600; font-size: 14px; }
.stk-rev { margin: 0; font-weight: 600; }
body.stk-open { overflow: hidden; }
/* the quantity control (shared: move / buy / write off, a task's Stock, an audit's count) */
.tsq { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.tsq-row { display: flex; align-items: flex-end; gap: 6px; }
.tsq-f { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; margin: 0; font-size: 13px; font-weight: 600; }
.tsq-f input { margin: 0; min-height: 44px; font-size: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.tsq-plus { padding: 0 2px 12px; color: var(--muted); font-weight: 700; }
.tsq-part { border: 0; margin: 0; padding: 0; min-width: 0; }
.tsq-part legend { padding: 0; margin: 0 0 4px; font-size: 13px; font-weight: 600; }
.tsq-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tsq-chip { width: auto; margin: 0; min-width: 48px; min-height: 44px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 16px; font-weight: 600; }
.tsq-chip[aria-checked="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.tsq-pct input { width: 72px; margin: 0; min-height: 44px; text-align: center; font-size: 16px; }
.tsq-guess { display: flex; align-items: center; gap: 8px; min-height: 44px; margin: 0; font-size: 14px; }
.tsq-guess input { width: auto; margin: 0; }
.tsq-sum { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.tsq-sum:empty { display: none; }
@media (min-width: 768px) { .stk-ov { padding-top: 48px; } }
/* the company switch (§28 K1) */
.stk-off { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.stk-off p { margin: 0 0 10px; }
.stk-switch { margin-top: 24px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
/* a task's stock (in UI's "Client & stock" box) and a time entry's "Stock used" — no page padding of their own */
.stk.stk-field, .stk.stk-entry { max-width: none; margin: 0; padding: 0; }
.stk-f-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 8px; }
.stk-f-head h4, .stk-entry h4 { margin: 0; }
.stk-entry h4 { margin: 0 0 8px; }
.stk-field .stk-contents li, .stk-entry .stk-contents li { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.stk-field .stk-contents .stk-link { align-self: flex-start; min-height: 36px; padding: 0; }
.stk-ro { font-size: 12px; color: var(--muted); }
.stk-field h4 + .stk-contents { margin-top: 0; }
.stk-entry .stk-lines { display: flex; flex-direction: column; gap: 8px; }
.stk-lines { display: flex; flex-direction: column; gap: 8px; }
@media (pointer: coarse) { .stk-field .stk-contents .stk-link { min-height: 44px; } }
/* audits (ST-3) */
.stk-audits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.stk-aud { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; margin: 0; min-height: 44px; padding: 10px 14px; text-align: left;
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; font: inherit; }
.stk-aud-rows, .stk-aud-extra { display: flex; flex-direction: column; gap: 8px; margin: 0 0 8px; }
.stk-aud-row .stk-match { align-self: flex-start; margin-top: 8px; }
.stk-match.on { background: var(--ink); border-color: var(--ink); color: #fff; }   /* ink, not --ok: white on that green is under 4.5:1 */
.stk-match:disabled { opacity: .5; }
.stk-draft { margin: 0 0 8px; padding: 8px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font-size: 14px; }
.stk-diff-t { margin: 0 0 6px; }
.stk-ok { color: var(--ink); font-weight: 600; }
.stk .bad, .stk-sheet .bad { color: var(--err); font-weight: 600; }
.stk .good, .stk-sheet .good { color: var(--ink); font-weight: 700; }
.stk-contents li.diff { background: var(--bg); }
/* reports (ST-4): a table on a computer; under 768 px each row is a card (the cell's data-label as its caption) */
.stk-rpick select { font-weight: 600; }
.stk-filters input { margin: 0; min-height: 44px; }
.stk-csv { text-decoration: none; display: inline-flex; align-items: center; }
.stk-rwrap { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 0 0 12px; }
.stk-rtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.stk-rtable th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg); }
.stk-rtable td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.stk-rtable tr:last-child td { border-bottom: 0; }
.stk-rtable td.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stk-rtable td .stk-loc-sub, .stk-rtable td .stk-bd { display: block; }
.stk-rn { font-weight: 800; font-size: 16px; }
.stk-rn.neg, .stk-rtable tr.neg .stk-rn { color: var(--err); }
.stk-rtable tr.stk-rgroup th { background: var(--card); color: var(--ink); font-size: 14px; text-transform: none; letter-spacing: 0; border-top: 2px solid var(--line); }
.stk-rtable tr.stk-rsub td { color: var(--muted); font-weight: 600; }
.stk-rtable tr.undone .stk-rn { text-decoration: line-through; color: var(--muted); }
.stk-rtable .stk-link { min-height: 32px; padding: 0; white-space: nowrap; }   /* a task key never splits */
@media (max-width: 767px) {
  .stk-rtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .stk-rtable, .stk-rtable tbody, .stk-rtable tr, .stk-rtable td, .stk-rtable th { display: block; width: 100%; }
  .stk-rtable tr { padding: 8px 12px; border-bottom: 1px solid var(--line); }
  .stk-rtable tr:last-child { border-bottom: 0; }
  .stk-rtable td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; }
  .stk-rtable td::before { content: attr(data-label); flex: none; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; }
  .stk-rtable td[data-label=""]::before { content: none; }
  .stk-rtable td > *:first-child { text-align: right; }
  .stk-rtable td { text-align: right; }
  .stk-rtable td.n { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-between; }
  .stk-rtable td.n .stk-bd { width: 100%; text-align: right; }
  .stk-rtable tr.stk-rgroup th { padding: 10px 0 4px; border-top: 0; }
  .stk-rtable .stk-link { min-height: 44px; }
}
/* the quick stock check (BRIEF-947): a tick at the bottom of Move / Write off / Use stock, then one line per item */
.stk-chk { border-top: 1px solid var(--line); padding-top: 8px; }
.stk-chk-rows { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.stk-chk-left { flex: none; }
.stk-chk-diff { margin: 6px 0 0; font-size: 14px; }
.stk-chk-diff:empty { display: none; }
/* the Diary (BRIEF-1234): the use a Diary row was opened from */
.stk-field .stk-contents li.stk-hl { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 8px; }
/* BRIEF-1244: the task's older uses fold under "Earlier (n)" */
.stk-earlier { margin-top: 8px; }
.stk-earlier > summary { min-height: 44px; display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--muted); font-weight: 600; list-style: none; }
.stk-earlier > summary::-webkit-details-marker { display: none; }
.stk-earlier > summary::after { content: '▸'; }   /* "Earlier (n) ▸" (Gary); ▾ when open */
.stk-earlier[open] > summary::after { content: '▾'; }
.stk-earlier > .stk-contents { margin-top: 4px; }
/* AS-9: the asset page's Stock box (THStock.assetBox) — the "Holds stock" choice, stacked; a long location name never widens the page. */
.stk-abox .stk-apick { display: grid; gap: 8px; margin-top: 8px; }
.stk-abox .stk-asel { max-width: 100%; margin-top: 4px; }
.stk-abox .stk-muted { overflow-wrap: anywhere; }
