/* =========================================================
   HEADER WRAPPER
   ========================================================= */

.site-header {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--header-bg, #0f1115);
    border-bottom: 1px solid var(--header-border, rgba(77, 163, 255, 0.15));
    height: 64px;
    display: flex;
    align-items: center;
}

.header-inner {
    max-width: 1200px;
    width: 100%;
    margin-inline: auto;
    padding-inline: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

/* =========================================================
   LOGO
   ========================================================= */

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    text-decoration: none;
    white-space: nowrap;
    letter-spacing: -0.01em;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.logo:hover {
    color: #4DA3FF;
}

.site-header .logo img {
    width: 200px;
    height: auto;
    max-width: 100%;
    display: block;
    transition: opacity 0.2s ease;
}

.site-header .logo:hover img { opacity: 0.85; }

/* =========================================================
   PRIMARY NAV
   ========================================================= */

.main-nav {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links li {
    position: relative;
}

.nav-links li a {
    display: block;
    padding: 8px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 6px;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-link {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: var(--text-sm, 0.8125rem);
    font-weight: 600;
}

.nav-links li a:hover,
.nav-links li.current-page-ancestor > a {
    color: var(--text);
    background: var(--nav-hover-bg, rgba(255, 255, 255, 0.06));
}

.nav-links li.current-menu-item > a {
    color: var(--accent, #4DA3FF);
    background: rgba(77, 163, 255, 0.08);
}

.nav-item.current-menu-item > .nav-link,
.nav-item.current-menu-ancestor > .nav-link {
    color: var(--gold, #D4A017);
    position: relative;
}

.nav-item.current-menu-item > .nav-link::after,
.nav-item.current-menu-ancestor > .nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gold, #D4A017);
    border-radius: 2px;
}

/* =========================================================
   DROPDOWN ARROW
   ========================================================= */

.nav-links li.menu-item-has-children > a::after {
    content: ' ▾';
    font-size: 0.9rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.nav-links li.menu-item-has-children:hover > a::after {
    opacity: 1;
}

/* =========================================================
   DROPDOWN — DESKTOP HOVER
   Uses a pseudo-element bridge to prevent gap-triggered close
   ========================================================= */

.nav-links li.menu-item-has-children {
    position: relative;
}

/* Invisible bridge fills the gap between nav link and dropdown */
.nav-links li.menu-item-has-children > a::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    right: 0;
    height: 10px;
}

.nav-links li.menu-item-has-children .sub-menu {
    display: block;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: var(--dropdown-bg, #1a1d24);
    border: 1px solid var(--dropdown-border, rgba(255, 255, 255, 0.08));
    border-radius: 8px;
    box-shadow: var(--dropdown-shadow, 0 8px 32px rgba(0, 0, 0, 0.5));
    list-style: none;
    margin: 0;
    padding: 6px;
    z-index: 1000;
    transform: translateY(6px);
    transition: opacity 0.18s ease,
                transform 0.18s ease,
                visibility 0.18s ease;
}

/* Show on hover — triggered by hovering the parent li */
.nav-links li.menu-item-has-children:hover > .sub-menu {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Sub-menu items */
.nav-links .sub-menu li {
    position: static;
}

.nav-links .sub-menu li a {
    padding: 9px 12px;
    font-size: 0.875rem;
    color: var(--text-muted);
    border-radius: 6px;
    display: block;
    white-space: nowrap;
    transition: color 0.2s ease, background 0.2s ease;
}

.nav-links .sub-menu li a:hover {
    color: var(--text);
    background: var(--nav-hover-bg, rgba(255, 255, 255, 0.06));
}

.nav-links .sub-menu li.current-menu-item > a {
    color: var(--accent, #4DA3FF);
    background: rgba(77, 163, 255, 0.08);
}

/* =========================================================
   HEADER CONTROLS
   ========================================================= */

.header-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* =========================================================
   THEME TOGGLE
   ========================================================= */

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    flex-shrink: 0;
    color: var(--text-muted, #b0b4be);
    transition: background 0.2s ease, color 0.2s ease;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.theme-icon {
    font-size: 1.1rem;
    line-height: 1;
}

/* ── TOP-LEVEL TRIGGER ── */
.nav-item--mega { position: static; }

.nav-link--mega {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.nav-chevron {
  transition: transform .25s ease;
  flex-shrink: 0;
}
.nav-item--mega:hover .nav-chevron,
.nav-item--mega.open  .nav-chevron { transform: rotate(180deg); }

/* ── MEGA PANEL ───────────────────────────────────────── */

.mega-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  width: min(960px, 96vw);
  background: var(--panel, #111);
  border: 1px solid var(--line, var(--border));
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0,0,0,.45);
  padding: 32px;
  z-index: 9999;

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
  clip-path: inset(0 0 100% 0);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease, clip-path .25s ease;
}

/* show on hover, keyboard focus, or JS fallback */
.nav-item--mega:hover .mega-menu,
.nav-item--mega:focus-within .mega-menu,
.nav-item--mega.open .mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  clip-path: inset(0 0 0% 0);
}

/* bridge the gap so mouse doesn't lose hover */
.mega-menu::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 0;
  right: 0;
  height: 12px;
}

.mega-menu__inner--2col {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 40px;
}

.mega-menu__inner--3col {
  display: grid;
  grid-template-columns: 1fr 1fr 220px;
  gap: 40px;
}

.mega-menu__col-hdr--spaced {
  margin-top: 16px;
}

.mega-menu__link--all strong {
  color: var(--accent, #4DA3FF);
}

.mega-menu__link--spaced {
  margin-top: 16px;
}

/* ── MARKETS MEGA MENU ─────────────────────────────────────────────────────── */

.mega-menu--markets {
    width: min(520px, 96vw);
    padding: 20px;
}

/* Featured live strip */
.mkt-mega__featured {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.07));
}

.mega-menu--markets a.mkt-mega__live-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    background: rgba(77,163,255,.06);
    border: 1px solid rgba(77,163,255,.2);
    border-radius: 8px;
    text-decoration: none;
    transition: background .18s ease, border-color .18s ease;
}

.mega-menu--markets a.mkt-mega__live-card:hover {
    background: rgba(77,163,255,.12);
    border-color: rgba(77,163,255,.4);
}

.mkt-mega__live-badge {
    font-size: 0.62rem;
    font-weight: 700;
    color: #6daa45;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
    flex-shrink: 0;
}

.mkt-mega__live-card strong {
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

.mkt-mega__live-card small {
    font-size: 0.75rem;
    color: var(--muted, #888);
    white-space: nowrap;
}

.mega-menu--markets a.mkt-mega__view-all {
    display: flex;
    align-items: center;
    margin-left: auto;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--accent, #4DA3FF);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: color .15s ease;
}

.mega-menu--markets a.mkt-mega__view-all:hover {
    color: #fff;
    text-decoration: underline;
}

/* Category grid — 4 columns; FX gets a touch more room */
.mkt-mega__grid {
    display: grid;
    grid-template-columns: 1fr 1.25fr 1fr 1fr;
    gap: 0;
    align-items: start;
}

.mkt-mega__col {
    padding-right: 18px;
    border-right: 1px solid var(--border, rgba(255,255,255,.07));
    margin-right: 18px;
}

.mkt-mega__col:last-child {
    padding-right: 0;
    border-right: none;
    margin-right: 0;
}

/* Category label */
.mkt-mega__cat {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent, #4DA3FF);
    margin: 0 0 6px;
}

.mkt-mega__cat--spaced {
    margin-top: 14px;
}

/* Asset link — .mega-menu--markets a.mkt-mega__link (0,2,1) beats .nav-links li a (0,1,2) */
.mega-menu--markets a.mkt-mega__link {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted, #b0b4be);
    transition: background .15s ease, color .15s ease;
    margin-bottom: 1px;
    white-space: nowrap;
    gap: 4px;
}

.mega-menu--markets a.mkt-mega__link:hover {
    background: rgba(77,163,255,.08);
    color: #fff;
}

/* Green dot on live assets */
.mkt-mega__live-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #6daa45;
    flex-shrink: 0;
}

/* Mobile: stack everything */
@media (max-width: 900px) {
    .mkt-mega__featured { flex-wrap: wrap; }
    .mkt-mega__view-all { margin-left: 0; }
    .mkt-mega__grid {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
    .mkt-mega__col {
        padding-right: 0;
        border-right: none;
        margin-right: 0;
    }
}

@media (max-width: 900px) {
  .mega-menu__inner--2col,
  .mega-menu__inner--3col {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}/* ── INNER GRID ── */
.mega-menu__inner {
  display: grid;
  grid-template-columns: 1fr 1fr 220px;
  gap: 40px;
}

/* ── COLUMN HEADER ── */
.mega-menu__col-hdr {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 16px;
}

/* ── LINKS ── */
.mega-menu__link {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: background .18s ease, color .18s ease;
  margin-bottom: 4px;
}
.mega-menu__link:hover {
  background: rgba(77,163,255,.08);
  color: #fff;
}
.mega-menu__link:hover .mega-menu__icon { color: var(--accent); }

.mega-menu__icon {
  width: 18px;
  height: 18px;
  min-width: 18px;
  color: var(--muted);
  margin-top: 2px;
  transition: color .18s ease;
}

.mega-menu__link strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  line-height: 1.2;
}
.mega-menu__link small {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.4;
}

/* ── CTA COLUMN ── */
.mega-menu__cta {
  background: rgba(77,163,255,.06);
  border: 1px solid rgba(77,163,255,.18);
  border-radius: 14px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.mega-menu__cta-hdr {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 8px;
}
.mega-menu__cta-sub {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0 0 18px;
}
.mega-menu__cta-btn {
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  background: var(--accent);
  color: #081018;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
  text-align: center;
  justify-content: center;
}
.mega-menu__cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
}

/* ── RESPONSIVE — collapse to standard dropdown on mobile ── */
@media (max-width: 900px) {
  .mega-menu {
    position: static;
    width: 100%;
    transform: none !important;
    border-radius: 12px;
    padding: 20px;
    box-shadow: none;
  }
  .mega-menu__inner {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .mega-menu__cta { display: none; } /* hide CTA on mobile to keep it clean */
}

/* =========================================================
   HAMBURGER
   ========================================================= */

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    flex-shrink: 0;
    color: var(--text-muted, #b0b4be);
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-toggle:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
}

.nav-toggle svg {
    display: block;
    width: 20px;
    height: 20px;
}

/* Hamburger → X animation */
.nav-toggle svg line {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

body.nav-open .nav-toggle svg line:nth-child(1) {
    transform-origin: center;
    transform: translateY(6px) rotate(45deg);
}

body.nav-open .nav-toggle svg line:nth-child(2) {
    opacity: 0;
}

body.nav-open .nav-toggle svg line:nth-child(3) {
    transform-origin: center;
    transform: translateY(-6px) rotate(-45deg);
}

/* =========================================================
   MOBILE NAV
   ========================================================= */

@media (max-width: 900px) {

    .nav-toggle {
        display: flex;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg, #0f1115);
        border-bottom: 1px solid rgba(77, 163, 255, 0.15);
        padding: 12px 16px 16px;
        z-index: 999;
    }

    .main-nav.is-open {
        display: flex;
        flex-direction: column;
    }

    .nav-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        width: 100%;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links li a {
        padding: 10px 14px;
        width: 100%;
    }

    /* Mobile — sub-menus hidden by default, shown on click */
    .nav-links li.menu-item-has-children .sub-menu {
        display: none;
        position: static;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0 0 0 16px;
        margin-top: 2px;
        transform: none;
        transition: none;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links li.menu-item-has-children.is-open > .sub-menu {
        display: block;
    }

    /* Arrow: down by default, up when open */
    .nav-links li.menu-item-has-children > a::after {
        content: ' ▾';
        font-size: 1.5rem;
        opacity: 0.6;
        float: right;
        transition: transform 0.2s ease;
    }

    .nav-links li.menu-item-has-children.is-open > a::after {
        transform: rotate(180deg);
    }

    /* Remove the desktop hover bridge on mobile */
    .nav-links li.menu-item-has-children > a::before {
        display: none;
    }
}

@media (min-width: 901px) {
    .nav-toggle {
        display: none;
    }

    .main-nav {
        display: flex !important;
    }
}

@media (max-width: 900px) {
    .logo img {
        width: 160px;  /* ← smaller on mobile */
    }
}
/* Logo swap dark/light */

/* Logo swap dark/light */
.site-header .logo .ewi-logo--light { display: none !important; }
.site-header .logo .ewi-logo--dark  { display: block !important; }
body.light-mode .site-header .logo .ewi-logo--light { display: block !important; }
body.light-mode .site-header .logo .ewi-logo--dark  { display: none !important; }

/* Hide theme toggle on force-dark pages */
body[data-force-dark="true"] .theme-toggle {
    display: none !important;
}
/* ── Mega menu — reset inherited nav styles ── */
.nav-item--mega > .nav-dropdown,
.nav-item--mega > .sub-menu { display: none !important; }

.mega-menu ul,
.mega-menu li {
    list-style: none !important;
    margin: 0;
    padding: 0;
}

.mega-menu a {
    padding: 0;
    font-size: inherit;
    color: inherit;
}

.mega-menu a::after,
.mega-menu a::before { display: none !important; }

/* Mega menu CTA button — ensure text is always dark */
.mega-menu__cta-btn,
.mega-menu__cta-btn:visited {
    color: #081018 !important;
}

/* ── Analysis mega menu — 3 col + bottom CTA bar ── */
.mega-menu__inner--3col { display: grid; grid-template-columns: 1fr 1fr 220px; gap: 40px; }
.mega-menu--analysis { width: min(1060px, 96vw); }
.mega-menu__cta-bar { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border, rgba(255,255,255,.07)); flex-wrap: wrap; }
.mega-menu__cta-bar-text { font-size: 13px; color: var(--muted, #a8a8a8); margin: 0; flex: 1; min-width: 200px; }
.mega-menu__cta-bar-btn { display: inline-flex; align-items: center; white-space: nowrap; padding: 9px 18px; background: var(--accent, #4da3ff); color: #081018 !important; border-radius: 8px; font-size: 13px; font-weight: 700; text-decoration: none; transition: transform .15s, box-shadow .15s; flex-shrink: 0; }
.mega-menu__cta-bar-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(77,163,255,.3); }

@media (max-width: 900px) {
    .mega-menu__inner--3col {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .mega-menu__cta-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ── Mobile mega menu — show on is-open ── */
@media (max-width: 900px) {
    .nav-item--mega .mega-menu {
        display: none !important;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        position: static;
        width: 100%;
        box-shadow: none;
        border-radius: 8px;
        padding: 16px;
        margin-top: 8px;
    }

    .nav-item--mega.is-open .mega-menu {
        display: block !important;
    }

    .mega-menu__inner,
    .mega-menu__inner--2col,
    .mega-menu__inner--3col {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .mega-menu__cta,
    .mega-menu__cta-bar { display: none !important; }
}

/* ── Mobile header fixes ── */
@media (max-width: 900px) {
    .site-header {
        width: 100%;
        overflow: visible;
    }

    .header-inner {
        padding-inline: 0.75rem;
        gap: 8px;
        width: 100%;
        overflow: visible;
    }

    .logo img {
        max-width: 160px;
        height: auto;
    }

    .nav-toggle {
        display: flex !important;
        position: relative;
        z-index: 1100;
        margin-left: auto;
        flex-shrink: 0;
    }

    .header-controls {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: auto;
        flex-shrink: 0;
    }
}

/* ── Mega menu — light mode overrides ── */
body.light-mode .mega-menu {
    background: #ffffff;
    border-color: rgba(0,0,0,0.1);
    box-shadow: 0 16px 48px rgba(0,0,0,.12);
}

body.light-mode .mega-menu__col-hdr {
    color: var(--accent);
}

body.light-mode .mega-menu__link {
    color: #1a1a1a;
}

body.light-mode .mega-menu__link:hover {
    background: rgba(77,163,255,.08);
    color: #0d0d0d;
}

body.light-mode .mega-menu__link strong {
    color: #0d0d0d;
}

body.light-mode .mega-menu__link small {
    color: #666;
}

body.light-mode .mega-menu__cta {
    background: rgba(77,163,255,.06);
    border-color: rgba(77,163,255,.2);
}

body.light-mode .mega-menu__cta-hdr {
    color: #0d0d0d;
}

body.light-mode .mega-menu__cta-sub {
    color: #555;
}

body.light-mode .mega-menu__cta-bar {
    border-top-color: rgba(0,0,0,.08);
}

body.light-mode .mega-menu__cta-bar-text {
    color: #555;
}

/* ── LEARN MEGA MENU — MODULE LAYOUT ── */
.mega-menu__inner--modules {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0;
}

.mega-menu__module {
    padding: 8px 20px 8px 0;
    border-right: 1px solid var(--border);
    margin-right: 20px;
}

.mega-menu__module:last-of-type {
    border-right: none;
    margin-right: 0;
}

.mega-menu__module-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mega-menu__module-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: rgba(77,163,255,.12);
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    color: var(--accent);
}

.mega-menu__link--locked {
    opacity: .6;
}

.mega-menu__link--locked:hover {
    opacity: 1;
}

.mega-menu__lock {
    font-size: .65rem;
    opacity: .7;
    margin-left: 2px;
}

.mega-menu__cta-register {
    display: block;
    margin-top: 10px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    text-align: center;
}

.mega-menu__cta-register:hover {
    text-decoration: underline;
}

@media (max-width: 1100px) {
    .mega-menu__inner--modules {
        grid-template-columns: 1fr 1fr;
    }

    .mega-menu__module {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding-bottom: 16px;
        margin-bottom: 16px;
        margin-right: 0;
    }
}

/* ── MEGA MENU VIEWPORT CLAMPING ── */
.mega-menu {
    max-width: min(960px, calc(100vw - 32px));
}

/* ── MARKETS DROPDOWN ── */
.nav-links .ewi-markets-submenu {
    min-width: 240px;
    padding: 8px;
}

.nav-links .ewi-markets-submenu .ewi-market-link,
.nav-links .ewi-markets-submenu .ewi-market-link--disabled {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--text, #e6e6e6);
    text-decoration: none;
    transition: background .18s ease;
    white-space: nowrap;
    font-size: .875rem;
    line-height: 1;
}

.nav-links .ewi-markets-submenu a.ewi-market-link:hover {
    background: rgba(77,163,255,.08);
    color: var(--text, #e6e6e6);
}

.ewi-market-link--disabled { opacity: .45; cursor: default; }

.ewi-market-icon { font-size: 1.15rem; line-height: 1; flex-shrink: 0; }

.ewi-market-text { flex: 1; min-width: 0; }

.ewi-market-text strong {
    display: block;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text, #e6e6e6);
    line-height: 1.2;
}

.ewi-market-text small {
    display: block;
    font-size: .75rem;
    color: var(--muted, #888);
    margin-top: 2px;
}

.ewi-market-status {
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    letter-spacing: .04em;
    text-transform: uppercase;
    flex-shrink: 0;
    white-space: nowrap;
}

.ewi-market-status--live { background: rgba(109,170,69,.15); color: #6daa45; }
.ewi-market-status--soon { background: rgba(255,255,255,.06); color: var(--muted, #888); }

/* ── BETA CTA NAV BUTTON ─────────────────────────────────────────────────────── */
.nav-links .nav-cta-item { margin-left: 6px; }

.nav-links .nav-cta-item .nav-cta-btn {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    background: linear-gradient(135deg, #c9a227, #e8be3a);
    color: #0a0a0a;
    font-size: .875rem;
    font-weight: 700;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .15s ease;
}
.nav-links .nav-cta-item .nav-cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(201,162,39,.35);
    color: #0a0a0a;
    background: linear-gradient(135deg, #c9a227, #e8be3a);
}


/* Module label number — accent colour */
.mega-menu__module-num {
    color: var(--accent, #4DA3FF);
}

.mega-menu__module-label {
    color: var(--accent, #4DA3FF);
}

/* ── COMPACT MARKETS DROPDOWN — mkt-drop__* ─────────────────────────────── */

.mkt-drop__live {
    display: flex;
    gap: 10px;
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}

.mega-menu--markets a.mkt-drop__live-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    background: rgba(77,163,255,.06);
    border: 1px solid rgba(77,163,255,.15);
    border-radius: 8px;
    padding: 8px 12px;
    text-decoration: none;
    transition: background .15s;
}

.mega-menu--markets a.mkt-drop__live-item:hover {
    background: rgba(77,163,255,.12);
}

.mkt-drop__live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4caf50;
    flex-shrink: 0;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.mkt-drop__live-item strong {
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
}

.mkt-drop__price {
    font-size: 0.8rem;
    color: var(--accent, #4DA3FF);
    margin-left: auto;
    font-weight: 500;
}

.mkt-drop__grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0 16px;
    margin-bottom: 14px;
}

.mkt-drop__cat {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--accent, #4DA3FF);
    margin: 0 0 8px;
}

.mega-menu--markets a.mkt-drop__link {
    display: block;
    font-size: 0.8125rem;
    color: var(--text-muted, #8892a4);
    text-decoration: none;
    padding: 3px 0;
    transition: color .15s;
}

.mega-menu--markets a.mkt-drop__link:hover {
    color: #fff;
}

.mega-menu--markets a.mkt-drop__view-all {
    display: block;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent, #4DA3FF);
    text-decoration: none;
    padding-top: 12px;
    border-top: 1px solid var(--border, rgba(255,255,255,.08));
    transition: color .15s;
}

.mega-menu--markets a.mkt-drop__view-all:hover {
    color: #fff;
}

/* ── BACKDROP BLUR — body.nav-open (desktop mega menus) ─────────────────── */

body.nav-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    z-index: 999;
    pointer-events: none;
}

/* =========================================================
   GUEST HEADER BUTTONS
   ========================================================= */

.ewi-header-login {
    display: inline-flex;
    align-items: center;
    padding: 7px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-muted, #b0b4be);
    text-decoration: none;
    border-radius: 6px;
    transition: color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
}
.ewi-header-login:hover {
    color: var(--text, #e6e6e6);
    background: rgba(255,255,255,0.06);
}

.ewi-header-cta {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    background: var(--accent, #4DA3FF);
    color: #0b0f14;
    font-size: 0.8125rem;
    font-weight: 700;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease;
}
.ewi-header-cta:hover {
    background: #3a8ee8;
    transform: translateY(-1px);
    color: #0b0f14;
}

/* =========================================================
   PROFILE DROPDOWN
   ========================================================= */

.ewi-profile-dropdown {
    position: relative;
}

.ewi-profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--border, rgba(255,255,255,.07));
    border-radius: 8px;
    padding: 5px 10px 5px 5px;
    cursor: pointer;
    color: var(--text, #e6e6e6);
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    transition: background 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}
.ewi-profile-btn:hover,
.ewi-profile-dropdown.is-open .ewi-profile-btn {
    background: rgba(255,255,255,0.06);
    border-color: rgba(77,163,255,0.35);
}

.ewi-profile-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px solid;
    font-size: 0.6875rem;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
    letter-spacing: 0.02em;
}

.ewi-profile-name {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ewi-profile-chevron {
    color: var(--text-muted, #888);
    flex-shrink: 0;
    transition: transform 0.2s ease;
}
.ewi-profile-dropdown.is-open .ewi-profile-chevron {
    transform: rotate(180deg);
}

/* Dropdown panel */
.ewi-profile-menu {
    display: none;
    position: absolute !important;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-card, #1a1a1a) !important;
    border: 1px solid var(--border, rgba(255,255,255,.08));
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    z-index: 9999 !important;
    flex-direction: column;
}
.ewi-profile-dropdown.is-open .ewi-profile-menu {
    display: flex !important;
}
.ewi-profile-menu a {
    display: block;
    padding: 9px 12px;
    font-size: 0.875rem;
    color: var(--text, #e6e6e6) !important;
    text-decoration: none;
    border-radius: 8px;
    transition: background .12s;
    white-space: nowrap;
}
.ewi-profile-menu a:hover {
    background: rgba(77,163,255,.08);
    color: var(--accent, #4DA3FF) !important;
}
.ewi-profile-divider {
    height: 1px;
    background: var(--border, rgba(255,255,255,.08));
    margin: 4px 6px;
}

/* Hide profile-name and chevron on small screens to save space */
@media (max-width: 900px) {
    .ewi-profile-name,
    .ewi-profile-chevron { display: none; }
    .ewi-profile-btn { padding: 5px; border: none; background: none; }
    .ewi-profile-btn:hover { background: rgba(255,255,255,0.06); border: none; }
    .ewi-header-login,
    .ewi-header-cta { display: none; }
}

/* ── PREMIUM CTA BUTTON ──────────────────────────────────────────────────── */

.nav-links .nav-cta-item .nav-cta-btn--premium {
    background: linear-gradient(135deg, #D4A017, #f0c040);
    color: #000;
    font-weight: 700;
    border-radius: 6px;
    padding: 8px 18px;
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: opacity 0.2s ease;
    white-space: nowrap;
}

.nav-links .nav-cta-item .nav-cta-btn--premium:hover {
    opacity: 0.9;
    transform: none;
    box-shadow: none;
    background: linear-gradient(135deg, #D4A017, #f0c040);
    color: #000;
}

/* =========================================================
   LIGHT MODE FIXES — header.v2.css
   ========================================================= */

body.light-mode .logo {
    color: var(--text);
}

body.light-mode .theme-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

body.light-mode .nav-toggle:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--text);
}

body.light-mode .mkt-mega__live-card strong,
body.light-mode .mkt-drop__live-item strong {
    color: var(--text);
}

body.light-mode .mega-menu--markets a.mkt-mega__link:hover,
body.light-mode .mega-menu--markets a.mkt-drop__link:hover,
body.light-mode .mega-menu--markets a.mkt-drop__view-all:hover,
body.light-mode .mega-menu--markets a.mkt-mega__view-all:hover {
    color: var(--text);
}

body.light-mode .ewi-market-status--soon {
    background: rgba(0, 0, 0, 0.06);
}

body.light-mode .ewi-header-login:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text);
}

body.light-mode .ewi-profile-btn:hover,
body.light-mode .ewi-profile-dropdown.is-open .ewi-profile-btn {
    background: rgba(0, 0, 0, 0.05);
}

@media (max-width: 900px) {
    body.light-mode .ewi-profile-btn:hover {
        background: rgba(0, 0, 0, 0.05);
    }
}
