/* ══════════════════════════════════════════════════════════════════════
   Header — unified styles for the site header (auth + guest).
   Loaded on every page via base.html.
   ══════════════════════════════════════════════════════════════════════ */

/* ── Impersonation banner ────────────────────────────────────────── */
.impersonate-banner {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 8px 28px;
  background: linear-gradient(90deg, rgba(232,185,49,0.12), rgba(232,185,49,0.06));
  border-bottom: 1px solid rgba(232,185,49,0.3);
  font-size: var(--fs-md); line-height: 1.5; color: var(--text-dim);
}
.impersonate-banner strong { color: #e8b931; }
.impersonate-banner-admin {
  font-size: var(--fs-sm); font-weight: 600; color: var(--text);
  text-decoration: none; padding: 4px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 20px;
  transition: border-color var(--dur-fast);
}
.impersonate-banner-admin:hover { border-color: #e8b931; }
.impersonate-banner-exit {
  font-size: var(--fs-sm); font-weight: 600; color: #fff;
  text-decoration: none; padding: 4px 14px; cursor: pointer;
  background: #e8b931; border: none; border-radius: 20px;
  transition: filter var(--dur-fast), transform var(--dur-fast);
}
.impersonate-banner-exit:hover { filter: brightness(1.15); }
.impersonate-banner-exit:active { transform: scale(0.97); }

/* ── Trial banner ─────────────────────────────────────────────────── */
.trial-banner {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 8px 28px;
  background: linear-gradient(90deg, var(--accent-glow), var(--blue-bg));
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-md); line-height: 1.5; color: var(--text-dim); position: relative;
}
.trial-banner-text strong { color: var(--accent); }
.trial-banner-cta {
  font-size: var(--fs-sm); font-weight: 600; color: var(--on-accent);
  text-decoration: none; padding: 4px 14px;
  background: var(--accent); border: none; border-radius: 20px;
  transition: filter var(--dur-fast), transform var(--dur-fast);
}
.trial-banner-cta:hover { filter: brightness(1.15); }
.trial-banner-cta:active { transform: scale(0.97); }
.trial-banner-close {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: var(--fs-md); padding: 4px; transition: color var(--dur-fast);
}
.trial-banner-close:hover { color: var(--text); }
.trial-banner-mobile { display: none; }

/* Urgency variant (≤3 days) for trial */
.trial-banner.urgent {
  background: linear-gradient(90deg, var(--red-bg), transparent);
}
.trial-banner.urgent .trial-banner-text strong { color: var(--red); }
.trial-banner.urgent .trial-banner-cta {
  background: var(--red); color: #fff;
}

/* Shared banner icon */
.banner-icon { display: flex; align-items: center; color: var(--red); flex-shrink: 0; }

/* ── Plan expiry banner ──────────────────────────────────────────── */
.expiry-banner {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 8px 28px;
  background: linear-gradient(90deg, var(--red-bg), transparent);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-md); line-height: 1.5; color: var(--text-dim); position: relative;
}
.expiry-banner-text strong { color: var(--red); }
.expiry-banner-text .plan-pill { vertical-align: middle; }
.expiry-banner-cta {
  font-size: var(--fs-sm); font-weight: 600; color: #fff;
  text-decoration: none; padding: 4px 14px;
  background: var(--red); border: none; border-radius: 20px;
  transition: filter var(--dur-fast), transform var(--dur-fast);
  white-space: nowrap;
}
.expiry-banner-cta:hover { filter: brightness(1.15); }
.expiry-banner-cta:active { transform: scale(0.97); }
.expiry-banner-close {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: var(--fs-md); padding: 4px; transition: color var(--dur-fast);
}
.expiry-banner-close:hover { color: var(--text); }
.expiry-banner-mobile { display: none; }

/* Urgency variant (≤3 days) for expiry — already red, just add icon space */
.expiry-banner.urgent .expiry-banner-text strong { font-weight: 700; }

/* ── Post-expiry banner (trial/plan ended) ───────────────────────── */
.post-expiry-banner {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; padding: 8px 28px;
  background: linear-gradient(90deg, var(--yellow-bg), transparent);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-md); line-height: 1.5; color: var(--text-dim); position: relative;
}
.post-expiry-banner .banner-icon { color: var(--yellow); }
.post-expiry-banner-text strong { color: var(--text); }
.post-expiry-banner-cta {
  font-size: var(--fs-sm); font-weight: 600; color: var(--on-accent);
  text-decoration: none; padding: 4px 14px;
  background: var(--accent); border: none; border-radius: 20px;
  transition: filter var(--dur-fast), transform var(--dur-fast);
  white-space: nowrap;
}
.post-expiry-banner-cta:hover { filter: brightness(1.15); }
.post-expiry-banner-cta:active { transform: scale(0.97); }
.post-expiry-banner-close {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: var(--fs-md); padding: 4px; transition: color var(--dur-fast);
}
.post-expiry-banner-close:hover { color: var(--text); }
.post-expiry-banner-mobile { display: none; }

/* ── Verify email banner ─────────────────────────────────────────── */
.verify-banner {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 8px 28px;
  background: linear-gradient(90deg, var(--yellow-bg), transparent);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-md); line-height: 1.5; color: var(--text-dim); position: relative;
}
.verify-banner-icon { display: flex; color: var(--yellow); flex-shrink: 0; }
.verify-banner-text strong { color: var(--text); }
.verify-banner-mobile { display: none; }
.verify-banner-cta {
  font-size: var(--fs-sm); font-weight: 600; color: var(--yellow);
  text-decoration: none; padding: 4px 14px;
  background: var(--yellow-bg); border: 1px solid var(--yellow); border-radius: 20px;
  transition: filter var(--dur-fast), transform var(--dur-fast);
  white-space: nowrap;
}
.verify-banner-cta:hover { filter: brightness(1.15); }
.verify-banner-cta:active { transform: scale(0.97); }
.verify-banner-cta.sent { pointer-events: none; opacity: 0.7; }
.verify-banner-cta.verify-banner-goto {
  background: var(--yellow); color: #fff; border-color: var(--yellow);
  pointer-events: auto; opacity: 1; cursor: pointer;
}
.verify-banner-close {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: var(--fs-md); padding: 4px; transition: color var(--dur-fast);
}
.verify-banner-close:hover { color: var(--text); }

