.bottom-nav {
  display: none;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 218px minmax(0, 1fr);
  }

  .content-grid.two,
  .pos-layout,
  .accounts-layout,
  .catalog-layout {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }
}

@media (max-width: 980px) {
  body.sidebar-open {
    overflow: hidden;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: auto;
    z-index: 45;
    width: min(310px, calc(100vw - 48px));
    height: 100vh;
    height: 100dvh;
    max-height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-104%);
    transition: transform .18s ease;
  }

  .sidebar nav {
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    border: 0;
    background: rgba(15, 23, 42, .45);
  }

  body.sidebar-open .sidebar-backdrop {
    display: block;
  }

  .mobile-menu-handle {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 38;
    display: grid;
    place-items: center;
    width: 34px;
    min-height: 40px;
    height: 40px;
    border: 1px solid rgba(203, 213, 225, .9);
    border-left: 0;
    border-radius: 0 10px 10px 0;
    background: rgba(255, 255, 255, .96);
    color: #0f172a;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .16);
    padding: 6px 5px 6px 6px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    touch-action: none;
    transform: translateY(var(--mobile-menu-handle-y, calc(100dvh - 58px)));
    user-select: none;
    will-change: transform;
  }

  .mobile-menu-handle::after {
    content: "";
    position: absolute;
    right: 2px;
    top: 12px;
    width: 3px;
    height: 16px;
    border-radius: 999px;
    background: #cbd5e1;
    pointer-events: none;
  }

  .nav-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
  }

  .main {
    padding: 14px 14px 24px;
  }

  .legacy-page-hero {
    min-height: 82px;
    padding: 14px;
    border-radius: 12px;
  }

  .legacy-page-hero-icon {
    width: 50px;
    height: 50px;
    flex-basis: 50px;
    border-radius: 12px;
  }

  .legacy-page-hero-icon .legacy-icon,
  .legacy-page-hero-icon img,
  .legacy-page-hero-icon svg {
    width: 28px;
    height: 28px;
  }

  .legacy-page-hero-text strong {
    font-size: 22px;
  }

  .legacy-page-hero-text em {
    font-size: 12px;
  }

  .user-chip {
    display: none;
  }

  .app-menu-button span {
    display: none;
  }

  .metrics-grid,
  .metrics-grid.small,
  .metrics-grid.accounts-metrics,
  .metrics-grid.crud-metrics,
  .quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .bottom-nav {
    position: fixed;
    right: 20px;
    bottom: 14px;
    z-index: 35;
    display: none;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(44px, 12vw, 110px);
    pointer-events: none;
  }

  .bottom-nav .nav-item {
    display: grid;
    place-items: center;
    min-width: 78px;
    border: 0;
    border-radius: 16px;
    background: rgba(255,255,255,.84);
    box-shadow: 0 8px 26px rgba(15, 23, 42, .12);
    color: #111827;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 10px;
    pointer-events: auto;
    font: inherit;
    font-size: 12px;
    font-weight: 750;
    cursor: pointer;
  }

  .bottom-nav .nav-item.active {
    color: #0d7bea;
  }

  .bottom-nav .bottom-nav-icon {
    display: block;
    margin-bottom: 2px;
    line-height: 1;
  }

  .bottom-nav img,
  .bottom-nav svg {
    width: 30px;
    height: 30px;
    object-fit: contain;
  }

  .app-menu-dialog {
    padding: 10px;
  }

  .app-menu-card {
    max-height: calc(100vh - 20px);
    padding: 14px;
  }

  .app-menu-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .main {
    padding: 8px 8px calc(74px + env(safe-area-inset-bottom, 0px));
  }

  .legacy-page-hero {
    min-height: 68px;
    margin-bottom: 10px;
    border-radius: 12px;
    padding: 12px 14px;
  }

  .legacy-page-hero-icon {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }

  .legacy-page-hero-icon .legacy-icon,
  .legacy-page-hero-icon img,
  .legacy-page-hero-icon svg {
    width: 28px;
    height: 28px;
  }

  .legacy-page-hero-text strong {
    font-size: 22px;
    line-height: 1.05;
  }

  .legacy-page-hero-text em {
    font-size: 12px;
    line-height: 1.25;
  }

  .panel,
  .form-section,
  .operation-toolbar,
  .page-toolbar,
  .filter-toolbar {
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .06);
  }

  input,
  select,
  textarea,
  button,
  .primary,
  .ghost,
  .table-link,
  .link-danger {
    max-width: 100%;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 13px;
  }

  .panel {
    padding: 11px;
  }

  .panel-head {
    flex-direction: column;
  }

  .metrics-grid,
  .metrics-grid.small,
  .metrics-grid.accounts-metrics,
  .metrics-grid.crud-metrics,
  .quick-actions,
  .money-grid,
  .order-action-grid,
  .two-actions {
    grid-template-columns: 1fr;
  }

  .inline-search,
  .order-filter {
    align-items: stretch;
    flex-direction: column;
  }

  .order-filter input,
  .order-filter select,
  .order-filter button,
  .order-filter .primary,
  .order-filter .ghost,
  .inline-search input,
  .inline-search select,
  .inline-search button,
  .inline-search .primary,
  .inline-search .ghost {
    width: 100%;
  }

  .table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .table-tools input {
    width: 100%;
  }

  .panel-head > *,
  .table-tools > *,
  .inline-search > *,
  .order-filter > * {
    min-width: 0;
  }

  .panel-head h2,
  .section-title {
    font-size: 16px;
    line-height: 1.25;
  }

  th,
  td {
    padding: 8px;
  }

  .row-actions {
    gap: 6px;
    white-space: normal;
  }

  .row-actions form,
  .row-actions button,
  .row-actions a {
    min-width: 0;
  }

  .row-actions .table-link,
  .row-actions .link-danger {
    min-height: 32px;
  }

  input,
  select,
  textarea,
  button,
  .primary,
  .ghost {
    max-width: 100%;
  }

  .table-count {
    white-space: normal;
  }

  .product-grid,
  .table-card-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .material-row {
    grid-template-columns: 1fr;
  }

  .legacy-home-head {
    align-items: stretch;
    flex-direction: column;
  }

  .legacy-primary-action {
    width: 100%;
  }

  .legacy-feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .app-menu-head {
    align-items: flex-start;
  }

  .app-menu-profile .legacy-home-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
  }

  .app-menu-primary {
    align-items: center;
    gap: 14px;
    padding: 14px;
  }

  .app-menu-primary .qr-icon {
    width: 66px;
    height: 66px;
    flex-basis: 66px;
  }

  .app-menu-primary .legacy-icon {
    width: 48px;
    height: 48px;
  }

  .app-menu-primary strong {
    font-size: 16px;
  }

  .app-menu-quick-actions {
    min-height: 74px;
    gap: 16px;
  }

  .app-menu-mini-action {
    width: 58px;
    height: 58px;
  }

  .app-menu-mini-action .legacy-icon {
    width: 40px;
    height: 40px;
  }

  .app-menu-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .app-menu-feature {
    min-height: 98px;
  }

  .legacy-feature {
    min-height: 98px;
  }

  .legacy-feature-icon {
    width: 56px;
    height: 56px;
  }

  .legacy-feature-icon .legacy-icon {
    width: 34px;
    height: 34px;
  }

  .bottom-nav {
    right: 10px;
    bottom: 10px;
    gap: clamp(20px, 7vw, 72px);
  }

  .bottom-nav .nav-item {
    min-width: 64px;
    padding: 5px 8px;
    border-radius: 14px;
    font-size: 12px;
  }
}

@media print {
  .sidebar,
  .sidebar-backdrop,
  .mobile-menu-handle,
  .bottom-nav,
  .pager,
  .row-actions,
  .quick-actions,
  .table-tools,
  form {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .panel {
    border: 0;
    box-shadow: none;
    page-break-inside: avoid;
  }

  .table-wrap {
    overflow: visible;
  }
}
