/* header-buttons.css: ONE rule for every control in the site header, on every page (loaded by the home page and, through site-frame.css, by every other page).
   Same height and the same frame family: an icon-only control is a circle (44 x 44), a text control is a pill of the same height.
   Colour: ONLY "My class" is yellow with black icon and text. Every other header control (Admin, profile, sign in, log out, back, menu, shield, theme, search, bell, language, cart)
   is blue glass with a white icon and white text, in Glassy, Light and Brite. Inside a control the icon and the text follow ONE colour (currentColor), so no icon is black while its neighbour is white.
   Text never wraps (no hangers). Menus that open from a control (.frame-pop) are not header controls and keep their own look.
   TO CHANGE: the size is --xh-h; the blue is --xh-glass / --xh-line; the yellow is --xh-gold. */
html .site-header {
  --xh-h: 44px; --xh-glass: rgba(26, 61, 129, .92); --xh-glass-hover: rgba(40, 84, 170, .96); --xh-line: rgba(125, 211, 252, .45); --xh-ink: rgb(255, 255, 255); --xh-gold: rgb(255, 176, 0); --xh-gold-hover: rgb(255, 194, 51); --xh-gold-ink: rgb(26, 17, 0);
}
@media (max-width: 360px) { html .site-header { --xh-h: 40px; } }

