
html,body{max-width:100%;overflow-x:hidden}.app,.shell,.main,.screen{min-width:0}.shell{min-width:0}.main{min-width:0;width:100%}
.purchase-optional{margin:12px 0;border:1px solid var(--border,#dfe6ef);border-radius:12px;padding:10px;min-width:0}.purchase-optional>summary{cursor:pointer;font-weight:700}.purchase-optional>.form-grid{margin-top:10px}.purchase-editor-table{width:100%;max-width:100%;min-width:0;overflow-x:auto;-webkit-overflow-scrolling:touch}.purchase-editor-table>.table-wrap{width:100%;max-width:100%;min-width:0;overflow-x:auto}.purchase-unit-control{display:grid;gap:5px;width:100%;max-width:220px;min-width:0}.purchase-unit-control select,.purchase-unit-control input{box-sizing:border-box;width:100%;max-width:100%;min-width:0}.purchase-unit-control label{display:grid;gap:3px;min-width:0;font-size:11px}.purchase-unit-control small{white-space:normal;overflow-wrap:anywhere;color:var(--muted,#64748b)}[data-editor-form="purchase-invoices"] .editor-shell-body{min-width:0;overflow-x:hidden}
.workspace-tab-shell{position:relative;display:inline-flex;flex:0 0 auto}.workspace-tab-shell .workspace-tab{width:100%}.workspace-tab-shell.has-close .workspace-tab{padding-inline-end:30px}.workspace-tab-close{position:absolute;inset-inline-end:4px;top:50%;z-index:1;width:22px;height:22px;display:grid;place-items:center;transform:translateY(-50%);border:0;border-radius:50%;background:transparent;color:inherit;font:700 16px/1 inherit;cursor:pointer}.workspace-tab-close:hover{background:var(--tint-red);color:var(--color-red)}.workspace-tab-close:focus-visible{outline:2px solid var(--ui-accent);outline-offset:1px}
/* Phone / high-resolution phone. The 941px reference is intentionally treated as phone UI. */
@media (max-width:1023px){
  :root{--bottomnav-h:76px;--font-size-body:14px;--height-input:44px;--height-btn:46px}
  body{font-size:14px}.topbar{height:74px;grid-template-columns:120px 1fr 120px;padding:0 20px}.brand strong{font-size:24px}.brand span{font-size:12px}
  .main{padding:16px 16px calc(var(--bottomnav-h) + 18px);width:100%;max-width:100%;overflow-x:hidden}
  .screen{width:100%;max-width:100%;overflow-x:hidden}.table-wrap{width:100%;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .screen-head{margin-bottom:11px}.screen-head h1{font-size:27px}.title-icon{width:46px;height:46px;border-radius:14px}.head-select{min-height:40px}
  .card{padding:13px}.kpi{min-height:86px}.chart-svg{height:155px}.chart-card{grid-template-columns:1fr 220px}
  .data-table{min-width:820px}.data-table th,.data-table td{font-size:11px;padding:8px 7px}.thumb{width:42px;height:36px}
  .bottomnav{display:grid}.desktop-only{display:none!important}
}
@media (max-width:700px){
  :root{--height-input:39px;--height-btn:41px;--bottomnav-h:69px;--font-size-body:12px}
  body{font-size:12px}.statusbar{height:30px;padding:0 12px;font-size:12px}.statusbar .island{width:102px;height:21px;top:5px}
  .topbar{height:62px;grid-template-columns:82px 1fr 82px;padding:0 10px}.brand strong{font-size:19px}.brand span{font-size:9px}.top-actions{gap:5px}.icon-btn{width:32px;height:32px}.topbar .menu-trigger{padding:6px}
  .main{padding:10px 8px calc(var(--bottomnav-h) + 9px)}.screen-head{min-height:44px;margin-bottom:8px}.screen-head h1{font-size:20px}.title-icon{width:36px;height:36px;border-radius:11px}.head-select{padding:6px 8px;font-size:10px;min-height:34px}
  .searchbar{height:38px;margin-bottom:9px;padding:0 9px}.card{padding:9px;border-radius:13px}.card-title h2,.card-title h3,.section-title{font-size:12px}
  .grid,.split,.two,.three,.five,.form-grid{gap:7px}.kpis{gap:6px}.kpi{min-height:70px;padding:8px;border-radius:12px}.kpi strong{font-size:16px;margin-top:3px}.kpi small{font-size:9px}.kpi .icon{width:21px;height:21px}
  .summary{gap:6px}.summary-box{padding:8px}.summary-box strong{font-size:15px}.field label{font-size:9px}.control{padding:0 7px;border-radius:9px}.action-row{gap:6px}.action-row .btn{min-width:82px;padding:0 8px;font-size:10px}.btn-sm{height:29px;padding:0 7px}
  .table-wrap{border-radius:11px}.data-table{min-width:700px}.data-table th,.data-table td{padding:6px 5px;font-size:9px}.thumb{width:34px;height:29px}.chart-card{grid-template-columns:1fr 132px;gap:7px}.chart-svg{height:112px}.chart-side strong{font-size:18px}
  .segmented button{padding:6px 8px;min-width:58px;font-size:9px}.subnav{gap:4px}.subnav button{padding:7px 3px;font-size:9px}.bottomnav button{font-size:9px}.bottomnav .fab{width:46px;height:46px}
}

/* Hard containment for popup/document editors at browser zoom levels. */
:where(.modal,.modal-card,.editor-shell-layer,.editor-card,.editor-shell-header,.editor-shell-body,.editor-shell-footer,.item-editor-groups,.editor-group,.form-grid,.item-unit-row,.item-unit-card-head,fieldset){box-sizing:border-box;min-width:0;max-width:100%}
:where(.modal-card,.editor-card,.editor-shell-body,.item-editor-groups,.editor-group,fieldset)>*{min-width:0;max-width:100%;box-sizing:border-box}
.editor-shell-layer,.modal{max-width:100vw;overflow-x:hidden}.editor-card,.modal-card{overflow-x:hidden}.editor-shell-body{width:100%;min-width:0;max-width:100%;overflow-x:hidden}
.editor-card :where(input,select,textarea,button,label,.control){box-sizing:border-box;min-width:0;max-width:100%}
.editor-card .form-grid{grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr))}
.editor-card[data-editor-form="items"] .item-unit-row,.editor-card[data-editor-form="items"] .item-unit-row.item-unit-row-guided,.editor-card[data-editor-form="items"] .item-unit-row-base{grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr))!important;width:100%;min-width:0;max-width:100%}
.editor-workspace-tabs,.workspace-tabs{min-width:0;max-width:100%;overflow-x:auto;overflow-y:hidden;overscroll-behavior-inline:contain}
@media(max-width:760px){.editor-card .form-grid,.editor-card[data-editor-form="items"] .item-unit-row,.editor-card[data-editor-form="items"] .item-unit-row.item-unit-row-guided,.editor-card[data-editor-form="items"] .item-unit-row-base{grid-template-columns:1fr!important}}
@media (max-width:470px){
  .grid-4,.kpis,.grid-5,.split,.summary,.form-grid,.two,.three,.five{grid-template-columns:1fr}
  .chart-card{grid-template-columns:1fr}.chart-side{display:flex;justify-content:space-between;align-items:end;gap:8px}.chart-side strong{font-size:17px}
}
/* Desktop: fixed right navigation, content gets its own explicit column. */
@media (min-width:1024px){
  .statusbar{display:none}.topbar{height:72px;position:fixed;top:0;left:0;right:var(--sidebar-w);z-index:35}.topbar .menu-trigger{display:none}.top-actions{justify-self:start}.brand{text-align:center;justify-self:center}.brand strong{font-size:22px}
  .shell{display:block;padding-right:var(--sidebar-w);padding-top:72px}.sidebar{position:fixed;right:0;left:auto;top:0;bottom:0;width:var(--sidebar-w);transform:none;box-shadow:-4px 0 18px rgba(21,51,91,.08);z-index:50;padding-top:18px}.sidebar .close-side{display:none}.sidebar-head{height:44px}
  .main{display:block;padding:26px 30px 40px;max-width:none;margin:0}.bottomnav{display:none}.overlay{display:none!important}.screen-head{margin-bottom:16px}.screen{max-width:1500px;margin:0 auto}.kpis{grid-template-columns:repeat(4,1fr)}.card{padding:16px}.data-table th,.data-table td{font-size:13px}.data-table{min-width:760px}.chart-svg{height:220px}.chart-card{grid-template-columns:1fr 310px}
}
@media (min-width:1600px){:root{--sidebar-w:290px}.main{padding:30px 42px}.screen{max-width:1600px}}

