/* What the app adds to the design system (ambar.css): only what a page drawn
   in the browser needs and ambar-paas got from its server or Tom Select. Tokens only. */
.pickwrap { position: relative; }
.pickwrap > .menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: var(--z-menu); max-height: 300px; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); box-shadow: var(--shadow-2); padding: 4px; }
.pickwrap > .menu button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: 6px; background: none; border: 0; color: inherit; font: inherit; cursor: pointer; }
.pickwrap > .menu button:hover, .pickwrap > .menu button.on { background: var(--sunken); }
.pickwrap > .menu small { display: block; color: var(--ink-3); }
[data-party-hit][hidden] { display: none; }
.posapp { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; max-width: var(--page); }
.posapp .scanbox { font-size: 18px; height: 52px; }
.posapp .modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.posapp .modes .btn { height: 48px; justify-content: center; }
.posapp .totals { width: 100%; margin: 0; }
.queued { background: var(--warn-soft); color: var(--warn); }
@media (max-width: 860px) { .posapp { grid-template-columns: 1fr; } }
@media print {
  .side, .mbar, .formbar, .keys, .listbar, .history, .pagehead .row, .scanline { display: none !important; }
  .main { padding: 0 !important; }
}
.pager:empty { display: none; }
/* the side menu's head stays at the top as the menu scrolls, as its account card stays at the bottom (.side .me) */
.side .side-head { position: sticky; top: -22px; z-index: 2; margin: -22px -12px 0; padding: 22px 12px 12px; background: var(--side-bg);
  border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; }
#sidenav { display: contents; }

/* the apps' shell: a counter form takes the width (ambar.css keeps phone apps at 640px) */
.mobile.mobile .m-main:has(form.layout-counter) { max-width: 1480px; }
.m-bar select#store { width: auto; max-width: 240px; }

/* a counter form (screen layout "counter"): the bill wide on the left with the scan line first;
   the customer, then the total and the payment, beside it */
form.layout-counter > .screen { max-width: none; grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
form.layout-counter > .screen > .sarea-lines { grid-column: 1; grid-row: 1 / span 2; }
form.layout-counter > .screen > .sarea-header { grid-column: 2; grid-row: 1; grid-template-columns: 1fr; }
form.layout-counter > .screen > .sarea-totals { grid-column: 2; grid-row: 2; position: static; justify-items: stretch; }
form.layout-counter > .screen > .sarea-totals > * { width: 100%; }
form.layout-counter [data-lines] { display: flex; flex-direction: column; min-height: 420px; }
form.layout-counter [data-lines] .scanline { order: -1; border-top: 0; border-bottom: 1px solid var(--line); padding: 14px; }
form.layout-counter [data-scan] { height: 52px; font-size: 18px; flex: 1; min-width: 0; }
form.layout-counter [data-scan-note], form.layout-counter [data-scanned] { display: none; }
@media (max-width: 900px) {
  form.layout-counter > .screen { grid-template-columns: 1fr; }
  form.layout-counter > .screen > .sarea-lines, form.layout-counter > .screen > .sarea-header, form.layout-counter > .screen > .sarea-totals { grid-column: 1; grid-row: auto; }
}

/* a line grid as tiles (props.view "tiles"): each line a card with its photo */
.table.lines-tiles thead, .table.lines-tiles tfoot, .table.lines-tiles tr[data-empty] { display: none; }
.table.lines-tiles tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; padding: 14px; }
.table.lines-tiles tbody tr { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; padding: 0 0 12px; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); position: relative; }
.table.lines-tiles td { padding: 0 12px; border: 0; }
.table.lines-tiles td:first-child, .table.lines-tiles td:has(input[name="qty"]) { display: none; }
.table.lines-tiles td.tile-photo { grid-column: 1 / -1; padding: 0; margin-bottom: 6px; aspect-ratio: 4 / 5; background: var(--sunken); display: grid; place-items: center; }
.table.lines-tiles td.tile-photo img { width: 100%; height: 100%; object-fit: cover; }
.table.lines-tiles td.tile-photo span { font-size: 30px; font-weight: 700; color: var(--ink-3); }
.table.lines-tiles td:has(input[name="item"]), .table.lines-tiles td:has(input[name="lot"]), .table.lines-tiles td[data-amount] { grid-column: 1 / -1; }
.table.lines-tiles input[name="item"], .table.lines-tiles input[name="lot"] { border: 0; background: none; padding: 0; height: auto; box-shadow: none; }
.table.lines-tiles input[name="item"] { font-weight: 600; }
.table.lines-tiles input[name="lot"] { color: var(--ink-3); font-size: 12.5px; }
.table.lines-tiles td:has([data-rate])::before { content: "Rate"; } .table.lines-tiles td:has([data-disc])::before { content: "Disc %"; }
.table.lines-tiles td:has([data-rate])::before, .table.lines-tiles td:has([data-disc])::before { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
.table.lines-tiles td[data-amount] { text-align: left; font-size: 18px; font-weight: 700; padding-top: 4px; }
.table.lines-tiles td:last-child { position: absolute; top: 6px; right: 0; padding: 0 6px; }
.table.lines-tiles td:last-child .btn { background: color-mix(in srgb, var(--surface) 85%, transparent); }
.tiles-empty { flex: 1; padding: 60px 16px; text-align: center; display: flex; gap: 8px; justify-content: center; align-items: center; }

/* payment on a counter (tender props.buttons): a button per mode; a mode shows its box once it has money in it */
.paybtns { display: flex; flex-wrap: wrap; gap: 8px; }
.paybtns .btn { flex: 1 1 96px; justify-content: center; white-space: nowrap; height: 48px; min-height: 48px; }
[data-buttons] .tender-row:has(input:placeholder-shown) { display: none; }
/* a tile's boxes are boxes: bordered, full width */
.table.lines-tiles td .input[data-rate], .table.lines-tiles td .input[data-off-in] { height: 38px; width: 100%; min-width: 0; border: 1px solid var(--line-2); background: var(--sunken); border-radius: 8px; padding: 0 10px; text-align: right; }
.table.lines-tiles td:has([data-off])::before { content: "Discount"; display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 2px; }
/* the discount box: the amount, and a switch between % and ₹ */
.offbox { display: flex; gap: 4px; align-items: center; }
.offbox .input { flex: 1; min-width: 0; }
.offbox [data-off-kind] { flex: none; width: 34px; justify-content: center; padding: 0; }
.table.entry .offbox .input { min-width: 56px; }
form.layout-counter { padding-bottom: 96px; } /* the bar with the total never covers the payment */

/* a total that stands alone has no rule above it */
.totals .grand.alone { margin-top: 0; padding-top: 0; border-top: 0; }
.totals [data-round] .input { height: 30px; }
/* tiles wide enough for a price and a discount side by side; square photos */
.table.lines-tiles tbody { grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); }
.table.lines-tiles td.tile-photo { aspect-ratio: 1 / 1; }
.table.lines-tiles td .input[data-rate], .table.lines-tiles td .input[data-off-in] { font-size: 15px; }

