/* Final mobile design system. Keep desktop behavior in the existing stylesheets. */
.mobile-page-tools,
.mobile-filter-chips,
.customer-actions-mobile,
.product-actions-mobile,
.user-actions-mobile,
.audit-mobile-list,
.order-mobile-heading,
.order-mobile-summary,
.mobile-filter-layer,
.mobile-page-more {
  display: none;
}

@media (max-width: 720px) {
  :root {
    --m-space-1: 4px;
    --m-space-2: 8px;
    --m-space-3: 12px;
    --m-space-4: 16px;
    --m-header: 48px;
    --m-nav: 58px;
    --m-radius: 10px;
    --m-line: #e3e9f2;
    --m-surface: #fff;
    --m-canvas: #f4f7fc;
    --m-muted: #718096;
    --m-blue: #315de5;
  }

  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background: var(--m-canvas);
    font-size: 14px;
  }

  .mobile-v2,
  .mobile-v2 * {
    box-sizing: border-box;
  }

  .mobile-v2 .sidebar { display: none; }
  .mobile-v2 .main { width: 100%; min-width: 0; margin: 0; padding: 0 0 calc(var(--m-nav) + env(safe-area-inset-bottom)); }
  .mobile-v2.has-mobile-cart .main { padding-bottom: calc(108px + env(safe-area-inset-bottom)); }
  .mobile-v2 .topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    min-height: var(--m-header);
    height: var(--m-header);
    padding: 0 var(--m-space-3);
    border-bottom: 1px solid var(--m-line);
    background: rgba(255,255,255,.96);
    backdrop-filter: blur(12px);
  }
  .mobile-v2 .topbar .page-title,
  .mobile-v2 .topbar h1 { margin: 0; font-size: 19px; line-height: 1.2; color: #16243a; }
  .mobile-v2 .topbar .page-subtitle,
  .mobile-v2 .topbar > .toolbar { display: none; }
  .mobile-v2 .content {
    width: 100%;
    min-width: 0;
    padding: var(--m-space-2) var(--m-space-2) calc(var(--m-nav) + var(--m-space-3) + env(safe-area-inset-bottom));
  }
  .mobile-v2.has-mobile-cart .content { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .mobile-v2 .card,
  .mobile-v2 .customer-card,
  .mobile-v2 .order-card,
  .mobile-v2 .product-mobile-item,
  .mobile-v2 .cost-order-card {
    border: 1px solid var(--m-line);
    border-radius: var(--m-radius);
    box-shadow: 0 2px 8px rgba(31,48,80,.045);
    background: var(--m-surface);
  }
  .mobile-v2 .input,
  .mobile-v2 .select,
  .mobile-v2 .btn { min-height: 40px; font-size: 13px; border-radius: 9px; }
  .mobile-v2 .btn { padding: 7px 10px; }
  .mobile-v2 .btn.primary { background: var(--m-blue); }
  .mobile-v2 .hint,
  .mobile-v2 .meta,
  .mobile-v2 small { font-size: 11px; line-height: 1.35; color: var(--m-muted); }
  .mobile-v2 .badge { padding: 3px 7px; font-size: 10px; line-height: 1.15; white-space: nowrap; }

  /* Fixed five-item navigation. */
  .mobile-v2 .mobile-bottom-nav {
    z-index: 80;
    min-height: calc(var(--m-nav) + env(safe-area-inset-bottom));
    padding: 2px 5px env(safe-area-inset-bottom);
    border-top: 1px solid var(--m-line);
    background: rgba(255,255,255,.97);
    box-shadow: 0 -3px 14px rgba(31,48,80,.08);
  }
  .mobile-v2 .mobile-bottom-nav button { min-height: 52px; gap: 1px; border-radius: 9px; font-size: 10px; }
  .mobile-v2 .mobile-bottom-nav .nav-icon { width: 25px; height: 25px; border-radius: 8px; font-size: 12px; }

  /* Shared page tools, chips, sheets and compact overflow menus. */
  .mobile-v2 .desktop-page-tools,
  .mobile-v2 .content > .desktop-page-tools,
  .mobile-v2.route-customers .content > .filter-toolbar.desktop-page-tools,
  .mobile-v2.route-products .content > .product-management-toolbar.desktop-page-tools,
  .mobile-v2.route-orders .content > .order-filter-toolbar.desktop-page-tools { display: none !important; }
  .mobile-v2 .mobile-page-tools {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto auto;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
  }
  .mobile-v2 .mobile-page-tools > .input { width: 100%; min-width: 0; }
  .mobile-v2 .mobile-page-tools > .btn { white-space: nowrap; }
  .mobile-v2 .mobile-filter-button { min-width: 54px; color: #3158c8; background: #eef3ff; border-color: #d9e3fb; }
  .mobile-v2 .mobile-filter-chips { display: flex; min-height: 0; gap: 5px; margin: 0 0 6px; overflow-x: auto; }
  .mobile-v2 .mobile-filter-chips:empty { display: none; }
  .mobile-v2 .mobile-filter-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 5px;
    min-height: 28px;
    padding: 3px 8px;
    border: 1px solid #cad8fb;
    border-radius: 999px;
    color: #2e58ce;
    background: #edf3ff;
    font-size: 11px;
  }
  .mobile-v2 .mobile-filter-chip b { font-size: 14px; }
  .mobile-v2 .mobile-filter-layer { display: block; z-index: 1300; }
  .mobile-v2 .mobile-filter-sheet {
    display: grid;
    grid-template-rows: 12px auto auto auto;
    width: 100%;
    max-height: min(72dvh, 580px);
    padding: 0 12px calc(12px + env(safe-area-inset-bottom));
    border-radius: 18px 18px 0 0;
  }
  .mobile-v2 .mobile-filter-sheet .mobile-sheet-head { min-height: 48px; padding: 4px 0 8px; }
  .mobile-v2 .mobile-filter-fields { display: grid; gap: 10px; padding: 8px 0 14px; overflow-y: auto; }
  .mobile-v2 .mobile-filter-field { display: grid; gap: 4px; }
  .mobile-v2 .mobile-filter-field > span { font-size: 11px; font-weight: 700; color: var(--m-muted); }
  .mobile-v2 .mobile-filter-done { width: 100%; }
  .mobile-v2 .mobile-row-actions { display: none; }
  .mobile-v2 .mobile-page-more { display: block; position: relative; }
  .mobile-v2 .mobile-page-more > summary,
  .mobile-v2 .mobile-row-more > summary {
    display: grid;
    place-items: center;
    min-width: 40px;
    min-height: 40px;
    border: 1px solid var(--m-line);
    border-radius: 9px;
    color: #52627d;
    background: #fff;
    cursor: pointer;
    list-style: none;
  }
  .mobile-v2 .mobile-page-more > summary::-webkit-details-marker,
  .mobile-v2 .mobile-row-more > summary::-webkit-details-marker { display: none; }
  .mobile-v2 .mobile-page-more > div,
  .mobile-v2 .mobile-row-more > div {
    position: absolute;
    right: 0;
    z-index: 25;
    display: grid;
    min-width: 132px;
    padding: 5px;
    border: 1px solid var(--m-line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(20,35,70,.18);
  }
  .mobile-v2 .mobile-page-more button,
  .mobile-v2 .mobile-row-more button { min-height: 38px; padding: 7px 9px; border: 0; border-radius: 7px; text-align: left; color: #24324a; background: transparent; }
  .mobile-v2 .mobile-page-more button:active,
  .mobile-v2 .mobile-row-more button:active { background: #f1f5fb; }
  .mobile-v2 .mobile-page-more button.danger,
  .mobile-v2 .mobile-row-more button.danger { color: #dc3545; }

  /* Dashboard: E direction, one hero amount + three compact month metrics. */
  .mobile-v2.route-dashboard .topbar { color: #fff; background: var(--m-blue); border-color: var(--m-blue); }
  .mobile-v2.route-dashboard .topbar h1 { color: #fff; }
  .mobile-v2.route-dashboard .dashboard-metrics { gap: 4px; padding: 0; }
  .mobile-v2.route-dashboard .dashboard-filter-row { gap: 3px; margin-bottom: 2px; }
  .mobile-v2.route-dashboard .dashboard-filter-row > span { font-size: 10px; }
  .mobile-v2.route-dashboard .dashboard-sales-filter { margin-bottom: 4px; }
  .mobile-v2.route-dashboard .dashboard-sales-filter label { margin-bottom: 3px; font-size: 11px; }
  .mobile-v2.route-dashboard .dashboard-sales-filter .select { height: 38px; min-height: 38px; }
  .mobile-v2.route-dashboard .dashboard-section-head { margin: 8px 2px 4px; }
  .mobile-v2.route-dashboard .dashboard-section-head strong { font-size: 15px; }
  .mobile-v2.route-dashboard .dashboard-section-head span { font-size: 11px; }
  .mobile-v2.route-dashboard .dashboard-metric-grid.month-metrics {
    display: grid;
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 5px;
    overflow: visible;
  }
  .mobile-v2.route-dashboard .month-metrics .dashboard-metric {
    min-width: 0;
    min-height: 62px;
    padding: 6px 5px;
    border-radius: 9px;
  }
  .mobile-v2.route-dashboard .month-metrics .dashboard-metric:first-child {
    grid-column: 1/-1;
    min-height: 72px;
    padding: 10px 12px;
    background: linear-gradient(135deg,#315de5,#5079ed);
    border-color: transparent;
    color: #fff;
  }
  .mobile-v2.route-dashboard .month-metrics .dashboard-metric:first-child .dashboard-metric-label,
  .mobile-v2.route-dashboard .month-metrics .dashboard-metric:first-child .dashboard-metric-value { color: #fff; }
  .mobile-v2.route-dashboard .month-metrics .dashboard-metric:first-child .dashboard-metric-value { margin-top: 2px; font-size: 25px; }
  .mobile-v2.route-dashboard .dashboard-metric-label { font-size: 10px; line-height: 1.25; }
  .mobile-v2.route-dashboard .month-metrics .dashboard-metric-value { margin-top: 2px; font-size: 17px; line-height: 1.1; white-space: nowrap; }
  .mobile-v2.route-dashboard .dashboard-metric-note { display: none; }
  .mobile-v2.route-dashboard .month-metrics .dashboard-metric:not(:first-child),
  .mobile-v2.route-dashboard .today-metrics .dashboard-metric { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
  .mobile-v2.route-dashboard .month-metrics .dashboard-metric:not(:first-child) > div:first-child,
  .mobile-v2.route-dashboard .today-metrics .dashboard-metric > div:first-child { display: contents; }
  .mobile-v2.route-dashboard .dashboard-metric-icon {
    order: -1;
    display: grid;
    place-items: center;
    width: 23px;
    height: 23px;
    margin-bottom: 3px;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 800;
  }
  .mobile-v2.route-dashboard .month-metrics .dashboard-metric:first-child .dashboard-metric-icon { display: none; }
  .mobile-v2.route-dashboard .dashboard-metric.violet .dashboard-metric-icon { color: #7447c8; background: #f0e9ff; }
  .mobile-v2.route-dashboard .dashboard-metric.orange .dashboard-metric-icon { color: #c36a12; background: #fff0df; }
  .mobile-v2.route-dashboard .dashboard-metric.cyan .dashboard-metric-icon { color: #1680a2; background: #e1f6fc; }
  .mobile-v2.route-dashboard .dashboard-metric.green .dashboard-metric-icon { color: #16845f; background: #e2f7ef; }
  .mobile-v2.route-dashboard .dashboard-metric.gold .dashboard-metric-icon { color: #a36b00; background: #fff4d8; }
  .mobile-v2.route-dashboard .dashboard-metric.red .dashboard-metric-icon { color: #c44855; background: #ffe8eb; }
  .mobile-v2.route-dashboard .today-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 5px; }
  .mobile-v2.route-dashboard .today-metrics .dashboard-metric { min-height: 62px; padding: 5px 4px; }
  .mobile-v2.route-dashboard .today-metrics .dashboard-metric-value { margin-top: 2px; font-size: 15px; white-space: nowrap; }
  .mobile-v2 .dashboard-trend-card { margin-top: 6px; padding: 8px 9px 3px; border-radius: 10px; box-shadow: none; }
  .mobile-v2 .dashboard-trend-head strong { font-size: 14px; }
  .mobile-v2 .dashboard-trend-tabs button { min-height: 32px; padding: 5px 9px; font-size: 11px; }
  .mobile-v2 .dashboard-trend-total { margin-top: 3px; }
  .mobile-v2 .dashboard-trend-total strong { font-size: 19px; }
  .mobile-v2 .dashboard-trend-chart svg { height: 108px; }
  .mobile-v2.route-dashboard > .main .grid.two-col,
  .mobile-v2.route-dashboard .content > .grid.two-col { display: block; margin-top: 8px !important; }
  .mobile-v2.route-dashboard .grid.two-col > .card { padding: 9px; }
  .mobile-v2.route-dashboard .grid.two-col > .card + .card { display: none; }

  /* Customers: compact row; details as primary action, maintenance in overflow. */
  .mobile-v2 .customer-mobile-head { display: none; }
  .mobile-v2 .customer-list { display: grid; gap: 6px; }
  .mobile-v2 .customer-card {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-rows: auto auto;
    gap: 4px 8px;
    min-height: 84px;
    padding: 9px 10px;
    overflow: visible;
  }
  .mobile-v2 .customer-main { min-width: 0; }
  .mobile-v2 .customer-name { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 14px; font-weight: 750; }
  .mobile-v2 .customer-main .meta { display: flex; flex-wrap: wrap; gap: 2px 8px; margin-top: 3px; }
  .mobile-v2 .customer-stats { display: flex; grid-column: 1; gap: 4px 10px; min-width: 0; padding: 0; border: 0; overflow: hidden; }
  .mobile-v2 .customer-stats span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
  .mobile-v2 .customer-stats span:last-child { flex: 0 0 auto; }
  .mobile-v2 .customer-actions-desktop { display: none; }
  .mobile-v2 .customer-actions-mobile {
    display: flex;
    grid-column: 2;
    grid-row: 1/3;
    align-items: center;
    gap: 4px;
  }
  .mobile-v2 .mobile-row-primary {
    min-height: 36px;
    padding: 6px 8px;
    border: 1px solid #d7e1f4;
    border-radius: 8px;
    color: #3158cc;
    background: #f6f8ff;
    font-size: 11px;
    white-space: nowrap;
  }
  .mobile-v2 .mobile-row-more { position: relative; }
  .mobile-v2 .mobile-row-more > summary { min-width: 36px; min-height: 36px; }

  /* Create: dense single-row catalog with a compact stepper. */
  .mobile-v2.route-create .create-order-meta-card,
  .mobile-v2.route-returns .create-order-meta-card { min-height: 0; margin: 0 0 6px !important; padding: 0; overflow: hidden; }
  .mobile-v2 .create-order-summary { min-height: 48px; padding: 7px 10px; border-radius: 9px; }
  .mobile-v2 .create-order-summary strong { font-size: 14px; }
  .mobile-v2 .create-order-summary small { max-width: 70vw; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-v2 .create-order-meta-details:not(.is-open) { display: none; }
  .mobile-v2 .create-order-meta-details.is-open { padding: 8px; }
  .mobile-v2 .create-order-meta-grid { gap: 7px; }
  .mobile-v2 .mobile-product-filters { position: sticky; top: var(--m-header); z-index: 20; margin: 0 0 5px; padding: 0 0 5px; background: var(--m-canvas); box-shadow: none; }
  .mobile-v2 .mobile-product-filters .toolbar { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 5px; margin-bottom: 5px; }
  .mobile-v2 .mobile-product-filters .toolbar .input,
  .mobile-v2 .mobile-product-filters .toolbar .btn { min-height: 38px; height: 38px; }
  .mobile-v2 .mobile-product-filters .desktop-cart-trigger { display: none; }
  .mobile-v2 .category-tabs,
  .mobile-v2 .subcategory-tabs { gap: 5px; margin: 0; padding-bottom: 2px; overflow-x: auto; scrollbar-width: none; }
  .mobile-v2 .category-tabs button,
  .mobile-v2 .subcategory-tabs button { min-height: 34px; padding: 5px 11px; font-size: 12px; white-space: nowrap; }
  .mobile-v2 .subcategory-panel { margin-top: 4px; }
  .mobile-v2 .product-count-hint { margin: 5px 2px; font-size: 11px; }
  .mobile-v2.route-create .product-grid,
  .mobile-v2.route-returns .product-grid { display: grid; grid-template-columns: 1fr; gap: 0; overflow: hidden; border: 1px solid var(--m-line); border-radius: var(--m-radius); background: #fff; }
  .mobile-v2.route-create .product-card,
  .mobile-v2.route-returns .product-card {
    display: grid;
    grid-template-columns: 44px minmax(0,1fr) auto;
    gap: 7px;
    min-height: 68px;
    padding: 7px;
    border: 0;
    border-bottom: 1px solid #e8edf5;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
  }
  .mobile-v2.route-create .product-card:last-child,
  .mobile-v2.route-returns .product-card:last-child { border-bottom: 0; }
  .mobile-v2.route-create .product-card .product-thumb-button.catalog,
  .mobile-v2.route-returns .product-card .product-thumb-button.catalog { width: 44px; height: 44px; }
  .mobile-v2.route-create .product-card > div:nth-child(2),
  .mobile-v2.route-returns .product-card > div:nth-child(2) { min-width: 0; }
  .mobile-v2.route-create .product-title,
  .mobile-v2.route-returns .product-title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 12.5px; line-height: 1.25; overflow-wrap: anywhere; }
  .mobile-v2.route-create .product-spec,
  .mobile-v2.route-returns .product-spec { font-size: 10px; line-height: 1.25; }
  .mobile-v2.route-create .price,
  .mobile-v2.route-returns .price { font-size: 15px; }
  .mobile-v2 .create-product-column .product-card-qty {
    display: grid;
    grid-template-columns: 27px 28px 27px;
    width: 84px;
    min-width: 84px;
    height: 30px;
    gap: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid #d9e1ee;
    border-radius: 8px;
    background: #fff;
    box-shadow: none;
  }
  .mobile-v2 .create-product-column .product-card-qty button,
  .mobile-v2 .create-product-column .product-card-qty .qty-input {
    width: 100%;
    min-width: 0;
    height: 28px;
    min-height: 28px;
    margin: 0;
    padding: 0;
    border: 0;
    border-right: 1px solid #e3e8f1;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    font-size: 12px;
    text-align: center;
  }
  .mobile-v2 .create-product-column .product-card-qty button:last-child { border-right: 0; }
  .mobile-v2 .create-product-column .product-add-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
    padding: 6px;
    border-radius: 8px;
    box-shadow: none;
  }

  /* Cart: near-full-height drawer, independent scrolling list and fixed checkout. */
  .mobile-v2 .mobile-cart-bar { right: 8px; bottom: calc(var(--m-nav) + env(safe-area-inset-bottom)); left: 8px; min-height: 50px; padding: 4px 5px; border-radius: 12px; }
  .mobile-v2 .mobile-cart-summary { min-height: 40px; }
  .mobile-v2 .mobile-cart-icon { width: 34px; height: 34px; flex-basis: 34px; }
  .mobile-v2 .mobile-cart-open { min-width: 106px; min-height: 40px; }
  .mobile-v2 .mobile-cart-layer { z-index: 1250; }
  .mobile-v2 .mobile-cart-sheet { height: 90dvh; max-height: 90dvh; grid-template-rows: 12px 48px minmax(0,1fr) auto; border-radius: 18px 18px 0 0; }
  .mobile-v2 .mobile-cart-sheet .mobile-sheet-head { min-height: 48px; padding: 4px 11px 8px; }
  .mobile-v2 .mobile-cart-sheet .mobile-sheet-head strong { font-size: 16px; }
  .mobile-v2 .mobile-cart-lines { min-height: 0; padding: 0 10px; overflow-y: auto; overscroll-behavior: contain; }
  .mobile-v2 .mobile-cart-lines .cart-line { display: grid; grid-template-columns: minmax(0,1fr) 36px; gap: 5px 7px; padding: 9px 0; border-bottom: 1px solid var(--m-line); }
  .mobile-v2 .mobile-cart-lines .cart-line-main { grid-column: 1; min-width: 0; }
  .mobile-v2 .mobile-cart-lines .cart-line-main strong { display: block; overflow-wrap: anywhere; font-size: 12px; line-height: 1.25; }
  .mobile-v2 .mobile-cart-lines .cart-line-delete { grid-column: 2; align-self: start; }
  .mobile-v2 .mobile-cart-lines .cart-line-delete .icon-btn { width: 34px; min-width: 34px; height: 34px; min-height: 34px; padding: 7px; }
  .mobile-v2 .mobile-cart-lines .cart-line-side { grid-column: 1/-1; display: grid; grid-template-columns: minmax(84px,.9fr) 94px minmax(62px,.55fr); gap: 6px; align-items: end; }
  .mobile-v2 .mobile-cart-lines .cart-price-field { display: grid; grid-template-columns: 1fr; gap: 2px; min-width: 0; font-size: 10px; }
  .mobile-v2 .mobile-cart-lines .cart-price-field > span { white-space: nowrap; }
  .mobile-v2 .mobile-cart-lines .cart-price-input { display: flex; align-items: center; gap: 2px; min-width: 0; }
  .mobile-v2 .mobile-cart-lines .cart-price-field input { width: 100%; min-width: 0; height: 32px; padding: 0 5px; font-size: 12px; }
  .mobile-v2 .mobile-cart-lines .cart-line-controls { display: grid; grid-template-columns: 30px 32px 30px; gap: 1px; padding: 1px; }
  .mobile-v2 .mobile-cart-lines .cart-line-controls button { width: 30px; min-width: 30px; height: 32px; min-height: 32px; padding: 0; }
  .mobile-v2 .mobile-cart-lines .cart-line-controls .qty-input { width: 32px; min-width: 32px; height: 32px; padding: 0 2px; font-size: 12px; }
  .mobile-v2 .mobile-cart-lines .cart-line-total { padding-bottom: 6px; overflow-wrap: anywhere; text-align: right; font-size: 12px; white-space: nowrap; }
  .mobile-v2 .mobile-cart-checkout { min-height: 62px; padding: 7px 10px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--m-line); background: #fff; }
  .mobile-v2 .mobile-cart-checkout .btn { min-height: 40px; }

  /* Orders: only search + filter trigger above compact cards. */
  .mobile-v2 .order-mobile-head { display: none; }
  .mobile-v2 .order-list { display: grid; gap: 6px; }
  .mobile-v2 .order-card-polished { overflow: visible; }
  .mobile-v2 .order-card-polished .order-card-body { padding: 9px 9px 7px; }
  .mobile-v2 .order-card-polished .order-card-head,
  .mobile-v2 .order-card-polished .order-card-meta-grid { display: none; }
  .mobile-v2 .order-mobile-heading {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    white-space: nowrap;
  }
  .mobile-v2 .order-mobile-heading h3 {
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: #16243a;
    font-size: clamp(11px,3.35vw,13px);
    line-height: 1.2;
    text-overflow: ellipsis;
  }
  .mobile-v2 .order-mobile-heading .badge { flex: 0 0 auto; padding: 2px 5px; font-size: 9px; }
  .mobile-v2 .order-mobile-summary {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 6px;
    align-items: center;
    margin-top: 6px;
  }
  .mobile-v2 .order-mobile-summary > div { display: flex; flex-wrap: wrap; gap: 3px 9px; min-width: 0; }
  .mobile-v2 .order-mobile-summary > div span { min-width: 0; font-size: 10.5px; }
  .mobile-v2 .order-mobile-summary > div b { margin-right: 4px; color: var(--m-muted); }
  .mobile-v2 .order-mobile-summary .order-amount,
  .mobile-v2 .order-mobile-summary .order-amount-button {
    justify-self: end;
    max-width: 132px;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    color: #2f5de0;
    font-size: clamp(15px,4.5vw,19px);
    line-height: 1.1;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-v2 .order-card-polished .order-card-address { min-height: 28px; margin-top: 5px; padding: 5px 7px; font-size: 10.5px; overflow-wrap: anywhere; }
  .mobile-v2 .order-card-polished .order-card-bottom { gap: 4px; }
  .mobile-v2 .order-card-polished .order-icon-toolbar {
    display: grid;
    grid-template-columns: repeat(4, 38px) minmax(38px,1fr);
    gap: 4px;
    min-height: 38px;
    margin-top: 3px;
    padding-top: 3px;
  }
  .mobile-v2 .order-card-polished .order-icon-toolbar > * { display: block; }
  .mobile-v2 .order-card-polished .order-icon-toolbar .order-tool-divider { display: none; }
  .mobile-v2 .order-card-polished .order-icon-toolbar .order-tool-button,
  .mobile-v2 .order-card-polished .order-icon-toolbar summary {
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 8px;
  }
  .mobile-v2 .order-card-polished .order-icon-toolbar .order-more-menu { justify-self: end; margin-left: 0; }

  /* Products: four independent regions and no overlapping controls. */
  .mobile-v2 .product-mobile-primary { grid-template-columns: minmax(0,1fr) auto auto auto; }
  .mobile-v2.route-products > .main .category-tabs,
  .mobile-v2.route-products .content > .category-tabs,
  .mobile-v2.route-products .content > .subcategory-panel { display: none; }
  .mobile-v2 .product-mobile-head,
  .mobile-v2 .product-table { display: none; }
  .mobile-v2 .product-list-summary { margin: 4px 1px 6px; font-size: 11px; }
  .mobile-v2 .product-mobile-list { display: grid; gap: 5px; }
  .mobile-v2 .product-mobile-item {
    display: grid;
    grid-template-columns: 42px minmax(0,1fr) 64px auto;
    gap: 6px;
    min-height: 64px;
    padding: 7px;
    align-items: center;
    overflow: visible;
  }
  .mobile-v2 .product-mobile-item .product-thumb-button.small { grid-column: 1; width: 42px; height: 42px; }
  .mobile-v2 .product-mobile-info { grid-column: 2; min-width: 0; }
  .mobile-v2 .product-mobile-info strong { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 12.5px; line-height: 1.2; overflow-wrap: anywhere; }
  .mobile-v2 .product-mobile-info span,
  .mobile-v2 .product-mobile-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9.5px; }
  .mobile-v2 .product-mobile-side { grid-column: 3; align-items: flex-end; min-width: 0; }
  .mobile-v2 .product-mobile-side > strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; color: #2858df; font-size: 14px; white-space: nowrap; }
  .mobile-v2 .product-mobile-side .badge { font-size: 9px; }
  .mobile-v2 .product-actions-desktop { display: none; }
  .mobile-v2 .product-actions-mobile { display: flex; grid-column: 4; align-items: center; gap: 3px; }
  .mobile-v2 .product-mobile-select { top: 1px; left: 1px; width: 20px; height: 20px; }

  /* Second batch: reuse the same compact vocabulary. */
  .mobile-v2.route-costs .cost-summary-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: 5px; }
  .mobile-v2.route-costs .cost-summary-item { grid-column: span 2; min-width: 0; padding: 8px 6px; }
  .mobile-v2.route-costs .cost-summary-item:nth-child(4),
  .mobile-v2.route-costs .cost-summary-item:nth-child(5) { grid-column: span 3; }
  .mobile-v2.route-costs .cost-summary-item span { font-size: 9.5px; }
  .mobile-v2.route-costs .cost-summary-item strong { display: block; margin-top: 4px; font-size: 14px; overflow-wrap: anywhere; }
  .mobile-v2 .cost-order-head { display: grid; gap: 7px; }
  .mobile-v2 .cost-card-metrics { width: 100%; grid-template-columns: repeat(3,minmax(0,1fr)); }
  .mobile-v2 .cost-order-meta { display: flex; flex-wrap: wrap; gap: 3px 8px; }
  .mobile-v2 .cost-compact-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mobile-v2 .cost-expand-btn { grid-column: 1/-1; width: 100%; }

  .mobile-v2 .ai-modal,
  .mobile-v2 .order-document-modal { width: 100%; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .mobile-v2 .ai-modal .modal-head,
  .mobile-v2 .order-document-modal .modal-head { min-height: var(--m-header); padding: 8px 10px; }
  .mobile-v2 .ai-modal .modal-body { padding: 7px 8px 72px; overflow-x: hidden; }
  .mobile-v2 .ai-modal.has-results .modal-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0;
    overflow: hidden;
  }
  .mobile-v2 .ai-master-detail { position: relative; display: grid; grid-template-columns: 1fr; grid-template-rows: minmax(0,1fr); flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
  .mobile-v2 .ai-result-master { display: flex; width: 100%; min-width: 0; min-height: 0; max-height: none; border: 0; }
  .mobile-v2 .ai-status-summary { flex-wrap: nowrap; gap: 4px; overflow-x: auto; }
  .mobile-v2 .ai-master-list {
    display: block;
    flex: 1;
    min-height: 0;
    padding: 8px 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
  .mobile-v2 .ai-nav-item { width: 100%; min-width: 0; min-height: 96px; margin-bottom: 8px; padding: 9px; }
  .mobile-v2 .ai-result-detail {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 8;
    width: min(90%, 430px);
    min-width: 0;
    min-height: 0;
    border: 0;
    visibility: hidden;
    overflow: hidden;
    background: #fff;
    box-shadow: -12px 0 28px rgba(15,23,42,.16);
    pointer-events: none;
    transform: translateX(100%);
    transition: transform 180ms ease, visibility 0s linear 180ms;
  }
  .mobile-v2 .ai-master-detail.mobile-editor-open .ai-result-detail {
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0);
    transition: transform 180ms ease;
  }
  .mobile-v2 .ai-detail-panel { height: 100%; min-height: 0; padding: 0; overflow: hidden; }
  .mobile-v2 .ai-detail-scroll { overflow-y: auto; overscroll-behavior: contain; }
  .mobile-v2 .ai-modal .modal-foot { position: relative; right: auto; bottom: auto; left: auto; z-index: auto; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.98); }

  .mobile-v2 .order-document-modal .modal-body { padding: 8px; background: var(--m-canvas); }
  .mobile-v2 .order-document-modal .document-toolbar,
  .mobile-v2 .order-document-modal .doc-preview { display: none; }
  .mobile-v2 .order-document-mobile-view { display: grid; gap: 7px; }
  .mobile-v2 .order-document-mobile-list { display: grid; overflow: hidden; border: 1px solid var(--m-line); border-radius: var(--m-radius); background: #fff; }
  .mobile-v2 .order-document-mobile-list article { display: grid; grid-template-columns: 25px minmax(0,1fr) auto; gap: 7px; padding: 8px; border-bottom: 1px solid var(--m-line); }

  .mobile-v2 .user-mobile-list { display: grid; gap: 6px; }
  .mobile-v2 .user-mobile-tools { grid-template-columns: minmax(0,1fr) auto; }
  .mobile-v2 .user-mobile-item {
    display: grid;
    grid-template-columns: minmax(0,1fr) auto;
    gap: 4px 8px;
    padding: 9px;
    border: 1px solid var(--m-line);
    border-radius: var(--m-radius);
    background: #fff;
  }
  .mobile-v2 .user-mobile-item > div:first-child,
  .mobile-v2 .user-mobile-item > div:nth-child(2) { display: grid; min-width: 0; gap: 2px; }
  .mobile-v2 .user-mobile-item > small { grid-column: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-v2 .user-actions-desktop { display: none; }
  .mobile-v2 .user-actions-mobile { display: flex; grid-column: 2; grid-row: 1/3; align-items: center; gap: 4px; }
  .mobile-v2 .desktop-audit-filter { display: none; }
  .mobile-v2 .audit-mobile-tools { grid-template-columns: minmax(0,1fr) auto auto; }
  .mobile-v2 .audit-table { display: none; }
  .mobile-v2 .audit-mobile-list { display: grid; gap: 6px; }
  .mobile-v2 .audit-mobile-item { display: grid; gap: 5px; padding: 9px; border: 1px solid var(--m-line); border-radius: var(--m-radius); background: #fff; }
  .mobile-v2 .audit-mobile-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .mobile-v2 .audit-mobile-head strong { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
  .mobile-v2 .audit-mobile-meta { display: flex; flex-wrap: wrap; gap: 3px 10px; color: var(--m-muted); font-size: 10px; }
  .mobile-v2 .audit-mobile-entity { display: flex; gap: 6px; min-width: 0; font-size: 11px; }
  .mobile-v2 .audit-mobile-entity span { min-width: 0; overflow-wrap: anywhere; color: var(--m-muted); }
  .mobile-v2 .audit-mobile-summary { padding: 6px 7px; border-radius: 7px; background: #f5f7fb; font-size: 11px; overflow-wrap: anywhere; }
  .mobile-v2 .audit-mobile-item code { color: var(--m-muted); font-size: 9px; overflow-wrap: anywhere; }
  .mobile-v2 .audit-filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
  .mobile-v2 .audit-filter-grid input[placeholder],
  .mobile-v2 .audit-filter-grid .btn { grid-column: 1/-1; }
  .mobile-v2 .audit-table { overflow-x: auto; border-radius: var(--m-radius); }

  .mobile-v2 .xiaocai-assistant.is-docked { inset: 0; width: 100%; height: 100dvh; z-index: 1400; }
  .mobile-v2 .xiaocai-panel { width: 100%; height: 100dvh; border-radius: 0; }
  .mobile-v2 .xiaocai-head { min-height: var(--m-header); padding: 6px 9px; }
  .mobile-v2 .xiaocai-messages { padding: 10px 9px; }
  .mobile-v2 .xiaocai-message { gap: 6px; margin-bottom: 10px; }
  .mobile-v2 .xiaocai-message-avatar { width: 28px; height: 28px; }
  .mobile-v2 .xiaocai-bubble { max-width: 88vw; padding: 9px 10px; font-size: 13px; }
  .mobile-v2 .xiaocai-compose { padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); }

  .mobile-v2 .pagination { flex-wrap: wrap; gap: 5px; margin-top: 7px; }
  .mobile-v2 .pagination span { width: 100%; font-size: 10px; }
  .mobile-v2 .modal-backdrop { z-index: 1200; }
  .mobile-v2 .modal-foot { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
}

@media (max-width: 390px) {
  .mobile-v2 .mobile-page-tools { grid-template-columns: minmax(0,1fr) 50px 52px; gap: 4px; }
  .mobile-v2 .product-mobile-primary { grid-template-columns: minmax(0,1fr) 50px 52px 40px; }
  .mobile-v2 .user-mobile-tools { grid-template-columns: minmax(0,1fr) 82px; }
  .mobile-v2 .mobile-page-tools .btn { padding-inline: 6px; }
  .mobile-v2 .customer-card { grid-template-columns: minmax(0,1fr) auto; padding: 8px; }
  .mobile-v2 .customer-stats span:nth-child(2) { display: none; }
  .mobile-v2 .mobile-row-primary { padding-inline: 6px; }
  .mobile-v2 .product-mobile-item { grid-template-columns: 38px minmax(0,1fr) 58px auto; gap: 5px; padding: 6px; }
  .mobile-v2 .product-mobile-item .product-thumb-button.small { width: 38px; height: 38px; }
  .mobile-v2 .mobile-cart-lines .cart-line-side { grid-template-columns: minmax(78px,.9fr) 94px minmax(54px,.55fr); gap: 4px; }
}
