/* ══ Density ══
   The app was drawn for a large screen at 100%. On a Full HD laptop at 150%
   scaling (about 1280 × 620 of usable page) and on the office's 720p screens it
   showed one row of anything at a time: a 68px top bar, two banners, a 44px
   button in every table row and a card per 340px of height.

   Loaded after every other stylesheet. Three rules hold throughout:
   - With a mouse (pointer:fine) controls are 28–32px. Fingers keep the 44px
     targets the audit asked for: those rules live in lists-admin-ui.css and
     only stop applying here, under pointer:fine.
   - Buttons that repeat on every row, and toolbar buttons, are icons that
     spell out their words on hover or keyboard focus (.ibtn).
   - Text stays readable: 12px is the floor for anything a person has to read. */

/* ── Icon buttons that name themselves on hover ── */
.btn.ibtn{display:inline-flex;align-items:center;justify-content:center;gap:0;width:auto;
  padding:0 8px;overflow:hidden;white-space:nowrap;flex:none}
.btn.ibtn svg{width:16px;height:16px;flex:none}
.btn.ibtn .ib-l{max-width:0;opacity:0;overflow:hidden;
  transition:max-width .2s var(--sag-ease,ease),opacity .14s var(--sag-ease,ease),margin .2s var(--sag-ease,ease)}
.btn.ibtn:hover .ib-l,.btn.ibtn:focus-visible .ib-l{max-width:240px;opacity:1;margin-left:6px}
@media (hover:none){
  /* No hover on a touch screen: the one action that matters keeps its words. */
  .btn.ibtn.btn-ink .ib-l{max-width:240px;opacity:1;margin-left:6px}
}

/* The catalogue header's own icon buttons (Edit catalogue, Refresh prices):
   back to icons, as they were before the audit wrote their words out. */
.btn.btn-sm.catalogue-action,.btn.btn-sm.catalogue-action.expanded{
  width:auto;min-width:0;padding:0 8px;gap:0;border-radius:8px}
.catalogue-action span,.catalogue-action.expanded span{max-width:0;opacity:0;
  transition:max-width .2s var(--sag-ease,ease),opacity .14s var(--sag-ease,ease),margin .2s var(--sag-ease,ease)}
.btn.btn-sm.catalogue-action:hover span,.btn.btn-sm.catalogue-action:focus-visible span{max-width:200px;opacity:1;margin-left:6px}

/* ── Sortable table headers ── */
.admin-table th[aria-sort]{padding:0}
.admin-sort{display:flex;align-items:center;gap:4px;width:100%;padding:7px 10px;font:inherit;font-weight:600;
  color:inherit;text-align:left;cursor:pointer;white-space:nowrap}
