/* Phone-only counter UX (Bob, Nov 20 2026). Computer / tablet layouts stay as they are. */
/* Primary hook: html[data-device=phone]. Tighter extras also under 480px. */

html[data-device=phone]{
  --tabbar-h: calc(56px + env(safe-area-inset-bottom, 0px));
  --px-red: #c41230;
}

/* ---- Bottom tab bar ---- */
#phoneTabBar{
  display:none;
}
html[data-device=phone] #phoneTabBar{
  display:flex;
  position:fixed;
  left:0;right:0;bottom:0;
  z-index:70;
  height:var(--tabbar-h);
  padding:0 2px env(safe-area-inset-bottom, 0px);
  background:var(--card,#fff);
  border-top:1px solid var(--line,#e4dfd8);
  box-shadow:0 -4px 16px rgba(28,25,23,.08);
  justify-content:space-around;
  align-items:stretch;
  -webkit-tap-highlight-color:transparent;
}
html[data-device=phone][data-theme=dark] #phoneTabBar,
html[data-device=phone]:not([data-theme=light]) #phoneTabBar{
  background:var(--card,#18181b);
  border-top-color:var(--line,#3f3f46);
  box-shadow:0 -4px 16px rgba(0,0,0,.35);
}
@media (prefers-color-scheme: light){
  html[data-device=phone]:not([data-theme=dark]) #phoneTabBar{
    background:var(--card,#fff);
    border-top-color:var(--line,#e4dfd8);
    box-shadow:0 -4px 16px rgba(28,25,23,.08);
  }
}
html[data-device=phone] body.signed-out #phoneTabBar,
html[data-device=phone] body.scanning #phoneTabBar,
html[data-device=phone] #phoneTabBar.hidden{display:none!important}
html[data-device=phone] body.px-modal #phoneTabBar{display:none!important}

#phoneTabBar button{
  flex:1 1 0;
  min-width:0;
  min-height:48px;
  height:56px;
  margin:0;
  padding:4px 2px 0;
  border:0;
  background:transparent;
  color:var(--muted,#78716c);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:2px;
  font:700 11px/1.1 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  letter-spacing:.01em;
  -webkit-user-select:none;user-select:none;
  cursor:pointer;
}
#phoneTabBar button svg{width:22px;height:22px;flex:none;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#phoneTabBar button.on,
#phoneTabBar button[aria-current=page]{color:var(--px-red,#c41230)}
#phoneTabBar button:active{opacity:.7;transform:none}
#phoneTabBar button:focus-visible{outline:2px solid var(--px-red,#c41230);outline-offset:-2px}

/* Room for the bar — do not apply on desktop */
html[data-device=phone] body:not(.signed-out):not(.px-modal) .pane,
html[data-device=phone] body:not(.signed-out):not(.px-modal) #app.planner,
html[data-device=phone] body:not(.signed-out):not(.px-modal) #startPane{
  padding-bottom:calc(var(--tabbar-h) + 12px);
}
html[data-device=phone] #oneHome{
  padding-bottom:calc(var(--tabbar-h) + 16px);
}

/* More sheet */
#phoneMoreSheet{display:none}
html[data-device=phone] #phoneMoreSheet{
  display:none;
  position:fixed;inset:0;z-index:80;
}
html[data-device=phone] #phoneMoreSheet.open{display:block}
#phoneMoreSheet .px-bg{position:absolute;inset:0;background:rgba(28,25,23,.45)}
#phoneMoreSheet .px-sheet{
  position:absolute;left:0;right:0;bottom:0;
  background:var(--card,#fff);
  border-radius:16px 16px 0 0;
  padding:10px 12px calc(16px + env(safe-area-inset-bottom,0px));
  box-shadow:0 -8px 32px rgba(28,25,23,.2);
  max-height:min(80vh,640px);
  overflow:auto;
}
html[data-theme=dark] #phoneMoreSheet .px-sheet{background:var(--card,#18181b)}
@media (prefers-color-scheme: dark){
  html:not([data-theme=light]) #phoneMoreSheet .px-sheet{background:var(--card,#18181b)}
}
#phoneMoreSheet .px-handle{width:36px;height:4px;border-radius:99px;background:var(--line,#d6d3d1);margin:4px auto 10px}
#phoneMoreSheet button.px-mi,
#phoneMoreSheet a.px-mi{
  display:flex;align-items:center;gap:12px;
  width:100%;min-height:52px;padding:8px 12px;margin:0;
  border:0;border-radius:12px;background:transparent;
  color:inherit;font:700 18px/1.2 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  text-align:left;text-decoration:none;cursor:pointer;
}
#phoneMoreSheet button.px-mi:active,
#phoneMoreSheet a.px-mi:active{background:var(--wash,#f5f5f4)}
#phoneMoreSheet .px-mi svg{width:22px;height:22px;flex:none;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* Instant tap feedback */
html[data-device=phone] button.btn,
html[data-device=phone] .wocard,
html[data-device=phone] .chip,
html[data-device=phone] #woChips button,
html[data-device=phone] .tile,
html[data-device=phone] a.tile{
  transition:none;
}
html[data-device=phone] button.btn:active,
html[data-device=phone] .wocard:active,
html[data-device=phone] #woChips button:active,
html[data-device=phone] .tile:active{opacity:.75}

