/* ============================================================
   ATENA CRYPTO — BASE DESIGN SYSTEM
   Bloomberg Terminal / Dune Analytics aesthetic
   Warm near-black · Deeper emerald · Institutional density
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Outfit:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* ══ CORE SURFACES ══ */
  --bg-base:        #0A0E14;
  --bg-surface-1:   #10161F;
  --bg-surface-2:   #161D28;
  --bg-surface-3:   #1D2532;
  --bg-overlay:     rgba(10,14,20,0.88);

  /* Legacy aliases — keep all existing pages working */
  --bg-primary:   #0A0E14;
  --bg-secondary: #0F141C;
  --bg-card:      #0F141C;
  --bg-elevated:  #151B26;
  --bg-hover:     #1C2431;
  --bg-glass:     rgba(15,20,28,0.82);

  /* Atmospheric tint */
  --bg-tint-warm: rgba(0,197,102,0.015);
  --bg-tint-cool: rgba(80,120,200,0.02);

  /* ══ BORDERS ══ */
  --border-subtle:  rgba(255,255,255,0.035);
  --border-default: rgba(255,255,255,0.07);
  --border-strong:  rgba(255,255,255,0.12);
  --border-accent:  rgba(0,197,102,0.28);

  /* Legacy glass aliases */
  --glass-border:        rgba(255,255,255,0.09);
  --glass-border-hover:  rgba(255,255,255,0.15);
  --glass-shine:         rgba(255,255,255,0.06);
  --border:              rgba(255,255,255,0.09);
  --border-hover:        rgba(255,255,255,0.15);
  --glass-bg:            rgba(15,20,28,0.82);
  --glass-border-legacy: rgba(255,255,255,0.09);

  /* ══ TYPOGRAPHY COLORS ══ */
  --text:           #E8ECF1;
  --text-secondary: #AAB3C0;
  --text-tertiary:  #6C7684;
  --text-muted:     #4A5262;
  --text-inverse:   #0A0E14;

  /* Legacy text aliases */
  --text-dim:   #6C7684;
  --text-faint: #4A5262;

  /* ══ ACCENT COLORS — deeper, more saturated ══ */
  --green:          #00C566;
  --green-bright:   #1FE084;
  --green-dim:      rgba(0,197,102,0.12);
  --green-glow:     rgba(0,197,102,0.35);

  --red:            #E54360;
  --red-bright:     #FF5A78;
  --red-dim:        rgba(229,67,96,0.12);
  --red-glow:       rgba(229,67,96,0.35);

  /* ══ SEMANTIC ══ */
  --positive:     #00C566;
  --negative:     #E54360;
  --warning:      #F0B040;
  --warning-dim:  rgba(240,176,64,0.12);
  --info:         #4A9EFF;
  --info-dim:     rgba(74,158,255,0.12);
  --neutral:      #8891A0;
  --accent:       #00C566;
  --accent-light: #1FE084;
  --green-text:   #1FE084;
  --red-text:     #FF5A78;

  /* ══ DATA VIZ PALETTE ══ */
  --data-1: #00C566;
  --data-2: #4A9EFF;
  --data-3: #F0B040;
  --data-4: #B46AFF;
  --data-5: #FF8A5B;
  --data-6: #3FD8C8;
  --data-7: #E54360;
  --data-8: #8891A0;

  /* ══ TYPOGRAPHY ══ */
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Type scale */
  --text-xs:   0.6875rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-md:   1.0625rem;
  --text-lg:   1.25rem;
  --text-xl:   1.5rem;
  --text-2xl:  2rem;
  --text-3xl:  2.75rem;

  /* Letter spacing */
  --tracking-tight: -0.015em;
  --tracking-base:  -0.005em;
  --tracking-wide:  0.02em;
  --tracking-mono:  0.01em;

  /* Line heights */
  --lh-tight: 1.2;
  --lh-base:  1.5;
  --lh-loose: 1.7;

  /* ══ SPACING — 4px grid ══ */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* ══ RADIUS — pill first, rounded second ══ */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius:      10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-2xl:  28px;
  --radius-pill: 999px;
  --radius-full: 999px;

  /* ══ SHADOWS ══ */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.5);
  --shadow-xl:  0 24px 64px rgba(0,0,0,0.6);
  --shadow-panel:       0 2px 8px rgba(0,0,0,0.35);
  --shadow-panel-hover: 0 4px 16px rgba(0,0,0,0.45);
  --shadow-glow-green:  0 0 32px rgba(0,197,102,0.18);
  --shadow-glow-red:    0 0 32px rgba(229,67,96,0.18);

  /* ══ TRANSITIONS ══ */
  --ease:     cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 360ms;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

/* ── SELECTION ── */
::selection      { background: var(--green-dim); color: var(--green-bright); }
::-moz-selection { background: var(--green-dim); color: var(--green-bright); }

