/* Bugalib POS: white base, navy blue brand. Status colours (green/red/blue) stay as-is so success/error/info still read at a glance. */
:root {
  --brand: #0b2a5b; --brand-ink: #ffffff;
  --gold-soft: #e8eefb;
  --g1: #1d4d9a; --g2: #0b2a5b; --g3: #5b86c9; --g4: #071b3d;    /* decorative navy rotation (nav icons, card accents) */
  --orange: var(--g1); --green: #16a34a; --red: #dc2626; --blue: #1d4d9a;
  --bg: #ffffff; --card: #ffffff; --soft: #f5f8fd; --text: #111827; --muted: #6b7280; --line: #d9e2f1; --hover: #eef3fb;
  --ok: var(--green); --warn: #c2410c; --bad: var(--red); --link: var(--blue); --bar: var(--g2);
  --side: 232px; color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); }
h1, h2, h3 { margin: 0; line-height: 1.25; } h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 15px; }
a { color: var(--link); } .muted { color: var(--muted); } small { color: var(--muted); font-size: 12px; font-weight: 400; }
.hide { display: none !important; } .right { text-align: end; } .nowrap { white-space: nowrap; }
.dot { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, var(--g3), var(--brand) 55%, var(--g4)); color: var(--brand-ink); display: inline-grid; place-items: center; font-weight: 800; flex: none; box-shadow: 0 1px 3px rgba(139, 107, 20, .4); }