/* the bar with the total runs as wide as a counter form */
form.layout-counter > .formbar { max-width: none; }
/* on a tile, the price and the discount each take the tile's width */
.table.lines-tiles td:has([data-rate]), .table.lines-tiles td:has([data-off]) { grid-column: 1 / -1; display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 8px; }
.table.lines-tiles td:has([data-rate])::before, .table.lines-tiles td:has([data-off])::before { margin: 0; }

/* a record made in a window over a voucher (quickCreate) */
dialog.quick { width: min(720px, calc(100vw - 32px)); padding: 18px 18px 0; }
dialog.quick .pagehead { margin-bottom: 8px; } dialog.quick .keys { display: none; }
dialog.quick .formbar { position: static; box-shadow: none; }
dialog.quick .quick-foot { display: flex; justify-content: flex-end; padding: 0 0 18px; margin-top: -58px; margin-right: 110px; }
.kids a { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }

/* a PDF among a bill's pages */
.m-pdf { display: grid; place-items: center; gap: 4px; aspect-ratio: 3 / 4; background: var(--sunken); border-radius: 10px; color: var(--ink-2); text-align: center; padding: 8px; }
.m-pdf .i { width: 28px; height: 28px; }

/* A choice as big buttons (select with props.buttons): equal halves, easy to hit on a phone */
.seg.big { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; max-width: 520px; padding: 4px; border-radius: 12px; }
.seg.big span { padding: 11px 14px; font-size: 15px; text-align: center; border-radius: 9px; }
.seg-field { border: 0; padding: 0; margin: 0; min-width: 0; }

/* The photos part: one flat area, pages as tiles each with a bin, and the ways to add one as tiles of the same kind */
.photos .label { font-weight: 600; }
.photos .m-pages { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.photos .m-pages:not(:has(.m-page)) { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); } /* no pages yet: the two ways share the width */
.photos .m-addpage { border: 1.5px dashed var(--line-2, var(--line)); border-radius: var(--r-lg); background: var(--surface); padding: 18px; min-height: 168px; color: var(--ink); transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease); }
.photos .m-addpage:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.photos .m-addpage:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.photos .m-busy { display: grid; place-items: center; min-height: 168px; }
.photos .m-page figcaption { min-height: 34px; }

