

/* ============================================================ */
/* Trading-platform polish (2026-04-27)                          */
/* Goal: tighten typography, add terminal-style market status,    */
/* tabular numerics, sleeker tables, deeper dark theme.           */
/* ============================================================ */

:root {
  --mono-font: "SFMono-Regular", "JetBrains Mono", "Fira Code", "Roboto Mono",
               "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
  --tape-up: #16a34a;
  --tape-down: #dc2626;
  --tape-flat: #94a3b8;
  --grid-line: rgba(120, 145, 178, 0.16);
  --status-live: #10b981;
  --status-closed: #f59e0b;
  --status-after: #64748b;
}

html[data-theme="dark"] {
  --page-bg: #050a14;
  --surface: rgba(13, 22, 36, 0.96);
  --surface-strong: #0f1a2c;
  --surface-muted: #0a1421;
  --surface-border: rgba(83, 113, 153, 0.32);
  --surface-border-strong: rgba(120, 152, 196, 0.46);
  --surface-shadow: 0 18px 38px rgba(0, 4, 12, 0.55);
  --surface-shadow-soft: 0 10px 24px rgba(0, 4, 12, 0.40);
  --grid-line: rgba(140, 168, 200, 0.12);
  --tape-up: #34d399;
  --tape-down: #f87171;
  --tape-flat: #94a3b8;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(ellipse at top, rgba(38, 111, 216, 0.10), transparent 55%),
    linear-gradient(180deg, #050a14 0%, #030711 100%);
}

/* ---------- Market status sub-bar (sits inside the navbar) ---------- */

.market-statusbar {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.18rem 0;
  font-family: var(--mono-font);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-700);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}

.market-statusbar::-webkit-scrollbar { display: none; }

.market-statusbar__group {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
}

.market-statusbar__label {
  color: var(--text-500);
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.market-statusbar__value {
  color: var(--text-900);
  font-variant-numeric: tabular-nums;
}

.market-statusbar__sep {
  width: 1px;
  height: 14px;
  background: var(--surface-border);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(16, 185, 129, 0.08);
}

.status-pill--live {
  color: var(--status-live);
  background: rgba(16, 185, 129, 0.10);
}

.status-pill--closed {
  color: var(--status-closed);
  background: rgba(245, 158, 11, 0.10);
}

.status-pill--after {
  color: var(--status-after);
  background: rgba(100, 116, 139, 0.10);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  position: relative;
}

.status-pill--live .status-dot::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: status-pulse 1.6s ease-out infinite;
}

@keyframes status-pulse {
  0%   { transform: scale(0.6); opacity: 0.55; }
  70%  { transform: scale(1.7); opacity: 0;    }
  100% { transform: scale(1.7); opacity: 0;    }
}

@media (max-width: 991.98px) {
  .market-statusbar {
    gap: 0.55rem;
    font-size: 0.7rem;
  }
  .market-statusbar__group--user,
  .market-statusbar__sep--user {
    display: none;
  }
}

@media (max-width: 767.98px) {
  .market-statusbar {
    gap: 0.45rem;
    font-size: 0.68rem;
  }
  .market-statusbar__label {
    font-size: 0.6rem;
  }
  .market-statusbar__group--density,
  .market-statusbar__sep--density {
    display: none;
  }
}

/* ---------- Tabular numerics everywhere data shows up ---------- */

.summary-strip__value,
.summary-strip__cash-line,
.summary-strip__nav-returns,
.summary-strip__returns-line,
.metric-card .metric-value,
.kpi-mini__value,
.asset-hero__value,
.dashboard-holdings-pnl,
.dashboard-updated-at,
table.table td,
table.table th {
  font-variant-numeric: tabular-nums;
}

.summary-strip__value,
.metric-card .metric-value,
.kpi-mini__value,
.asset-hero__value {
  font-family: var(--mono-font);
  letter-spacing: -0.01em;
}

/* Numeric cells in data tables get monospace */
table.table tbody td,
table.table tfoot td {
  font-variant-numeric: tabular-nums;
}

/* ---------- Sleeker, denser data tables ---------- */

table.table {
  --bs-table-bg: transparent;
  border-collapse: separate;
  border-spacing: 0;
}

