/* ============================================================================================================
   UI stage 2 - shared pieces (tokens from styles.css only: three text sizes, 8-pt spacing, ok/warn/bad tints)
     .usheet           the one bottom sheet (ui2.js: uiSheetOpen)       .ui-hero      THE one hero block of a screen
     .ui-list/.ui-row  iOS-style grouped list (one tap per row)         .ui-fold      a fold: tap on phone/iPad, open on a wide desktop
     table.tbl-cards   a table that becomes cards under 768 px          .ui-only-*    show/hide helpers
   ============================================================================================================ */

/* ---------- the bottom sheet (phone: slides up from the bottom; iPad/desktop: a centred panel) ---------- */
.usheet-scrim { display: none; position: fixed; inset: 0; z-index: 95; background: var(--scrim); opacity: 0; transition: opacity .18s ease; }
body.usheet-open .usheet-scrim { display: block; opacity: 1; }
.usheet {
  position: fixed; z-index: 96; left: 0; right: 0; bottom: 0; max-height: 88vh; display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-lg);
  padding: var(--sp-2) var(--sp-3) calc(var(--sp-3) + var(--safe-b));
  transform: translateY(100%); visibility: hidden;
  transition: transform .22s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .22s;            /* closed = not focusable either */
}
body.usheet-open .usheet { transform: none; visibility: visible; transition-delay: 0s; }
body.usheet-open { overflow: hidden; }
.usheet:focus { outline: none; }
.usheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-1) 0 var(--sp-2); }
.usheet-title { font-size: var(--fs-title); font-weight: 700; letter-spacing: -.02em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usheet-done { flex: none; color: var(--accent); font-weight: 600; }
.usheet-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; min-height: 0; flex: 1 1 auto; }
.usheet-body > .in-sheet { display: flex; flex-direction: column; gap: var(--sp-2); align-items: stretch; width: 100%; max-width: none; padding: 0; margin: 0; border: 0; box-shadow: none; background: none; position: static; }
.usheet-body > .in-sheet select, .usheet-body > .in-sheet input:not([type=checkbox]):not([type=radio]) { width: 100%; max-width: none; flex: 0 0 auto; }
@media (min-width: 768px) {
  .usheet { left: 50%; right: auto; bottom: auto; top: 50%; width: min(560px, calc(100vw - 48px)); max-height: min(80vh, 760px); border-radius: var(--r-lg);
    padding: var(--sp-3); transform: translate(-50%, -46%) scale(.98); opacity: 0; transition: transform .18s ease, opacity .18s ease, visibility 0s linear .18s; }
  body.usheet-open .usheet { transform: translate(-50%, -50%); opacity: 1; }
  .usheet .sheet-grab { display: none; }
}

/* ---------- the hero: one per screen ---------- */
.ui-hero {
  display: flex; flex-direction: column; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-3); padding: var(--sp-3);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow);
}
.ui-hero-k { font-size: var(--fs-small); font-weight: 600; color: var(--muted); }
.ui-hero-v { font-size: var(--fs-title); font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.ui-hero-s { font-size: var(--fs-small); color: var(--muted); }
.ui-hero-act { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.ui-hero.tone-ok { background: var(--ok-soft); } .ui-hero.tone-ok .ui-hero-v { color: var(--ok); }
.ui-hero.tone-warn { background: var(--warn-soft); } .ui-hero.tone-warn .ui-hero-v { color: var(--warn); }
.ui-hero.tone-bad { background: var(--bad-soft); } .ui-hero.tone-bad .ui-hero-v { color: var(--bad); }
.ui-hero.tone-accent { background: var(--accent-soft); } .ui-hero.tone-accent .ui-hero-v { color: var(--accent); }
@media (max-width: 767px) { .ui-hero-act .btn-primary { flex: 1 1 100%; justify-content: center; } }

/* ---------- iOS-style grouped list ---------- */
.ui-group-h { padding: 0 var(--sp-3) 6px; font-size: var(--fs-small); font-weight: 600; color: var(--muted); }
.ui-list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin: 0 0 var(--sp-3); }
.ui-row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px var(--sp-3);
  background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; color: var(--ink); font: inherit; font-size: var(--fs-body); cursor: pointer;
}
.ui-row:last-child { border-bottom: 0; }
.ui-row:active, .ui-row:hover { background: var(--surface-2); }
.ui-row-main { min-width: 0; flex: 1 1 auto; }
.ui-row-t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-row-s { font-size: var(--fs-small); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ui-row-v { margin-left: auto; font-weight: 700; white-space: nowrap; flex: none; }
.ui-row-v.ok { color: var(--ok); } .ui-row-v.warn { color: var(--warn); } .ui-row-v.bad { color: var(--bad); } .ui-row-v.muted { color: var(--muted); font-weight: 600; }
.ui-row .chev { color: var(--muted); flex: none; }
.ui-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--muted); }
.ui-dot.ok { background: var(--ok); } .ui-dot.warn { background: var(--warn); } .ui-dot.bad { background: var(--bad); }

