/* Base styles and Tailwind-like utility classes */
body {
  margin: 0;
  font-family: "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.5;
  /* Prevent accidental sideways scroll on mobile */
  overflow-x: hidden;
}

/* Mobile-safe global defaults */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: clip; /* prevent horizontal scroll at root */
}

/* Keep body hidden horizontally but allow vertical scrolling smoothly */
body {
  -webkit-text-size-adjust: 100%;
}

/* Fluid media to avoid overflow */
img,
video,
canvas,
svg,
iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ensure flex/grid children can shrink and not cause overflow */
.flex > *,
.grid > * {
  min-width: 0;
}

/* Clamp primary regions to viewport width and clip overflow */
header,
main,
footer,
.page-frame,
.container {
  max-width: 100vw;
  overflow-x: clip;
}

/* Ensure containers never exceed the viewport on small devices */
.container {
  max-width: min(1280px, 100%);
}

/* Custom colors for a greenish, futuristic theme */
:root {
  --color-emerald-50: #ecfdf5;
  --color-emerald-100: #d1fae5;
  --color-emerald-200: #a7f3d0;
  --color-emerald-300: #6ee7b7;
  --color-emerald-400: #34d399; /* Primary accent green */
  --color-emerald-500: #10b981;
  --color-emerald-600: #059669; /* Darker green for buttons */
  --color-emerald-700: #047857; /* Border green */
  --color-emerald-800: #065f46;
  --color-emerald-900: #064e3b;
  --color-emerald-950: #022c22; /* Very dark green for backgrounds */

  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937; /* Dark gray for cards/sections */
  --color-gray-900: #111827; /* Darker gray for header/footer */
  --color-gray-950: #030712; /* Deepest dark for main background */
}

