:root {
  --bg: #061321;
  --bg-soft: #10213a;
  --panel: rgba(19, 34, 61, 0.86);
  --panel-strong: #142642;
  --text: #f6f9ff;
  --muted: #c2d0e5;
  --muted-2: #90a0ba;
  --accent: #2563eb;
  --accent-2: #14b8a6;
  --violet: #a855f7;
  --cyan: #0ea5e9;
  --green: #10b981;
  --red: #fb7185;
  --amber: #f97316;
  --pink: #ec4899;
  --lime: #84cc16;
  --border: rgba(168, 188, 214, 0.22);
  --shadow: 0 24px 90px rgba(2, 8, 23, 0.32);
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background:
    radial-gradient(circle at 9% 4%, rgba(14, 165, 233, 0.38), transparent 28rem),
    radial-gradient(circle at 73% 7%, rgba(168, 85, 247, 0.32), transparent 30rem),
    radial-gradient(circle at 93% 42%, rgba(249, 115, 22, 0.16), transparent 25rem),
    radial-gradient(circle at 16% 82%, rgba(16, 185, 129, 0.18), transparent 24rem),
    linear-gradient(180deg, #071421 0%, #0d1b31 43%, #08111f 100%);
  color: var(--text);
  text-rendering: geometricPrecision;
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, border-color 0.15s ease, filter 0.15s ease, background 0.15s ease;
}

button:hover { filter: brightness(1.08); }
button:active { transform: translateY(1px); }

input, select {
  width: 100%;
  background: rgba(7, 12, 22, 0.88);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus {
  border-color: rgba(96, 165, 250, 0.7);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.16);
}

.hidden { display: none !important; }

.admin-entry-link {
  color: #67e8f9;
  font-weight: 800;
  text-decoration: none;
}

.admin-entry-link:hover {
  color: #a5f3fc;
  text-decoration: underline;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem clamp(1rem, 3vw, 2.5rem);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  background:
    radial-gradient(circle at 0% 0%, rgba(20, 184, 166, 0.14), transparent 22rem),
    linear-gradient(90deg, rgba(8, 19, 35, 0.90), rgba(20, 32, 58, 0.80)),
    rgba(8, 13, 23, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: max-content;
}

.brand::before {
  content: "";
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: conic-gradient(from 160deg, #22d3ee, #4f7cff, #8b5cf6, #22c55e, #22d3ee);
  box-shadow: 0 10px 34px rgba(34, 211, 238, 0.3);
}

.header h1 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: #f8fbff;
}

.badge {
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.20), rgba(236, 72, 153, 0.12));
  color: #fed7aa;
  border: 1px solid rgba(251, 146, 60, 0.34);
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
}

.main-nav {
  position: relative;
  justify-self: center;
  display: flex;
  gap: 0.3rem;
  background: linear-gradient(135deg, rgba(15, 35, 64, 0.86), rgba(49, 46, 129, 0.62));
  padding: 0.32rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  isolation: isolate;
}

.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9 52%, #14b8a6);
  box-shadow: 0 10px 30px rgba(14, 165, 233, 0.35);
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  transition:
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    width 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.24s ease;
  will-change: transform, width;
}

.nav-indicator.nav-indicator-instant,
.main-nav:not(.nav-indicator-ready) .nav-indicator {
  transition: none !important;
}

.nav-link {
  position: relative;
  z-index: 1;
  color: #b8c7de;
  text-decoration: none;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  white-space: nowrap;
  background: transparent;
  transition: color 0.28s ease, transform 0.22s ease;
}

.nav-link:active {
  transform: scale(0.97);
}

.nav-link:hover { color: var(--text); }

.nav-link.active {
  color: #fff;
  background: transparent;
  box-shadow: none;
}

.account-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.7rem;
  color: #9ba9c2;
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.user-email {
  color: #dbeafe;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-stat {
  padding: 0.25rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(15, 35, 64, 0.70), rgba(20, 184, 166, 0.14));
}

.header-stat strong { color: #f8fafc; }

.lang-btn,
.btn-secondary,
#logout-btn {
  background: linear-gradient(135deg, rgba(15, 35, 64, 0.76), rgba(49, 46, 129, 0.38));
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
}

.lang-btn {
  color: var(--muted);
  font-size: 0.75rem;
}

.btn-primary,
.banner-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #2563eb, #0ea5e9 45%, #14b8a6);
  border: 1px solid rgba(125, 211, 252, 0.50);
  color: #fff;
  padding: 0.78rem 1.25rem;
  border-radius: 999px;
  box-shadow: 0 16px 44px rgba(14, 165, 233, 0.26);
}

.app-main {
  flex: 1 0 auto;
  min-height: calc(100vh - 68px - 120px);
  animation: app-shell-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page {
  display: none;
  width: min(1600px, calc(100% - clamp(0.75rem, 2vw, 2rem)));
  margin: 0 auto;
  padding: clamp(0.85rem, 1.8vw, 1.35rem) 0 3rem;
}

.page.active {
  display: block;
}

.page.page-enter {
  animation: page-enter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page.page-leave {
  display: block !important;
  pointer-events: none;
  animation: page-leave 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

#page-news.page.active {
  display: grid;
  gap: 1.4rem;
}

#page-home,
#market-content,
#contract-content,
#contracts-content,
#profile-content {
  gap: 1.25rem;
}

#market-content,
#contract-content,
#contracts-content,
#profile-content {
  display: grid;
}

#contract-content > .trading-hero { order: 1; }
#contract-content > .trading-stats { order: 2; }
#contract-content > .contract-risk-panel { order: 3; }
#contract-content > .trade-workspace-panel { order: 4; }
#contract-content > .trade-kline-panel { order: 5; }

.panel {
  background:
    radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.12), transparent 16rem),
    linear-gradient(180deg, rgba(22, 40, 72, 0.90), rgba(13, 27, 49, 0.86));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem;
  box-shadow: 0 16px 50px rgba(2, 8, 23, 0.22);
}

.panel h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: #f8fbff;
}

.banner-carousel {
  position: relative;
  min-height: 360px;
  margin-bottom: 1.25rem;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--panel-strong);
}

.banner-slide {
  display: none;
  min-height: 360px;
  padding: clamp(2rem, 5vw, 4.25rem);
  position: relative;
  isolation: isolate;
}

.banner-slide::after {
  content: "";
  position: absolute;
  inset: auto -12% -40% auto;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.36), transparent 62%);
  z-index: -1;
}

.banner-slide.active {
  display: flex;
  align-items: center;
}

.banner-blue {
  background:
    radial-gradient(circle at 82% 16%, rgba(45, 212, 191, 0.34), transparent 20rem),
    radial-gradient(circle at 55% 85%, rgba(132, 204, 22, 0.16), transparent 18rem),
    linear-gradient(115deg, rgba(8, 24, 43, 0.92) 0%, rgba(18, 80, 119, 0.82) 52%, rgba(37, 99, 235, 0.50) 100%),
    linear-gradient(135deg, #0f172a, #0e7490);
}

.banner-purple {
  background:
    radial-gradient(circle at 82% 18%, rgba(249, 115, 22, 0.28), transparent 18rem),
    radial-gradient(circle at 54% 92%, rgba(236, 72, 153, 0.20), transparent 19rem),
    linear-gradient(115deg, rgba(12, 20, 42, 0.92) 0%, rgba(67, 35, 122, 0.82) 58%, rgba(168, 85, 247, 0.48) 100%),
    linear-gradient(135deg, #0f172a, #6d28d9);
}

.banner-inner {
  max-width: 760px;
}

.eyebrow,
.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
  color: #67e8f9;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
}

.banner-inner h2 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.06;
  letter-spacing: -0.06em;
}

.banner-inner p {
  margin: 0 0 1.6rem;
  max-width: 650px;
  color: #e2edf9;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.75;
}