/* Dashboard responsive fidelity */
@media(max-width:700px){.dashboard-kpis{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}.dashboard-kpi{min-height:72px;padding:8px}.dashboard-kpi strong{font-size:17px}.dashboard-kpi .dash-icon{width:34px;height:34px;border-radius:10px}.dashboard-chart{grid-template-columns:1fr}.dashboard-chart .chart-meta{display:flex;align-items:end;justify-content:space-between;gap:8px}.dashboard-chart .chart-meta strong{font-size:20px}.quick-grid{grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}.quick-card{min-height:72px;padding:7px 3px;font-size:9px}.quick-card .quick-icon{width:32px;height:32px}.dashboard-panes{grid-template-columns:1fr}.module-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}.module-card{min-height:55px;padding:7px;font-size:10px}.module-icon{width:32px;height:32px}.dashboard-welcome{align-items:flex-start}.dashboard-period{font-size:9px;padding:6px 7px}}
@media(min-width:1024px){.dashboard-kpis{grid-template-columns:repeat(4,1fr)}.quick-grid{grid-template-columns:repeat(5,1fr)}.module-grid{grid-template-columns:repeat(5,minmax(0,1fr))}.dashboard-panes{grid-template-columns:1fr 1fr}}

/* =========================================================
   2026 MODERN RESPONSIVE OVERRIDES
   ========================================================= */
@media (max-width:1023px){
  .statusbar{display:none!important}
  .topbar{height:60px;grid-template-columns:116px minmax(0,1fr) 42px;padding:0 9px}.brand strong{font-size:19px}.brand span{font-size:9.5px}.top-actions{gap:4px}.top-actions .connection-status,.top-actions #commandPaletteBtn,.top-actions #themeToggle,.top-actions .sidebar-mode-toggle{display:none!important}.sync-rescue-button{max-width:42px;width:38px;height:36px;padding:0;justify-content:center}.sync-rescue-button [data-sync-rescue-label]{display:none}.sync-rescue-button b{position:absolute;transform:translate(-14px,-13px);min-width:17px;height:17px;font-size:9px}.icon-btn{width:34px;height:34px;border-radius:11px}.topbar .menu-trigger{width:34px;height:34px;padding:5px}
  .main{padding-top:11px}.screen-head h1{font-size:23px}.screen-head{min-height:48px}.title-icon{width:39px;height:39px}
  .quick-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.quick-card{min-height:104px}.quick-card .quick-icon{width:59px;height:59px;border-radius:18px}
  .module-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px 5px}.module-card{min-height:91px}.module-icon{width:55px;height:55px;border-radius:16px}.module-card>span:last-child{font-size:9.8px;max-width:84px}
  .dashboard-block-title{margin-top:12px}
}
@media (min-width:1024px) and (max-width:1599px){
  .sync-rescue-button{position:relative;max-width:42px;width:38px;height:36px;padding:0;justify-content:center}
  .sync-rescue-button [data-sync-rescue-label]{display:none}
  .sync-rescue-button b{position:absolute;transform:translate(-14px,-13px);min-width:17px;height:17px;font-size:9px}
}
@media (max-width:470px){
  .topbar{height:58px}.brand strong{font-size:18px}.brand span{font-size:9px}
  .main{padding:8px 7px calc(var(--bottomnav-h) + 10px)}.screen-head h1{font-size:19px}
  .quick-card{min-height:96px;border-radius:18px;font-size:11px}.quick-card .quick-icon{width:54px;height:54px;border-radius:16px}.quick-card .quick-icon .icon{width:27px;height:27px}
  .module-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:11px 2px}.module-card{min-height:84px;padding:2px 0}.module-icon{width:50px;height:50px;border-radius:15px}.module-card .icon{width:24px;height:24px}.module-card>span:last-child{font-size:8.8px;max-width:76px}
  .dashboard-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.dashboard-kpi{min-height:76px;padding:9px}.dashboard-kpi strong{font-size:18px}.dashboard-kpi .dash-icon{width:37px;height:37px}
}
@media (min-width:1024px){
  :root{--sidebar-w:216px}
  .statusbar{display:none!important}.topbar{height:64px;right:var(--sidebar-w);grid-template-columns:96px 1fr 96px;padding:0 14px}.brand strong{font-size:20px}.brand span{font-size:10px}
  .shell{padding-right:var(--sidebar-w);padding-top:64px}.sidebar{width:var(--sidebar-w);padding:11px 10px;box-shadow:-4px 0 16px rgba(21,51,91,.07)}.sidebar-head{height:42px;margin-bottom:8px}.sidebar-head strong{font-size:15px}.sidebar-head .muted{font-size:10px}.nav-list{gap:2px}.nav-link{padding:6px 7px;font-size:11px;border-radius:10px}.nav-link .nav-icon-shell{width:29px;height:29px}.nav-link .num{font-size:8px}.sidebar-divider{margin:9px 0}.sidebar-state{gap:4px}.sidebar-state button{padding:6px 2px;font-size:9px}
  .main{padding:22px 24px 34px}.screen{max-width:1540px}.screen-head h1{font-size:27px}
  .quick-grid{grid-template-columns:repeat(3,minmax(0,190px));justify-content:start;direction:rtl;gap:12px}.quick-card{min-height:116px}.quick-card .quick-icon{width:65px;height:65px}
  .module-grid{grid-template-columns:repeat(8,minmax(0,1fr));gap:16px 8px}.module-card{min-height:102px}.module-icon{width:60px;height:60px}.module-card>span:last-child{font-size:10.5px}
  .dashboard-kpis{grid-template-columns:repeat(4,minmax(0,1fr))}
}
@media (min-width:1600px){:root{--sidebar-w:224px}.module-grid{grid-template-columns:repeat(10,minmax(0,1fr))}.main{padding:24px 30px 38px}}

