/* V67 · Exact Urdu print typography + compact invoice editor + responsive polish */

/*
   Alvi Nastaleeq is intentionally referenced as a LOCAL font only.
   The font file is not bundled with the project. If it is installed on the device,
   every Urdu screen/print below uses it before any fallback.
*/
@font-face{
  font-family:"SSTRADERS Alvi Exact";
  src:local("Alvi Nastaleeq Regular"),local("Alvi Nastaleeq"),local("Alvi Nastaleeq Urdu");
  font-style:normal;
  font-weight:400 900;
  font-display:swap;
}

/* Exact Urdu face across the whole application while keeping the structural layout LTR. */
html[data-language="ur"] body,
html[data-language="ur"] :is(
  h1,h2,h3,h4,h5,h6,p,label,button,a,th,td,small,strong,b,span,legend,
  input:not([type="number"]):not([type="date"]):not([type="datetime-local"]),textarea,select,
  .section-kicker,.field-help,.nav-label,.page-heading,.panel,.admin-content,.admin-header,.admin-sidebar,
  .g54-view,.g54-topbar,.g54-sidebar,.pos-cart,.pos-catalog,.receipt-note,.invoice-note-box
){
  font-family:"SSTRADERS Alvi Exact","Alvi Nastaleeq Regular","Alvi Nastaleeq","Noto Nastaliq Urdu","Noto Sans Arabic",serif!important;
  font-synthesis:none;
}
html[data-language="ur"] :is(h1,h2,h3,h4,h5,h6,.section-kicker){line-height:1.62!important;letter-spacing:0!important}
html[data-language="ur"] :is(p,label,button,a,th,td,small,strong,b,span){line-height:1.78}

/* Every printable surface uses the same Urdu font. This also overrides page-local Arial/Inter rules. */
html[data-language="ur"] :is(
  .invoice-document,.receipt-sheet,.pro-receipt,.thermal-receipt,.receipt,
  .v66-print-sheet,.v66-return-printable,.customer-statement,.payment-statement-receipt,
  .sheet,.continuous-print,.order-print
),
html[data-language="ur"] :is(
  .invoice-document,.receipt-sheet,.pro-receipt,.thermal-receipt,.receipt,
  .v66-print-sheet,.v66-return-printable,.customer-statement,.payment-statement-receipt,
  .sheet,.continuous-print,.order-print
) *{
  font-family:"SSTRADERS Alvi Exact","Alvi Nastaleeq Regular","Alvi Nastaleeq","Noto Nastaliq Urdu","Noto Sans Arabic",serif!important;
  font-synthesis:none!important;
}
html[data-language="ur"] :is(.invoice-document,.receipt-sheet,.pro-receipt,.receipt,.v66-print-sheet,.v66-return-printable,.sheet) :is(p,span,small,td,th,label){line-height:1.72!important}
html[data-language="ur"] :is(.invoice-document,.receipt-sheet,.pro-receipt,.receipt,.v66-print-sheet,.v66-return-printable,.sheet) :is(h1,h2,h3,h4,strong,b){line-height:1.58!important}

/* IDs/SKUs/invoice numbers stay readable left-to-right even inside Urdu documents. */
html[data-language="ur"] :is(.invoice-number,.sku,[data-no-i18n],code,.num,.money,.amount){direction:ltr!important;unicode-bidi:isolate!important}

