/**
 * APKassa cabinet — ноутбуки и планшеты.
 *
 * Почему меню обрезалось: .sidebar был position:sticky + height:100vh
 * внутри flex-body. Flex растягивает сайдбар на высоту всей страницы,
 * overflow-y не срабатывает, а sticky держит только верхнюю часть
 * (Магазин приложений … Товары). На 1366×768 нижние ~30 пунктов недоступны.
 */
:root {
  --apk-sidebar-w: 280px;
  --apk-drawer-bp: 1180px;
}

html {
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  align-items: flex-start !important;
  overflow-x: hidden;
}

.sidebar {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: auto !important;
  bottom: 0 !important;
  width: var(--apk-sidebar-w) !important;
  height: 100vh !important;
  height: 100dvh !important;
  max-height: 100vh !important;
  max-height: 100dvh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  align-self: flex-start !important;
  flex: 0 0 var(--apk-sidebar-w) !important;
  z-index: 220 !important;
  padding-bottom: 28px !important;
  transform: none !important;
  scrollbar-gutter: stable;
  touch-action: pan-y;
}

.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-track { background: #121a28; }
.sidebar::-webkit-scrollbar-thumb {
  background: #6b9aff;
  border-radius: 8px;
}

.main-wrapper {
  margin-left: var(--apk-sidebar-w);
  width: calc(100% - var(--apk-sidebar-w));
  max-width: calc(100% - var(--apk-sidebar-w));
  min-height: 100vh;
  min-height: 100dvh;
  flex: 1 1 auto;
}

.hamburger {
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
}

.sidebar .nav li a {
  min-height: 40px;
}

.apk-nav-search {
  margin: 8px 12px 6px;
  position: relative;
}

.apk-nav-search i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #6a7f9a;
  font-size: 13px;
  pointer-events: none;
}

.apk-nav-search input {
  width: 100%;
  background: #0f1724;
  border: 1px solid #2a3a4a;
  color: #e2e8f0;
  border-radius: 10px;
  padding: 8px 12px 8px 34px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}

.apk-nav-search input:focus {
  border-color: #6b9aff;
  box-shadow: 0 0 0 3px rgba(107, 154, 255, 0.18);
}

.apk-nav-search input::placeholder { color: #6a7f9a; }

.sidebar .nav .nav-section {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.sidebar .nav .nav-section::after {
  content: "▾";
  font-size: 11px;
  opacity: 0.7;
}

.sidebar .nav .nav-section.apk-collapsed::after { content: "▸"; }

.sidebar .nav li.apk-hidden,
.sidebar .nav .nav-section.apk-hidden {
  display: none !important;
}

.apk-nav-more {
  display: none;
  position: absolute;
  left: 0;
  right: 10px;
  bottom: 0;
  margin: 0;
  padding: 18px 10px 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #dbe7ff;
  background: linear-gradient(180deg, rgba(26, 38, 57, 0), #1a2639 36%);
  pointer-events: none;
}

.apk-nav-more.show { display: block; }

.apk-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  z-index: 210;
  backdrop-filter: blur(2px);
}

.apk-nav-backdrop.show { display: block; }

.page-content,
.table-wrap,
.card {
  max-width: 100%;
}

.table-wrap,
.card { overflow-x: auto; }

@media (max-height: 820px) {
  .sidebar { padding-top: 10px !important; }
  .sidebar .logo {
    min-height: 48px !important;
    padding: 0 16px 10px !important;
  }
  .sidebar .user { padding: 10px 16px !important; }
  .sidebar .installer-btn {
    margin: 8px 12px !important;
    padding: 8px 12px !important;
  }
  .sidebar .nav { padding: 6px 10px !important; }
  .sidebar .nav .nav-section { padding: 10px 12px 4px !important; }
  .sidebar .nav li a { padding: 7px 12px !important; }
}

@media (max-width: 1180px) {
  .hamburger { display: flex !important; }
  .sidebar {
    transform: translateX(-110%) !important;
    box-shadow: none !important;
    width: min(320px, 88vw) !important;
  }
  .sidebar.open {
    transform: translateX(0) !important;
    box-shadow: 12px 0 40px rgba(0, 0, 0, 0.35) !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  body.apk-nav-open { overflow: hidden; }
  .top-header .right .rates-bar { display: none; }
}

@media (max-width: 768px) {
  .page-content { padding: 14px !important; }
  .top-header { padding: 10px 14px !important; }
  .card { padding: 16px !important; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
}
