:root {
  color-scheme: light;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --surface-strong: #edf3fb;
  --text: #121826;
  --muted: #5d6b82;
  --subtle: #98a2b3;
  --line: #d7e1ee;
  --line-strong: #b9c8da;
  --accent: #2463eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eaf1ff;
  --blue: #2563eb;
  --blue-soft: #e8f1ff;
  --green: #08795b;
  --green-soft: #e7f6ef;
  --red: #bd2f2f;
  --red-soft: #fdeeee;
  --amber: #9a6700;
  --amber-soft: #fff4db;
  --teal: #0f766e;
  --purple: #6d28d9;
  --purple-soft: #f1e9ff;
  --shadow: 0 18px 45px rgba(28, 44, 75, 0.13);
  --soft-shadow: 0 8px 24px rgba(28, 44, 75, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(220, 38, 38, 0.08) 0 12%, transparent 12% 100%),
    linear-gradient(45deg, transparent 0 62%, rgba(5, 150, 105, 0.08) 62% 72%, transparent 72%),
    linear-gradient(180deg, #f7fbff 0%, var(--bg) 44%, #f8fafc 100%);
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(37, 99, 235, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.05) 1px, transparent 1px);
  background-size: 34px 34px;
  content: "";
  pointer-events: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(183, 199, 219, 0.72);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(18px);
  box-shadow: 0 8px 26px rgba(18, 24, 38, 0.06);
}

.topbar::before {
  display: block;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--red), var(--amber), var(--green), var(--blue));
  content: "";
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1360px;
  min-height: 68px;
  margin: 0 auto;
  padding: 0 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand > span:last-child {
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #111827, #1d4ed8 50%, #dc2626);
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  line-height: 1.2;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.main-nav a,
button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(28, 44, 75, 0.05);
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.main-nav a,
.main-nav button {
  min-width: 108px;
}

button {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), #0f766e);
  color: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
}

.main-nav a:hover,
.button-secondary:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
  transform: translateY(-1px);
}

button:hover {
  background: linear-gradient(135deg, var(--accent-dark), #0d9488);
  transform: translateY(-1px);
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.app-shell {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 28px 42px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(520px, 1.14fr);
  gap: 28px;
  align-items: stretch;
  min-height: 360px;
  margin-bottom: 18px;
  padding: 30px;
  overflow: hidden;
  border: 1px solid rgba(191, 203, 220, 0.76);
  border-radius: 18px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.96) 0 46%, rgba(232, 241, 255, 0.9) 46% 64%, rgba(231, 246, 239, 0.92) 64% 100%),
    linear-gradient(90deg, rgba(220, 38, 38, 0.1), rgba(245, 158, 11, 0.08), rgba(37, 99, 235, 0.1));
  box-shadow: var(--shadow);
}

.hero-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: 22px 0;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 10px;
  padding: 4px 9px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 999px;
  background: rgba(231, 246, 239, 0.75);
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero h1,
.page-heading h1 {
  margin: 0;
  font-size: 38px;
  line-height: 1.15;
  letter-spacing: 0;
}

.hero p,
.page-heading p,
.section-head p {
  margin: 8px 0 0;
  max-width: 660px;
  color: var(--muted);
}

.hero p {
  font-size: 15px;
  line-height: 1.8;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}

.data-stamp {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid rgba(220, 38, 38, 0.16);
  border-radius: 999px;
  background: rgba(253, 238, 238, 0.78);
  color: #8f1d1d;
  font-size: 12px;
  font-weight: 800;
}

.hero-visual,
.heading-visual {
  margin: 0;
}

.hero-visual {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
}

.hero-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid rgba(184, 198, 216, 0.84);
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(28, 44, 75, 0.18);
}

.hero-visual figcaption {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-visual figcaption span {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(18, 24, 38, 0.1);
}

.summary-strip {
  display: grid;
  grid-template-columns: 1.25fr repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.summary-item {
  position: relative;
  min-width: 0;
  padding: 22px;
  border-left: 1px solid var(--line);
}

.summary-item::before {
  position: absolute;
  top: 22px;
  left: 22px;
  width: 34px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--teal));
  content: "";
}

