:root {
  --bg: #0e1117;
  --panel: #161b22;
  --border: #2a3140;
  --text: #e6e9ef;
  --muted: #8b94a3;
  --buy: #e5484d;   /* 港股惯例: 买/涨 红 */
  --sell: #2fbf71;  /* 卖/跌 绿 */
  --accent: #4c8dff;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

h1 { font-size: 20px; letter-spacing: 0.5px; }
h1 .sub { font-size: 13px; color: var(--muted); font-weight: normal; margin-left: 8px; }

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

.conn {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.conn.on  { color: var(--sell); border-color: var(--sell); }
.conn.off { color: var(--buy);  border-color: var(--buy); }

.clock { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 66px; }

input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 6px;
  width: 180px;
  outline: none;
}
input[type="text"]:focus { border-color: var(--accent); }

button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
button:hover { opacity: 0.85; }
button.warn { background: #5a3a3d; color: #f0b7ba; }

.msg {
  height: 0;
  overflow: hidden;
  text-align: center;
  font-size: 13px;
  transition: height .2s;
}
.msg.show { height: 30px; line-height: 30px; }
.msg.ok  { color: var(--sell); }
.msg.err { color: var(--buy); }

main { flex: 1; padding: 16px 24px; overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

th, td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  background: #1b2230;
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #1a2233; }

.num { text-align: right; font-variant-numeric: tabular-nums; }
.code { font-weight: 600; color: var(--accent); }
.name { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.buy  { color: var(--buy); }
.sell { color: var(--sell); }
.net  { font-weight: 600; }
.muted { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 32px; }

.barcell { min-width: 120px; }
.bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--border);
}
.bar-buy  { background: var(--buy); }
.bar-sell { background: var(--sell); }

button.del {
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  padding: 0 6px;
  line-height: 1;
}
button.del:hover { color: var(--buy); opacity: 1; }

footer {
  padding: 10px 24px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
}