/* ── Header bar ───────────────────────────────────────────────────── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px;
  background: rgba(13, 27, 20, 0.60);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-bottom: 1px solid rgba(52, 211, 153, 0.10);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.30), inset 0 -1px 0 rgba(52, 211, 153, 0.06);
  position: sticky; top: 0; z-index: var(--z-sticky);
}
.light .header {
  background: rgba(243, 244, 237, 0.85);
  border-bottom: 1px solid rgba(26, 150, 72, 0.10);
  box-shadow: 0 4px 24px rgba(30,35,24,0.06), inset 0 -1px 0 rgba(250,250,245,0.9);
}
.header-left { display: flex; align-items: center; gap: 24px; }
.header-logo {
  font-family: var(--font-heading);
  font-size: calc(var(--fs-base) + 4px); font-weight: 700; color: var(--text);
  text-decoration: none; display: flex; align-items: center; gap: 10px;
}
.header-logo:hover { text-decoration: none; opacity: 0.9; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--bg-input); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); flex-shrink: 0;
}
.header-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  font-size: var(--fs-lg); font-weight: 500; padding: 7px 16px;
  border-radius: var(--radius-sm); color: var(--text-dim);
  text-decoration: none; transition: all var(--dur-fast); cursor: pointer;
}
.nav-link:hover { color: var(--text); background: var(--bg-input); }
.nav-link.active { color: var(--text); background: var(--bg-input); }
.header-right { display: flex; align-items: center; gap: 12px; }

/* ── Plan pill (single source of truth for all plan labels) ──────── */
.plan-pill {
  display: inline-flex; align-items: center; line-height: 1;
  padding: 5px 12px; border-radius: 6px; font-size: var(--fs-sm);
  font-family: var(--font); font-weight: 600;
  border: none; cursor: pointer; white-space: nowrap;
}
.plan-pill--pro,
.plan-pill--trial,
.plan-pill--max { background: var(--accent-glow); color: var(--accent); }
.plan-pill--free { background: var(--yellow); color: #1A0C00; font-weight: 700; }

.plan-badge-wrap { position: relative; display: flex; align-items: center; gap: 8px; }
.plan-days-left { display: none; font-size: var(--fs-sm); color: var(--text-dim); white-space: nowrap; }

/* Plan tooltip */
.plan-tooltip {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 220px; padding: 14px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
   border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all var(--dur-mid) var(--ease); z-index: var(--z-tooltip);
}
.plan-tooltip::before {
  content: ''; position: absolute; top: -6px; right: 16px;
  width: 12px; height: 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-bottom: none; border-right: none;
  transform: rotate(45deg);}
.light .plan-tooltip::before { background: var(--bg-card); }
.light .plan-tooltip { background: var(--bg-card); box-shadow: var(--shadow-lg); border-color: transparent; }
.plan-badge-wrap:hover .plan-tooltip {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.plan-tooltip-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.plan-tooltip-title .plan-pill { font-size: var(--fs-xs); padding: 2px 7px; }
.plan-tooltip-days { font-size: var(--fs-sm); color: var(--text-dim); margin-bottom: 8px; }
.plan-tooltip-days strong { color: var(--accent); }
.plan-tooltip-desc { font-size: calc(var(--fs-base) - 3px); color: var(--text-muted); line-height: 1.5; margin-bottom: 12px; }
.plan-tooltip-btn {
  display: block; text-align: center; font-size: var(--fs-sm); font-weight: 600;
  color: var(--on-accent); background: var(--accent); text-decoration: none;
  padding: 6px 16px; border-radius: var(--radius-sm);
  transition: filter var(--dur-fast), transform var(--dur-fast);
}
.plan-tooltip-btn:hover { filter: brightness(1.15); }
.plan-tooltip-btn:active { transform: scale(0.97); }

/* ── Support dropdown ─────────────────────────────────────────────── */
.support-wrap { position: relative; }
.support-wrap.highlight .support-btn {
  animation: support-heartbeat 1.2s ease-in-out 2 both;
  border-color: var(--accent); color: var(--accent);
}
@keyframes support-heartbeat {
  0%   { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
  10%  { transform: scale(1.22); box-shadow: 0 0 0 5px var(--accent-glow); }
  20%  { transform: scale(0.95); box-shadow: 0 0 0 0 transparent; }
  30%  { transform: scale(1.18); box-shadow: 0 0 0 7px var(--accent-glow); }
  45%  { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
  100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
}
.support-tooltip {
  position: absolute; top: 100%; right: 0;
  margin-top: 8px; white-space: nowrap;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 12px; font-size: var(--fs-sm); color: var(--text);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  opacity: 0; animation: tooltip-in 0.3s ease forwards;
  pointer-events: none; z-index: 300;
}
@keyframes tooltip-in {
  0% { opacity: 0; transform: translateY(4px); }
  100% { opacity: 1; transform: translateY(0); }
}
.support-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-dim); font-family: var(--font-body); cursor: pointer; transition: all var(--dur-fast);
}
.support-btn:hover { color: var(--text); border-color: var(--border-hover); background: var(--bg-input); }
.support-wrap.open .support-btn { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }
.support-btn { position: relative; }
.inbox-badge {
  position: absolute; top: -6px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9999px; background: var(--accent); color: var(--on-accent);
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg); pointer-events: none;
}
.inbox-badge--alert { background: var(--yellow); color: var(--bg); }
.light .inbox-badge--alert { color: var(--text); }
.inbox-badge[hidden] { display: none; }

/* ── Окно «Поддержка и новости» (static/inbox.js) ── */
.support-dropdown {
  position: absolute; top: calc(100% + 10px); right: -8px;
  width: 360px; max-height: min(580px, calc(100vh - 90px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all var(--dur-mid) var(--ease); z-index: var(--z-popover);
}
.light .support-dropdown { background: var(--bg-card); box-shadow: var(--shadow-lg); border-color: transparent; }
.support-wrap.open .support-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.inbox [hidden] { display: none; }
.inbox-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.inbox-view { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.inbox-head { padding: var(--space-lg) var(--space-lg) 0; }
.inbox-head-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.inbox-title { font-family: var(--font-heading); font-size: 18px; font-weight: 700; color: var(--text); }
.inbox-close { display: none; width: 44px; height: 44px; margin: -8px -8px -8px 0; border: 0; border-radius: 50%;
  background: none; color: var(--text-dim); cursor: pointer; align-items: center; justify-content: center; }
.inbox-close:hover { color: var(--text); background: var(--bg-input); }
.inbox-tabs { display: flex; gap: 4px; margin-top: var(--space-md); background: var(--bg-surface); border-radius: var(--radius-sm); padding: 4px; }
.inbox-tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: 36px;
  border: 0; background: none; border-radius: var(--radius-xs); color: var(--text-dim);
  font: 600 var(--fs-sm) var(--font-body); cursor: pointer; transition: color var(--dur-fast), background var(--dur-fast); }
.inbox-tab:hover { color: var(--text); }
.inbox-tab[aria-selected="true"] { background: var(--bg-card); color: var(--text); box-shadow: var(--shadow-xs); }
.inbox-tab-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9999px; background: var(--accent);
  color: var(--on-accent); font-size: 11px; line-height: 18px; }
.inbox-tab:focus-visible, .inbox-close:focus-visible, .inbox-back:focus-visible, .inbox-item:focus-visible,
.inbox-link-btn:focus-visible, .inbox-composer-send:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.inbox-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.inbox-feed { overflow-y: auto; padding: var(--space-md) var(--space-sm) var(--space-sm); min-height: 120px; }
.inbox-foot { border-top: 1px solid var(--border); padding: var(--space-xs) var(--space-md); }
.inbox-link-btn { background: none; border: 0; color: var(--text-dim); font: var(--fs-sm) var(--font-body); cursor: pointer;
  min-height: 36px; padding: 0 var(--space-xs); border-radius: var(--radius-xs); }
.inbox-link-btn:hover { color: var(--accent); }
.inbox-state { padding: var(--space-xl) var(--space-lg); text-align: center; color: var(--text-dim); font-size: var(--fs-sm); line-height: 1.5; }
.inbox-state .inbox-link-btn { color: var(--accent); }

.inbox-item { display: flex; gap: var(--space-md); width: 100%; padding: var(--space-md); border: 0; background: none;
  border-radius: var(--radius-sm); cursor: pointer; text-align: left; font-family: var(--font-body); color: inherit; }
.inbox-item:hover { background: var(--bg-card-hover); }
.inbox-item + .inbox-item { margin-top: 2px; }
.inbox-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.inbox-ico svg { width: 17px; height: 17px; }
.inbox-ico--thread { background: var(--accent-glow); color: var(--accent); }
.inbox-ico--update { background: var(--green-bg); color: var(--green); }
.inbox-ico--incident { background: var(--yellow-bg); color: var(--yellow); }
.inbox-ico--welcome { background: var(--bg-surface); color: var(--text-dim); }
.inbox-main { min-width: 0; flex: 1; }
.inbox-top { display: flex; align-items: baseline; gap: var(--space-sm); }
.inbox-kind { font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }
.inbox-kind--incident { color: var(--yellow); }
.inbox-time { margin-left: auto; font-size: var(--fs-xs); color: var(--text-muted); white-space: nowrap; }
.inbox-subj { font-size: var(--fs-md); font-weight: 600; color: var(--text); margin-top: 2px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inbox-text { font-size: var(--fs-sm); color: var(--text-dim); line-height: 1.45; margin-top: 2px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.inbox-item.is-unread .inbox-subj::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); margin-right: 6px; vertical-align: 2px; }
.inbox-item.is-read .inbox-subj { font-weight: 500; color: var(--text-dim); }
.inbox-item--pinned { background: var(--yellow-bg); border: 1px solid color-mix(in srgb, var(--yellow) 30%, transparent); margin-bottom: var(--space-sm); }
.inbox-item--pinned:hover { background: var(--yellow-bg); }
.inbox-pin { font-size: var(--fs-xs); color: var(--yellow); margin-top: var(--space-xs); }
.inbox-sep { font-size: var(--fs-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; padding: var(--space-md) var(--space-md) var(--space-xs); }

.inbox-subhead { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-md) var(--space-lg); border-bottom: 1px solid var(--border); }
.inbox-back { flex: none; width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: none;
  color: var(--text-dim); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.inbox-back:hover { color: var(--text); border-color: var(--border-hover); }
.inbox-subhead-text { min-width: 0; }
.inbox-subhead-title { font-weight: 600; font-size: var(--fs-md); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-subhead-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.inbox-thread { padding: var(--space-lg); display: flex; flex-direction: column; gap: var(--space-md); overflow-y: auto; flex: 1; min-height: 160px; }
.inbox-bubble { max-width: 85%; padding: var(--space-sm) var(--space-md); border-radius: var(--radius); font-size: var(--fs-sm);
  line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text); }
.inbox-bubble--me { align-self: flex-end; background: var(--accent-glow); border-bottom-right-radius: var(--radius-xs); }
.inbox-bubble--them { align-self: flex-start; background: var(--bg-surface); border-bottom-left-radius: var(--radius-xs); }
.inbox-bubble-who { font-size: var(--fs-xs); font-weight: 700; color: var(--accent); margin-bottom: 2px; white-space: normal; }
.inbox-bubble-meta { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 4px; white-space: normal; }
.inbox-bubble--me .inbox-bubble-meta { text-align: right; }
.inbox-composer { border-top: 1px solid var(--border); padding: var(--space-md); display: flex; gap: var(--space-sm); align-items: flex-end; }
.inbox-composer textarea { flex: 1; min-height: 44px; max-height: 120px; resize: none; font-size: var(--fs-md); line-height: 1.4; }
.inbox-composer-send { flex: none; width: 44px; height: 44px; border-radius: var(--radius-sm); border: 0; background: var(--accent);
  color: var(--on-accent); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: filter var(--dur-fast); }
.inbox-composer-send:hover { filter: brightness(1.12); }
.inbox-composer-send:disabled { opacity: .5; cursor: not-allowed; }
.inbox-news { padding: var(--space-lg); overflow-y: auto; }
.inbox-news-title { font-family: var(--font-heading); font-size: 18px; font-weight: 700; color: var(--text); margin: 0 0 var(--space-sm); overflow-wrap: anywhere; }
.inbox-news-body { font-size: var(--fs-sm); color: var(--text-dim); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 var(--space-lg); }

.inbox-write { padding: var(--space-md) var(--space-lg) var(--space-lg); overflow-y: auto; }
.inbox-write .form-group { margin-bottom: var(--space-md); }
.inbox-hint { font-size: var(--fs-sm); color: var(--text-dim); margin: 0 0 var(--space-md); line-height: 1.5; }
.inbox-err { font-size: var(--fs-sm); color: var(--red); margin: 0 0 var(--space-sm); line-height: 1.4; }
.inbox-err--pad { padding: 0 var(--space-lg); margin-top: var(--space-sm); }
.support-textarea { resize: vertical; min-height: 80px; font-size: var(--fs-md); line-height: 1.5; }
.support-hint-link {
  display: block; font-size: var(--fs-sm); color: var(--accent);
  text-decoration: none; margin-bottom: 12px; transition: color var(--dur-fast);
}
.support-hint-link:hover { color: var(--accent-hover); text-decoration: underline; }
.support-send {
  width: 100%; padding: 9px; min-height: 40px; background: var(--accent); color: var(--on-accent);
  border: none; border-radius: var(--radius-sm); font-size: var(--fs-md);
  font-weight: 600; cursor: pointer; font-family: inherit;
  transition: filter var(--dur-fast), transform var(--dur-fast);
}
.support-send:hover { filter: brightness(1.15); }
.support-send:active { transform: scale(0.97); }
.support-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Avatar & menu ────────────────────────────────────────────────── */
.avatar-wrap { position: relative; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-input); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-xl); font-weight: 700; color: var(--accent);
  cursor: pointer; user-select: none;
  border: 2px solid transparent; transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.avatar:hover { border-color: var(--accent); }
.avatar-wrap.open .avatar {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.avatar-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: 240px; background: var(--bg-card);
   border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: all var(--dur-mid) var(--ease); z-index: var(--z-popover);
}
.avatar-menu::before {
  content: ''; position: absolute; top: -6px; right: 14px;
  width: 12px; height: 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-bottom: none; border-right: none;
  transform: rotate(45deg);}
.light .avatar-menu::before { background: var(--bg-card); }
.light .avatar-menu { background: var(--bg-card); box-shadow: var(--shadow-lg); border-color: transparent; }
.avatar-wrap.open .avatar-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.avatar-menu-header { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.avatar-menu-name-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.avatar-menu-name { font-size: var(--fs-lg); font-weight: 600; color: var(--text); text-decoration: none; }
.avatar-menu-name:hover { color: var(--accent); }
.avatar-menu-rename {
  flex-shrink: 0; padding: 4px; border: none; background: none;
  color: var(--text-muted); font-family: var(--font-body); cursor: pointer; border-radius: var(--radius-xs);
  transition: color var(--dur-fast), background var(--dur-fast);
  display: flex; align-items: center; justify-content: center;
}
.avatar-menu-rename:hover { color: var(--accent); background: var(--accent-glow); }
.avatar-menu-email { font-size: var(--fs-md); color: var(--text-dim); margin-top: 2px; }
.avatar-menu-verify {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; font-size: calc(var(--fs-base) - 3px); font-weight: 600;
  color: var(--yellow); text-decoration: none;
  padding: 2px 8px; border-radius: 4px;
  background: var(--yellow-bg); border: 1px solid var(--yellow);
  transition: filter var(--dur-fast);
}
.avatar-menu-verify:hover { filter: brightness(1.15); }
.avatar-menu-list { padding: 4px 6px; }
.avatar-menu-item {
  display: flex; align-items: center; justify-content: flex-start; gap: 10px;
  width: 100%; padding: 8px 10px;
  background: none; border: none; border-radius: 6px;
  color: var(--text-dim); font-size: var(--fs-lg); font-family: inherit;
  cursor: pointer; transition: all var(--dur-fast); text-align: left;
}
.avatar-menu-item:hover { background: var(--bg-input); color: var(--text); }
.avatar-menu-item .menu-icon,
.theme-toggle-left .menu-icon {
  width: 20px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.menu-icon svg { display: block; }
.avatar-menu-divider { height: 1px; background: var(--border); margin: 4px 10px; }
.avatar-menu-upgrade {
  display: block; width: calc(100% - 16px); margin: 6px 8px 4px; padding: 10px;
  border: none; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent); font-size: var(--fs-lg);
  font-weight: 600; cursor: pointer; font-family: inherit;
  transition: filter var(--dur-fast), transform var(--dur-fast);
}
.avatar-menu-upgrade:hover { filter: brightness(1.15); }
.avatar-menu-upgrade:active { transform: scale(0.97); }
.avatar-menu-item.danger { color: var(--red); }
.avatar-menu-item.danger:hover { background: var(--red-bg); }

.menu-plan-badge { margin-left: auto; }

/* ── Accent cycle (in avatar menu) ────────────────────────────────── */
.accent-dot-preview {
  display: block;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  transition: background 0.2s;
}

/* ── Theme toggle (in avatar menu) ────────────────────────────────── */
.theme-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 8px 10px;
  background: none; border: none; border-radius: 6px;
  color: var(--text-dim); font-size: var(--fs-lg); font-family: inherit;
  cursor: pointer; transition: all var(--dur-fast);
}

/* ── Guest header buttons ─────────────────────────────────────────── */
.header-guest-btn {
  padding: 6px 16px; font-size: var(--fs-md); font-weight: 500;
  border-radius: var(--radius-sm); text-decoration: none;
  transition: filter var(--dur-fast), transform var(--dur-fast); white-space: nowrap;
  border: none;
}
.header-guest-btn:active { transform: scale(0.97); }
.header-guest-login {
  background: var(--bg-input); color: var(--text);
}
.header-guest-login:hover { filter: brightness(1.1); }
.header-guest-register { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.header-guest-register:hover { filter: brightness(1.15); }

/* ── Admin badge ──────────────────────────────────────────────────── */
.admin-badge {
  color: #e8b931;
  font-weight: 700; font-size: calc(var(--fs-base) - 3px);
  letter-spacing: 1.5px; text-transform: uppercase;
  text-decoration: none; padding: 4px 10px;
  border: 1px solid #e8b93144; border-radius: 4px;
}
.admin-badge:hover { background: #e8b93118; }

/* ── Tools mega-menu ─────────────────────────────────────────────── */
.tools-nav-wrap { position: relative; display: flex; align-items: center; }
.tools-nav-chevron {
  display: inline-block; vertical-align: middle; margin-left: 2px;
  transition: transform var(--dur-fast);
}
.tools-nav-wrap:hover .tools-nav-chevron,
.tools-nav-wrap.open .tools-nav-chevron { transform: rotate(180deg); }

.tools-mega {
  position: absolute; top: calc(100% + 14px); left: 50%;
  width: 840px; max-width: calc(100vw - 2 * var(--space-lg)); padding: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden; transform: translateX(-50%) translateY(-6px);
  transition: all var(--dur-mid) var(--ease); z-index: var(--z-popover);
}
/* Invisible bridge — prevents hover gap between nav-link and dropdown */
.tools-nav-wrap::after {
  content: ''; position: absolute; top: 100%; left: 0;
  width: 100%; height: 18px;
}
.tools-mega::before {
  content: ''; position: absolute; top: -6px; left: 50%; margin-left: -6px;
  width: 12px; height: 12px; background: var(--bg-card);
  border: 1px solid var(--border); border-bottom: none; border-right: none;
  transform: rotate(45deg);
}
/* Открыто: наведение, тап (.open) и клавиатура (фокус внутри); Escape — .kb-closed (header.js) */
.tools-nav-wrap:hover .tools-mega,
.tools-nav-wrap:focus-within .tools-mega,
.tools-nav-wrap.open .tools-mega {
  opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0);
}
.tools-nav-wrap.kb-closed .tools-mega { opacity: 0; visibility: hidden; }

/* Вариант Б: разделы слева, инструменты раздела справа */
.tools-mega-body { display: grid; grid-template-columns: 232px minmax(0, 1fr); }
.tools-mega-side {
  display: flex; flex-direction: column; padding: var(--space-md) var(--space-sm);
  background: var(--bg-surface); border-right: 1px solid var(--border);
  border-radius: calc(var(--radius) - 1px) 0 0 calc(var(--radius) - 1px);
}
.tools-mega-cat {
  display: flex; align-items: center; gap: var(--space-sm); width: 100%; min-height: 44px;
  padding: 0 var(--space-md); border: none; border-radius: var(--radius-sm); background: transparent;
  font-family: inherit; font-size: var(--fs-md); font-weight: 500; line-height: 1.3; text-align: left;
  color: var(--text); cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.tools-mega-cat:hover { background: var(--bg-input); }
.tools-mega-cat.is-active { background: var(--bg-card); color: var(--accent); font-weight: 600; box-shadow: var(--shadow-xs); }
.tools-mega-cat:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tools-mega-cat-name { flex: 1; min-width: 0; }
.tools-mega-cat--pro .tools-mega-cat-name { color: var(--accent); font-weight: 600; }
.tools-mega-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.tools-mega-sep { height: 1px; margin: var(--space-xs) var(--space-md); background: var(--border); }
.tools-mega-all {
  margin-top: auto; padding: var(--space-md) var(--space-md) var(--space-xs);
  font-size: var(--fs-md); font-weight: 600; color: var(--accent);
  text-decoration: none; transition: color var(--dur-fast);
}
.tools-mega-all:hover { color: var(--accent-hover); }
.tools-mega-all:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-xs); }

/* Все панели — в одной ячейке: высота = самая длинная, при смене раздела не прыгает */
.tools-mega-panes { display: grid; }
.tools-mega-pane { grid-area: 1 / 1; padding: var(--space-lg) var(--space-lg) var(--space-md); visibility: hidden; }
.tools-mega-pane.is-active { visibility: inherit; }  /* inherit, не visible: закрытое меню (hidden) не должно оставлять панель кликабельной */
.tools-mega-title { margin: 0 var(--space-sm) var(--space-sm); font-size: var(--fs-lg); font-weight: 700; color: var(--text); }
.tools-mega-grid,
.tools-mega-pro-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px var(--space-sm); }
.tools-mega-sub {
  margin: var(--space-md) var(--space-sm) var(--space-2xs);
  font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim);
}
.tools-mega-sub:first-child { margin-top: 0; }
/* Пометка «Новое» у пунктов меню (мега-меню, drawer, хаб /tools) */
.nav-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px; vertical-align: 1px;
  border-radius: var(--radius-xs); border: 1px solid transparent;
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.4; white-space: nowrap;
}
.nav-badge--new { background: var(--accent-glow); color: var(--accent); border-color: var(--accent-glow); }
/* Последнее слово названия + бейдж — неразрывно, бейдж не уходит на строку один */
.nav-badge-keep { white-space: nowrap; }
.tools-mega-item {
  display: block; padding: var(--space-sm); border-radius: var(--radius-sm);
  text-decoration: none; transition: background var(--dur-fast);
}
.tools-mega-item:hover { background: var(--bg-input); }
.tools-mega-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tools-mega-item:hover .tools-mega-name { color: var(--accent); }
.tools-mega-name {
  display: block; font-size: var(--fs-md); font-weight: 600; line-height: 1.35; color: var(--text);
  transition: color var(--dur-fast);
}
/* Подпись в одну строку (≤ 38 символов, app/tools_router.py); «…» — только страховка на узкой ширине */
.tools-mega-desc {
  display: block; margin-top: 2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: var(--fs-sm); line-height: 1.4; color: var(--text-dim);
}

