﻿/* App layout */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Topbar (sticky) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--panel);
  border-bottom: 1px solid var(--line2);
  overflow: visible;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  overflow: visible;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.mobile-only {
  display: none;
}
.sidebar-backdrop {
  display: none;
}
.sidebar-mobile-header {
  display: none;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 10px;
}
.topup-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 14px;
  align-items: start;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: rgba(109, 74, 255, 0.1);
  border: 1px solid rgba(109, 74, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.brand-mark img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand-name {
  font-weight: 700;
  font-size: 14px;
}
.brand-sub {
  font-size: 12px;
  color: var(--muted2);
  margin-top: 2px;
  font-weight: 500;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Main layout */
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}
.sidebar {
  width: 320px;
  padding: 14px;
  min-height: 0;
  position: fixed;
  top: 82px;
  left: 14px;
  bottom: 14px;
  align-self: flex-start;
  z-index: 120;
}
.sidebar-inner {
  height: 100%;
  background: var(--panel);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.side-section-title {
  margin: 10px 6px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted2);
}

.side-menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.side-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line2);
  background: rgba(109, 74, 255, 0);
  transition:
    background var(--transition),
    border-color var(--transition),
    transform var(--transition),
    box-shadow var(--transition);
}
.side-item:hover {
  background: rgba(109, 74, 255, 0.06);
  border-color: rgba(109, 74, 255, 0.18);
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.06);
}
.side-item.active {
  background: rgba(109, 74, 255, 0.1);
  border-color: rgba(109, 74, 255, 0.24);
}

.side-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.side-label {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-divider {
  height: 1px;
  background: var(--line2);
  margin: 10px 0;
}

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-left: 360px;
}

@media (min-width: 1081px) {
  .main {
    min-height: calc(100dvh - 62px);
  }
}
.main-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 14px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#pageRoot {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding-bottom: 28px;
}

.card {
  background: var(--panel2);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  box-shadow: var(--shadow2);
  padding: 14px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card-title {
  font-weight: 700;
  font-size: 16px;
}
.muted {
  color: var(--muted);
}
.muted2 {
  color: var(--muted2);
}

/* Footer внутри .main-scroll: один общий скролл с контентом; margin-top: auto — к низу при короткой странице */
.footer {
  border-top: 1px solid var(--line2);
  padding: 12px 14px max(14px, env(safe-area-inset-bottom, 0px)) 14px;
  background: var(--panel);
  margin-top: auto;
  flex-shrink: 0;
  align-self: stretch;
  width: 100%;
  box-sizing: border-box;
  border-radius: 14px 14px 0 0;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px 16px;
  flex-wrap: wrap;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}
.footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.footer a {
  color: var(--muted);
  font-weight: 600;
}

@media (min-width: 720px) {
  .footer-links {
    margin-left: auto;
    justify-content: flex-end;
  }
}

/* Синхронно с components.css @1080px — общий скролл документа */
@media (max-width: 1080px) {
  .layout {
    min-height: auto;
  }
  .main {
    min-height: auto;
  }
  .main-scroll {
    flex: 1 0 auto;
    align-items: stretch;
    overflow-y: visible;
    overflow-x: clip;
    padding: 14px 14px 0;
  }
}