/* ---- Jobs list: compact rows, sticky search/chips ---- */
html[data-device=phone] #woPane .phead{
  position:sticky;top:0;z-index:6;
  background:var(--bg,#f6f4f1);
  padding-top:4px;padding-bottom:6px;margin-bottom:0;
}
html[data-device=phone] #woPane .wobar,
html[data-device=phone] #woPane #woChips{
  position:sticky;z-index:5;
  background:var(--bg,#f6f4f1);
  margin-top:0;
}
html[data-device=phone] #woPane .wobar{top:48px;padding:6px 0 4px}
html[data-device=phone] #woPane #woChips{top:100px;padding:4px 0 8px;margin-bottom:0}
html[data-device=phone] #woQ{
  font-size:18px;min-height:48px;width:100%;
}
html[data-device=phone] #woChips button{
  min-height:40px;padding:8px 12px;font-size:15px;
}
html[data-device=phone] .wocard{
  display:flex;align-items:center;gap:8px;
  padding:8px 12px;min-height:56px;
  margin:0 0 6px;border-radius:12px;
}
html[data-device=phone] .wocard .ph{display:none}
html[data-device=phone] .wocard .wc-b{
  display:grid;
  grid-template-columns:1fr auto;
  grid-template-areas:"who tot" "mach pill";
  gap:1px 10px;width:100%;min-width:0;align-items:center;
}
html[data-device=phone] .wocard .nm{
  grid-area:who;display:flex;flex-direction:column;gap:0;min-width:0;
  font-size:16px;font-weight:800;line-height:1.2;
}
html[data-device=phone] .wocard .nm .wono{
  order:-1;font-size:13px;font-weight:800;letter-spacing:.02em;color:var(--muted,#78716c);
  display:block;
}
html[data-device=phone] .wocard .womach{
  grid-area:mach;font-size:14px;line-height:1.25;margin:0;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
html[data-device=phone] .wocard .meta{
  grid-area:pill;display:flex;flex-direction:column;align-items:flex-end;gap:2px;margin:0;
}
html[data-device=phone] .wocard .meta > span:not(.wopill):not(.wctot){display:none}
html[data-device=phone] .wocard .wctot{
  grid-area:tot;display:block!important;
  font-size:16px;font-weight:800;white-space:nowrap;
}
html[data-device=phone] .wocard .wopill{font-size:12px;padding:2px 8px}
html[data-device=phone] .wohead{font-size:14px;margin:4px 0 8px;padding:0}
html[data-device=phone] #woNew{min-height:48px}
html[data-device=phone] #woPane .pane-in{padding-bottom:8px}

/* ---- Job page: sticky header, sections, cards, sheet, sticky totals ---- */
html[data-device=phone] #woView #woViewBody,
html[data-device=phone] #woView #woViewBody.modal{
  padding:0 0 var(--job-tot-h, 0px) !important;
}
html[data-device=phone] #woViewBody .jobpage{padding:0;gap:0}
html[data-device=phone] #woViewBody .jobhd{
  position:sticky;top:0;z-index:20;
  display:grid;
  grid-template-columns:auto 1fr auto auto;
  grid-template-areas:"back id print more" "st st act act";
  gap:6px 8px;align-items:center;
  margin:0;padding:8px 12px;
  background:var(--card,#fff);
  border-bottom:1px solid var(--line,#e4dfd8);
}
html[data-theme=dark] #woViewBody .jobhd,
html[data-device=phone]:not([data-theme=light]) #woViewBody .jobhd{background:var(--card,#18181b)}
@media (prefers-color-scheme: light){
  html[data-device=phone]:not([data-theme=dark]) #woViewBody .jobhd{background:var(--card,#fff)}
}
html[data-device=phone] #woViewBody .jobhd .backbtn{grid-area:back;min-height:48px;min-width:48px;padding:0 10px}
html[data-device=phone] #woViewBody .jobhd .idblock{grid-area:id;min-width:0}
html[data-device=phone] #woViewBody .jobhd .idblock b{font-size:16px;display:block;line-height:1.15}
html[data-device=phone] #woViewBody .jobhd .jobcust{
  display:block;font-size:14px;font-weight:600;color:var(--ink,#1c1917);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
html[data-device=phone] #woViewBody .jobhd .stlab{display:none}
html[data-device=phone] #woViewBody .jobhd #wvPhase{grid-area:st;min-height:44px;font-size:16px;max-width:100%}
html[data-device=phone] #woViewBody .jobhd .sp{display:none}
html[data-device=phone] #woViewBody .jobhd #wvPrint{grid-area:print;min-height:48px;padding:0 10px;font-size:14px;white-space:nowrap}
html[data-device=phone] #woViewBody .jobhd #wvMore{grid-area:more;min-height:48px;min-width:48px}
html[data-device=phone] #woViewBody .jobhd .jobhd-primary{grid-area:act}
html[data-device=phone] #woViewBody .jobhd .jobhd-primary .btn.red,
html[data-device=phone] #woViewBody .jobhd .jobhd-primary .btn.red.big{
  width:100%;min-height:48px;flex:none;margin:0;
}
html[data-device=phone] #woViewBody .wv-primary{display:none}
html[data-device=phone] #woViewBody .banner,
html[data-device=phone] #woViewBody .jobacts{margin:8px 12px}

/* Desktop must not show the extra header slot / customer line */
html:not([data-device=phone]) #woViewBody .jobcust,
html:not([data-device=phone]) #woViewBody .jobhd-primary{display:none}

/* Sections: on desktop the wrappers disappear so the form grid is unchanged */
html:not([data-device=phone]) .jsec,
html:not([data-device=phone]) .jsec-b{display:contents}
html:not([data-device=phone]) .jsec-h{display:none!important}

html[data-device=phone] #woViewBody form.woedit{
  display:block;margin:0;padding:0;
}
html[data-device=phone] .jsec{
  display:block;
  border-bottom:1px solid var(--line,#ece8e1);
  background:transparent;
  margin:0;
}
html[data-device=phone] .jsec-h{
  display:flex;align-items:center;justify-content:space-between;
  width:100%;min-height:48px;padding:10px 16px;
  margin:0;border:0;background:transparent;color:inherit;
  font:800 16px/1.2 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  text-align:left;cursor:pointer;
}
html[data-device=phone] .jsec-h::after{
  content:"";width:10px;height:10px;border-right:2px solid currentColor;border-bottom:2px solid currentColor;
  transform:rotate(45deg);margin-left:8px;flex:none;opacity:.5;transition:transform .12s;
}
html[data-device=phone] .jsec.open .jsec-h::after{transform:rotate(-135deg);margin-top:6px}
html[data-device=phone] .jsec:not(.open) .jsec-b{display:none}
html[data-device=phone] .jsec.open .jsec-b{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px 10px;
  padding:0 16px 12px;
}
html[data-device=phone] .jsec-b > .full,
html[data-device=phone] .jsec-b > .mach3{grid-column:1/-1}
html[data-device=phone] .jsec-b input,
html[data-device=phone] .jsec-b select,
html[data-device=phone] .jsec-b textarea{
  font-size:18px;min-height:48px;width:100%;
}
html[data-device=phone] .jsec-b textarea{min-height:72px}

/* Collapse leftover standalone sections (photos, notes, P&D) via same pattern if wrapped;
   otherwise tighten existing .wosec */
html[data-device=phone] #woViewBody .wosec{
  padding:0;margin:0;border-top:0;border-bottom:1px solid var(--line,#ece8e1);
}
html[data-device=phone] #woViewBody .wosec > h3{
  display:flex;align-items:center;justify-content:space-between;
  min-height:48px;padding:10px 16px;margin:0;font-size:16px;
}
html[data-device=phone] #woViewBody .wosec.collapsed > :not(h3){display:none}

/* Parts & labor as tappable cards */
html[data-device=phone] #woViewBody table.wolines thead{display:none}
html[data-device=phone] #woViewBody table.wolines,
html[data-device=phone] #woViewBody table.wolines tbody,
html[data-device=phone] #woViewBody table.wolines tr,
html[data-device=phone] #woViewBody table.wolines td{
  display:block;width:100%;
}
html[data-device=phone] #woViewBody table.wolines colgroup{display:none}
html[data-device=phone] #woViewBody table.wolines tr{
  background:var(--card,#fff);
  border:1px solid var(--line,#e4dfd8);
  border-radius:12px;
  padding:10px 12px;
  margin:0 0 8px;
  min-height:48px;
}
html[data-theme=dark] #woViewBody table.wolines tr{background:var(--wash,#27272a);border-color:var(--line,#3f3f46)}
@media (prefers-color-scheme: dark){
  html[data-device=phone]:not([data-theme=light]) #woViewBody table.wolines tr{background:var(--wash,#27272a);border-color:var(--line,#3f3f46)}
}
html[data-device=phone] #woViewBody table.wolines td{
  padding:4px 0;border:0;
}
html[data-device=phone] #woViewBody table.wolines td.c-pn{font-weight:800}
html[data-device=phone] #woViewBody table.wolines input.cell,
html[data-device=phone] #woViewBody table.wolines textarea.cell,
html[data-device=phone] #woViewBody table.wolines select.cell{
  font-size:18px;min-height:44px;width:100%;
}
html[data-device=phone] #woViewBody .tblwrap{padding:0 16px}
html[data-device=phone] #woViewBody #wvShowPart,
html[data-device=phone] #woViewBody #wvShowLab,
html[data-device=phone] #woViewBody #wvShowMisc{
  min-height:48px;margin:4px 16px 10px;width:calc(100% - 32px);
}

