/* =========================================================
   Everjoy Global Styles — Cleaned & Organized
   Sections:
   1.  Design Tokens & Base
   2.  Layout & Typography Utilities
   3.  Buttons, Chips & Inputs
   4.  Footer
   5.  Forms, Errors & A11y Helpers
   6.  Toasts & Modals
   7.  Busy Overlay / Spinner
   8.  Global Header (Gradient Navbar)
   9.  App-style Header (.site-header-app)
   10. Mobile Bottom Tabbar
   11. Admin Shell
   12. Notification Dots
   13. FOUC / Booting Guards
========================================================= */

/* ================================
   1) DESIGN TOKENS & BASE
================================== */

:root {
  --bg: #f6f8fb;
  --ink: #0f172a;
  --muted: #5b677a;
  --line: #e5e7eb;
  --border: #e5e7eb;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --brandFrom: #025fbc;
  --brandTo: #06a2dd;
  --primary-gradient: linear-gradient(90deg, var(--brandFrom), var(--brandTo));

  --card: #ffffff;
  --ring: #e9eef6;

  --shadow: 0 10px 28px rgba(2, 95, 188, 0.10);
  --shadow-strong: 0 14px 40px rgba(15, 23, 42, 0.18),
                   0 6px 18px rgba(2, 95, 188, 0.12);

  /* Global content width cap (header + hero + sections) */
  --wrap-max: 1600px;
  /* bump this later if you want it even wider (e.g. 1440px or 1600px) */

  /* Header icon sizing */
  --nav-icon-size: 48px;    /* desktop/tablet */
  --nav-icon-size-sm: 44px; /* ≤560px */
  --nav-icon-size-xs: 38px; /* ≤380px */
  --nav-icon-glyph: 28px;   /* inner SVG size */
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
}

body {
  color: var(--ink);
  font-family: Poppins, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  max-width: 100%;
  overflow-x: hidden;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ================================
   2) LAYOUT & TYPOGRAPHY UTILITIES
================================== */

/* Global content container: centered with 4vw side padding */
.wrap {
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding-inline: 4vw; /* matches header padding so edges line up */
}

.wrap--flush-left { padding-left: 0; }
.wrap--flush-right { padding-right: 0; }
.wrap--no-pad { padding: 0; }

/* Mobile: light guard so text never hugs the edge */
@media (max-width: 640px) {
  .wrap--flush-left { padding-left: 16px; }
  .wrap--flush-right { padding-right: 16px; }
}

.section { padding: 44px 0; }

#popular.section { padding-top: 72px; } /* extra space from header */

.kicker {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

h1, h2 { margin: 0; }
h2 {
  font-size: 28px;
  letter-spacing: -0.01em;
}

.muted { color: var(--muted); }

.see {
  color: #025fbc;
  font-weight: 600;
  white-space: nowrap;
}

.row-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

/* Role-based visibility used across the app */
.auth-guest .user-only { display: none !important; }
.auth-user  .guest-only { display: none !important; }

/* ================================
   3) BUTTONS, CHIPS & INPUTS
================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn.primary {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.btn.cta {
  background: linear-gradient(135deg, var(--brandFrom), var(--brandTo));
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

/* Global hover pop for main buttons */
button.btn,
a.btn,
.btn-ghost,
.btn-with-icon {
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

button.btn:hover,
button.btn:focus-visible,
a.btn:hover,
a.btn:focus-visible,
.btn-ghost:hover,
.btn-ghost:focus-visible,
.btn-with-icon:hover,
.btn-with-icon:focus-visible {
  transform: scale(1.04);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

/* Opt-out helper */
.no-scale.btn,
.no-scale.btn-ghost,
.no-scale.btn-with-icon {
  transform: none !important;
  box-shadow: none !important;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f3f6fb;
  border: 1px solid #e6ebf4;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12.5px;
}

/* Simple login button (used in legacy sections + app header) */
.login-btn {
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: none;
  background: #111827;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

/* ================================
   4) FOOTER
================================== */

#site-footer {
  background: linear-gradient(180deg, #131313 0%, #181818 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  color: #dbe4f0;
}

#site-footer .footer-pad {
  padding-top: 48px;
  padding-bottom: 48px;
}

/* Columns */
#site-footer .grid {
  display: grid;
  gap: 28px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 960px) {
  #site-footer .grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  #site-footer .grid { grid-template-columns: 1fr; }
  #site-footer { padding-bottom: 80px; }
}

/* Brand block */
#site-footer .brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

#site-footer .logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #fff;
  color: #1d4ed8;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

#site-footer .name {
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
}

#site-footer .tag {
  color: #cbd5e1;
  font-size: 12px;
  margin-top: 2px;
}

