:root {
  color-scheme: light;
  --bg: #f4f4f1;            /* 页面底色 */
  --panel: #fcfcfb;         /* 卡片 / 图表底色 */
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #898781;
  --line: #e1e0d9;          /* 细分割线 */
  --axis: #c3c2b7;
  --accent: #2a78d6;        /* 图表第 1 色 / 主按钮 */
  --accent-2: #eb6834;      /* 图表第 2 色 */
  --accent-3: #1baf7a;      /* 图表第 3 色 */
  --accent-soft: #e8f1fc;
  --good: #006300;
  --good-bg: #e5f3e5;
  --bad: #c43535;
  --bad-bg: #fbeaea;
  --warn: #8a5a00;
  --warn-bg: #fdf1d8;
  --row-hover: #f0f4fa;
  --shadow: 0 1px 2px rgba(11,11,11,.04), 0 4px 16px rgba(11,11,11,.04);
  --ring: rgba(11,11,11,.10);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d0d0d;
    --panel: #1a1a19;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #898781;
    --line: #2c2c2a;
    --axis: #383835;
    --accent: #3987e5;
    --accent-2: #d95926;
    --accent-3: #199e70;
    --accent-soft: #172a42;
    --good: #0ca30c;
    --good-bg: #14301a;
    --bad: #e66767;
    --bad-bg: #3a1e1e;
    --warn: #f0b44c;
    --warn-bg: #3a2e14;
    --row-hover: #232a36;
    --shadow: none;
    --ring: rgba(255,255,255,.10);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.55 "Microsoft YaHei UI", "PingFang SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 56px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand .logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.topbar nav { display: flex; gap: 2px; overflow-x: auto; }
.topbar nav a { padding: 7px 12px; border-radius: 8px; color: var(--text-2); white-space: nowrap; }
.topbar nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; text-decoration: none; }
.topbar nav a:hover { background: var(--bg); text-decoration: none; }
.calc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .calc-grid { grid-template-columns: 1fr; } }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
@media (max-width: 520px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 13px; }
.form-grid input, .form-grid input[type=number], .form-grid select { width: 100%; font-size: 15px; padding: 8px 10px; }
.result-hero { padding: 6px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 12px; min-height: 92px; }
.result-hero .t { color: var(--text-2); font-size: 13px; }
.result-hero .big { font-size: 40px; font-weight: 600; line-height: 1.15; }
.result-hero .big .unit { font-size: 18px; font-weight: 500; color: var(--text-2); }
.result-hero .rate { font-size: 15px; margin-top: 2px; }
.result-kv { gap: 8px 18px; font-size: 14px; }
.fx-badge { margin-left: auto; font-size: 13px; color: var(--text-2); padding: 5px 10px; border-radius: 8px;
  background: var(--bg); white-space: nowrap; font-variant-numeric: tabular-nums; cursor: help; flex-shrink: 0; }
