/*
 * Phase 20.5.14.23 — Core Responsive CSS Refactor & Conflict Cleanup
 * Professional responsive lock: replaces incremental mobile patches from 20.5.14.19–20.5.14.22
 * with one controlled layer. Scope: layout containment, Arabic text safety, admin/customer/notifications mobile stack.
 */
:root{
  --mk-safe-gutter:clamp(10px,3vw,24px);
  --mk-mobile-radius:22px;
}
html{overflow-x:hidden;-webkit-text-size-adjust:100%;scroll-behavior:smooth}
body{overflow-x:hidden;min-width:0;text-rendering:optimizeLegibility}
*,*::before,*::after{box-sizing:border-box}
img,svg,video,canvas,iframe{max-width:100%;height:auto}
a,button,input,select,textarea{max-width:100%;font:inherit}
input,select,textarea{min-width:0}
.container,.page-shell,.content-shell,.admin-main,.admin-content,.vendor-main-pro,.customer-main,.panel,.card,.admin-card,.vendor-panel-pro{min-width:0;max-width:100%}

/* Arabic text must not be broken letter-by-letter. Aggressive wrapping is allowed only for machine strings. */
:where(.card,.admin-card,.vendor-card,.operation-card,.stat-card,.panel,.box,.form-card,.order-card,.store-card,.product-card,.notification-card,
.customer-orders-v177,.notifications-page,.admin-page,.vendor-page) :where(h1,h2,h3,h4,p,span,a,b,strong,small,label,button,summary,li,td,th){
  word-break:normal;
  overflow-wrap:normal;
  line-break:auto;
}
:where(code,pre,.debug-box,.log-box,.error-box,.api-response,.order-code,.copy-order-code-host-v20512542,[class*="code"],[class*="token"],[class*="hash"]){
  overflow-wrap:anywhere!important;
  word-break:break-word!important;
}
pre,code,.debug-box,.log-box,.error-box{white-space:pre-wrap;max-width:100%;overflow-x:auto}

/* Tables should scroll horizontally instead of squeezing columns into 1-letter Arabic words. */
.table-pro-wrap,.responsive-table,.table-responsive,.admin-table-wrap,.orders-table-wrap,[class*="table-wrap"]{
  width:100%;max-width:100%;overflow-x:auto!important;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain
}
table{max-width:100%;border-collapse:separate;border-spacing:0}
.table-pro-wrap table,.responsive-table table,.admin-table-wrap table{min-width:720px}

/* Buttons and actions: controlled wrapping, never character squeezing. */
button,.btn,.btn-pro,.mini-btn,.action-btn,[class*="btn"],[class*="button"]{line-height:1.35;min-width:0}
.actions,.form-actions,.order-actions,.checkout-actions{min-width:0;max-width:100%}
.modal,.modal-card,.dialog,.dialog-card,.popup-card,.drawer,.sheet{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);overflow:auto;-webkit-overflow-scrolling:touch}

@media (min-width:1025px){
  .store-products-grid,.products-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
  .admin-layout,.vendor-layout-pro{align-items:start}
  .admin-sidebar,.vendor-sidebar{position:sticky;top:14px;align-self:start;max-height:calc(100dvh - 28px);overflow:auto}
}

@media (max-width:1024px){
  .admin-layout,.vendor-layout-pro,.dashboard-grid,.checkout-grid,.cart-layout,.orders-layout{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:16px!important;width:100%!important;max-width:100%!important}
  .admin-main,.vendor-main-pro,.checkout-main,.cart-main,.customer-main{width:100%!important;max-width:100%!important;min-width:0!important;padding-inline:var(--mk-safe-gutter)!important}
  .admin-sidebar,.vendor-sidebar{position:relative!important;inset:auto!important;transform:none!important;width:100%!important;max-width:100%!important;min-width:0!important;max-height:none!important;overflow:visible!important;margin-inline:auto!important}
  .admin-menu-pro,.admin-menu-unified-v167,.vendor-menu{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:8px!important;width:100%!important;max-width:100%!important}
  .admin-menu-pro a,.admin-menu-unified-v167 a,.vendor-menu a{display:flex!important;align-items:center!important;gap:10px!important;width:100%!important;min-height:46px!important;white-space:normal!important;line-height:1.55!important;text-align:right!important;justify-content:flex-start!important}
  .admin-menu-pro a>*:not(.rbac-nav-icon):not(.rbac-lock),.admin-menu-unified-v167 a>*:not(.rbac-nav-icon):not(.rbac-lock){min-width:0;max-width:100%}
}

