:root {
  --rm-bg: #f6f5f1;
  --rm-panel: #ffffff;
  --rm-glass: rgba(255, 255, 255, 0.88);
  --rm-ink: #2c2c2a;
  --rm-mute: #5f5e5a;
  --rm-line: rgba(0, 0, 0, 0.12);
  --rm-accent: #534ab7;
  --rm-red: #a32d2d;
}
body.dark {
  --rm-bg: #1c1c1a;
  --rm-panel: #262624;
  --rm-glass: rgba(38, 38, 36, 0.88);
  --rm-ink: #f1efe8;
  --rm-mute: #b4b2a9;
  --rm-line: rgba(255, 255, 255, 0.16);
  --rm-accent: #afa9ec;
  --rm-red: #f09595;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--rm-bg);
  color: var(--rm-ink);
  font: 13px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
}

/* ---------- 舞台：图占满，浮层叠加其上 ---------- */
.rm-wrap { height: 100%; padding: 0; }
.rm-stage { position: relative; width: 100%; height: 100%; }
.rm-cy {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--rm-panel);
  border-radius: 12px;
  overflow: hidden;
}

/* ---------- 浮层 ---------- */
.rm-float {
  position: absolute;
  z-index: 5;
  background: var(--rm-glass);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--rm-line);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
  max-width: calc(100% - 20px);
}
.rm-pos-tl { top: 10px; left: 10px; }
.rm-pos-tr { top: 10px; right: 10px; }
.rm-pos-bl { bottom: 10px; left: 10px; max-width: 320px; }
.rm-pos-br { bottom: 10px; right: 10px; max-width: 340px; }
.rm-pos-b { bottom: 10px; left: 10px; right: 10px; z-index: 6; }
.rm-pos-b.collapsed { right: auto; z-index: 5; }

.rm-fh {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 7px 10px;
}
.rm-ft { font-size: 12px; font-weight: 500; }
.rm-fb { padding: 0 10px 10px; }
.collapsed .rm-fb { display: none; }

.rm-mini {
  border: none;
  background: transparent;
  color: var(--rm-mute);
  font-size: 15px;
  line-height: 1;
  padding: 0 5px;
  border-radius: 5px;
  cursor: pointer;
  flex: none;
}
.rm-mini:hover { background: rgba(0, 0, 0, 0.06); }

/* ---------- 控件 ---------- */
select, input[type="date"], button {
  font: inherit;
  color: var(--rm-ink);
  background: var(--rm-panel);
  border: 1px solid var(--rm-line);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}
.rm-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.rm-row label { width: 30px; flex: none; font-size: 12px; color: var(--rm-mute); }
.rm-row select { max-width: 210px; }
.rm-segs { display: flex; gap: 4px; flex-wrap: wrap; }
.rm-seg { padding: 4px 10px; }
.rm-seg.on { background: var(--rm-accent); color: #fff; border-color: var(--rm-accent); }
.rm-btn { padding: 4px 12px; }
.rm-tilde { color: var(--rm-mute); }

/* ---------- 统计与图例 ---------- */
.rm-sum, #rmSummary { font-size: 12px; color: var(--rm-mute); }
#rmSummary b { color: var(--rm-ink); font-weight: 500; }
.rm-red { color: var(--rm-red); }
.rm-legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; color: var(--rm-mute); }
.rm-lg { display: inline-flex; align-items: center; gap: 4px; }
.rm-lg i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.rm-lg b { color: var(--rm-ink); font-weight: 500; }

/* ---------- 明细浮层：点击节点才出现 ---------- */
.rm-dt-panel { display: none; width: 250px; max-height: 62%; overflow: auto; }
.rm-dt-panel.on { display: block; }
.rm-dt-h { font-weight: 500; margin-bottom: 6px; }
.rm-dt-r { display: flex; justify-content: space-between; font-size: 12px; color: var(--rm-mute); padding: 2px 0; }
.rm-dt-r i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.rm-mute { color: var(--rm-mute); font-size: 12px; }
.rm-act {
  margin-top: 8px; text-align: center; padding: 5px; border-radius: 8px;
  background: var(--rm-accent); color: #fff; cursor: pointer; font-size: 12px;
}
.rm-err { padding: 10px; border-radius: 8px; background: #fcebeb; color: #a32d2d; font-size: 12px; }

/* ---------- 清单 ---------- */
#rmListWrap .rm-fb { max-height: 200px; overflow: auto; }
.rm-tb { width: 100%; border-collapse: collapse; font-size: 12px; }
.rm-tb th {
  position: sticky; top: 0; background: var(--rm-panel);
  text-align: left; padding: 6px 8px; color: var(--rm-mute);
  font-weight: 500; border-bottom: 1px solid var(--rm-line);
}
.rm-tb td { padding: 5px 8px; border-bottom: 1px solid var(--rm-line); }
.rm-tb tr { cursor: pointer; }
.rm-tb tr:hover { background: rgba(0, 0, 0, 0.04); }
.rm-code { font-family: ui-monospace, Consolas, monospace; color: var(--rm-mute); }
.rm-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; }

.rm-foot { font-size: 11px; color: var(--rm-mute); line-height: 1.7; }

/* ---------- 取数失败提示 ---------- */
#rmMsg {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); z-index: 20;
}