.fx-badge.bad { background: var(--bad-bg); color: var(--bad); }
.fx-badge + .cur-switch { margin-left: 0; }
.cur-switch { margin-left: auto; display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.cur-switch button { background: transparent; color: var(--text-2); border-radius: 0; padding: 5px 11px; font-size: 13px; }
.cur-switch button.on { background: var(--accent); color: #fff; }
main { max-width: 1400px; margin: 0 auto; padding: 24px 16px 60px; }
h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: .2px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--text-2); font-weight: 600; }
.sub { color: var(--text-2); margin: 0 0 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.card .t { color: var(--text-2); font-size: 12px; }
.card .v { font-size: 20px; font-weight: 600; margin-top: 4px; }
.card .d { color: var(--muted); font-size: 12px; margin-top: 4px; word-break: break-all; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .t { color: var(--text-2); font-size: 12px; }
.kpi .v { font-size: 26px; font-weight: 600; margin-top: 2px; line-height: 1.25; }
.kpi .d { color: var(--muted); font-size: 12px; margin-top: 2px; }
.section-title { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px; }
.section-title h2 { margin: 0; font-size: 18px; }
.section-title .muted { font-size: 13px; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.chart-card .cap { color: var(--muted); font-size: 12px; margin: -4px 0 10px; }
.chart-card .plot { position: relative; height: 300px; }
.chart-card .plot.tall { height: 380px; }
.empty { display: grid; place-items: center; text-align: center; color: var(--muted); height: 100%; min-height: 160px; padding: 20px; }
details.tbl { margin-top: 10px; font-size: 13px; }
details.tbl summary { cursor: pointer; color: var(--accent); }
details.tbl table { margin-top: 8px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot.ok { background: var(--good); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
input[type=text], input[type=number], select {
  background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px; font: inherit;
}
input[type=number] { width: 80px; }
input[type=text].search { width: 240px; }
button {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 7px 14px;
  font: inherit; cursor: pointer;
}
button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: default; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--panel); }
th.sort { cursor: pointer; user-select: none; }
th.sort:hover { color: var(--text); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--row-hover); }
td.name { white-space: normal; min-width: 240px; }
.pos { color: var(--good); font-weight: 600; } .neg { color: var(--bad); }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; background: var(--bg); color: var(--muted); }
.tag.good { background: var(--good-bg); color: var(--good); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.reason { color: var(--muted); font-size: 12px; white-space: normal; min-width: 180px; }
.muted { color: var(--muted); }
.more { text-align: center; padding: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; }
.kv .k { color: var(--muted); }
.chart-box { position: relative; height: 340px; }
.logbox {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px;
  font: 12px/1.55 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; word-break: break-all;
  max-height: 75vh; overflow-y: auto;
}
.logbox .w { color: var(--warn); } .logbox .e { color: var(--bad); }
.notice { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; }
.links a { margin-right: 14px; }
button.sm { padding: 3px 9px; font-size: 12px; }
td.acts { white-space: nowrap; }
td.acts > * { margin-right: 6px; }
tr.sub-row td { border-bottom: 1px solid var(--line); padding-top: 0; font-size: 12px; white-space: normal; }
.sale { color: var(--muted); padding: 2px 0; }
dialog {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel); color: var(--text);
  padding: 0; width: min(460px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dform { padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.dform label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
.dform input, .dform select { width: 100%; }
.dform input[readonly] { opacity: .75; }
.dform p { margin: 0; font-size: 13px; }
.derr { color: var(--bad); min-height: 1em; }
.dbtns { display: flex; justify-content: flex-end; gap: 8px; }
.srow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.srow:first-of-type { border-top: 0; }
.srow.changed { background: var(--warn-bg); margin: 0 -16px; padding: 10px 16px; }
.slabel .muted { font-size: 12px; }
.sinput { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.snote { flex-basis: 100%; font-size: 12px; color: var(--muted); }
@media (max-width: 700px) { .srow { grid-template-columns: minmax(0, 1fr); gap: 6px; } .sinput select, .sinput input { max-width: 100%; min-width: 0; } }
.savebar { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 10px; box-shadow: 0 4px 18px rgba(0,0,0,.08); z-index: 4; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--text); color: var(--panel); padding: 10px 16px; border-radius: 8px; z-index: 20; }
.tag.ready { background: var(--accent); color: #fff; }
.ready-text { color: var(--accent); font-weight: 600; font-size: 12px; }
td.status-cell { white-space: normal; min-width: 170px; }
td.status-cell > div { font-size: 12px; margin-top: 2px; }
tr.row-ready td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.card.alert { border-color: var(--accent); }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.dir-switch { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 12px; flex-wrap: wrap; }
.dir-switch button { background: transparent; color: var(--text-2); border-radius: 0; padding: 8px 14px; }
.dir-switch button.on { background: var(--accent); color: #fff; }
.advice { padding: 4px 0 6px; font-size: 13px; }
.advice .muted { font-size: 12px; }
.top-search input { width: 200px; padding: 6px 10px; border-radius: 8px; }
@media (max-width: 900px) { .top-search input { width: 130px; } }
.btn-link { display: inline-block; padding: 4px 10px; border-radius: 6px; background: var(--accent); color: #fff; font-size: 13px; white-space: nowrap; }
.btn-link:hover { text-decoration: none; opacity: .9; }

.user-chip { font-size: 13px; color: var(--text-2); white-space: nowrap; padding: 5px 8px; border-radius: 8px; flex-shrink: 0; }
.user-chip:hover { background: var(--bg); text-decoration: none; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: min(380px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login-box h1 { font-size: 20px; }
.login-box label { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 13px; }
.login-box input { width: 100%; font-size: 15px; padding: 9px 10px; }
.login-box button { padding: 10px; font-size: 15px; }

.user-chip.on { background: var(--accent-soft); color: var(--accent); }
.acct-form { display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.acct-form label { display: flex; flex-direction: column; gap: 4px; color: var(--text-2); font-size: 13px; }
.acct-form input { width: 100%; padding: 8px 10px; }

/* ===================================================================== 2026-11-09 手机 / 平板适配
   电脑上：顶栏一排放下所有东西。窄屏（平板竖着、手机）：顶栏只剩 logo + "☰ 菜单"，点开再显示导航和工具。
   手机上表格改成"一行一张小卡片"（每个格子前面写上表头），不用左右滑。 */
.brand { color: var(--text); }
.brand:hover { text-decoration: none; }
.top-menu { flex: 1; display: flex; align-items: center; gap: 14px; min-width: 0; }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.top-tools .fx-badge, .top-tools .cur-switch { margin-left: 0; }
.menu-btn { display: none; margin-left: auto; background: var(--bg); color: var(--text); border: 1px solid var(--line);
  padding: 7px 12px; font-size: 14px; }
/* 语言 + 币种：电脑上排在顶栏最右边；窄屏上放在"菜单"按钮左边，不收起来 */
.quick-tools { order: 4; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.quick-tools .cur-switch { margin-left: 0; }

@media (max-width: 1180px) {
  .topbar { gap: 10px; padding: 0 14px; }
  .menu-btn { display: inline-block; order: 5; margin-left: 0; }
  .quick-tools { margin-left: auto; }
  .top-menu { display: none; }
  .topbar.open .top-menu {
    display: flex; flex-direction: column; align-items: stretch; gap: 12px;
    position: absolute; top: 56px; left: 0; right: 0; padding: 12px 14px 16px;
    background: var(--panel); border-bottom: 1px solid var(--line); box-shadow: 0 10px 24px rgba(0,0,0,.12);
    max-height: calc(100vh - 56px); overflow-y: auto;
  }
  .topbar.open nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px; overflow: visible; }
  .topbar.open nav a { padding: 10px 12px; background: var(--bg); text-align: center; }
  .topbar.open .top-search input { width: 100%; padding: 10px 12px; font-size: 15px; }
  .topbar.open .top-tools { margin-left: 0; flex-wrap: wrap; }
}

@media (max-width: 700px) {
  .cur-word { display: none; }             /* 手机上币种按钮只留 ¥ / € */
  .quick-tools { gap: 6px; }
  .quick-tools .lang-btn, .quick-tools .cur-switch button { padding: 6px 9px; }
  main { padding: 16px 12px 48px; }
  h1 { font-size: 20px; }
  .sub { font-size: 13px; }
  .panel { padding: 14px 12px; border-radius: 10px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi .v { font-size: 20px; }
  .kpi .d { font-size: 11px; }
  .cards { grid-template-columns: 1fr 1fr; gap: 8px; }
  .card { padding: 10px 12px; }
  .card .v { font-size: 16px; }
  .card .d { font-size: 11px; }
  .toolbar { gap: 8px 10px; }
  .toolbar input.search, .toolbar input[type=search] { width: 100% !important; }
  .toolbar input[type=number] { width: 64px; }
  .dir-switch { width: 100%; }
  .dir-switch button { flex: 1; padding: 8px 6px; font-size: 13px; }
  .chart-card .plot { height: 240px; }
  .chart-card .plot.tall { height: 300px; }
  .chart-box { height: 260px; }
  .grid2, .calc-grid { grid-template-columns: 1fr; }
  .srow { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .section-title { flex-wrap: wrap; }
  button, .btn-link { min-height: 36px; }

  /* 表格 → 一行一张卡片 */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: var(--panel); }
  table.stack tr.click:hover { background: var(--row-hover); }
  table.stack td { border: 0; padding: 4px 0; white-space: normal; text-align: right; display: flex;
    justify-content: space-between; gap: 12px; align-items: baseline; min-width: 0; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; flex-shrink: 0; }
  table.stack td.name { display: block; text-align: left; font-weight: 600; font-size: 14px; padding-bottom: 6px; }
  table.stack td.name::before { content: none; }
  table.stack td:empty, table.stack td[data-label=""]::before { display: none; }
  table.stack td.acts { justify-content: flex-start; flex-wrap: wrap; padding-top: 8px; }
  table.stack td.acts::before { content: none; }
  table.stack tr.sub-row { border-style: dashed; margin-top: -6px; }
  table.stack tr.sub-row td { display: block; text-align: left; }
  table.stack tr.sub-row td::before { content: none; }
  table.stack .reason, table.stack .status-cell { min-width: 0; text-align: right; }
  .table-wrap { overflow-x: visible; }
}

.lang-btn { background: var(--bg); color: var(--text-2); border: 1px solid var(--line); padding: 5px 10px; font-size: 13px; flex-shrink: 0; }

@media (max-width: 400px) {
  .brand-text { display: none; }           /* 特别窄的手机：顶栏只留 CS 图标，给按钮让位置 */
  .menu-btn { padding: 7px 10px; }
}
