.mobile-bottom-nav,
.mobile-more-backdrop,
.mobile-more-sheet {
  display: none;
}

/* MOBILE_LOCATION_STATUS_ROLLOUT: crm-mobile-location-status-1 */
@media (min-width: 761px) {
  html.crm-mobile-location-status-beta #tenantSwitcherWrap[data-mobile-single-tenant="true"] {
    display: none !important;
  }
}

@media (max-width: 760px) {
  html.crm-mobile-location-status-beta .company-start-guide {
    display: none !important;
  }

  html.crm-mobile-location-status-beta:not(.crm-mobile-location-right-beta) .app-topbar:has(#tenantSwitcherWrap:not([hidden])) .app-topbar__location {
    display: none;
  }

  html.crm-mobile-location-status-beta #tenantSwitcherWrap:not([hidden]) {
    position: relative;
    display: inline-flex;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    height: 44px;
    padding: 0;
    margin-left: 0;
    margin-right: auto;
    border: 1px solid #fff;
    border-radius: 999px;
    background: #f8fafc;
    box-shadow: 0 4px 16px rgba(31, 52, 78, 0.06);
  }

  html.crm-mobile-location-status-beta #tenantSwitcherLabel {
    display: none;
  }

  html.crm-mobile-location-status-beta #tenantSwitcherWrap::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    width: 12px;
    height: 12px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: #98a5b5;
    pointer-events: none;
  }

  html.crm-mobile-location-status-beta #tenantSwitcherWrap[data-subscription-state="active"]::before {
    background: #28b477;
  }

  html.crm-mobile-location-status-beta #tenantSwitcherWrap[data-subscription-state="inactive"]::before {
    background: #ff6168;
  }

  html.crm-mobile-location-status-beta #tenantSwitcherWrap::after {
    content: "";
    position: absolute;
    right: 16px;
    top: 17px;
    width: 8px;
    height: 8px;
    border-right: 2px solid #233247;
    border-bottom: 2px solid #233247;
    transform: rotate(45deg);
    pointer-events: none;
  }

  html.crm-mobile-location-status-beta #tenantSwitcherWrap:focus-within {
    outline: 2px solid #347ccd;
    outline-offset: 2px;
  }

  html.crm-mobile-location-status-beta #tenantSwitcherWrap #tenantSwitcher {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 44px;
    padding: 0 40px 0 38px;
    border: 0;
    border-radius: inherit;
    background: transparent;
    background-image: none !important;
    color: #172d49;
    font-size: 16px;
    font-weight: 600;
    text-overflow: ellipsis;
  }

  /* MOBILE_LOCATION_RIGHT_ROLLOUT: crm-mobile-location-right-1 */
  html.crm-mobile-location-right-beta .app-topbar {
    flex-wrap: nowrap;
  }

  html.crm-mobile-location-right-beta .app-topbar__location {
    flex: 0 1 auto;
    min-width: 0;
  }

  html.crm-mobile-location-right-beta .app-topbar__location strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html.crm-mobile-location-right-beta #tenantSwitcherWrap:not([hidden]) {
    max-width: 240px;
    margin-left: auto;
    margin-right: 0;
  }

  /* MOBILE_LOCATION_RIGHT_ALIGN_ROLLOUT: crm-mobile-location-right-align-1 */
  html.crm-mobile-location-right-align-beta:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__location {
    flex: 0 1 auto;
    min-width: 0;
    align-self: center;
  }

  html.crm-mobile-location-right-align-beta #tenantSwitcherWrap:not([hidden]) {
    flex: 1 1 0;
    min-width: 0;
    align-self: center;
  }

  html.crm-mobile-location-right-align-beta #tenantSwitcherWrap #tenantSwitcher {
    height: 44px;
    line-height: 44px;
    font-size: 17px;
    font-weight: var(--ui-weight-heavy, 850);
  }
}

@media (max-width: 380px) {
  html.crm-mobile-location-right-beta #tenantSwitcherWrap:not([hidden]) {
    max-width: 160px;
  }
}