.summary-item:nth-child(2)::before {
  background: linear-gradient(90deg, var(--red), #f97316);
}

.summary-item:nth-child(3)::before {
  background: linear-gradient(90deg, var(--amber), #eab308);
}

.summary-item:nth-child(4)::before {
  background: linear-gradient(90deg, var(--green), #14b8a6);
}

.summary-item:first-child {
  border-left: 0;
}

.summary-item.primary {
  background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.summary-item span,
.metric-tile span,
.meta-list dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary-item span {
  padding-top: 16px;
}

.summary-item strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.summary-item.primary strong {
  font-size: 34px;
}

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

.metric-tile {
  position: relative;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  box-shadow: var(--soft-shadow);
}

.metric-tile::after {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--blue-soft);
  content: "";
}

.metric-tile strong {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: 7px;
  font-size: 22px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.metric-tile.wide {
  grid-column: span 2;
}

.metric-tile.tone-red {
  border-color: rgba(220, 38, 38, 0.22);
}

.metric-tile.tone-red::after {
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.18), rgba(253, 238, 238, 0.7));
}

.metric-tile.tone-blue {
  border-color: rgba(37, 99, 235, 0.22);
}

.metric-tile.tone-blue::after {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(232, 241, 255, 0.78));
}

.metric-tile.tone-amber {
  border-color: rgba(245, 158, 11, 0.24);
}

.metric-tile.tone-amber::after {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(255, 244, 219, 0.8));
}

.metric-tile.tone-teal,
.metric-tile.tone-green {
  border-color: rgba(5, 150, 105, 0.22);
}

.metric-tile.tone-teal::after,
.metric-tile.tone-green::after {
  background: linear-gradient(135deg, rgba(5, 150, 105, 0.18), rgba(231, 246, 239, 0.78));
}

.metric-tile.tone-purple {
  border-color: rgba(109, 40, 217, 0.2);
}

.metric-tile.tone-purple::after {
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.14), rgba(241, 233, 255, 0.78));
}

.visual-story {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0;
}

.story-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(205, 216, 231, 0.92);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--soft-shadow);
}

.story-panel img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.story-panel > div {
  padding: 18px;
}

.story-panel h2 {
  margin: 0;
  font-size: 19px;
  line-height: 1.25;
}

.story-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.story-panel.accent-panel {
  border-color: rgba(220, 38, 38, 0.18);
  background: linear-gradient(180deg, #fff, #fff8f7);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
  gap: 18px;
  margin: 18px 0;
}

.panel,
.table-section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--soft-shadow);
}

.panel {
  padding: 22px;
}

.table-section {
  margin: 18px 0;
  overflow: hidden;
}

.table-section .section-head {
  padding: 20px 22px 0;
}

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

.section-head.tight {
  align-items: center;
}

.section-head h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.section-head h2::before {
  display: inline-block;
  width: 8px;
  height: 18px;
  margin-right: 9px;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--red), var(--blue));
  content: "";
  vertical-align: -3px;
}

.text-link {
  color: var(--accent);
  font-weight: 750;
}

.chart-wrap {
  width: 100%;
  min-height: 280px;
  padding: 10px;
  border: 1px solid rgba(215, 225, 238, 0.78);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f7fbff);
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 280px;
}

.run-panel {
  display: flex;
  flex-direction: column;
}

.meta-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0 0 16px;
  border-top: 1px solid var(--line);
}