@media (max-width:760px){
  .actions,.form-actions,.order-actions,.checkout-actions{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px!important;width:100%!important}
  .actions a,.actions button,.form-actions a,.form-actions button,.order-actions a,.order-actions button,.checkout-actions a,.checkout-actions button{width:100%;justify-content:center;text-align:center}
  .tabs,.nav-tabs,.store-tabs,.admin-tabs,.category-nav{overflow-x:auto!important;overflow-y:hidden!important;white-space:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:thin;max-width:100%;flex-wrap:nowrap!important}
  .tabs a,.tabs button,.nav-tabs a,.nav-tabs button,.store-tabs a,.store-tabs button,.category-nav a{flex:0 0 auto}
  .table-pro-wrap table,.responsive-table table,.admin-table-wrap table{min-width:640px}
}

/* Notifications source layout: true stack on mobile, no squeezed side columns. */
@media (max-width:900px){
  .notifications-page{padding-block:28px 44px!important;overflow-x:hidden!important}
  .notifications-page .container{width:min(100% - 16px,1240px)!important;max-width:100%!important;padding-inline:0!important;overflow:visible!important}
  .notifications-page .notifications-hero{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:16px!important;padding:22px!important;border-radius:26px!important;overflow:hidden!important}
  .notifications-page .notifications-hero h1{font-size:clamp(24px,7vw,31px)!important;line-height:1.35!important;letter-spacing:0!important}
  .notifications-page .notifications-hero p{line-height:1.85!important;max-width:100%!important}
  .notifications-page .notif-hero-actions{display:grid!important;grid-template-columns:minmax(0,1fr)!important;width:100%!important;gap:10px!important}
  .notifications-page .notif-hero-actions>*{width:100%!important;max-width:100%!important}
  .notifications-page .notif-mini-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .notifications-page .notif-mini-stats>div{min-width:0!important;overflow:hidden!important}
  .notifications-page .notif-search-row{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px!important;width:100%!important;max-width:100%!important;overflow:visible!important}
  .notifications-page .notif-search-row :where(input,select,button){width:100%!important;min-width:0!important;max-width:100%!important}
  .notifications-page .notif-tabs{display:flex!important;flex-wrap:nowrap!important;gap:8px!important;max-width:100%!important;overflow-x:auto!important;overflow-y:hidden!important;padding:0 2px 10px!important;margin-block:16px!important;-webkit-overflow-scrolling:touch!important;scrollbar-width:thin!important}
  .notifications-page .notif-tabs a{flex:0 0 auto!important;min-width:max-content!important;width:auto!important;max-width:none!important;white-space:nowrap!important;line-height:1.25!important;padding:10px 15px!important;overflow:visible!important;text-overflow:clip!important}
  .notifications-page .notification-list{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:14px!important;width:100%!important;max-width:100%!important}
  .notifications-page .notification-card{display:grid!important;grid-template-columns:minmax(0,1fr)!important;width:100%!important;max-width:100%!important;min-width:0!important;gap:12px!important;padding:16px!important;border-radius:22px!important;overflow:hidden!important;align-items:stretch!important}
  .notifications-page .notif-icon{width:48px!important;height:48px!important;min-width:48px!important;border-radius:16px!important;margin-inline-start:auto!important;margin-inline-end:0!important}
  .notifications-page .notif-body,.notifications-page .notif-topline,.notifications-page .notif-meta,.notifications-page .notif-actions{display:block!important;width:100%!important;max-width:100%!important;min-width:0!important;grid-column:auto!important}
  .notifications-page .notif-topline h3{display:block!important;width:100%!important;margin:0 0 7px!important;font-size:clamp(18px,5vw,22px)!important;line-height:1.6!important;white-space:normal!important;text-align:right!important;word-break:normal!important;overflow-wrap:normal!important}
  .notifications-page .notif-date{display:block!important;width:100%!important;margin:0 0 8px!important;white-space:normal!important;text-align:right!important;direction:ltr!important;unicode-bidi:plaintext!important;overflow-wrap:break-word!important}
  .notifications-page .notif-body p{display:block!important;width:100%!important;margin:8px 0 12px!important;line-height:1.9!important;white-space:normal!important;text-align:right!important;word-break:normal!important;overflow-wrap:normal!important}
  .notifications-page .notif-meta{display:flex!important;flex-wrap:wrap!important;gap:7px!important;justify-content:flex-start!important}
  .notifications-page .notif-actions{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:9px!important;margin-top:2px!important}
  .notifications-page .notif-actions .btn{width:100%!important;max-width:100%!important;justify-content:center!important;white-space:normal!important}
}

