/* Shared header/nav — extracted verbatim from the pairing UI.
   Requires the page's color tokens (:root + html[data-theme]). */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  background: color-mix(in srgb, var(--bg-primary) 72%, transparent);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  width: min(100% - 40px, 1180px);
  margin: 0 auto;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text-primary);
}
.brand-text em { font-style: normal; color: var(--text-muted); font-weight: 500; }
.nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.86rem;
  color: var(--text-secondary);
  text-decoration: none;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link.active { color: var(--text-primary); background: var(--bg-tertiary); }
.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--border-hover); color: var(--text-primary); background: var(--bg-tertiary); }
.theme-icon { display: inline-flex; width: 18px; height: 18px; }
.theme-icon svg { width: 18px; height: 18px; display: block; }
.theme-icon .icon-sun { display: none; }
html[data-theme="light"] .theme-icon .icon-sun { display: block; }
html[data-theme="light"] .theme-icon .icon-moon { display: none; }
.menu-btn { display: none; }
.menu-bars { display: grid; gap: 4px; }
.menu-bars i {
  display: block;
  width: 16px;
  height: 1.6px;
  background: currentColor;
  border-radius: 2px;
}
.menu-btn[aria-expanded="true"] .menu-bars i:nth-child(1) { transform: translateY(5.6px) rotate(45deg); }
.menu-btn[aria-expanded="true"] .menu-bars i:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] .menu-bars i:nth-child(3) { transform: translateY(-5.6px) rotate(-45deg); }
@media (max-width: 820px) {
  body .header-inner { width: min(100% - 28px, 1180px); margin: 0 auto; padding: 14px 0; }
  body .sidebar-tools #themeToggle { display: none; }
  body #themeToggleMob { display: grid; }
  .nav {
    position: fixed;
    top: 68px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 20px 18px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
  }
  .nav.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-link { padding: 12px; border-radius: 10px; }
  .menu-btn { display: grid; }
  .hide-sm { display: none; }
}
.sidebar-tools { display: contents; }
#themeToggleMob { display: none; }
button.sidebar-close { display: none; }
div.side-float { display: none; }
.sidebar-x { font-size: 20px; line-height: 1; font-weight: 400; color: var(--text-primary); }
@media (min-width: 821px) {
  body .header-inner { position: relative; }
  body .sidebar-tools {
    position: absolute;
    top: 20px;
    right: 14px;
    display: flex;
    gap: 8px;
  }
  body .sidebar-tools .icon-btn { width: 32px; height: 32px; }
  body button.sidebar-close { display: grid; }
  body.sidebar-collapsed .site-header { display: none; }
  body.sidebar-collapsed .side-float {
    display: flex;
    position: fixed;
    top: 18px;
    left: 18px;
    gap: 8px;
    z-index: 101;
  }
  body.sidebar-collapsed main { margin: 0 auto; max-width: 1080px; }
  body.sidebar-collapsed .site-footer { margin-left: 0; }
  body.sidebar-collapsed .site-footer .footer-inner,
  body.sidebar-collapsed .site-footer .footer-base { max-width: 1080px; }
  body .site-header {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 248px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }
  body .header-inner {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    min-height: 100vh;
    height: auto;
    padding: 26px 18px;
    gap: 28px;
  }
  body .brand { padding: 2px 10px; font-size: 17px; text-align: left; }
  body .site-header .nav { flex-direction: column; align-items: stretch; gap: 4px; }
  body .site-header .nav-link { padding: 11px 14px; text-align: left; justify-content: flex-start; }
  body .header-actions { margin: auto 0 0; flex-direction: column; align-items: stretch; }
  body .header-actions .btn { text-align: center; }
  body main { max-width: none; margin: 0 0 0 248px; padding-left: 48px; padding-right: 48px; }
  body .site-footer { margin-left: 248px; }
  body .site-footer .footer-inner,
  body .site-footer .footer-base { max-width: none; padding-left: 48px; padding-right: 48px; }
}
