/* Final checkbox visibility fix: global input appearance was hiding the tick mark */
input[type="checkbox"]{
  -webkit-appearance: checkbox !important;
  appearance: checkbox !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  padding: 0 !important;
  border-radius: 4px !important;
  accent-color: var(--success) !important;
  cursor: pointer !important;
  vertical-align: middle;
}
.inv-check{width:22px!important;height:22px!important;min-width:22px!important;}
.fz-mini-row{cursor:pointer;transition:transform .15s ease, background .15s ease;}
.fz-mini-row:hover{transform:translateX(-2px);background:rgba(255,255,255,.04);border-radius:10px;}
.farm-row{cursor:pointer;transition:transform .15s ease, background .15s ease;}
.farm-row:hover{transform:translateX(-2px);background:rgba(255,255,255,.04);border-radius:12px;}

/* PATCH: optional seller row under DL1 / RTN1 distribution headers */
.sales-dist-table .sd-seller-row th{
  background:#fff7d6!important;
  color:#111!important;
  padding:3px 4px!important;
  font-size:10px!important;
  font-weight:700!important;
}
.sales-dist-table .sd-seller-row th.sd-seller-empty{
  background:#f7f7f7!important;
  color:#9ca3af!important;
}
.sales-dist-seller-select{
  width:100%; min-width:78px; height:25px!important; min-height:25px!important;
  border:1px solid #d4a017!important; border-radius:3px!important;
  background:#fffdf0!important; color:#111!important;
  padding:0 4px!important; font-size:10px!important; font-family:var(--f-sans)!important;
  text-align:center!important; box-shadow:none!important;
}
.sales-dist-seller-select:focus{outline:2px solid #d4a017!important; box-shadow:none!important;}

/* PATCH FIX: DL1 aggregated sales orders + sales deletion */
.sales-dist-input.sd-sales-order-linked{background:#eef8ff!important;border-color:#38bdf8!important;color:#075985!important;font-weight:800!important;}
.sales-dist-input.sd-sales-order-linked.sd-manual-override{background:#fff7ed!important;border-color:#f59e0b!important;color:#92400e!important;}

/* PATCH: sales management item edit controls + frozen stock note */
.sales-mgmt-items{min-width:280px;line-height:1.8}
.sales-mgmt-item{display:flex;align-items:center;justify-content:space-between;gap:8px;border-bottom:1px solid var(--hair);padding:4px 0}
.sales-mgmt-item:last-child{border-bottom:0}
.sales-mgmt-item-main{flex:1;min-width:0}
.sales-mgmt-item-actions{display:flex;gap:4px;flex-wrap:wrap;justify-content:flex-end}
.sales-mgmt-item-actions .btn{padding:3px 7px!important;font-size:10px!important}
.frozen-stock-hint{display:block;margin-top:4px;font-family:var(--f-mono);font-size:10.5px;font-weight:800;color:var(--purple)}
.sales-dist-seller-select[disabled]{opacity:1!important;background:#f3f4f6!important;color:#111!important;cursor:not-allowed!important}

/* FINAL PATCH: LULU duplicate delivery-line aggregation fix */
.sales-dist-input.sd-lulu-linked{background:#f5f3ff!important;border-color:#8b5cf6!important;color:#4c1d95!important;font-weight:800!important;}
.sales-dist-input.sd-lulu-linked.sd-manual-override{background:#fff7ed!important;border-color:#f59e0b!important;color:#92400e!important;}

/* FINAL PATCH: Permanent orders paste/table must behave LEFT-TO-RIGHT like Excel.
   This prevents RTL layout from visually reversing LULU columns and keeps Column A as Item Code. */
#perm-paste{
  direction:ltr!important;
  text-align:left!important;
  unicode-bidi:plaintext!important;
  font-family:'IBM Plex Mono',monospace!important;
  white-space:pre!important;
}
#perm-table-wrap,
#perm-table-wrap table{
  direction:ltr!important;
  text-align:left!important;
}
#perm-table-wrap th,
#perm-table-wrap td{
  direction:ltr!important;
  text-align:left!important;
  unicode-bidi:plaintext!important;
}

/* PATCH: keep all Aurora detail popups centered regardless of scroll or click source */
.aurora-modal-overlay,
.aurora-modal-overlay.open{
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  place-items:center !important;
  padding:24px !important;
}
.aurora-modal-card{
  margin:auto !important;
  inset:auto !important;
  max-height:calc(100dvh - 48px) !important;
}
@media(max-width:700px){
  .aurora-modal-overlay,.aurora-modal-overlay.open{padding:14px !important;}
  .aurora-modal-card{max-height:calc(100dvh - 28px) !important;}
}

/* PATCH: stronger centered dashboard modal + full visibility */
#aurora-modal.aurora-modal-overlay,
.aurora-modal-overlay{
  position:fixed !important;
  inset:0 !important;
  width:100vw !important;
  height:100vh !important;
  height:100dvh !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  overflow:hidden !important;
  padding:22px !important;
  box-sizing:border-box !important;
}
#aurora-modal .aurora-modal-card,
.aurora-modal-card{
  position:relative !important;
  inset:auto !important;
  top:auto !important;
  left:auto !important;
  right:auto !important;
  bottom:auto !important;
  margin:auto !important;
  width:min(720px, calc(100vw - 44px)) !important;
  max-width:720px !important;
  max-height:calc(100dvh - 44px) !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  box-sizing:border-box !important;
}
#aurora-modal.open .aurora-modal-card{
  transform:none !important;
  opacity:1 !important;
}
.fz-location-split{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  width:100%;
  direction:rtl;
}
.fz-location-box{
  border:1px solid rgba(255,255,255,.08);
  background:rgba(255,255,255,.045);
  border-radius:12px;
  padding:8px 9px;
  text-align:center;
}
.fz-location-box .lbl{
  display:block;
  font-family:var(--f-sans)!important;
  font-size:10px;
  color:rgba(245,242,235,.58);
  margin-bottom:6px;
}
.fz-location-box .num{
  display:block;
  font-family:var(--f-mono)!important;
  font-size:22px;
  line-height:1;
  color:#EAF2FF;
  direction:ltr;
}
@media(max-width:700px){
  #aurora-modal.aurora-modal-overlay,
  .aurora-modal-overlay{padding:12px !important;}
  #aurora-modal .aurora-modal-card,
  .aurora-modal-card{width:calc(100vw - 24px) !important;max-height:calc(100dvh - 24px) !important;padding:24px 18px !important;border-radius:20px !important;}
}

/* FINAL PATCH: stable dashboard modal + visible location counters */
#aurora-modal.aurora-modal-overlay{
  position:fixed !important;
  inset:0 !important;
  width:100vw !important;
  height:100vh !important;
  height:100dvh !important;
  z-index:99999 !important;
  display:flex !important;
  align-items:center !important;
  justify-content:center !important;
  padding:24px !important;
  box-sizing:border-box !important;
  overflow:hidden !important;
  opacity:0;
  pointer-events:none;
}
#aurora-modal.aurora-modal-overlay.open{
  opacity:1 !important;
  pointer-events:auto !important;
}
#aurora-modal #aurora-modal-card.aurora-modal-card{
  position:relative !important;
  inset:auto !important;
  top:auto !important;
  left:auto !important;
  right:auto !important;
  bottom:auto !important;
  margin:0 auto !important;
  width:min(720px, calc(100vw - 48px)) !important;
  max-width:720px !important;
  max-height:calc(100dvh - 48px) !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  transform:none !important;
  box-sizing:border-box !important;
  opacity:1 !important;
}
.dh-location-split-final{
  display:grid !important;
  grid-template-columns:1fr 1fr !important;
  gap:10px !important;
  width:100% !important;
  direction:rtl !important;
}
.dh-location-split-final .loc-box{
  min-height:58px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.055);
  border-radius:14px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:6px;
}
.dh-location-split-final .loc-label{
  font-family:var(--f-sans)!important;
  font-size:10px;
  color:rgba(245,242,235,.62);
  line-height:1;
}
.dh-location-split-final .loc-num{
  font-family:var(--f-mono)!important;
  font-size:24px;
  font-weight:800;
  line-height:1;
  color:#EAF2FF;
  direction:ltr;
}
@media(max-width:700px){
  #aurora-modal.aurora-modal-overlay{padding:12px !important;}
  #aurora-modal #aurora-modal-card.aurora-modal-card{
    width:calc(100vw - 24px) !important;
    max-height:calc(100dvh - 24px) !important;
    padding:24px 18px !important;
    border-radius:20px !important;
  }
}

/* FINAL FIX V2: dashboard modal must be attached to body and centered in visible viewport */
body.dh-modal-open{
  overflow:hidden !important;
}
body > #aurora-modal.aurora-modal-overlay,
#aurora-modal.aurora-modal-overlay{
  position:fixed !important;
  top:0 !important;
  left:0 !important;
  right:0 !important;
  bottom:0 !important;
  inset:0 !important;
  width:100vw !important;
  height:100vh !important;
  height:100dvh !important;
  z-index:2147483000 !important;
  display:none !important;
  align-items:center !important;
  justify-content:center !important;
  padding:24px !important;
  overflow:hidden !important;
  box-sizing:border-box !important;
  transform:none !important;
}
body > #aurora-modal.aurora-modal-overlay.open,
#aurora-modal.aurora-modal-overlay.open{
  display:flex !important;
  opacity:1 !important;
  pointer-events:auto !important;
}
body > #aurora-modal #aurora-modal-card.aurora-modal-card,
#aurora-modal #aurora-modal-card.aurora-modal-card{
  position:relative !important;
  top:auto !important;
  left:auto !important;
  right:auto !important;
  bottom:auto !important;
  inset:auto !important;
  margin:auto !important;
  width:min(720px, calc(100vw - 48px)) !important;
  max-width:720px !important;
  max-height:calc(100dvh - 48px) !important;
  overflow-y:auto !important;
  overflow-x:hidden !important;
  box-sizing:border-box !important;
  transform:none !important;
  opacity:1 !important;
}
@media(max-width:700px){
  body > #aurora-modal.aurora-modal-overlay,
  #aurora-modal.aurora-modal-overlay{padding:12px !important;}
  body > #aurora-modal #aurora-modal-card.aurora-modal-card,
  #aurora-modal #aurora-modal-card.aurora-modal-card{
    width:calc(100vw - 24px) !important;
    max-height:calc(100dvh - 24px) !important;
    padding:22px 16px !important;
    border-radius:20px !important;
  }
}

/* PATCH: seller code only + linked quantities from sales orders to DL1 */
.sales-dist-seller-select{font-family:var(--f-mono)!important;font-weight:800!important;direction:ltr!important;text-align:center!important;}
.sales-dist-input.sd-sales-order-linked{
  background:#eef8ff!important;
  border-color:#38bdf8!important;
  color:#075985!important;
  font-weight:800!important;
  box-shadow:0 0 0 2px rgba(56,189,248,.10)!important;
}
.sales-dist-input.sd-sales-order-linked:focus{box-shadow:0 0 0 3px rgba(56,189,248,.18)!important;}