/* ── «Инфо»: Тарифы, Блог, Глоссарий, Справка (по образцу «Инструментов»; JS — header.js) ── */
.info-nav-wrap { position: relative; display: flex; align-items: center; }
.info-nav-trigger {
  display: inline-flex; align-items: center; gap: 2px;
  background: transparent; border: none; font-family: inherit; line-height: inherit;
}
.info-nav-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.info-nav-wrap.open .tools-nav-chevron { transform: rotate(180deg); }
/* Мостик для hover между пунктом и панелью */
.info-nav-wrap::after { content: ''; position: absolute; top: 100%; left: 0; width: 100%; height: 14px; }
.info-menu {
  position: absolute; top: calc(100% + 10px); left: 0; min-width: 200px;
  display: flex; flex-direction: column; padding: var(--space-xs);
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--dur-mid) var(--ease), transform var(--dur-mid) var(--ease), visibility var(--dur-mid);
  z-index: var(--z-popover);
}
.info-nav-wrap.open .info-menu {
  opacity: 1; visibility: visible; transform: translateY(0);
  /* при открытии visibility включается сразу — иначе пункты ещё скрыты и focus() с кнопки не срабатывает */
  transition: opacity var(--dur-mid) var(--ease), transform var(--dur-mid) var(--ease), visibility 0s;
}
.info-menu-item {
  display: block; padding: var(--space-sm) var(--space-md); border-radius: var(--radius-sm);
  font-size: var(--fs-md); font-weight: 500; color: var(--text); text-decoration: none;
  transition: color var(--dur-fast), background var(--dur-fast);
}
.info-menu-item:hover, .info-menu-item:focus-visible { background: var(--bg-input); color: var(--accent); outline: none; }
.info-menu-item.active { color: var(--accent); }
.light .info-menu { box-shadow: var(--shadow-lg); border-color: transparent; }