#site-footer .brand-copy {
  margin-top: 14px;
  max-width: 36ch;
}

/* Columns / links */
#site-footer h4 {
  color: #fff;
  font-weight: 600;
  margin: 0 0 10px;
  font-size: 15px;
}

#site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

#site-footer a {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
}
#site-footer a:hover { color: #fff; }

/* Newsletter */
#site-footer .nl {
  display: flex;
  gap: 8px;
}

#site-footer .nl-input {
  height: 46px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: #0f172a;
  outline: none;
  padding: 0 0.9rem;
  flex: 1 1 auto;
}

#site-footer .nl-input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

#site-footer .nl-btn {
  height: 46px;
  border-radius: 12px;
  background: #fff;
  color: #153463;
  font-weight: 600;
  padding: 0 1rem;
  border: 0;
  cursor: pointer;
}
#site-footer .nl-btn:hover { background: #f3f4f6; }

/* Bottom bar */
#site-footer .footer-bar {
  max-width: 1350px;
  margin: 0 auto;
  padding: 20px 4vw;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
}

#site-footer .footer-legal {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

#site-footer .footer-legal a {
  color: #cbd5e1;
  font-size: 0.95rem;
}
#site-footer .footer-legal a:hover { color: #fff; }

@media (max-width: 640px) {
  #site-footer .footer-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Mobile footer adjustments */
@media (max-width: 560px) {
  #site-footer .wrap { padding-inline: 16px; }
  #site-footer .footer-pad { padding-top: 28px; padding-bottom: 28px; }
  #site-footer .grid { gap: 16px; }
}

/* ================================
   5) FORMS, ERRORS & A11Y HELPERS
================================== */

.field-error {
  color: #b91c1c;
  font-size: 0.875rem;
  margin: 0.25rem 0 0;
}

[aria-invalid="true"] {
  outline: 2px solid #b91c1c;
  outline-offset: 2px;
}

/* Screen-reader only */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Keyboard-only focus rings (html gets .kbd after first Tab) */
.kbd :focus-visible {
  outline: 2px solid #1e90ff;
  outline-offset: 2px;
  border-radius: 6px;
}

:not(.kbd) :focus-visible { outline: none !important; }

:focus:not(:focus-visible) { outline: none !important; }

/* Skip link */
.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  z-index: 9999;
  background: #0b5fff;
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}
.skip-link:focus { top: 8px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Main content outline only for keyboard users */
#mainContent:focus:not(:focus-visible) { outline: 0; }

.kbd #mainContent:focus-visible {
  outline: 2px solid var(--focus-ring, #2563eb);
  outline-offset: 4px;
}

/* ================================
   6) TOASTS & MODALS
================================== */

/* Toast stack (old global system) */
#toastHost {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 9999;
  display: grid;
  gap: 10px;
  width: min(92vw, 360px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 10px;
  align-items: start;
  background: #fff;
  border: 1px solid var(--ring);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px;
}

.toast .bar {
  border-radius: 10px;
  background: linear-gradient(180deg, var(--brandFrom), var(--brandTo));
}

.toast .title {
  font-weight: 600;
  margin-bottom: 2px;
}
.toast .msg {
  color: var(--muted);
  line-height: 1.3;
}

.toast .close,
.toast .action {
  background: none;
  border: 0;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  font-weight: 600;
}

.toast.t-success { border-color: #10b98133; }
.toast.t-error  { border-color: #ef444433; }
.toast.t-info   { border-color: #3b82f633; }

@media (prefers-reduced-motion: no-preference) {
  #toastHost .toast {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  #toastHost .toast.show {
    opacity: 1;
    transform: translateY(0);
  }
  #toastHost .toast.hide {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 600px) {
  #toastHost {
    right: 50%;
    transform: translateX(50%);
    bottom: 12px;
  }
}

/* Screen reader region for toasts */
#toastSR {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* New centered toast (Saved, etc.) */
#ejCenterToastHost {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10000;
  display: grid;
  gap: 10px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.ej-center-toast {
  pointer-events: auto;
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 14px;
  box-shadow: var(--shadow-strong);
  padding: 16px;
  opacity: 0;
  transform: scale(0.96) translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  will-change: opacity, transform;
}

.ej-center-toast.show {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.ej-center-toast .hd {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 6px;
}

.ej-center-toast .bd {
  color: #cbd5e1;
  font-size: 14px;
  margin-bottom: 10px;
}

.ej-center-toast .ft {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.ej-center-toast .btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}
.ej-center-toast .btn.primary { background: #fff; color: #0f172a; }
.ej-center-toast .btn.ghost {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

/* Simple dark toast (requests/messages) */
#ej-toast-stack {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 9999;
  display: grid;
  gap: 8px;
}

.ej-toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.ej-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Auth modals (old + new unified) */
#authPrompt::backdrop,
#forgotPrompt::backdrop,
#ejAuthModal .backdrop {
  background: rgba(15, 23, 42, 0.45);
}

#authPrompt,
#forgotPrompt {
  border: 0;
  padding: 0;
  width: min(420px, 92vw);
  border-radius: 16px;
  box-shadow: var(--shadow);
  background: transparent;
}

.auth-modal {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
}
.auth-modal .hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.auth-modal .hd h3 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.auth-modal .bd {
  margin-top: 8px;
  color: var(--muted);
}
.auth-modal .ft {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}
.auth-modal .btn {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--ring);
  background: #fff;
  font-weight: 600;
}
.auth-modal .btn.primary {
  background: linear-gradient(
    90deg,
    var(--brandFrom, #025fbc),
    var(--brandTo, #06a2dd)
  );
  color: #fff;
  border: 0;
}

/* New auth modal */
#ejAuthModal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
#ejAuthModal[open] { display: flex; }

#ejAuthModal .panel {
  position: relative;
  z-index: 1;
  width: min(480px, calc(100% - 32px));
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 20px 20px 16px;
  box-shadow: 0 24px 72px rgba(2, 34, 62, 0.25);
}
#ejAuthModal .panel h3 {
  margin: 0 0 6px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}
#ejAuthModal .panel p {
  margin: 0 0 16px;
  color: #475569;
}

