/* Universal site header (see site-header.js), styled to match the dashboard
   chrome: a 56px bar with a bottom border, bordered square controls, and a
   hamburger menu holding every site link grouped and fully expanded.
   Self-contained: private tokens (not the host page's own --background /
   --foreground vars) drive the navigation chrome, but site-header.js still
   stamps html.light / html.dark on every page, and the light-mode block
   below repoints those private tokens so the header follows the visitor's
   chosen theme instead of staying dark forever. */

.forkmesh-simple-header {
  --fm-header-bg: #090909;
  --fm-header-surface: #141416;
  --fm-header-fg: #f5f5f5;
  --fm-header-muted: #a3a3a3;
  --fm-header-border: #313134;
  --fm-header-accent: #2ea043;
  position: relative;
  z-index: 40;
  display: flex;
  width: 100%;
  height: 3.5rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--fm-header-border);
  background: var(--fm-header-bg);
  color: var(--fm-header-fg);
}

html.light .forkmesh-simple-header {
  --fm-header-bg: #ffffff;
  --fm-header-surface: #f6f6f7;
  --fm-header-fg: #111113;
  --fm-header-muted: #5c5c66;
  --fm-header-border: #d9d9de;
  --fm-header-accent: #1a7f37;
}

html.light .fm-header-signup,
html.light .fm-header-mobile-account .fm-header-signup {
  background: #111113;
  color: #ffffff;
}

.forkmesh-simple-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fm-header-fg);
  text-decoration: none;
  flex-shrink: 0;
}

.forkmesh-simple-brand:hover {
  text-decoration: none;
}

.forkmesh-simple-brand-mark {
  width: 2rem;
  height: 2rem;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 0 22px rgba(63, 185, 80, 0.16));
}

.fm-header-version {
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border: 1px solid var(--fm-header-border);
  border-radius: 999px;
  color: var(--fm-header-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1;
}

.fm-header-version[hidden] { display: none; }

.fm-header-context {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fm-header-fg);
  font-size: 0.875rem;
  font-weight: 600;
}

/* ── hamburger (all pages, all widths — it holds the full site menu) ── */
.fm-header-burger {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--fm-header-border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.fm-header-burger span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: var(--fm-header-muted);
}

.fm-header-burger:hover span,
.fm-header-burger.is-open span {
  background: var(--fm-header-fg);
}

/* ── grouped, fully-expanded site menu ── */
.fm-header-mobile {
  position: absolute;
  top: calc(100% + 8px);
  left: 0.75rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(320px, calc(100vw - 1.5rem));
  max-height: min(75vh, 40rem);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--fm-header-border);
  border-radius: 12px;
  background: var(--fm-header-surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

.fm-header-mobile[hidden] { display: none; }

.forkmesh-simple-header-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fm-nav-group {
  display: flex;
  flex-direction: column;
}

.fm-nav-group-title {
  padding: 4px 10px 2px;
  color: var(--fm-header-muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.forkmesh-simple-header-nav a,
.fm-header-mobile-account a,
.fm-header-mobile-account button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--fm-header-fg);
  font-size: 0.875rem;
  font-family: inherit;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.forkmesh-simple-header-nav a:hover,
.fm-header-mobile-account a:not(.fm-header-signup):hover,
.fm-header-mobile-account button:hover {
  background: rgba(127, 127, 127, 0.14);
  text-decoration: none;
}

.forkmesh-simple-header-nav a[aria-current="page"] {
  background: rgba(127, 127, 127, 0.1);
  font-weight: 700;
}

/* ── dropdown menus (account chip) ── */
.fm-header-menu {
  position: relative;
  display: inline-flex;
}

.fm-header-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  min-width: 180px;
  padding: 6px;
  border: 1px solid var(--fm-header-border);
  border-radius: 10px;
  background: var(--fm-header-surface);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

.fm-header-dropdown[hidden] { display: none; }

.fm-header-dropdown-right {
  left: auto;
  right: 0;
}

.fm-header-dropdown a,
.fm-header-dropdown button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--fm-header-fg);
  font-size: 0.85rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.fm-header-dropdown a:hover,
.fm-header-dropdown button:hover {
  background: rgba(127, 127, 127, 0.14);
}

/* ── right side: payout shortcut, theme toggle, account ── */
.fm-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  flex-shrink: 0;
}

.fm-header-payout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--fm-header-border);
  border-radius: 8px;
  background: transparent;
  color: var(--fm-header-muted);
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease;
}

.fm-header-payout:hover {
  background: rgba(127, 127, 127, 0.1);
  color: var(--fm-header-fg);
  text-decoration: none;
}

.fm-header-payout img {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

.fm-header-theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--fm-header-border);
  border-radius: 8px;
  background: transparent;
  color: var(--fm-header-fg);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.fm-header-theme:hover {
  border-color: var(--fm-header-muted);
}

/* ── chat icon + unread badge ── */
.fm-header-chat {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--fm-header-border);
  border-radius: 8px;
  background: transparent;
  color: var(--fm-header-fg);
  text-decoration: none;
  flex-shrink: 0;
}

.fm-header-chat:hover {
  border-color: var(--fm-header-muted);
  text-decoration: none;
}

.fm-header-chat svg {
  width: 17px;
  height: 17px;
}

.fm-header-chat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #cf222e;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-sizing: border-box;
}

/* ── account area ── */
.fm-header-account {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
}

.fm-header-login {
  color: var(--fm-header-muted);
  text-decoration: none;
}

.fm-header-login:hover { color: var(--fm-header-fg); }

.fm-header-signup {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 0.375rem;
  background: #ffffff;
  color: #090909;
  font-weight: 700;
  text-decoration: none;
}

.fm-header-signup:hover { opacity: 0.88; }

.fm-header-mobile-account .fm-header-signup {
  border-radius: 0.375rem;
  background: #ffffff;
  color: #090909;
}

.fm-header-account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--fm-header-border);
  border-radius: 999px;
  background: transparent;
  color: var(--fm-header-fg);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.fm-header-account-chip:hover { border-color: var(--fm-header-accent); }

.fm-header-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #4f7ddb;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.fm-header-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.fm-header-account-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fm-header-mobile-account {
  display: flex;
  flex-direction: column;
}

/* ── responsive: mirror the dashboard header's breakpoints ── */
@media (max-width: 899.9px) {
  .fm-header-account .fm-header-account-name { display: none; }
}

@media (max-width: 639.9px) {
  .fm-header-context { display: none; }
  .fm-header-payout { display: none; }
}
