/* ==========================================================================
   VOLIARE POS · v16 "Reference Exact" stylesheet
   One clean layer. No stacked overrides. Tokens first, then layout, then
   components, then pages, then responsive rules, then print.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root{
  color-scheme:light;
  --primary:#2563eb;        /* blue-600 */
  --primary-hover:#1d4ed8;  /* blue-700 */
  --primary-soft:#eff6ff;   /* blue-50  */
  --primary-line:#bfdbfe;   /* blue-200 */
  --success:#059669;        /* emerald-600 */
  --success-soft:#ecfdf5;
  --discount:#e11d48;       /* rose/pink-red */
  --discount-soft:#fdf2f8;
  --warning:#d97706;        /* amber-600 */
  --warning-soft:#fffbeb;
  --warning-line:#fde68a;
  --surface:#ffffff;
  --surface-muted:#f4f4f5;  /* zinc-100 page background */
  --surface-sunk:#fafafa;   /* zinc-50 table heads, inputs */
  --border:#e4e4e7;         /* zinc-200 */
  --border-strong:#d4d4d8;  /* zinc-300 */
  --text:#18181b;           /* zinc-900 */
  --text-soft:#3f3f46;      /* zinc-700 */
  --text-muted:#71717a;     /* zinc-500 */
  --dark-panel:#18181b;     /* POS cart */
  --dark-line:#2e2e33;
  --dark-muted:#a1a1aa;
  --black:#09090b;
  --radius:14px;
  --radius-sm:10px;
  --shadow:0 1px 2px rgba(16,24,40,.04),0 1px 3px rgba(16,24,40,.03);
  --shadow-lg:0 18px 40px -12px rgba(16,24,40,.18);
  --side-w:208px;
  --head-h:92px;
  --cart-w:345px;
  --font:"Cairo",Tahoma,system-ui,sans-serif;
}

