/* V205 — Mobile public-header safe area + dashboard side drawer
   Fixes two device-only layout issues reported after V203/V204:
   1) the public/home header overlapping the system status bar;
   2) the dashboard menu still collapsing into a clipped horizontal strip.
   This file is intentionally loaded after V203/V204 and only affects narrow viewports. */

@media (max-width: 1000px) {
  :root {
    --vnt-mobile-safe-top: env(safe-area-inset-top, 0px);
    --vnt-mobile-safe-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Public/home surface: keep all tappable header controls below system UI. */
  .public-site-header,
  .landing-header,
  .public-site-header.is-scrolled,
  .landing-header.is-scrolled {
    padding-top: var(--vnt-mobile-safe-top) !important;
  }

  /* Public menu follows the shifted header instead of opening under the status bar. */
  .public-nav-panel {
    top: calc(70px + var(--vnt-mobile-safe-top)) !important;
    max-height: calc(100dvh - 80px - var(--vnt-mobile-safe-top) - var(--vnt-mobile-safe-bottom)) !important;
  }

  .public-site-header.is-scrolled .public-nav-panel,
  .landing-header.is-scrolled .public-nav-panel {
    top: calc(58px + var(--vnt-mobile-safe-top)) !important;
    max-height: calc(100dvh - 68px - var(--vnt-mobile-safe-top) - var(--vnt-mobile-safe-bottom)) !important;
  }
}

@media (max-width: 980px) {
  /* Keep the fixed drawer from being clipped by the sticky dashboard header. */
  .ks-dashboard-header,
  .ks-dashboard-header.is-scrolled {
    overflow: visible !important;
  }

  /*
   * True side drawer. It remains mounted while closed and is hidden with
   * visibility/transform rather than display:none, so old display/flex rules
   * cannot collapse it back to a single horizontal row.
   */
  .ks-dashboard-nav {
    display: flex !important;
    position: fixed !important;
    top: calc(70px + var(--vnt-mobile-safe-top)) !important;
    right: 8px !important;
    left: auto !important;
    bottom: max(8px, var(--vnt-mobile-safe-bottom)) !important;
    width: min(86vw, 320px) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 12px !important;
    z-index: 240 !important;
    flex: 0 0 auto !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 5px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    background: #08243a !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    border-radius: 10px !important;
    box-shadow: -16px 22px 55px rgba(0,0,0,.36) !important;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(calc(100% + 20px));
    transition: transform .2s ease, opacity .2s ease, visibility 0s linear .2s;
  }

  html[dir="ltr"] .ks-dashboard-nav {
    right: auto !important;
    left: 8px !important;
    box-shadow: 16px 22px 55px rgba(0,0,0,.36) !important;
    transform: translateX(calc(-100% - 20px));
  }

  .ks-dashboard-nav.open {
    display: flex !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(0) !important;
    transition: transform .2s ease, opacity .2s ease, visibility 0s;
  }

  .ks-dashboard-header.is-scrolled .ks-dashboard-nav {
    top: calc(62px + var(--vnt-mobile-safe-top)) !important;
    bottom: max(8px, var(--vnt-mobile-safe-bottom)) !important;
    max-height: none !important;
  }

  .ks-dashboard-nav > a {
    display: flex !important;
    flex: 0 0 auto !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 46px !important;
    align-items: center !important;
    justify-content: space-between !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  .ks-dashboard-nav .ks-mobile-logout {
    margin-top: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ks-dashboard-nav {
    transition: none !important;
  }
}