.admin-sort:hover{background:var(--sag-selected)}
.admin-sort::after{content:"";width:8px;height:8px;flex:none;opacity:.35;
  background:no-repeat center/8px 8px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M4 0 7 3H1zM4 8 1 5h6z' fill='%2363696C'/%3E%3C/svg%3E")}
.admin-sort:hover::after{opacity:.7}
th[aria-sort="ascending"] .admin-sort::after{opacity:1;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M4 1 7.5 6h-7z' fill='%231B3038'/%3E%3C/svg%3E")}
th[aria-sort="descending"] .admin-sort::after{opacity:1;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3E%3Cpath d='M4 7 .5 2h7z' fill='%231B3038'/%3E%3C/svg%3E")}
.admin-table th.num .admin-sort{justify-content:flex-end}

/* ── Work queue table ── */
.admin-table{font-size:13px}
.admin-table th{padding:7px 10px;font-size:12px}
.admin-table td{padding:7px 10px;vertical-align:middle;white-space:nowrap}
.admin-table td:first-child{white-space:nowrap;font-variant-numeric:tabular-nums}
.admin-table .num{font-variant-numeric:tabular-nums}
.admin-table .admin-items{min-width:200px;max-width:380px;white-space:normal}
.admin-table .sag-chip{white-space:nowrap}
.admin-table .admin-next{min-width:0;width:1%;padding:5px 8px}
.admin-acts{display:flex;justify-content:flex-end;gap:4px;width:104px;margin-left:auto}
.admin-acts .btn{margin:0;position:relative;z-index:1}
.admin-acts .btn:hover,.admin-acts .btn:focus-visible{z-index:2}

/* ── Work queue head: title, count and tools on one line ── */
.pane-head-manage{margin:12px 0 10px!important;padding:6px 0}
.admin-queue .pane-tools-labels{flex:0 1 auto;width:auto;margin-left:auto;justify-content:flex-end;gap:6px}
.admin-queue .pane-tools-labels .btn{flex:none;white-space:nowrap}

/* Summary tiles: count and stage on one line, the hint in the tooltip. */
.mg-tiles{gap:8px;margin:0 0 10px}
.mg-tile{flex-direction:row;align-items:center;gap:10px;padding:8px 12px}
.mg-tile .mg-tile-n{font-size:20px;line-height:1;min-width:1.4em}
.mg-tile-l{font-size:12.5px}
.mg-tile-h{display:none}

/* Filters: one row where the width allows. */
.admin-filters{grid-template-columns:minmax(180px,2fr) repeat(auto-fill,minmax(132px,1fr));gap:8px;margin:0 0 8px}
.admin-filter:first-child{grid-column:auto}
.admin-filter{gap:3px}
.admin-filter span{font-size:11.5px;font-weight:600;color:var(--sag-text-3,var(--sag-text-3))}
.admin-presets{gap:6px;margin:0 0 10px}

/* ── Everything else in the working view ── */
.app{padding-bottom:72px}
.topbar{padding:7px 22px}
.brand img{width:28px}
.brand h1{font-size:16px}
.brand p{font-size:11px}
.nav{padding:3px}
.nav button{padding:5px 13px}

.howto{margin:12px 0 4px;padding:6px 12px;gap:8px}
.howto .st{font-size:12.5px;gap:7px}
.howto .n{width:18px;height:18px;font-size:10.5px}

/* Price changes: one line of chips that scrolls sideways instead of a block. */
.price-note{padding:6px 12px!important;margin:0 0 10px;gap:8px;flex-wrap:nowrap}
.price-note > span{flex:0 0 auto;white-space:nowrap}
.price-note .pn-items{flex:1 1 auto;flex-wrap:nowrap;overflow-x:auto;padding-left:0;scrollbar-width:none;min-width:0;order:0}
.price-note .pn-items::-webkit-scrollbar{display:none}
.price-note .pn-item{padding:3px 8px;flex:none;max-width:280px}
.price-note .pn-go{order:1;padding:3px 11px}
.price-note .pn-x{order:2}

/* 6px over the tabs, so a selected or focused tab is never cut by the top bar. */
.cats{gap:6px;padding:6px 4px 8px}
.cat{padding:5px 10px 5px 8px;gap:7px}
.cat .ic{font-size:15px}
.cat .tx b{font-size:13px}
.cat .cnt{min-width:20px;height:18px;font-size:11px}

.pane-head{padding:6px 0 8px;gap:10px;margin-bottom:4px}
.pane-head h2{font-size:17px}
.pane-head .sub{font-size:12px}

/* Catalogue cards: more to a row, less to a card. */
.grid,.group-grid{grid-template-columns:repeat(auto-fill,minmax(min(132px,100%),1fr));gap:10px}
.card .body{padding:8px 10px 0}
.card .nm{font-size:13.5px}
.card .un{margin-top:1px}
.card .who-has{margin-top:6px}
.card .act{padding:8px 10px 10px;gap:6px}
.add-btn{height:32px;font-size:13px}

/* The order panel. */
.panel-hd{padding:8px 12px}
.line{padding:7px 8px;gap:9px}
.line .th{width:34px;height:34px}
.panel-ft{padding:10px 12px}
.panel-sum{margin:0 2px 8px}
.panel-sum b{font-size:18px}

/* Budget. */
.bgt-hero{padding:16px 20px 14px}
.bgt-fig{font-size:clamp(28px,4vw,38px);margin:4px 0 2px}
.bgt-mo{padding:7px 10px}
.bgt-petty-main b{font-size:24px}

/* ── Mouse-sized controls ── */
@media (pointer:fine){
  .btn{height:34px;font-size:13px}
  .btn-sm,.btn.btn-sm{height:30px;min-height:0;font-size:12.5px;padding:0 11px}
  .btn.ibtn{padding:0 7px}
  .btn.btn-sm.catalogue-action,#cat-table-toggle{height:30px;min-height:0}
  .pane-head .search,.pane-head .search:focus-within{height:30px;flex:0 1 220px;width:220px}
  .pane-head .search input{font-size:13px}
  .admin-queue .pane-tools-labels .btn,.admin-presets .btn,.admin-table .btn,
  .invoice-queue-actions button{min-height:0}
  .admin-table .btn{height:28px}
  .admin-presets .btn{height:26px;padding:0 10px;font-size:12px;box-shadow:none;border:1px solid var(--sag-line,var(--sag-line))}
  .admin-filter input,.admin-filter select{min-height:0;height:32px;padding:0 10px;font-size:13px}
  .admin-filter select{padding-right:28px}
  .step button,.line-act .rm,.line-act .tag-btn{min-width:0;min-height:0;width:24px;height:24px}
  .typed-qty{min-height:0!important;height:24px;width:44px!important;padding:0 4px}
  .card-step-q.typed-qty{width:44px!important}
  .card .edit button{width:28px;height:28px}
  .catalogue-table input{min-height:0;height:30px}
  .em-chip{height:30px}
}

/* ── Short screens: the sticky header and the panel take less of the height ── */
@media (max-height:720px) and (min-width:1081px){
  .panel{top:64px;max-height:calc(100dvh - 76px)}
  .panel #budget{max-height:120px}
}

/* Below 1080px the page forces 16px text into every field so iOS does not zoom
   on focus. With a mouse there is no zoom to prevent, so fields keep the size
   of the text around them. (html body: the phone rule is injected later.) */
@media (pointer:fine) and (max-width:1080px){
  html body input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),html body select,html body textarea{font-size:14px!important}
  html body .admin-filter input,html body .admin-filter select{font-size:13px!important}
}

/* On a phone the catalogue tools share the row evenly, all three of them. */
@media (max-width:720px){
  html body .pane-tools #cat-table-toggle,html body .pane-tools .catalogue-action{flex:1 1 0}
}

/* ── Dialogs ── */
@media (pointer:coarse){
  .receipt-upload #rc-clear,.receipt-upload .rc-drop{min-height:44px;min-width:44px}
  .receipt-upload .rc-park-yn-btn,.receipt-upload .rc-park-pick{min-height:44px}
}
/* The tracker's calendar is compact with a mouse and a full target on touch. */
.pc-period>summary{min-height:44px}
@media (pointer:fine){.pc-period>summary{min-height:34px;padding-top:6px;padding-bottom:6px}}
.modal-hd{padding:18px 22px 0}
.modal-hd h2{font-size:18px;margin-bottom:4px}
.modal-hd p{font-size:13px;line-height:1.5}
.modal-bd{padding:14px 22px}
.modal-ft{padding:0 22px 18px;gap:8px}
.fld{margin-bottom:12px}
@media (pointer:fine){
  /* lists-review-ui.css gives every control in a dialog 44px; a mouse needs less. */
  .modal button,.modal input,.modal select,.modal textarea{min-height:0}
  .modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]),.modal select{min-height:34px}
  .modal .btn{height:34px}
  .modal .btn.btn-sm{height:30px}
  .fld input,.fld select,.fld textarea{padding:7px 10px}
  .fld select{padding-right:28px}
}