table.table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: linear-gradient(180deg, rgba(245, 249, 255, 0.96), rgba(232, 240, 252, 0.96));
  color: var(--text-700);
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--surface-border-strong);
  padding: 0.42rem 0.55rem;
}

table.table tbody td {
  padding: 0.4rem 0.55rem;
  border-bottom: 1px solid var(--grid-line);
  font-size: 0.86rem;
  color: var(--text-900);
}

table.table tbody tr:hover td {
  background: rgba(59, 130, 246, 0.06);
}

table.table tbody tr:nth-child(even) td {
  background: rgba(245, 249, 255, 0.45);
}

table.table tbody tr:nth-child(even):hover td {
  background: rgba(59, 130, 246, 0.08);
}

html[data-theme="dark"] table.table thead th {
  background: linear-gradient(180deg, rgba(15, 26, 44, 0.96), rgba(11, 19, 32, 0.96));
  color: #b8cce6;
  border-bottom-color: rgba(120, 152, 196, 0.32);
}

html[data-theme="dark"] table.table tbody td {
  color: #e2ecf9;
  border-bottom-color: rgba(120, 152, 196, 0.12);
}

html[data-theme="dark"] table.table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.018);
}

html[data-theme="dark"] table.table tbody tr:hover td {
  background: rgba(96, 165, 250, 0.10);
}

html[data-theme="dark"] table.table tbody tr:nth-child(even):hover td {
  background: rgba(96, 165, 250, 0.13);
}

/* ---------- Card header polish: tiny indicator on accents ---------- */

.surface-accent .card-header {
  position: relative;
}

.surface-accent .card-header .section-heading {
  position: relative;
  padding-left: 0.4rem;
}

.surface-accent .card-header .section-heading::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.18rem;
  bottom: 0.18rem;
  width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand-600), var(--brand-700));
}

/* ---------- Summary strip: terminal feel ---------- */

.summary-strip__label {
  text-transform: uppercase;
  letter-spacing: 0.10em;
  font-size: 0.68rem;
  color: var(--text-500);
}

html[data-theme="dark"] .summary-strip__item {
  background:
    linear-gradient(180deg, rgba(20, 32, 50, 0.92), rgba(13, 22, 36, 0.86)),
    linear-gradient(120deg, rgba(96, 165, 250, 0.10), transparent 70%);
  border-color: rgba(96, 137, 188, 0.28);
}

html[data-theme="dark"] .summary-strip__item--asset {
  background:
    linear-gradient(180deg, rgba(22, 36, 58, 0.94), rgba(13, 22, 36, 0.92)),
    linear-gradient(120deg, rgba(96, 165, 250, 0.18), transparent 72%);
  border-color: rgba(120, 162, 215, 0.36);
}

/* ---------- Page hero: trading-terminal style ---------- */

.page-hero {
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.99), rgba(238, 246, 255, 0.94)),
    linear-gradient(90deg, rgba(26, 95, 192, 0.10), rgba(59, 130, 246, 0.04));
}

html[data-theme="dark"] .page-hero {
  border-color: rgba(96, 137, 188, 0.36);
  background:
    linear-gradient(140deg, rgba(17, 30, 50, 0.96), rgba(11, 19, 32, 0.94)),
    linear-gradient(90deg, rgba(96, 165, 250, 0.16), rgba(59, 130, 246, 0.04));
}

.page-eyebrow {
  font-family: var(--mono-font);
  letter-spacing: 0.18em;
}

/* ---------- Buttons: a touch crisper ---------- */

.btn-primary {
  background: linear-gradient(180deg, #2873db, #1452ad);
  border-color: #0e3f8a;
  letter-spacing: 0.02em;
}

html[data-theme="dark"] .btn-primary {
  background: linear-gradient(180deg, #3b82f6, #1e5ec8);
  border-color: #1d4ed8;
  box-shadow: 0 8px 22px rgba(8, 22, 58, 0.55);
}

/* ---------- Login: terminal hero ---------- */

.login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 1rem;
  align-items: stretch;
  margin: 0 auto;
  max-width: 980px;
}

.login-brand {
  position: relative;
  padding: 1.2rem 1.3rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--surface-border);
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(20, 60, 130, 0.96), rgba(8, 27, 65, 0.96)),
    linear-gradient(90deg, rgba(59, 130, 246, 0.18), transparent 60%);
  color: #eaf2ff;
  box-shadow: var(--surface-shadow);
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: -40% -10% auto auto;
  width: 70%;
  height: 80%;
  background: radial-gradient(circle at center, rgba(99, 179, 237, 0.32), transparent 65%);
  pointer-events: none;
}

