/* density: catalogue — merged into lists-density.css before commit */
/* Request items: header tools, section tabs, cards, card dialogs and the admin
   catalogue table. Loaded after lists-density.css, so equal selectors win here. */

/* ── Header tools: the Table/Cards toggle is the same rounded square as Edit
   and Refresh beside it. lists-admin-ui.css gives it a pill by id, so the
   selectors here carry the id too. ── */
.pane-tools #cat-table-toggle.btn.btn-sm{
  width:auto;min-width:0;padding:0 8px;gap:0;border-radius:8px;
  color:var(--ink-2);background:color-mix(in srgb,var(--sag-surface) 82%,transparent);border:1px solid color-mix(in srgb,var(--sag-line-strong) 90%,transparent);
  box-shadow:0 1px 2px rgba(22,24,26,.04),0 5px 16px rgba(22,24,26,.055)}
.pane-tools #cat-table-toggle.btn.btn-sm:hover:not(:disabled){
  color:var(--ink);background:var(--sag-surface);border-color:var(--gold-2)}
.pane-tools #cat-table-toggle.btn.btn-sm svg{width:18px;height:18px;stroke-width:1.9}
@media (pointer:coarse){
  .pane-tools #cat-table-toggle.btn.btn-sm,.pane-tools .btn.btn-sm.catalogue-action{min-width:44px}
}

/* Touch has no hover, so the words are written out beside the icons. On a
   phone the three share the row and a long word wraps rather than being cut. */
@media (hover:none) and (pointer:coarse){
  .pane-tools #cat-table-toggle.btn.btn-sm,.pane-tools .btn.btn-sm.catalogue-action{
    height:auto;min-height:44px;padding:4px 10px;gap:6px;white-space:normal;line-height:1.2}
  html body .pane-tools #cat-table-toggle.btn .ib-l,html body .pane-tools #cat-table-toggle.btn:hover .ib-l,
  html body .pane-tools .btn.btn-sm.catalogue-action span,html body .pane-tools .btn.btn-sm.catalogue-action:hover span{
    position:static;max-width:none;opacity:1;margin:0;overflow:visible;white-space:normal;
    font-size:12.5px;font-weight:600;text-align:center}
}
/* Phone with a finger: each tool is as wide as its icon and words, on one
   line, not a third of the row each. If the three do not fit, the last one
   moves to the next line whole. */
@media (max-width:720px) and (pointer:coarse){
  .pane-tools:has(#cat-table-toggle){flex-wrap:wrap}
  html body .pane-tools #cat-table-toggle,html body .pane-tools .catalogue-action{flex:0 0 auto;width:auto;white-space:nowrap}
  html body .pane-tools #cat-table-toggle.btn .ib-l,html body .pane-tools .btn.btn-sm.catalogue-action span{white-space:nowrap}
}

/* Edit mode's "Done" keeps its words but not a taller button, and it is the
   brand's primary ink like every other primary button. */
.pane-tools #cat-edit-toggle.on,.pane-tools #cat-edit-toggle.on:hover:not(:disabled){
  background:var(--sag-primary,var(--sag-primary));border-color:var(--sag-primary,var(--sag-text));color:var(--sag-on-primary)}
.btn.btn-sm.catalogue-action.expanded{padding:0 10px}
.btn.btn-sm.catalogue-action.expanded span{max-width:120px;opacity:1;margin-left:6px}
@media (pointer:fine){.btn.btn-sm.catalogue-action.expanded{height:30px;min-height:0}}

/* The hover label for these icon buttons is shared: see the end of lists-density.css. */


/* B36: the heading and tools share a row. Respond to the catalogue's width,
   since the order panel can take room even on a wide screen. */
