:root {
  --bg: #0f1320;
  --panel: #161b2e;
  --panel2: #1d2440;
  --border: #2a3154;
  --text: #e6eaf5;
  --muted: #8b93b3;
  --green: #2ecc71;
  --red: #ff5252;
  --amber: #ffb547;
  --accent: #5b8cff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.head-left { display: flex; align-items: center; gap: 14px; }
h1 { font-size: 20px; }
.tag {
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px;
}
.head-right { display: flex; align-items: center; gap: 18px; }
.status { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); display: inline-block; }
.dot.ok { background: var(--green); }
.dot.err { background: var(--red); }
.clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
button {
  background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-size: 13px;
}
button:hover { border-color: var(--accent); }
button.small { padding: 4px 8px; font-size: 12px; }

main { padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  position: relative;
  transition: border-color .2s;
}
.card:hover { border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: baseline; }
.card-name { font-size: 15px; font-weight: 600; }
.card-region { font-size: 11px; color: var(--muted); }
.card-price {
  margin-top: 8px;
  font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.card-change { font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.card-meta { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11px; color: var(--muted); }
.spark { margin-top: 10px; height: 46px; }

.up { color: var(--green); }
.down { color: var(--red); }
.flat { color: var(--muted); }

.card .alert-flag {
  position: absolute; top: 12px; right: 12px;
  font-size: 16px;
}
.card.unavailable { opacity: .5; border-style: dashed; border-color: #5a4520; }

/* alerts panel */
.alerts-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.alerts-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.alerts-head h2 { font-size: 15px; display: flex; align-items: center; gap: 10px; }
.badge {
  background: var(--accent); color: #000;
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
}
.alerts-list { max-height: 280px; overflow-y: auto; }
.alert-item {
  display: flex; gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  animation: flash 0.6s;
}
@keyframes flash { 0%{background:#3a2410} 100%{background:transparent} }
.alert-item .sym { font-weight: 700; min-width: 86px; color: var(--accent); }
.alert-item .msg { flex: 1; }
.alert-item .time { color: var(--muted); white-space: nowrap; }
.alert-item.warn { border-left: 3px solid var(--amber); }
.empty { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

footer {
  padding: 12px 24px 18px;
  font-size: 12px; color: var(--muted);
  display: flex; gap: 8px; align-items: center;
}

@media (max-width: 640px) {
  header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .head-right { width: 100%; justify-content: space-between; }
}


/* data-time in card meta */
.card-meta .data-time {
  font-size: 10px;
  color: var(--muted);
  font-family: monospace;
}