.login-brand__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono-font);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #8fc1ff;
  text-transform: uppercase;
}

.login-brand__title {
  margin: 0.5rem 0 0.4rem;
  font-size: clamp(1.4rem, 2vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: #ffffff;
}

.login-brand__subtitle {
  margin: 0;
  color: #c4d8f3;
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 380px;
}

.login-brand__feature-list {
  margin: 0.9rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.42rem;
  position: relative;
}

.login-brand__feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  color: #d6e6fa;
  font-size: 0.86rem;
  line-height: 1.4;
}

.login-brand__feature-list li::before {
  content: "›";
  color: #7ab8ff;
  font-weight: 800;
  font-family: var(--mono-font);
}

.login-brand__ticker {
  margin-top: 1rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  font-family: var(--mono-font);
  font-size: 0.78rem;
  color: #cee2fa;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  position: relative;
}

.login-brand__ticker span {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
}

.login-brand__ticker em {
  font-style: normal;
  color: #8fc1ff;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.66rem;
}

.login-card {
  align-self: stretch;
}

.login-card .card-body {
  padding: 1.25rem 1.2rem;
}

@media (max-width: 767.98px) {
  .login-grid {
    grid-template-columns: 1fr;
  }
  .login-brand {
    padding: 1rem 1.05rem;
  }
}

/* ---------- Number flash on update ---------- */

.flash-up {
  animation: flash-up 0.7s ease-out 1;
}
.flash-down {
  animation: flash-down 0.7s ease-out 1;
}

@keyframes flash-up {
  0% { background-color: rgba(22, 163, 74, 0.28); }
  100% { background-color: transparent; }
}
@keyframes flash-down {
  0% { background-color: rgba(220, 38, 38, 0.24); }
  100% { background-color: transparent; }
}

/* 双击持仓行填入操作表单时的高亮提示（用 outline，避免覆盖卡片自身阴影） */
.position-op-flash {
  animation: position-op-flash 1s ease-out 1;
}

@keyframes position-op-flash {
  0% { outline: 2px solid rgba(37, 99, 235, 0.55); outline-offset: -2px; }
  100% { outline: 2px solid rgba(37, 99, 235, 0); outline-offset: -2px; }
}

/* ---------- Slimmer scrollbars for an app feel ---------- */

.panel-scroll::-webkit-scrollbar,
.panel-scroll-sm::-webkit-scrollbar,
.summary-strip::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

.panel-scroll::-webkit-scrollbar-thumb,
.panel-scroll-sm::-webkit-scrollbar-thumb,
.summary-strip::-webkit-scrollbar-thumb {
  background: rgba(120, 145, 178, 0.35);
  border-radius: 3px;
}

html[data-theme="dark"] .panel-scroll::-webkit-scrollbar-thumb,
html[data-theme="dark"] .panel-scroll-sm::-webkit-scrollbar-thumb,
html[data-theme="dark"] .summary-strip::-webkit-scrollbar-thumb {
  background: rgba(140, 168, 200, 0.30);
}


/* Market status bar wrapper - sits directly under the navbar */
.market-statusbar-wrap {
  position: sticky;
  top: 0;
  z-index: 1039;
  border-bottom: 1px solid var(--surface-border);
  background: linear-gradient(180deg, rgba(245, 249, 255, 0.96), rgba(232, 240, 252, 0.96));
  backdrop-filter: blur(10px);
}

html[data-theme="dark"] .market-statusbar-wrap {
  background: linear-gradient(180deg, rgba(11, 19, 32, 0.96), rgba(8, 14, 24, 0.96));
  border-bottom-color: rgba(96, 137, 188, 0.22);
}

.market-statusbar-wrap .container-fluid.app-shell {
  padding-block: 0;
}

@media (max-width: 991.98px) {
  .market-statusbar {
    padding: 0.16rem 0;
  }
}