/* ── BODY ── warm near-black with subtle atmospheric gradient ── */
body {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0,197,102,0.05), transparent 60%),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(74,158,255,0.03), transparent 60%),
    var(--bg-base);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-display);
  font-size: var(--text-base);
  line-height: var(--lh-base);
  letter-spacing: var(--tracking-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Subtle noise/grain texture — the Bloomberg/Dune secret */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* Keep existing atmospheric gradient on ::before */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 40%, rgba(0,197,102,0.04), transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(229,67,96,0.025), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── LINKS ── */
a { color: var(--text-secondary); text-decoration: none; transition: color var(--dur-base) var(--ease); }
a:hover { color: var(--text); }

/* ── HEADINGS ── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-tight);
  color: var(--text);
}
h1 { font-size: clamp(32px, 4vw, 48px); font-weight: 300; letter-spacing: -0.02em; line-height: 1.1; }
h1 strong, h1 .bold { font-weight: 700; }
h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 400; letter-spacing: -0.015em; line-height: 1.2; margin-bottom: 1.5rem; }
h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }

p { font-size: 15px; line-height: 1.65; color: var(--text-secondary); }
p.lead, .lead { font-size: 17px; color: var(--text-secondary); line-height: 1.7; }

/* ── TABULAR NUMBERS ── monospace figures for all data ── */
.mono, code, pre, .num, .price, .ticker, .tabular, .value, .change {
  font-family: var(--font-mono);
  font-feature-settings: "tnum" 1, "zero" 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: var(--tracking-mono);
}

/* ── SCROLLBAR ── refined ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb {
  background: var(--bg-surface-3);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-base);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ── FOCUS ── */
*:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══════════════════════════════════════════════════════════
   PAGE LOADER
══════════════════════════════════════════════════════════ */

.ac-loader {
  position: fixed; inset: 0; z-index: 99999;
  background: var(--bg-base);
  display: flex; align-items: center; justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: all;
}
.ac-loader.fade-out {
  opacity: 0;
  pointer-events: none;
}
.ac-loader-logo {
  height: 40px;
  opacity: 0;
  transform: scale(0.95);
  animation: loaderReveal 0.5s ease-out 0.1s forwards;
  mix-blend-mode: lighten;
}
@keyframes loaderReveal {
  to { opacity: 1; transform: scale(1); }
}

/* ══════════════════════════════════════════════════════════
   NAVBAR — 56px, institutional
══════════════════════════════════════════════════════════ */

.navbar {
  position: sticky; top: 0; z-index: 200;
  display: flex; align-items: center;
  height: 64px; padding: 0 32px; gap: 1.25rem;
  background: rgba(10,14,20,0.70);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  /* Reserve flow space for the now-fixed crypto ticker (height 36px on desktop, 32px ≤640px) */
  margin-bottom: 36px;
}

.navbar::after {
  content: '';
  position: absolute;
  bottom: 0; left: 8%; right: 8%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,197,102,0.18), rgba(229,67,96,0.1), transparent);
  pointer-events: none;
}

.nav-inner { display: flex; align-items: center; width: 100%; gap: 1.25rem; }

.nav-logo, .logo {
  display: flex; align-items: center; gap: 0.5rem; font-weight: 700; flex-shrink: 0;
  color: var(--text); text-decoration: none;
  transition: opacity var(--dur-base) var(--ease);
}
.nav-logo:hover, .logo:hover { opacity: 0.85; }
.nav-logo img, .logo img { height: 24px; width: auto; mix-blend-mode: lighten; }
.logo-text {
  color: var(--text);
  font-size: 0.92rem; letter-spacing: var(--tracking-base);
  font-weight: 700;
}

/* ── NAV SEARCH ── */
.nav-search { position: relative; flex-shrink: 0; align-self: center; }
.nav-search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0 14px;
  height: 36px;
  width: 196px;
  transition: width 250ms var(--ease), background 200ms var(--ease), border-color 200ms var(--ease);
  cursor: text;
}
.nav-search-wrap:focus-within {
  width: 260px;
  background: rgba(255,255,255,0.06);
  border-color: var(--border-default);
}
.nav-search-icon { width: 13px; height: 13px; color: var(--text-tertiary); flex-shrink: 0; }
/* Higher specificity than input[type="text"] to prevent global input styles from inflating the bar */
input.nav-search-input {
  flex: 1; min-width: 0;
  background: none !important; border: none !important; outline: none !important;
  box-shadow: none !important; border-radius: 0 !important;
  color: var(--text); font-family: var(--font-display); font-size: 13px;
  padding: 0 !important; width: 100%; height: auto;
  backdrop-filter: none;
}
.nav-search-input::placeholder { color: var(--text-muted); }
.nav-search-kbd {
  font-family: var(--font-mono); font-size: 10px; color: var(--text-muted);
  background: var(--bg-surface-2); border: 1px solid var(--border-subtle);
  border-radius: 5px; padding: 1px 5px; flex-shrink: 0;
  pointer-events: none;
}
.nav-search-wrap:focus-within .nav-search-kbd { display: none; }

.nav-search-drop {
  position: absolute; top: calc(100% + 8px); left: 0;
  width: 320px; max-height: 420px; overflow-y: auto;
  background: var(--bg-surface-1); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 56px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.03);
  display: none; z-index: 9999;
}
.nav-search-drop.open { display: block; }
.nav-search-drop::-webkit-scrollbar { width: 3px; }
.nav-search-drop::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }

.nav-search-section {
  padding: 10px 16px 4px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--text-muted);
}
.nav-search-result {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px; cursor: pointer;
  transition: background 120ms var(--ease);
  text-decoration: none; color: var(--text);
}
.nav-search-result:hover,
.nav-search-result.focused { background: rgba(255,255,255,0.05); }
.nav-search-result-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--bg-surface-2); border: 1px solid var(--border-subtle);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.nav-search-result-name { font-size: 13px; font-weight: 500; color: var(--text); }
.nav-search-result-desc {
  font-size: 11px; color: var(--text-tertiary); margin-top: 1px;
  font-family: var(--font-mono);
}
.nav-search-empty {
  padding: 24px 16px; text-align: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary);
}

@media (max-width: 1100px) { .nav-search { display: none; } }

.nav-links { display: flex; gap: 0; flex: 1; margin-left: 0.25rem; justify-content: center; }
.nav-links a {
  color: var(--text-tertiary);
  font-size: 13px; font-weight: 500;
  padding: 8px 14px; border-radius: 999px;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  letter-spacing: var(--tracking-wide);
  white-space: nowrap;
  display: inline-flex; align-items: center; line-height: 1;
}
.nav-links a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav-links a.active {
  color: var(--green); font-weight: 600;
  background: rgba(0,197,102,0.08);
}

