/**
 * Hydra TCG — Mobile Design System (≤900px, body.use-new-ui).
 * Native app shell: warm bg, orange pills, large cards, bottom nav indicator.
 * Load before route sheets + hydra-mobile-polish-final.css. Tokens: hydra-orange-tokens.css
 */

@media (max-width: 900px) {
  /* ═══════════════════════════════════════
     SHELL & TYPOGRAPHY
     ═══════════════════════════════════════ */
  body.use-new-ui {
    --mo-radius: var(--hydra-mo-card-radius);
    --mo-radius-lg: var(--hydra-mo-card-radius);
    --mo-card-pad: var(--hydra-mo-card-pad);
    --mo-section-gap: var(--hydra-mo-card-gap);
    background: var(--hydra-gradient-soft) !important;
    color: var(--hydra-text);
  }

  body.use-new-ui .app.app-layout {
    background: var(--hydra-bg-warm-soft) !important;
  }

  body.use-new-ui .page-title-text,
  body.use-new-ui .page-title-text--mobile-shell {
    font-size: var(--hydra-mo-title) !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em !important;
    line-height: 1.15 !important;
    color: var(--hydra-text) !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  body.use-new-ui .topbar-route-subtitle {
    display: none !important;
  }

  body.use-new-ui header.topbar,
  body.use-new-ui .topbar {
    background: var(--hydra-surface) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 1px solid var(--hydra-border-soft) !important;
    box-shadow: 0 1px 0 rgba(249, 115, 22, 0.05), 0 6px 18px rgba(15, 23, 42, 0.04) !important;
  }

  body.use-new-ui .topbar-extras {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
  }

  body.use-new-ui .topbar-extras > *:not(.notification-wrap):not(.user-menu-wrap) {
    display: none !important;
  }

  body.use-new-ui .topbar-extras .user-menu-wrap {
    display: flex !important;
  }

  body.use-new-ui .notification-bell,
  body.use-new-ui .user-avatar-btn {
    min-width: var(--hydra-mo-touch) !important;
    min-height: var(--hydra-mo-touch) !important;
    width: var(--hydra-mo-touch) !important;
    height: var(--hydra-mo-touch) !important;
    border-radius: 14px !important;
    box-sizing: border-box !important;
  }

  body.use-new-ui .notification-bell {
    border: 1px solid var(--hydra-border-soft) !important;
    background: var(--hydra-bg-warm-soft) !important;
  }

  body.use-new-ui .notification-badge {
    background: var(--hydra-primary) !important;
    color: #fff !important;
  }

  body.use-new-ui .user-avatar-btn {
    border-radius: 999px !important;
    border: 2px solid var(--hydra-border) !important;
    background: var(--hydra-gradient) !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 800 !important;
    box-shadow: var(--hydra-shadow) !important;
  }

  body.use-new-ui .hydra-currency-unit {
    font-size: 0.58em;
    font-weight: 700;
    margin-left: 1px;
    opacity: 0.9;
    vertical-align: baseline;
  }

  body.use-new-ui #contentScroll.content-scroll,
  body.use-new-ui .content-scroll {
    padding-top: calc(var(--mobile-topbar-h, 52px) + 10px) !important;
    padding-bottom: var(--mobile-scroll-bottom-clearance, var(--hydra-mo-scroll-bottom-pad, var(--app-scroll-bottom-pad))) !important;
  }

  body.use-new-ui[data-owner-fab-route] #contentScroll.content-scroll,
  body.use-new-ui[data-owner-fab-route] .content-scroll {
    padding-bottom: var(--mobile-scroll-bottom-clearance-fab, var(--hydra-mo-scroll-bottom-pad-fab, var(--app-scroll-bottom-pad-fab))) !important;
  }

  /* ═══════════════════════════════════════
     PILLS (shared filter language)
     ═══════════════════════════════════════ */
  body.use-new-ui .mobile-dash-period-btn,
  body.use-new-ui .cashflow-period-btn,
  body.use-new-ui .orders-desk-chip,
  body.use-new-ui .inventory-tabs--mo-pills .btn,
  body.use-new-ui .inventory-tabs--mo .btn,
  body.use-new-ui .inventory-page #inventoryTabs.inventory-tabs--mo .btn,
  body.use-new-ui .storefront-inquiries-page .sf-inq-page button.sf-inq-filter-chip,
  body.use-new-ui.route-storefront-inquiries .storefront-inquiries-page button.sf-inq-filter-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--hydra-mo-pill-h);
    padding: 0 18px;
    border-radius: var(--hydra-mo-pill-radius);
    border: 1px solid var(--hydra-border);
    background: var(--hydra-surface);
    color: var(--hydra-text-secondary);
    font-size: 14px;
    font-weight: 650;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  }

  body.use-new-ui .mobile-dash-period-btn.is-active,
  body.use-new-ui .cashflow-period-btn.is-active,
  body.use-new-ui .cashflow-period-btn.active,
  body.use-new-ui .orders-desk-chip.is-active,
  body.use-new-ui .inventory-tabs--mo-pills .btn.primary,
  body.use-new-ui .inventory-tabs--mo .btn.primary,
  body.use-new-ui .inventory-page #inventoryTabs.inventory-tabs--mo .btn.primary,
  body.use-new-ui .storefront-inquiries-page .sf-inq-page button.sf-inq-filter-chip.is-active,
  body.use-new-ui.route-storefront-inquiries .storefront-inquiries-page button.sf-inq-filter-chip.is-active {
    background: var(--hydra-primary) !important;
    border-color: var(--hydra-primary) !important;
    color: #fff !important;
    box-shadow: 0 2px 10px rgba(249, 115, 22, 0.28);
  }

  body.use-new-ui .mobile-dash-month-chip,
  body.use-new-ui .cashflow-month-chip {
    flex: 0 0 auto;
    min-width: 44px;
    min-height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: var(--hydra-surface);
    color: var(--hydra-text-muted);
    font-size: 13px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
  }

  body.use-new-ui .mobile-dash-month-chip.is-active,
  body.use-new-ui .cashflow-month-chip.is-active {
    border-color: var(--hydra-primary);
    background: var(--hydra-accent-softer);
    color: var(--hydra-orange-700);
  }

  body.use-new-ui .mobile-dash-period-scroll,
  body.use-new-ui .cashflow-period-scroll,
  body.use-new-ui .orders-desk-chips,
  body.use-new-ui .inventory-tabs--mo-pills,
  body.use-new-ui .sf-inq-filter-chips--mobile {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0 6px;
  }

  body.use-new-ui .mobile-dash-period-scroll::-webkit-scrollbar,
  body.use-new-ui .cashflow-period-scroll::-webkit-scrollbar,
  body.use-new-ui .orders-desk-chips::-webkit-scrollbar,
  body.use-new-ui .inventory-tabs--mo-pills::-webkit-scrollbar,
  body.use-new-ui .sf-inq-filter-chips--mobile::-webkit-scrollbar {
    display: none;
  }

  /* ═══════════════════════════════════════
     CARDS (panels + list cards)
     ═══════════════════════════════════════ */
  body.use-new-ui .panel,
  body.use-new-ui .card:not(.btn):not(.mobile-owner-nav-item) {
    background: var(--hydra-surface) !important;
    border: 1px solid var(--hydra-border-soft) !important;
    border-radius: var(--hydra-mo-card-radius) !important;
    box-shadow: var(--hydra-shadow) !important;
  }

  body.use-new-ui .order-mobile-card,
  body.use-new-ui .inv-mo-card,
  body.use-new-ui .finance-expense-mo-card,
  body.use-new-ui .finance-mo-section,
  body.use-new-ui .cod-mobile-card,
  body.use-new-ui .customer-mo-card,
  body.use-new-ui .cust-src-mo-card {
    background: var(--hydra-surface) !important;
    border: 1px solid var(--hydra-border-soft) !important;
    border-radius: var(--hydra-mo-card-radius) !important;
    box-shadow: var(--hydra-shadow) !important;
    padding: var(--hydra-mo-card-pad) !important;
    margin-bottom: var(--hydra-mo-card-gap) !important;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  /* Yêu cầu khách — ultra-compact; full rules in inquiries-mobile.css */
  body.use-new-ui.route-storefront-inquiries .sf-inq-mobile-card {
    padding: 12px !important;
    margin-bottom: 0 !important;
    gap: 6px !important;
    border-radius: 18px !important;
  }

  body.use-new-ui .order-mobile-card {
    max-height: none !important;
    overflow: visible !important;
  }

  body.use-new-ui .orders-mobile-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  body.use-new-ui .order-mobile-card__amount,
  body.use-new-ui .finance-kpi-value,
  body.use-new-ui .inv-mo-kpi-card .card-value,
  body.use-new-ui .mobile-kpi-value {
    font-size: var(--hydra-mo-money) !important;
    font-weight: 800 !important;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    line-height: 1.1 !important;
    word-break: keep-all;
  }

  body.use-new-ui .mobile-kpi-label,
  body.use-new-ui .finance-kpi-label,
  body.use-new-ui .inv-mo-k {
    font-size: var(--hydra-mo-label) !important;
    font-weight: 700 !important;
    letter-spacing: 0.06em !important;
    text-transform: uppercase !important;
    color: var(--hydra-text-muted) !important;
    white-space: nowrap !important;
  }

  body.use-new-ui .inv-mo-section-title,
  body.use-new-ui .finance-panel-title,
  body.use-new-ui .mobile-dash-section-title {
    font-size: var(--hydra-mo-section) !important;
    font-weight: 800 !important;
    color: var(--hydra-text) !important;
    letter-spacing: -0.02em;
    margin: 0 0 12px !important;
  }

  /* KPI grids */
  body.use-new-ui .mobile-kpi-grid,
  body.use-new-ui .finance-kpi-row--4,
  body.use-new-ui .finance-kpi-row--bottom,
  body.use-new-ui .inv-mo-overview .inv-mo-kpi-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  /* KPI card shell — hydra-mobile-polish-final.css (.mobile-kpi-card) */

  body.use-new-ui .finance-kpi-card--hero-wide {
    grid-column: 1 / -1;
  }

  /* ═══════════════════════════════════════
     BOTTOM NAV + FAB
     ═══════════════════════════════════════ */
  /* Bottom nav skin — canonical rules in hydra-mobile-polish-final.css */

  body.use-new-ui .mobile-owner-nav-badge {
    background: var(--hydra-primary) !important;
    color: #fff !important;
  }

  body.use-new-ui #mobileOwnerFab {
    width: var(--hydra-mo-fab-size) !important;
    height: var(--hydra-mo-fab-size) !important;
    background: var(--hydra-gradient) !important;
    box-shadow: 0 8px 22px rgba(234, 88, 12, 0.28), 0 2px 8px rgba(15, 23, 42, 0.08) !important;
  }

  /* ═══════════════════════════════════════
     MODALS & SHEETS
     ═══════════════════════════════════════ */
  body.use-new-ui .modal-card,
  body.use-new-ui .mobile-owner-action-sheet__panel,
  body.use-new-ui .sf-inq-mobile-sheet__panel {
    border-radius: 26px 26px 0 0 !important;
    background: var(--hydra-surface) !important;
    backdrop-filter: none !important;
    border: 1px solid var(--hydra-border-soft) !important;
    max-width: 100vw;
    box-sizing: border-box;
  }

  body.use-new-ui .modal-head,
  body.use-new-ui .mobile-owner-action-sheet__head,
  body.use-new-ui .sf-inq-mobile-sheet__head {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--hydra-surface);
    border-bottom: 1px solid var(--hydra-border-soft);
  }

  body.use-new-ui .mobile-owner-action-sheet__list {
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  body.use-new-ui .input,
  body.use-new-ui .input-md,
  body.use-new-ui select.input,
  body.use-new-ui textarea.input {
    min-height: var(--hydra-mo-pill-h);
    font-size: var(--hydra-mo-body);
    border-radius: 14px;
  }

  body.use-new-ui .btn:not(.mobile-owner-nav-item):not(.notification-bell):not(.user-avatar-btn):not(.btn-xs) {
    min-height: var(--hydra-mo-pill-h);
    border-radius: 14px;
    font-size: var(--hydra-mo-body);
    font-weight: 650;
  }

  body.use-new-ui .btn.primary {
    background: var(--hydra-primary) !important;
    border-color: var(--hydra-primary) !important;
    color: #fff !important;
  }

  body.use-new-ui .mobile-owner-action-sheet__item--dash-primary {
    border: 1px solid var(--hydra-border-soft) !important;
    border-radius: 16px !important;
    background: var(--hydra-bg-warm-soft) !important;
    min-height: var(--hydra-mo-touch);
  }

  /* ═══════════════════════════════════════
     ROUTE: DASHBOARD
     ═══════════════════════════════════════ */
  body.use-new-ui.route-dashboard .mobile-dashboard,
  body.use-new-ui.route-dashboard .mobile-dashboard--native {
    gap: var(--hydra-mo-card-gap) !important;
  }

  body.use-new-ui.route-dashboard .mobile-kpi-card--compact.kpi-tone-revenue .mobile-kpi-value {
    color: #c2410c;
  }

  body.use-new-ui.route-dashboard .mobile-kpi-card--compact.kpi-tone-profit .mobile-kpi-value {
    color: #15803d;
  }

  body.use-new-ui.route-dashboard .mobile-kpi-card--compact.kpi-tone-orders .mobile-kpi-value {
    color: var(--hydra-text, #0f172a);
  }

  body.use-new-ui.route-dashboard .mobile-kpi-card--compact.kpi-tone-cod .mobile-kpi-value {
    color: #b45309;
  }

  body.use-new-ui.route-dashboard .mobile-month-summary .dashboard-overview-strip-item,
  body.use-new-ui.route-dashboard .mobile-crm-card .hydra-crm-kpi {
    background: var(--hydra-bg-warm-soft) !important;
    border: 1px solid var(--hydra-border-soft) !important;
    border-radius: 16px !important;
  }

  /* ═══════════════════════════════════════
     ROUTE: ORDERS
     ═══════════════════════════════════════ */
  body.use-new-ui.route-orders .orders-page .orders-table-shell,
  body.use-new-ui.route-orders .orders-page .orders-summary-cards,
  body.use-new-ui.route-orders .orders-page .orders-bulk-bar-host {
    display: none !important;
  }

  body.use-new-ui.route-orders .orders-page #hydraOrdersMobileWrap {
    display: block !important;
  }

  body.use-new-ui.route-orders .order-mobile-card__id {
    font-weight: 800;
    color: var(--hydra-orange-700);
  }

  body.use-new-ui.route-orders .order-mobile-card__customer {
    font-weight: 700;
    font-size: var(--hydra-mo-card-title);
    color: var(--hydra-text);
  }

  body.use-new-ui.route-orders .orders-desk-chips-host {
    padding: 0;
    margin-bottom: 8px;
  }

  /* ═══════════════════════════════════════
     ROUTE: CASHFLOW / TIỀN
     ═══════════════════════════════════════ */
  body.use-new-ui.route-cashflow .cashflow-mobile-page .finance-kpi-card {
    border: 1px solid var(--hydra-border-soft);
    background: var(--hydra-surface);
    box-shadow: var(--hydra-shadow);
  }

  body.use-new-ui.route-cashflow .cashflow-period-bar,
  body.use-new-ui.route-cashflow #hydraCashflowPeriodFilter {
    padding: 0 0 10px;
    margin-bottom: 4px;
  }

  body.use-new-ui.route-cashflow .cashflow-mobile-page .finance-toolbar.cashflow-mo-toolbar {
    display: flex !important;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: var(--hydra-mo-card-gap);
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  body.use-new-ui.route-cashflow #hydraCashflowPeriodFilter,
  body.use-new-ui.route-cashflow .cashflow-period-bar {
    display: none !important;
  }

  body.use-new-ui.route-cashflow .cashflow-mo-empty {
    padding: var(--hydra-mo-card-pad);
    border-radius: var(--hydra-mo-card-radius);
    border: 1px solid var(--hydra-border-soft);
    background: var(--hydra-surface);
    box-shadow: var(--hydra-shadow);
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--hydra-text-muted);
    margin: 0 0 var(--hydra-mo-card-gap);
  }

  body.use-new-ui.route-cashflow .cashflow-tx-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  body.use-new-ui.route-cashflow .cashflow-mo-kpi-grid {
    margin-bottom: var(--hydra-mo-card-gap);
  }

  body.use-new-ui.route-cashflow .cashflow-mo-summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  body.use-new-ui.route-cashflow .cashflow-mo-summary-item {
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--hydra-bg-warm-soft);
    border: 1px solid var(--hydra-border-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  body.use-new-ui.route-cashflow .cashflow-mo-summary-item .mobile-kpi-value {
    font-size: 18px !important;
  }

  body.use-new-ui.route-cashflow .cashflow-month-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 2px 0;
  }

  body.use-new-ui.route-cashflow .cashflow-month-row::-webkit-scrollbar {
    display: none;
  }

  body.use-new-ui.route-cashflow .finance-expense-mo-amount {
    font-size: var(--hydra-mo-money);
    font-weight: 800;
    color: #b91c1c;
  }

  /* ═══════════════════════════════════════
     ROUTE: INVENTORY / KHO
     ═══════════════════════════════════════ */
  body.use-new-ui.route-inventory .inv-mo-product-name,
  body.use-new-ui.route-inventory .inv-mo-product-name--batch {
    font-size: var(--hydra-mo-card-title);
    font-weight: 800;
    color: var(--hydra-text);
    line-height: 1.3;
  }

  body.use-new-ui.route-inventory .inv-mo-pill-warn,
  body.use-new-ui.route-inventory .inv-mo-pill-bad,
  body.use-new-ui.route-inventory .inv-mo-prio {
    border-radius: var(--hydra-mo-pill-radius);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
  }

  body.use-new-ui.route-inventory .inventory-module--mo-owner {
    padding-bottom: max(28px, calc(env(safe-area-inset-bottom, 0px) + 88px));
  }

  body.use-new-ui.route-inventory .inv-mo-card-actions .btn {
    min-height: var(--hydra-mo-touch);
  }

  /* ═══════════════════════════════════════
     ROUTE: STOREFRONT INQUIRIES
     ═══════════════════════════════════════ */
  body.use-new-ui.route-storefront-inquiries .storefront-inquiries-page .sf-inq-table-wrap.sf-inq-table-desktop {
    display: none !important;
  }

  body.use-new-ui.route-storefront-inquiries .sf-inq-mobile-list {
    display: flex;
    flex-direction: column;
    gap: var(--hydra-mo-card-gap);
    padding: 0;
  }

  body.use-new-ui.route-storefront-inquiries .sf-inq-mobile-card__name {
    font-size: var(--hydra-mo-card-title);
    font-weight: 800;
  }

  body.use-new-ui.route-storefront-inquiries .sf-inq-mobile-card__amount {
    font-size: 16px !important;
    font-weight: 800 !important;
    color: var(--hydra-orange-700);
  }

  body.use-new-ui.route-storefront-inquiries .sf-inq-filter-chips--mobile {
    padding: 0 0 10px;
  }
}

/* iPhone 14 Pro Max — 430×932 */
@media (max-width: 430px) {
  body.use-new-ui {
    --hydra-mo-card-pad: 18px;
  }

  body.use-new-ui #mobileOwnerFab {
    right: 16px !important;
    bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 14px) !important;
  }
}
