:root {
  --bg: #edf3f6;
  --bg-soft: #f5f8fa;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-strong: #ffffff;
  --line: rgba(18, 53, 73, 0.10);
  --line-strong: rgba(18, 53, 73, 0.18);
  --text: #173043;
  --muted: #6f8798;
  --blue: #2476ea;
  --blue-soft: rgba(36, 118, 234, 0.12);
  --teal: #1d9a84;
  --teal-soft: rgba(29, 154, 132, 0.12);
  --amber: #b98517;
  --amber-soft: rgba(185, 133, 23, 0.12);
  --red: #d14f49;
  --red-soft: rgba(209, 79, 73, 0.12);
  --ink: #0f2534;
  --shadow: 0 18px 44px rgba(27, 57, 80, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(36, 118, 234, 0.12), transparent 26%),
    radial-gradient(circle at 88% 12%, rgba(29, 154, 132, 0.10), transparent 22%),
    linear-gradient(180deg, #f5f9fb 0%, #edf3f6 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.shell {
  max-width: 1520px;
  margin: 0 auto;
  padding: 28px 20px 44px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.08;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue);
}

.subtle {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-pill,
.refresh-button,
.window-switch button {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  box-shadow: var(--shadow);
}

.workspace-pill {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--muted);
}

.refresh-button,
.window-switch button {
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.refresh-button:hover,
.window-switch button:hover {
  transform: translateY(-1px);
}

.refresh-button:active,
.window-switch button:active {
  transform: translateY(0);
}

.window-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.window-switch button.active {
  background: linear-gradient(135deg, #2476ea, #4b93f2);
  color: #fff;
  border-color: transparent;
}

.hidden {
  display: none;
}

.alert-strip {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 245, 245, 0.92);
  border: 1px solid rgba(209, 79, 73, 0.18);
  box-shadow: var(--shadow);
}

.alert-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.6;
  color: #8c3431;
}

.alert-item::before {
  content: "";
  width: 10px;
  height: 10px;
  margin-top: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
  background: var(--red);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.panel,
.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 134px;
  padding: 16px 18px;
  border-radius: 22px;
}

.metric-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 4px;
  background: linear-gradient(90deg, rgba(36, 118, 234, 0.85), rgba(29, 154, 132, 0.65));
  opacity: 0.9;
}

.metric-card .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card .value {
  margin-top: 10px;
  font-size: clamp(24px, 2.2vw, 30px);
  font-weight: 800;
  line-height: 1.12;
  color: var(--ink);
}

.metric-card .delta {
  margin-top: 9px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.text-up {
  color: var(--teal) !important;
}

.text-down {
  color: var(--red) !important;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
  border-radius: var(--radius);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-head h2 {
  margin: 0;
  font-size: 20px;
  color: var(--ink);
}

.chart-panel {
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.90)),
    radial-gradient(circle at top right, rgba(36, 118, 234, 0.07), transparent 28%);
}

.chart-wrap-large {
  height: 580px;
}

.chart {
  width: 100%;
  height: 100%;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.34fr) minmax(330px, 0.82fr);
  gap: 18px;
  align-items: start;
}

.main-stack,
.side-stack {
  min-width: 0;
}

.side-stack {
  position: sticky;
  top: 18px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.status-card {
  padding: 14px 15px;
  border-radius: 18px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.status-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.status-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.status-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--ink);
}

.status-detail {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.tone-ok {
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(29, 154, 132, 0.10);
}

.tone-warn {
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(185, 133, 23, 0.10);
}

.tone-bad {
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(209, 79, 73, 0.10);
}

.tone-info {
  background: var(--blue);
  box-shadow: 0 0 0 6px rgba(36, 118, 234, 0.10);
}

.position-grid,
.order-grid {
  display: grid;
  gap: 12px;
}

.position-card,
.order-card,
.event-card,
.empty-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
}

.position-card {
  padding: 14px 15px;
}

.position-head,
.order-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.symbol-block {
  min-width: 0;
}

