/* ===== GLOBAL HEADER (сквозная шапка) ===== */

:root {
  --app-header-h: 44px;
}

/* Пока не вызван AppHeader.init() (экран логина/онбординга) — шапка
   пустая, скрываем её полностью, чтобы не перекрывать оверлеи с
   меньшим z-index (например .ob-overlay онбординга). */
#app-header:empty { display: none; }

#app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: calc(env(safe-area-inset-top) + var(--app-header-h));
  padding: env(safe-area-inset-top) 14px 0;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--nav-border);
  box-sizing: border-box;
}

.ah-identity {
  display: flex; align-items: center; gap: 8px;
  min-width: 0; flex: 1;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.ah-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-bg); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; overflow: hidden;
}
.ah-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ah-name {
  font-size: 14px; font-weight: 600; color: var(--label);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.ah-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }

.ah-burger, .ah-icon-btn {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  border: none; background: transparent; padding: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--label);
}
.ah-burger svg, .ah-icon-btn svg { width: 20px; height: 20px; }
.ah-burger:active, .ah-icon-btn:active { background: var(--bg3); }

/* ===== DRAWER ===== */
.ah-drawer-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: var(--overlay-bg);
  opacity: 0;
  transition: opacity var(--duration) var(--ease);
}
.ah-drawer-overlay.open { opacity: 1; }

.ah-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(320px, 84vw);
  background: var(--modal-bg);
  z-index: 1201;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--duration) var(--spring);
  box-shadow: -8px 0 40px rgba(0,0,0,.2);
}
.ah-drawer.open { transform: translateX(0); }

.ah-drawer-head {
  padding: calc(env(safe-area-inset-top) + 18px) 18px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 0.5px solid var(--sep2);
  cursor: pointer; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.ah-drawer-avatar {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-bg); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; font-weight: 700; overflow: hidden;
}
.ah-drawer-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ah-drawer-name { font-size: 16px; font-weight: 700; color: var(--label); }
.ah-drawer-sub  { font-size: 12px; color: var(--label3); margin-top: 1px; }

.ah-drawer-body {
  flex: 1; overflow-y: auto;
  padding: 4px 0 calc(24px + env(safe-area-inset-bottom));
}

.ah-drawer-group-label {
  font-size: 12px; font-weight: 600; color: var(--label3);
  text-transform: uppercase; letter-spacing: .05em;
  padding: 16px 18px 6px;
}
.ah-drawer-hint {
  font-size: 12.5px; line-height: 1.4; color: var(--label4);
  padding: 0 18px 8px;
}
.ah-drawer-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ah-drawer-item:active { background: var(--bg3); }
.ah-drawer-item-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent-bg); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.ah-drawer-item-icon i { font-size: 16px; }
.ah-drawer-item-label { font-size: 15px; font-weight: 500; color: var(--label); }