/* Light theme */
.light .tools-mega {
  background: var(--bg-card); box-shadow: var(--shadow-lg); border-color: transparent;
}
.light .tools-mega::before { background: var(--bg-card); }
.light .tools-mega-side { background: var(--bg-card-hover); border-right-color: transparent; }

/* ── Desktop: hide mobile-only header elements ────────────────────── */
.avatar-drawer-overlay { display: none; }
.avatar-drawer { display: none; }
.hamburger { display: none; }
.drawer-overlay { display: none; }
.drawer { display: none; }
.trial-banner-mobile { display: none; }

/* ── Compact desktop (961–1180px): уплотняем шапку, чтобы меню влезало ──
   Натуральная ширина шапки ~1100px (гость) / ~1030px (юзер). Ниже 1180 —
   меньше отступов, без переноса пунктов; ниже 1100 прячем текст логотипа
   (знак .logo-mark остаётся). ≤960 — бургер (см. блок ниже). */
.nav-link, .header-logo { white-space: nowrap; }
@media (max-width: 1180px) {
  .header { padding-left: var(--space-xl); padding-right: var(--space-xl); }
  .header-left { gap: var(--space-lg); }
  .nav-link { padding-left: var(--space-sm); padding-right: var(--space-sm); }
  .header-nav { gap: var(--space-2xs); }
  /* Мега-меню: центр по шапке, а не по пункту «Инструменты» — иначе при
     сдвинутом влево триггере 760px-панель вылезает за левый край.
     .header (sticky) — containing block; стрелку прячем, ::before = мостик
     для hover от пункта до панели. */
  .tools-nav-wrap { position: static; }
  .tools-nav-wrap::after { content: none; }
  .tools-mega { top: calc(100% + var(--space-xs)); }
  .tools-mega::before {
    top: auto; bottom: 100%; left: 0; right: 0; margin: 0;
    width: auto; height: var(--space-xl);
    background: none; border: none; transform: none;
  }
  .light .tools-mega::before { background: none; }
}
@media (max-width: 1100px) {
  .header-logo-text { display: none; }
}

