:root {
  --bg: #0e1116;
  --bg-2: #161b22;
  --bg-3: #1c2330;
  --line: #2a3340;
  --text: #e7ecf3;
  --muted: #8b98a8;
  --red: #ef4444;
  --green: #22c55e;
  --amber: #f59e0b;
  --blue: #60a5fa;
  --up: #f05252;
  --down: #16a34a;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.45 "IBM Plex Sans", "PingFang SC", "Noto Sans SC", sans-serif; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

.app { display: grid; grid-template-columns: 320px 1fr; height: 100%; }
.side { border-right: 1px solid var(--line); background: var(--bg-2); display: flex; flex-direction: column; min-height: 0; }
.main { min-width: 0; min-height: 0; overflow: auto; padding: 20px 24px 32px; }

.top { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: 0.04em; }
.brand span { color: var(--muted); font-size: 12px; }
.session { margin-top: 8px; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.live { background: var(--up); }
.note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

.search { display: flex; gap: 8px; padding: 12px 16px; }
.search input { flex: 1; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; outline: none; }
.search input:focus { border-color: #3d4d63; }
.search button, .icon-btn, .ghost { background: var(--bg-3); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.icon-btn { padding: 2px 8px; color: var(--muted); }
.suggest { margin: 0 16px 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.suggest button { display: flex; width: 100%; justify-content: space-between; background: none; border: 0; padding: 8px 10px; }
.suggest button:hover { background: var(--bg-3); }

.list-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 16px 6px; }
.list-head span { color: var(--muted); font-size: 12px; }
.list-head .ghost { padding: 4px 10px; font-size: 12px; }
.list-head .ghost.on { border-color: #3d4d63; color: var(--text); background: #202a38; }
.watch-note { margin: 0 16px 8px; color: var(--amber); font-size: 12px; }

.list { overflow: auto; padding: 4px 8px 16px; }
.card { width: 100%; text-align: left; background: transparent; border: 0; border-radius: 10px; padding: 10px 10px; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; align-items: center; cursor: pointer; }
.list.editing .card { grid-template-columns: 1fr auto auto; }
.card:hover { background: var(--bg-3); }
.card.active { background: #202a38; }
.card .name { font-weight: 600; }
.card .code { color: var(--muted); font-size: 12px; }
.card .px { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; }
.card .chg { font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; }
.acts { display: none; flex-direction: column; gap: 4px; }
.list.editing .acts { display: flex; }
.act { width: 28px; height: 22px; padding: 0; border-radius: 6px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 20px; }
.act:hover { color: var(--text); border-color: #3d4d63; }
.act:disabled { opacity: 0.35; cursor: default; }
.act.del { color: var(--up); }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

.head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.head h2 { margin: 0; font-size: 28px; }
.meta { color: var(--muted); margin-top: 4px; }
.big { text-align: right; }
.big .px { font-size: 36px; font-variant-numeric: tabular-nums; font-weight: 700; line-height: 1; }
.big .chg { margin-top: 6px; font-variant-numeric: tabular-nums; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.stat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { margin-top: 4px; font-variant-numeric: tabular-nums; font-weight: 650; }

.callout { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--bg-2); margin-bottom: 16px; }
.callout.danger { border-color: #7f1d1d; background: #1a1010; }
.callout.warning { border-color: #78350f; background: #17120c; }
.callout.info { border-color: #1e3a5f; background: #10151d; }
.callout h3 { margin: 0 0 6px; font-size: 16px; }
.callout p, .callout li { margin: 0; color: var(--text); }
.callout ol { margin: 8px 0 0; padding-left: 18px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.panel h3 { margin: 0 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
canvas { width: 100%; height: 180px; display: block; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; font-weight: 500; }
.right { text-align: right; }

.ann { margin: 0; padding: 0; list-style: none; }
.ann li { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.4; }
.ann li:last-child { border-bottom: 0; }
.ann li span { color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; }

.login { min-height: 100%; display: grid; place-items: center; }
.box { width: min(420px, 92vw); background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.box h1 { margin: 0 0 8px; }
.box p { color: var(--muted); }
.box input { width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin: 12px 0; }
.box button { width: 100%; background: #2b3b52; border: 0; border-radius: 8px; padding: 10px; }
.err { color: var(--up); min-height: 1.2em; }

@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .side { height: auto; max-height: 42vh; }
  .stats, .grid2 { grid-template-columns: 1fr 1fr; }
}