.nav-right { display: flex; gap: 0.5rem; align-items: center; margin-left: auto; flex-shrink: 0; }
/* Constrain any btn-primary used directly in the navbar to 36px-tall pill */
.nav-right .btn-primary {
  height: 36px; padding: 0 18px; font-size: 13px;
  white-space: nowrap; min-width: fit-content;
}

/* ── BUTTONS — pill-first design ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: var(--font-display); font-size: 14px; font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: 999px; border: 1px solid transparent;
  cursor: pointer; transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap; user-select: none; line-height: 1;
}
/* Ensure all button variants never wrap */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger,
.btn-chrome, .btn-chrome-ghost, .btn-outline, .btn-login,
.btn-upgrade, .btn-logout, .nav-logout {
  white-space: nowrap !important;
}
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 16px 32px; font-size: 15px; }

.btn-primary {
  background: var(--text); color: #000;
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  padding: 10px 22px; border-radius: 999px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; text-align: center;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-primary:hover {
  background: var(--green); color: #000;
  box-shadow: 0 8px 24px rgba(0,197,102,0.30);
  transform: translateY(-1px);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary.btn-lg { padding: 14px 28px; font-size: 15px; }

.btn-secondary {
  background: rgba(255,255,255,0.04); color: var(--text);
  border-color: var(--border-default);
  font-family: var(--font-display); font-weight: 500; font-size: 14px;
  padding: 10px 22px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center;
  backdrop-filter: blur(10px);
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.08); border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--text-secondary); background: transparent;
  font-size: 14px; font-weight: 500;
  padding: 10px 22px; border-radius: 999px;
  transition: color var(--dur-base) var(--ease), background var(--dur-base) var(--ease);
}
.btn-ghost:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.btn-danger {
  background: var(--red-dim); color: var(--red-bright);
  border: 1px solid rgba(229,67,96,0.2);
  font-family: var(--font-display); font-weight: 500; font-size: 14px;
  padding: 10px 22px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-danger:hover { background: var(--red); color: #fff; }

.btn-chrome {
  position: relative;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 16px 32px;
  font-family: var(--font-display); font-size: 15px; font-weight: 700; letter-spacing: -0.005em;
  color: #000;
  background: linear-gradient(135deg, #00C566 0%, #4AE3A0 15%, #FFFFFF 40%, #FFFFFF 55%, #FF7A9B 80%, #E54360 100%);
  background-size: 250% 250%; background-position: 0% 50%;
  border: none; border-radius: 999px; cursor: pointer; overflow: hidden;
  transition: all 400ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow:
    0 8px 32px rgba(0,197,102,0.35),
    0 4px 16px rgba(229,67,96,0.2),
    inset 0 1px 0 rgba(255,255,255,0.5),
    inset 0 -1px 0 rgba(0,0,0,0.15);
  animation: chrome-shimmer 6s ease-in-out infinite;
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
}
.btn-chrome::after {
  content: "";
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  transition: left 600ms ease;
}
.btn-chrome:hover::after { left: 100%; }
.btn-chrome:hover {
  transform: translateY(-2px);
  box-shadow:
    0 12px 48px rgba(0,197,102,0.5),
    0 6px 24px rgba(229,67,96,0.35),
    inset 0 1px 0 rgba(255,255,255,0.6),
    inset 0 -1px 0 rgba(0,0,0,0.2);
}
.btn-chrome:active { transform: scale(0.98); }
.btn-chrome.btn-lg { padding: 16px 36px; font-size: 1rem; }

.btn-chrome-ghost {
  position: relative; isolation: isolate;
  background: transparent; color: var(--text);
  font-family: var(--font-display); font-weight: 500; font-size: 14px;
  padding: 10px 22px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; text-align: center;
  transition: color var(--dur-base) var(--ease), transform var(--dur-fast) var(--ease);
  border: none;
}
.btn-chrome-ghost::before {
  content: '';
  position: absolute; inset: 0; border-radius: 999px;
  padding: 1px;
  background: linear-gradient(135deg, #00C566, #E54360, #00C566);
  background-size: 200% 200%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  animation: chrome-shift 4s linear infinite;
}
.btn-chrome-ghost:hover { color: var(--text); transform: translateY(-1px); }
.btn-chrome-ghost:active { transform: scale(0.98); }
.btn-chrome-ghost.btn-lg { padding: 0.65rem 1.8rem; font-size: 0.9rem; }

/* Legacy button aliases */
.btn-outline {
  border: 1px solid var(--border-default); color: var(--text-secondary);
  font-family: var(--font-display); font-weight: 500; font-size: 0.82rem;
  padding: 9px 20px; border-radius: 999px; cursor: pointer;
  display: inline-block; text-align: center; background: transparent;
  transition: border-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}
.btn-outline:hover { border-color: var(--border-strong); color: var(--text); }
.btn-outline.btn-lg { padding: 13px 26px; font-size: 0.9rem; }

.btn-login  { color: var(--text-secondary); font-size: 13px; font-weight: 500; padding: 8px 14px; border-radius: 999px; transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.btn-login:hover { color: var(--text); background: rgba(255,255,255,0.04); }

.btn-upgrade {
  background: var(--text); color: #000;
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  padding: 8px 16px; border-radius: 999px; border: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.3rem;
  transition: all 250ms cubic-bezier(0.16, 1, 0.3, 1);
}
.btn-upgrade:hover { background: var(--green); box-shadow: 0 8px 24px rgba(0,197,102,0.3); color: #000; transform: translateY(-1px); }

/* ── INPUTS — pill shape ── */
.input,
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="number"] {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  padding: 12px 20px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  transition: all 250ms var(--ease);
  width: 100%;
  backdrop-filter: blur(10px);
}
.input:focus,
input[type="text"]:focus, input[type="email"]:focus,
input[type="password"]:focus, input[type="search"]:focus,
input[type="number"]:focus {
  border-color: rgba(0,197,102,0.4);
  background: rgba(0,197,102,0.04);
  box-shadow: 0 0 0 4px rgba(0,197,102,0.08);
  outline: none;
}
textarea {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  transition: all 250ms var(--ease);
  width: 100%;
}
textarea:focus {
  border-color: rgba(0,197,102,0.4);
  background: rgba(0,197,102,0.04);
  box-shadow: 0 0 0 4px rgba(0,197,102,0.08);
  outline: none;
}
select {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-default);
  border-radius: 999px;
  padding: 12px 44px 12px 20px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
  transition: all 250ms var(--ease);
  width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' stroke='%236C7684' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  appearance: none;
  -webkit-appearance: none;
}
select[multiple] { border-radius: var(--radius-lg); padding: 14px 18px; background-image: none; }
select:focus {
  border-color: rgba(0,197,102,0.4);
  background-color: rgba(0,197,102,0.04);
  box-shadow: 0 0 0 4px rgba(0,197,102,0.08);
  outline: none;
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--text-muted); }

/* ══════════════════════════════════════════════════════════
   PANELS / CARDS
══════════════════════════════════════════════════════════ */

.glass-panel, .panel {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  position: relative;
  overflow: hidden;
  transition: border-color 300ms var(--ease), transform 300ms var(--ease);
}
.glass-panel:hover, .panel:hover { border-color: var(--border-default); }
.panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 15%, rgba(255,255,255,0.08) 50%, transparent 85%);
  pointer-events: none;
}

.panel-elevated {
  background: var(--bg-surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 48px rgba(0,0,0,0.30), inset 0 1px 0 rgba(255,255,255,0.04);
  position: relative; overflow: hidden;
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
}
.panel-title {
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-tertiary);
  font-weight: 500;
}
.panel-body { padding: 24px; }

/* ── METRIC CARDS ── */
.metric-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.3rem;
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
  position: relative; overflow: hidden;
}
.metric-card:hover { border-color: var(--border-default); box-shadow: var(--shadow-md); }
.mc-label {
  font-family: var(--font-mono); font-size: 0.6rem; color: var(--text-tertiary);
  margin-bottom: 0.4rem; text-transform: uppercase; letter-spacing: 0.1em;
}
.mc-val {
  font-family: var(--font-mono); font-size: 1.4rem; font-weight: 700;
  color: var(--text); letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
}
.mc-change { font-family: var(--font-mono); font-size: 0.68rem; margin-top: 0.2rem; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.mc-change.up   { color: var(--green); }
.mc-change.down { color: var(--red); }
.mc-bar {
  position: absolute; bottom: 0; left: 1.3rem;
  width: 30px; height: 2px; border-radius: 1px;
  background: var(--green);
}
.mc-bar.red { background: var(--red); }

/* ══════════════════════════════════════════════════════════
   TABLES — Bloomberg-style data density
══════════════════════════════════════════════════════════ */

table { border-collapse: collapse; width: 100%; }
th {
  font-family: var(--font-mono); font-size: 0.62rem; color: var(--text-tertiary);
  text-align: left; padding: 0.6rem 0.9rem; text-transform: uppercase; letter-spacing: 0.09em;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface-1);
}
td {
  padding: 0.65rem 0.9rem; font-size: 0.83rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  line-height: 1.5;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg-surface-2); }

