:root {
  --bg: #f2f6f9; --panel: #ffffff; --ink: #18212b; --muted: #5f6b78; --line: #e3e7ec;
  --brand: #0b4f7c; --brand-2: #1677a8; --brand-soft: #e3eff7;
  --c1: #1677a8; --c2: #9fb7d9; --warn: #b26a00; --warn-soft: #fff4e0; --bad: #b42318; --bad-soft: #fdecea;
  --ok: #1d7a3e; --ok-soft: #e7f5ec; --info-soft: #eaf1fb;
  --radius: 10px; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 650; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: #0a2a42; color: #cfe2ef; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; color: #fff; font-weight: 700; font-size: 16px; }
.brand svg { flex: none; }
.side .group { margin: 14px 8px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #7fa3bd; }
.side a { display: flex; align-items: center; gap: 9px; color: #d6e7f2; padding: 7px 10px; border-radius: 7px; font-size: 13.5px; }
.side a:hover { background: rgba(255,255,255,.07); text-decoration: none; }
.side a.on { background: #134a70; color: #fff; }
.side .badge { margin-left: auto; }
.main { min-width: 0; }
.top { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top .spacer { flex: 1; }
.top form { margin: 0; }
.content { padding: 22px 24px 60px; max-width: 1400px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* status pills */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; background: var(--brand-soft); color: var(--brand); font-weight: 600; white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.grey { background: #eef0f3; color: var(--muted); }
.badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; font-weight: 700; }

/* cards & grids */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .alerts > * { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.mt { margin-top: 16px; }
.kpi { padding: 14px 16px; }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; margin-top: 4px; }
.up { color: var(--ok); } .down { color: var(--bad); }
.alerts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 16px; }
.alert-tile { display: block; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--ink); }
.alert-tile:hover { text-decoration: none; border-color: var(--brand-2); }
.alert-tile b { display: block; font-size: 20px; }
.alert-tile.bad { background: var(--bad-soft); border-color: #f5c2bd; }
.alert-tile.warn { background: var(--warn-soft); border-color: #f3d9a8; }
.alert-tile.ok { background: var(--ok-soft); border-color: #bfe3cb; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; position: sticky; top: 0; }
tr:hover td { background: #fafcfb; }
tfoot td { font-weight: 700; background: #fafbfc; }
td.sub { padding-left: 26px; }

/* forms */
label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #cfd6de; border-radius: 8px; background: #fff; width: 100%; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid #9fd3c7; border-color: var(--brand-2); }
input[type=checkbox] { width: auto; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > .field { flex: 1 1 160px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline input, .inline select { width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: 13.5px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #cfd6de; background: #fff; color: var(--ink); border-radius: 8px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f3f5f7; text-decoration: none; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--bad); border-color: #f0b8b2; }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn.lg { padding: 12px 18px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 13px; }
.tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.tabs a:hover { text-decoration: none; }

/* flash */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #bfe3cb; color: #14532d; }
.flash.error { background: var(--bad-soft); border-color: #f5c2bd; color: #7a1a12; }
.flash.warn { background: var(--warn-soft); border-color: #f3d9a8; color: #6b4200; }
.empty { padding: 30px; text-align: center; color: var(--muted); }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: #edf0f3; }
.chart .axis { fill: #8a96a3; font-size: 11px; }
.chart .s1 { fill: var(--c1); } .chart .s2 { fill: var(--c2); }
.chart .line { stroke: var(--c1); stroke-width: 2; }
.chart .area { fill: var(--c1); opacity: .08; }
.chart .dot { fill: var(--c1); }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 4px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.legend i.s1 { background: var(--c1); } .legend i.s2 { background: var(--c2); }
.donut { display: flex; align-items: center; gap: 16px; }
.donut ul { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.donut li { margin: 4px 0; } .donut li i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
.ds1 { stroke: #1677a8; background: #1677a8; } .ds2 { stroke: #9fb7d9; background: #9fb7d9; }
.ds3 { stroke: #e0a43a; background: #e0a43a; } .ds4 { stroke: #c96a6a; background: #c96a6a; }
.ds5 { stroke: #7a6fc9; background: #7a6fc9; } .ds6 { stroke: #8aa0b3; background: #8aa0b3; }
.bar-inline { height: 6px; background: #edf0f3; border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar-inline > span { display: block; height: 100%; background: var(--c1); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0a2a42, #1677a8); }
.login { width: 360px; background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }

/* POS */
.cart-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.cart-tabs button { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 12px; cursor: pointer; font: inherit; text-align: left; min-width: 150px; }
.cart-tabs button small { display: block; color: var(--muted); font-size: 11.5px; }
.cart-tabs button.on { border-color: var(--brand); background: var(--brand); color: #fff; }
.cart-tabs button.on small { color: #cfe9e2; }
.cart-tabs button .dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:#e0a43a; margin-left:6px; }
.pos { display: grid; grid-template-columns: minmax(0,1fr) 470px; gap: 16px; height: calc(100vh - 160px); }
.pos .left, .pos .right { display: flex; flex-direction: column; min-height: 0; }
.search-wrap { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pos .results { overflow-y: auto; flex: 1; margin-top: 10px; }
.pos .prod { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-bottom: 6px; cursor: pointer; }
.pos .prod:hover, .pos .prod.sel { border-color: var(--brand-2); box-shadow: 0 0 0 2px #cfe3f0; }
.pos .prod.out { opacity: .55; }
.exp { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.exp-red { background: #fecaca; color: #991b1b; border-color: #f87171; }
.exp-orange { background: #fed7aa; color: #9a3412; border-color: #fb923c; }
.exp-deep { background: #fcd34d; color: #713f12; border-color: #f59e0b; }
.exp-faint { background: #fef9c3; color: #713f12; border-color: #fde68a; }
.exp-green { background: #bbf7d0; color: #166534; border-color: #4ade80; }
.exp-none { background: #fff; color: var(--muted); border-color: var(--line); }
.prod.exp-row-red { border-left: 5px solid #ef4444; } .prod.exp-row-orange { border-left: 5px solid #f97316; }
.prod.exp-row-deep { border-left: 5px solid #f59e0b; } .prod.exp-row-faint { border-left: 5px solid #fde68a; }
.prod.exp-row-green { border-left: 5px solid #22c55e; }
.exp-legend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; color: var(--muted); }
.exp-legend i { font-style: normal; padding: 1px 8px; border-radius: 999px; border: 1px solid; font-size: 11.5px; }
.cust-row { display: flex; gap: 10px; align-items: flex-end; }
.tier-toggle { display: flex; gap: 2px; background: #eef1f4; border-radius: 8px; padding: 3px; }
.tier-toggle label { margin: 0; padding: 6px 10px; border-radius: 6px; cursor: pointer; color: var(--ink); font-weight: 600; }
.tier-toggle input { display: none; }
.tier-toggle label:has(input:checked) { background: #fff; box-shadow: var(--shadow); }
.pos .cart { flex: 1; overflow-y: auto; margin-top: 8px; }
.cart-table td, .cart-table th { padding: 6px 6px; vertical-align: middle; }
.cart-table input { padding: 5px 6px; text-align: right; width: 78px; }
.cart-table .nm b { display: block; }
.cart-table .col-av, .cart-table .col-cost, .cart-table .col-no { display: none; }
.pos .totals { border-top: 2px solid var(--ink); padding-top: 8px; margin-top: 6px; }
.pos .totals div { display: flex; justify-content: space-between; margin: 3px 0; }
.pos .grand { font-size: 26px; font-weight: 800; }
.pos .search { font-size: 17px; padding: 12px 14px; }
.pos-actions { display: grid; grid-template-columns: auto auto 1fr 1.3fr; gap: 8px; margin-top: 10px; }
/* wholesale / warehouse: wide bulk cart */
.pos.wide { grid-template-columns: 1fr; height: auto; }
.pos.wide .left { order: 1; } .pos.wide .right { order: 2; }
.pos.wide .search-wrap { flex: none; }
.pos.wide .results { position: absolute; top: 58px; left: 0; right: 0; z-index: 20; max-height: 55vh; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.15); padding: 8px; display: none; }
.pos.wide .search-wrap:focus-within .results, .pos.wide .results.show { display: block; }
.pos.wide .cart { min-height: 340px; max-height: none; }
.pos.wide .cart-table .col-av, .pos.wide .cart-table .col-cost, .pos.wide .cart-table .col-no { display: table-cell; }
.pos.wide .cart-table td { font-size: 14.5px; padding: 9px 8px; }
.pos.wide .cart-table input { width: 100px; font-size: 15px; }
.pos.wide .totals { display: grid; grid-template-columns: repeat(4, 1fr) 1.4fr; gap: 12px; align-items: end; border-top: none; }
.pos.wide .totals div { flex-direction: column; background: #f4f8fb; border-radius: 8px; padding: 8px 12px; margin: 0; }
.pos.wide .grand { background: var(--brand) !important; color: #fff; }
.pos.wide .pos-actions { grid-template-columns: auto auto auto 260px; justify-content: end; }
.offline-banner { display: none; background: var(--warn-soft); color: var(--warn); border: 1px solid #f3d9a8; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; font-weight: 600; }
body.is-offline .offline-banner { display: block; }
dialog { border: none; border-radius: 12px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.3); max-width: 480px; width: 92vw; }
dialog::backdrop { background: rgba(10,20,20,.55); backdrop-filter: blur(2px); }
/* payment pop-up */
.paydlg { max-width: 920px; padding: 0; overflow: hidden; border-radius: 18px; }
.pay-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 26px; background: linear-gradient(135deg, #0a2a42, #1677a8); color: #fff; }
.pay-total { font-size: 40px; font-weight: 800; letter-spacing: -.5px; }
.pay-body { display: grid; grid-template-columns: 230px 1fr; min-height: 360px; }
.pay-methods { background: #f3f6f6; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pay-methods button { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 12px; border: 2px solid transparent; background: #fff; font: inherit; font-size: 15px; font-weight: 650; cursor: pointer; text-align: left; box-shadow: var(--shadow); }
.pay-methods button .ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 17px; }
.pay-methods button.on { border-color: var(--brand); background: #e9f6f2; }
.pay-methods button:disabled { opacity: .4; cursor: not-allowed; }
.pay-panel { padding: 20px 24px; }
.pay-panel [data-panel] { display: none; } .pay-panel [data-panel].on { display: block; }
.big-input { font-size: 26px !important; padding: 10px 14px !important; font-weight: 700; }
.quick-cash { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.quick-cash button { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.quick-cash button:hover { border-color: var(--brand-2); }
.change-box { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-radius: 12px; background: var(--ok-soft); border: 2px solid #9fd8b4; margin-top: 8px; }
.change-box b { font-size: 34px; color: var(--ok); }
.change-box.short { background: var(--bad-soft); border-color: #f5b5ae; } .change-box.short b { color: var(--bad); }
.change-box.big b { font-size: 44px; }
.momo-status { margin-top: 12px; padding: 14px; border-radius: 12px; display: none; font-weight: 600; }
.momo-status.wait { display: block; background: #fff8e6; color: #7a5300; }
.momo-status.ok { display: block; background: var(--ok-soft); color: var(--ok); }
.momo-status.bad { display: block; background: var(--bad-soft); color: var(--bad); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
.tenders { margin-top: 14px; }
.tenders .t { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 8px; background: #f4f8fb; margin-bottom: 6px; }
.credit-info { padding: 14px; border-radius: 10px; background: var(--info-soft); }
.pay-foot { display: flex; gap: 10px; align-items: center; padding: 14px 24px; border-top: 1px solid var(--line); background: #fafbfc; }
.pay-remaining { flex: 1; font-weight: 700; font-size: 16px; }
.donedlg { text-align: center; max-width: 520px; }
.done-tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); font-size: 34px; display: grid; place-items: center; margin: 0 auto 8px; }
.ixdlg { max-width: 640px; }
.ix-item { border-left: 5px solid; border-radius: 8px; padding: 10px 14px; margin-bottom: 10px; background: #fafafa; }
.ix-item.severe { border-color: #dc2626; background: #fef2f2; } .ix-item.moderate { border-color: #f59e0b; background: #fffbeb; }
.ix-item.minor { border-color: #3b82f6; background: #eff6ff; }
.ix-item b.sev { text-transform: uppercase; font-size: 11px; letter-spacing: .05em; }

/* receipt */
.receipt { width: 300px; margin: 20px auto; background: #fff; padding: 16px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
.receipt table td, .receipt table th { padding: 2px 0; border: none; }
@media print {
  .side, .top, .no-print, .page-head .actions { display: none !important; }
  .app { display: block; } .content { padding: 0; } body { background: #fff; }
  .card { box-shadow: none; border: none; }
}
@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; } .side { position: static; height: auto; }
  .g2, .g3, .g4, .g-2-1, .pos { grid-template-columns: 1fr; } .pos { height: auto; }
}

/* v1.2 */
@media print { nav.side, header.top, .no-pdf, .actions form, .btn, .tabs, dialog { display: none !important; } .app { display: block; } .main { margin: 0; } }
.export-btns .btn { padding: 4px 8px; }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.steps span { background: #eef4f2; border-radius: 99px; padding: 3px 10px; font-size: 12px; }
.shift-bar { display: flex; align-items: center; gap: 10px; background: #fff7e6; border: 1px solid #f3d19c; border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; }
.shift-bar.ok { background: #eef8f3; border-color: #b7e0cb; }
.count-grid input { text-align: right; font-size: 18px; }
.slip { max-width: 520px; margin: 0 auto; }
.diff-pos { color: #067647; font-weight: 600; } .diff-neg { color: #b42318; font-weight: 600; }
table td.wrap { white-space: normal; }
.map-table td:first-child { font-weight: 600; }

/* v1.3 permissions */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.perm-head { display: flex; justify-content: space-between; align-items: baseline; }
.perm-head h3 { margin: 0 0 6px; }
.perm-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-top: 1px solid var(--line); font-weight: normal; cursor: pointer; }
.perm-row input { margin-top: 3px; width: auto; }

/* v1.3 menu: grouped headers, hide / show */
.side .ni { width: 18px; text-align: center; flex: none; }
.side a.navtop { font-weight: 600; margin: 4px 0; }
.navgrp { margin: 2px 0; }
.navgrp summary { list-style: none; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 7px; cursor: pointer;
  font-weight: 600; font-size: 13.5px; color: #e8f4f1; user-select: none; }
.navgrp summary::-webkit-details-marker { display: none; }
.navgrp summary:hover { background: rgba(255,255,255,.07); }
.navgrp summary .chev { margin-left: auto; font-size: 11px; opacity: .7; transition: transform .15s; }
.navgrp[open] summary .chev { transform: rotate(180deg); }
.navgrp[open] summary { color: #fff; }
.navgrp .navitems { padding: 2px 0 6px 14px; border-left: 1px solid rgba(255,255,255,.12); margin-left: 18px; }
.navgrp .navitems a { font-size: 13px; padding: 6px 10px; }
.nav-toggle { font-size: 15px; }
body.nav-hidden .app { grid-template-columns: 1fr; }
body.nav-hidden .side { display: none; }
body.nav-hidden.nav-peek .side { display: block; position: fixed; left: 0; top: 0; width: 260px; z-index: 60; box-shadow: 6px 0 24px rgba(0,0,0,.3); }
body.nav-peek .nav-scrim { display: block; }
.nav-scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.25); z-index: 55; }
/* POS fills the screen and never scrolls; only the cart and search list scroll inside it */
body.pos-page { overflow: hidden; }
body.pos-page .app { height: 100vh; min-height: 0; }
body.pos-page .main { height: 100vh; display: flex; flex-direction: column; min-height: 0; }
body.pos-page header.top { flex: none; }
body.pos-page .content { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 14px; overflow: hidden; }
body.pos-page #pos-root { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.pos-page .flash { flex: none; }

/* v1.3 till: one layout for every shop, full-width cart, fixed to the screen */
.pos.wide { display: flex; flex-direction: column; gap: 10px; height: auto; flex: 1; min-height: 0; }
.pos.wide .left { flex: none; padding: 10px 12px; position: relative; overflow: visible; z-index: 30; }
.pos.wide .right { flex: 1; min-height: 0; padding: 10px 12px; }
.pos .search-row { display: flex; gap: 12px; align-items: center; }
.pos .search-row .search-wrap { flex: 1; position: relative; }
.pos .search-row .search { margin: 0; }
.pos.wide .results { top: 52px; max-height: 60vh; }
.pos.wide .cart { flex: 1; min-height: 0; max-height: none; overflow-y: auto; margin-top: 6px; }
.pos.wide .cart-table th { position: sticky; top: 0; background: #fff; z-index: 1; }
.pos .cust-row { display: flex; gap: 10px; align-items: center; }
.pos-foot { display: flex; gap: 12px; align-items: stretch; margin-top: 8px; flex: none; }
.pos.wide .pos-foot .totals { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 8px; margin: 0; padding: 0; border: none; }
.pos.wide .pos-foot .disc-box { grid-column: span 2; }
.pos.wide .pos-foot .totals > div { flex-direction: column; background: #f4f8fb; border-radius: 8px; padding: 6px 10px; margin: 0; }
.pos.wide .pos-foot .grand { grid-column: span 2; font-size: 24px; }
.pos.wide .pos-foot .totals { min-width: 0; }
.pos.wide .pos-foot .pos-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; width: 420px; flex: none; align-content: stretch; }
.pos.wide .pos-foot .pos-actions .btn { padding: 6px 8px; font-size: 13px; white-space: nowrap; }
.pos.wide .pos-foot .pos-actions .lg { grid-column: 1 / -1; font-size: 17px; padding: 10px; }
.disc-box input { width: 70px; text-align: right; padding: 3px 5px; }
.disc-box select { width: auto; padding: 3px 4px; }
.pos .exp-legend { flex: none; display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.pos .cart-table input:disabled { background: transparent; border-color: transparent; color: var(--ink); }

/* v1.3 bordered tables (refills etc.) */
.card.boxed h2 { margin-top: 0; }
.table-box { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table-box table { margin: 0; }
.table-box table.fixed { table-layout: fixed; width: 100%; }
.table-box th { background: #f3f7f6; border-bottom: 1px solid var(--line); }
.table-box td, .table-box th { border-right: 1px solid #edf1f0; padding: 8px 10px; vertical-align: middle; }
.table-box td:last-child, .table-box th:last-child { border-right: none; }
.table-box td.ell { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-row { display: flex; gap: 4px; flex-wrap: wrap; } .btn-row form { margin: 0; }
.filter-bar { margin: -4px 0 4px; }
dialog form h2 { margin-top: 0; }

/* v1.3 receive purchases (till-style) */
body.pos-page .rcv { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.rcv-head { display: grid; grid-template-columns: 2fr 1.1fr 1.3fr 1.2fr 1fr .9fr 1.1fr; gap: 10px; padding: 10px 12px; flex: none; }
.rcv-head .field[hidden] { display: none; }
@media (max-width: 1100px) { .rcv-head { grid-template-columns: repeat(3, 1fr); } }
.rcv-head .field { margin: 0; }
.rcv-search { padding: 10px 12px; flex: none; position: relative; z-index: 30; overflow: visible; }
.rcv-search .search-wrap { position: relative; }
.rcv-search .results { display: none; position: absolute; top: 52px; left: 0; right: 0; max-height: 55vh; overflow-y: auto; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.15); padding: 8px; }
.rcv-search .results.show { display: block; }
.rcv-search .prod { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.rcv-search .prod.sel, .rcv-search .prod:hover { border-color: var(--brand-2); box-shadow: 0 0 0 2px #cfe3f0; }
.rcv-cart { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 12px; }
.rcv-cart .cart { flex: 1; min-height: 0; overflow-y: auto; }
.rcv-cart .cart-table th { position: sticky; top: 0; background: #fff; }
.rcv-cart .pos-foot .totals { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0; }
.rcv-cart .pos-foot .totals > div { display: flex; flex-direction: column; background: #f4f8fb; border-radius: 8px; padding: 6px 10px; }
.rcv-cart .pos-foot .grand { font-size: 22px; font-weight: 800; background: var(--brand) !important; color: #fff; }
.rcv-cart .pos-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 6px; width: 380px; }

/* v1.3 HR */
table.roster td { vertical-align: top; height: 64px; }
table.roster th.today, table.roster td.today { background: #f2faf7; }
.shift-chip { background: #e4f0f8; border: 1px solid #b8d6ea; border-radius: 6px; padding: 3px 6px; font-size: 12px; margin-bottom: 3px; cursor: pointer; }
.add-chip { border: 1px dashed var(--line); background: none; border-radius: 6px; width: 100%; color: var(--muted); cursor: pointer; padding: 2px; }
.add-chip:hover { border-color: var(--brand-2); color: var(--brand); }
.pay-table input { width: 92px; text-align: right; padding: 4px; }
.table-wrap { overflow-x: auto; }

/* v1.4 delivery tracker */
a.card.kpi { text-decoration: none; color: inherit; }
a.card.kpi.sel { outline: 2px solid var(--brand-2); }
.share-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.share-box h3 { margin: 0 0 8px; font-size: 14px; }
.share-text { background: #f4f8fb; border-radius: 8px; padding: 10px; font-size: 14px; margin-bottom: 8px; white-space: pre-wrap; }
.check-line { display: flex; gap: 8px; align-items: center; padding: 3px 0; }

/* v1.5 drug dictionary suggestions */
.dict-wrap { position: relative; flex: 1; }
.dict-wrap > input { width: 100%; }
.dict-list { display: none; position: absolute; z-index: 60; left: 0; right: 0; top: 100%; margin-top: 2px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 320px; overflow-y: auto; }
.dict-list.show { display: block; }
.dict-head { padding: 6px 10px; color: var(--muted); background: #f4f8fb; border-bottom: 1px solid var(--line); }
.dict-item { padding: 6px 10px; cursor: pointer; display: flex; flex-direction: column; }
.dict-item.sel, .dict-item:hover { background: #e8f2f9; }
.dict-hint { margin-top: 3px; min-height: 16px; }
.warn-text { color: #9a6b00; }

/* v1.5 POS line buttons and drug information */
.cart-table td.line-acts { white-space: nowrap; text-align: right; }
.cart-table td.line-acts .btn { padding: 3px 7px; margin-left: 2px; }
.cart-table .lb.on { background: #e4f0f8; border-color: #7fb6d6; color: #0b4f7c; font-weight: 700; }
.infodlg .info-sec { border-top: 1px solid var(--line); padding: 8px 0; }
.infodlg .info-sec h3 { margin: 0 0 4px; font-size: 14px; }
.infodlg .info-sec p { margin: 2px 0; }
.info-t { width: 100%; } .info-t th { text-align: left; width: 120px; color: var(--muted); font-weight: 600; vertical-align: top; padding: 2px 0; } .info-t td { padding: 2px 0; }
.info-sec.caution { background: #fff6e0; padding: 8px 10px; border-radius: 8px; border: none; margin: 6px 0; }
.info-sec.preg { padding: 8px 10px; border-radius: 8px; border: none; margin: 6px 0; }
.info-sec.preg.ok { background: #e3f5ec; } .info-sec.preg.warn { background: #fff6e0; } .info-sec.preg.bad { background: #fde8e8; }

/* v1.5 receive: product editor and invoice review */
.price-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; background: #f4f8fb; border-radius: 8px; padding: 8px; margin: 6px 0; }
.price-grid .field { margin: 0; }
a.pname { color: inherit; text-decoration: none; } a.pname:hover b { text-decoration: underline; color: var(--brand); }
/* v1.6: the invoice review uses (almost) the whole screen, with large fields */
dialog.reviewdlg[open] { width: 98vw; max-width: 98vw; height: 94vh; max-height: 94vh; display: flex; flex-direction: column; padding: 18px 22px; }
.rv-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rv-head { display: grid; grid-template-columns: 2.2fr 1.2fr 1.1fr 0.8fr 0.9fr 0.9fr; gap: 10px; margin: 12px 0 6px; }
.rv-head input, .rv-table input { height: 40px; font-size: 15px; padding: 6px 10px; }
.rv-head .field { margin: 0; }
.rv-box { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; }
.rv-table { width: 100%; min-width: 1150px; table-layout: fixed; border-collapse: collapse; }
.rv-table thead th { position: sticky; top: 0; background: #f4f8fb; z-index: 2; padding: 10px 8px; font-size: 13px; }
.rv-table td { vertical-align: top; padding: 10px 8px; border-top: 1px solid var(--line); font-size: 14px; }
.rv-table td.desc { white-space: normal; word-break: break-word; }
.rv-table td.desc b { font-size: 15px; }
.rv-table input { width: 100%; }
.rv-table input[type=checkbox] { width: 18px; height: 18px; }
.rv-table .cands { margin-top: 6px; line-height: 1.7; font-size: 13px; }
.rv-table .cands a { display: inline-block; background: #eef6f3; border-radius: 6px; padding: 1px 8px; margin: 0 4px 3px 0; text-decoration: none; }
.rv-table .cands a.new { background: #e4f0f8; font-weight: 700; }
.rv-table tr.done { background: #f3faf6; color: var(--muted); }
.rv-foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-top: 12px; }
.rv-match { display: flex; gap: 8px; align-items: center; border-left: 5px solid #ccc; padding-left: 8px; }
.rv-match.ok { border-color: #1f9d55; } .rv-match.warn { border-color: #d69e2e; } .rv-match.bad { border-color: #c53030; }
.msg-line { min-height: 20px; margin: 6px 0; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #b8d6ea; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.tline { cursor: pointer; } .tline.sel { background: #e8f2f9; }

/* v1.5 voice at the till */
.btn.mic { white-space: nowrap; }
.btn.mic.live { background: #fde8e8; border-color: #e53e3e; color: #9b2c2c; animation: micpulse 1.6s ease-in-out infinite; }
@keyframes micpulse { 50% { box-shadow: 0 0 0 4px rgba(229,62,62,.18); } }
.voice-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; margin-top: 6px; background: #f4f8fb; border-radius: 8px; font-size: 13px; }
.vs-label { font-weight: 700; } .vs-text { color: var(--muted); max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vs-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip { border-radius: 999px; padding: 4px 10px; border: 1px solid var(--line); background: #fff; font-size: 13px; }
.chip.ok { border-color: #7fb6d6; background: #e4f0f8; cursor: pointer; font-weight: 600; } .chip.ok:disabled { opacity: .5; }
.chip.warn { border-color: #f0d58a; background: #fff6e0; } .chip.grey { background: #eef2f5; color: #4a5a55; }
.chip small { font-weight: 400; color: var(--muted); }
dialog[style*="width"] { max-width: 96vw; }
a.pname b { border-bottom: 1px dashed #8fb8ab; }

/* v1.6 receive cart prices */
.rcv-table input[data-f=mk] { width: 70px; } .rcv-table input[data-f=sell] { width: 90px; }
.rcv-table input.chg { background: #fff6e0; border-color: #e0b84a; font-weight: 700; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #c53030; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.badge[hidden] { display: none; }
/* <dialog> fallback for older Safari */
dialog.dlg-fallback:not([open]) { display: none; }
dialog.dlg-fallback[open] { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 1000; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }

/* v2.2: the unit (form) each quantity and price stands for */
.qu { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; }
.qu .u { font-size: 11px; color: var(--muted); white-space: nowrap; min-width: 34px; text-align: left; }
.u-tag { font-size: 11px; color: var(--muted); margin-left: 2px; white-space: nowrap; }

/* v2.3 receive cart: supplier's invoice | in the shop */
.rcv2 { min-width: 1280px; }
.rcv2 tr.grp th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: none; }
.rcv2 th.g-sup, .rcv2 td.g-sup { background: #f4f7fb; }
.rcv2 th.g-shop, .rcv2 td.g-shop { background: #eef6fb; }
.rcv2 tr.grp th.g-sup { color: #33506e; border-top: 3px solid #9fb6cf; text-align: center; }
.rcv2 tr.grp th.g-shop { color: #1f6b4a; border-top: 3px solid #8fc8aa; text-align: center; }
.rcv2 input[data-f=qty], .rcv2 input[data-f=ps] { width: 70px; } .rcv2 input[data-f=cost] { width: 88px; }
.rcv2 input[data-f=ps].chg { background: #fff6e0; border-color: #e0b84a; font-weight: 700; }
.rcv2 td.nm { min-width: 170px; }
.rcv-cart .cart { overflow-x: auto; }
.rcv-cart .rcv2 thead tr.grp th { top: 0; z-index: 2; } .rcv-cart .rcv2 thead tr:nth-child(2) th { top: 27px; z-index: 2; }
.rcv-cart .rcv2 th.g-sup { background: #f4f7fb; } .rcv-cart .rcv2 th.g-shop { background: #eef6fb; }

/* v2.5 Aegean theme: deep Aegean blue sidebar fading to open sea, a turquoise marker on the current page */
.side { background: linear-gradient(180deg, #0a2a42 0%, #0b3656 55%, #0d4466 100%); }
.side a.on { background: #134a70; box-shadow: inset 3px 0 0 #3fb6d3; }
.brand svg rect, .brand svg circle { transition: none; }
.top { box-shadow: 0 1px 0 #e3ecf3; }
.btn.primary { background: var(--brand); border-color: var(--brand); }
.btn.primary:hover { background: #0d5d91; border-color: #0d5d91; }
.card.kpi.sel, .kpi.sel { border-color: var(--brand-2); box-shadow: 0 0 0 2px rgba(22,119,168,.15); }

/* v2.6 360si brand */
.si-word { font-family: "Poppins", "Montserrat", "Segoe UI", system-ui, -apple-system, Arial, sans-serif; font-weight: 800;
           letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.si-word b { color: #fff; font-weight: 800; } .si-word i { font-style: normal; color: #4cc9e6; text-shadow: 0 0 14px rgba(76,201,230,.35); }
.si-word.light b { color: #0b2c47; } .si-word.light i { color: #1a8fc4; text-shadow: none; }
.brand { gap: 10px; padding: 2px 6px 16px; }
.brand .si-mark { filter: drop-shadow(0 0 6px rgba(63,182,211,.35)); }
.brand-txt { display: flex; flex-direction: column; gap: 3px; } .brand-txt .si-word { font-size: 22px; }
.brand-txt small { font-size: 7.6px; letter-spacing: .08em; white-space: nowrap; text-transform: uppercase; color: #8fc3dc; font-weight: 600; }
.si-login .login-wrap { background: radial-gradient(ellipse at 30% 35%, rgba(63,182,211,.22), transparent 55%),
                        radial-gradient(ellipse at 80% 80%, rgba(27,95,174,.35), transparent 60%), linear-gradient(135deg, #071f33, #0b3656 60%, #0d4466); }
.si-login .login { border-top: 4px solid #2aa3d4; }
.si-login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.si-login-brand .si-word { font-size: 34px; }
.si-tag { font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: #4a6a82; font-weight: 700; margin-top: 4px; }