.home-poster-strip {
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.home-poster-card {
  min-height: 190px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(5, 13, 28, 0.06), rgba(5, 13, 28, 0.88)),
    linear-gradient(90deg, rgba(8, 20, 38, 0.72), rgba(8, 20, 38, 0.18)),
    var(--poster-image);
  background-size: cover;
  background-position: center;
  box-shadow: 0 18px 54px rgba(2, 8, 23, 0.24);
  isolation: isolate;
}

.home-poster-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 85% 0%, rgba(20, 184, 166, 0.24), transparent 14rem),
    radial-gradient(circle at 0% 100%, rgba(168, 85, 247, 0.18), transparent 13rem);
  mix-blend-mode: screen;
  z-index: -1;
}

.poster-market {
  --poster-image: url("https://images.pexels.com/photos/210607/pexels-photo-210607.jpeg?auto=compress&cs=tinysrgb&w=1200");
}

.poster-desk {
  --poster-image: url("https://images.pexels.com/photos/534216/pexels-photo-534216.jpeg?auto=compress&cs=tinysrgb&w=1200");
}

.poster-growth {
  --poster-image: url("https://images.pexels.com/photos/5980871/pexels-photo-5980871.jpeg?auto=compress&cs=tinysrgb&w=1200");
}

.poster-copy {
  padding: 1.1rem;
  color: #fff;
}

.poster-source {
  display: inline-flex;
  margin-bottom: 0.5rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(8, 20, 38, 0.42);
  color: #c8f7ff;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.poster-copy strong {
  display: block;
  font-size: clamp(1.05rem, 1.8vw, 1.4rem);
  letter-spacing: -0.03em;
}

.poster-copy p {
  max-width: 360px;
  margin: 0.45rem 0 0;
  color: #dbeafe;
  line-height: 1.6;
  font-size: 0.88rem;
}

.home-sections {
  display: grid;
  grid-template-columns: 1.05fr 1.6fr;
  gap: 1.25rem;
}

.home-market-panel {
  margin-bottom: 1.25rem;
}

.home-news-panel {
  margin-bottom: 1.25rem;
}

.home-market-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}

.home-market-card {
  padding: 0.95rem;
  border: 1px solid rgba(125, 211, 252, 0.16);
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.20), transparent 8rem),
    linear-gradient(135deg, rgba(8, 28, 51, 0.60), rgba(11, 22, 40, 0.48));
}

.home-market-card:nth-child(2n) {
  background:
    radial-gradient(circle at 100% 0%, rgba(168, 85, 247, 0.22), transparent 8rem),
    linear-gradient(135deg, rgba(35, 24, 70, 0.58), rgba(11, 22, 40, 0.48));
}

.home-market-card:nth-child(3n) {
  background:
    radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.20), transparent 8rem),
    linear-gradient(135deg, rgba(12, 55, 47, 0.56), rgba(11, 22, 40, 0.48));
}

.home-market-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
}

.home-market-title strong {
  color: #f4f8ff;
  font-size: 0.95rem;
}

.home-market-title span {
  min-width: 26px;
  text-align: center;
  color: #cffafe;
  border: 1px solid rgba(45, 212, 191, 0.30);
  background: rgba(20, 184, 166, 0.14);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.home-market-list {
  display: grid;
  gap: 0.5rem;
}

.home-market-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0;
  text-align: left;
  color: #dbe7f7;
  background: transparent;
  border-radius: 10px;
}

.home-market-list button:hover {
  background: rgba(59, 130, 246, 0.08);
}

.home-market-list span {
  display: grid;
  gap: 0.1rem;
}

.home-market-list strong {
  color: #eaf2ff;
  font-size: 0.82rem;
}

.home-market-list small {
  color: #a9bbd3;
  font-size: 0.72rem;
}

.home-market-list em {
  font-style: normal;
  font-weight: 900;
}

.home-news-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.home-news-card {
  width: 100%;
  min-height: 180px;
  display: grid;
  align-content: start;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(168, 85, 247, 0.18);
  border-radius: 16px;
  background:
    radial-gradient(circle at 100% 0%, rgba(249, 115, 22, 0.16), transparent 9rem),
    linear-gradient(135deg, rgba(28, 24, 58, 0.58), rgba(10, 22, 39, 0.48));
  color: inherit;
  text-align: left;
}

.home-news-card:hover {
  border-color: rgba(45, 212, 191, 0.34);
  background:
    radial-gradient(circle at 100% 0%, rgba(45, 212, 191, 0.20), transparent 9rem),
    linear-gradient(135deg, rgba(18, 38, 68, 0.62), rgba(10, 22, 39, 0.56));
}

.home-news-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: #8ea0bb;
  font-size: 0.76rem;
}

.home-news-meta span {
  color: #bfdbfe;
  font-weight: 800;
}

.home-news-card h3 {
  margin: 0;
  color: #f4f8ff;
  font-size: 1rem;
  line-height: 1.45;
}

.home-news-card p {
  margin: 0;
  color: #aebed3;
  line-height: 1.65;
  font-size: 0.88rem;
}

.home-news-card a {
  color: #93c5fd;
  font-size: 0.84rem;
  font-weight: 800;
  text-decoration: none;
}

.home-news-card em {
  align-self: end;
  color: #93c5fd;
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 850;
}

.news-page-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.42fr) minmax(0, 1fr);
  gap: 1.35rem;
  align-items: start;
}

.news-page-list-panel {
  position: sticky;
  top: 5.5rem;
  background:
    radial-gradient(circle at 0% 0%, rgba(139, 92, 246, 0.14), transparent 14rem),
    linear-gradient(180deg, rgba(18, 27, 43, 0.94), rgba(11, 20, 39, 0.92));
}

.news-page-list {
  display: grid;
  gap: 0.85rem;
}

.news-page-list-item {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  padding: 0.95rem;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(7, 12, 22, 0.52), rgba(20, 32, 58, 0.38));
  color: inherit;
  text-align: left;
}

.news-page-list-item.active,
.news-page-list-item:hover {
  border-color: rgba(34, 211, 238, 0.36);
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 211, 238, 0.16), transparent 8rem),
    rgba(59, 130, 246, 0.12);
}

.news-page-list-item span {
  color: #93c5fd;
  font-size: 0.76rem;
  font-weight: 850;
}

.news-page-list-item strong {
  color: #eaf2ff;
  font-size: 0.88rem;
  line-height: 1.45;
}

.news-page-list-item time {
  color: #8ea0bb;
  font-size: 0.74rem;
}

.news-page-detail {
  min-height: 520px;
  display: grid;
  align-content: start;
  gap: 1.15rem;
  padding: clamp(1.25rem, 2.5vw, 2rem);
  background:
    radial-gradient(circle at 100% 0%, rgba(79, 124, 255, 0.16), transparent 22rem),
    radial-gradient(circle at 0% 100%, rgba(34, 197, 94, 0.08), transparent 18rem),
    linear-gradient(180deg, rgba(18, 27, 43, 0.96), rgba(12, 22, 41, 0.93));
}

.news-page-detail-head h1 {
  margin: 0.35rem 0 0;
  max-width: 900px;
  color: #f8fbff;
  font-size: clamp(1.45rem, 2.6vw, 2.3rem);
  line-height: 1.3;
  letter-spacing: -0.03em;
}

.news-page-meta {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 0.65rem 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(7, 12, 22, 0.58), rgba(30, 41, 78, 0.32));
}

.news-page-meta span {
  color: #8ea0bb;
}

.news-page-meta strong {
  color: #eaf2ff;
}

.news-page-summary {
  margin: 0;
  color: #cbd5e1;
  font-size: 1.05rem;
  line-height: 2;
  white-space: pre-line;
}

.news-page-actions {
  display: flex;
  justify-content: flex-end;
}

.home-panel {
  min-height: 100%;
}

#home-intro h2,
#home-features h2,
.home-cta h2 {
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.intro-body {
  margin: 0;
  color: #dbe7f5;
  line-height: 1.85;
}

#home-features {
  grid-row: span 2;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.feature-card {
  position: relative;
  min-height: 160px;
  background:
    radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.18), transparent 9rem),
    linear-gradient(135deg, rgba(11, 42, 68, 0.58), rgba(9, 22, 39, 0.55));
  border: 1px solid rgba(125, 211, 252, 0.18);
  border-radius: 16px;
  padding: 1.1rem;
  overflow: hidden;
}

