:root {
  --bg: #080d18;
  --bg-soft: #0c1423;
  --panel: #101a2c;
  --panel-2: #142136;
  --line: #22314a;
  --line-soft: rgba(115, 146, 190, 0.16);
  --text: #e9f0fc;
  --muted: #8b9bb5;
  --muted-2: #607089;
  --accent: #43e0c0;
  --accent-2: #66f2d4;
  --accent-dim: rgba(67, 224, 192, 0.12);
  --blue: #6ea8ff;
  --up: #ff5f73;
  --up-dim: rgba(255, 95, 115, 0.12);
  --down: #2fd39a;
  --down-dim: rgba(47, 211, 154, 0.12);
  --warn: #f5c451;
  --danger: #ff6b7d;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
  --radius: 16px;
  --radius-sm: 10px;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1000px 520px at 12% -10%, rgba(35, 116, 120, 0.22), transparent 62%),
    radial-gradient(760px 420px at 95% 2%, rgba(59, 92, 184, 0.18), transparent 60%), var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
.hidden {
  display: none !important;
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.up {
  color: var(--up) !important;
}
.down {
  color: var(--down) !important;
}
.muted {
  color: var(--muted);
}

.app-shell {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding-bottom: 28px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 74px;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 236px;
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent), #2c9f9f);
  color: #04221f;
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 700;
  box-shadow: 0 8px 26px rgba(67, 224, 192, 0.24);
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.brand-text strong {
  font-size: 15px;
  letter-spacing: 0.06em;
}
.brand-text small {
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.16em;
  margin-top: 3px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
}
.nav-item {
  position: relative;
  height: 100%;
  padding: 0 18px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  transition: color 0.2s;
}
.nav-item:hover {
  color: var(--text);
}
.nav-item.active {
  color: var(--text);
  font-weight: 600;
}
.nav-item.active::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(67, 224, 192, 0.6);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.market-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  background: rgba(16, 26, 44, 0.7);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
  display: inline-block;
}
.dot-live {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
}
.dot-open {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-dim);
  animation: pulse 2.2s infinite;
}
.dot-closed {
  background: var(--muted-2);
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(67, 224, 192, 0.1);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(67, 224, 192, 0.02);
  }
}
.clock {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  min-width: 58px;
  text-align: right;
}

/* ---------- index strip ---------- */
.index-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin: 14px 0 24px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  overflow: hidden;
  background: var(--line-soft);
}
.index-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(12, 20, 35, 0.8);
}
.index-item .name {
  color: var(--muted);
  font-size: 12px;
}
.index-item .value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
}
.index-item .change {
  font-family: var(--mono);
  font-size: 12px;
}

/* ---------- layout ---------- */
.view {
  animation: fade-in 0.3s ease;
}
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-bottom: 20px;
}
.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.2em;
  font-weight: 700;
}
h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.subhead {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12.5px;
}

.account-tools {
  flex: 0 0 auto;
}
.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.account-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

/* ---------- controls ---------- */
.input,
.select {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  color: var(--text);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: none;
  transition:
    border-color 0.18s,
    box-shadow 0.18s;
}
.input:focus,
.select:focus {
  border-color: rgba(67, 224, 192, 0.6);
  box-shadow: 0 0 0 3px rgba(67, 224, 192, 0.08);
}
.select {
  appearance: none;
  padding-right: 30px;
  cursor: pointer;
}
.account-row .select {
  width: auto;
  min-width: 160px;
  max-width: 230px;
}
input[type="date"] {
  color-scheme: dark;
}
input[type="number"] {
  font-family: var(--mono);
}

.btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    transform 0.12s,
    filter 0.15s,
    background 0.15s;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