/* =========================================================
   COMPACT DRAWER + SECTION RIBBON RESPONSIVE OVERRIDES
   ========================================================= */
@media (max-width:1023px){
  .sidebar{width:var(--sidebar-mobile-w);max-width:76vw;padding:10px 8px}
  .nav-link{min-height:39px;padding:4px 5px;font-size:11px}.nav-link .nav-icon-shell{width:29px;height:29px;border-radius:9px}.nav-link .num{display:none}
  .screen-head{min-height:62px;padding:8px 10px;border-radius:16px;gap:8px}.screen-head-main{gap:8px}.screen-head-icon{width:41px;height:41px;border-radius:13px}.screen-head-icon svg.icon{width:23px;height:23px}.screen-head h1{font-size:21px;letter-spacing:-.35px}.screen-kicker{font-size:8px}.screen-head-action{max-width:45%}.screen-head .head-select,.screen-head .dashboard-period{min-height:35px;padding:7px 8px;font-size:10px;max-width:100%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}
}
@media (max-width:470px){
  .sidebar{width:min(72vw,var(--sidebar-mobile-w));padding:9px 7px}.sidebar-head strong{font-size:14px}.nav-link{min-height:37px;font-size:10.5px}.nav-link .nav-icon-shell{width:28px;height:28px}.nav-link .nav-icon-shell svg.icon{width:16px;height:16px}
  .screen-head{min-height:57px;padding:7px 8px;border-radius:15px}.screen-head-icon{width:37px;height:37px;border-radius:12px}.screen-head-icon svg.icon{width:21px;height:21px}.screen-head h1{font-size:18px;line-height:1.18}.screen-kicker{display:none}.screen-head-action{max-width:43%}.screen-head .head-select,.screen-head .dashboard-period{min-height:32px;padding:5px 6px;font-size:8.8px;border-radius:10px}.screen-head .head-select svg.icon,.screen-head .dashboard-period svg.icon{width:14px;height:14px}
}
@media (min-width:1024px){
  :root{--sidebar-w:204px}
  .sidebar{width:var(--sidebar-w);max-width:none;padding:10px 9px}.nav-link{min-height:39px;padding:4px 6px;font-size:10.8px}.nav-link .nav-icon-shell{width:29px;height:29px}.sidebar-head{height:auto;min-height:42px}
  .screen-head{min-height:72px;padding:11px 15px}.screen-head h1{font-size:27px}.screen-head-action{max-width:42%}
}
@media (min-width:1600px){:root{--sidebar-w:210px}.sidebar{width:var(--sidebar-w)}}

/* Yemen Smart Workflow responsive */
@media (max-width:1023px){
  .workspace-bar{top:60px;height:40px;padding:4px 7px}.workspace-tab{height:31px;min-width:96px;max-width:150px;font-size:9px}.workspace-save{display:none}.workspace-add{height:31px;width:31px}
  .weight-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.currency-converter{grid-template-columns:1fr 1fr}.currency-converter .calc-result{grid-column:1/-1}.preference-grid{grid-template-columns:1fr 1fr}.smart-options{position:fixed;top:auto;right:8px;left:8px;bottom:calc(var(--bottomnav-h) + 8px);max-height:48vh}
  .table-tools{align-items:center}.table-search{min-width:0;max-width:none;flex:1}.table-hint{display:none}
}
@media (max-width:470px){
  .workspace-bar{top:58px}.workspace-tab{min-width:88px;padding:0 7px}.screen-head-actions{gap:3px}.screen-head-actions .head-select{font-size:8px;padding:4px 5px}
  .weight-grid,.preference-grid,.journal-pair{grid-template-columns:1fr}.journal-explain{grid-template-columns:1fr}.journal-explain>span{transform:rotate(90deg)}.theme-choice{grid-template-columns:1fr 1fr 1fr}.theme-choice button{font-size:9px;padding:0 4px}.entity-context{grid-template-columns:36px minmax(0,1fr)}.entity-context .btn{display:none}.entity-context-icon{width:34px;height:34px}.currency-converter{grid-template-columns:1fr}
}
@media (min-width:1024px){
  .workspace-bar{position:fixed;top:64px;right:var(--sidebar-w);left:0;height:44px;z-index:34}.shell{padding-top:108px}.topbar{z-index:35}.smart-options{min-width:320px}.weight-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
}

/* Closed mobile drawer stays outside the layout without increasing document width. */
@media (max-width:1023px){
  .sidebar{
    right:calc(-1 * var(--sidebar-mobile-w));
    left:auto;
    transform:none;
    transition:right var(--transition),box-shadow var(--transition);
  }
  .sidebar.open{right:0;transform:none}
}

/* Fixed off-canvas elements can still enlarge Chromium's scroll area; remove the closed drawer from layout. */
@media (max-width:1023px){
  .sidebar:not(.open){display:none}
  .sidebar.open{display:block;right:0;left:auto;transform:none}
}

/* Reserve the width of the actions actually available in each edition. */
@media (max-width:1023px){
  .topbar{grid-template-columns:max-content minmax(0,1fr) 42px;padding-inline:7px}
  .topbar [hidden]{display:none!important}
  .top-actions{min-width:0;overflow:visible}
  .dashboard-kpi:after{left:0}
}

@media(max-width:600px){
  .document-designer{padding:0}.document-designer-panel{width:100%;height:100dvh;border-radius:0}.document-designer-body{grid-template-columns:1fr;overflow:auto}.document-branding-controls{border-left:0;border-bottom:1px solid var(--color-border);overflow:visible}.document-color-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.document-preview-area{min-height:520px}.document-preview-frame{min-width:0;max-width:100%;min-height:440px}.document-designer-actions{position:sticky;bottom:0;background:var(--color-surface);overflow-x:auto}.document-designer-actions .btn{flex:0 0 auto}
}

@media(max-width:900px){.accounting-flow-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.account-categories{grid-template-columns:1fr}.branding-settings-grid{grid-template-columns:120px minmax(0,1fr)}.branding-card .btn{grid-column:1/-1}.report-filter-bar{grid-template-columns:1fr 1fr}.report-filter-bar .btn{grid-column:1/-1}.ledger-account-filter{grid-template-columns:1fr}.account-node-row{grid-template-columns:28px minmax(0,1fr) auto}.account-node-row>.badge:nth-last-child(-n+2){display:none}}
@media(max-width:560px){.accounting-flow-grid{grid-template-columns:1fr}.accounting-flow-grid>div:after{display:none}.branding-settings-grid{grid-template-columns:1fr;text-align:center}.branding-card img,.branding-logo-placeholder{margin:auto}.directory-heading{display:grid}.item-directory-actions{display:grid;grid-template-columns:1fr}.list-sort-toolbar label{width:100%;justify-content:space-between}.report-filter-bar{grid-template-columns:1fr}.account-node-row{padding-inline-start:6px}.account-main{display:grid;gap:2px}.account-main span{font-size:11px}}