/* Bloomberg-style .data-table class */
.data-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.data-table thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-family: var(--font-mono); font-size: var(--text-xs); font-weight: 500;
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-surface-1);
  position: sticky; top: 0; z-index: 1;
}
.data-table tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.data-table tbody tr { transition: background var(--dur-fast) var(--ease); }
.data-table tbody tr:hover { background: var(--bg-surface-2); }
.data-table .num, .data-table td.num { font-family: var(--font-mono); text-align: right; }
.data-table .pos { color: var(--green); }
.data-table .neg { color: var(--red); }

/* Price change cells with tinted background */
.change-cell { padding: 2px 6px !important; border-radius: var(--radius-sm); font-family: var(--font-mono); font-size: var(--text-xs); font-variant-numeric: tabular-nums; }
.change-cell.pos { background: var(--green-dim); color: var(--green-bright); }
.change-cell.neg { background: var(--red-dim);   color: var(--red-bright); }

/* ══════════════════════════════════════════════════════════
   BADGES / PILLS
══════════════════════════════════════════════════════════ */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  border-radius: 999px;
  background: var(--bg-surface-3); color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.badge-green { background: var(--green-dim); color: var(--green-bright); border-color: transparent; }
.badge-red   { background: var(--red-dim);   color: var(--red-bright);   border-color: transparent; }
.badge-warn  { background: var(--warning-dim); color: var(--warning);    border-color: transparent; }
.badge-info  { background: var(--info-dim);  color: var(--info);         border-color: transparent; }

/* ══════════════════════════════════════════════════════════
   LIVE INDICATORS
══════════════════════════════════════════════════════════ */

.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse-dot 2s infinite;
  display: inline-block; flex-shrink: 0;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.5; transform: scale(1.3); }
}

.live-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-mono); font-size: 0.58rem; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--green);
}

/* Legacy pulse keyframe alias */
@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ══════════════════════════════════════════════════════════
   VALUE COLORS
══════════════════════════════════════════════════════════ */

.up, .positive, .green { color: var(--green) !important; }
.down, .negative, .red-val { color: var(--red) !important; }

/* ══════════════════════════════════════════════════════════
   SECTION LABELS & DIVIDERS
══════════════════════════════════════════════════════════ */

.section-label {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-tertiary); margin-bottom: 0.5rem;
}

/* Eyebrow — mono micro-label above section titles */
.eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.3em;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}
.eyebrow-green { color: var(--green); }
.eyebrow-accent {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 999px;
  background: var(--bg-surface-2); border: 1px solid var(--border-subtle);
}