/* ── Collapsed header (≤960px): бургер + drawer ─────────────────────
   Брейкпоинт шапки выше общего tablet (768): на 769–960 полное меню
   гостя (6 пунктов + «Войти/Попробовать») физически не помещается.
   Синхронно с HEADER_COLLAPSE_PX в header.js. */
@media (max-width: 960px) {
  .header { padding: 10px 16px; }
  .header-left { gap: 12px; }
  .header-logo { order: -1; }
  .hamburger { order: 0; }
  .header-nav { display: none; }
  .tools-nav-wrap .tools-mega { display: none !important; }
  .info-nav-wrap .info-menu { display: none !important; }
  .tools-nav-chevron { display: none; }
  .header-logo-text { display: none; }
  .plan-badge-wrap { display: none; }
  .support-btn { width: 30px; height: 30px; }
  .header-right { gap: 8px; }
  .logo-mark { width: 34px; height: 34px; }
  .avatar { width: 34px; height: 34px; font-size: var(--fs-lg); }

  /* Hamburger */
  .hamburger {
    display: flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    background: transparent; border: 1px solid var(--border);
    color: var(--text-dim); cursor: pointer; transition: all var(--dur-fast);
    flex-shrink: 0;
  }
  .hamburger:hover { color: var(--text); border-color: var(--border-hover); }

  /* Drawer overlay */
  .drawer-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px); z-index: 299;
  }
  .drawer-overlay.open { display: block; }

  /* Drawer sidebar */
  .drawer {
    display: none; position: fixed; left: 0; top: 0; bottom: 0;
    width: 260px; z-index: 300;
    background: rgba(28,28,30,0.88); -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border-right: 1px solid var(--border);
    flex-direction: column; padding: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .light .drawer {
    background: rgba(243, 244, 237, 0.97); backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    box-shadow: 4px 0 24px rgba(30,35,24,0.08);
  }
  .drawer.open {
    display: flex;
    animation: drawerSlideIn var(--dur-slow) var(--ease);
  }
  @keyframes drawerSlideIn {
    from { transform: translateX(-100%); }
    to   { transform: none; }
  }
  .drawer-header {
    display: flex; align-items: center; gap: 10px;
    padding: 16px 20px; font-size: calc(var(--fs-base) + 2px); font-weight: 700;
    border-bottom: 1px solid var(--border); color: var(--text);
  }
  .drawer-header .logo-mark { color: var(--accent); }
  .drawer-close {
    margin-left: auto; background: none; border: none;
    color: var(--text-dim); font-size: calc(var(--fs-base) + 4px); cursor: pointer;
    padding: 4px; line-height: 1;
  }
  .drawer-close:hover { color: var(--text); }
  .drawer-nav {
    display: flex; flex-direction: column; gap: 2px; padding: 12px 10px;
    /* меню длиннее экрана телефона (группа «Инфо») — прокручивается внутри, шапка и футер drawer на месте */
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  }
  .drawer-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; border-radius: var(--radius-sm);
    font-size: var(--fs-xl); font-weight: 500; color: var(--text-dim);
    text-decoration: none; transition: all var(--dur-fast);
  }
  .drawer-link:hover { background: var(--bg-input); color: var(--text); }
  .drawer-link.active { background: var(--accent-glow); color: var(--accent); }
  .drawer-link svg { width: 18px; height: 18px; flex-shrink: 0; }
  .drawer-footer {
    border-top: 1px solid var(--border); margin-top: auto;
    display: flex; flex-direction: column; gap: 2px; padding: 12px 10px;
  }
  .drawer-link-accent { color: var(--accent); font-weight: 600; }
  .drawer-link-accent:hover { color: var(--accent-hover); }

  /* Help sub-nav inside drawer */
  .drawer-help-nav {
    padding: 4px 10px 8px 42px;
    display: flex; flex-direction: column; gap: 0;
  }
  .drawer-help-section { margin-bottom: 8px; }
  /* Подпись группы ссылок в drawer («Инфо») */
  .drawer-group-title {
    margin-top: var(--space-sm); padding: 4px 10px;
    font-size: calc(var(--fs-base) - 3px); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-dim);
  }
  .drawer-group { display: flex; flex-direction: column; }
  .drawer-help-title {
    font-size: calc(var(--fs-base) - 3px); font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-dim); padding: 4px 10px;
  }
  .drawer-help-link {
    display: block; padding: 6px 10px; border-radius: var(--radius-xs);
    font-size: var(--fs-md); color: var(--text); text-decoration: none;
    transition: all var(--dur-fast);
  }
  .drawer-help-link:hover { color: var(--text); background: var(--bg-input); }
  .drawer-help-link.active { color: var(--accent); background: var(--accent-glow); }
  .drawer-help-title--accent { color: var(--accent); }
  .drawer-help-sub {
    padding: 6px 10px 2px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-dim);
  }
  /* Подсекция «Семантика · Вордстат» под «Инструменты» */
  .drawer-sub { padding-top: 0; padding-bottom: var(--space-2xs); }
  .drawer-sub .drawer-help-section { margin-bottom: 0; }

  /* Trial banner: compact on mobile, pill aligned with logo */
  .trial-banner {
    padding: 4px 12px; font-size: var(--fs-sm);
    justify-content: flex-start; gap: 6px;
  }
  .trial-banner-text { display: none; }
  .trial-banner-close { display: none; }
  .trial-banner-mobile {
    display: inline-flex !important; align-items: center; gap: 6px;
  }
  .trial-banner-mobile .plan-days-left { display: inline; font-size: var(--fs-sm); }
  .trial-banner-cta { font-size: var(--fs-sm); margin-left: auto; }

  /* Impersonation banner: compact on mobile */
  .impersonate-banner {
    padding: 6px 12px; font-size: var(--fs-sm);
    flex-wrap: wrap; gap: 6px;
    justify-content: center;
  }
  .impersonate-banner-admin { padding: 3px 10px; font-size: calc(var(--fs-base) - 3px); }
  .impersonate-banner-exit { padding: 3px 10px; font-size: calc(var(--fs-base) - 3px); }

  /* Verify banner: compact on mobile */
  .verify-banner {
    padding: 4px 12px; font-size: var(--fs-sm);
    justify-content: flex-start; gap: 6px;
  }
  .verify-banner-text { display: none; }
  .verify-banner-mobile { display: inline; font-size: var(--fs-sm); }
  .verify-banner-close { display: none; }
  .verify-banner-cta { font-size: var(--fs-sm); margin-left: auto; }

  /* Expiry banner: compact on mobile */
  .expiry-banner {
    padding: 4px 12px; font-size: var(--fs-sm);
    justify-content: flex-start; gap: 6px;
  }
  .expiry-banner-text { display: none; }
  .expiry-banner-mobile {
    display: inline-flex !important; align-items: center; gap: 6px;
  }
  .expiry-banner-mobile .plan-days-left { display: inline; font-size: var(--fs-sm); }
  .expiry-banner-close { display: none; }
  .expiry-banner-cta { font-size: var(--fs-sm); margin-left: auto; }

  /* Post-expiry banner: compact on mobile */
  .post-expiry-banner {
    padding: 4px 12px; font-size: var(--fs-sm);
    justify-content: flex-start; gap: 6px;
  }
  .post-expiry-banner-text { display: none; }
  .post-expiry-banner-mobile { display: inline; font-size: var(--fs-sm); }
  .post-expiry-banner-close { display: none; }
  .post-expiry-banner-cta { font-size: var(--fs-sm); margin-left: auto; }

  /* Banner icon: hide on mobile */
  .banner-icon { display: none; }

  /* Dropdowns on mobile */
  .support-dropdown { right: -40px; width: calc(100vw - 24px); max-width: 360px; }

  /* Avatar drawer (right-side, mirrors hamburger drawer) */
  .avatar-drawer-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px); z-index: 299;
  }
  .avatar-drawer-overlay.open { display: block; }

  .avatar-drawer {
    display: none; position: fixed; right: 0; top: 0; bottom: 0;
    width: 280px; z-index: 300;
    background: var(--bg-card);
    border-left: 1px solid var(--border);
    flex-direction: column; padding: 0;
    box-shadow: -4px 0 24px rgba(0,0,0,0.5);
    overflow-y: auto;
  }
  .light .avatar-drawer {
    box-shadow: -4px 0 24px rgba(0,0,0,0.08);
  }
  .avatar-drawer.open {
    display: flex;
    animation: avatarDrawerSlideIn var(--dur-slow) var(--ease);
  }
  @keyframes avatarDrawerSlideIn {
    from { transform: translateX(100%); }
    to   { transform: none; }
  }

  .avatar-drawer .drawer-header { justify-content: space-between; }
  .avatar-drawer .avatar-menu-list { padding: 8px 10px; }
  .avatar-drawer .avatar-menu-item { padding: 10px 14px; font-size: var(--fs-xl); }

  /* Hide dropdown avatar-menu on mobile (use drawer instead) */
  .avatar-menu { display: none !important; }

  /* Guest buttons */
  .header-guest-btn { padding: 5px 12px; font-size: var(--fs-sm); }
}