/* ---------- a fold: a tap on phone/iPad (< 1025 px); on a wide desktop it is open and its label is the section heading ---------- */
.ui-fold { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 var(--sp-2); overflow: hidden; }
.ui-fold > summary { list-style: none; display: flex; align-items: center; gap: var(--sp-2); min-height: 48px; padding: 10px var(--sp-3); cursor: pointer; font-weight: 600; }
.ui-fold > summary::-webkit-details-marker { display: none; }
.ui-fold-n { font-size: var(--fs-small); font-weight: 600; color: var(--muted); background: var(--surface-2); padding: 1px 8px; border-radius: 999px; }
.ui-fold-h { margin-left: auto; font-size: var(--fs-small); font-weight: 400; color: var(--muted); }
.ui-fold > summary .chev { margin-left: auto; color: var(--muted); transition: transform .15s ease; flex: none; }
.ui-fold-h + .chev { margin-left: 0; }
.ui-fold[open] > summary .chev { transform: rotate(90deg); }
.ui-fold-body { padding: 0 var(--sp-3) var(--sp-3); }
@media (min-width: 1025px) {
  .ui-fold { background: none; border: 0; border-radius: 0; margin: 0; overflow: visible; }
  .ui-fold > summary { min-height: 0; padding: 0; margin: 18px 0 8px; cursor: default; pointer-events: none; font-size: var(--fs-body); font-weight: 700; }
  .ui-fold > summary .chev, .ui-fold-n { display: none; }
  .ui-fold-body { padding: 0; }
}

/* ---------- a table becomes cards under 768 px (add class tbl-cards; ui2.js labels the cells) ---------- */
@media (max-width: 767px) {
  table.tbl-cards, table.tbl-cards tbody { display: block; width: 100%; }
  table.tbl-cards thead { display: none; }
  table.tbl-cards tr { display: flex; flex-direction: column; gap: 2px; margin: 0 0 var(--sp-2); padding: 10px var(--sp-3); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
  table.tbl-cards td, table.tbl-cards th { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); width: auto !important; max-width: none !important; padding: 3px 0; border: 0; text-align: right; font-size: var(--fs-body); white-space: normal; }
  table.tbl-cards td[data-label]::before { content: attr(data-label); flex: 0 0 38%; max-width: 40%; text-align: left; font-size: var(--fs-small); color: var(--muted); }
  table.tbl-cards td.tc-title { display: block; text-align: left; font-weight: 700; padding: 0 0 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  table.tbl-cards td.tc-hide, table.tbl-cards td.tc-empty { display: none; }
  table.tbl-cards td.tc-foot { justify-content: flex-start; flex-wrap: wrap; margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--line); text-align: left; }
  table.tbl-cards td.tc-foot::before { display: none; }
  .tscroll:has(> table.tbl-cards) { overflow-x: visible; }
}

/* ---------- show / hide helpers ---------- */
.ui-only-phone, .ui-only-narrow { display: none; }
@media (max-width: 767px) { .ui-only-phone { display: revert; } .ui-not-phone { display: none !important; } }
@media (max-width: 1024px) { .ui-only-narrow { display: revert; } .ui-not-narrow { display: none !important; } }

