:root {
  --bg-primary: #030712;
  --bg-secondary: #06101f;
  --bg-card: rgba(8, 21, 41, 0.76);
  --bg-elevated: rgba(12, 29, 54, 0.92);
  --bg-input: rgba(4, 14, 29, 0.88);
  --line: rgba(104, 146, 204, 0.2);
  --line-strong: rgba(62, 150, 255, 0.42);
  --primary: #258bff;
  --primary-light: #51b8ff;
  --cyan: #38d9ff;
  --violet: #8657ff;
  --long: #24d38a;
  --short: #ff5964;
  --warning: #f4b74a;
  --text-primary: #f4f8ff;
  --text-secondary: #8fa5c0;
  --text-muted: #647a98;
  --sidebar-width: 242px;
  --topbar-height: 64px;
  --radius: 12px;
  --shadow-card: 0 18px 60px rgba(0, 0, 0, 0.2), inset 0 1px rgba(255, 255, 255, 0.025);
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body.app-body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text-primary);
  background:
    radial-gradient(circle at 72% 4%, rgba(67, 55, 210, 0.16), transparent 29rem),
    radial-gradient(circle at 38% 35%, rgba(0, 118, 255, 0.1), transparent 35rem),
    #030712;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.ambient-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background-image:
    linear-gradient(rgba(79, 138, 211, .085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 138, 211, .085) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 88%);
}

a { color: inherit; }
button, input, select { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.navbar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 14px 18px;
  border-right: 1px solid rgba(104, 146, 204, .18);
  background: rgba(3, 9, 20, .91);
  backdrop-filter: blur(24px);
  box-shadow: 22px 0 60px rgba(0, 0, 0, .18);
}

