:root {
  --primary: #387ED1; /* Brand Blue */
  --primary-hover: #2D64A6;
  --primary-light: #F1F7FF;
  
  --mint: #00B386; /* Brand Mint */
  --mint-hover: #008f6b;
  --mint-light: #F0FDF4;

  --secondary: #1A1A1B;
  --accent: var(--mint);
  --bg-main: #fff;
  --card-bg: #FFFFFF;
  --border-color: rgba(26, 26, 27, 0.1);
  --text-main: #1A1A1B;
  --text-muted: #6b7280;
  --shadow-premium: transparent;

  /* Intelligence Hub (News/Learn) Tokens */
  --newspaper-bg: #FAF9F5;
  --newspaper-bg-rgb: 250, 249, 245;
  --news-card-bg: #FFFFFF;

  /* Extended Theme Tokens */
  --color-primary-50: #F1F7FF;
  --color-primary-100: #E3EEFF;
  --color-primary-400: #60A5FA;
  --color-primary-600: #387ED1;
  --color-primary-800: #2D64A6;
  --color-primary-900: #214A7B;

  --color-mint-50: #F0FDF4;
  --color-mint-100: #DCFCE7;
  --color-mint-500: #00B386;
  --color-mint-600: #059669;
  --color-mint-700: #047857;

  /* Chart Modular Tokens */
  --chart-invested: #E2E8F0;
  --chart-gain: #34D399;
  --chart-fund-gain: #10B981;
  --chart-rate-text: #1E293B;
  --chart-invested-stroke: rgba(0, 0, 0, 0.05);
}

.dark {
  --bg-main: #111112;
  --card-bg: #1A1A1B;
  --border-color: rgba(255, 255, 255, 0.1);
  --text-main: #F3F4F6;
  --text-muted: #9CA3AF;
  --primary-light: rgba(56, 126, 209, 0.1);

  /* Chart Modular Tokens (Dark Mode) */
  --chart-invested: #0F172A;
  --chart-gain: #064E3B;
  --chart-fund-gain: #10B981;
  --chart-rate-text: #FFFFFF;
  --chart-invested-stroke: rgba(255, 255, 255, 0.05);

  /* Intelligence Hub (News/Learn) Tokens (Dark) */
  --newspaper-bg: #111112;
  --newspaper-bg-rgb: 17, 17, 18;
  --news-card-bg: #1A1A1B;
}

@layer base {
  * {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    /* Removed space for mobile nav on small screens */
  }

  html {
    scroll-behavior: smooth;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }

  /* Defensive: Always keep mobile nav fixed at bottom */
  .mobile-bottom-nav-fixed {
    position: fixed !important;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 150;
    width: 100vw;
    background: var(--bg-main);
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.05);
    border-top: 1px solid var(--border-color);
    padding-bottom: env(safe-area-inset-bottom);
    transition: none;
  }

  @media (min-width: 1024px) {
    .mobile-bottom-nav-fixed {
      display: none !important;
    }
  }

  /* Defensive: Always keep top nav sticky */
  .desktop-top-nav-sticky {
    position: sticky !important;
    top: 0;
    z-index: 50;
    width: 100vw;
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .dark .desktop-top-nav-sticky {
    background: rgba(11, 15, 14, 0.8);
  }
}

/* Typography Extensions */
.font-poppins {
  font-family: 'Inter', sans-serif;
}

/* Map Poppins to Inter globally */

/* Clean Solid Cards replacing Glass */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  box-shadow: none;
  transition: all 0.2s ease-in-out;
  border-radius: 4px;
}

.dark .glass-card {
  box-shadow: none;
}

.glass-card:hover {
  border-color: rgba(26, 26, 27, 0.3);
  box-shadow: none;
}

.dark .glass-card:hover {
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: none;
}

/* Removed heavy animations and gradients */


.text-gradient {
  color: var(--primary);
}

.text-mint {
  color: var(--mint);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  font-weight: 400;
  transition: all 0.2s;
  box-shadow: none;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: none;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.75rem 1.75rem;
  border-radius: 4px;
  font-weight: 400;
  transition: all 0.2s;
}

.dark .btn-secondary {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.1);
  color: white;
}

.btn-secondary:hover {
  background-color: rgba(0, 0, 0, 0.05);
  border-color: var(--text-main);
}

.dark .btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: white;
}

/* Custom Range Inputs */
input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border-color);
  border-radius: 0;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 24px;
  background: var(--primary);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.2s;
}

input[type=range]::-webkit-slider-thumb:hover {
  transform: none;
  background: var(--primary-hover);
}

/* Utilities */
.nav-link {
  color: var(--text-muted);
  font-weight: 400;
  transition: color 0.2s;
  position: relative;
}

.nav-link:hover {
  color: var(--primary);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s;
}

.nav-link:hover::after {
  width: 100%;
}

/* Removed duplicated root */

.input-value-box {
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
}

.dark .input-value-box {
  background-color: transparent;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.input-value-box:focus-within {
  border-color: var(--primary);
  box-shadow: none;
}

.dark .input-value-box:focus-within {
  border-color: var(--primary);
  box-shadow: none;
}


/* Utilities */
.hide-scrollbars {
  -ms-overflow-style: none;
  /* IE and Edge */
  scrollbar-width: none;
  /* Firefox */
}

.hide-scrollbars::-webkit-scrollbar {
  display: none;
}

/* Bell Wobble Animation */
@keyframes bell-wobble {
  0% {
    transform: rotate(0);
  }

  5% {
    transform: rotate(25deg);
  }

  10% {
    transform: rotate(-20deg);
  }

  15% {
    transform: rotate(15deg);
  }

  20% {
    transform: rotate(-10deg);
  }

  25% {
    transform: rotate(5deg);
  }

  30% {
    transform: rotate(0);
  }

  100% {
    transform: rotate(0);
  }
}

.animate-wobble-periodically {
  display: inline-block;
  animation: bell-wobble 4s ease-in-out infinite;
  transform-origin: center top;
}

/* Centralized Value Display */
.ui-value {
  font-size: 11px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

/* Alpine.js Cloak */
[x-cloak] {
  display: none !important;
}

/* Centralized UI Typographic System */
.ui-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: #4b5563; /* Slate-600 / Gray-600 */
}

/* Specific styling for Hub Badges (Clarity, Data as of, etc) */
.ui-badge-label {
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--primary-600);
}

.dark .ui-badge-label {
  color: var(--teal-400);
}

/* Centralized Copy / Description styling */
.ui-description {
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
  color: var(--text-muted);
}

@media (min-width: 768px) {
  .ui-description {
    font-size: 1.125rem;
  }
}

/* Institutional Grade Header Titles */
.ui-page-title {
  font-family: inherit;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--text-main);
  font-size: 2.25rem;
  /* 4xl */
}

@media (min-width: 640px) {
  .ui-page-title {
    font-size: 3rem;
    /* 5xl */
  }
}

@media (min-width: 768px) {
  .ui-page-title {
    font-size: 3.75rem;
    /* 6xl */
  }
}

.ui-value {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-main);
  font-variant-numeric: tabular-nums;
}

.ui-label-xs {
  font-size: 8px;
}

.ui-value-lg {
  font-size: 14px;
}

.ui-value-bold {
  color: var(--text-main);
}

/* Still font-normal, but ensures black color */
.ui-label-tracked {
  letter-spacing: 0.2em;
}