.header-container,
.vm-header {
  position: fixed;
  z-index: 1000;
  inset: 0 0 auto 0;
  min-height: var(--v-header-h);
  height: var(--v-header-h);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding-inline: clamp(12px, 2vw, 24px);
  border-bottom: 1px solid var(--v-border);
  background: var(--v-header-bg, color-mix(in srgb, var(--v-surface) 88%, black));
  color: var(--v-text-strong);
}

.header-logo-wrapper,
.vm-header__brand { display: flex; align-items: center; min-width: 0; }
.header-logo-link { display: inline-flex; align-items: center; text-decoration: none; }
.header-container .logo-inner,
.header-container .logo-group { display: inline-flex; align-items: center; width: 38px; height: 38px; position: relative; }
.header-container .logo-circle,
.header-container .logo-v { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.header-title,
.vm-header__title {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--v-font-display);
  font-weight: 700;
  letter-spacing: .02em;
}
.header-actions { display: flex; align-items: center; justify-content: flex-end; }

.user-menu-toggle,
.burger-toggle,
.vm-nav-toggle {
  width: 42px;
  height: 42px;
  padding: 0;
}
.burger-lines { display: grid; gap: 5px; width: 20px; }
.burger-lines span { display: block; height: 2px; border-radius: 99px; background: currentColor; }

.user-menu-overlay,
.vm-nav-overlay {
  position: fixed;
  inset: var(--v-header-h) 0 0 0;
  background: rgba(0,0,0,.55);
}
.user-menu-overlay[hidden],
.vm-nav-overlay[hidden],
.offcanvas-menu[hidden] { display: none !important; }

.offcanvas-menu,
.user-menu,
.vm-mobile-nav {
  position: fixed;
  z-index: 1001;
  top: var(--v-header-h);
  right: 0;
  width: min(420px, 92vw);
  height: calc(100vh - var(--v-header-h));
  overflow: auto;
  border-left: 1px solid var(--v-border);
  background: var(--v-surface);
  color: var(--v-text);
  box-shadow: -16px 0 44px rgba(0,0,0,.35);
}
.offcanvas-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--v-border); }
.offcanvas-close { min-width: 40px; }
.user-menu-list { list-style: none; margin: 0; padding: 10px; display: grid; gap: 8px; }
.user-menu-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--v-border);
  border-left: 4px solid rgba(var(--nav-accent-rgb, var(--v-accent-rgb)), .70);
  border-radius: var(--v-radius-sm);
  background: rgba(255,255,255,.035);
  color: var(--v-text-strong);
  padding: 9px 12px;
  text-decoration: none;
}
.user-menu-link:hover,
.user-menu-link:focus-visible,
.user-menu-link.is-active {
  background: rgba(var(--nav-accent-rgb, var(--v-accent-rgb)), .16);
  border-color: rgba(var(--nav-accent-rgb, var(--v-accent-rgb)), .52);
}
.user-menu-link-danger { --nav-accent-rgb: 251,113,133; }
.nav-item-dashboard { --nav-accent-rgb: 56,189,248; }
.nav-item-stats { --nav-accent-rgb: 6,182,212; }
.nav-item-media { --nav-accent-rgb: 34,197,94; }
.nav-item-upload { --nav-accent-rgb: 245,158,11; }
.nav-item-apps { --nav-accent-rgb: 139,92,246; }
.nav-item-account { --nav-accent-rgb: 251,191,36; }
.nav-item-profile { --nav-accent-rgb: 52,211,153; }
.nav-item-settings,
.nav-item-theme { --nav-accent-rgb: 167,139,250; }

/* Shared logo contract for header and auth pages. */
.logo-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.logo-inner {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.logo-circle,
.logo-v {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-circle {
  z-index: 1;
}

.logo-v {
  z-index: 2;
}

/* Header should show the mark, not the text label. */
.vm-header__title {
  display: none;
}

/* Auth pages use the same mark, just larger. */
.login-logo .logo-inner {
  width: 92px;
  height: 92px;
}

/* Header logo on dark header: invert only inside header, not on auth/login pages. */
.vm-header .logo-circle,
.vm-header .logo-v {
  filter: brightness(0) invert(1);
}

/* Header nav modes.
   Default remains offcanvas. Themes may opt into inline via theme-meta.php. */
.vm-header--nav-inline {
  grid-template-columns: auto 1fr;
  gap: clamp(18px, 4vw, 42px);
}

.vm-header--nav-inline .burger-toggle,
.vm-header--nav-inline .user-menu-toggle,
.vm-header--nav-inline .vm-nav-toggle,
.vm-header--nav-inline .user-menu-overlay,
.vm-header--nav-inline .vm-nav-overlay,
.vm-header--nav-inline .offcanvas-head,
.vm-header--nav-inline .vm-mobile-nav__head {
  display: none;
}

.vm-header--nav-inline .header-actions {
  justify-self: end;
  width: auto;
}

.vm-header--nav-inline .user-menu.offcanvas-menu,
.vm-header--nav-inline .vm-primary-nav,
.vm-header--nav-inline .vm-mobile-nav {
  display: block;
  position: static;
  inset: auto;
  width: auto;
  max-width: none;
  height: auto;
  min-height: 0;
  padding: 0;
  margin: 0;
  transform: none;
  opacity: 1;
  visibility: visible;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.vm-header--nav-inline .user-menu-list,
.vm-header--nav-inline .vm-primary-nav ul,
.vm-header--nav-inline .vm-mobile-nav ul {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(14px, 2.4vw, 30px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.vm-header--nav-inline .user-menu-list li,
.vm-header--nav-inline .vm-primary-nav li,
.vm-header--nav-inline .vm-mobile-nav li {
  width: auto;
}

.vm-header--nav-inline .user-menu-list a,
.vm-header--nav-inline .vm-primary-nav a,
.vm-header--nav-inline .vm-mobile-nav a {
  width: auto;
  text-align: left;
}

@media (max-width: 780px) {
  .vm-header--nav-inline {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .vm-header--nav-inline .header-actions {
    width: 100%;
    justify-self: stretch;
    overflow-x: auto;
  }

  .vm-header--nav-inline .user-menu-list,
  .vm-header--nav-inline .vm-primary-nav ul,
  .vm-header--nav-inline .vm-mobile-nav ul {
    justify-content: flex-start;
    white-space: nowrap;
  }
}