#ejAuthModal .actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

#ejAuthModal .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  font-weight: 700;
  text-decoration: none;
}

#ejAuthModal .btn-primary {
  background: #0b1220;
  color: #fff;
  border: 0;
}
#ejAuthModal .btn-ghost {
  background: #fff;
  color: #0f172a;
  border: 1px solid #e5e7eb;
}

#ejAuthModal .close-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #0f172a;
  font-size: 18px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
#ejAuthModal .close-x:focus-visible {
  outline: 2px solid #025fbc55;
  outline-offset: 2px;
}

/* Legacy auth-required overlay */
#authOverlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  z-index: 5000;
}
#authOverlay.show { display: flex; }

#authModal {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.20);
  width: min(92vw, 420px);
  padding: 20px;
}

#authModal h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #0f172a;
}
#authModal p {
  margin: 0 0 16px;
  font-size: 14px;
  color: #334155;
}
#authModal .actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ================================
   7) BUSY OVERLAY / SPINNER
================================== */

.ej-busy-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.66);
  backdrop-filter: saturate(120%) blur(1.5px);
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.ej-busy-overlay.is-on {
  opacity: 1;
  pointer-events: auto;
}

.ej-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(2, 95, 188, 0.18);
  border-top-color: var(--ej-brand, #025fbc);
  border-radius: 50%;
  animation: ejSpin 0.8s linear infinite;
}

@keyframes ejSpin {
  to { transform: rotate(360deg); }
}

/* ================================
   8) GLOBAL HEADER (GRADIENT NAVBAR)
================================== */

/* Header element & spacer (used by global.js for pinning) */
/* Fixed gradient header — base visuals only.
   Positioning + scroll behavior now live in header.html */

.header-spacer {
  height: var(--header-h, 88px);
  pointer-events: none !important;
  border: 0;
  box-shadow: none;
  /* match page background so it doesn't show as a colored bar */
  background: var(--bg, #f6f8fb);
}

/* Core layout — align header with global .wrap */
.navbar .nav-container,
#siteHeader .nav-container {
  width: 100%;
  max-width: var(--wrap-max);  /* same cap as .wrap */
  box-sizing: border-box;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
  padding-inline: 4vw;        /* same side padding as .wrap */
}

/* Header container on tablet/mobile: full-width with side padding */
@media (max-width: 960px) {
  .navbar .nav-container,
  #siteHeader .nav-container {
    width: 100%;
    max-width: none;
    padding-inline: 16px;
  }
}


