/* DSSM design system: plain CSS, logical properties only (inline-start/end) so RTL is a true mirror.
   Breakpoint: mobile < 768px, desktop >= 768px. Built to be dropped on top of Bootstrap 5 tokens. */
@font-face{font-family:"Inter";src:url("fonts/Inter.woff2") format("woff2");font-weight:400 800;font-display:swap}
@font-face{font-family:"Noto Naskh Arabic";src:url("fonts/NotoNaskhArabic.woff2") format("woff2");font-weight:400 700;font-display:swap}
@font-face{font-family:"Noto Nastaliq Urdu";src:url("fonts/NotoNastaliqUrdu.woff2") format("woff2");font-weight:400 700;font-display:swap}

:root{
  --brand-50:#EAF2FD;--brand-100:#D3E3FA;--brand-500:#2F72D2;--brand-600:#1558B0;--brand-700:#0F4590;--brand-800:#0B346D;
  --ink:#16202E;--ink-2:#37465C;--muted:#566680;
  --line:#D6DDE8;--line-strong:#AEB9CB;--bg:#F4F6FA;--surface:#FFFFFF;--surface-2:#F8FAFD;
  --debit:#B42318;--debit-bg:#FDECEA;     /* customer owes (sale on credit) */
  --credit:#0F7A3C;--credit-bg:#E3F5E9;   /* money received */
  --cashc:#1558B0;--udhaar:#B45309;--udhaar-bg:#FFF1DE;
  --warn:#7A4B00;--warn-bg:#FFF3D6;--info:#0F4590;--info-bg:#EAF2FD;
  --radius:12px;--radius-sm:8px;
  --shadow:0 1px 2px rgba(22,32,46,.06),0 4px 14px rgba(22,32,46,.06);
  --ring:0 0 0 2px #fff,0 0 0 5px var(--brand-700);
  --sidebar-w:264px;
}
*,*::before,*::after{box-sizing:border-box}
html{font-size:16px;-webkit-text-size-adjust:100%}
html[lang=ur]{font-size:18px}
body{margin:0;background:var(--bg);color:var(--ink);font-family:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;line-height:1.5;font-size:1rem}
html[lang=ur] body{font-family:"Noto Naskh Arabic","Noto Nastaliq Urdu",serif;line-height:1.8}
/* Urdu pairing: Nastaliq (Pakistani identity) for titles + brand only; Naskh for all working text (tables, forms, buttons) */
html[lang=ur] h1,html[lang=ur] h2,html[lang=ur] h3,html[lang=ur] .brand b,html[lang=ur] .login .hero h2,html[lang=ur] .a4 .ttl{font-family:"Noto Nastaliq Urdu","Noto Naskh Arabic",serif}
html[lang=ur] .en-num,html[lang=ur] .num,html[lang=ur] .money{font-family:"Inter","Noto Naskh Arabic",system-ui,sans-serif;line-height:1.5}
h1,h2,h3,h4{margin:0;line-height:1.25;color:var(--ink)}
html[lang=ur] h1,html[lang=ur] h2,html[lang=ur] h3,html[lang=ur] h4{line-height:1.95}
h1{font-size:1.5rem;font-weight:700} h2{font-size:1.125rem;font-weight:650} h3{font-size:1rem;font-weight:650}
p{margin:0}
a{color:var(--brand-700)}
.i{width:1.25rem;height:1.25rem;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex:none}
.i.lg{width:1.5rem;height:1.5rem}.i.sm{width:1rem;height:1rem}
[dir=rtl] .flip{transform:scaleX(-1)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.skip{position:absolute;inset-inline-start:.5rem;top:-4rem;background:#fff;padding:.5rem 1rem;border-radius:8px;z-index:100}
.skip:focus{top:.5rem}
:focus-visible,.focus-demo{outline:none;box-shadow:var(--ring)}
bdi.ltr,.ltr{direction:ltr;unicode-bidi:isolate;display:inline-block}
.num,.money{font-variant-numeric:tabular-nums;font-feature-settings:"tnum";direction:ltr;unicode-bidi:isolate;white-space:nowrap}
.money.debit{color:var(--debit)}.money.credit{color:var(--credit)}
.muted{color:var(--muted)}.small{font-size:.8125rem}.strong{font-weight:650}

/* ---------- app shell ---------- */
.app{display:grid;grid-template-columns:var(--sidebar-w) minmax(0,1fr);min-height:100vh}
.sidebar{background:var(--surface);border-inline-end:1px solid var(--line);padding:1.25rem 1rem;display:flex;flex-direction:column;gap:1.25rem;position:sticky;top:0;height:100vh}
.brand{display:flex;align-items:center;gap:.75rem;padding:.25rem .5rem;text-decoration:none;color:var(--ink)}
.brand .logo{width:2.5rem;height:2.5rem;border-radius:12px;background:var(--brand-600);display:grid;place-items:center;color:#fff}
.brand b{font-size:1.0625rem;line-height:1.2;display:block}.brand span{font-size:.75rem;color:var(--muted);display:block;line-height:1.4}
.sidenav{display:flex;flex-direction:column;gap:.25rem;margin:0;padding:0;list-style:none}
.sidenav a{display:flex;align-items:center;gap:.75rem;padding:.625rem .875rem;border-radius:10px;color:var(--ink-2);text-decoration:none;font-weight:550;min-height:44px;position:relative}
.sidenav a:hover{background:var(--surface-2)}
.sidenav a[aria-current=page]{background:var(--brand-50);color:var(--brand-700)}
.sidenav a[aria-current=page]::before{content:"";position:absolute;inset-inline-start:-1rem;top:20%;bottom:20%;width:4px;border-radius:0 4px 4px 0;background:var(--brand-600)}
[dir=rtl] .sidenav a[aria-current=page]::before{border-radius:4px 0 0 4px}
.sidebar .usercard .iconbtn{flex:none}
.sidebar .usercard{margin-top:auto;border:1px solid var(--line);border-radius:12px;padding:.75rem;display:flex;gap:.75rem;align-items:center}
.avatar{width:2.5rem;height:2.5rem;border-radius:50%;background:var(--brand-100);color:var(--brand-800);display:grid;place-items:center;font-weight:700;flex:none}
.main{min-width:0;display:flex;flex-direction:column}
.topbar{position:sticky;top:0;z-index:10;background:rgba(255,255,255,.96);backdrop-filter:blur(6px);border-bottom:1px solid var(--line);display:flex;align-items:center;gap:1rem;padding:.75rem 1.5rem;min-height:68px}
.topbar .title{flex:1;min-width:0}
.topbar .title h1{font-size:1.25rem}
.topbar .actions{display:flex;gap:.5rem;align-items:center}
.iconbtn{width:44px;height:44px;border-radius:10px;border:1px solid var(--line);background:#fff;display:inline-grid;place-items:center;color:var(--ink-2);text-decoration:none}
.iconbtn:hover{background:var(--surface-2)}
.langbtn{display:inline-flex;align-items:center;gap:.5rem;min-height:44px;padding:0 .875rem;border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--ink-2);text-decoration:none;font-weight:600}
.content>*,.card{min-width:0}
.content{padding:1.5rem;max-width:1240px;width:100%;margin-inline:auto;display:flex;flex-direction:column;gap:1.25rem}
.pay-grid{display:grid;grid-template-columns:minmax(0,1.2fr) minmax(0,1fr);gap:1.25rem;align-items:start}
.pagehead{display:flex;align-items:center;justify-content:space-between;gap:1rem;flex-wrap:wrap}
.pagehead p{color:var(--muted)}
.bottomnav{display:none}
.mob-only{display:none!important}

/* ---------- components ---------- */
.card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}
.card-h{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.5rem 1rem;padding:1rem 1.25rem;border-bottom:1px solid var(--line)}
.card-b{padding:1.25rem}
.grid{display:grid;gap:1rem}
.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))}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;min-height:44px;padding:.5rem 1.125rem;border-radius:10px;border:1px solid transparent;font:inherit;font-weight:650;cursor:pointer;text-decoration:none;line-height:1.5;white-space:nowrap}
html[lang=ur] .btn{line-height:1.7}
.btn.lg{min-height:52px;padding-inline:1.5rem;font-size:1.0625rem}
.btn.sm{min-height:44px;padding:.25rem .875rem;font-size:.875rem}
.btn.primary{background:var(--brand-600);color:#fff}.btn.primary:hover{background:var(--brand-700)}
.btn.secondary{background:#fff;color:var(--brand-700);border-color:var(--line-strong)}.btn.secondary:hover{background:var(--brand-50)}
.btn.ghost{background:transparent;color:var(--brand-700)}.btn.ghost:hover{background:var(--brand-50)}
.btn.danger{background:#fff;color:var(--debit);border-color:#E7A39B}.btn.danger:hover{background:var(--debit-bg)}
.btn.block{width:100%}
.btn[disabled]{background:#E6EAF1;color:#4B5A72;border-color:#E6EAF1;cursor:not-allowed}
.field{display:flex;flex-direction:column;gap:.375rem;min-width:0}
.label{font-weight:600;font-size:.9375rem;color:var(--ink)}
.help{font-size:.8125rem;color:var(--muted)}.err{font-size:.8125rem;color:var(--debit);display:flex;gap:.375rem;align-items:center}
.input,.select,.textarea{width:100%;min-height:48px;padding:.5rem .875rem;border:1px solid var(--line-strong);border-radius:10px;background:#fff;color:var(--ink);font:inherit;line-height:1.5}
html[lang=ur] .input,html[lang=ur] .select{line-height:1.7}
.input.num{text-align:right}
.input.dt{direction:inherit;text-align:start}
.input:hover,.select:hover{border-color:#8A98AE}
.input:focus,.select:focus,.input.is-focus{outline:none;border-color:var(--brand-600);box-shadow:var(--ring)}
.input.is-invalid{border-color:var(--debit);background:#FFF8F7}
.input[readonly],.input.ro{background:var(--surface-2);color:var(--ink-2)}
.input[disabled]{background:#EEF1F6;color:#5F6B7F}
.select{appearance:none;background-image:linear-gradient(45deg,transparent 50%,#566680 50%),linear-gradient(135deg,#566680 50%,transparent 50%);background-position:calc(100% - 1.25rem) 55%,calc(100% - .9rem) 55%;background-size:.35rem .35rem;background-repeat:no-repeat;padding-inline-end:2.5rem}
[dir=rtl] .select{background-position:.9rem 55%,1.25rem 55%}
.inwrap{position:relative}.inwrap .i{position:absolute;inset-inline-start:.875rem;top:50%;transform:translateY(-50%);color:var(--muted)}
.inwrap .input{padding-inline-start:2.5rem}
.inwrap .tail{position:absolute;inset-inline-end:.5rem;top:50%;transform:translateY(-50%)}
.seg{display:grid;grid-auto-flow:column;grid-auto-columns:1fr;border:1px solid var(--line-strong);border-radius:12px;padding:4px;background:var(--surface-2);gap:4px}
.seg input{position:absolute;opacity:0}
.seg label{display:flex;align-items:center;justify-content:center;gap:.5rem;min-height:44px;border-radius:9px;font-weight:650;color:var(--ink-2);cursor:pointer;padding:0 .75rem;text-align:center}
.seg input:checked+label{background:#fff;color:var(--brand-700);box-shadow:0 1px 3px rgba(22,32,46,.18)}
.seg input:focus-visible+label{box-shadow:var(--ring)}
.badge{display:inline-flex;align-items:center;gap:.25rem;padding:.0625rem .625rem;border-radius:999px;font-size:.8125rem;font-weight:650;line-height:1.6;white-space:nowrap}
html[lang=ur] .badge{line-height:1.7}
.badge.cash{background:var(--brand-50);color:var(--brand-700)}.badge.credit{background:var(--udhaar-bg);color:#8A4308}
.badge.ok{background:var(--credit-bg);color:#0B6232}.badge.bad{background:var(--debit-bg);color:#9A1B11}.badge.neutral{background:#EDF0F5;color:var(--ink-2)}
.alert{display:flex;gap:.75rem;align-items:flex-start;padding:.875rem 1rem;border-radius:10px;border:1px solid;font-size:.9375rem}
.alert.info{background:var(--info-bg);border-color:#B9D2F3;color:#0B346D}.alert.success{background:var(--credit-bg);border-color:#A9DDBB;color:#0B5A2D}
.alert.warn{background:var(--warn-bg);border-color:#EACB83;color:#5E3A00}.alert.danger{background:var(--debit-bg);border-color:#EDB1AA;color:#8E1A10}
.stat{padding:1rem 1.25rem;display:flex;flex-direction:column;gap:.25rem}
.stat .k{color:var(--muted);font-size:.875rem;font-weight:550}.stat .v{font-size:1.625rem;font-weight:750;line-height:1.2}
html[lang=ur] .stat .v{line-height:1.4}
.split{height:10px;border-radius:99px;overflow:hidden;display:flex;background:#E6EAF1}
.split i{display:block;height:100%}
.legend{display:flex;gap:1rem;flex-wrap:wrap;font-size:.875rem;color:var(--ink-2)}
.legend span{display:inline-flex;align-items:center;gap:.375rem}.legend b{width:.75rem;height:.75rem;border-radius:3px;display:inline-block}
.tablewrap{overflow:auto}
.table{width:100%;border-collapse:separate;border-spacing:0}
.table th{text-align:start;font-size:.8125rem;color:var(--muted);font-weight:650;background:var(--surface-2);padding:.75rem 1rem;border-bottom:1px solid var(--line);white-space:nowrap}
.table td{padding:.75rem 1rem;border-bottom:1px solid var(--line);vertical-align:middle}
.table tr:last-child td{border-bottom:0}
.table .num,.table th.num{text-align:right} /* explicit: numeric columns stay right-aligned in LTR and RTL so decimals line up */
.table tfoot td{background:var(--surface-2);font-weight:700;border-top:2px solid var(--line-strong)}
.table tr.sub td{background:var(--surface-2);font-weight:650}
.rowact{display:inline-flex;gap:.25rem}
.rowact .iconbtn{width:44px;height:44px;border:0;background:transparent}
.toolbar{display:flex;gap:.75rem;flex-wrap:wrap;align-items:flex-end}
.toolbar .field{min-width:150px;flex:1}
.tabs{display:flex;gap:.25rem;border-bottom:1px solid var(--line)}
.tabs a{padding:.75rem 1.125rem;color:var(--muted);font-weight:650;text-decoration:none;border-bottom:3px solid transparent;margin-bottom:-1px;min-height:44px}
.tabs a[aria-current=page]{color:var(--brand-700);border-color:var(--brand-600)}
.list{margin:0;padding:0;list-style:none}
.list li{display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:.75rem 0;border-bottom:1px solid var(--line)}
.list li:last-child{border-bottom:0}
.bar{height:8px;border-radius:99px;background:#E6EAF1;overflow:hidden;margin-top:.375rem}.bar i{display:block;height:100%;background:var(--brand-600);border-radius:99px}
.chip{display:inline-flex;align-items:center;gap:.5rem;background:var(--brand-50);color:var(--brand-800);border-radius:10px;padding:.5rem .75rem;font-size:.9375rem}
.kv{display:grid;grid-template-columns:auto 1fr;gap:.25rem 1rem}.kv dt{color:var(--muted)}.kv dd{margin:0;text-align:end}
.sumrow{display:flex;justify-content:space-between;gap:1rem;padding:.5rem 0}
.sumrow.total{border-top:2px solid var(--line-strong);margin-top:.5rem;padding-top:.875rem;font-size:1.25rem;font-weight:750}
.divider{height:1px;background:var(--line);border:0;margin:0}

/* ---------- screens ---------- */
.sale-grid{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:1.25rem;align-items:start}
.sticky{position:sticky;top:88px}
.lines{display:flex;flex-direction:column;gap:.75rem}
.line{display:grid;grid-template-columns:repeat(3,minmax(0,1fr)) 44px;gap:.75rem;align-items:end;padding:.875rem;border:1px solid var(--line);border-radius:12px;background:var(--surface)}
.line .f-prod{grid-column:1/4;grid-row:1}.line .f-del{grid-column:4;grid-row:1}.line .f-qty{grid-column:1;grid-row:2}.line .f-rate{grid-column:2;grid-row:2}.line .tot{grid-column:3/5;grid-row:2}
.line .tot{font-weight:700;font-size:1.0625rem;padding-bottom:.625rem;text-align:end;display:flex;justify-content:flex-end}
.stepper{display:grid;grid-template-columns:44px 1fr 44px;gap:4px;align-items:center}
.stepper .iconbtn{width:44px;height:48px}
.stepper .input{text-align:center;padding-inline:.25rem}
.actionbar{display:none}
.login{min-height:100vh;display:grid;grid-template-columns:1.1fr 1fr}
.login .hero{background-color:#0F4590;background-image:linear-gradient(160deg,var(--brand-700),var(--brand-600) 55%,#2F72D2);color:#fff;padding:3rem;display:flex;flex-direction:column;justify-content:space-between}
.login .hero h2{color:#fff;font-size:2rem;line-height:1.3;max-width:20ch}
html[lang=ur] .login .hero h2{line-height:1.9}
.login .hero p{color:#DCE9FB;max-width:36ch}
.login .formside{display:grid;place-items:center;padding:2rem}
.login .box{width:100%;max-width:400px;display:flex;flex-direction:column;gap:1.25rem}
.login .topline{position:absolute;inset-block-start:1rem;inset-inline-end:1rem}
.swatches{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:1rem}
.sw{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}
.sw .c{height:64px}.sw .t{padding:.625rem .75rem;font-size:.8125rem;line-height:1.5}
.sw .t b{display:block;font-size:.875rem}
.reportcard{display:flex;flex-direction:column;gap:.75rem;padding:1.25rem}
.reportcard .ico{width:44px;height:44px;border-radius:12px;background:var(--brand-50);color:var(--brand-700);display:grid;place-items:center}
.reportcard .btns{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:auto}.reportcard .btns .primary{flex:1 1 100%}.reportcard .btns .secondary{flex:1 1 0}
.acctcard{padding:1.125rem 1.25rem;display:flex;flex-direction:column;gap:.5rem}

/* ---------- paper (invoice / slip) ---------- */
body.paperbody{background:#D9DEE7;padding:2rem 0}
.paper{background:#fff;color:#111;margin:0 auto;box-shadow:0 2px 20px rgba(0,0,0,.2)}
.a4{width:794px;min-height:1123px;padding:48px 56px;display:flex;flex-direction:column;gap:28px}
.a4 .hd{display:flex;justify-content:space-between;gap:24px;align-items:flex-start;border-bottom:3px solid var(--brand-600);padding-bottom:20px}
.a4 .meta{display:grid;grid-template-columns:1fr 1fr;gap:24px}
.a4 table{width:100%;border-collapse:collapse}
.a4 th{background:#EAF2FD;color:#0B346D;text-align:start;padding:10px 12px;font-size:13px}
.a4 td{padding:10px 12px;border-bottom:1px solid #D6DDE8}
.a4 td.num,.a4 th.num{text-align:right}
.a4 .totals{margin-inline-start:auto;width:300px}
.a4 .foot{margin-top:auto;border-top:1px solid #D6DDE8;padding-top:14px;font-size:12px;color:#444;display:flex;justify-content:space-between}
.slip{width:302px;padding:14px 12px 22px;font-size:12.5px;line-height:1.45}
html[lang=ur] .slip{font-size:14px;line-height:1.7}
.slip .c{text-align:center}
.slip hr{border:0;border-top:1px dashed #555;margin:8px 0}
.slip table{width:100%;border-collapse:collapse}
.slip th{font-size:11px;text-align:start;border-bottom:1px solid #111;padding:3px 0}
.slip td{padding:3px 0;vertical-align:top}
.slip td.num,.slip th.num{text-align:right}
.slip .big{font-size:15px;font-weight:800}
@media print{body.paperbody{background:#fff;padding:0}.paper{box-shadow:none}}
@page{margin:10mm}

/* ---------- responsive ---------- */
@media (max-width:1100px){.sale-grid{grid-template-columns:minmax(0,1fr) 300px}.pay-grid{grid-template-columns:minmax(0,1fr)}.g4{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:767.98px){
  html{font-size:16px}html[lang=ur]{font-size:17.5px}
  .app{display:block}
  .sidebar,.desk-only{display:none!important}
  .mob-only{display:inline-flex!important}
  .topbar{padding:.5rem 1rem;min-height:60px}
  .topbar .title h1{font-size:1.125rem}
  .content{padding:1rem;gap:1rem;padding-bottom:6rem}
  .bottomnav{display:grid;grid-template-columns:repeat(5,1fr);position:fixed;inset-inline:0;bottom:0;z-index:20;background:#fff;border-top:1px solid var(--line);padding:.25rem .25rem calc(.25rem + env(safe-area-inset-bottom))}
  .bottomnav a{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:.125rem;min-height:56px;color:var(--muted);text-decoration:none;font-size:.75rem;font-weight:600;border-radius:10px;line-height:1.3}
  html[lang=ur] .bottomnav a{line-height:1.6}
  .bottomnav a[aria-current=page]{color:var(--brand-700)}
  .bottomnav a[aria-current=page] .i{stroke-width:2.4}
  .bottomnav .fab{margin-top:-1.25rem;color:var(--brand-700)}
  .bottomnav .fab span.bubble{width:52px;height:52px;border-radius:50%;background:var(--brand-600);color:#fff;display:grid;place-items:center;box-shadow:0 4px 12px rgba(21,88,176,.45);border:3px solid #fff}
  body.focus .bottomnav{display:none}
  body.focus .content{padding-bottom:9rem}
  .actionbar{display:flex;position:fixed;inset-inline:0;bottom:0;z-index:30;background:#fff;border-top:1px solid var(--line);padding:.75rem 1rem calc(.75rem + env(safe-area-inset-bottom));gap:1rem;align-items:center;box-shadow:0 -6px 20px rgba(22,32,46,.1)}
  .actionbar .tt{flex:1;min-width:0}.actionbar .tt small{display:block;color:var(--muted);font-size:.8125rem;line-height:1.3}
  .actionbar .tt b{font-size:1.25rem;line-height:1.3;display:block}
  .grid.g2,.grid.g3,.grid.g4{grid-template-columns:minmax(0,1fr)}
  .grid.g2.keep,.grid.g4.keep{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sale-grid,.pay-grid{grid-template-columns:minmax(0,1fr)}.sticky{position:static}
  .line{grid-template-columns:minmax(0,1fr) 44px}
  .line .f-prod{grid-column:1;grid-row:1}.line .f-del{grid-column:2;grid-row:1}
  .line .f-qty{grid-column:1/-1;grid-row:2}.line .f-rate{grid-column:1/-1;grid-row:3}
  .line .tot{grid-column:1/-1;grid-row:4;justify-content:space-between;padding:.5rem 0 0;border-top:1px dashed var(--line)}
  .desk-sum-save{display:none}
  .login{grid-template-columns:1fr}.login .hero{display:none}.login .formside{padding:1.5rem 1.25rem;align-content:center}
  .table.cards thead{display:none}
  .table.cards,.table.cards tbody,.table.cards tfoot,.table.cards tr,.table.cards td{display:block;width:100%}
  .table.cards tr{background:#fff;border:1px solid var(--line);border-radius:12px;padding:.625rem 1rem;margin-bottom:.75rem}
  .table.cards tfoot tr{background:var(--surface-2)}
  .table.cards td{display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:.3rem 0;border:0;text-align:start;background:transparent}
  .table.cards td::before{content:attr(data-label);color:var(--muted);font-size:.8125rem;font-weight:550;flex:none}
  .table.cards td.primary{font-weight:650;font-size:1.0625rem;padding-bottom:.375rem;border-bottom:1px solid var(--line);margin-bottom:.25rem}
  .table.cards td.primary::before,.table.cards td.actions::before{display:none}
  .table.cards td.actions{justify-content:flex-end;padding-top:.375rem}
  .table.cards td.num{text-align:end}
  .card.cardlist{background:transparent;border:0;box-shadow:none}
  .card.cardlist .tablewrap{overflow:visible}
  .toolbar .field{min-width:calc(50% - .5rem)}
  .toolbar .field.full{min-width:100%}
  .pagehead h1{font-size:1.25rem}
  .stat .v{font-size:1.375rem}
}

/* ---------- polish ---------- */
.table tbody tr{transition:background .12s}.table:not(.cards) tbody tr:hover td{background:#F8FAFD}
.avatar.sm{width:2rem;height:2rem;font-size:.9rem;font-weight:650}
.namecell{display:flex;align-items:center;gap:.75rem}
.hello{background-color:#0F4590;display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap;padding:1.25rem 1.5rem;border-radius:var(--radius);background-image:linear-gradient(135deg,var(--brand-700),var(--brand-600));color:#fff;position:relative;overflow:hidden}
.hello h2{color:#fff;font-size:1.375rem}.hello p{color:#DCE9FB}
.hello::after{content:"";position:absolute;inset-inline-end:-60px;top:-60px;width:220px;height:220px;border-radius:50%;background:rgba(255,255,255,.08)}
.hello>*{position:relative;z-index:1}
.pager{display:flex;gap:.5rem;justify-content:center;align-items:center;flex-wrap:wrap}
.pager a{min-width:44px;min-height:44px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--line);border-radius:10px;text-decoration:none;color:var(--ink-2);background:#fff;padding:0 .75rem;font-weight:600}
.pager a[aria-current=page]{background:var(--brand-600);border-color:var(--brand-600);color:#fff}
.qchips{display:flex;gap:.5rem;flex-wrap:wrap}
.qchip{display:inline-flex;align-items:center;gap:.375rem;min-height:44px;padding:0 .875rem;border:1px solid var(--line-strong);border-radius:999px;background:#fff;color:var(--brand-700);font-weight:650;text-decoration:none;font:inherit;cursor:pointer}
.qchip:hover{background:var(--brand-50)}
.menulist a{display:flex;align-items:center;gap:1rem;min-height:56px;padding:0 1.25rem;text-decoration:none;color:var(--ink);border-bottom:1px solid var(--line);font-weight:600}
.menulist a:last-child{border-bottom:0}.menulist a .go{margin-inline-start:auto;color:var(--muted)}
.menulist a .ico{width:40px;height:40px;border-radius:10px;background:var(--brand-50);color:var(--brand-700);display:grid;place-items:center}
.login .hero{position:relative;overflow:hidden}
.login .hero::before{content:"";position:absolute;inset-inline-end:-140px;bottom:-140px;width:460px;height:460px;border-radius:50%;background:rgba(255,255,255,.07)}
.login .hero::after{content:"";position:absolute;inset-inline-end:60px;top:-80px;width:220px;height:220px;border-radius:50%;background:rgba(255,255,255,.06)}
.login .hero>*{position:relative;z-index:1}
.noprint{display:flex;gap:.75rem;justify-content:center;align-items:center;margin-bottom:12px;flex-wrap:wrap}
@media print{.noprint{display:none}}

/* Urdu legibility: Naskh has a small x-height, so small text steps up one size */
html[lang=ur] .small,html[lang=ur] .help,html[lang=ur] .err{font-size:.9375rem}
html[lang=ur] .stat .k,html[lang=ur] .legend{font-size:1rem}
html[lang=ur] .badge{font-size:.9375rem}
html[lang=ur] .table th{font-size:.9375rem}
html[lang=ur] .label{font-size:1.0625rem}
html[lang=ur] .sidenav a{font-size:1.0625rem}
html[lang=ur] .btn.sm{font-size:.9375rem}
html[lang=ur] .tabs a{font-size:1.0625rem}
@media (max-width:767.98px){
  html[lang=ur] .table.cards td::before{font-size:.9375rem}
  html[lang=ur] .bottomnav a{font-size:.8125rem}
  .actionbar .tt b{font-size:1.125rem}
  .actionbar .btn.lg{padding-inline:1rem}
}
/* td.num switches to Inter/LTR for digits; its generated card label must stay Urdu (Naskh, RTL) */
html[lang=ur] .table.cards td.num::before,html[lang=ur] .table.cards td.num::after{font-family:"Noto Naskh Arabic",serif;direction:rtl;font-feature-settings:normal;unicode-bidi:isolate}
html[lang=ur] .input.dt,html[lang=ur] .input.num{font-family:"Inter","Noto Naskh Arabic",system-ui,sans-serif}

.a4 td.qtycell{text-align:right}
.qty{white-space:nowrap}

/* ================= round 2 ================= */
/* sidebar brand: no overlap (title and subtitle stack, Urdu gets tall line-height) */
.brand .bn{display:block;min-width:0;font-size:1rem;color:var(--ink)}
.brand .bn b{display:block;font-size:1.0625rem;line-height:1.25}
.brand .bn small{display:block;font-size:.75rem;color:var(--muted);line-height:1.5;margin-top:.125rem}
html[lang=ur] .brand{align-items:flex-start}
html[lang=ur] .brand .logo{margin-top:.5rem}
html[lang=ur] .brand .bn b{line-height:2.15;padding-block:.125rem}
html[lang=ur] .brand .bn small{line-height:1.8;font-size:.875rem;margin-top:.125rem}
.sidebar{overflow-y:auto}
.sidenav .navlabel{margin:.75rem .875rem .25rem;font-size:.75rem;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
html[lang=ur] .sidenav .navlabel{font-size:.9375rem;letter-spacing:0;text-transform:none}
.sidebar .usercard .iconbtn{margin-inline-start:auto;flex:none}
.sidenav a{min-height:42px;padding-block:.5rem}
.usermenu{display:inline-flex;align-items:center;gap:.5rem;min-height:44px;padding:0 .75rem;border:1px solid var(--line);border-radius:10px;background:#fff;color:var(--ink);font:inherit;font-weight:600;cursor:pointer}
.usermenu:hover{background:var(--surface-2)}
.menu-pop{width:240px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 12px 32px rgba(22,32,46,.18);overflow:hidden}
.menu-pop a,.menu-pop div.mi{display:flex;align-items:center;gap:.75rem;min-height:48px;padding:0 1rem;color:var(--ink);text-decoration:none;border-bottom:1px solid var(--line);font-weight:550}
.menu-pop a:last-child{border-bottom:0}.menu-pop .mi-h{padding:.75rem 1rem;border-bottom:1px solid var(--line);background:var(--surface-2)}

/* compact sale line: product row + one row (stepper, rate, line total) */
.cl{display:grid;grid-template-columns:minmax(0,1fr) 44px;gap:.5rem;padding:.75rem;border:1px solid var(--line);border-radius:12px;background:#fff;align-items:center}
.cl .row2{grid-column:1/-1;display:flex;align-items:center;gap:.75rem;justify-content:space-between}
.cl .stepper{flex:none;width:150px}
.cl .stepper .iconbtn,.cl .stepper .input{height:44px;min-height:44px}
.cl .rate{flex:1;color:var(--muted);font-size:.875rem;white-space:nowrap;display:flex;align-items:center;gap:.25rem;min-width:0}
html[lang=ur] .cl .rate{font-size:.9375rem}
.cl .lt{font-weight:700;white-space:nowrap}
.cl .select{min-height:44px}
.cl .iconbtn.del{border-color:transparent;color:var(--debit)}
.cpick{display:flex;flex-direction:column;gap:.5rem}
.plist{border:1px solid var(--line-strong);border-radius:12px;background:#fff;box-shadow:0 8px 24px rgba(22,32,46,.15);overflow:hidden}
.plist a{display:flex;justify-content:space-between;gap:.75rem;align-items:center;padding:.5rem .875rem;min-height:56px;text-decoration:none;color:var(--ink);border-bottom:1px solid var(--line)}
.plist a:last-child{border-bottom:0}.plist a[aria-selected=true]{background:var(--brand-50)}
.plist .sub{font-size:.8125rem;color:var(--muted)}
html[lang=ur] .plist .sub{font-size:.9375rem}
.banner{display:flex;gap:.75rem;align-items:flex-start;padding:.875rem 1rem;border-radius:12px;background:var(--warn-bg);border:1px solid #EACB83;color:#5E3A00}
.banner .acts{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:.625rem}
.banner .btn.secondary{border-color:#C9A24B;color:#5E3A00;background:#fff}
.seg.sm label{padding:0 .25rem;font-size:.875rem}
html[lang=ur] .seg.sm label{font-size:.9375rem}
.rangebar{display:flex;gap:.75rem;flex-wrap:wrap;align-items:flex-end}
.rangebar .seg{max-width:520px}

/* states */
.toast{display:flex;align-items:center;gap:.75rem;padding:.875rem 1rem;border-radius:12px;background:#16202E;color:#fff;box-shadow:0 8px 24px rgba(0,0,0,.25);max-width:440px}
.toast.ok .i{color:#7DDBA3}.toast.err .i{color:#FFB4AB}.toast .x{margin-inline-start:auto;color:#C9D3E3;background:none;border:0;min-width:44px;min-height:44px;display:grid;place-items:center;cursor:pointer}
.skel{background:linear-gradient(90deg,#E6EAF1 25%,#F1F4F9 37%,#E6EAF1 63%);background-size:400% 100%;animation:shim 1.4s ease infinite;border-radius:8px;height:14px}
@keyframes shim{0%{background-position:100% 50%}100%{background-position:0 50%}}
.empty{text-align:center;padding:2.5rem 1.5rem;display:flex;flex-direction:column;align-items:center;gap:.75rem}
.empty .ill{width:72px;height:72px;border-radius:50%;background:var(--brand-50);color:var(--brand-700);display:grid;place-items:center}
.empty p{color:var(--muted);max-width:42ch}
.errpage{min-height:60vh;display:grid;place-items:center;text-align:center;padding:2rem 0}
.errpage .box{display:flex;flex-direction:column;align-items:center;gap:1rem;max-width:460px}
.errpage .code{font-size:4.5rem;font-weight:800;color:var(--brand-600);line-height:1;font-family:"Inter",sans-serif}
.errpage .ill{width:88px;height:88px;border-radius:50%;background:var(--brand-50);color:var(--brand-700);display:grid;place-items:center}
.backdrop{position:fixed;inset:0;background:rgba(22,32,46,.58);display:grid;place-items:center;padding:1rem;z-index:50}
.modal{background:#fff;border-radius:16px;width:100%;max-width:460px;box-shadow:0 20px 60px rgba(0,0,0,.35);overflow:hidden}
.modal .mh{padding:1.25rem 1.25rem .5rem;display:flex;gap:.875rem;align-items:flex-start}
.modal .mb{padding:0 1.25rem 1.125rem}
.modal .mf{display:flex;gap:.75rem;justify-content:flex-end;padding:1rem 1.25rem;border-top:1px solid var(--line);flex-wrap:wrap;background:var(--surface-2)}
.modal .icd{width:44px;height:44px;border-radius:12px;background:var(--debit-bg);color:var(--debit);display:grid;place-items:center;flex:none}
.modal ul{margin:.5rem 0 0;padding-inline-start:1.25rem;color:var(--ink-2)}
.field-block{display:flex;flex-direction:column;gap:.375rem}
.adjpill{display:inline-flex;gap:.25rem;align-items:center;background:var(--warn-bg);color:#5E3A00;border-radius:8px;padding:0 .5rem;font-size:.8125rem;line-height:1.7}
.sw-toggle{display:flex;align-items:center;gap:.75rem;min-height:44px}
.sw-toggle .track{width:44px;height:26px;border-radius:99px;background:var(--brand-600);position:relative;flex:none}
.sw-toggle .track::after{content:"";position:absolute;top:3px;inset-inline-end:3px;width:20px;height:20px;border-radius:50%;background:#fff}
.sw-toggle.off .track{background:#8A98AE}.sw-toggle.off .track::after{inset-inline-end:auto;inset-inline-start:3px}
.kpi-row{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem}
@media (max-width:1100px){.kpi-row{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (max-width:767.98px){
  .modal .mf .btn{flex:1}
  .backdrop{align-items:end;padding:0}
  .modal{max-width:none;border-radius:16px 16px 0 0}
  .menu-pop{width:100%}
  .cl .stepper{width:150px}
  .kpi-row{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media print{.noprint{display:none}}
.btn.solid-danger{background:var(--debit);color:#fff}.btn.solid-danger:hover{background:#8E1A10}
.sw-toggle input:focus-visible+.track{box-shadow:var(--ring)}

/* phone: three product lines fit on the first screen */
@media (max-width:767.98px){
  .sale-grid .card-b{padding:.75rem}
  .sale-grid .lines{gap:.5rem!important}
  .sale-grid .prodhead{display:none!important}
  .qchips{flex-wrap:nowrap;overflow-x:auto;padding-bottom:.125rem}
  .qchips>span{display:none}.qchip{flex:none;min-height:44px}
  .cl{padding:.5rem .625rem;gap:.375rem}
  .cpick{gap:.25rem}
  .cpick .chip{font-size:.8125rem;padding:.25rem .625rem}
  html[lang=ur] .cpick .chip{font-size:.9375rem}
  .sale-grid .card-b.grid{gap:.625rem!important}
  .sale-grid .field .label{font-size:.875rem}
  html[lang=ur] .sale-grid .field .label{font-size:1rem}
}
.cl .select{min-height:44px;padding-block:.125rem}
@media (max-width:767.98px){body.focus .content{padding-top:.75rem}}

@media (max-width:767.98px){.seg label .i{display:none}.seg label{padding:0 .5rem}}