.btn-sm {
  height: 30px;
  padding: 0 11px;
  font-size: 12px;
  border-radius: 8px;
}
.btn-primary {
  background: var(--accent);
  color: #05221e;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
}
.btn-secondary {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(67, 224, 192, 0.25);
}
.btn-secondary:hover:not(:disabled) {
  background: rgba(67, 224, 192, 0.18);
}
.btn-quiet {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
}
.btn-quiet:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted-2);
}
.btn-buy {
  background: var(--up);
  color: #fff;
  flex: 1;
}
.btn-buy:hover:not(:disabled) {
  filter: brightness(1.06);
}
.btn-sell {
  background: var(--down);
  color: #04221b;
  flex: 1;
}
.btn-sell:hover:not(:disabled) {
  filter: brightness(1.06);
}
.btn-block {
  width: 100%;
}
.ghost-icon {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  padding: 4px;
}
.ghost-icon:hover {
  color: var(--accent);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-soft {
  background: rgba(110, 168, 255, 0.1);
  color: var(--blue);
}

/* ---------- cards ---------- */
.summary-grid {
  display: grid;
  grid-template-columns: 1.35fr repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.metric-card {
  position: relative;
  min-height: 106px;
  padding: 16px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: linear-gradient(160deg, rgba(20, 33, 54, 0.94), rgba(12, 20, 35, 0.94));
  overflow: hidden;
}
.metric-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(67, 224, 192, 0.25), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}
.metric-card:hover::after {
  opacity: 1;
}
.metric-card.primary {
  background:
    radial-gradient(150px 100px at 100% 0%, rgba(67, 224, 192, 0.13), transparent 70%),
    linear-gradient(160deg, #14253a, #0e1a2b);
}
.metric-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: 0.02em;
}
.metric-label em {
  font-style: normal;
  color: var(--muted-2);
  font-size: 9px;
  letter-spacing: 0.1em;
}
.metric-value {
  display: block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: clamp(20px, 1.85vw, 27px);
  font-weight: 600;
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.metric-foot {
  display: block;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 11px;
}
.metric-foot span {
  color: var(--muted);
}

/* ---------- panels ---------- */
.panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: linear-gradient(170deg, rgba(16, 26, 44, 0.96), rgba(11, 18, 31, 0.96));
  box-shadow: var(--shadow);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 0;
}
.panel-sub {
  margin: 4px 0 0;
  color: var(--muted-2);
  font-size: 11.5px;
}
.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
  gap: 14px;
  margin-bottom: 14px;
}
.chart-panel {
  min-width: 0;
}
.chart {
  width: 100%;
  height: 320px;
}
.chart-tall {
  height: 378px;
}
.range-switch {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--line-soft);
}
.range-switch button {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font-size: 11px;
  padding: 4px 9px;
  border-radius: 6px;
  white-space: nowrap;
  flex-shrink: 0;
}
.range-switch button.active {
  background: var(--panel-2);
  color: var(--text);
}

/* ---------- trade panel ---------- */
.trade-panel {
  padding-bottom: 14px;
}
.trade-panel .panel-head {
  padding-bottom: 12px;
}
.stock-search,
.trade-panel .form-grid,
.trade-note,
.trade-actions,
.trade-panel .footnote {
  margin-left: 18px;
  margin-right: 18px;
}
.stock-search {
  position: relative;
  margin-bottom: 12px;
}
.input-wrap {
  position: relative;
}
.input-wrap .input {
  padding-right: 50px;
}
.input-wrap .ghost-icon {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
}
.search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 245px;
  overflow: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #111c2f;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}
