/* ── FinWave Global Styles ──────────────────────────────────── */
:root {
  --bg:     #070b14;
  --bg2:    #0d1424;
  --bg3:    #111d30;
  --card:   #0f192b;
  --border: #1a2d4a;
  --blue:   #3b82f6;
  --cyan:   #06b6d4;
  --green:  #22c55e;
  --red:    #ef4444;
  --text:   #e2e8f0;
  --muted:  #64748b;
  --muted2: #94a3b8;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ── Top bar ────────────────────────────────────────────────── */
#logo {
  position: fixed;
  top: 14px;
  left: 60px;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -0.6px;
  color: var(--text);
  z-index: 200;
  line-height: 28px;
  /* Promote to its own compositing layer so iOS Safari keeps it
     pinned during momentum scroll instead of letting it drift. */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
#logo span { color: var(--blue); }

/* Hamburger — LEFT side (mobile only) */
#menu-btn {
  position: fixed;
  top: 14px;
  left: 20px;
  z-index: 200;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
#menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--muted2);
  border-radius: 2px;
  transition: background 0.15s;
}
#menu-btn:hover span { background: var(--text); }

/* Desktop: hide hamburger (icon rail has its own), add rail body offset */
@media (min-width: 769px) {
  #menu-btn { display: none; }
  body { padding-left: 48px; }
  #logo { left: 62px; }
}

/* ── Overlay ────────────────────────────────────────────────── */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 300;
  backdrop-filter: blur(2px);
}
#overlay.open { display: block; }

/* ── Side menu ──────────────────────────────────────────────── */

/* Nav brand header */
.nav-brand-header {
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: -.6px;
  color: var(--text);
  flex-shrink: 0;
}
.nav-brand-header span { color: var(--blue); }
/* Keep the logo image inside the menu, preserving aspect ratio */
.nav-brand-header img {
  display: block;
  width: auto !important;
  height: auto !important;
  max-width: 80%;
  max-height: 32px;
  object-fit: contain;
}

#side-menu {
  position: fixed;
  top: 0;
  left: -290px;
  width: 272px;
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  z-index: 400;
  display: flex;
  flex-direction: column;
  padding: 0 0 24px;
  transition: left 0.28s cubic-bezier(0.4,0,0.2,1);
}
#side-menu.open { left: 0; }

#side-menu nav {
  flex: 1;
  padding: 12px 0 0;
}
#side-menu nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 26px;
  font-size: 1.01rem;
  font-weight: 600;
  color: var(--muted2);
  border-left: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  text-decoration: none;
  letter-spacing: 0.01em;
}
#side-menu nav a svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  opacity: 0.55;
  transition: opacity 0.15s;
}
#side-menu nav a:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}
#side-menu nav a:hover svg { opacity: 1; }
#side-menu nav a.active {
  color: var(--blue);
  border-left-color: var(--blue);
  background: rgba(59,130,246,0.08);
}
#side-menu nav a.active svg { opacity: 1; }

.menu-footer {
  padding: 20px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-blue {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 11px 20px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  text-align: center;
  transition: opacity 0.15s;
}
.btn-blue:hover { opacity: 0.88; }

.btn-ghost {
  display: inline-block;
  background: none;
  color: var(--muted2);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: 9px;
  border: 1px solid var(--border);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--muted); color: var(--text); }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}


/* ── Profile modal (centered popup) ─────────────────────────── */
#profile-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 590;
  backdrop-filter: blur(6px);
}
#profile-overlay.open { display: block; }

#profile-panel {
  position: fixed;
  inset: 0;
  z-index: 600;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#profile-panel.open { display: flex; }