.catalogue-column{container:catalogue / inline-size;min-width:0}
.pane-head:has(#cat-title){display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:6px 12px}
.pane-head .catalogue-heading{grid-column:1;grid-row:1;display:flex;align-items:baseline;gap:10px;min-width:0}
.pane-head #cat-title{flex:none;min-width:0}
.pane-head #cat-hint{order:0;flex:1 1 auto;min-width:0;max-width:72ch;margin:0;white-space:normal;line-height:1.4}
.pane-head #cat-hint:empty{display:none}
.pane-head:has(#usd-live:not([hidden])){grid-template-columns:minmax(300px,1fr) auto auto}
.pane-head:has(#cat-title) .usd-live{grid-column:2;grid-row:1;justify-self:end;max-width:100%}
.pane-head:has(#cat-title) .pane-tools{grid-column:2;grid-row:1;display:grid;
  --catalogue-search-width:40px;--catalogue-search-open-width:210px;
  grid-template-columns:minmax(40px,var(--catalogue-search-width)) auto auto auto;
  align-items:center;gap:8px;min-width:0;margin-left:0}
.pane-head:has(#cat-title) .pane-tools:has(.search:focus-within){--catalogue-search-width:var(--catalogue-search-open-width)}
.pane-head:has(#usd-live:not([hidden])) .pane-tools{grid-column:3}
.pane-head:has(#cat-title) .order-view-switch,.pane-head:has(#cat-title) #cat-table-toggle{grid-column:2}
.pane-head:has(#cat-title) #cat-edit-toggle{grid-column:3}
.pane-head:has(#cat-title) #cat-price-refresh{grid-column:4}
.pane-head:has(#cat-title) .search,.pane-head:has(#cat-title) .search:focus-within{
  grid-column:1;justify-self:start;width:100%;max-width:100%;margin-left:0;border-radius:999px;cursor:pointer}
.pane-head:has(#cat-title) .search:focus-within{cursor:text}
.pane-head:has(#cat-title) .search:not(:focus-within) input{opacity:0;pointer-events:none;cursor:pointer}
.pane-head:has(#cat-title) .search input{-webkit-user-select:text;user-select:text}
.pane-head:has(#cat-title) #q::selection{background:rgba(183,134,27,.28);color:var(--ink,var(--sag-text))}
@media (hover:hover) and (pointer:fine){
  .pane-head:has(#cat-title) .pane-tools:has(.search:hover){--catalogue-search-width:var(--catalogue-search-open-width)}
  .pane-head:has(#cat-title) .search:hover input{opacity:1}
}
@container catalogue (max-width:800px){
  .pane-head:has(#usd-live:not([hidden])){grid-template-columns:minmax(0,1fr) auto}
  .pane-head:has(#cat-title) .usd-live{grid-column:1/-1;grid-row:2;justify-self:start}
  .pane-head:has(#usd-live:not([hidden])) .pane-tools{grid-column:2}
  .pane-head:has(#cat-title) .pane-tools{--catalogue-search-open-width:120px}
  .pane-head .pane-tools #cat-table-toggle.btn.btn-sm{width:36px;padding:0;gap:0}
  .pane-head .pane-tools #cat-table-toggle.btn.btn-sm span{position:absolute;width:1px;height:1px;
    padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;opacity:1}
}
@container catalogue (max-width:600px){
  .pane-head:has(#cat-title),.pane-head:has(#usd-live:not([hidden])){grid-template-columns:minmax(0,1fr)}
  .pane-head .catalogue-heading{align-items:baseline;gap:8px}
  .pane-head .catalogue-heading #cat-hint{order:0;flex:1 1 auto;margin:0}
  .pane-head:has(#cat-title) .usd-live{grid-column:1;grid-row:2;justify-self:start}
  .pane-head:has(#cat-title) .pane-tools{grid-column:1;grid-row:2;grid-template-columns:minmax(44px,1fr) auto 44px 44px;gap:7px}
  .pane-head:has(#cat-title):has(.usd-live:not([hidden])) .pane-tools{grid-column:1;grid-row:3}
  html body .pane-head .pane-tools #cat-table-toggle.btn.btn-sm,
  html body .pane-head .pane-tools .btn.btn-sm.catalogue-action{width:44px;min-width:44px;padding:0;gap:0}
  html body .pane-head .pane-tools #cat-table-toggle.btn.btn-sm span,
  html body .pane-head .pane-tools .btn.btn-sm.catalogue-action span{position:absolute;width:1px;height:1px;
    padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;opacity:1}
  .pane-head:has(#cat-title) .order-view-switch button{height:44px;padding:0 4px;gap:3px;font-size:12px}
  .pane-head:has(#cat-title) .search,.pane-head:has(#cat-title) .search:focus-within{width:100%}
  #q-spell{grid-column:1/-1}
}

/* ── Section tabs: the edit pen sits in the corner instead of taking width ── */
.cat{position:relative}
.cat .pen{position:absolute;top:1px;right:3px;margin:0;font-size:11px;line-height:1}
/* Phone: two tabs a row, so a long section name wraps inside its tab. */
@media (max-width:720px){
  .cat{white-space:normal;min-width:0}
  .cat .tx{flex:1 1 auto;min-width:0}
  .cat .tx b{line-height:1.25;overflow-wrap:anywhere}
}
@media (pointer:coarse){.cat{min-height:44px}}

/* ── Price changes ──
   With room for them, the changed items show as whole chips on one line:
   the strip is one chip tall and wraps, so a chip that does not fit drops
   to the hidden second line instead of being cut in half behind Review.
   Review lists every change. On a phone the sentence wraps and the chips
   stay in the Review dialog. */
.price-note .pn-go,.price-note .pn-go:hover,.price-note .pn-item:hover,.price-note .pn-item:focus-visible{
  border-color:var(--sag-primary,var(--sag-text))}
.price-note .pn-go{color:var(--sag-primary,var(--sag-text))}
.price-note .pn-go:hover,.price-note .pn-item:hover,.price-note .pn-item:focus-visible{
  background:var(--sag-primary,var(--sag-primary));color:var(--sag-on-primary)}
@media (min-width:721px){
  .price-note .pn-items{flex:1 1 0;flex-wrap:wrap;row-gap:12px;height:24px;overflow:hidden;align-content:flex-start}
  .price-note .pn-item{max-width:100%;line-height:16px;padding:3px 8px}
}
@media (max-width:720px){
  .price-note{flex-wrap:nowrap}
  .price-note > span{flex:1 1 auto;min-width:0;white-space:normal}
  .price-note .pn-items{display:none}
}
@media (pointer:coarse){
  .price-note .pn-go{min-height:44px;padding:0 14px}
  .price-note .pn-x{width:44px;height:44px;margin-right:-8px}
  .price-note .pn-item{min-height:44px}
  #howto-close{min-height:44px;padding:0 12px}
}
@media (pointer:coarse) and (min-width:721px){.price-note .pn-items{height:44px}}

/* ── Groups: small groups share a row instead of a full-width panel each ── */
.catalog-groups{gap:10px}
.catalog-group{padding:10px}
.catalog-group-hd{min-height:28px;padding-bottom:6px}
@media (min-width:721px){
  .grid.grouped .catalog-groups:not(:has(.card.shaking)){flex-direction:row;flex-wrap:wrap}
  .grid.grouped .catalog-groups:not(:has(.card.shaking))>.catalog-group{flex:1 1 100%;min-width:0}
  .grid.grouped .catalog-groups:not(:has(.card.shaking))>.catalog-group:has(.group-grid>.card:nth-child(-n+3):last-child){flex:0 1 auto}
  .grid.grouped .catalog-groups:not(:has(.card.shaking))>.catalog-group:has(.group-grid>.card:nth-child(-n+3):last-child) .group-grid{
    grid-template-columns:none;grid-auto-flow:column;grid-auto-columns:156px}
}

/* "Add catalogue item" at the end of a grouped section: a button, not a 90px tile. */
.grid.grouped .catalog-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:10px}
.grid.grouped .catalog-actions .tile-add{min-height:34px;flex-direction:row;width:auto;padding:0 14px;gap:8px;border-radius:8px}
.grid.grouped .catalog-actions .tile-add svg{width:16px;height:16px}
.grid.grouped .catalog-actions .tile-add em{display:inline;margin:0;padding:0}
@media (pointer:coarse){.grid.grouped .catalog-actions .tile-add{min-height:44px}}

/* ── Cards ── */
/* Subscriptions use the same card grid and 4:3 image area as groceries (B33).
   Keep complete artwork visible, without adding inset thumbnail padding. */
.subscription-catalogue .card .pic{background:var(--sag-surface)}
.subscription-catalogue .card .pic img{object-fit:contain;padding:0}
.subscription-catalogue .card.card-artwork-fill .pic img{object-fit:cover}
.subscription-catalogue .card.card-artwork-trim .pic img{
  width:auto;max-width:100%;height:116%;inset:auto;top:-8%;left:50%;transform:translateX(-50%);clip-path:inset(2px)}
.subscription-catalogue .card .sub-chip{font-size:12px;line-height:1.4;white-space:normal}
.subscription-catalogue .card .auto-me{font-size:12px;line-height:1.4;min-height:34px;white-space:normal}
@media (pointer:coarse){.subscription-catalogue .card .auto-me{min-height:44px}}
/* Who added it: a small pill, not a second button-shaped bar. */
.card .who-has{margin-top:5px;padding:2px 8px;width:fit-content;max-width:100%;font-size:11px;border-radius:6px;line-height:1.35}
/* "Erik menambahkan 31" is longer than a card is wide: it wraps, it is not cut. */
.card .who-has{display:block;padding:2px 7px}
.card .who-has svg{display:inline-block;vertical-align:-1px;margin-right:4px}
.card .who-has span{display:inline;overflow:visible;text-overflow:clip;white-space:normal}

/* ── Edit mode ── */
/* Delete: a white button with a clay cross. Status colours are for the
   glyph, never the fill. */
.card .del-badge,.card .del-badge:hover{
  background:var(--sag-surface);color:var(--clay,var(--sag-risk-fg));border:1px solid var(--sag-line-strong,var(--sag-line-strong))}
.card .del-badge:hover,.card .del-badge:focus-visible{border-color:var(--clay,var(--sag-risk))}
.card .del-badge svg{width:12px;height:12px}
@media (pointer:coarse){
  .card .del-badge{width:32px;height:32px;top:6px;left:6px}
  .card .del-badge::after{content:"";position:absolute;inset:-6px}
  .group-grip,.group-tool{min-width:44px;min-height:44px}
}
.card .drag-hint{line-height:1.3}
/* Subscriptions: the renewal chip and the auto-add switch stay one line each. */
.card .auto-me{border-radius:8px;padding:4px 8px;margin-top:5px;line-height:1.3}
.card .sub-chip{padding:2px 6px;gap:3px;font-size:10.5px;letter-spacing:-.01em;max-width:100%;border-radius:6px;line-height:1.35}
/* Fingers keep a 44px Add / Choose target (density shrinks it for everyone). */
@media (pointer:coarse){.add-btn,.card-step{height:44px}}

/* ── Card dialogs ── */
/* Choose options: shorter rows, still a recognisable picture. */
@media (pointer:fine){
  .chan.opts{gap:6px}
  .chan.opts button{padding:6px 10px;gap:10px}
  .chan.opts button .ic{width:44px;height:44px;border-radius:8px}
  .chan.opts b{font-size:13.5px}
}
@media (pointer:coarse){
  .chan.opts button{padding:8px 10px}
  .chan.opts button .ic{width:48px;height:48px}
}
/* Item edit: the photo slot and the choice rows. */
@media (pointer:fine){
  .modal #drop{display:flex;align-items:center;gap:12px;padding:8px 12px;text-align:left}
  .modal #drop img{max-height:64px;margin:0}
  .modal #drop .em{font-size:20px;margin:0}
  .opt-top{grid-template-columns:34px 1fr 110px 30px;gap:6px}
  .o-pic{width:34px;height:34px}
  .opt-row{padding:7px;gap:5px}
  .modal .opt-row input:not([type="checkbox"]){min-height:0;height:34px;padding:0 9px}
  .opt-link .o-get,.opt-link .o-open,.opt-link .o-link-del{height:34px;min-height:0}
  /* Add an item / item edit: every field and the button beside it 34px, the
     same as the dialog's footer buttons. */
  .modal:has(#drop) input:not([type="checkbox"]):not([type="radio"]),.modal:has(#drop) select{min-height:0;height:34px}
  .modal:has(#drop) .btn.btn-sm{height:34px}
}
/* Opened with the mouse, nothing in the dialog is ringed unless the keyboard put focus there. */
.modal #drop .clr:focus:not(:focus-visible){outline:none;box-shadow:none}

/* ── Item dialog: one profile card for Add and Edit (itemProfileHtml) ──
   The photo square, the name beside it in large type, and under the name the
   facts that place it: unit, section, group and price. */
.it-profile{display:grid;grid-template-columns:96px minmax(0,1fr);gap:16px;align-items:start;margin-bottom:8px}
.modal #drop.it-photo{position:relative;width:96px;height:96px;padding:0;display:grid;place-content:center;justify-items:center;gap:4px;
  text-align:center;border-radius:10px;background:var(--sag-hover,var(--sag-hover));color:var(--sag-icon,#8A9196)}
.modal #drop.it-photo svg{width:26px;height:26px}
.modal #drop.it-photo p{margin:0;font-size:11.5px;font-weight:600;color:var(--sag-text-3,var(--sag-text-3))}
.modal #drop.it-photo img{position:absolute;inset:0;width:100%;height:100%;max-height:none;object-fit:cover;border-radius:0;margin:0}
.modal #drop.it-photo .clr{top:4px;right:4px;width:24px;height:24px;z-index:1}
.it-main{min-width:0;display:flex;flex-direction:column;gap:10px}
.modal input.it-name{width:100%;height:42px;padding:0 12px;border-radius:8px;border:1.5px solid var(--line,var(--sag-line));
  background:var(--surface-2,var(--sag-hover));font-size:19px;font-weight:700;letter-spacing:-.01em;color:var(--sag-text,var(--sag-text))}
.modal input.it-name:focus{border-color:var(--sag-line-strong,var(--sag-line-strong));background:var(--sag-surface,var(--sag-surface));box-shadow:none}
.it-meta{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 12px}
.it-meta .fld{margin:0;min-width:0}
.it-meta .fld label{margin-bottom:4px}
.it-hints{margin:0 0 14px;font-size:12px;line-height:1.45;color:var(--sag-text-3,var(--sag-text-3))}
/* The shop field's row holds only that field now; nothing to show, no gap. */
.it-vendor-row:not(:has(> :not([hidden]))){display:none}
.modal:has(.it-profile) .modal-hd{padding-bottom:4px}
/* Beats the dialog's 34px field rule (.modal:has(#drop) input). */
#modal #it-name{height:42px}
@media (max-width:480px){
  .it-profile{grid-template-columns:72px minmax(0,1fr);gap:12px}
  .modal #drop.it-photo{width:72px;height:72px}
  .it-meta{grid-template-columns:1fr}
}

/* Refresh prices: the rows share one set of columns, so old price, arrow and
   new price line up down the list. Names wrap; they are never cut. */
.pr-list{gap:4px}
.pr-row{padding:5px 10px}
.pr-nm{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;line-height:1.3}
.pr-old,.pr-new{font-variant-numeric:tabular-nums;text-align:right}
@media (min-width:721px){
  /* Names take what is left and may use two lines; the source of the new
     price sits small under old → new. */
  .pr-list{display:grid;grid-template-columns:22px minmax(160px,1fr) auto 14px auto;column-gap:10px}
  .pr-list>.pr-row{grid-column:1/-1;display:grid;grid-template-columns:subgrid;row-gap:0}
  .pr-list>.pr-shop-review{grid-column:1/-1}
  .pr-row>input,.pr-row>.pr-dot,.pr-row>.pr-nm{grid-row:1/3}
  .pr-row .pr-new{display:contents}
  .pr-new em{grid-column:3/-1;grid-row:2;display:block;margin:0;text-align:right;font-size:10.5px;line-height:1.3;white-space:nowrap}
}
/* Phone: the name has the whole first line; old → new sits under it. */
@media (max-width:720px){
  .pr-row{grid-template-columns:22px 1fr 16px auto;row-gap:2px;column-gap:6px}
  .pr-row .pr-nm{grid-column:2/-1}
  .pr-row .pr-old{grid-column:2;grid-row:2}
  .pr-row .pr-arrow{grid-column:3;grid-row:2}
  .pr-row .pr-new{grid-column:4;grid-row:2}
  .pr-row>input,.pr-row>.pr-dot{grid-row:1/3}
  .pr-new em{display:none}
}

/* ── Admin catalogue table ── */
.admin-catalogue-toolbar{gap:6px;margin-bottom:8px}
.admin-catalogue-toolbar>.btn{white-space:nowrap}
.admin-catalogue-toolbar>#catalogue-change-count{font-size:12.5px;color:var(--sag-text-3,var(--sag-text-3));margin-left:4px}
.admin-catalogue-toolbar>p{font-size:12px;color:var(--sag-text-3,var(--sag-text-3))}
@media (pointer:fine){.admin-catalogue-toolbar>.btn{height:30px;font-size:12.5px;padding:0 12px}}
/* "Preview changes" is the primary action only once there is something to
   preview: with no draft (Discard is disabled) it reads as a plain button. */
.admin-catalogue-toolbar:has(#catalogue-discard:disabled) #catalogue-review{
  background:var(--sag-surface,var(--sag-surface));color:var(--sag-text,var(--sag-text));box-shadow:var(--sag-shadow-1)}
.admin-catalogue-toolbar:has(#catalogue-discard:disabled) #catalogue-review:hover:not(:disabled){background:var(--sag-hover)}
/* Phone: the buttons are as wide as their words and wrap as whole buttons,
   not a grid of stretched bars. */
@media (max-width:720px){
  .admin-catalogue-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
  html body .admin-catalogue-toolbar>.btn{flex:0 0 auto;width:auto;max-width:100%;white-space:normal;line-height:1.2;
    height:auto;min-height:44px;padding:4px 14px}
  .admin-catalogue-toolbar>#catalogue-change-count,.admin-catalogue-toolbar>p{flex:1 1 100%;margin-left:0}
}
@media (max-width:720px) and (pointer:fine){html body .admin-catalogue-toolbar>.btn{min-height:34px}}

/* ── Catalogue sheet (lists-sheet.js): Item, Price, Unit edit in place like
   Excel. An unsaved value is bold with an amber dot (status colour as a dot,
   never a fill); its row number turns amber too. ── */
#grid:has(.cat-sheet){display:block}
/* The sheet scrolls inside its own box with its header row frozen, as Excel
   does. The section bar above it (title, Cards/Edit/Refresh, Search items)
   stays in the page while the Table view is on, so it never slides over the
   sheet's chips and column headings; the box is sized to fit under the top
   bar, so scrolling the page to the end shows the whole sheet. */
#view-list .pane-head:has(+ #grid .cat-sheet){position:relative;top:auto}
#view-list .pane-head:has(+ #grid .cat-sheet)::after{opacity:0}
/* 100dvh less the top bar, the sheet's chip bar (38) and the page's own
   bottom margin (72), with a little air. */
.cat-sheet .sh{--sh-max-h:calc(100dvh - var(--topbar-h,59px) - 124px)}
.cat-sheet .cat-val{display:inline-block;min-width:24px;min-height:18px}
.cat-sheet .cat-dirty{font-weight:600}
.cat-sheet .cat-dirty::after{content:"";display:inline-block;width:6px;height:6px;margin-left:6px;border-radius:50%;
  background:var(--sag-wait,#C98A00);vertical-align:middle}
.cat-sheet tr.admin-changed > .sh-rn{color:var(--sag-wait-fg,#8A5A00);font-weight:700}
.cat-sheet .cat-fixed{color:var(--sag-text-3,var(--sag-text-3))}
.cat-sheet input.cat-edit{display:block;width:100%;height:24px;min-height:0;margin:0;padding:0 2px;border:0;border-radius:0;
  outline:0;box-shadow:none;background:var(--sag-surface,var(--sag-surface));color:var(--sag-text,var(--sag-text));font:inherit;field-sizing:content}
.cat-sheet .sh-num input.cat-edit{text-align:right}
.cat-sheet .cat-val:has(.cat-edit){display:block}
.cat-sheet .cat-val:has(.cat-edit)::after{content:none}
.cat-sheet .sh-grid td:has(.cat-edit){outline:2px solid var(--sag-primary,#1B3038);outline-offset:-2px}
@media (pointer:coarse){
  .cat-sheet .cat-val{display:inline-flex;align-items:center;min-height:44px;min-width:44px}
  .cat-sheet input.cat-edit{height:44px;font-size:16px}
}
/* Phone cards: the name and its Details button, then Price and Unit side by
   side as two fields, each its small label over its value and a 44px tap
   target (a tap opens the field and the keyboard), then the price rule. One
   even rhythm instead of 44px lines between 20px ones. A value that can be
   changed is underlined with dots. The selection ring sits outside the words
   rather than on them. */
@media (max-width:720px){
  .cat-sheet .sh-grid tbody tr{grid-template-columns:minmax(0,1fr) auto;column-gap:16px}
  .cat-sheet .sh-grid tbody td[data-sh-col="1"]:not(.sh-main){grid-column:1;grid-row:2}
  .cat-sheet .sh-grid tbody td[data-sh-col="2"]:not(.sh-main){grid-column:2;grid-row:2;max-width:44vw}
  .cat-sheet .sh-grid tbody td[data-sh-col="1"],.cat-sheet .sh-grid tbody td[data-sh-col="2"]{
    display:flex;flex-direction:column;align-items:flex-start;justify-content:center;min-height:32px}
  #grid .cat-sheet .sh-grid tbody td[data-sh-col="1"]::before,#grid .cat-sheet .sh-grid tbody td[data-sh-col="2"]::before{
    content:attr(data-label);font-size:11.5px;line-height:1.25}
  .cat-sheet .sh-grid tbody td:has(.sh-st){display:flex;flex-wrap:wrap;align-items:center;column-gap:4px}
  .cat-sheet .sh-grid tbody td .cat-val{min-height:0;min-width:0;border-bottom:1px dashed var(--sag-line-strong,var(--sag-line-strong));line-height:1.35}
  .cat-sheet .sh-grid tbody td .cat-val:has(.cat-edit){align-self:stretch;border-bottom:0}
  /* While typing, the ring is the field's own, not drawn round its label. */
  #grid .cat-sheet .sh-grid td:has(.cat-edit){outline:0}
  .cat-sheet .sh-grid tbody input.cat-edit{height:36px;padding:0 8px;border:2px solid var(--sag-primary,var(--sag-text));border-radius:6px;text-align:left}
  .cat-sheet .sh-grid td.sh-focus,.cat-sheet .sh-grid td:focus{outline-offset:2px;border-radius:4px}
  /* An empty value still shows something to tap (not copied: it is drawn). */
  .cat-sheet .cat-val:empty::before{content:"\2014";color:var(--sag-text-3,var(--sag-text-3))}
}
@media (max-width:720px) and (pointer:coarse){
  .cat-sheet .sh-grid tbody td[data-sh-col="1"],.cat-sheet .sh-grid tbody td[data-sh-col="2"]{min-height:44px}
  .cat-sheet .sh-grid tbody td.sh-main .cat-val{min-height:0}
  .cat-sheet .sh-grid tbody td.sh-main{min-height:44px;display:flex;align-items:center}
}

/* Paste rows dialog: a real field, wide enough for Name, Price, Unit. */
#catalogue-paste-text{display:block;width:100%;min-height:140px;margin-top:8px;padding:8px 10px;
  border:1px solid var(--sag-line-strong,var(--sag-line-strong));border-radius:8px;background:var(--sag-surface);color:var(--ink);
  font:13px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace;tab-size:16;resize:vertical}
#catalogue-paste-text:focus-visible{outline:none;border-color:var(--sag-primary,var(--sag-text));box-shadow:0 0 0 3px rgba(27,48,56,.12)}
.modal-bd:has(#catalogue-paste-text)>p{font-size:13px;margin:0 0 4px;color:var(--sag-text-2,var(--sag-text-2))}

/* A narrow window with a mouse keeps the icons square (the words float on
   hover); only touch spreads the three across the row with their words. */
@media (max-width:720px) and (pointer:fine){
  html body .pane-tools #cat-table-toggle,html body .pane-tools .catalogue-action:not(.expanded){flex:0 0 auto}
}

/* "On the list" lines: no edge mark at all. The inset shadow down the left
   edge read as a "{" against the rounded corner, and a short bar in its place
   still did. A flagged line keeps its tint and its lit price tag, a due line
   its tint and its warning words; whose line it is shows in its own text. */
.line.mine,.line.flagged,.line.renewal-due{box-shadow:none}
.line.mine::before,.line.flagged::before,.line.renewal-due::before{content:none}
/* A finger gets the full 44px on the sheet's search box too. */
@media (pointer:coarse){.cat-sheet .sh-search,.cat-sheet .sh-search input{min-height:44px}}

/* Prices in the sheet carry their badge (priceBadgeHtml): figures right-aligned
   in the column as the editable rupiah ones are, in the sheet's regular weight. */
.cat-sheet .cat-fixed.pb-line{justify-content:flex-end;color:inherit}
.cat-sheet .pb b{font-weight:500}
.cat-sheet .pb .cat-val{font-variant-numeric:tabular-nums}
@media (max-width:720px){.cat-sheet .cat-fixed.pb-line{justify-content:flex-start}}

/* ── Cards | Sheet (lists-order-sheet.js): a two-way segmented switch ── */
.order-view-switch{display:inline-flex;align-items:center;gap:2px;padding:2px;flex:none;
  border:1px solid var(--sag-line,var(--sag-line));border-radius:8px;background:var(--sag-app,var(--sag-app))}
.order-view-switch[hidden]{display:none}
.order-view-switch button{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 9px;border:0;border-radius:6px;
  background:none;color:var(--sag-text-2,var(--sag-text-2));font:600 12.5px/1 var(--sag-font);cursor:pointer;white-space:nowrap}
.order-view-switch button svg{width:14px;height:14px}
.order-view-switch button:hover{color:var(--sag-text,var(--sag-text))}
.order-view-switch button[aria-pressed="true"]{background:var(--sag-surface,var(--sag-surface));color:var(--sag-text,var(--sag-text));box-shadow:var(--sag-shadow-1)}
@media (pointer:coarse){.order-view-switch button{height:40px;padding:0 12px}}

/* ── The order sheet: name and unit, the price badge, my quantity stepper ── */
#grid:has(> .order-sheet){display:block}
/* While editing, the switch to the editing table says its words in full. */
.btn.btn-sm.catalogue-action.expanded#cat-table-toggle span{max-width:none}
#cat-table-toggle[hidden]{display:none}
.order-sheet .os-name{font-weight:600;color:var(--sag-text,var(--sag-text))}
.order-sheet .os-unit{margin-left:6px;font-size:12px;color:var(--sag-text-3,var(--sag-text-3))}
.order-sheet .os-price{justify-content:flex-end}
.os-step{display:inline-grid;grid-template-columns:24px 44px 24px;align-items:center;vertical-align:middle;overflow:hidden;
  border:1px solid var(--sag-line-strong,var(--sag-line-strong));border-radius:6px;background:var(--sag-surface,var(--sag-surface))}
.os-step-b{height:24px;padding:0;border:0;background:var(--sag-app,var(--sag-app));color:var(--sag-text-2,var(--sag-text-2));font-size:15px;line-height:1;cursor:pointer}
.os-step-b:hover{background:var(--sag-hover,var(--sag-hover));color:var(--sag-text,var(--sag-text))}
.os-qty{height:24px;width:44px;padding:0 2px;border:0;border-left:1px solid var(--sag-line,var(--sag-line));border-right:1px solid var(--sag-line,var(--sag-line));
  background:var(--sag-surface,var(--sag-surface));color:var(--sag-text,var(--sag-text));font:600 13px var(--sag-font);text-align:center;font-variant-numeric:tabular-nums}
.os-qty:focus{outline:none;background:var(--sag-selected,var(--sag-selected))}
.os-qty::placeholder{color:var(--sag-text-3,var(--sag-text-3));font-weight:500;opacity:1}
.os-fixed{font-weight:600;font-variant-numeric:tabular-nums}
.os-amount{margin-left:6px}
@media (pointer:coarse){
  .os-step{grid-template-columns:44px 56px 44px}
  .os-step-b,.os-qty{height:44px}
  .os-qty{width:56px;font-size:16px}
}
@media (max-width:720px){.order-sheet .os-price{justify-content:flex-start}}

/* F: the admin's Edit pencil was painted under the product photo (the .pic box
   comes later in the card), so the photo took the click. */
.card .edit{z-index:3}
