/**
 * Mobile UX V3 (<=768px) — desktop unchanged
 */

@media (max-width: 768px) {
  :root {
    --mob-bottom-nav-h: 74px;
    --mob-kpi-value-size: clamp(15px, 3.5vw, 18px);
  }

  /* Global mobile scale (~9%) — fit iPhone 390px without clipping money */
  .content-wrap {
    padding: 11px !important;
    box-sizing: border-box;
  }

  .page.active {
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box;
  }

  body.has-mobile-bottom-nav,
  body:has(#mobile-bottom-nav) {
    padding-bottom: calc(var(--mob-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  }

  body.has-mobile-bottom-nav .main,
  body:has(#mobile-bottom-nav) .main {
    padding-bottom: calc(var(--mob-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  }

  /* Topbar: Avatar · 🔔 (no hamburger — bottom nav) */
  .top-bar .mobile-menu-btn {
    display: none !important;
  }

  .top-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
  }

  .top-bar .profile-wrap {
    order: 1;
    position: relative;
    flex-shrink: 0;
  }

  .top-bar .notif-wrap {
    order: 2;
    margin-left: auto;
    flex-shrink: 0;
  }

  .profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    width: max-content;
    max-width: calc(100vw - 2rem);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    z-index: 200;
    padding: 12px;
  }

  .profile-dropdown-head {
    margin-bottom: 10px;
  }

  .profile-dropdown-head strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text);
  }

  .profile-dropdown-head small {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: capitalize;
  }

  .profile-logout-btn {
    width: 100%;
    min-height: 40px;
    border-radius: 10px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
  }

  .profile-logout-btn:active {
    background: #fee2e2;
  }

  #page-dashboard .dash-mob-alert-btn {
    display: none !important;
  }

  .profile-dropdown-tools {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }

  .profile-tool-btn {
    width: 100%;
    min-height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    padding: 0 12px;
  }

  .profile-tool-btn.hidden {
    display: none;
  }

  /* --- Dashboard mobile polish v2 --- */

  #page-dashboard #dash-quick-actions {
    display: none !important;
  }

  #page-dashboard.page.active {
    padding-left: 12px !important;
    padding-right: 12px !important;
    box-sizing: border-box;
  }

  #page-dashboard.page.active .dash-header {
    order: 1;
    margin-bottom: 8px;
  }

  #page-dashboard.page.active #dash-filter-bar {
    order: 2;
    overflow: visible;
    flex-wrap: wrap;
    max-width: 100%;
    padding-bottom: 0;
    margin-bottom: 10px !important;
  }

  #page-dashboard .dash-period-field {
    flex: 1 1 100%;
    width: 100%;
  }

  #page-dashboard .dash-period-select {
    width: 100%;
  }

  #page-dashboard .filter-custom {
    flex: 1 1 100%;
    width: 100%;
  }

  #page-dashboard .dash-status-strip {
    order: 3;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 10px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  #page-dashboard .dash-status-strip::-webkit-scrollbar {
    display: none;
  }

  #page-dashboard .dash-status-strip.hidden {
    display: none !important;
  }

  #page-dashboard .dash-status-chip {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: var(--text);
    white-space: nowrap;
  }

  #page-dashboard .dash-status-chip--warn {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
  }

  #page-dashboard.page.active #dash-hero-grid {
    order: 4;
    display: flex;
    flex-direction: column;
    margin-bottom: 10px !important;
    grid-template-columns: unset !important;
  }

  #page-dashboard .dash-hero-all {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
  }

  #page-dashboard .hero-card {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    position: relative;
    padding: 9px 10px !important;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
    overflow: visible;
    gap: 2px;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
  }

  #page-dashboard .hero-card .hero-icon {
    display: none !important;
  }

  #page-dashboard .hero-card .hero-body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    flex: 1;
    gap: 2px;
    min-width: 0;
    min-height: 0;
    padding-right: 28px;
    overflow: visible;
  }

  #page-dashboard .hero-card .hero-top {
    display: block;
    margin: 0;
    gap: 0;
  }

  #page-dashboard .hero-card .hero-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    line-height: 1.2;
    color: #64748b;
    text-transform: uppercase;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  #page-dashboard .hero-card .hero-value {
    min-width: 0;
    max-width: 100%;
  }

  #page-dashboard .hero-card .hero-value-money {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: nowrap;
    white-space: nowrap;
    max-width: 100%;
    min-width: 0;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    word-break: normal;
    overflow-wrap: normal;
    overflow: visible;
    text-overflow: unset;
  }

  #page-dashboard .hero-card .money-val-core {
    font-variant-numeric: tabular-nums;
    font-weight: inherit;
    font-size: inherit;
    line-height: inherit;
    letter-spacing: inherit;
  }

  #page-dashboard .hero-card .money-val-suffix {
    font-size: 0.85em;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
  }

  #page-dashboard .hero-card .trend-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    font-size: 8px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 999px;
    line-height: 1.2;
    opacity: 0.75;
  }

  #page-dashboard .hero-card .trend-up {
    background: #ecfdf5;
    color: #15803d;
  }

  #page-dashboard .hero-card .trend-down {
    background: #fef2f2;
    color: #b91c1c;
  }

  #page-dashboard .hero-card .hero-value,
  #page-dashboard .hero-card .hero-value-money,
  #page-dashboard .hero-card .money-val-core {
    font-size: var(--mob-kpi-value-size) !important;
    font-weight: 700 !important;
    line-height: 1.05 !important;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    overflow: visible;
    text-overflow: unset;
  }

  #page-dashboard .hero-card .money-val-suffix {
    font-size: 0.86em !important;
    font-weight: 700 !important;
    flex-shrink: 0;
  }

  #page-dashboard .hero-card.hero-debt.hero-card--primary .hero-value,
  #page-dashboard .hero-card.hero-debt.hero-card--primary .hero-value-qty,
  #page-dashboard .hero-card.hero-debt .money-val-core {
    color: var(--danger);
  }

  #page-dashboard .hero-card--mini .hero-body {
    padding-right: 20px;
  }

  #page-dashboard .hero-card--mini .hero-sub,
  #page-dashboard .hero-card--primary .hero-sub,
  #page-dashboard .hero-card--secondary .hero-sub {
    display: none;
  }

  #page-dashboard .hero-value--stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    align-items: flex-start;
    line-height: 1.15;
  }

  #page-dashboard .hero-card--secondary .hero-value--stack .hero-value-qty {
    font-size: clamp(17px, 4vw, 20px) !important;
    font-weight: 800 !important;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1 !important;
    overflow: visible;
    max-width: 100%;
  }

  #page-dashboard .hero-value--stack .hero-value-turn {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    line-height: 1.15;
  }

  /* Mobile: no chart section on dashboard (donut, revenue, etc.) */
  #page-dashboard #dash-charts-wrap > .dash-section:first-of-type,
  #page-dashboard #dash-charts-wrap .dash-charts-grid {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: 0 !important;
    overflow: hidden;
  }

  #page-dashboard .hero-card--tappable {
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
  }

  #page-dashboard .hero-card--tappable:active {
    transform: scale(0.98);
  }

  #page-dashboard .dash-mob-actions {
    order: 5;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    margin-bottom: 9px;
  }

  #page-dashboard .dash-mob-actions.hidden {
    display: none !important;
  }

  #page-dashboard .dash-mob-action-btn {
    min-height: 42px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
  }

  #page-dashboard .dash-mob-action-btn--primary {
    border: none;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
  }

  #page-dashboard .dash-mob-action-btn--secondary {
    background: #fff;
    color: #0f172a;
    border: 1px solid #e5e7eb;
    box-shadow: none;
  }

  #page-dashboard.page.active #dash-cash-section,
  #page-dashboard.page.active #dash-purchase-import-section,
  #page-dashboard.page.active .dash-section,
  #page-dashboard.page.active #dash-analytics-loading,
  #page-dashboard.page.active #dash-charts-wrap {
    order: 6;
    width: 100%;
  }

  #page-dashboard #dash-cash-section.hidden,
  #page-dashboard.page.active #dash-cash-section.hidden,
  #page-dashboard #dash-purchase-import-section.hidden,
  #page-dashboard.page.active #dash-purchase-import-section.hidden,
  #page-dashboard #dash-analytics-loading.hidden,
  #page-dashboard.page.active #dash-analytics-loading.hidden,
  #page-dashboard #dash-charts-wrap.hidden,
  #page-dashboard.page.active #dash-charts-wrap.hidden {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: 0 !important;
    overflow: hidden;
    border: none !important;
  }

  #page-dashboard .mob-dash-hide {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: 0 !important;
    overflow: hidden;
  }

  #page-dashboard.page.active.dash-mob-compact-tail {
    padding-bottom: 4px;
  }

  #page-dashboard.page.active.dash-mob-compact-tail .dash-mob-actions {
    margin-bottom: 4px;
  }

  #page-dashboard #dash-analytics-loading {
    display: none !important;
  }

  #page-dashboard .dash-section {
    margin-top: 0;
    margin-bottom: 10px;
    padding-top: 0;
  }

  #page-dashboard #dash-charts-wrap .dash-section:last-child {
    margin-bottom: 8px;
  }

  /* Phân tích — Hàng tồn nhiều nhất (card list, no table) */
  #page-dashboard .analytics-panel--heavy .dash-heavy-table-wrap {
    display: none !important;
  }

  #page-dashboard .analytics-panel--heavy {
    overflow-x: hidden;
    max-width: 100%;
    padding: 12px 12px !important;
    border-radius: 21px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  }

  #page-dashboard .analytics-panel--heavy .analysis-card-header,
  #page-dashboard .analytics-panel--heavy .dash-heavy-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    min-width: 0;
  }

  #page-dashboard .analytics-panel--heavy .analysis-card-header h3,
  #page-dashboard .analytics-panel--heavy .dash-heavy-head h3 {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
  }

  #page-dashboard .analysis-view-all.dash-heavy-view-all:not(.hidden) {
    display: inline-flex !important;
    flex-shrink: 0;
    align-items: center;
    margin: 0;
    padding: 4px 0;
    border: none !important;
    outline: none;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--accent, #2563eb);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    -webkit-appearance: none;
    appearance: none;
  }

  #page-dashboard .analysis-list.dash-heavy-inv-cards {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
    box-sizing: border-box;
    border: none;
    border-radius: 0;
    background: transparent;
  }

  #page-dashboard .analysis-item.dash-heavy-item {
    display: grid;
    grid-template-columns: 44px 1fr auto;
    gap: 10px;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #ffffff;
  }

  #page-dashboard .analysis-badge.dash-heavy-badge {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1;
    color: var(--accent, #2563eb);
    background: rgba(37, 99, 235, 0.08);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
    box-sizing: border-box;
  }

  #page-dashboard .analysis-item-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }

  #page-dashboard .analysis-item-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #page-dashboard .analysis-item-meta {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #page-dashboard .analysis-stock {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
    gap: 1px;
    text-align: right;
    min-width: 0;
  }

  #page-dashboard .analysis-stock-qty {
    font-size: clamp(20px, 5vw, 24px);
    font-weight: 800;
    line-height: 1;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    white-space: nowrap;
  }

  #page-dashboard .analysis-stock-unit {
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    color: #94a3b8;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  #page-dashboard .dash-heavy-empty {
    margin: 0;
    padding: 14px 0;
    text-align: center;
    font-size: 0.8125rem;
    color: #64748b;
  }

  /* Period filter — scroll chips */
  /* Bottom navigation — NewGym / iOS tab bar */
  .mobile-bottom-nav {
    display: flex;
    align-items: stretch;
    gap: 0;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 120;
    box-sizing: border-box;
    min-height: var(--mob-bottom-nav-h, 82px);
    padding: 0 4px calc(8px + env(safe-area-inset-bottom, 0px));
    background: #ffffff;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  }

  .mobile-bottom-nav-item {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 0;
    min-height: 56px;
    margin: 0;
    padding: 10px 2px 6px;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #64748b;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.15;
    letter-spacing: -0.01em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    appearance: none;
    transition: color 0.18s ease;
  }

  .mobile-bottom-nav-item:focus {
    outline: none;
  }

  .mobile-bottom-nav-item:focus-visible {
    outline: 2px solid var(--accent, #2563eb);
    outline-offset: 2px;
    border-radius: 8px;
  }

  .mobile-bottom-nav-item .mob-nav-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    flex-shrink: 0;
  }

  .mobile-bottom-nav-item .mob-nav-svg {
    width: 24px;
    height: 24px;
    display: block;
    stroke: currentColor;
  }

  .mobile-bottom-nav-item .mob-nav-label {
    max-width: 100%;
    text-align: center;
    line-height: 1.15;
    white-space: normal;
    word-break: keep-all;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .mobile-bottom-nav-item.active {
    background: transparent;
    color: #2563eb;
    font-weight: 600;
    box-shadow: none;
  }

  .mobile-bottom-nav-item.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: 0 0 4px 4px;
    background: #2563eb;
  }

  .mobile-bottom-nav-item.active .mob-nav-svg {
    stroke: #2563eb;
  }

  .mobile-bottom-nav-item.active:focus-visible {
    outline-color: #2563eb;
    outline-offset: 2px;
  }

  .kpi-detail-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text);
  }

  .kpi-detail-body .kpi-detail-value {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 8px 0 12px;
    word-break: break-word;
  }

  /* --- Nhập hàng mobile (Phase 3) --- */
  #page-purchases .pur-list-meta {
    margin-bottom: 10px;
    overflow: visible;
    max-width: 100%;
  }

  #page-purchases .pur-type-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    max-width: 100%;
    margin: 0 0 10px;
  }

  #page-purchases .pur-stat-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 9px 11px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
    min-width: 0;
  }

  #page-purchases .pur-stat-card .pur-stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    line-height: 1.2;
  }

  #page-purchases .pur-stat-card .pur-stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
  }

  #page-purchases .pur-stat-card .pur-stat-sub {
    font-size: 11px;
    font-weight: 500;
    color: #64748b;
    line-height: 1.2;
  }

  #page-purchases .pur-stat-card--capital {
    grid-column: 1 / -1;
    gap: 6px;
  }

  #page-purchases .pur-stat-capital-stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
  }

  #page-purchases .pur-stat-capital-line {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
  }

  #page-purchases .pur-stat-capital-name {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    color: #64748b;
    flex-shrink: 0;
  }

  #page-purchases .pur-stat-capital-line .pur-stat-money {
    font-size: 0.9rem;
    font-weight: 700;
    color: #0f172a;
    text-align: right;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
  }

  #page-purchases .pur-stat-card.is-active,
  #page-purchases .pur-stat-capital-line.is-active {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
  }

  #page-purchases .pur-type-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin: 0 0 12px;
    padding: 0;
    overflow: visible;
    background: transparent;
    border: none;
    border-radius: 0;
  }

  #page-purchases .pur-tab {
    min-height: 36px;
    padding: 7px 5px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #64748b;
    font-size: 0.8125rem;
    font-weight: 600;
    box-shadow: none;
    text-align: center;
    white-space: nowrap;
  }

  #page-purchases .pur-tab:hover {
    background: #f8fafc;
    color: #0f172a;
  }

  #page-purchases .pur-tab.active {
    background: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
    color: #ffffff;
    box-shadow: none;
  }

  #page-purchases .pur-table-wrap {
    overflow: visible;
  }

  #page-purchases .purchase-table tbody {
    gap: 8px;
  }

  #page-purchases .pur-mob-card.pur-mob-card--compact.pur-mob-card--grid {
    border: 1px solid rgba(15, 23, 42, 0.06);
    border-radius: 16px;
    background: #ffffff;
    padding: 12px 13px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    display: grid;
    grid-template-columns: minmax(80px, 0.82fr) minmax(82px, 0.98fr) minmax(82px, 0.98fr) auto;
    align-items: center;
    column-gap: 6px;
    row-gap: 0;
    min-height: 88px;
    max-height: none !important;
    overflow: visible;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
  }

  #page-purchases .pur-mob-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    min-width: 0;
  }

  #page-purchases .pur-mob-col--price {
    border-left: 1px solid #f1f5f9;
    padding-left: 6px;
    min-width: 0;
    flex-shrink: 0;
    overflow: visible;
  }

  #page-purchases .pur-mob-col--lot {
    min-width: 0;
    overflow: hidden;
    padding-right: 0;
  }

  #page-purchases .pur-mob-col--remain.lot-remain {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-left: 2px;
    text-align: center;
    gap: 0;
  }

  #page-purchases .pur-lot-name {
    font-size: clamp(16px, 4vw, 18px);
    font-weight: 800;
    line-height: 1.1;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  #page-purchases .pur-lot-meta {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.15;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  #page-purchases .pur-price-label {
    font-size: 12px;
    font-weight: 500;
    line-height: 1.1;
    color: #64748b;
    white-space: nowrap;
  }

  #page-purchases .pur-price-value {
    font-size: clamp(13px, 3.2vw, 16px);
    font-weight: 700;
    line-height: 1.12;
    color: #0f172a;
    white-space: nowrap;
    overflow: visible;
    text-overflow: unset;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    max-width: none;
  }

  #page-purchases .lot-remain-label {
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    color: #64748b;
    margin: 0 0 4px;
    text-align: center;
    width: 100%;
    white-space: nowrap;
  }

  #page-purchases .lot-remain-row,
  #page-purchases .pur-mob-remain-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
  }

  #page-purchases .lot-remain-value {
    font-size: clamp(30px, 7vw, 32px);
    font-weight: 900;
    line-height: 1;
    color: var(--accent, #2563eb);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    white-space: nowrap;
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
  }

  #page-purchases .lot-remain-value--out {
    color: #64748b;
  }

  #page-purchases .lot-action-more.pur-mob-menu-btn,
  #page-purchases .pur-mob-menu-btn {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    min-width: 30px;
    max-height: 30px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #ffffff;
    color: #475569;
    font-size: 17px;
    font-weight: 700;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.15s, border-color 0.15s;
  }

  #page-purchases .pur-mob-menu-btn:active {
    background: #f8fafc;
  }

  #page-purchases .pur-mob-card--compact.pur-row--sold-out {
    opacity: 1;
  }

  #pur-actions-sheet .pur-sheet-actions {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    padding: 0;
  }

  #pur-actions-sheet .pur-sheet-action {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 52px;
    padding: 14px 4px;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    background: transparent;
    color: #0f172a;
    font-size: 1rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    box-sizing: border-box;
  }

  #pur-actions-sheet .pur-sheet-action:last-child {
    border-bottom: none;
  }

  #pur-actions-sheet .pur-sheet-action:active:not(:disabled) {
    background: #f8fafc;
  }

  #pur-actions-sheet .pur-sheet-action:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  #pur-actions-sheet .pur-sheet-action--danger {
    color: #b91c1c;
  }

  #pur-actions-sheet .pur-sheet-action[data-pur-action="sell"] {
    color: var(--accent, #2563eb);
  }

  .kpi-detail-body .kpi-detail-formula {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--muted);
  }

  /* --- Thanh toán mobile (Phase 4) --- */
  #page-payments .payment-page-header > div:first-child {
    order: 1;
  }

  #page-payments #payment-kpi-grid {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    min-height: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    gap: 0 !important;
  }

  #page-payments .payment-summary-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    padding: 10px 12px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
    min-width: 0;
  }

  #page-payments .payment-summary-card--debt {
    border-color: rgba(239, 68, 68, 0.2);
  }

  #page-payments .payment-summary-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
    line-height: 1.2;
  }

  #page-payments .payment-summary-value {
    font-size: clamp(15px, 3.5vw, 18px);
    font-weight: 700;
    color: #0f172a;
    line-height: 1.05;
    white-space: nowrap;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    width: 100%;
    min-width: 0;
    overflow: visible;
    text-overflow: unset;
  }

  #page-payments .payment-summary-value--debt {
    color: #dc2626;
  }

  #page-payments .payment-page-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    order: 2;
    width: 100%;
    margin: 0 0 12px;
  }

  #page-payments.payments-tab-returns .payment-page-actions,
  #page-payments.payments-tab-returns .payment-page-header > div:first-child {
    display: none !important;
  }

  #page-payments .debt-ledger-section {
    order: 3;
  }

  #page-payments .payment-action-btn {
    min-height: 42px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    box-shadow: none;
  }

  #page-payments .payment-action-btn--primary {
    background: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
    color: #ffffff;
  }

  #page-payments .payment-action-btn--secondary {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #0f172a;
  }

  #page-payments .debt-ledger-table-wrap {
    max-height: none;
    overflow: visible;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  #page-payments .debt-ledger-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
  }

  #page-payments .debt-mobile-card-row,
  #page-payments .debt-mobile-card-row td {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
  }

  #page-payments .debt-mobile-card-row td::before {
    display: none;
    content: none;
  }

  #page-payments .debt-mob-card {
    position: relative;
    padding: 14px;
    padding-right: 40px;
    border-radius: 16px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
    min-width: 0;
    overflow: visible;
  }

  #page-payments .debt-mob-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: #0f172a;
    word-break: break-word;
    padding-right: 0;
  }

  #page-payments .debt-mob-amount-row {
    display: flex;
    align-items: baseline;
    min-width: 0;
  }

  #page-payments .debt-mob-amount {
    font-size: 1.125rem;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    word-break: break-word;
    white-space: normal;
  }

  #page-payments .debt-mob-amount.debt-amount--debt {
    color: #dc2626;
  }

  #page-payments .debt-mob-amount.debt-amount--pay {
    color: #15803d;
  }

  #page-payments .debt-mob-meta {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.35;
    font-weight: 500;
    color: #64748b;
  }

  #page-payments .debt-mob-note {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #64748b;
    word-break: break-word;
  }

  #page-payments .payment-modal-dialog {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    padding: 16px;
    border-radius: 16px;
  }

  #page-payments .pay-form-grid {
    gap: 12px;
  }

  #page-payments .pay-form-grid label {
    margin: 0;
  }

  #page-payments .payment-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  #page-payments .payment-modal-actions .payment-modal-btn {
    width: 100%;
  }

  .payment-modal-dialog .pay-form-grid input,
  .payment-modal-dialog .pay-form-grid select {
    min-height: 46px;
    height: 46px;
  }

  #page-payments .debt-mob-actions {
    display: none !important;
  }

  #page-payments .debt-mob-menu-wrap {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
  }

  #page-payments .debt-mob-menu-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #page-payments .debt-mob-menu-btn:active {
    background: #e2e8f0;
  }

  #page-payments .debt-mob-menu-panel {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 128px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
    padding: 4px;
    z-index: 20;
  }

  #page-payments .debt-mob-menu-panel.hidden {
    display: none !important;
  }

  #page-payments .debt-mob-menu-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
  }

  #page-payments .debt-mob-menu-item:active {
    background: #f1f5f9;
  }

  #page-payments .debt-mob-menu-item--danger {
    color: #b91c1c;
  }

  /* --- Đối soát mobile (Phase 5) --- */
  #page-reconciliation .page-header p {
    display: none;
  }

  #page-reconciliation .hub-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    flex-wrap: unset;
    white-space: normal;
    border: none;
    padding: 0;
    margin-bottom: 12px;
  }

  #page-reconciliation .hub-tab {
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    flex-shrink: unset;
    box-shadow: none;
  }

  #page-reconciliation .hub-tab:hover {
    background: #f8fafc;
    color: #0f172a;
  }

  #page-reconciliation .hub-tab.active {
    background: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
    color: #ffffff;
  }

  #page-reconciliation .report-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    flex-wrap: unset;
    margin-bottom: 12px;
  }

  #page-reconciliation .report-tab {
    min-height: 40px;
    padding: 8px 6px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    box-shadow: none;
  }

  #page-reconciliation .report-tab.active {
    background: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
    color: #ffffff;
  }

  #page-reconciliation .recon-mob-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
  }

  #page-reconciliation .recon-summary-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
  }

  #page-reconciliation .recon-summary-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #64748b;
  }

  #page-reconciliation .recon-summary-value {
    font-size: 1.1rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.15;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
    width: 100%;
  }

  #page-reconciliation .recon-summary-value--debt {
    color: #dc2626;
  }

  #page-reconciliation .recon-balance-panel {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    margin-bottom: 10px;
    border: 1px solid rgba(15, 23, 42, 0.06);
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  }

  #page-reconciliation .recon-balance-ok {
    border-color: rgba(34, 197, 94, 0.25);
  }

  #page-reconciliation .recon-balance-warn {
    border-color: rgba(239, 68, 68, 0.25);
  }

  #page-reconciliation .recon-balance-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #0f172a;
  }

  #page-reconciliation .recon-balance-meta {
    font-size: 0.75rem;
    line-height: 1.35;
    color: #64748b;
    word-break: break-word;
  }

  #page-reconciliation .recon-warnings {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 10px;
  }

  #page-reconciliation .recon-warning {
    margin: 0;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.8125rem;
    line-height: 1.35;
    border: 1px solid #e5e7eb;
    background: #f8fafc;
    color: #0f172a;
  }

  #page-reconciliation .recon-warning--danger {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
  }

  #page-reconciliation .recon-warning--warning {
    background: #fffbeb;
    border-color: #fde68a;
    color: #a16207;
  }

  #page-reconciliation .recon-mob-btn {
    min-height: 42px;
    width: 100%;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid transparent;
    cursor: pointer;
  }

  #page-reconciliation .recon-mob-btn--primary {
    background: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
    color: #ffffff;
  }

  #page-reconciliation .recon-mob-btn--secondary {
    background: #ffffff;
    border-color: #e5e7eb;
    color: #0f172a;
  }

  #page-reconciliation #recon-go-inventory {
    margin-top: 0;
  }

  #page-reconciliation .recon-inv-table-wrap,
  #page-reconciliation .recon-ledger-table-wrap,
  #page-reconciliation .report-table-wrap {
    max-height: none;
    overflow: visible;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  #page-reconciliation .recon-inv-table thead,
  #page-reconciliation .recon-ledger-table thead,
  #page-reconciliation .report-table-wrap thead {
    display: none;
  }

  #page-reconciliation .recon-inv-table tbody,
  #page-reconciliation .recon-ledger-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow: visible;
  }

  #page-reconciliation .recon-mobile-card-row,
  #page-reconciliation .recon-mobile-card-row td,
  #page-reconciliation .recon-empty-row,
  #page-reconciliation .recon-empty-row td {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
  }

  #page-reconciliation .recon-mobile-card-row td::before,
  #page-reconciliation .recon-empty-row td::before {
    display: none;
    content: none;
  }

  #page-reconciliation .recon-mob-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 14px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    box-sizing: border-box;
    min-width: 0;
    overflow: visible;
  }

  #page-reconciliation .recon-mob-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: #0f172a;
    word-break: break-word;
  }

  #page-reconciliation .recon-mob-meta,
  #page-reconciliation .recon-mob-sub {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.35;
    font-weight: 500;
    color: #64748b;
    word-break: break-word;
  }

  #page-reconciliation .recon-mob-value-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
  }

  #page-reconciliation .recon-mob-value-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    flex-shrink: 0;
  }

  #page-reconciliation .recon-mob-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    text-align: right;
    word-break: break-word;
    font-variant-numeric: tabular-nums;
  }

  #page-reconciliation .recon-empty-state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 16px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    text-align: left;
  }

  #page-reconciliation .recon-empty-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
  }

  #page-reconciliation .recon-empty-hint {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #64748b;
  }

  #page-reconciliation .recon-empty-state .recon-mob-btn {
    margin-top: 4px;
    width: auto;
    min-width: 140px;
  }

  #page-reconciliation [data-recon-panel="inventory"] .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  #page-reconciliation [data-recon-panel="inventory"] .toolbar label {
    width: 100%;
  }

  #page-reconciliation [data-recon-panel="inventory"] .toolbar input,
  #page-reconciliation [data-recon-panel="inventory"] .toolbar select,
  #page-reconciliation [data-recon-panel="inventory"] .toolbar button {
    min-height: 46px;
    border-radius: 12px;
    width: 100%;
    box-sizing: border-box;
  }

  #page-reconciliation #report-filter-bar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #page-reconciliation #report-filter-bar label,
  #page-reconciliation #report-filter-bar button {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    box-sizing: border-box;
  }

  /* --- Phase 6: global polish + Cài đặt --- */
  .empty-icon {
    display: none !important;
  }

  .app-empty-state,
  .recon-empty-state,
  .empty-state-banner.app-empty-state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 16px;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
    text-align: left;
  }

  .app-empty-title,
  .recon-empty-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: #0f172a;
  }

  .app-empty-hint,
  .recon-empty-hint {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #64748b;
  }

  .filter-bar {
    overflow: visible !important;
    flex-wrap: wrap !important;
    gap: 8px;
  }

  .form-panel,
  .info-panel,
  #page-settings .settings-card,
  #page-settings .danger-zone {
    border-radius: 16px !important;
    border: 1px solid rgba(15, 23, 42, 0.06) !important;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05) !important;
    padding: 14px !important;
    max-width: 100% !important;
  }

  .panel-title {
    font-size: 11px !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    color: #64748b !important;
    margin-bottom: 10px !important;
  }

  .settings-note,
  .field-hint {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #64748b;
  }

  #page-settings .page-header p {
    display: none;
  }

  #page-settings .hub-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    overflow: visible !important;
    flex-wrap: unset !important;
    white-space: normal;
    border: none;
    padding: 0;
    margin-bottom: 12px;
  }

  #page-settings .hub-tab {
    min-height: 40px;
    padding: 7px 5px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    flex-shrink: unset;
    box-shadow: none;
  }

  #page-settings .hub-tab.active {
    background: var(--accent, #2563eb);
    border-color: var(--accent, #2563eb);
    color: #ffffff;
  }

  #page-settings .settings-field {
    width: 100%;
    margin-bottom: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
    gap: 6px;
  }

  #page-settings .settings-field input,
  #page-settings .settings-rates-grid input,
  #page-settings .settings-rates-grid select,
  #page-settings #import-file {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 46px;
    border-radius: 12px;
    box-sizing: border-box;
  }

  #page-settings .settings-rates-grid,
  #page-settings .form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px;
  }

  #page-settings .import-actions,
  #page-settings .backup-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  #page-settings .import-actions button,
  #page-settings .backup-actions button,
  #page-settings .settings-actions button,
  #page-settings .btn-row button {
    width: 100%;
    min-height: 46px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
  }

  #page-settings .settings-btn--primary,
  #page-settings #settings-save-btn,
  #page-settings #import-submit {
    background: var(--accent, #2563eb) !important;
    border-color: var(--accent, #2563eb) !important;
    color: #fff !important;
  }

  #page-settings .settings-btn--secondary,
  #page-settings button.secondary,
  #page-settings button.ghost {
    background: #fff !important;
    border: 1px solid #e5e7eb !important;
    color: #0f172a !important;
    box-shadow: none !important;
  }

  #page-settings .settings-btn--danger,
  #page-settings button.danger,
  #page-settings .danger-zone button {
    background: #ef4444 !important;
    border-color: #ef4444 !important;
    color: #fff !important;
  }

  #page-settings .table-wrap {
    overflow: visible;
    border: none;
    box-shadow: none;
  }

  /* Modals — global mobile */
  .modal-overlay.show {
    padding: 12px;
    align-items: flex-end;
  }

  .modal-overlay.show > .modal,
  .modal-overlay.show > .app-modal,
  .modal-overlay.show > .payment-modal-dialog,
  .modal-overlay.show > .modal-wide,
  .modal.app-modal,
  .payment-modal-dialog {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 24px) !important;
    border-radius: 16px !important;
    padding: 16px !important;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18) !important;
  }

  .app-modal .modal-header-row h3,
  .payment-modal-dialog h3,
  .modal.app-modal h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
  }

  .app-modal-desc {
    font-size: 0.8125rem;
    color: #64748b;
    line-height: 1.4;
    margin: 0 0 10px;
  }

  .app-modal form,
  .payment-modal-dialog form,
  .modal.app-modal form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .app-modal .form-grid,
  .pay-form-grid,
  .modal .form-grid {
    gap: 12px;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
  }

  .app-modal label,
  .payment-modal-dialog label,
  .modal.app-modal label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
  }

  .app-modal input,
  .app-modal select,
  .app-modal textarea,
  .payment-modal-dialog input,
  .payment-modal-dialog select,
  .modal.app-modal input,
  .modal.app-modal select,
  #reset-input,
  #restore-input {
    min-height: 46px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    padding: 0 12px;
    font-size: 0.9375rem;
    box-sizing: border-box;
    width: 100%;
  }

  .app-modal textarea {
    min-height: 80px;
    height: auto;
    padding: 10px 12px;
  }

  .app-modal input:focus,
  .app-modal select:focus,
  .payment-modal-dialog input:focus,
  .payment-modal-dialog select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  }

  .app-modal-actions,
  .payment-modal-actions,
  .modal-actions,
  .modal .btn-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: auto !important;
    padding-top: 12px !important;
    border-top: 1px solid #e5e7eb;
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 2;
  }

  .app-modal-actions button,
  .payment-modal-actions button,
  .modal-actions button,
  .modal .btn-row button {
    min-height: 46px;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 600;
    width: 100%;
  }

  .main .btn-row button,
  .toolbar button,
  .pur-filter-btn,
  .btn-add-purchase {
    min-height: 46px;
  }
}

@media (min-width: 769px) {
  .mobile-bottom-nav,
  .profile-wrap,
  .dash-status-strip,
  .dash-mob-actions,
  .profile-dropdown-tools {
    display: none !important;
  }

  body.has-mobile-bottom-nav {
    padding-bottom: 0;
  }
}