/* Fast cashier: catalog and cart share the desktop, then stack without horizontal overflow. */
.quick-pos{display:grid;grid-template-columns:minmax(260px,.85fr) minmax(0,1.5fr);gap:12px;align-items:start}.pos-categories{display:flex;gap:6px;overflow:auto;padding-bottom:8px}.pos-categories button{border:1px solid var(--color-border);background:var(--color-surface);border-radius:999px;padding:7px 10px;white-space:nowrap}.pos-categories button.active{background:var(--color-primary);color:#fff}.pos-items{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.pos-item{display:flex;min-width:0;min-height:92px;flex-direction:column;align-items:flex-start;justify-content:space-between;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface);padding:10px;text-align:start}.pos-item strong,.pos-item small{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pos-barcode{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:8px;margin-bottom:10px}.pos-barcode input{min-width:0;border:2px solid var(--color-primary);border-radius:12px;padding:12px;font-size:16px}.pos-total{display:flex;justify-content:space-between;align-items:center;margin-top:12px;padding:14px;border-radius:12px;background:var(--color-primary-soft,#eaf4ff)}.pos-total strong{font-size:22px}.pos-actions{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-top:10px}.pos-cart [data-pos-qty]{width:82px;max-width:100%}
.pos-sale-options{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-bottom:10px}.pos-sale-options label{display:grid;gap:4px;color:var(--color-muted);font-size:12px}.pos-sale-options select{min-width:0;border:1px solid var(--color-border);border-radius:10px;background:var(--color-surface);padding:9px;color:var(--color-text)}.pos-weight-choices{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-bottom:10px}.pos-weight-choices span{color:var(--color-muted);font-size:12px}.pos-weight-choices button{border:1px solid var(--color-border);border-radius:999px;background:var(--color-surface);padding:6px 10px;cursor:pointer}.pos-weight-choices button.active{border-color:var(--color-primary);background:var(--color-primary);color:#fff}
.pos-scan-unit-bar{display:flex;align-items:end;gap:10px;flex-wrap:wrap;margin-bottom:10px;padding:9px;border:1px solid var(--color-border);border-radius:11px;background:var(--color-background)}.pos-scan-unit-bar label{display:grid;gap:4px;min-width:min(260px,100%);color:var(--color-muted);font-size:12px}.pos-scan-unit-bar select,.pos-line-unit{min-width:0;border:1px solid var(--color-border);border-radius:8px;background:var(--color-surface);padding:7px;color:var(--color-text)}.pos-unit-shortcut{display:inline-flex;gap:4px;align-items:center;margin-inline-end:5px;color:var(--color-muted);font-size:11px}.pos-unit-shortcut kbd{padding:2px 5px;border:1px solid var(--color-border);border-radius:5px;background:var(--color-surface)}
.pos-weight-cell,.invoice-weight-cell{display:grid;gap:5px;min-width:92px}.pos-weight-cell>input,.invoice-weight-cell>input{width:100%}.pos-weight-cell label,.invoice-weight-cell label{display:grid;grid-template-columns:auto minmax(54px,1fr);align-items:center;gap:4px;color:var(--color-muted);font-size:9px}.pos-weight-cell label input,.invoice-weight-cell label input{width:100%;min-width:54px;border:1px solid var(--color-border);border-radius:7px;padding:4px}.document-quick-actions{padding:8px;border:1px solid var(--color-border);border-radius:12px;background:var(--color-background)}
.invoice-retail-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin:0 0 12px}.invoice-retail-actions .segmented{display:flex;gap:4px;padding:4px;border-radius:12px;background:var(--color-background)}.invoice-retail-actions .segmented button{border:0;border-radius:9px;background:var(--color-surface);padding:8px 14px;cursor:pointer}.invoice-retail-actions>.field{min-width:230px;margin:0}
@media(max-width:900px){.quick-pos{grid-template-columns:1fr}.pos-catalog{order:2}.pos-cart{order:1}.pos-items{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:600px){.quick-pos{width:100%;overflow:hidden}.pos-items{grid-template-columns:repeat(2,minmax(0,1fr))}.pos-sale-options{grid-template-columns:1fr}.pos-actions{grid-template-columns:1fr 1fr}.pos-barcode{grid-template-columns:1fr}.pos-barcode .btn{width:100%}.pos-cart{padding:9px}.pos-cart .table-wrap{overflow-x:auto;max-width:100%}}

/* Fluid workspace: use the available display instead of an artificial desktop cap. */
@media (min-width:1024px){
  .main{padding-inline:clamp(16px,2vw,34px)}
  .screen{width:100%;max-width:none;margin:0}
  .editor-card{width:min(1480px,calc(100vw - 32px));max-height:calc(100dvh - 28px)}
  .modal-card:has(.table-wrap),.modal-card:has(.picker-list),.modal-card:has(.command-palette){width:min(1180px,calc(100vw - 40px))}
  .form-grid{grid-template-columns:repeat(auto-fit,minmax(min(260px,100%),1fr))}
}

@media (max-width:700px){
  .table-wrap{overflow:visible;border:0;background:transparent}
  .data-table[data-responsive="ready"]{display:block;min-width:0;width:100%;background:transparent}
  .data-table[data-responsive="ready"] thead{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
  .data-table[data-responsive="ready"] tbody{display:grid;gap:9px;width:100%}
  .data-table[data-responsive="ready"] tbody tr{display:grid;width:100%;min-width:0;overflow:hidden;border:1px solid var(--color-border);border-radius:13px;background:var(--color-surface);box-shadow:var(--shadow-sm)}
  .data-table[data-responsive="ready"] tbody td{display:grid;grid-template-columns:minmax(92px,36%) minmax(0,1fr);gap:8px;align-items:center;width:100%;max-width:none;padding:8px 10px;border-top:1px solid var(--color-border);overflow-wrap:anywhere}
  .data-table[data-responsive="ready"] tbody td:first-child{border-top:0}
  .data-table[data-responsive="ready"] tbody td::before{content:attr(data-label);font-size:10px;font-weight:800;color:var(--color-muted)}
  .data-table[data-responsive="ready"] tbody td[colspan]::before{display:none}
  .data-table[data-responsive="ready"] :where(input,.control,.invoice-weight-cell,.row-actions){min-width:0;max-width:100%}
}
@media(max-width:600px){.document-quick-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible}.document-quick-actions .btn{width:100%;min-width:0}.pos-weight-cell,.invoice-weight-cell{min-width:78px}}

/* MOBILE CONTAINMENT CONTRACT */
@media(max-width:600px){
  .screen,.screen>*,.card,.card>*,.modal-card,.modal-card>*,.split>*,.two>*,.three>*,.five>*,.form-grid>*,.summary>*,.kpis>*{min-width:0;max-width:100%}
  .screen :where(h1,h2,h3,p,span,strong,small,label,.btn),.picker-item{overflow-wrap:anywhere;word-break:break-word}
  input,select,textarea{min-width:0;max-width:100%}
  .screen-head{flex-wrap:wrap;align-items:flex-start}
  .screen-head-main{flex:1 1 180px;max-width:100%}
  .screen-head-action{flex:1 1 auto;max-width:100%;justify-content:flex-start}
  .screen-head-action>*,.screen-head-actions{max-width:100%}
  .card-title{flex-wrap:wrap;align-items:flex-start}
  .card-title h2,.card-title h3,.section-title{min-width:0;max-width:100%}
  .table-wrap{width:100%;max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain;-webkit-overflow-scrolling:touch}
  .data-table{width:100%;max-width:none}
  .data-table th,.data-table td{max-width:260px;overflow-wrap:anywhere;word-break:break-word}
  .segmented{max-width:100%;overflow-x:auto;overscroll-behavior-inline:contain}
  .segmented button{flex:0 0 auto}
  .action-row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));width:100%}
  .action-row .btn{width:100%;min-width:0;height:auto;min-height:var(--height-btn);padding-block:7px;white-space:normal}
  .modal{padding:8px;align-items:flex-start}
  .modal-card{width:100%;max-height:calc(100dvh - 16px);padding:12px;border-radius:16px}
  .modal-head,.picker-item{min-width:0;flex-wrap:wrap;align-items:flex-start}
  .document-preview-toolbar{min-width:0;flex-wrap:wrap}
  .document-preview-toolbar>.segmented{width:100%}
}
/* END MOBILE CONTAINMENT CONTRACT */