.feature-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 auto;
  width: 130px;
  height: 130px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.12), transparent 68%);
}

.feature-card:nth-child(2n) {
  background:
    radial-gradient(circle at 100% 0%, rgba(168, 85, 247, 0.18), transparent 9rem),
    linear-gradient(135deg, rgba(43, 28, 76, 0.58), rgba(9, 22, 39, 0.55));
  border-color: rgba(196, 181, 253, 0.18);
}

.feature-card:nth-child(3n) {
  background:
    radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.16), transparent 9rem),
    linear-gradient(135deg, rgba(10, 58, 48, 0.56), rgba(9, 22, 39, 0.55));
  border-color: rgba(94, 234, 212, 0.18);
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 0.9rem;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(79, 124, 255, 0.18), rgba(34, 211, 238, 0.12));
  color: #a5f3fc;
  border: 1px solid rgba(125, 211, 252, 0.25);
  font-size: 1.2rem;
  font-weight: 800;
}

.feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.02rem;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.65;
}

.home-cta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    radial-gradient(circle at 100% 0%, rgba(249, 115, 22, 0.22), transparent 12rem),
    radial-gradient(circle at 0% 100%, rgba(132, 204, 22, 0.12), transparent 11rem),
    linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(37, 99, 235, 0.16)),
    rgba(18, 38, 58, 0.92);
}

.home-cta p {
  color: var(--muted);
  line-height: 1.65;
}

.auth-gate {
  text-align: center;
  max-width: 520px;
  margin: 5rem auto;
  padding: 2.5rem;
}

.auth-gate p { color: var(--muted); }

.page-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    radial-gradient(circle at 82% 0%, rgba(14, 165, 233, 0.26), transparent 28rem),
    radial-gradient(circle at 12% 100%, rgba(168, 85, 247, 0.20), transparent 24rem),
    radial-gradient(circle at 52% 100%, rgba(249, 115, 22, 0.10), transparent 22rem),
    linear-gradient(135deg, rgba(19, 48, 82, 0.94), rgba(14, 22, 40, 0.90));
  box-shadow: var(--shadow);
}

.page-hero.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.9rem, 2vw, 1.5rem);
  padding: clamp(1rem, 2vw, 1.55rem);
}

.page-hero h2 {
  margin: 0;
  font-size: clamp(1.45rem, 2.4vw, 2.25rem);
  letter-spacing: -0.05em;
  color: #ffffff;
}

.page-hero p {
  max-width: 720px;
  margin: 0.55rem 0 0;
  color: #e1ebf8;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.market-stats,
.profile-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.trading-stats {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: clamp(0.65rem, 1.2vw, 0.9rem);
}

.stat-card {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 88px;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.22), transparent 9rem),
    linear-gradient(135deg, rgba(12, 40, 66, 0.66), rgba(14, 25, 44, 0.72));
  box-shadow: 0 16px 46px rgba(2, 8, 23, 0.20);
}

.stat-card.primary {
  background:
    radial-gradient(circle at 100% 0%, rgba(20, 184, 166, 0.28), transparent 9rem),
    linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(16, 185, 129, 0.16)),
    rgba(18, 38, 58, 0.92);
}

.stat-card:nth-child(2) {
  background:
    radial-gradient(circle at 100% 0%, rgba(168, 85, 247, 0.24), transparent 9rem),
    linear-gradient(135deg, rgba(46, 31, 82, 0.66), rgba(14, 25, 44, 0.72));
}

.stat-card:nth-child(3) {
  background:
    radial-gradient(circle at 100% 0%, rgba(20, 184, 166, 0.22), transparent 9rem),
    linear-gradient(135deg, rgba(10, 58, 54, 0.62), rgba(14, 25, 44, 0.72));
}

.stat-card:nth-child(4) {
  background:
    radial-gradient(circle at 100% 0%, rgba(249, 115, 22, 0.22), transparent 9rem),
    linear-gradient(135deg, rgba(70, 37, 18, 0.60), rgba(14, 25, 44, 0.72));
}

.stat-card span {
  display: block;
  color: #c2d1e6;
  font-size: 0.76rem;
  margin-bottom: 0.55rem;
}

.stat-card strong {
  display: block;
  color: #ffffff;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: -0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card .stat-sub,
.stat-card small {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.74rem;
  font-weight: 700;
}

.stat-card-pnl {
  background:
    radial-gradient(circle at 100% 0%, rgba(34, 197, 94, 0.20), transparent 9rem),
    linear-gradient(135deg, rgba(12, 52, 42, 0.62), rgba(14, 25, 44, 0.72));
}

.contract-risk-panel {
  border-color: rgba(56, 189, 248, 0.18);
  padding: 0.95rem;
  background:
    radial-gradient(circle at 12% 0%, rgba(56, 189, 248, 0.12), transparent 18rem),
    radial-gradient(circle at 88% 8%, rgba(168, 85, 247, 0.10), transparent 18rem),
    linear-gradient(180deg, rgba(18, 31, 55, 0.92), rgba(12, 24, 43, 0.88));
}

.contract-risk-panel.risk-warn {
  border-color: rgba(251, 191, 36, 0.35);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.08);
}

.contract-risk-panel.risk-danger {
  border-color: rgba(248, 113, 113, 0.35);
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.08);
}

.contract-risk-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(420px, 1.45fr);
  gap: clamp(0.75rem, 1.5vw, 1rem);
  align-items: stretch;
}

.contract-risk-metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
}

.risk-metric-card {
  min-width: 0;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0%, rgba(56, 189, 248, 0.08), transparent 10rem),
    rgba(7, 12, 22, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.risk-metric-card > span {
  display: block;
  margin-bottom: 0.42rem;
  color: #9fb0c9;
  font-size: 0.74rem;
  font-weight: 700;
}

.risk-metric-card > strong {
  display: block;
  font-size: clamp(1.08rem, 1.7vw, 1.38rem);
  letter-spacing: -0.03em;
}

.risk-metric-sub {
  display: block;
  margin-top: 0.4rem;
  color: #8fa3bf;
  font-size: 0.76rem;
  line-height: 1.45;
}

.contract-risk-overview {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(circle at 20% 0%, rgba(34, 197, 94, 0.10), transparent 18rem),
    linear-gradient(135deg, rgba(7, 12, 22, 0.52), rgba(15, 23, 42, 0.34));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.contract-risk-gauge-head {
  display: flex;
  width: 100%;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  color: #9fb0c9;
  font-size: 0.82rem;
  font-weight: 700;
}

.contract-risk-gauge-head strong {
  color: #f8fbff;
  font-size: 1rem;
}

.contract-risk-gauge {
  display: grid;
  gap: 0.7rem;
  padding-top: 0.25rem;
}

.risk-gauge-track {
  position: relative;
  width: 100%;
  height: 34px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.26);
  background: rgba(2, 6, 23, 0.72);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 16px 34px rgba(2, 8, 23, 0.22);
  overflow: visible;
}

.risk-gauge-zone {
  position: absolute;
  top: 5px;
  bottom: 5px;
}

.risk-gauge-danger-zone {
  left: 0;
  width: 10%;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, rgba(239, 68, 68, 0.92), rgba(248, 113, 113, 0.76));
}

.risk-gauge-warn-zone {
  left: 10%;
  width: calc(var(--warning-pct, 30%) - 10%);
  min-width: 6%;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.82), rgba(245, 158, 11, 0.68));
}

.risk-gauge-safe-zone {
  left: var(--warning-pct, 30%);
  right: 0;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.70), rgba(45, 212, 191, 0.82));
}

.risk-gauge-line {
  position: absolute;
  top: -8px;
  bottom: -8px;
  width: 2px;
  background: #fbbf24;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.16);
  pointer-events: none;
}

.risk-gauge-liquidation {
  left: 0;
  background: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.16);
}