/* Logo / wordmark */
.navbar .nav-logo,
#siteHeader .nav-logo {
  font-weight: 700;
  font-size: 1.7rem;
  color: #fff;
  white-space: nowrap;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Image logo in nav — keep aspect ratio (no stretch) */
.nav-logo-img {
  display: block;
  height: 36px;
  width: auto;
}

/* Slightly smaller on tiny screens */
@media (max-width: 480px) {
  .nav-logo-img { height: 30px; }
}

/* Left nav links */
.navbar .nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.navbar .nav-links a {
  text-decoration: none;
  color: rgb(255, 255, 255);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.15s ease;
}
.navbar .nav-links a:hover,
.navbar .nav-links a.is-active,
.navbar .nav-links a[aria-current="page"] {
  color: #fff;
}

/* Right rail */
.nav-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: unset;
  white-space: nowrap;
  flex: 0 0 auto;
}

/* CTA pills in header */
.navbar .btn {
  font-weight: 700;
  font-size: 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.navbar .btn-primary,
.navbar .btn-secondary-dark {
  background: #fff;
  color: var(--brandFrom);
}
.navbar .btn-primary:hover,
.navbar .btn-secondary-dark:hover {
  background: rgba(255, 255, 255, 0.92);
}

.navbar .btn-secondary {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}
.navbar .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.10);
}

/* Partner CTA: white pill with brand blue text */
.navbar #partnerCta {
  background: #fff !important;
  color: var(--brandFrom) !important;
  border-color: #fff !important;
}

/* Unified hamburger & avatar buttons */
#menuBtn,
#avatarBtn {
  width: var(--nav-icon-size) !important;
  height: var(--nav-icon-size) !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255, 255, 255, 0.45) !important;
  background: rgba(255, 255, 255, 0.12) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: right !important;
  color: #fff;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease,
    border-color 0.18s ease, background 0.18s ease;
}

#menuBtn svg,
#accountMenu #avatarFallback svg {
  width: var(--nav-icon-glyph) !important;
  height: var(--nav-icon-glyph) !important;
  display: block !important;
}

#menuBtn:hover,
#avatarBtn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(2, 95, 188, 0.18);
  border-color: rgba(255, 255, 255, 0.65);
  background: rgba(255, 255, 255, 0.16);
}

/* Desktop: no hamburger */
@media (min-width: 961px) {
  #menuBtn { display: none !important; }
}

/* Mobile / mid-width tweaks */
@media (max-width: 960px) {
  .navbar { padding: 6px 20px; }
  .navbar .nav-links { display: none !important; }
  #menuBtn { display: inline-flex !important; }
}

@media (max-width: 560px) {
  #menuBtn,
  #avatarBtn {
    width: var(--nav-icon-size-sm) !important;
    height: var(--nav-icon-size-sm) !important;
  }
  #menuBtn svg,
  #accountMenu #avatarFallback svg {
    width: 24px !important;
    height: 24px !important;
  }
}

@media (max-width: 380px) {
  #menuBtn,
  #avatarBtn {
    width: var(--nav-icon-size-xs) !important;
    height: var(--nav-icon-size-xs) !important;
  }
  #menuBtn svg,
  #accountMenu #avatarFallback svg {
    width: 22px !important;
    height: 22px !important;
  }
}

/* Hide big CTAs on tablet + mobile */
@media (max-width: 960px) {
  #partnerCta,
  #planEventCta {
    display: none !important;
  }
}

/* Hide Sign in only on smaller phones */
@media (max-width: 640px) {
  #linkLogin {
    display: none !important;
  }
}


/* Avatar image fallback handling */
#avatarImg { display: none; width: 100%; height: 100%; object-fit: cover; border-radius: 999px; }
#avatarFallback { font-weight: 700; line-height: 1; }
.account-menu #avatarImg[src] { display: block; }
.account-menu #avatarImg[src] + #avatarFallback { display: none; }

/* Account menu container (used by header-auth.js) */
.account-menu { position: relative; margin-left: 8px; }
.account-menu .dropdown,
#accountDropdown,
.site-header .account-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  max-width: min(92vw, 320px);
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: saturate(1.05) blur(6px);
  border: 1px solid rgba(2, 16, 32, 0.08);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(2, 95, 188, 0.16), 0 6px 18px rgba(15, 23, 42, 0.10);
  padding: 8px;
  z-index: 2147483001;
  overflow: hidden;
}

