.mobile-menu-toggle,
.mobile-nav-overlay {
  display: none;
}

@media (max-width: 760px) {

  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden !important;
  }

  body {
    padding-top: 82px !important;
  }

  .layout {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .main {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  /* ===== FIXED MOBILE HEADER ===== */

  .topbar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;

    height: 82px !important;
    min-height: 82px !important;

    padding:
      max(10px, env(safe-area-inset-top))
      14px
      10px !important;

    display: grid !important;
    grid-template-columns: 46px minmax(0, 1fr) 46px !important;
    align-items: center !important;
    gap: 10px !important;

    background: rgba(15, 19, 25, .98) !important;
    border-bottom: 1px solid rgba(255,255,255,.08) !important;

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    box-shadow: 0 8px 30px rgba(0,0,0,.18);

    z-index: 3000 !important;
  }

  /* ===== MENU BUTTON ===== */

  .mobile-menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;

    width: 46px;
    height: 46px;
    padding: 0;

    border: 1px solid #343a44;
    border-radius: 14px;

    background: #1b2028;
    color: #fff;

    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-menu-toggle .mobile-menu-lines,
  .mobile-menu-toggle .mobile-menu-lines::before,
  .mobile-menu-toggle .mobile-menu-lines::after {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 10px;
    background: currentColor;
  }

  .mobile-menu-toggle .mobile-menu-lines {
    position: relative;
  }

  .mobile-menu-toggle .mobile-menu-lines::before,
  .mobile-menu-toggle .mobile-menu-lines::after {
    content: "";
    position: absolute;
    left: 0;
    transition: transform .18s ease, top .18s ease;
  }

  .mobile-menu-toggle .mobile-menu-lines::before {
    top: -6px;
  }

  .mobile-menu-toggle .mobile-menu-lines::after {
    top: 6px;
  }

  body.mobile-nav-open .mobile-menu-lines {
    background: transparent;
  }

  body.mobile-nav-open .mobile-menu-lines::before {
    top: 0;
    transform: rotate(45deg);
  }

  body.mobile-nav-open .mobile-menu-lines::after {
    top: 0;
    transform: rotate(-45deg);
  }

  /* ===== BRAND ===== */

  .topbar > .brand {
    min-width: 0 !important;

    display: grid !important;
    grid-template-columns: 42px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 9px !important;
  }

  .topbar .brand-logo {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;

    object-fit: contain !important;
  }

  .topbar .brand-copy {
    min-width: 0 !important;
    overflow: hidden !important;
  }

  .topbar .brand-name {
    width: 100% !important;

    font-size: 13px !important;
    line-height: 1.12 !important;
    font-weight: 800 !important;

    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .topbar .brand-subtitle {
    display: none !important;
  }

  /* ===== RIGHT SIDE ===== */

  .top-actions {
    width: 46px !important;
    min-width: 46px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
  }

  .top-actions #btnNewProject,
  .top-actions #btnSaveProject,
  .top-actions .export-menu-wrap,
  .top-actions #btnPrint,
  .top-actions .current-user,
  .top-actions .server-sync-status {
    display: none !important;
  }

  .top-actions .reminder-bell {
    width: 46px !important;
    height: 46px !important;
    min-width: 46px !important;

    padding: 0 !important;
    margin: 0 !important;

    border-radius: 14px !important;
  }

  /* ===== SIDEBAR DRAWER ===== */

  .sidebar {
    display: block !important;

    position: fixed !important;
    top: 82px !important;
    left: 0 !important;
    bottom: 0 !important;

    width: min(86vw, 340px) !important;
    height: calc(100dvh - 82px) !important;

    padding: 14px 14px max(24px, env(safe-area-inset-bottom)) !important;

    overflow-y: auto !important;
    overscroll-behavior: contain;

    background: #12161c !important;
    border-right: 1px solid rgba(255,255,255,.10);

    box-shadow: 20px 0 55px rgba(0,0,0,.45);

    transform: translate3d(-105%,0,0);
    transition: transform .2s ease;

    z-index: 2900 !important;
  }

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

  .mobile-nav-overlay {
    display: block !important;

    position: fixed !important;
    top: 82px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;

    background: rgba(5,8,12,.60);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition: opacity .18s ease;

    z-index: 2800 !important;
  }

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

  body.mobile-nav-open {
    overflow: hidden !important;
  }

  .sidebar .nav-item,
  .sidebar .nav-group-toggle {
    min-height: 48px !important;
    border-radius: 12px !important;
  }
}

/* На ПК этот файл ничего не меняет */
@media (min-width: 761px) {
  .mobile-menu-toggle,
  .mobile-nav-overlay {
    display: none !important;
  }
}


/* ===== SAFARI STARTUP STABILITY ===== */
@media (max-width: 760px) {
  .topbar,
  .auth-gate {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }

  .auth-locked {
    -webkit-filter: none !important;
    filter: none !important;
  }
}