/* Utility classes (simplified Tailwind-like) */
.container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}
.my-auto {
  margin-top: auto;
  margin-bottom: auto;
}
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.flex-row {
  flex-direction: row;
}
.flex-1 {
  flex: 1 1 0%;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-1 {
  gap: 0.25rem;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-3 {
  gap: 0.75rem;
}
.gap-4 {
  gap: 1rem;
}
.gap-6 {
  gap: 1.5rem;
}
.gap-8 {
  gap: 2rem;
}
.gap-10 {
  gap: 2.5rem;
}
.space-x-4 > *:not(:first-child) {
  margin-left: 1rem;
}
.space-x-6 > *:not(:first-child) {
  margin-left: 1.5rem;
}
.space-y-2 > *:not(:first-child) {
  margin-top: 0.5rem;
}
.space-y-3 > *:not(:first-child) {
  margin-top: 0.75rem;
}
.space-y-4 > *:not(:first-child) {
  margin-top: 1rem;
}
.space-y-6 > *:not(:first-child) {
  margin-top: 1.5rem;
}
.grid {
  display: grid;
}
.grid-cols-1 {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

/* IMPORTANT: responsive grid utilities must be inside media queries */
@media (min-width: 640px) {
  .sm\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 768px) {
  .md\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .md\:grid-cols-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .md\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1280px) {
  .xl\:grid-cols-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .xl\:grid-cols-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.hidden {
  display: none;
}
.block {
  display: block;
}
.relative {
  position: relative;
}
.absolute {
  position: absolute;
}
.fixed {
  position: fixed;
}
.inset-0 {
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
}
.top-4 {
  top: 1rem;
}
.right-4 {
  right: 1rem;
}
.z-0 {
  z-index: 0;
}
.z-10 {
  z-index: 10;
}
.z-20 {
  z-index: 20;
}
.z-50 {
  z-index: 50;
}
.z-\[100\] {
  z-index: 100;
}
.p-4 {
  padding: 1rem;
}
.p-6 {
  padding: 1.5rem;
}
.p-8 {
  padding: 2rem;
}
.py-10 {
  padding-top: 2.5rem;
  padding-bottom: 2.5rem;
}
.py-16 {
  padding-top: 4rem;
  padding-bottom: 4rem;
}
.py-20 {
  padding-top: 5rem;
  padding-bottom: 5rem;
}
.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.py-3\.5 {
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
}
.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}
.px-6 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}
.px-7 {
  padding-left: 1.75rem;
  padding-right: 1.75rem;
}
.px-8 {
  padding-left: 2rem;
  padding-right: 2rem;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-3 {
  margin-bottom: 0.75rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-6 {
  margin-bottom: 1.5rem;
}
.mb-8 {
  margin-bottom: 2rem;
}
.mb-10 {
  margin-bottom: 2.5rem;
}
.mb-12 {
  margin-bottom: 3rem;
}
.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mt-8 {
  margin-top: 2rem;
}
.ml-1 {
  margin-left: 0.25rem;
}
.min-h-screen {
  min-height: 100vh;
}
.min-h-svh {
  min-height: 100svh;
}
.w-full {
  width: 100%;
}
.max-w-md {
  max-width: 28rem;
}
.max-w-2xl {
  max-width: 42rem;
}
.max-w-3xl {
  max-width: 48rem;
}
.max-w-6xl {
  max-width: 72rem;
}
.max-w-xl {
  max-width: 36rem;
}
.rounded-lg {
  border-radius: 0.5rem;
}
.rounded-full {
  border-radius: 9999px;
}
.shadow-lg {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.shadow-xl {
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.shadow-2xl {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.shadow-md {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}
.shadow-inner {
  box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
}
.border {
  border-width: 1px;
}
.border-2 {
  border-width: 2px;
}
.border-3 {
  border-width: 3px; /* thicker outline */
}
.border-b {
  border-bottom-width: 1px;
}
.last\:border-b-0:last-child {
  border-bottom-width: 0;
}
.last\:pb-0:last-child {
  padding-bottom: 0;
}
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-sm {
  font-size: 0.875rem;
  line-height: 1.25rem;
}
.text-xs {
  font-size: 0.75rem;
  line-height: 1rem;
}
.text-lg {
  font-size: 1.125rem;
  line-height: 1.75rem;
}
.text-xl {
  font-size: 1.25rem;
  line-height: 1.75rem;
}
.text-2xl {
  font-size: 1.5rem;
  line-height: 2rem;
}
.text-3xl {
  font-size: 1.875rem;
  line-height: 2.25rem;
}
.text-4xl {
  font-size: 2.25rem;
  line-height: 2.5rem;
}
.text-5xl {
  font-size: 3rem;
  line-height: 1;
}
.text-6xl {
  font-size: 3.75rem;
  line-height: 1;
}
.text-7xl {
  font-size: 4.5rem;
  line-height: 1;
}
.font-inter {
  font-family: "Inter", sans-serif;
}
.font-bold {
  font-weight: 700;
}
.font-extrabold {
  font-weight: 800;
}
.font-semibold {
  font-weight: 600;
}
.font-medium {
  font-weight: 500;
}
.font-normal {
  font-weight: 400;
}
.font-light {
  font-weight: 300;
}
.font-thin {
  font-weight: 100;
}
.font-mono {
  font-family: monospace;
}
.leading-tight {
  line-height: 1.25;
}
.italic {
  font-style: italic;
}
.underline {
  text-decoration: underline;
}
.hover\:underline:hover {
  text-decoration: underline;
}
.transition-colors {
  transition: color, background-color, border-color 150ms ease;
}
.transition-all {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.duration-200 {
  transition-duration: 200ms;
}
.duration-300 {
  transition-duration: 300ms;
}
.duration-500 {
  transition-duration: 500ms;
}
.transform {
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x))
    skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
}
.hover\:scale-105:hover {
  --tw-scale-x: 1.05;
  --tw-scale-y: 1.05;
}
.drop-shadow-lg {
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.04)) drop-shadow(0 4px 3px rgba(0, 0, 0, 0.1));
}
.opacity-0 {
  opacity: 0;
}
.opacity-10 {
  opacity: 0.1;
}
.opacity-50 {
  opacity: 0.5;
}
.opacity-70 {
  opacity: 0.7;
}
.pointer-events-none {
  pointer-events: none;
}
.cursor-not-allowed {
  cursor: not-allowed;
}
.overflow-hidden {
  overflow: hidden;
}
.overflow-auto {
  overflow: auto;
}
.overflow-x-auto {
  overflow-x: auto;
}
.min-w-full {
  min-width: 100%;
}
.w-4 {
  width: 1rem;
}
.w-5 {
  width: 1.25rem;
}
.w-6 {
  width: 1.5rem;
}
.w-9 {
  width: 2.25rem;
}
.w-12 {
  width: 3rem;
}
.w-16 {
  width: 4rem;
}
.h-4 {
  height: 1rem;
}
.h-5 {
  height: 1.25rem;
}
.h-6 {
  height: 1.5rem;
}
.h-9 {
  height: 2.25rem;
}
.h-12 {
  height: 3rem;
}
.h-16 {
  height: 4rem;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
.uppercase {
  text-transform: uppercase;
}
.tracking-wide {
  letter-spacing: 0.05em;
}

/* Custom colors */
.bg-gray-950 {
  background-color: var(--color-gray-950);
}
.bg-gray-900 {
  background-color: var(--color-gray-900);
}
.bg-gray-800 {
  background-color: var(--color-gray-800);
}
.bg-gray-700 {
  background-color: var(--color-gray-700);
}
.bg-emerald-600 {
  background-color: var(--color-emerald-600);
}
.bg-emerald-900\/20 {
  background-color: rgba(6, 78, 59, 0.2);
}
.hover\:bg-emerald-700:hover {
  background-color: var(--color-emerald-700);
}
.hover\:bg-emerald-600:hover {
  background-color: var(--color-emerald-600);
}
.hover\:bg-gray-700:hover {
  background-color: var(--color-gray-700);
}
.text-gray-100 {
  color: var(--color-gray-100);
}
.text-gray-200 {
  color: var(--color-gray-200);
}
.text-gray-300 {
  color: var(--color-gray-300);
}
.text-gray-400 {
  color: var(--color-gray-400);
}
.text-gray-500 {
  color: var(--color-gray-500);
}
.text-emerald-300 {
  color: var(--color-emerald-300);
}
.text-emerald-400 {
  color: var(--color-emerald-400);
}
.text-red-500 {
  color: #ef4444;
}
.text-green-500 {
  color: #22c55e;
}
.text-yellow-500 {
  color: #eab308;
}
.text-orange-400 {
  color: #fb923c;
}
.text-white {
  color: #fff;
}
.border-emerald-500 {
  border-color: var(--color-emerald-500);
}
.border-emerald-700 {
  border-color: var(--color-emerald-700);
}
.border-emerald-500 {
  border-color: var(--color-emerald-500);
}
.border-gray-600 {
  border-color: var(--color-gray-600);
}
.border-gray-700 {
  border-color: var(--color-gray-700);
}
.border-gray-800 {
  border-color: var(--color-gray-800);
}
.focus\:ring-emerald-500:focus {
  outline: 2px solid var(--color-emerald-500);
  outline-offset: 2px;
}
.hover\:text-emerald-400:hover {
  color: var(--color-emerald-400);
}
.hover\:text-white:hover {
  color: #fff;
}

/* Background Gradients */
.bg-gradient-to-br {
  background-image: linear-gradient(to bottom right, var(--tw-gradient-stops));
}
.from-gray-950 {
  --tw-gradient-from: var(--color-gray-950);
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to, rgba(2, 7, 18, 0));
}
.via-gray-900 {
  --tw-gradient-stops: var(--tw-gradient-from), var(--color-gray-900), var(--tw-gradient-to, rgba(17, 24, 39, 0));
}
.to-emerald-950 {
  --tw-gradient-to: var(--color-emerald-950);
}

/* CM Logo Animation for Loading Screen */
.cm-logo-container {
  font-family: "Orbitron", sans-serif;
  font-size: 8rem;
  font-weight: 900;
  color: transparent;
  -webkit-text-stroke: 2px var(--color-emerald-400);
  position: relative;
  display: flex;
  overflow: hidden;
}

.cm-logo-char {
  display: inline-block;
  position: relative;
}
.cm-logo-char-c::before,
.cm-logo-char-m::before {
  content: attr(data-char);
  position: absolute;
  top: 0;
  left: 0;
  color: var(--color-emerald-400);
  overflow: hidden;
  white-space: nowrap;
  animation-fill-mode: forwards;
}
.cm-logo-char-c::before {
  width: 0;
  animation: write-c 1s ease-out forwards;
}
.cm-logo-char-m::before {
  width: 0;
  animation: write-m 1s ease-out forwards 0.5s;
}

@keyframes write-c {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}
@keyframes write-m {
  0% {
    width: 0;
  }
  100% {
    width: 100%;
  }
}

.cm-logo-text {
  font-family: "Orbitron", sans-serif;
  font-weight: 900;
}

/* Responsive flex-row helper */
@media (min-width: 640px) {
  .sm\:flex-row {
    flex-direction: row;
  }
}

/* Mobile nav legacy (kept) */
.mobile-nav {
  display: none;
  background: #2ecc71;
  padding: 0.75rem 1rem;
}
.mobile-nav__brand {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mobile-nav__logo {
  font-weight: bold;
  color: #fff;
  text-decoration: none;
  font-size: 1.25rem;
}
.mobile-nav__toggle {
  font-size: 1.5rem;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}
.mobile-nav__menu {
  display: none;
  flex-direction: column;
  margin-top: 0.5rem;
  list-style: none;
  padding: 0;
}
.mobile-nav__menu li + li {
  margin-top: 0.25rem;
}
.mobile-nav__menu li a {
  display: block;
  padding: 0.5rem 0;
  color: #fff;
  text-decoration: none;
  font-size: 1rem;
}
.mobile-nav__menu.active {
  display: flex;
}
@media (max-width: 768px) {
  .desktop-nav {
    display: none !important;
  }
  .mobile-nav {
    display: block;
  }
}

/* NEW: CTA button with thicker emerald outline */
.btn-outline-emerald-thick {
  border: 3px solid var(--color-emerald-400);
  color: var(--color-emerald-400);
  background: transparent;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 700;
  transition: all 150ms ease;
}
.btn-outline-emerald-thick:hover {
  background: var(--color-emerald-600);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

/* NEW: Stats grid for landing page (mobile 1, md 2, xl 4) */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1280px) {
  .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Helper to hide app sidebar/nav when needed (auth pages) */
.page--no-nav .app-sidebar {
  display: none !important;
}

/* NEW: User-controlled sidebar collapse */
body.sidebar-collapsed .app-sidebar {
  display: none !important;
}
body.sidebar-collapsed .page-frame {
  display: flex; /* no flex gap when sidebar is absent */
  gap: 0 !important;
}

/* Helper to hide app sidebar/nav when using top slide-down nav */
body.use-topnav .app-sidebar {
  display: none !important;
}
body.use-topnav .page-frame {
  gap: 0 !important;
}

/* Top slide-down nav styles */
.topnav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 49; /* under panel */
}
.topnav-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.topnav-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  transform: translateY(-100%);
  transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  background: #0b1220; /* dark surface */
  border-bottom: 1px solid #1f2937;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  z-index: 50;
  max-height: 85vh;
  overflow-y: auto;
}
.topnav-panel.open {
  transform: translateY(0);
}

/* Links within the panel */
.topnav-link {
  display: block;
  padding: 12px 14px;
  border: 1px solid #1f2937;
  border-radius: 10px;
  color: #e5e7eb;
  background: #0f172a;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.topnav-link:hover {
  background: #13203a;
  border-color: #374151;
  color: #ffffff;
}

/* Fix: Center content and remove legacy gutter when using top nav only */
body.use-topnav .page-frame {
  display: block; /* no flex gap when sidebar is absent */
}
body.use-topnav .page-frame > main {
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: 1rem;
  width: 100%;
}

/* Ensure icons align nicely in KPI cards */
i[data-lucide] {
  display: inline-block;
  line-height: 1;
}

/* Center page content and remove leftover gap when using top nav */
body.use-topnav .page-frame {
  gap: 0 !important;
}
body.use-topnav .page-frame > main {
  max-width: 1280px; /* professional readable line-length */
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem; /* consistent gutters */
  padding-right: 1rem;
  width: 100%;
}

/* Stronger safeguard: never show legacy sidebar when using top nav */
body.use-topnav .app-sidebar {
  display: none !important;
}

/* Admin-only sub-navigation */
.admin-subnav {
  position: sticky;
  top: 0; /* stays below the admin header; header isn't fixed, so 0 is fine */
  z-index: 19;
  background-color: var(--color-gray-900);
  border-bottom: 1px solid var(--color-gray-800);
}
.admin-subnav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
}
.admin-subnav__left {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.admin-subnav__right {
  display: none;
  gap: 8px;
}
@media (min-width: 768px) {
  .admin-subnav__right {
    display: flex;
  }
}
.admin-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--color-gray-800);
  border-radius: 10px;
  color: var(--color-gray-200);
  background: #0f172a;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}
.admin-link:hover {
  background: #13203a;
  border-color: #374151;
  color: #ffffff;
}
.admin-link.is-active {
  background: linear-gradient(180deg, #0f1512 0%, #0b0f0d 100%);
  border-color: var(--color-emerald-700);
  color: #e6f3ec;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.admin-link--ghost {
  background: transparent;
  color: #b0f2de;
  border-color: #163227;
}
.admin-link--ghost:hover {
  background: #102019;
  border-color: #163227;
  color: #f0fdf4;
}
.admin-link--danger {
  background: transparent;
  color: #fecaca;
  border-color: #3f1f23;
}
.admin-link--danger:hover {
  background: #1a0f12;
  border-color: #ef4444;
  color: #fff;
}

/* Footer: professional quick links */
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.footer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-gray-800);
  border-radius: 10px;
  background: #0f172a;
  color: #e5e7eb;
  text-decoration: none;
  font-weight: 600;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
  outline: none;
}
.footer-link:hover {
  background: #13203a;
  border-color: #374151;
  color: #ffffff;
  transform: translateY(-1px);
}
.footer-link:focus-visible {
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  border-color: var(--color-emerald-700);
}
.footer-link__label {
  color: #cfeee5; /* subtle emerald-leaning text */
  font-weight: 600;
}
.footer-link__icon {
  color: #6ee7b7; /* emerald-300 */
  flex-shrink: 0;
}

/* Footer: contact and legal sections */
.footer-contact {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-gray-800);
  border-radius: 10px;
  background: #0f172a;
  color: #d1d5db;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.contact-item:hover {
  background: #13203a;
  border-color: #374151;
  color: #ffffff;
  transform: translateY(-1px);
}
.contact-item__icon {
  color: #6ee7b7; /* emerald-300 */
  flex-shrink: 0;
}
.contact-item__content {
  display: flex;
  flex-direction: column;
}
.contact-link {
  color: #cfeee5;
  font-weight: 600;
  text-decoration: none;
}
.contact-link:hover {
  color: #ffffff;
  text-decoration: underline;
}
.contact-subtle {
  color: #9ca3af;
  font-size: 12px;
}

.footer-legal {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--color-gray-800);
  border-radius: 10px;
  background: #0f172a;
}
.legal-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d1d5db;
}
.legal-row__icon {
  color: #6ee7b7;
  flex-shrink: 0;
}
.legal-muted {
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.5;
}