/* A long request names many items: two lines of them, the rest on hover. */
.admin-items-t{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow:hidden}

/* ── Account ── */
.account-profile-copy h1{font-size:24px}
.account-avatar{width:56px;height:56px}

/* Catalogue photos: a shorter slot. The lifestyle shots crop well to 4:3. */
.card .pic{height:auto;aspect-ratio:4/3}

/* Order panel rows: the quantity controls beside the item, not under it. */
@media (min-width:1081px) and (pointer:fine){
  .panel .line{flex-wrap:nowrap;align-items:center}
  .panel .line .tx{min-width:0}
  .panel .line .line-act{margin-left:0;flex-wrap:nowrap;gap:2px}
  .panel .line .tx .pr{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
}
@media (min-width:1081px) and (pointer:fine){
  .panel .line{gap:7px;padding:6px 6px}
  .panel .line .th{width:28px;height:28px}
  .panel .line .typed-qty{width:34px!important}
  .panel .line .step button,.panel .line .line-act .rm,.panel .line .line-act .tag-btn{width:22px}
}

/* ══ Buttons are as wide as their words ══
   The base .btn in index.html is width:100% with no side padding, so a short
   button stretched across whatever held it: the cash actions, the catalogue
   table toolbar and every dialog footer were thin bars as wide as the screen.
   Full width is now opt-in (.btn-block, or one of the named places below). */
.btn{display:inline-flex;width:auto;vertical-align:middle}
.btn:where(:not(.btn-sm):not(.ibtn)){padding:0 16px}
.btn.btn-block,.panel-ft #btn-send,.btn.rr-see,.invoice-queue-actions .btn{width:100%}
.modal .btn:not(.ibtn):not(.btn-sm){padding-left:14px;padding-right:14px}
/* Dialog footers: the actions sit at the right, primary last, sized to their words. */
@media (min-width:721px){
  .modal-ft{justify-content:flex-end;flex-wrap:wrap}
  .modal-ft .btn{flex:0 0 auto;width:auto;min-width:96px;padding:0 16px}
}
.modal-scroll>.modal-ft{padding-top:10px;padding-bottom:14px}
@media (max-width:720px){.review-cash-actions .btn,.admin-catalogue-toolbar .btn{flex:1 1 auto}}
.admin-catalogue-toolbar,.review-cash-actions{gap:8px}
.admin-catalogue-toolbar>p{flex:1 1 100%;margin:0}

/* ══ One way to name an icon button ══
   The words used to slide out of the button itself. In a table row that
   widened the button over the amount and fund columns next to it, and in a
   toolbar it pushed the neighbours sideways under the pointer. Now, with a
   mouse, the words are a small dark label that floats beside the icon: the
   button keeps its size and nothing in the row moves or is hidden for good.
   Below the icon in toolbars; above it inside tables, whose scrolling wrapper
   would otherwise clip a label hanging under the last row. Right-aligned to
   the button so a label at the right edge never runs off the page. */
@media (hover:hover) and (pointer:fine){
  .btn.ibtn,.btn.btn-sm.catalogue-action:not(.expanded),.pane-tools #cat-table-toggle.btn.btn-sm{position:relative;overflow:visible}
  .btn.ibtn .ib-l,.btn.btn-sm.catalogue-action:not(.expanded) span{
    position:absolute;top:calc(100% + 5px);right:0;left:auto;transform:none;
    max-width:none;margin:0;padding:3px 8px;border-radius:6px;opacity:0;
    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;z-index:30;box-shadow:var(--sag-shadow-2);
    transition:opacity .12s var(--sag-ease,ease) .15s}
  .btn.ibtn:hover .ib-l,.btn.ibtn:focus-visible .ib-l,
  .btn.btn-sm.catalogue-action:not(.expanded):hover span,.btn.btn-sm.catalogue-action:not(.expanded):focus-visible span{
    opacity:1;max-width:none;margin:0}
  .admin-table .btn.ibtn .ib-l,.catalogue-table .btn.ibtn .ib-l{top:auto;bottom:calc(100% + 5px)}
}

/* Overdue and due-today renewal lines: the coloured edge sat inside a rounded
   row, so it curved round the corners like a "{". The "⚠ n days late" words
   already say it; the row keeps a plain hairline and its own background. */
.rq-lines li.renewal-overdue,.rq-lines li.renewal-overdue:nth-child(odd),
.rq-lines li.renewal-today,.rq-lines li.renewal-today:nth-child(odd),
.rq-lines li.flagged,.rq-lines li.flagged:nth-child(odd){box-shadow:none;background:transparent;border-radius:0}
.rq-lines li.renewal-overdue+li,.rq-lines li.renewal-today+li,.rq-lines li.flagged+li{border-top:1px solid var(--sag-line,var(--sag-line))}

/* ══ Price badges (priceBadgeHtml in index.html) ══
   The currency is a small tinted mark in front of the figure: green $ for a
   dollar subscription, slate Rp for rupiah. What a dollar price comes to in
   rupiah follows it, muted. The parts sit in a wrapping row with a gap, so a
   narrow card wraps cleanly instead of leaving a separator on its own line. */
.pb-line{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 8px;min-width:0}
.pb{display:inline-flex;align-items:baseline;gap:4px;white-space:nowrap;font-variant-numeric:tabular-nums;color:var(--sag-text,var(--sag-text))}
.pb b{font-weight:700}
.pb-cur{align-self:center;display:inline-grid;place-items:center;min-width:18px;height:16px;padding:0 4px;border-radius:4px;
  font:700 9.5px/1 var(--sag-font);font-style:normal;letter-spacing:.02em}
.pb-cur-idr{background:var(--sag-idle-bg,var(--sag-idle-bg));color:var(--sag-meta,var(--sag-text-2))}
.pb-cur-usd{background:var(--sag-ok-bg,var(--sag-ok-bg));color:var(--sag-ok-fg,var(--sag-ok-fg))}
.pb-alt{font-size:11.5px;font-weight:500;color:var(--sag-text-3,var(--sag-text-3));white-space:nowrap;font-variant-numeric:tabular-nums}
.pb-n{font-size:11px;font-weight:600;color:var(--sag-meta,var(--sag-text-2));white-space:nowrap}
.pb-var{display:inline-flex;align-items:center;height:20px;padding:0 8px;border:1px dashed var(--sag-line-strong,var(--sag-line-strong));
  border-radius:999px;font-size:11px;font-weight:600;color:var(--sag-text-2,var(--sag-text-2));white-space:nowrap}

/* ══ One focus ring, one cursor (feedback A2–A4) ══
   Focus is the soft slate ring of --sag-ring (sag-app.css), keyboard only, for
   every control in the Lists app; the dozen older rules in gold, slate and 3px
   black each drew their own. Controls inside a box that clips (the section
   tabs on a narrow screen, the card stepper) take the inset form. Text fields
   keep their own focus border instead of a ring. */
:is(#app,#modal,#account-page) :is(button,a,summary,select,[role="button"],[tabindex]:not(td),input[type="checkbox"],input[type="radio"]):focus-visible{
  outline:2px solid transparent;outline-offset:2px;box-shadow:var(--sag-ring)}
:is(#app,#modal) :is(.cat,.card-step button,.nav button,.sh-opt):focus-visible{box-shadow:var(--sag-ring-inset)}
:is(#app,#modal,#account-page) :is(input:not([type="checkbox"]):not([type="radio"]),textarea):focus-visible{outline:none}
#modal:focus,#modal:focus-visible{outline:none;box-shadow:var(--sag-shadow-2)}
.fld input:focus,.fld select:focus,.fld textarea:focus{border-color:var(--sag-line-strong,var(--sag-line-strong));box-shadow:0 0 0 3px rgba(27,48,56,.12)}
/* The pointer stays an arrow over what cannot be typed into or pressed. */
.panel-hd,.pane-head,.sh-bar,.sh-grid th,.nav,.cats,.topbar{cursor:default}
/* A tab scrolled to by keyboard, or a header jumped to, clears the sticky bar. */
.cat,.pane-head{scroll-margin-top:calc(var(--topbar-h,59px) + 8px)}

/* ── The active tab: one pill that slides to it (slideTabPill) ──
   The top navigation and the section tabs each have one pill under the tab
   that is on, instead of the tab drawing its own fill and outline. */
#nav,#cats{position:relative}
.tab-pill{position:absolute;left:0;top:0;z-index:0;pointer-events:none;
  transition:transform .26s var(--sag-ease,ease),width .26s var(--sag-ease,ease),height .26s var(--sag-ease,ease)}
.tab-pill.still{transition:none}
#nav>.tab-pill{border-radius:999px;background:var(--surface,var(--sag-surface));box-shadow:var(--sag-shadow-1)}
#cats>.tab-pill{border-radius:var(--r,8px);background:var(--sag-selected);box-shadow:inset 0 0 0 1px var(--sag-line-strong)}
#nav>button,#cats>.cat{position:relative;z-index:1}
/* B48: the bar's icons (Backups, the bell, Subscription invoices, Sign out) on
   one pill, the same shape as the tabs and EN | ID, with the tabs' pill under
   the icon the pointer is on (wireDock). pan-y: a finger sliding along it
   chooses an icon instead of scrolling the page sideways. */
.tb-dock{position:relative;display:flex;align-items:center;gap:2px;padding:3px;border-radius:999px;flex-shrink:0;touch-action:pan-y}
.tb-dock>button{position:relative;z-index:1}
.tb-dock>.tab-pill{border-radius:999px;background:color-mix(in srgb,var(--sag-text) 18%,transparent);
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--sag-text) 22%,transparent)}
.tb-dock>.dock-hot{color:var(--sag-text)}
.tb-dock>.icon-btn:not(.backup-badge):hover{background:transparent}
/* Sign out a step apart, so it is never the icon a slide ends on by accident. */
.tb-dock>#btn-out{margin-left:5px}
.tb-dock>#btn-out::before{content:"";position:absolute;left:-4px;top:7px;bottom:7px;width:1px;background:var(--sag-line)}
#nav:has(>.tab-pill) button.on{background:transparent;box-shadow:none}
#cats:has(>.tab-pill) .cat.on{background:transparent;border-color:transparent}

/* ── "Did you mean …?" under a search box (lists-spell.js) ──
   Under the catalogue search it hangs below the box, so nothing moves; under
   a sheet's search it is a line of its own above the rows. */
.spell-hint{margin:0;font-size:12.5px;line-height:1.4;color:var(--sag-text-2,var(--sag-text-2))}
.spell-hint[hidden]{display:none}
.spell-go{padding:0 2px;border:0;background:none;color:var(--sag-text,var(--sag-text));font:inherit;font-weight:700;cursor:pointer;
  text-decoration:underline;text-underline-offset:2px}
.spell-go:hover{color:var(--sag-primary,var(--sag-text))}
.pane-tools{position:relative}
#q-spell{position:absolute;right:0;top:calc(100% + 2px);z-index:5;padding:3px 10px;border-radius:6px;
  background:var(--sag-surface,var(--sag-surface));box-shadow:var(--sag-shadow-1);white-space:nowrap}
.sh-spell{margin:-2px 0 8px;text-align:right}
@media (max-width:720px){#q-spell{position:static;margin-top:4px;white-space:normal}.sh-spell{text-align:left}}
.it-name-warn{margin:-4px 0 0;font-size:12px;font-weight:600;color:var(--sag-wait-fg,var(--sag-wait-fg))}
.it-name-warn[hidden]{display:none}

/* ── Round 1 review: 44px under a finger for what this round added or touched ── */
@media (pointer:coarse){
  .topbar-in>.nav button,.nav button{min-height:44px}
  .order-view-switch button{height:44px}
  .pane-head .search,.pane-head .search:focus-within{min-height:44px}
  #mobar-open{min-height:44px}
  .q-tiles .q-tile{min-height:44px}
  .q-sortby select{height:44px}
  .card .auto-me{min-height:44px}
}