/* Add part / labor / misc as a bottom sheet */
html[data-device=phone] #woViewBody .partform:not(.hidden),
html[data-device=phone] #woViewBody .labform#wvLab:not(.hidden){
  position:fixed;left:0;right:0;bottom:0;z-index:90;
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:8px 10px;
  margin:0;
  padding:16px 16px calc(16px + env(safe-area-inset-bottom,0px));
  background:var(--card,#fff);
  border-radius:16px 16px 0 0;
  box-shadow:0 -8px 32px rgba(28,25,23,.25);
  max-height:min(85vh,640px);overflow:auto;
}
html[data-theme=dark] #woViewBody .partform:not(.hidden),
html[data-theme=dark] #woViewBody .labform#wvLab:not(.hidden){background:var(--card,#18181b)}
html[data-device=phone] #woViewBody .partform [name=pn],
html[data-device=phone] #woViewBody .partform [name=desc],
html[data-device=phone] #woViewBody .partform .pf-btns,
html[data-device=phone] #woViewBody .labform#wvLab [name=note]{grid-column:1/-1}
html[data-device=phone] #woViewBody .partform input,
html[data-device=phone] #woViewBody .partform select,
html[data-device=phone] #woViewBody .labform#wvLab input{
  font-size:18px;min-height:48px;
}
html[data-device=phone] .px-sheet-bg{
  position:fixed;inset:0;z-index:85;background:rgba(28,25,23,.45);border:0;padding:0;margin:0;
}