/* Quick cashier owns its width: the old generic table minimum caused the distorted layout. */
.quick-pos.quick-pos-single{display:block;width:100%;min-width:0}
.quick-pos-single .pos-cart{width:100%;min-width:0}
.pos-picker{margin-bottom:12px;padding:12px;border:1px solid var(--color-border);border-radius:14px;background:var(--color-background)}
.pos-search-results{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:7px;margin-top:8px}
.pos-search-results[hidden]{display:none}
.pos-search-result{display:flex;justify-content:space-between;gap:12px;min-width:0;border:1px solid var(--color-border);border-radius:11px;background:var(--color-surface);padding:9px 11px;color:var(--color-text);text-align:start;cursor:pointer}
.pos-search-result:hover,.pos-search-result:focus-visible{border-color:var(--color-primary);box-shadow:0 0 0 2px var(--color-primary-soft,#eaf4ff);outline:0}
.pos-search-result>span{display:grid;gap:2px;min-width:0}.pos-search-result strong,.pos-search-result small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.pos-search-result b{color:var(--color-primary)}
.pos-search-empty{grid-column:1/-1;padding:10px;color:var(--color-muted);text-align:center}
.quick-pos-table-wrap{width:100%;max-width:100%;overflow:visible}
.quick-pos-table{width:100%;min-width:0;table-layout:fixed}
.quick-pos-table th:nth-child(1){width:23%}.quick-pos-table th:nth-child(2){width:43%}.quick-pos-table th:nth-child(3){width:12%}.quick-pos-table th:nth-child(4){width:15%}.quick-pos-table th:nth-child(5){width:7%}
.quick-pos-table th,.quick-pos-table td{min-width:0;padding:8px 6px;vertical-align:middle;overflow-wrap:anywhere}
.quick-pos-table .pos-line-code{display:block;margin-top:3px}
.quick-pos-table .pos-weight-cell{grid-template-columns:repeat(3,minmax(76px,1fr));gap:6px;min-width:0}
.quick-pos-table .pos-weight-cell label{display:grid;grid-template-columns:1fr;gap:3px;font-size:10px}
.quick-pos-table .pos-weight-cell input{width:100%;min-width:0;padding:7px}
.quick-pos-table .pos-price-field{display:grid;gap:3px;color:var(--color-muted);font-size:10px}
.quick-pos-table .pos-price-field{justify-items:center;text-align:center}.quick-pos-table .pos-price-field input{width:min(92px,100%);height:34px;min-width:0;border:1px solid var(--color-border);border-radius:7px;padding:5px 6px;font-size:11px;text-align:center}
.quick-pos-table [data-pos-rounding]{min-height:12px;color:var(--color-orange);font-size:9px}
.quick-pos-table{border-collapse:collapse;font-size:11px}.quick-pos-table th,.quick-pos-table td{border:1px solid var(--color-border);line-height:1.35}.pos-checkout-trigger{grid-column:span 2}.pos-checkout-trigger kbd{margin-inline-start:7px}.pos-checkout-panel{position:fixed;z-index:100020;inset:0;display:grid;place-items:center;padding:18px;background:rgba(8,20,38,.68)}.pos-checkout-panel[hidden]{display:none}.pos-checkout-card{width:min(520px,100%);display:grid;gap:16px;padding:22px;border:1px solid var(--color-border);border-radius:18px;background:var(--color-surface);box-shadow:var(--shadow-lg)}.pos-checkout-card h3{margin:3px 0}.pos-checkout-card small{color:var(--color-primary);font-weight:800}.pos-checkout-methods{display:grid;grid-template-columns:repeat(3,1fr);gap:7px}.pos-checkout-methods button{min-height:48px;border:1px solid var(--color-border);border-radius:11px;background:var(--color-background);font-weight:800;cursor:pointer}.pos-checkout-methods button.active{border-color:var(--color-primary);background:var(--color-primary);color:#fff}.pos-checkout-card label{display:grid;gap:5px;color:var(--color-muted);font-size:12px}.pos-checkout-card label input{height:44px;border:1px solid var(--color-border);border-radius:10px;padding:8px 11px;background:var(--color-background);color:var(--color-text)}
.pos-customer-results{grid-template-columns:1fr;max-height:240px;overflow:auto;padding:2px}
.item-editor-groups{display:grid;gap:12px}
.item-barcode-inline{display:grid;grid-template-columns:minmax(220px,1fr) auto auto;gap:10px;align-items:end;min-width:0;margin-bottom:14px}
.item-barcode-inline>label{display:grid;gap:6px;min-width:0}
.item-barcode-inline input{width:100%;min-width:0}
.item-barcode-inline [data-item-barcode-video]{grid-column:1/-1;width:min(440px,100%);max-height:260px;margin-inline:auto;border-radius:12px;background:#101820}
.item-units-editor [data-item-unit-rows]{display:grid;gap:9px}
.item-unit-row{display:grid;grid-template-columns:repeat(6,minmax(105px,1fr)) auto auto;gap:8px;align-items:end;padding:10px;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface-soft)}
.item-unit-row label{display:grid;gap:5px;font-size:.82rem}
.item-unit-row input{min-width:0;width:100%}
.item-unit-row .item-unit-default{display:grid;align-content:end;gap:5px;min-height:42px;white-space:normal}
.item-unit-row .item-unit-default span{display:flex;align-items:center;gap:6px;white-space:nowrap}
.item-unit-row .item-unit-default input{width:auto}
.item-unit-row .item-unit-example{color:var(--color-text-muted);font-size:.72rem;font-weight:500;line-height:1.45}
.item-simple-unit-picker{margin-top:14px;padding:14px;border:2px solid color-mix(in srgb,var(--color-primary) 24%,var(--color-border));border-radius:16px;background:color-mix(in srgb,var(--color-primary) 4%,var(--color-background))}
.item-opening-warning{display:block;margin-top:8px;padding:8px 10px;border:1px solid #f6d786;border-radius:10px;background:#fff8dc;color:#7a5200;font-weight:750}
.simple-step-title{display:grid;gap:3px;margin-bottom:11px}.simple-step-title strong{font-size:1.05rem;color:var(--color-primary)}.simple-step-title small{color:var(--color-text-muted)}
.simple-unit-choices{display:grid;grid-template-columns:repeat(4,minmax(110px,1fr));gap:9px}
.simple-unit-choice{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;min-height:74px;border:2px solid var(--color-border);border-radius:14px;background:var(--color-background);color:var(--color-text);cursor:pointer;font:inherit}
.simple-unit-choice span{font-size:1.45rem}.simple-unit-choice b{font-size:.9rem}.simple-unit-choice:hover,.simple-unit-choice.active{border-color:var(--color-primary);background:color-mix(in srgb,var(--color-primary) 10%,var(--color-background));color:var(--color-primary);box-shadow:0 0 0 2px color-mix(in srgb,var(--color-primary) 12%,transparent)}
.simple-unit-more{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-top:11px;padding-top:11px;border-top:1px solid var(--color-border)}.simple-unit-more label{display:grid;gap:5px;font-size:.84rem;font-weight:700}.simple-unit-more select,.simple-unit-more input{width:100%;min-height:44px}
.simple-unit-more-trigger{margin-top:10px;border:0;background:transparent;color:var(--color-primary);font:inherit;font-size:.82rem;font-weight:800;cursor:pointer}.simple-unit-more-trigger.active{text-decoration:underline}
.item-carton-choice{display:flex;align-items:center;gap:9px;flex-wrap:wrap;margin-bottom:11px}.item-carton-choice>span{display:inline-flex;align-items:center;min-height:42px;padding:8px 12px;border-radius:12px;background:var(--color-surface-soft);font-weight:800}.item-carton-choice [data-carton-added]{color:#08783f;background:#e9faef}
.item-unit-guide{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:0 0 12px}
.item-unit-guide>div{display:grid;grid-template-columns:auto 1fr;column-gap:10px;align-items:center;padding:11px 12px;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface-soft)}
.item-unit-guide>div>span{grid-row:1/3;font-size:1.45rem}.item-unit-guide b{font-size:.9rem}.item-unit-guide small{color:var(--color-text-muted);line-height:1.5}
.item-unit-row.item-unit-row-guided{grid-template-columns:minmax(180px,1.2fr) repeat(3,minmax(130px,1fr)) auto;align-items:center;padding:13px}
.item-unit-row.item-unit-row-guided>*{min-width:0;max-width:100%}.item-unit-row.item-unit-row-guided label,.item-unit-card-head>div{min-width:0;overflow-wrap:anywhere}.item-unit-row.item-unit-row-guided input{min-width:0;max-width:100%}
.item-unit-row-base{grid-template-columns:minmax(180px,1.2fr) repeat(2,minmax(130px,1fr))!important;border-color:color-mix(in srgb,var(--color-primary) 25%,var(--color-border));background:color-mix(in srgb,var(--color-primary) 4%,var(--color-background))}
.item-unit-card-head{display:flex;gap:10px;align-items:center}.item-unit-card-head>span{font-size:1.55rem}.item-unit-card-head>div{display:grid;gap:3px}.item-unit-card-head strong{font-size:.94rem}.item-unit-card-head small{color:var(--color-text-muted);line-height:1.5}.item-unit-card-head small b{color:var(--color-primary)}
.item-unit-factor span{font-weight:700;color:var(--color-primary)}
.item-unit-templates{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 12px}.item-unit-templates .btn{min-height:40px}
.item-unit-row [data-unit-name-select],.item-unit-row [data-unit-custom-name] input{width:100%;min-height:42px;border:1px solid var(--color-border);border-radius:10px;background:var(--color-background);color:var(--color-text);padding:8px 10px}
.item-unit-default-choice{display:flex!important;align-items:center;gap:7px;white-space:nowrap}.item-unit-default-choice input{width:18px!important;height:18px}
.item-unit-live-summary{margin-top:12px;padding:12px 14px;border:1px solid color-mix(in srgb,#10a85b 35%,var(--color-border));border-radius:12px;background:color-mix(in srgb,#10a85b 8%,var(--color-background));color:var(--color-text);font-weight:700;line-height:1.8}
.item-directory-pager{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;margin:10px 0 16px}
.item-directory-pager span{min-width:190px;text-align:center;color:var(--color-muted);font-weight:700}
.item-pricing-optional{border:1px solid var(--color-border);border-radius:14px;background:var(--color-background);overflow:hidden}
.item-pricing-optional>summary{cursor:pointer;list-style:none;padding:13px 15px;color:var(--color-primary);font-weight:800;background:var(--color-surface-soft)}
.item-pricing-optional>summary::-webkit-details-marker{display:none}.item-pricing-optional>summary:after{content:'+';float:left;font-size:1.2rem}.item-pricing-optional[open]>summary:after{content:'−'}
.item-pricing-optional-body{display:grid;gap:12px;padding:12px}
@media(max-width:1100px){.item-unit-row{grid-template-columns:repeat(3,minmax(0,1fr)) auto}.item-unit-row.item-unit-row-guided{grid-template-columns:repeat(2,minmax(0,1fr))}.item-unit-row-base{grid-template-columns:repeat(2,minmax(0,1fr))!important}.item-unit-row>*{min-width:0}.item-barcode-inline{grid-template-columns:minmax(0,1fr) auto auto}}
@media(max-width:680px){.simple-unit-choices{grid-template-columns:repeat(2,minmax(0,1fr))}.simple-unit-more,.item-unit-guide,.item-unit-row,.item-unit-row.item-unit-row-guided,.item-unit-row-base,.item-barcode-inline{grid-template-columns:1fr!important}.item-unit-row .btn,.item-carton-choice .btn,.item-barcode-inline .btn{width:100%}}
.editor-group{border:1px solid var(--color-border);border-radius:14px;padding:12px;background:var(--color-background)}
.editor-group h3{margin:0 0 10px;color:var(--color-primary);font-size:14px}
.pricing-profit .summary{margin-top:0}

@media(max-width:700px){
  .quick-pos-table-wrap{overflow:visible}
  .quick-pos-table,.quick-pos-table tbody{display:block;width:100%}
  .quick-pos-table thead{display:none}
  .quick-pos-table tr{display:grid;grid-template-columns:1fr 1fr;gap:7px;margin-bottom:10px;padding:10px;border:1px solid var(--color-border);border-radius:12px;background:var(--color-surface)}
  .quick-pos-table td{display:grid;grid-template-columns:minmax(74px,.42fr) minmax(0,1fr);align-items:center;gap:8px;width:auto!important;max-width:none;border:0;padding:3px 0;text-align:start}
  .quick-pos-table td:before{content:attr(data-label);color:var(--color-muted);font-size:10px;font-weight:700}
  .quick-pos-table td:nth-child(1),.quick-pos-table td:nth-child(2){grid-column:1/-1}
  .quick-pos-table td:nth-child(5){grid-template-columns:minmax(74px,.42fr) auto}
  .quick-pos-table .pos-weight-cell{grid-template-columns:repeat(3,minmax(0,1fr));width:100%}
  .quick-pos-table .pos-empty-row{display:block;padding:14px;text-align:center}
  .quick-pos-table .pos-empty-row td{display:block}.quick-pos-table .pos-empty-row td:before{content:none}
  .pos-search-results{grid-template-columns:1fr}
}

@media(max-width:430px){
  .quick-pos-table tr{grid-template-columns:1fr}
  .quick-pos-table td,.quick-pos-table td:nth-child(1),.quick-pos-table td:nth-child(2){grid-column:1}
  .quick-pos-table .pos-weight-cell{grid-template-columns:1fr}
  .editor-group{padding:9px}
}

/* Dashboard shortcut grid — responsive distribution without horizontal scrolling. */
@media (max-width:1023px){
  .dashboard-shortcuts{grid-template-columns:repeat(auto-fit,minmax(112px,1fr));gap:8px;overflow-x:visible}
  .dashboard-shortcuts .shortcut-card{min-height:88px;padding:8px 5px}
  .dashboard-shortcuts .quick-icon{width:50px;height:50px;border-radius:15px}
}
@media (max-width:470px){
  .dashboard-shortcuts{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px;overflow-x:visible}
  .dashboard-shortcuts .shortcut-card{min-height:86px;padding:7px 3px;font-size:10px;border-radius:15px}
  .dashboard-shortcuts .quick-icon{width:48px;height:48px;border-radius:14px}
  .dashboard-shortcuts .quick-icon .icon{width:24px;height:24px}
  .dashboard-shortcuts kbd{top:5px;left:5px;font-size:6px;padding:2px 4px}
}

/* A transformed screen becomes the containing block for fixed editors. Disable the
   entrance animation whenever an editor is mounted, at every viewport width. */
.screen:has(.editor-shell-layer){overflow:visible;transform:none!important;animation:none!important}
/* Editors become full-screen on phones while their save/cancel actions remain reachable. */
@media(max-width:700px){
  body:has(.editor-shell-layer){overflow:hidden}
  .editor-shell-layer{align-items:stretch;padding:0;background:var(--color-surface);backdrop-filter:none}
  .editor-card{width:100%;max-width:none;max-height:100dvh;height:100dvh;border:0;border-radius:0;box-shadow:none}
  .editor-shell-header{padding:11px 12px}
  .editor-shell-body{padding:11px 10px}
  .editor-shell-footer{padding:8px 10px calc(8px + env(safe-area-inset-bottom))}
  .editor-shell-footer .document-quick-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  .list-filter-toolbar{grid-template-columns:1fr 1fr}
}

/* Compact journal editor: each debit/credit cell remains visible on phones. */
@media(max-width:700px){
  .journal-editor-table table,.journal-editor-table tbody,.journal-editor-table tr{display:block;width:100%}
  .journal-editor-table thead{display:none}
  .journal-editor-table tbody tr{border:1px solid var(--color-border);border-radius:12px;padding:9px;margin:9px 0;background:var(--color-background)}
  .journal-editor-table tbody td{display:inline-block;width:48%;vertical-align:top;border:0;padding:5px;min-width:0}
  .journal-editor-table tbody td:first-child,.journal-editor-table tbody td:nth-child(2),.journal-editor-table tbody td:nth-child(5){width:100%}
  .journal-editor-table tbody td input{max-width:100%;min-width:0}
  .journal-editor-table tbody td:nth-child(3):before{content:'مدين';display:block;font-size:11px;color:var(--color-muted)}
  .journal-editor-table tbody td:nth-child(4):before{content:'دائن';display:block;font-size:11px;color:var(--color-muted)}
}

@media(max-width:700px){
  .journal-mode-switch{width:100%;display:grid;grid-template-columns:1fr 1fr}.journal-mode-switch button{min-height:42px;padding-inline:6px}
  .journal-list-tools{grid-template-columns:1fr 1fr}.journal-list-tools>label:first-child,.journal-list-pager{grid-column:1/-1}.journal-list-pager{justify-content:space-between}.journal-list-pager button{min-height:40px;min-width:78px}
  .journal-account-create{min-height:38px}
}

/* Invoice editors keep the content area usable: secondary actions scroll in one compact row. */
@media(max-width:700px){
  /* The screen entrance transform otherwise becomes the containing block for
     the fixed editor and clips its lower half behind a blank page. */
  .editor-shell-footer{overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}
  .editor-shell-footer .document-quick-actions{display:flex;flex-wrap:nowrap;width:max-content;min-width:100%;gap:6px;overflow:visible}
  .editor-shell-footer .document-quick-actions .btn{flex:0 0 auto;width:auto;min-width:max-content;height:44px;padding-inline:12px;white-space:nowrap}
  .party-balance-indicators{display:grid;grid-template-columns:1fr 1fr}.party-balance{justify-content:center}
  .return-picker-table table,.return-picker-table tbody,.return-picker-table tr{display:block;width:100%}
  .return-picker-table thead{display:none}.return-picker-table tr{border:1px solid var(--color-border);border-radius:12px;padding:8px;margin:8px 0;background:var(--color-surface)}
  .return-picker-table td{display:grid;grid-template-columns:96px 1fr;align-items:center;gap:8px;border:0;padding:5px}
  .return-picker-table td:nth-child(1):before{content:'اختيار'}.return-picker-table td:nth-child(2):before{content:'الصنف'}.return-picker-table td:nth-child(3):before{content:'الأصلية'}.return-picker-table td:nth-child(4):before{content:'سبق إرجاعها'}.return-picker-table td:nth-child(5):before{content:'المتاح'}.return-picker-table td:nth-child(6):before{content:'كمية المرتجع'}.return-picker-table td:nth-child(7):before{content:'الوحدة'}
}

/* The list overlays the full-width editor instead of compressing its fields. */
@media (min-width:1200px){
  :root{--topbar-h:52px;--workspace-h:34px}
  .topbar{height:var(--topbar-h);padding-inline:10px}
  .workspace-bar{top:var(--topbar-h);height:var(--workspace-h);padding:2px 8px}
  .workspace-tab{height:28px;min-width:96px;max-width:170px;padding-inline:7px;font-size:10px}
  .workspace-add{width:28px;height:28px}
  .shell{padding-top:calc(var(--topbar-h) + var(--workspace-h))}
  .main{padding-top:12px}
  .document-editor-pane .editor-card{height:calc(100dvh - 104px)}
  .document-list-pane{top:calc(var(--topbar-h) + var(--workspace-h) + 8px);max-height:calc(100dvh - 104px)}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .form-grid{grid-template-columns:repeat(4,minmax(0,1fr));gap:6px 10px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .editor-shell-header{padding:10px 14px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .editor-shell-body{padding:10px 14px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .editor-shell-footer{padding:8px 14px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .field{gap:3px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .field label{font-size:10px;line-height:1.2}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .control{height:36px;border-radius:10px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) textarea.control{height:36px;min-height:36px;padding-top:7px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .invoice-retail-actions{margin-bottom:7px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .invoice-item-search{top:-10px;margin-bottom:7px;padding:6px 0}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .invoice-item-search .searchbar{height:36px;margin-bottom:0}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .table-tools{min-height:28px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .table-search{height:28px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .data-table th{padding:6px 7px;font-size:11px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .data-table td{padding:5px 7px;font-size:11px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .data-table td[colspan]{padding:9px!important}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) button[data-action="openItemPicker"]{height:34px;margin-block:2px 5px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .editor-summary-rail{bottom:-10px;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;margin:7px -14px -10px;padding:4px 8px}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .editor-summary-rail .summary-box{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:36px;padding:4px 9px;border-width:0 0 0 1px;border-radius:0}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .editor-summary-rail .summary-box:first-child{border-inline-start:0}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .editor-summary-rail .summary-box span{font-size:10px;white-space:nowrap}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .editor-summary-rail .summary-box strong{margin:0;font-size:14px;white-space:nowrap}
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .editor-shell-footer .btn{height:38px}
}
@media (min-width:701px) and (max-width:1199px){
  .document-editor-pane .editor-card:is([data-editor-form="sales-invoices"],[data-editor-form="purchase-invoices"],[data-editor-form="sales-returns"],[data-editor-form="purchase-returns"],[data-editor-form="journal-entries"]) .form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .document-workbench.has-editor .document-list-pane{display:none}
  .document-workbench.list-open .document-list-pane{display:block}
}
@media (max-width:700px){
  .document-workbench,.document-workbench.has-editor,.document-workbench.list-open{display:block}
  .document-workbench.has-editor .document-list-pane{display:none}
  .document-workbench.list-open .document-list-pane{position:fixed;inset:0;z-index:85;display:block;max-height:none;padding:14px 10px 90px;overflow:auto;background:var(--color-background)}
  .document-editor-pane .editor-shell-layer{position:fixed;inset:0;z-index:80;display:flex;padding:0;background:var(--color-surface)}
  .document-editor-pane .editor-card{width:100%;height:100dvh;max-height:100dvh;border:0;border-radius:0;box-shadow:none}
  .invoice-item-search{top:-11px;margin-bottom:8px;padding-block:7px}
  .editor-summary-rail{bottom:-11px;margin:10px -10px -11px;padding:8px 10px;grid-template-columns:repeat(2,minmax(0,1fr))}
}

/* Compact desktop document actions: preserve every command without oversized tiles. */
@media (min-width:701px){
  .editor-shell-footer{padding:4px 8px;overflow-x:auto;overflow-y:hidden;scrollbar-width:thin}
  .editor-shell-footer .document-quick-actions{display:flex;flex-wrap:nowrap;align-items:center;justify-content:flex-start;width:max-content;min-width:100%;gap:4px;margin-top:0!important}
  .editor-shell-footer .document-quick-actions .btn{flex:0 0 auto;width:auto;height:30px;min-height:30px;padding:3px 8px;border-radius:8px;font-size:10px;line-height:1;white-space:nowrap}
  .editor-shell-footer .document-quick-actions .btn .icon{width:14px;height:14px}
}
@media (max-width:700px){
  .editor-shell-footer .document-quick-actions{gap:4px}
  .editor-shell-footer .document-quick-actions .btn{height:38px;min-height:38px;padding:5px 9px;font-size:10px}
  .editor-shell-footer .document-quick-actions .btn .icon{width:15px;height:15px}
}

/* Final editor containment: nothing except tab/table rails may scroll inline. */
:where(.modal,.modal-card,.editor-shell-layer,.editor-card,.editor-shell-header,.editor-shell-body,.editor-shell-footer,.item-editor-groups,.editor-group,.form-grid,.item-unit-row,.item-unit-card-head,fieldset){box-sizing:border-box;min-width:0;max-width:100%}
:where(.modal-card,.editor-card,.editor-shell-body,.item-editor-groups,.editor-group,fieldset)>*{box-sizing:border-box;min-width:0;max-width:100%}
.editor-shell-layer,.modal{max-width:100vw;overflow-x:hidden}.editor-card,.modal-card{min-width:0;max-width:100%;overflow-x:hidden}.editor-shell-body{width:100%;min-width:0;max-width:100%;overflow-x:hidden}
.editor-card :where(input,select,textarea,button,label,.control){box-sizing:border-box;min-width:0;max-width:100%}
.editor-card .form-grid{grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr))}
.editor-card[data-editor-form="items"] :is(.item-unit-row,.item-unit-row.item-unit-row-guided,.item-unit-row-base){grid-template-columns:repeat(auto-fit,minmax(min(180px,100%),1fr))!important;width:100%;min-width:0;max-width:100%}
.editor-workspace-tabs,.workspace-tabs{min-width:0;max-width:100%;overflow-x:auto;overflow-y:hidden;overscroll-behavior-inline:contain}
.item-variant-optional{margin-top:12px;border:1px solid color-mix(in srgb,var(--color-border) 72%,#8b5cf6);border-radius:14px;background:color-mix(in srgb,var(--color-surface) 96%,#8b5cf6);overflow:hidden}
.item-variant-optional>summary{display:flex;align-items:center;gap:8px;padding:12px 14px;font-weight:800;color:#5530a5;cursor:pointer;list-style:none}
.item-variant-optional>summary::-webkit-details-marker{display:none}.item-variant-optional>summary small{margin-inline-start:auto;font-size:11px;font-weight:700;color:var(--color-muted)}
.item-variant-fields{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding:0 14px 14px}
.item-variant-fields label{display:grid;gap:6px;font-weight:700}.item-variant-fields input{width:100%;height:44px;padding:8px 11px;border:1px solid var(--color-border);border-radius:10px;background:var(--color-background);color:var(--color-text)}
.item-variant-fields small{font-size:11px;font-weight:500;line-height:1.5;color:var(--color-muted)}
@media(max-width:760px){.editor-card .form-grid,.editor-card[data-editor-form="items"] :is(.item-unit-row,.item-unit-row.item-unit-row-guided,.item-unit-row-base){grid-template-columns:1fr!important}}
@media(max-width:760px){.item-variant-fields{grid-template-columns:1fr;padding-inline:10px}.item-variant-optional>summary{padding-inline:10px}}
