.mobile-shell-only {
  display: none;
}

@media (max-width: 720px), (max-width: 940px) and (max-height: 520px) {
  body.has-mobile-shell:not(.is-auth-landing) {
    --mobile-header-h: 56px;
    --mobile-nav-content-h: 58px;
    --mobile-nav-h: calc(var(--mobile-nav-content-h) + env(safe-area-inset-bottom, 0px));
    min-width: 0;
    overflow: hidden;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-shell-only {
    display: flex;
  }

  body.has-mobile-shell:not(.is-auth-landing) .app-header {
    position: relative;
    z-index: 310;
    height: var(--mobile-header-h);
    min-height: var(--mobile-header-h);
    gap: 8px;
    padding: 8px 10px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .header-left {
    flex: 1 1 auto;
    gap: 8px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .header-right {
    flex: 0 0 auto;
    gap: 6px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .brand-logo {
    width: 78px;
    margin-right: 0;
  }

  body.has-mobile-shell:not(.is-auth-landing) #workspaceCrumb,
  body.has-mobile-shell:not(.is-auth-landing) #databaseCrumb,
  body.has-mobile-shell:not(.is-auth-landing) .header-sep,
  body.has-mobile-shell:not(.is-auth-landing) #connectButton,
  body.has-mobile-shell:not(.is-auth-landing) #headerLogs,
  body.has-mobile-shell:not(.is-auth-landing) #headerHelp,
  body.has-mobile-shell:not(.is-auth-landing) #headerDatabase,
  body.has-mobile-shell:not(.is-auth-landing) .env-chip {
    display: none;
  }

  body.has-mobile-shell:not(.is-auth-landing) #tableCrumb {
    min-width: 0;
    max-width: min(38vw, 152px);
    height: 40px;
    border-color: transparent;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 700;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-header-action,
  body.has-mobile-shell:not(.is-auth-landing) #headerProfile {
    width: 44px;
    min-width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-3);
    color: var(--muted);
    background: var(--control);
    padding: 0;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-header-action:hover,
  body.has-mobile-shell:not(.is-auth-landing) .mobile-header-action:focus-visible,
  body.has-mobile-shell:not(.is-auth-landing) #headerProfile:hover,
  body.has-mobile-shell:not(.is-auth-landing) #headerProfile:focus-visible {
    color: var(--text);
    border-color: var(--focus-ring);
    outline: 0;
  }

  body.has-mobile-shell:not(.is-auth-landing) .header-right .global-search-shell {
    display: none;
  }

  body.has-mobile-shell:not(.is-auth-landing).is-mobile-search-open .header-right .global-search-shell {
    position: fixed;
    inset: max(8px, env(safe-area-inset-top, 0px)) 8px auto;
    z-index: 520;
    width: auto;
    height: 48px;
    min-width: 0;
    display: flex;
    gap: 10px;
    border-radius: var(--radius-3);
    padding: 0 6px 0 12px;
    box-shadow: var(--shadow-popover);
  }

  body.has-mobile-shell:not(.is-auth-landing).is-mobile-search-open .global-search {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
    font-size: 16px;
  }

  body.has-mobile-shell:not(.is-auth-landing).is-mobile-search-open .global-search-shell kbd {
    display: none;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-search-close {
    width: 44px;
    min-width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--radius-2);
    color: var(--muted);
    background: transparent;
    padding: 0;
  }

  body.has-mobile-shell:not(.is-auth-landing) .global-search-panel {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - var(--mobile-nav-h) - 76px);
  }

  body.has-mobile-shell:not(.is-auth-landing) .global-search-result {
    min-height: 48px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .user-menu,
  body.has-mobile-shell:not(.is-auth-landing) .crumb-menu {
    position: fixed;
    top: calc(var(--mobile-header-h) + 6px);
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100dvh - var(--mobile-header-h) - var(--mobile-nav-h) - 20px);
    overflow-y: auto;
  }

  body.has-mobile-shell:not(.is-auth-landing) #app {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100dvh - var(--mobile-header-h) - var(--mobile-nav-h));
    min-height: 0;
  }

  body.has-mobile-shell:not(.is-auth-landing) .rail {
    display: none;
  }

  body.has-mobile-shell:not(.is-auth-landing) .workspace {
    width: 100%;
    min-width: 0;
    height: calc(100dvh - var(--mobile-header-h) - var(--mobile-nav-h));
  }

  body.has-mobile-shell:not(.is-auth-landing) .sidebar {
    position: fixed;
    inset: var(--mobile-header-h) auto var(--mobile-nav-h) 0;
    z-index: 450;
    width: min(88vw, 360px);
    height: auto;
    min-height: 0;
    display: flex;
    padding: 0 12px 16px;
    overflow-x: hidden;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    box-shadow: var(--shadow-panel);
    transform: translateX(-104%);
    visibility: hidden;
    pointer-events: none;
    transition: transform var(--transition-ui), visibility 0s linear var(--duration-fast);
  }

  body.has-mobile-shell:not(.is-auth-landing).is-mobile-navigation-open .sidebar {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
    transition: transform var(--transition-ui), visibility 0s;
  }

  body.has-mobile-shell:not(.is-auth-landing) .sidebar-resize-handle {
    display: none;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-header {
    position: sticky;
    top: 0;
    z-index: 2;
    min-height: 64px;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    padding: 10px 0;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-header h2 {
    margin: 0;
    color: var(--text);
    font-size: 16px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-close {
    width: 44px;
    min-width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-3);
    color: var(--muted);
    background: var(--control);
    padding: 0;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-menu {
    flex: 0 0 auto;
    flex-direction: column;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    padding: 10px 0 14px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-group-label {
    margin: 10px 8px 4px;
    color: var(--muted-2);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-item {
    width: 100%;
    min-height: 46px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    border: 1px solid transparent;
    border-radius: var(--radius-3);
    color: var(--muted);
    background: transparent;
    padding: 0 10px;
    text-align: left;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-item.active,
  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-item:hover,
  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-item:focus-visible {
    color: var(--text);
    border-color: var(--line);
    background: var(--control);
    outline: 0;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-item.active .ui-icon {
    color: var(--accent);
  }

  body.has-mobile-shell:not(.is-auth-landing) .side-header {
    flex: 0 0 auto;
    min-height: 58px;
    padding-top: 12px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .sidebar-content {
    min-height: 160px;
    flex: 0 0 auto;
    overflow: visible;
  }

  body.has-mobile-shell:not(.is-auth-landing) .surface-sidebar-list,
  body.has-mobile-shell:not(.is-auth-landing) .table-list {
    max-height: none;
    overflow: visible;
  }

  body.has-mobile-shell:not(.is-auth-landing) .surface-sidebar-item,
  body.has-mobile-shell:not(.is-auth-landing) .table-item,
  body.has-mobile-shell:not(.is-auth-landing) .sidebar-footer-btn {
    min-height: 44px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-backdrop {
    position: fixed;
    inset: var(--mobile-header-h) 0 var(--mobile-nav-h);
    z-index: 440;
    display: block;
    border: 0;
    background: var(--overlay-muted);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-ui), visibility 0s linear var(--duration-fast);
  }

  body.has-mobile-shell:not(.is-auth-landing).is-mobile-navigation-open .mobile-navigation-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity var(--transition-ui), visibility 0s;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-primary-navigation {
    position: fixed;
    inset: auto 0 0;
    z-index: 430;
    height: var(--mobile-nav-h);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: start;
    border-top: 1px solid var(--line);
    background: var(--header);
    padding: 3px max(4px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(4px, env(safe-area-inset-left, 0px));
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-primary-item {
    min-width: 0;
    min-height: 52px;
    display: grid;
    grid-template-rows: 26px 16px;
    place-items: center;
    gap: 1px;
    border: 0;
    border-radius: var(--radius-3);
    color: var(--muted-2);
    background: transparent;
    padding: 4px 2px 2px;
    font-size: 9px;
    font-weight: 700;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-primary-item .ui-icon {
    width: 21px;
    height: 21px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-primary-item.active,
  body.has-mobile-shell:not(.is-auth-landing) .mobile-primary-item:focus-visible {
    color: var(--text);
    background: var(--control);
    outline: 0;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-primary-item.active .ui-icon {
    color: var(--accent);
  }

  body.has-mobile-shell:not(.is-auth-landing) .ld-dashboard-mode-footer {
    left: 0;
    bottom: var(--mobile-nav-h);
  }

  body.has-mobile-shell:not(.is-auth-landing) .ld-dashboard-pet {
    bottom: calc(var(--dashboard-footer-h, 44px) + var(--mobile-nav-h) + 10px);
  }
}

@media (max-width: 380px) {
  body.has-mobile-shell:not(.is-auth-landing) .brand-logo {
    width: 70px;
  }

  body.has-mobile-shell:not(.is-auth-landing) #tableCrumb {
    max-width: 32vw;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-primary-item {
    font-size: 8px;
  }
}

@media (max-width: 940px) and (max-height: 520px) and (orientation: landscape) {
  body.has-mobile-shell:not(.is-auth-landing) {
    --mobile-nav-content-h: 54px;
  }

  body.has-mobile-shell:not(.is-auth-landing) .mobile-primary-item {
    min-height: 48px;
    grid-template-rows: 22px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.has-mobile-shell:not(.is-auth-landing) .sidebar,
  body.has-mobile-shell:not(.is-auth-landing) .mobile-navigation-backdrop {
    transition: none;
  }
}