#accountMenu.open #accountDropdown,
.account-menu.open .dropdown,
.site-header .account.open .account-menu {
  display: block !important;
}

#accountDropdown a,
#accountDropdown button,
.site-header .account-menu a,
.site-header .account-menu button,
.account-menu .dropdown a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  border: 0;
  font: 600 14px Poppins, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.08s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#accountDropdown a:hover,
#accountDropdown button:hover,
.site-header .account-menu a:hover,
.site-header .account-menu button:hover,
.account-menu .dropdown a:hover {
  background: #f8fafc;
}

#accountDropdown .danger,
.site-header .account-menu #logoutBtn {
  color: #b91c1c;
}
#accountDropdown .danger:hover,
.site-header .account-menu #logoutBtn:hover {
  background: #fef2f2;
}

/* Keep dropdown above everything */
#accountMenu { position: relative; z-index: 2147483000; }
#accountDropdown,
.site-header .account-menu {
  pointer-events: auto !important;
}

/* Role-driven visibility (wired to header-auth.js) */
html.auth-unknown #accountMenu,
html.auth-unknown #partnerCta,
html.auth-unknown #planEventCta,
html.auth-unknown #linkLogin {
  visibility: hidden;
}

/* Guest */
html.role-guest #accountMenu { display: none !important; }
html.role-guest #linkLogin { display: inline-flex !important; }
html.role-guest #partnerCta,
html.role-guest #planEventCta { display: inline-flex !important; }

/* Client */
html.role-client #accountMenu { display: inline-flex !important; }
html.role-client #linkLogin { display: none !important; }
html.role-client #partnerCta,
html.role-client #planEventCta { display: inline-flex !important; }

/* Partner/Admin */
html.role-partner #accountMenu,
html.role-admin   #accountMenu { display: inline-flex !important; }

html.role-partner #linkLogin,
html.role-admin   #linkLogin { display: none !important; }

html.role-partner #partnerCta,
html.role-admin   #partnerCta,
html.role-partner #planEventCta,
html.role-admin   #planEventCta { display: none !important; }


/* ================================
   9) APP-STYLE HEADER (.site-header-app)
================================== */

.site-header-app {
  background: var(--primary-gradient);
  color: #ffffff;
}

/* Ensure Poppins everywhere inside this header */
.site-header-app,
.site-header-app * {
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

/* Top bar inside app header — aligned with global .wrap */
.site-header-app .top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;

  /* Use the same width system as .wrap so hero + header line up */
  width: 100%;
  margin: 0 auto;
  padding-block: 18px;
  padding-inline: 4vw;

  /* IMPORTANT: prevent width:100% + padding from overflowing viewport */
  box-sizing: border-box;
}

/* Left brand block */
.site-header-app .top-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

/* Brand lockup containing the logo image (no stretch) */
.brand-lockup {
  display: inline-flex;
  align-items: center;
}
.site-header-app .brand-logo {
  display: block;
  height: 38px;  /* larger at rest */
  width: auto;
  padding-right: 20px;
  object-fit: contain;
}
/* Search bar in blue header (app header + main header) */
/* Header search: compact, Airbnb-style pill */
.site-header-app .search-bar,
#siteHeader .search-bar {
  flex: 0 1 520px;           /* target size, not full-width */
  max-width: 520px;
  min-width: 320px;

  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin-inline: 16px;       /* breathing room around search */
  border-radius: 999px;

  background: rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.55);
  color: #e5e7eb;
}

/* On narrower laptops/tablets, let it flex a bit more */
@media (max-width: 1200px){
  .site-header-app .search-bar,
  #siteHeader .search-bar {
    flex: 1 1 auto;
    max-width: none;
    margin-inline: 8px;
  }
}

.site-header-app .search-bar .icon,
#siteHeader .search-bar .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #e2e8f0;
}

.site-header-app .search-bar input,
#siteHeader .search-bar input {
  border: none;
  outline: none;
  background: transparent;
  font-size: 13px;
  width: 100%;
  color: #f9fafb;
}
.site-header-app .search-bar input::placeholder,
#siteHeader .search-bar input::placeholder {
  color: rgba(226, 232, 240, 0.85);
}

/* Right-side nav chips + CTA pills */
.site-header-app .top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: nowrap;
  min-width: 0;
}

.site-header-app .primary-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

