:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e6e8eb;
  --text: #1f2329;
  --muted: #8a9199;
  --sell: #f23645;
  --sell-bg: rgba(242, 54, 69, 0.18);
  --sell-deep: rgba(242, 54, 69, 0.45);
  --buy: #22ab94;
  --buy-bg: rgba(34, 171, 148, 0.18);
  --buy-deep: rgba(34, 171, 148, 0.45);
}

* { box-sizing: border-box; }

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

.page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 24px;
}

.topbar h1 {
  margin: 0 0 12px;
  font-size: 1.25rem;
  font-weight: 600;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.tool-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.tool-item.fixed .tool-label {
  color: var(--text);
  font-weight: 500;
}

select,
.tool-item input[type="text"] {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.85rem;
  background: #fff;
  color: var(--text);
}

.tool-item.symbol-input input {
  width: 9.5rem;
  font-family: inherit;
}

.tool-item.alert-toggle input {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: var(--buy);
}

.status {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.chart-box {
  display: flex;
  margin-top: 12px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  height: calc(100vh - 200px);
  min-height: 520px;
  overflow: hidden;
}

.chart-main {
  flex: 1;
  min-width: 0;
  height: 100%;
}

#chart {
  width: 100%;
  height: 100%;
}

.price-rail {
  width: 62px;
  flex-shrink: 0;
  position: relative;
  background: #fff;
  border-left: 1px solid var(--border);
}

.price-tag {
  position: absolute;
  left: 5px;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--sell);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 4px;
  border-radius: 3px;
  line-height: 1.25;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  z-index: 2;
  white-space: nowrap;
}

.price-tag.is-buy {
  background: var(--buy);
}

.price-tag .countdown {
  font-size: 10px;
  opacity: 0.95;
  font-weight: 500;
}

.legend {
  margin: 12px 4px 0;
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
}

.legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.legend .dot.sell { background: var(--sell); }
.legend .dot.buy { background: var(--buy); }

.legend .hint {
  color: #b0b5bd;
}