/* controls */
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; min-height: 38px; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
button { padding: 8px 14px; border-radius: 8px; border: 1px solid #d1d5db; background: #fff; cursor: pointer; min-height: 38px; }
@media (hover: hover) { button:not(.primary):not(.success):not(.danger):not(.info):not(.on):hover:not(:disabled) { background: var(--hover); } }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: linear-gradient(135deg, var(--g1), var(--brand) 55%, var(--g4)); color: var(--brand-ink); border-color: var(--g4); font-weight: 600; box-shadow: 0 1px 4px rgba(11, 42, 91, .35); } @media (hover: hover) { button.primary:hover:not(:disabled) { filter: brightness(1.15); } }
button.primary:active:not(:disabled) { filter: brightness(.92); }
button.primary:disabled { background: linear-gradient(135deg, #8aa0c4, #6f86ad); border-color: #6f86ad; color: #fff; opacity: .85; }
button.success { background: var(--green); color: #fff; border-color: var(--green); font-weight: 600; } button.success:hover:not(:disabled) { filter: brightness(.95); background: var(--green); }
button.danger { background: var(--red); color: #fff; border-color: var(--red); } button.danger:hover:not(:disabled) { filter: brightness(.95); background: var(--red); }
button.info { background: var(--blue); color: #fff; border-color: var(--blue); } button.info:hover:not(:disabled) { filter: brightness(.95); background: var(--blue); }
button.sm { padding: 3px 9px; min-height: 28px; font-size: 12px; }
.icon-btn { border: 0; background: transparent; font-size: 22px; line-height: 1; padding: 2px 8px; min-height: 0; }
label { display: block; font-size: 12px; font-weight: 600; color: #4b5563; } label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; color: var(--text); }
label.check { display: flex; gap: 8px; align-items: center; font-size: 14px; font-weight: 400; color: var(--text); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; } .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
form > * + * { margin-top: 12px; } .actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.err { color: var(--red); min-height: 1.3em; margin: 6px 0 0; }

/* shell */
#shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
#side { background: #fff; border-inline-end: 1px solid var(--line); padding: 14px 10px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
#side .logo { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; font-weight: 700; font-size: 16px; }
#side .logo img, .brandmark img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; }
#side a.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 8px; color: var(--text); text-decoration: none; border-inline-start: 3px solid transparent; }
#side a.nav:hover { background: var(--soft); } #side a.nav.on { background: var(--hover); font-weight: 600; border-inline-start-color: var(--brand); }
#side svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
/* gold rotation on nav icons */
#side a.nav:nth-of-type(4n+1) svg { color: var(--g1); } #side a.nav:nth-of-type(4n+2) svg { color: var(--g2); }
#side a.nav:nth-of-type(4n+3) svg { color: var(--g4); } #side a.nav:nth-of-type(4n+4) svg { color: var(--g1); }
#side .foot { margin-top: auto; padding: 8px; font-size: 12px; color: var(--muted); }
#top { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
#top .spacer { flex: 1; } #menu-btn { display: none; }
#top::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--g4), var(--g3) 25%, var(--brand) 50%, var(--g3) 75%, var(--g4)); }
#content { padding: 20px; max-width: 1200px; width: 100%; margin: 0 auto; }
.banner { padding: 9px 20px; font-size: 13px; border-bottom: 1px solid var(--line); } .banner.warn { background: #fff7ed; color: #9a3412; } .banner.bad { background: #fef2f2; color: #991b1b; }

/* content blocks */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: 0 1px 2px rgba(16, 24, 40, .04); } .card + .card { margin-top: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat b { display: block; font-size: 22px; line-height: 1.2; } .stat span { color: var(--muted); font-size: 12px; }
.stats .card { border-top: 3px solid var(--g1); } .stats .card:nth-child(4n+2) { border-top-color: var(--g2); } .stats .card:nth-child(4n+3) { border-top-color: var(--g4); } .stats .card:nth-child(4n+4) { border-top-color: var(--g1); }
.stats .card:nth-child(4n+1) b { color: var(--g4); } .stats .card:nth-child(4n+2) b { color: var(--g4); } .stats .card:nth-child(4n+3) b { color: var(--g4); } .stats .card:nth-child(4n+4) b { color: var(--g4); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; } .toolbar > label { min-width: 140px; } .toolbar .grow { flex: 1; min-width: 200px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: 8px 12px; } .tabs button.on { border-color: var(--brand); color: var(--text); font-weight: 700; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; } th, td { padding: 9px 10px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--soft); } td.num, th.num { text-align: end; font-variant-numeric: tabular-nums; }
tbody tr.click { cursor: pointer; } tbody tr.click:hover { background: var(--hover); } tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; } tr.tot td { font-weight: 700; background: var(--soft); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; font-size: 12px; border: 1px solid currentColor; } .pill.ok { color: var(--green); background: #f0fdf4; } .pill.warn { color: #c2410c; background: #fff7ed; } .pill.bad { color: var(--red); background: #fef2f2; } .pill.mute { color: var(--muted); } .pill.info { color: var(--blue); background: #eff6ff; }
.empty { text-align: center; padding: 28px 12px; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; direction: ltr; } .chart .bar { fill: var(--bar); } .chart .axis { fill: var(--muted); font-size: 11px; }
.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); } .list-row:last-child { border: 0; }
.two-col { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; } .two-col > .card + .card { margin-top: 0; }
.neg { color: var(--red); } .pos-n { color: var(--green); }

/* modal + toast */
dialog.modal { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: #fff; color: var(--text); width: min(520px, 94vw); max-height: 92vh; box-shadow: 0 20px 50px rgba(0, 0, 0, .2); } dialog.modal.wide { width: min(820px, 96vw); }
dialog.modal::backdrop { background: rgba(17, 24, 39, .45); } .modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 3px solid var(--brand); } .modal-body { padding: 18px; overflow: auto; max-height: calc(92vh - 60px); }
/* bottom sheet: slides up from the bottom edge instead of appearing centered */
dialog.modal.sheet { position: fixed; inset: auto 0 0 50%; transform: translateX(-50%); margin: 0; width: 100%; max-width: 520px; border-radius: 16px 16px 0 0; max-height: 86vh; animation: sheet-up .2s ease-out; }
/* the recent-sales window uses the screen's width so every column fits */
dialog.modal.full { width: min(1240px, 96vw); }
.rs-table { font-size: 12.5px; } .rs-table th, .rs-table td { padding: 7px 5px; } .rs-table th { white-space: normal; vertical-align: bottom; line-height: 1.25; } .rs-table .num, .rs-table .nw { white-space: nowrap; } .rs-table .pill { white-space: nowrap; padding-inline: 6px; }
.rs-bar label { flex: 0 1 150px; }
dialog.modal.sheet .modal-head { border-bottom-color: var(--line); border-top: 4px solid var(--brand); border-radius: 16px 16px 0 0; }
dialog.modal.sheet .modal-body { max-height: calc(86vh - 60px); padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
@keyframes sheet-up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@media (prefers-reduced-motion: reduce) { dialog.modal.sheet { animation: none; } }
#toasts { position: fixed; inset-inline-end: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; } .toast { background: var(--green); color: #fff; padding: 10px 14px; border-radius: 8px; max-width: 340px; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); } .toast.err { background: var(--red); }

/* login */
#login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(180deg, #fff, var(--gold-soft)); } #login .card { width: min(380px, 100%); border-top: 4px solid transparent; border-image: linear-gradient(90deg, var(--g4), var(--g3), var(--brand)) 1; }
.brandmark { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 18px; font-weight: 700; } .brandmark img { width: 40px; height: 40px; }
.portal-switch { text-align: center; margin: 12px 0 0; font-size: 13px; }

/* scanner */
.scan-box { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; } .scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-box::after { content: ''; position: absolute; inset: 18% 12%; border: 2px solid var(--g3); border-radius: 10px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scan-line { position: absolute; z-index: 2; inset-inline: 14%; height: 2px; background: var(--red); top: 50%; animation: scan 1.8s ease-in-out infinite alternate; }
@keyframes scan { from { top: 24%; } to { top: 74%; } } @media (prefers-reduced-motion: reduce) { .scan-line { animation: none; } }

/* ---------- staff point of sale ---------- */
body.posmode { background: var(--soft); }
.pos { display: grid; grid-template-columns: 1fr 390px; height: 100vh; }
.pos-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--soft); }
.pos-top { display: flex; gap: 8px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); align-items: center; position: relative; flex-wrap: wrap; }
.pos-top::after { content: ''; position: absolute; inset-inline: 0; bottom: -1px; height: 2px; background: linear-gradient(90deg, var(--g4), var(--g3) 25%, var(--brand) 50%, var(--g3) 75%, var(--g4)); }
.pos-top .grow { flex: 1; min-width: 180px; }
.pos-top button, .pos-top select { width: auto; flex: 0 0 auto; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; background: #fff; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.chips::-webkit-scrollbar { height: 6px; } .chips::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; } .chips::-webkit-scrollbar-track { background: transparent; }
.chip { border-radius: 99px; padding: 4px 14px; min-height: 30px; font-size: 13px; white-space: nowrap; } .chip.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 600; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); grid-auto-rows: max-content; gap: 8px; padding: 10px; overflow: auto; flex: 1; min-height: 0; align-content: start; align-items: start; }
.pcard { position: relative; text-align: start; padding: 8px 9px; border-radius: 10px; background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--g1); min-height: 76px; height: auto; align-self: start; display: flex; flex-direction: column; gap: 3px; }
.pcard:nth-child(4n+2) { border-top-color: var(--g2); } .pcard:nth-child(4n+3) { border-top-color: var(--g4); } .pcard:nth-child(4n+4) { border-top-color: var(--g1); }
.pcard b { font-size: 13px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pcard-attr { font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-foot { margin-top: auto; padding-top: 2px; display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.pcard .pr { font-weight: 700; font-size: 14px; white-space: nowrap; } .pcard-foot .pill { font-size: 10px; padding: 0 6px; white-space: nowrap; }
.pcard.out { opacity: .6; }
.pcard.picked { border-color: var(--brand); border-width: 2px; background: var(--gold-soft); box-shadow: 0 0 0 1px var(--brand); }
.pqty { position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 99px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.cart { display: flex; flex-direction: column; background: #fff; border-inline-start: 1px solid var(--line); height: 100vh; min-height: 0; }
.cart-head { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cart-lines { flex: 1; min-height: 0; overflow: auto; }
.cline { padding: 9px 12px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.cline .nm { font-weight: 600; } .cline .meta { color: var(--muted); font-size: 12px; } .cline .amt { font-weight: 700; text-align: end; font-variant-numeric: tabular-nums; }
.step { display: inline-flex; align-items: center; gap: 4px; } .step button { padding: 0; width: 30px; min-height: 30px; font-size: 18px; line-height: 1; } .step input { width: 56px; text-align: center; min-height: 30px; padding: 2px; }
.cline-ctl { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; } .cline-ctl select { width: auto; min-width: 110px; max-width: 160px; min-height: 30px; padding: 2px 8px; font-size: 13px; }
.cline-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.cline-actions select { width: auto; max-width: 220px; min-height: 30px; padding: 2px 6px; font-size: 12px; }
.cline-actions button { min-height: 30px; }
.cart-foot { border-top: 2px solid var(--line); padding: 10px 12px; background: var(--soft); }
.sum-row { display: flex; justify-content: space-between; padding: 2px 0; } .sum-row.big { font-size: 20px; font-weight: 800; padding-top: 6px; }
.cart-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; } .cart-btns .pay { grid-column: 1 / -1; min-height: 50px; font-size: 17px; }
.mcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; } .mcards button { min-height: 52px; font-weight: 600; } .mcards button.on { outline: 3px solid var(--brand); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
#cart-toggle { display: none; }
@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; height: auto; min-height: 100vh; } .pos-main { min-height: 100vh; padding-bottom: 76px; }
  .cart { position: fixed; inset: 0; z-index: 30; height: 100vh; transform: translateY(100%); transition: transform .2s; } .cart.open { transform: none; }
  #cart-toggle { display: flex; position: fixed; inset-inline: 10px; bottom: 10px; z-index: 20; justify-content: space-between; min-height: 52px; font-size: 16px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25); }
}

/* print: only the receipt / report / labels */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; } #print-area { display: block !important; color: #000; background: #fff; padding: 12px; }
  #print-area table { font-size: 12px; } #print-area th, #print-area td { border-color: #bbb; background: #fff; }
  .receipt { width: 80mm; margin: 0 auto; font: 12px/1.35 ui-monospace, monospace; } .receipt h2 { text-align: center; } .receipt hr { border: 0; border-top: 1px dashed #000; } .receipt .row { display: flex; justify-content: space-between; gap: 8px; }
  .labels { display: flex; flex-wrap: wrap; gap: 2mm; } .lbl { width: var(--lw, 58mm); height: var(--lh, 32mm); border: 1px dashed #999; padding: 1.5mm 2mm; break-inside: avoid; text-align: center; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; align-items: center; }
  .lbl .n { font: 700 11px/1.2 system-ui, sans-serif; max-height: 2.4em; overflow: hidden; } .lbl .p { font: 800 15px system-ui, sans-serif; } .lbl svg { max-width: 100%; height: 14mm; }
}

@media (max-width: 820px) {
  #shell { grid-template-columns: 1fr; } #side { position: fixed; z-index: 20; width: 250px; inset-inline-start: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0, 0, 0, .15); }
  [dir=rtl] #side { transform: translateX(100%); } #side.open, [dir=rtl] #side.open { transform: none; } #menu-btn { display: inline-block; } #content { padding: 14px 12px; }
  .grid2, .grid3, .grid4, .two-col { grid-template-columns: 1fr; } #top { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) { #side, .cart { transition: none; } }

/* right-to-left (Arabic) */
[dir=rtl] input[type=email], [dir=rtl] input[type=tel], [dir=rtl] input[type=number], [dir=rtl] input[type=url], [dir=rtl] input[type=password], [dir=rtl] input[type=date] { direction: ltr; text-align: right; }
[dir=rtl] code, [dir=rtl] .receipt { direction: ltr; unicode-bidi: plaintext; }
[dir=rtl] td.num, [dir=rtl] th.num { direction: ltr; text-align: left; unicode-bidi: isolate; }
[dir=rtl] .pill { unicode-bidi: plaintext; } [dir=rtl] .cline .amt { text-align: left; direction: ltr; }
.lang-btn { font-size: 12px; }

/* manual POS (web) */
.cat-area { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.pos-tabs { margin: 0; padding: 0 12px; background: #fff; }
.mfilters { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 12px; background: #fff; border-bottom: 1px solid var(--line); } .mfilters label { flex: 1; min-width: 110px; }
.mwrap { overflow: auto; flex: 1; min-height: 0; padding: 0 12px 12px; background: #fff; } .mwrap th { position: sticky; top: 0; z-index: 1; }

/* product pictures */
.pimg { display: block; width: 100%; height: 86px; object-fit: cover; border-radius: 8px; margin-bottom: 6px; background: #fff; }

/* dashboard stat cards: all the same height */
.stats { align-items: stretch; }
.stats .card { min-height: 92px; display: flex; flex-direction: column; justify-content: center; margin: 0; }

/* ---------- dashboard ---------- */
.dash-top { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dash-presets { display: flex; flex-wrap: wrap; gap: 6px; } .dash-presets button.on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); font-weight: 700; }
.dash-dates { display: flex; align-items: center; gap: 6px; color: var(--muted); } .dash-dates input { width: auto; margin: 0; padding: 7px 8px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.kpi { display: flex; gap: 14px; align-items: center; margin: 0 !important; padding: 18px; }
.kpi-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--gold-soft); color: var(--g4); flex: none; }
.kpi b { display: block; font-size: 22px; line-height: 1.2; } .kpi span:not(.kpi-ico) { color: var(--muted); font-size: 13px; } .kpi small { display: block; color: var(--muted); font-size: 12px; }
.mini-kpis { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.mini-kpis > * { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-decoration: none; color: inherit; display: block; }
.mini-kpis span { display: block; color: var(--muted); font-size: 12px; } .mini-kpis b { font-size: 16px; }
.dash-row { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; margin-bottom: 16px; } .dash-row.even { grid-template-columns: 1fr 1fr; } .dash-row > .card, .dash-body > .card { margin: 0 !important; }
#dash-body > .card { margin-bottom: 16px; }
.dash-row h2, #dash-body .card h2 { margin: 0 0 10px; font-size: 15px; display: flex; justify-content: space-between; } .more { font-size: 13px; font-weight: 500; }
.donut { display: flex; flex-direction: column; align-items: center; gap: 10px; } .donut svg { width: 170px; height: 170px; }
.donut ul { list-style: none; margin: 0; padding: 0; width: 100%; font-size: 13px; } .donut li { display: flex; align-items: center; gap: 8px; padding: 3px 0; } .donut li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut li i, .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.chart { width: 100%; height: auto; display: block; } .legend { display: flex; gap: 16px; justify-content: center; font-size: 12px; color: var(--muted); margin-top: 6px; } .legend span { display: inline-flex; align-items: center; gap: 6px; }
.dash-hist { display: grid; grid-template-columns: 210px 1fr; gap: 16px; } .counters { display: grid; gap: 10px; align-content: start; }
.counters div { border-radius: 10px; padding: 12px 14px; } .counters span { display: block; font-size: 12px; color: #4b5563; } .counters b { font-size: 22px; }
.rank { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--gold-soft); color: var(--g4); font-size: 11px; font-style: normal; font-weight: 700; margin-right: 4px; }
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, 1fr); } .mini-kpis { grid-template-columns: repeat(2, 1fr); } .dash-row, .dash-row.even, .dash-hist { grid-template-columns: 1fr; }
  .counters { grid-template-columns: 1fr 1fr; } .kpi b { font-size: 18px; }
}
.kpis > *, .mini-kpis > *, .dash-row > *, .dash-hist > * { min-width: 0; }
@media (max-width: 600px) { .kpis { grid-template-columns: 1fr; } .kpi { padding: 14px; } .dash-dates { width: 100%; } .dash-dates input { flex: 1; min-width: 0; } }

/* ---------- POS layout fixes ---------- */
.cust-new { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; } .cust-new button { min-height: 38px; white-space: nowrap; }
@media (max-width: 600px) { .cust-new { grid-template-columns: 1fr; } .cust-new button { width: 100%; } }
#cart-toggle.primary { color: var(--brand-ink); } #cart-toggle b { color: inherit; }
@media (max-width: 700px) {
  .mwrap { overflow-x: hidden; } .mwrap table { width: 100%; table-layout: auto; }
  .mwrap th:nth-child(2), .mwrap td:nth-child(2), .mwrap th:nth-child(3), .mwrap td:nth-child(3) { display: none; }   /* details and code columns: not needed on a phone */
  .mwrap th, .mwrap td { padding: 8px 6px; } .mwrap td:first-child { max-width: 38vw; word-break: break-word; }
  .mwrap .pill { white-space: nowrap; font-size: 11px; padding: 1px 7px; } .mwrap td .step { white-space: nowrap; }
}

/* phone number with country code */
.phone-row { display: flex; gap: 6px; margin-top: 4px; } .phone-row select { width: auto; max-width: 48%; flex: none; margin: 0 !important; } .phone-row input { flex: 1; min-width: 0; margin: 0 !important; }

/* ---------- top bar on phones: everything on one tidy row, Sign out never wraps ---------- */
#logout { white-space: nowrap; flex: none; }
#top h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
#top h1 { flex: 0 0 auto; max-width: 45%; }
#top select { width: auto; max-width: 260px; flex: 0 1 auto; }
@media (max-width: 600px) {
  #top { gap: 6px; padding: 8px 10px; }
  #top h1 { flex: 1; font-size: 17px; } #top .spacer { display: none; }
  #top select { width: auto; max-width: 70px; min-height: 34px; padding: 5px 22px 5px 8px; font-size: 13px; flex: none; margin: 0; }
  #top #menu-btn { min-height: 34px; padding: 4px 10px; flex: none; }
  #logout { min-height: 34px; padding: 5px 10px; font-size: 13px; }
}
.wa-box { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); } .wa-box .phone-row { margin-top: 6px; }

/* POS: top strip (location, clock, connection, quick tools) and the bottom action bar */
.pos-strip { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 12px; background: #fff; border-bottom: 1px solid var(--line); font-size: 13px; }
.pos-strip .grow { flex: 1; } .pos-strip button { width: auto; min-height: 30px; padding: 2px 10px; }
.pos-strip .clock { padding: 3px 10px; border-radius: 6px; background: var(--soft); font-variant-numeric: tabular-nums; }
.pos-strip .net { padding: 2px 10px; border-radius: 99px; font-weight: 600; font-size: 12px; } .pos-strip .net.ok { background: #dcfce7; color: #166534; } .pos-strip .net.bad { background: #fee2e2; color: #991b1b; }
.pos-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 12px; background: #fff; border-top: 1px solid var(--line); }
.pos-bar button { width: auto; min-height: 44px; padding: 6px 16px; font-weight: 700; } .pos-bar .grow { flex: 1; } .pos-bar .sep { width: 1px; align-self: stretch; background: var(--line); }
.pos-bar .danger { color: #b91c1c; border-color: #b91c1c; } .pos-bar .pay-card { background: #db3a78; color: #fff; border-color: #db3a78; }
@media (max-width: 900px) { .pos-bar { position: fixed; inset-inline: 0; bottom: 74px; z-index: 19; } .pos-main { padding-bottom: 150px; } }

/* connection pill + top bar POS link */
#top .net { padding: 2px 10px; border-radius: 99px; font-weight: 600; font-size: 12px; white-space: nowrap; } #top .net.ok { background: #dcfce7; color: #166534; } #top .net.bad { background: #fee2e2; color: #991b1b; }
#top .sm { width: auto; flex: none; }
#top a.btn-link { flex: none; padding: 7px 14px; border-radius: 8px; background: var(--brand); color: var(--brand-ink, #fff); font-weight: 700; text-decoration: none; }

.pos-strip button.warn { background: #fff7ed; color: #c2410c; border-color: #c2410c; } .pos-strip button.danger { background: #fef2f2; color: #b91c1c; border-color: #b91c1c; }

/* till: roomy search row, readable Cancel, picture tiles, featured star */
.pos-top #q { flex: 1 1 calc(100% - 110px); min-width: 0; }
.pos-bar .danger { background: #fff !important; color: #b91c1c !important; border: 2px solid #b91c1c !important; } .pos-bar .danger:hover { background: #fef2f2 !important; }
.pimg { height: 78px; } .pimg.ph { display: grid; place-items: center; background: #f1f4f9; color: #b6bfce; border: 1px dashed #dbe1ec; } .pimg.ph svg { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.pstar { position: absolute; top: 4px; inset-inline-end: 6px; color: #d4a017; font-size: 16px; text-shadow: 0 0 2px #fff; z-index: 1; }

/* collapsible nav group (Stock Transfers) */
#side .nav-group-h { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; color: var(--text); font: inherit; cursor: pointer; text-align: start; }
#side .nav-group-h:hover { background: var(--soft); }
#side .nav-group-h i { margin-inline-start: auto; font-style: normal; transition: transform .15s; }
#side .nav-group.open .nav-group-h i { transform: rotate(180deg); }
#side .subnav { display: none; margin-inline-start: 22px; border-inline-start: 1px solid var(--line, #e5e7eb); }
#side .nav-group.open .subnav { display: block; }
#side .subnav a.nav { padding-inline-start: 14px; font-size: .93em; }
#side .subnav a.nav svg { display: none; }

/* ---------- layout: wide tables scroll inside their own box, never the whole page ---------- */
#shell { grid-template-columns: var(--side) minmax(0, 1fr); }
#shell > div, #content, #content .card, #content form, .grid2 > *, .grid3 > *, .grid4 > *, .two-col > * { min-width: 0; }
#content { max-width: 1480px; }
.table-wrap { max-width: 100%; }
@media (max-width: 820px) { #shell { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  #top { flex-wrap: wrap; row-gap: 6px; }
  #top h1 { flex: 1 1 auto; max-width: none; min-width: 40%; }
  #top select, #top select.lang-btn { flex: 1 1 90px; min-width: 0; max-width: 200px; width: auto; }
  #top .spacer { display: none; }
  .toolbar > * { max-width: 100%; }
  th, td { padding: 8px 8px; }
}
@media (max-width: 600px) {
  #top h1 { flex-basis: 60%; }
  #top select, #top select.lang-btn { max-width: none; flex: 1 1 28%; }
  .toolbar > label, .toolbar .grow { min-width: 0; flex: 1 1 140px; }
  .actions { flex-wrap: wrap; }
}
@media (max-width: 600px) {   /* phone: two short rows - menu, title, status; then POS, branch, language, sign out */
  #top #calc-top, #top #quick-reports { display: none; }
  #top h1 { flex: 1 1 55%; }
  #top select#branch-pick { flex: 1 1 90px; }
  #top select.lang-btn { flex: 0 1 86px; }
}
/* Add Purchase product lines: many columns, so headers wrap and boxes stay compact to fit a laptop screen */
.pl-table { min-width: 940px; font-size: 12.5px; } .pl-table th { white-space: normal; vertical-align: bottom; line-height: 1.25; } .pl-table th, .pl-table td { padding: 7px 4px; }
.pl-table input, .pl-table select { min-height: 32px; padding: 4px 6px; font-size: 12.5px; } .pl-table select[name=tax] { width: 104px !important; } .pl-table input[name=qty], .pl-table input[name=margin] { width: 62px !important; }
.pl-table input[name=before], .pl-table input[name=sell] { width: 72px !important; }
/* discount: type and value side by side, joined as one control */
.pl-disc { display: flex; align-items: stretch; width: 128px; } .pl-table .pl-disc select, .pl-table .pl-disc input { height: 34px; margin: 0; } .pl-table .pl-disc select { width: 70px !important; flex: none; border-start-end-radius: 0; border-end-end-radius: 0; padding-inline-end: 2px; } .pl-table .pl-disc input { width: 58px !important; flex: none; border-start-start-radius: 0; border-end-start-radius: 0; margin-inline-start: -1px; }
.pl-table input, .pl-table select { height: 34px; } .pl-table td { vertical-align: middle; }
/* Till toolbar: compact buttons so they take less height above the products */
.pos-top { gap: 6px; } .pos-top button, .pos-top select { min-height: 34px; padding: 5px 10px; font-size: 13px; width: auto; } .pos-top select { padding-inline-end: 26px; } .pos-top input.grow { min-height: 38px; }
.pos-acts { display: contents; }
@media (max-width: 900px) {   /* tablet: the bottom bar stays on one row */
  .pos-bar { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 8px; } .pos-bar button { flex: 0 0 auto; padding: 6px 11px; font-size: 14px; } .pos-bar .sep { display: none; } .pos-bar .grow { flex: 1 0 0; }
}
@media (max-width: 600px) {   /* phone: header, buttons and bottom bar are single swipeable rows so products stay visible */
  .pos-strip { flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding: 5px 8px; font-size: 12px; } .pos-strip > * { flex: 0 0 auto; white-space: nowrap; } .pos-strip .grow { display: none; }
  .pos-top { padding: 8px; }
  .pos-acts { display: flex; flex: 1 0 100%; gap: 6px; overflow-x: auto; max-width: 100%; align-items: center; padding-bottom: 2px; } .pos-acts > * { flex: 0 0 auto; white-space: nowrap; }
  .pos-bar .grow { display: none; } .pos-bar #b-multi, .pos-bar #b-card, .pos-bar #b-cash { order: -1; }
}
.pos-strip #loc-pick { width: auto; min-height: 30px; padding: 2px 26px 2px 8px; font-size: 13px; display: inline-block; margin: 0; }
.cust-note { margin: 6px 0; padding: 7px 10px; background: #fffbeb; border: 1px solid #f59e0b; border-radius: 8px; color: #1f2937; font-size: 13px; text-align: start; } .cust-note small { display: block; color: #92400e; font-weight: 700; } .cust-note div { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 92px; overflow: auto; }