/* Sticky totals bar */
html[data-device=phone] #woViewBody .wosec.wototals{
  position:sticky;bottom:0;z-index:15;
  background:var(--card,#fff);
  border-top:1px solid var(--line,#e4dfd8);
  border-bottom:0;
  padding:8px 16px calc(8px + env(safe-area-inset-bottom,0px));
  margin:0;
}
html[data-theme=dark] #woViewBody .wosec.wototals{background:var(--card,#18181b)}
@media (prefers-color-scheme: light){
  html[data-device=phone]:not([data-theme=dark]) #woViewBody .wosec.wototals{background:var(--card,#fff)}
}
html[data-device=phone] #woViewBody .wosec.wototals > h3{display:none}
html[data-device=phone] #woViewBody .wosec.wototals .wotot{width:100%;font-size:16px}
html[data-device=phone] #woViewBody .wosec.wototals .mt{display:none}

/* ---- Forms: 18px inputs, no iOS zoom, 2 short fields, sticky Save, keyboard ---- */
html[data-device=phone] input,
html[data-device=phone] select,
html[data-device=phone] textarea,
html[data-device=phone] button.btn{
  font-size:18px;
}
html[data-device=phone] input,
html[data-device=phone] select{
  min-height:48px;
}
html[data-device=phone] #pdDlg .foot,
html[data-device=phone] #pdDlg .pdfoot,
html[data-device=phone] dialog#pdDlg .foot{
  position:sticky;bottom:0;z-index:6;
  background:var(--card,#fff);
  padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));
  margin:0;border-top:1px solid var(--line,#e4dfd8);
}
html[data-device=phone] #pdDlg #pdSave,
html[data-device=phone] #pdDlg .foot .btn.red{
  width:100%;min-height:48px;
}
html[data-device=phone] #pdDlg .pdgrid,
html[data-device=phone] #pdDlg .grid,
html[data-device=phone] #pdDlg form{
  padding-bottom:8px;
}
/* Two short P&D fields per row where they already use the 12-col grid;
   on a narrow phone keep pairs for phone/email, city/state, zip/ etc. */
@media (max-width:480px){
  html[data-device=phone] #pdDlg{width:100vw;max-width:100vw;height:100dvh;max-height:100dvh;margin:0;border-radius:0}
}