.search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.search-item:hover {
  background: var(--panel-2);
}
.search-item .code {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 11px;
  margin-left: 7px;
}
.search-item .industry {
  color: var(--muted-2);
  font-size: 10px;
}
.quote-card {
  margin: 0 18px 13px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
  min-height: 84px;
}
.quote-card.empty {
  display: grid;
  place-items: center;
  color: var(--muted-2);
  border-style: dashed;
}
.quote-empty {
  font-size: 12px;
}
.quote-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.quote-name {
  font-size: 14px;
  font-weight: 600;
}
.quote-code {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10.5px;
  margin-left: 5px;
}
.quote-price {
  text-align: right;
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.quote-change {
  font-family: var(--mono);
  font-size: 11px;
}
.quote-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 10.5px;
}
.quote-meta strong {
  color: var(--muted);
  font-weight: 500;
  font-family: var(--mono);
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-soft);
}
.segmented button {
  flex: 1;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.segmented button.active {
  color: var(--text);
  background: var(--panel-2);
}
.segmented button.active.buy {
  color: var(--up);
  background: var(--up-dim);
}
.segmented button.active.sell {
  color: var(--down);
  background: var(--down-dim);
}
.static-value {
  height: 38px;
  display: flex;
  align-items: center;
  padding: 0 11px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  font-family: var(--mono);
  color: var(--muted);
  font-size: 12px;
}
.trade-note {
  min-height: 18px;
  margin-top: 2px;
  margin-bottom: 12px;
  color: var(--muted-2);
  font-size: 10.5px;
  line-height: 1.5;
}
.trade-actions {
  display: flex;
  gap: 9px;
}
.trade-actions .btn {
  height: 40px;
}
.footnote {
  margin-top: 10px;
  margin-bottom: 0;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.5;
}

.alert {
  margin-bottom: 13px;
  padding: 10px 13px;
  border: 1px solid rgba(245, 196, 81, 0.28);
  border-radius: 10px;
  background: rgba(245, 196, 81, 0.07);
  color: #f3ce77;
  font-size: 12px;
}
.alert.error {
  border-color: rgba(255, 107, 125, 0.3);
  background: rgba(255, 107, 125, 0.07);
  color: #ff9ca8;
}

/* ---------- ledger ---------- */
.ledger-panel {
  margin-bottom: 14px;
}
.tabs {
  display: flex;
  gap: 4px;
}
.tab {
  border: 0;
  background: transparent;
  color: var(--muted-2);
  padding: 7px 11px;
  border-radius: 7px;
  font-size: 12px;
}
.tab.active {
  color: var(--text);
  background: var(--panel-2);
}
.tab span {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  margin-left: 3px;
}
.table-wrap {
  overflow-x: auto;
  padding: 8px 10px 10px;
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}
th {
  padding: 9px 10px;
  color: var(--muted-2);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-soft);
}
th.num {
  text-align: right;
}
td {
  padding: 11px 10px;
  border-bottom: 1px solid rgba(115, 146, 190, 0.08);
  font-size: 12.5px;
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: rgba(110, 168, 255, 0.025);
}
.stock-cell {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.stock-cell strong {
  font-weight: 600;
}
.stock-cell small {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 10px;
}
.tag-side {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
}
.tag-side.buy {
  color: var(--up);
  background: var(--up-dim);
}
.tag-side.sell {
  color: var(--down);
  background: var(--down-dim);
}
.status-filled {
  color: var(--accent);
}
.status-open {
  color: var(--warn);
}
.status-cancelled,
.status-rejected {
  color: var(--muted-2);
}
.empty-cell {
  padding: 28px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
}
.row-action {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  font-size: 10px;
  padding: 3px 7px;
}
.row-action:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--muted-2);
}
.row-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ---------- research ---------- */
.notice-card {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  margin-bottom: 16px;
  padding: 15px 18px;
  border: 1px solid rgba(245, 196, 81, 0.18);
  border-radius: 12px;
  background: linear-gradient(90deg, rgba(245, 196, 81, 0.055), rgba(245, 196, 81, 0.015));
}
.notice-card strong {
  color: #f0ca72;
  font-size: 12.5px;
}
.notice-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.7;
}
.strategy-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 11px;
  margin-bottom: 16px;
}
.strategy-card {
  padding: 15px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: var(--panel);
}
.strategy-card h3 {
  margin: 0 0 5px;
  font-size: 13px;
}
.strategy-card .key {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}
.strategy-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}
.backtest-form {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px 18px;
}
.inline-loading {
  padding: 0 18px 12px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 14px 18px;
}
.mini-metric {
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: var(--bg-soft);
}
.mini-metric span {
  display: block;
  color: var(--muted-2);
  font-size: 10px;
}
.mini-metric strong {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 16px;
}