/* Tweak: ensure footer cards align well on small screens */
@media (max-width: 767px) {
  .footer-links,
  .footer-contact,
  .footer-legal {
    text-align: left;
  }
}

.footer-card {
  border: 1px solid var(--color-gray-800);
  border-radius: 10px;
  background: #0f172a;
  padding: 12px;
}

/* Optional: ensure text is left-aligned on small screens */
@media (max-width: 767px) {
  .footer-card {
    text-align: left;
  }
}

/* CM Account Layout + Sidebar */
.cm-account {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 16px;
}
@media (min-width: 1024px) {
  .cm-account {
    grid-template-columns: 260px 1fr;
    align-items: start;
  }
}
.cm-account__main {
  min-width: 0;
}

/* Sidebar */
.cm-sidenav {
  background: #0f172a;
  border: 1px solid var(--color-gray-800);
  border-radius: 12px;
  padding: 12px;
  position: sticky;
  top: 84px; /* under sticky header */
}
.cm-sidenav__title {
  font-weight: 900;
  color: #e6f3ec;
  margin: 4px 6px 10px;
  font-size: 18px;
}
.cm-sidenav__menu {
  display: grid;
  gap: 6px;
}
.cm-sidenav__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-gray-800);
  border-radius: 10px;
  color: #cfeee5;
  text-decoration: none;
  font-weight: 600;
  background: #0b1220;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.cm-sidenav__link:hover {
  background: #13203a;
  border-color: #374151;
  color: #ffffff;
  transform: translateY(-1px);
}
.cm-sidenav__link.is-active {
  border-color: var(--color-emerald-700);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.03);
  background: linear-gradient(180deg, #0f1512 0%, #0b0f0d 100%);
  color: #e6f3ec;
}
.cm-sidenav__icon {
  color: #6ee7b7;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
}
.cm-sidenav__label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Small cards / KPIs on profile intro */
.cm-kpi {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--color-gray-700);
  border-radius: 10px;
  background: #0b1220;
}
.cm-kpi__label {
  color: #9ca3af;
  font-size: 12px;
}
.cm-kpi__value {
  color: #e5e7eb;
  font-weight: 700;
}