/* Check-in / checkout sticky actions */
html[data-device=phone] #woDlg .foot,
html[data-device=phone] #woForm ~ .foot,
html[data-device=phone] #coDlg .bzpay,
html[data-device=phone] #salePane .foot,
html[data-device=phone] .bzdlg .bzrow:has(.btn.red.big){
  position:sticky;bottom:0;z-index:5;
  background:var(--card,#fff);
  padding-bottom:calc(10px + env(safe-area-inset-bottom,0px));
}
html[data-device=phone] #coDlg .bzpay .btn,
html[data-device=phone] #woDlg .foot .btn.red{min-height:48px;width:100%}

/* Keyboard: scroll field into view is JS; leave room under focused fields */
html[data-device=phone] dialog[open] form,
html[data-device=phone] .pane-in{
  scroll-padding-bottom:120px;
}

/* Sticky search / filters on other lists */
html[data-device=phone] #custPane .phead + *,
html[data-device=phone] #cxQ,
html[data-device=phone] #custPane input[type=search]{
  /* parent sticky set below */
}
html[data-device=phone] #custPane .wobar,
html[data-device=phone] #rentPane .wobar,
html[data-device=phone] #cxSearch,
html[data-device=phone] .cxbar{
  position:sticky;top:48px;z-index:4;background:var(--bg,#f6f4f1);padding:6px 0;
}

/* Tighter vertical rhythm */
html[data-device=phone] .pane-in{padding-left:12px;padding-right:12px}
html[data-device=phone] .ptitle{font-size:22px;margin:4px 0}
html[data-device=phone] .setrow{min-height:52px}

/* Hide computer-only table on jobs list (already hidden under 901, keep explicit) */
html[data-device=phone] .wotable-wrap{display:none!important}
html[data-device=phone] .wolist{display:block}

/* Speed: contain list paints */
html[data-device=phone] #woList{content-visibility:auto;contain:layout}
html[data-device=phone] .wocard{content-visibility:auto;contain-intrinsic-size:auto 64px}

/* Landscape phones still use data-device=phone (device.js <600). Extra tighter at 480. */
@media (max-width:480px){
  html[data-device=phone] #woViewBody .jobhd #wvPrint{font-size:13px;padding:0 8px}
}

/* ---- Raised Home tab (JB circle logo in the middle) ---- */
html[data-device=phone] #phoneTabBar button.px-home{
  position:relative;
  margin-top:-22px;
  z-index:2;
  justify-content:flex-start;
  gap:2px;
  height:auto;
  min-height:56px;
  padding:0 2px 4px;
  overflow:visible;
}
html[data-device=phone] #phoneTabBar .px-home-logo{
  display:grid;
  place-items:center;
  width:58px;height:58px;
  border-radius:50%;
  background:#fff;
  overflow:hidden;
  box-shadow:0 6px 16px rgba(28,25,23,.28), 0 0 0 3px var(--card,#fff);
  flex:none;
}
html[data-device=phone] #phoneTabBar .px-home-logo img{
  width:40px;height:40px;
  object-fit:contain;
  display:block;
}
html[data-device=phone] #phoneTabBar button.px-home.on .px-home-logo,
html[data-device=phone] #phoneTabBar button.px-home[aria-current=page] .px-home-logo{
  box-shadow:0 6px 16px rgba(196,18,48,.4), 0 0 0 3px var(--card,#fff), 0 0 0 5px #c41230;
}
html[data-device=phone] #phoneTabBar .px-home-lab{
  font-size:10px;font-weight:800;line-height:1;margin-top:2px;
  color:var(--muted,#78716c);
}
html[data-device=phone] #phoneTabBar button.px-home.on .px-home-lab,
html[data-device=phone] #phoneTabBar button.px-home[aria-current=page] .px-home-lab{
  color:var(--px-red,#c41230);
}
html[data-theme=dark] #phoneTabBar .px-home-logo{
  background:#fff;
  box-shadow:0 6px 16px rgba(0,0,0,.5), 0 0 0 3px var(--card,#18181b);
}
html[data-theme=dark] #phoneTabBar button.px-home.on .px-home-logo{
  box-shadow:0 6px 16px rgba(196,18,48,.5), 0 0 0 3px var(--card,#18181b), 0 0 0 5px #c41230;
}

/* Phone Home is a launcher (computer Home tiles stay unchanged via JS) */
html[data-device=phone] #startPane .one-search{position:sticky;top:0;z-index:5;background:var(--bg,#f6f4f1);padding:8px 0 10px;margin:0}
html[data-device=phone] #oneQ{font-size:18px;min-height:48px}
html[data-device=phone] #oneFindGo,html[data-device=phone] #oneScan,html[data-device=phone] #oneNewSale{min-height:48px}
html[data-device=phone] #oneGrid.px-launch{grid-template-columns:1fr;gap:8px}
html[data-device=phone] #oneGrid.px-launch .one-tile{min-height:72px;padding:12px 14px}

/* P&D: two short fields per row on a phone, sticky save already above */
html[data-device=phone] #pdDlg .pdsec{
  grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  column-gap:10px;row-gap:10px;
}
html[data-device=phone] #pdDlg .col-name,
html[data-device=phone] #pdDlg .col-phone,
html[data-device=phone] #pdDlg .col-amt,
html[data-device=phone] #pdDlg .col-dep,
html[data-device=phone] #pdDlg .col-pay,
html[data-device=phone] #pdDlg .col-fee,
html[data-device=phone] #pdDlg .col-loc,
html[data-device=phone] #pdDlg .pdm-type,
html[data-device=phone] #pdDlg .pdcard .cn,
html[data-device=phone] #pdDlg .pdcard #pd_cexp,
html[data-device=phone] #pdDlg .pdcard #pd_ccvc{grid-column:auto !important}
html[data-device=phone] #pdDlg .col-addr,
html[data-device=phone] #pdDlg .col-date,
html[data-device=phone] #pdDlg .col-card,
html[data-device=phone] #pdDlg .col-notes,
html[data-device=phone] #pdDlg .pdsec-h,
html[data-device=phone] #pdDlg .pdsec-head,
html[data-device=phone] #pdDlg #pd_machines,
html[data-device=phone] #pdDlg #pdDepSum,
html[data-device=phone] #pdDlg #pdAiBox,
html[data-device=phone] #pdDlg .span-12,
html[data-device=phone] #pdDlg .pdm-desc,
html[data-device=phone] #pdDlg .pdm-prob,
html[data-device=phone] #pdDlg .pdm-wo{grid-column:1/-1 !important}
html[data-device=phone] #pdDlg .pdm-x{grid-column:2/3 !important}
html[data-device=phone] #pdDlg form.modal,
html[data-device=phone] #pdDlg .modal{
  padding-bottom:0;
  max-height:100dvh;overflow:auto;
}
html[data-device=phone] #pdDlg .foot,
html[data-device=phone] #pdDlg .pdfoot{
  position:sticky;bottom:0;z-index:6;
  background:var(--card,#fff);
  padding:10px 12px calc(10px + env(safe-area-inset-bottom,0px));
  border-top:1px solid var(--line,#e4dfd8);
}
html[data-device=phone] #pdDlg #pdSave{width:100%;min-height:48px;font-size:18px}

/* Part Search (iframe is phone-width when embedded on a phone): search + scan in one row */
html[data-device=phone] #psQrow,
html.embed[data-device=phone] #psQrow{
  display:flex;align-items:stretch;gap:8px;width:100%;
}
html[data-device=phone] #psQrow #fModel,
html.embed[data-device=phone] #psQrow #fModel{flex:1 1 auto;min-width:0;min-height:48px;font-size:18px}
html[data-device=phone] #psQrow #scanBtn,
html.embed[data-device=phone] #psQrow #scanBtn{
  flex:0 0 auto;min-width:48px;min-height:48px;padding:0 14px;font-weight:800;
}
html[data-device=phone] .jsec.open .jsec-b.jsec-lines{display:block;padding:0 0 8px}
html[data-device=phone] #woViewBody .jobhd .wv-menu{
  position:absolute;right:8px;top:56px;z-index:30;margin:0;
}
html[data-device=phone] #diagPane{padding-bottom:0}
/* Keep the Parts iframe above the tab bar */
html[data-device=phone] #diagFrame{height:calc(100dvh - var(--tabbar-h) - 56px);min-height:60vh}