.risk-gauge-warning {
  left: var(--warning-pct, 30%);
}

.risk-gauge-thumb {
  position: absolute;
  left: var(--gauge-pct, 50%);
  top: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  margin-top: -10px;
  border-radius: 50%;
  border: 2px solid #f8fbff;
  background: #38bdf8;
  box-shadow:
    0 0 0 5px rgba(56, 189, 248, 0.18),
    0 8px 18px rgba(2, 8, 23, 0.36);
  transition: left 0.35s ease;
}

.contract-risk-gauge[data-level="warn"] .risk-gauge-thumb {
  background: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.25);
}

.contract-risk-gauge[data-level="danger"] .risk-gauge-thumb {
  background: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
}

.risk-gauge-scale {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #9fb0c9;
  font-size: 0.76rem;
  line-height: 1.3;
}

.risk-gauge-scale span:last-child {
  color: #f8fbff;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.risk-gauge-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  justify-content: flex-start;
  color: #9fb0c9;
  font-size: 0.76rem;
}

.risk-gauge-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 0.35rem;
  border-radius: 999px;
  vertical-align: middle;
}

.legend-safe { background: #86efac; }
.legend-warn { background: #fbbf24; }
.legend-danger { background: #f87171; }

.contract-risk-data-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.55rem;
}

.contract-risk-data-grid > div {
  min-width: 0;
  padding: 0.62rem 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.38);
}

.contract-risk-data-grid span {
  display: block;
  margin-bottom: 0.22rem;
  color: #8fa3bf;
  font-size: 0.7rem;
}

.contract-risk-data-grid strong {
  color: #f8fbff;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.contract-status-badge.status-normal {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.35);
  background: rgba(20, 83, 45, 0.28);
}

.contract-status-badge.status-warn {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(120, 83, 9, 0.28);
}

.contract-status-badge.status-danger {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.28);
}

.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.panel-title-row .section-kicker {
  margin-bottom: 0.4rem;
  font-size: 0.7rem;
}

.panel-title-row h2 {
  margin: 0;
  font-size: 1.12rem;
  letter-spacing: -0.03em;
  color: #f7fbff;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(7, 12, 22, 0.38);
}

.table-wrap .table th:first-child,
.table-wrap .table td:first-child {
  padding-left: 0.9rem;
}

.table-wrap .table th:last-child,
.table-wrap .table td:last-child {
  padding-right: 0.9rem;
}

.market-overview-panel {
  margin: 0;
}

.market-overview-panel .table {
  min-width: 680px;
}

.market-pulse-panel,
.market-category-panel,
.trade-quote-panel {
  margin: 0;
}

.market-session {
  display: grid;
  gap: 0.2rem;
  justify-items: end;
  color: #bfdbfe;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
}

.market-session small {
  color: #8494ad;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
}

.instrument-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.85rem;
}

.instrument-card {
  display: grid;
  gap: 0.35rem;
  text-align: left;
  padding: 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background:
    radial-gradient(circle at 100% 0%, rgba(96, 165, 250, 0.10), transparent 7rem),
    rgba(7, 12, 22, 0.48);
}

.instrument-card span,
.instrument-card small {
  color: #9fb0c9;
  font-size: 0.76rem;
  font-weight: 700;
}

.instrument-card strong {
  color: #f8fbff;
  font-size: 1.25rem;
  letter-spacing: -0.04em;
}

.instrument-card em,
.mover-row em,
.sector-row em,
.category-symbols em {
  font-style: normal;
  font-weight: 900;
}

/* A-share colors: red = up, green = down */
.up { color: #ff4d4f !important; }
.down { color: #22c55e !important; }
.flat { color: #9fb0c9 !important; }

/* Price flash: green background on rise, red background on fall */
.price-tone-up { color: #4ade80 !important; }
.price-tone-down { color: #ff6b6b !important; }
.price-tone-flat { color: #dbe4f0 !important; }

.price-flash-cell {
  display: inline-block;
  min-width: 2.5rem;
  padding: 0.08rem 0.28rem;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  transition: color 0.35s ease;
}

.pnl-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 850;
}

.term-hint {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  cursor: help;
  border-bottom: 1px dotted rgba(147, 197, 253, 0.72);
}

.term-hint::before,
.term-hint::after {
  position: absolute;
  left: 50%;
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
}

.term-hint::before {
  content: "";
  bottom: calc(100% + 6px);
  border: 6px solid transparent;
  border-top-color: rgba(5, 10, 20, 0.96);
}

.term-hint::after {
  content: attr(data-tooltip);
  bottom: calc(100% + 18px);
  width: max-content;
  max-width: min(320px, 72vw);
  padding: 0.72rem 0.82rem;
  border-radius: 12px;
  border: 1px solid rgba(147, 197, 253, 0.24);
  background: rgba(5, 10, 20, 0.96);
  color: #eaf2ff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.55;
  letter-spacing: 0;
  text-align: left;
  white-space: normal;
  text-transform: none;
}

.term-hint:hover::before,
.term-hint:hover::after,
.term-hint:focus-visible::before,
.term-hint:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.market-professional-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr) minmax(0, 0.9fr);
  gap: 1.25rem;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.85rem;
}

.category-card {
  min-width: 0;
  padding: 0.95rem;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  background:
    radial-gradient(circle at 100% 0%, rgba(59, 130, 246, 0.10), transparent 8rem),
    rgba(7, 12, 22, 0.44);
}

.category-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.75rem;
}

.category-title strong {
  color: #f4f8ff;
  font-size: 0.95rem;
}

.category-title span {
  min-width: 26px;
  text-align: center;
  color: #bfdbfe;
  border: 1px solid rgba(96, 165, 250, 0.22);
  background: rgba(59, 130, 246, 0.10);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
}

.category-symbols {
  display: grid;
  gap: 0.5rem;
}

.category-symbols button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  text-align: left;
  padding: 0.55rem 0;
  background: transparent;
  border-radius: 10px;
  color: #dbe7f7;
}

.category-symbols button:hover {
  background: rgba(59, 130, 246, 0.08);
}

.category-symbols span {
  display: grid;
  gap: 0.1rem;
}

.category-symbols strong {
  color: #eaf2ff;
  font-size: 0.82rem;
}

.category-symbols small {
  color: #8ea0bb;
  font-size: 0.72rem;
}

.sector-list,
.mover-list {
  display: grid;
  gap: 0.65rem;
}

.sector-row,
.mover-row {
  width: 100%;
  display: grid;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(7, 12, 22, 0.42);
  border-radius: 14px;
  color: #dbe7f7;
}

.sector-row {
  grid-template-columns: minmax(120px, 1fr) 1fr auto;
  gap: 0.8rem;
  padding: 0.72rem 0.8rem;
  text-align: left;
}

.sector-row span,
.mover-row span {
  display: grid;
  gap: 0.15rem;
}

.sector-row strong,
.mover-row strong {
  color: #f4f8ff;
  font-size: 0.86rem;
}

.sector-row small,
.mover-row small {
  color: #8494ad;
  font-size: 0.72rem;
}

.sector-row i {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(30, 41, 59, 0.95);
}

.sector-row i b {
  display: block;
  height: 100%;
  min-width: 8px;
  border-radius: inherit;
  background: currentColor;
}

.mover-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem;
  padding: 0.75rem 0.85rem;
  text-align: left;
}

.mover-row .right {
  justify-items: end;
}

.mover-row b {
  color: #f8fbff;
}

.trade-quote-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.trade-quote-grid div {
  min-height: 86px;
  padding: 0.85rem;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 16px;
  background: rgba(7, 12, 22, 0.44);
}

.trade-quote-grid span {
  display: block;
  color: #aab8d0;
  font-size: 0.78rem;
  margin-bottom: 0.45rem;
}

.trade-quote-grid .term-hint {
  display: inline-flex;
}

.trade-quote-grid strong {
  display: block;
  color: #f8fbff;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.market-chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 1.25rem;
  align-items: stretch;
}

.chart-panel,
.chart-side-panel {
  min-width: 0;
}