/* An app's form: the one button fills the bar */
.mobile .formbar > span.grow:empty { display: none; }
.mobile .formbar > span.grow:empty ~ .btn { flex: 1; }
.mobile .formbar { padding: 10px; }

/* The photo field: a small thumbnail and its button, not a canvas the width of the form */
.photo-field { display: flex; align-items: center; gap: 12px; }
.m-photo.sm { width: 72px; height: 72px; aspect-ratio: 1; flex: none; border: 1px solid var(--line); color: var(--ink-3); }
.m-photo.sm .i { width: 22px; height: 22px; }
.photos button.m-addpage { font: inherit; width: 100%; }

/* The camera window, on a phone: the live view, a shutter, the phone's photos */
dialog.photo-cam { width: min(100vw - 16px, 560px); padding: 14px; }
dialog.photo-cam .cam-view { background: #000; border-radius: var(--r); overflow: hidden; margin: 10px 0; aspect-ratio: 3 / 4; display: grid; }
dialog.photo-cam video { width: 100%; height: 100%; object-fit: cover; }
dialog.photo-cam .cam-bar { justify-content: space-between; align-items: center; }
dialog.photo-cam .cam-gap { width: 88px; }
dialog.photo-cam .shutter { width: 68px; height: 68px; border-radius: 50%; border: 4px solid var(--surface); outline: 3px solid var(--ink); background: var(--accent); cursor: pointer; }
dialog.photo-cam .stack { margin-top: 12px; }

/* A printed bill: a GST tax invoice on A4, or a receipt for an 80 mm counter printer */
.pb-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.pb-tools .btn.primary { margin-left: auto; }
.pb { background: #fff; color: #111; margin: 0 auto; padding: 28px 32px; font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow-2); border-radius: 6px; }
.pb.a4 { max-width: 210mm; min-height: 280mm; }
.pb.receipt { max-width: 80mm; padding: 10px 8px; font-size: 11px; }
.pb .faint { color: #666; }
.pb h1 { font-size: 18px; margin: 0 0 4px; } .pb.receipt h1 { font-size: 14px; text-align: center; }
.pb h2 { font-size: 15px; margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.pb-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #111; padding-bottom: 12px; }
.pb.receipt .pb-head { flex-direction: column; gap: 6px; text-align: center; border-bottom: 1px dashed #111; }
.pb-doc { text-align: right; } .pb.receipt .pb-doc { text-align: center; }
.pb-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 12px 0; border-bottom: 1px solid #ccc; }
.pb.receipt .pb-parties { grid-template-columns: 1fr; gap: 6px; padding: 6px 0; }
.pb .t-caps { font-size: 10px; color: #666; }
.pb table { width: 100%; border-collapse: collapse; }
.pb th, .pb td { padding: 5px 6px; text-align: left; vertical-align: top; } .pb.receipt th, .pb.receipt td { padding: 2px 2px; }
.pb th { border-bottom: 1px solid #111; font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; }
.pb .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pb-lines { margin: 12px 0; } .pb-lines tbody tr td { border-bottom: 1px solid #eee; }
.pb-sums { display: flex; gap: 24px; align-items: flex-start; justify-content: space-between; }
.pb.receipt .pb-sums { display: block; }
.pb-hsn { max-width: 55%; font-size: 11px; } .pb-total { max-width: 280px; margin-left: auto; }
.pb.receipt .pb-total { max-width: none; }
.pb-grand td { border-top: 2px solid #111; font-size: 15px; font-weight: 700; padding-top: 7px; }
.pb-words { font-style: italic; margin: 10px 0; }
.pb-foot { display: flex; justify-content: space-between; gap: 20px; margin-top: 28px; border-top: 1px solid #ccc; padding-top: 10px; }
.pb.receipt .pb-foot { flex-direction: column; text-align: center; margin-top: 10px; }
.pb-terms { white-space: pre-line; max-width: 60%; font-size: 11px; color: #444; } .pb-sign { text-align: right; } .pb.receipt .pb-sign { display: none; }
@media print {
  .pb { box-shadow: none; border-radius: 0; padding: 0; max-width: none; }
  .pb-tools { display: none !important; }
  .main { padding: 0 !important; }
}
@page { margin: 12mm; }

/* An exchange on the POS bill: what comes back, and its credit */
details.exchange > summary { cursor: pointer; list-style: none; padding: 12px 16px; font-weight: 600; }
details.exchange > summary::-webkit-details-marker { display: none; }
details.exchange[open] > summary .i { transform: rotate(90deg); }
details.exchange [data-credit] { color: var(--pos, #1a7f4b); }
