:root {
  --bg: #030711;
  --panel: rgba(7, 18, 37, .86);
  --panel-2: rgba(9, 28, 54, .74);
  --line: rgba(30, 197, 255, .34);
  --line-hot: #28d9ff;
  --blue: #0a7cff;
  --cyan: #20f0ff;
  --green: #24f2a1;
  --red: #ff4d63;
  --yellow: #ffd84a;
  --text: #f4fbff;
  --muted: #8aa8c5;
  --shadow: 0 0 30px rgba(32, 240, 255, .14);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 5%, rgba(0, 132, 255, .22), transparent 32%),
              radial-gradient(circle at 80% 0%, rgba(0, 255, 204, .13), transparent 28%),
              linear-gradient(145deg, #030711 0%, #061426 52%, #02040a 100%);
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.terminal-body { overflow-x: hidden; }
.market-noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(40,217,255,.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(40,217,255,.04) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.8), transparent 80%);
  z-index: -1;
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #00111c;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 0 26px rgba(32, 240, 255, .55);
  font-weight: 950;
}
.logo-mark {
  background: transparent;
  box-shadow: none;
  overflow: hidden;
}
.logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(32, 240, 255, .42));
}
.brand-stack { flex-direction: row; align-items: center; gap: 12px; }

.public-nav, .public-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}
.nav-actions { display: flex; align-items: center; gap: 18px; color: var(--muted); }
.btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: rgba(9, 28, 54, .78);
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-weight: 800;
}
.btn-primary { background: linear-gradient(135deg, #08baf7, #095dff); color: white; border: 0; }
.btn-danger { background: linear-gradient(135deg, #ff3b5f, #8b1024); border: 0; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 34px;
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 24px;
  align-items: center;
}
.eyebrow { color: var(--cyan); text-transform: uppercase; letter-spacing: .18em; font-size: 12px; font-weight: 900; margin: 0 0 8px; }
.hero h1, .app-topbar h1 { margin: 0; font-weight: 950; line-height: .96; letter-spacing: 0; }
.hero h1 { font-size: clamp(52px, 9vw, 106px); text-transform: uppercase; }
.hero p { color: #bdd7ec; font-size: 18px; line-height: 1.65; max-width: 690px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin: 28px 0; }
.ticker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
}
.ticker-card, .panel, .stat-card, .auth-card, .data-table, .chart-panel {
  background: linear-gradient(145deg, rgba(8, 20, 42, .92), rgba(6, 16, 32, .78));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 14px;
}
.ticker-card { padding: 14px; }
.ticker-card span { color: var(--muted); font-size: 12px; }
.ticker-card strong { display: block; margin-top: 6px; font-size: 20px; }
.up { color: var(--green); }
.down { color: var(--red); }
.yellow { color: var(--yellow); }

.chart-panel { padding: 20px; min-height: 440px; position: relative; overflow: hidden; }
.chart-panel:before {
  content: "";
  position: absolute;
  inset: 28px;
  background: linear-gradient(180deg, transparent, rgba(32,240,255,.08)),
              repeating-linear-gradient(90deg, transparent 0 42px, rgba(255,255,255,.04) 43px),
              repeating-linear-gradient(0deg, transparent 0 42px, rgba(255,255,255,.04) 43px);
}
.candles { position: absolute; inset: 70px 32px 74px; display: flex; align-items: end; gap: 13px; }
.candle { width: 12px; border-radius: 2px; position: relative; animation: pulse 2.5s ease-in-out infinite; }
.candle:before { content: ""; position: absolute; left: 5px; width: 2px; height: 54px; top: -22px; background: currentColor; opacity: .72; }
.candle.green { background: var(--green); color: var(--green); }
.candle.red { background: var(--red); color: var(--red); }
@keyframes pulse { 50% { filter: drop-shadow(0 0 12px currentColor); transform: translateY(-4px); } }

.section-grid, .stats-grid {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.panel { padding: 22px; min-width: 0; max-width: 100%; overflow: hidden; }
.panel h3, .stat-card h3 { margin: 0 0 10px; }
.panel p, .stat-card p { color: var(--muted); line-height: 1.55; }

.auth-wrap { min-height: calc(100vh - 120px); display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(540px, 100%); padding: 28px; }
.field { display: grid; gap: 8px; margin-bottom: 15px; }
.field label { color: var(--muted); font-size: 13px; font-weight: 800; }
.field input, .field textarea, .field select {
  width: 100%;
  color: var(--text);
  background: rgba(2, 8, 18, .82);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
}
.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; border: 1px solid var(--line); background: rgba(32,240,255,.08); color: #c9f7ff; }
.alert.error { border-color: rgba(255,77,99,.5); color: #ffd3da; background: rgba(255,77,99,.09); }

.app-shell-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(2, 7, 16, .88);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.side-rail .brand {
  margin-bottom: 14px;
  align-items: center;
}
.side-rail .brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  border-radius: 0;
}
.side-rail .brand span:last-child {
  line-height: 1.05;
}
.rail-links { display: flex; flex-direction: column; gap: 10px; }
.rail-links a { padding: 12px 14px; color: #bcd8ee; border-radius: 10px; display: flex; align-items: center; gap: 10px; }
.rail-links a:hover, .rail-links a.is-active { background: rgba(32,240,255,.1); color: white; }
.mobile-dock { display: none; }
.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 10px;
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 26px;
  background: linear-gradient(135deg, rgba(32,240,255,.95), rgba(10,124,255,.95));
  box-shadow: 0 0 16px rgba(32,240,255,.25);
}
.nav-icon:before, .nav-icon:after { content: ""; position: absolute; border-color: #03111f; }
.nav-icon-home:before { width: 11px; height: 9px; border: 2px solid #03111f; border-top: 0; bottom: 6px; }
.nav-icon-home:after { width: 12px; height: 12px; border-left: 2px solid #03111f; border-top: 2px solid #03111f; transform: rotate(45deg); top: 5px; }
.nav-icon-bolt:before { width: 8px; height: 15px; background: #03111f; clip-path: polygon(55% 0, 100% 0, 58% 45%, 100% 45%, 30% 100%, 45% 55%, 0 55%); }
.nav-icon-network:before { width: 5px; height: 5px; background: #03111f; border-radius: 50%; box-shadow: -8px 8px 0 #03111f, 8px 8px 0 #03111f; top: 6px; }
.nav-icon-network:after { width: 18px; height: 11px; border-left: 2px solid #03111f; border-right: 2px solid #03111f; border-bottom: 2px solid #03111f; top: 9px; }
.nav-icon-ledger:before { width: 13px; height: 15px; border: 2px solid #03111f; border-radius: 2px; }
.nav-icon-ledger:after { width: 8px; height: 2px; background: #03111f; box-shadow: 0 5px 0 #03111f; }
.nav-icon-wallet:before { width: 15px; height: 11px; border: 2px solid #03111f; border-radius: 4px; }
.nav-icon-wallet:after { width: 4px; height: 4px; background: #03111f; border-radius: 50%; right: 6px; }
.nav-icon-user:before { width: 8px; height: 8px; background: #03111f; border-radius: 50%; top: 5px; }
.nav-icon-user:after { width: 15px; height: 8px; background: #03111f; border-radius: 8px 8px 4px 4px; bottom: 5px; }
.app-main { padding: 24px; min-width: 0; }
.app-topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.app-topbar h1 { font-size: clamp(32px, 5vw, 58px); text-transform: uppercase; }
.user-chip { border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px; display: flex; gap: 12px; color: var(--muted); background: rgba(8,20,42,.7); }
.user-chip strong { color: var(--cyan); }
.stats-grid.app { max-width: none; padding: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-card { padding: 18px; min-height: 126px; min-width: 0; max-width: 100%; overflow: hidden; }
.stat-card strong { font-size: 26px; display: block; margin-top: 12px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .65fr); gap: 18px; margin-top: 18px; min-width: 0; max-width: 100%; }
.workspace-grid > * { min-width: 0; max-width: 100%; }
.mini-chart { height: 260px; position: relative; overflow: hidden; }
.mini-chart svg { width: 100%; height: 100%; }
.feed { display: grid; gap: 10px; }
.feed-item { display: flex; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid rgba(40,217,255,.18); border-radius: 10px; background: rgba(3,9,20,.58); min-width: 0; }
.feed-item > * { min-width: 0; overflow-wrap: anywhere; }
.data-table { width: 100%; border-collapse: collapse; overflow: hidden; }
.data-table th, .data-table td { padding: 13px 14px; border-bottom: 1px solid rgba(40,217,255,.14); text-align: left; }
.data-table th { color: var(--cyan); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.market-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.market-strip span {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid rgba(40,217,255,.2);
  border-radius: 12px;
  background: rgba(3, 12, 28, .68);
}
.market-strip strong { display: block; color: #b7d4ec; font-size: 11px; letter-spacing: .08em; }
.market-strip em { display: block; margin-top: 4px; font-style: normal; font-weight: 900; }
.portfolio-card {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid rgba(32,240,255,.34);
  border-radius: 20px;
  background:
    radial-gradient(circle at 85% 15%, rgba(36,242,161,.18), transparent 28%),
    linear-gradient(135deg, rgba(9, 92, 255, .38), rgba(3, 12, 28, .96) 62%),
    rgba(5, 18, 38, .9);
  box-shadow: 0 20px 50px rgba(0,0,0,.26), 0 0 36px rgba(32,240,255,.16);
}
.portfolio-card:before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: .38;
}
.portfolio-card > * { position: relative; }
.portfolio-card h2 { margin: 4px 0 8px; font-size: clamp(34px, 7vw, 58px); line-height: 1; }
.portfolio-sub { color: #b8d8ee; font-weight: 800; }
.portfolio-ring {
  width: 96px;
  height: 96px;
  align-self: center;
  border-radius: 50%;
  border: 8px solid rgba(32,240,255,.18);
  box-shadow: inset 0 0 0 2px rgba(32,240,255,.45), 0 0 24px rgba(32,240,255,.2);
  display: grid;
  place-items: center;
  text-align: center;
}
.portfolio-ring span { display: block; color: var(--yellow); font-weight: 950; }
.portfolio-ring small { color: var(--muted); font-weight: 800; }
.portfolio-metrics {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.portfolio-metrics span { padding: 12px; border-radius: 12px; background: rgba(2,8,18,.42); border: 1px solid rgba(255,255,255,.08); }
.portfolio-metrics small { display: block; color: var(--muted); margin-bottom: 5px; }
.portfolio-metrics strong { font-size: 18px; }
.copy-btn {
  margin-left: 8px;
  border: 1px solid rgba(32,240,255,.35);
  color: var(--cyan);
  background: rgba(32,240,255,.08);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 1024px) {
  .hero, .workspace-grid { grid-template-columns: 1fr; }
  .ticker, .section-grid, .stats-grid.app { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-shell-body { grid-template-columns: 1fr; }
  .side-rail {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid rgba(40,217,255,.28);
    background: rgba(2, 7, 16, .96);
    backdrop-filter: blur(18px);
    gap: 0;
  }
  .side-rail .brand {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    letter-spacing: .05em;
  }
  .side-rail .brand span:last-child {
    margin-right: auto;
    font-size: 14px;
    line-height: 1.1;
  }
  .side-rail .brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 0;
    flex: 0 0 40px;
  }
  .side-rail > .rail-links { display: none; }
  .mobile-dock {
    position: fixed !important;
    left: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
    top: auto !important;
    bottom: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 999;
    width: auto;
    margin: 0;
    padding: 8px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 6px;
    overflow: visible;
    border: 1px solid rgba(40,217,255,.28);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(4, 16, 34, .94), rgba(2, 8, 18, .96));
    box-shadow: 0 18px 40px rgba(0,0,0,.42), 0 0 28px rgba(32,240,255,.2);
    backdrop-filter: blur(22px);
  }
  .mobile-dock a {
    flex: 1 1 0;
    min-width: 0;
    height: 58px;
    padding: 7px 4px 6px;
    border: 0;
    background: transparent;
    color: #9fb9d2;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    display: grid;
    place-items: center;
    gap: 5px;
    text-align: center;
    border-radius: 17px;
  }
  .mobile-dock .nav-icon {
    width: 29px;
    height: 29px;
    flex-basis: 29px;
  }
  .mobile-dock a:hover,
  .mobile-dock a:focus,
  .mobile-dock a.is-active {
    background: rgba(32,240,255,.1);
    color: #fff;
  }
  .mobile-dock a.is-active .nav-icon {
    box-shadow: 0 0 22px rgba(32,240,255,.58);
    transform: translateY(-2px);
  }
  .app-main { padding: 20px 16px 104px; width: 100%; max-width: 100vw; overflow-x: hidden; }
  .app-topbar {
    padding-bottom: 4px;
    margin-bottom: 16px;
  }
}
@media (max-width: 580px) {
  .public-nav, .app-topbar { align-items: flex-start; flex-direction: column; }
  .ticker, .section-grid, .stats-grid.app { grid-template-columns: 1fr; }
  .hero h1 { font-size: 48px; }
  .market-strip {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    margin: -2px -2px 14px;
    padding: 2px;
  }
  .market-strip::-webkit-scrollbar { display: none; }
  .market-strip span {
    flex: 0 0 132px;
    padding: 10px;
  }
  .portfolio-card {
    grid-template-columns: minmax(0, 1fr) 82px;
    padding: 20px;
    border-radius: 18px;
  }
  .portfolio-card h2 { font-size: 40px; }
  .portfolio-ring {
    width: 82px;
    height: 82px;
    border-width: 7px;
  }
  .side-rail {
    padding: 12px 16px;
    min-height: 72px;
  }
  .side-rail .brand span:last-child {
    font-size: 13px;
  }
  .side-rail .brand-mark {
    width: 48px;
    height: 48px;
    flex-basis: 48px;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
  .side-rail .logo-mark img {
    width: 100%;
    height: 100%;
  }
  .mobile-dock {
    left: 10px;
    right: 10px;
    max-width: calc(100vw - 20px);
    top: auto !important;
    bottom: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    padding: 7px;
    border-radius: 22px;
  }
  .mobile-dock a {
    height: 56px;
    font-size: 9px;
  }
  .mobile-dock .nav-icon { width: 27px; height: 27px; }
  .app-topbar { gap: 12px; }
  .app-topbar h1 {
    font-size: 32px;
    line-height: 1;
  }
  .app-topbar .eyebrow {
    font-size: 11px;
    letter-spacing: .16em;
  }
  .user-chip {
    width: 100%;
    justify-content: space-between;
    border-radius: 14px;
    padding: 10px 12px;
    overflow: hidden;
  }
  .user-chip span,
  .user-chip strong {
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .stat-card {
    min-height: 116px;
    padding: 18px;
    border-radius: 12px;
  }
  .stat-card strong {
    font-size: 24px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }
  .panel {
    padding: 18px;
    border-radius: 12px;
    width: 100%;
  }
  .mini-chart { height: 210px; width: 100%; overflow: hidden; }
  .mini-chart svg { min-width: 0; }
  .feed-item {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }
  .referral-item div {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .referral-item small {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .copy-btn { margin-left: auto; flex: 0 0 auto; }
  .data-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
