:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei UI", "PingFang SC", system-ui, sans-serif;
  background: #0b131b;
  color: #e5edf3;
  --base: #0b131b;
  --panel: #101d28;
  --soft: #142431;
  --line: #253643;
  --muted: #9aafbe;
  --mint: #76ead0;
  --red: #ffaaa8;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button, input, select {
  border: 1px solid var(--line); border-radius: 6px; background: var(--soft);
  color: inherit; padding: 8px 12px; min-height: 37px;
}
button { cursor: pointer; white-space: nowrap; transition: background .15s ease, border .15s ease; }
button:hover { border-color: #65808e; background: #1a3040; }
button:disabled { opacity: .45; cursor: default; }
button.accent { background: var(--mint); border-color: var(--mint); color: #09241d; font-weight: 750; }
button.accent:hover { background: #a4f5e2; }
button.subtle { background: transparent; border-color: transparent; color: var(--muted); }
:focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
.topbar {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; min-height: 66px; padding: 0 26px; border-bottom: 1px solid var(--line); background: #0e1922;
}
.brand { display: flex; gap: 13px; align-items: center; font-weight: 760; font-size: 17px; white-space: nowrap; }
.brand small { color: var(--muted); font-size: 11px; font-weight: 500; margin-left: 12px; }
.brand-mark { display: flex; gap: 3px; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; background: #183a37; transform: skew(-5deg); }
.brand-mark i { display: block; height: 11px; width: 3px; background: var(--mint); border-radius: 1px; transform: rotate(23deg); }
.brand-mark i:nth-child(2) { height: 19px; }
.brand-mark i:nth-child(3) { height: 14px; }
.topstatus, .status { display: flex; align-items: center; gap: 9px; }
.topstatus { gap: 21px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.status { color: var(--mint); }
.status i, .rail-foot i { border-radius: 50%; width: 7px; height: 7px; background: currentColor; box-shadow: 0 0 9px currentColor; }
time { font-family: var(--mono); }
.shell { display: grid; grid-template-columns: 205px minmax(0, 1fr); min-height: calc(100vh - 66px); }
.rail { padding: 26px 12px; border-right: 1px solid var(--line); position: sticky; top: 66px; height: calc(100dvh - 66px); display: flex; flex-direction: column; justify-content: space-between; }
.rail nav { display: grid; gap: 6px; }
.rail a { display: flex; padding: 12px 14px; align-items: center; gap: 12px; border-radius: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; transition: background .15s ease, color .15s ease; }
.rail a span { font: 18px var(--mono); width: 20px; text-align: center; }
.rail a:hover { background: var(--soft); color: #fff; }
.rail a[aria-current] { background: #173431; color: var(--mint); }
.rail-foot { display: flex; gap: 10px; align-items: center; color: #76c8b8; font-size: 12px; padding: 12px 14px; border-top: 1px solid var(--line); }
main { min-width: 0; width: 100%; max-width: 1680px; margin: 0 auto; padding: 31px clamp(16px, 3vw, 46px) 45px; }
.view { animation: reveal .18s ease-out; }
@keyframes reveal { from { opacity: .65; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.page-head { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.page-head p { color: var(--muted); margin: 8px 0 0; font-size: 13px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(25px, 3vw, 33px); letter-spacing: -.035em; }
h2 { font-size: 15px; font-weight: 750; }
.actions, .dialog-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 24%); gap: 15px; }
.chart-panel, .summary, .wide-panel { border: 1px solid var(--line); border-radius: 9px; background: var(--panel); overflow: hidden; }
.panel-head { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-head h2 small { font-size: 11px; color: var(--muted); margin-left: 7px; font-weight: 500; }
.muted { color: var(--muted); font-size: 12px; line-height: 1.65; }
.market-price { font: 700 clamp(20px, 3vw, 28px) var(--mono); color: var(--mint); }
.chart-toolbar { min-height: 38px; display: flex; justify-content: space-between; align-items: center; padding: 0 19px; gap: 8px; flex-wrap: wrap; }
.legend { display: flex; gap: 13px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.legend i { display: inline-block; width: 12px; height: 2px; background: var(--mint); margin-right: 5px; vertical-align: middle; }
.legend span:nth-child(2) i { background: #8298b1; }
.segmented { display: flex; gap: 3px; }
.segmented button { font-size: 11px; padding: 4px 7px; min-height: 28px; border-color: transparent; color: var(--muted); background: transparent; }
.segmented button[aria-pressed=true] { color: var(--mint); background: #193633; }
#chart { display: block; width: 100%; height: 285px; }
.quote-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.quote-strip div { padding: 13px 14px; display: grid; gap: 6px; }
.quote-strip div + div { border-left: 1px solid var(--line); }
.quote-strip span, dt { color: var(--muted); font-size: 11px; }
.quote-strip strong { font: 12px var(--mono); overflow-wrap: anywhere; }
.summary { padding: 19px; }
.summary dl { margin: 15px 0; }
.summary dl div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary dd { margin: 6px 0 0; font: 650 22px var(--mono); }
.positive { color: var(--mint); }
.negative, .form-error { color: var(--red); }
.wide-panel { margin-top: 15px; }
.wide-panel > .panel-head { border-bottom: 1px solid var(--line); }
.wide-panel > .panel-head p { color: var(--muted); font-size: 12px; }
.text-link { color: var(--mint); font-size: 12px; white-space: nowrap; }
.text-link:hover { text-decoration: underline; }
.text-link span { margin-left: 6px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 12px; white-space: nowrap; }
th, td { padding: 12px 16px; }
th { background: #142331; color: var(--muted); font-weight: 600; }
td { border-top: 1px solid var(--line); }
tbody tr:hover { background: #142633; }
.empty { text-align: center; padding: 27px; color: var(--muted); }
td .row-action { min-height: 29px; padding: 4px 7px; margin-right: 4px; font-size: 11px; }
.module { padding: 20px; display: grid; gap: 14px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
input, select { min-width: 0; }
form:not(.inline-form) { display: grid; gap: 13px; align-content: start; }
.inline-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.inline-label { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1 1 200px; }
#replay-form > label { max-width: 440px; }
.login { min-height: calc(100vh - 66px); display: grid; place-items: center; padding: 20px; }
.login form { width: min(100%, 400px); padding: 25px; border: 1px solid var(--line); background: var(--panel); border-radius: 9px; }
dialog { background: var(--panel); color: inherit; width: min(580px, calc(100% - 22px)); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
dialog::backdrop { background: #030a10ba; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; }
.dialog-head button { font-size: 20px; padding: 1px 7px; }
.dialog-actions { justify-content: end; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 14px; }
.check { display: flex; align-items: center; gap: 7px; }
.check input { min-height: auto; accent-color: var(--mint); }
.form-error { font-size: 12px; }
.form-error:empty { display: none; }
#toast { position: fixed; right: 18px; bottom: 18px; z-index: 5; width: max-content; max-width: calc(100% - 36px); padding: 12px 18px; background: #183530; color: #f0fffb; border: 1px solid #416c65; border-radius: 7px; font-size: 13px; }
@media (max-width: 910px) {
  .shell { grid-template-columns: 148px minmax(0, 1fr); }
  .rail { padding-inline: 8px; }
  .rail a { gap: 6px; padding-inline: 8px; }
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .summary dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
  .summary dd { font-size: 18px; }
}
@media (max-width: 590px) {
  .topbar { min-height: 54px; padding: 0 12px; }
  .brand { font-size: 14px; gap: 7px; }
  .brand small, #clock { display: none; }
  .topstatus { gap: 4px; }
  .shell { display: block; }
  .rail { height: auto; top: 54px; z-index: 2; padding: 5px; border: 0; border-bottom: 1px solid var(--line); background: #0e1922; }
  .rail nav { display: flex; overflow-x: auto; gap: 3px; }
  .rail a { padding: 9px 6px; font-size: 11px; }
  .rail a span, .rail-foot { display: none; }
  main { padding-top: 20px; }
  #chart { height: 210px; }
  .panel-head { padding-inline: 13px; }
  .chart-toolbar { padding-inline: 13px; }
  .quote-strip div { padding: 10px 8px; }
  .quote-strip strong { font-size: 10px; }
  .summary dd { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
