/* v103: one header layout for every screen width. Loaded last on accounts.html, so it replaces the older header rules
   in styles.css and site-shell.css. Every header control is 40px tall with the same radius and border.
   Three widths:
   - wide (901px and up): brand, centered menu, language, Discord, account
   - tablet and phone (900px and down): language and Discord move into the ⋮ menu
   - small phone (720px and down): the menu drops to a full-width row under the brand */

body:not(.admin-page) .site-header {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-items: center !important;
  gap: 10px 18px !important;
  box-sizing: border-box;
  width: 100%;
  min-height: 66px !important;
  height: auto !important;
  margin: 0;
  padding: 10px clamp(14px, 3vw, 40px) !important;
  position: sticky !important;
  inset-block-start: 0;
  z-index: 40 !important;
  background: rgb(9 11 24 / 84%) !important;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgb(175 178 220 / 12%) !important;
}
body:not(.admin-page) .site-header::after { display: none !important; }

/* Brand */
body:not(.admin-page) .site-header .brand {
  display: inline-flex !important;
  align-items: center;
  gap: 11px;
  min-width: 0;
  margin: 0 !important;
  color: #f1eeff;
  text-decoration: none;
}
body:not(.admin-page) .site-header .brand-seal { width: 40px !important; height: 40px !important; }
body:not(.admin-page) .site-header .brand-seal-image > img { width: 100%; height: 100%; border: 0; border-radius: 12px; object-fit: cover; }
body:not(.admin-page) .site-header .brand-seal i { display: none; }
body:not(.admin-page) .site-header .brand-name { display: grid !important; gap: 0; min-width: 0; }
body:not(.admin-page) .site-header .brand-name strong { overflow: hidden; color: #f1eeff; font-size: 16px; font-weight: 800; letter-spacing: 0; text-overflow: ellipsis; white-space: nowrap; }
body:not(.admin-page) .site-header .brand-name small { display: none !important; }

/* Menu */
body:not(.admin-page) .site-header .top-nav {
  display: flex !important;
  justify-self: center;
  align-items: center;
  gap: 4px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: none !important;
}
body:not(.admin-page) .site-header .top-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: none;
  color: #aeb2c8;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
body:not(.admin-page) .site-header .top-nav-link:hover { background: rgb(166 145 255 / 10%); color: #eee9ff; }
body:not(.admin-page) .site-header .top-nav-link.is-current { border-color: rgb(166 145 255 / 26%); background: rgb(166 145 255 / 16%); color: #f4f0ff; }

/* Action buttons: all the same height, radius and border */
body:not(.admin-page) .site-header .header-actions {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 0 !important;
  justify-self: end;
}
body:not(.admin-page) .site-header .language-toggle,
body:not(.admin-page) .site-header .discord-link,
body:not(.admin-page) .site-header .overflow-trigger,
body:not(.admin-page) .site-header .login-chip-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  box-sizing: border-box;
  height: 40px;
  min-width: 40px;
  margin: 0;
  padding: 0 13px;
  border: 1px solid #373b56;
  border-radius: 11px;
  background: #15182b;
  color: #e7e2fa;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease;
}
body:not(.admin-page) .site-header .discord-link { border-color: rgb(112 149 255 / 38%); background: rgb(85 111 207 / 14%); }
body:not(.admin-page) .site-header .overflow-trigger,
body:not(.admin-page) .site-header .login-chip-trigger { width: 40px; padding: 0; }
body:not(.admin-page) .site-header .language-toggle:hover,
body:not(.admin-page) .site-header .discord-link:hover,
body:not(.admin-page) .site-header .overflow-trigger:hover,
body:not(.admin-page) .site-header .login-chip-trigger:hover,
body:not(.admin-page) .site-header .header-overflow[open] .overflow-trigger { border-color: #8b79c7; background: #1d2037; }
body:not(.admin-page) .site-header .overflow-trigger .icon { width: 19px; height: 19px; }
body:not(.admin-page) .site-header .login-chip,
body:not(.admin-page) .site-header .login-chip-menu { display: inline-flex; align-items: center; }
body:not(.admin-page) .site-header .login-chip-avatar { width: 30px; height: 30px; }
body:not(.admin-page) .site-header .login-chip-link { height: 40px; box-sizing: border-box; display: inline-flex; align-items: center; }
body:not(.admin-page) .site-header .overflow-phone-item { display: flex; }

/* Wide: language, "เข้าร่วม Discord" (hire the farm) and the customer login sit side by side.
   Login is the primary action (filled), Discord is secondary (outlined). The ⋮ menu is only for small screens. */
body:not(.admin-page) .site-header .header-overflow { display: none; }
body:not(.admin-page) .site-header .login-chip-link {
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, #8b79c7 0%, #5c8dff 100%);
  box-shadow: 0 6px 18px rgb(92 141 255 / 24%);
  color: #ffffff;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
  transition: filter .16s ease, box-shadow .16s ease;
}
body:not(.admin-page) .site-header .login-chip-link:hover { filter: brightness(1.08); box-shadow: 0 8px 22px rgb(92 141 255 / 32%); }

/* Tablet and phone: language and Discord move into the ⋮ menu */
@media (max-width: 900px) {
  body:not(.admin-page) .site-header .language-toggle,
  body:not(.admin-page) .site-header .discord-link { display: none !important; }
  body:not(.admin-page) .site-header .header-overflow { display: block !important; position: relative; }
  body:not(.admin-page) .site-header .overflow-phone-item { display: flex; }
  body:not(.admin-page) .overflow-popover { z-index: 60; }
}

/* Small phone: the menu takes a full-width row under the brand */
@media (max-width: 720px) {
  body:not(.admin-page) .site-header { grid-template-columns: minmax(0, 1fr) auto !important; gap: 10px !important; padding: 10px 14px !important; }
  body:not(.admin-page) .site-header .top-nav {
    grid-column: 1 / -1;
    order: 3;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-self: stretch;
    width: 100%;
    gap: 6px !important;
  }
  body:not(.admin-page) .site-header .top-nav-link { width: 100%; padding: 0 10px; }
  body:not(.admin-page) .site-header .login-chip-extra { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.admin-page) .site-header .top-nav-link,
  body:not(.admin-page) .site-header .language-toggle,
  body:not(.admin-page) .site-header .discord-link,
  body:not(.admin-page) .site-header .overflow-trigger,
  body:not(.admin-page) .site-header .login-chip-trigger { transition: none; }
}

/* v109: the profile tab for "จัดการ" stays hidden unless the customer owns the account. */
.profile-tab[hidden] { display: none !important; }

/* v109: phone bottom bar (like an iPhone tab bar). The top menu is replaced by it on small screens. */
.bottom-tabs { display: none; }
@media (max-width: 720px) {
  body:not(.admin-page) .site-header .top-nav { display: none !important; }
  .bottom-tabs {
    position: fixed;
    inset-inline: 0;
    inset-block-end: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    border-top: 1px solid rgb(175 178 220 / 12%);
    background: rgb(9 11 24 / 92%);
    backdrop-filter: blur(16px);
  }
  .bottom-tabs a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 0 4px;
    border-radius: 12px;
    color: #8f89ad;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
  }
  .bottom-tabs a svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .bottom-tabs a[aria-current="page"] { color: #f4f0ff; }
  .bottom-tabs a[aria-current="page"] svg { stroke: #b7a6ff; }
  .bottom-tabs a:focus-visible { outline: 2px solid #8b79c7; outline-offset: 2px; }
  body:not(.admin-page) { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
}

/* v109: "ไอดีของฉัน" in the top menu (wide screens) is hidden until the customer is logged in. */
.top-nav-link[hidden] { display: none !important; }