/* ---------- login ---------- */
.login-body {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #070c16;
}
.login-backdrop {
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(520px 400px at 30% 30%, rgba(42, 146, 138, 0.24), transparent 65%),
    radial-gradient(560px 460px at 70% 70%, rgba(52, 83, 173, 0.2), transparent 65%);
  filter: blur(10px);
}
.login-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(115, 146, 190, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(115, 146, 190, 0.055) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black, transparent 72%);
}
.login-card {
  position: relative;
  width: min(400px, calc(100vw - 36px));
  padding: 30px;
  border: 1px solid rgba(115, 146, 190, 0.18);
  border-radius: 18px;
  background: rgba(13, 21, 36, 0.9);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 28px;
}
.login-brand h1 {
  font-size: 19px;
}
.login-brand p {
  margin: 4px 0 0;
  color: var(--muted-2);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}
.login-form label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 7px;
}
.password-wrap {
  position: relative;
}
.password-wrap .input {
  height: 42px;
  padding-right: 48px;
}
.password-wrap .ghost-icon {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
}
.login-form .btn {
  margin-top: 6px;
  height: 42px;
}
.form-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 11px;
  padding-top: 3px;
}
.login-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 20px;
  color: var(--muted-2);
  font-size: 10.5px;
}

/* ---------- misc ---------- */
.app-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 13px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted-2);
  font-size: 10px;
}
.toasts {
  position: fixed;
  z-index: 90;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}
.toast {
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #142136;
  color: var(--text);
  font-size: 12px;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.42);
  animation: toast-in 0.25s ease;
}
.toast.success {
  border-color: rgba(67, 224, 192, 0.35);
}
.toast.error {
  border-color: rgba(255, 107, 125, 0.4);
  color: #ffb2bb;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(5, 9, 16, 0.58);
  backdrop-filter: blur(3px);
}
.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(67, 224, 192, 0.2);
  border-top-color: var(--accent);
  display: inline-block;
  animation: spin 0.8s linear infinite;
}
.spinner.large {
  width: 30px;
  height: 30px;
  border-width: 3px;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .summary-grid .metric-card.primary {
    grid-column: span 1;
  }
  .main-grid {
    grid-template-columns: minmax(0, 1.3fr) minmax(310px, 0.9fr);
  }
  .strategy-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 24px, 1480px);
  }
  .topbar {
    gap: 10px;
    height: auto;
    padding: 12px 0;
    flex-wrap: wrap;
  }
  .brand {
    min-width: 0;
  }
  .brand-text small {
    display: none;
  }
  .main-nav {
    order: 3;
    width: 100%;
    height: 38px;
    border-top: 1px solid var(--line-soft);
  }
  .nav-item {
    height: 38px;
    padding: 0 12px;
  }
  .nav-item.active::after {
    left: 12px;
    right: 12px;
  }
  .clock {
    display: none;
  }
  .index-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .page-heading {
    flex-direction: column;
    align-items: stretch;
  }
  .account-row {
    flex-wrap: wrap;
  }
  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .main-grid {
    grid-template-columns: 1fr;
  }
  .trade-panel {
    order: -1;
  }
  .notice-card {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .strategy-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .backtest-form {
    grid-template-columns: 1fr 1fr;
  }
  .backtest-form .btn {
    width: 100%;
  }
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 560px) {
  h1 {
    font-size: 23px;
  }
  .summary-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .metric-card {
    min-height: 94px;
    padding: 13px;
  }
  .metric-value {
    font-size: 20px;
  }
  .metric-card:first-child {
    grid-column: span 2;
  }
  .index-item {
    padding: 8px 11px;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .index-item .name {
    font-size: 10px;
  }
  .index-item > div:last-child {
    text-align: left !important;
  }
  .index-item .change {
    margin-left: 6px;
  }
  .chart-panel .panel-head {
    flex-wrap: wrap;
    gap: 8px;
  }
  .range-switch button {
    padding: 4px 7px;
    font-size: 10px;
  }
  .strategy-grid {
    grid-template-columns: 1fr;
  }
  .backtest-form {
    grid-template-columns: 1fr;
  }
  .app-footer {
    flex-direction: column;
  }
  .toasts {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
  .chart-tall {
    height: 290px;
  }
}
