/* Avilo — Sales & customers module (team D1). Phone first (375px); every class starts with .sal- */

/* ---------- Section: list screen ---------- */
.sal{padding-top:6px}
.sal .mod-head .btn{min-height:44px}
.sal-tabs{margin:0 0 12px}
.sal-tabs .chip{min-height:44px}
.sal-newbtn{margin:0 0 12px;min-height:54px;font-size:16.5px;border-radius:var(--r)}
.sal-search{position:relative;margin:0 0 10px}
.sal-search>.i{position:absolute;left:14px;top:50%;transform:translateY(-50%);color:var(--muted);pointer-events:none}
.sal-search input{padding-left:44px;padding-right:48px;border-radius:var(--r-pill);min-height:48px}
.sal-qx{position:absolute;right:6px;top:50%;transform:translateY(-50%);width:44px;height:44px;border:0;border-radius:50%;background:var(--surface-2);color:var(--ink-2);display:grid;place-items:center}
.sal-types,.sal-scopes{margin:0 0 12px}
.sal-count{margin:0 0 8px}
.sal-list{display:grid;grid-template-columns:1fr;gap:10px}
@media (min-width:760px){.sal-list{grid-template-columns:1fr 1fr}}
@media (min-width:1200px){.sal-list{grid-template-columns:repeat(3,1fr)}}
.sal-card{display:flex;align-items:center;gap:12px;width:100%;min-height:72px;padding:12px 12px 12px 14px;text-align:left;background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r);box-shadow:var(--shadow-1);cursor:pointer;min-width:0;
  transition:transform .15s var(--ease),box-shadow .15s}