.pp-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%;
  max-width: 480px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.pp-header {
  display: flex; align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pp-title { font-size: 0.95rem; font-weight: 800; color: var(--text); }
.pp-close {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 1rem; padding: 4px 8px;
  border-radius: 6px; transition: color 0.15s;
}
.pp-close:hover { color: var(--text); }

.pp-body {
  flex: 1; overflow-y: auto;
  padding: 20px;
  display: flex; flex-direction: column;
  gap: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.pp-loading { color: var(--muted); font-size: 0.85rem; }
.pp-empty   { color: var(--muted); font-size: 0.82rem; line-height: 1.55; }

.pp-identity { display: flex; align-items: center; gap: 14px; }
.pp-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pp-username   { font-size: 1rem; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.pp-rank-badge { font-size: 0.82rem; font-weight: 700; }

.pp-progress-bar {
  height: 5px; background: var(--bg3);
  border-radius: 99px; overflow: hidden;
  margin-bottom: 6px;
}
.pp-progress-fill { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.pp-progress-label { font-size: 0.7rem; color: var(--muted); }

.pp-stats {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 4px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 8px;
}
.pp-stat        { text-align: center; }
.pp-stat-val    { font-size: 1.05rem; font-weight: 900; color: var(--text); }
.pp-stat-lbl    { font-size: 0.68rem; color: var(--muted); margin-top: 3px; }

/* ── Profile tabs ───────────────────────────────────────────── */
.pp-tabs {
  display: flex;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pp-tab {
  flex: 1; text-align: center; cursor: pointer; user-select: none;
  font-size: 0.8rem; font-weight: 700; color: var(--muted);
  padding: 12px 6px; border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.pp-tab:hover { color: var(--text); }
.pp-tab.active { color: var(--text); border-bottom-color: var(--blue); }
.pp-tab-panel { display: flex; flex-direction: column; gap: 20px; }

/* ── Subscription module ────────────────────────────────────── */
.pp-sub-card {
  border: 1px solid var(--border); border-radius: 14px; overflow: hidden;
}
.pp-sub-top { padding: 20px; display: flex; flex-direction: column; gap: 5px; }
.pp-sub-tier-label {
  font-size: 0.66rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1px;
}
.pp-sub-tier-name { font-size: 1.45rem; font-weight: 900; color: var(--text); }
.pp-sub-price { font-size: 1rem; font-weight: 800; color: var(--text); }
.pp-sub-price span { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.pp-sub-perks {
  border-top: 1px solid var(--border);
  padding: 16px 20px; display: flex; flex-direction: column; gap: 11px;
}
.pp-sub-perk {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 0.83rem; color: var(--text); line-height: 1.35;
}
.pp-sub-perk-icon { flex-shrink: 0; font-weight: 900; color: var(--green); }
.pp-sub-perk.locked { color: var(--muted); }
.pp-sub-perk.locked .pp-sub-perk-icon { color: var(--muted); }
.pp-view-plans-btn {
  width: 100%; padding: 13px; border-radius: 10px; border: none;
  background: var(--blue); color: #fff; font-size: 0.9rem; font-weight: 800;
  cursor: pointer; transition: filter 0.15s;
}
.pp-view-plans-btn:hover { filter: brightness(1.12); }
.pp-manage-btn {
  width: 100%; padding: 12px; border-radius: 10px;
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); font-size: 0.85rem; font-weight: 700; cursor: pointer;
  transition: background 0.15s;
}
.pp-manage-btn:hover { background: var(--card); }
.pp-sub-note {
  font-size: 0.72rem; color: var(--muted); text-align: center; line-height: 1.5;
}

/* ── Site footer ────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg2);
  padding: 56px 40px 32px;
  margin-top: 40px;
}
.footer-top {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto 48px;
}
@media (max-width: 960px) { .footer-top { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 640px) { .footer-top { grid-template-columns: 1fr 1fr; } }
@media (max-width: 400px) { .footer-top { grid-template-columns: 1fr; } }
.footer-logo { font-size: 1.3rem; font-weight: 900; margin-bottom: 10px; }
.footer-logo span { color: var(--blue); }
.footer-tagline { font-size: 0.82rem; color: var(--muted); line-height: 1.6; max-width: 220px; }
.footer-col h4 { font-size: 0.72rem; font-weight: 800; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--muted); margin-bottom: 14px; }
.footer-col a, .footer-col span {
  display: block; font-size: 0.84rem; color: var(--muted2);
  margin-bottom: 9px; cursor: pointer; text-decoration: none;
  transition: color 0.15s;
}
.footer-col a:hover { color: var(--text); }
.footer-legal {
  border-top: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-legal-text { font-size: 0.74rem; color: var(--muted); line-height: 1.65; max-width: 700px; }
.footer-copy { font-size: 0.74rem; color: var(--muted); white-space: nowrap; }

/* Legal modal */
#legal-modal { display:none;position:fixed;inset:0;background:rgba(0,0,0,0.8);z-index:3000;
  align-items:center;justify-content:center;padding:20px;backdrop-filter:blur(6px); }
#legal-modal.open { display:flex; }
.legal-card { background:#0d1424;border:1px solid #1a2d4a;border-radius:18px;
  width:100%;max-width:680px;max-height:85vh;display:flex;flex-direction:column;position:relative; }
.legal-card-head { padding:28px 32px 20px;border-bottom:1px solid #1a2d4a;flex-shrink:0; }
.legal-card-head h2 { font-size:1.2rem;font-weight:900;margin-bottom:4px; }
.legal-card-head p { font-size:0.78rem;color:var(--muted); }
.legal-close { position:absolute;top:16px;right:16px;background:#111d30;border:none;
  color:#64748b;font-size:1rem;width:30px;height:30px;border-radius:50%;cursor:pointer; }
.legal-body { padding:24px 32px;overflow-y:auto;font-size:0.84rem;color:var(--muted2);line-height:1.75; }
.legal-body h3 { font-size:0.88rem;font-weight:800;color:var(--text);margin:20px 0 8px; }
.legal-body h3:first-child { margin-top:0; }
.legal-body p { margin-bottom:12px; }

/* ── Icon rail ──────────────────────────────────────────────── */
#icon-rail {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 48px;
  height: 100vh;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  z-index: 350;
  flex-direction: column;
  align-items: center;
  padding-bottom: 16px;
}
@media (min-width: 769px) { #icon-rail { display: flex; } }

/* Hamburger in rail */
#rail-ham {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
#rail-ham span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--muted2);
  border-radius: 2px;
  transition: background 0.15s;
}
#rail-ham:hover span { background: var(--text); }

/* Nav icons */
#ir-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding-top: 6px;
  overflow-y: auto;
  scrollbar-width: none;
}
#ir-nav::-webkit-scrollbar { display: none; }

.ir-link {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
  text-decoration: none;
}
.ir-link:hover {
  color: var(--text);
  background: rgba(255,255,255,0.06);
}
.ir-link.active {
  color: var(--blue);
  background: rgba(59,130,246,0.12);
}
.ir-link svg { flex-shrink: 0; }

/* User initials slot */
#ir-user {
  flex-shrink: 0;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ir-user-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(59,130,246,0.18);
  border: 2px solid rgba(59,130,246,0.4);
  color: var(--blue);
  font-size: 0.72rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.ir-user-btn:hover {
  background: rgba(59,130,246,0.3);
  border-color: var(--blue);
}

/* Profile button in side nav footer */
.btn-my-profile {
  display: block;
  width: 100%;
  padding: 10px 16px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted2);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
  font-family: inherit;
}
.btn-my-profile:hover { border-color: var(--blue); color: var(--blue); }

/* ── Shared auth gate overlay (soft-blocks pages for guests) ── */
#auth-gate {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(7,11,20,0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  /* z-index 150 keeps gate below nav rail (350), side-menu (400), logo (200)
     so users can always reach the menu even when gated */
}
.auth-gate-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 22px; padding: 44px 36px;
  text-align: center; max-width: 400px; width: 100%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
.auth-gate-icon { font-size: 2.8rem; margin-bottom: 16px; }
.auth-gate-card h2 { font-size: 1.25rem; font-weight: 900; margin: 0 0 10px; }
.auth-gate-card p  { color: var(--muted2); font-size: 0.88rem; line-height: 1.65; margin: 0 0 28px; }
.auth-gate-btns { display: flex; flex-direction: column; gap: 10px; }
.auth-gate-btns .btn-blue  { padding: 13px 24px; border-radius: 10px; font-size: 0.92rem; font-weight: 700; text-align: center; }
.auth-gate-btns .btn-ghost { padding: 11px 24px; border-radius: 10px; font-size: 0.87rem; text-align: center; }