/* Customer orders source layout: mobile cards stack from the real components, not emergency overlays. */
@media (max-width:900px){
  .customer-orders-v177{padding-block:20px 42px!important;overflow-x:hidden!important}
  .customer-orders-v177 .wrap{width:min(100% - 16px,1180px)!important;max-width:100%!important;padding-inline:0!important;overflow:visible!important}
  .customer-orders-v177 .hero{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important;align-items:stretch!important;padding:18px!important;border-radius:26px!important;overflow:hidden!important}
  .customer-orders-v177 .hero>div:first-child{width:100%!important;min-width:0!important}
  .customer-orders-v177 .hero h1{font-size:clamp(24px,7.2vw,31px)!important;line-height:1.35!important;margin-block:8px 10px!important;letter-spacing:0!important}
  .customer-orders-v177 .hero p{font-size:13.5px!important;line-height:1.85!important}
  .customer-orders-v177 .hero-stat,.customer-orders-v177 a.hero-stat{display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;padding:16px!important;border-radius:22px!important;position:relative!important;inset:auto!important;transform:none!important;text-decoration:none!important;z-index:2!important;min-height:92px!important}
  .customer-orders-v177 .hero-stat span,.customer-orders-v177 .hero-stat b{display:block!important;width:100%!important;text-align:center!important;white-space:normal!important;line-height:1.45!important}
  .customer-orders-v177 .stats{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important}
  .customer-orders-v177 .stat{min-width:0!important;overflow:hidden!important}.customer-orders-v177 .stat:last-child:nth-child(odd){grid-column:1/-1!important}
  .customer-orders-v177 .filters{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px!important;width:100%!important;max-width:100%!important;overflow:visible!important}
  .customer-orders-v177 .filters :where(input,select,button){width:100%!important;max-width:100%!important;min-width:0!important}
  .customer-orders-v177 .stage-tabs{display:flex!important;flex-wrap:nowrap!important;overflow-x:auto!important;overflow-y:hidden!important;gap:8px!important;max-width:100%!important;padding-bottom:8px!important;-webkit-overflow-scrolling:touch!important}
  .customer-orders-v177 .stage-tabs a{flex:0 0 auto!important;min-width:max-content!important;max-width:none!important;white-space:nowrap!important}
  .customer-orders-v177 .live-center,.customer-orders-v177 .order-card,.customer-orders-v177 .proof-panel,.customer-orders-v177 .tracking-panel,.customer-orders-v177 .items,.customer-orders-v177 .digital-delivery-box-v20925,.customer-orders-v177 .return-settlement-audit-v205121516,.customer-orders-v177 .customer-refund-receipt-card-v205121515{width:100%!important;max-width:100%!important;min-width:0!important;overflow:hidden!important}
  .customer-orders-v177 .order-card{padding:14px!important;border-radius:24px!important}
  .customer-orders-v177 .order-top,.customer-orders-v177 .order-title,.customer-orders-v177 .proof-head,.customer-orders-v177 .tracking-head,.customer-orders-v177 .live-head,.customer-orders-v177 .delivery-code-customer-v18952853{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px!important;align-items:stretch!important;width:100%!important;max-width:100%!important;min-width:0!important}
  .customer-orders-v177 .store-avatar{width:48px!important;height:48px!important;margin-inline-start:auto!important}
  .customer-orders-v177 .badges,.customer-orders-v177 .actions{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:8px!important;width:100%!important;justify-content:stretch!important}
  .customer-orders-v177 .badge,.customer-orders-v177 .new-update-ribbon,.customer-orders-v177 .btn,.customer-orders-v177 .track-percent,.customer-orders-v177 .live-unread{width:100%!important;max-width:100%!important;min-width:0!important;white-space:normal!important;text-align:center!important;justify-content:center!important;line-height:1.55!important}
  .customer-orders-v177 .order-grid,.customer-orders-v177 .pay-info,.customer-orders-v177 .proof-form,.customer-orders-v177 .tracking-update,.customer-orders-v177 .stage-info-list,.customer-orders-v177 .digital-delivery-grid-v20925,.customer-orders-v177 .digital-delivery-row-v20925,.customer-orders-v177 .return-settlement-audit-summary-grid-v2051215161,.customer-orders-v177 .customer-refund-actions-v205121515,.customer-orders-v177 .cancel-return-pro-form-v2051255,.customer-orders-v177 .cancel-return-box-v205125 form{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:10px!important;width:100%!important;max-width:100%!important;min-width:0!important}
  .customer-orders-v177 .box,.customer-orders-v177 .update-box,.customer-orders-v177 .stage-info-item{width:100%!important;max-width:100%!important;min-width:0!important;overflow:hidden!important;text-align:right!important}
  .customer-orders-v177 .box b,.customer-orders-v177 .box small,.customer-orders-v177 .update-box b,.customer-orders-v177 .update-box p,.customer-orders-v177 .stage-info-item b,.customer-orders-v177 .stage-info-item small{display:block!important;width:100%!important;max-width:100%!important;white-space:normal!important;line-height:1.75!important;word-break:normal!important;overflow-wrap:normal!important}
  .customer-orders-v177 .items .item{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:6px!important;align-items:stretch!important;width:100%!important;max-width:100%!important}
  .customer-orders-v177 .items .item span,.customer-orders-v177 .items .item b{display:block!important;width:100%!important;max-width:100%!important;white-space:normal!important;text-align:right!important;line-height:1.7!important;word-break:normal!important;overflow-wrap:normal!important}
  .customer-orders-v177 .items .item b{text-align:left!important;direction:ltr!important;unicode-bidi:plaintext!important;overflow-wrap:break-word!important}
}