.meta-list.analysis-meta {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.meta-list div {
  min-width: 0;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.meta-list dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.llm-callout,
.analysis-box {
  margin: 0 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fbff, #ffffff);
}

.llm-callout span,
.analysis-box h3 {
  display: block;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.llm-callout p,
.analysis-box p {
  margin: 0;
  color: var(--text);
}

.analysis-box h3:not(:first-child) {
  margin-top: 14px;
}

.analysis-box ul {
  margin: 0;
  padding-left: 18px;
}

.analysis-box li + li {
  margin-top: 5px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: #31445f;
  font-size: 12px;
  font-weight: 800;
  background: linear-gradient(180deg, #eff6ff, #f8fbff);
}

tbody tr:hover {
  background: #f6fbff;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tr.selected {
  background: linear-gradient(90deg, #fff1f0, #ffffff);
}

.code,
.hash {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
}

td.reasons,
td.description {
  max-width: 520px;
  white-space: normal;
  overflow-wrap: anywhere;
}

td.hash {
  max-width: 460px;
  white-space: normal;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.status,
.pill,
.side {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status {
  background: var(--surface-strong);
  color: var(--muted);
}

.status.success {
  background: var(--green-soft);
  color: var(--green);
}

.status.failed {
  background: var(--red-soft);
  color: var(--red);
}

.status.running {
  background: var(--amber-soft);
  color: var(--amber);
}

.pill {
  background: var(--surface-strong);
  color: var(--muted);
}

.pill.buy,
.side.buy {
  background: var(--red-soft);
  color: var(--red);
}

.side.sell {
  background: var(--green-soft);
  color: var(--green);
}

.up {
  color: var(--red);
}

.down {
  color: var(--green);
}

.empty {
  color: var(--muted);
  text-align: center;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border: 1px solid rgba(205, 216, 231, 0.86);
  border-radius: 18px;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.96) 0 52%, rgba(255, 244, 219, 0.62) 52% 70%, rgba(232, 241, 255, 0.86) 70%),
    #fff;
  box-shadow: var(--soft-shadow);
  margin-bottom: 18px;
}

.detail-heading {
  align-items: center;
}

.visual-heading {
  align-items: center;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.heading-visual {
  width: min(330px, 32vw);
  flex: 0 0 auto;
}

.heading-visual img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid rgba(205, 216, 231, 0.86);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(28, 44, 75, 0.12);
}

.detail-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.site-footer {
  max-width: 1360px;
  margin: 0 auto;
  padding: 10px 28px 34px;
  color: var(--muted);
  font-size: 12px;
}

#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 44px));
  padding: 13px 15px;
  border-radius: 8px;
  background: var(--text);
  color: #fff;
  box-shadow: 0 16px 40px rgba(18, 24, 38, 0.2);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1080px) {
  .hero,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .hero-visual img {
    max-height: 420px;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-item:nth-child(3) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .summary-item:nth-child(4) {
    border-top: 1px solid var(--line);
  }

  .metric-grid,
  .detail-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .visual-story {
    grid-template-columns: 1fr;
  }

  .story-panel {
    display: grid;
    grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.1fr);
    align-items: center;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 12px 18px;
  }

  .brand small {
    white-space: normal;
  }

  .main-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .main-nav a,
  .main-nav button {
    width: 100%;
    min-height: 40px;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 13px;
  }

  .app-shell {
    padding: 18px 18px 32px;
  }

  .hero {
    min-height: 0;
    padding: 20px;
    border-radius: 16px;
  }

  .hero h1,
  .page-heading h1 {
    font-size: 28px;
  }

  .hero-actions,
  .hero-visual figcaption {
    align-items: stretch;
    flex-direction: column;
  }

  .hero-actions .button-secondary,
  .data-stamp {
    width: 100%;
  }

  .hero-visual img {
    min-height: 210px;
  }

  .summary-strip,
  .metric-grid,
  .detail-metrics,
  .meta-list,
  .meta-list.analysis-meta {
    grid-template-columns: 1fr;
  }

  .summary-item,
  .summary-item:nth-child(3),
  .summary-item:nth-child(4) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .summary-item:first-child {
    border-top: 0;
  }

  .metric-tile.wide {
    grid-column: auto;
  }

  .visual-story {
    grid-template-columns: 1fr;
  }

  .story-panel {
    display: block;
  }

  .section-head,
  .page-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading {
    padding: 18px;
    border-radius: 16px;
  }

  .heading-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .heading-visual {
    width: 100%;
  }

  .panel,
  .table-section .section-head {
    padding: 18px;
  }

  .table-section .section-head {
    margin-bottom: 0;
  }

  th,
  td {
    padding: 10px 12px;
  }
}