/* Data table container */
.data-table-wrap {
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-subtle);
}

/* Divider with label — Bloomberg section separator */
.divider-label {
  display: flex; align-items: center; gap: var(--space-4);
  margin: var(--space-8) 0;
  font-family: var(--font-mono); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  color: var(--text-tertiary);
}
.divider-label::before,
.divider-label::after {
  content: ""; flex: 1; height: 1px; background: var(--border-subtle);
}

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--green), transparent 30%, transparent 70%, var(--red));
  opacity: 0.2; margin: 1.5rem 0; border: none;
}

hr { height: 1px; background: var(--border-subtle); border: none; margin: 1.5rem 0; }

/* ══════════════════════════════════════════════════════════
   STAT BLOCKS — headline metrics
══════════════════════════════════════════════════════════ */

.stat { display: flex; flex-direction: column; gap: var(--space-1); }
.stat-label {
  font-family: var(--font-mono); font-size: var(--text-xs);
  text-transform: uppercase; letter-spacing: var(--tracking-wide);
  color: var(--text-tertiary);
}
.stat-value {
  font-family: var(--font-mono); font-size: var(--text-xl); font-weight: 600;
  color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: var(--tracking-tight);
}
.stat-change {
  font-family: var(--font-mono); font-size: var(--text-sm); font-variant-numeric: tabular-nums;
}
.stat-change.pos { color: var(--green); }
.stat-change.neg { color: var(--red); }

/* ══════════════════════════════════════════════════════════
   TOOLTIP
══════════════════════════════════════════════════════════ */

.tooltip {
  position: absolute;
  background: var(--bg-surface-3); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs); color: var(--text);
  box-shadow: var(--shadow-lg); pointer-events: none; white-space: nowrap; z-index: 1000;
}

/* ══════════════════════════════════════════════════════════
   SKELETON LOADING
══════════════════════════════════════════════════════════ */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-surface-2) 0%,
    var(--bg-surface-3) 50%,
    var(--bg-surface-2) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ══════════════════════════════════════════════════════════
   PRICE TICK ANIMATIONS
══════════════════════════════════════════════════════════ */

@keyframes tick-up {
  0%   { background: var(--green-dim); }
  100% { background: transparent; }
}
@keyframes tick-down {
  0%   { background: var(--red-dim); }
  100% { background: transparent; }
}
.tick-up   { animation: tick-up   800ms var(--ease-out); }
.tick-down { animation: tick-down 800ms var(--ease-out); }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
══════════════════════════════════════════════════════════ */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse  { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ══════════════════════════════════════════════════════════
   SIDEBAR
══════════════════════════════════════════════════════════ */

.sidebar-item.active {
  background: var(--green-dim) !important;
  color: var(--green) !important;
  font-weight: 600;
  border-left: 2px solid var(--green) !important;
}

/* ── FILTER / TAB ACTIVE ── */
.filter-btn.active, .sub-pill.active {
  background: var(--green-dim) !important;
  border-color: rgba(0,197,102,0.3) !important;
  color: var(--green) !important;
}
.chart-btn.active {
  border-color: var(--border-strong) !important;
  color: var(--text) !important;
  background: var(--bg-surface-2) !important;
}

/* ══════════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════════ */

.footer {
  border-top: 1px solid var(--border-subtle); padding: 1.25rem 2rem;
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap;
  background: var(--bg-base);
}
.footer-logo { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; color: var(--text); }
.footer-logo img { height: 22px; mix-blend-mode: lighten; }
.footer-links { display: flex; gap: 1.5rem; margin-left: auto; }
.footer-links a { color: var(--text-tertiary); font-size: 0.82rem; }
.footer-links a:hover { color: var(--text); }
.footer-copy { color: var(--text-tertiary); font-size: 0.72rem; font-family: var(--font-mono); }

/* ══════════════════════════════════════════════════════════
   MOBILE NAVIGATION
══════════════════════════════════════════════════════════ */

.nav-hamburger {
  display: none;
  flex-direction: column; justify-content: center; align-items: center; gap: 5px;
  width: 40px; height: 40px; flex-shrink: 0;
  background: transparent; border: none; cursor: pointer;
  padding: 4px; border-radius: var(--radius-md);
  margin-left: auto; transition: background var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.nav-hamburger:hover { background: var(--bg-surface-2); }
.nav-hamburger span {
  display: block; width: 22px; height: 2px;
  background: var(--text-secondary); border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease, width 0.2s ease;
  transform-origin: center;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg);  background: var(--text); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; width: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); background: var(--text); }

.nav-mobile-overlay {
  display: none; position: fixed; inset: 0; z-index: 498;
  background: rgba(10,14,20,0.7);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  opacity: 0; transition: opacity 0.25s ease;
}
.nav-mobile-overlay.visible { display: block; opacity: 1; }

.nav-mobile-drawer {
  position: fixed; top: 0; right: -300px; bottom: 0;
  width: 280px; z-index: 499;
  background: var(--bg-surface-1);
  backdrop-filter: blur(20px) saturate(180%);
  border-left: 1px solid var(--border-subtle);
  display: flex; flex-direction: column;
  transition: right 0.28s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
}
.nav-mobile-drawer.open { right: 0; }

.nav-drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.1rem; height: 56px; flex-shrink: 0;
  border-bottom: 1px solid var(--border-subtle);
}
.nav-drawer-brand { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.nav-drawer-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 1rem; line-height: 1;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md); transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.nav-drawer-close:hover { color: var(--text); background: var(--bg-surface-2); }

