/* JOSS Till — same palette and type as the tech app and office app. Laid out for a counter:
   landscape tablet or touchscreen monitor (products left, sale right), collapsing to a single
   column with a bottom "Pay" bar on a phone or portrait tablet. */
:root{
  --stone-50:#f3f6f7; --stone-100:#e6eaec; --stone-200:#d8dee1; --stone-300:#c1c9cd;
  --stone-400:#7c878d; --stone-500:#586269; --stone-600:#434d54; --stone-700:#323c44;
  --stone-800:#232d34; --stone-900:#18222a;
  --amber-50:#fffbeb; --amber-100:#fef3c7; --amber-400:#fbbf24; --amber-700:#b45309;
  --green-50:#ecfdf5; --green-100:#d1fae5; --green-500:#10b981; --green-600:#05966a; --green-700:#047857;
  --brand:#05966a;
  --blue-100:#dbeafe; --blue-700:#1d4ed8;
  --red-50:#fef2f2; --red-100:#fee2e2; --red-600:#dc2626; --red-700:#b91c1c;
  --sans:-apple-system,BlinkMacSystemFont,"Segoe UI Variable Text","Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  --mono:ui-monospace,SFMono-Regular,"SF Mono",Consolas,Menlo,monospace;
  --cart-w:380px;
}
*{box-sizing:border-box;}
html,body{margin:0; padding:0; height:100%;}
body{font-family:var(--sans); color:var(--stone-800); background:var(--stone-50); -webkit-font-smoothing:antialiased; line-height:1.4; overscroll-behavior:none;}
button{font-family:var(--sans);}
svg{display:block;}
.app{height:100vh; height:100dvh; display:flex; flex-direction:column;}
.boot{padding:40px; color:var(--stone-400); text-align:center;}