/* Fix: raise fixed primary actions above the tab bar */
html[data-device=phone] body.counter[data-tab=wo] #woNew,
html[data-device=phone] body.counter[data-tab=invoices] #bzListNew,
html[data-device=phone] body.counter[data-tab=inventory] #invNewPo,
html[data-device=phone] body.counter[data-tab=queue] #qAdd,
html[data-device=phone] body.counter[data-tab=upcoming] #uAdd,
html[data-device=phone] body.counter[data-tab=rentals] #opsResNew{
  bottom:calc(12px + var(--tabbar-h)) !important;
  z-index:60;
}
html[data-device=phone] body.counter[data-tab=wo] #woPane .pane-in,
html[data-device=phone] body.counter[data-tab=invoices] #invPane .pane-in,
html[data-device=phone] body.counter[data-tab=inventory] #stockPane .pane-in,
html[data-device=phone] body.counter[data-tab=queue] #queuePane .pane-in,
html[data-device=phone] body.counter[data-tab=upcoming] #upcomingPane .pane-in,
html[data-device=phone] body.counter[data-tab=rentals] #rentPane .pane-in{
  padding-bottom:calc(88px + var(--tabbar-h)) !important;
}

/* Fix: job header — nothing clipped; Print short; status + red action on their own rows */
html[data-device=phone] #woViewBody .jobhd{
  grid-template-columns:auto minmax(0,1fr) auto auto;
  grid-template-areas:"back id print more" "st st st st" "act act act act";
  align-items:center;
}
html[data-device=phone] #woViewBody .jobhd .idblock b,
html[data-device=phone] #woViewBody .jobhd .jobcust{
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;
}
html[data-device=phone] #woViewBody .jobhd #wvPrint{min-width:48px;padding:0 12px}
html[data-device=phone] #wvPrint .print-full{display:none}
html[data-device=phone] #wvPrint .print-short{display:inline}
html:not([data-device=phone]) #wvPrint .print-short{display:none}
html[data-device=phone] #woViewBody .jobhd #wvPhase{max-width:none;width:100%;min-height:48px}
html[data-device=phone] #woViewBody .jobhd .jobhd-primary .btn{width:100%;min-height:48px}