.nav-drawer-links {
  display: flex; flex-direction: column; gap: 2px; padding: 0.75rem; flex: 1;
}
.nav-drawer-links a {
  display: flex; align-items: center;
  padding: 0.72rem 0.9rem; font-size: 0.88rem; font-weight: 500;
  color: var(--text-secondary); border-radius: var(--radius-md);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  letter-spacing: 0.01em; min-height: 44px;
}
.nav-drawer-links a:hover { color: var(--text); background: var(--bg-surface-2); }
.nav-drawer-links a.active { color: var(--green); background: var(--green-dim); font-weight: 600; }

.nav-drawer-divider { height: 1px; background: var(--border-subtle); margin: 0 0.75rem; }

.nav-drawer-actions {
  display: flex; flex-direction: column; gap: 0.5rem; padding: 0.75rem;
}
.nav-drawer-actions a {
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0.65rem 1rem; border-radius: var(--radius-md);
  font-size: 0.85rem; font-weight: 600; min-height: 44px;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
  .navbar {
    padding: 0 1rem;
    height: 64px;
    /* Notch / Dynamic Island on iPhone — push content below the safe area */
    padding-top: env(safe-area-inset-top);
    height: calc(64px + env(safe-area-inset-top));
  }
  .nav-links { display: none; }
  .nav-right  { display: none; }
  /* Also hide the search bar — hamburger drawer handles navigation */
  .nav-search { display: none !important; }
  .nav-hamburger { display: flex; }
  .nav-inner { gap: 1rem; }

  .sidebar {
    width: 100% !important; height: auto !important;
    position: static !important; overflow-x: auto; overflow-y: hidden;
    display: flex !important; flex-direction: row !important;
    padding: 0.5rem 0.75rem !important; gap: 0.25rem;
    border-right: none !important; border-bottom: 1px solid var(--border-subtle);
    scrollbar-width: none;
  }
  .sidebar::-webkit-scrollbar { display: none; }
  .sidebar-section { display: flex; flex-direction: row; gap: 0.25rem; margin-bottom: 0 !important; flex-shrink: 0; margin-right: 0.5rem; }
  .sidebar-section:last-child { margin-right: 0; }
  .sidebar-label { display: none; }
  .sidebar-item { white-space: nowrap; padding: 0.4rem 0.75rem !important; font-size: 0.78rem; border-left: none !important; border-bottom: 2px solid transparent; border-radius: var(--radius-md) !important; }
  .sidebar-item.active { border-left: none !important; border-bottom-color: var(--green) !important; padding: 0.4rem 0.75rem !important; }
  .sidebar-premium { display: none !important; }

  .footer { padding: 1rem; gap: 1rem; }
  .footer-links { margin-left: 0; gap: 1rem; flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .footer { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .footer-links { margin-left: 0; }
}

/* ══════════════════════════════════════════════════════════
   ATENA AI CHAT WIDGET
══════════════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════════════
   CHROME ACCENT UTILITIES — use sparingly, hero moments only
══════════════════════════════════════════════════════════ */

/* Animated chrome gradient text — for 1–3 word hero accents only */
.chrome-text {
  background: linear-gradient(135deg,
    #00C566 0%, #4AE3A0 20%, #FFFFFF 45%, #FFFFFF 55%, #FF7A9B 80%, #E54360 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
          background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: chrome-shift 8s linear infinite;
  filter: drop-shadow(0 2px 20px rgba(0,197,102,0.15));
}

/* Subtle static variant — no animation */
.chrome-text-subtle {
  background: linear-gradient(135deg, #00C566, #E8ECF1, #E54360);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

@keyframes chrome-shift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
@keyframes chrome-shimmer {
  0%, 100% { background-position: 0% 50%; }
  50%       { background-position: 100% 50%; }
}

/* Float animation — chrome visuals */
@keyframes float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%       { transform: translateY(-16px) rotate(2deg); }
}

/* Chrome section divider — max 2–3 per page */
.chrome-divider {
  display: flex; align-items: center; gap: 16px;
  margin: 80px auto; max-width: 400px; padding: 0 24px;
}
.chrome-divider-line {
  flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}
.chrome-divider-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: linear-gradient(135deg, #00C566, #E54360);
  box-shadow: 0 0 12px rgba(0,197,102,0.5);
  flex-shrink: 0;
}

/* ── AI CHAT FAB — chrome orb ── */
.ac-chat-btn {
  position: fixed; bottom: 24px; right: 24px;
  width: 56px; height: 56px;
  background: url('../images/chrome/chrome-orb.jpg') center/cover, var(--bg-surface-3);
  border: 1px solid rgba(0,197,102,0.3); border-radius: 999px;
  cursor: pointer; z-index: 9998;
  box-shadow: 0 8px 32px rgba(0,197,102,0.25), inset 0 1px 0 rgba(255,255,255,0.1);
  animation: fab-breathe 4s ease-in-out infinite;
  transition: transform 200ms var(--ease);
  overflow: hidden;
}
.ac-chat-btn::after {
  content: "AI";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-weight: 700; font-size: 14px;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}
.ac-chat-btn:hover { transform: scale(1.08); }
@keyframes fab-breathe {
  0%, 100% { box-shadow: 0 8px 32px rgba(0,197,102,0.25), inset 0 1px 0 rgba(255,255,255,0.1); }
  50%       { box-shadow: 0 12px 48px rgba(229,67,96,0.35), inset 0 1px 0 rgba(255,255,255,0.15); }
}

.ac-chat-panel {
  position: fixed; bottom: 84px; right: 24px;
  width: 360px; height: 500px;
  background: var(--bg-surface-1);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  display: flex; flex-direction: column; z-index: 9999;
  opacity: 0; transform: translateY(20px) scale(0.95);
  pointer-events: none; transition: opacity var(--dur-base) var(--ease), transform var(--dur-base) var(--ease);
  overflow: hidden;
}
.ac-chat-panel.open {
  opacity: 1; transform: translateY(0) scale(1); pointer-events: all;
}

.ac-chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--border-subtle);
}
.ac-chat-title {
  font-family: var(--font-display); font-weight: 600; font-size: 0.85rem;
  color: var(--text); display: flex; align-items: center; gap: 8px;
}
.ac-chat-dot {
  width: 6px; height: 6px; background: var(--green); border-radius: 50%; animation: pulse 2s infinite;
}
.ac-chat-attribution {
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.08em; color: var(--text-tertiary); margin-left: 2px;
}
.ac-chat-remaining {
  font-family: var(--font-mono); font-size: 0.62rem; font-weight: 500;
  letter-spacing: 0.08em; color: var(--text-tertiary); margin-left: 4px;
}
.ac-chat-remaining--low { color: var(--warning, #f59e0b); }
.ac-chat-remaining--premium { color: var(--green); }
.ac-chat-cta {
  display: inline-block; margin-left: 6px;
  color: var(--green); text-decoration: none; font-weight: 600;
}
.ac-chat-cta:hover { text-decoration: underline; }
.ac-msg-error { color: var(--text-secondary); }
.ac-chat-close {
  background: none; border: none; color: var(--text-tertiary); cursor: pointer; font-size: 1rem; padding: 4px; line-height: 1;
}
.ac-chat-close:hover { color: var(--text); }

.ac-chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.ac-chat-messages::-webkit-scrollbar { width: 3px; }
.ac-chat-messages::-webkit-scrollbar-thumb { background: var(--bg-surface-3); border-radius: 2px; }

.ac-chat-welcome {
  font-size: 0.78rem; color: var(--text-secondary); line-height: 1.5;
  padding: 12px; background: var(--green-dim); border-radius: var(--radius-md);
  border: 1px solid rgba(0,197,102,0.15);
}

.ac-msg {
  font-size: 0.82rem; line-height: 1.5; padding: 10px 14px;
  border-radius: 10px; max-width: 85%; word-wrap: break-word; white-space: pre-wrap;
}
.ac-msg-user {
  align-self: flex-end;
  background: var(--green-dim); border: 1px solid rgba(0,197,102,0.2); color: var(--text);
}
.ac-msg-ai {
  align-self: flex-start;
  background: var(--bg-surface-2); border: 1px solid var(--border-subtle); color: var(--text-secondary);
}
.ac-typing { color: var(--text-tertiary); font-style: italic; }

.ac-chat-input-area {
  display: flex; padding: 12px; gap: 8px;
  border-top: 1px solid var(--border-subtle);
}
.ac-chat-input {
  flex: 1; background: var(--bg-surface-2); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); padding: 10px 14px; color: var(--text);
  font-family: var(--font-display); font-size: 0.82rem; outline: none;
}
.ac-chat-input:focus { border-color: var(--green); }
.ac-chat-input::placeholder { color: var(--text-tertiary); }
.ac-chat-send {
  background: var(--green); border: none; border-radius: var(--radius-md);
  width: 40px; color: var(--text-inverse); font-size: 1.1rem; font-weight: 700;
  cursor: pointer; transition: background var(--dur-base) var(--ease);
}
.ac-chat-send:hover    { background: var(--green-bright); }
.ac-chat-send:disabled { opacity: 0.5; cursor: default; }

.ai-footer {
  padding: 16px 24px; border-top: 1px solid var(--border-subtle); text-align: center;
}
.ai-footer-inner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 0.72rem; color: var(--text-tertiary);
}
.ai-footer-badge {
  background: var(--green-dim); color: var(--green);
  font-family: var(--font-mono); font-size: 0.6rem; font-weight: 700;
  padding: 2px 6px; border-radius: 4px; letter-spacing: 0.05em;
}

@media (max-width: 480px) {
  .ac-chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 76px; height: 60vh; }
}

/* ══════════════════════════════════════════════════════════
   AUTH NAVBAR ELEMENTS
══════════════════════════════════════════════════════════ */

.nav-username {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--font-mono); font-size: 0.75rem;
  color: var(--text-secondary);
  transition: color var(--dur-fast) var(--ease);
}
.nav-username:hover { color: var(--text); }