.symbol-main {
  font-size: 17px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink);
}

.symbol-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.position-pnl {
  font-size: 18px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.mini-item {
  min-width: 0;
}

.mini-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.mini-value {
  display: block;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
}

.pill-neutral {
  color: var(--text);
  background: var(--bg-soft);
  border-color: var(--line);
}

.pill-blue {
  color: #1251ae;
  background: var(--blue-soft);
}

.pill-green {
  color: #0d6f5b;
  background: var(--teal-soft);
}

.pill-amber {
  color: #886112;
  background: var(--amber-soft);
}

.pill-red {
  color: #972f2c;
  background: var(--red-soft);
}

.order-card {
  padding: 14px 15px;
}

.order-progress {
  margin-top: 12px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

.progress-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6edf2;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2476ea, #2aa98f);
}

.order-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(18, 53, 73, 0.12);
}

.muted-block {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.event-list {
  position: relative;
  display: grid;
  gap: 12px;
}

.event-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: -2px 0 14px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(36, 118, 234, 0.07), rgba(29, 154, 132, 0.05));
  border: 1px solid rgba(18, 53, 73, 0.08);
}

.event-filter-summary {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.event-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.event-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.event-filter-button {
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.event-filter-button:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.event-filter-button.active {
  color: #fff;
  background: linear-gradient(135deg, #2476ea, #4b93f2);
  border-color: transparent;
}

.event-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.event-page-size-label,
.event-page-info {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.event-page-size,
.event-page-button {
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.90);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.event-page-size {
  padding: 0 12px;
  cursor: pointer;
}

.event-page-button {
  padding: 0 12px;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.event-page-button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.event-page-button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.event-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.event-rail {
  position: relative;
  min-height: 100%;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}

.event-rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: -18px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(36, 118, 234, 0.18), rgba(18, 53, 73, 0.03));
}

.event-item:last-child .event-rail::before {
  bottom: 12px;
}

.event-dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.event-card {
  padding: 14px 16px 12px;
}

.event-card.event-order {
  background: linear-gradient(180deg, rgba(245, 249, 255, 0.98), rgba(255, 255, 255, 1));
}

.event-card.event-risk {
  background: linear-gradient(180deg, rgba(255, 248, 242, 0.98), rgba(255, 255, 255, 1));
}

.event-card.event-system {
  background: linear-gradient(180deg, rgba(247, 250, 252, 0.98), rgba(255, 255, 255, 1));
}

.event-dot.event-dot-order {
  background: var(--blue);
  box-shadow: 0 0 0 6px rgba(36, 118, 234, 0.12);
}

.event-dot.event-dot-risk {
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(185, 133, 23, 0.12);
}

.event-dot.event-dot-system {
  background: #7c92a3;
  box-shadow: 0 0 0 6px rgba(124, 146, 163, 0.12);
}

.event-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}

.event-time {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.event-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.event-title {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.45;
  color: var(--ink);
}

.event-summary {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.event-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
}

.event-details {
  margin-top: 12px;
  border-top: 1px dashed rgba(18, 53, 73, 0.12);
  padding-top: 10px;
}

.event-details summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}

.event-details summary::-webkit-details-marker {
  display: none;
}

.event-details-body {
  margin-top: 10px;
  padding: 12px;
  border-radius: 12px;
  background: #f6f9fb;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.empty-card {
  padding: 18px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 1280px) {
  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .side-stack {
    position: static;
    top: auto;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 20px 14px 32px;
  }

  .hero {
    flex-direction: column;
  }

  .card-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .chart-wrap-large {
    height: 500px;
  }

  .order-footer,
  .event-top,
  .position-head,
  .order-head {
    flex-direction: column;
  }

  .event-filter-bar {
    justify-content: flex-start;
  }

  .event-toolbar {
    align-items: flex-start;
  }

  .event-toolbar-actions,
  .event-pagination {
    justify-content: flex-start;
  }

  .mini-grid {
    grid-template-columns: 1fr;
  }
}