/* PATCH: sales-order linked DL1 quantities are editable */
.sales-dist-input.sd-sales-order-linked{
  background:#eef8ff!important;
  border-color:#38bdf8!important;
  color:#075985!important;
  font-weight:800!important;
}
.sales-dist-input.sd-sales-order-linked.sd-manual-override{
  background:#fff7ed!important;
  border-color:#f59e0b!important;
  color:#92400e!important;
}

/* FINAL OVERRIDE V2: DL1 summed sales orders + delete fix */
.sales-dist-input.sd-sales-order-linked{background:#eef8ff!important;border-color:#38bdf8!important;color:#075985!important;font-weight:800!important;}
.sales-dist-input.sd-sales-order-linked.sd-manual-override{background:#fff7ed!important;border-color:#f59e0b!important;color:#92400e!important;}

/* FINAL PATCH: LULU permanent orders linked to DL1 as baskets */
.sales-dist-input.sd-lulu-linked{
  background:#f0fdf4!important;
  border-color:#22c55e!important;
  color:#166534!important;
  font-weight:800!important;
}
.sales-dist-input.sd-sales-order-linked.sd-lulu-linked{
  background:linear-gradient(135deg,#eef8ff 0%,#f0fdf4 100%)!important;
  border-color:#0ea5e9!important;
}

/* FINAL PATCH: precise LULU -> DL1 mapping from duplicated delivery-line headers */
.sales-dist-input.sd-lulu-linked{background:#f0fdf4!important;border-color:#22c55e!important;color:#166534!important;font-weight:800!important;}
.sales-dist-input.sd-sales-order-linked.sd-lulu-linked{background:linear-gradient(135deg,#eef8ff 0%,#f0fdf4 100%)!important;border-color:#0ea5e9!important;}
.sales-dist-input.sd-manual-override{background:#fff7ed!important;border-color:#f59e0b!important;color:#92400e!important;}


/* ═══════════════════════════════════════════════════════
   SALES ROUTE ORDERS — route cards + printable order sheet
═══════════════════════════════════════════════════════ */
.route-orders-page-header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap}
.route-orders-head-actions{display:flex;gap:8px;flex-wrap:wrap}
.route-orders-kpis{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:16px}
.route-orders-selector-card{margin-bottom:16px}
.route-orders-search-wrap{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.route-orders-search-wrap input{width:min(320px,70vw)}
.route-orders-check{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--text2);cursor:pointer}
.route-orders-cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px;margin-top:12px}
.route-order-card{border:1px solid var(--border);background:var(--surface);border-radius:14px;padding:14px 12px;text-align:right;cursor:pointer;transition:.18s ease;box-shadow:0 2px 8px rgba(25,20,16,.04);font-family:inherit}
.route-order-card:hover{transform:translateY(-2px);border-color:rgba(212,33,42,.35);box-shadow:0 8px 20px rgba(25,20,16,.08)}
.route-order-card.active{border-color:var(--brand);box-shadow:0 0 0 2px rgba(212,33,42,.12);background:linear-gradient(145deg,#fff,#fff7f7)}
.route-order-card-name{display:block;font-weight:800;color:var(--text);font-size:13px;margin-bottom:8px}
.route-order-card-value{font-family:var(--f-display);font-size:25px;font-weight:800;color:var(--brand);line-height:1}
.route-order-card-unit{font-size:9px;color:var(--text3);margin-inline-start:4px}
.route-order-card-meta{display:block;font-size:10px;color:var(--text3);margin-top:8px}
.route-orders-report-shell{scroll-margin-top:15px}
.route-orders-report-card{overflow:hidden}
.route-orders-report-title{display:flex;justify-content:space-between;align-items:center;gap:14px;background:linear-gradient(120deg,#94141b,#d4212a);color:#fff;padding:18px 20px;margin:-18px -18px 16px;border-radius:var(--r) var(--r) 0 0}
.route-orders-report-title h2{font-size:24px;margin:3px 0 0;color:#fff}
.route-orders-report-eyebrow{font-family:var(--f-mono);font-size:9px;letter-spacing:2px;opacity:.75}
.route-orders-report-date{font-size:11px;opacity:.8;margin-top:4px}
.route-orders-report-totals{display:flex;gap:8px;direction:ltr}
.route-orders-report-totals>div{min-width:78px;text-align:center;border:1px solid rgba(255,255,255,.25);background:rgba(255,255,255,.1);border-radius:10px;padding:8px}
.route-orders-report-totals span{display:block;font-size:18px;font-weight:800}
.route-orders-report-totals small{font-size:9px;opacity:.8}
.route-orders-main-table{min-width:1000px;border-collapse:collapse}
.route-orders-main-table th,.route-orders-main-table td{border:1px solid #d5d1cc;text-align:center;padding:7px 6px;font-size:11px}
.route-orders-main-table thead th{background:#ef1924;color:#fff;font-weight:800;white-space:nowrap}
.route-orders-main-table .route-orders-super-head th{background:#d20f18;font-size:12px}
.route-orders-product-cell{text-align:right!important;min-width:220px;background:#fff}
.route-orders-product-cell strong{display:block;font-size:11px}
.route-orders-product-cell small{display:block;font-family:var(--f-mono);font-size:8px;color:var(--text3);direction:ltr;text-align:right;margin-top:2px}
.route-orders-category-row td{background:#f01b25!important;color:#fff!important;text-align:right!important;font-weight:800;font-size:11px;padding:7px 12px!important}
.route-orders-total-row td{background:#d8d8d8!important;color:#c9151e;font-weight:800}
.route-orders-grand-cell{background:#fff6a9;font-weight:800;color:#9f1017}
.route-orders-lower-grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(280px,1fr);gap:16px}
.route-orders-source-card{min-width:0}
.route-orders-source-summary{display:grid;gap:12px}
.route-source-line>div:first-child{display:flex;justify-content:space-between;gap:10px;font-size:12px;margin-bottom:5px}
.route-source-line span{font-family:var(--f-mono);color:var(--brand);font-weight:700}
.route-source-bar{height:7px;background:#eee9e4;border-radius:99px;overflow:hidden}
.route-source-bar i{display:block;height:100%;background:linear-gradient(90deg,var(--brand),var(--gold));border-radius:99px}
@media(max-width:1000px){.route-orders-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.route-orders-lower-grid{grid-template-columns:1fr}.route-orders-report-title{align-items:flex-start}.route-orders-report-totals{flex-wrap:wrap}}
@media(max-width:600px){.route-orders-kpis{grid-template-columns:1fr 1fr}.route-orders-cards{grid-template-columns:repeat(2,minmax(0,1fr))}.route-orders-report-title{display:block}.route-orders-report-totals{margin-top:12px}.route-orders-report-totals>div{flex:1}.route-orders-head-actions .btn{flex:1}}
@media print{
  body.route-orders-printing .sidebar,body.route-orders-printing .mobile-toggle,body.route-orders-printing .route-orders-selector-card,body.route-orders-printing .route-orders-kpis,body.route-orders-printing .route-orders-head-actions,body.route-orders-printing .toast{display:none!important}
  body.route-orders-printing .app{display:block!important}
  body.route-orders-printing .main{margin:0!important;padding:0!important;width:100%!important;overflow:visible!important}
  body.route-orders-printing .page{display:none!important}
  body.route-orders-printing #page-sales-route-orders{display:block!important}
  body.route-orders-printing .card{box-shadow:none!important;border:0!important}
  body.route-orders-printing .route-orders-main-table{min-width:0;width:100%}
  body.route-orders-printing .route-orders-main-table th,body.route-orders-printing .route-orders-main-table td{font-size:8px;padding:4px 2px}
  body.route-orders-printing .route-orders-lower-grid{display:block}
  body.route-orders-printing .route-orders-source-card{break-inside:avoid;margin-top:12px}
}

/* HYPER delivery locations for Bag category in Sales Route Orders */
.route-orders-hyper-location-cell{min-width:145px;padding:5px!important}
.route-orders-hyper-location-cell>strong{display:block;color:var(--brand);margin-bottom:4px;font-size:11px}
.route-orders-hyper-location{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:3px 5px;margin-top:3px;border-radius:5px;background:#fff5f5;border:1px solid #ffd9dc;font-size:9px;line-height:1.3}
.route-orders-hyper-location span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right}
.route-orders-hyper-location b{font-family:var(--f-mono);color:var(--brand);direction:ltr;white-space:nowrap}
@media print{
  body.route-orders-printing .route-orders-hyper-location{font-size:7px;padding:2px 3px;margin-top:2px}
}

/* Branch breakdown for every permanent-order source in Sales Route Orders */
.route-orders-source-detail-cell{min-width:150px;padding:5px!important;vertical-align:top}
.route-orders-source-detail-cell>strong{display:block;color:var(--brand);margin-bottom:4px;font-size:11px}
.route-orders-branch-detail{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:3px 5px;margin-top:3px;border-radius:5px;background:#fff5f5;border:1px solid #ffd9dc;font-size:9px;line-height:1.35}
.route-orders-branch-detail span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:right}
.route-orders-branch-detail b{font-family:var(--f-mono);color:var(--brand);direction:ltr;white-space:nowrap}
@media print{
  body.route-orders-printing .route-orders-source-detail-cell{min-width:95px}
  body.route-orders-printing .route-orders-branch-detail{font-size:6.5px;padding:2px 3px;margin-top:2px}
}

/* Separate printable source sheets for Sales Route Orders */
.route-orders-print-note{
  margin:0 0 14px;
  padding:9px 12px;
  border:1px solid #eadfda;
  border-radius:8px;
  background:#fffaf7;
  color:var(--text2);
  font-size:11px;
}
.route-orders-source-tables{display:grid;gap:18px}
.route-source-sheet{
  border:1px solid #d4cfca;
  border-radius:10px;
  overflow:hidden;
  background:#fff;
  break-inside:avoid;
}
.route-source-sheet-title{
  background:#e3141e;
  color:#fff;
  text-align:center;
  font-size:15px;
  font-weight:800;
  padding:9px 12px;
  letter-spacing:.4px;
}
.route-source-sheet-table{
  width:100%;
  min-width:760px;
  border-collapse:collapse;
  direction:rtl;
}
.route-source-sheet-table th,
.route-source-sheet-table td{
  border:1px solid #2d2d2d;
  padding:6px 5px;
  text-align:center;
  font-size:10px;
  line-height:1.35;
}
.route-source-sheet-table thead th{
  background:#f01822;
  color:#fff;
  font-weight:800;
  white-space:nowrap;
}
.route-source-sheet-table .route-source-desc{
  min-width:220px;
  text-align:right;
}
.route-source-product{text-align:right!important;background:#fff}
.route-source-product strong{display:block;font-size:10px}
.route-source-product small{display:block;margin-top:2px;font-family:var(--f-mono);font-size:7.5px;color:#777;direction:ltr;text-align:right}
.route-source-category td{
  background:#f31b25!important;
  color:#fff!important;
  text-align:right!important;
  font-weight:800;
  padding:6px 10px!important;
}
.route-source-total td{background:#d8d8d8!important;color:#bd1119;font-weight:800}
.route-source-crates{background:#fff4a3;font-weight:800;color:#9f1017}

@media(max-width:900px){
  .route-source-sheet-table{min-width:680px}
}

@media print{
  body.route-orders-printing .route-orders-print-note{display:none!important}
  body.route-orders-printing .route-orders-source-tables{display:block}
  body.route-orders-printing .route-source-sheet{
    margin:0 0 10mm;
    border-radius:0;
    border:1px solid #111;
    break-inside:avoid;
    page-break-inside:avoid;
  }
  body.route-orders-printing .route-source-sheet-title{
    background:#e3141e!important;
    color:#fff!important;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
    font-size:11px;
    padding:5px;
  }
  body.route-orders-printing .route-source-sheet-table{
    width:100%!important;
    min-width:0!important;
    table-layout:fixed;
  }
  body.route-orders-printing .route-source-sheet-table th,
  body.route-orders-printing .route-source-sheet-table td{
    font-size:6.5px!important;
    padding:2px 1px!important;
    border-color:#111!important;
    word-break:break-word;
  }
  body.route-orders-printing .route-source-sheet-table .route-source-desc{width:19%;min-width:0}
  body.route-orders-printing .route-source-product strong{font-size:6.5px}
  body.route-orders-printing .route-source-product small{font-size:5.5px}
  body.route-orders-printing .route-source-category td,
  body.route-orders-printing .route-source-sheet-table thead th{
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
  body.route-orders-printing .route-orders-lower-grid{break-before:auto}
}

/* Route Orders V3 — print-friendly two-table layout + fixed HYPER branch row */
.route-orders-source-tables{
  grid-template-columns:repeat(2,minmax(0,1fr));
  align-items:start;
}
.route-source-sheet-wide{grid-column:1 / -1}
.route-source-sheet .table-wrap{overflow:auto}
.route-source-sheet-table{min-width:0;table-layout:fixed}
.route-source-sheet-table th:not(.route-source-desc),
.route-source-sheet-table td:not(.route-source-product){word-break:break-word}

@media(max-width:1100px){
  .route-orders-source-tables{grid-template-columns:1fr}
  .route-source-sheet-wide{grid-column:auto}
  .route-source-sheet-table{min-width:720px;table-layout:auto}
}

@media print{
  @page{size:A4 landscape;margin:6mm}
  body.route-orders-printing .route-orders-source-tables{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:5mm!important;
    align-items:start!important;
  }
  body.route-orders-printing .route-source-sheet{
    width:100%!important;
    margin:0!important;
    break-inside:avoid!important;
    page-break-inside:avoid!important;
  }
  body.route-orders-printing .route-source-sheet-wide{
    grid-column:1 / -1!important;
  }
  body.route-orders-printing .route-source-sheet .table-wrap{
    overflow:visible!important;
  }
  body.route-orders-printing .route-source-sheet-table{
    width:100%!important;
    min-width:0!important;
    table-layout:fixed!important;
  }
  body.route-orders-printing .route-source-sheet-table th,
  body.route-orders-printing .route-source-sheet-table td{
    font-size:6.5px!important;
    line-height:1.15!important;
    padding:2px 1.5px!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  body.route-orders-printing .route-source-sheet-title{
    font-size:10px!important;
    padding:4px 6px!important;
  }
  body.route-orders-printing .route-source-sheet-table .route-source-desc{
    width:25%!important;
    min-width:0!important;
  }
  body.route-orders-printing .route-source-product strong{font-size:6.8px!important}
  body.route-orders-printing .route-source-product small{font-size:5.6px!important}
}

/* HYPER Grade B aggregate row in route orders */
.route-source-sheet-table tr.route-source-grade-b td{
  background:#fff3cd;
  font-weight:700;
}
.route-source-sheet-table tr.route-source-grade-b .route-source-product small{
  color:#9a6700;
}


/* ═══════════════════════════════════════════════════
   SALES — DYNAMIC TRANSFER
═══════════════════════════════════════════════════ */
.dynamic-transfer-page-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.dynamic-transfer-actions{display:flex;gap:8px;flex-wrap:wrap}
.dynamic-transfer-control-card{margin-bottom:14px}
.dynamic-transfer-switches{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;flex-wrap:wrap}
.dynamic-transfer-meta{display:grid;grid-template-columns:repeat(4,minmax(105px,1fr));gap:8px;min-width:min(100%,520px)}
.dynamic-transfer-meta>div{border:1px solid var(--border);border-radius:10px;background:var(--surface-2,#fafafa);padding:9px 11px}
.dynamic-transfer-meta span{display:block;font-size:9px;color:var(--text3);margin-bottom:3px}
.dynamic-transfer-meta strong{display:block;font-family:var(--f-mono);font-size:13px;color:var(--ink)}
.dynamic-transfer-route-tabs{display:grid;grid-template-columns:repeat(auto-fill,minmax(125px,1fr));gap:8px}
.dynamic-transfer-route-btn{border:1px solid var(--border);border-radius:10px;background:var(--surface);padding:9px 10px;cursor:pointer;font-family:inherit;color:var(--text2);transition:.16s ease;text-align:center}
.dynamic-transfer-route-btn:hover{border-color:var(--brand);transform:translateY(-1px)}
.dynamic-transfer-route-btn.active{background:var(--brand);border-color:var(--brand);color:#fff;box-shadow:0 7px 18px rgba(212,33,42,.18)}
.dynamic-transfer-route-btn span{display:block;font-size:11px;font-weight:800}
.dynamic-transfer-route-btn small{display:block;font-family:var(--f-mono);font-size:8px;opacity:.72;margin-top:2px;direction:ltr}
.dynamic-transfer-warning{margin:0 0 14px;border:1px solid #f3c96a;background:#fff8df;color:#7d5711;border-radius:10px;padding:10px 13px;font-size:11px}
.dynamic-transfer-grid{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(330px,.7fr);gap:14px;align-items:start}
.dynamic-transfer-preview-wrap{max-height:610px}
.dynamic-transfer-table{min-width:980px}
.dynamic-transfer-table th,.dynamic-transfer-table td{white-space:nowrap;text-align:center}
.dynamic-transfer-table tfoot td{background:#f5f0e9;font-weight:800;color:var(--brand)}
.dynamic-transfer-copy-card{position:sticky;top:14px}
.dynamic-transfer-copy-card textarea{width:100%;min-height:425px;resize:vertical;font-family:var(--f-mono);font-size:10px;line-height:1.55;direction:ltr;text-align:left;white-space:pre;tab-size:4}
.dynamic-transfer-format-note{font-size:9px;color:var(--text3);margin-top:8px;line-height:1.6}
.dt-seller-code{font-family:var(--f-mono);font-weight:800;color:var(--purple)}
@media(max-width:1050px){.dynamic-transfer-grid{grid-template-columns:1fr}.dynamic-transfer-copy-card{position:static}.dynamic-transfer-meta{grid-template-columns:repeat(2,minmax(100px,1fr))}}
@media(max-width:600px){.dynamic-transfer-actions .btn{flex:1}.dynamic-transfer-route-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}.dynamic-transfer-meta{width:100%}}

/* Dynamic transfer batch columns */
#page-sales-dynamic-transfer .dt-batch{
  font-family:var(--f-mono);
  direction:ltr;
  font-weight:700;
  color:var(--purple);
}

/* Sales Dynamic Transfer — missing batch warning */
#page-sales-dynamic-transfer .dt-batch-missing{
  color:var(--brand);
  background:rgba(212,33,42,.08);
  font-weight:700;
}


/* ═══ FROZEN SALES ORDERS ═══ */
.frozen-sales-orders-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.fso-header-actions{display:flex;gap:8px;flex-wrap:wrap}
.fso-stats{grid-template-columns:repeat(5,minmax(150px,1fr))}
.fso-filter-card{margin-bottom:16px}
.fso-filter-grid{display:grid;grid-template-columns:2fr repeat(3,minmax(160px,1fr));gap:12px;align-items:end}
.fso-result-meta{font-size:12px;font-weight:700;color:var(--text3);background:var(--bg2);border:1px solid var(--border);border-radius:999px;padding:5px 10px}
.fso-table{min-width:1180px}
.fso-line-row td{background:linear-gradient(90deg,var(--purple-dim),#fff);color:var(--purple);font-weight:800;font-size:12px;padding:8px 12px;border-top:2px solid rgba(124,58,237,.2)}
.fso-line-total td{background:#faf7ff;font-weight:800;border-top:1px solid rgba(124,58,237,.18);border-bottom:2px solid rgba(124,58,237,.18)}
@media(max-width:1100px){.fso-stats{grid-template-columns:repeat(2,minmax(140px,1fr))}.fso-filter-grid{grid-template-columns:1fr 1fr}}
@media(max-width:640px){.fso-stats,.fso-filter-grid{grid-template-columns:1fr}.frozen-sales-orders-header{align-items:stretch}.fso-header-actions .btn{flex:1}}

/* Approved frozen sales orders: auto-filled ORDER Box */
#fwh-order-products-body .fwh-order-linked{
  background:rgba(22,163,74,.08);
  border-color:rgba(22,163,74,.28);
  color:var(--green,#168f45);
  font-weight:800;
  cursor:not-allowed;
}


/* Frozen Sales Orders — tabs and route seller assignment */
.fso-tabs{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 16px;padding:6px;background:var(--surface,#fff);border:1px solid var(--border);border-radius:14px}
.fso-tab{border:1px solid var(--border);background:var(--bg2,#faf8f5);color:var(--text2);padding:9px 16px;border-radius:10px;font-family:inherit;font-weight:800;cursor:pointer}
.fso-tab.active{background:var(--brand,#d4212a);border-color:var(--brand,#d4212a);color:#fff;box-shadow:0 6px 15px rgba(212,33,42,.18)}
.fso-seller-select{min-width:220px;max-width:320px;padding:7px 10px;font-size:11px;background:#fff;border:1px solid rgba(124,58,237,.28);border-radius:8px}
.fso-seller-group td{background:linear-gradient(90deg,rgba(22,143,69,.12),#fff);font-weight:900;color:var(--green,#168f45);border-top:2px solid rgba(22,143,69,.2)}
.fso-dynamic-panel{text-align:center;padding:55px 20px;min-height:260px}
.fso-placeholder-icon{width:64px;height:64px;display:grid;place-items:center;margin:0 auto 14px;border-radius:18px;background:rgba(124,58,237,.1);color:var(--purple);font-size:34px;font-weight:900}
.fso-dynamic-panel h3{margin:0 0 8px;font-size:22px}.fso-dynamic-panel p{margin:0;color:var(--text3)}
@media(max-width:640px){.fso-tabs{display:grid;grid-template-columns:1fr}.fso-seller-select{min-width:100%;max-width:100%}}

/* Frozen sales orders — seller FEFO dynamic transfer */
.fso-dynamic-panel{text-align:initial;padding:18px;min-height:320px}
.fso-dynamic-head{align-items:flex-start;gap:14px;flex-wrap:wrap}
.fso-dynamic-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.fso-dynamic-actions select{min-width:230px;padding:8px 10px;border:1px solid var(--border);border-radius:9px;background:#fff;font-family:inherit}
.fso-dynamic-note{font-size:11px;color:var(--text3);margin-top:5px}
.fso-dynamic-panel>.fso-result-meta{display:inline-block;margin:10px 0}
.fso-dynamic-table{min-width:1250px}
.fso-dynamic-table th,.fso-dynamic-table td{white-space:nowrap;text-align:center}
.fso-dynamic-copy-block{margin-top:14px}
#fso-dynamic-text{width:100%;min-height:190px;resize:vertical;direction:ltr;text-align:left;font-family:var(--f-mono,monospace);font-size:11px;line-height:1.55;padding:12px;border:1px solid var(--border);border-radius:10px;background:#fbfbfb}
@media(max-width:700px){.fso-dynamic-actions{width:100%}.fso-dynamic-actions select{min-width:100%;flex:1}.fso-dynamic-actions .btn{flex:1}}

/* Frozen sales orders by seller inside Sales Route Orders */
.route-frozen-sellers-title{
  grid-column:1/-1;
  margin:2px 0 -6px;
  padding:10px 14px;
  border-radius:10px;
  background:linear-gradient(120deg,#24114b,#5f2dbd);
  color:#fff;
  font-weight:800;
  font-size:14px;
  text-align:right;
}
.route-frozen-seller-sheet .route-source-sheet-title{
  background:linear-gradient(120deg,#32145f,#7440cf);
}
.route-frozen-seller-meta{
  padding:7px 10px;
  background:#f5f0ff;
  color:#5f2dbd;
  border-top:1px solid #ded3f6;
  font-size:10px;
  font-weight:700;
  text-align:left;
  direction:rtl;
}
@media print{
  body.route-orders-printing .route-frozen-sellers-title{
    break-before:page;
    font-size:9px;
    padding:5px 7px;
    background:#32145f!important;
    -webkit-print-color-adjust:exact;
    print-color-adjust:exact;
  }
  body.route-orders-printing .route-frozen-seller-sheet{
    break-inside:avoid;
  }
  body.route-orders-printing .route-frozen-seller-meta{
    font-size:6px;
    padding:3px 5px;
  }
}

/* Frozen sellers as independent cards inside Sales Route Orders */
.route-orders-seller-divider{flex:0 0 100%;display:flex;align-items:center;gap:10px;margin:8px 0 2px;font-weight:800;color:var(--brand);font-size:12px}
.route-orders-seller-divider:before,.route-orders-seller-divider:after{content:"";height:1px;background:var(--border);flex:1}
.route-order-seller-card{border-style:dashed}
.route-order-seller-card.active{border-style:solid}


/* Final Distribution — same visual table as DL1 / RTN1 */
#page-sales-final-distribution .final-dist-readonly{cursor:default;background:var(--surface-2,#fdfcfa);font-weight:700;color:var(--ink);}
#page-sales-final-distribution .final-dist-readonly:focus{outline:none;box-shadow:none;border-color:var(--border);}
#page-sales-final-distribution .sales-dist-meta input:disabled{opacity:1;color:var(--ink-2);background:var(--surface-2,#fdfcfa);}

/* ═══════════════════════════════════════════════════════
   SALES DISTRIBUTION COLOR THEMES ONLY
   DL1 = Red · RTN1 = Yellow · Final = Blue
   Structure, spacing, logic and values remain unchanged.
═══════════════════════════════════════════════════════ */

/* Shared neutral cells */
#page-sales-dl1 .sales-dist-table,
#page-sales-rtn1 .sales-dist-table,
#page-sales-final-distribution .sales-dist-table{
  background:#ffffff!important;
}
#page-sales-dl1 .sales-dist-table th,
#page-sales-rtn1 .sales-dist-table th,
#page-sales-final-distribution .sales-dist-table th{
  background:#d9d9d9!important;
  color:#111!important;
}
#page-sales-dl1 .sales-dist-table td:not(.sd-qty):not(.sd-fresh):not(.sd-online):not(.sd-internal):not(.sd-distributed):not(.sd-balance),
#page-sales-rtn1 .sales-dist-table td:not(.sd-qty):not(.sd-fresh):not(.sd-online):not(.sd-internal):not(.sd-distributed):not(.sd-balance),
#page-sales-final-distribution .sales-dist-table td:not(.sd-qty):not(.sd-fresh):not(.sd-online):not(.sd-internal):not(.sd-distributed):not(.sd-balance){
  background:#ffffff!important;
}

/* ─── DL1 — RED THEME ─── */
#page-sales-dl1 .sales-dist-table .sd-title-row th,
#page-sales-dl1 .sales-dist-table .sd-cat-row td{
  background:#ff0000!important;
  color:#ffffff!important;
}
#page-sales-dl1 .sales-dist-table .sd-qty,
#page-sales-dl1 .sales-dist-table .sd-distributed,
#page-sales-dl1 .sales-dist-table .sd-balance{
  background:#ff0000!important;
  color:#ffffff!important;
}
#page-sales-dl1 .sales-dist-table .sd-fresh{
  background:#f4a69e!important;
  color:#111!important;
}
#page-sales-dl1 .sales-dist-table .sd-online{
  background:#f4c2c2!important;
  color:#111!important;
}
#page-sales-dl1 .sales-dist-table .sd-internal{
  background:#e2b2ae!important;
  color:#111!important;
}
#page-sales-dl1 .sales-dist-table .sd-total-row td{
  background:#bfbfbf!important;
  color:#ff0000!important;
}
#page-sales-dl1 .sales-dist-table .sd-summary-row td{
  background:#ffffff!important;
  color:#ff0000!important;
}
#page-sales-dl1 .sales-dist-table .sd-summary-row .sd-qty,
#page-sales-dl1 .sales-dist-table .sd-summary-row .sd-distributed,
#page-sales-dl1 .sales-dist-table .sd-summary-row .sd-balance{
  background:#ff0000!important;
  color:#ffffff!important;
}
#page-sales-dl1 .sales-dist-input,
#page-sales-dl1 .sales-dist-num{
  color:inherit!important;
}

/* ─── RTN1 — YELLOW THEME ─── */
#page-sales-rtn1 .sales-dist-table .sd-title-row th,
#page-sales-rtn1 .sales-dist-table .sd-cat-row td{
  background:#fff200!important;
  color:#111!important;
}
#page-sales-rtn1 .sales-dist-table .sd-qty,
#page-sales-rtn1 .sales-dist-table .sd-distributed,
#page-sales-rtn1 .sales-dist-table .sd-balance{
  background:#fff200!important;
  color:#111!important;
}
#page-sales-rtn1 .sales-dist-table .sd-fresh{
  background:#ffe599!important;
  color:#111!important;
}
#page-sales-rtn1 .sales-dist-table .sd-online{
  background:#fce5a5!important;
  color:#111!important;
}
#page-sales-rtn1 .sales-dist-table .sd-internal{
  background:#ffd966!important;
  color:#111!important;
}
#page-sales-rtn1 .sales-dist-table .sd-total-row td{
  background:#bfbfbf!important;
  color:#ff0000!important;
}
#page-sales-rtn1 .sales-dist-table .sd-summary-row td{
  background:#ffffff!important;
  color:#ff0000!important;
}
#page-sales-rtn1 .sales-dist-table .sd-summary-row .sd-qty,
#page-sales-rtn1 .sales-dist-table .sd-summary-row .sd-distributed,
#page-sales-rtn1 .sales-dist-table .sd-summary-row .sd-balance{
  background:#fff200!important;
  color:#111!important;
}
#page-sales-rtn1 .sales-dist-input,
#page-sales-rtn1 .sales-dist-num{
  color:inherit!important;
}

/* ─── FINAL DISTRIBUTION — BLUE THEME ─── */
#page-sales-final-distribution .sales-dist-table .sd-title-row th,
#page-sales-final-distribution .sales-dist-table .sd-cat-row td{
  background:#4285f4!important;
  color:#ffffff!important;
}
#page-sales-final-distribution .sales-dist-table .sd-qty,
#page-sales-final-distribution .sales-dist-table .sd-distributed,
#page-sales-final-distribution .sales-dist-table .sd-balance{
  background:#4285f4!important;
  color:#ffffff!important;
}
#page-sales-final-distribution .sales-dist-table .sd-fresh{
  background:#c9daf8!important;
  color:#111!important;
}
#page-sales-final-distribution .sales-dist-table .sd-online{
  background:#b4c7e7!important;
  color:#111!important;
}
#page-sales-final-distribution .sales-dist-table .sd-internal{
  background:#9fc5e8!important;
  color:#111!important;
}
#page-sales-final-distribution .sales-dist-table .sd-total-row td{
  background:#bfbfbf!important;
  color:#4285f4!important;
}
#page-sales-final-distribution .sales-dist-table .sd-summary-row td{
  background:#ffffff!important;
  color:#4285f4!important;
}
#page-sales-final-distribution .sales-dist-table .sd-summary-row .sd-qty,
#page-sales-final-distribution .sales-dist-table .sd-summary-row .sd-distributed,
#page-sales-final-distribution .sales-dist-table .sd-summary-row .sd-balance{
  background:#4285f4!important;
  color:#ffffff!important;
}
#page-sales-final-distribution .sales-dist-input,
#page-sales-final-distribution .sales-dist-num,
#page-sales-final-distribution .final-dist-readonly{
  color:inherit!important;
  background:transparent!important;
}

/* Keep focused editable cells readable without changing the page palette */
#page-sales-dl1 .sales-dist-input:focus,
#page-sales-rtn1 .sales-dist-input:focus{
  background:#ffffff!important;
  color:#111!important;
}

/* Distribution color accuracy fix — category bands and seller row */
#page-sales-dl1 .sales-dist-table tbody tr.sd-cat-row > td{
  background:#ff0000!important;
  color:#ffffff!important;
}
#page-sales-final-distribution .sales-dist-table tbody tr.sd-cat-row > td{
  background:#4285f4!important;
  color:#ffffff!important;
}
#page-sales-rtn1 .sales-dist-table tbody tr.sd-cat-row > td{
  background:#fff200!important;
  color:#111111!important;
}

/* Seller row follows each page palette; Final mirrors DL1 seller selections */
#page-sales-dl1 .sales-dist-table thead tr.sd-seller-row > th{
  background:#f4c2c2!important;
  color:#111!important;
}
#page-sales-rtn1 .sales-dist-table thead tr.sd-seller-row > th{
  background:#fce5a5!important;
  color:#111!important;
}
#page-sales-final-distribution .sales-dist-table thead tr.sd-seller-row > th{
  background:#c9daf8!important;
  color:#111!important;
}
#page-sales-final-distribution .sales-dist-table thead tr.sd-seller-row > th.sd-qty,
#page-sales-final-distribution .sales-dist-table thead tr.sd-seller-row > th.sd-distributed,
#page-sales-final-distribution .sales-dist-table thead tr.sd-seller-row > th.sd-balance{
  background:#4285f4!important;
  color:#fff!important;
}
#page-sales-final-distribution .sales-dist-table thead tr.sd-seller-row > th.sd-fresh{
  background:#c9daf8!important;
}
#page-sales-final-distribution .sales-dist-table thead tr.sd-seller-row > th.sd-online{
  background:#b4c7e7!important;
}
#page-sales-final-distribution .sales-dist-table thead tr.sd-seller-row > th.sd-internal{
  background:#9fc5e8!important;
}
#page-sales-final-distribution .sales-dist-seller-select:disabled{
  opacity:1!important;
  color:#111!important;
  -webkit-text-fill-color:#111!important;
  background:#fff!important;
  cursor:default!important;
}