/* ---------- 2. Base ---------- */
*{box-sizing:border-box}
[hidden]{display:none!important}
html,body{margin:0;min-height:100%}
html{background:var(--surface-muted);scrollbar-width:thin;scrollbar-color:var(--border-strong) transparent}
body{background:var(--surface-muted);color:var(--text);font-family:var(--font);font-size:14px;line-height:1.55;-webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent;overflow-x:hidden}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
h1,h2,h3{margin:0;color:var(--text)}
:focus-visible{outline:2px solid var(--primary);outline-offset:2px}
::selection{background:var(--primary);color:#fff}
::-webkit-scrollbar{width:6px;height:6px}
::-webkit-scrollbar-thumb{background:var(--border-strong);border-radius:99px}
.num{font-variant-numeric:tabular-nums}
.sub{color:var(--text-muted);font-size:12.5px}
.cur{font-size:.55em;font-weight:600;color:var(--text-muted);margin-inline-start:6px}
.profit{color:var(--success);font-weight:800}
.neg{color:var(--discount);font-weight:800}
.was{text-decoration:line-through;color:var(--text-muted);font-size:.85em;margin-inline-start:6px}
.empty{text-align:center;color:var(--text-muted);padding:28px 12px;border:1.5px dashed var(--border-strong);border-radius:var(--radius);background:var(--surface)}

/* ---------- 3. Form controls & buttons ---------- */
label{display:flex;flex-direction:column;gap:6px;font-size:12.5px;font-weight:600;color:var(--text-soft)}
input,select,textarea{width:100%;min-width:0;height:42px;padding:0 12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius-sm);transition:border-color .15s,box-shadow .15s}
input[type=checkbox]{width:17px;height:17px;padding:0;accent-color:var(--primary)}
input[type=file]{height:auto}
input:hover,select:hover{border-color:var(--border-strong)}
input:focus,select:focus{outline:none;border-color:var(--primary);box-shadow:0 0 0 3px rgba(37,99,235,.12)}
select{appearance:none;-webkit-appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2318181b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:14px;background-position:left 14px center;padding-inline-end:36px}
[dir=ltr] select{background-position:right 14px center}
.row{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:11px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;height:42px;padding:0 18px;border:1px solid var(--primary);border-radius:var(--radius-sm);background:var(--primary);color:#fff;font-weight:700;font-size:14px;white-space:nowrap;transition:background .15s,border-color .15s,transform .1s}
.btn:hover:not(:disabled){background:var(--primary-hover);border-color:var(--primary-hover)}
.btn:active:not(:disabled){transform:scale(.99)}
.btn:disabled{opacity:.45;cursor:not-allowed}
.btn.ghost{background:var(--surface);border-color:var(--border);color:var(--text)}
.btn.ghost:hover:not(:disabled){background:var(--surface-sunk);border-color:var(--border-strong)}
.btn.soft{background:var(--primary-soft);border-color:var(--primary-soft);color:var(--primary)}
.btn.soft:hover:not(:disabled){background:#dbeafe;border-color:#dbeafe}
.btn.danger{background:var(--discount);border-color:var(--discount)}
.btn.small{height:34px;padding:0 12px;font-size:12.5px;border-radius:9px}
.btn.block{width:100%}
.link{background:none;border:0;padding:4px 6px;color:var(--text-muted);font-size:12.5px;text-decoration:underline;text-underline-offset:3px}
.link:hover{color:var(--text)}
.iconbtn{display:grid;place-items:center;width:40px;height:40px;padding:0;border:1px solid var(--border);border-radius:12px;background:var(--surface-sunk);color:var(--text);font-size:15px}
.iconbtn:hover{border-color:var(--border-strong);background:#fff}
.lang{display:grid;place-items:center;min-width:40px;height:40px;padding:0 8px;border:1px solid var(--border);border-radius:12px;background:var(--surface-sunk);font-weight:800;font-size:12.5px;letter-spacing:.04em}
.lang:hover{border-color:var(--border-strong);background:#fff}
.seg{display:flex;border:1px solid var(--border);border-radius:var(--radius-sm);overflow:hidden;background:var(--surface)}
.seg input,.seg select{border:0;border-radius:0;box-shadow:none}
.seg button{border:0;border-inline-start:1px solid var(--border);background:var(--surface-sunk);padding:0 12px;font-weight:700;white-space:nowrap}
.seg .unit{width:auto;flex:0 0 auto;border-inline-start:1px solid var(--border);background-color:var(--surface-sunk)}
.check{flex-direction:row;align-items:center;gap:8px;color:var(--text);font-size:13px;cursor:pointer}
.chip{height:34px;padding:0 14px;border:1px solid var(--border);border-radius:99px;background:var(--surface);color:var(--text-soft);font-weight:700;font-size:12.5px;white-space:nowrap}
.chip:hover{border-color:var(--border-strong);color:var(--text)}
.chip[aria-pressed=true],.chip.active{background:var(--primary);border-color:var(--primary);color:#fff}
.chips{display:flex;gap:8px;flex-wrap:wrap;align-items:center}

/* ---------- 4. Cards & generic blocks ---------- */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:18px;display:flex;flex-direction:column;gap:13px;box-shadow:var(--shadow)}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.card-head h2{font-size:16px;font-weight:800}
.card-head .ico{display:grid;place-items:center;width:38px;height:38px;border-radius:50%;background:var(--surface-muted);color:var(--text-soft);flex:0 0 auto}
.table-wrap{border:1px solid var(--border);border-radius:var(--radius-sm);overflow-x:auto}
table.tbl{width:100%;border-collapse:collapse;font-size:13px}
.tbl th{height:44px;padding:0 12px;background:var(--surface-sunk);color:var(--text-soft);font-weight:700;font-size:12.5px;text-align:center;white-space:nowrap;border-bottom:1px solid var(--border)}
.tbl td{padding:12px;text-align:center;border-bottom:1px solid #f0f0f2;white-space:nowrap;color:var(--text-soft)}
.tbl tr:last-child td{border-bottom:0}
.tbl th:first-child,.tbl td:first-child{text-align:start}
.tbl tbody tr:hover td{background:#fcfcfd}
.tbl .cur{font-size:11px;margin-inline-start:4px}
.badge{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border-radius:99px;font-size:12px;font-weight:700;white-space:nowrap;border:1px solid transparent}
.badge.ok{background:var(--success-soft);color:var(--success);border-color:#a7f3d0}
.badge.low{background:var(--warning-soft);color:var(--warning);border-color:var(--warning-line)}
.badge.out{background:#fff1f2;color:var(--discount);border-color:#fecdd3}
.badge.neutral{background:var(--surface-muted);color:var(--text-soft);border-color:var(--border)}
.badge.blue{background:var(--primary-soft);color:var(--primary);border-color:var(--primary-line)}
.sku{display:inline-block;direction:ltr;unicode-bidi:isolate;font-size:11px;font-weight:600;letter-spacing:.03em;color:var(--text-muted);white-space:nowrap}
.sku.big{font-size:13px;padding:3px 10px;border-radius:7px;background:var(--black);color:#fff}
.pill{font-size:11.5px;padding:3px 10px;border-radius:99px;white-space:nowrap;font-weight:700;border:1px solid transparent}
.pill.ok{background:var(--success-soft);color:var(--success);border-color:#a7f3d0}
.pill.low{background:var(--warning-soft);color:var(--warning);border-color:var(--warning-line)}
.pill.out{background:#fff1f2;color:var(--discount);border-color:#fecdd3}
.tag{display:inline-block;font-size:10.5px;font-weight:700;padding:1px 8px;border-radius:99px;background:var(--primary-soft);color:var(--primary);margin-inline-start:6px}
.actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.toast{position:fixed;inset-inline:16px;bottom:calc(18px + env(safe-area-inset-bottom,0px));max-width:420px;margin:0 auto;background:var(--black);color:#fff;padding:12px 16px;border-radius:12px;font-weight:700;text-align:center;z-index:200;box-shadow:var(--shadow-lg)}
.demo,.bio-offer{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:10px 14px;font-size:13.5px;margin-bottom:14px}
.bio-offer .fp{width:24px;height:24px;flex:0 0 auto;color:var(--primary)}
.bio-offer>span{flex:1 1 200px}

/* ---------- 5. Login & lock ---------- */
.login{min-height:100dvh;display:grid;place-items:center;padding:24px 16px;background:var(--surface-muted)}
.login-card{width:100%;max-width:400px;display:flex;flex-direction:column;gap:14px;background:var(--surface);border:1px solid var(--border);border-radius:18px;padding:28px 26px;box-shadow:var(--shadow-lg)}
.login-top{display:flex;justify-content:flex-end}
.login-brand{display:flex;flex-direction:column;align-items:center;gap:4px;margin:2px 0 10px}
.login-brand .logo{height:38px}
.login-brand .sub{font-size:13px}
.login-card .err{color:var(--discount);font-size:13px;min-height:1.2em}
.login-card .btn{height:46px;font-size:15px}
.pass-wrap{position:relative}
/* password field is always LTR text, so the eye is pinned to the physical right in both AR and EN */
.pass-wrap input{padding-right:48px;padding-left:12px}
.pass-eye{position:absolute;right:6px;left:auto;display:grid;place-items:center;top:50%;transform:translateY(-50%);width:34px;height:34px;border:0;border-radius:8px;background:transparent;color:var(--text-muted)}
.pass-eye:hover{background:var(--surface-muted);color:var(--text)}
.remember-row{flex-direction:row;align-items:center;gap:8px;font-weight:600;color:var(--text-soft);cursor:pointer}
#lockCard{align-items:center;text-align:center}
.fp-btn{display:flex;flex-direction:column;align-items:center;gap:10px;border:0;background:transparent;color:var(--primary);font-weight:700;font-size:15px;padding:16px;border-radius:16px}
.fp-btn .fp{width:70px;height:70px}
.fp-btn:hover{background:var(--primary-soft)}

/* ---------- 6. App shell ---------- */
.shell{display:grid;grid-template-columns:var(--side-w) minmax(0,1fr);min-height:100dvh;direction:ltr}
.main{grid-column:2;min-width:0}
.wrap{min-width:0}
.content{padding:22px 22px 32px;min-width:0}

/* Sidebar */
.app-sidebar{grid-column:1;grid-row:1;position:sticky;top:0;height:100dvh;display:flex;flex-direction:column;background:var(--surface-muted);border-inline-end:1px solid var(--border);padding:20px 11px 18px;direction:ltr;z-index:30}
.side-logo{width:58px;height:58px;margin:0 0 28px 28px;border-radius:12px;background:var(--black);color:#fff;display:grid;place-items:center;font-family:"Plus Jakarta Sans",var(--font);font-weight:800;font-size:27px;flex:0 0 auto;box-shadow:0 8px 18px -10px rgba(0,0,0,.6)}
.side-nav{display:flex;flex-direction:column;gap:6px;flex:1;overflow-y:auto;min-height:0}
.side-nav-btn{display:flex;align-items:center;gap:14px;height:50px;padding:0 20px;border:0;border-radius:12px;background:transparent;color:var(--text-soft);font-weight:700;font-size:15.5px;text-align:start;direction:ltr;white-space:nowrap;transition:background .15s,color .15s}
.side-nav-btn i{width:22px;text-align:center;font-size:19px;color:#3f3f46;flex:0 0 auto}
.side-nav-btn:hover{background:#e9e9ec;color:var(--text)}
.side-nav-btn.active{background:var(--primary);color:#fff;box-shadow:0 10px 20px -12px rgba(37,99,235,.8)}
.side-nav-btn.active i{color:#fff}
.side-logout{display:flex;align-items:center;justify-content:center;gap:12px;height:48px;margin-top:12px;border:1px solid var(--border);border-radius:12px;background:var(--surface);color:var(--text-soft);font-weight:700;font-size:15px;flex:0 0 auto}
.side-logout:hover{border-color:var(--border-strong);color:var(--text)}
.side-logout i{font-size:17px}
.nav-scrim{display:none}

/* Header */
.topbar{position:sticky;top:0;z-index:25;display:flex;align-items:center;justify-content:space-between;gap:16px;height:var(--head-h);padding:0 36px;background:var(--surface);box-shadow:0 1px 0 var(--border),0 6px 18px -16px rgba(0,0,0,.25)}
.brand-block{display:flex;flex-direction:column;align-items:flex-start;gap:2px;min-width:0}
.brand-line{display:flex;align-items:flex-end;gap:10px;direction:ltr}
.brand-line .logo{height:36px;width:auto;color:var(--black);display:block}
.pos-mark{font-family:"Plus Jakarta Sans",var(--font);font-weight:800;font-size:25px;line-height:1;color:var(--primary);letter-spacing:.02em}
.brand-sub{font-size:13.5px;color:var(--text-muted);font-weight:600}
.top-actions{display:flex;align-items:center;gap:14px;min-width:0}
.top-user{display:flex;align-items:center;gap:10px;min-width:0}
.top-user-avatar{display:grid;place-items:center;width:40px;height:40px;border-radius:50%;background:var(--surface-muted);color:var(--text-soft);flex:0 0 auto}
.top-user-copy{display:flex;flex-direction:column;line-height:1.25;min-width:0}
.top-user-copy b{font-size:15px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:170px}
.top-user-copy small{font-size:12px;color:var(--text-muted)}
.sync-pill{direction:ltr;display:inline-flex;align-items:center;gap:9px;height:40px;padding:0 18px;border:1px solid var(--primary-line);border-radius:99px;background:var(--primary-soft);color:var(--primary);font-size:13px;font-weight:600;white-space:nowrap}
.sync-pill i{width:8px;height:8px;border-radius:50%;background:var(--primary);display:inline-block;flex:0 0 auto}
.sync-pill.pending{border-color:var(--warning-line);background:var(--warning-soft);color:var(--warning)}
.sync-pill.pending i{background:var(--warning)}
.sync-pill.off{border-color:#fecdd3;background:#fff1f2;color:var(--discount)}
.sync-pill.off i{background:var(--discount)}
.nav-toggle{display:none}

/* Page title */
.page-titlebar{display:flex;align-items:flex-end;justify-content:space-between;gap:12px;margin:2px 4px 18px}
.page-titlebar h1{font-size:26px;font-weight:800;line-height:1.3}
.page-titlebar p{margin:2px 0 0;color:var(--text-muted);font-size:14px}
.title-actions{display:flex;gap:8px}
.title-log{display:none}
body[data-tab=sales] .title-log{display:inline-flex}
body[data-tab=sell] #pageTitlebar{display:none}
section.panel{display:flex;flex-direction:column;gap:16px;min-width:0}

/* ---------- 7. KPI cards (shared by sales / dashboard / reports) ---------- */
.kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.kpi{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:112px;padding:16px 22px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);min-width:0}
.kpi-copy{display:flex;flex-direction:column;gap:4px;min-width:0}
.kpi-label{font-size:14px;font-weight:600;color:var(--text-soft);white-space:nowrap}
.kpi-value{display:flex;align-items:baseline;flex-wrap:wrap;font-size:36px;font-weight:800;line-height:1.15;color:var(--text);letter-spacing:-.01em}
.kpi-value .cur{font-size:16px;color:var(--text-soft);font-weight:600}
.kpi-note{font-size:12px;color:var(--text-muted)}
.kpi-icon{display:grid;place-items:center;width:64px;height:64px;border-radius:50%;background:var(--surface-muted);color:var(--text-soft);font-size:23px;flex:0 0 auto}
.kpi.blue .kpi-label,.kpi.blue .kpi-value{color:var(--primary)}
.kpi.blue .kpi-icon{background:var(--primary-soft);color:var(--primary)}
.kpi.pink .kpi-value{color:var(--discount)}
.kpi.pink .kpi-icon{background:#fde7ef;color:var(--discount)}
.kpi.green .kpi-icon{background:var(--success-soft);color:var(--success)}
.kpi.green .kpi-value .profit{color:var(--text)}
.kpi.green .kpi-value .neg{color:var(--discount)}
.kpi.amber .kpi-icon{background:var(--warning-soft);color:var(--warning)}

/* ---------- 8. Sales page ---------- */
.toolbar{display:flex;align-items:center;gap:12px;padding:12px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow)}
.search{position:relative;flex:1 1 320px;min-width:0}
.search i{position:absolute;inset-inline-start:15px;top:50%;transform:translateY(-50%);color:var(--text-soft);font-size:15px;pointer-events:none}
.search input{height:44px;padding-inline-start:42px}
.toolbar select{height:44px;flex:0 0 140px;width:140px}
.date-filter{position:relative;flex:0 0 140px;width:140px;display:block}
.date-filter i{position:absolute;inset-inline-start:13px;top:50%;transform:translateY(-50%);color:var(--text-soft);pointer-events:none;z-index:1}
.date-filter input{height:44px;padding-inline-start:36px;padding-inline-end:8px;font-size:13px;cursor:pointer}
.date-filter .ph{position:absolute;inset-inline-start:36px;top:50%;transform:translateY(-50%);color:var(--text-muted);font-size:13px;font-weight:500;pointer-events:none}
.date-filter input[data-empty]:not(:focus){color:transparent}
.date-filter input:not([data-empty])+.ph,.date-filter input:focus+.ph{display:none}
.date-filter input::-webkit-calendar-picker-indicator{opacity:0;position:absolute;inset:0;width:100%;height:100%;cursor:pointer}
.toolbar .btn{height:44px;min-width:116px;font-size:15px}

.invoice-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);padding:16px 16px 0;box-shadow:var(--shadow);overflow:hidden}
.invoice-head{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:2px 2px 14px}
.inv-id{display:flex;align-items:center;gap:8px;font-size:19px;font-weight:800;color:var(--text);direction:ltr;justify-content:flex-end}
[dir=ltr] .inv-id{justify-content:flex-end;flex-direction:row-reverse}
.inv-id i{font-size:17px}
.inv-meta{font-size:13px;color:var(--text-muted);margin-top:2px}
.inv-side{display:flex;align-items:center;gap:16px}
.inv-total{font-size:28px;font-weight:800;color:var(--text);white-space:nowrap}
.inv-total .cur{font-size:15px;color:var(--text-soft)}
.inv-print{height:46px;padding:0 20px;font-size:15px;border-radius:12px}
.inv-lines td{height:68px}
.inv-lines .p-name{font-weight:800;color:var(--text);font-size:13px}
.inv-lines .p-sub{font-size:12px;color:var(--text-muted);margin-top:2px}
.inv-lines .t-total{font-weight:800;color:var(--text)}
.inv-lines .t-profit{font-weight:800;color:var(--primary)}
.inv-lines .t-profit.neg{color:var(--discount)}
.inv-lines .t-profit .cur,.inv-lines .t-profit.neg .cur{color:inherit}
.invoice-foot{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));margin:14px -16px 0;border-top:1px solid var(--border)}
.foot-cell{display:flex;align-items:center;gap:14px;padding:16px 26px;min-width:0}
.foot-cell+.foot-cell{border-inline-start:1px solid var(--border)}
.foot-ico{display:grid;place-items:center;width:46px;height:46px;border-radius:50%;background:var(--surface-muted);color:var(--text-soft);font-size:18px;flex:0 0 auto}
.foot-cell>div>span{display:block;font-size:13px;color:var(--text-muted);font-weight:600}
.foot-cell>div>b{display:block;font-size:24px;font-weight:800;line-height:1.25;white-space:nowrap}
.foot-cell b .cur{font-size:13px;color:inherit;opacity:.85}
.foot-cell.blue .foot-ico{background:var(--primary-soft);color:var(--primary)}
.foot-cell.blue b{color:var(--primary)}
.foot-cell.pink .foot-ico{background:#fde7ef;color:var(--discount)}
.foot-cell.pink b{color:var(--discount)}
.foot-cell.green .foot-ico{background:var(--success-soft);color:var(--success)}
.foot-cell.green b{color:var(--success)}
.foot-cell.green b.neg{color:var(--discount)}
.sales-note{padding:10px 2px 14px;font-size:12.5px;color:var(--text-muted)}
.sales-list{display:flex;flex-direction:column;gap:16px}

/* ---------- 9. POS ---------- */
.pos-layout{display:grid;grid-template-columns:minmax(0,1fr) var(--cart-w);grid-template-areas:"products cart";gap:18px;align-items:start;direction:ltr}
.pos-products{grid-area:products;direction:rtl;display:flex;flex-direction:column;gap:16px;min-width:0}
.pos-head h1{font-size:26px;font-weight:800}
.pos-head p{margin:2px 0 0;color:var(--text-muted);font-size:14px}
.pos-toolbar{flex-wrap:wrap}
.pos-toolbar .search{flex:1 1 280px}
.pos-cats{display:flex;gap:8px;flex-wrap:wrap}
.pos-cat{height:40px;padding:0 16px;border:1px solid var(--border);border-radius:10px;background:var(--surface);font-weight:700;font-size:13.5px;color:var(--text-soft);white-space:nowrap}
.pos-cat:hover{border-color:var(--border-strong);color:var(--text)}
.pos-cat.active{background:var(--primary);border-color:var(--primary);color:#fff}
.pos-cat .cc{font-size:11.5px;opacity:.75;margin-inline-start:6px}
.pos-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(196px,1fr));gap:12px}
.pos-item{position:relative;display:flex;flex-direction:column;align-items:stretch;gap:8px;padding:14px;border:1px solid var(--border);border-radius:var(--radius);background:var(--surface);text-align:start;box-shadow:var(--shadow);transition:border-color .15s,box-shadow .15s,transform .15s;min-width:0}
.pos-item:hover:not(:disabled){border-color:var(--primary-line);box-shadow:0 10px 24px -16px rgba(37,99,235,.55);transform:translateY(-1px)}
.pos-item:disabled{opacity:.5;cursor:not-allowed}
.pos-item .pi{display:grid;place-items:center;height:84px;border-radius:10px;background:var(--surface-sunk);border:1px solid #f0f0f2;color:var(--text-soft);font-size:30px}
.pos-item .pn{font-weight:800;font-size:13.5px;line-height:1.4;color:var(--text);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;min-height:2.8em}
.pos-item .pc{font-size:12px;color:var(--text-muted)}
.pos-item .pp{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.pos-item .pp strong{font-size:18px;font-weight:800;color:var(--primary)}
.pos-item .pp strong .cur{color:var(--primary)}
.pos-item .pp s{font-size:12.5px;color:var(--text-muted)}
.pos-item .pf{display:flex;align-items:center;justify-content:space-between;gap:8px}
.pos-item .padd{display:grid;place-items:center;width:32px;height:32px;border-radius:9px;background:var(--primary);color:#fff;font-size:13px}
.pos-item .poffer{position:absolute;top:20px;inset-inline-start:20px}

.pos-cart{grid-area:cart;position:sticky;top:calc(var(--head-h) + 12px);display:flex;flex-direction:column;height:calc(100dvh - var(--head-h) - 26px);min-height:520px;background:var(--dark-panel);color:#fff;border-radius:16px;padding:18px 16px 16px;direction:rtl;box-shadow:var(--shadow-lg);z-index:20}
[dir=ltr] .pos-cart,[dir=ltr] .pos-products{direction:ltr}
.cart-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:4px 2px 14px;border-bottom:1px solid var(--dark-line)}
.cart-head h2{color:#fff;font-size:17px;font-weight:800}
.cart-ico{position:relative;display:flex;align-items:center;gap:8px;font-size:19px;direction:ltr}
.cart-badge{display:grid;place-items:center;min-width:22px;height:22px;padding:0 6px;border-radius:99px;background:var(--primary);color:#fff;font-size:12px;font-weight:800}
.cart-tools{display:flex;align-items:center;gap:10px;padding:12px 0 4px}
.cart-tools select{height:38px;background-color:#232327;border-color:var(--dark-line);color:#fff;font-size:12.5px;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}
.cart-tools select:focus{border-color:var(--primary)}
.cart-tools .link{color:var(--dark-muted);white-space:nowrap}
.cart-tools .link:hover{color:#fff}
.cart-close{display:none;background:none;border:0;color:#fff;font-size:18px;padding:4px 8px}
.pos-cart-list{flex:1;overflow-y:auto;min-height:0;margin:0 -6px;padding:4px 6px;scrollbar-color:#3f3f46 transparent}
.pos-cart-list .empty{background:transparent;border-color:var(--dark-line);color:var(--dark-muted);margin-top:14px}
.cart-line{display:grid;grid-template-columns:66px minmax(0,1fr) auto;gap:12px;align-items:center;padding:12px 0;border-bottom:1px solid #232327}
.cart-line:last-child{border-bottom:0}
.cl-img{display:grid;place-items:center;width:66px;height:66px;border-radius:10px;background:#fff;color:var(--text);font-size:26px}
.cl-info{display:flex;flex-direction:column;gap:1px;min-width:0}
.cl-info b{font-size:13.5px;font-weight:800;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-transform:uppercase}
.cl-info span{font-size:13px;color:#e4e4e7;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cl-info em{font-style:normal;font-size:15px;font-weight:800;color:#3b82f6}
.cl-info em .cur{color:#3b82f6}
.cl-info small{font-size:11px;color:var(--dark-muted)}
.cl-side{display:flex;flex-direction:column;align-items:flex-end;gap:8px}
[dir=rtl] .cl-side{align-items:flex-start}
.cart-remove{display:grid;place-items:center;width:28px;height:28px;border:0;border-radius:8px;background:transparent;color:#d4d4d8;font-size:14px}
.cart-remove:hover{background:#2a2a2f;color:#fb7185}
.cart-qty{display:flex;align-items:center;gap:8px;direction:ltr}
.cart-qty button{display:grid;place-items:center;width:28px;height:28px;border:0;border-radius:7px;background:#fff;color:var(--text);font-size:19px;font-weight:800;line-height:1}
.cart-qty button:hover{background:#e4e4e7}
.cart-qty span{min-width:18px;text-align:center;font-weight:700}
.cart-summary{border-top:1px solid var(--dark-line);padding-top:12px;display:flex;flex-direction:column;gap:4px}
.cart-sum{display:flex;align-items:center;justify-content:space-between;gap:10px;height:34px;font-size:14px;color:#f4f4f5}
.cart-sum b{font-weight:700;color:#fff}
.cart-sum b .cur{color:#fff;font-size:12px}
.cart-sum.blue b,.cart-sum.blue b .cur{color:#3b82f6}
.cart-final{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:8px;padding-top:14px;border-top:1px solid var(--dark-line)}
.cart-final>span{font-size:18px;font-weight:800}
.cart-final b{font-size:34px;font-weight:800;color:#3b82f6;line-height:1.1}
.cart-final b .cur{font-size:16px;color:#3b82f6}
.checkout{margin-top:14px;height:54px;width:100%;font-size:16px;border-radius:12px}
.cart-fab{display:none}

/* ---------- 10. Products ---------- */
.prod-layout{display:grid;grid-template-columns:minmax(0,1fr) 380px;gap:18px;align-items:start}
.prod-form{position:sticky;top:calc(var(--head-h) + 16px)}
.prod-form .btn{height:44px}
.details,.offer-ed{display:grid;gap:10px}
.offer-ed{padding:12px;border:1px dashed var(--border-strong);border-radius:var(--radius-sm);background:var(--surface-sunk)}
.offer-ed .offer-ed{padding:0;border:0;background:transparent}
.sku-prev{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.plist{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:12px}
.prod{display:grid;gap:11px;padding:16px;background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);align-content:start}
.prod:hover{border-color:var(--border-strong)}
.prod-top{display:flex;justify-content:space-between;align-items:flex-start;gap:10px}
.prod-name{font-weight:800;font-size:14.5px;color:var(--text)}
.prod .sku{margin-inline-start:4px}
.prod .sub .profit{color:var(--success)}
.meter{height:6px;background:var(--surface-muted);border-radius:99px;overflow:hidden}
.meter i{display:block;height:100%;background:var(--primary);border-radius:99px}
.kv{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.kv div{display:flex;flex-direction:column;background:var(--surface-sunk);border:1px solid #f0f0f2;border-radius:9px;padding:7px 9px;min-width:0}
.kv .k{font-size:11px;color:var(--text-muted)}
.kv .v{font-weight:800;font-size:13.5px}
.edit{border-top:1px dashed var(--border-strong);padding-top:12px;display:grid;gap:10px}

/* ---------- 11. Inventory ---------- */
.inv-name{display:flex;align-items:center;gap:10px;font-weight:800;color:var(--text)}
.inv-name .thumb{display:grid;place-items:center;width:38px;height:38px;border-radius:9px;background:var(--surface-muted);color:var(--text-soft);flex:0 0 auto}
.inv-name small{display:block;font-weight:500}
.stock-table td{height:62px}

/* ---------- 12. Sales points & customers ---------- */
.points-grid{display:grid;grid-template-columns:380px minmax(0,1fr);gap:18px;align-items:start}
.point-row{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:12px;align-items:center;padding:12px 4px;border-bottom:1px solid #f0f0f2}
.point-row:last-child{border-bottom:0}
.point-code{font-size:12px;font-weight:700;color:var(--primary);background:var(--primary-soft);border-radius:8px;padding:4px 9px;direction:ltr}
.point-meta{font-size:12px;color:var(--text-muted)}
.cust-toolbar{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
.cust-toolbar .search{flex:1 1 260px}

/* ---------- 13. Dashboard & reports ---------- */
.dash-grid{display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,1fr);gap:16px}
.dash-bars{height:230px;display:flex;align-items:flex-end;gap:14px;padding:12px 6px 0;border-bottom:1px solid var(--border)}
.dash-bar-col{flex:1;height:100%;display:flex;flex-direction:column;justify-content:flex-end;align-items:center;gap:6px}
.dash-bar{width:100%;max-width:54px;background:var(--primary);border-radius:8px 8px 0 0;min-height:3px}
.dash-bar-col small{font-size:11px;color:var(--text-muted)}
.dash-activity{display:flex;flex-direction:column;max-height:300px;overflow:auto}
.dash-event{display:flex;justify-content:space-between;gap:10px;padding:10px 2px;border-bottom:1px solid #f0f0f2;font-size:13px}
.dash-event span{color:var(--text-muted);font-size:12px}
.dash-event .num{color:var(--success);white-space:nowrap}
.live-pill{display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 12px;border-radius:99px;background:var(--primary-soft);color:var(--primary);font-size:11px;font-weight:800;letter-spacing:.06em}
.live-pill i{width:7px;height:7px;border-radius:50%;background:var(--primary)}
.report-two{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
.report-bar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}
.top-sale-row{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:11px 2px;border-bottom:1px solid #f0f0f2}
.top-sale-row:last-child{border-bottom:0}
.top-sale-row .rank{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--surface-muted);font-weight:800;font-size:12px;flex:0 0 auto}
.top-sale-row:first-child .rank{background:var(--primary);color:#fff}
.top-sale-row .grow{flex:1;min-width:0}
.donut-wrap{display:flex;align-items:center;gap:28px;flex-wrap:wrap;justify-content:center;padding:8px 0}
.donut{position:relative;width:190px;height:190px;border-radius:50%;background:var(--surface-muted);flex:0 0 auto}
.donut::after{content:"";position:absolute;inset:34px;border-radius:50%;background:var(--surface)}
.donut-legend{display:flex;flex-direction:column;gap:12px;min-width:200px}
.donut-legend>span{display:flex;align-items:center;gap:10px;font-size:13.5px;font-weight:600}
.donut-legend i{width:12px;height:12px;border-radius:4px;flex:0 0 auto}
.donut-legend b{margin-inline-start:auto;font-weight:800}
.an-chart{position:relative;min-height:210px}
.an-chart svg{display:block;width:100%;height:auto;overflow:visible}
.an-chart .grid{stroke:#f0f0f2}
.an-chart .axis0{stroke:var(--border-strong)}
.an-chart .tick{fill:var(--text-muted);font-size:10.5px;font-family:var(--font)}
.an-chart .bar.pos{fill:var(--success)}
.an-chart .bar.neg{fill:var(--discount)}
.an-chart .hit{fill:transparent}
.an-chart .hover{stroke:var(--border-strong);stroke-dasharray:3 3}
.an-tip{position:absolute;top:0;background:var(--black);color:#fff;border-radius:10px;padding:8px 10px;font-size:12px;pointer-events:none;white-space:nowrap;z-index:2}
.an-tip .neg{color:#fda4af}

/* ---------- 14. Settings & log ---------- */
.settings-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:16px;align-items:start}
.set-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;border-bottom:1px solid #f0f0f2}
.set-row:last-child{border-bottom:0}
.set-row b{font-size:14px}
.set-row .sub{display:block}
.lang-switch{display:flex;gap:8px}
.lang-switch .chip{min-width:84px}
.note{font-size:12.5px;color:var(--text-muted);background:var(--surface-sunk);border:1px solid var(--border);border-radius:10px;padding:10px 12px}
.file-btn{cursor:pointer;flex-direction:row}
.day{display:flex;flex-direction:column;gap:8px;margin-bottom:16px}
.dayhead{display:flex;justify-content:space-between;font-size:13px;font-weight:700;color:var(--text-muted);padding-inline:4px}
.sale{display:grid;grid-template-columns:1fr auto;gap:2px 12px;align-items:center;padding:12px 14px;background:var(--surface);border:1px solid var(--border);border-radius:12px}
.sale .t{font-weight:800}
.sale .a{font-weight:800;text-align:end}
.sale .d{font-size:12px;color:var(--text-muted)}
.sale .x{grid-column:2;justify-self:end}

/* ---------- 15. Mobile simulator drawer ---------- */
.sim-column{position:fixed;top:0;bottom:0;left:var(--side-w);width:340px;z-index:60;display:flex;flex-direction:column;gap:14px;padding:18px;background:var(--surface);border-inline-end:1px solid var(--border);box-shadow:var(--shadow-lg);overflow-y:auto;direction:rtl}
.shell.sim-hidden .sim-column{display:none}
.sim-title{display:flex;align-items:center;justify-content:space-between;gap:8px}
.sim-title strong{display:flex;align-items:center;gap:8px;font-size:14px}
.sim-dot{width:8px;height:8px;border-radius:50%;background:var(--success);display:inline-block}
.mobile-frame{border:8px solid var(--black);border-radius:34px;background:var(--surface-muted);overflow:hidden;display:flex;flex-direction:column;min-height:560px}
.phone-top{background:var(--surface);padding:8px 16px 6px}
.phone-notch{width:90px;height:18px;border-radius:0 0 12px 12px;background:var(--black);margin:-8px auto 6px}
.phone-status{display:flex;justify-content:space-between;font-size:11px;font-weight:700;direction:ltr}
.phone-head{display:flex;align-items:center;justify-content:space-between;padding:10px 14px;background:var(--surface);border-bottom:1px solid var(--border)}
.phone-brand{display:flex;align-items:center;gap:8px;font-size:13px}
.phone-f{display:grid;place-items:center;width:28px;height:28px;border-radius:8px;background:var(--black);color:#fff;font-weight:800;font-size:13px;font-family:"Plus Jakarta Sans",var(--font)}
.phone-sync{font-size:11px;color:var(--primary);background:var(--primary-soft);border-radius:99px;padding:2px 9px;font-weight:700}
.phone-body{flex:1;padding:12px;display:flex;flex-direction:column;gap:12px}
.phone-card{background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:12px;display:flex;flex-direction:column;gap:10px}
.phone-card-head{display:flex;justify-content:space-between;align-items:center;font-size:13px}
.phone-card-head span{font-size:11px;color:var(--text-muted)}
.phone-qty-row{display:flex;justify-content:space-between;align-items:center}
.phone-qty-row b{font-size:20px;font-weight:800}
.phone-step{display:flex;align-items:center;gap:10px;direction:ltr}
.phone-step button{width:32px;height:32px;border-radius:9px;border:1px solid var(--border);background:var(--surface-sunk);font-weight:800}
.phone-action{display:flex;align-items:center;justify-content:center;gap:8px;height:42px;border:0;border-radius:11px;background:var(--primary);color:#fff;font-weight:700}
.phone-stock{display:flex;flex-direction:column;gap:6px;max-height:190px;overflow:auto}
.phone-stock-row{display:flex;justify-content:space-between;gap:8px;font-size:12px;padding:6px 0;border-bottom:1px solid #f0f0f2}
.phone-stock-row b{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.phone-nav{display:flex;justify-content:space-around;padding:10px 6px;background:var(--surface);border-top:1px solid var(--border);font-size:16px;color:var(--text-soft)}
.phone-nav span{display:flex;flex-direction:column;align-items:center;gap:2px}
.phone-nav small{font-size:10px}

/* ---------- 16. Category chips (products / inventory) ---------- */
.cat-strip{display:flex;gap:8px;flex-wrap:wrap}
.cat{display:inline-flex;align-items:center;gap:8px;height:38px;padding:0 14px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text-soft);font-weight:700;font-size:13px}
.cat svg{width:17px;height:17px}
.cat .cc{font-size:11.5px;opacity:.7}
.cat:hover{border-color:var(--border-strong);color:var(--text)}
.cat[aria-pressed=true]{background:var(--primary);border-color:var(--primary);color:#fff}
.side-h{display:none}

/* ---------- 17. Receipt ---------- */
.receipt-bg{position:fixed;inset:0;background:rgba(9,9,11,.5);z-index:150;display:grid;place-items:center;padding:18px}
.receipt-modal{width:min(430px,100%);max-height:92vh;overflow:auto;background:var(--surface);border-radius:18px;padding:18px;box-shadow:var(--shadow-lg)}
.receipt-paper{border:1px solid #ddd;padding:18px;background:#fff;color:#000}
.receipt-brand{text-align:center;border-bottom:1px dashed #999;padding-bottom:10px}
.receipt-brand h2{font-family:"Plus Jakarta Sans",var(--font);letter-spacing:.08em;color:#000}
.receipt-meta{font-size:11px;display:grid;gap:3px;padding:10px 0;border-bottom:1px dashed #aaa}
.receipt-items{width:100%;border-collapse:collapse;font-size:11px}
.receipt-items th,.receipt-items td{padding:7px 3px;border-bottom:1px dotted #ddd;text-align:start}
.receipt-summary{font-size:12px;display:grid;gap:5px;padding-top:10px}
.receipt-summary div{display:flex;justify-content:space-between}
.receipt-summary .grand{font-size:15px;font-weight:800;border-top:1px solid #000;padding-top:7px}
.receipt-actions{display:flex;gap:8px;margin-top:12px}
.receipt-actions .btn{flex:1}

/* ---------- 18. Responsive ---------- */
@media (max-width:1440px){
  .kpi-value{font-size:32px}
  .kpi{padding:16px 18px}
  .kpi-icon{width:56px;height:56px;font-size:21px}
  .foot-cell{padding:14px 18px}
  .foot-cell b{font-size:21px}
}
@media (max-width:1280px){
  :root{--side-w:84px;--cart-w:330px}
  .side-logo{width:50px;height:50px;margin:0 auto 24px;font-size:23px}
  .side-nav-btn{justify-content:center;padding:0;gap:0}
  .side-nav-btn span,.side-logout span{display:none}
  .side-logout{gap:0}
  .topbar{padding:0 22px}
  .kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
  .prod-layout{grid-template-columns:minmax(0,1fr) 340px}
}
@media (max-width:1100px){
  .pos-layout{grid-template-columns:minmax(0,1fr);grid-template-areas:"products"}
  .pos-cart{position:fixed;top:0;bottom:0;right:0;height:auto;min-height:0;width:min(380px,94vw);border-radius:0;z-index:90;transform:translateX(105%);transition:transform .25s ease;visibility:hidden}
  body.cart-open .pos-cart{transform:none;visibility:visible}
  .cart-close{display:block}
  body[data-tab=sell] .cart-fab{display:flex}
  .cart-fab{position:fixed;bottom:calc(18px + env(safe-area-inset-bottom,0px));right:18px;z-index:80;align-items:center;gap:10px;height:54px;padding:0 20px;border:0;border-radius:99px;background:var(--dark-panel);color:#fff;font-weight:800;box-shadow:var(--shadow-lg)}
  .cart-fab b{color:#3b82f6}
  .cart-scrim{position:fixed;inset:0;background:rgba(9,9,11,.45);z-index:85}
  .invoice-foot{grid-template-columns:repeat(2,minmax(0,1fr))}
  .foot-cell:nth-child(3){border-inline-start:0}
  .foot-cell:nth-child(n+3){border-top:1px solid var(--border)}
  .prod-layout,.points-grid,.dash-grid,.report-two{grid-template-columns:minmax(0,1fr)}
  .prod-form{position:static}
  .toolbar{flex-wrap:wrap}
  .toolbar .search{flex-basis:100%}
}
@media (max-width:760px){
  :root{--head-h:64px}
  .shell{grid-template-columns:minmax(0,1fr)}
  .main{grid-column:1}
  .app-sidebar{position:fixed;top:0;bottom:0;left:0;width:248px;height:auto;padding:18px 12px;background:var(--surface);transform:translateX(-105%);transition:transform .25s ease;z-index:95;box-shadow:var(--shadow-lg);visibility:hidden}
  body.nav-open .app-sidebar{transform:none;visibility:visible}
  body.nav-open .nav-scrim{display:block;position:fixed;inset:0;background:rgba(9,9,11,.45);z-index:94}
  .side-logo{margin:0 0 20px 16px}
  .side-nav-btn{justify-content:flex-start;padding:0 16px;gap:14px}
  .side-nav-btn span,.side-logout span{display:inline}
  .side-logout{gap:12px}
  .sim-column{left:0;width:min(340px,100vw)}
  .nav-toggle{display:grid}
  .topbar{padding:0 12px;gap:10px}
  .brand-line .logo{height:24px}
  .pos-mark{font-size:17px}
  .brand-sub,.top-user-copy,.top-user-avatar,#simToggle{display:none}
  .top-actions{gap:8px}
  .sync-pill{height:34px;padding:0 11px}
  .sync-pill span{display:none}
  .lang,.iconbtn{height:36px;min-width:36px;width:auto}
  .content{padding:14px 12px 90px}
  .page-titlebar h1,.pos-head h1{font-size:21px}
  .kpis{gap:10px}
  .kpi{min-height:92px;padding:12px 14px;gap:8px}
  .kpi-value{font-size:24px}
  .kpi-value .cur{font-size:12px}
  .kpi-label{font-size:12.5px;white-space:normal}
  .kpi-icon{width:40px;height:40px;font-size:16px}
  .toolbar select,.date-filter{flex:1 1 calc(50% - 6px);width:auto}
  .toolbar .btn{flex:1 1 100%}
  .invoice-head{flex-direction:column;align-items:stretch}
  .inv-id{justify-content:flex-start}
  [dir=ltr] .inv-id{justify-content:flex-end}
  [dir=rtl] .inv-id{justify-content:flex-end}
  .inv-side{justify-content:space-between}
  .inv-total{font-size:23px}
  .foot-cell{padding:12px;gap:10px}
  .foot-ico{width:36px;height:36px;font-size:14px}
  .foot-cell b{font-size:17px}
  .pos-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .pos-item{padding:10px}
  .pos-item .pi{height:64px;font-size:24px}
  .plist{grid-template-columns:minmax(0,1fr)}
  .kv{grid-template-columns:repeat(2,1fr)}
  .settings-grid{grid-template-columns:minmax(0,1fr)}
  .donut{width:160px;height:160px}
  .donut::after{inset:28px}
}
@media (max-width:380px){
  .kpis{grid-template-columns:minmax(0,1fr)}
  .pos-grid{grid-template-columns:minmax(0,1fr)}
}

/* ---------- 19. Read-only role & print ---------- */
.readonly [data-owner]{display:none!important}
@media print{
  body>*{display:none!important}
  #receiptModal{display:block!important;position:static;background:#fff;padding:0}
  #receiptModal .receipt-modal{box-shadow:none;width:100%;max-height:none;padding:0}
  #receiptModal .receipt-actions{display:none!important}
  #receiptModal .receipt-paper{border:0}
}

/* ---------- v17: cart line edit, checkout & payments ---------- */
.cl-tools{display:flex;gap:2px}
.cl-info em s{font-size:12px;color:var(--dark-muted);font-weight:600}
.cl-manual{color:#fbbf24!important;font-weight:700}
.modal-bg{position:fixed;inset:0;background:rgba(9,9,11,.5);z-index:140;display:grid;place-items:center;padding:16px}
.modal{width:min(480px,100%);max-height:92dvh;display:flex;flex-direction:column;background:var(--surface);border-radius:18px;box-shadow:var(--shadow-lg);overflow:hidden}
.modal.wide{width:min(620px,100%)}
[dir=ltr] .modal{direction:ltr}
.modal-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:16px 18px;border-bottom:1px solid var(--border)}
.modal-head h2{font-size:17px;font-weight:800}
.modal-body{padding:16px 18px;display:flex;flex-direction:column;gap:12px;overflow-y:auto}
.modal-body input[readonly]{background:var(--surface-sunk);color:var(--text-muted)}
.modal-body textarea{height:auto;padding:10px 12px;resize:vertical}
.modal-body .err{color:var(--discount);font-size:13px;min-height:1.2em}
.modal-foot{display:flex;gap:10px;padding:14px 18px;border-top:1px solid var(--border)}
.modal-foot .btn{flex:1}
.ck-sum,.ck-status{display:grid;gap:6px;padding:12px 14px;border:1px solid var(--border);border-radius:12px;background:var(--surface-sunk)}
.ck-sum>div,.ck-status>div{display:flex;align-items:center;justify-content:space-between;gap:10px;font-size:14px}
.ck-sum .big{padding-top:8px;border-top:1px solid var(--border);font-size:16px;font-weight:800}
.ck-sum .big b{font-size:24px;color:var(--primary)}
.ck-sum .big b .cur{color:var(--primary)}
.ck-sum b .cur,.ck-status b .cur{font-size:11px}
.pay-row{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr) minmax(0,1.2fr) 40px;gap:10px;align-items:end}
.pay-del{height:42px}
.inv-pay{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:0 2px 14px}
.pay-chip,.pay-kv{display:inline-flex;align-items:center;gap:5px;height:28px;padding:0 10px;border:1px solid var(--border);border-radius:99px;background:var(--surface-sunk);font-size:12.5px;color:var(--text-soft)}
.pay-chip b,.pay-kv b{color:var(--text)}
.pay-kv.due{border-color:#fecdd3;background:#fff1f2;color:var(--discount)}
.pay-kv.due b{color:var(--discount)}
.receipt-pay{display:grid!important;gap:3px;padding:6px 0;border-top:1px dashed #aaa;border-bottom:1px dashed #aaa}
.receipt-pay div{display:flex;justify-content:space-between}
.receipt-note{display:block!important;font-size:11px;padding-top:6px}
@media (max-width:560px){.pay-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.pay-row>label:nth-child(3){grid-column:1/-1}.pay-row>span:empty{display:none}}

/* ---------- v18: Settings → Users ---------- */
.users-card{margin-top:16px}
.users-tbl td{height:58px}
.u-actions{display:flex;gap:6px;justify-content:center}
.u-actions .iconbtn{width:34px;height:34px;font-size:13px;border-radius:10px}
.iconbtn.danger{color:var(--discount)}
.iconbtn.danger:hover{border-color:#fecdd3;background:#fff1f2}

/* ---------- v19: Sales top summary (approved summary-row design) + Reports cost KPI ---------- */
.sales-summary{display:flex;flex-wrap:wrap;gap:1px;background:var(--border);border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;box-shadow:var(--shadow)}
.sales-summary .foot-cell{flex:1 1 170px;background:var(--surface);border:0}
.sales-summary .foot-cell>div>b .profit{color:inherit}
.sales-summary .foot-cell.green>div>b .neg{color:var(--discount)}
.kpis.five{grid-template-columns:repeat(5,minmax(0,1fr))}
.kpi.cost .kpi-icon{background:var(--surface-muted);color:var(--text)}
@media (max-width:1280px){.kpis.five{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media (max-width:760px){.kpis.five{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:380px){.kpis.five{grid-template-columns:minmax(0,1fr)}}

/* ---------- v20: product images ---------- */
.pi,.cl-img,.thumb,.prod-media,.sl-thumb,.ps-thumb,.img-prev{position:relative;overflow:hidden}
.pi>img,.cl-img>img,.thumb>img,.prod-media>img,.sl-thumb>img,.ps-thumb>img,.img-prev>img{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;background:#fff;z-index:1}
.pi>img{padding:6px}
.cl-img>img{padding:4px}
.prod-media{display:grid;place-items:center;height:150px;border-radius:12px;background:var(--surface-sunk);border:1px solid #f0f0f2;color:var(--text-soft);font-size:34px}
.prod-media>img{padding:8px;background:#fff}
.sl-thumb{display:inline-grid;place-items:center;width:30px;height:30px;border-radius:7px;background:var(--surface-muted);color:var(--text-muted);font-size:13px;flex:0 0 auto}
.inv-lines .p-name,.ie-tbl .p-name{display:flex;align-items:center;gap:8px}
.ps-thumb{display:inline-grid;place-items:center;width:22px;height:22px;border-radius:6px;background:var(--surface-muted);font-size:10px;color:var(--text-muted);flex:0 0 auto}
.phone-stock-row{align-items:center}
.phone-stock-row b{flex:1}
.img-ed{display:flex;align-items:center;gap:12px;padding:12px;border:1px dashed var(--border-strong);border-radius:var(--radius-sm);background:var(--surface-sunk)}
.img-prev{display:grid;place-items:center;width:84px;height:84px;border-radius:10px;background:#fff;border:1px solid var(--border);color:var(--text-muted);font-size:24px;flex:0 0 auto}
.img-prev>img{padding:4px}
.img-ed-side{display:flex;flex-direction:column;gap:4px;min-width:0}
/* ---------- v20: invoice actions & edit dialog ---------- */
.inv-side{flex-wrap:wrap;justify-content:flex-end}
.inv-del{background:#fff1f2;border-color:#fecdd3;color:var(--discount)}
.inv-del:hover:not(:disabled){background:#ffe4e6!important;border-color:#fda4af!important;color:var(--discount)}
.modal.xwide{width:min(860px,100%)}
.ie-tbl td{height:auto;padding:8px 10px}
.ie-in{height:36px;min-width:70px}
.ie-tbl td:nth-child(5) .ie-in{min-width:140px}
.ie-add{display:flex;gap:10px}
.ie-add select{flex:1}
.ie-add .btn{height:42px}
@media (max-width:760px){.inv-side .inv-print{height:40px;padding:0 12px;font-size:13px}}
