/* density: queue — merged into lists-density.css before commit */

/* ── Not sent yet · Subscriptions: Paid / Skip in brand colours, compact ──
   Paid is the primary (PANEL), Skip a white secondary. Green and red stay for
   chips and text; they are told apart by word and icon. */
.renew-act{gap:6px}
.renew-act .renew-paid{background:var(--sag-primary,var(--sag-primary));color:var(--sag-on-primary);border-color:transparent;
  box-shadow:0 1px 2px rgba(22,24,26,.18)}
.renew-act .renew-paid:hover{background:var(--sag-primary);box-shadow:0 1px 2px rgba(22,24,26,.18)}
.renew-act .renew-skip{background:var(--sag-surface);color:var(--sag-text,var(--sag-text));border-color:var(--sag-line,var(--sag-line));
  box-shadow:0 1px 2px rgba(22,24,26,.06)}
.renew-act .renew-skip:hover{background:var(--sag-hover,var(--sag-hover));border-color:var(--sag-line,var(--sag-line));box-shadow:none}
.renew-act button{border-radius:8px}
.renew-act button:focus-visible{outline:2px solid var(--sag-focus,#1B3038)}
.renew-confirm.is-paid .renew-yes{background:var(--sag-primary,var(--sag-primary))}
.renew-confirm button{border-radius:8px}
/* The short "N days late" sits on the same line as the unit. */
.rq-lines .n em.renewal-short{display:inline;margin:0 0 0 8px;white-space:nowrap}
@media (pointer:fine){
  .renew-act{margin-left:8px}
  .renew-act button{height:28px;padding:0 10px 0 8px;font-size:12px;gap:4px}
  .renew-act button svg{width:13px;height:13px}
  .rq-lines li:has(> .renew-act){align-items:center;padding-top:5px;padding-bottom:5px}
  .renew-confirm button{padding:5px 12px}
}
@media (max-width:640px){
  .renew-act{width:100%;justify-content:flex-end;margin:4px 0 0}
  .renew-act button{flex:0 0 auto;min-width:88px;justify-content:center}
  .rq-lines .n em.renewal-short{display:block;margin:2px 0 0}
}
@media (max-width:640px) and (pointer:coarse){.renew-act button{min-height:44px}}

/* ── Not sent yet: the open list ── */
.rq-checkout{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:8px 12px;padding:10px 14px;border-top:1px solid var(--sag-line);background:var(--sag-app)}
.mg-unsent .rq-checkout .rq-totals{padding:0;border:0;background:none}
.rq-checkout .rq-totals .grand span{font-size:12px;letter-spacing:0;text-transform:none}
.rq-checkout .btn{flex:none;width:auto}
@media (pointer:fine){
  .mg-unsent .rq-hd{display:none}
  .mg-unsent .rq-who{padding:8px 16px 2px}
  .mg-unsent .rq-lines{padding:2px 10px 8px}
  .mg-unsent .rq-lines li{padding:4px 8px;align-items:center}
  .mg-unsent .rq-lines .n{font-size:13.5px}
  .mg-unsent .rq-lines .n em:not(.renewal-warning){display:inline;margin:0 0 0 8px}
  .mg-unsent .rq-totals{padding:8px 16px}
  .mg-unsent .rq-totals .grand b{font-size:16px}
}
/* The collapsed rows: no fixed 150px pill column (every pill reads the same). */
@media (min-width:721px){
  .mg-unsent > .mg-sum{padding:8px 14px;grid-template-columns:auto minmax(0,1fr) auto auto 14px;gap:4px 12px}
  .mg-unsent .mg-main b{font-size:14px}
  .mg-unsent .mg-main small{font-size:11.5px}
  .mg-unsent .mg-total{font-size:14px}
  /* A row without a flag keeps the same end columns, so amounts and
     chevrons line up down the stack. */
  .mg-unsent > .mg-sum > .mg-total{grid-column:4;grid-row:1;text-align:right}
  .mg-unsent > .mg-sum > .mg-chev{grid-column:5;grid-row:1}
}
.mg-section .rq-group{margin:14px 0 8px}

/* ══ Work queue and History as sheets (lists-sheet.js) ══ */
.sh[data-sheet="queue"],.sh[data-sheet="history"]{--sh-max-h:max(260px,calc(100dvh - 250px))}
.modal .sh[data-sheet="history"]{--sh-max-h:max(240px,calc(100dvh - 300px))}
/* Short phrases (section, fund, proof) take two lines rather than widen the sheet. */
.sh-grid td .q-soft{display:inline-block;white-space:normal;min-width:64px;max-width:150px;line-height:1.3}
/* Items: every name in full, wrapping; nothing is clamped. */
.sh-grid .admin-items-t{display:inline;-webkit-line-clamp:unset;line-clamp:none;overflow:visible}
.sh-grid .admin-items-more{color:var(--sag-text-3);font-size:12px;white-space:nowrap}
.sh-grid td.sh-wrap{line-height:1.3}
/* The row's buttons sit on one line: the next step, then the small icons. */
.q-acts{display:flex;align-items:center;justify-content:flex-start;gap:4px;flex-wrap:nowrap}
.q-acts .sh-ibtn{margin-left:0}
@media (max-width:1240px) and (min-width:721px){
  .sh[data-sheet="queue"] .sh-grid th,.sh[data-sheet="queue"] .sh-grid td:not(.sh-rn),
  .sh[data-sheet="history"] .sh-grid th,.sh[data-sheet="history"] .sh-grid td:not(.sh-rn){padding-left:6px;padding-right:6px}
  .sh[data-sheet="queue"] .sh-st,.sh[data-sheet="history"] .sh-st{white-space:normal;align-items:flex-start}
  .sh[data-sheet="queue"] .sh-st::before,.sh[data-sheet="history"] .sh-st::before{margin-top:5px}
}

/* ── Date range: From / To and the two month picks, one compact group ── */
.q-dates{display:none;flex-wrap:wrap;align-items:center;gap:6px;margin:0 0 10px;padding:12px;border:1px solid var(--sag-line);border-radius:var(--sag-r,8px);background:var(--sag-app)}
.q-dates.open{display:flex}
.q-dates[hidden]{display:none}
.q-date{display:inline-flex;align-items:center;gap:6px;font:500 12.5px/1 var(--sag-font);color:var(--sag-text-2)}
.q-date input{height:30px;min-height:30px;width:136px;padding:0 8px;border:1px solid var(--sag-line-strong);border-radius:var(--sag-r,8px);
  background:var(--sag-surface);color:var(--sag-text);font:13px var(--sag-font)}
.q-date input:focus-visible{outline:2px solid var(--sag-focus);outline-offset:0}
.q-dates .sh-chip.q-period{height:30px}
.q-dates .sh-ibtn{width:30px;height:30px;margin-left:0}
.sh-tools .sh-act[data-q-export]{height:30px}
/* The tools wrap as two blocks: the dates (From, To, the months) together,
   then Export and Search together, never one word left on a line alone. */
.sh[data-sheet="queue"] .sh-tools,.sh[data-sheet="history"] .sh-tools{flex-wrap:wrap;justify-content:flex-end;row-gap:6px}
/* The same calendar disclosure is used at every screen width. */
.sh-tools .q-dates-t{display:inline-flex}
.q-dates-t[aria-expanded="true"]{border-color:var(--sag-primary)}
.q-dates-t.is-filtered{background:var(--sag-selected);border-color:var(--sag-primary)}
.q-dates-t.is-filtered::after{content:"";width:6px;height:6px;border-radius:50%;background:var(--sag-primary)}
@media (max-width:720px){
  .sh-tools .q-dates-t{display:inline-flex;order:1}
  .q-dates{display:none;grid-template-columns:1fr 1fr;width:100%;gap:8px}
  .q-dates.open{display:grid}
  .q-date{display:grid;gap:4px}
  .q-date input{width:100%}
  .q-dates .sh-chip.q-period{justify-self:start;width:auto}
  .q-dates .sh-ibtn{grid-column:1/-1;justify-self:start}
  /* One row of tools: Dates, Sort and Export sized to their words, then the
     search taking the rest (or its own line on a narrow phone). */
  .sh[data-sheet="queue"] .sh-tools,.sh[data-sheet="history"] .sh-tools{justify-content:flex-start;gap:8px}
  .sh[data-sheet="queue"] .sh-phone-sort,.sh[data-sheet="history"] .sh-phone-sort{order:2}
  .sh[data-sheet="queue"] .sh-act[data-q-export]{order:3}
  .sh[data-sheet="queue"] .sh-search,.sh[data-sheet="history"] .sh-search{order:4;flex:1 1 170px}
  /* Status chips and their calendar Filter stay visible together on phones. */
  .sh[data-sheet="queue"] .sh-chips,.sh[data-sheet="history"] .sh-chips{flex-wrap:wrap;overflow:visible;margin:0;padding:0}
  .sh[data-sheet="queue"] .sh-chip,.sh[data-sheet="history"] .sh-chip{flex:none}
  /* A card: what it is on the first line, full width so no word is split;
     its buttons on the line under it; then the facts. */
  .sh[data-sheet="queue"] .sh-grid tbody tr,.sh[data-sheet="history"] .sh-grid tbody tr{grid-template-columns:minmax(0,1fr)}
  .sh[data-sheet="queue"] .sh-grid td.sh-main,.sh[data-sheet="history"] .sh-grid td.sh-main{grid-column:1/-1;overflow-wrap:normal;word-break:normal}
  .sh[data-sheet="queue"] .sh-grid td.sh-acts,.sh[data-sheet="history"] .sh-grid td.sh-acts{grid-column:1/-1;grid-row:2;justify-content:flex-start;margin:4px 0 2px}
}
@media (pointer:coarse){
  .q-date input,.q-dates .sh-chip.q-period,.sh-tools .sh-act[data-q-export]{height:44px;min-height:44px}
  .q-date input{font-size:16px}
  .q-dates .sh-ibtn{height:44px}
}
/* The head toolbar's icons line up with the sheet's controls. */
@media (pointer:fine){
  .admin-queue .pane-tools-labels .btn{height:30px;min-height:30px}
  .admin-queue .pane-tools-labels .btn.ibtn{width:30px;min-width:30px;padding:0}
}

/* ══ A row's dialog as a side panel ══
   From the Work queue, approve / pay / invoice / proof / details dock to the
   right on a wide screen; the queue stays in view, scrolls and can be clicked
   to its left. Below 1081px it is the usual centred dialog; on a phone it
   takes the whole screen. */
@media (min-width:1081px){
  /* It starts under the top bar (--q-top is set as it opens), so the nav,
     language, notifications and account are never covered. */
  .veil.side{--q-h:calc(100dvh - var(--q-top,53px));top:var(--q-top,53px);
    background:transparent;-webkit-backdrop-filter:none;backdrop-filter:none;
    padding:0;justify-content:flex-end;align-items:stretch;pointer-events:none}
  .veil.side.show{pointer-events:none}
  .veil.side .modal,.veil.side .modal.wide,.veil.side .modal.wide.storage{width:var(--q-panel-w);max-width:var(--q-panel-w);height:var(--q-h);max-height:var(--q-h);
    border-radius:0;border-left:1px solid var(--sag-line);border-top:1px solid var(--sag-line);box-shadow:-12px 0 32px -12px rgba(22,24,26,.22);pointer-events:auto;
    transform:translateX(24px)}
  .veil.side.show .modal{transform:none}
  .veil.side .modal-scroll{max-height:var(--q-h);height:100%}

  body:has(#veil.side.show) #view-report{margin-right:calc(var(--q-panel-w) - 6px)}
  body:has(#veil.side.show) #view-report .sh[data-sheet="queue"]{--sh-max-h:max(240px,calc(100dvh - 290px))}
  /* The row in the side panel: a light selection and a 3px bar on its left edge. */
  body:has(#veil.side.show) #admin-work-table tr.q-open td:not(.sh-rn){background:var(--sag-selected,#E8EDEF)}
  body:has(#veil.side.show) #admin-work-table tr.q-open td.sh-rn{background:var(--sag-selected,#E8EDEF);color:var(--sag-text);font-weight:700;
    box-shadow:inset 3px 0 0 var(--sag-primary)}
  .veil.side .modal-scroll>.modal-bd{flex:1 1 auto}
}
/* A dialog with no field to fill takes the focus itself (focusDialog in
   index.html): no ring is drawn round the whole dialog. */
#modal:focus{outline:none}
/* Header: the title, and Close on its right. */
.veil.side .modal-hd{position:relative;padding-right:96px;padding-bottom:12px;border-bottom:1px solid var(--sag-line)}
.veil.side .modal-hd h2{font-size:17px}
.veil.side .panel-x{position:absolute;top:14px;right:18px;width:auto;height:30px;min-height:30px;padding:0 12px}
.veil:not(.side) .panel-x{display:none}
.veil.side .modal-ft{justify-content:flex-end}
/* The footer's Close (or "← Back") repeats the header's Close: hidden, and a
   footer left with nothing in it goes too (markPanelDuplicates, index.html). */
.veil.side .modal-ft .panel-dup{display:none}
.veil.side .modal-scroll>.modal-ft:not(:has(> :not(.panel-dup))){display:none}
@media (pointer:coarse){.veil.side .panel-x{height:44px;min-height:44px}}

/* ══ P1: a panel you can widen, and an email you can read in it ══
   --q-panel is the width the person dragged to (addPanelResize, index.html),
   kept per browser; without it the panel keeps its old default. The clamp
   keeps it between 400px and 1000px (and 70% of the window), and always leaves the queue
   800px: narrower than that, its filters and row buttons slide out of view. */
:root{--q-panel-w:clamp(400px,var(--q-panel,clamp(440px,36vw,520px)),min(70vw,calc(100vw - 800px),1000px))}
.panel-resize{display:none}
@media (min-width:1081px){
  .veil.side .modal{position:relative}
  .veil.side .panel-resize{display:block;position:absolute;top:0;bottom:0;left:-5px;width:10px;z-index:5;
    cursor:col-resize;touch-action:none}
  /* A thin line shows where to grab, on hover and while dragging. */
  .veil.side .panel-resize::after{content:"";position:absolute;top:0;bottom:0;left:4px;width:2px;background:transparent;transition:background .15s}
  .veil.side .panel-resize:hover::after,.veil.side .panel-resize:focus-visible::after,
  body.panel-resizing .veil.side .panel-resize::after{background:var(--sag-primary,var(--sag-primary))}
  .veil.side .panel-resize:focus-visible{outline:none}
  body.panel-resizing{cursor:col-resize;-webkit-user-select:none;user-select:none}
  /* No slide-in animation while the edge follows the mouse. */
  body.panel-resizing .veil.side .modal{transition:none}
}

/* The email preview, inside the panel or any dialog: the 600px letter fits
   the space it is given instead of scrolling sideways, its text stays the
   size it is sent at, and the wheel over it scrolls the panel top to bottom.
   Only the preview is changed; the email that is sent is not. */
.mail-preview{overflow-x:auto;overscroll-behavior-y:auto}
.mail-preview table[width="600"]{width:100% !important;max-width:600px}
.mail-preview>table>tbody>tr>td{padding:14px 10px !important}
.mail-preview img{max-width:100%;height:auto}
/* On a narrow panel the letter's own wide side margins give way a little. */
@container mailpane (max-width:520px){
  .mail-preview td[style*="padding:34px 42px"]{padding:24px 20px 22px !important}
  .mail-preview td[style*="padding:22px 36px"],.mail-preview td[style*="padding:12px 36px"],.mail-preview td[style*="padding:16px 36px"]{padding-left:20px !important;padding-right:20px !important}
  /* The item table's cells give up some side padding so its columns fit. */
  .mail-preview td[style*="padding:11px 10px"],.mail-preview td[style*="padding:9px 10px"],.mail-preview td[style*="padding:10px 10px"],
  .mail-preview td[style*="padding:9px 16px 9px 10px"],.mail-preview td[style*="padding:11px 16px 11px 10px"]{padding-left:6px !important;padding-right:6px !important}
}
.mail-preview{container:mailpane / inline-size}

/* Details "See the message": the text that was sent, in the app's own type,
   at full height, so the panel scrolls it rather than a small box inside it. */
.msg-fold>summary{cursor:pointer;font-weight:600;font-size:13px;margin:6px 0}
.preview.msg-read{font:400 13.5px/1.6 var(--sag-font,inherit);max-height:none;overflow:visible;color:var(--sag-text,var(--sag-text));overscroll-behavior:auto}
@media (max-width:720px){
  .veil.side{padding:0}
  .veil.side .modal,.veil.side .modal.wide{width:100%;max-width:100%;height:100dvh;max-height:100dvh;border-radius:0}
  .veil.side .modal-scroll{max-height:100dvh;height:100%}
}

/* The panel's key / value list: what the row says, one fact a line. */
.q-kv{display:grid;grid-template-columns:minmax(110px,max-content) minmax(0,1fr);margin:0 0 14px;
  border:1px solid var(--sag-line);border-radius:var(--sag-r,8px);overflow:hidden;font-size:13px}
.q-kv > div{display:contents}
.q-kv dt,.q-kv dd{margin:0;padding:6px 12px;border-bottom:1px solid var(--sag-line);line-height:1.35;min-width:0;overflow-wrap:anywhere}
.q-kv > div:last-child dt,.q-kv > div:last-child dd{border-bottom:0}
.q-kv dt{color:var(--sag-text-3);background:var(--sag-app);font-weight:500}
.q-kv dd{color:var(--sag-text)}
.q-kv .sh-st{white-space:normal}

/* ── Filters: each select as wide as its longest option (its native width),
   the search takes what is left, and the row wraps instead of squeezing. ── */
@media (min-width:621px){
  .admin-filters{display:flex;flex-wrap:wrap;align-items:flex-end}
  .admin-filter{flex:0 0 auto;max-width:100%}
  .admin-filter:first-child{flex:1 1 180px}
  .admin-filter input[type="date"]{width:136px}
  .admin-filter input[data-filter="person"]{width:130px}
  .admin-filter select{width:auto;max-width:100%}
}
.modal .admin-filters{gap:6px}
.admin-presets .admin-filters-toggle{display:none}
@media (max-width:620px){
  .admin-filters{grid-template-columns:1fr 1fr}
  .admin-filter:first-child{grid-column:1/-1}
  .admin-filters.can-collapse:not(.show-all) .admin-filter:not(:first-child){display:none}
  .admin-presets .admin-filters-toggle{display:inline-flex}
  .admin-filters.can-collapse:not(.show-all) + .admin-presets [data-admin-period]{display:none}
  .admin-presets .admin-filters-toggle[aria-expanded="true"]{background:var(--sag-selected,#E8EDEF)}
}

/* ── Requests table (Work queue and History) ──
   Nothing is cut: items, fund and headers wrap; the table fits its box at
   desktop widths, so the action column is an ordinary column there. */
.admin-acts{width:64px}
@media (pointer:coarse){.admin-acts{width:auto}}
@media (hover:none){
  /* The primary row action is an icon on a phone too; its words are its
     aria-label. Spelt out, it covered every column under the sticky cell. */
  .admin-table .btn.ibtn{min-width:44px;justify-content:center}
  .admin-table .btn.ibtn .ib-l{display:none}
}
.admin-table .admin-items-t{display:inline;-webkit-line-clamp:unset;line-clamp:none;overflow:visible}
.admin-table .admin-items-more{color:var(--sag-text-3,var(--sag-text-3));font-size:12px;white-space:nowrap}
.admin-table .admin-items{min-width:160px;max-width:380px}
/* The fund is one line where there is room, two where there is not. */
.admin-table td.admin-fund{max-width:none;overflow:visible;text-overflow:clip}
.admin-table th{white-space:normal;line-height:1.25}
.admin-table .admin-sort{white-space:normal}
.admin-table th.num .admin-sort{text-align:right}
@media (min-width:721px){
  .admin-table .admin-next{position:static;box-shadow:none}
}
@media (max-width:1199px){
  .admin-table td.admin-fund{white-space:normal;min-width:118px}
}
.modal .admin-table td.admin-fund{white-space:normal;min-width:118px}
@media (max-width:1080px){
  .admin-table .admin-items{min-width:140px}
  .admin-table th[aria-sort] .admin-sort,.admin-table td{padding-left:6px;padding-right:6px}
}
/* Phone: the table scrolls sideways and the actions stay in reach. The
   header cell is pinned with them, and the edge shadow says more is under. */
@media (max-width:720px){
  .admin-table thead th:last-child{position:sticky;right:0;z-index:2;background:var(--sag-selected)}
  .admin-table .admin-next{box-shadow:-6px 0 8px -6px rgba(22,24,26,.25)}
  .admin-table .admin-items{min-width:180px}
  /* In History the rows are read more than acted on: nothing is pinned. */
  .modal .admin-table thead th:last-child,.modal .admin-table .admin-next{position:static;box-shadow:none}
}

/* ── Head toolbar ── on a phone the icons sit in a row, not a stretched grid. */
@media (max-width:720px){
  .admin-queue .pane-tools-labels{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-start}
  .admin-queue .pane-tools-labels .btn{width:auto;flex:0 0 auto}
  .admin-queue .pane-tools-labels .btn.ibtn{min-width:44px}
}
/* A finger has no hover to name an icon: on a touch screen each head tool
   shows its short word beside the icon (Prices, Totals, File done, History). */
.btn.ibtn .ib-s{display:none}
@media (pointer:coarse){
  .admin-queue .pane-tools-labels .btn.ibtn{gap:6px;padding:0 12px}
  .admin-queue .pane-tools-labels .btn.ibtn .ib-s{display:inline;font-size:13px;font-weight:600}
}

/* ── History on a phone: the whole screen, Close in its header, Export and
   ZIP side by side in a compact footer ── */
.modal-hd.q-hist-hd{position:relative;padding-right:96px}
.q-hist-x{position:absolute;top:18px;right:18px;width:auto;height:30px;min-height:30px;padding:0 12px}
@media (pointer:coarse){.q-hist-x{height:44px;min-height:44px}}
@media (max-width:720px){
  .veil:has(#admin-history-list){padding:0;align-items:stretch}
  .modal.wide.storage:has(#admin-history-list){width:100%;max-width:100%;height:100dvh;max-height:100dvh;border-radius:0}
  /* Header and footer stay put; only the rows between them scroll, so the
     footer never sits over a row. */
  .modal:has(#admin-history-list) .modal-scroll{max-height:100dvh;height:100%;display:flex;flex-direction:column;overflow:hidden}
  .modal:has(#admin-history-list) .modal-scroll>.modal-hd,.modal:has(#admin-history-list) .modal-scroll>.modal-ft{flex:none}
  .modal:has(#admin-history-list) .modal-scroll>.modal-bd{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}
  .modal:has(#admin-history-list) .modal-scroll>.modal-hd{padding:12px 14px 0;padding-right:96px}
  .modal:has(#admin-history-list) .modal-scroll>.modal-hd h2{font-size:18px;margin-bottom:2px}
  .modal:has(#admin-history-list) .modal-scroll>.modal-hd p{font-size:12.5px;line-height:1.4}
  .modal:has(#admin-history-list) .q-hist-x{top:10px;right:12px}
  .modal:has(#admin-history-list) .modal-scroll>.modal-bd{padding:10px 14px}
  .modal:has(#admin-history-list) .modal-scroll>.modal-ft{padding:8px 14px;background:var(--sag-surface);border-top:1px solid var(--sag-line);gap:6px}
  .modal:has(#admin-history-list) .modal-scroll>.modal-ft .btn{padding:6px 10px;font-size:13.5px}
}

/* ── History dialog ── wider on a large screen; the table scrolls inside
   itself, the header stays. */
@media (min-width:721px){
  .modal.wide.storage{width:min(1200px,calc(100vw - 48px));max-width:min(1200px,calc(100vw - 48px))}
  .modal .admin-table-wrap{max-height:max(200px,calc(100dvh - 330px));overflow:auto}
  /* History holds the whole sheet: nearly the full width, slimmer margins. */
  .modal.wide.storage:has(#admin-history-list){width:min(1320px,calc(100vw - 24px));max-width:min(1320px,calc(100vw - 24px))}
  .modal:has(#admin-history-list) .modal-scroll>.modal-bd,.modal:has(#admin-history-list) .modal-scroll>.modal-hd{padding-left:14px;padding-right:14px}
  #admin-history-count{margin:0 0 6px;font-size:12.5px;color:var(--sag-text-3)}
}
@media (min-width:721px) and (max-width:1100px){
  .modal .sh[data-sheet="history"] .sh-grid td.sh-wrap{min-width:110px}
  .veil:has(#admin-history-list){padding:8px}
  .modal.wide.storage:has(#admin-history-list){width:calc(100vw - 16px);max-width:calc(100vw - 16px)}
  .modal .sh[data-sheet="history"] .sh-grid th,.modal .sh[data-sheet="history"] .sh-grid td:not(.sh-rn){padding-left:5px;padding-right:5px}
}

/* ── e-Meterai: Update stock ── */
@media (pointer:fine){
  .em-stock-adjust{grid-template-columns:32px 96px 32px;justify-content:start}
  .em-stock-adjust button{height:32px;font-size:18px}
  .em-stock-adjust input{font-size:16px;min-height:32px!important;height:32px}
}
.em-stock-preview{display:inline-block;margin:6px 0 0;padding:4px 10px}

/* ── Monthly totals: five cards in one row ── */
.ov-cards{grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:8px;margin-bottom:10px}
.ov-card{padding:9px 11px;gap:2px}

/* ── File completed requests ── */
.archive-list{font-size:12.5px;line-height:1.5;padding-left:16px;margin:0}
@media (min-width:721px){.archive-list{columns:2;column-gap:24px}}

/* ── Review approval: the price field is a price, not a full-width bar ── */
.fld .ap-price-row .ap-price-in{width:120px;flex:none;margin-left:auto}

/* ── Dialog footers on a phone: one row of buttons sized to their words,
   wrapping when they do not fit, never a stack of full-width bars ── */
@media (max-width:720px){
  .modal-scroll>.modal-ft{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:flex-end;align-items:center;gap:8px}
  .modal-scroll>.modal-ft .btn{flex:0 1 auto;width:auto;max-width:100%;line-height:1.2}
  /* A long label (ID "Ekspor tampilan saat ini") wraps inside a button that
     grows with it, not inside a fixed 44px box. */
  .modal-scroll>.modal-ft .btn{height:auto;min-height:44px;padding:6px 14px;white-space:normal;text-align:center}
}

/* ── View proof: the photo is a preview; a click still enlarges it ── */
.rc-view{display:flex;justify-content:center}
.rc-view img{width:auto;max-width:100%;max-height:min(42vh,320px);object-fit:contain}

/* ── Add purchase proof ── */
@media (pointer:fine){
  .review-field{margin:10px 0;gap:4px;font-size:12.5px}
  .review-field input,.review-field select{padding:6px 10px;font-size:14px}
}
/* Paying fund: a tray of white choices, the chosen one filled, so they read as
   choices rather than plain text; sized to their words with a mouse; 2 × 2 on a phone. */
.rc-fund{background:var(--sag-app,var(--sag-app));border-color:var(--sag-line,var(--sag-line))}
.rc-fund-btn{background:var(--sag-surface,var(--sag-surface));color:var(--sag-text-2,var(--sag-text-2));font-weight:600;box-shadow:inset 0 0 0 1px var(--sag-line,#E5E9EA)}
.rc-fund-btn:hover{color:var(--sag-text,var(--sag-text));box-shadow:inset 0 0 0 1px var(--sag-line-strong,#84969E)}
.rc-fund-btn.is-on{background:var(--sag-primary,var(--sag-primary));color:var(--sag-on-primary,var(--sag-on-primary));box-shadow:none}
@media (min-width:721px){.rc-fund-btn{flex:1 1 auto}}
@media (pointer:fine){.rc-fund-btn{padding:7px 12px;line-height:1.25}}
@media (max-width:600px){.rc-fund{display:grid;grid-template-columns:1fr 1fr}.rc-fund-btn{min-height:44px}}
/* On touch the choices are separate white buttons with an outline, so they
   read as something to tap; the chosen one keeps the PANEL fill. */
@media (pointer:coarse),(max-width:720px){
  .rc-fund{border:0;padding:0;gap:8px;background:transparent}
  .rc-fund-btn{border:1px solid var(--sag-line-strong,var(--sag-line-strong));background:var(--sag-surface,var(--sag-surface));color:var(--sag-text,var(--sag-text));font-weight:600}
  .rc-fund-btn.is-on{border-color:var(--sag-primary,var(--sag-text))}
}
/* B14: the existing receipt form starts with its attachment, then date and
   paying fund. No rows are reserved for retired payment fields. */
.receipt-upload{min-width:0}
.receipt-upload #rc-drop:not(.has-file){padding:20px 16px;background:var(--sag-app);border-color:var(--sag-line-strong)}
.receipt-upload #rc-drop .rc-drop-big{font-size:14px;margin:6px 0 4px}
.receipt-upload #rc-drop p{font-size:12px;line-height:1.5}
.receipt-drop-icon{display:inline-flex;color:var(--sag-icon)}
.receipt-drop-icon svg{width:24px;height:24px}
.receipt-upload #rc-drop:focus-visible{outline:2px solid var(--sag-primary);outline-offset:3px}
.receipt-upload #rc-drop.has-file:has(img){display:flex;align-items:center;gap:12px;padding:12px 48px 12px 12px;text-align:left}
.receipt-upload #rc-drop img{max-height:100px;max-width:80px;object-fit:contain;margin:0}
.receipt-attachment-info{min-width:0;font-size:13px;color:var(--sag-text)}
.receipt-attachment-info p{margin:4px 0 0;overflow-wrap:anywhere}
.receipt-upload #rc-clear{position:absolute;top:8px;right:8px;background:var(--sag-surface)}
.rc-payment-fields{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:16px;align-items:center;margin-top:14px}
.rc-payment-fields .review-field{min-width:0;margin:0;font-size:12px}
.rc-payment-fields input{width:100%;min-width:0}
.rc-payment-fund{min-width:0;color:var(--sag-text-2);font-size:12px;line-height:1.5}
.rc-payment-fund .paid-from{margin:0;font-size:12px;font-weight:500}
.rc-payment-fund .paid-from-note{font-size:12px;margin-top:4px}
.receipt-upload .rc-ocr{padding:12px;margin:14px 0 0;background:var(--sag-surface)}
.receipt-upload .rc-ocr-head b{font-size:13px}
.rc-lines-scroll{overflow:auto;max-width:100%;min-height:0;overscroll-behavior:contain}
.receipt-upload .rc-grid{min-width:0;grid-template-columns:minmax(0,1fr) 38px 84px 84px 28px;gap:6px}
.receipt-upload .rc-grid .rc-unit{display:block}
.receipt-upload .rc-kind,.receipt-upload .rc-verdict,.receipt-upload .rc-status,.receipt-upload .rc-scanner,
.receipt-upload .rc-scanner-line,.receipt-upload .rc-bar-say,.receipt-upload .rc-facts label{font-size:12px;line-height:1.5}
.receipt-upload .rc-facts label{text-transform:none;letter-spacing:normal}
.receipt-upload .rc-status{overflow-wrap:anywhere}
.receipt-upload .rc-ocr-head,.receipt-upload .rc-park-ask{flex-wrap:wrap}
@media(max-width:480px){.rc-payment-fields{grid-template-columns:minmax(0,1fr);gap:10px}}

/* B38: the standard wide receipt dialog keeps the form beside the reading.
   Only the receipt's rows need more room when there are many of them. */
.modal:has(.receipt-upload) .modal-scroll{height:calc(100dvh - 40px)}
.modal-scroll>.receipt-upload{display:grid;grid-template-columns:minmax(0,1fr) 280px;
  grid-template-rows:auto minmax(0,1fr);gap:10px 12px;overflow:hidden;flex:1;min-height:0}
.receipt-upload #rc-drop{grid-column:1;grid-row:1;margin:0;min-width:0;align-self:start}
.receipt-upload #rc-drop.has-file:has(img){padding:6px 40px 6px 8px;gap:8px}
.receipt-upload #rc-drop img{max-width:36px;max-height:42px}
.receipt-upload #rc-drop .receipt-attachment-info p{margin:0;line-height:1.35}
.receipt-upload #rc-clear{top:4px;right:4px}
.receipt-upload .rc-payment-fields{grid-column:2;grid-row:1;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin:0;align-content:start}
.receipt-upload .rc-payment-fields .review-field{gap:3px}
.receipt-upload .rc-payment-fund,.receipt-upload .rc-payment-fund .paid-from{font-size:12px;line-height:1.3}
.receipt-upload .rc-review-body{grid-column:1/-1;grid-row:2;display:grid;
  grid-template-columns:subgrid;min-height:0;gap:12px}
.receipt-upload .rc-ocr{grid-column:1;min-height:0;min-width:0;margin:0;padding:10px;
  display:flex;flex-direction:column;gap:6px;container:receipt-lines / inline-size}
.receipt-upload .rc-ocr-head{margin:0;display:flex;align-items:center;justify-content:space-between;gap:8px}
.receipt-upload .rc-status,.receipt-upload .rc-scanner{margin:0;line-height:1.35}
.receipt-upload .rc-status:empty,.receipt-upload #rc-results:empty{display:none}
.receipt-upload .rc-reading-details{position:relative;font-size:12px;line-height:1.35;min-width:0}
.receipt-upload .rc-reading-details>summary{cursor:pointer;min-height:28px;display:list-item}
.receipt-upload .rc-reading-info{position:absolute;top:100%;right:0;z-index:5;width:300px;max-width:calc(100vw - 40px);
  max-height:200px;overflow:auto;padding:10px;background:var(--sag-surface);border:1px solid var(--sag-line-strong);
  border-radius:8px;box-shadow:0 8px 24px rgba(22,24,26,.14)}
.receipt-upload .rc-wrong{padding:8px;gap:8px;border-radius:8px}
.receipt-upload .rc-wrong b{font-size:13px;line-height:1.3}
.receipt-upload .rc-wrong p{font-size:12px;line-height:1.35}
.receipt-upload .rc-wrong-icon{width:22px;height:22px;font-size:14px}
.receipt-upload .rc-lines-scroll{flex:1;overflow-x:hidden}
.receipt-upload .rc-grid{font-size:12px;padding:6px 0;align-items:start;overflow-wrap:anywhere}
.receipt-upload .rc-grid.rc-hd{padding-top:0;font-size:12px;letter-spacing:0}
.receipt-upload .rc-grid input[data-name],.receipt-upload .rc-grid input[data-qty],
.receipt-upload .rc-grid input[data-unit],.receipt-upload .rc-grid input[data-line]{display:none}
.receipt-upload .rc-read-value{min-width:0;line-height:1.4;overflow-wrap:anywhere}
.receipt-upload .rc-cell-label{display:none;color:var(--sag-text-3);font-size:12px;line-height:1.3}
.receipt-upload .rc-qty-cell,.receipt-upload .rc-price-cell,.receipt-upload .rc-line-cell{text-align:right}
.receipt-upload .rc-kind{margin:0;letter-spacing:0;text-transform:none}
.receipt-upload .rc-verdict{margin-top:0;letter-spacing:0;white-space:normal;overflow-wrap:anywhere}
.receipt-upload .rc-drop{min-width:28px;min-height:28px;opacity:1}
.receipt-upload .rc-review-fields{grid-column:2;min-width:0;min-height:0;overflow-y:auto;overflow-x:hidden;
  display:flex;flex-direction:column;gap:8px;overscroll-behavior:contain}
.receipt-upload .rc-facts{grid-template-columns:minmax(0,1.4fr) repeat(2,minmax(0,1fr));gap:4px 8px;margin:0}
.receipt-upload .rc-facts .rc-shop{grid-column:auto}
.receipt-upload .rc-facts label{margin:0;line-height:1.3}
.receipt-upload .rc-facts input{min-height:0;height:20px;font-size:12px}
.receipt-upload .rc-review-fields>.fld{margin:0;min-width:0}
.receipt-upload .rc-review-fields>.fld>label{font-size:12px;line-height:1.35;margin-bottom:3px;text-transform:none;letter-spacing:0}
.receipt-upload .rc-review-fields .hint{font-size:12px;line-height:1.35;margin-top:3px}
.receipt-upload .rc-parking{margin:0;padding:6px 8px;border-radius:8px}
.receipt-upload .rc-park-ask{gap:6px}
.receipt-upload .rc-park-ask label{font-size:12px;text-transform:none;letter-spacing:0}
.receipt-upload .rc-total-read,.receipt-upload .rc-diff{font-size:12px;line-height:1.35;margin:0}
/* The printed slip covers the whole comparison until it is closed (B75). It was
   a 160px hover popover over the receipt lines, gone as soon as the mouse left
   the Print button: a strip of paper floating over the rows. The comparison is
   its containing box, so .rc-print stays static. */
.receipt-upload .rc-ocr{position:relative}
.receipt-upload .rc-print{position:static;margin:0}
.receipt-upload .rc-print .sagrp{margin:0}
.receipt-upload .rc-print .sagrp-machine{display:flex;align-items:center;flex-wrap:wrap;gap:4px 8px;
  padding:0;border:0;border-radius:0;box-shadow:none;background:none}
.receipt-upload .rc-print .sagrp-brand,.receipt-upload .rc-print .sagrp-sum,.receipt-upload .rc-print .sagrp-slot{display:none!important}
.receipt-upload .rc-print .sagrp-head{margin:0}
.receipt-upload .rc-print .sagrp-screen{padding:0;margin:0;border:0;box-shadow:none;background:none}
.receipt-upload .rc-print .sagrp-status{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0)}
.receipt-upload .rc-print .sagrp[data-stage="idle"] .sagrp-status{display:none}
.receipt-upload .rc-print .sagrp-print{min-height:30px;padding:4px 10px;border:1px solid var(--sag-line-strong);
  border-radius:8px;box-shadow:none;background:var(--sag-surface);color:var(--sag-text);font-size:12px}
.receipt-upload .rc-print .sagrp-out{position:absolute;inset:0;z-index:6;margin:0;padding:8px 12px 16px;
  overflow:auto;overscroll-behavior:contain;border-radius:inherit;background:var(--sag-surface)}
.receipt-upload .rc-print .sagrp-out::before{display:none}
.modal-scroll>.receipt-footer{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center}
.receipt-footer #rc-diff{margin:0;padding:6px 8px;font-size:12px;line-height:1.35;overflow-wrap:anywhere}
.receipt-footer [data-x]{grid-column:2}
.receipt-footer #rc-save{grid-column:3}
@container receipt-lines (max-width:520px){
  .receipt-upload .rc-grid{grid-template-columns:repeat(3,minmax(0,1fr)) 28px;gap:4px 6px}
  .receipt-upload .rc-grid.rc-hd{display:none}
  .receipt-upload .rc-grid>.rc-cell:first-child{grid-column:1/4;grid-row:1}
  .receipt-upload .rc-grid>.rc-drop{grid-column:4;grid-row:1}
  .receipt-upload .rc-qty-cell{grid-column:1;grid-row:2}
  .receipt-upload .rc-price-cell{grid-column:2;grid-row:2}
  .receipt-upload .rc-line-cell{grid-column:3;grid-row:2}
  .receipt-upload .rc-qty-cell,.receipt-upload .rc-price-cell,.receipt-upload .rc-line-cell{text-align:left}
  .receipt-upload .rc-cell-label{display:block}
}
@media(max-width:720px){
  .modal:has(.receipt-upload) .modal-scroll{height:100dvh;max-height:100dvh}
  .veil.side .modal:has(.receipt-upload) .modal-hd{padding:12px 14px 0}
  .modal-scroll>.receipt-upload{padding:10px 14px}
  .modal-scroll>.receipt-upload{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:auto auto minmax(0,1fr);gap:8px}
  .receipt-upload .rc-payment-fields{display:contents}
  .receipt-upload .rc-payment-fields .review-field{grid-column:2;grid-row:1}
  .receipt-upload .rc-payment-fund{grid-column:1/-1;grid-row:2}
  .receipt-upload .rc-review-body{grid-row:3;grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) auto;gap:8px}
  .receipt-upload .rc-ocr{grid-column:1;grid-row:1;padding:8px}
  .receipt-upload .rc-ocr-head>b{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0)}
  .receipt-upload .rc-reading-info{left:0;right:auto}
  .receipt-upload .rc-review-fields{grid-column:1;grid-row:2;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px 8px}
  .receipt-upload .rc-facts{grid-column:1/-1;grid-template-columns:minmax(0,1.4fr) repeat(2,minmax(0,1fr))}
  .receipt-upload .rc-facts .rc-shop{grid-column:auto}
  .receipt-upload .rc-parking{grid-column:1/-1}
  .receipt-upload .rc-review-fields .hint{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0)}
  .receipt-upload .rc-kind{display:none}
  .receipt-upload .rc-grid{position:relative;padding:4px 0;gap:2px 6px}
  .receipt-upload .rc-grid>.rc-cell:first-child{grid-column:1/-1;padding-right:44px}
  .receipt-upload .rc-grid>.rc-drop{position:absolute;top:0;right:0}
  .receipt-upload #rc-diff{grid-column:1/-1}
  .receipt-upload .receipt-attachment-info p{display:none}
  .receipt-footer #rc-diff{grid-column:1/-1}
}
@media(pointer:coarse){
  .receipt-upload .rc-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  .receipt-upload .rc-reading-details>summary{min-height:44px;align-content:center}
  .receipt-upload .rc-drop{min-width:44px;min-height:44px}
  .receipt-upload .rc-print .sagrp-print{min-height:44px}
}

/* Record payment and Review receipt manually: short fields two to a row. */
@media (pointer:fine) and (min-width:721px){
  .modal-bd.review-form:has(#payment-date),.modal-bd.review-form:has(#review-paid-on){
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));column-gap:12px;align-content:start}
  .modal-bd.review-form:has(#payment-date)>:not(.review-field),
  .modal-bd.review-form:has(#review-paid-on)>:not(.review-field){grid-column:1/-1}
}
.modal-bd.review-form > .btn{width:auto;justify-self:start;padding:0 14px}
.review-line .btn{width:auto}
.review-line .review-line-x{justify-self:end}
@media (max-width:600px){
  .review-line,.review-line-heading{grid-template-columns:minmax(0,2fr) 56px 84px 44px}
  .review-line .review-line-x{grid-column:auto}
}
@media (pointer:fine){
  .review-line input{padding:6px 8px;min-height:34px}
  .modal .review-line .btn{height:34px}
}

/* ── Subscription invoices ── */
.modal .admin-filters:has(#invoice-request){display:grid;grid-template-columns:150px minmax(0,1fr) minmax(0,1.6fr);gap:8px}
.modal .admin-filters:has(#invoice-request) input{width:100%}
@media (max-width:600px){
  .modal .admin-filters:has(#invoice-request){grid-template-columns:1fr 1fr}
  .modal .admin-filters:has(#invoice-request) label:last-child{grid-column:1/-1}
}
.modal-bd:has(#invoice-request)>p{font-size:13px;margin:0 0 8px}
.invoice-queue-card{padding:12px 14px;margin:8px 0}
.invoice-queue-actions{gap:6px}
.invoice-queue-card:has(.invoice-upload-zone){align-items:stretch}
.invoice-queue-actions:has(.invoice-upload-zone){flex:1 1 100%;min-width:0}
.invoice-upload-zone{width:100%;padding:24px 16px;border-color:var(--sag-line-strong);background:var(--sag-app);font-size:13px}
.invoice-upload-zone b{display:block;font-size:14px;color:var(--sag-text)}
.invoice-upload-zone p{margin:6px 0;color:var(--sag-text-2)}
.invoice-upload-zone small{font-size:12px;color:var(--sag-text-3)}
.invoice-upload-zone:focus-visible{outline:2px solid var(--sag-primary);outline-offset:3px}
.invoice-queue-card.is-dragging .invoice-upload-zone,.invoice-upload-zone:hover{border-color:var(--sag-primary);background:var(--sag-hover)}
.invoice-upload-zone[aria-disabled="true"]{cursor:wait}
.request-proof-upload{min-width:0;margin-bottom:14px}
/* Every saved receipt of the request, as pictures to open (B78). */
.saved-proof{margin:14px 0 4px;min-width:0}
.saved-proof h3{margin:0 0 8px;font-size:14px}
.saved-proof-none{margin:0 0 8px;font-size:13px;line-height:1.4}
.saved-proof-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(132px,1fr));gap:10px}
.saved-proof-list:empty{display:none}
.proof-tile{display:flex;flex-direction:column;gap:6px;min-width:0;padding:6px;border:1px solid var(--sag-line);
  border-radius:10px;background:var(--sag-surface);color:var(--sag-text);text-align:left;font:inherit;cursor:pointer}
.proof-tile:hover,.proof-tile:focus-visible{border-color:var(--sag-line-strong)}
.proof-tile-pic{display:grid;place-items:center;height:128px;border-radius:6px;overflow:hidden;background:var(--sag-app)}
.proof-tile-pic img{width:100%;height:100%;object-fit:cover;object-position:top}
.proof-tile-kind{font-size:12px;font-weight:700;color:var(--sag-text-2)}
.proof-tile-cap{display:flex;flex-direction:column;gap:2px;min-width:0}
.proof-tile-cap b{font-size:13px;line-height:1.3;overflow-wrap:anywhere}
.proof-tile-cap small{font-size:12px;line-height:1.3;color:var(--sag-text-3)}
.request-proof-upload .invoice-queue-card{margin:0 0 8px;padding:12px;gap:10px}
.request-proof-upload .invoice-queue-card h3{font-size:13px;margin-bottom:4px}
.request-proof-upload .invoice-queue-card .inv-due{display:none}
.request-proof-upload .invoice-upload-zone{padding:18px 12px}
.request-proof-upload .invoice-queue-card p{font-size:12px}
/* B40: shared invoice cards, with a fixed toolbar and actions around the list. */
.modal:has(.invoice-queue-body) .modal-scroll{height:min(680px,calc(100dvh - 48px))}
.modal-scroll>.invoice-queue-body{display:flex;flex-direction:column;gap:10px;min-height:0;overflow:hidden;flex:1}
.invoice-queue-body .inv-count{margin:0;font-size:13px;line-height:1.4;color:var(--sag-text-2)}
.invoice-queue-body .invoice-only{margin:0;font-size:12px;line-height:1.4}
.inv-toolbar{position:relative;display:flex;gap:8px;align-items:center;flex:none}
.inv-search{display:flex;align-items:center;gap:8px;min-width:0;flex:1;border:1px solid var(--sag-line-strong);
  border-radius:8px;background:var(--sag-surface);padding:0 10px;height:34px}
.inv-search>span{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0)}
.inv-search svg{width:16px;height:16px;flex:none;color:var(--sag-icon)}
.invoice-queue-body .inv-search input{min-width:0;min-height:0;width:100%;height:100%;border:0;padding:0;box-shadow:none;background:none;font-size:13px}
.inv-search:focus-within{outline:2px solid var(--sag-primary);outline-offset:1px}
.inv-filters{flex:none;min-width:0}
.inv-filters>summary{list-style:none;display:flex;align-items:center;gap:6px;cursor:pointer}
.inv-filters>summary::-webkit-details-marker{display:none}
.inv-filters>summary svg{width:16px;height:16px;flex:none}
.inv-filters[open]>summary{background:var(--sag-selected);border-color:var(--sag-primary)}
.invoice-queue-body .inv-filters>.admin-filters{position:absolute;top:calc(100% + 6px);left:0;right:0;z-index:3;
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:12px;margin:0;border:1px solid var(--sag-line-strong);
  border-radius:8px;background:var(--sag-surface);box-shadow:var(--sag-shadow-2);max-height:240px;overflow:auto}
.invoice-queue-body .inv-filters:not([open])>.admin-filters{display:none}
.invoice-queue-body .admin-filter{min-width:0;margin:0;font-size:12px}
.invoice-queue-body .admin-filter input{width:100%;min-width:0}
#invoice-queue-list{min-height:80px;min-width:0;flex:1;overflow:auto;overscroll-behavior:contain;padding-right:3px}
.invoice-queue-body .invoice-queue-card{display:grid;grid-template-columns:minmax(0,1fr) 170px;gap:12px;align-items:center;
  margin:0 0 6px;padding:8px 10px;border-radius:10px;border:1px solid var(--sag-line);background:var(--sag-surface);
  transition:background .12s,border-color .12s}
.invoice-queue-body .invoice-queue-copy{display:block;min-width:0}
.inv-card-title{display:flex;align-items:baseline;justify-content:space-between;flex-wrap:wrap;gap:4px 10px;min-width:0}
.invoice-queue-body .invoice-queue-card h3{margin:0;font-size:15px;line-height:1.4;overflow-wrap:anywhere}
.invoice-queue-body .invoice-queue-card p{margin:4px 0 0;font-size:12px;line-height:1.4;min-width:0;overflow-wrap:anywhere}
.invoice-queue-card .inv-due{font-size:12px;line-height:1.4;color:var(--sag-text-3);white-space:nowrap}
.invoice-queue-card .inv-due.is-overdue{color:var(--sag-wait-fg)}
.invoice-queue-body .invoice-queue-actions{min-width:0;gap:6px;font-size:12px;line-height:1.4}
.invoice-upload-zone .inv-upload-icon{display:grid;place-items:center;flex:none}
.invoice-upload-zone svg{width:20px;height:20px;color:var(--sag-text-2)}
.invoice-queue-body .invoice-upload-zone{min-height:40px;padding:6px 8px;display:flex;flex-direction:row;gap:8px;
  align-items:center;justify-content:center;background:var(--sag-hover);border:1px dashed var(--sag-line-strong);border-radius:8px;cursor:pointer}
.invoice-queue-body .invoice-upload-zone b{font-size:12px;line-height:1.4;text-align:left}
.invoice-queue-card.is-uploadable:hover{border-color:var(--sag-line-strong)}
.invoice-queue-card.is-dragging{border-color:var(--sag-primary);outline:2px solid var(--sag-primary);outline-offset:-2px}
.invoice-queue-card.is-dragging .invoice-upload-zone,.invoice-upload-zone:hover{background:var(--sag-selected);border-color:var(--sag-primary)}
.invoice-upload-zone[aria-disabled="true"]{opacity:.75}
.invoice-queue-body .inv-formats{margin:0;color:var(--sag-text-3);font-size:12px;line-height:1.4;flex:none}
.inv-progress{padding:10px 12px;border:1px solid var(--sag-line);border-radius:10px;background:var(--sag-hover)}
.inv-progress-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:4px 12px}
.inv-progress-heading>span{display:flex;align-items:center;gap:6px;color:var(--sag-text);font-size:14px}
.inv-progress-heading b{font-weight:700;font-size:inherit}
.inv-progress-heading>span>b:first-child{font-size:20px;line-height:1.2}
.inv-progress-heading small{font-size:12px;color:var(--sag-text-2)}
.inv-progress.is-complete .inv-progress-heading>span>b{font-size:14px}
.inv-progress-heading svg{width:18px;height:18px;color:var(--sag-ok-fg);flex:none}
.inv-progress progress{display:block;width:100%;height:5px;margin-top:8px;border:0;border-radius:4px;overflow:hidden;
  appearance:none;background:var(--sag-line);color:var(--sag-primary);accent-color:var(--sag-primary)}
.inv-progress progress::-webkit-progress-bar{background:var(--sag-line);border-radius:4px}
.inv-progress progress::-webkit-progress-value{background:var(--sag-primary);border-radius:4px;transition:width .2s}
.inv-progress progress::-moz-progress-bar{background:var(--sag-primary);border-radius:4px}
.inv-progress.is-complete progress{color:var(--sag-ok);accent-color:var(--sag-ok)}
.inv-progress.is-complete progress::-webkit-progress-value{background:var(--sag-ok)}
.inv-progress.is-complete progress::-moz-progress-bar{background:var(--sag-ok)}
.invoice-queue-body .inv-filter-note{margin:6px 0 0;color:var(--sag-text-2);font-size:12px;line-height:1.4}
.invoice-queue-body .inv-saved-note{display:flex;align-items:center;gap:6px;margin:6px 0 0;font-size:12px;line-height:1.4;color:var(--sag-ok-fg);
  animation:inv-filed-in .18s ease-out}
.inv-saved-note svg{width:16px;height:16px;flex:none}
@keyframes inv-filed-in{from{opacity:0;transform:translateY(3px)}to{opacity:1;transform:none}}
.inv-empty{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:10px;padding:24px 12px;color:var(--sag-text-2);text-align:center}
.inv-empty>svg{width:28px;height:28px;color:var(--sag-icon)}
.invoice-queue-body .inv-empty p{margin:0;font-size:13px;line-height:1.5}
.inv-waiting>summary{display:flex;align-items:center;gap:8px;min-height:30px;padding:6px 10px;margin:6px 0;cursor:pointer;
  font-size:13px;font-weight:600;border:1px solid var(--sag-line);border-radius:8px;background:var(--sag-app)}
.inv-waiting>summary::before{content:'\203A';font-size:18px;line-height:1}
.inv-waiting[open]>summary::before{transform:rotate(90deg)}
.inv-waiting>summary>span{padding:1px 7px;border-radius:999px;background:var(--sag-surface);font-size:12px}
.inv-waiting .invoice-queue-card{background:var(--sag-app)}
.inv-toolbar #invoice-clear{flex:none}
.inv-toolbar #invoice-clear[hidden]{display:none}
@media(max-width:560px){
  .invoice-queue-body .invoice-queue-card{grid-template-columns:minmax(0,1fr);gap:10px;padding:12px}
  .invoice-queue-body .invoice-queue-actions{width:100%}
  .invoice-queue-body .invoice-upload-zone{min-height:44px;width:100%}
  .inv-toolbar{flex-wrap:wrap}
  .inv-toolbar #invoice-clear:not([hidden]){width:auto;margin-left:auto}
  .inv-progress-heading>span{font-size:13px}
}
@media(pointer:coarse){
  .inv-search,.inv-filters>summary,.inv-waiting>summary{min-height:44px}
  .invoice-queue-body .inv-search input{font-size:16px}
}
@media(prefers-reduced-motion:reduce){.inv-saved-note{animation:none}.inv-progress progress::-webkit-progress-value{transition:none}}
/* B32: a receipt due in Details is an actual drop target, not an action in the
   footer. It opens the existing reader with the file already attached. */
.request-proof-upload .request-receipt-drop{min-height:112px;padding:20px 14px;background:var(--sag-app);
  border-color:var(--sag-line-strong);display:flex;flex-direction:column;align-items:center;justify-content:center}
.request-proof-upload .request-receipt-drop .rc-drop-big{margin:6px 0 3px;font-size:14px;font-weight:700;color:var(--sag-text)}
.request-proof-upload .request-receipt-drop p{margin:0;font-size:12px;line-height:1.45;color:var(--sag-text-2)}
.request-proof-upload .request-receipt-drop:focus-visible{outline:2px solid var(--sag-primary);outline-offset:3px}
.modal-scroll>.modal-ft.q-details-footer{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:end;gap:8px}
.q-details-footer .q-details-close{align-self:end;justify-self:start;width:auto}
.q-details-actions{display:flex;align-items:center;justify-content:flex-end;flex-wrap:wrap;gap:8px;min-width:0}
.q-details-actions>.btn{max-width:100%}
.veil.side .modal:has(.q-details-footer) .modal-hd{padding-right:22px}
.invoice-queue-actions .btn{padding:0 12px;white-space:nowrap}
/* Each invoice's buttons are sized to their words on a phone too, wrapping
   as a row rather than stacking as full-width bars. */
@media (max-width:720px){
  .invoice-queue-card .invoice-queue-actions{display:flex;flex-direction:row;flex-wrap:wrap;align-items:center;gap:8px}
  .invoice-queue-card .invoice-queue-actions .btn{width:auto;flex:0 0 auto;max-width:100%;white-space:normal}
}
/* An empty month reads "Month · All months", not a dashed mask. */
.q-month .q-month-any{display:none;font-weight:500;color:var(--sag-text-3)}
.q-month.is-empty .q-month-any{display:inline}
.q-month.is-empty input[type="month"]:not(:focus)::-webkit-datetime-edit{opacity:0}

/* ── Receipt versions ── */
.receipt-versions-t .btn{width:auto}
@media (max-width:600px){
  .receipt-versions-t th:nth-child(3),.receipt-versions-t td:nth-child(3),
  .receipt-versions-t th:nth-child(5),.receipt-versions-t td:nth-child(5){display:none}
}

/* ── Edit request ── */
.modal #rq-ed-add{width:auto;padding:0 14px;height:30px;margin-top:6px}
@media (pointer:coarse){.modal #rq-ed-add{height:44px}}
.modal:has(#rq-ed-add) .hint{font-size:12px;line-height:1.45}

/* ── Details: Decline is a white secondary with risk-coloured words ── */
.modal-ft .btn-clay{background:var(--sag-surface,var(--sag-surface));color:var(--sag-risk-fg,var(--sag-risk-fg));
  border:1px solid var(--sag-line,var(--sag-line));box-shadow:var(--sag-shadow-1)}
.modal-ft .btn-clay:hover:not(:disabled){background:var(--sag-hover,var(--sag-hover))}

/* ── No left marks in the row dialogs ──
   A coloured edge on a rounded box reads as a "{", and a short bar beside the
   first letter as a "[". The notes keep their tint, their 1px line and their
   bold lead words; the edge mark is gone everywhere in the queue. */
.rc-offbalance{position:relative;box-shadow:none;padding:11px 13px}
.rc-offbalance::before{content:none}
.review-notice{position:relative;border-left:0;border:1px solid var(--sag-line,var(--sag-line));border-radius:var(--sag-r,8px);padding:8px 12px}
.review-notice::before{content:none}
/* A receipt line nobody approved says so in its verdict words; a settled
   renewal line in its name. Neither draws an edge any more. */
.rc-grid:has(.rc-verdict.bad),.rc-grid:has(.rc-verdict.off){box-shadow:none;padding-left:0}
.rq-lines li.renew-settled.settled-paid,.rq-lines li.renew-settled.settled-paid:nth-child(odd),
.rq-lines li.renew-settled.settled-skip,.rq-lines li.renew-settled.settled-skip:nth-child(odd){box-shadow:none}
/* Subscription invoices in the side panel: month and owner side by side, the
   long request ID on its own row so it is read in full. */
@media (min-width:1081px){
  .veil.side .modal .admin-filters:has(#invoice-request){grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .veil.side .modal .admin-filters:has(#invoice-request) label:last-child{grid-column:1/-1}
}

/* ── A narrower sheet (721-1100px, or beside the side panel) ──
   Section moves over the items as a small grey line and Proof steps out (the
   State column already says "Proof due" or "Complete"), so the row's button
   stays in view without scrolling sideways. Both stay in the side panel, the
   search and the export. */
.sh-grid .q-sec{display:none}
@media (min-width:721px) and (max-width:1100px){
  .sh[data-sheet="queue"] .sh-grid tr > :nth-child(3),.sh[data-sheet="queue"] .sh-grid tr > :nth-child(10),
  .sh[data-sheet="history"] .sh-grid tr > :nth-child(3),.sh[data-sheet="history"] .sh-grid tr > :nth-child(10){display:none}
  .sh[data-sheet="queue"] .sh-grid .q-sec,.sh[data-sheet="history"] .sh-grid .q-sec{display:block}
}
@media (min-width:1081px){
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-grid tr > :nth-child(3),
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-grid tr > :nth-child(10){display:none}
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-grid .q-sec{display:block}
  /* Beside the panel the sheet is narrower still: tighter cells, a status that
     may take two lines, items that wrap sooner. */
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-grid th,
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-grid td:not(.sh-rn){padding-left:4px;padding-right:4px}
  body:has(#veil.side.show) .sh[data-sheet="queue"] .q-acts{gap:3px}
  body:has(#veil.side.show) .sh[data-sheet="queue"] .q-acts .sh-act{padding:0 7px}
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-grid td.sh-wrap{min-width:104px}
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-grid .sh-rn{width:30px;min-width:30px}
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-st{white-space:normal;align-items:flex-start}
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-st::before{margin-top:5px}
}
/* Below 1600px the Paying fund steps out beside the panel too (the panel
   names it for the open row), so the row's button never needs a sideways scroll. */
@media (min-width:1081px) and (max-width:1599px){
  body:has(#veil.side.show) .sh[data-sheet="queue"] .sh-grid tr > :nth-child(9){display:none}
}
/* The details panel: the date never breaks, the request ID is read in full. */
.q-nowrap{white-space:nowrap}
.q-id{font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;overflow-wrap:anywhere;user-select:all}
/* Its item lines become short cards on a phone, so nothing is cut at the edge. */
@media (max-width:720px){
  .q-lines-wrap{overflow:visible;border:0}
  .q-lines,.q-lines tbody,.q-lines tr,.q-lines td{display:block;width:auto;min-width:0}
  .q-lines thead{display:none}
  .q-lines tr{padding:8px 0;border-bottom:1px solid var(--sag-line)}
  .q-lines td{padding:0;border:0;white-space:normal;height:auto;font-size:13px;color:var(--sag-text-2)}
  .q-lines td:first-child{font-weight:600;font-size:14px;color:var(--sag-text)}
  .q-lines td:not(:first-child)::before{content:attr(data-label) ": ";color:var(--sag-text-3);font-weight:500}
  .q-lines td[data-empty]{display:none}
}
.sh-grid .q-sec{font-size:11.5px;line-height:1.3;color:var(--sag-text-3);font-weight:500}

/* ── Phone ── a short phrase reads inline after its label; the "Not sent
   yet" line under each section's name wraps rather than being cut. */
@media (max-width:720px){
  .sh-grid td .q-soft{display:inline;max-width:none;min-width:0}
  .mg-unsent .mg-main small{white-space:normal;overflow:visible;text-overflow:clip}
}
@media (max-width:720px){
  .q-dates{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
  .q-date,.q-date input{min-width:0}
  .veil.side .modal-scroll>.modal-bd{flex:1 1 auto}
}
/* Wide screens have the room: a fund name stays on one line where it can. */
@media (min-width:1500px){.sh-grid td .q-soft{max-width:260px}}

/* ══ Work queue and History, round 1 (H17–H24) ══ */

/* Work queue's Cards | Sheet is in its header; History keeps its own bar. */
.q-datebar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 0 8px}
.q-datebar[hidden]{display:none}
.q-datebar .q-view{margin-left:auto}
.q-view-slot{display:flex;align-items:center;flex:0 0 auto}
.q-dates-t{display:inline-flex;gap:6px;flex:none;white-space:nowrap}
.q-dates-t svg{width:14px;height:14px;flex:none}
.q-cards-view svg,.q-view svg{width:14px;height:14px;flex:none}
.q-cards-view .sh-search{width:220px}
.q-clear{height:30px}
.q-clear:disabled{opacity:.45;cursor:default}
.q-clear:disabled:hover{background:var(--sag-surface);border-color:var(--sag-line)}
@media (pointer:coarse){.q-clear{height:44px}}
@media (max-width:720px){
  .q-datebar{align-items:flex-start}
}

/* The next step is an icon; its word floats beside it on hover or keyboard
   focus, never over the row below or behind the frozen header. A finger sees
   the word of the main step. */
.q-step{position:relative}
@media (hover:hover) and (pointer:fine){
  .q-acts .q-step{width:26px;padding:0}
  .q-acts .q-step .q-step-l{position:absolute;right:calc(100% + 6px);top:50%;transform:translateY(-50%);padding:3px 8px;border-radius:6px;
    background:var(--sag-primary,var(--sag-primary));color:var(--sag-on-primary);font-size:11.5px;font-weight:600;line-height:1.35;white-space:nowrap;
    pointer-events:none;opacity:0;z-index:5;box-shadow:var(--sag-shadow-2);transition:opacity .12s var(--sag-ease,ease) .15s}
  .q-acts .q-step:hover .q-step-l,.q-acts .q-step:focus-visible .q-step-l{opacity:1}
}

/* Over the items: the section (where the sheet is narrow) and the short reference. */
.q-meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px}
.q-ref{font:600 11px/1.3 ui-monospace,SFMono-Regular,Consolas,monospace;color:var(--sag-text-3,var(--sag-text-3));letter-spacing:.02em;white-space:nowrap}
.q-kv .q-ref,.modal-hd .q-ref,.invoice-queue-card .q-ref,.invoice-only .q-ref{font-size:12px;color:var(--sag-text-2,var(--sag-text-2))}
/* A filed (archived) request carries the archive mark beside its date. */
.q-day{white-space:nowrap}
.q-filed{display:inline-flex;vertical-align:-2px;margin-left:5px;color:var(--sag-icon,#8A9196)}
.q-filed svg{width:13px;height:13px}
.invoice-only{margin:0;align-self:end;font-size:13px}

/* ── Cards: one card per request (Q3) ──
   A grid of cards under each group heading: the month, then who pays with a
   swatch in the payer's colour. Each card carries the payer's colour as a bar
   down its left edge; the state chip says where it stands. Phones: one column. */
.q-tiles{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 10px}
.q-tiles .q-tile{height:auto;min-height:40px;padding:6px 14px;gap:8px;border-radius:var(--sag-r,8px)}
.q-tiles .q-tile b{font-size:18px;line-height:1}
.q-tiles .q-tile span{font-size:12.5px}
.q-tools{display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 10px}
.q-tools .q-grow{flex:1 1 auto}
.q-sortby{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;color:var(--sag-text-3)}
.q-sortby select{min-height:30px;padding:0 28px 0 10px;border:1px solid var(--sag-line-strong);border-radius:var(--sag-r,8px);
  font:13px var(--sag-font);color:var(--sag-text);background-color:var(--sag-surface)}
@media (pointer:fine){.q-sortby select{height:30px}}
/* As wide as its longest choice, as the system box was, so picking one never
   moves the row (a box drawn by the page sizes to the chosen words). */
.q-sortby select{min-width:176px}
.q-cards{display:flex;flex-direction:column}
.q-group{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 10px;margin:18px 0 8px;font-size:15px;font-weight:750;color:var(--sag-text)}
.q-cards>.q-group:first-child{margin-top:4px}
.q-group small{font-size:12px;font-weight:500;color:var(--sag-text-3);font-variant-numeric:tabular-nums}
.q-group-1{align-items:center;margin:8px 0 8px;font-size:13px;font-weight:700;color:var(--sag-text-2)}
.q-group-1::before{content:"";width:10px;height:10px;border-radius:3px;background:var(--sag-line-strong);flex:none}
.q-group-1.q-pay-company{color:var(--sag-pay-company-fg)}
.q-group-1.q-pay-company::before{background:var(--sag-pay-company)}
.q-group-1.q-pay-petty{color:var(--sag-pay-petty-fg)}
.q-group-1.q-pay-petty::before{background:var(--sag-pay-petty)}
.q-card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,290px),1fr));gap:10px;margin:0 0 4px}
.q-card{position:relative;display:flex;flex-direction:column;gap:6px;min-width:0;padding:12px 14px 10px 16px;
  border:1px solid var(--sag-line);border-radius:var(--sag-r-lg,12px);background:var(--sag-surface);box-shadow:var(--sag-shadow-1);
  cursor:pointer;transition:border-color .15s var(--sag-ease,ease),box-shadow .15s var(--sag-ease,ease)}
.q-card::before{content:"";position:absolute;left:0;top:12px;bottom:12px;width:4px;border-radius:0 4px 4px 0;background:var(--sag-line-strong)}
.q-card.q-pay-company::before{background:var(--sag-pay-company)}
.q-card.q-pay-petty::before{background:var(--sag-pay-petty)}
.q-card:hover{border-color:var(--sag-line-strong)}
.q-card:focus-visible{outline:none;box-shadow:var(--sag-ring)}
.q-card.q-open{border-color:var(--sag-primary);box-shadow:0 0 0 1px var(--sag-primary)}
.q-card-declined{background:var(--sag-app)}
.q-card-declined .q-card-items,.q-card-declined .q-card-money b{color:var(--sag-text-3)}
.q-card-top{display:flex;align-items:center;gap:8px;min-width:0}
.q-card-day{font-size:12px;color:var(--sag-text-3);white-space:nowrap}
.q-card-state{margin-left:auto;display:flex;flex-wrap:wrap;justify-content:flex-end;gap:4px}
.q-card-items{margin:2px 0 0;font-size:14px;font-weight:650;line-height:1.35;color:var(--sag-text);overflow-wrap:anywhere}
.q-card-who{margin:0;font-size:12.5px;color:var(--sag-text-2)}
.q-card-money{display:flex;flex-wrap:wrap;gap:4px 22px;margin:2px 0 0}
.q-card-money span{display:flex;flex-direction:column;gap:1px}
.q-card-money small,.q-card-facts small{font-size:12px;font-weight:500;color:var(--sag-text-3)}
.q-card-money b{font-size:15px;font-weight:700;color:var(--sag-text);font-variant-numeric:tabular-nums}
.q-card-facts{display:flex;flex-wrap:wrap;gap:2px 16px;margin:0;font-size:12.5px;color:var(--sag-text-2)}
.q-card-facts small::after{content:":"}
.q-card-foot{display:flex;justify-content:flex-end;margin-top:auto;padding-top:8px;border-top:1px solid var(--sag-line)}
/* On a card the next step says its word: there is room, and no row below for it to cover. */
.q-card-foot .q-acts .q-step{width:auto;padding:0 10px;gap:6px}
.q-card-foot .q-acts .q-step .q-step-l{position:static;transform:none;opacity:1;padding:0;background:none;color:inherit;box-shadow:none;
  font-size:12.5px;font-weight:600;pointer-events:none}
.q-cards-total{margin:12px 0 0;padding:10px 14px;border-top:2px solid var(--sag-primary);background:var(--sag-app);border-radius:0 0 var(--sag-r,8px) var(--sag-r,8px);
  font-size:13px;color:var(--sag-text-2);font-variant-numeric:tabular-nums}
.q-cards-total b{color:var(--sag-text)}

/* ── History fills its dialog: the rows' own box takes the space between the
   header and the footer, so the totals under it are never behind the footer
   (historyScroller in lists-admin-ui.js reads this box). ── */
@media (min-width:721px){
  .modal:has(#admin-history-list) .modal-scroll{height:calc(100dvh - 40px)}
  .modal:has(#admin-history-list) .modal-scroll>.modal-bd.q-hist-bd{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;overflow:hidden}
}
.q-hist-bd #admin-history-list{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
.q-hist-bd #admin-history-list>.q-body{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
.q-hist-bd #admin-history-list .sh{flex:1 1 auto;min-height:0;display:flex;flex-direction:column}
.q-hist-bd #admin-history-list .sh>.sh-scroll{flex:1 1 auto;min-height:120px}
.modal .q-hist-bd .sh[data-sheet="history"]{--sh-max-h:none}
.q-hist-bd #admin-history-list .q-cards-view{flex:1 1 auto;min-height:0;overflow:auto}

/* E13-E14: receipt-first purchases. "Bought already" sits beside the state, the
   drop zones look like the receipt dialog's own, and the review sheet's lines
   become labelled cards on a phone. */
.q-bought{display:inline-flex;align-items:center;min-height:20px;padding:2px 7px;margin-left:4px;border-radius:var(--sag-r-sm,6px);
  font-size:11.5px;font-weight:600;white-space:nowrap;background:var(--sag-slate-bg,#EEF2F4);color:var(--sag-slate-fg,#334A55)}
/* B59: read from Erik's cash workbook. The same chip, with a sheet beside its
   words: the order was made from the Excel, or took its payment from it. */
.q-bought.q-excel{gap:4px}
.q-bought.q-excel svg{flex:none;width:12px;height:12px}
.rf-slot{margin:0 0 12px}
.rf-slot[hidden]{display:none}
.rf-drop-btn{display:flex;align-items:center;gap:10px;width:100%;min-height:44px;padding:10px 14px;border:1.5px dashed var(--line,#D5DCDF);
  border-radius:10px;background:var(--surface,var(--sag-surface));color:var(--ink-2,#3C4B52);font:inherit;font-size:13px;text-align:left;cursor:pointer}
.rf-drop-btn svg{width:18px;height:18px;flex:none;color:var(--muted,#6B7A80)}
.rf-drop-btn:hover,.rf-drop-btn.over{border-color:var(--sag-line-strong,var(--sag-line-strong));background:var(--surface-2,#F7F9F9)}
.rf-drop-btn.btn{width:auto;min-height:0;border-style:dashed;gap:6px;text-align:center}
.rf-drop-btn.btn svg{width:14px;height:14px}
#rf-queue{display:inline-flex}
/* B29: a till roll is tall, so its import sheet is a portrait workspace rather
   than inheriting Storage's report width. Header and actions stay put while a
   long reviewed receipt scrolls between them. */
.modal.receipt-import{width:min(780px,calc(100vw - 32px));max-width:min(780px,calc(100vw - 32px));
  height:min(900px,calc(100dvh - 32px));max-height:min(900px,calc(100dvh - 32px))}
.modal.receipt-import .modal-scroll{height:100%;display:flex;flex-direction:column;overflow:hidden}
.modal.receipt-import .modal-hd,.modal.receipt-import .modal-ft{flex:none}
.modal.receipt-import .rf-dialog-body{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}
.rf-file-input,#rf-file{display:none!important}
/* The shared receipt drop zone draws a dark reading badge from data-reading.
   This flow already has the labelled status row below it and does not set that
   attribute, so the empty badge was the unexplained black pill over the copy. */
.receipt-import .rf-drop.reading::after{display:none}
.rf-upload-stage{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:14px;padding:14px;
  min-height:150px;border:1.5px dashed var(--line,#D5DCDF);border-radius:12px;background:var(--surface-2,#F7F9F9)}
.rf-upload-stage:has(.rf-drop.has-photo){border-style:solid;background:var(--surface,var(--sag-surface));box-shadow:0 8px 24px rgba(27,48,56,.06)}
.rf-upload-stage>.btn{margin-right:4px;white-space:nowrap}
.rf-drop{display:grid;grid-template-columns:1fr;align-items:center;justify-items:center;gap:10px;min-width:0;min-height:120px;
  padding:8px;border:0;background:transparent;text-align:center;cursor:pointer}
.rf-drop-preview{display:grid;place-items:center;min-width:0}
.rf-drop-icon{display:grid;place-items:center;width:52px;height:52px;border-radius:12px;background:var(--surface,var(--sag-surface));color:var(--muted,#6B7A80);
  box-shadow:inset 0 0 0 1px var(--line,#D5DCDF)}
.rf-drop-icon svg{width:26px;height:26px;display:block}
.rf-drop-copy{min-width:0}
.rf-drop-copy p{margin:0}
.rf-drop-copy .rc-drop-big{font-size:15px;font-weight:650;color:var(--ink,var(--sag-text))}
.rf-drop-help{margin-top:4px!important;font-size:13px;line-height:1.45;color:var(--muted,#6B7A80)}
.rf-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:15px;font-weight:650;color:var(--ink,var(--sag-text))}
.rf-file-name[hidden]{display:none}
.rf-drop.reading{pointer-events:none}
.rf-drop.has-photo{grid-template-columns:168px minmax(0,1fr);justify-items:stretch;text-align:left}
.rf-drop.has-photo .rc-drop-big{display:none}

/* B82: the shared receipt and invoice dialogs's single-preview variant. The same photo
   accepts replacements and opens the existing OCR viewer; only item rows
   need to scroll. Payment fields and actions keep their standard controls. */
.modal-scroll>.receipt-upload.receipt-preview{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);
  grid-template-rows:auto minmax(0,1fr) auto;gap:10px 14px}
.receipt-upload.receipt-preview [hidden]{display:none!important}
.receipt-upload.receipt-preview #rc-drop{grid-column:1;grid-row:1/-1;align-self:stretch;min-height:0;
  display:flex;flex-direction:column;align-items:center;justify-content:center}
.receipt-upload.receipt-preview #rc-drop.has-file{padding:8px;gap:8px;align-items:stretch;text-align:left;cursor:default}
.receipt-preview .receipt-photo{display:flex;flex:1;min-height:0;min-width:0}
.receipt-preview .inv-read-preview{display:grid;grid-template-rows:minmax(0,1fr) auto;gap:8px;flex:1;min-height:0;
  align-items:stretch;justify-content:stretch;margin:0;padding:4px;border:0;box-shadow:none;background:transparent;color:var(--sag-text);cursor:zoom-in}
.receipt-preview [data-reading-picture]{position:relative;overflow:hidden;min-width:0;min-height:0}
.receipt-upload.receipt-preview #rc-drop img{position:absolute;inset:0;display:block;width:100%;height:100%;max-width:100%;max-height:100%;object-fit:contain;border-radius:6px}
.receipt-preview [data-reading-photo-label]{font-size:12px;line-height:1.4}
.receipt-preview .receipt-attachment-info{font-size:12px;color:var(--sag-text-3)}
.receipt-preview .receipt-attachment-info p{margin:0}
.receipt-upload.receipt-preview #rc-clear{top:8px;right:8px;z-index:2}
.receipt-upload.receipt-preview .rc-review-body:not([hidden]){display:contents}
.receipt-upload.receipt-preview .rc-payment-fields{grid-column:2;grid-row:1;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.receipt-upload.receipt-preview .rc-ocr{grid-column:2;grid-row:2;overflow:hidden}
.receipt-upload.receipt-preview .rc-review-fields{grid-column:2;grid-row:3;display:flex;overflow:visible}
.receipt-preview #invoice-reading{display:flex;flex:1;min-height:0;min-width:0}
.receipt-preview .inv-reading{display:flex;flex-direction:column;flex:1;min-height:0;min-width:0;gap:8px;margin:0}
.receipt-preview .inv-reading h3{font-size:14px;line-height:1.4;margin:0}
.receipt-preview .inv-reading [data-reading-status]{font-size:12px;line-height:1.4;margin:0}
.receipt-preview [data-reading-result]{flex:1;min-height:0;overflow:auto;overscroll-behavior:contain}
.receipt-preview .inv-read-pages{margin:0 0 8px}
.receipt-preview .inv-read-pages:empty{display:none}
.receipt-preview .inv-read-facts{font-size:12px;line-height:1.4;margin:4px 0}
.receipt-preview .inv-read-items{font-size:12px;line-height:1.5;margin:8px 0}
.receipt-preview .inv-read-items li{gap:8px;border-color:var(--sag-line)}
.receipt-preview .inv-read-total{font-size:13px;line-height:1.4;margin:0;padding:8px 0;border-color:var(--sag-line)}
.receipt-preview .inv-read-text{font-size:12px;line-height:1.4}
.receipt-preview .inv-reading [data-reading-retry]{align-self:flex-start;margin:0}
/* B85: an empty upload has no comparison to reserve a column for. */
.modal-scroll>.receipt-preview:not(:has(#rc-drop.has-file)){grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(160px,1fr) auto}
.receipt-preview:not(:has(#rc-drop.has-file)) #rc-drop{grid-column:1;grid-row:1;min-height:180px}
.receipt-preview:not(:has(#rc-drop.has-file)) .rc-payment-fields{grid-column:1;grid-row:2}
@media(min-width:721px){
  .modal.wide.storage:has(.receipt-preview):not(:has(#rc-drop.has-file)){width:min(700px,calc(100vw - 32px));max-width:min(700px,calc(100vw - 32px))}
  .modal:has(.receipt-preview):not(:has(#rc-drop.has-file)) .modal-scroll{height:auto;max-height:calc(100dvh - 40px)}
  .modal-scroll>.receipt-preview:not(:has(#rc-drop.has-file)){flex:0 0 auto;grid-template-rows:auto auto}
}
.receipt-preview:not(.invoice-upload) .rc-review-fields{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:8px}
.receipt-preview .receipt-extra-fields{position:relative;min-width:0}
.receipt-extra-fields>summary{list-style:none}
.receipt-extra-fields>summary::-webkit-details-marker{display:none}
.receipt-extra-content{position:absolute;bottom:calc(100% + 8px);right:0;z-index:12;width:min(400px,calc(100vw - 48px));
  max-height:min(400px,55dvh);overflow:auto;padding:12px;background:var(--sag-surface);border:1px solid var(--sag-line-strong);
  border-radius:10px;box-shadow:0 8px 24px rgba(0,0,0,.16);display:grid;gap:12px}
.receipt-extra-content .fld{margin:0}
.receipt-extra-content .fld>label{font-size:12px;line-height:1.4;margin-bottom:4px}
.receipt-extra-content .rc-parking{margin:0}
.receipt-extra-content .rc-reading-info{position:static;width:auto;max-width:100%;max-height:160px;box-shadow:none}
.receipt-preview:not(.invoice-upload) .rc-ocr-head>b{position:static;width:auto;height:auto;clip:auto;overflow:visible}
@media(min-width:721px){
  .receipt-preview:not(.invoice-upload) .rc-grid{grid-template-columns:minmax(0,1fr) 72px 94px 94px 28px}
}
@media(max-width:720px){
  .modal:has(.receipt-preview) .modal-hd p{padding-right:76px}
  .modal-scroll>.receipt-upload.receipt-preview{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(140px,28%) auto minmax(0,1fr) auto;gap:8px}
  .receipt-upload.receipt-preview #rc-drop{grid-column:1;grid-row:1}
  .receipt-upload.receipt-preview .rc-payment-fields{grid-column:1;grid-row:2}
  .receipt-upload.receipt-preview .rc-payment-fields .review-field{grid-column:1;grid-row:auto}
  .receipt-upload.receipt-preview .rc-payment-fund{grid-column:2;grid-row:auto}
  .receipt-upload.receipt-preview .rc-ocr{grid-column:1;grid-row:3}
  .receipt-upload.receipt-preview .rc-review-fields{grid-column:1;grid-row:4}
}
.rf-drop.has-photo .rf-drop-preview{height:136px;border:1px solid var(--line,#D5DCDF);border-radius:10px;background:var(--surface-2,#F7F9F9);overflow:hidden}
.rf-drop.has-photo.has-image .rf-drop-icon{display:none}
.rf-thumb{display:block;width:100%;height:100%;object-fit:contain;margin:0;cursor:zoom-in}
.rf-thumb[hidden]{display:none}
.receipt-import .rf-upload-stage{grid-template-columns:1fr;align-items:stretch;padding:16px}
.receipt-import .rf-upload-stage>.btn{justify-self:end;margin:0}
.receipt-import .rf-drop.has-photo{grid-template-columns:minmax(220px,280px) minmax(0,1fr);align-items:center;min-height:390px;gap:20px}
.receipt-import .rf-drop.has-photo .rf-drop-preview{height:clamp(340px,48dvh,500px);border-radius:12px}
.rf-status{font-size:13px;color:var(--ink-2,#3C4B52);margin:10px 0 0;min-height:1em}
.rf-status:empty{display:none}
.rf-status:not(:empty){display:flex;align-items:center;flex-wrap:wrap;gap:9px;padding:10px 12px;border:1px solid var(--line,#D5DCDF);
  border-radius:9px;background:var(--surface-2,#F7F9F9)}
.rf-status .btn{flex:none;margin:0 0 0 auto}
.rf-dialog-body:has(.rf-drop.reading) .rf-status{font-weight:600}
.rf-dialog-body:has(.rf-drop.reading) .rf-status::before{content:"";width:14px;height:14px;flex:none;border:2px solid var(--line,#D5DCDF);
  border-top-color:var(--sag-primary,var(--sag-text));border-radius:50%;animation:rf-spin .75s linear infinite}
@keyframes rf-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:reduce){.rf-dialog-body:has(.rf-drop.reading) .rf-status::before{animation:none}}
#rf-form:not(:empty){margin-top:14px;padding-top:14px;border-top:1px solid var(--line,#D5DCDF)}
.rf-facts{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) auto;gap:10px;margin:14px 0 12px}
.rf-facts label,.rf-fund-field{display:grid;gap:4px;font-size:12px;font-weight:600;color:var(--muted,#6B7A80);min-width:0}
.rf-facts input,.rf-facts select,.rf-totals input,.rf-note input,.rf-lines input,.rf-lines select{height:36px;min-width:0;width:100%;padding:0 10px;
  border-radius:8px;border:1.5px solid var(--line,var(--sag-line));background:var(--surface-2,#F7F9F9);font:inherit;font-size:13.5px;font-weight:400;color:var(--ink,var(--sag-text))}
.rf-facts input:focus,.rf-totals input:focus,.rf-note input:focus,.rf-lines input:focus{background:var(--surface,var(--sag-surface))}
.rf-fund{width:max-content}
.rf-table-wrap{max-height:310px;overflow:auto;border:1px solid var(--line,#D5DCDF);border-radius:10px;background:var(--surface,var(--sag-surface))}
.rf-lines{width:100%;border-collapse:collapse;font-size:13px}
.rf-lines th{position:sticky;top:0;z-index:1;text-align:left;font-size:11.5px;font-weight:600;color:var(--muted,#6B7A80);padding:8px 7px;
  border-bottom:1px solid var(--line,var(--sag-line));background:var(--surface-2,#F7F9F9)}
.rf-lines td{padding:6px;border-bottom:1px solid var(--line-2,var(--sag-line));vertical-align:middle}
.rf-lines td:nth-child(3){width:76px}
.rf-lines td:nth-child(4){width:120px}
.rf-read{color:var(--ink-2,#3C4B52);font-size:12.5px;min-width:130px;max-width:200px;overflow-wrap:break-word}
.rf-item{min-width:180px}
.rf-item input{margin-top:6px}
.rf-item input[hidden]{display:none}
.rf-line-total{text-align:right;white-space:nowrap;font-variant-numeric:tabular-nums}
.rf-remove{width:32px;height:32px;font-size:18px;line-height:1}
#rf-add{margin-top:10px}
.rf-extra{font-size:12px;color:var(--muted,#6B7A80);margin:10px 0 0}
.rf-totals{display:flex;flex-wrap:wrap;align-items:flex-end;gap:12px;margin-top:14px}
.rf-totals label,.rf-note{display:grid;gap:4px;font-size:12px;font-weight:600;color:var(--muted,#6B7A80)}
.rf-totals label{flex:0 1 220px}
.rf-sum{font-size:13px;color:var(--ink-2,#3C4B52);margin:0 0 8px}
.rf-note{margin-top:12px}
@media (max-width:760px){
  .veil:has(.modal.receipt-import){padding:0;align-items:stretch}
  .modal.receipt-import{width:100%;max-width:100%;height:100dvh;max-height:100dvh;border-radius:0}
  .rf-upload-stage{grid-template-columns:1fr;justify-items:stretch}
  .rf-upload-stage>.btn{justify-self:end;margin:0}
  .rf-drop.has-photo{grid-template-columns:124px minmax(0,1fr)}
  .rf-drop.has-photo .rf-drop-preview{height:112px}
  .rf-facts{grid-template-columns:1fr 1fr}
  .rf-fund-field{grid-column:1 / -1}
  .rf-lines thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
  .rf-lines,.rf-lines tbody,.rf-lines tr,.rf-lines td{display:block;width:auto}
  .rf-lines tr{position:relative;padding:10px 40px 10px 0;border-bottom:1px solid var(--line,var(--sag-line))}
  .rf-lines td{border:0;padding:3px 0}
  .rf-lines td:nth-child(3),.rf-lines td:nth-child(4){display:inline-block;width:calc(50% - 6px);vertical-align:top}
  .rf-lines td:nth-child(3){margin-right:12px}
  .rf-lines td[data-label]::before{content:attr(data-label);display:block;font-size:11px;font-weight:600;color:var(--muted,#6B7A80);margin-bottom:2px}
  .rf-line-total{text-align:left}
  .rf-lines td:last-child{position:absolute;top:8px;right:0;padding:0}
  .rf-read{max-width:none}
  .rf-remove{width:44px;height:44px}
}
@media (max-width:420px){
  .rf-drop.has-photo{grid-template-columns:1fr;text-align:center}
  .rf-drop.has-photo .rf-drop-preview{height:clamp(260px,44dvh,360px)}
  .rf-file-name{white-space:normal;overflow-wrap:anywhere}
  .rf-status .btn{width:100%;margin:0;justify-content:center}
  .rf-facts{grid-template-columns:1fr}
}

/* Who pays, on the Work queue (Ahmed, 27 Oct 2026): the company's rows in
   slate, Erik's petty cash rows in gold -- a stripe down the left edge and a
   light tint, and the same on their group heading. Hover, focus and the row
   open in the side panel still show over it. The State column keeps its
   words: the colour says who pays, not where the request stands. */
.sh-grid tr.q-pay-company>td{background:var(--sag-pay-company-bg)}
.sh-grid tr.q-pay-petty>td{background:var(--sag-pay-petty-bg)}
.sh-grid tr.q-pay-company>td.sh-rn{box-shadow:inset 4px 0 0 var(--sag-pay-company)}
.sh-grid tr.q-pay-petty>td.sh-rn{box-shadow:inset 4px 0 0 var(--sag-pay-petty)}
.sh-grid tr.sh-group.q-pay-company>th{background:var(--sag-pay-company-bg);color:var(--sag-pay-company-fg);
  box-shadow:inset 4px 0 0 var(--sag-pay-company)}
.sh-grid tr.sh-group.q-pay-petty>th{background:var(--sag-pay-petty-bg);color:var(--sag-pay-petty-fg);
  box-shadow:inset 4px 0 0 var(--sag-pay-petty)}
@media (max-width:720px){
  .sh-grid tbody tr.q-pay-company{background:var(--sag-pay-company-bg);box-shadow:inset 4px 0 0 var(--sag-pay-company)}
  .sh-grid tbody tr.q-pay-petty{background:var(--sag-pay-petty-bg);box-shadow:inset 4px 0 0 var(--sag-pay-petty)}
  .sh-grid tbody tr.q-pay-company>td,.sh-grid tbody tr.q-pay-petty>td{background:none}
}

/* ── The Work queue's toolbar, one standard (Ahmed, 27 Oct 2026) ──
   "The buttons are very messy and misaligned": the rows above the requests
   mixed 26, 30 and 40px controls, big filled tiles beside small chips, a
   dashed button and three kinds of button. Now every control there is one
   height (--q-ctl: 32px with a mouse, 44px under a finger), one radius and
   one quiet bordered style, the way Notion and Datadog keep a toolbar:
     the head        title and count; e-Meterai, Cards | Sheet, Import receipt, the icons
     the filter bar  the state chips and calendar Filter; Sort by; Export and Search on the right
   In Cards the chips and the tools share one row, as the sheet's do. */
:root{--q-ctl:32px}
@media (pointer:coarse){:root{--q-ctl:44px}}

.admin-queue .pane-head{align-items:center;gap:8px 12px}
.admin-queue .pane-head .pane-tools{display:flex;align-items:center;flex-wrap:wrap;gap:6px}
.admin-queue .pane-head .pane-tools .btn{height:var(--q-ctl);min-height:var(--q-ctl);border-radius:var(--sag-r,8px);font-size:13px}
.admin-queue .pane-head .pane-tools .btn.ibtn{min-width:var(--q-ctl);padding:0 8px}
.admin-queue .pane-head .rf-drop-btn.btn{border-style:solid;border-width:1px}
.admin-queue .pane-head .em-chip{padding:0 12px}

.q-datebar{display:flex;align-items:center;flex-wrap:wrap;gap:8px;margin:0 0 10px}
.q-dates{gap:8px}
.q-date input,.q-dates .sh-chip.q-period,.q-clear,.q-tiles .q-tile,.q-sortby select,
.admin-queue .sh-search,.admin-queue .sh-act[data-q-export],.q-dates-t,
.sh[data-sheet="queue"] .sh-chip,.sh[data-sheet="history"] .sh-chip{
  height:var(--q-ctl);min-height:var(--q-ctl);border-radius:var(--sag-r,8px);font-size:13px}
.q-dates .sh-chip.q-period,.q-clear{padding:0 12px}
.q-clear{border-color:transparent;background:transparent}
.q-view{height:var(--q-ctl);padding:2px;border-radius:var(--sag-r,8px)}
.q-view button{height:calc(var(--q-ctl) - 4px);border-radius:6px;padding:0 10px;font-size:13px}
.admin-queue .sh-act[data-q-export]{padding:0 12px}
.sh[data-sheet="queue"] .sh-chip,.sh[data-sheet="history"] .sh-chip{padding:0 12px}

/* The state filters as compact chips -- the word, then its count -- the same
   chips the sheet shows, not 40px coloured tiles. */
.q-tiles{gap:6px;margin:0}
.q-tiles .q-tile{padding:0 12px;gap:6px}
.q-tiles .q-tile span{order:1;font-size:13px}
.q-tiles .q-tile b{order:2;font-size:13px;line-height:1}

/* Cards: the chips at the left and Sort by, Export and Search at the right,
   one row; the requests below take the width. */
.q-cards-view{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:12px;align-items:center}
.q-cards-view>*{grid-column:1/-1}
.q-cards-view>.q-tiles{grid-column:1;margin:0 0 12px}
.q-cards-view>.q-tools{grid-column:2;margin:0 0 12px;justify-content:flex-end}
.q-cards-view>.q-tools .q-grow{display:none}
@media (max-width:1100px){
  .q-cards-view>.q-tiles,.q-cards-view>.q-tools{grid-column:1/-1}
  .q-cards-view>.q-tiles{margin-bottom:8px}
  .q-cards-view>.q-tools{justify-content:flex-start}
  .q-cards-view>.q-tools .q-grow{display:block}
}