.navbar-brand { height: var(--topbar-height); display: flex; align-items: center; gap: 11px; padding: 0 7px; }
.logo-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(78, 175, 255, .55);
  border-radius: 11px;
  color: #c8eeff;
  font-size: 20px;
  background: linear-gradient(145deg, rgba(38, 126, 255, .3), rgba(124, 77, 255, .25));
  box-shadow: 0 0 26px rgba(38, 126, 255, .22), inset 0 1px rgba(255,255,255,.12);
}
.navbar-brand .logo-mark, .login-brand .logo-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border: 1px solid rgba(78, 175, 255, .55);
  border-radius: 11px;
  color: #c8eeff;
  background: linear-gradient(145deg, rgba(38, 126, 255, .3), rgba(124, 77, 255, .25));
  box-shadow: 0 0 26px rgba(38, 126, 255, .22), inset 0 1px rgba(255,255,255,.12);
}
.brand-copy { min-width: 0; display: flex; flex-direction: column; }
.brand-copy strong { font-size: 17px; letter-spacing: .02em; white-space: nowrap; }
.brand-copy span { margin-top: 3px; color: #5d789b; font-size: 9px; letter-spacing: .16em; }
.nav-caption { padding: 20px 13px 9px; color: #4c6688; font-size: 10px; font-weight: 700; letter-spacing: .18em; }
.navbar-links { display: flex; flex-direction: column; gap: 6px; }
.navbar-links a {
  position: relative;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #8ea4be;
  text-decoration: none;
  font-size: 14px;
  transition: .2s ease;
}
.navbar-links a i { width: 20px; text-align: center; font-size: 17px; }
.navbar-links a:hover { color: #e7f5ff; background: rgba(27, 77, 135, .18); border-color: rgba(72, 135, 207, .14); }
.navbar-links a.active {
  color: #72c6ff;
  background: linear-gradient(90deg, rgba(31, 123, 247, .22), rgba(39, 80, 161, .08));
  border-color: rgba(42, 144, 255, .32);
  box-shadow: inset 3px 0 #258bff, 0 0 28px rgba(0, 106, 255, .08);
}
.sidebar-spacer { flex: 1; min-height: 38px; }
.system-card {
  margin: 0 4px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(12, 33, 60, .72), rgba(5, 18, 34, .74));
  box-shadow: var(--shadow-card);
}
.system-card-title { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid rgba(112, 150, 197, .13); font-size: 12px; font-weight: 600; }
.system-card-row { display: flex; justify-content: space-between; margin-top: 11px; color: var(--text-muted); font-size: 11px; }
.system-card-row strong { color: #53dca4; font-weight: 600; }
.sidebar-version { padding: 14px 8px 0; color: #405674; font-size: 8px; letter-spacing: .14em; text-align: center; }
.status-dot { width: 7px; height: 7px; display: inline-block; flex: 0 0 7px; border-radius: 50%; background: #2ee59d; box-shadow: 0 0 12px rgba(46, 229, 157, .85); }
.sidebar-close, .sidebar-toggle { display: none; }
.sidebar-scrim { display: none; }

.app-stage { grid-column: 2; min-width: 0; }
.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 2.4vw, 34px);
  border-bottom: 1px solid rgba(104, 146, 204, .17);
  background: rgba(3, 9, 20, .78);
  backdrop-filter: blur(22px);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 19px; }
.terminal-state { display: flex; align-items: center; gap: 8px; color: #8ca2bc; font-size: 12px; }
.topbar-metric { min-height: 28px; display: flex; align-items: center; gap: 8px; padding-left: 18px; border-left: 1px solid rgba(108, 146, 194, .16); font-size: 11px; }
.topbar-metric span:not(.status-dot) { color: #617997; }
.topbar-metric strong { color: #acc0d7; font-size: 11px; font-weight: 600; }
.icon-button { position: relative; width: 34px; height: 34px; border: 1px solid rgba(112, 155, 209, .18); border-radius: 9px; background: rgba(8, 24, 44, .64); cursor: pointer; }
.icon-button:hover { color: var(--primary-light); border-color: rgba(37, 139, 255, .48); }
.notification-dot { position: absolute; top: 7px; right: 7px; width: 5px; height: 5px; border-radius: 50%; background: #ff5b67; box-shadow: 0 0 8px #ff5b67; }
.navbar-user-wrapper { position: relative; }
.navbar-user-trigger {
  min-height: 36px;
  padding: 0 28px 0 42px;
  border: 1px solid rgba(103, 151, 215, .2);
  border-radius: 10px;
  color: #dcecff;
  background: rgba(8, 22, 43, .7);
  cursor: pointer;
}
.navbar-user-trigger::before { content: "Q"; position: absolute; left: 8px; top: 5px; width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; color: white; font-size: 11px; font-weight: 700; background: linear-gradient(145deg, #287cff, #754cff); box-shadow: 0 0 16px rgba(66, 101, 255, .35); }
.navbar-user-trigger::after { content: "⌄"; position: absolute; right: 10px; color: #6e85a4; }
.navbar-user-dropdown { position: absolute; top: calc(100% + 9px); right: 0; min-width: 168px; display: none; padding: 7px; border: 1px solid var(--line-strong); border-radius: 11px; background: rgba(6, 18, 36, .96); box-shadow: 0 18px 55px rgba(0,0,0,.45); backdrop-filter: blur(24px); }
.navbar-user-dropdown.active { display: grid; }
.navbar-user-dropdown a { display: flex; gap: 10px; align-items: center; padding: 10px 11px; border-radius: 7px; color: #a9bdd5; text-decoration: none; font-size: 12px; }
.navbar-user-dropdown a:hover { color: white; background: rgba(37, 139, 255, .15); }

.app-content { min-height: calc(100vh - var(--topbar-height)); padding: 14px clamp(18px, 2vw, 30px) 26px; }
.page-container { width: min(100%, 1680px); margin: 0 auto; padding: 0; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 0 0 20px; }
.page-title { margin: 0; color: #eef7ff; font-size: clamp(22px, 2.2vw, 30px); font-weight: 680; letter-spacing: -.02em; }
.page-title::before { content: "COMMAND / "; display: block; margin-bottom: 7px; color: #4c86cb; font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.page-subtitle { margin: 7px 0 0; color: var(--text-muted); font-size: 12px; }

.card {
  position: relative;
  overflow: visible;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(11, 29, 55, .8), rgba(5, 16, 33, .8));
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px);
}
.card::before { content: ""; position: absolute; z-index: -1; top: -1px; left: 22px; width: 72px; height: 1px; background: linear-gradient(90deg, var(--primary), transparent); box-shadow: 0 0 12px rgba(37, 139, 255, .65); }

.btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 16px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 650; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.btn-primary { color: #fff; background: linear-gradient(135deg, #1675ef, #554fe8); border-color: rgba(86, 160, 255, .72); box-shadow: 0 8px 24px rgba(29, 104, 239, .22); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 30px rgba(29, 104, 239, .35); }
.btn-outline { color: #aac5e3; border-color: rgba(100, 149, 210, .32); background: rgba(9, 27, 51, .74); }
.btn-outline:hover:not(:disabled) { color: white; border-color: rgba(58, 155, 255, .64); background: rgba(29, 90, 157, .22); }
.btn-ghost { color: #7190b4; background: transparent; }
.btn-danger, .btn-short { color: #fff; border-color: rgba(255, 89, 100, .52); background: rgba(180, 42, 57, .68); }
.btn-long { color: #021c13; border-color: #31dea0; background: linear-gradient(135deg, #23d28d, #31c0ab); }
.btn-sm { min-height: 31px; padding: 0 11px; font-size: 11px; }
.btn-group { display: flex; flex-wrap: wrap; gap: 9px; }

.form-group { margin: 0 0 14px; }
.form-group label { display: block; margin-bottom: 7px; color: #7790ae; font-size: 10px; font-weight: 650; letter-spacing: .04em; }
input, select, textarea {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(92, 137, 194, .27);
  border-radius: 8px;
  outline: 0;
  color: #dcecff;
  background: rgba(3, 13, 27, .72);
  transition: border-color .16s, box-shadow .16s, background .16s;
}
input::placeholder { color: #425b7b; }
input:focus, select:focus, textarea:focus { border-color: rgba(47, 150, 255, .72); background: rgba(5, 19, 39, .9); box-shadow: 0 0 0 3px rgba(37, 139, 255, .11), 0 0 20px rgba(37, 139, 255, .08); }
select option { background: #071427; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); }

.filter-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin: -2px 0 17px; padding: 14px; border: 1px solid rgba(92, 137, 194, .14); border-radius: 9px; background: rgba(3, 14, 29, .46); }
.filter-bar .form-group { min-width: 150px; flex: 1; margin: 0; }
.filter-bar .btn { margin-bottom: 0; }
.table-wrapper { width: 100%; overflow: auto; border: 1px solid rgba(91, 135, 190, .13); border-radius: 9px; background: rgba(2, 10, 22, .28); scrollbar-color: #214875 transparent; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { height: 40px; padding: 0 12px; color: #637e9f; background: rgba(14, 35, 64, .64); border-bottom: 1px solid rgba(104, 146, 204, .17); font-size: 9px; font-weight: 700; letter-spacing: .06em; text-align: left; text-transform: uppercase; }
td { height: 45px; padding: 0 12px; border-bottom: 1px solid rgba(104, 146, 204, .09); color: #a8bdd5; font-size: 11px; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: rgba(32, 100, 173, .09); }
tbody tr:last-child td { border-bottom: 0; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; }
.text-long { color: var(--long) !important; }
.text-short { color: var(--short) !important; }
.text-muted { color: var(--text-muted) !important; }
.badge, .status-badge { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border: 1px solid rgba(88, 141, 206, .19); border-radius: 6px; background: rgba(30, 76, 130, .14); font-size: 10px; }
.empty-state { padding: 42px 20px !important; color: #4d698a; text-align: center; }
.skeleton { overflow: hidden; border-radius: 6px; background: linear-gradient(90deg, rgba(22, 49, 82, .45), rgba(47, 88, 134, .48), rgba(22, 49, 82, .45)); background-size: 200% 100%; animation: skeletonPulse 1.5s infinite; }
@keyframes skeletonPulse { to { background-position: -200% 0; } }

.tabs, .position-detail-nav, .trade-panel-tabs { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid rgba(93, 138, 194, .18); border-radius: 9px; background: rgba(3, 14, 29, .54); }
.tab-btn, .nav-tab, .trade-tab-btn, .trade-tab-btn-sm { min-height: 33px; padding: 0 14px; border: 0; border-radius: 6px; color: #6f88a7; background: transparent; font-size: 11px; cursor: pointer; }
.tab-btn.active, .nav-tab.active, .trade-tab-btn.active, .trade-tab-btn-sm.active { color: #dff4ff; background: linear-gradient(135deg, rgba(32, 127, 255, .58), rgba(87, 72, 213, .48)); box-shadow: 0 0 18px rgba(37, 139, 255, .14); }
.tab-content { display: none; padding-top: 18px; }
.tab-content.active { display: block; }
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 16px; }

.modal-overlay { position: fixed; z-index: 100; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; background: rgba(0, 5, 14, .76); backdrop-filter: blur(8px); }
.modal-overlay.active { display: flex; }
.modal { width: min(100%, 560px); max-height: calc(100vh - 40px); overflow: auto; padding: 21px; border: 1px solid rgba(74, 149, 240, .36); border-radius: 14px; background: linear-gradient(145deg, rgba(12, 31, 57, .98), rgba(4, 14, 29, .98)); box-shadow: 0 32px 90px rgba(0,0,0,.58), 0 0 50px rgba(37,139,255,.08); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 19px; padding-bottom: 15px; border-bottom: 1px solid rgba(104, 146, 204, .14); }
.modal-title { display: block; color: #eef8ff; font-size: 16px; font-weight: 700; }
.modal-kicker { display: block; margin-bottom: 5px; color: #397cc8; font-size: 8px; font-weight: 700; letter-spacing: .18em; }
.modal-subtitle { margin: 6px 0 0; color: var(--text-muted); font-size: 11px; }
.modal-close { width: 32px; height: 32px; border: 1px solid rgba(102, 145, 199, .19); border-radius: 8px; color: #7790ad; background: rgba(6, 20, 38, .66); cursor: pointer; }
.modal-close:hover { color: white; border-color: rgba(48, 148, 255, .54); }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(104, 146, 204, .14); }
.confirm-text { color: #8ea5c0; font-size: 12px; line-height: 1.75; }

.toast-container { position: fixed; z-index: 160; right: 22px; top: 82px; display: grid; gap: 9px; }
.toast { min-width: 270px; padding: 13px 15px; border: 1px solid rgba(62, 150, 255, .34); border-radius: 10px; color: #dff4ff; background: rgba(7, 24, 46, .96); box-shadow: 0 18px 50px rgba(0,0,0,.4); font-size: 12px; }
.toast-success { border-left: 3px solid var(--long); }
.toast-error { border-left: 3px solid var(--short); }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.28); border-top-color: white; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Command dashboard */
.command-header { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.command-heading { display: flex; align-items: baseline; gap: 12px; min-width: 0; }
.command-heading small { order: 2; color: #4d88cf; font-size: 8px; font-weight: 700; letter-spacing: .16em; }
.command-heading h1 { margin: 0; font-size: 20px; letter-spacing: -.02em; white-space: nowrap; }
.command-heading p { margin: 0; color: #607998; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid rgba(43, 211, 142, .22); border-radius: 7px; color: #62dda9; background: rgba(18, 103, 74, .1); font-size: 10px; }
.command-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.metric-card { position: relative; min-height: 132px; padding: 16px; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 110px; height: 110px; right: -45px; bottom: -60px; border-radius: 50%; background: rgba(37, 139, 255, .13); filter: blur(22px); }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: #8198b4; font-size: 10px; }
.metric-icon { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid rgba(77, 144, 221, .25); border-radius: 8px; color: #5aaeff; background: rgba(20, 73, 135, .16); }
.metric-value { margin: 18px 0 8px; color: #f1f8ff; font-family: "SFMono-Regular", Consolas, monospace; font-size: clamp(20px, 2vw, 27px); font-weight: 650; letter-spacing: -.04em; }
.metric-value.positive { color: #45dda1; text-shadow: 0 0 22px rgba(69, 221, 161, .12); }
.metric-foot { color: #5f7897; font-size: 9px; }
.metric-foot strong { color: #87a2c1; font-weight: 600; }
.insight-layout { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(280px, .9fr); gap: 14px; margin-bottom: 14px; }
.pulse-card { min-height: 224px; }
.card-section-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 13px; }
.card-section-head h2, .card-section-head h3 { margin: 0; color: #deedfb; font-size: 13px; font-weight: 650; }
.section-legend { display: flex; align-items: center; gap: 12px; color: #617b9b; font-size: 9px; }
.legend-line { width: 16px; height: 2px; background: #278eff; box-shadow: 0 0 9px rgba(39, 142, 255, .6); }
#commandPulse { display: block; width: 100%; height: 158px; }
.risk-card { min-height: 224px; }
.risk-overview { display: flex; align-items: center; gap: 18px; margin: 19px 0; }
.risk-ring { --risk-angle: 76deg; width: 88px; height: 88px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(#39dfa4 var(--risk-angle), rgba(94, 131, 174, .17) 0); position: relative; }
.risk-ring::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: #071529; box-shadow: inset 0 0 18px rgba(0,0,0,.42); }
.risk-ring strong { position: relative; z-index: 1; font-family: "SFMono-Regular", Consolas, monospace; font-size: 21px; }
.risk-copy strong { display: block; margin-bottom: 5px; color: #43dfa1; font-size: 14px; }
.risk-copy span { color: #66809f; font-size: 9px; }
.risk-bars { display: grid; gap: 10px; }
.risk-row { display: grid; grid-template-columns: 70px 1fr 30px; align-items: center; gap: 9px; color: #7087a3; font-size: 9px; }
.risk-track { height: 4px; overflow: hidden; border-radius: 999px; background: rgba(92, 127, 168, .17); }
.risk-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2f8aff, #36dcc4); box-shadow: 0 0 10px rgba(54, 220, 196, .28); }

/* Trade workspace */
.trade-page-wrapper { display: grid; grid-template-columns: minmax(460px, 1.25fr) minmax(310px, .75fr); gap: 14px; margin-bottom: 14px; }
.trade-main, .trade-trends { min-width: 0; }
.trade-card { height: 100%; }
.trade-card::after { content: "下单控制"; display: block; position: absolute; top: 17px; right: 18px; color: #3c72aa; font-size: 8px; font-weight: 700; letter-spacing: .15em; }
.trade-panel-top { display: grid; grid-template-columns: 1fr 1.25fr .8fr; gap: 12px; padding-top: 29px; }
.trade-leverage-row, .quantity-input-split { display: flex; }
.trade-leverage-row input, .quantity-num-input { min-width: 0; border-radius: 8px 0 0 8px; }
.trade-leverage-row .btn, .quantity-unit-select { width: auto; flex: 0 0 auto; border-radius: 0 8px 8px 0; }
.quantity-unit-select { max-width: 170px; }
.trade-panel-tabs-primary { margin-bottom: 8px; }
.trade-panel-tabs-primary > button { flex: 1; }
.trade-panel-tabs-secondary { width: max-content; margin-bottom: 14px; }
.trade-panel-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.trade-tpsl { margin: 5px 0 15px; padding: 12px; border: 1px solid rgba(100, 144, 201, .14); border-radius: 8px; background: rgba(3, 14, 29, .42); }
.trade-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.trade-actions .btn { min-height: 44px; }
.trade-trends { display: grid; grid-template-columns: 1fr; gap: 14px; }
.trend-card { padding: 14px; }
.trend-title { margin: 0 0 11px; font-size: 11px; font-weight: 650; }
.trend-title-long { color: #47dda3; }
.trend-title-short { color: #ff7880; }
.trend-table-wrapper { max-height: 159px; }
.position-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.position-tab-hint { margin: 0 0 11px; color: #506b8b; font-size: 9px; }
.auto-refresh-tag { display: inline-flex; align-items: center; gap: 7px; color: #6f8aa8; font-size: 9px; }
.auto-refresh-tag .dot { width: 6px; height: 6px; border-radius: 50%; background: #2ddf99; box-shadow: 0 0 9px rgba(45,223,153,.72); }
.symbol-dropdown, .account-filter-dropdown { position: absolute; z-index: 20; left: 0; right: 0; max-height: 260px; overflow: auto; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(5, 18, 37, .98); box-shadow: 0 18px 50px rgba(0,0,0,.5); }
.symbol-search-wrapper, .account-search-wrapper { position: relative; }

/* Admin and account extras */
.group-item, .groups-list label { border-color: rgba(100, 146, 204, .17) !important; background: rgba(5, 18, 35, .5) !important; }
.groups-modal-body { max-height: 55vh; overflow: auto; }
.groups-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.groups-quick-actions { display: flex; gap: 7px; }
.groups-count { color: #7089a7; font-size: 10px; }

/* Login */
body.login-page { overflow-x: hidden; background: #020612; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(390px, .85fr); position: relative; }
.login-visual { position: relative; min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(32px, 5vw, 72px); overflow: hidden; border-right: 1px solid rgba(94, 142, 205, .18); background: radial-gradient(circle at 45% 48%, rgba(35, 115, 255, .17), transparent 26rem); }
.login-visual::before { content: ""; position: absolute; inset: 0; opacity: .34; background-image: linear-gradient(rgba(79,138,211,.12) 1px, transparent 1px), linear-gradient(90deg, rgba(79,138,211,.12) 1px, transparent 1px); background-size: 56px 56px; transform: perspective(700px) rotateX(58deg) scale(1.35) translateY(23%); }
.login-brand { position: relative; display: flex; align-items: center; gap: 12px; }
.login-brand-copy strong { display: block; font-size: 18px; }
.login-brand-copy span { color: #4e6d91; font-size: 9px; letter-spacing: .18em; }
.login-hero { position: relative; width: min(100%, 620px); }
.login-hero-kicker { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; color: #5fb9ff; font-size: 10px; font-weight: 700; letter-spacing: .2em; }
.login-hero h1 { max-width: 620px; margin: 0; font-size: clamp(40px, 5.2vw, 72px); line-height: 1.03; letter-spacing: -.055em; }
.login-hero h1 span { color: #65cfff; text-shadow: 0 0 34px rgba(61, 166, 255, .26); }
.login-hero p { max-width: 540px; margin: 22px 0 0; color: #718baa; font-size: clamp(13px, 1.1vw, 16px); line-height: 1.8; }
.login-stats { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: min(100%, 600px); }
.login-stat { padding: 14px; border: 1px solid rgba(94, 142, 205, .16); border-radius: 9px; background: rgba(5, 19, 38, .52); backdrop-filter: blur(16px); }
.login-stat strong { display: block; margin-bottom: 6px; color: #cee9ff; font-size: 13px; }
.login-stat span { color: #526f91; font-size: 9px; }
.login-panel { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: rgba(3, 9, 21, .7); backdrop-filter: blur(22px); }
.login-container { width: min(100%, 440px); min-height: 0; display: block; padding: 0; }
.login-card { width: 100%; padding: clamp(24px, 3vw, 38px); border: 1px solid rgba(70, 146, 239, .27); border-radius: 16px; background: linear-gradient(145deg, rgba(11, 30, 56, .83), rgba(5, 16, 33, .88)); box-shadow: 0 26px 80px rgba(0,0,0,.42), 0 0 60px rgba(37,139,255,.06); backdrop-filter: blur(24px); }
.login-logo { display: none; }
.login-card h1 { margin: 0; font-size: 25px; letter-spacing: -.025em; }
.login-card .subtitle { margin: 8px 0 24px; color: #6983a2; font-size: 11px; }
.login-card .btn-primary { width: 100%; min-height: 44px; margin-top: 6px; }
.login-footer { margin-top: 20px; color: #587292; font-size: 11px; text-align: center; }
.login-footer a { color: #52b8ff; text-decoration: none; }
.login-security { display: flex; justify-content: center; gap: 13px; margin-top: 18px; color: #476583; font-size: 9px; }
.login-security span { display: inline-flex; align-items: center; gap: 5px; }

@media (max-width: 1180px) {
  :root { --sidebar-width: 210px; }
  .command-kpis { grid-template-columns: repeat(2, 1fr); }
  .trade-page-wrapper { grid-template-columns: 1fr; }
  .trade-trends { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-clock { display: none; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 242px; }
  .app-shell { display: block; }
  .navbar { transform: translateX(-105%); transition: transform .23s ease; }
  body.sidebar-open .navbar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; z-index: 35; inset: 0; display: block; pointer-events: none; opacity: 0; background: rgba(0,4,12,.7); backdrop-filter: blur(3px); transition: opacity .2s; }
  body.sidebar-open .sidebar-scrim { opacity: 1; pointer-events: auto; }
  .sidebar-toggle, .sidebar-close { display: grid; place-items: center; border: 0; color: #8eadd0; background: transparent; cursor: pointer; }
  .sidebar-toggle { width: 36px; height: 36px; border: 1px solid rgba(96,143,202,.2); border-radius: 8px; font-size: 20px; }
  .sidebar-close { width: 30px; height: 30px; margin-left: auto; }
  .app-stage { width: 100%; }
  .insight-layout { grid-template-columns: 1fr; }
  .risk-card { min-height: auto; }
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
}

@media (max-width: 680px) {
  .topbar { padding: 0 14px; }
  .topbar-metric, .icon-button { display: none; }
  .terminal-state span:last-child { display: none; }
  .navbar-user-trigger { max-width: 132px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .app-content { padding: 16px 12px 26px; }
  .page-header, .command-header, .position-header { align-items: stretch; flex-direction: column; }
  .command-header { margin-bottom: 16px; }
  .command-heading { display: block; }
  .command-heading small { display: block; margin-bottom: 7px; }
  .command-heading h1 { font-size: 24px; }
  .command-heading p { margin-top: 7px; white-space: normal; }
  .page-header .btn-group { width: 100%; }
  .page-header .btn { flex: 1; }
  .command-kpis { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 112px; padding: 13px; }
  .metric-value { margin: 13px 0 7px; font-size: 18px; }
  .trade-panel-top, .trade-panel-grid { grid-template-columns: 1fr; }
  .trade-trends { grid-template-columns: 1fr; }
  .card { padding: 13px; border-radius: 10px; }
  .filter-bar { display: grid; grid-template-columns: 1fr 1fr; }
  .filter-bar .form-group { min-width: 0; }
  .position-header > div { width: 100%; }
  .position-detail-nav { width: 100%; }
  .position-detail-nav .nav-tab { flex: 1; }
  .login-panel { padding: 18px; }
  .login-card { padding: 24px 18px; }
}

@media (max-width: 430px) {
  .command-kpis { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .trade-actions { grid-template-columns: 1fr; }
  .toast-container { left: 12px; right: 12px; top: 74px; }
  .toast { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