@media (max-width: 760px) {
  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) body:is(.auth-locked, .subscription-locked) :is(.mobile-bottom-nav, .mobile-more-backdrop, .mobile-more-sheet) {
    display: none !important;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) body:not(.auth-locked):not(.subscription-locked) {
    min-width: 320px;
    display: block;
    overflow: hidden;
    background: #f4f7fa;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) body:not(.auth-locked):not(.subscription-locked) .app-sidebar {
    display: none;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) body:not(.auth-locked):not(.subscription-locked) .shell {
    width: 100%;
    height: 100dvh;
    grid-template-rows: calc(58px + env(safe-area-inset-top)) 48px auto minmax(0, 1fr);
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
    background: #f4f7fa;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar {
    min-height: calc(58px + env(safe-area-inset-top));
    padding:
      env(safe-area-inset-top)
      max(12px, env(safe-area-inset-right))
      0
      max(12px, env(safe-area-inset-left));
    gap: 8px;
    border-bottom-color: #e1e7ee;
    box-shadow: 0 2px 12px rgba(31, 52, 78, 0.05);
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__location {
    min-width: 0;
    max-width: none;
    flex: 1 1 auto;
    gap: 10px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__location::before {
    content: "NS";
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 9px;
    background: #1f5fb8;
    color: #fff;
    font-size: 12px;
    font-weight: var(--ui-weight-black, 900);
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__location strong {
    color: #21344b;
    font-size: 17px;
    font-weight: var(--ui-weight-heavy, 850);
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__search,
  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__user,
  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__action,
  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .topbar__spacer {
    display: none !important;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__tenant {
    min-width: 0;
    max-width: 142px;
    flex: 0 1 142px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__tenant > span {
    display: none;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__tenant select {
    width: 100%;
    height: 38px;
    padding: 0 28px 0 10px;
    border-radius: 9px;
    font-size: 12px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .workspace-view[data-view="welcome"] {
    grid-row: 2 / 5;
    min-height: 0;
    padding: 12px max(12px, env(safe-area-inset-right)) 18px max(12px, env(safe-area-inset-left));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: contain;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid > * {
    grid-column: 1 / -1;
    min-width: 0;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .workspace-panel {
    padding: 14px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(31, 52, 78, 0.06);
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-dashboard__hero h2 {
    margin-top: 5px;
    font-size: 22px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-dashboard__hero-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-dashboard__hero-actions .button {
    min-height: 44px;
    white-space: normal;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-dashboard-period {
    padding: 8px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-dashboard-period__quick {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-dashboard-period__quick::-webkit-scrollbar {
    display: none;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-dashboard-period__quick button {
    min-height: 38px;
    flex: 0 0 auto;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid > .manager-dashboard__kpi-group .manager-dashboard__kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid > .manager-dashboard__kpi-group .manager-kpi {
    min-height: 104px;
    padding: 12px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-kpi strong {
    font-size: 20px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-dashboard__panel-head {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid .manager-dashboard__panel-head .button {
    min-height: 40px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 55;
    min-height: calc(64px + env(safe-area-inset-bottom));
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    padding: 5px max(5px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(5px, env(safe-area-inset-left));
    border-top: 1px solid #dde5ed;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -8px 24px rgba(30, 50, 72, 0.08);
    backdrop-filter: blur(16px);
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-bottom-nav button {
    min-width: 0;
    min-height: 54px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 3px;
    padding: 3px 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #6e7e90;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-bottom-nav button.active {
    color: #1f64bd;
    background: #edf5ff;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-bottom-nav svg,
  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet svg {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-bottom-nav span {
    max-width: 100%;
    overflow: hidden;
    font-size: var(--ui-text-2xs, 10px);
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    border: 0;
    background: rgba(15, 27, 40, 0.42);
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 71;
    display: grid;
    gap: 12px;
    max-height: min(76dvh, 640px);
    padding: 12px max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-y: auto;
    border-radius: 18px 18px 0 0;
    background: #fff;
    box-shadow: 0 -18px 48px rgba(19, 34, 50, 0.22);
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet__handle {
    width: 42px;
    height: 4px;
    margin: 0 auto 2px;
    border-radius: 999px;
    background: #d6dee7;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet__head strong {
    color: #21344b;
    font-size: 18px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet__close {
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: #eef3f8;
    color: #42556a;
    font-size: 24px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet__links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet__links button {
    min-height: 54px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    border: 1px solid #e0e7ef;
    border-radius: 10px;
    background: #f8fafc;
    color: #33485e;
    font-size: 13px;
    font-weight: 750;
    text-align: left;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet__links button.active {
    border-color: #b8d3f2;
    background: #edf5ff;
    color: #1f64bd;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .mobile-more-sheet__logout {
    min-height: 48px;
    border: 1px solid #f0caca;
    border-radius: 10px;
    background: #fff6f6;
    color: #af3838;
    font-weight: 800;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) body:is(.post-login-booting, .admin-only) .mobile-bottom-nav {
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 380px) {
  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) #workspaceDashboardGrid > .manager-dashboard__kpi-group .manager-dashboard__kpis {
    grid-template-columns: 1fr;
  }

  html:is(.crm-mobile-shell-preview, .crm-mobile-shell-beta) .app-topbar__tenant {
    max-width: 116px;
    flex-basis: 116px;
  }
}

/* MOBILE_COMPACT_SHELL_ROLLOUT: crm-mobile-compact-shell-1 */
@media (max-width: 760px) {
  html.crm-mobile-compact-shell-beta #tenantSwitcherWrap:not([hidden]) {
    flex: 0 1 auto;
    min-width: 0;
    max-width: min(54vw, 220px);
    height: 44px;
    margin-left: auto;
    margin-right: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    box-shadow: none;
  }

  html.crm-mobile-compact-shell-beta #tenantSwitcherWrap::before {
    content: "";
    display: block;
    z-index: 1;
    left: 10px;
    width: 6px;
    height: 6px;
  }

  html.crm-mobile-compact-shell-beta #tenantSwitcherWrap::after {
    content: none;
    display: none;
  }

  html.crm-mobile-compact-shell-beta #tenantSwitcherWrap #tenantSwitcher {
    appearance: none;
    -webkit-appearance: none;
    min-width: 0;
    width: 100%;
    height: 34px;
    align-self: center;
    padding: 0 10px 0 24px;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    background: #f1f4f8;
    background-image: none !important;
    color: #43546b;
    font-size: 16px;
    font-weight: 600;
    line-height: normal;
    text-overflow: ellipsis;
  }

  html.crm-mobile-compact-shell-beta #tenantSwitcherWrap:focus-within {
    outline: 2px solid #347ccd;
    outline-offset: 1px;
  }
}

/* MOBILE_NAV_READABLE_ROLLOUT: crm-mobile-nav-readable-1 */
@media (max-width: 760px) {
  html.crm-mobile-nav-readable-beta #mobileBottomNav button svg {
    width: 24px;
    height: 24px;
  }
  html.crm-mobile-nav-readable-beta #mobileBottomNav button span {
    font-size: 12px;
  }
}