.chart-toolbar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.data-source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.34rem 0.68rem;
  border-radius: 999px;
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.11);
  border: 1px solid rgba(96, 165, 250, 0.22);
  font-size: 0.75rem;
  font-weight: 800;
}

.chart-chip {
  background: rgba(15, 23, 42, 0.74);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.42rem 0.72rem;
  font-size: 0.78rem;
}

.chart-chip.active {
  color: #fff;
  border-color: rgba(96, 165, 250, 0.48);
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.9), rgba(37, 99, 235, 0.75));
}

.chart-wrap {
  position: relative;
  width: 100%;
  height: 420px;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(7, 12, 22, 0.56), rgba(7, 12, 22, 0.82)),
    radial-gradient(circle at 30% 0%, rgba(59, 130, 246, 0.10), transparent 18rem);
}

.chart-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.trade-chart-wrap {
  height: 360px;
}

.order-dialog {
  width: min(480px, calc(100% - 2rem));
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: var(--text);
  background: transparent;
}

.order-dialog:not([open]) {
  display: none !important;
}

.order-dialog[open] {
  position: fixed;
  inset: 0;
  z-index: 11000;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 1rem;
  display: grid;
  place-items: center;
  overflow: auto;
  border: none;
  background: transparent;
}

.order-dialog::backdrop {
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(8px);
  animation: backdrop-in 0.28s ease both;
}

.order-dialog[open] .order-dialog-card {
  animation: dialog-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.order-dialog[open] .order-dialog-card {
  width: min(480px, 100%);
  max-height: min(90vh, 900px);
  overflow: auto;
}

.market-quick-buy-dialog[open] .order-dialog-card {
  width: min(520px, 100%);
}

.order-dialog-card {
  margin: 0;
  padding: 1.25rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(18, 27, 43, 0.98), rgba(15, 23, 42, 0.96));
  box-shadow: var(--shadow);
}

.order-confirm-dl {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 0.75rem 1rem;
  margin: 0 0 1.1rem;
  padding: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(7, 12, 22, 0.45);
}

.order-confirm-dl dt {
  color: #9fb0c9;
  font-weight: 800;
}

.order-confirm-dl dd {
  margin: 0;
  color: #f8fbff;
  font-weight: 850;
}

.order-dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.contract-open-hint {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
}

.contracts-open-btn {
  flex: 0 0 auto;
  min-width: 118px;
  white-space: nowrap;
}

.contract-open-dialog {
  width: min(560px, calc(100% - 2rem));
}

.open-contract-form {
  display: grid;
  grid-template-columns: 1fr 120px;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.open-contract-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.84rem;
  color: #9fb0c9;
}

.open-contract-field input,
.open-contract-field select {
  width: 100%;
}

.open-contract-notes,
.open-contract-preview {
  margin-bottom: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(8, 14, 26, 0.55);
}

.open-contract-notes h3,
.open-contract-preview h3 {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #dbe7ff;
}

.open-contract-notes-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #b8c5dc;
  font-size: 0.82rem;
  line-height: 1.55;
}

.open-contract-notes-list li + li {
  margin-top: 0.35rem;
}

.open-contract-preview-dl {
  margin: 0;
}

.market-quick-buy-dialog {
  width: min(520px, calc(100% - 2rem));
}

.dialog-inline-message {
  margin: 0 0 0.9rem;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  font-size: 0.86rem;
  line-height: 1.45;
}

.dialog-inline-message[hidden],
.dialog-inline-message:empty {
  display: none !important;
}

.dialog-inline-message.error {
  border: 1px solid rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
}

.dialog-inline-message.warn {
  border: 1px solid rgba(251, 191, 36, 0.35);
  background: rgba(120, 83, 9, 0.28);
  color: #fde68a;
}

.dialog-inline-message.success {
  border: 1px solid rgba(74, 222, 128, 0.35);
  background: rgba(20, 83, 45, 0.28);
  color: #bbf7d0;
}

.market-quick-buy-dialog .order-confirm-dl input {
  width: 100%;
  max-width: none;
}

.quick-buy-contract-section {
  margin: 0 0 1rem;
}

.quick-buy-section-title {
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8fa3bf;
}

.quick-buy-mode-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.quick-buy-mode-card {
  display: block;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 12, 22, 0.38);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.quick-buy-mode-card:has(input:checked) {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(14, 165, 233, 0.07);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.14);
}

.quick-buy-mode-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.quick-buy-mode-card-inner {
  padding: 0.85rem 1rem;
}

.quick-buy-mode-card-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
  font-size: 0.94rem;
}

.quick-buy-mode-dot {
  width: 16px;
  height: 16px;
  border: 2px solid #64748b;
  border-radius: 50%;
  flex-shrink: 0;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.quick-buy-mode-card:has(input:checked) .quick-buy-mode-dot {
  border-color: #38bdf8;
  box-shadow: inset 0 0 0 3px #0f172a, inset 0 0 0 5px #38bdf8;
}

.quick-buy-mode-panel {
  padding-left: 1.55rem;
}

.quick-buy-mode-card:not(:has(input:checked)) .quick-buy-mode-panel {
  opacity: 0.42;
  pointer-events: none;
}

.quick-buy-mode-panel select,
.quick-buy-mode-panel input {
  width: 100%;
}

.quick-buy-new-fields {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 0.65rem;
}

.quick-buy-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #9fb0c9;
}

.quick-buy-field input,
.quick-buy-field select {
  min-height: 38px;
}

.quick-buy-price-note {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: #fbbf24;
}

.quick-buy-dialog-actions {
  grid-template-columns: 1fr 1fr;
}

.quick-buy-direct-hint {
  margin: 0 0 12px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.quick-buy-dialog-actions #market-quick-buy-submit {
  grid-column: 1 / -1;
}

.chart-quick-buy-btn {
  padding: 0.35rem 0.85rem;
  font-size: 0.82rem;
  min-height: auto;
}

.toast-root {
  position: fixed;
  top: 1rem;
  right: 1rem;
  left: auto;
  bottom: auto;
  inset: auto 1rem auto auto;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: min(360px, calc(100vw - 2rem));
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  overflow: visible;
  pointer-events: none;
}

.toast-root:popover-open {
  position: fixed;
  top: 1rem;
  right: 1rem;
  left: auto;
  bottom: auto;
  inset: auto 1rem auto auto;
  width: min(360px, calc(100vw - 2rem));
  border: none;
  background: transparent;
  overflow: visible;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.8rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(180deg, rgba(18, 27, 43, 0.98), rgba(15, 23, 42, 0.96));
  box-shadow: 0 16px 40px rgba(2, 8, 23, 0.35);
  color: #f8fbff;
  font-size: 0.9rem;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: auto;
  cursor: pointer;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 900;
  flex-shrink: 0;
}

.toast-success .toast-icon {
  background: rgba(34, 197, 94, 0.18);
  color: #4ade80;
}

.toast-error .toast-icon {
  background: rgba(239, 68, 68, 0.18);
  color: #f87171;
}

.toast-warn .toast-icon {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
}

.toast-info .toast-icon {
  background: rgba(56, 189, 248, 0.18);
  color: #38bdf8;
}

.toast-text {
  flex: 1;
  padding-top: 1px;
}

.result-hidden {
  display: none !important;
}

.order-dialog-actions button {
  justify-content: center;
  border-radius: 14px;
  min-height: 42px;
}

