/* ═══════════════════════════════════════════════
   EquitySight.app — Shared Design System
   ═══════════════════════════════════════════════ */

:root {
  --cream:            #F5F0E8;
  --warm-white:       #FAF7F2;
  --charcoal:         #1C1C1E;
  --charcoal-soft:    #2C2C2E;
  --charcoal-mid:     #3A3A3C;
  --slate:            #4A4A52;
  --sage:             #7B9E87;
  --sage-light:       #A8C4B0;
  --terracotta:       #C4704A;
  --terracotta-light: #E8A882;
  --gold:             #C9A84C;
  --gold-light:       #E8D080;
  --sky:              #5B8FAB;
  --risk-red:         #C45A5A;
  --reward-green:     #5A9E7B;

  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono:    'DM Mono', 'Courier New', monospace;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 8px 32px rgba(0,0,0,0.14);
  --shadow-lg: 0 20px 60px rgba(0,0,0,0.22);
}

/* ── Dark mode ── */
html.dark-mode { color-scheme: dark; background: #111113; }
html.dark-mode body { background: #111113 !important; color: #F5F0E8 !important; }
html.dark-mode .site-nav { background: rgba(8,8,10,0.98) !important; }
/* Cards & panels */
html.dark-mode .acct-card,
html.dark-mode .stat-card,
html.dark-mode .feature-card { background: #1C1C1E !important; border-color: rgba(255,255,255,0.08) !important; }
html.dark-mode .acct-card-head { border-color: rgba(255,255,255,0.08) !important; }
html.dark-mode .security-row { border-color: rgba(255,255,255,0.06) !important; }
html.dark-mode .security-label,
html.dark-mode .acct-card-head h3,
html.dark-mode .acct-card-head p { color: rgba(245,240,232,0.8) !important; }
html.dark-mode .security-meta { color: rgba(245,240,232,0.5) !important; }
html.dark-mode .acct-nav-item { color: rgba(245,240,232,0.55) !important; }
html.dark-mode .acct-nav-item.active,
html.dark-mode .acct-nav-item:hover { background: rgba(255,255,255,0.07) !important; color: #F5F0E8 !important; }
html.dark-mode .plan-feature { border-color: rgba(255,255,255,0.05) !important; color: rgba(245,240,232,0.65) !important; }
/* Inputs */
html.dark-mode input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
html.dark-mode select,
html.dark-mode textarea { background: rgba(255,255,255,0.06) !important; border-color: rgba(255,255,255,0.12) !important; color: #F5F0E8 !important; }
html.dark-mode .form-input { background: rgba(255,255,255,0.07) !important; border-color: rgba(255,255,255,0.12) !important; color: #F5F0E8 !important; }
html.dark-mode .form-label { color: rgba(245,240,232,0.65) !important; }
/* Pricing cards */
html.dark-mode .pricing-card { background: #1C1C1E !important; border-color: rgba(255,255,255,0.1) !important; }
html.dark-mode .pricing-card .price-label,
html.dark-mode .pricing-card .feature-text { color: rgba(245,240,232,0.7) !important; }
/* Sections */
html.dark-mode section:not(.dark-section),
html.dark-mode .page-section { background: #111113 !important; }
html.dark-mode h1, html.dark-mode h2, html.dark-mode h3,
html.dark-mode h4, html.dark-mode p { color: inherit; }
/* Admin */
html.dark-mode .admin-layout { color: #F5F0E8 !important; }
html.dark-mode .user-table th,
html.dark-mode .user-table td { color: rgba(245,240,232,0.8) !important; border-color: rgba(255,255,255,0.06) !important; }
html.dark-mode .user-table tr:hover { background: rgba(255,255,255,0.04) !important; }
html.dark-mode .user-cog-menu { background: #2C2C2E !important; border-color: rgba(255,255,255,0.12) !important; }
html.dark-mode .cog-menu-item { color: rgba(245,240,232,0.8) !important; }
html.dark-mode .cog-menu-item:hover { background: rgba(255,255,255,0.07) !important; }
html.dark-mode .admin-tab { color: rgba(245,240,232,0.5) !important; border-color: rgba(255,255,255,0.08) !important; }
html.dark-mode .admin-tab.active { color: #F5F0E8 !important; border-bottom-color: var(--gold) !important; background: rgba(255,255,255,0.05) !important; }
html.dark-mode .config-input { background: rgba(255,255,255,0.06) !important; border-color: rgba(255,255,255,0.1) !important; color: #F5F0E8 !important; }

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden !important; }
body {
  background: var(--cream);
  color: var(--charcoal);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: var(--font-body); cursor: pointer; }
img { max-width: 100%; display: block; }

/* ── Shared Nav ── */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  background: rgba(28,28,30,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: env(safe-area-inset-top, 0) 0 0;
  overflow: visible;
}
.site-nav::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: env(safe-area-inset-top, 0px);
  background: rgba(28,28,30,0.95);
  z-index: 899;
  pointer-events: none;
}
.site-nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 48px;
  min-height: 96px;
  display: grid;
  grid-template-columns: 260px 1fr 260px;
  align-items: center;
  gap: 0;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  text-decoration: none;
}
.site-logo-mark {
  width: 52px;
  height: 52px;
  background: var(--gold);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.site-logo-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, transparent 60%);
}
.site-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.site-logo-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--cream);
  letter-spacing: -0.3px;
}
.site-logo-tld {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gold);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}
.site-nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  list-style: none;
}
.site-nav-links a {
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
  color: rgba(245,240,232,0.65);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.site-nav-links a:hover,
.site-nav-links a.active {
  color: var(--cream);
  background: rgba(255,255,255,0.06);
}
.site-nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  width: auto;
  min-width: 200px;
}
.btn-ghost {
  background: none;
  border: 1px solid rgba(255,255,255,0.18);
  color: rgba(245,240,232,0.7);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: all 0.15s;
}
.btn-ghost:hover { border-color: rgba(255,255,255,0.4); color: var(--cream); }
.btn-gold {
  background: var(--gold);
  border: 1px solid transparent;
  color: var(--charcoal);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-gold:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary {
  background: var(--charcoal);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--cream);
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  transition: all 0.15s;
}
.btn-primary:hover { background: var(--charcoal-soft); }

/* ── Shared Footer ── */
.site-footer {
  background: var(--charcoal);
  color: var(--cream);
  padding: 60px 0 0;
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}
.site-footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.site-footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  padding-bottom: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.footer-brand p {
  font-size: 13px;
  color: rgba(245,240,232,0.4);
  line-height: 1.7;
  margin-top: 14px;
  max-width: 260px;
}
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: rgba(245,240,232,0.3);
  margin-bottom: 16px;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul li a {
  font-size: 13px;
  color: rgba(245,240,232,0.5);
  transition: color 0.15s;
}
.footer-col ul li a:hover { color: var(--cream); }
.footer-bottom {
  padding: 20px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-bottom p {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(245,240,232,0.25);
  letter-spacing: 0.5px;
}
.footer-bottom-links {
  display: flex;
  gap: 20px;
}
.footer-bottom-links a {
  font-family: var(--font-mono);
  font-size: 10px;
  color: rgba(245,240,232,0.3);
  letter-spacing: 0.5px;
  transition: color 0.15s;
}
.footer-bottom-links a:hover { color: rgba(245,240,232,0.6); }

/* ── Section helpers ── */
.section-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.8;
  margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.5px;
}
.section-sub {
  font-size: 16px;
  color: var(--slate);
  line-height: 1.7;
  max-width: 580px;
}

/* ── Mobile nav ── */
.nav-hamburger {
  display: none;
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  align-items: center;
  justify-content: center;
  color: var(--cream);
  font-size: 18px;
}
@media(max-width: 768px) {
  /* Never hide nav links behind hamburger — show them in a secondary row */
  .site-nav-inner {
    display: flex;
    flex-wrap: wrap;
    padding-bottom: 0;
    gap: 0;
  }
  .site-nav-links {
    display: flex !important;
    order: 3;
    width: 100%;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 6px 16px;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    margin: 0;
  }
  .site-nav-links::-webkit-scrollbar { display: none; }
  .site-nav-links li { flex-shrink: 0; }
  .site-nav-links a {
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
    letter-spacing: 0.5px;
  }
  .site-nav-actions {
    order: 2;
    flex: 1;
    gap: 6px;
    width: auto;
    justify-content: flex-end;
  }
  .btn-ghost {
    padding: 7px 11px;
    font-size: 10px;
  }
  .btn-gold {
    padding: 7px 12px;
    font-size: 10px;
    white-space: nowrap;
  }
  .nav-hamburger { display: none !important; }
  .site-nav { padding-bottom: 0; }
  .site-footer-grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .footer-brand { grid-column: 1 / -1; }
}
@media(max-width: 480px) {
  .site-footer-grid { grid-template-columns: 1fr; }
  .site-nav-inner { padding: 0 20px; gap: 8px; min-height: 70px; }
  .site-nav-links a { font-size: 12px; padding: 8px 10px; }
  .site-logo-name { font-size: 17px; }
  .site-logo-mark { width: 40px; height: 40px; font-size: 21px; }
  .btn-ghost { padding: 8px 12px; font-size: 11px; }
  .btn-gold  { padding: 8px 12px; font-size: 11px; max-width: none; overflow: visible; white-space: nowrap; }
}

/* ── Session-aware nav ── */
.nav-user-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid rgba(201,168,76,0.4);
  color: var(--charcoal);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}
.nav-user-btn:hover { transform: scale(1.1); box-shadow: 0 0 0 3px rgba(201,168,76,0.25); }
.nav-user-btn img { width:100%; height:100%; object-fit:cover; border-radius:50%; }

/* Dropdown for nav user */
.nav-user-wrap { position: relative; }
.nav-user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: var(--charcoal-soft);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  min-width: 200px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 1000;
}
.nav-user-wrap.open .nav-user-dropdown { display: block; }
.nav-dropdown-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.nav-dropdown-name { font-size: 13px; font-weight: 600; color: var(--cream); }
.nav-dropdown-email { font-family: var(--font-mono); font-size: 10px; color: rgba(245,240,232,0.35); margin-top: 2px; letter-spacing: 0.3px; }
.nav-dropdown-items { padding: 6px 0; }
.nav-dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(245,240,232,0.6);
  letter-spacing: 0.5px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.nav-dropdown-item:hover { background: rgba(255,255,255,0.06); color: var(--cream); }
.nav-dropdown-item.danger { color: rgba(196,90,90,0.7); }
.nav-dropdown-item.danger:hover { color: #E87070; background: rgba(196,90,90,0.08); }

/* Nav font size upgrade */
.site-nav-links a {
  font-family: var(--font-mono);
  font-size: 13px !important;
  letter-spacing: 0.3px;
  color: rgba(245,240,232,0.6);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
