/* Shared header only. Do not reuse legacy .topbar/.nav/.brand selectors. */
html:has(body[data-site-shell]) { scrollbar-gutter: stable; min-width: 0; }
body[data-site-shell] { margin: 0; min-width: 0; }
body[data-site-shell] .site-header {
  --nav-surface: #ffffff;
  --nav-text: #25364a;
  --nav-muted: #45566b;
  --nav-border: #dce4ee;
  --nav-hover: #eaf3ff;
  --nav-active: #006ac6;
  position: sticky; top: 0; z-index: 60; width: 100%;
  margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--nav-border);
  background: var(--nav-surface); color: var(--nav-text);
  font-family: Arial, "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  isolation: isolate;
}
html[data-theme="dark"] body[data-site-shell] .site-header {
  --nav-surface: #111923; --nav-text: #f4f8fc; --nav-muted: #d7e3f0;
  --nav-border: #344356; --nav-hover: #223b55; --nav-active: #006ac6;
}
.site-header, .site-header * { box-sizing: border-box; }
.site-header .site-header__inner {
  width: min(1280px, calc(100% - 48px)); min-height: 72px;
  margin: 0 auto; padding: 0; display: grid;
  grid-template-columns: 176px minmax(0, 1fr) 200px;
  align-items: center; gap: 24px;
}
.site-header .site-header__brand {
  display: inline-flex; align-items: center; gap: 4px; height: 44px;
  margin: 0; padding: 0; color: var(--nav-text); background: transparent;
  text-decoration: none; white-space: nowrap;
  font: 800 13px/1 Arial, "Microsoft JhengHei", sans-serif;
  letter-spacing: .6px;
}
.site-header .site-header__brand span { color: #2196ed; }
.site-header .site-header__nav {
  display: flex; align-items: center; justify-content: flex-start;
  min-width: 0; gap: 4px; margin: 0; padding: 4px 0;
}
.site-header .site-header__nav > a {
  display: inline-flex; flex: 0 0 auto; justify-content: center; align-items: center;
  height: 40px; min-height: 40px; margin: 0; padding: 0 12px;
  border: 1px solid transparent; border-radius: 8px; background: transparent;
  color: var(--nav-muted); font: 700 13px/1 Arial, "Microsoft JhengHei", sans-serif;
  letter-spacing: 0; text-decoration: none; text-transform: none;
  white-space: nowrap; box-shadow: none; transform: none;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}
.site-header .site-header__nav > a:hover,
.site-header .site-header__nav > a:focus-visible {
  background: var(--nav-hover); color: var(--nav-text); border-color: var(--nav-border);
}
.site-header .site-header__nav > a[aria-current="page"] {
  background: var(--nav-active); border-color: var(--nav-active); color: #fff;
}
.site-header a:focus-visible, .site-header button:focus-visible {
  outline: 2px solid #2589dc; outline-offset: 2px;
}
.site-header .site-header__tools {
  display: flex; align-items: center; justify-content: flex-end;
  min-width: 0; gap: 8px; margin: 0; padding: 0;
}
.site-header .site-header__tools > button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  flex: 0 0 auto; height: 40px; min-height: 40px; max-height: 40px;
  width: auto; min-width: 40px; margin: 0; padding: 0 10px;
  border: 1px solid var(--nav-border); border-radius: 8px;
  color: var(--nav-text); background: var(--nav-surface);
  font: 700 12px/1 Arial, "Microsoft JhengHei", sans-serif;
  letter-spacing: 0; box-shadow: none; transform: none; cursor: pointer;
}
.site-header .site-header__tools > button:hover { background: var(--nav-hover); }
.site-header .site-header__tools > [data-account-trigger] { flex: 0 1 116px; min-width: 44px; overflow: hidden; }
.site-header [data-account-trigger] > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-header [data-account-trigger] .account-avatar,
.site-header [data-account-trigger] .account-provider-icon,
.site-header [data-account-trigger] img {
  display: inline-flex; flex: 0 0 26px; width: 26px !important; height: 26px !important;
  min-width: 26px; max-width: 26px; min-height: 26px; max-height: 26px;
  border-radius: 50%; object-fit: cover; align-items: center; justify-content: center;
}
.site-header .site-header__tools > [data-site-menu-toggle] { display: none; }
.site-header [hidden] { display: none !important; }
/* One mobile navigation replaces the different page-specific shortcut bars. */
body[data-site-shell] [data-mobile-nav] { display: none !important; }
@media (max-width: 1199px) {
  .site-header .site-header__inner { grid-template-columns: minmax(0, 1fr) auto; gap: 0 16px; padding: 8px 0; min-height: 64px; }
  .site-header .site-header__brand { grid-column: 1; grid-row: 1; }
  .site-header .site-header__tools { grid-column: 2; grid-row: 1; }
  .site-header .site-header__nav { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 700px) {
  .site-header .site-header__inner { width: calc(100% - 24px); gap: 0 8px; }
  .site-header .site-header__brand { font-size: 11px; letter-spacing: 0; }
  .site-header .site-header__tools { gap: 6px; }
  .site-header .site-header__tools > button { height: 44px; min-height: 44px; max-height: 44px; width: 44px; min-width: 44px; padding: 0; }
  .site-header .site-header__tools > [data-account-trigger] { flex: 0 0 44px; }
  .site-header [data-account-trigger] > span:last-child,
  .site-header [data-theme-label] { display: none; }
  .site-header .site-header__tools > [data-site-menu-toggle] { display: inline-flex; font-size: 20px; }
  .site-header .site-header__nav { display: none; }
  .site-header[data-menu-open="true"] .site-header__nav {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 8px 0 4px;
  }
  .site-header .site-header__nav > a { height: 44px; min-height: 44px; justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .site-header * { transition: none !important; } }