/* app bar */
.appbar{background:linear-gradient(180deg,#0aa074,var(--brand)); color:#fff; padding:calc(10px + env(safe-area-inset-top)) 16px 10px; display:flex; align-items:center; justify-content:space-between; gap:12px; flex-shrink:0; box-shadow:0 1px 6px rgba(3,98,73,.25); z-index:5;}
.appbar .brand{display:flex; align-items:center; gap:10px; font-size:17px; font-weight:600; min-width:0;}
.appbar .brand img{height:24px; width:auto;}
.appbar .brand .sep{opacity:.6; font-weight:400;}
.appbar .right{display:flex; align-items:center; gap:8px;}
.appbar .who{font-size:12px; opacity:.95; white-space:nowrap;}
.barbtn{background:rgba(255,255,255,.16); color:#fff; border:1px solid rgba(255,255,255,.28); border-radius:999px; font-size:12px; font-weight:600; padding:6px 12px; cursor:pointer; display:flex; align-items:center; gap:6px; white-space:nowrap;}
.barbtn:active{background:rgba(255,255,255,.28);}
.netpill{font-size:11px; font-weight:700; padding:6px 11px; border-radius:999px; border:none; display:flex; align-items:center; gap:5px; white-space:nowrap; cursor:pointer;}
.netpill.on{background:rgba(255,255,255,.2); color:#fff;}
.netpill.off{background:var(--amber-400); color:#3b2f10;}
.netpill.pending{background:#fff; color:var(--green-700);}
.installbar{background:var(--green-50); color:var(--green-700); font-size:12px; padding:8px 16px; display:flex; gap:10px; align-items:center; justify-content:space-between; border-bottom:1px solid var(--green-100); flex-shrink:0;}
.installbar .x{background:none; border:none; color:var(--green-700); cursor:pointer; padding:2px;}

/* main split */
.main{flex:1 1 auto; display:flex; min-height:0;}
.products{flex:1 1 auto; display:flex; flex-direction:column; min-width:0;}
.tools{display:flex; gap:8px; padding:12px 16px 8px; flex-wrap:wrap;}
.search{flex:1 1 240px; border:1px solid var(--stone-200); border-radius:12px; padding:12px 14px; font-size:16px; font-family:var(--sans); background:#fff; min-width:0;}
.search:focus{outline:none; border-color:var(--green-500);}
.chips{display:flex; gap:6px; flex-wrap:wrap;}
.chip{border:1px solid var(--stone-200); background:#fff; border-radius:999px; padding:9px 14px; font-size:13px; font-weight:600; color:var(--stone-600); cursor:pointer;}
.chip.on{background:var(--green-600); border-color:var(--green-600); color:#fff;}
.grid{flex:1 1 auto; overflow-y:auto; padding:4px 16px 24px; display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:10px; align-content:start;}
.tile{background:#fff; border:1px solid var(--stone-200); border-radius:14px; padding:12px; text-align:left; cursor:pointer; display:flex; flex-direction:column; gap:4px; min-height:112px; position:relative; -webkit-tap-highlight-color:transparent;}
.tile:active{background:var(--green-50); border-color:var(--green-500);}
.tile .nm{font-size:15px; font-weight:600; color:var(--stone-900); line-height:1.25;}
.tile .code{font-size:11px; color:var(--stone-400); font-family:var(--mono);}
.tile .foot{margin-top:auto; display:flex; justify-content:space-between; align-items:flex-end; gap:6px;}
.tile .price{font-size:17px; font-weight:700; color:var(--stone-900);}
.tile .stock{font-size:11px; font-weight:600; color:var(--green-700);}
.tile .stock.low{color:var(--amber-700);}
.tile .incart{position:absolute; top:8px; right:8px; background:var(--green-600); color:#fff; font-size:12px; font-weight:700; min-width:24px; height:24px; border-radius:12px; display:flex; align-items:center; justify-content:center; padding:0 6px;}
.empty{color:var(--stone-400); font-size:14px; padding:24px 4px;}

/* sale (cart) panel */
.cart{width:var(--cart-w); flex-shrink:0; background:#fff; border-left:1px solid var(--stone-200); display:flex; flex-direction:column; min-height:0;}
.cart .ch{display:flex; justify-content:space-between; align-items:center; padding:14px 16px; border-bottom:1px solid var(--stone-100);}
.cart .ch h2{margin:0; font-size:16px;}
.linkbtn{background:none; border:none; color:var(--green-700); font-size:13px; font-weight:600; cursor:pointer; padding:4px;}
.linkbtn.danger{color:var(--red-600);}
.lines{flex:1 1 auto; overflow-y:auto; padding:4px 16px;}
.line{display:flex; align-items:center; gap:10px; padding:10px 0; border-bottom:1px solid var(--stone-100);}
.line .info{flex:1; min-width:0;}
.line .nm{font-size:14px; font-weight:600; color:var(--stone-800); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.line .sub{font-size:12px; color:var(--stone-400);}
.line .amt{font-size:14px; font-weight:700; min-width:72px; text-align:right;}
.stepper{display:flex; align-items:center; border:1px solid var(--stone-200); border-radius:10px; overflow:hidden; flex-shrink:0;}
.stepper button{width:38px; height:38px; border:none; background:var(--stone-50); font-size:20px; cursor:pointer; color:var(--stone-600);}
.stepper button:active{background:var(--stone-200);}
.stepper .q{width:34px; text-align:center; font-size:15px; font-family:var(--mono);}
.cust{padding:10px 16px 0;}
.cust input{width:100%; border:1px solid var(--stone-200); border-radius:10px; padding:10px 12px; font-size:15px; font-family:var(--sans);}
.cust input:focus{outline:none; border-color:var(--green-500);}
.totals{padding:12px 16px; border-top:1px solid var(--stone-100);}
.totals .row{display:flex; justify-content:space-between; font-size:13px; color:var(--stone-500); padding:2px 0;}
.totals .grand{font-size:24px; font-weight:800; color:var(--stone-900);}
.pay{display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:0 16px calc(16px + env(safe-area-inset-bottom));}
.paybtn{border:none; border-radius:14px; padding:18px 10px; font-size:17px; font-weight:700; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:8px;}
.paybtn.cash{background:var(--green-600); color:#fff;}
.paybtn.card{background:var(--stone-800); color:#fff;}
.paybtn:active{filter:brightness(.92);}
.paybtn:disabled{background:var(--stone-200); color:var(--stone-400); cursor:default;}

/* phone / portrait: the sale becomes a bottom bar that opens as a sheet */
.paybar{display:none;}
@media (max-width: 820px){
  .cart{display:none;}
  .cart.open{display:flex; position:fixed; inset:auto 0 0 0; width:100%; height:86vh; height:86dvh; border-left:none; border-radius:18px 18px 0 0; z-index:21; box-shadow:0 -8px 30px rgba(0,0,0,.2);}
  .paybar{display:flex; align-items:center; justify-content:space-between; gap:10px; background:#fff; border-top:1px solid var(--stone-200); padding:10px 16px calc(10px + env(safe-area-inset-bottom)); flex-shrink:0;}
  .paybar .sum{font-size:13px; color:var(--stone-500);}
  .paybar .sum strong{display:block; font-size:20px; color:var(--stone-900);}
  .paybar button{background:var(--green-600); color:#fff; border:none; border-radius:12px; padding:14px 22px; font-size:16px; font-weight:700; cursor:pointer;}
  .paybar button:disabled{background:var(--stone-200); color:var(--stone-400);}
  .grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr));}
  .appbar .who{display:none;}
}

/* dialogs (tender, done, history) */
.backdrop{position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:20;}
.dialog{position:fixed; left:50%; top:50%; transform:translate(-50%,-50%); width:min(460px, calc(100vw - 24px)); max-height:calc(100dvh - 24px); overflow:auto; background:#fff; border-radius:18px; z-index:22; box-shadow:0 20px 60px rgba(0,0,0,.3);}
.dialog.wide{width:min(720px, calc(100vw - 24px));}
.dialog .dh{display:flex; justify-content:space-between; align-items:center; padding:16px 18px; border-bottom:1px solid var(--stone-100);}
.dialog .dh h3{margin:0; font-size:17px;}
.dialog .db{padding:18px;}
.dialog .df{padding:14px 18px; border-top:1px solid var(--stone-100); display:flex; gap:10px;}
.dialog .df button{flex:1;}
.due{text-align:center; margin-bottom:14px;}
.due .lbl{font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--stone-400); font-weight:700;}
.due .val{font-size:38px; font-weight:800; color:var(--stone-900);}
.cashin{width:100%; font-size:28px; font-weight:700; text-align:center; border:2px solid var(--stone-200); border-radius:12px; padding:12px; font-family:var(--sans);}
.cashin:focus{outline:none; border-color:var(--green-500);}
.quick{display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:12px 0;}
.quick button{border:1px solid var(--stone-200); background:var(--stone-50); border-radius:12px; padding:14px 6px; font-size:16px; font-weight:700; cursor:pointer; color:var(--stone-700);}
.quick button:active{background:var(--stone-200);}
.change{display:flex; justify-content:space-between; align-items:center; font-size:15px; padding:12px 14px; border-radius:12px; background:var(--stone-50);}
.change strong{font-size:22px;}
.change.ok{background:var(--green-50); color:var(--green-700);}
.change.short{background:var(--amber-50); color:var(--amber-700);}
.cardnote{display:flex; gap:12px; align-items:flex-start; background:var(--stone-50); border-radius:12px; padding:14px; font-size:14px; color:var(--stone-600);}
.btn{border:1px solid var(--stone-200); background:#fff; color:var(--stone-700); border-radius:12px; padding:14px; font-size:15px; font-weight:600; cursor:pointer;}
.btn.primary{background:var(--green-600); border-color:var(--green-600); color:#fff;}
.btn.primary:disabled{background:var(--stone-200); border-color:var(--stone-200); color:var(--stone-400); cursor:default;}
.btn:active{filter:brightness(.95);}
.done{text-align:center; padding:8px 0;}
.done .tick{width:64px; height:64px; border-radius:32px; background:var(--green-100); color:var(--green-700); display:flex; align-items:center; justify-content:center; margin:0 auto 12px;}
.done .big{font-size:30px; font-weight:800; color:var(--stone-900);}
.done .sub{font-size:14px; color:var(--stone-500); margin-top:4px;}
.warns{margin-top:12px; text-align:left; background:var(--amber-50); border:1px solid var(--amber-100); color:var(--amber-700); border-radius:10px; padding:10px 12px; font-size:13px;}
.warns div+div{margin-top:4px;}
.hist{width:100%; border-collapse:collapse; font-size:14px;}
.hist th{text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--stone-400); padding:6px 8px; border-bottom:1px solid var(--stone-200);}
.hist td{padding:9px 8px; border-bottom:1px solid var(--stone-100); vertical-align:top;}
.hist .num{text-align:right; white-space:nowrap;}
.hist .items{color:var(--stone-500); font-size:12px;}
.pend{display:inline-block; font-size:10px; font-weight:700; color:var(--amber-700); background:var(--amber-50); border:1px solid var(--amber-100); border-radius:6px; padding:1px 6px;}
.sumrow{display:flex; gap:10px; margin-bottom:14px; flex-wrap:wrap;}
.sumrow div{flex:1; min-width:120px; background:var(--stone-50); border-radius:12px; padding:10px 12px;}
.sumrow .l{font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--stone-400); font-weight:700;}
.sumrow .v{font-size:20px; font-weight:800;}

/* sign-in (same as the tech app) */
.authwrap{display:flex; align-items:center; justify-content:center; min-height:100vh; padding:24px; background:var(--stone-200);}
.authcard{width:100%; max-width:360px; background:#fff; border:1px solid var(--stone-200); border-radius:14px; padding:26px 22px;}
.authbrand{display:flex; align-items:center; justify-content:center; gap:10px; background:linear-gradient(180deg,#0aa074,var(--brand)); color:#fff; border-radius:12px; padding:14px; margin-bottom:16px; font-size:18px; font-weight:600;}
.authbrand img{height:30px; width:auto;}
.authcard h1{font-size:18px; margin:0 0 16px; text-align:center; color:var(--stone-900);}
.field{display:flex; flex-direction:column; gap:6px; margin-bottom:12px;}
.field label{font-size:12px; color:var(--stone-500); font-weight:600;}
.field input{border:1px solid var(--stone-200); border-radius:10px; padding:11px 12px; font-size:16px; font-family:var(--sans);}
.field input:focus{outline:none; border-color:var(--green-500);}
.autherr{background:var(--red-50); border:1px solid var(--red-100); color:var(--red-700); font-size:12px; border-radius:8px; padding:8px 10px; margin-bottom:12px;}
.authok{background:var(--green-50); border:1px solid var(--green-100); color:var(--green-700); font-size:13px; border-radius:8px; padding:9px 11px; margin-bottom:12px;}
.forgotlink{display:block; margin:12px auto 0; background:none; border:none; color:var(--green-700); font-size:14px; text-decoration:underline; cursor:pointer; padding:6px;}
.pwwrap{position:relative; display:block;}
.pwwrap input{width:100%; padding-right:44px;}
.pweye{position:absolute; right:4px; top:50%; transform:translateY(-50%); background:none; border:none; padding:8px; cursor:pointer; color:var(--stone-400); display:flex; align-items:center;}

#toast{position:fixed; bottom:calc(18px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); background:var(--stone-900); color:#fff; padding:10px 16px; border-radius:10px; font-size:13px; opacity:0; transition:opacity .2s; pointer-events:none; z-index:50; max-width:90%;}
#toast.show{opacity:.96;}

/* narrow screens: top-bar buttons go icon-only so the brand keeps its room */
@media (max-width: 600px){
  .appbar .lbl{display:none;}
  .barbtn{padding:7px 9px;}
  .netpill{padding:6px 8px;}
  .appbar .right{gap:6px;}
}

/* receipts: preview in a dialog, and print only the receipt */
.rcpt-actions{margin-top:14px; display:flex; flex-direction:column; gap:10px; text-align:left;}
.rcpt-actions .rowbtns{display:flex; gap:10px;}
.rcpt-actions .rowbtns > *{flex:1;}
.rcpt-actions .paper{display:flex; align-items:center; gap:8px; font-size:12px; color:var(--stone-500);}
.rcpt-actions .paper button{border:1px solid var(--stone-200); background:#fff; border-radius:999px; padding:5px 11px; font-size:12px; font-weight:600; color:var(--stone-600); cursor:pointer;}
.rcpt-actions .paper button.on{background:var(--green-50); border-color:var(--green-500); color:var(--green-700);}
.emailrow{display:flex; gap:8px;}
.emailrow input{flex:1; min-width:0; border:1px solid var(--stone-200); border-radius:12px; padding:12px; font-size:15px; font-family:var(--sans);}
.emailrow input:focus{outline:none; border-color:var(--green-500);}
.emailrow .btn{padding:12px 16px;}
.rcpt-note{font-size:12px; color:var(--stone-500);}
.rcpt-note.ok{color:var(--green-700);}
.rcpt-preview{border:1px solid var(--stone-200); border-radius:12px; padding:16px 12px; background:#fff; max-height:46vh; overflow:auto;}
.hist tbody tr{cursor:pointer;}
.hist tbody tr:hover td{background:var(--stone-50);}
.taxhint{font-size:12px; color:var(--amber-700); margin-top:6px;}
#printarea{display:none;}
@media print{
  html,body{height:auto; background:#fff !important;}
  body > *:not(#printarea){display:none !important;}
  #printarea{display:block;}
}

.whsel{border:1px solid var(--stone-200, #d8dee1); border-radius:10px; padding:0 10px; font:inherit; font-size:14px; background:#fff; margin-right:8px; height:44px;}