/* Alerts */
.cm-alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
}
.cm-alert--success {
  background: #0b2a1e;
  color: #def7ec;
  border: 1px solid #1f5c48;
}
.cm-alert--error {
  background: #2a0b12;
  color: #fde2e2;
  border: 1px solid #5c1f25;
}

/* CM: TradingView Chart block */
.cmx-chart {
  margin-top: 10px;
  background: #0b0f0d;
  border: 1px solid #13223b;
  border-radius: 10px;
  overflow: hidden;
}
.cmx-chart__inner {
  width: 100%;
  /* Responsive, reliable height so TradingView can autosize properly */
  height: clamp(460px, 62vh, 820px);
  min-height: 420px;
}
@media (min-width: 1024px) {
  .cmx-chart__inner {
    height: clamp(520px, 65vh, 880px);
  }
}

/* ========== CMX DASHBOARD RESTORED STYLES (matches original screenshot) ========== */

/* Shell strip */
.cmx-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid #163227;
  border-radius: 10px;
  background: #0f172a;
}
.cmx-strip__hello {
  font-weight: 800;
  color: #e6f3ec;
}
.cmx-strong {
  color: #a7f3d0;
}
.cmx-strip__muted {
  color: #94a3b8;
  font-weight: 600;
}
.cmx-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid #115e59;
  background: #052e2b;
  color: #a7f3d0;
}