/* Fix: compact sticky totals; full totals stay in the section and do not cover the page */
html[data-device=phone] #woViewBody .wosec.wototals{
  position:static;
  padding:8px 16px 12px;
  border-bottom:1px solid var(--line,#e4dfd8);
}
html[data-device=phone] #woViewBody .wosec.wototals > h3{display:flex}
html[data-device=phone] #woViewBody .wosec.wototals .mt{display:block}
html:not([data-device=phone]) .jobtot-bar{display:none!important}
html[data-device=phone] .jobtot-bar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  position:sticky;bottom:0;z-index:16;
  min-height:52px;
  padding:10px 16px calc(10px + env(safe-area-inset-bottom,0px));
  background:var(--card,#fff);
  border-top:1px solid var(--line,#e4dfd8);
  font-size:18px;font-weight:800;
}
html[data-theme=dark] .jobtot-bar{background:var(--card,#18181b)}
@media (prefers-color-scheme: light){
  html[data-device=phone]:not([data-theme=dark]) .jobtot-bar{background:var(--card,#fff)}
}

/* Fix: Home — room for the raised logo; Find + Scan on one row */
html[data-device=phone] #startPane .one-in{
  padding-bottom:calc(var(--tabbar-h) + 36px) !important;
}
html[data-device=phone] #startPane .one-search{
  display:grid;grid-template-columns:1fr 1fr;gap:8px;
}
html[data-device=phone] #startPane .one-q{grid-column:1/-1}
html[data-device=phone] #startPane #oneNewSale{grid-column:1/-1;min-height:48px}
html[data-device=phone] #startPane #oneFindGo,
html[data-device=phone] #startPane #oneScan{min-height:48px;width:100%}

/* Fix: add-part sheet field order + a little handle space */
html[data-device=phone] #woViewBody .partform:not(.hidden) [name=pn]{grid-column:1/-1;order:1}
html[data-device=phone] #woViewBody .partform:not(.hidden) [name=desc]{grid-column:1/-1;order:2}
html[data-device=phone] #woViewBody .partform:not(.hidden) [name=qty]{order:3}
html[data-device=phone] #woViewBody .partform:not(.hidden) [name=list]{order:4}
html[data-device=phone] #woViewBody .partform:not(.hidden) [name=cost]{order:5}
html[data-device=phone] #woViewBody .partform:not(.hidden) [name=vendor]{order:6}
html[data-device=phone] #woViewBody .partform:not(.hidden) .pf-btns{grid-column:1/-1;order:7}
html[data-device=phone] #woViewBody .partform:not(.hidden) .pnlook{grid-column:1/-1;order:1;margin-top:44px}

/* Check-in / other FABs must clear the raised Home logo */
html[data-device=phone] body.counter[data-tab=wo] #woNew,
html[data-device=phone] body.counter[data-tab=invoices] #bzListNew,
html[data-device=phone] body.counter[data-tab=inventory] #invNewPo,
html[data-device=phone] body.counter[data-tab=queue] #qAdd,
html[data-device=phone] body.counter[data-tab=upcoming] #uAdd,
html[data-device=phone] body.counter[data-tab=rentals] #opsResNew{
  bottom:calc(36px + var(--tabbar-h)) !important;
}
html[data-device=phone] body.counter[data-tab=wo] #woPane .pane-in,
html[data-device=phone] body.counter[data-tab=invoices] #invPane .pane-in,
html[data-device=phone] body.counter[data-tab=inventory] #stockPane .pane-in,
html[data-device=phone] body.counter[data-tab=queue] #queuePane .pane-in,
html[data-device=phone] body.counter[data-tab=upcoming] #upcomingPane .pane-in,
html[data-device=phone] body.counter[data-tab=rentals] #rentPane .pane-in{
  padding-bottom:calc(112px + var(--tabbar-h)) !important;
}

/* Home: Find and Scan on the same row; New sale stays full width */
html[data-device=phone] #startPane .one-q{order:1;grid-column:1/-1}
html[data-device=phone] #startPane #oneFindGo{order:2;grid-column:1}
html[data-device=phone] #startPane #oneScan{order:3;grid-column:2}
html[data-device=phone] #startPane #oneNewSale{order:4;grid-column:1/-1}
html[data-device=phone][data-theme=dark] #woPane .phead,
html[data-device=phone][data-theme=dark] #woPane .wobar,
html[data-device=phone][data-theme=dark] #woPane #woChips,
html[data-device=phone][data-theme=dark] #startPane .one-search{
  background:#09090b;
}
@media (prefers-color-scheme: dark){
  html[data-device=phone]:not([data-theme=light]) #woPane .phead,
  html[data-device=phone]:not([data-theme=light]) #woPane .wobar,
  html[data-device=phone]:not([data-theme=light]) #woPane #woChips,
  html[data-device=phone]:not([data-theme=light]) #startPane .one-search{
    background:#09090b;
  }
}

/* ---- Polish (Nov 20 8:35 PM): part/labor cards, sticky Jobs search, section summaries ---- */

/* Desktop: the sticky wrapper must not change the Jobs list layout */
html:not([data-device=phone]) .wo-stick{display:contents}

/* Jobs search + chips stick together. overflow-x:hidden on .pane-in was breaking sticky. */
html[data-device=phone] #woPane .pane-in{overflow-x:clip;overflow-y:visible}
html[data-device=phone] #woStick.wo-stick{
  position:sticky;top:0;z-index:6;
  background:var(--bg,#f6f4f1);
  padding:6px 0 8px;
}
html[data-device=phone] #woPane .wobar,
html[data-device=phone] #woPane #woChips{
  position:static;top:auto;background:transparent;padding-top:0;
}
html[data-device=phone][data-theme=dark] #woStick.wo-stick{background:#09090b}
@media (prefers-color-scheme: dark){
  html[data-device=phone]:not([data-theme=light]) #woStick.wo-stick{background:#09090b}
}