/* V67 compact continued-bill editor: remove the oversized full-width blocks. */
.command54-body .continued-edit-history{
  padding:12px!important;
  margin-bottom:12px!important;
  border-radius:14px!important;
}
.command54-body .continued-edit-history>.invoice-edit-lines-head{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  align-items:start!important;
  gap:10px 18px!important;
  margin-bottom:10px!important;
}
.command54-body .continued-edit-history .invoice-edit-lines-head h3{
  margin:2px 0 3px!important;
  font-size:16px!important;
  line-height:1.25!important;
}
.command54-body .continued-edit-history .invoice-edit-lines-head p{
  margin:0!important;
  max-width:760px!important;
  font-size:10px!important;
  line-height:1.45!important;
}
.command54-body .continued-edit-chain-summary{
  display:flex!important;
  flex-wrap:wrap!important;
  justify-content:flex-end!important;
  gap:5px!important;
  min-width:0!important;
  max-width:520px!important;
  text-align:left!important;
}
.command54-body .continued-edit-chain-summary span{
  display:inline-flex!important;
  align-items:center!important;
  gap:5px!important;
  min-height:30px!important;
  padding:5px 8px!important;
  border:1px solid var(--g54-border)!important;
  border-radius:9px!important;
  background:var(--g54-surface-2)!important;
  font-size:9px!important;
  white-space:nowrap!important;
}
.command54-body .continued-edit-chain-summary strong{margin:0!important;font-size:10px!important}
.command54-body .continued-edit-chain-summary .due{background:var(--g54-warning-soft)!important}
.command54-body .continued-edit-chain-summary .paid,
.command54-body .continued-edit-chain-summary .credit{background:var(--g54-success-soft)!important}
.command54-body .continued-edit-grid{
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(360px,1fr))!important;
  gap:9px!important;
}
.command54-body .continued-edit-card{
  min-width:0!important;
  padding:9px 11px 10px!important;
  border:1px solid var(--g54-border)!important;
  border-left:3px solid var(--g54-primary)!important;
  border-bottom:2px solid color-mix(in srgb,var(--g54-primary) 42%,var(--g54-border))!important;
  border-radius:11px!important;
  box-shadow:none!important;
}
.command54-body .continued-edit-card.active{box-shadow:0 0 0 1px color-mix(in srgb,var(--g54-primary) 26%,transparent)!important}
.command54-body .continued-edit-card:after{height:0!important;margin:0!important;background:transparent!important}
.command54-body .continued-edit-card-head{
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:8px!important;
  margin:0 0 4px!important;
  padding:0 0 7px!important;
}
.command54-body .continued-edit-card-head>div{display:flex!important;align-items:baseline!important;gap:5px!important;min-width:0!important}
.command54-body .continued-edit-card-head strong{font-size:12.5px!important;white-space:nowrap!important}
.command54-body .continued-edit-card-head small{font-size:9px!important;white-space:nowrap!important}
.command54-body .continued-edit-card .segment-edit-btn{min-height:30px!important;padding:5px 9px!important;font-size:9px!important}
.command54-body .continued-edit-line{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  gap:8px!important;
  min-height:0!important;
  padding:6px 0!important;
  align-items:center!important;
}
.command54-body .continued-edit-line>span{min-width:0!important}
.command54-body .continued-edit-line>span>strong{display:block!important;font-size:11px!important;line-height:1.25!important}
.command54-body .continued-edit-line small{display:block!important;margin-top:2px!important;font-size:8.7px!important;line-height:1.35!important;color:var(--g54-text-3)!important}
.command54-body .continued-edit-line>strong{font-size:10.5px!important;white-space:nowrap!important}
.command54-body .continued-edit-total{
  margin-top:6px!important;
  padding-top:7px!important;
  border-top:1px solid var(--g54-border)!important;
  font-size:10px!important;
}
.command54-body .continued-edit-total strong{font-size:11px!important}

/* General responsive hardening across Studio + public site. */
html,body{max-width:100%}
body{overflow-x:hidden}
img,video,svg{max-width:100%;height:auto}
.g54-main,.g54-content,.g54-view,.admin-main,.admin-content,main{min-width:0}
.table-responsive{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}

@media(max-width:1100px){
  .command54-body .continued-edit-grid{grid-template-columns:repeat(auto-fit,minmax(320px,1fr))!important}
  .command54-body .continued-edit-history>.invoice-edit-lines-head{grid-template-columns:1fr!important}
  .command54-body .continued-edit-chain-summary{justify-content:flex-start!important;max-width:none!important}
}