/* [ui2:golive] ---------------------------------------------------------------------------------------- Go live */
.gl-hero { margin: var(--sp-2) 0 var(--sp-3); }
.gl-hero-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.gl-hero-top .gl-boardmenu > summary { min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; }
.gl-hero-num { display: flex; flex-direction: column; gap: 2px; }
.gl-hero-num .ui-hero-v { font-variant-numeric: tabular-nums; }
@media (min-width: 1025px) { .gl-hero-num { flex-direction: row; align-items: baseline; gap: var(--sp-3); } }
/* phone: one row per store; the full card opens in the sheet */
.gl-rows .ui-row-main > span { display: block; }
.gl-rows .ui-row { min-height: 56px; }
/* a tall pop-up on a phone could not be scrolled to its top (flex-end overflows upward): anchor it to the top and let the margin push a short one down */
@media (max-width: 767px) { .modal { align-items: flex-start; } .modal > .modal-card { margin-top: auto; } }
body.usheet-open .modal { z-index: 98; }                 /* a pop-up opened from a card inside the sheet sits above it */
.usheet-body > .gl-card.in-sheet { gap: var(--sp-2); }
.usheet-body > .gl-card.in-sheet .gl-name { display: none; }    /* the sheet's title already says the store */
/* the daily new-listings table: a card per store on a phone, with tap-sized controls */
@media (max-width: 767px) {
  .pace-card > summary { min-height: 40px; align-items: center; }
  .pace-wrap { overflow-x: visible; }
  .pace-tbl.tbl-cards td { text-align: right; }
  .pace-tbl.tbl-cards td.tc-title { text-align: left; }
  .pace-tbl .pace-day { padding: 8px 10px; margin: 0 2px 4px 0; }
  .pace-tbl select, .pace-tbl input.pace-target { min-height: 40px; padding: 6px 10px; }
  .pace-tbl .btn.sm { min-height: 40px; }
  .pace-tbl .pace-blk { white-space: normal; text-align: left; border-radius: var(--r); padding: 6px 10px; display: block; margin: 0 0 4px; }
}
/* [/ui2:golive] */


/* [ui2:products] ----------------------------------------------------------------------------------------- Products */
/* Desktop (>= 1025): the controls bar is exactly as before - the wrapper dissolves, the Filters button is not there. */
.prod-ctl { display: contents; }
.prod-fbtn { display: none; }
/* Desktop: the Filters panel opens from the RIGHT edge of the controls bar and never wider than it (2026-10-23: .tabpage clips
   overflow-x, so a panel opened rightward from the Filters button ran off the screen and its right half could not be reached) */
@media (min-width: 1025px) {
  #tab-products > .controls { position: relative; }
  #tab-products > .controls > .prod-ctl > .viewmenu { position: static; }
  #tab-products > .controls > .prod-ctl > .viewmenu[open] > .viewmenu-body { left: auto; right: 16px; top: calc(100% - 4px); max-width: calc(100% - 32px); max-height: calc(100vh - 160px); overflow: auto; }
}
/* Phone + iPad (< 1025): search + ONE Filters button; everything else is in the shared sheet (the wrapper is moved there, not copied) */
@media (max-width: 1024px) {
  #tab-products > .controls { flex-wrap: nowrap; gap: var(--sp-2); }
  #tab-products > .controls > .search { flex: 1 1 0; }
  .prod-fbtn { display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 44px; padding: 0 var(--sp-3); font-weight: 600; color: var(--accent); }
  .prod-fbtn.on { background: var(--accent-soft); border-color: var(--accent); }
  .prod-fn { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-fill); color: #fff; font-size: var(--fs-small); font-weight: 700; }
  .prod-fn[hidden] { display: none; }
  .prod-ctl { display: none; }
  /* ... and inside the sheet: one column, store first, then sort / page size, then the filters, then "Add a product" */
  .prod-ctl.in-sheet { gap: var(--sp-3); }
  .prod-ctl.in-sheet #storePick { order: 1; }
  .prod-ctl.in-sheet #needsNameChip { order: 2; justify-content: center; }
  .prod-ctl.in-sheet .viewmenu { order: 3; display: block; width: 100%; }
  .prod-ctl.in-sheet #addProductBtn { order: 4; justify-content: center; }
  .prod-ctl.in-sheet .viewmenu > summary { display: none; }
  .prod-ctl.in-sheet .viewmenu[open] > .viewmenu-body { position: static; min-width: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: none; gap: var(--sp-3); }
  .prod-ctl.in-sheet #flSortRow { order: 1; }
  .prod-ctl.in-sheet #flFilterRow { order: 2; }
  .prod-ctl.in-sheet #savedFiltersBox { order: 3; }
  .prod-ctl.in-sheet #photoSizesBox { order: 4; }
  .prod-ctl.in-sheet #flRulesRow { order: 5; }
  .prod-ctl.in-sheet .fl-row { gap: var(--sp-2); }
  .prod-ctl.in-sheet .fl-row > b { flex: 1 0 100%; min-width: 0; color: var(--muted); font-weight: 600; }
  .prod-ctl.in-sheet .fl-row select.select, .prod-ctl.in-sheet .fl-row input.search { flex: 1 1 100% !important; min-height: 44px; }
  .prod-ctl.in-sheet .fl-row .btn, .prod-ctl.in-sheet .fl-row .btn-sm { min-height: 40px; }
  .prod-ctl.in-sheet .fl-row .toggle { min-height: 40px; }
  .prod-ctl.in-sheet #storePick, .prod-ctl.in-sheet .btn { min-height: 44px; }
}
/* [/ui2:products] */


