/* Layout: Sidebar + Header + Main Canvas */
body { display: flex; min-height: 100vh; }

/* ====== SIDEBAR ====== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: var(--space-6);
  z-index: 100;
  transition: transform var(--t-normal) var(--ease);
}

.sidebar__logo {
  display: block;
  width: 158px;
  height: auto;
  max-width: 100%;
  margin: 0 auto var(--space-10);
  object-fit: contain;
  object-position: center;
}

.sidebar__nav { flex: 1; display: flex; flex-direction: column; gap: var(--space-1); }

.sidebar__group-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--space-4) var(--space-3) var(--space-2);
  margin-top: var(--space-4);
}
.sidebar__group-label:first-child { margin-top: 0; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--t-fast) var(--ease);
  position: relative;
}
.sidebar__link:hover {
  background: var(--bg-3);
  color: var(--text);
}
.sidebar__link.active {
  background: var(--gold-glow);
  color: var(--gold-light);
}
.sidebar__link.active::before {
  content: "";
  position: absolute;
  left: calc(var(--space-6) * -1);
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}
.sidebar__link-icon {
  width: 18px; height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  flex: none;
}

.sidebar__divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
  margin: var(--space-4) 0;
}

.sidebar__balance {
  padding: 10px;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,.025),
    rgba(255,255,255,.012)
  );
  border: 1px solid rgba(214,178,92,.16);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.025);
}

.sidebar__balance-top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 9px;
}

.sidebar__balance-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  background: rgba(214,178,92,.08);
  border: 1px solid rgba(214,178,92,.24);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar__balance-icon svg {
  width: 14px;
  height: 14px;
  stroke: var(--gold);
  fill: none;
  stroke-width: 1.7;
}

.sidebar__balance-amount {
  font-size: 16px;
  line-height: 1.05;
  font-weight: 700;
  color: var(--text);
}

.sidebar__balance-amount strong {
  color: var(--gold-light);
}

.sidebar__balance-label {
  margin-top: 3px;
  font-size: 9px;
  line-height: 1;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .12em;
}

.sidebar__topup {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 30px;
  padding: 6px 10px;
  background: linear-gradient(
    180deg,
    rgba(214,178,92,.95),
    rgba(170,126,42,.95)
  );
  color: #171208;
  border: 1px solid rgba(246,226,168,.22);
  border-radius: 8px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .01em;
  cursor: pointer;
  transition:
    filter var(--t-fast) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    transform var(--t-fast) var(--ease);
}

.sidebar__topup:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 16px rgba(214,178,92,.18);
  transform: translateY(-1px);
}

/* ====== MAIN WRAPPER ====== */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ====== HEADER ====== */
.header {
  height: var(--header-h);
  padding: 0 var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(9, 9, 9, 0.85);
}

.header__search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.header__search-input {
  width: 100%;
  padding: var(--space-3) var(--space-4) var(--space-3) 44px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 14px;
  transition: all var(--t-fast) var(--ease);
}
.header__search-input::placeholder { color: var(--text-muted); }
.header__search-input:focus {
  outline: none;
  border-color: var(--border-gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.header__search-icon {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 1.7;
}

.header__actions { display: flex; align-items: center; gap: var(--space-3); }

.header__icon-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
  color: var(--text-secondary);
}
.header__icon-btn:hover {
  background: var(--bg-3);
  border-color: var(--border-gold);
  color: var(--gold-light);
}
.header__icon-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }

.header__avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: 2px solid var(--border-gold);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: #1a1408;
  font-size: 14px;
  cursor: pointer;
}

/* ====== CONTENT ====== */
.content {
  padding: var(--space-8);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* ====== MOBILE ====== */
.header__burger {
  display: none;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.header__burger span {
  width: 18px; height: 2px;
  background: var(--text);
  position: relative;
}
.header__burger span::before,
.header__burger span::after {
  content: "";
  position: absolute;
  width: 18px; height: 2px;
  background: var(--text);
  left: 0;
}
.header__burger span::before { top: -6px; }
.header__burger span::after { top: 6px; }

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .header__burger { display: flex; }
  .content { padding: var(--space-5); }
}

@media (max-width: 640px) {
  .header { padding: 0 var(--space-4); }
  .header__search { display: none; }
  .content { padding: var(--space-4); }
}

/* ====== STICKY FOOTER v3 (финальный) ====== */
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body > div {
  flex: 1 1 auto;
}
.sono-footer {
  margin-top: auto;
  flex-shrink: 0;
}

/* ====== STICKY FOOTER v4: точный удар в родителя футера ====== */
/* Любой элемент, у которого футер — прямой ребёнок: */
*:has(> .sono-footer) {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh !important;
}
/* Элемент прямо ПЕРЕД футером (контент) растягивается: */
*:has(> .sono-footer) > *:has(+ .sono-footer) {
  flex: 1 0 auto !important;
}
.sono-footer {
  margin-top: auto !important;
  flex-shrink: 0 !important;
}

/* ====== STICKY FOOTER v5: точно по .main ====== */
.main {
  min-height: 100vh !important;
  display: flex !important;
  flex-direction: column !important;
}
.main > main.content,
.main > *:has(+ .sono-footer) {
  flex: 1 0 auto !important;
}
.main > .sono-footer {
  margin-top: auto !important;
  flex-shrink: 0 !important;
}