@media (max-width: 480px) {
  .header { padding: 8px 12px; }
}

/* ── Кошелёк: индикатор баланса + выпадашка (spec-balance-billing §10.2) ── */
.wallet-wrap { position: relative; }
.wallet-chip {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  min-height: 32px; padding: var(--space-2xs) var(--space-md) var(--space-2xs) var(--space-sm);
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: var(--fs-sm); font-weight: 600;
  font-variant-numeric: tabular-nums; white-space: nowrap;
  cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
}
.wallet-chip:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.wallet-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wallet-chip-icon { color: var(--accent); display: inline-flex; }
.wallet-chip-caret {
  color: var(--text-muted); display: inline-flex;
  transition: transform var(--dur-mid) var(--ease);
}
.wallet-wrap.is-open .wallet-chip { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.wallet-wrap.is-open .wallet-chip-caret { transform: rotate(180deg); }
/* Нулевой баланс — индикатор приглушён (и в открытом состоянии) */
.wallet-chip--empty { color: var(--text-dim); background: transparent; }
.wallet-chip--empty .wallet-chip-icon { color: var(--text-muted); }
.wallet-wrap.is-open .wallet-chip--empty { border-color: var(--border-hover); box-shadow: none; }

.wallet-pop {
  position: absolute; top: calc(100% + var(--space-sm)); right: 0;
  width: 300px; max-width: calc(100vw - var(--space-2xl));
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity var(--dur-mid) var(--ease), transform var(--dur-mid) var(--ease), visibility var(--dur-mid);
  z-index: var(--z-popover);
}
.light .wallet-pop { border-color: transparent; }
.wallet-wrap.is-open .wallet-pop { opacity: 1; visibility: visible; transform: none; }
.wallet-pop-head { padding: var(--space-lg) var(--space-lg) var(--space-md); }
.wallet-pop-label {
  font-size: var(--fs-xs); font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.wallet-pop-total {
  font-family: var(--font-heading); font-size: calc(var(--fs-base) + 13px);
  font-weight: 700; line-height: 1.15; margin-top: var(--space-2xs);
  font-variant-numeric: tabular-nums; color: var(--text);
}
.wallet-pop-total--zero { color: var(--text-dim); }
.wallet-pop-hint { font-size: var(--fs-sm); color: var(--text-dim); margin-top: var(--space-2xs); }
.wallet-pool-list {
  list-style: none; margin: 0;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: var(--space-md);
}
.wallet-pool-line {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-sm);
  font-size: var(--fs-sm);
}
.wallet-pool-name { color: var(--text-dim); }
.wallet-pool-sum { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wallet-pool-of { font-weight: 400; color: var(--text-muted); }
.wallet-pop-empty {
  padding: var(--space-md) var(--space-lg); border-top: 1px solid var(--border);
  font-size: var(--fs-sm); color: var(--text-dim); line-height: 1.5;
}
.wallet-pop-actions {
  display: flex; gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  border-top: 1px solid var(--border);
}
.wallet-pop-actions .btn { flex: 1; min-height: 36px; }
.wallet-pop-foot {
  padding: 0 var(--space-lg) var(--space-md);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.wallet-pop-foot a { color: var(--accent); text-decoration: none; }
.wallet-pop-foot a:hover { text-decoration: underline; }

/* Мобильное меню профиля: строка «Баланс» */
a.avatar-menu-item { text-decoration: none; }
.menu-wallet-sum {
  margin-left: auto; font-size: var(--fs-md); font-weight: 600;
  color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.menu-wallet-sum--empty { color: var(--accent); }

/* ≤960px (свёрнутая шапка) индикатор скрыт вместе с бейджем тарифа — баланс строкой в меню профиля */
@media (max-width: 960px) {
  .wallet-wrap { display: none; }
}

/* Окно «Поддержка и новости» на телефоне — на весь экран */
@media (max-width: 760px) {
  .support-dropdown { position: fixed; inset: 0; width: 100%; max-width: none; max-height: none;
    height: 100dvh; border-radius: 0; border: 0; transform: translateY(12px); }
  .support-wrap.open .support-dropdown { transform: none; }
  .inbox-close { display: inline-flex; }
  /* backdrop-filter шапки делает её контейнером для position:fixed — пока окно открыто, снимаем его
     и поднимаем шапку над баннерами, иначе окно начинается от шапки, а не от верха экрана */
  html.inbox-open .header { backdrop-filter: none; -webkit-backdrop-filter: none; z-index: var(--z-modal); }
  html.inbox-open body { overflow: hidden; }
}