/* Sections and headings */
.cmx-section {
  margin-top: 16px;
}
.cmx-heading {
  font-size: 28px;
  line-height: 1.1;
  margin: 0 0 12px 0;
  text-transform: uppercase;
  font-weight: 900;
  color: #d1fae5;
  letter-spacing: 0.02em;
  border-left: 4px solid #10b981;
  padding-left: 10px;
  filter: drop-shadow(0 0 6px rgba(16, 185, 129, 0.25));
}
.cmx-heading--center {
  text-align: center;
  border-left: 0;
  padding-left: 0;
}

/* Grid layouts */
.cmx-grid {
  display: grid;
  gap: 12px;
}
.cmx-grid--triples {
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .cmx-grid--triples {
    grid-template-columns: repeat(3, 1fr);
  }
}
.cmx-grid--cta {
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .cmx-grid--cta {
    grid-template-columns: repeat(3, 1fr);
  }
}
.cmx-grid--duo {
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .cmx-grid--duo {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Cards */
.cmx-card {
  border: 1px solid #163227;
  border-radius: 12px;
  background: #0b1220;
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02), 0 6px 18px rgba(0, 0, 0, 0.25);
}
.cmx-card--wide {
  display: flex;
  align-items: center;
  gap: 12px;
}
.cmx-card__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.cmx-card__icon {
  font-size: 18px;
  color: #6ee7b7;
}
.cmx-card__title {
  color: #9ca3af;
  font-weight: 700;
}
.cmx-card__label {
  color: #9ca3af;
  font-size: 12px;
}
.cmx-card__value {
  color: #e5e7eb;
  font-weight: 800;
  font-size: 20px;
}
.cmx-card__value--xl {
  font-size: 34px;
  line-height: 1.2;
  word-break: break-word;
}
.cmx-card__actions {
  margin-top: 10px;
}

/* Buttons */
.cmx-btn {
  --ring: #059669;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  border: 2px solid transparent;
}
.cmx-btn:focus-visible {
  outline: 3px solid rgba(16, 185, 129, 0.35);
  outline-offset: 2px;
}
.cmx-btn--primary {
  background: #10b981;
  color: #06140f;
  border-color: #059669;
}
.cmx-btn--ghost {
  background: #0b1720;
  color: #b0f2de;
  border-color: #163227;
}
.cmx-btn--ghost:hover {
  background: #0f2234;
  color: #fff;
  border-color: #1f3b2e;
}

/* Table */
.cmx-table {
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  border: 1px solid #163227;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
}
.cmx-table th,
.cmx-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #13223b;
}
.cmx-table thead th {
  background: #0e1726;
  color: #cdeee4;
  text-align: left;
}
.cmx-table tbody tr:last-child td {
  border-bottom: 0;
}
.cmx-empty {
  color: #94a3b8;
  text-align: center;
  padding: 12px;
}