@media(max-width:900px){
  .g54-content,.admin-content{padding:10px!important}
  .g54-routebar{margin-bottom:8px!important;overflow-x:auto!important;white-space:nowrap!important}
  .page-heading,.page-head{padding:13px!important;border-radius:14px!important}
  .page-heading,.page-head,.panel-head,.invoice-edit-lines-head{align-items:stretch!important}
  .heading-actions{width:100%!important;display:flex!important;flex-wrap:wrap!important;gap:7px!important}
  .heading-actions>*{flex:1 1 135px!important;justify-content:center!important}
  .invoice-edit-grid,.form-grid{grid-template-columns:1fr!important}
  .command54-body .continued-edit-grid{grid-template-columns:1fr!important}
  .command54-body .continued-edit-card-head{align-items:flex-start!important}
  .command54-body .continued-edit-card-head>div{display:block!important}
  .command54-body .continued-edit-card-head small{display:block!important;margin-top:2px!important}
  .v66-doc-tools{position:relative!important;margin:0 8px 10px!important;padding:8px!important}
  .v66-doc-tools .v66-tool-group{width:100%!important;display:flex!important;flex-wrap:wrap!important}
  .v66-doc-btn{flex:1 1 105px!important;min-width:0!important}
  .ss13-container,.ss13-page-hero-inner,.ss13-contact-cta-inner{width:100%!important;max-width:100%!important;padding-left:14px!important;padding-right:14px!important}
}

@media(max-width:640px){
  .g54-content,.admin-content{padding:7px!important}
  .page-heading,.page-head,.panel,.invoice-edit-panel,.invoice-edit-return-overview,.invoice-edit-return-history,.continued-edit-history{border-radius:11px!important}
  .heading-actions>*{flex:1 1 calc(50% - 7px)!important;min-width:0!important}
  .command54-body .continued-edit-history{padding:9px!important}
  .command54-body .continued-edit-chain-summary span{flex:1 1 calc(50% - 5px)!important;justify-content:space-between!important}
  .command54-body .continued-edit-line{grid-template-columns:1fr!important;gap:3px!important}
  .command54-body .continued-edit-line>strong{white-space:normal!important;text-align:left!important}
  .invoice-edit-table{min-width:760px!important}
  .v66-doc-btn{flex:1 1 calc(50% - 7px)!important}
  .v66-return-hero,.v66-return-panel-head{padding:11px!important}
  .v66-return-metrics{grid-template-columns:1fr 1fr!important;gap:6px!important}
  .v66-return-metric{padding:9px!important}
  .v66-return-metric strong{font-size:14px!important}
  .ss13-section-head h2,.ss15-accordion-head h2{font-size:clamp(1.65rem,8vw,2.35rem)!important}
}

@media(max-width:420px){
  .heading-actions>*,.v66-doc-btn{flex-basis:100%!important}
  .command54-body .continued-edit-chain-summary span{flex-basis:100%!important}
  .v66-return-metrics{grid-template-columns:1fr!important}
}

/* Print always uses white paper and the exact Urdu stack. */
@media print{
  html[data-language="ur"] body,
  html[data-language="ur"] :is(.invoice-document,.receipt-sheet,.pro-receipt,.thermal-receipt,.receipt,.v66-print-sheet,.v66-return-printable,.customer-statement,.payment-statement-receipt,.sheet),
  html[data-language="ur"] :is(.invoice-document,.receipt-sheet,.pro-receipt,.thermal-receipt,.receipt,.v66-print-sheet,.v66-return-printable,.customer-statement,.payment-statement-receipt,.sheet) *{
    font-family:"SSTRADERS Alvi Exact","Alvi Nastaleeq Regular","Alvi Nastaleeq","Noto Nastaliq Urdu","Noto Sans Arabic",serif!important;
    font-synthesis:none!important;
  }
}
