:root {
  --bg: #0f1419;
  --panel: #1a2027;
  --panel-2: #222a33;
  --border: #2c3540;
  --text: #e6e9ee;
  --muted: #93a1b0;
  --accent: #4da3ff;
  --accent-2: #ffce54;
  --green: #3ddc97;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

header h1 { margin: 0 0 6px; font-size: 1.7rem; }
.subtitle { color: var(--muted); margin: 0 0 22px; }

.search form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.input-wrap { position: relative; flex: 1 1 280px; }

#symbol-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}
#symbol-input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 340px;
  overflow-y: auto;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
}
.suggestions li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.suggestions li.active,
.suggestions li:hover { background: var(--panel-2); }
.suggestions .s-sym { font-weight: 700; color: var(--accent); white-space: nowrap; }
.suggestions .s-name {
  color: var(--text);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.suggestions .s-exch {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}

button {
  padding: 12px 18px;
  font-size: 1rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #051323;
  font-weight: 600;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button.secondary { background: var(--panel-2); color: var(--accent-2); border: 1px solid var(--border); }

.hint { color: var(--muted); font-size: 0.85rem; margin: 10px 2px 0; }
code {
  background: var(--panel-2);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.85em;
}

.status {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.status.error { border-color: #5a2a2a; color: #ff9b9b; }
.status.loading { color: var(--muted); }

.result {
  margin-top: 22px;
  padding: 20px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
}
.result-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.result-head h2 { margin: 0; font-size: 1.25rem; }
.badge {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}
.asof { color: var(--muted); font-size: 0.85rem; margin: 6px 0 16px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.metric {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.metric .label { color: var(--muted); font-size: 0.82rem; margin-bottom: 6px; }
.metric .value { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric.hero { grid-column: 1 / -1; background: linear-gradient(135deg, #14304d, #1a2027); }
.metric.hero .value { font-size: 1.9rem; color: var(--green); }

.source { color: var(--muted); font-size: 0.8rem; margin: 16px 0 0; }

.saved { margin-top: 30px; }
.saved h3 { margin: 0 0 12px; }
.saved-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.saved-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.saved-list .chip-symbol {
  cursor: pointer;
  font-weight: 600;
  color: var(--accent);
}
.saved-list .chip-name { color: var(--muted); font-size: 0.82rem; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-list .remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 2px;
}
.saved-list .remove:hover { color: #ff9b9b; }

footer { margin-top: 40px; }