html body .site-header :is(.frame-icon, .xag-back, .menu-toggle, #menuToggle, .cart-btn, .user-chip, .xh-signin, #authBtn, .xh-btn, .xh-logout, .xag-trust-shield, .xp-searchbtn, .xh-langone, .xn-bell):not(.frame-pop *) {
  box-sizing: border-box !important; align-items: center !important; justify-content: center !important; gap: .4rem !important;
  height: var(--xh-h) !important; min-height: var(--xh-h) !important; min-width: var(--xh-h) !important; padding: 0 !important; border-radius: 999px !important;
  background: var(--xh-glass) !important; color: var(--xh-ink) !important; border: 1.5px solid var(--xh-line) !important; box-shadow: none !important;
  font-weight: 700 !important; font-size: .85rem !important; line-height: 1 !important; font-family: inherit !important; text-decoration: none !important; white-space: nowrap !important; cursor: pointer;
}
/* text controls: the same height, a pill that grows with its words (Admin, Sign in, My class) */
html body .site-header :is(.xh-signin, #authBtn):not(.frame-pop *) { padding: 0 .9rem !important; width: auto !important; }
html body .site-header :is(.frame-icon, .xag-back, .menu-toggle, #menuToggle, .cart-btn, .user-chip, .xag-trust-shield, .xp-searchbtn, .xh-langone, .xn-bell) { width: var(--xh-h) !important; }
html body .site-header :is(.frame-icon, .xag-back, .menu-toggle, #menuToggle, .cart-btn, .user-chip, .xh-signin, #authBtn, .xh-btn, .xh-logout, .xag-trust-shield, .home-btn, .xp-searchbtn, .xh-langone, .xn-bell):hover {
  background: var(--xh-glass-hover) !important; color: var(--xh-ink) !important; border-color: rgb(125, 211, 252) !important;
}
html body .site-header :is(.frame-icon, .xag-back, .menu-toggle, #menuToggle, .cart-btn, .user-chip, .xh-signin, #authBtn, .xh-btn, .xh-logout, .xag-trust-shield, .home-btn, .xp-searchbtn, .xh-langone, .xn-bell):focus-visible { outline: 3px solid rgb(255, 180, 92) !important; outline-offset: 2px; }
/* icons and words inside a control follow the control's colour */
html body .site-header :is(.frame-icon, .xag-back, .menu-toggle, #menuToggle, .cart-btn, .xh-signin, #authBtn, .xh-btn, .xh-logout, .xp-searchbtn, .home-btn, .xn-bell) svg { color: inherit !important; stroke: currentColor !important; width: 20px; height: 20px; flex: none; }
html body .site-header :is(.xh-signin, #authBtn, .xh-btn, .xh-logout, .frame-icon, .cart-btn) :is(span, b, strong, i) { color: inherit !important; white-space: nowrap !important; }
html body .site-header .user-chip { font-size: 0 !important; gap: 0 !important; }
html body .site-header .user-chip::before { color: var(--xh-ink) !important; font-size: 1.1rem; background: none; }
html body .site-header :is(#authBtn, .user-chip[data-initial="?"], .user-chip:not([data-initial]))::before { background: currentColor !important; }

/* the ONE yellow control: My class (black icon and black text) */
html body .site-header .xh-myclass, html body .site-header #xhMyClass {
  background: var(--xh-gold) !important; border-color: var(--xh-gold) !important; color: var(--xh-gold-ink) !important; padding: 0 .9rem !important; width: auto !important;
}
html body .site-header :is(.xh-myclass, #xhMyClass):hover { background: var(--xh-gold-hover) !important; border-color: var(--xh-gold-hover) !important; color: var(--xh-gold-ink) !important; }
html body .site-header :is(.xh-myclass, #xhMyClass) :is(svg, span) { color: var(--xh-gold-ink) !important; stroke: currentColor !important; }
/* Admin is blue like the others */
html body .site-header :is(.xh-adminbtn, #xhAdmin) { background: var(--xh-glass) !important; border-color: var(--xh-line) !important; color: var(--xh-ink) !important; padding: 0 .9rem !important; width: auto !important; }
html body .site-header :is(.xh-adminbtn, #xhAdmin) :is(svg, span) { color: var(--xh-ink) !important; stroke: currentColor !important; }

/* ===== OWNER HEADER STANDARD 2026-11-07 =====
   LEFT group (Back, Menu, Trust shield): theme blue disc (never black), yellow ring, white icon, 44 x 44 on EVERY width (never squished).
   RIGHT group: the six controls (theme, Search, My class, Admin, profile, Log out) are one size and one frame, WHITE border; only My class is yellow (black icon and text).
   Flags and the bell are not touched. The tokens below are the ONLY colours: Glassy, Light and Brite change the tokens, not the structure. Phone = desktop except for layout (the right group wraps under the logo row). */
html .site-header { --xh-left-ring: rgb(245, 184, 0); --xh-white: rgb(255, 255, 255); }
html[data-theme="light"] .site-header { --xh-glass: rgb(26, 61, 129); --xh-glass-hover: rgb(40, 84, 170); }
html[data-theme="brite"] .site-header { --xh-glass: rgb(1, 52, 122); --xh-glass-hover: rgb(3, 78, 170); }

/* left group: same blue as the other header buttons, yellow ring kept */
html body header.site-header .header-inner :is(.xag-back, #xagBack, .menu-toggle, #menuToggle, .xag-trust-shield) {
  background: var(--xh-glass) !important; border: 2px solid var(--xh-left-ring) !important; color: var(--xh-white) !important; -webkit-text-fill-color: var(--xh-white);
  width: 44px !important; min-width: 44px !important; height: 44px !important; min-height: 44px !important; flex: 0 0 44px !important; border-radius: 50% !important; padding: 0 !important; font-size: 0 !important; box-sizing: border-box !important;
}
html body header.site-header .header-inner :is(.xag-back, #xagBack, .menu-toggle, #menuToggle):is(:hover, :focus-visible) { background: var(--xh-glass-hover) !important; }
html body header.site-header .header-inner :is(.xag-back, #xagBack) svg { color: var(--xh-white) !important; stroke: var(--xh-white) !important; }
/* logo: transparent, full size, never squeezed by the buttons next to it */
html body header.site-header .header-inner .logo-link { background: transparent !important; flex: 0 0 auto !important; min-width: 0 !important; }
html body header.site-header .header-inner .logo-img { background: transparent !important; height: 44px !important; max-height: none !important; width: auto !important; max-width: none !important; }

/* the six: one size, one frame, WHITE border */
html body header.site-header .header-inner :is(.xh-theme, .xt-btn, #xtBtn, .xp-searchbtn, #searchBtn, .xh-myclass, #xhMyClass, .xh-adminbtn, #xhAdmin, .user-chip, #userChip, .xh-signin, #authBtn, .xh-logout, #xhLogout):not(.hidden):not([hidden]) { display: inline-flex !important; }
html body header.site-header .header-inner :is(.xh-theme, .xt-btn, #xtBtn, .xp-searchbtn, #searchBtn, .xh-myclass, #xhMyClass, .xh-adminbtn, #xhAdmin, .user-chip, #userChip, .xh-signin, #authBtn, .xh-logout, #xhLogout) {
  box-sizing: border-box !important; align-items: center !important; justify-content: center !important; gap: .4rem !important;
  height: var(--xh-h) !important; min-height: var(--xh-h) !important; min-width: var(--xh-h) !important; border-radius: 999px !important; padding: 0 !important; flex: 0 0 auto !important;
  background: var(--xh-glass) !important; color: var(--xh-white) !important; border: 1.5px solid var(--xh-white) !important; box-shadow: none !important; text-decoration: none !important; white-space: nowrap !important;
  font-size: .85rem !important; font-weight: 700 !important; line-height: 1 !important;
}
html body header.site-header .header-inner :is(.xh-theme, .xt-btn, #xtBtn, .xp-searchbtn, #searchBtn, .xh-logout, #xhLogout, .user-chip, #userChip) { width: var(--xh-h) !important; padding: 0 !important; }
html body header.site-header .header-inner :is(.xh-signin, #authBtn, .xh-myclass, #xhMyClass, .xh-adminbtn, #xhAdmin) { width: auto !important; padding: 0 .9rem !important; }
html body header.site-header .header-inner :is(.xh-theme, .xt-btn, #xtBtn, .xp-searchbtn, #searchBtn, .xh-myclass, #xhMyClass, .xh-adminbtn, #xhAdmin, .user-chip, #userChip, .xh-signin, #authBtn, .xh-logout, #xhLogout):hover { background: var(--xh-glass-hover) !important; color: var(--xh-white) !important; border-color: var(--xh-white) !important; }
html body header.site-header .header-inner :is(.xh-theme, .xt-btn, #xtBtn, .xp-searchbtn, #searchBtn, .xh-adminbtn, #xhAdmin, .xh-signin:not(.xh-myclass), #authBtn, .xh-logout, #xhLogout) :is(svg, span, b, i) { color: var(--xh-white) !important; stroke: currentColor !important; }
html body header.site-header .header-inner :is(.xt-btn, #xtBtn) svg, html body header.site-header .header-inner :is(.xh-theme, .xp-searchbtn, #searchBtn, .xh-logout, #xhLogout, .xh-myclass, #xhMyClass, .xh-adminbtn, #xhAdmin) svg { width: 20px !important; height: 20px !important; flex: none; }
/* My class: yellow ALL THE TIME (every theme, page and width), black icon and black text */
html body header.site-header .header-inner .header-actions :is(.xh-myclass, #xhMyClass) { background: var(--xh-gold) !important; border-color: var(--xh-white) !important; color: var(--xh-gold-ink) !important; }
html body header.site-header .header-inner .header-actions :is(.xh-myclass, #xhMyClass):hover { background: var(--xh-gold-hover) !important; border-color: var(--xh-white) !important; color: var(--xh-gold-ink) !important; }
html body header.site-header .header-inner .header-actions :is(.xh-myclass, #xhMyClass) :is(svg, span, b, i) { color: var(--xh-gold-ink) !important; stroke: currentColor !important; }
/* logout is part of the standard on phone too (it was hidden under 700px): shown whenever someone is signed in */
html body.xag-in header.site-header .header-inner .xh-logout:not(.hidden):not([hidden]), html body header.site-header[data-frame] .header-inner .xh-logout:not([hidden]) { display: inline-flex !important; }
/* profile: ALWAYS the outline person icon (white lines on blue), signed in or not, on every page and width. Never an initial or a letter (the account name stays in the menu). */
html body header.site-header .header-inner :is(.user-chip, #userChip) { font-size: 0 !important; gap: 0 !important; max-width: var(--xh-h) !important; overflow: hidden; }
html body header.site-header .header-inner .header-actions #userChipWrap:not(.hidden) ~ #authBtn { display: none !important; }
html body header.site-header .header-inner :is(.user-chip, #userChip, #authBtn)::before {
  content: "" !important; display: block !important; flex: none; width: 1.3rem !important; height: 1.3rem !important; background: currentColor !important; color: var(--xh-white) !important;
  -webkit-mask: var(--ic-user) center/contain no-repeat !important; mask: var(--ic-user) center/contain no-repeat !important; font-size: 0;
}
/* layout only: the left group and logo keep their size; the right group wraps under them on narrow screens (no overlap, nothing squeezed) */
html body header.site-header .header-inner { flex-wrap: wrap !important; justify-content: flex-start !important; row-gap: .35rem; gap: .4rem; }
html body header.site-header .header-inner .header-actions { flex: 0 1 auto !important; margin-left: auto !important; justify-content: flex-end !important; flex-wrap: wrap !important; gap: .4rem !important; order: 3; }
@media (max-width: 720px) {
  html body header.site-header .header-inner { padding-left: .4rem !important; padding-right: .4rem !important; gap: .3rem !important; row-gap: .25rem !important; }
  html body header.site-header .header-inner .header-actions { gap: .3rem !important; }
  /* narrow screens: the text controls become icon-only circles of the same size (the name stays in aria-label and title) */
  html body header.site-header .header-inner :is(.xh-myclass, #xhMyClass, .xh-adminbtn, #xhAdmin, .xh-signin, #authBtn) { width: var(--xh-h) !important; padding: 0 !important; }
  html body header.site-header .header-inner :is(.xh-myclass, #xhMyClass, .xh-adminbtn, #xhAdmin, .xh-signin, #authBtn) :is(.xh-signin-t, .xh-lbl) { display: none !important; }
  /* the right group stays on the logo row when it fits (shorter header); it drops under the logo only when it cannot fit */
  html body header.site-header .header-inner .header-actions { flex: 1 1 auto !important; min-width: 0 !important; order: 3 !important; flex-wrap: wrap !important; }
  html body header.site-header { --xh-h: 38px; }
  html body header.site-header .header-inner :is(.xag-back, #xagBack, .menu-toggle, #menuToggle, .xag-trust-shield) { width: 38px !important; min-width: 38px !important; height: 38px !important; min-height: 38px !important; flex: 0 0 38px !important; }
  html body header.site-header .header-inner .logo-img { height: 40px !important; }
}
/* ===== ROUND 3 (2026-11-08): phone header stays ONE row in the fullest case (Back + Menu + Shield + logo + bell + flag + My class + Admin + account = 9 controls) =====
   At 390 the nine controls were 26px too wide and the right group dropped to a second row (header 100px tall). Narrow phones get slightly smaller circles and a tighter gap. */
@media (max-width: 430px) {
  html body header.site-header { --xh-h: 34px; }
  html body header.site-header .header-inner { gap: .2rem !important; padding-left: .3rem !important; padding-right: .3rem !important; }
  html body header.site-header .header-inner .header-actions { gap: .2rem !important; flex-wrap: nowrap !important; }
  html body header.site-header .header-inner :is(.xag-back, #xagBack, .menu-toggle, #menuToggle, .xag-trust-shield) { width: 34px !important; min-width: 34px !important; height: 34px !important; min-height: 34px !important; flex: 0 0 34px !important; }
  html body header.site-header .header-inner .logo-img { height: 34px !important; }
}
@media (max-width: 370px) {
  html body header.site-header { --xh-h: 32px; }
  html body header.site-header .header-inner :is(.xag-back, #xagBack, .menu-toggle, #menuToggle, .xag-trust-shield) { width: 32px !important; min-width: 32px !important; height: 32px !important; min-height: 32px !important; flex: 0 0 32px !important; }
  html body header.site-header .header-inner .logo-img { height: 30px !important; }
}
/* the phone flag button (the four flags in one button) wears the same frame as its neighbours: theme blue, white ring, same size (it is not shown on wide screens, so no display rule here) */
html body header.site-header .header-inner :is(.xh-langone, #langOne) { background: var(--xh-glass) !important; border: 1.5px solid var(--xh-white) !important; width: var(--xh-h) !important; height: var(--xh-h) !important; min-width: var(--xh-h) !important; min-height: var(--xh-h) !important; border-radius: 999px !important; padding: 0 !important; box-shadow: none !important; flex: 0 0 auto !important; }
html body header.site-header .header-inner :is(.xh-langone, #langOne):hover { background: var(--xh-glass-hover) !important; }

/* ===== OWNER ACCOUNT-MENU STANDARD 2026-11-08 =====
   Search, Theme and Log out are NOT in the header bar. They live in the account menu (acct-menu.js): Search and Theme on top, Log out (or Sign in) at the bottom.
   The header keeps: Back, Menu, Trust shield, logo, language flags / bell, My class (the only yellow control), Admin (when allowed) and the account button (outline person icon).
   Same design on phone and desktop; only the layout differs. */
html body header.site-header .header-inner .header-actions > :is(.xh-theme, .xt-wrap, .xt-btn, #xtBtn, .search-wrap, #searchBtn, .xp-searchbtn, .xh-logout, #xhLogout, #authBtn):not(#xag):not(#xag2):not(#xag3) { display: none !important; }
html body header.site-header .header-inner :is(.xh-theme, .xt-btn, #xtBtn, #searchBtn, .xp-searchbtn, .xh-logout, #xhLogout, #authBtn):not(.chip-drop *):not(#xag):not(#xag2):not(#xag3) { display: none !important; }
/* the person button: outline person, white lines, never a letter */
html body header.site-header .header-inner :is(.user-chip, #userChip):not(#xag):not(#xag2)::before {
  content: "" !important; display: block !important; width: 1.3rem !important; height: 1.3rem !important; background: currentColor !important; color: var(--xh-white) !important;
  -webkit-mask: var(--ic-user) center/contain no-repeat !important; mask: var(--ic-user) center/contain no-repeat !important; font-size: 0 !important;
}
/* the account menu: scrolls when taller than the screen */
html body header.site-header .chip-drop { max-height: calc(100dvh - 76px) !important; overflow-y: auto !important; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; min-width: min(250px, calc(100vw - 16px)); max-width: calc(100vw - 16px); box-sizing: border-box; }
/* signed out: only Search, Theme and Sign in; signed in: no Sign in */
body:not(.xag-in) .site-header .chip-drop > .xa-in { display: none !important; }
body.xag-in .site-header .chip-drop > .xa-signin { display: none !important; }
html body .site-header .chip-drop > .xa-top { display: flex; flex-direction: column; gap: .15rem; padding: 0 0 .4rem; margin: 0 0 .3rem; border-bottom: 1px solid rgba(128, 128, 128, .35); }
html body .site-header .chip-drop .xa-h { padding: .35rem .75rem .1rem; font-weight: 700; font-size: .72rem; line-height: 1.2; letter-spacing: .05em; text-transform: uppercase; opacity: .8; white-space: nowrap; }
html body .site-header .chip-drop .xa-th { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; padding: .2rem .5rem .1rem; }
html body .site-header .chip-drop button.xa-opt {
  all: unset; box-sizing: border-box; display: flex !important; align-items: center; gap: .45rem; min-height: 40px; padding: 0 .6rem; border: 1.5px solid var(--xa-line, rgba(128, 128, 128, .5)); border-radius: 999px;
  color: var(--xa-ink, inherit) !important; font-weight: 700; font-size: .82rem; line-height: 1; font-family: inherit; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
html body .site-header .chip-drop button.xa-opt:hover { background: var(--xa-hover, rgba(128, 128, 128, .18)) !important; }
html body .site-header .chip-drop button.xa-opt[aria-pressed="true"] { background: var(--xa-sel, rgba(48, 74, 220, .16)) !important; border-color: var(--xa-ring, rgb(48, 74, 220)); box-shadow: 0 0 0 1px var(--xa-ring, rgb(48, 74, 220)) inset; }
html body .site-header .chip-drop button.xa-opt:focus-visible { outline: 3px solid rgb(255, 180, 92); outline-offset: 1px; }
html body .site-header .chip-drop .xa-sw { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; }
html body .site-header .chip-drop .xa-sw.s-site { background: linear-gradient(135deg, rgb(255, 255, 255) 50%, rgb(20, 50, 112) 50%); }
html body .site-header .chip-drop .xa-sw.s-light { background: rgb(255, 255, 255); }
html body .site-header .chip-drop .xa-sw.s-glass { background: rgb(20, 50, 112); }
html body .site-header .chip-drop .xa-sw.s-brite { background: linear-gradient(135deg, rgb(1, 36, 86) 40%, rgb(34, 211, 238) 40%, rgb(34, 211, 238) 70%, rgb(250, 204, 21) 70%); }
html .site-header .chip-drop { --xa-ink: rgb(11, 28, 45); --xa-line: rgba(11, 28, 45, .35); --xa-hover: rgba(48, 74, 220, .1); --xa-sel: rgba(48, 74, 220, .16); --xa-ring: rgb(48, 74, 220); }
html[data-theme="glass"] .site-header .chip-drop, html[data-theme="dark"] .site-header .chip-drop, html[data-theme="brite"] .site-header .chip-drop { --xa-ink: rgb(255, 255, 255); --xa-line: rgba(255, 255, 255, .55); --xa-hover: rgba(255, 255, 255, .14); --xa-sel: rgba(125, 211, 252, .28); --xa-ring: rgb(125, 211, 252); }
@media (max-width: 360px) { html body .site-header .chip-drop .xa-th { grid-template-columns: 1fr; } }
/* the menu is a solid panel (text never sits over the page behind it) */
html[data-theme="glass"] body .site-header .chip-drop, html[data-theme="dark"] body .site-header .chip-drop { background: rgb(16, 48, 107) !important; }
html[data-theme="brite"] body .site-header .chip-drop { background: rgb(1, 40, 94) !important; }
html[data-theme="light"] body .site-header .chip-drop { background: rgb(255, 255, 255) !important; }
/* the outline person icon (a mask: the colour comes from the button, white on blue) */
:root { --ic-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8z M4 21c0-4 3.6-7 8-7s8 3 8 7'/%3E%3C/svg%3E"); }

/* ===== OWNER ORDER 2026-11-08: bell + account are ONE cluster, with red unread badges =====
   The bell sits directly left of the person button (rec-notify.js puts it there on every page, phone and desktop). The bell wears the unread count; the person button
   wears the same count as a small red badge, so the count is visible even when the bell is not looked at. Red is only ever the badge (and the shield slice). */
html body header.site-header .header-inner .header-actions > .xn-bell { order: 4 !important; margin-inline-end: -.1rem; }
html body header.site-header .header-inner .header-actions > :is(.chip-menu, #userChipWrap) { order: 4 !important; }
html body header.site-header .xn-bell { position: relative; overflow: visible !important; }
html body header.site-header .xn-bell .xn-badge, html body header.site-header .user-chip .xn-dot {
  position: absolute !important; top: -5px !important; right: -5px !important; left: auto !important; min-width: 17px; height: 17px; box-sizing: border-box; padding: 0 4px;
  border-radius: 999px !important; background: rgb(212, 42, 37) !important; color: rgb(255, 255, 255) !important; -webkit-text-fill-color: rgb(255, 255, 255); border: 1.5px solid rgb(255, 255, 255);
  font: 700 10px/14px system-ui, sans-serif !important; letter-spacing: 0; text-align: center; pointer-events: none; z-index: 2; display: block; mask: none !important; -webkit-mask: none !important;
}
html body header.site-header .xn-bell .xn-badge[hidden] { display: none !important; }
html body header.site-header .user-chip { position: relative; overflow: visible !important; }
html body header.site-header .user-chip .xn-dot-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; font-size: 1px !important; }

/* Speed row (Auto / Lite / Full): three short buttons on one line */
html body .site-header .chip-drop .xa-th.xa-sp { grid-template-columns: repeat(3, 1fr); }
