:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --blue: #2563eb;
  --green: #16a34a;
  --red: #ef4444;
  --amber: #d97706;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 34px clamp(18px, 4vw, 52px) 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1, h2, p {
  margin: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.subhead {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

.status-pill {
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(360px, 0.95fr);
  gap: 18px;
  padding: 22px clamp(18px, 4vw, 52px) 30px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.market-panel,
.nasdaq-panel {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.section-title h2 {
  font-size: 18px;
}

.section-title span {
  color: var(--muted);
  font-size: 13px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  padding: 16px;
}

.metric-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #f9fafb;
}

.metric-card span,
.detail-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.metric-card em,
.fund-row em {
  display: inline-block;
  margin-top: 6px;
  font-style: normal;
  font-weight: 800;
}

.fund-list {
  display: grid;
  gap: 8px;
  padding: 14px;
  max-height: 580px;
  overflow: auto;
}

.fund-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 14px;
  text-align: left;
  cursor: pointer;
}

.fund-row.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.fund-row strong {
  display: block;
  font-size: 15px;
}

.fund-row small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-empty,
.empty {
  padding: 22px;
  color: var(--muted);
}

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

.detail-grid div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #f9fafb;
}

.detail-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 15px;
}

.nasdaq-stats {
  display: flex;
  gap: 10px;
  padding: 14px 18px 0;
  flex-wrap: wrap;
}

.nasdaq-stats span {
  border-radius: 999px;
  background: #f3f4f6;
  color: var(--muted);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
}

.table-wrap {
  max-height: 460px;
  overflow: auto;
  padding: 14px 18px 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

th {
  position: sticky;
  top: 0;
  background: #fff;
  color: var(--muted);
  z-index: 1;
}

th:nth-child(2),
th:nth-child(3),
td:nth-child(2),
td:nth-child(3) {
  text-align: left;
}

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

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

.flat {
  color: var(--muted);
}

.footer {
  padding: 0 clamp(18px, 4vw, 52px) 36px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 980px) {
  .app-header {
    display: block;
  }

  .header-actions {
    margin-top: 18px;
  }

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

  .metric-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

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