/* Job section headers: title, then a one-line summary, chevron on the right */
html[data-device=phone] .jsec-h{
  display:flex;flex-wrap:wrap;align-items:center;gap:2px 8px;
}
html[data-device=phone] .jsec-h::after{margin-left:auto;order:2}
html[data-device=phone] .jsec-sum{
  flex:1 1 100%;order:3;
  display:block;min-width:0;
  font-weight:600;font-size:14px;line-height:1.3;
  color:var(--muted,#78716c);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  text-align:left;
}
html[data-device=phone] .jsec.open .jsec-sum{display:none}
html:not([data-device=phone]) .jsec-sum{display:none!important}

/* Part / labor cards: qty + price side by side, labeled, line total on the right; × stays inside */
html[data-device=phone] #woViewBody .tblwrap{overflow-x:hidden;padding:0 16px}
html[data-device=phone] #woViewBody table.wolines,
html[data-device=phone] #woViewBody table.wolines tbody{
  display:block !important;width:100%;
}
html[data-device=phone] #woViewBody table.wolines thead{display:none !important}
html[data-device=phone] #woViewBody table.wolines tr{
  display:grid !important;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto 44px;
  grid-template-areas:
    "pn pn pn acts"
    "desc desc desc desc"
    "qty price ext acts";
  gap:8px 10px;
  align-items:end;
  width:100%;
  max-width:100%;
  box-sizing:border-box;
  overflow:hidden;
  padding:12px !important;
  margin:0 0 8px;
}
html[data-device=phone] #woViewBody table.wolines td{
  display:block !important;
  width:auto !important;
  max-width:100%;
  min-width:0;
  padding:0 !important;
  overflow:visible;
}
html[data-device=phone] #woViewBody table.wolines td.c-pn{grid-area:pn}
html[data-device=phone] #woViewBody table.wolines td.c-desc{grid-area:desc}
html[data-device=phone] #woViewBody table.wolines td.c-qty,
html[data-device=phone] #woViewBody table.wolines td.c-hrs{grid-area:qty}
html[data-device=phone] #woViewBody table.wolines td.c-price{grid-area:price}
html[data-device=phone] #woViewBody table.wolines td.c-ext{
  grid-area:ext;justify-self:end;align-self:end;
  font-size:16px;font-weight:800;white-space:nowrap;padding-bottom:10px !important;
}
html[data-device=phone] #woViewBody table.wolines td.c-acts{
  grid-area:acts;justify-self:end;align-self:start;
  width:44px;max-width:44px;min-width:44px;
}
html[data-device=phone] #woViewBody table.wolines td.c-acts .x{
  width:44px;height:44px;min-width:44px;min-height:44px;max-width:44px;
  margin:0;padding:0;box-sizing:border-box;
  display:grid;place-items:center;
}
html[data-device=phone] #woViewBody table.wolines td.c-qty::before,
html[data-device=phone] #woViewBody table.wolines td.c-price::before,
html[data-device=phone] #woViewBody table.wolines td.c-hrs::before{
  display:block;
  font-size:12px;font-weight:700;line-height:1.2;
  color:var(--muted,#78716c);
  margin:0 0 4px;letter-spacing:.02em;
}
html[data-device=phone] #woViewBody table.wolines td.c-qty::before{content:"Qty"}
html[data-device=phone] #woViewBody table.wolines td.c-price::before{content:"Price"}
html[data-device=phone] #woViewBody table.wolines.labgrid td.c-hrs::before{content:"Hours"}
html[data-device=phone] #woViewBody table.wolines.labgrid td.c-price::before{content:"Rate"}
html[data-device=phone] #woViewBody table.wolines td.c-qty input,
html[data-device=phone] #woViewBody table.wolines td.c-price input,
html[data-device=phone] #woViewBody table.wolines td.c-hrs input{
  width:100%;min-width:0;min-height:44px;font-size:18px;box-sizing:border-box;
}
html[data-device=phone] #woViewBody table.wolines.labgrid tr{
  grid-template-columns:minmax(0,1fr) minmax(0,1fr) auto 44px;
  grid-template-areas:
    "qty price ext acts"
    "mech mech mech acts"
    "desc desc desc desc";
}
html[data-device=phone] #woViewBody table.wolines.labgrid td.c-mech{
  grid-area:mech;min-width:0;
  font-size:14px;color:var(--muted,#78716c);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
html[data-device=phone] #woViewBody table.wolines.labgrid td.c-desc{grid-area:desc}

/* Nov 30: Home Part Search modes — one column of fields on the phone (override the old 2-col Find/Scan grid) */
html[data-device=phone] #startPane #oneSearch.one-search,
html[data-device=phone] #startPane .one-search#oneSearch{
  display:flex !important;
  flex-direction:column !important;
  flex-wrap:nowrap !important;
  grid-template-columns:none !important;
  gap:10px;
}
html[data-device=phone] #startPane #oneSearch .ps-msd,
html[data-device=phone] #startPane #oneSearch .ps-pn,
html[data-device=phone] #startPane #oneSearch .ps-actions{
  width:100%;
  grid-column:1 / -1;
  min-width:0;
}
html[data-device=phone] #startPane #oneSearch .ps-msd{display:flex;flex-direction:column;gap:10px}
html[data-device=phone] #startPane #oneSearch .ps-actions{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
html[data-device=phone] #startPane #oneSearch #oneFindGo{order:1;grid-column:1;width:100%;min-height:48px}
html[data-device=phone] #startPane #oneSearch #oneScan{order:2;grid-column:2;width:100%;min-height:48px;flex-direction:row}
html[data-device=phone] #startPane #oneSearch #oneNewSale{order:3;grid-column:1 / -1;width:100%;min-height:48px}