.chart-tooltip {
  position: absolute;
  z-index: 5;
  width: 210px;
  padding: 0.8rem;
  border-radius: 14px;
  border: 1px solid rgba(147, 197, 253, 0.24);
  background: rgba(5, 10, 20, 0.92);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.tooltip-title {
  color: #eaf2ff;
  font-size: 0.78rem;
  font-weight: 800;
  margin-bottom: 0.55rem;
}

.tooltip-grid {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 0.32rem 0.65rem;
  font-size: 0.78rem;
}

.tooltip-grid span {
  color: #7f8da6;
}

.tooltip-grid strong {
  color: #dbeafe;
  text-align: right;
}

.tooltip-grid .up { color: #ff6b6b; }
.tooltip-grid .down { color: #4ade80; }

#kline-chart {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
  color: #aab8d0;
  font-size: 0.82rem;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
}

.chart-legend i {
  width: 16px;
  height: 3px;
  border-radius: 999px;
}

.legend-up { background: #ef4444; }
.legend-down { background: #22c55e; }
.legend-ma { background: #fbbf24; }
.legend-volume { background: rgba(96, 165, 250, 0.72); }

.chart-metrics {
  display: grid;
  gap: 0.8rem;
}

.chart-metrics div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.78rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 12, 22, 0.42);
}

.chart-metrics span {
  color: #aab8d0;
}

.chart-metrics strong {
  color: #f8fbff;
}

.chart-note {
  margin-top: 1rem;
  padding: 0.95rem;
  border-radius: 14px;
  color: #adbad1;
  line-height: 1.6;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.12);
  font-size: 0.86rem;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 340px;
  gap: 1.25rem;
}

.quotes-panel {
  grid-column: 2 / 4;
}

.market-layout {
  grid-template-columns: 320px minmax(0, 1fr);
  align-items: start;
}

.market-layout .quotes-panel {
  grid-column: auto;
  min-height: 100%;
}

.trading-layout {
  grid-template-columns: 360px minmax(0, 1fr);
  align-items: start;
}

.trade-workspace-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.trade-workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.trade-tab-body {
  position: relative;
  height: clamp(400px, 44vh, 520px);
  min-height: 400px;
}

.trade-tab-body:has(#trade-tab-order.active) {
  height: clamp(500px, 54vh, 620px);
  min-height: 500px;
}

.trade-workspace-tab {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(7, 12, 22, 0.45);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.trade-workspace-tab.active {
  color: #fff;
  border-color: rgba(14, 165, 233, 0.55);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.85), rgba(14, 165, 233, 0.75));
}

.trade-tab-panel {
  display: none;
  position: absolute;
  inset: 0;
  flex-direction: column;
  overflow: hidden;
}

.trade-tab-panel.active {
  display: flex;
}

.trade-tab-panel .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.trade-tab-panel > .pagination-bar,
.trade-tab-panel > [id$="-pagination"] {
  flex-shrink: 0;
  margin-top: auto;
  padding-top: 0.65rem;
}

#trade-tab-order.trade-tab-panel.active {
  overflow-x: hidden;
  overflow-y: auto;
  justify-content: flex-start;
}

.trade-order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 1rem 1.15rem;
  width: 100%;
  height: auto;
  align-items: start;
  min-height: 0;
}

.trade-order-summary {
  background:
    radial-gradient(circle at 100% 0%, rgba(14, 165, 233, 0.1), transparent 12rem),
    rgba(8, 16, 32, 0.55);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  padding: 0.7rem 0.8rem;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.trade-order-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.trade-order-summary-head .section-kicker {
  font-size: 0.68rem;
}

.trade-order-summary h3 {
  margin: 0.15rem 0 0;
  font-size: 0.9rem;
  line-height: 1.3;
}

.trade-order-summary .data-source-badge {
  font-size: 0.68rem;
  padding: 0.15rem 0.45rem;
  white-space: nowrap;
}

.trade-order-quote-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.38rem 0.5rem;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
}

.trade-order-quote-grid div {
  min-height: 0;
  padding: 0.45rem 0.55rem;
  border-radius: 10px;
}

.trade-order-quote-grid span {
  font-size: 0.68rem;
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.trade-order-quote-grid strong {
  font-size: 0.82rem;
  line-height: 1.25;
  word-break: break-word;
}

.symbol-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.symbol-field {
  grid-column: 1 / -1;
}

.symbol-quick-pick {
  min-width: 7.5rem;
  max-width: 9.5rem;
  font-size: 0.82rem;
}

.list-controls {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.65rem;
  flex-shrink: 0;
}

.list-control-search {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.list-control-filter,
.list-control-sort {
  flex: 0 0 auto;
  width: auto;
  min-width: 7.25rem;
  max-width: 10.5rem;
}

.position-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.position-actions button {
  padding: 0.28rem 0.55rem;
  font-size: 0.74rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(7, 12, 22, 0.55);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.position-actions button:hover {
  border-color: rgba(14, 165, 233, 0.45);
  color: #fff;
}

.position-actions .btn-short {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}

.position-qty.short {
  color: #4ade80;
}

.position-qty.long {
  color: #ff6b6b;
}

.trade-tab-panel .table .position-row-clickable {
  cursor: pointer;
}

.trade-tab-panel .table .position-row-clickable:hover {
  background: rgba(59, 130, 246, 0.08);
}

.trade-order-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem 0.85rem;
}

.limit-price-field {
  grid-column: auto;
}

.order-session-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.4;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  background: rgba(251, 191, 36, 0.08);
  color: #fcd34d;
}

.order-session-hint.session-open {
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.08);
  color: #86efac;
}

.trade-order-form button[type="submit"] {
  grid-column: 1 / -1;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.85rem;
  flex-wrap: wrap;
}

.auth-page {
  min-height: 100vh;
}

.auth-page .auth-wrap {
  width: min(440px, calc(100% - 2rem));
  max-width: 440px;
  flex: 0 0 auto;
  margin: clamp(2rem, 8vh, 5rem) auto auto;
  align-self: center;
  padding: 1.5rem 1.35rem 1.25rem;
}

.pagination-info {
  color: var(--muted);
  font-size: 0.84rem;
}

.pagination-btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.trading-hero {
  background:
    radial-gradient(circle at 86% 12%, rgba(245, 158, 11, 0.16), transparent 22rem),
    linear-gradient(135deg, rgba(18, 27, 43, 0.96), rgba(12, 18, 30, 0.92));
}

.watchlist-panel,
.order-panel {
  position: sticky;
  top: 92px;
}

.quotes-panel,
.positions-panel,
.orders-panel,
.market-overview-panel {
  min-width: 0;
}

.span-2 {
  grid-column: span 2;
}

.row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
}

.row button,
.order-form button,
#add-symbol,
#deposit-btn-profile,
#leverage-btn-profile,
#save-profile-btn {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: #fff;
  border-radius: 12px;
  padding: 0.72rem 0.95rem;
}

.watchlist {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.watchlist li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 0.3rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.watchlist li:hover span {
  color: #93c5fd;
}

.watchlist button {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.16);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.quotes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0.85rem;
}

.quote-card {
  background: rgba(7, 12, 22, 0.62);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.quote-card:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.34);
  background: rgba(15, 23, 42, 0.86);
}

.quote-card .sym {
  color: #bfdbfe;
  font-weight: 800;
  font-size: 1.08rem;
}

.quote-card .name {
  margin-top: 0.16rem;
  color: #8ea0bb;
  font-size: 0.74rem;
  font-weight: 700;
}

.quote-card .last {
  font-size: 1.75rem;
  margin: 0.35rem 0;
  letter-spacing: -0.04em;
  color: #f8fbff;
}

.quote-card .sub {
  color: #9aa8bf;
  font-size: 0.8rem;
}

.order-form {
  display: grid;
  gap: 0.8rem;
}

.order-form label {
  display: grid;
  gap: 0.35rem;
  color: #aab8d0;
  font-size: 0.85rem;
}

.result {
  min-height: 0;
  margin: 0.85rem 0 0;
  color: #aab8d0;
  white-space: pre-wrap;
  font-size: 0.8rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.75rem 0.55rem;
  border-bottom: 1px solid var(--border);
}

.table td {
  color: #dbe7f7;
}

.table th {
  color: #b7c5dc;
  font-weight: 700;
  background: rgba(7, 12, 22, 0.25);
  white-space: nowrap;
}

.table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

.link-btn {
  background: transparent;
  color: #bfdbfe;
  padding: 0;
  font-weight: 800;
}

.symbol-cell,
.symbol-stack {
  display: inline-grid;
  gap: 0.15rem;
  text-align: left;
}

