/* Mobile-only enhancement. Desktop styles and embedded module frames are untouched. */
.erp-mobile-bar,
.erp-mobile-shade { display: none; }

@media (max-width: 900px) {
  .layout.erp-mobile-shell {
    --erp-mobile-bar-height: calc(60px + env(safe-area-inset-top, 0px));
    padding-top: var(--erp-mobile-bar-height);
  }
  .erp-mobile-shell > .erp-mobile-bar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 100;
    height: var(--erp-mobile-bar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
    background: var(--primary-900);
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  .erp-mobile-bar strong { font-size: 16px; letter-spacing: .02em; }
  .erp-mobile-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid rgba(255,255,255,.3);
    border-radius: var(--radius-btn);
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
  }
  .erp-mobile-toggle:active { background: rgba(255,255,255,.12); }
  .erp-mobile-toggle:focus-visible,
  .erp-mobile-shell > .sidebar button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: -3px;
  }
  .erp-mobile-shell.erp-mobile-open > .erp-mobile-shade {
    display: block;
    position: fixed;
    inset: var(--erp-mobile-bar-height) 0 0;
    z-index: 90;
    background: rgba(15,23,42,.45);
  }
  .layout.erp-mobile-shell > .sidebar {
    display: none;
    position: fixed;
    top: var(--erp-mobile-bar-height);
    bottom: 0;
    left: 0;
    z-index: 100;
    width: min(360px, calc(100% - 32px));
    padding: 12px 12px max(16px, env(safe-area-inset-bottom, 0px));
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    transition: none;
  }
  .layout.erp-mobile-shell.erp-mobile-open > .sidebar { display: flex; }
  .erp-mobile-shell > .sidebar .brand,
  .erp-mobile-shell > .sidebar #toggleSidebarBtn { display: none; }
  .layout.erp-mobile-shell > .sidebar .side-btn {
    justify-content: flex-start;
    padding: 10px;
    min-height: 48px;
    font-size: 14px;
  }
  .layout.erp-mobile-shell > .sidebar .side-btn .text { display: inline; }
  .layout.erp-mobile-shell > .sidebar .side-btn .chevron { display: inline-flex; transform: none; }
  .layout.erp-mobile-shell > .sidebar .nav-group.erp-mobile-group-open .chevron { transform: rotate(180deg); }
  .layout.erp-mobile-shell > .sidebar .nav-group .submenu { display: none; }
  .layout.erp-mobile-shell > .sidebar .nav-group.erp-mobile-group-open .submenu {
    display: grid;
    gap: 8px;
    padding-left: 12px;
  }
  .erp-mobile-shell > .sidebar .submenu-btn {
    min-height: 44px;
    font-size: 14px;
    line-height: 1.5;
    white-space: normal;
  }
  .layout.erp-mobile-shell > .sidebar .sidebar-footer { grid-template-columns: 1fr 1fr; }
  .layout.erp-mobile-shell > .sidebar .sidebar-action-btn { justify-content: center; }
  .layout.erp-mobile-shell > .sidebar .workspace-mode { flex-direction: row; border-radius: var(--radius-btn); }
  .layout.erp-mobile-shell > .sidebar .workspace-mode__btn { min-height: 44px; width: auto; }

}

/* At <=720px the existing shell deliberately uses natural page scrolling. */
@media (min-width: 721px) and (max-width: 900px) {
  /* Reserve the bar's height without cutting off the existing list/workspace scroller. */
  .layout.erp-mobile-shell:is(.debt-detail-layout, .debt-current-layout, .sticky-list-layout) {
    height: 100dvh;
    min-height: 100dvh;
  }
  .layout.erp-mobile-shell:is(.debt-detail-layout, .debt-current-layout, .sticky-list-layout) > main > .content {
    height: calc(100vh - var(--erp-mobile-bar-height));
    height: calc(100dvh - var(--erp-mobile-bar-height));
  }
}

@media print {
  .erp-mobile-bar, .erp-mobile-shade { display: none !important; }
  .layout.erp-mobile-shell { padding-top: 0; }
}