.site-header-app .nav-chip {
  font-size: 15px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #ffffff;
  white-space: nowrap;
  opacity: 0.9;
}

.site-header-app .nav-chip:hover {
  opacity: 1;
}

.site-header-app .nav-chip.active {
  background: rgba(15, 23, 42, 0.22);
  color: #ffffff;
  font-weight: 600;
}

/* Start Planning pill — matches white CTA style */
.site-header-app .start-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: #ffffff;
  color: #0f172a;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
  white-space: nowrap;
}
.site-header-app .start-btn:hover {
  background: #f9fafb;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.30);
}

/* Login pill beside Start Planning */
.site-header-app .login-btn {
  padding: 8px 20px;
  border-radius: 999px;
  border: none;
  background: #0f172a;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* App-style header: collapse nav chips + Start on tablet/mobile */
@media (max-width: 960px) {
  .site-header-app .primary-nav,
  .site-header-app .start-btn {
    display: none !important;
  }

  .site-header-app .top-actions {
    gap: 8px;
  }
}

/* Compact header on small screens */
@media (max-width: 640px) {

  /* keep app header strictly inside the viewport on phones */
  .site-header-app .top-bar {
    max-width: 100vw;
    margin: 0;
    padding-inline: 12px;
    box-sizing: border-box;
  }

  /* spacer height comes from inline style (header.js), not CSS */
  .header-spacer {
    height: auto;
  }

  .navbar .nav-container,
  #siteHeader .nav-container {
    padding-inline: 12px;
    gap: 12px;
  }

  /* smaller avatar / menu buttons */
  #menuBtn,
  #avatarBtn {
    width: 34px !important;
    height: 34px !important;
  }

  #menuBtn svg,
  #accountMenu #avatarFallback svg {
    width: 20px !important;
    height: 20px !important;
  }

  /* keep header search hidden on mobile */
  #siteHeader .search-bar,
  .site-header-app .search-bar {
    display: none !important;
  }
}

/* Small tweak for narrower widths */
@media (max-width: 820px) {
  .site-header-app .top-bar {
    max-width: none;
    padding-block: 12px;
    padding-inline: 16px;
  }

  .site-header-app .search-bar,
  #siteHeader .search-bar {
    max-width: none;
  }
}

/* Extra-compact on small phones */
@media (max-width: 480px) {
  .site-header-app .top-bar {
    padding-block: 10px;
    padding-inline: 12px;
  }

  .site-header-app .brand-logo {
    height: 32px;
  }
}

/* Left cluster: logo + small tagline */
#siteHeader .nav-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-width: 0;
}

/* Tagline under logo (reuses brand-sub style) */
#siteHeader .brand-sub {
  font-size: 11px;
  color: rgba(241, 245, 249, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Let actions stay tight on the right */
#siteHeader .nav-actions {
  flex: 0 0 auto;
}

/* Force mobile header icons flush-right (override page-specific styles) */
@media (max-width: 969px) {
  #siteHeader .nav-container {
    padding-right: 0 !important;
  }

  #siteHeader .nav-actions {
    margin-right: 0 !important;
  }

  /* Remove any extra margin from the hamburger on mobile */
  #siteHeader #menuBtn.icon-btn {
    margin: 0 !important;
  }
}

/* ================================
   11) ADMIN SHELL
================================== */

.admin-shell {
  --aside-w: 240px;
  display: grid;
  grid-template-columns: var(--aside-w) 1fr;
  gap: 24px;
  max-width: 1500px;
  margin: 10px auto 40px;
  padding-top: 80px;
  padding-bottom: 50px;
}

.admin-aside {
  position: sticky;
  top: calc(var(--header-h, 72px) + 12px);
  align-self: start;
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 14px;
  height: fit-content;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  text-decoration: none;
  color: inherit;
}

.admin-brand .logo {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, var(--brandFrom), var(--brandTo));
}

