/* Starkwood ONE mobile/tablet responsive layer.
   Desktop layout (1024px and wider) is intentionally untouched. */
.sw-mobile-menu-button,
.sw-mobile-sidebar-head,
.sw-mobile-nav-backdrop,
.sw-mobile-table-hint {
  display: none;
}

@media (max-width: 1023px) {
  :root {
    --sw-mobile-header-height: 64px;
    --sw-mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  html,
  body,
  #root {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    height: 100dvh !important;
    overflow: hidden !important;
  }

  body.sw-mobile-nav-open {
    overscroll-behavior: none;
    touch-action: none;
  }

  .sw-mobile-topbar {
    position: relative;
    z-index: 140;
    min-width: 0;
    padding-left: 10px !important;
    padding-right: 10px !important;
    gap: 8px;
    padding-top: env(safe-area-inset-top, 0px);
  }

  .sw-mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    color: #0b1739;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    -webkit-tap-highlight-color: transparent;
  }

  .sw-mobile-menu-button:active {
    transform: scale(.97);
    background: #f8fafc;
  }

  .sw-mobile-brand {
    min-width: 0;
    max-width: min(42vw, 230px);
    flex: 0 1 auto;
  }

  .sw-mobile-brand > div:last-child {
    min-width: 0;
  }

  .sw-mobile-actions {
    margin-left: auto;
    min-width: 0;
    gap: 6px !important;
  }

  .sw-mobile-profile-button {
    min-width: 0 !important;
    width: auto !important;
    max-width: 170px;
    padding: 6px 8px !important;
  }

  .sw-mobile-profile-menu {
    right: 12px !important;
    left: auto !important;
    width: min(320px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
  }

  .sw-mobile-content-row {
    min-width: 0;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
  }

  .sw-app-sidebar {
    position: fixed !important;
    z-index: 150 !important;
    top: var(--sw-mobile-header-height) !important;
    left: 0 !important;
    bottom: 0 !important;
    width: min(86vw, 320px) !important;
    max-width: 320px !important;
    height: auto !important;
    min-height: 0 !important;
    transform: translate3d(-104%, 0, 0);
    transition: transform .24s ease;
    box-shadow: 18px 0 45px rgba(2, 8, 23, .25);
    will-change: transform;
    padding-bottom: var(--sw-mobile-safe-bottom);
  }

  body.sw-mobile-nav-open .sw-app-sidebar {
    transform: translate3d(0, 0, 0);
  }

  .sw-mobile-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 0 0 auto;
    min-height: 52px;
    padding: 10px 12px 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .10);
    color: rgba(255, 255, 255, .78);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
  }

  .sw-mobile-sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 11px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 24px;
    line-height: 1;
  }

  .sw-sidebar-item {
    min-height: 46px !important;
    padding-top: 11px !important;
    padding-bottom: 11px !important;
  }

  .sw-mobile-nav-backdrop {
    display: block;
    position: fixed;
    z-index: 145;
    inset: var(--sw-mobile-header-height) 0 0 0;
    border: 0;
    padding: 0;
    background: rgba(2, 8, 23, .50);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
    backdrop-filter: blur(2px);
  }

  body.sw-mobile-nav-open .sw-mobile-nav-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .sw-mobile-main {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }

  .sw-mobile-main > .flex-1,
  .sw-mobile-main > .flex-1 > * {
    min-width: 0;
    max-width: 100%;
  }

  .sw-mobile-main .p-6 { padding: 1rem !important; }
  .sw-mobile-main .px-6 { padding-left: 1rem !important; padding-right: 1rem !important; }
  .sw-mobile-main .py-6 { padding-top: 1rem !important; padding-bottom: 1rem !important; }
  .sw-mobile-main .gap-6 { gap: 1rem !important; }
  .sw-mobile-main .gap-5 { gap: .875rem !important; }

  .sw-mobile-main .grid-cols-7,
  .sw-mobile-main .grid-cols-5,
  .sw-mobile-main .grid-cols-4,
  .sw-mobile-main .grid-cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .sw-mobile-overflow-flex {
    flex-wrap: wrap !important;
    align-items: stretch !important;
  }

  .sw-mobile-overflow-flex > input,
  .sw-mobile-overflow-flex > select,
  .sw-mobile-overflow-flex > .relative,
  .sw-mobile-overflow-flex > [class*="min-w-"] {
    min-width: min(100%, 220px) !important;
    flex: 1 1 220px !important;
  }

  .sw-mobile-main input,
  .sw-mobile-main select,
  .sw-mobile-main textarea,
  .sw-mobile-modal-card input,
  .sw-mobile-modal-card select,
  .sw-mobile-modal-card textarea {
    max-width: 100%;
  }

  .sw-mobile-main button,
  .sw-mobile-modal-card button {
    touch-action: manipulation;
  }

  .sw-mobile-table-shell {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: visible;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #94a3b8 #eef2f7;
  }

  .sw-mobile-table-shell::-webkit-scrollbar { height: 9px; }
  .sw-mobile-table-shell::-webkit-scrollbar-track { background: #eef2f7; border-radius: 999px; }
  .sw-mobile-table-shell::-webkit-scrollbar-thumb { background: #94a3b8; border: 2px solid #eef2f7; border-radius: 999px; }

  .sw-mobile-table-wide {
    min-width: 760px !important;
    width: max-content !important;
  }

  .sw-manage-access-table-scroll .sw-mobile-table-wide {
    min-width: 1180px !important;
  }

  .sw-mobile-table th,
  .sw-mobile-table td {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .sw-mobile-table-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    width: max-content;
    max-width: 100%;
    margin: 0 0 7px;
    padding: 5px 9px;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    background: #f8fafc;
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
  }

  .sw-floating-scrollbar {
    display: none !important;
  }

  .sw-mobile-modal-overlay {
    padding: 12px !important;
    align-items: center !important;
  }

  .sw-mobile-modal-card {
    width: min(680px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: calc(100dvh - 24px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  .sw-map-tools {
    align-items: stretch !important;
  }

  .sw-map-search-wrap,
  .sw-map-tools input,
  .sw-map-tools select,
  .sw-map-tools .sw-map-btn {
    min-width: 0 !important;
  }

  .sw-map-search-wrap {
    flex: 1 1 100% !important;
    width: 100% !important;
  }

  .sw-map-tools select,
  .sw-map-tools .sw-map-btn {
    flex: 1 1 150px;
  }

  .sw-map-editbar .push {
    display: none !important;
  }

  .sw-map-modal {
    padding: 12px !important;
  }

  .sw-map-modal-card {
    width: min(480px, 100%) !important;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
  }

  .sw-mobile-main .recharts-responsive-container,
  .sw-mobile-main .recharts-wrapper {
    max-width: 100% !important;
  }

  .sw-mobile-main footer,
  .sw-mobile-main [data-sw-app-footer] {
    flex-wrap: wrap;
    gap: 6px 12px;
    text-align: center;
    justify-content: center;
  }
}

@media (max-width: 767px) {
  :root { --sw-mobile-header-height: 60px; }

  .sw-mobile-topbar {
    min-height: 60px !important;
    height: 60px !important;
  }

  .sw-mobile-menu-button {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
  }

  .sw-mobile-brand {
    max-width: 43vw;
  }

  .sw-mobile-brand > div:last-child > div:first-child {
    font-size: 12px !important;
  }

  .sw-mobile-brand > div:last-child > div:last-child {
    display: none;
  }

  .sw-mobile-profile-button {
    max-width: 46px;
    width: 42px !important;
    min-height: 42px;
    justify-content: center;
    padding: 4px !important;
    border-radius: 12px !important;
  }

  .sw-mobile-profile-button > div:not(:first-child),
  .sw-mobile-profile-button > svg {
    display: none !important;
  }

  .sw-mobile-main .p-5,
  .sw-mobile-main .p-6 { padding: .875rem !important; }
  .sw-mobile-main .px-5,
  .sw-mobile-main .px-6 { padding-left: .875rem !important; padding-right: .875rem !important; }

  .sw-mobile-main .grid-cols-7,
  .sw-mobile-main .grid-cols-5,
  .sw-mobile-main .grid-cols-4,
  .sw-mobile-main .grid-cols-3,
  .sw-mobile-main .grid-cols-2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .sw-mobile-main h1 { font-size: 1.35rem !important; line-height: 1.3 !important; }
  .sw-mobile-main h2 { line-height: 1.35 !important; }

  .sw-mobile-main input,
  .sw-mobile-main select,
  .sw-mobile-main textarea,
  .sw-mobile-modal-card input,
  .sw-mobile-modal-card select,
  .sw-mobile-modal-card textarea {
    font-size: 16px !important;
  }

  .sw-mobile-main button:not(.sw-mobile-compact-button),
  .sw-mobile-modal-card button:not(.sw-mobile-compact-button) {
    min-height: 42px;
  }

  .sw-mobile-table-wide {
    min-width: 700px !important;
  }

  .sw-mobile-modal-overlay {
    padding: 0 !important;
    align-items: stretch !important;
  }

  .sw-mobile-modal-card {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
    overflow-y: auto !important;
  }

  .sw-map-modal {
    align-items: flex-end !important;
    padding: 0 !important;
  }

  .sw-map-modal-card {
    width: 100% !important;
    max-height: 88dvh !important;
    border-radius: 18px 18px 0 0 !important;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .sw-map-detail-grid {
    grid-template-columns: 1fr !important;
  }

  .sw-map-detail.wide {
    grid-column: auto !important;
  }

  .sw-map-tools select,
  .sw-map-tools .sw-map-btn {
    flex-basis: calc(50% - 4px);
  }
}

@media (max-width: 390px) {
  .sw-mobile-brand {
    max-width: 40vw;
  }

  .sw-mobile-brand > div:first-child {
    width: 32px !important;
    height: 32px !important;
  }

  .sw-mobile-topbar {
    padding-left: 7px !important;
    padding-right: 7px !important;
    gap: 5px;
  }

  .sw-mobile-actions { gap: 3px !important; }
}

@media (prefers-reduced-motion: reduce) {
  .sw-app-sidebar,
  .sw-mobile-nav-backdrop,
  .sw-mobile-menu-button {
    transition: none !important;
  }
}

/* v2.1.20 mobile/tablet density and login refinements. */
@media (max-width: 1023px) {
  html.sw-login-page-active,
  body.sw-login-page,
  body.sw-login-page #root {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body.sw-login-page {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: auto;
  }

  .sw-login-main {
    min-height: calc(100dvh - 76px);
    padding: 20px 16px !important;
  }

  .sw-login-card {
    width: min(100%, 860px) !important;
    border-radius: 22px !important;
  }

  .sw-login-promo,
  .sw-login-form-panel {
    min-width: 0;
  }

  .sw-login-form-panel {
    padding: 28px !important;
  }

  .sw-mobile-main .p-8 {
    padding: 1.25rem !important;
  }

  .sw-mobile-main .space-y-8 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1.25rem !important;
  }

  .sw-mobile-main .space-y-6 > :not([hidden]) ~ :not([hidden]) {
    margin-top: 1rem !important;
  }

  .sw-mobile-main .grid-cols-7 {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .sw-mobile-main .grid-cols-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .sw-mobile-main .grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  .sw-mobile-brand-copy {
    min-width: 0;
    overflow: hidden;
  }

  .sw-mobile-brand-copy > div:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sw-mobile-profile-button {
    overflow: hidden;
  }

  .sw-mobile-profile-details {
    min-width: 0;
  }

  .sw-dashboard-target-card {
    flex-wrap: wrap !important;
    gap: 12px !important;
    align-items: flex-start !important;
  }

  .sw-dashboard-target-card > .flex-1 {
    flex: 1 1 280px !important;
  }

  .sw-dashboard-target-card > :last-child {
    flex: 0 1 auto;
  }

  .sw-dashboard-major-grid,
  .sw-dashboard-history-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .sw-mobile-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .sw-mobile-batch-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }

  .sw-mobile-metric-card {
    padding: 14px !important;
    gap: 8px !important;
    min-height: 126px;
  }

  .sw-mobile-metric-card > div:first-child {
    width: 36px !important;
    height: 36px !important;
    border-radius: 10px !important;
  }

  .sw-mobile-metric-card > div:last-child > div:first-child {
    font-size: 1.25rem !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere;
  }

  .sw-mobile-metric-card > div:last-child > div:nth-child(2) {
    font-size: .78rem !important;
    line-height: 1.25 !important;
  }

  .sw-mobile-small-metric-card {
    padding: 12px !important;
    min-width: 0;
  }

  .sw-mobile-small-metric-card > div:first-child {
    font-size: 1.1rem !important;
    line-height: 1.15 !important;
  }

  .sw-mobile-small-metric-card > div:nth-child(2) {
    line-height: 1.25 !important;
  }

  .sw-mobile-batch-card {
    padding: 10px !important;
    min-width: 0;
  }

  .sw-mobile-batch-card > div:nth-child(2) {
    font-size: 1rem !important;
  }

  .sw-dashboard-construction-card {
    padding: 16px !important;
  }

  .sw-dashboard-summary-card {
    padding: 16px !important;
  }

  .sw-mobile-save-toast {
    font-size: 11px !important;
    line-height: 1 !important;
    padding: 9px 12px !important;
    right: 12px !important;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px)) !important;
    max-width: calc(100vw - 24px) !important;
    white-space: nowrap;
  }
}

@media (max-width: 899px) {
  .sw-login-grid {
    display: block !important;
  }

  .sw-login-promo {
    display: none !important;
  }

  .sw-login-card {
    max-width: 520px !important;
  }

  .sw-login-mobile-brand {
    display: flex !important;
  }
}

@media (min-width: 900px) and (max-width: 1023px) {
  .sw-login-card {
    max-width: 820px !important;
  }

  .sw-login-grid {
    grid-template-columns: .82fr 1.18fr !important;
  }

  .sw-login-promo {
    padding: 30px !important;
  }

  .sw-login-form-panel {
    padding: 30px !important;
  }
}

@media (max-width: 767px) {
  .sw-mobile-main .p-8,
  .sw-mobile-main .p-6,
  .sw-mobile-main .p-5 {
    padding: .75rem !important;
  }

  .sw-mobile-main .px-8,
  .sw-mobile-main .px-6,
  .sw-mobile-main .px-5 {
    padding-left: .75rem !important;
    padding-right: .75rem !important;
  }

  .sw-mobile-main .py-8,
  .sw-mobile-main .py-6,
  .sw-mobile-main .py-5 {
    padding-top: .75rem !important;
    padding-bottom: .75rem !important;
  }

  .sw-mobile-main .space-y-8 > :not([hidden]) ~ :not([hidden]),
  .sw-mobile-main .space-y-6 > :not([hidden]) ~ :not([hidden]) {
    margin-top: .875rem !important;
  }

  .sw-mobile-topbar {
    padding-left: 8px !important;
    padding-right: 8px !important;
    gap: 6px !important;
  }

  .sw-mobile-brand {
    max-width: calc(100vw - 112px) !important;
    flex: 1 1 auto !important;
  }

  .sw-mobile-brand-icon {
    width: 38px !important;
    height: 38px !important;
    flex: 0 0 38px !important;
    border-radius: 11px !important;
  }

  .sw-mobile-brand-copy > div:first-child {
    font-size: 12px !important;
    max-width: 100%;
  }

  .sw-mobile-brand-copy > div:last-child {
    display: none !important;
  }

  .sw-mobile-actions {
    flex: 0 0 auto;
    margin-left: 0 !important;
  }

  .sw-mobile-profile-button {
    width: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 3px !important;
    border-radius: 12px !important;
  }

  .sw-mobile-profile-details,
  .sw-mobile-profile-button > svg {
    display: none !important;
  }

  .sw-mobile-profile-avatar {
    margin: 0 !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
  }

  .sw-login-main {
    min-height: calc(100dvh - 64px);
    padding: 12px !important;
    align-items: flex-start !important;
  }

  .sw-login-card {
    max-width: 480px !important;
    border-radius: 18px !important;
    box-shadow: 0 14px 40px rgba(11, 23, 57, .12) !important;
  }

  .sw-login-form-panel {
    padding: 22px 18px !important;
  }

  .sw-login-mobile-brand {
    margin-bottom: 20px !important;
  }

  .sw-login-form-panel form {
    gap: 0 !important;
  }

  .sw-login-form-panel input {
    min-height: 48px;
  }

  .sw-login-form-panel button[type="submit"] {
    min-height: 48px !important;
    font-size: 1rem !important;
  }

  .sw-login-shell > footer {
    padding: 10px 14px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .sw-dashboard-target-card {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 14px !important;
  }

  .sw-dashboard-target-card > :last-child {
    width: 100%;
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
  }

  .sw-dashboard-target-card input {
    width: 100% !important;
    min-width: 0 !important;
  }

  .sw-mobile-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .sw-mobile-batch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .sw-mobile-metric-card {
    min-height: 116px;
    padding: 12px !important;
  }

  .sw-mobile-small-metric-card {
    padding: 10px !important;
  }

  .sw-dashboard-summary-card .text-3xl {
    font-size: 1.7rem !important;
  }

  .sw-dashboard-summary-card .gap-6 {
    gap: 1rem !important;
  }

  .sw-dashboard-construction-card > .grid-cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  .sw-page-dashboard h1 {
    font-size: 1.45rem !important;
  }

  .sw-page-dashboard h1 + p {
    font-size: .82rem !important;
    line-height: 1.45 !important;
  }

  .sw-page-root .rounded-2xl {
    border-radius: 16px !important;
  }

  .sw-page-root .gap-4 {
    gap: .75rem !important;
  }

  .sw-page-root .gap-3 {
    gap: .625rem !important;
  }
}

@media (max-width: 420px) {
  .sw-mobile-menu-button {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .sw-mobile-brand {
    max-width: calc(100vw - 104px) !important;
  }

  .sw-mobile-brand-copy > div:first-child {
    font-size: 11px !important;
  }

  .sw-mobile-metric-card > div:last-child > div:first-child {
    font-size: 1.1rem !important;
  }

  .sw-mobile-metric-card > div:last-child > div:nth-child(2) {
    font-size: .72rem !important;
  }

  .sw-mobile-small-metric-card > div:nth-child(2) {
    font-size: .68rem !important;
  }
}

/* v2.1.21 mobile navigation drawer scrolling fix. */
@media (max-width: 1023px) {
  /* Lock the page behind the drawer without disabling vertical gestures inside it. */
  body.sw-mobile-nav-open {
    touch-action: auto !important;
    overflow: hidden !important;
  }

  .sw-app-sidebar {
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .sw-app-sidebar > .sw-mobile-sidebar-head {
    position: relative;
    z-index: 2;
    flex: 0 0 auto !important;
  }

  /* React renders the actual menu inside this nav element. It must own the scroll. */
  .sw-app-sidebar > .sw-sidebar-scroll,
  .sw-app-sidebar > nav[aria-label="Main navigation"] {
    display: block !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.32) transparent;
    scrollbar-gutter: stable;
    scroll-padding-top: 12px;
    scroll-padding-bottom: 72px;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .sw-app-sidebar > .sw-sidebar-scroll::-webkit-scrollbar,
  .sw-app-sidebar > nav[aria-label="Main navigation"]::-webkit-scrollbar {
    width: 6px;
  }

  .sw-app-sidebar > .sw-sidebar-scroll::-webkit-scrollbar-track,
  .sw-app-sidebar > nav[aria-label="Main navigation"]::-webkit-scrollbar-track {
    background: transparent;
  }

  .sw-app-sidebar > .sw-sidebar-scroll::-webkit-scrollbar-thumb,
  .sw-app-sidebar > nav[aria-label="Main navigation"]::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.28);
    border-radius: 999px;
  }

  .sw-app-sidebar > .sw-sidebar-footer {
    flex: 0 0 auto !important;
    position: relative;
    z-index: 2;
  }

  /* Do not let the autosave badge cover the lower navigation choices. */
  body.sw-mobile-nav-open .sw-mobile-save-toast {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

@media (max-width: 767px) {
  .sw-app-sidebar {
    width: min(88vw, 330px) !important;
  }

  .sw-app-sidebar > .sw-sidebar-scroll,
  .sw-app-sidebar > nav[aria-label="Main navigation"] {
    padding-top: 12px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }
}

/* v2.1.22 definitive mobile navigation scrolling fix.
   The fixed sidebar itself owns the scroll so nested flex/overflow rules cannot trap it. */
@media (max-width: 1023px) {
  body.sw-mobile-nav-open {
    overflow: hidden !important;
    touch-action: auto !important;
  }

  .sw-app-sidebar {
    top: 0 !important;
    right: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    min-height: 0 !important;
    display: block !important;
    overflow-x: hidden !important;
    overflow-y: scroll !important;
    overscroll-behavior-y: contain !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.34) transparent;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
    contain: layout paint;
  }

  .sw-app-sidebar::-webkit-scrollbar {
    width: 6px;
  }

  .sw-app-sidebar::-webkit-scrollbar-track {
    background: transparent;
  }

  .sw-app-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.30);
    border-radius: 999px;
  }

  .sw-app-sidebar > .sw-mobile-sidebar-head {
    position: sticky !important;
    top: 0 !important;
    z-index: 10 !important;
    min-height: 58px !important;
    background: inherit !important;
    backdrop-filter: none !important;
  }

  /* Disable nested scrolling. The outer fixed aside is the single scroll owner. */
  .sw-app-sidebar > .sw-sidebar-scroll,
  .sw-app-sidebar > nav[aria-label="Main navigation"],
  .sw-app-sidebar .sw-mobile-sidebar-scroll {
    display: block !important;
    flex: none !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    overscroll-behavior: auto !important;
    -webkit-overflow-scrolling: auto !important;
    touch-action: inherit !important;
    padding-bottom: 24px !important;
  }

  .sw-app-sidebar > .sw-sidebar-footer {
    position: relative !important;
    z-index: 1 !important;
    margin-bottom: 8px !important;
  }

  .sw-mobile-nav-backdrop {
    inset: 0 !important;
  }

  body.sw-mobile-nav-open .sw-mobile-save-toast {
    display: none !important;
  }
}
