:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #182230;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #182230;
  --muted: #667085;
  --line: #d9dee7;
  --line-soft: #edf0f4;
  --accent: #1f2937;
  --accent-hover: #111827;
  --danger: #b42318;
  --success: #067647;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 6px;
  font-size: 24px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 16px;
  font-size: 17px;
  line-height: 1.3;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid #c8d0dc;
  border-radius: 6px;
  padding: 9px 14px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
button.active,
.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #c8d0dc;
  border-radius: 6px;
  padding: 10px 11px;
  background: #ffffff;
  color: var(--text);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: #344054;
  font-size: 13px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  min-width: 0;
}

.topbar p,
.muted {
  color: var(--muted);
}

.topbar p {
  margin-bottom: 0;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 18px;
  padding: 18px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--panel);
}

.candidates-panel {
  grid-row: span 2;
}

.bloggers-panel {
  grid-column: 1 / -1;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.summary-list {
  display: grid;
  gap: 10px;
}

.summary-item,
.empty-state {
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--panel-soft);
}

.empty-state {
  color: var(--muted);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

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

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  color: #475467;
  font-weight: 600;
}

td strong {
  color: #101828;
}

.sentiment {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
}

.sentiment.bullish {
  background: #ecfdf3;
  color: var(--success);
}

.sentiment.bearish {
  background: #fef3f2;
  color: var(--danger);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-grid .full-width {
  grid-column: 1 / -1;
}

.form-grid button {
  justify-self: start;
}

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

.upload-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.upload-row input {
  max-width: 420px;
}

.status-line {
  min-height: 22px;
  margin: 10px 0 0;
  font-size: 14px;
}

.status-line.error {
  color: var(--danger);
}

.status-line.success {
  color: var(--success);
}

.blogger-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.blogger-item {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--panel-soft);
}

.blogger-name {
  font-weight: 600;
}

.blogger-tags {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.weights {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

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

  .candidates-panel,
  .bloggers-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .form-grid,
  .compact {
    grid-template-columns: 1fr;
  }

  .blogger-item {
    grid-template-columns: 1fr;
  }

  .weights {
    white-space: normal;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 21px;
  }

  .topbar,
  .panel {
    padding: 16px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  button {
    width: 100%;
    white-space: normal;
  }

  .tabs button,
  .upload-row input {
    width: 100%;
  }
}

/* ========== 纳斯达克指数条样式 ========== */
.nasdaq-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 10px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
  position: relative;
  z-index: 10;
}

.nasdaq-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nasdaq-label {
  font-weight: 500;
  color: var(--text);
}

.nasdaq-price {
  font-weight: 600;
  color: var(--text);
  font-family: monospace;
}

.nasdaq-change {
  font-weight: bold;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
}

.nasdaq-change.bullish {
  background: #ecfdf3;
  color: var(--success);
}

.nasdaq-change.bearish {
  background: #fef3f2;
  color: var(--danger);
}

.nasdaq-refresh {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  transition: transform 0.3s ease;
  min-height: auto;
}

.nasdaq-refresh:hover {
  color: var(--text);
  transform: rotate(180deg);
  background: transparent;
}

.nasdaq-refresh.spinning {
  animation: spin 1s linear infinite;
}

/* ========== Nasdaq 标签 & Badge ========== */
.tag-nasdaq-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  border: 1px solid rgba(99, 102, 241, 0.2);
  margin-left: 6px;
  vertical-align: middle;
}