@media (max-width:760px){
  .customer-orders-v177 .timeline,.customer-orders-v177 .tracking-panel.cancel-return-timeline-v2051262 .timeline,.customer-orders-v177 .tracking-panel.digital-timeline-v20930 .timeline{display:flex!important;grid-template-columns:none!important;flex-wrap:nowrap!important;gap:10px!important;width:100%!important;max-width:100%!important;min-width:0!important;overflow-x:auto!important;overflow-y:hidden!important;padding:4px 2px 10px!important;-webkit-overflow-scrolling:touch!important;scroll-snap-type:x proximity!important}
  .customer-orders-v177 .timeline:before,.customer-orders-v177 .timeline:after,.customer-orders-v177 .tracking-panel.cancel-return-timeline-v2051262 .timeline:before,.customer-orders-v177 .tracking-panel.cancel-return-timeline-v2051262 .timeline:after{display:none!important;content:none!important}
  .customer-orders-v177 .t-step,.customer-orders-v177 .tracking-panel.cancel-return-timeline-v2051262 .t-step{flex:0 0 118px!important;width:118px!important;max-width:118px!important;min-width:118px!important;text-align:center!important;scroll-snap-align:start!important}
  .customer-orders-v177 .t-step b,.customer-orders-v177 .t-step small{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;line-height:1.45!important;word-break:normal!important;overflow-wrap:normal!important}
}

@media (max-width:480px){
  .product-grid,.products-grid,.store-products-grid,.stores-grid,.cards-grid{grid-template-columns:1fr!important}
  .admin-main,.vendor-main-pro,.customer-main,.checkout-main,.cart-main{padding-inline:10px!important}
  .table-pro-wrap table,.responsive-table table,.admin-table-wrap table{min-width:620px}
  .notifications-page .notif-mini-stats{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.01ms!important}}