.admin-nav { display: grid; gap: 6px; margin: 10px 0; }
.admin-nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  color: #0f172a;
}
.admin-nav a:hover { background: #f5f7fb; }
.admin-nav a.is-active { background: #0f172a; color: #fff; }

.admin-main { min-width: 0; }

.admin-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0 10px;
}
.admin-topbar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.admin-topbar .muted {
  margin-top: 2px;
  font-size: 13px;
}

.admin-actions { display: flex; gap: 10px; }

.btn.ghost {
  padding: 10px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #e2e8f0;
  color: #0f172a;
  font-weight: 600;
}

.admin-kpis {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}
@media (max-width: 960px) {
  .admin-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .admin-kpis { grid-template-columns: 1fr; }
}

.kpi {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  padding: 14px;
}
.kpi-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.kpi-num {
  font-size: 28px;
  font-weight: 800;
  margin-top: 6px;
}
.kpi-sub {
  color: #64748b;
  font-size: 12px;
  margin-top: 2px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
}
@media (max-width: 1040px) {
  .admin-grid { grid-template-columns: 1fr; }
}

.table-wrap { overflow: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th,
.table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #eef2f6;
}
.table th {
  color: #475569;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.glance { display: grid; gap: 12px; }
.glance-row { display: grid; gap: 6px; }
.glance-label {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.glance-bar {
  height: 8px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
  position: relative;
}
.glance-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brandFrom), var(--brandTo));
}

/* Small screens: stack aside above main */
@media (max-width: 840px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }
  .admin-aside {
    position: relative;
    top: 0;
  }
}

/* ================================
   12) NOTIFICATION DOTS
================================== */

.nav-notif-dot,
.notif-badge,
.bell-dot,
.notification-dot,
.notif-dot,
.nav-dot,
[data-notif-dot] {
  background: #f59e0b !important;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

/* ================================
   13) FOUC / BOOTING GUARDS
================================== */

/* Hide main content + footer while booting, keep header mount visible */
.booting main,
.booting section,
.booting #siteFooterMount {
  visibility: hidden;
}

/* Reserve vertical space under fixed header */
.booting body {
  padding-top: var(--header-h, 88px);
}

/* Reveal once boot completes */
html:not(.booting) #siteFooterMount,
html:not(.booting) main,
html:not(.booting) section {
  visibility: visible;
}

/* Ensure dropdowns always show when opened – support all markup patterns */
#accountMenu.open #accountDropdown,
.site-header .account.open .account-menu,
.account-menu.open .dropdown,
.account-menu.open,
#accountDropdown.open {
  display: block !important;
}

/* Safety for [hidden] attributes */
[hidden],
.site-search-list[hidden] {
  display: none !important;
}

/* =========================================================
   MOBILE MENU & TAB BAR OVERRIDES
   Add this to the END of global.css to fix visibility issues
========================================================= */

/* Force mobile menu to respect JS state */
#mobileMenu {
  display: none !important;
}

#mobileMenu[data-open="1"],
#mobileMenu.is-open {
  display: block !important;
}

/* Force tab bar to always be visible on mobile, even during boot */
@media (max-width: 960px) {
  #mbTabbar {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  
  /* Override booting class for tab bar specifically */
  .booting #mbTabbar,
  html.booting #mbTabbar {
    visibility: visible !important;
    opacity: 1 !important;
  }
}

/* Ensure tab items display based on role classes */
#mbTabbar .tab {
  display: none; /* Hidden by default */
}

/* Show tabs based on role */
html.role-guest #mbTabbar .tab[data-roles~="guest"],
html.auth-guest #mbTabbar .tab[data-roles~="guest"] {
  display: grid !important;
}

html.role-client #mbTabbar .tab[data-roles~="client"],
html.auth-user:not(.role-partner):not(.role-admin) #mbTabbar .tab[data-roles~="client"] {
  display: grid !important;
}

html.role-partner:not(.role-admin) #mbTabbar .tab[data-roles~="partner"] {
  display: grid !important;
}

html.role-admin #mbTabbar .tab[data-roles~="admin"] {
  display: grid !important;
}

/* Tab bar should never be hidden by [hidden] attribute once roles are set */
#mbTabbar[hidden] {
  display: flex !important;
}

@media (max-width: 960px) {
  #mbTabbar .tab[hidden] {
    display: none !important; /* Individual tabs can still be hidden */
  }
}

/* Mobile menu dropdown positioning - ensure it's above everything */
#mobileMenu {
  z-index: 10000 !important;
}

/* Ensure hamburger button is always clickable */
#menuBtn {
  pointer-events: auto !important;
  z-index: 10001 !important;
}

/* Debug helper - remove after testing */
/* Uncomment these to see what's happening:

#mbTabbar {
  border: 3px solid red !important;
  background: rgba(255, 0, 0, 0.1) !important;
}

#mobileMenu {
  border: 3px solid blue !important;
  background: rgba(0, 0, 255, 0.1) !important;
}

*/
