/* MESHWAR_CSS_POLISH_V17 — CSS-only visual layer
   Package 1/3: customer dashboard
   Package 2/3: customer chat
   Package 3/3: branch dashboard
   No DOM, business logic, Supabase, scanner, pricing, or event-handler changes. */

/* ---------- 1/3 CUSTOMER DASHBOARD ---------- */
html[data-mw-global-theme="light"] body:has(.chat-layout) .dashboard-header,
html[data-mw-global-theme="light"] body:has(.chat-layout) .panel-card,
html[data-mw-global-theme="light"] body:has(.chat-layout) .summary-grid .info-card{
  background:#fff!important;background-image:none!important;color:#172033!important;border:1px solid #dbe3ea!important;box-shadow:0 8px 24px rgba(15,23,42,.08)!important;
}
html[data-mw-global-theme="light"] body:has(.chat-layout) .dashboard-header{border-radius:18px!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) .summary-grid .info-card,
html[data-mw-global-theme="light"] body:has(.chat-layout) .warehouse-card{border-radius:14px!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) .panel-head h2,
html[data-mw-global-theme="light"] body:has(.chat-layout) .welcome,
html[data-mw-global-theme="light"] body:has(.chat-layout) .warehouse-text,
html[data-mw-global-theme="light"] body:has(.chat-layout) .warehouse-text *{color:#172033!important;text-shadow:none!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) .identity-chips .chip{background:#eef2f7!important;color:#334155!important;border:1px solid #dbe3ea!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) .tabs-nav{background:rgba(238,242,247,.96)!important;border:1px solid #dbe3ea!important;box-shadow:0 5px 18px rgba(15,23,42,.07)!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) .tab-btn{background:#fff!important;color:#475569!important;border-color:#dbe3ea!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) .tab-btn.active{background:#173b63!important;color:#fff!important;border-color:#173b63!important;box-shadow:0 6px 16px rgba(23,59,99,.20)!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) .siparis-no,
html[data-mw-global-theme="light"] body:has(.chat-layout) .siparis-no.missing{background:#f1f5f9!important;color:#475569!important;border:1px solid #cbd5e1!important;box-shadow:none!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) .qty-badge{background:#fff7ed!important;color:#9a3412!important;border-color:#fdba74!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) .table-wrap{border:1px solid #dbe3ea!important;border-radius:14px!important;box-shadow:0 5px 16px rgba(15,23,42,.05)!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) th{background:#edf2f7!important;color:#334155!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) td{color:#172033!important;border-color:#e5eaf1!important}
html[data-mw-global-theme="light"] body:has(.chat-layout) input:focus,
html[data-mw-global-theme="light"] body:has(.chat-layout) textarea:focus,
html[data-mw-global-theme="light"] body:has(.chat-layout) select:focus{border-color:#64748b!important;box-shadow:0 0 0 3px rgba(100,116,139,.12)!important;outline:none!important}

/* ---------- 2/3 CUSTOMER CHAT ---------- */
html[data-mw-global-theme="light"] .chat-layout{max-width:900px!important}
html[data-mw-global-theme="light"] .chat-box-container{background:#f8fafc!important;border:1px solid #cbd5e1!important;border-radius:16px!important;box-shadow:inset 0 1px 0 #fff,0 8px 22px rgba(15,23,42,.06)!important;padding:16px!important}
html[data-mw-global-theme="light"] .chat-line{color:#172033!important;border:1px solid transparent!important;box-shadow:0 2px 8px rgba(15,23,42,.05)!important}
html[data-mw-global-theme="light"] .chat-line.employee{background:#ecfdf5!important;border-color:#bbf7d0!important;color:#14532d!important}
html[data-mw-global-theme="light"] .chat-line.customer{background:#eff6ff!important;border-color:#bfdbfe!important;color:#1e3a8a!important}
html[data-mw-global-theme="light"] .chat-file-link{background:#fff!important;color:#1d4ed8!important;border-color:#cbd5e1!important}
html[data-mw-global-theme="light"] .chat-attachment img{border-color:#cbd5e1!important;box-shadow:0 4px 14px rgba(15,23,42,.10)!important}
html[data-mw-global-theme="light"] .chat-compose{padding:10px!important;background:#fff!important;border:1px solid #dbe3ea!important;border-radius:14px!important;box-shadow:0 6px 18px rgba(15,23,42,.06)!important}
html[data-mw-global-theme="light"] .chat-compose input[type="text"]{background:#fff!important;color:#172033!important;border:1px solid #cbd5e1!important;border-radius:10px!important}
html[data-mw-global-theme="light"] .attach-btn{background:#eef2ff!important;color:#3730a3!important;border:1px solid #c7d2fe!important}
html[data-mw-global-theme="light"] .selected-file{color:#64748b!important}

/* ---------- 3/3 BRANCH DASHBOARD ---------- */
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats){background:#eef2f7!important;background-image:none!important;color:#172033!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .container{background:#fff!important;background-image:none!important;color:#172033!important;border:1px solid #dbe3ea!important;border-radius:20px!important;box-shadow:0 12px 34px rgba(15,23,42,.08)!important;backdrop-filter:none!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .top,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .toolbar,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .account-card,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .branch-stat-card,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .branch-tabs{background:#fff!important;background-image:none!important;color:#172033!important;border-color:#dbe3ea!important;box-shadow:0 6px 18px rgba(15,23,42,.06)!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .section-title{background:#173b63!important;background-image:none!important;color:#fff!important;border-color:#173b63!important;box-shadow:none!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) h2,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) h3,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .branch-stat-value{color:#172033!important;text-shadow:none!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .branch-stat-label,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .branch-stat-note,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .muted{color:#64748b!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) input,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) select{background:#fff!important;color:#172033!important;-webkit-text-fill-color:#172033!important;border-color:#cbd5e1!important;box-shadow:none!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) select option{background:#fff!important;color:#172033!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) table{background:#dbe2ea!important;background-image:none!important;border:1px solid #c5ced9!important;box-shadow:0 7px 20px rgba(15,23,42,.06)!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) th{background:#cfd8e3!important;background-image:none!important;color:#172033!important;border-color:#b8c3d0!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) td{color:#334155!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .selected-row td{background:#f4e7b6!important;color:#3b2f12!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .branch-tab{background:#f8fafc!important;color:#475569!important;border-color:#dbe3ea!important;box-shadow:none!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .branch-tab.active{background:#173b63!important;color:#fff!important;border-color:#173b63!important;box-shadow:0 6px 16px rgba(23,59,99,.18)!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .modal-content,
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .dashboard-scanner-panel{background:#fff!important;background-image:none!important;color:#172033!important;border-color:#dbe3ea!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .scan-item{background:#f8fafc!important;color:#172033!important;border-color:#dbe3ea!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .scan-code{background:#fff!important;color:#334155!important;border-color:#94a3b8!important}

/* Branch light-mode contrast hotfix — CSS only */
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .collect{background:#fff7ed!important;color:#7c2d12!important;border:1px solid #fdba74!important;font-weight:900!important;text-shadow:none!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .contact-mini a{background:#e0f2fe!important;color:#0c4a6e!important;border:1px solid #7dd3fc!important;font-weight:900!important;text-shadow:none!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .contact-mini a:hover{background:#bae6fd!important;color:#082f49!important;border-color:#38bdf8!important}

/* Branch customer contact hierarchy v17.1 */
#ordersBody > tr[id^="row-"] > td:nth-child(3){display:flex!important;flex-direction:column!important;align-items:flex-start!important;justify-content:flex-start!important;flex-wrap:nowrap!important;gap:4px!important;text-align:right!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3) > br{display:none!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3) > b{order:10!important;display:block!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3) > span.muted{order:20!important;display:block!important;margin:0!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3) > span.customer-code{order:30!important;display:inline-block!important;margin:4px 0 0!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3) > span.mw-branch-whatsapp-primary{order:31!important;display:flex!important;margin:0!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3) > span.secondary-phone{order:40!important;display:block!important;margin:7px 0 0!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3) > span.contact-mini:not(.mw-branch-whatsapp-primary){order:41!important;display:flex!important;margin:0!important}

/* Branch compact layout v17.2 */
#ordersBody{font-size:12px!important}
#ordersBody > tr[id^="row-"] > td{padding:6px 5px!important;vertical-align:middle!important;line-height:1.25!important}
#ordersBody > tr[id^="row-"] > td:nth-child(1){width:34px!important;min-width:34px!important;max-width:34px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(2){width:15%!important;min-width:120px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3){width:22%!important;min-width:180px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(4){width:15%!important;min-width:145px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(5){width:10%!important;min-width:100px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(6){width:10%!important;min-width:100px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(7){width:12%!important;min-width:125px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(8){width:12%!important;min-width:125px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9){width:18%!important;min-width:210px!important;display:flex!important;flex-wrap:wrap!important;align-items:center!important;justify-content:center!important;gap:4px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button{margin:0!important;padding:5px 7px!important;min-height:28px!important;height:auto!important;line-height:1.1!important;font-size:10px!important;border-radius:7px!important;white-space:nowrap!important;flex:1 1 calc(50% - 4px)!important;max-width:110px!important;box-shadow:none!important}
#ordersBody > tr[id^="row-"] select{min-width:0!important;width:100%!important;max-width:100%!important;padding:5px 6px!important;min-height:30px!important;font-size:11px!important}
#ordersBody > tr[id^="row-"] input[type="number"]{min-width:0!important;max-width:100%!important;padding:5px 6px!important;min-height:30px!important;font-size:11px!important}
#ordersBody > tr[id^="row-"] .collect{margin-top:3px!important;padding:3px 5px!important;font-size:11px!important}
#ordersBody > tr[id^="row-"] .customer-code{padding:2px 5px!important;font-size:10px!important}
#ordersBody > tr[id^="row-"] .contact-mini{gap:3px!important}
#ordersBody > tr[id^="row-"] .contact-mini a{padding:3px 5px!important;font-size:9px!important}

/* Branch table alignment recovery v17.4 — CSS only */
#ordersBody > tr[id^="row-"]{display:table-row!important;width:auto!important}
#ordersBody > tr[id^="row-"] > td{display:table-cell!important;grid-column:auto!important;width:auto;vertical-align:middle!important;box-sizing:border-box!important}
#ordersBody > tr[id^="row-"] > td:nth-child(1){width:34px!important;min-width:34px!important;max-width:34px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(2){width:15%!important;min-width:120px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3){width:22%!important;min-width:180px!important;text-align:right!important}
#ordersBody > tr[id^="row-"] > td:nth-child(4){width:15%!important;min-width:145px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(5){width:10%!important;min-width:100px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(6){width:10%!important;min-width:100px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(7){width:12%!important;min-width:125px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(8){width:12%!important;min-width:125px!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9){width:auto!important;min-width:150px!important;max-width:none!important;padding:5px 6px!important;text-align:center!important;background:transparent!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button{display:flex!important;align-items:center!important;justify-content:center!important;width:auto!important;max-width:none!important;min-width:max-content!important;margin:0 0 3px!important;padding:4px 8px!important;line-height:1!important;font-size:9px!important;font-weight:800!important;border-radius:6px!important;box-shadow:none!important;white-space:nowrap!important;transform:none!important;overflow:visible!important;text-overflow:clip!important;margin-left:auto!important;margin-right:auto!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button:last-child{margin-bottom:0!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button.green{min-height:32px!important;height:32px!important;padding:5px 10px!important;font-size:13px!important;font-weight:800!important;background:#10b981!important;color:#fff!important;border:1px solid #059669!important;border-radius:6px!important;box-shadow:0 2px 6px rgba(16,185,129,.20)!important;text-shadow:none!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button.green:hover{background:#059669!important;border-color:#047857!important;filter:none!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button.purple,
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button.blue{min-height:27px!important;height:27px!important;padding:4px 7px!important;font-size:10.5px!important;font-weight:800!important;border-radius:6px!important;box-shadow:none!important;text-shadow:none!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button.purple{background:#f3e8ff!important;color:#581c87!important;border:1px solid #c4b5fd!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button.blue{background:#e0f2fe!important;color:#0c4a6e!important;border:1px solid #7dd3fc!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button.purple:hover{background:#ede9fe!important;border-color:#a78bfa!important;filter:none!important}
#ordersBody > tr[id^="row-"] > td:nth-child(9) > button.blue:hover{background:#bae6fd!important;border-color:#38bdf8!important;filter:none!important}

/* Keep customer cell table semantics; compact contact blocks without flex on td */
#ordersBody > tr[id^="row-"] > td:nth-child(3) > b,
#ordersBody > tr[id^="row-"] > td:nth-child(3) > span{display:block!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3) > .contact-mini{display:flex!important;width:max-content!important;max-width:100%!important;gap:3px!important;flex-wrap:wrap!important}
#ordersBody > tr[id^="row-"] > td:nth-child(3) > br{display:none!important}

.branch-quick-actions{display:flex!important;gap:4px!important;flex-wrap:wrap!important;justify-content:center!important;align-items:center!important;margin-top:5px!important;padding-top:5px!important;border-top:1px solid rgba(148,163,184,.18)!important}
.branch-quick-actions button{flex:0 1 auto!important;width:auto!important;min-width:max-content!important;max-width:none!important;min-height:27px!important;height:27px!important;margin:0!important;padding:4px 8px!important;font-size:10px!important;font-weight:800!important;line-height:1!important;border-radius:6px!important;box-shadow:none!important;transform:none!important;white-space:nowrap!important;text-shadow:none!important;overflow:visible!important;text-overflow:clip!important}
.branch-quick-actions .branch-action-receive{background:#ecfdf5!important;color:#065f46!important;border:1px solid #6ee7b7!important}
.branch-quick-actions .branch-action-transfer{background:#fff7ed!important;color:#9a3412!important;border:1px solid #fdba74!important}
.branch-quick-actions .branch-action-courier{background:#eff6ff!important;color:#1e3a8a!important;border:1px solid #93c5fd!important}
.branch-quick-actions .branch-action-receive:hover{background:#d1fae5!important;border-color:#34d399!important}
.branch-quick-actions .branch-action-transfer:hover{background:#ffedd5!important;border-color:#fb923c!important}
.branch-quick-actions .branch-action-courier:hover{background:#dbeafe!important;border-color:#60a5fa!important}
html[data-mw-global-theme="light"] .branch-quick-actions{border-top-color:#e2e8f0!important}

/* Branch darker slate rows v17.7 */
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) #ordersBody > tr[id^="row-"] > td{background:#e2e8f0!important;color:#1e293b!important;padding-top:8px!important;padding-bottom:10px!important}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) #ordersBody > tr[id^="row-"]:nth-child(even) > td{background:#dbe2ef!important}

/* Branch full-width row separator + strong hover v17.9 — CSS only */
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) #ordersBody > tr[id^="row-"]{
  position:relative!important;
  display:table-row!important;
  background:transparent!important;
}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) #ordersBody > tr[id^="row-"] > td{
  border-bottom:0!important;
  border-bottom-width:0!important;
  border-bottom-style:none!important;
}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) #ordersBody > tr[id^="row-"]::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-1px;
  height:3px;
  background:#c59b27;
  z-index:10;
  pointer-events:none;
}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) #ordersBody > tr[id^="row-"]:hover{
  background:#b0bece!important;
}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) #ordersBody > tr[id^="row-"]:hover > td{
  background:#b0bece!important;
  color:#132033!important;
}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) #ordersBody > tr[id^="row-"]:hover::after{
  background:#b88919!important;
}
html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) #ordersBody > tr[id^="row-"]:hover > td:nth-child(3) .muted{color:#334155!important}

@media(max-width:1100px){
  #ordersBody > tr[id^="row-"] > td:nth-child(9){min-width:145px!important;max-width:none!important}
  #ordersBody > tr[id^="row-"] > td:nth-child(9) > button{font-size:9px!important;padding:4px 7px!important}
}
@media(max-width:850px){
  html[data-mw-global-theme="light"] .chat-line{max-width:90%!important}
  html[data-mw-global-theme="light"] body:has(.chat-layout) .dashboard-header,
  html[data-mw-global-theme="light"] body:has(.chat-layout) .panel-card,
  html[data-mw-global-theme="light"] body:has(.branch-luxury-stats) .container{border-radius:14px!important}
  #ordersBody > tr[id^="row-"] > td{padding:5px 4px!important}
}
