/* Мобильная шапка и быстрые действия — единый интерфейс для всех страниц. */
.mobile_topbar { display: none; }

@media (max-width: 900px) {
  :root { --mobile-topbar-height: 56px; }

  body { overflow-x: hidden; }

  .mobile_topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 120;
    height: var(--mobile-topbar-height);
    display: grid;
    grid-template-columns: 1fr 1.45fr 1fr;
    align-items: stretch;
    background: #ffc93e;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
  }

  .mobile_topbar button,
  .mobile_topbar a {
    min-width: 0;
    border: 0;
    border-right: 1px solid rgba(0,0,0,.12);
    background: transparent;
    color: #1d1d1d;
    text-decoration: none;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile_topbar a:last-child { border-right: 0; }
  .mobile_topbar button:active,
  .mobile_topbar a:active { background: rgba(255,255,255,.35); }

  .mobile_topbar img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    flex: 0 0 24px;
  }

  .mobile_burger i {
    position: relative;
    width: 25px;
    height: 18px;
    flex: 0 0 25px;
    border-top: 2px solid #111;
    border-bottom: 2px solid #111;
    box-sizing: border-box;
  }
  .mobile_burger i::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: 6px;
    height: 2px;
    background: #111;
  }

  html.menu-open .mobile_burger i {
    border: 0;
    height: 24px;
  }
  html.menu-open .mobile_burger i::before,
  html.menu-open .mobile_burger i::after {
    content: "";
    position: absolute;
    left: 1px;
    top: 11px;
    width: 24px;
    height: 2px;
    background: #111;
    transform-origin: center;
  }
  html.menu-open .mobile_burger i::before { transform: rotate(45deg); }
  html.menu-open .mobile_burger i::after { transform: rotate(-45deg); }

  /* Основная часть шапки под фиксированной панелью. */
  .menu {
    position: static !important;
    transform: none !important;
    width: auto !important;
    margin: var(--mobile-topbar-height) 0 0 !important;
    padding: 11px 12px 10px !important;
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
    background: #fff;
    box-sizing: border-box;
  }

  .menu > .burger { display: none !important; }
  .menu_calc,
  .menu .phones { display: none !important; }

  .menu .header_logo {
    width: 100% !important;
    text-align: center;
    justify-self: center;
    line-height: 1.2;
  }
  .menu .header_logo a {
    display: block;
    color: #222;
    font-size: 20px;
    text-decoration: none;
  }

  /* Все быстрые кнопки исходной мобильной версии остаются доступны. */
  .menu .menu_options {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(7, minmax(38px, 1fr));
    align-items: center;
    gap: 4px !important;
    margin: 0;
    padding: 0;
  }
  .menu .menu_options > a,
  .menu .menu_options > div {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0 !important;
    padding: 7px 2px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    background: #f7f7f7;
  }
  .menu .menu_options > a:active,
  .menu .menu_options > div:active { background: #fff0bd; }
  .menu .menu_options img {
    width: 24px !important;
    height: 24px !important;
    margin: 0 !important;
    object-fit: contain;
  }
  .menu .menu_options span { display: none !important; }
  .menu .menu_options .count_cart {
    top: -5px !important;
    right: -2px !important;
    width: 18px !important;
    height: 18px !important;
    padding: 0 !important;
    font-size: 11px !important;
    line-height: 18px !important;
  }

  /* Полноэкранное меню начинается под панелью, телефон остаётся доступен. */
  .menu .header_links {
    position: fixed !important;
    top: var(--mobile-topbar-height) !important;
    left: 0 !important;
    width: 100% !important;
    height: calc(100vh - var(--mobile-topbar-height)) !important;
    height: calc(100dvh - var(--mobile-topbar-height)) !important;
    margin: 0 !important;
    padding: 18px 18px 40px !important;
    box-sizing: border-box;
    background: #ffc93e;
    z-index: 110 !important;
    display: flex !important;
    flex-direction: column;
    align-items: stretch !important;
    justify-content: flex-start !important;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    transform: translateX(-105%) !important;
    transition: transform .3s ease !important;
  }
  .menu .header_links.-active { transform: translateX(0) !important; }
  .menu .header_links .search {
    width: 100%;
    max-width: none !important;
    margin: 18px 0 0 !important;
  }

  html.menu-open,
  html.menu-open body { overflow: hidden; }
}

@media (max-width: 420px) {
  .mobile_topbar { grid-template-columns: .95fr 1.35fr .95fr; }
  .mobile_topbar button,
  .mobile_topbar a { gap: 5px; padding-inline: 5px; font-size: 11px; }
  .mobile_topbar img { width: 22px; height: 22px; flex-basis: 22px; }
  .mobile_burger i { width: 23px; flex-basis: 23px; }
  .menu { padding-inline: 8px !important; }
  .menu .menu_options { gap: 3px !important; }
  .menu .menu_options > a,
  .menu .menu_options > div { min-height: 42px; padding-inline: 1px; }
  .menu .menu_options img { width: 22px !important; height: 22px !important; }
}

@media (max-width: 340px) {
  .mobile_topbar span { display: none; }
  .mobile_topbar { grid-template-columns: repeat(3, 1fr); }
}
