:root {
  --navy: #0f2a3d; --navy-2: #173d57; --teal: #1fb5a8; --teal-d: #138f84; --bg: #f4f6f8; --card: #fff; --line: #dde3e8;
  --ink: #1b2730; --muted: #6b7a86; --warn: #e8890c; --danger: #d64545; --ok: #2a9d5c; --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 42, 61, .08), 0 4px 16px rgba(15, 42, 61, .06);
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { display: flex; flex-direction: column; -webkit-tap-highlight-color: transparent; }
a { color: var(--teal-d); }
small { color: var(--muted); }
.muted { color: var(--muted); font-size: .9em; }
.grow { flex: 1; }
.r { text-align: right; }
.empty { color: var(--muted); text-align: center; padding: 28px 12px; }
.pre { white-space: pre-wrap; }

/* top bar */
#topbar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--navy); color: #fff; min-height: 54px; }
#topbar .brand { flex: 1; font-weight: 700; line-height: 1.15; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#topbar .brand small { display: block; font-weight: 400; color: #a9c0cf; }
#topbar .icon { color: #fff; font-size: 20px; }
.status { font-size: 12px; padding: 3px 8px; border-radius: 99px; }
.status.on { background: rgba(42, 157, 92, .25); color: #9be5bb; }
.status.off { background: rgba(255, 255, 255, .12); color: #ccd; }
.sync { border: 0; border-radius: 99px; padding: 8px 14px; font-weight: 600; color: #fff; cursor: pointer; font-size: 14px; }
.sync b { background: #fff; color: var(--warn); border-radius: 99px; padding: 0 7px; margin-left: 4px; }
.sync.clean { background: var(--ok); } .sync.pending { background: var(--warn); } .sync.offline { background: #6b7a86; }
.sync.spin { opacity: .7; pointer-events: none; }

#view { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 9px 14px; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 40px; }
.btn:hover { border-color: #b8c4cd; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; } .btn.primary:hover { background: var(--teal-d); }
.btn.danger { color: var(--danger); border-color: #f0c6c6; }
.btn.big { padding: 12px 22px; font-size: 16px; min-height: 48px; }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.btn.wide { width: 100%; }
.icon { background: none; border: 0; font-size: 18px; cursor: pointer; padding: 6px 8px; color: var(--muted); border-radius: 6px; }
.chip { border: 1px solid var(--line); background: #f0f4f7; border-radius: 6px; padding: 0 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; background: #fff; min-height: 40px; width: 100%; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(31, 181, 168, .35); border-color: var(--teal); }
input[readonly] { background: #f3f5f7; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg button, .seg label span { border: 0; background: none; padding: 9px 14px; font-weight: 600; cursor: pointer; color: var(--muted); display: block; font-size: 14px; }
.seg button.on, .seg label input:checked + span { background: var(--navy); color: #fff; }
.seg label { margin: 0; } .seg label input { display: none; }
.seg.small button { padding: 5px 10px; font-size: 13px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: #e5edf2; color: var(--navy-2); vertical-align: middle; }
.pill.danger { background: #fde8e8; color: var(--danger); } .pill.warn { background: #fff1dd; color: #a85f00; } .pill.ok { background: #e3f5ea; color: var(--ok); }
.promo { color: var(--danger); font-weight: 700; font-size: .85em; }
.req { color: var(--danger); font-size: 12px; font-weight: 700; }

/* forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: #3b4a55; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--ink); }
label.check input { width: 20px; height: 20px; min-height: 0; flex: none; }
.form fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 0; }
.form legend { font-size: 13px; font-weight: 600; color: #3b4a55; padding: 0 4px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.inline { display: flex; gap: 8px; align-items: center; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.btn-row { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.err { color: var(--danger); min-height: 1em; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin-bottom: 12px; }
.kv span { color: var(--muted); font-size: 13px; } .kv b { font-weight: 500; }
.thumb { max-height: 90px; border-radius: 6px; border: 1px solid var(--line); }

/* modal & toast */
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 42, 61, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 12px; }
.modal { background: #fff; border-radius: 14px; width: min(520px, 100%); max-height: calc(100vh - 24px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal.wide { width: min(820px, 100%); } .modal.full { width: min(1100px, 100%); height: calc(100vh - 24px); }
.modal header { display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal header h2 { flex: 1; margin: 0; font-size: 18px; }
.modal-body { padding: 16px; overflow: auto; }
.confirm-msg { font-size: 16px; line-height: 1.45; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 14px; cursor: pointer; font-size: 15px; }
.choice:hover { border-color: var(--teal); background: #f2fbfa; }
.choice small { display: block; margin-top: 2px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); opacity: 0; transition: .25s; background: var(--navy); color: #fff;
  padding: 12px 18px; border-radius: 10px; z-index: 99; max-width: 90vw; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.ok { background: var(--ok); } .toast.err { background: var(--danger); } .toast.warn { background: #a85f00; }

/* login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, var(--navy), #1f5170); }
.login .card { background: #fff; border-radius: 16px; padding: 28px; width: min(380px, 100%); box-shadow: var(--shadow); }
.login h1 { margin: 0; color: var(--navy); }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.toolbar .title { flex: 1 1 100%; font-size: 15px; }
.toolbar .tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; }
.toolbar select { width: auto; max-width: 220px; }
.search { display: flex; gap: 0; flex: 1; min-width: 200px; }
.search input { border-radius: 8px 0 0 8px; } .search .chip { border-radius: 0 8px 8px 0; border-left: 0; }

/* store select */
.days { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); }
.days button { flex: none; border: 1px solid var(--line); background: #fff; border-radius: 10px; width: 56px; padding: 6px 0; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.days button b { font-size: 18px; } .days button i { font-style: normal; font-size: 11px; color: var(--teal-d); min-height: 14px; }
.days button.on { background: var(--navy); color: #fff; border-color: var(--navy); } .days button.on small, .days button.on i { color: #bcd; }
.banner { margin: 10px 12px 0; padding: 10px 12px; background: #fff7e8; border: 1px solid #f3d9a6; border-radius: 8px; }
.custlist, .list { list-style: none; margin: 0; padding: 8px 12px 100px; display: flex; flex-direction: column; gap: 6px; }
.custlist li, .list li { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; gap: 12px; align-items: center; cursor: pointer; }
.custlist li > div:first-child, .list li > b { flex: 1; }
.custlist li small, .list li small { display: block; margin-top: 2px; }
.list li { flex-wrap: wrap; } .list li small { flex-basis: 100%; }
.custlist li.sel { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(31, 181, 168, .25); }
.custlist li.done, .list li.done { opacity: .55; background: #f1f3f5; }
.custlist .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 13px; color: var(--muted); }
.tick { color: var(--ok); font-weight: 700; }
.selbar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; align-items: center; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -4px 20px rgba(0, 0, 0, .06); z-index: 10; }
.selbar div { flex: 1; } .selbar small { display: block; }
body.left .selbar { flex-direction: row-reverse; text-align: right; }

/* store call */
.store-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.store-head h2 { margin: 0; font-size: 20px; } .store-head > div { flex: 1; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; padding: 12px 12px 110px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.panel h3 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel h4 { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.tasks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.tasks li { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.tasks li div { flex: 1; } .tasks li small { display: block; }
.tasks .box { width: 24px; height: 24px; border-radius: 6px; border: 2px solid #b8c4cd; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; flex: none; }
.tasks li.done .box { background: var(--ok); border-color: var(--ok); }
.tasks li.comp { border-color: #f0b7b7; background: #fff8f8; }
.mini { list-style: none; margin: 0; padding: 0; } .mini li { padding: 8px 4px; border-bottom: 1px solid #eef1f3; display: flex; gap: 8px; align-items: center; cursor: pointer; flex-wrap: wrap; }
.mini li:last-child { border-bottom: 0; }
.contacts li.primary b { font-weight: 800; }
.storemenu { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--navy); padding-bottom: env(safe-area-inset-bottom); z-index: 10; overflow-x: auto; }
.storemenu button { flex: 1; min-width: 76px; background: none; border: 0; color: #fff; padding: 10px 4px; font-size: 20px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.storemenu button span { font-size: 12px; color: #bcd; } .storemenu button:hover { background: var(--navy-2); }
.storemenu .exit { background: #8e2f2f; } body.left .storemenu { flex-direction: row-reverse; }

/* pages */
.page { padding: 12px 12px 100px; max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 19px; flex: 1; }
.page-head input { width: auto; flex: 1; min-width: 200px; }
.page .panel { margin-bottom: 10px; }
.inlineform { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.inlineform label { flex: 1; min-width: 140px; }
.note .note-head { margin-bottom: 6px; }

/* tables */
.grid { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; }
.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: 8px; border-bottom: 2px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.grid td { padding: 8px; border-bottom: 1px solid #eef1f3; vertical-align: middle; }
.grid tr.tap { cursor: pointer; } .grid tr.tap:hover td { background: #f6fafb; }
.grid th.r, .grid td.r { text-align: right; }
.scroll { max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.grid.merch input, .grid.merch select { min-width: 80px; }

/* sale */
.sale, .subtotal { display: flex; flex-direction: column; min-height: 100%; }
.products { flex: 1; padding: 0 0 80px; }
.products.list .grid td.code { font-family: ui-monospace, monospace; font-size: 13px; color: var(--muted); }
.products.list .grid td.desc a { color: var(--ink); text-decoration: none; font-weight: 500; }
.products.list .grid td.prev { font-size: 12px; color: var(--muted); line-height: 1.2; }
.products.list .grid tr.has td { background: #effaf8; }
.qty { width: 84px; text-align: right; font-weight: 700; }
.products.image { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card), 1fr)); gap: 10px; padding: 12px 12px 90px; }
.card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.card img, .card .ph { width: 100%; aspect-ratio: 1; object-fit: cover; background: linear-gradient(135deg, #dfe9ef, #c7d8e2); display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; color: #7d97a8; }
.card .cap { padding: 8px; font-size: 13px; } .card .cap small { display: block; }
.card .badge { position: absolute; top: 6px; right: 6px; background: var(--danger); color: #fff; border-radius: 99px; min-width: 28px; height: 28px; padding: 0 6px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; }
.zoom { position: fixed; bottom: 70px; right: 16px; background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 6px 14px; display: flex; gap: 8px; align-items: center; box-shadow: var(--shadow); z-index: 6; }
.zoom input { width: 140px; min-height: 0; padding: 0; }
.sale-foot { position: fixed; bottom: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); z-index: 6; }
.sale-foot div { flex: 1; } body.left .sale-foot { flex-direction: row-reverse; }
.cols2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; padding: 12px; }
@media (max-width: 760px) { .cols2 { grid-template-columns: 1fr; } }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; justify-items: end; padding: 12px 8px; background: #fff; }
.totals span { color: var(--muted); } .totals .big { font-size: 20px; }
.sign { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; align-self: start; }
.sign label { font-size: 13px; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.sigpad { width: 100%; height: 160px; border: 1px dashed #9fb0bc; border-radius: 8px; background: #fcfdfd; touch-action: none; }
.note-box { background: #fff; padding: 10px; border-left: 3px solid var(--teal); }
details.margin { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
details.margin summary { cursor: pointer; font-weight: 600; }
details.margin .out { grid-column: 1 / -1; background: #f3f8f9; border-radius: 6px; padding: 8px; }
.scanlist { list-style: none; padding: 0; } .scanlist li { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #eef1f3; }
.scanlist input { width: 90px; } #bcv { width: 100%; max-height: 240px; border-radius: 8px; background: #000; }

/* product images */
.detail-top { display: flex; gap: 16px; align-items: flex-start; } .detail-top .kv { flex: 1; }
.packshot { width: 140px; height: 140px; border-radius: 10px; border: 1px solid var(--line); flex: none; }
.thumbcell { width: 52px; } .thumbcell img { width: 44px; height: 44px; border-radius: 6px; display: block; }
@media (max-width: 600px) { .packshot { width: 96px; height: 96px; } }

/* surveys */
.survey .q { border-bottom: 1px solid #eef1f3; padding-bottom: 12px; } .survey .q p { margin: 0 0 8px; }
.instruction { background: #eef6fb; border-left: 3px solid var(--navy-2); padding: 10px 12px; border-radius: 6px; }
.stars { display: flex; gap: 4px; } .stars label { cursor: pointer; } .stars input { display: none; }
.stars span { font-size: 34px; color: #cfd8de; } .stars label.on span { color: #f5b301; }

#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; font-family: system-ui, sans-serif; }
  #print-area table { width: 100%; border-collapse: collapse; } #print-area td, #print-area th { border-bottom: 1px solid #ccc; padding: 4px; text-align: left; }
}
@media (max-width: 600px) {
  .toolbar select { max-width: 48%; }
  .products.list .grid .prev { display: none; }
  .storemenu button span { font-size: 10px; }
}

/* touch screens: 16px inputs stop iOS zooming the page on focus */
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } }
.center { text-align: center; }

/* landing dashboard */
.dash { padding: 16px 20px 40px; max-width: 1400px; margin: 0 auto; }
.dash-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.dash-head h1 { margin: 0; font-size: 22px; color: var(--navy); }
.dash h2 { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 20px; align-items: start; }
.widgets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.widget { --tone: var(--teal); background: #fff; border: 0; border-top: 5px solid var(--tone); border-radius: 6px; box-shadow: var(--shadow); padding: 18px 10px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; min-height: 118px; font: inherit; color: var(--ink); }
.widget:hover { box-shadow: 0 0 0 2px var(--tone), var(--shadow); } .widget:active { transform: scale(.98); }
.widget .wv { display: flex; align-items: center; gap: 8px; }
.widget svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.widget b { font-size: 34px; font-weight: 800; line-height: 1; }
.widget .wl { font-size: 15px; text-align: center; }
.widget small { font-size: 12px; }
.tone-blue { --tone: #1aa3b5; } .tone-green { --tone: #2bb38a; } .tone-red { --tone: #e04b5a; } .tone-amber { --tone: #f2c12e; }
.dpanel { background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: 14px; margin-bottom: 16px; }
.dpanel h3 { margin: 0 0 10px; font-size: 16px; font-weight: 600; } .dpanel h3 small { font-weight: 400; margin-left: 6px; }
.budget-wrap { overflow: auto; max-height: 440px; border: 1px solid var(--line); border-radius: 4px; }
.grid.budget th, .grid.msgs th { background: #f0f2f4; position: static; white-space: nowrap; }
.grid.budget th[data-sort] { cursor: pointer; } .grid.budget th.sorted { color: var(--navy); }
.grid.budget th.super { text-align: center; border-bottom: 1px solid var(--line); }
.grid.budget td.num { color: #1f6fb5; } .grid.budget td.good { color: var(--ok); font-weight: 700; }
.grid.budget tr.me td { background: #effaf8; font-weight: 600; }
.grid.budget td:nth-child(2) { white-space: nowrap; }
.grid.budget tfoot td { font-weight: 700; border-top: 2px solid var(--line); background: #fafbfc; }
.grid.msgs td.clip { max-width: 0; width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
@media (max-width: 899px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } .widgets { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .dash { padding: 12px; } .widgets { grid-template-columns: repeat(2, 1fr); } .widget b { font-size: 28px; } }

/* dashboard drill-downs */
.wide-page { max-width: 1300px; }
.table-card { background: #fff; border-radius: 8px; box-shadow: var(--shadow); overflow: auto; }
.table-card .grid td small { display: block; }
.grid td.late { color: var(--danger); font-weight: 700; }
.pill.st-pending { background: #e2f1fb; color: #1d6fa5; } .pill.st-awaiting { background: #fff1dd; color: #a85f00; }
.pill.st-backorder { background: #f0e8fb; color: #6b3fa0; } .pill.st-ready { background: #e3f5ea; color: var(--ok); }
.pill.st-shipping { background: #dff5f3; color: var(--teal-d); } .pill.st-closed { background: #eceff1; color: var(--muted); }
.list.pick { padding: 10px 0 0; max-height: 60vh; overflow: auto; }

/* order entry (iPad layout) */
#view[data-view="sale"] { overflow: hidden; }
.sale2 { display: flex; flex-direction: column; height: 100%; }
.sale-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.sale-head .who { flex: 1; min-width: 0; } .sale-head .who b { font-size: 17px; } .sale-head .who small { display: block; margin-top: 2px; }
.sale-tools { display: flex; gap: 8px; align-items: center; padding: 8px 14px 4px; background: #fff; flex-wrap: wrap; }
.sale-tools .search { min-width: 240px; }
.zoomer { width: 130px; min-height: 0; padding: 0; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 6px 14px 10px; background: #fff; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); background: #f4f6f8; border-radius: 99px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; min-height: 40px; }
.chips button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.sale-body { flex: 1; min-height: 0; display: flex; position: relative; }
.sale2 .products { flex: 1; overflow: auto; padding: 0 0 24px; -webkit-overflow-scrolling: touch; }
.sale2 .products.image { padding: 12px; align-content: start; }
.sale2 .grid td { padding: 6px 8px; }
.sale2 .grid td.desc { min-width: 180px; } .sale2 .grid td.desc a { color: var(--ink); text-decoration: none; font-weight: 600; }
.sale2 .grid td.desc small { display: block; font-family: ui-monospace, monospace; font-size: 12px; }
.sale2 .grid tr.has td { background: #effaf8; }
.sale2 .grid td.prev { font-size: 12px; color: var(--muted); line-height: 1.2; white-space: nowrap; }
.sale2 .thumbcell { cursor: pointer; }
.qtycell { width: 168px; white-space: nowrap; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper button { width: 44px; height: 44px; border: 0; background: #f0f4f7; font-size: 22px; font-weight: 700; color: var(--navy); cursor: pointer; flex: none; touch-action: manipulation; }
.stepper button:active { background: #d6e4ec; }
.stepper input.qty { width: 66px; border: 0; border-radius: 0; text-align: center; min-height: 44px; padding: 0 4px; font-weight: 800; }
.stepper input.qty:focus { outline: 0; background: #f2fbfa; }
.stepper span { min-width: 40px; text-align: center; font-weight: 800; }
.sale2 .card .stepper { display: flex; justify-content: space-between; margin: 0 8px 8px; }
.sale2 .card.has { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.cart { width: 360px; flex: none; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.cart-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cart-lines { list-style: none; margin: 0; padding: 0; flex: 1; overflow: auto; }
.cart-lines li { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 10px 14px; border-bottom: 1px solid #eef1f3; align-items: center; }
.cart-lines li.empty { display: block; }
.cl-main { grid-column: 1 / -1; cursor: pointer; } .cl-main small { display: block; }
.cart-lines .stepper button { width: 40px; height: 40px; }
.cart-lines .stepper { justify-self: start; }
.stepper input.qty::-webkit-inner-spin-button, .stepper input.qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper input.qty { -moz-appearance: textfield; appearance: textfield; }
.cl-tot { text-align: right; }
.cart .totals { border-top: 1px solid var(--line); }
.cart-actions { display: flex; gap: 8px; padding: 12px 14px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.cart-actions .primary { flex: 1; }
.sale2 .sale-foot { position: static; }
#closecart { display: none; }
@media (min-width: 1000px) { .sale2 .sale-foot { display: none; } }
@media (max-width: 999px) {
  .cart { position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 92vw); box-shadow: -8px 0 30px rgba(0, 0, 0, .15); transform: translateX(105%); transition: transform .2s; z-index: 8; }
  .cart-open .cart { transform: none; } #closecart { display: inline-block; }
}
/* previous-sales columns that fit: iPad Pro landscape 3, iPad landscape 1, iPad portrait 2, phone none */
@media (max-width: 1299px) { .sale2 .prev.p3 { display: none; } }
@media (min-width: 1000px) and (max-width: 1199px) { .sale2 .prev.p2 { display: none; } }
@media (max-width: 767px) { .sale2 .prev.p2 { display: none; } }
@media (max-width: 640px) { .sale2 .prev { display: none; } .qtycell { width: auto; } .stepper input.qty { width: 48px; } .sale-head .btn { padding: 8px 10px; } }
.sale2 .prev.p4, .sale2 .prev.p5, .sale2 .prev.p6 { display: none; }
@media (min-width: 1000px) { .subtotal .sigpad { height: 200px; } }

/* phones: product cards, the order in a bottom sheet, compact dashboard and card-style drill-downs */
.sale2 .grid td.desc .last, .phone-only { display: none; }
@media (max-width: 640px) {
  .sale-head { padding: 8px 12px; } .sale-head .who b { font-size: 15px; } .sale-head .who small { font-size: 12px; }
  .sale-tools { padding: 8px 12px 4px; } .sale-tools .search { flex: 1 1 100%; min-width: 0; }
  .chips { padding: 6px 12px 8px; } .chips button { min-height: 36px; padding: 6px 12px; }
  .sale2 .grid, .sale2 .grid tbody { display: block; } .sale2 .grid thead { display: none; }
  .sale2 .grid tr { display: grid; grid-template-columns: 44px auto auto 1fr; grid-template-areas: "thumb desc desc desc" "thumb price soh qty";
    gap: 4px 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #eef1f3; }
  .sale2 .grid tr.has { background: #effaf8; } .sale2 .grid tr.has td { background: none; }
  .sale2 .grid td { padding: 0; border: 0; } .sale2 .grid td.empty { grid-column: 1 / -1; padding: 20px 0; }
  .sale2 .thumbcell { grid-area: thumb; align-self: start; width: 44px; }
  .sale2 .grid td.desc { grid-area: desc; min-width: 0; } .sale2 .grid td.desc small { display: inline; margin-left: 6px; }
  .sale2 .grid td.desc .last { display: block; font-size: 12px; color: var(--muted); }
  .sale2 .grid td.price { grid-area: price; text-align: left; font-weight: 600; }
  .sale2 .grid td.soh { grid-area: soh; text-align: left; font-size: 13px; } .sale2 .grid td.soh::before { content: 'SOH '; color: var(--muted); }
  .sale2 .grid td.qtycell { grid-area: qty; justify-self: end; }
  .sale2 .sale-foot { padding: 8px 12px; padding-bottom: max(8px, env(safe-area-inset-bottom)); gap: 8px; } .sale-foot .units { display: none; }
  .cart { position: fixed; top: auto; left: 0; right: 0; bottom: 0; width: auto; height: 88%; height: 88dvh; border-left: 0; border-radius: 16px 16px 0 0;
    transform: translateY(105%); box-shadow: 0 -8px 30px rgba(0, 0, 0, .2); z-index: 40; }
  .cart-open .sale-body::after { content: ''; position: fixed; inset: 0; background: rgba(15, 42, 61, .45); z-index: 39; }
  .cart-head::before { content: ''; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #cfd8de; }
  .cart-head { position: relative; padding-top: 16px; }

  .phone-only { display: block; margin-top: 8px; width: 100%; }
  .dash-head h1 { font-size: 19px; } .dash-head .btn.big { padding: 10px 14px; }
  .widget { padding: 12px 6px 10px; } .widget .wl { font-size: 13px; }
  .budget-wrap.mine:not(.all) tbody tr:not(.me) { display: none; }
  .grid.budget thead tr:first-child, .grid.budget tr > :first-child { display: none; }
  .grid.budget th, .grid.budget td { padding: 8px 6px; font-size: 13px; } .grid.budget th { white-space: normal; font-size: 11px; }
  .grid.msgs th:nth-child(2), .grid.msgs td.clip { display: none; }

  .grid.cardrows, .grid.cardrows tbody { display: block; } .grid.cardrows thead { display: none; }
  .grid.cardrows tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px 10px; padding: 12px; border-bottom: 1px solid var(--line); }
  .grid.cardrows td { padding: 0; border: 0; text-align: left; min-width: 0; }
  .grid.cardrows td::before { content: attr(data-l); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
  .grid.cardrows td.main { grid-column: 1 / -1; order: -1; } .grid.cardrows td.main::before, .grid.cardrows td.empty::before { display: none; }
  .grid.cardrows td.empty { grid-column: 1 / -1; }
}

.login .legal { text-align: center; margin: 14px 0 0; font-size: 13px; }

/* rep's own sales reports (Enhanced reporting): phone one column, tablet two; 44px touch targets */
.myreports { padding: 12px 16px 40px; max-width: 1200px; margin: 0 auto; }
.myreports .page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; } .myreports .page-head h2 { margin: 0; }
.my-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; } .my-grid .col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 768px) { .my-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); } }
.myreports .card, .dash .pace { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.myreports .card h3 { margin: 0 0 10px; font-size: 16px; color: var(--navy); } .myreports .card h3 small { font-weight: 400; font-size: 12px; }
.dash .pace { margin-bottom: 16px; }
.pace-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.pace-top small { display: block; } .pace-top b { font-size: 28px; color: var(--navy); line-height: 1.15; }
.pace-pct { text-align: right; } .pace-pct b { font-size: 24px; color: var(--teal-d); }
.warn-txt { color: var(--warn) !important; font-weight: 600; }
.pace .meter { position: relative; height: 10px; background: #e6ecf0; border-radius: 99px; margin: 12px 0 10px; }
.pace .meter i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.pace .meter em { position: absolute; top: -4px; bottom: -4px; width: 3px; background: var(--navy); border-radius: 2px; }
.pace-chips { display: flex; flex-wrap: wrap; gap: 6px 8px; font-size: 13px; }
.pace-chips span { background: #f1f4f6; border-radius: 99px; padding: 5px 10px; }
.pace-chips .good { background: #e3f5ea; color: var(--ok); font-weight: 600; } .pace-chips .bad { background: #fdeaea; color: var(--danger); font-weight: 600; }
.pace .btn.wide { margin-top: 12px; min-height: 44px; }
.chg { white-space: nowrap; font-weight: 600; font-size: 13px; } .chg.up { color: var(--ok); } .chg.down { color: var(--danger); }
.mylist { list-style: none; margin: 0; padding: 0; }
.mylist li { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 0; border-bottom: 1px solid #eef1f3; }
.mylist li:last-child { border-bottom: 0; } .mylist li.tap { cursor: pointer; } .mylist li.tap:active { background: #f2fbfa; }
.mylist li .grow { min-width: 0; } .mylist li b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mylist li small { display: block; color: var(--muted); font-size: 12px; } .mylist .num { text-align: right; white-space: nowrap; }
.mylist .btn { min-height: 44px; min-width: 76px; flex: none; }
.mychart { width: 100%; height: auto; display: block; } .mychart text { font-size: 12px; fill: var(--muted); } .mychart .grid { stroke: #e6ecf0; }
.mychart .cum-line { fill: none; stroke: var(--teal); stroke-width: 3; } .mychart .pace-line { fill: none; stroke: var(--navy); stroke-width: 2; stroke-dasharray: 6 5; }
.mychart .day { fill: #c9e9e6; }
.myreports .legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.myreports .legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.myreports .legend i.cum { background: var(--teal); } .myreports .legend i.pace { background: var(--navy); } .myreports .legend i.day { background: #c9e9e6; height: 10px; }
@media (max-width: 420px) { .pace-top b { font-size: 24px; } .pace-pct b { font-size: 20px; } .myreports { padding: 10px 12px 32px; } }