/* [ui2:item] ---------------------------------------------------------------------------------------- Product page */
/* Phone + iPad (< 1025): photo + three facts (name, cost, ready or why not) + the buttons; every section is a fold that looks like the shared ui-fold.
   Desktop (>= 1025) keeps today's page. The head's extra lines are folded by ppArrangeHead() (screens.js). */
@media (max-width: 1024px) {
  .pp-head { gap: var(--sp-3); margin-bottom: var(--sp-3); }
  .pp-main { gap: var(--sp-2); }
  .pp-ready { font-size: var(--fs-body); font-weight: 600; }
  .pp-actions { gap: var(--sp-2); margin-top: var(--sp-2); }
  .pp-actions .btn-primary { flex: 1 1 100%; min-height: 48px; justify-content: center; font-weight: 600; }
  .pp-actions { align-items: stretch; }
  .pp-actions .btn { flex: 1 1 auto; min-height: 44px; justify-content: center; white-space: nowrap; }
  .pp-actions .pp-approved { flex: 1 1 100%; }
  /* the folds: label, chevron on the right, the old grey explanation as a quiet second line */
  .pp-folds { gap: var(--sp-2); }
  .pp-fold { border-radius: var(--r); overflow: hidden; }
  .pp-fold > summary { display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--sp-2); min-height: 48px; padding: 10px var(--sp-3); list-style: none; }
  .pp-fold > summary::-webkit-details-marker { display: none; }
  .pp-fold > summary > .pp-fold-t { display: contents; }
  .pp-fold > summary::after { content: "›"; order: 1; margin-left: auto; color: var(--muted); font-weight: 600; transition: transform .15s ease; }
  .pp-fold[open] > summary::after { transform: rotate(90deg); }
  .pp-fold > summary .hint { order: 2; flex: 1 0 100%; font-size: var(--fs-small); color: var(--muted); }
  .pp-fold-b { padding: 0 var(--sp-3) var(--sp-3); }
  /* the folds made from the head (waiting for your OK / stores and item details) */
  .pp-headfold { margin: 0; }
  .pp-headfold .pp-wait-t { display: none; }
  .pp-headfold .pp-wait { border: 0; background: none; padding: 0; margin: 0; }
  .pp-headfold .pp-wait-h { font-weight: 400; color: var(--muted); }
  .pp-headfold .pp-sub { margin-bottom: var(--sp-2); }
  .pp-headfold .pp-stores { margin-bottom: var(--sp-2); }
}
/* [/ui2:item] */