/* FINAL HOTFIX — force category labels visible on DL1 / RTN1 / Final */
#page-sales-dl1 table.sales-dist-table tbody > tr.sd-cat-row > td{
  background-color:#ff0000!important;
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
  opacity:1!important;
  visibility:visible!important;
  font-size:12px!important;
  font-weight:900!important;
  text-align:right!important;
}
#page-sales-rtn1 table.sales-dist-table tbody > tr.sd-cat-row > td{
  background-color:#fff200!important;
  color:#111111!important;
  -webkit-text-fill-color:#111111!important;
  opacity:1!important;
  visibility:visible!important;
  font-size:12px!important;
  font-weight:900!important;
  text-align:right!important;
}
#page-sales-final-distribution table.sales-dist-table tbody > tr.sd-cat-row > td{
  background-color:#4285f4!important;
  color:#ffffff!important;
  -webkit-text-fill-color:#ffffff!important;
  opacity:1!important;
  visibility:visible!important;
  font-size:12px!important;
  font-weight:900!important;
  text-align:right!important;
}

/* ═══════════════════════════════════════════════
   DASHBOARD — SALES INTELLIGENCE
═══════════════════════════════════════════════ */
.sales-intel-section{position:relative;margin-top:26px;padding:24px;border:1px solid rgba(147,197,253,.18);border-radius:22px;background:linear-gradient(145deg,rgba(13,25,45,.96),rgba(20,15,33,.96));box-shadow:0 24px 70px rgba(0,0,0,.24);overflow:hidden;color:#f7f4ee}
.sales-intel-section:before{content:"";position:absolute;inset:0;pointer-events:none;background:radial-gradient(circle at 86% 8%,rgba(96,165,250,.14),transparent 32%),radial-gradient(circle at 8% 92%,rgba(212,33,42,.11),transparent 34%)}
.sales-intel-section>*{position:relative;z-index:1}
.sales-intel-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;flex-wrap:wrap;margin-bottom:20px}
.sales-intel-eyebrow{font:700 9px/1.4 var(--f-mono);letter-spacing:1.8px;color:#93c5fd;text-transform:uppercase;margin-bottom:7px}
.sales-intel-head h2{font:800 24px/1.4 var(--f-display);margin:0;color:#fff}
.sales-intel-head p{margin:5px 0 0;font-size:11px;color:rgba(245,242,235,.54)}
.sales-intel-refresh{display:inline-flex;align-items:center;gap:8px;border:1px solid rgba(147,197,253,.26);background:rgba(147,197,253,.09);color:#dbeafe;border-radius:10px;padding:9px 13px;font-family:inherit;font-size:11px;font-weight:700;cursor:pointer;transition:.2s}
.sales-intel-refresh:hover{background:rgba(147,197,253,.17);transform:translateY(-1px)}
.sales-intel-refresh span{font-size:16px}
.sales-intel-kpis{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:10px;margin-bottom:14px}
.sales-intel-kpi{padding:14px 13px;border:1px solid rgba(255,255,255,.08);border-radius:14px;background:rgba(255,255,255,.035);min-height:102px;display:flex;flex-direction:column;justify-content:center}
.sales-intel-kpi.alert{border-color:rgba(252,165,165,.18);background:rgba(252,165,165,.05)}
.si-kpi-label{font-size:10px;color:rgba(245,242,235,.52);margin-bottom:8px}
.sales-intel-kpi strong{font:800 24px/1 var(--f-serif);color:#fff}
.sales-intel-kpi small{font-size:8px;color:rgba(245,242,235,.38);margin-top:7px}
.sales-intel-kpi.alert strong{color:#fca5a5}
.sales-intel-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
.sales-intel-panel{padding:15px;border:1px solid rgba(255,255,255,.07);border-radius:15px;background:rgba(0,0,0,.13);min-height:260px}
.sales-intel-panel-head{display:flex;align-items:center;justify-content:space-between;gap:8px;padding-bottom:11px;margin-bottom:9px;border-bottom:1px solid rgba(255,255,255,.06)}
.sales-intel-panel-head h3{font-size:12px;color:#fff;margin:0}
.sales-intel-panel-head span{font:600 8px/1 var(--f-mono);color:rgba(245,242,235,.35)}
.sales-intel-list{display:flex;flex-direction:column;gap:10px}
.sales-intel-row{display:grid;grid-template-columns:22px 1fr auto;gap:8px;align-items:center}
.sales-intel-rank{width:20px;height:20px;border-radius:6px;display:grid;place-items:center;font:700 9px/1 var(--f-mono);background:rgba(255,255,255,.06);color:rgba(255,255,255,.55)}
.sales-intel-rank.top{background:rgba(212,168,92,.14);color:#f6d38c}
.sales-intel-row-main{min-width:0}
.sales-intel-row-title{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:5px}
.sales-intel-row-title strong{font-size:9px;color:rgba(255,255,255,.82);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.sales-intel-row-title small{font-size:7px;color:rgba(255,255,255,.3);white-space:nowrap}
.sales-intel-track{height:4px;border-radius:999px;background:rgba(255,255,255,.06);overflow:hidden}
.sales-intel-track i{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,#60a5fa,#c4b5fd)}
.sales-intel-row-value{font:700 9px/1.2 var(--f-mono);color:#bfdbfe;text-align:left}
.sales-intel-row-value small{display:block;font-size:6px;color:rgba(255,255,255,.3);margin-top:3px}
.sales-intel-alerts{display:flex;flex-direction:column;gap:8px}
.sales-intel-alert{display:grid;grid-template-columns:7px 1fr auto;gap:9px;align-items:center;padding:10px;border-radius:10px;background:rgba(255,255,255,.035)}
.sales-intel-alert-dot{width:6px;height:6px;border-radius:50%;background:#93c5fd;box-shadow:0 0 10px currentColor}
.sales-intel-alert.danger .sales-intel-alert-dot{background:#f87171}.sales-intel-alert.warn .sales-intel-alert-dot{background:#fbbf24}.sales-intel-alert.info .sales-intel-alert-dot{background:#60a5fa}.sales-intel-alert.neutral .sales-intel-alert-dot{background:#c4b5fd}
.sales-intel-alert strong{display:block;font-size:9px;color:rgba(255,255,255,.82)}
.sales-intel-alert small{display:block;font-size:7px;color:rgba(255,255,255,.34);margin-top:3px}
.sales-intel-alert b{font:800 15px/1 var(--f-mono);color:#fff}
.sales-intel-ok,.sales-intel-empty{display:grid;place-items:center;min-height:150px;text-align:center;color:rgba(255,255,255,.28);font-size:10px}
.sales-intel-foot{text-align:left;margin-top:12px;font:500 8px/1 var(--f-mono);color:rgba(255,255,255,.28)}
.future-card-active{cursor:pointer;border-color:rgba(96,165,250,.18)!important}
.future-card-active:hover{transform:translateY(-3px);border-color:rgba(96,165,250,.38)!important}
@media(max-width:1250px){.sales-intel-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}.sales-intel-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:700px){.sales-intel-section{padding:16px}.sales-intel-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.sales-intel-grid{grid-template-columns:1fr}.sales-intel-refresh{width:100%;justify-content:center}}

/* Comparison table — keep all nine columns aligned in Fresh/Frozen tabs */
#page-compare table:has(#cmp-body){table-layout:auto!important;width:100%!important}
#page-compare table:has(#cmp-body) thead th,
#page-compare #cmp-body > tr > td{
  display:table-cell!important;
  visibility:visible!important;
  opacity:1!important;
  box-sizing:border-box!important;
  vertical-align:middle!important;
}
#page-compare .cmp-col-type{min-width:72px!important;width:72px!important;text-align:center!important}
#page-compare .cmp-col-code{min-width:130px!important;white-space:nowrap!important;text-align:center!important}
#page-compare .cmp-col-product{min-width:210px!important;text-align:right!important}
#page-compare .cmp-col-category{min-width:150px!important;text-align:center!important}
#page-compare .cmp-col-production,
#page-compare .cmp-col-warehouse,
#page-compare .cmp-col-dynamic,
#page-compare .cmp-col-difference{min-width:95px!important;text-align:center!important}
#page-compare .cmp-col-status{min-width:120px!important;text-align:center!important}
#page-compare #cmp-body .cmp-col-type .badge{display:inline-flex!important;visibility:visible!important;opacity:1!important}

/* ═══════════════════════════════════════════════
   WAREHOUSE — FREEZER PICK (DL1 + RTN1)
═══════════════════════════════════════════════ */
.freezer-pick-page-header{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;flex-wrap:wrap}
.freezer-pick-actions{display:flex;gap:8px;flex-wrap:wrap}
.freezer-pick-route-card{margin-bottom:16px}
.freezer-pick-route-tabs{display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:9px;margin-top:12px}
.freezer-pick-route-tab{border:1px solid var(--border);border-radius:12px;background:#fff;padding:10px 11px;display:flex;flex-direction:column;align-items:flex-start;gap:2px;font-family:inherit;cursor:pointer;transition:.18s ease;color:var(--text)}
.freezer-pick-route-tab:hover{transform:translateY(-2px);border-color:var(--info);box-shadow:0 7px 18px rgba(0,0,0,.06)}
.freezer-pick-route-tab.active{border-color:var(--info);background:rgba(30,64,175,.06);box-shadow:0 0 0 2px rgba(30,64,175,.12)}
.freezer-pick-route-tab strong{font-size:12px}
.freezer-pick-route-tab span{font:800 16px/1.2 var(--f-mono);color:var(--info)}
.freezer-pick-route-tab small{font-size:9px;color:var(--text3)}
.freezer-pick-sheet{max-width:1000px;margin:0 auto;background:#fff}
.freezer-pick-sheet-title{text-align:center;font:800 22px/1.2 var(--f-display);margin-bottom:10px;color:#111}
.freezer-pick-sheet-info{display:flex;justify-content:space-between;gap:24px;margin-bottom:14px;direction:ltr}
.freezer-pick-info-group{display:grid;gap:5px;min-width:280px}
.freezer-pick-info-group>div{display:grid;grid-template-columns:95px 1fr;align-items:center;gap:8px;font-size:12px}
.freezer-pick-info-group span{font-weight:700;color:#333}
.freezer-pick-info-group strong{font-family:var(--f-mono);color:#111}
.freezer-pick-info-group input{border:0;border-bottom:1px solid #888;padding:2px 4px;font:700 12px var(--f-sans);background:transparent}
.freezer-pick-kind{margin-top:12px}
.freezer-pick-kind-title{padding:7px 10px;text-align:center;font-weight:900;border:1px solid #111}
.freezer-pick-dl1 .freezer-pick-kind-title{background:#ef1f28;color:#fff}
.freezer-pick-rtn1 .freezer-pick-kind-title{background:#ffed00;color:#111}
.freezer-pick-category{margin-top:0}
.freezer-pick-category-title{padding:5px 8px;text-align:center;font-weight:800;border:1px solid #111;border-top:0}
.freezer-pick-dl1 .freezer-pick-category-title{background:#f21f28;color:#fff}
.freezer-pick-rtn1 .freezer-pick-category-title{background:#ffed00;color:#111}
.freezer-pick-table{width:100%;border-collapse:collapse;table-layout:fixed;font-size:11px}
.freezer-pick-table th,.freezer-pick-table td{border:1px solid #222;padding:4px 6px;text-align:center;vertical-align:middle}
.freezer-pick-table th{background:#f7f7f7;color:#111;font-weight:800}
.freezer-pick-table th:nth-child(1),.freezer-pick-table td:nth-child(1){width:55px}
.freezer-pick-table th:nth-child(2),.freezer-pick-table td:nth-child(2){width:38%}
.freezer-pick-table th:nth-child(3),.freezer-pick-table td:nth-child(3){width:18%}
.freezer-pick-table th:nth-child(4),.freezer-pick-table td:nth-child(4){width:85px}
.freezer-pick-item strong{display:block;font-size:11px;color:#111}
.freezer-pick-item small{display:block;font:8px var(--f-mono);color:#777}
.freezer-pick-qty{font:800 12px var(--f-mono)}
.freezer-pick-check input{width:17px;height:17px;accent-color:#111}
.freezer-pick-note{width:100%;border:0;background:transparent;font:11px var(--f-sans);padding:2px}
.freezer-pick-total td{font-weight:900;background:#f6f6f6}
.freezer-pick-empty td{height:30px;color:#999;font-size:10px}
@media(max-width:750px){.freezer-pick-sheet-info{flex-direction:column;direction:rtl}.freezer-pick-info-group{min-width:0}.freezer-pick-route-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}.freezer-pick-sheet{padding:10px}.freezer-pick-table{min-width:680px}}
@media print{
  body.freezer-pick-printing .sidebar,
  body.freezer-pick-printing .topbar,
  body.freezer-pick-printing .freezer-pick-page-header,
  body.freezer-pick-printing .freezer-pick-route-card,
  body.freezer-pick-printing .toast{display:none!important}
  body.freezer-pick-printing .main{margin:0!important;padding:0!important;width:100%!important}
  body.freezer-pick-printing .page{display:none!important}
  body.freezer-pick-printing #page-freezer-pick{display:block!important}
  body.freezer-pick-printing .freezer-pick-sheet{display:block!important;max-width:none!important;border:0!important;box-shadow:none!important;padding:0!important}
  body.freezer-pick-printing .freezer-pick-table{font-size:8px}
  body.freezer-pick-printing .freezer-pick-table th,
  body.freezer-pick-printing .freezer-pick-table td{padding:2px 4px!important}
  body.freezer-pick-printing .freezer-pick-item small{font-size:6px}
  body.freezer-pick-printing .freezer-pick-note{font-size:8px}
  body.freezer-pick-printing .freezer-pick-category{break-inside:avoid}
  @page{size:A4 portrait;margin:8mm}
}


/* PICKLIST Fresh — Picker from Master Data */
#freezer-pick-picker{min-width:220px;max-width:320px;padding:7px 10px;border:1px solid var(--border);border-radius:7px;background:#fff;font-family:inherit;font-size:12px}
@media print{body.freezer-pick-printing #freezer-pick-picker{appearance:none;border:0;padding:0;background:transparent;font-weight:700}}


/* ═══ ONLINE & INTERNAL SALES SECTION ═══ */
.online-internal-header{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.online-internal-placeholder{min-height:340px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;padding:36px;background:linear-gradient(145deg,#fff,#faf7ff)}
.online-internal-placeholder.compact{min-height:250px;padding:28px}
.online-internal-placeholder h3{margin:12px 0 6px;font-size:20px;color:var(--ink)}
.online-internal-placeholder p{margin:0;color:var(--text3);font-size:12px}
.online-internal-icon{width:68px;height:68px;border-radius:20px;display:grid;place-items:center;background:var(--purple-soft);color:var(--purple);font-size:28px;font-weight:900;box-shadow:inset 0 0 0 1px rgba(109,40,217,.12)}
.online-lines-shell{margin-bottom:14px}
.online-lines-tabs{display:grid;grid-template-columns:repeat(6,minmax(120px,1fr));gap:8px;margin-top:12px}
.online-line-tab{border:1px solid var(--border);background:var(--surface);color:var(--text2);border-radius:11px;padding:11px 10px;font-family:inherit;font-size:11px;font-weight:800;cursor:pointer;transition:.18s ease}
.online-line-tab:hover{border-color:var(--purple);transform:translateY(-1px)}
.online-line-tab.active{background:var(--purple);border-color:var(--purple);color:#fff;box-shadow:0 8px 18px rgba(109,40,217,.18)}
.online-line-panel{margin-top:14px}
@media(max-width:1000px){.online-lines-tabs{grid-template-columns:repeat(3,minmax(120px,1fr))}}
@media(max-width:620px){.online-lines-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}.online-internal-placeholder{min-height:260px;padding:24px}}

/* Online & Internal — paste reader and master-data mapping */
.oi-actions{display:flex;gap:8px;flex-wrap:wrap}
.oi-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px;margin-bottom:14px}
.oi-layout{display:grid;grid-template-columns:minmax(300px,34%) minmax(0,66%);gap:14px;align-items:start}
.oi-paste-card,.oi-preview-card{min-width:0}
.oi-format-note{font-size:11px;color:var(--text3);margin:4px 0 10px;padding:8px 10px;background:var(--surface2);border:1px dashed var(--border);border-radius:8px}
.oi-paste{width:100%;min-height:430px;resize:vertical;direction:ltr;text-align:left;font-family:var(--f-mono,monospace);font-size:12px;line-height:1.55;padding:12px;border:1px solid var(--border);border-radius:10px;background:#fff}
.oi-paste:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.oi-read-btn{width:100%;margin-top:10px}
.oi-table{min-width:1180px}
.oi-table th,.oi-table td{white-space:nowrap;text-align:center}
.oi-table .tn{text-align:right;white-space:normal;min-width:180px}
.oi-basket{font-weight:900;color:var(--brand);background:var(--brand-soft)}
.oi-unmatched-row td{background:#fff5f5}
.oi-unmatched-row .tn{color:var(--danger)}
@media(max-width:1100px){.oi-layout{grid-template-columns:1fr}.oi-paste{min-height:240px}.oi-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:650px){.oi-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.oi-actions{width:100%}.oi-actions .btn{flex:1}}


/* Online / Internal paste → DL1 linked quantities */
.sales-dist-input.sd-online-internal-linked{
  background:#eef8ff!important;
  border-color:#4aa3df!important;
  color:#0b5f94!important;
  font-weight:800!important;
  box-shadow:inset 0 0 0 1px rgba(74,163,223,.15);
}

/* Online lines — paste, seller and Allocate as per Dynamic */
.online-line-workspace{display:flex;flex-direction:column;gap:14px}
.online-line-toolbar{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--border);border-radius:14px;padding:14px 16px}
.online-line-sub{font-size:11px;color:var(--text3);margin-top:4px}
.online-line-seller-label{display:flex;align-items:center;gap:8px;font-size:11px;font-weight:700}
.online-line-seller-label select{min-width:250px;padding:9px 10px;border:1px solid var(--border);border-radius:9px;background:#fff;font-family:inherit}
.online-line-kpis{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:10px}
.online-line-kpis>div{background:var(--surface);border:1px solid var(--border);border-radius:12px;padding:11px 12px;text-align:center}
.online-line-kpis span{display:block;font-size:9px;color:var(--text3)}
.online-line-kpis strong{display:block;margin-top:4px;font:800 18px/1.2 var(--f-mono);color:var(--purple)}
.online-line-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px}
.online-line-paste-card,.online-line-dynamic-card{min-width:0}
.online-line-actions{display:flex;gap:7px;flex-wrap:wrap}
.online-line-paste,.online-line-dynamic-text{width:100%;margin-top:10px;resize:vertical;border:1px solid var(--border);border-radius:10px;padding:11px;font:11px/1.55 var(--f-mono);direction:ltr;text-align:left;background:#fff}
.online-line-dynamic-text{background:#faf9ff;min-height:230px}
.online-line-meta{font-size:10px;color:var(--text3);margin-top:8px}
.online-line-dynamic-source{font-size:10px;color:var(--purple);background:var(--purple-dim);border-radius:8px;padding:7px 9px;margin:8px 0}
.online-line-preview-card,.online-line-dynamic-preview-card{overflow:hidden}
.online-line-dynamic-preview-card .dynamic-transfer-table{min-width:1120px}
@media(max-width:980px){.online-line-grid{grid-template-columns:1fr}.online-line-kpis{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:620px){.online-line-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}.online-line-seller-label{width:100%;align-items:stretch;flex-direction:column}.online-line-seller-label select{min-width:100%}}

/* Dynamic Transfer — CRATE row from Manama through Riffa */
.dynamic-transfer-table .dt-crate-row td{
  background:#fff7d6;
  font-weight:800;
  color:#7a4a00;
  border-top:2px solid #d8a400;
}
.dynamic-transfer-table .dt-crate-row td:nth-child(3){
  color:#b36b00;
}

/* Online lines — print quantities by seller */
.online-lines-print-actions{display:flex;gap:8px;flex-wrap:wrap}
.online-lines-print-area{display:none}
.online-line-print-sheet{background:#fff;color:#111;padding:12px;direction:rtl;break-after:page}
.online-line-print-sheet:last-child{break-after:auto}
.online-line-print-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;border-bottom:2px solid #222;padding-bottom:10px;margin-bottom:12px}
.online-line-print-head h2{margin:0;font-size:22px}
.online-line-print-meta{font-size:11px;color:#666;margin-top:3px}
.online-line-print-summary{display:grid;grid-template-columns:repeat(4,minmax(110px,1fr));gap:8px;min-width:520px}
.online-line-print-summary>div{border:1px solid #ccc;border-radius:6px;padding:7px 8px;text-align:center}
.online-line-print-summary span{display:block;font-size:9px;color:#666}
.online-line-print-summary strong{display:block;font-size:13px;margin-top:3px}
.online-line-print-table{width:100%;border-collapse:collapse;font-size:10px}
.online-line-print-table th,.online-line-print-table td{border:1px solid #bfc3c8;padding:5px 6px;text-align:center}
.online-line-print-table th{background:#eef0f3;font-weight:800}
.online-line-print-table .tn{text-align:right}
.online-line-print-cat td{background:#2f3e5b;color:#fff;font-weight:800;text-align:right}
.online-line-print-total td{background:#f2f2f2;font-weight:800}
.online-line-print-check{font-size:15px}
@media(max-width:700px){.online-lines-print-actions{width:100%}.online-lines-print-actions .btn{flex:1}}
@media print{
  body.online-lines-printing .sidebar,
  body.online-lines-printing .topbar,
  body.online-lines-printing .page:not(#page-online-lines),
  body.online-lines-printing #page-online-lines>*:not(#online-lines-print-area){display:none!important}
  body.online-lines-printing .main{margin:0!important;padding:0!important;width:100%!important}
  body.online-lines-printing #page-online-lines{display:block!important;padding:0!important}
  body.online-lines-printing #online-lines-print-area{display:block!important}
  body.online-lines-printing .online-line-print-sheet{page-break-after:always;break-after:page}
  body.online-lines-printing .online-line-print-sheet:last-child{page-break-after:auto;break-after:auto}
  @page{size:A4 landscape;margin:8mm}
}

/* Compact colored print — Online Lines + Internal Sales */
.compact-color-print{padding:8mm 7mm!important;background:#fff!important;color:#111!important}
.compact-print-head{border-bottom:0!important;margin-bottom:7px!important;padding:0!important;background:linear-gradient(135deg,#6d28d9,#2563eb);color:#fff;border-radius:10px;padding:9px 11px!important}
.compact-print-head h2{font-size:17px!important;color:#fff!important}
.compact-print-head .online-line-print-meta{color:rgba(255,255,255,.82)!important;font-size:9px!important}
.compact-print-summary{grid-template-columns:repeat(3,minmax(95px,1fr))!important;min-width:360px!important;gap:6px!important}
.compact-print-summary>div{border-color:rgba(255,255,255,.28)!important;background:rgba(255,255,255,.12)!important;padding:5px 7px!important}
.compact-print-summary span{color:rgba(255,255,255,.8)!important;font-size:8px!important}
.compact-print-summary strong{color:#fff!important;font-size:11px!important}
.compact-print-table{font-size:9px!important;table-layout:fixed}
.compact-print-table th,.compact-print-table td{padding:3px 5px!important;border-color:#cbd5e1!important}
.compact-print-table th{background:#172554!important;color:#fff!important;font-size:9px!important}
.compact-print-table th:first-child{width:78%;text-align:right!important}
.compact-print-table th:last-child{width:22%}
.compact-print-table .tn{font-weight:700;text-align:right!important}
.compact-basket-cell{font-size:11px!important;font-weight:900!important;color:#111827!important;background:#f8fafc!important}
.compact-print-table .online-line-print-cat td{color:#fff!important;font-weight:900!important;text-align:right!important;padding:4px 7px!important}
.compact-print-table .print-cat-1 td{background:#b91c1c!important}
.compact-print-table .print-cat-2 td{background:#1d4ed8!important}
.compact-print-table .print-cat-3 td{background:#7c3aed!important}
.compact-print-table .print-cat-4 td{background:#0f766e!important}
.compact-print-table .print-cat-5 td{background:#c2410c!important}
.compact-print-table .print-cat-6 td{background:#854d0e!important}
.compact-print-table .print-cat-7 td{background:#475569!important}
.compact-print-table .online-line-print-total td{background:#e2e8f0!important;color:#0f172a!important;font-weight:900!important}
.compact-grand-total td{background:#0f172a!important;color:#fff!important;font-weight:900!important;font-size:10px!important}

@media print{
  body.online-lines-printing .compact-color-print,
  body.internal-sales-printing .compact-color-print{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important}

  body.internal-sales-printing .sidebar,
  body.internal-sales-printing .topbar,
  body.internal-sales-printing .page:not(#page-internal-sales),
  body.internal-sales-printing #page-internal-sales>*:not(#internal-sales-print-area){display:none!important}
  body.internal-sales-printing .main{margin:0!important;padding:0!important;width:100%!important}
  body.internal-sales-printing #page-internal-sales{display:block!important;padding:0!important}
  body.internal-sales-printing #internal-sales-print-area{display:block!important}
  body.internal-sales-printing .online-line-print-sheet{page-break-after:auto!important;break-after:auto!important}

  .compact-print-table tr{break-inside:avoid}
  @page{size:A4 portrait;margin:6mm}
}

/* Order sequence paste and print — Online Lines + Internal Sales */
.order-sequence-card{margin-top:14px;grid-column:1/-1}
.order-sequence-help{font-size:10px;color:var(--text3);margin-top:4px}
.order-sequence-actions{display:flex;gap:7px;flex-wrap:wrap}
.order-sequence-paste{width:100%;min-height:180px;resize:vertical;direction:ltr;text-align:left;font-family:var(--f-mono,monospace);font-size:10px;line-height:1.45;padding:10px;border:1px solid var(--border);border-radius:9px;background:#fff;margin-top:10px}
.order-sequence-meta{font-size:10px;color:var(--text3);margin:7px 0}
.order-sequence-preview{min-width:1000px;font-size:10px}
.order-sequence-preview th,.order-sequence-preview td{padding:6px 7px;vertical-align:top;white-space:nowrap}
.order-sequence-preview .tn{min-width:130px}.order-sequence-preview .order-sequence-multiline{white-space:normal;min-width:240px;line-height:1.35}
.order-sequence-print-area{display:none}
.order-sequence-print-sheet{background:#fff;color:#111;padding:6mm;direction:ltr}
.order-sequence-print-title{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:7px;border-bottom:2px solid #dc2626;padding-bottom:6px}
.order-sequence-print-title h2{margin:0;color:#b91c1c;font-size:15px}.order-sequence-print-title span,.order-sequence-print-title strong{display:block;font-size:8px;margin-top:2px}
.order-sequence-print-table{width:100%;border-collapse:collapse;table-layout:fixed;font-family:Arial,sans-serif;font-size:6.2px}
.order-sequence-print-table th,.order-sequence-print-table td{border:.65px solid #555;padding:2.5px 2px;vertical-align:top;text-align:center;overflow-wrap:anywhere}
.order-sequence-print-table th{background:#ef1717!important;color:#fff!important;font-weight:700;font-size:6.2px}
.order-sequence-print-table tbody tr:nth-child(even) td{background:#f1f1f1!important}
.order-sequence-print-table .multiline{white-space:normal;line-height:1.25;text-align:center}
.order-sequence-print-table th:nth-child(1){width:4%}.order-sequence-print-table th:nth-child(2){width:8%}.order-sequence-print-table th:nth-child(3){width:6%}.order-sequence-print-table th:nth-child(4){width:5%}.order-sequence-print-table th:nth-child(5){width:6%}.order-sequence-print-table th:nth-child(6){width:7%}.order-sequence-print-table th:nth-child(7),.order-sequence-print-table th:nth-child(8),.order-sequence-print-table th:nth-child(9){width:3.5%}.order-sequence-print-table th:nth-child(10){width:16%}.order-sequence-print-table th:nth-child(11){width:14%}.order-sequence-print-table th:nth-child(12){width:5%}.order-sequence-print-table th:nth-child(13){width:5%}.order-sequence-print-table th:nth-child(14){width:10%}
@media(max-width:700px){.order-sequence-actions{width:100%}.order-sequence-actions .btn{flex:1}.order-sequence-paste{min-height:140px}}
@media print{
  body.order-sequence-printing{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important;background:#fff!important}
  body.order-sequence-printing .sidebar,body.order-sequence-printing .topbar,body.order-sequence-printing .page{display:none!important}
  body.order-sequence-printing[data-order-print-scope="line"] #page-online-lines,body.order-sequence-printing[data-order-print-scope="internal"] #page-internal-sales{display:block!important;padding:0!important;margin:0!important}
  body.order-sequence-printing[data-order-print-scope="line"] #page-online-lines>*:not(.order-sequence-print-area),body.order-sequence-printing[data-order-print-scope="internal"] #page-internal-sales>*:not(.order-sequence-print-area){display:none!important}
  body.order-sequence-printing .order-sequence-print-area{display:block!important}
  body.order-sequence-printing .main{margin:0!important;padding:0!important;width:100%!important}
  body.order-sequence-printing .order-sequence-print-table thead{display:table-header-group}
  body.order-sequence-printing .order-sequence-print-table tr{break-inside:avoid}
  @page{size:A4 landscape;margin:5mm}
}

/* Order sequence address parsing + clearer print layout */
.order-sequence-print-sheet{padding:4mm 5mm}
.order-sequence-print-title{margin-bottom:5px;padding-bottom:4px}
.order-sequence-print-table{font-size:7px;line-height:1.22}
.order-sequence-print-table th,.order-sequence-print-table td{padding:3px 2.5px;vertical-align:middle}
.order-sequence-print-table th{font-size:7px;line-height:1.15}
.order-sequence-print-table td.multiline{vertical-align:top;line-height:1.32;text-align:left;direction:ltr}
.order-sequence-print-table td.os-details,.order-sequence-print-table td.os-note{direction:rtl;text-align:right}
.order-sequence-print-table td.os-id,.order-sequence-print-table td.os-phone,.order-sequence-print-table td.os-num,.order-sequence-print-table td.os-price{font-family:Arial,sans-serif;font-weight:700;white-space:nowrap}
.order-sequence-print-table td.os-customer,.order-sequence-print-table td.os-area{font-weight:700}
.order-sequence-print-table tbody tr:nth-child(odd) td{background:#fff!important}
.order-sequence-print-table tbody tr:nth-child(even) td{background:#f4f4f4!important}
.order-sequence-print-table tbody tr{page-break-inside:avoid;break-inside:avoid}
.order-sequence-print-table th:nth-child(1){width:4.5%}
.order-sequence-print-table th:nth-child(2){width:8.5%}
.order-sequence-print-table th:nth-child(3){width:6.5%}
.order-sequence-print-table th:nth-child(4){width:4.5%}
.order-sequence-print-table th:nth-child(5){width:5%}
.order-sequence-print-table th:nth-child(6){width:6.5%}
.order-sequence-print-table th:nth-child(7),.order-sequence-print-table th:nth-child(8),.order-sequence-print-table th:nth-child(9){width:3.2%}
.order-sequence-print-table th:nth-child(10){width:18%}
.order-sequence-print-table th:nth-child(11){width:15%}
.order-sequence-print-table th:nth-child(12){width:5%}
.order-sequence-print-table th:nth-child(13){width:4.5%}
.order-sequence-print-table th:nth-child(14){width:9.7%}
@media print{
  body.order-sequence-printing .order-sequence-print-sheet{padding:0}
  body.order-sequence-printing .order-sequence-print-table{font-size:7px}
  body.order-sequence-printing .order-sequence-print-table thead{display:table-header-group}
  @page{size:A4 landscape;margin:4mm}
}


/* Order sequence print — parsed Product Details directly inside column H */
.order-sequence-print-table .os-products{padding:3px!important;vertical-align:top}
.os-product-list{display:flex;flex-direction:column;gap:3px;min-width:145px}
.os-product-item{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:5px;align-items:center;padding:3px 5px;border:1px solid #d8e4ef;border-radius:4px;background:#f7fbff;line-height:1.25}
.os-product-item strong{font-size:6.8px;text-align:left;direction:ltr;white-space:normal;overflow-wrap:anywhere}
.os-product-item span{white-space:nowrap;font-size:6.5px;color:#334155}
.os-product-item span b{color:#b91c1c;font-size:7px}
.os-product-item.unmatched{background:#fff1f2;border-color:#fecdd3}
.os-product-item.unmatched small{grid-column:1/-1;color:#b91c1c;font-weight:800;font-size:6px}
.os-product-raw{font-size:6.5px;line-height:1.35;text-align:left;direction:ltr;white-space:normal;overflow-wrap:anywhere}
@media print{
  body.order-sequence-printing .os-product-item{-webkit-print-color-adjust:exact;print-color-adjust:exact;break-inside:avoid}
}


/* Order sequence print v3 — clean area, sorted route, readable layout */
.order-sequence-print-sheet{padding:3mm 4mm!important;background:#fff}
.order-sequence-print-title{background:linear-gradient(135deg,#7f1d1d,#dc2626);color:#fff;border:0!important;border-radius:8px;padding:8px 10px!important;margin-bottom:7px!important}
.order-sequence-print-title h2,.order-sequence-print-title span,.order-sequence-print-title strong{color:#fff!important}
.order-sequence-print-table{font-size:7.2px!important;line-height:1.25!important;table-layout:fixed}
.order-sequence-print-table th{background:#374151!important;color:#fff!important;font-size:6.6px!important;text-transform:uppercase;letter-spacing:.15px;padding:4px 2px!important;vertical-align:middle!important}
.order-sequence-print-table td{padding:4px 3px!important;vertical-align:middle!important}
.order-sequence-print-table tbody tr:nth-child(odd) td{background:#fff!important}
.order-sequence-print-table tbody tr:nth-child(even) td{background:#f3f4f6!important}
.order-sequence-print-table tbody tr{border-bottom:1.2px solid #6b7280!important}
.order-sequence-print-table td.os-area{direction:rtl;text-align:center;font-size:7.4px;line-height:1.3;color:#111827}
.order-sequence-print-table td.os-num{font-size:7.2px;background:#f9fafb!important}
.order-sequence-print-table td.os-products{vertical-align:top!important}
.order-sequence-print-table td.os-details{vertical-align:top!important;font-size:7px;line-height:1.45}
.order-sequence-print-table td.os-note{vertical-align:top!important;font-size:6.8px}
.order-sequence-print-table th:nth-child(1){width:4.5%!important}
.order-sequence-print-table th:nth-child(2){width:7.5%!important}
.order-sequence-print-table th:nth-child(3){width:6.5%!important}
.order-sequence-print-table th:nth-child(4){width:4.5%!important}
.order-sequence-print-table th:nth-child(5){width:4.5%!important}
.order-sequence-print-table th:nth-child(6){width:7.5%!important}
.order-sequence-print-table th:nth-child(7),.order-sequence-print-table th:nth-child(8),.order-sequence-print-table th:nth-child(9){width:3.5%!important}
.order-sequence-print-table th:nth-child(10){width:20%!important}
.order-sequence-print-table th:nth-child(11){width:17%!important}
.order-sequence-print-table th:nth-child(12){width:5%!important}
.order-sequence-print-table th:nth-child(13){width:4.5%!important}
.order-sequence-print-table th:nth-child(14){width:8.5%!important}
.os-product-list{gap:4px!important;min-width:0!important}
.os-product-item{grid-template-columns:minmax(0,1fr) 50px 50px!important;padding:4px 5px!important;border-radius:5px!important;background:#eef6ff!important;border-color:#bfdbfe!important}
.os-product-item strong{font-size:7px!important;line-height:1.25!important}
.os-product-item span{font-size:6.6px!important;text-align:center}
@media print{
  body.order-sequence-printing .order-sequence-print-title,
  body.order-sequence-printing .order-sequence-print-table th,
  body.order-sequence-printing .os-product-item{-webkit-print-color-adjust:exact!important;print-color-adjust:exact!important}
  body.order-sequence-printing .order-sequence-print-table tr{break-inside:avoid-page!important;page-break-inside:avoid!important}
  @page{size:A4 landscape;margin:4mm}
}

/* V5.1.4 order sequence — Flat column after Road */
.order-sequence-print-table th:nth-child(7),
.order-sequence-print-table th:nth-child(8),
.order-sequence-print-table th:nth-child(9),
.order-sequence-print-table th:nth-child(10){width:3.1%!important}
.order-sequence-print-table th:nth-child(11){width:19%!important}
.order-sequence-print-table th:nth-child(12){width:16%!important}
.order-sequence-print-table th:nth-child(13){width:5%!important}
.order-sequence-print-table th:nth-child(14){width:4.5%!important}
.order-sequence-print-table th:nth-child(15){width:8.2%!important}
.order-sequence-print-table td.os-flat{background:#eef2ff!important}

/* Delmon V6.7.0 — Accessibility Foundation */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.delmon-skip-link {
  position: fixed;
  inset-inline-start: 16px;
  top: -80px;
  z-index: 100000;
  padding: 12px 18px;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  box-shadow: 0 8px 28px rgba(0,0,0,.28);
  font-weight: 700;
  transition: top .18s ease;
}
.delmon-skip-link:focus { top: 16px; }
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid currentColor !important;
  outline-offset: 3px !important;
}
[aria-invalid="true"] { outline: 2px solid #b91c1c !important; }
.delmon-help-shell { margin: 18px; }
.delmon-help-intro { margin-top: 8px; opacity: .82; line-height: 1.8; }
.delmon-help-tips {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid rgba(59,130,246,.3);
  border-radius: 12px;
  background: rgba(59,130,246,.08);
  line-height: 1.8;
}
.delmon-help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}
.delmon-help-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border: 1px solid var(--border, rgba(148,163,184,.25));
  border-radius: 14px;
  background: var(--card, rgba(255,255,255,.04));
}
.delmon-help-card h3 { margin: 0 0 6px; }
.delmon-help-card p { margin: 0 0 12px; opacity: .72; }
.delmon-help-icon { font-size: 26px; line-height: 1; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* V6.8.0 Backup & Recovery Center */
.delmon-backup-actions{display:flex;gap:10px;flex-wrap:wrap;margin:16px 0}.delmon-backup-status,.delmon-backup-import{margin:14px 0}.delmon-backup-import .alert{padding:14px;border-radius:10px}.delmon-backup-import .alert-success{background:#eefbf2;border:1px solid #9bd5aa}.delmon-backup-import .alert-danger{background:#fff0f0;border:1px solid #e0a1a1}

/* ═══════════════════════════════════════════════════════════════
   V8.2.7 — DL1 / RTN1 THREE-ROW FREEZE
   Keep title, delivery-line names and seller row visible while
   scrolling vertically. Horizontal scrolling remains available.
═══════════════════════════════════════════════════════════════ */
#page-sales-dl1 #dl1-table-wrap,
#page-sales-rtn1 #rtn1-table-wrap{
  position:relative;
  max-height:calc(100vh - 190px);
  min-height:260px;
  overflow:auto;
  overscroll-behavior:contain;
  scrollbar-gutter:stable;
}

#page-sales-dl1 #dl1-table-wrap .sales-dist-table thead,
#page-sales-rtn1 #rtn1-table-wrap .sales-dist-table thead{
  position:sticky;
  top:0;
  z-index:40;
  box-shadow:0 3px 8px rgba(0,0,0,.18);
}

/* Ensure every cell in the frozen three-row header paints an opaque layer. */
#page-sales-dl1 #dl1-table-wrap .sales-dist-table thead > tr > th,
#page-sales-rtn1 #rtn1-table-wrap .sales-dist-table thead > tr > th{
  position:relative;
  z-index:1;
  background-clip:padding-box!important;
}

/* Preserve the existing page palettes while the header is frozen. */
#page-sales-dl1 #dl1-table-wrap .sales-dist-table thead > tr:nth-child(2) > th{
  background:#d9d9d9!important;
  color:#111!important;
}
#page-sales-rtn1 #rtn1-table-wrap .sales-dist-table thead > tr:nth-child(2) > th{
  background:#d9d9d9!important;
  color:#111!important;
}

@media(max-height:700px){
  #page-sales-dl1 #dl1-table-wrap,
  #page-sales-rtn1 #rtn1-table-wrap{
    max-height:calc(100vh - 145px);
  }
}

@media print{
  #page-sales-dl1 #dl1-table-wrap,
  #page-sales-rtn1 #rtn1-table-wrap{
    max-height:none!important;
    overflow:visible!important;
  }
  #page-sales-dl1 #dl1-table-wrap .sales-dist-table thead,
  #page-sales-rtn1 #rtn1-table-wrap .sales-dist-table thead{
    position:static!important;
    box-shadow:none!important;
  }
}