/* Chart container (full height) */
.cmx-chart {
  margin-top: 10px;
  background: #0b0f0d;
  border: 1px solid #13223b;
  border-radius: 10px;
  overflow: hidden;
}
.cmx-chart__inner {
  width: 100%;
  height: clamp(460px, 62vh, 820px);
  min-height: 420px;
}
@media (min-width: 1024px) {
  .cmx-chart__inner {
    height: clamp(520px, 65vh, 880px);
  }
}

/* ========== CM LOADING OVERLAY WITH "C→M WATER FILL" ========== */
.cm-loader {
  position: fixed;
  inset: 0;
  background: #070c13;
  display: none;
  place-items: center;
  z-index: 1000;
}
.cm-loader.is-visible {
  display: grid;
}
.cm-logo {
  position: relative;
  display: inline-flex;
  gap: 6px;
  align-items: baseline;
}
.cm-logo__cm {
  position: relative;
  font-weight: 1000;
  font-size: 56px;
  letter-spacing: 0.5px;
  color: #0f2b24; /* base fallback */
  -webkit-text-stroke: 2px rgba(52, 211, 153, 0.75);
  text-stroke: 2px rgba(52, 211, 153, 0.75);
  filter: drop-shadow(0 0 10px rgba(16, 185, 129, 0.35));
  /* outline/write reveal */
  clip-path: inset(0 100% 0 0);
  animation: cmReveal 900ms ease-out forwards;
}
.cm-logo__cm::after {
  content: "CM";
  position: absolute;
  inset: 0;
  background: radial-gradient(
      120% 180% at 0% 100%,
      rgba(34, 197, 94, 0.85) 0%,
      rgba(16, 185, 129, 0.6) 35%,
      rgba(16, 185, 129, 0.28) 58%,
      rgba(0, 0, 0, 0) 72%
    )
    0% 100% / 220% 200% no-repeat, linear-gradient(180deg, #34d399 0%, #10b981 100%) 0 0 / 100% 100% no-repeat;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  clip-path: polygon(0 100%, 0 100%, 0 100%, 0 100%);
  animation: cmFill 1500ms cubic-bezier(0.22, 0.8, 0.29, 0.99) 120ms forwards, cmWave 2200ms ease-in-out 120ms infinite
    alternate;
}
.cm-logo__cap {
  font-weight: 900;
  font-size: 18px;
  color: #e6f3ec;
  margin-left: 6px;
}

@keyframes cmReveal {
  0% {
    clip-path: inset(0 100% 0 0);
    opacity: 0;
    transform: translateY(3px);
  }
  55% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    clip-path: inset(0 0 0 0);
  }
}
@keyframes cmFill {
  0% {
    clip-path: polygon(0 100%, 0 100%, 0 100%, 0 100%);
  }
  35% {
    clip-path: polygon(0 60%, 45% 60%, 45% 100%, 0 100%);
  }
  70% {
    clip-path: polygon(0 0%, 75% 0%, 75% 100%, 0 100%);
  }
  100% {
    clip-path: polygon(0 0%, 100% 0%, 100% 100%, 0 100%);
  }
}
@keyframes cmWave {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(6%);
  }
}