.symbol-cell small,
.symbol-stack small {
  color: #8ea0bb;
  font-size: 0.74rem;
  font-weight: 700;
}

.symbol-stack strong {
  color: #eaf2ff;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
}

.status.online {
  background: rgba(34, 197, 94, 0.12);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.18);
}

.status.offline {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.18);
}

#profile-content .ledger-panel-full {
  grid-column: 1 / -1;
}

.wallet-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.wallet-action-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 12, 22, 0.38);
}

.wallet-action-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.ledger-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0 0 1rem;
}

.ledger-tab {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(7, 12, 22, 0.45);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.ledger-tab.active {
  color: #fff;
  border-color: rgba(14, 165, 233, 0.55);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.85), rgba(14, 165, 233, 0.75));
}

.ledger-table .ledger-note {
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-empty {
  text-align: center;
  padding: 1.25rem !important;
}

#profile-content {
  display: grid;
  gap: 1.25rem;
}

.profile-stats {
  margin: 0;
}

.profile-settings-panel {
  padding-bottom: 0.35rem;
}

.profile-settings-menu {
  display: grid;
  gap: 0.55rem;
}

.profile-settings-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9rem;
  width: 100%;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 16px;
  background: rgba(7, 12, 22, 0.42);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.profile-settings-item:hover {
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(14, 165, 233, 0.08);
  transform: translateY(-1px);
}

.profile-settings-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 14px;
  background: rgba(37, 99, 235, 0.14);
  font-size: 1.1rem;
}

.profile-settings-copy {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.profile-settings-copy strong {
  font-size: 0.96rem;
  letter-spacing: -0.01em;
}

.profile-settings-copy small {
  color: var(--muted-2);
  font-size: 0.8rem;
  line-height: 1.45;
}

.profile-settings-chevron {
  color: #7f91ad;
  font-size: 1.35rem;
  line-height: 1;
}

.profile-settings-dialog[open] .order-dialog-card {
  width: min(560px, 100%);
}

.profile-wallet-dialog[open] .order-dialog-card {
  width: min(640px, 100%);
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.profile-hero {
  background:
    radial-gradient(circle at 86% 20%, rgba(34, 197, 94, 0.16), transparent 22rem),
    linear-gradient(135deg, rgba(18, 27, 43, 0.96), rgba(9, 16, 29, 0.92));
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.avatar-card {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 24px;
  color: #fff;
  font-size: 2rem;
  font-weight: 900;
  background: linear-gradient(135deg, #2563eb, #22c55e);
  box-shadow: 0 20px 48px rgba(37, 99, 235, 0.28);
}

.profile-hero h2 {
  margin: 0;
}

.profile-hero p {
  margin-top: 0.35rem;
  color: #aab8d0;
}

.profile-badges {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.42rem 0.75rem;
  border-radius: 999px;
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.2);
  font-size: 0.82rem;
  font-weight: 800;
}

.pill.green {
  color: #86efac;
  background: rgba(34, 197, 94, 0.11);
  border-color: rgba(34, 197, 94, 0.18);
}

.profile-info-panel,
.profile-security-panel,
.profile-account-panel,
.profile-action-panel {
  min-height: 100%;
}

.profile-avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
}

.profile-avatar-img {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.35);
}

.profile-avatar-upload {
  margin-bottom: 1rem;
}

.profile-upload-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.35);
  background: rgba(14, 165, 233, 0.12);
  color: #dbeafe;
  font-size: 0.84rem;
  cursor: pointer;
}

.profile-upload-hint {
  margin: 0.45rem 0 0;
  font-size: 0.8rem;
}

.profile-security-status {
  margin: 0 0 1rem;
  line-height: 1.5;
}

.profile-security-form {
  display: grid;
  gap: 0.75rem;
}

.profile-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.84rem;
  color: #9fb0c9;
}

.profile-field input {
  width: 100%;
}

.profile-action-panel .row {
  display: flex;
  flex-wrap: wrap;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(7, 12, 22, 0.36);
  margin-bottom: 0.85rem;
}

.profile-action-panel .row > input,
.profile-action-panel .row > select {
  flex: 1 1 120px;
  width: auto;
  min-width: 0;
}

.profile-action-panel .row > button,
#fund-contract-btn {
  flex: 0 0 auto;
  width: auto;
  min-width: 112px;
  white-space: nowrap;
}

#open-contract-leverage {
  flex: 0 0 86px;
}

#open-contract-btn {
  min-width: 118px;
}

#fund-contract-select,
#fund-contract-mode {
  flex-basis: 140px;
}

#fund-contract-btn {
  margin-top: 0.15rem;
}

.contract-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
}

.contract-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 12, 22, 0.36);
}

.contract-row.active-contract {
  border-color: rgba(56, 189, 248, 0.55);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.15);
}

.contract-row-main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.88rem;
  color: #c5d0e6;
}

.contract-subtitle {
  margin: 1rem 0 0.5rem;
  font-size: 0.95rem;
}

.contract-settings-hint {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
}

.contract-select-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.contract-select-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.92rem;
}

.contract-status-badge {
  font-size: 0.82rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: #9fb0cc;
}

.contracts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  margin: 0.5rem 0 1.25rem;
}

.contract-card {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.15rem 1.25rem;
  min-height: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(7, 12, 22, 0.42);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.contract-card.pnl-up {
  border-color: rgba(248, 113, 113, 0.5);
  background:
    linear-gradient(145deg, rgba(127, 29, 29, 0.36) 0%, rgba(7, 12, 22, 0.72) 72%),
    rgba(7, 12, 22, 0.42);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.1),
    0 10px 28px rgba(127, 29, 29, 0.2);
}

.contract-card.pnl-down {
  border-color: rgba(74, 222, 128, 0.5);
  background:
    linear-gradient(145deg, rgba(6, 95, 70, 0.38) 0%, rgba(7, 12, 22, 0.72) 72%),
    rgba(7, 12, 22, 0.42);
  box-shadow:
    0 0 0 1px rgba(74, 222, 128, 0.1),
    0 10px 28px rgba(6, 78, 59, 0.22);
}

.contract-card.pnl-up .contract-card-head strong {
  color: #fee2e2;
}

.contract-card.pnl-down .contract-card-head strong {
  color: #d1fae5;
}

.contract-card.pnl-up .contract-status {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.32);
}

.contract-card.pnl-down .contract-status {
  color: #86efac;
  border-color: rgba(74, 222, 128, 0.35);
  background: rgba(6, 78, 59, 0.35);
}

.contract-card.warn {
  border-color: rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.12), 0 10px 28px rgba(180, 83, 9, 0.18);
}

.contract-card.danger {
  border-color: rgba(239, 68, 68, 0.7);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.14), 0 10px 28px rgba(127, 29, 29, 0.28);
}

.contract-card .contract-status {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: #9fb0cc;
  background: rgba(15, 23, 42, 0.45);
}

.contract-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.contract-card-metrics {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.88rem;
  color: #c5d0e6;
}

.contract-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: auto;
}

.contract-card-actions .btn-primary,
.contract-card-actions .btn-secondary {
  width: 100%;
  min-width: 0;
}

.holdings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.holding-card-head {
  align-items: flex-start;
}

.holding-symbol-stack {
  display: grid;
  gap: 0.2rem;
}

.holding-symbol-stack strong {
  font-size: 1.2rem;
  letter-spacing: 0.02em;
}

.holding-symbol-stack small {
  color: var(--muted-2);
  font-size: 0.8rem;
}

.holding-card-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.holding-leverage {
  font-size: 0.82rem;
  color: #93c5fd;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(96, 165, 250, 0.28);
  background: rgba(37, 99, 235, 0.12);
}

.holdings-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 1rem;
  justify-items: start;
  padding: 1.5rem;
}

.holdings-empty-cta {
  text-decoration: none;
}

.holding-card-metrics {
  display: grid;
  gap: 0.35rem;
}

.holding-card .contract-card-actions {
  grid-template-columns: 1fr;
}

.contract-fund-dialog {
  width: min(520px, calc(100% - 2rem));
}