.nav-avatar-img {
  width: 26px; height: 26px;
  border-radius: 50%; object-fit: cover;
  border: 1px solid var(--border-default);
  flex-shrink: 0;
}

.nav-avatar-init {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--green-dim); border: 1px solid rgba(0,197,102,0.28);
  color: var(--green); font-size: 0.58rem; font-weight: 700;
  font-family: var(--font-display);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; user-select: none;
}

.nav-logout {
  background: none; border: 1px solid var(--border-subtle);
  color: var(--text-tertiary); font-size: 0.72rem;
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
  font-family: var(--font-display); line-height: 1;
  display: inline-flex; align-items: center; white-space: nowrap;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-logout:hover { border-color: rgba(229,67,96,0.35); color: var(--red); }

.nav-login {
  color: var(--text-secondary); font-size: 0.8rem; font-weight: 500;
  padding: 0.35rem 0.8rem; border-radius: 999px;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.nav-login:hover { color: var(--text); background: var(--bg-surface-2); }

.nav-user-area { display: flex; align-items: center; gap: 10px; }

/* ── Clickable coin rows (market-overview + markets pages) ── */
.md-row {
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.md-row:hover { background: rgba(255,255,255,0.035); }
.md-row:hover .md-coin-symbol { color: var(--green); }
.md-row:focus { background: rgba(0,197,102,0.06); outline: none; }
.md-row:focus-visible { box-shadow: inset 0 0 0 1px rgba(0,197,102,0.4); }
.md-row-no-page { cursor: default; opacity: 0.85; }
.md-row-no-page:hover { background: transparent; }
.md-row-no-page:hover .md-coin-symbol { color: var(--text); }

/* Coin cell layout: logo + symbol/name */
td.md-cell-coin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
}
.md-coin-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--bg-elevated);
}
.md-coin-names {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.md-coin-symbol {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
  transition: color 140ms var(--ease);
}
.md-coin-name {
  font-size: 0.68rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

/* ══════════════════════════════════════════════════════════
   MOBILE POLISH — iPhone Safari (iOS 17+)
   CSS-only pass. No HTML or JS changes.
══════════════════════════════════════════════════════════ */

/* ── iOS foundations (global, non-breaking) ── */
html {
  -webkit-text-size-adjust: 100%; /* prevent iOS auto-zoom on landscape rotation */
  text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100vw;
}
body {
  overscroll-behavior-y: none; /* prevent rubber-band scroll exposing void */
  max-width: 100vw;
  /* Bottom safe area for home-bar phones */
  padding-bottom: env(safe-area-inset-bottom);
}

/* Brand tap-highlight instead of default iOS gray flash */
* {
  -webkit-tap-highlight-color: rgba(0,197,102,0.15);
}

/* Prevent iOS auto-zoom on input focus (requires font-size ≥ 16px) */
input,
select,
textarea {
  font-size: 16px !important;
}

/* Momentum scrolling for inner-scroll containers */
.scroll-x,
.data-table-wrap,
.panel-body,
.sidebar {
  -webkit-overflow-scrolling: touch;
}

/* GPU compositing layer for sticky nav + ticker — smoother on iOS */
.crypto-ticker,
.navbar,
nav {
  -webkit-transform: translateZ(0);
  will-change: transform;
}

/* ── Touch targets (Apple HIG: 44×44 min) ── */
@media (max-width: 768px) {
  button,
  .btn,
  a.btn,
  .lang-trigger,
  .btn-icon,
  .nf-btn,
  .preset-btn,
  .mo-tab {
    min-height: 44px;
  }

  /* ── Tables: horizontal scroll, frozen first columns ── */
  .data-table-wrap,
  .market-data-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .data-table-wrap::-webkit-scrollbar,
  .market-data-table-wrap::-webkit-scrollbar { display: none; }

  /* Tighten cells, prevent wrapping */
  .data-table thead th,
  .data-table tbody td {
    padding: 10px 12px !important;
    font-size: 12px !important;
    white-space: nowrap;
  }

  /* Freeze rank column + coin column on left */
  .data-table thead th:first-child,
  .data-table tbody td:first-child {
    position: sticky;
    left: 0;
    background: var(--bg-surface-1);
    z-index: 2;
    border-right: 1px solid var(--border-subtle);
  }
  /* Market-overview table: freeze rank + coin cell */
  table thead tr th:first-child,
  table tbody .md-row td:first-child {
    position: sticky;
    left: 0;
    background: var(--bg-surface-1);
    z-index: 2;
    border-right: 1px solid var(--border-subtle);
  }
  .md-row:hover td:first-child { background: var(--bg-surface-2); }

  /* ── Panel padding ── */
  .panel-body   { padding: 18px 16px; }
  .panel-header { padding: 14px 18px; }

  /* ── Stat cards: 2-col on mobile ── */
  .cp-stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px;
  }
  .cp-stat-card { padding: 12px 14px; }
  .cp-stat-val  { font-size: 15px; }
  .cp-stat-label { font-size: 11px; }

  /* ── Forms: tap-friendly inputs ── */
  .input,
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  select,
  textarea {
    min-height: 44px;
    padding: 10px 16px;
  }
  .btn     { min-height: 44px; padding: 10px 20px; }
  .btn-lg  { min-height: 48px; padding: 12px 24px; }
  .btn-sm  { min-height: 36px; padding: 8px 14px; }

  /* ── AI chat FAB: clear of home-bar ── */
  .ac-chat-btn {
    width: 52px !important;
    height: 52px !important;
    bottom: calc(20px + env(safe-area-inset-bottom)) !important;
    right: 16px !important;
  }

  /* ── Homepage hero ── */
  .home-hero {
    grid-template-columns: 1fr !important;
    padding: 32px 16px 60px !important;
    text-align: center;
    gap: 28px;
  }
  .home-hero-chrome { max-width: 220px !important; margin: 0 auto; }
  .hero-eyebrow, .hero-ctas { justify-content: center; }
  .hero-h1  { font-size: clamp(28px, 8vw, 40px) !important; }
  .hero-sub { font-size: 15px; }
}

/* ── Typography: smaller scales on phones ── */
@media (max-width: 640px) {
  /* Mobile ticker shrinks to 32px (per ticker.css) — match the navbar's reserved flow space */
  .navbar { margin-bottom: 32px; }
  h1 { font-size: clamp(24px, 6vw, 32px) !important; }
  h2 { font-size: clamp(20px, 5vw, 26px) !important; }
  h3 { font-size: 17px !important; }
  p, .text-body { font-size: 14px; line-height: 1.6; }
  .cp-price, .stat-value, .coin-price-value {
    font-size: clamp(20px, 6vw, 32px) !important;
  }

  /* ── Pagination: larger tap targets, wrap ── */
  .md-pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    padding: 16px 0;
  }
  .md-pg-btn  { height: 40px; padding: 0 12px; }
  .md-pg-num  { min-width: 36px; height: 36px; }
  .md-pg-info {
    width: 100%;
    text-align: center;
    margin: 8px 0 0;
    font-size: 10px;
  }
}

/* ── Tiny phones: hide leaderboard ad, tighten nav padding ── */
@media (max-width: 480px) {
  .navbar { padding-left: 12px; padding-right: 12px; }
}

/* ── Prevent any child element from causing horizontal scroll ── */
@media (max-width: 768px) {
  body { overflow-x: hidden; }
  /* Allow exceptions for elements that legitimately scroll */
  .ticker-track,
  .data-table-wrap,
  .scroll-x {
    max-width: none;
  }
}
