/* Desktop-only polish. Keep phone layouts and the explicit App/H5 preview intact. */
@media (min-width: 1024px) {
  html:not(.force-h5) :is(.buyer-body,.seller-body,.admin-body) {
    --pc-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    font-family: var(--pc-font);
  }
  html:not(.force-h5) :is(.buyer-body,.seller-body,.admin-body) :is(.price,.kpi-num,.dq b,.seller-profit-value,.seller-today-grid strong,.seller-total-grid strong,.stat-grid .num) {
    font-family: var(--pc-font) !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.3px;
  }

  /* Four header children need four tracks: the language control must not wrap. */
  html:not(.force-h5) .buyer-body .pc-header-inner {
    width: 100%; max-width: 1360px; height: 84px; padding: 0 24px;
    grid-template-columns: 150px minmax(220px,1fr) auto 44px; gap: 24px;
  }
  html:not(.force-h5) .buyer-body .pc-header .pc-lang {
    position: relative; inset: auto; width: 44px; margin: 0; justify-self: end;
  }
  html:not(.force-h5) .buyer-body .pc-header .lang-btn {
    width: 40px; height: 38px; padding: 0; border: 1px solid #e4e7ec; border-radius: 9px; box-shadow: none;
  }
  html:not(.force-h5) .buyer-body .pc-logo { height: auto; }
  html:not(.force-h5) .buyer-body .pc-logo img { width: 52px; height: 56px; }
  html:not(.force-h5) .buyer-body .pc-account { gap: 16px; white-space: nowrap; }
  html:not(.force-h5) .buyer-body .pc-search { min-width: 0; gap: 10px; height: 44px; }
  html:not(.force-h5) .buyer-body .pc-search>span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html:not(.force-h5) .buyer-body .pc-search:after { flex: none; box-shadow: none; }
  html:not(.force-h5) .buyer-body .pc-nav { max-width: 900px; height: 46px; }
  html:not(.force-h5) .buyer-body .pc-nav a { height: 46px; }
  html:not(.force-h5) .buyer-body .pc-promo-grid { height: 100%; grid-template-rows: repeat(2,minmax(0,1fr)); }
  html:not(.force-h5) .buyer-body .pc-promo-card { height: 100%; min-height: 0; }
  html:not(.force-h5) .buyer-body .pc-section-head { margin: 36px 0 18px; padding-bottom: 0; }

  /* A cart row reads left to right: product, price, quantity and actions. */
  html:not(.force-h5) .buyer-body .cart-page {
    width: calc(100% - 48px); max-width: 1160px; min-height: calc(100vh - 130px); padding: 28px 0 64px;
  }
  html:not(.force-h5) .buyer-body .cart-page>.topbar {
    min-height: 48px; padding: 0 0 20px; border: 0; background: transparent;
  }
  html:not(.force-h5) .buyer-body .cart-page>.topbar h1 { font-size: 22px; }
  html:not(.force-h5) .buyer-body .cart-page>.list-item {
    gap: 20px; padding: 20px; margin: 0 0 12px; min-height: 120px;
    border: 1px solid #e7eaf0; border-radius: 12px; background: #fff;
  }
  html:not(.force-h5) .buyer-body .cart-page>.list-item>input { width: 18px; height: 18px; flex: none; accent-color: #e60023; }
  html:not(.force-h5) .buyer-body .cart-page>.list-item .thumb { width: 80px; height: 80px; flex: none; }
  html:not(.force-h5) .buyer-body .cart-page>.list-item .body {
    display: grid; grid-template-columns: minmax(0,1fr) 120px 206px; gap: 8px 20px; align-items: center;
  }
  html:not(.force-h5) .buyer-body .cart-page .body>.title { grid-column: 1; grid-row: 1; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
  html:not(.force-h5) .buyer-body .cart-page .body>.muted { grid-column: 1; grid-row: 2; }
  html:not(.force-h5) .buyer-body .cart-page .body>.price { grid-column: 2; grid-row: 1 / span 2; margin: 0 !important; font-size: 18px; text-align: right; }
  html:not(.force-h5) .buyer-body .cart-page .body>div:last-child { grid-column: 3; grid-row: 1 / span 2; margin-top: 0 !important; white-space: nowrap; text-align: right; }
  html:not(.force-h5) .buyer-body .cart-page>.detail-actions { gap: 20px; margin-top: 20px; padding: 18px 20px; border: 1px solid #e7eaf0; border-radius: 12px; box-shadow: 0 -4px 20px #18223008; }
  html:not(.force-h5) .buyer-body .cart-page>.detail-actions>div { text-align: right; }
  html:not(.force-h5) .buyer-body .cart-page>.detail-actions .btn-primary { flex: 0 0 180px; width: 180px; min-height: 44px; border-radius: 10px !important; box-shadow: none; }

  /* Give the existing floating language selector a reserved desktop lane. */
  html:not(.force-h5) .seller-body .seller-main>div>.topbar { padding-right: 94px; }
  html:not(.force-h5) .seller-body .seller-main>.lang-switch { top: 14px; right: 24px; }
  html:not(.force-h5) .seller-body .seller-main>.lang-switch .lang-btn { width: 40px; height: 38px; border: 1px solid #e4e7ec; border-radius: 9px; box-shadow: none; }
  html:not(.force-h5) .seller-body .pc-sidebar { scrollbar-width: thin; }
  html:not(.force-h5) .seller-body .ps-link { min-height: 40px; padding-block: 8px; font-size: 14px; }
  html:not(.force-h5) .seller-body .ps-link>span { width: 20px; height: 20px; flex-basis: 20px; }
  html:not(.force-h5) .seller-body .ps-link .mall-ic { width: 20px; height: 20px; }
  html:not(.force-h5) .seller-body .seller-main :is(.card,.stat-card,.order-item) { box-shadow: 0 2px 6px #18223004; }
  html:not(.force-h5) .seller-body .seller-main>.seller-home { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; max-width: 1400px; }
  html:not(.force-h5) .seller-body .seller-home>* { grid-column: 1 / -1; min-width: 0; }
  html:not(.force-h5) .seller-body .seller-home>:is(.card,.seller-profit-card,.menu-grid,.list-item) { margin: 0; }
  html:not(.force-h5) .seller-body .seller-home>.topbar { margin-bottom: 4px; }
  html:not(.force-h5) .seller-body .seller-home>.seller-profit-card { grid-column: 1; padding: 22px; }
  html:not(.force-h5) .seller-body .seller-home>.seller-shop-summary { grid-column: 2; display: flex; flex-direction: column; padding: 22px; }
  html:not(.force-h5) .seller-body .seller-shop-summary .seller-total-grid { margin-top: auto; padding-top: 20px; }
  html:not(.force-h5) .seller-body .seller-home>.card:has(.order-status-grid) { grid-column: 1; }
  html:not(.force-h5) .seller-body .seller-home>.card:has(.traffic-grid) { grid-column: 2; }
  html:not(.force-h5) .seller-body .seller-home .seller-profit-value { font-size: 36px; }
  html:not(.force-h5) .seller-body .seller-home .menu-grid { padding: 10px; }
  html:not(.force-h5) .seller-body .seller-home .menu-grid a { min-height: 88px; }
  html:not(.force-h5) .seller-body .seller-home>.list-item { grid-column: auto; padding: 16px; border: 1px solid #e7eaf0; border-radius: 12px; }
  html:not(.force-h5) .seller-body .seller-main .list-item .title { font-size: 14px; line-height: 1.6; }

  /* A compact dashboard and consistent numeric typography, without hiding data. */
  html:not(.force-h5) .admin-body .admin-top { min-height: 70px; padding-block: 12px; }
  html:not(.force-h5) .admin-body .admin-tabs { padding-bottom: 8px; }
  html:not(.force-h5) .admin-body .welcome-card { padding: 18px 22px; margin-bottom: 16px; box-shadow: none; }
  html:not(.force-h5) .admin-body .dash-quick { gap: 14px; margin-bottom: 16px; }
  html:not(.force-h5) .admin-body .admin-kpis { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
  html:not(.force-h5) .admin-body .kpi { margin: 0; padding: 18px; gap: 12px; min-height: 94px; justify-content: flex-start; box-shadow: 0 2px 6px #18223004; }
  html:not(.force-h5) .admin-body .kpi-ico { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; box-shadow: none; }
  html:not(.force-h5) .admin-body .kpi-num { font-size: 24px; line-height: 1.35; }
  html:not(.force-h5) .admin-body .kpi-lab { margin-top: 6px; font-size: 12px; line-height: 1.5; }
  html:not(.force-h5) .admin-body .admin-toolbar { padding: 12px 14px; box-shadow: none; }
  html:not(.force-h5) .admin-body .table-wrap { scrollbar-width: thin; scrollbar-color: #bcc5d2 #f4f6f9; }
  /* Keep the customer identity visible while horizontally reading shop columns. */
  html:not(.force-h5) .admin-body .seller-table :is(th,td):nth-child(1) { position: sticky; left: 0; z-index: 2; background: #fff; }
  html:not(.force-h5) .admin-body .seller-table :is(th,td):nth-child(2) { position: sticky; left: 50px; z-index: 2; background: #fff; box-shadow: 2px 0 0 #e7eaf0; }
  html:not(.force-h5) .admin-body .seller-table th:nth-child(-n+2) { background: #f7f9fc; z-index: 3; }

  /* Full-route audit: keep shared statistics stretched inside flex cards. */
  html:not(.force-h5) :is(.buyer-body,.seller-body,.admin-body) .stat-grid {
    width: 100%; min-width: 0; margin: 0; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px;
  }
  html:not(.force-h5) :is(.buyer-body,.seller-body,.admin-body) .stat-grid:has(>:nth-child(4):last-child) { grid-template-columns: repeat(4,minmax(0,1fr)); }
  html:not(.force-h5) :is(.buyer-body,.seller-body,.admin-body) .stat-grid>div { min-width: 0; overflow-wrap: anywhere; }
  html:not(.force-h5) .admin-body .stat-grid>.kpi { display: block; text-align: left; }

  /* A vertical category rail must not wrap into clipped horizontal columns. */
  html:not(.force-h5) .buyer-body .commodity-layout .catalog-side { flex-wrap: nowrap; height: auto; align-self: start; }
  html:not(.force-h5) .buyer-body .catalog-side>:is(.chip,.catalog-side-title) { flex: none; width: 100%; white-space: normal; }
  html:not(.force-h5) .buyer-body .catalog-cat-icon { flex: 0 0 24px; }
  html:not(.force-h5) .buyer-body .detail-page { width: calc(100% - 48px); max-width: 1180px; }
  html:not(.force-h5) .buyer-body .detail-page .product-info { width: 100%; max-width: none; grid-template-columns: minmax(300px,.85fr) minmax(0,1fr); gap: 40px; padding: 18px 0 28px; }
  html:not(.force-h5) .buyer-body .product-info-right { min-width: 0; overflow-wrap: anywhere; }
  html:not(.force-h5) .buyer-body .detail-page .product-info .detail-img { width: 100%; height: auto; aspect-ratio: 1; max-width: 480px; margin-inline: auto; }
  html:not(.force-h5) .buyer-body .detail-lower { width: 100%; max-width: none; grid-template-columns: minmax(0,1fr) 220px; gap: 28px; }
  html:not(.force-h5) .buyer-body .detail-lower>main { min-width: 0; }
  html:not(.force-h5) .buyer-body .detail-lower>.detail-store-card { width: 100%; min-width: 0; max-width: 100%; margin: 0; overflow-wrap: anywhere; }
  html:not(.force-h5) .buyer-body .detail-store-card :is(.detail-store-head,.detail-store-actions) { flex-wrap: wrap; min-width: 0; }
  html:not(.force-h5) .buyer-body .detail-content-card { max-width: 100%; }
  html:not(.force-h5) .buyer-body .detail-option-row { flex-wrap: wrap; }
  html:not(.force-h5) .buyer-body .login-wrap { position: relative; }
  html:not(.force-h5) .buyer-body .login-wrap>.login-back { position: absolute; top: 24px; left: 24px; }
  html:not(.force-h5) .buyer-body .support-page { width: calc(100% - 48px); max-width: 1040px; height: calc(100dvh - 158px); min-height: 460px; margin: 14px auto; display: flex; flex-direction: column; }
  html:not(.force-h5) .buyer-body .support-page>.topbar { flex: none; padding-inline: 0; background: transparent; box-shadow: none; }
  html:not(.force-h5) .buyer-body .support-chat { display: flex; flex-direction: column; flex: 1; min-height: 0; margin: 10px 0 0; }
  html:not(.force-h5) .buyer-body .support-chat .chat-body { flex: 1; min-height: 0; overflow-y: auto; }
  html:not(.force-h5) .buyer-body .support-chat :is(.cs-online,.chat-quick,.chat-input) { flex: none; }
  html:not(.force-h5) .buyer-body .support-chat .chat-input input { min-width: 0; }

  /* Secondary screens share a readable canvas instead of mismatched 760/860px cards. */
  html:not(.force-h5) .buyer-body #app>.page>div:not([class]) { width: calc(100% - 48px); max-width: 1040px; margin: 24px auto 48px; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>:is(.card,.stat-card,.wallet-card,.list-item,.order-item,.empty) { width: 100%; max-width: none; margin: 16px 0; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.topbar { margin: 0 0 20px; padding: 0 0 18px; background: transparent; box-shadow: none; border-bottom: 1px solid #e7eaf0; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.section-title { margin: 24px 0 14px; padding: 0; font-size: 18px; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.seg { display: flex; gap: 8px; border-bottom: 1px solid #e7eaf0; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.seg>.seg-item { padding: 12px 24px; cursor: pointer; border-bottom: 2px solid transparent; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.seg>.seg-item.on { color: #e60023; border-color: #e60023; font-weight: 600; }
  html:not(.force-h5) .seller-body .seller-main>div:not(.seller-home)>:is(.card,.stat-card,.wallet-card,.list-item,.order-item,.empty) { width: 100%; max-width: none; margin: 16px 0; }
  html:not(.force-h5) .seller-body .seller-main>div>.section-title { margin: 24px 0 14px; padding: 0; font-size: 18px; }
  html:not(.force-h5) .seller-body .seller-main .marketing-hero { width: 100%; max-width: none; margin: 16px 0; }
  html:not(.force-h5) .seller-body .marketing-combo>.btn-primary { width: 180px; min-width: 180px; justify-self: end; border-radius: 10px; }
  html:not(.force-h5) :is(.buyer-body,.seller-body) .kv:has(>input:not([type=checkbox]),>textarea,>select) { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 12px; padding: 14px 0; }
  html:not(.force-h5) :is(.buyer-body,.seller-body) .kv>:is(input:not([type=checkbox]),textarea,select) { width: 100%; max-width: 620px; min-width: 0; min-height: 42px; border: 1px solid #dfe4ec; border-radius: 8px; padding: 10px 12px; font: inherit; }
  html:not(.force-h5) :is(.buyer-body,.seller-body) .kv>span:first-child { color: #586477; font-size: 13px; }
  html:not(.force-h5) :is(.buyer-body,.seller-body) :is(.card,.seller-main>div,#app>.page>div:not([class]))>.btn-block,
  html:not(.force-h5) .admin-body .card>.btn-block { width: auto; min-width: 180px; max-width: 100%; margin: 20px 0 0; padding-inline: 28px; border-radius: 10px; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.card[style*="text-align:center"] { text-align: center; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.card[style*="text-align:center"]>img { margin-inline: auto; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.card:has(>.field) { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px 20px; padding: 24px; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.card:has(>.field)>:not(.field) { grid-column: 1 / -1; justify-self: start; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.card>.field { min-width: 0; margin: 0; padding: 0; border: 0; }
  html:not(.force-h5) .buyer-body #app>.page>div:not([class])>.card>.field label { display: block; margin-bottom: 8px; color: #586477; }

  /* Table cells are cells, not full-height pill badges; inline badges stay intact. */
  html:not(.force-h5) .admin-body .admin-table td:is(.status-ok,.status-warn,.status-bad) { background: transparent !important; border-radius: 0; font-weight: 600; text-align: left; }
  html:not(.force-h5) .admin-body .admin-table td[style*="max-width"] { white-space: normal; overflow-wrap: anywhere; }
  html:not(.force-h5) .admin-body .kv:has(>span>input[type=number]):has(.chip) { align-items: start; }
  html:not(.force-h5) .admin-body .kv>span:has(>input[type=number]):has(.chip) { flex-wrap: wrap; gap: 10px !important; min-width: 0; line-height: 2; }
  html:not(.force-h5) .admin-body .kv>span:has(>input[type=number])>:is(input,.chip) { flex: none; white-space: nowrap; }
  html:not(.force-h5) .admin-body .modal-box { max-height: calc(100dvh - 64px); overflow-y: auto; }
}
@media (min-width: 1024px) and (max-width: 1199px) {
  html:not(.force-h5) .buyer-body .pc-header-inner { grid-template-columns: 90px minmax(220px,1fr) auto 40px; gap: 16px; }
  html:not(.force-h5) .buyer-body .pc-account { gap: 10px; font-size: 13px; }
  html:not(.force-h5) .admin-body .admin-kpis { grid-template-columns: repeat(3,minmax(0,1fr)); }
  html:not(.force-h5) .seller-body .seller-main { padding-inline: 20px; }
  html:not(.force-h5) .seller-body .seller-main>div>.topbar { margin-inline: -20px; padding-left: 20px; }
  html:not(.force-h5) .seller-body .seller-home .seller-today-grid { gap: 8px; }
}
@media (min-width: 1440px) {
  html:not(.force-h5) .seller-body .seller-home .menu-grid { grid-template-columns: repeat(8,minmax(0,1fr)); }
}