/* [ui2:listings] ------------------------------------------------------------------------------------------ Listings */
/* narrow (phone + iPad): hero first, the filter row folded to one line, the cards, then the health card; desktop keeps the table */
@media (min-width: 1025px) { .ls-barfold > summary { display: none; } }
.ls-barfold, .ls-barfold > .ui-fold-body { overflow: visible; }
@media (max-width: 1024px) {
  .ls-wrap { display: flex; flex-direction: column; }
  .ls-wrap > * { order: 4; min-width: 0; }
  .ls-wrap > #lsHero { order: 1; }
  .ls-wrap > .ls-barfold, .ls-wrap > #lsMsg { order: 2; }
  .ls-wrap > #lsTodo { order: 3; }
  .ls-wrap > #lsHealth { order: 6; margin-top: var(--sp-3); }
  .ls-barfold .ls-bar { margin: 0; }
  .ls-barfold .ls-bar .btn-sm { min-height: 40px; }
  .ls-barfold .ls-bar select, .ls-barfold .ls-bar input { min-height: 40px; }
  .ls-detailsfold { margin-top: var(--sp-3); }
  .ls-detailsfold .tblwrap { overflow-x: auto; }
}
.ls-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); }
@media (min-width: 768px) { .ls-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ls-card { display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; padding: var(--sp-2) var(--sp-3); background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.ls-card.is-loss { border-left: 4px solid var(--bad); }
.ls-card-h { display: flex; align-items: flex-start; gap: 12px; }
.ls-card-h .ls-th { width: 48px; height: 48px; flex: 0 0 48px; }
.ls-card-t { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.ls-card-t > a, .ls-card-t > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink); text-decoration: none; padding: 2px 0; overflow-wrap: anywhere; }
.ls-card-s { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: var(--fs-small); font-weight: 400; color: var(--muted); }
.ls-card-ext { flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; color: var(--accent); text-decoration: none; }
.ls-card-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.ls-card-nums > div { display: flex; flex-direction: column; min-width: 0; }
.ls-card-nums span { font-size: var(--fs-small); color: var(--muted); font-weight: 400; }
.ls-card-nums b { font-size: var(--fs-body); font-weight: 700; }
.ls-card-nums .ls-card-n { font-size: var(--fs-small); }
.ls-card-res.neg b { color: var(--bad); }
.ls-card-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); }
.ls-card-says { flex: 1 1 auto; min-width: 0; font-size: var(--fs-small); color: var(--muted); }
.ls-card-foot .btn-sm { flex: none; min-height: 40px; min-width: 72px; }
.ls-card-fix { padding-top: var(--sp-2); border-top: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
/* [/ui2:listings] */


/* [ui2:today] -------------------------------------------------------------------------------------------- Today */
.today-label { margin: var(--sp-3) 0 0; font-size: var(--fs-small); font-weight: 600; color: var(--muted); }
#todayAlerts .ui-hero { margin-top: 0; }
#todayAlerts .ui-hero .today-list { margin-top: var(--sp-1); }
#todayAlerts .ui-hero .ui-hero-act a { display: inline-flex; align-items: center; min-height: 40px; font-weight: 600; }
#todayAlerts .ui-fold { margin-top: var(--sp-2); }
@media (min-width: 1025px) { #todayAlerts .ui-fold > summary { margin-top: var(--sp-3); } }
@media (max-width: 1024px) { .al-clip > .today-item:nth-child(n+6) { display: none; } }
/* [/ui2:today] */


/* [ui2:goflow] ------------------------------------------------------------------------------------------- Goflow */
/* the connection line: one compact summary on phone / iPad (uiFold), the full line on a wide desktop */
.gf-conn-fold.ok > summary .ui-fold-l { color: var(--ok); }
.gf-conn-fold.bad > summary .ui-fold-l { color: var(--bad); }
@media (min-width: 1025px) { .gf-conn-fold > summary { display: none; } }
.gf-conn-fold .ui-fold-body { padding-top: 0; }
@media (max-width: 1024px) { .gf-conn-fold { margin-bottom: var(--sp-2); } .gf-conn-fold .hint { margin: 0; } }
/* the four pane buttons: a 2 x 2 grid on phone, and they come first (the hero belongs to the Inventory pane) */
@media (max-width: 767px) {
  .gf-head { flex-direction: column; align-items: stretch; gap: var(--sp-2); }
  .gf-head .gf-panes { order: -1; display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
  .gf-head .gf-panes .btn { min-height: 44px; padding: 8px 6px; }
}
/* the hero: the three small lines stay quiet, links keep the accent colour */
#gfHero .ui-hero-s a { color: var(--accent); font-weight: 600; }
#gfHero .ui-hero-s .hint { margin: 0; }
@media (max-width: 767px) { #gfHero .ui-hero-act .btn, #gfHero .ui-hero-act .btn-primary { flex: 1 1 100%; justify-content: center; min-height: 44px; } }
/* More ... fold: a real tap target on phone / iPad */
@media (max-width: 1024px) {
  details.gf-more { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); margin: 0 0 var(--sp-2); }
  details.gf-more > summary { min-height: 48px; display: flex; align-items: center; padding: 10px var(--sp-3); font-size: var(--fs-body); font-weight: 600; color: var(--ink); list-style: none; }
  details.gf-more > summary::-webkit-details-marker { display: none; }
  details.gf-more > div { padding: 0 var(--sp-3) var(--sp-2); }
  details.gf-more .imgadd .btn, details.gf-more .imgadd .btn-sm { min-height: 44px; }
  .gf-vsum { min-height: 44px; display: flex; align-items: center; }
}
.gf-sortsel { max-width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--card); color: var(--ink); font-size: var(--fs-body); min-height: 40px; }
/* the vendor table as cards on phone (tbl-cards): the main facts + mode + file + preview stay on the card, the rest is behind Details */
@media (max-width: 767px) {
  table.gf-inv td { white-space: normal !important; }
  table.gf-inv tr:not(.gf-open) td.gf-sec { display: none; }
  table.gf-inv tr.gf-issue { border-color: var(--bad); }
  table.gf-inv td.tc-title { display: block; }
  table.gf-inv .gf-card-toggle { float: right; min-height: 40px; padding: 6px 14px; margin-left: var(--sp-2); }
  table.gf-inv td select.gf-mode { width: 100%; min-width: 0; min-height: 44px; }
  table.gf-inv td > .gf-v { flex: 1 1 auto; min-width: 0; text-align: right; }
  table.gf-inv td .gf-v > .imgadd { justify-content: flex-end; }
  table.gf-inv td .btn-sm, table.gf-inv td summary.btn-sm { min-height: 40px; display: inline-flex; align-items: center; }
  table.gf-inv td .gf-row-more > summary { padding: 6px 12px; }
  table.gf-inv td.gf-act { display: block; padding-top: 8px; }
  table.gf-inv td.gf-act .btn-sm { width: 100%; justify-content: center; min-height: 44px; }
  table.gf-inv td:not(.tc-title) .hint { text-align: right; }
  table.gf-inv td.tc-title .hint { font-weight: 400; text-align: left; }
}
/* [/ui2:goflow] */


/* [ui2:settings] ----------------------------------------------------------------------------------------- Settings */
/* the group list: one rounded list, a row per group (name, one line of what is inside, chevron); iPad/desktop open a row inline */
#settingsBody { padding-top: var(--sp-2); }
.set-groups { margin: 0 0 var(--sp-3); }
.set-groups > details.set-group { background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; box-shadow: none; margin: 0; }
.set-groups > details.set-group:last-child { border-bottom: 0; }
details.set-group > summary.set-group-h.ui-row { display: flex; flex-wrap: nowrap; align-items: center; gap: 12px; min-height: 56px; padding: 10px var(--sp-3); border: 0; cursor: pointer; list-style: none; }
details.set-group > summary.set-group-h::before, details.set-group[open] > summary.set-group-h::before { content: none; }
details.set-group[open] > summary.set-group-h { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.set-group-name { font-size: var(--fs-body); font-weight: 700; }
.set-group-h .ui-row-main > span { display: block; }
.set-group-h .set-group-what { margin: 0 !important; color: var(--muted); font-size: var(--fs-small); }
.set-group-h .chev { transition: transform .15s ease; }
details.set-group[open] > summary .chev { transform: rotate(90deg); }
.set-group-body { padding: var(--sp-2) var(--sp-3) var(--sp-3); }
/* phone: an open group is its own full-width view; its heading row is the "â€¹ Settings" back row */
@media (max-width: 767px) {
  #settingsFoldBar { display: none; }
  #settingsBody.set-focus .set-groups { border: 0; background: none; box-shadow: none; overflow: visible; margin: 0; }
  #settingsBody.set-focus details.set-group:not([open]) { display: none; }
  #settingsBody.set-focus details.set-group[open] { border: 0; }
  #settingsBody.set-focus details.set-group[open] > summary.set-group-h {
    position: sticky; top: var(--hdr-total); z-index: 3; margin: 0; padding: 0; min-height: 48px;
    background: var(--bg); border-bottom: 1px solid var(--line);
  }
  #settingsBody.set-focus details.set-group[open] > summary.set-group-h::before { content: "\2039\00a0Settings"; color: var(--accent); font-weight: 600; font-size: var(--fs-body); flex: none; }
  #settingsBody.set-focus details.set-group[open] > summary .ui-row-main { text-align: right; }
  #settingsBody.set-focus details.set-group[open] > summary .set-group-what, #settingsBody.set-focus details.set-group[open] > summary .chev { display: none; }
  #settingsBody.set-focus .set-group-body { padding: var(--sp-3) 0 var(--sp-3); }
}
/* [/ui2:settings] */


/* [ui2:more] ---------------------------------------------------------------------- Money, CS, Reports, Imports, Help */
/* -- 2.8a Money -- */
.money-stores { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--sp-2); }
.money-store { text-align: left; height: auto; min-height: 48px; padding: 10px var(--sp-3); white-space: normal; line-height: 1.35; }
.money-store.sel { outline: 2px solid var(--accent); background: var(--accent-soft); }
.money-bar { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin: 0 0 var(--sp-2); }
.money-scroll { max-height: 40vh; overflow: auto; }
#moneyBody .ui-fold-body, #csBody .ui-fold-body, #reportsBody .ui-fold-body { overflow-x: auto; }
table.tbl-cards tr[hidden] { display: none; }
@media (max-width: 767px) {
  .money-scroll { max-height: none; overflow: visible; }
  .money-stores { grid-template-columns: 1fr; }
  #moneyBody table.tbl-cards tr[id^="mcase"] td.tc-title { border: 0; padding: 0; margin: 0; }
}
/* -- 2.8b Customer service -- */
.cs-queues { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-2); }
.cs-queues .btn-sm.sel { outline: 2px solid var(--accent); background: var(--accent-soft); }
.cs-listbox { max-height: 70vh; overflow: auto; }
.cs-case.sel { background: var(--accent-soft); }
.cs-case .ui-row-s, .cs-case .ui-row-t { white-space: normal; }
#csBody .cs-grid { margin: var(--sp-3) 0; }
@media (min-width: 1025px) { #csBody .ui-fold-h { display: none; } }
.cs-issue-card { border: 1px solid var(--line); border-radius: var(--r); padding: 10px; background: var(--card); }
@media (max-width: 767px) {
  .cs-listbox { max-height: none; overflow: visible; }
  #csIssue:not(.in-sheet) { display: none; }
  .usheet-body .cs-issue-card { border: 0; padding: 0; }
  #csBody table.tbl-cards td.tc-title { order: -1; }
}
/* -- 2.8c Reports -- */
.rp-range { align-items: center; }
.rp-f { display: inline-flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-small); color: var(--muted); }
.rp-lane .rp-card { margin: 0 0 var(--sp-2); }
@media (max-width: 767px) {
  .rp-f { flex: 1 1 100%; }
  .rp-f input { flex: 1 1 auto; min-width: 0; }
}
/* -- 2.8d Imports & files -- */
#importsBody .ui-fold-body { overflow-x: auto; }
#importsBody .ui-hero-act input[type=file] { flex: 1 1 100%; min-width: 0; max-width: 100%; }
@media (max-width: 767px) { #importsBody { padding-left: var(--pad); padding-right: var(--pad); } }
/* -- 2.8e Help & Guide -- */
#tab-ask .ask-col.ui-hero { border: 1px solid var(--line); padding: var(--sp-3); min-width: 0; }
#tab-ask .ask-log { max-height: 45vh; }
#tab-ask .ask-input textarea { background: var(--card); color: var(--ink); }
#tab-ask .ask-input { border-top-color: var(--line); }
@media (min-width: 821px) {
  #tab-ask .guide-col { order: -1; }
  #tab-ask .ask-col.ui-hero { background: none; box-shadow: none; border-radius: 0; border: 0; border-left: 1px solid var(--line); margin: 0; padding: 0 0 0 18px; }
  #tab-ask .ask-log { max-height: none; }
}
/* [/ui2:more] */