.fund-contract-form {
  margin-bottom: 0.85rem;
}

@media (max-width: 1180px) {
  .contracts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .contracts-grid {
    grid-template-columns: 1fr;
  }

  .contract-card-actions {
    grid-template-columns: 1fr;
  }
}

.contract-detail-hero .contract-detail-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.85rem;
  align-items: center;
  width: 100%;
}

.contract-detail-hero.page-hero.compact {
  padding: clamp(0.75rem, 1.5vw, 1.1rem) clamp(1rem, 2vw, 1.45rem);
  border-radius: 22px;
}

.contract-detail-hero.pnl-up {
  border-color: rgba(248, 113, 113, 0.45);
  background:
    radial-gradient(circle at 82% 0%, rgba(248, 113, 113, 0.26), transparent 28rem),
    radial-gradient(circle at 12% 100%, rgba(239, 68, 68, 0.18), transparent 24rem),
    linear-gradient(135deg, rgba(127, 29, 29, 0.88), rgba(14, 22, 40, 0.9));
}

.contract-detail-hero.pnl-down {
  border-color: rgba(74, 222, 128, 0.45);
  background:
    radial-gradient(circle at 82% 0%, rgba(74, 222, 128, 0.28), transparent 28rem),
    radial-gradient(circle at 12% 100%, rgba(16, 185, 129, 0.18), transparent 24rem),
    linear-gradient(135deg, rgba(6, 78, 59, 0.92), rgba(14, 22, 40, 0.9));
}

.contract-detail-hero .section-kicker {
  margin-bottom: 0.35rem;
  font-size: 0.68rem;
}

.contract-detail-hero h2 {
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.12;
}

.contract-detail-hero p {
  margin-top: 0.45rem;
  font-size: 0.78rem;
  line-height: 1.4;
}

.contract-back-btn {
  white-space: nowrap;
  min-height: 34px;
  padding: 0.42rem 0.7rem;
  font-size: 0.78rem;
}

.contracts-empty {
  grid-column: 1 / -1;
  padding: 1rem 0;
}

.profile-dl {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.85rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
}

.profile-dl dt {
  color: #aab8d0;
}

.profile-dl dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  color: #e2e8f0;
  font-weight: 650;
}

.profile-dl input {
  margin-top: -0.25rem;
}

@media (max-width: 1180px) {
  .header {
    grid-template-columns: 1fr;
  }

  .main-nav,
  .account-meta {
    justify-self: stretch;
    justify-content: center;
  }

  .home-sections,
  .home-poster-strip,
  .market-chart-grid,
  .market-professional-grid,
  .news-page-layout,
  .layout,
  .trading-layout,
  .profile-grid,
  .market-stats,
  .profile-stats,
  .trade-quote-grid,
  .trade-order-layout,
  .trade-order-quote-grid,
  .contract-risk-grid,
  .contract-risk-metrics {
    grid-template-columns: 1fr;
  }

  .trading-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contract-risk-overview {
    padding: 0.9rem;
  }

  .instrument-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .home-market-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-poster-strip {
    grid-template-columns: 1fr;
  }

  .home-news-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-hero.compact {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-identity {
    align-items: flex-start;
  }

  .watchlist-panel,
  .order-panel {
    position: static;
  }

  #home-features,
  .quotes-panel,
  .span-2 {
    grid-column: auto;
  }

  .feature-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 1rem, 1360px);
    padding-top: 1rem;
  }

  .header {
    padding: 0.8rem;
  }

  .main-nav {
    overflow-x: auto;
    justify-content: flex-start;
  }

  .account-meta {
    justify-content: flex-start;
  }

  .header-stat {
    display: none;
  }

  .banner-carousel,
  .banner-slide {
    min-height: 300px;
  }

  .home-poster-card {
    min-height: 170px;
  }

  .banner-slide {
    padding: 1.5rem;
  }

  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .page-hero.compact {
    padding: 1.25rem;
    border-radius: 20px;
  }

  .market-stats,
  .profile-stats {
    gap: 0.75rem;
  }

  .instrument-grid {
    grid-template-columns: 1fr;
  }

  .home-market-grid {
    grid-template-columns: 1fr;
  }

  .home-news-grid {
    grid-template-columns: 1fr;
  }

  .news-page-list-panel {
    position: static;
  }

  .news-page-meta {
    grid-template-columns: auto 1fr;
  }

  .category-grid {
    grid-template-columns: 1fr;
  }

  .sector-row {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 96px;
  }

  .trading-stats,
  .contract-risk-data-grid {
    grid-template-columns: 1fr;
  }

  .risk-gauge-scale {
    font-size: 0.68rem;
  }

  .wallet-action-grid {
    grid-template-columns: 1fr;
  }

  .trade-tab-body {
    height: 360px;
    min-height: 320px;
  }

  .trade-tab-body:has(#trade-tab-order.active) {
    height: auto;
    min-height: 540px;
  }

  .list-controls {
    flex-wrap: wrap;
  }

  .list-control-search {
    flex: 1 1 100%;
  }

  .profile-identity {
    flex-direction: column;
  }

  .profile-badges {
    justify-content: flex-start;
  }

  .avatar-card {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    font-size: 1.6rem;
  }

  .profile-dl {
    grid-template-columns: 1fr;
  }
}

/* —— Motion: page, cards, dialogs, interactions —— */
@keyframes page-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes page-leave {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes motion-stagger-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes app-shell-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Price flash: green pulse on rise, red pulse on fall */
@keyframes price-flash-up {
  0% { background-color: rgba(34, 197, 94, 0.55); }
  40% { background-color: rgba(34, 197, 94, 0.28); }
  100% { background-color: transparent; }
}

@keyframes price-flash-down {
  0% { background-color: rgba(255, 77, 79, 0.55); }
  40% { background-color: rgba(255, 77, 79, 0.28); }
  100% { background-color: transparent; }
}

@keyframes quote-card-flash-up {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
  35% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.55), inset 0 0 20px rgba(34, 197, 94, 0.12); }
}

@keyframes quote-card-flash-down {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 77, 79, 0); }
  35% { box-shadow: 0 0 0 3px rgba(255, 77, 79, 0.55), inset 0 0 20px rgba(255, 77, 79, 0.12); }
}

.motion-stagger {
  animation: motion-stagger-in 0.48s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--motion-delay, 0ms);
  will-change: opacity, transform;
}

.btn-press {
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), filter 0.14s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.btn-press:hover {
  transform: translateY(-1px);
}

.btn-press:active {
  transform: translateY(0) scale(0.97);
  filter: brightness(1.02);
}

.quote-card.tick-up {
  animation: quote-card-flash-up 0.65s ease;
  border-color: rgba(34, 197, 94, 0.55);
}

.quote-card.tick-down {
  animation: quote-card-flash-down 0.65s ease;
  border-color: rgba(255, 77, 79, 0.55);
}

.quote-card.tick-up .last {
  color: #4ade80;
}

.quote-card.tick-down .last {
  color: #ff6b6b;
}

.price-tick-up {
  animation: price-flash-up 0.65s ease;
}

.price-tick-down {
  animation: price-flash-down 0.65s ease;
}

.trade-order-quote-grid strong.price-tone-up,
.instrument-card strong.price-tone-up,
.mover-row b.price-tone-up {
  color: #4ade80;
}

.trade-order-quote-grid strong.price-tone-down,
.instrument-card strong.price-tone-down,
.mover-row b.price-tone-down {
  color: #ff6b6b;
}

@media (prefers-reduced-motion: reduce) {
  .app-main,
  .page.page-enter,
  .page.page-leave,
  .motion-stagger,
  .nav-indicator,
  .order-dialog[open] .order-dialog-card,
  .order-dialog::backdrop,
  .quote-card.tick-up,
  .quote-card.tick-down,
  .price-tick-up,
  .price-tick-down {
    animation: none !important;
    transition: none !important;
  }

  .btn-press:hover,
  .btn-press:active,
  .nav-link:active {
    transform: none;
  }
}