@media (hover:hover){.sal-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-2)}}
.sal-card:focus-visible{outline:3px solid var(--muted);outline:3px solid color-mix(in srgb,var(--accent) 55%,transparent);outline-offset:2px}
.sal-card .grow{flex:1;min-width:0}
.sal-card b{display:block;font-size:16.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sal-card small{display:block;color:var(--muted);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sal-cright{display:flex;align-items:center;gap:6px;flex:none;color:var(--muted)}
.sal-avatar{width:44px;height:44px;flex:none;border-radius:50%;display:grid;place-items:center;background:var(--brand-soft);color:var(--brand);font:800 18px var(--font-head)}
.sal-avatar.big{width:56px;height:56px;font-size:22px}
.sal-avatar .i{width:22px;height:22px}
.sal-skel{min-height:72px;cursor:default;background:linear-gradient(90deg,var(--surface) 0%,var(--surface-2) 50%,var(--surface) 100%);background-size:200% 100%;animation:salShimmer 1.2s linear infinite}
@keyframes salShimmer{from{background-position:200% 0}to{background-position:-200% 0}}
.sal-more{margin-top:14px}
.sal-view .empty .i.lg{width:40px;height:40px;color:var(--muted)}
.sal-view .empty p{margin:4px 0 14px}
.sal-range{margin:-4px 0 10px}

/* ---------- Sold list ---------- */
.sal-scard{display:flex;flex-direction:column;gap:8px;width:100%;padding:14px;text-align:left;background:var(--surface);border:1px solid var(--line-2);border-radius:var(--r);box-shadow:var(--shadow-1);cursor:pointer;min-width:0}
.sal-scard.sal-skel{min-height:120px}
.sal-stop{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.sal-sno{font:800 17px var(--font-head)}
.sal-when{margin-left:auto;font-size:13px;font-weight:600;color:var(--ink-2);white-space:nowrap}
.sal-smid{display:flex;align-items:center;gap:10px;min-width:0}
.sal-smid .grow{flex:1;min-width:0}
.sal-smid b{display:block;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sal-smid small{display:block;color:var(--muted);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sal-pics{display:flex;flex:none}
.sal-pics span{width:44px;height:44px;border-radius:10px;overflow:hidden;background:var(--surface-2);border:2px solid var(--surface);margin-left:-12px;box-shadow:0 1px 3px rgba(0,0,0,.12);display:block}
.sal-pics span:first-child{margin-left:0}
.sal-pics img{width:100%;height:100%;object-fit:cover}
.sal-schips{display:flex;flex-wrap:wrap;gap:6px}
.sal-lchip{display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:5px 10px;border-radius:var(--r-pill);background:var(--surface-2);font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sal-lchip em{font-style:normal;color:var(--brand);font-weight:800;letter-spacing:.03em}
.sal-stot{font-size:14px;color:var(--ink-2)}
.sal-stot b{color:var(--ink);font-size:15px}

/* ---------- Shared: item rows, code, thumbs ---------- */
.sal-items{display:flex;flex-direction:column;gap:8px}
.sal-item{display:flex;align-items:center;gap:12px;width:100%;padding:10px;border:1px solid var(--line);border-radius:var(--r);background:var(--surface-2);text-align:left;min-width:0}
button.sal-item{cursor:pointer}
.sal-item .grow{flex:1;min-width:0}
.sal-item b{display:block;font-size:15.5px;line-height:1.3;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sal-item small{display:flex;align-items:center;gap:4px;color:var(--muted);font-size:12.5px;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sal-thumb{width:60px;height:60px;flex:none;border-radius:12px;overflow:hidden;background:var(--surface);display:block}
.sal-thumb img{width:100%;height:100%;object-fit:cover;cursor:zoom-in}
.sal-noimg{width:100%;height:100%;display:grid;place-items:center;color:var(--muted)}
.sal-code{flex:none;display:flex;flex-direction:column;align-items:flex-end;font:800 18px var(--font-head);letter-spacing:.04em;color:var(--brand)}
.sal-code small{font:600 12px var(--font);color:var(--muted);letter-spacing:0}
.sal-warn{color:#92400E !important;font-weight:600}
:root[data-theme="dark"] .sal-warn{color:#FCD34D !important}

/* ---------- Sell sheet ---------- */
.sal-sell .fsec>h3{font-size:16px}
.sal-pricef input{font-weight:700;letter-spacing:.04em;text-transform:uppercase}
.sal-pricef .hint{display:block;min-height:18px;margin-top:4px}
.sal-hint{color:var(--muted);font-size:13px}
.sal-hint.ok{color:var(--ok)}
.sal-hint.err{color:var(--danger)}
.sal-hint b{letter-spacing:.04em}
.sal-matches:empty{display:none}
.sal-matches{margin:-6px 0 12px}
.sal-matches .lbl{margin:0 0 4px}
.sal-match{min-height:56px;background:var(--surface-2);border-radius:var(--r-sm);margin-bottom:6px}
.sal-match .grow{font-weight:700}
.sal-picked{display:flex;align-items:center;gap:12px;padding:12px;border:1.5px solid var(--ok);border-radius:var(--r);background:var(--ok-soft)}
.sal-picked .grow{flex:1;min-width:0}
.sal-picked b{display:block;font-size:16px}
.sal-picked small{display:block;color:var(--ink-2);font-size:13px}
.sal-picked .btn{min-height:44px}
.sal-deliv{display:grid;grid-template-columns:1fr;gap:10px}
@media (min-width:560px){.sal-deliv{grid-template-columns:1fr 1fr}}
.sal-big{display:flex;align-items:center;gap:14px;min-height:64px;padding:12px 16px;border-radius:var(--r);border:1.5px solid var(--line);background:var(--surface);text-align:left;width:100%;transition:border-color .15s,background .15s,transform .1s}
.sal-big:active{transform:scale(.98)}
.sal-big>.i{width:26px;height:26px;padding:9px;box-sizing:content-box;border-radius:14px;flex:none;color:var(--brand);background:var(--brand-soft)}
.sal-big b{display:block;font:700 16px var(--font-head)}
.sal-big small{display:block;color:var(--muted);font-size:13px;line-height:1.3;margin-top:2px}
.sal-big.on{border-color:var(--ink);background:var(--ink);color:var(--bg)}
.sal-big.on>.i{color:var(--bg);background:rgba(255,255,255,.14)}
.sal-big.on small{color:var(--line);color:color-mix(in srgb,var(--bg) 75%,transparent)}

/* ---------- Customer page ---------- */
.sal-cpage .sal-cbox{display:flex;align-items:flex-start;gap:12px}
.sal-cbox{display:flex;align-items:center;gap:12px}
.sal-cbox .grow{flex:1;min-width:0}
.sal-cbox .btn{min-height:44px}
.sal-cname{display:block;font:800 20px var(--font-head)}
.sal-phone{display:inline-block;font-weight:700;font-size:16px;color:var(--ink);text-decoration:none;margin-top:2px}
.sal-ctags{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
.sal-cbox p{margin:8px 0 0;font-size:14px;overflow-wrap:anywhere}
.sal-cbox .subtle{display:block;margin-top:6px}
.sal-cacts{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 14px}
.sal-cacts .btn{flex:1 1 0;min-width:96px;min-height:48px;padding:10px 8px;text-decoration:none}
.sal-cols{display:grid;grid-template-columns:1fr;gap:0 24px}
@media (min-width:900px){.sal-cols{grid-template-columns:1fr 1fr}}
.sal-h{display:flex;align-items:center;gap:8px;font-size:16px;margin:16px 0 10px}
.sal-h span{font:500 13px var(--font);color:var(--muted)}
.sal-orders .item{min-height:60px;border:1px solid var(--line);border-radius:var(--r-sm);margin-bottom:8px;background:var(--surface)}
.sal-orders .item b{font-size:15px}
.sal-orders .item small{white-space:normal;overflow-wrap:anywhere}
.sal-orders .stat{margin-left:4px}
.sal-kv{margin:0 0 6px;padding:12px 14px;border-radius:var(--r-sm);background:var(--surface-2)}
.sal-link{padding:0 4px;color:var(--brand);font-weight:700;min-height:44px}
.sal-hist{list-style:none;margin:0;padding:0}
.sal-hist li{position:relative;padding:0 0 12px 18px;font-size:14px;overflow-wrap:anywhere}
.sal-hist li::before{content:"";position:absolute;left:3px;top:7px;width:7px;height:7px;border-radius:50%;background:var(--line)}
.sal-hist li:first-child::before{background:var(--brand)}
.sal-hist small{display:block;color:var(--muted);font-size:12.5px}
.sal-foot{display:flex;gap:10px;width:100%}
.sal-foot .btn{flex:1}
.sal-foot .btn.secondary{flex:1}
.sal-foot .btn.ghost{flex:0 0 auto}
@media (max-width:380px){.sal-code{font-size:16px}.sal-cacts .btn{min-width:80px}}

/* ---------- Phase 2b: sale basket, Sold today, client stats, order desk ---------- */
/* Floating "Sale basket" button on the product grid (above the bottom bar on phones). */
.sal-fab{position:fixed;right:14px;bottom:calc(76px + env(safe-area-inset-bottom));z-index:34;display:inline-flex;align-items:center;gap:8px;min-height:52px;padding:0 10px 0 16px;
  border:0;border-radius:var(--r-pill);background:var(--accent);color:var(--on-accent);font:700 15px var(--font-head);box-shadow:0 12px 26px -10px rgba(15,15,16,.6);cursor:pointer;transition:transform .12s}
.sal-fab:active{transform:scale(.96)}
.sal-fab[hidden]{display:none}
.sal-fab .i{width:22px;height:22px}
.sal-fab b{min-width:30px;height:30px;padding:0 8px;border-radius:var(--r-pill);display:grid;place-items:center;background:var(--brand);color:#fff;font:800 15px var(--font-head)}
@media (min-width:900px){.sal-fab{bottom:24px;right:24px}}
body:not([data-view="products"]) .sal-fab,.selecting .sal-fab{display:none}
/* Product page: Add to sale basket */
.sal-addbox{display:flex;flex-direction:column;gap:6px}
.sal-addbox small{color:var(--muted);font-size:12.5px;line-height:1.35}
.sal-addbtn{width:100%;min-height:52px}
.sal-addbox.in{flex-direction:row;align-items:center;gap:10px;padding:10px 12px;border:1.5px solid var(--ok);border-radius:var(--r);background:var(--ok-soft)}
.sal-addbox.in>.i{width:24px;height:24px;color:var(--ok);flex:none}
.sal-addbox.in .grow{flex:1;min-width:0}
.sal-addbox.in b{display:block;font-size:15px}
.sal-addbox.in small{display:block;color:var(--ink-2)}
.sal-addbox.in .btn{min-height:44px;flex:none;padding:0 12px}
/* Basket sheet + sell sheet rows */
.sal-bkrow{gap:10px}
.sal-bkrow .sal-thumb{border:0;padding:0;cursor:pointer}
.sal-bkmain{border:0;background:none;text-align:left;padding:0;min-width:0;cursor:pointer;color:inherit}
.sal-x{width:44px;height:44px;min-height:44px;padding:0;flex:none;display:grid;place-items:center;border-radius:50%;color:var(--muted)}
.sal-x:hover{background:var(--surface-3);color:var(--danger)}
.sal-bkadd,.sal-addpiece{margin-top:10px;min-height:48px}
.sal-bkfoot{display:flex;gap:10px;width:100%}
.sal-bkfoot .btn{min-height:52px}
/* Client page numbers */
.sal-stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(78px,1fr));gap:8px;margin:0 0 12px}
.sal-stats div{padding:10px 8px;border-radius:var(--r-sm);background:var(--surface-2);text-align:center;min-width:0}
.sal-stats b{display:block;font:800 19px var(--font-head);overflow-wrap:anywhere}
.sal-stats small{display:block;color:var(--muted);font-size:12px}
/* Sold today: one card per client */
.sal-sgroup{cursor:default}
.sal-sgroup .sal-stop{flex-wrap:nowrap}
.sal-sgroup .sal-stop .grow{flex:1;min-width:0}
.sal-sgroup .sal-stop b{display:block;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sal-sgroup .sal-stop small{display:block;color:var(--muted);font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sal-sgroup .sal-avatar{width:40px;height:40px;font-size:16px}
.sal-call{width:44px;min-height:44px;padding:0;flex:none;justify-content:center}
.sal-open{min-height:44px;flex:none;padding:0 12px}
.sal-sgroup .sal-item{background:var(--surface-2)}
.sal-note{margin-top:14px}
.sal-scopes .chip,.sal-types .chip{min-height:44px}
.sal-scopes .chip .n{margin-left:6px;font-weight:600;color:var(--muted)}
.sal-scopes{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
.sal-scopes::-webkit-scrollbar{display:none}
.sal-desk .item.on{border-color:var(--ink);background:var(--surface-2)}

/* ---------- D1 fixes: full-width client type, 44px targets, Last price on the Sell sheet ---------- */
/* Client type (Walk-in / Regular / Dealer): three equal buttons across the whole field. */
.sal-typechips{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;width:100%}
.sal-typechips .chip{min-height:44px;justify-content:center;padding:8px 6px;text-align:center}
.sal-sell .chips .chip,.sal-tabs .chip{min-height:44px}
.sal-link{display:inline-flex;align-items:center;min-height:44px;min-width:44px}
/* Tag code + "Last T5" under it on each piece of the Sell sheet */
.sal-item .sal-code small{white-space:nowrap}
.sal-hint.err b{letter-spacing:.04em}
/* D2 Sold list rows (Waiting for delivery / Delivered) + D8 variant chips */
.sal-sitem{flex-direction:column;align-items:stretch;gap:8px}
.sal-sopen{display:flex;gap:12px;align-items:flex-start;width:100%;background:none;border:0;padding:0;text-align:left;font:inherit;color:inherit;min-height:44px}
.sal-sopen .grow{display:flex;flex-direction:column;gap:3px;min-width:0}
.sal-vchip{align-self:flex-start;margin:1px 0}
.sal-dst{display:flex;align-items:center;gap:5px;font-weight:700}
.sal-dst.wait{color:var(--sand)}
.sal-dst.out{color:var(--accent)}
.sal-dst.done{color:var(--ok)}
.sal-hobtn{min-height:44px}
/* Customer page: sale slips as they were written (CONFORMANCE C9) */
.sal-slips{display:flex;flex-direction:column;gap:10px}
.sal-slip{cursor:auto}
.sal-slip .sal-link{margin-left:2px}
/* Manager's corrections C5 / C6: client form — Requirement type chips (multi-select, icon + name) and "Call after" chips */
.sal-wants{gap:6px}
.sal-wants .chip{min-height:44px;padding:8px 12px;font-size:14px}
.sal-wants .chip .i{width:18px;height:18px;flex:none}
.sal-wants .subtle{font-size:13px}
.sal-callf{margin:0 0 14px} /* sits right under Requirement (round 8 fix), a plain field like the others */
.sal-days .chip{min-height:48px}
.sal-days .chip .n{font-weight:500}
.sal-date{margin:12px 0 0}
.sal-cwants{display:flex;align-items:center;gap:6px;margin:8px 0 0;font-size:14px;font-weight:600;color:var(--ink-2)}
.sal-cwants .i{flex:none;color:var(--brand)}
/* Customer page: Client record — Mark inactive / Delete, admin (CONFORMANCE C12) */
.sal-crec{margin-top:18px;padding-top:12px;border-top:1px solid var(--line)}
.sal-crec .sal-cacts{margin-bottom:8px}
.sal-crec .hint{margin:0;font-size:13px;color:var(--muted);line-height:1.4}
.sal-wants .chip.on,.sal-days .chip.on{background:var(--ink);border-color:var(--ink);color:var(--bg);font-weight:600;opacity:1}.sal-wants .chip.on::after{content:"\2713";margin-left:4px} /* r25 fixer: a tapped requirement reads as chosen */
/* r33 JL (Sapna 2026-10-14): "Just looking — no follow-up" at the top of the walk-in sheet + the "Why no follow-up" chips.
   48 px targets at 360 px; Chrome 109 floor: plain rules, no nesting, plain colours only. */
.sal-jlf{margin:0 0 14px}
.sal-jl{min-height:48px;width:100%;justify-content:center;font-weight:600;border-style:dashed}
.sal-jl.on{background:var(--ink);border-color:var(--ink);border-style:solid;color:var(--bg)}
.sal-jl.on::after{content:"\2713";margin-left:4px}
.sal-jlf .hint{margin-top:6px}
.sal-why .chip{min-height:48px}
.sal-why .chip.on{background:var(--ink);border-color:var(--ink);color:var(--bg);font-weight:600}
.sal-whytext{margin-top:8px}

/* ---------- r35 desktop (owner 2026-10-17: "on desktop it looks like the mobile") — layout only, ≥1024 px ----------
   The client form (Add client / Edit client / Add walk-in client — the sheet with #cfPhone) is a little wider on a PC and
   puts its short boxes side by side: City + Pincode, Contact person + Contact mobile. Every other row keeps the full
   width and the same order. Phones (< 1024 px) are untouched. Chrome 109: :has() is 105+, no nesting. */
@media (min-width:1024px){
  .scrim>.sheet:not(.full):has(>.bd>.field>#cfPhone){max-width:760px}
  .sheet .bd:has(>.field>#cfPhone){display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:16px;align-content:start}
  .sheet .bd:has(>.field>#cfPhone)>*{grid-column:1/-1}
  .sheet .bd:has(>.field>#cfPhone)>:is(#cfCityF,#cfPinF,#cfContactF,#cfContactPhF){grid-column:auto}
}
