.trading-records-page {
  min-height: calc(100vh - var(--app-chrome-height, 131px));
  padding: clamp(26px, 2.8vw, 42px) clamp(22px, 3.2vw, 56px) 84px;
  background:
    radial-gradient(circle at 72% 4%, rgba(var(--blue-rgb), 0.05), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

/* ========================================================================
   IB 客户交易历史 · 账户范围组件
   保留 Fusion 版筛选能力，视觉对齐非 Fusion 后台与 CRM 账号列表：
   标准筛选框尺寸、蓝色交互态、白色浮层与紧凑的高级关系树。
   ======================================================================== */
body[data-layout-page="ib-trading-history"] {
  --fr-gold: var(--blue-ink, #2563eb);
  --fr-gold-soft: #3b82f6;
  --fr-gold-deep: var(--blue-deep, #1d4ed8);
  --fr-gold-ink: #ffffff;
  --fr-gold-tint: rgba(37, 99, 235, 0.1);
  --fr-gold-line: rgba(37, 99, 235, 0.32);
  --fr-surface: #ffffff;
  --fr-surface-2: #f7faff;
  --fr-surface-3: #f1f5f9;
  --fr-line: #e8edf5;
  --fr-line-2: #d8e1ef;
  --fr-ink: #0f172a;
  --fr-ink-2: #475569;
  --fr-muted: #64748b;
  --fr-faint: #94a3b8;
  --fr-shadow-pop: 0 18px 42px rgba(15, 23, 42, 0.16);
  --fr-radius-sm: 8px;
  --fr-radius-lg: 14px;
  --fr-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

body[data-layout-page="ib-trading-history"] .records-fusion-range-field {
  position: relative;
  z-index: 5;
  align-content: start;
}

body[data-layout-page="ib-trading-history"] .records-fusion-range-field:has(.mft-pf.is-open) {
  z-index: 40;
}

body[data-layout-page="ib-trading-history"] .records-fusion-range-field button,
body[data-layout-page="ib-trading-history"] .mft-sheet-backdrop button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

body[data-layout-page="ib-trading-history"] .mft-pf {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  width: 100%;
  height: 42px;
  border: 1px solid var(--fr-line);
  border-radius: 8px;
  background: var(--fr-surface);
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
}

body[data-layout-page="ib-trading-history"] .mft-pf:hover { border-color: var(--fr-line-2); }

body[data-layout-page="ib-trading-history"] .mft-pf.is-open {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px var(--fr-gold-tint);
}

body[data-layout-page="ib-trading-history"] .mft-pf.is-drilled {
  border-color: var(--fr-gold-line);
  background: var(--fr-gold-tint);
}

body[data-layout-page="ib-trading-history"] .mft-pf-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: none;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  color: var(--fr-ink-2);
}

body[data-layout-page="ib-trading-history"] .mft-pf-label {
  flex: none;
  color: var(--fr-muted);
  font-weight: 500;
}

body[data-layout-page="ib-trading-history"] .mft-pf.is-drilled .mft-pf-label { color: var(--fr-gold-deep); }

body[data-layout-page="ib-trading-history"] .mft-pf-value {
  min-width: 0;
  overflow: hidden;
  color: var(--fr-ink);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-layout-page="ib-trading-history"] .mft-pf-caret {
  width: 13px;
  height: 13px;
  flex: none;
  fill: none;
  stroke: var(--fr-faint);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  transition: transform 0.18s var(--fr-ease);
}

body[data-layout-page="ib-trading-history"] .mft-pf.is-open .mft-pf-caret { transform: rotate(180deg); }

body[data-layout-page="ib-trading-history"] .ibh-chip-icon {
  width: 15px;
  height: 15px;
  flex: none;
  fill: none;
  stroke: var(--fr-gold);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

body[data-layout-page="ib-trading-history"] .mft-pf-pop {
  position: absolute;
  z-index: 30;
  top: calc(100% + 7px);
  left: 0;
  width: 300px;
  min-width: 100%;
  max-width: calc(100vw - 48px);
  padding: 7px;
  border: 1px solid var(--fr-line);
  border-radius: 8px;
  background: var(--fr-surface);
  box-shadow: var(--fr-shadow-pop);
  animation: fr-drop 0.15s var(--fr-ease);
}

body[data-layout-page="ib-trading-history"] .mft-pf-pop[hidden] { display: none !important; }

@keyframes fr-drop {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: none; }
}

body[data-layout-page="ib-trading-history"] .ibh-quick-search,
body[data-layout-page="ib-trading-history"] .ibh-scope-search {
  position: relative;
  display: flex;
  align-items: center;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-search { margin-bottom: 6px; }

body[data-layout-page="ib-trading-history"] .ibh-quick-search > svg,
body[data-layout-page="ib-trading-history"] .ibh-scope-search > svg {
  position: absolute;
  left: 9px;
  width: 13px;
  height: 13px;
  fill: none;
  stroke: var(--fr-muted);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  pointer-events: none;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-search input {
  width: 100%;
  height: 36px;
  padding: 0 10px 0 30px;
  border: 1px solid var(--fr-line);
  border-radius: var(--fr-radius-sm);
  background: var(--fr-surface);
  color: var(--fr-ink);
  font: inherit;
  font-size: 12.5px;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-search input:focus-visible,
body[data-layout-page="ib-trading-history"] .ibh-scope-search input:focus-visible {
  outline: 2px solid var(--fr-gold-line);
  outline-offset: 1px;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 2px 6px;
  color: var(--fr-muted);
  font-size: 11px;
  font-weight: 650;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-seg {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: var(--fr-surface-2);
}

body[data-layout-page="ib-trading-history"] .ibh-quick-seg button {
  height: 30px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fr-muted);
  font-size: 11.5px;
  font-weight: 700;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-seg button.is-active {
  color: var(--fr-gold-deep);
  background: var(--fr-surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

body[data-layout-page="ib-trading-history"] .ibh-quick-body {
  max-height: 288px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-list { display: grid; gap: 2px; }

body[data-layout-page="ib-trading-history"] .ibh-quick-all {
  width: 100%;
  padding: 7px 8px;
  border: 1px dashed var(--fr-line-2);
  border-radius: 8px;
  background: transparent;
  color: var(--fr-ink-2);
  font-size: 12px;
  font-weight: 650;
  text-align: left;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-all:hover {
  border-color: var(--fr-gold-line);
  color: var(--fr-gold-deep);
}

body[data-layout-page="ib-trading-history"] .ibh-quick-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 8px;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-row:hover { background: var(--fr-gold-tint); }

body[data-layout-page="ib-trading-history"] .ibh-quick-main {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-main strong,
body[data-layout-page="ib-trading-history"] .ibh-row-main strong {
  overflow: hidden;
  color: var(--fr-ink);
  font-size: 12.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-main small,
body[data-layout-page="ib-trading-history"] .ibh-row-main small {
  overflow: hidden;
  color: var(--fr-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-layout-page="ib-trading-history"] .ibh-tag {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--fr-surface-3);
  color: var(--fr-ink-2);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

body[data-layout-page="ib-trading-history"] .ibh-tag.is-ib { color: #6d28d9; background: #f5f3ff; }
body[data-layout-page="ib-trading-history"] .ibh-tag.is-client { color: var(--fr-gold-deep); background: var(--fr-gold-tint); }

body[data-layout-page="ib-trading-history"] .ibh-level {
  margin-left: 6px;
  padding: 1px 5px;
  border: 1px solid var(--fr-line);
  border-radius: 4px;
  color: var(--fr-muted);
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
}

body[data-layout-page="ib-trading-history"] .ibh-level.is-self {
  border-color: var(--fr-gold-line);
  background: var(--fr-gold-tint);
  color: var(--fr-gold-deep);
}

body[data-layout-page="ib-trading-history"] .ibh-quick-empty {
  padding: 18px 8px;
  color: var(--fr-muted);
  font-size: 12px;
  text-align: center;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-more {
  margin: 6px 6px 0;
  color: var(--fr-muted);
  font-size: 11px;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
  padding-top: 7px;
  border-top: 1px solid var(--fr-line);
  color: var(--fr-muted);
  font-size: 11px;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-adv {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  padding: 3px 9px;
  border: 1px solid var(--fr-gold-line);
  border-radius: 999px;
  background: var(--fr-gold-tint);
  color: var(--fr-gold-deep);
  font-size: 11.5px;
  font-weight: 700;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-adv svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

body[data-layout-page="ib-trading-history"] .ibh-quick-adv:hover {
  border-color: var(--fr-gold);
  background: var(--fr-gold);
  color: var(--fr-gold-ink);
}

body[data-layout-page="ib-trading-history"].records-scope-sheet-open { overflow: hidden; }

body[data-layout-page="ib-trading-history"] .mft-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 26px;
  background: rgba(6, 6, 8, 0.56);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

body[data-layout-page="ib-trading-history"] .mft-sheet-backdrop[hidden] { display: none !important; }

body[data-layout-page="ib-trading-history"] .mft-sheet {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: min(86dvh, 780px);
  overflow: hidden;
  border: 1px solid var(--fr-line);
  border-radius: var(--fr-radius-lg);
  background: var(--fr-surface);
  color: var(--fr-ink);
  box-shadow: var(--fr-shadow-pop);
}

body[data-layout-page="ib-trading-history"] .mft-sheet.is-wide { width: min(920px, 100%); }
body[data-layout-page="ib-trading-history"] .mft-sheet-grab { display: none; }

body[data-layout-page="ib-trading-history"] .mft-sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--fr-line);
}

body[data-layout-page="ib-trading-history"] .mft-sheet-head h2 {
  margin: 0;
  color: var(--fr-ink);
  font-size: 16px;
  font-weight: 750;
}

body[data-layout-page="ib-trading-history"] .mft-sheet-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  margin-left: auto;
  border: 1px solid var(--fr-line);
  border-radius: 9px;
  background: var(--fr-surface-2);
  color: var(--fr-muted);
}

body[data-layout-page="ib-trading-history"] .mft-sheet-close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

body[data-layout-page="ib-trading-history"] .mft-sheet-body {
  flex: 1;
  min-height: 0;
  padding: 16px 18px;
}

body[data-layout-page="ib-trading-history"] .mft-sheet-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--fr-line);
  background: var(--fr-surface-2);
}

body[data-layout-page="ib-trading-history"] .mft-sheet-foot .mf-btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 0 13px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 700;
}

body[data-layout-page="ib-trading-history"] .mf-btn-outline {
  border: 1px solid var(--fr-line-2);
  background: var(--fr-surface);
  color: var(--fr-ink-2);
}

body[data-layout-page="ib-trading-history"] .mf-btn-gold {
  border: 1px solid var(--fr-gold);
  background: linear-gradient(180deg, var(--fr-gold-soft), var(--fr-gold));
  color: var(--fr-gold-ink);
}

body[data-layout-page="ib-trading-history"] .ibh-scope-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body[data-layout-page="ib-trading-history"] .ibh-scope-status {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 5px;
  color: var(--fr-ink-2);
  font-size: 12.5px;
}

body[data-layout-page="ib-trading-history"] .ibh-path-chain,
body[data-layout-page="ib-trading-history"] .ibh-scope-stats {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 6px;
}

body[data-layout-page="ib-trading-history"] .ibh-path-chain b { color: var(--fr-ink-2); font-weight: 650; }
body[data-layout-page="ib-trading-history"] .ibh-path-chain b.is-tail { color: var(--fr-ink); font-weight: 750; }
body[data-layout-page="ib-trading-history"] .ibh-path-chain i { color: var(--fr-muted); font-style: normal; }
body[data-layout-page="ib-trading-history"] .ibh-scope-status.is-drilled .ibh-path-chain b.is-tail { color: var(--fr-gold-deep); }

body[data-layout-page="ib-trading-history"] .ibh-scope-stats { gap: 2px 10px; color: var(--fr-muted); }
body[data-layout-page="ib-trading-history"] .ibh-scope-stats::before { content: "·"; color: var(--fr-line-2); }
body[data-layout-page="ib-trading-history"] .ibh-scope-stats b { color: var(--fr-ink-2); font-weight: 750; }

body[data-layout-page="ib-trading-history"] .ibh-scope-clear {
  padding: 1px 8px;
  border: 1px solid var(--fr-gold-line);
  border-radius: 999px;
  background: var(--fr-gold-tint);
  color: var(--fr-gold-deep);
  font-size: 11.5px;
  font-weight: 650;
}

body[data-layout-page="ib-trading-history"] .ibh-scope-search { flex: none; margin-bottom: 10px; }

body[data-layout-page="ib-trading-history"] .ibh-scope-search input {
  width: 100%;
  height: 36px;
  padding: 0 32px 0 30px;
  border: 1px solid var(--fr-line);
  border-radius: var(--fr-radius-sm);
  background: var(--fr-surface);
  color: var(--fr-ink);
  font: inherit;
  font-size: 12.5px;
}

body[data-layout-page="ib-trading-history"] .ibh-scope-search > button {
  position: absolute;
  right: 6px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--fr-surface-3);
  color: var(--fr-muted);
}

body[data-layout-page="ib-trading-history"] .ibh-scope-search > button svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
}

body[data-layout-page="ib-trading-history"] .ibh-scope-hits {
  flex: none;
  margin: -6px 2px 10px;
  color: var(--fr-muted);
  font-size: 11.5px;
}

body[data-layout-page="ib-trading-history"] .ibh-scope-hits b { color: var(--fr-gold-deep); font-weight: 750; }

body[data-layout-page="ib-trading-history"] .ibh-scope-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  flex: none;
  gap: 10px 12px;
  margin-bottom: 14px;
}

body[data-layout-page="ib-trading-history"] .ibh-field { display: grid; gap: 5px; min-width: 0; }
body[data-layout-page="ib-trading-history"] .ibh-field > legend { color: var(--fr-muted); font-size: 11.5px; font-weight: 650; }
body[data-layout-page="ib-trading-history"] .ibh-scope-mode-field { margin: 0; padding: 0; border: 0; }
body[data-layout-page="ib-trading-history"] .ibh-scope-mode-options { display: flex; flex-wrap: wrap; gap: 6px; }
body[data-layout-page="ib-trading-history"] .ibh-scope-mode-option { position: relative; flex: 1 1 125px; min-width: 0; cursor: pointer; }
body[data-layout-page="ib-trading-history"] .ibh-scope-mode-option input { position: absolute; opacity: 0; pointer-events: none; }

body[data-layout-page="ib-trading-history"] .ibh-scope-mode-option span {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid var(--fr-line);
  border-radius: 999px;
  background: var(--fr-surface-2);
  color: var(--fr-muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

body[data-layout-page="ib-trading-history"] .ibh-scope-mode-option input:checked + span {
  border-color: transparent;
  background: linear-gradient(180deg, var(--fr-gold-soft), var(--fr-gold));
  color: var(--fr-gold-ink);
}

body[data-layout-page="ib-trading-history"] .ibh-switch {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--fr-line);
  border-radius: var(--fr-radius-sm);
  background: var(--fr-surface-2);
  color: var(--fr-ink-2);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

body[data-layout-page="ib-trading-history"] .ibh-switch input { position: absolute; opacity: 0; pointer-events: none; }

body[data-layout-page="ib-trading-history"] .ibh-switch i {
  position: relative;
  width: 34px;
  height: 19px;
  flex: none;
  border-radius: 999px;
  background: var(--fr-line-2);
}

body[data-layout-page="ib-trading-history"] .ibh-switch i::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.16s;
}

body[data-layout-page="ib-trading-history"] .ibh-switch input:checked + i { background: var(--fr-gold); }
body[data-layout-page="ib-trading-history"] .ibh-switch input:checked + i::after { transform: translateX(15px); }

body[data-layout-page="ib-trading-history"] .ibh-scope-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--fr-line);
  border-radius: var(--fr-radius-sm);
  background: var(--fr-surface-2);
}

body[data-layout-page="ib-trading-history"] .ibh-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

body[data-layout-page="ib-trading-history"] .ibh-panel-title { display: grid; flex: 1; gap: 1px; min-width: 0; }
body[data-layout-page="ib-trading-history"] .ibh-panel-title strong { color: var(--fr-ink); font-size: 13px; font-weight: 750; }
body[data-layout-page="ib-trading-history"] .ibh-panel-title small { color: var(--fr-muted); font-size: 11.5px; line-height: 1.5; }

body[data-layout-page="ib-trading-history"] .ibh-dim-key {
  display: inline-block;
  width: 16px;
  height: 8px;
  margin-right: 4px;
  border: 1px solid var(--fr-line);
  border-radius: 3px;
  background: var(--fr-surface-3);
  opacity: 0.55;
  vertical-align: middle;
}

body[data-layout-page="ib-trading-history"] .ibh-scope-toolbtns { display: flex; flex: none; gap: 6px; }

body[data-layout-page="ib-trading-history"] .ibh-scope-toolbtns button {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--fr-line);
  border-radius: var(--fr-radius-sm);
  background: var(--fr-surface);
  color: var(--fr-ink-2);
  font-size: 11.5px;
  font-weight: 650;
}

body[data-layout-page="ib-trading-history"] .ibh-scope-tree {
  flex: 1;
  min-height: 180px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--fr-line);
  border-radius: var(--fr-radius-sm);
  background: var(--fr-surface);
}

body[data-layout-page="ib-trading-history"] .ibh-node + .ibh-node { margin-top: 3px; }
body[data-layout-page="ib-trading-history"] .ibh-kids { margin: 3px 0 3px 14px; padding-left: 12px; border-left: 1px dashed var(--fr-line-2); }

body[data-layout-page="ib-trading-history"] .ibh-row {
  display: grid;
  grid-template-columns: 20px 18px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
}

body[data-layout-page="ib-trading-history"] .ibh-row:hover { background: var(--fr-surface-3); }
body[data-layout-page="ib-trading-history"] .ibh-row.is-on { border-color: var(--fr-gold-line); background: var(--fr-gold-tint); }
body[data-layout-page="ib-trading-history"] .ibh-row.is-dim { opacity: 0.5; }
body[data-layout-page="ib-trading-history"] .ibh-row.is-dim:hover,
body[data-layout-page="ib-trading-history"] .ibh-row.is-on.is-dim { opacity: 1; }

body[data-layout-page="ib-trading-history"] .ibh-check {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1.5px solid var(--fr-line-2);
  border-radius: 5px;
  background: var(--fr-surface);
  color: transparent;
}

body[data-layout-page="ib-trading-history"] .ibh-check svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.8;
}

body[data-layout-page="ib-trading-history"] .ibh-check:not(.is-on):not(.is-part) svg { opacity: 0; }

body[data-layout-page="ib-trading-history"] .ibh-check.is-on { border-color: var(--fr-gold); background: var(--fr-gold); color: var(--fr-gold-ink); }
body[data-layout-page="ib-trading-history"] .ibh-check.is-part { border-color: var(--fr-gold); background: var(--fr-gold-tint); color: var(--fr-gold-deep); }

body[data-layout-page="ib-trading-history"] .ibh-caret {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--fr-muted);
}

body[data-layout-page="ib-trading-history"] .ibh-caret svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 0.16s var(--fr-ease);
}

body[data-layout-page="ib-trading-history"] .ibh-caret.is-open svg { transform: rotate(90deg); }
body[data-layout-page="ib-trading-history"] .ibh-caret.is-leaf { visibility: hidden; }

body[data-layout-page="ib-trading-history"] .ibh-row-main {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

body[data-layout-page="ib-trading-history"] .ibh-row-main strong,
body[data-layout-page="ib-trading-history"] .ibh-row-main small { display: block; }

body[data-layout-page="ib-trading-history"] .ibh-hit {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--fr-gold-tint);
  color: var(--fr-gold-deep);
}

body[data-layout-page="ib-trading-history"] .ibh-hitflag {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--fr-gold);
  color: var(--fr-gold-ink);
  font-size: 10px;
  font-weight: 700;
}

body[data-layout-page="ib-trading-history"] .ibh-scope-empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--fr-muted);
  font-size: 12px;
}

@media (max-width: 820px) {
  body[data-layout-page="ib-trading-history"] .mft-sheet-backdrop {
    place-items: end stretch;
    padding: 0;
  }

  body[data-layout-page="ib-trading-history"] .mft-sheet,
  body[data-layout-page="ib-trading-history"] .mft-sheet.is-wide {
    width: 100%;
    max-height: 92dvh;
    border-radius: 20px 20px 0 0;
  }

  body[data-layout-page="ib-trading-history"] .mft-sheet-grab {
    display: block;
    width: 38px;
    height: 4px;
    flex: none;
    margin: 8px auto 0;
    border-radius: 999px;
    background: var(--fr-line-2);
  }

  body[data-layout-page="ib-trading-history"] .ibh-scope-form { grid-template-columns: minmax(0, 1fr); }
  body[data-layout-page="ib-trading-history"] .ibh-scope-body { display: block; overflow-y: auto; }
  body[data-layout-page="ib-trading-history"] .ibh-scope-panel { display: block; }
  body[data-layout-page="ib-trading-history"] .ibh-scope-tree { min-height: 0; max-height: none; overflow: visible; }
  body[data-layout-page="ib-trading-history"] .ibh-panel-head { flex-wrap: wrap; }
  body[data-layout-page="ib-trading-history"] .ibh-scope-toolbtns { width: 100%; }
  body[data-layout-page="ib-trading-history"] .ibh-scope-toolbtns button { flex: 1; }
  body[data-layout-page="ib-trading-history"] .ibh-kids { margin-left: 8px; padding-left: 8px; }
}

.records-shell {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  display: grid;
  gap: 22px;
  color: #0f172a;
}

.trading-records-page [hidden],
.records-modal-backdrop[hidden] {
  display: none !important;
}

.records-heading,
.records-title-row,
.records-tabs,
.records-subtabs,
.records-filter-grid,
.records-filter-actions,
.records-table-actions,
.records-table-head,
.records-table-footer,
.records-modal-header,
.pnl-calendar-toolbar,
.pnl-calendar-nav,
.scope-card-head,
.range-summary,
.range-tags,
.customer-line,
.records-empty,
.field-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.records-heading {
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.records-title-row {
  justify-content: space-between;
  flex-wrap: wrap;
}

.records-title-row.has-leading-tabs {
  justify-content: flex-start;
  gap: 16px;
}

.records-heading h1 {
  margin: 0;
  color: #0f172a;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 900;
}

.records-heading p {
  max-width: 760px;
  margin: 8px 0 0;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.records-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-bottom: 8px;
  padding: 0 8px;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--blue-ink);
  font-size: 11px;
  font-weight: 900;
}

.records-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

body:is([data-layout-page="client-trading-history"], [data-layout-page="ib-trading-history"]) .records-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

body:is([data-layout-page="client-trading-history"], [data-layout-page="ib-trading-history"]) .records-stat {
  padding-right: 14px;
  padding-left: 14px;
}

body:is([data-layout-page="client-trading-history"], [data-layout-page="ib-trading-history"]) .records-stat strong {
  font-size: clamp(22px, 1.6vw, 27px);
}

.records-stat {
  min-width: 0;
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 16px 18px;
  border: 1px solid #dce6f4;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.records-stat.green {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.records-stat.red {
  border-color: #fecaca;
  background: #fef2f2;
}

.records-stat.blue {
  border-color: #dbeafe;
  background: #eff6ff;
}

.records-stat.purple {
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.records-stat.amber {
  border-color: #fde68a;
  background: #fffbeb;
}

.records-stat.cyan {
  border-color: #bae6fd;
  background: #f0f9ff;
}

.records-stat-top {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 13px;
  font-weight: 900;
}

.records-stat-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--blue-ink);
}

.records-stat.green .records-stat-icon,
.records-stat.green strong {
  color: #059669;
}

.records-stat.red .records-stat-icon,
.records-stat.red strong {
  color: #dc2626;
}

.records-stat.purple .records-stat-icon {
  color: #7c3aed;
  background: #f5f3ff;
}

.records-stat.amber .records-stat-icon,
.records-stat.amber strong {
  color: #d97706;
}

.records-stat.amber .records-stat-icon {
  background: #fef3c7;
}

.records-stat.cyan .records-stat-icon,
.records-stat.cyan strong {
  color: #0284c7;
}

.records-stat.cyan .records-stat-icon {
  background: #e0f2fe;
}

.records-stat.green .records-stat-icon {
  background: #d1fae5;
}

.records-stat.red .records-stat-icon {
  background: #fee2e2;
}

.records-stat svg,
.records-action svg,
.records-search svg,
.scope-filter-trigger svg,
.records-empty svg,
.records-modal-close svg,
.pnl-calendar-nav svg,
.scope-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.records-stat strong {
  overflow: hidden;
  color: #0f172a;
  font-size: clamp(24px, 2.1vw, 30px);
  line-height: 1;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records-stat-value-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.records-stat-detail {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.1);
  color: #7c3aed;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.records-stat-detail:hover,
.records-stat-detail:focus-visible {
  background: rgba(124, 58, 237, 0.18);
  outline: 2px solid rgba(124, 58, 237, 0.24);
  outline-offset: 2px;
  transform: translateY(-1px);
}

.records-stat-detail svg {
  width: 16px;
  height: 16px;
  fill: rgba(124, 58, 237, 0.1);
  stroke-width: 2;
}

.records-card,
.records-filter-card,
.records-table-card,
.scope-card {
  border: 1px solid #dce6f4;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.06);
}

.records-card {
  display: grid;
  gap: 16px;
  padding: 18px;
}

body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-card {
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-layout-page="client-trading-history"] .records-card {
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body[data-layout-page="client-trading-history"] .records-filter-card {
  padding: 14px;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.05);
}

.records-date-range-field {
  flex: 1.5 1 240px;
}

.records-date-range {
  width: 100%;
  height: 42px;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
}

.records-field .records-date-range input {
  width: 100%;
  height: 40px;
  min-width: 0;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}

.records-date-range i {
  color: #94a3b8;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.records-date-range:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

body[data-layout-page="client-trading-history"] .records-table-card {
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.05);
}

body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-filter-card,
body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-table-card {
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.05);
}

body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-filter-card {
  padding: 14px;
}

body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-filter-grid {
  gap: 12px;
}

body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-field.wide {
  flex: 1.35 1 280px;
}

body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-filter-grid > .records-field:not(.wide):not(.compact) {
  flex: 1.1 1 190px;
}

body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-field.compact {
  flex-basis: 142px;
}

body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"]) .records-table-head-actions-only {
  padding: 12px 14px;
}

body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-table th,
body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"], [data-layout-page="ib-trading-history"]) .records-table td {
  padding: 14px 12px;
}

@media (min-width: 1000px) and (max-width: 1279px) {
  body[data-layout-page="client-trading-history"] .records-filter-grid {
    display: grid;
    grid-template-areas:
      "server search search account"
      "type side duration reset"
      "time time time time";
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  body[data-layout-page="client-trading-history"][data-history-platform="mt5"] .records-filter-grid {
    grid-template-areas:
      "server search search account"
      "type side duration reset"
      "linked linked entry ."
      "time time time time";
  }

  body[data-layout-page="client-trading-history"] .records-filter-server { grid-area: server; }
  body[data-layout-page="client-trading-history"] .records-filter-search { grid-area: search; }
  body[data-layout-page="client-trading-history"] .records-filter-account { grid-area: account; }
  body[data-layout-page="client-trading-history"] .records-filter-type { grid-area: type; }
  body[data-layout-page="client-trading-history"] .records-filter-side { grid-area: side; }
  body[data-layout-page="client-trading-history"] .records-filter-duration { grid-area: duration; }
  body[data-layout-page="client-trading-history"] .records-filter-linked { grid-area: linked; }
  body[data-layout-page="client-trading-history"] .records-filter-entry { grid-area: entry; }
  body[data-layout-page="client-trading-history"] .records-filter-time { grid-area: time; }
  body[data-layout-page="client-trading-history"] .records-filter-actions { grid-area: reset; }

  body[data-layout-page="client-trading-history"] .records-field,
  body[data-layout-page="client-trading-history"] .records-field.wide,
  body[data-layout-page="client-trading-history"] .records-field.compact {
    min-width: 0;
  }
}

@media (min-width: 1280px) {
  body[data-layout-page="client-trading-history"] .records-filter-grid {
    display: grid;
    grid-template-areas: "server search account type side duration time reset";
    grid-template-columns:
      minmax(145px, 0.9fr)
      minmax(180px, 1.2fr)
      minmax(140px, 1fr)
      repeat(3, minmax(102px, 0.72fr))
      minmax(240px, 1.35fr)
      auto;
    gap: 12px;
  }

  body[data-layout-page="client-trading-history"][data-history-platform="mt5"] .records-filter-grid {
    grid-template-areas:
      "server search search account type side duration reset"
      "linked linked entry time time time time .";
    grid-template-columns:
      minmax(145px, 0.9fr)
      minmax(170px, 1.05fr)
      minmax(130px, 0.82fr)
      minmax(145px, 0.9fr)
      minmax(102px, 0.68fr)
      minmax(102px, 0.68fr)
      minmax(115px, 0.74fr)
      auto;
  }

  body[data-layout-page="client-trading-history"] .records-filter-server { grid-area: server; }
  body[data-layout-page="client-trading-history"] .records-filter-search { grid-area: search; }
  body[data-layout-page="client-trading-history"] .records-filter-account { grid-area: account; }
  body[data-layout-page="client-trading-history"] .records-filter-type { grid-area: type; }
  body[data-layout-page="client-trading-history"] .records-filter-side { grid-area: side; }
  body[data-layout-page="client-trading-history"] .records-filter-duration { grid-area: duration; }
  body[data-layout-page="client-trading-history"] .records-filter-linked { grid-area: linked; }
  body[data-layout-page="client-trading-history"] .records-filter-entry { grid-area: entry; }
  body[data-layout-page="client-trading-history"] .records-filter-time { grid-area: time; }
  body[data-layout-page="client-trading-history"] .records-filter-actions { grid-area: reset; }

  body[data-layout-page="client-trading-history"] .records-field,
  body[data-layout-page="client-trading-history"] .records-field.wide,
  body[data-layout-page="client-trading-history"] .records-field.compact {
    min-width: 0;
  }

  body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"]) .records-filter-grid {
    display: grid;
    grid-template-columns:
      minmax(240px, 1.3fr)
      minmax(260px, 1.45fr)
      minmax(180px, 0.95fr)
      minmax(128px, 0.7fr)
      minmax(150px, 0.85fr)
      minmax(128px, 0.7fr)
      auto;
  }

  body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"]) .records-field,
  body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"]) .records-field.wide,
  body:is([data-layout-page="ib-trading-records"], [data-layout-page="ib-limit-orders"]) .records-field.compact {
    min-width: 0;
  }

  /* 桌面网格由 records-refine.css 的容器查询负责（那边才扣得掉侧栏宽度），
     这里只保留网格/弹性都要的收缩许可与底对齐。 */
  body[data-layout-page="ib-trading-history"] .records-filter-grid {
    align-items: end;
  }

  body[data-layout-page="ib-trading-history"] .records-field,
  body[data-layout-page="ib-trading-history"] .records-field.wide,
  body[data-layout-page="ib-trading-history"] .records-field.compact {
    min-width: 0;
  }
}

.records-section-title {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
  line-height: 1.15;
  font-weight: 950;
}

.records-section-copy {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.records-tabs,
.records-subtabs {
  align-items: center;
  flex-wrap: wrap;
}

.records-tabs {
  width: fit-content;
  max-width: 100%;
  padding: 5px;
  border-radius: 10px;
  background: #f1f5f9;
}

.records-tabs button,
.records-subtabs button {
  border: 0;
  border-radius: 8px;
  color: #64748b;
  background: transparent;
  font-weight: 900;
  white-space: nowrap;
}

.records-tabs button {
  min-width: 150px;
  height: 42px;
  padding: 0 16px;
}

.records-subtabs button {
  min-width: 112px;
  height: 38px;
  padding: 0 18px;
}

.records-tabs button.active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.08);
}

.records-subtabs {
  width: fit-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.05);
}

.records-subtabs button.active {
  background: var(--blue-ink);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.records-filter-card,
.scope-card {
  padding: 16px;
}

.records-filter-grid {
  align-items: flex-end;
  flex-wrap: wrap;
}

.records-field {
  min-width: 158px;
  flex: 1 1 158px;
  display: grid;
  gap: 7px;
}

.records-field.wide {
  min-width: 270px;
  flex: 2 1 320px;
}

.records-field.compact {
  flex: 0 1 150px;
}

.records-multi-select {
  position: relative;
  min-width: 0;
}

.records-multi-trigger {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 11px;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 800;
  text-align: left;
}

.records-multi-trigger > span {
  overflow: hidden;
  color: inherit;
  font-size: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records-multi-trigger svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: #64748b;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 0.16s ease;
}

.records-multi-trigger[aria-expanded="true"] {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.records-multi-trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.records-multi-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  width: max(100%, 176px);
  padding: 6px;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
}

.records-multi-menu[hidden] {
  display: none !important;
}

.records-multi-option {
  min-height: 34px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  border-radius: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.records-multi-option:hover,
.records-multi-option.is-selected {
  background: #eff6ff;
  color: var(--blue-deep);
}

.records-multi-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--blue-ink);
}

.records-multi-option > span {
  color: inherit;
  font-size: inherit;
}

.records-multi-option b {
  opacity: 0;
  color: var(--blue-ink);
  text-align: center;
}

.records-multi-option.is-selected b {
  opacity: 1;
}

.records-field span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.records-field .records-multi-trigger > span,
.records-field .records-multi-option > span {
  color: inherit;
  font-size: inherit;
}

.records-field input,
.records-field select,
.records-search {
  width: 100%;
  height: 42px;
  min-width: 0;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font: inherit;
  font-weight: 800;
}

.records-field input,
.records-field select {
  padding: 0 12px;
}

.records-field .records-multi-option input {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  border-radius: 3px;
  accent-color: var(--blue-ink);
}

.records-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: #f8fafc;
  color: #64748b;
}

.records-search input {
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: #0f172a;
  font: inherit;
  font-weight: 800;
}

.scope-filter-trigger {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  padding: 8px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
  color: #0f172a;
  font: inherit;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.03);
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.scope-filter-trigger:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.scope-filter-main {
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-filter-trigger small {
  grid-column: 1;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-filter-trigger svg {
  grid-column: 2;
  grid-row: 1 / span 2;
  justify-self: end;
  color: var(--blue-ink);
}

.records-account-range-filter {
  position: relative;
  min-width: 0;
  z-index: 4;
}

.records-account-range-filter.is-open {
  z-index: 30;
}

.records-account-range-combobox {
  position: relative;
  min-width: 0;
}

.records-account-range-input-wrap {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 11px;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
}

.records-account-range-input-wrap:focus-within {
  border-color: rgba(var(--blue-rgb), 0.64);
  box-shadow: 0 0 0 3px rgba(var(--blue-rgb), 0.11);
}

.records-account-range-input-wrap > svg,
.records-account-range-toggle svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: #94a3b8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.records-account-range-selection-scope {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  height: 22px;
  flex: 0 0 auto;
  padding: 0 8px;
  border-radius: 999px;
  background: #eaf1ff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
}

.records-account-range-selection-scope.is-direct {
  background: #ecfdf5;
  color: #047857;
}

.records-account-range-input-wrap input {
  height: 40px;
  flex: 1 1 0;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.records-account-range-input-wrap input:focus {
  outline: 0;
}

.records-account-range-toggle {
  width: 38px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.records-account-range-toggle:hover {
  background: rgba(var(--blue-rgb), 0.07);
}

.records-account-range-filter.is-open .records-account-range-toggle svg {
  transform: rotate(180deg);
}

.records-account-range-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  width: 100%;
  max-height: 340px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.16);
}

.records-account-range-options[hidden] {
  display: none;
}

.records-account-range-scope {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: #f1f5f9;
}

.records-account-range-scope-option {
  height: 30px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}

.records-account-range-scope-option:hover,
.records-account-range-scope-option:focus-visible {
  outline: 0;
  color: var(--blue);
}

.records-account-range-scope-option.is-selected {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.records-account-range-user-heading {
  margin-top: 8px;
  padding: 9px 9px 6px;
  border-top: 1px solid #e8edf5;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.records-account-range-user-list {
  display: grid;
  gap: 2px;
}

.records-account-range-option {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #0f172a;
  font: inherit;
  text-align: left;
}

.records-account-range-option:hover,
.records-account-range-option:focus-visible {
  outline: 0;
  background: rgba(var(--blue-rgb), 0.08);
}

.records-account-range-option.is-selected {
  background: rgba(var(--blue-rgb), 0.12);
  color: var(--blue);
}

.records-account-range-option.is-selected::after {
  content: "✓";
  flex: 0 0 auto;
  color: currentColor;
  font-size: 12px;
  font-weight: 950;
}

.records-account-range-option span {
  min-width: 0;
  overflow: hidden;
  color: inherit;
  font-size: 13px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records-account-range-option small {
  flex: 0 0 auto;
  margin-left: auto;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.records-account-range-empty {
  padding: 18px 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 760;
  text-align: center;
}

.records-account-range-tree-action {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  padding: 0 10px;
  border: 0;
  border-top: 1px solid #e8edf5;
  border-radius: 0 0 6px 6px;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.records-account-range-tree-action:hover,
.records-account-range-tree-action:focus-visible {
  outline: 0;
  background: rgba(var(--blue-rgb), 0.08);
}

.records-account-range-tree-action svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.records-action {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #fff;
  color: var(--blue-ink);
  font-weight: 900;
  white-space: nowrap;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.records-action:hover:not(:disabled) {
  border-color: #93c5fd;
  background: #eff6ff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.1);
}

.records-action:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.08);
}

.records-action:disabled {
  cursor: wait;
  opacity: 0.76;
}

.records-action.loading svg {
  animation: records-spin 0.85s linear infinite;
}

@keyframes records-spin {
  to {
    transform: rotate(360deg);
  }
}

.records-action.primary {
  border-color: var(--blue-ink);
  background: var(--blue-ink);
  color: #fff;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.16);
}

.records-skeleton-row td {
  height: 72px;
}

.records-skeleton-line {
  display: block;
  width: 100%;
  max-width: 118px;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef4fb 0%, #f8fbff 42%, #e7eef8 78%);
  background-size: 220% 100%;
  animation: records-skeleton-pulse 1.1s ease-in-out infinite;
}

.records-skeleton-line.medium {
  max-width: 84px;
}

.records-skeleton-line.short {
  max-width: 56px;
}

@keyframes records-skeleton-pulse {
  0% {
    background-position: 180% 0;
  }

  100% {
    background-position: -40% 0;
  }
}

.records-table-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

body.records-modal-open {
  overflow: hidden;
}

.records-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.46);
  backdrop-filter: blur(8px);
}

.records-modal-backdrop[hidden] {
  display: none !important;
}

.records-modal {
  width: min(980px, calc(100vw - 32px));
  max-height: min(84vh, 820px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dce6f4;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.22);
}

.volume-breakdown-modal {
  width: min(720px, calc(100vw - 32px));
}

.money-breakdown-modal {
  width: min(620px, calc(100vw - 32px));
}

/* ---------- 显示列（自定义列）弹窗 ---------- */

.records-columns-modal {
  width: min(680px, calc(100vw - 32px));
}

.records-columns-body {
  min-height: 0;
  padding: 16px 18px;
  overflow: auto;
  background: #fff;
}

.records-columns-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.records-columns-option {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 38px;
  border: 1px solid #dce6f4;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease;
}

.records-columns-option:hover {
  border-color: #bfdbfe;
  background: #f8fbff;
}

/* 固定列仍然勾着但不可取消，灰掉是为了让「点不动」看起来是设计而不是坏了 */
.records-columns-option.is-locked {
  background: #f8fafc;
  color: #94a3b8;
  cursor: default;
}

.records-columns-option:has(input:focus-visible) {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.records-columns-option input {
  width: 15px;
  height: 15px;
  flex: none;
  margin: 0;
  border-radius: 3px;
  accent-color: var(--blue-ink);
}

.records-columns-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records-columns-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid #edf1f7;
  background: #fff;
}

.records-columns-footer-end {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 有列被藏起来时给触发按钮一点提示，否则表格少了几列会让人以为数据丢了 */
.records-action.is-active {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.volume-breakdown-body {
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.volume-breakdown-table-wrap {
  min-width: 680px;
}

.money-breakdown-table-wrap {
  min-width: 420px;
}

.volume-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  color: #0f172a;
  font-size: 13px;
}

.volume-breakdown-table th,
.volume-breakdown-table td {
  padding: 13px 16px;
  border-bottom: 1px solid #edf1f7;
  text-align: right;
  white-space: nowrap;
}

.volume-breakdown-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.volume-breakdown-table th:first-child,
.volume-breakdown-table td:first-child {
  text-align: left;
}

.volume-breakdown-table td {
  font-weight: 850;
}

.volume-breakdown-table tfoot td {
  border-bottom: 0;
  background: #f8fbff;
  color: #0f172a;
  font-weight: 950;
}

.volume-currency {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.volume-currency i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #7c3aed;
}

.volume-breakdown-empty {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: #64748b;
  font-size: 14px;
  font-weight: 900;
}

.records-modal-header {
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #edf1f7;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.records-modal-header h2 {
  margin: 0;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 950;
}

.records-modal-header p {
  margin: 7px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.records-modal-close {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
  color: #64748b;
}

.scope-range-modal {
  width: min(1040px, calc(100vw - 32px));
}

.scope-modal-toolbar {
  padding: 14px 18px;
  border-bottom: 1px solid #edf1f7;
  background: #fff;
}

.scope-modal-toolbar .scope-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.scope-modal-body {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.85fr);
  gap: 14px;
  padding: 16px 18px;
  overflow: auto;
  background: #f8fbff;
}

.scope-panel {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dce6f4;
  border-radius: 8px;
  background: #fff;
}

.scope-panel-head h3 {
  margin: 0;
  color: #0f172a;
  font-size: 16px;
  line-height: 1.2;
  font-weight: 950;
}

.scope-panel-head p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.45;
}

.scope-tree,
.scope-tree-children {
  display: grid;
  gap: 8px;
}

.scope-tree-node {
  display: grid;
  gap: 8px;
}

.scope-tree-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 10px 10px calc(10px + var(--level, 0) * 18px);
  border: 1px solid #edf1f7;
  border-radius: 8px;
  background: #fff;
}

.scope-tree-row.agent {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.scope-tree-row.user.active,
.scope-account-pill.active {
  border-color: var(--blue-ink);
  background: #eff6ff;
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.18);
}

.scope-tree-main {
  min-width: 0;
  display: grid;
  gap: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

button.scope-tree-main {
  cursor: pointer;
}

.scope-tree-main strong,
.scope-account-pill strong {
  overflow: hidden;
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-tree-main small,
.scope-account-pill small {
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scope-tree-actions,
.scope-account-pills {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.scope-tree-actions button,
.scope-account-pill {
  min-height: 30px;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
  color: var(--blue-ink);
  font-weight: 900;
}

.scope-tree-actions button {
  padding: 0 9px;
}

.scope-tree-actions button.active {
  border-color: var(--blue-ink);
  background: var(--blue-ink);
  color: #fff;
}

.scope-account-pills {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.scope-account-pill {
  min-width: 118px;
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  text-align: left;
}

.scope-tree-empty {
  padding: 14px;
  border: 1px dashed #d8e1ef;
  border-radius: 8px;
  color: #64748b;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
}

.scope-modal-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.scope-modal-summary > div {
  min-width: 0;
}

.scope-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid #edf1f7;
  background: #fff;
}

.pnl-calendar-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid #edf1f7;
  background: #fff;
}

.pnl-calendar-views {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #f1f5f9;
}

.pnl-calendar-views button {
  min-width: 66px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-weight: 950;
}

.pnl-calendar-views button.active {
  background: #fff;
  color: var(--blue-ink);
  box-shadow: 0 7px 16px rgba(15, 23, 42, 0.08);
}

.pnl-calendar-nav {
  min-width: 0;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pnl-calendar-nav button {
  min-width: 38px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #fff;
  color: var(--blue-ink);
  font-weight: 900;
}

.pnl-calendar-nav strong {
  min-width: 160px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 950;
  text-align: center;
  white-space: nowrap;
}

.pnl-calendar-nav .pnl-calendar-today {
  padding: 0 12px;
}

.pnl-calendar-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 18px 0;
}

.pnl-summary-card {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid #edf1f7;
  border-radius: 8px;
  background: #f8fbff;
}

.pnl-summary-card.positive {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.pnl-summary-card.negative {
  border-color: #fecaca;
  background: #fef2f2;
}

.pnl-summary-card span,
.pnl-summary-card small {
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnl-summary-card strong {
  overflow: hidden;
  color: #0f172a;
  font-size: 19px;
  line-height: 1;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnl-summary-card.positive strong {
  color: #059669;
}

.pnl-summary-card.negative strong {
  color: #dc2626;
}

.pnl-calendar-content {
  min-height: 0;
  padding: 12px 18px 18px;
  overflow: auto;
}

.pnl-year-grid,
.pnl-month-grid,
.pnl-week-grid {
  display: grid;
  gap: 10px;
}

.pnl-year-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.pnl-calendar-month-card,
.pnl-calendar-day,
.pnl-week-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  border: 1px solid #edf1f7;
  border-radius: 8px;
  background: #fff;
  color: #0f172a;
  text-align: left;
}

.pnl-calendar-month-card {
  min-height: 116px;
  padding: 14px;
}

.pnl-calendar-month-card:hover,
.pnl-calendar-day:hover,
.pnl-week-card:hover {
  border-color: #bfdbfe;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.1);
}

.pnl-calendar-month-card.positive,
.pnl-calendar-day.positive,
.pnl-week-card.positive,
.pnl-day-panel.positive {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.pnl-calendar-month-card.negative,
.pnl-calendar-day.negative,
.pnl-week-card.negative,
.pnl-day-panel.negative {
  border-color: #fecaca;
  background: #fef2f2;
}

.pnl-calendar-month-card.flat,
.pnl-calendar-day.flat,
.pnl-week-card.flat,
.pnl-day-panel.flat {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.pnl-calendar-month-card.empty,
.pnl-calendar-day.empty,
.pnl-week-card.empty {
  color: #94a3b8;
  background: #f8fafc;
}

.pnl-calendar-month-card span,
.pnl-calendar-day span,
.pnl-week-card span,
.pnl-day-panel span {
  color: #475569;
  font-size: 13px;
  font-weight: 950;
}

.pnl-calendar-month-card strong,
.pnl-calendar-day strong,
.pnl-week-card strong,
.pnl-day-panel strong {
  overflow: hidden;
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnl-calendar-month-card strong.muted,
.pnl-calendar-day strong.muted,
.pnl-week-card strong.muted {
  color: #94a3b8;
}

.pnl-compact {
  display: none;
}

.pnl-calendar-month-card small,
.pnl-calendar-day small,
.pnl-week-card small,
.pnl-day-panel small {
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pnl-calendar-weekdays,
.pnl-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.pnl-calendar-weekdays {
  gap: 10px;
  margin-bottom: 8px;
}

.pnl-calendar-weekdays span {
  color: #64748b;
  font-size: 12px;
  font-weight: 950;
  text-align: center;
}

.pnl-calendar-day {
  min-height: 72px;
  padding: 8px 10px;
}

.pnl-month-grid {
  overflow: hidden;
  gap: 0;
  border: 1px solid #dce6f4;
  border-radius: 8px;
  background: #dce6f4;
}

.pnl-month-grid .pnl-calendar-day {
  border: 0;
  border-right: 1px solid #dce6f4;
  border-bottom: 1px solid #dce6f4;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

.pnl-month-grid .pnl-calendar-day:nth-child(7n) {
  border-right: 0;
}

.pnl-month-grid .pnl-calendar-day:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.pnl-month-grid .pnl-calendar-day.empty {
  background: #f8fafc;
}

.pnl-month-grid .pnl-calendar-day.positive {
  background: #ecfdf5;
}

.pnl-month-grid .pnl-calendar-day.negative {
  background: #fff1f2;
}

.pnl-month-grid .pnl-calendar-day.flat {
  background: #eff6ff;
}

.pnl-month-grid .pnl-calendar-day:hover {
  position: relative;
  z-index: 1;
  box-shadow: inset 0 0 0 2px #93c5fd;
}

.pnl-calendar-day.outside {
  opacity: 0.58;
}

.pnl-calendar-day.today,
.pnl-week-card.today {
  box-shadow: inset 0 0 0 2px var(--blue-ink);
}

.pnl-week-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.pnl-week-card {
  min-height: 132px;
  padding: 14px;
}

.pnl-day-panel {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid #edf1f7;
  border-radius: 8px;
  background: #f8fbff;
}

.pnl-day-panel strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
}

.pnl-day-orders {
  display: grid;
  gap: 8px;
}

.pnl-day-order {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #edf1f7;
  border-radius: 8px;
  background: #fff;
}

.pnl-day-order strong {
  display: block;
  color: #0f172a;
  font-weight: 950;
}

.pnl-day-order small {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
}

.pnl-day-order b {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 950;
}

.pnl-calendar-empty {
  display: grid;
  min-height: 160px;
  place-items: center;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-weight: 900;
}

.records-table-card {
  overflow: hidden;
}

.records-table-head {
  justify-content: space-between;
  padding: 20px 22px;
  border-bottom: 1px solid #edf1f7;
}

.records-table-head-actions-only {
  justify-content: flex-end;
  padding: 16px 22px;
}

.records-table-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 950;
}

.records-table-head p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
}

.records-table-wrap {
  overflow: auto;
}

.records-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

.ib-records-page .records-table {
  min-width: 1320px;
}

body[data-layout-page="client-trading-history"] .records-table {
  min-width: 1180px;
}

body[data-layout-page="client-trading-history"][data-history-platform="mt5"] .records-table {
  min-width: 1380px;
}

body[data-layout-page="ib-trading-history"] .records-table {
  min-width: 1430px;
}

body[data-layout-page="ib-trading-history"][data-history-platform="mt5"] .records-table {
  min-width: 1650px;
}

.records-table th,
.records-table td {
  padding: 15px 13px;
  border-bottom: 1px solid #edf1f7;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.records-table th {
  color: #475569;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0;
  white-space: nowrap;
}

.records-table tbody tr:hover {
  background: #f8fbff;
}

.records-table strong {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  color: #0f172a;
  font-weight: 950;
  text-overflow: ellipsis;
  vertical-align: top;
  white-space: nowrap;
}

.records-tooltip-trigger {
  position: relative;
  display: inline-block;
  max-width: 100%;
  color: #0f172a;
  font-weight: 950;
  vertical-align: top;
  cursor: help;
}

.records-truncate-text {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records-order-id {
  max-width: 120px;
}

.records-tooltip-trigger::after {
  content: attr(data-full);
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: max-content;
  max-width: min(360px, 70vw);
  padding: 8px 10px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.22);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}

.records-tooltip-trigger::before {
  content: "";
  position: absolute;
  top: calc(100% + 3px);
  left: 16px;
  z-index: 21;
  width: 9px;
  height: 9px;
  background: #0f172a;
  opacity: 0;
  pointer-events: none;
  transform: rotate(45deg) translateY(-3px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.records-tooltip-trigger:hover::after,
.records-tooltip-trigger:focus-visible::after,
.records-tooltip-trigger:hover::before,
.records-tooltip-trigger:focus-visible::before {
  opacity: 1;
  transform: translateY(0);
}

.records-table small {
  display: block;
  margin-top: 4px;
  max-width: 112px;
  overflow: hidden;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.records-table td {
  max-width: 180px;
}

.records-table td:first-child {
  max-width: 130px;
}

.records-table .account-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 130px;
}

.records-table .account-meta span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.money-positive {
  color: #059669 !important;
}

.money-negative {
  color: #dc2626 !important;
}

.side-chip,
.status-chip,
.account-chip,
.agent-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.side-chip.buy {
  background: #ecfdf5;
  color: #047857;
}

.side-chip.sell {
  background: #fef2f2;
  color: #dc2626;
}

.side-chip.pending {
  background: #eff6ff;
  color: var(--blue-ink);
}

.entry-type-chip {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #f5f3ff;
  color: #7c3aed;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.status-chip {
  background: #f1f5f9;
  color: #475569;
}

.status-chip.open,
.status-chip.closed {
  background: #ecfdf5;
  color: #047857;
}

.status-chip.pending {
  background: #fffbeb;
  color: #b45309;
}

.status-chip.cancelled {
  background: #f1f5f9;
  color: #64748b;
}

.account-chip {
  background: #eff6ff;
  color: var(--blue-ink);
}

.account-chip.demo {
  background: #f5f3ff;
  color: #7c3aed;
}

.agent-chip {
  background: #f8fafc;
  color: #475569;
}

.records-empty {
  min-height: 220px;
  margin: 12px;
  justify-content: center;
  flex-direction: column;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fbff;
  color: #64748b;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}

.records-empty svg {
  width: 48px;
  height: 48px;
  color: #b8c6d8;
  stroke-width: 1.8;
}

.records-table-footer {
  justify-content: space-between;
  padding: 14px 16px;
  border-top: 1px solid #edf1f7;
  background: #fbfdff;
  color: #64748b;
  font-weight: 850;
}

.records-page-size {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.records-page-size select {
  height: 34px;
  padding: 0 26px 0 10px;
  border: 1px solid #d8e1ef;
  border-radius: 7px;
  background: #fff;
  color: #0f172a;
  font-weight: 850;
}

.records-pager {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
}

.records-pager button {
  min-width: 38px;
  height: 36px;
  border: 0;
  border-right: 1px solid #d8e1ef;
  background: #fff;
  color: #64748b;
  font-weight: 900;
}

.records-pager button:last-child {
  border-right: 0;
}

.records-pager button.active {
  background: var(--blue-ink);
  color: #fff;
}

.records-pager button:disabled {
  color: #cbd5e1;
  background: #f8fafc;
}

.ib-scope-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 2fr);
  gap: 16px;
  align-items: stretch;
}

.scope-card {
  display: grid;
  align-content: start;
  gap: 14px;
}

.scope-card-head {
  align-items: flex-start;
  justify-content: space-between;
}

.scope-card h2 {
  margin: 0;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 950;
}

.scope-card p {
  margin: 5px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
}

.scope-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.scope-grid .records-field.wide {
  grid-column: 1 / -1;
}

.scope-toggle {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px;
  border: 1px solid #d8e1ef;
  border-radius: 8px;
  background: #f8fafc;
  color: #0f172a;
  font-weight: 900;
}

.scope-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue-ink);
}

.range-summary {
  align-items: stretch;
  flex-wrap: wrap;
}

.range-summary > div {
  min-width: 132px;
  flex: 1 1 132px;
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid #edf1f7;
  border-radius: 8px;
  background: #f8fbff;
}

.range-summary span {
  color: #64748b;
  font-size: 12px;
  font-weight: 850;
}

.range-summary strong {
  color: #0f172a;
  font-size: 22px;
  line-height: 1;
  font-weight: 950;
}

.range-tags {
  flex-wrap: wrap;
  gap: 8px;
}

.range-tags span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--blue-ink);
  font-size: 12px;
  font-weight: 900;
}

.customer-list {
  display: grid;
  gap: 8px;
}

.customer-line {
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #edf1f7;
  border-radius: 8px;
  background: #fff;
}

.customer-line strong {
  color: #0f172a;
  font-size: 13px;
}

.customer-line small {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
}

.customer-line b {
  color: var(--blue-ink);
  font-size: 14px;
}

@media (max-width: 1180px) {
  .records-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body:is([data-layout-page="client-trading-history"], [data-layout-page="ib-trading-history"]) .records-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .pnl-calendar-summary,
  .pnl-year-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pnl-week-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ib-scope-grid {
    grid-template-columns: 1fr;
  }

  .scope-modal-toolbar .scope-grid,
  .scope-modal-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .trading-records-page {
    padding: 22px 16px 64px;
  }

  /* 17 个字段在手机上排三列会挤成两行字，收成一列反而好点；
     底部三个按钮也从两端对齐改成整行铺开。 */
  .records-columns-list {
    grid-template-columns: 1fr;
  }

  .records-columns-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .records-columns-footer-end {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .records-heading,
  .records-title-row,
  .records-table-head,
  .records-table-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .records-summary,
  .scope-grid {
    grid-template-columns: 1fr;
  }

  body:is([data-layout-page="client-trading-history"], [data-layout-page="ib-trading-history"]) .records-summary {
    grid-template-columns: 1fr;
  }

  .records-shell,
  .records-card,
  .records-filter-card,
  .records-table-card,
  .records-table-head,
  .records-table-wrap {
    min-width: 0;
    max-width: 100%;
  }

  .records-tabs,
  .records-subtabs {
    width: 100%;
  }

  .records-tabs button,
  .records-subtabs button {
    min-width: 0;
    flex: 1 1 0;
  }

  .records-filter-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .records-filter-grid {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .records-field,
  .records-field.wide,
  .records-field.compact {
    min-width: 0;
    width: 100%;
    flex: none;
  }

  .records-table-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .records-action {
    min-width: 0;
    flex: 1 1 0;
  }

  .records-table-head .records-action {
    width: 100%;
  }

  .records-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .records-modal {
    width: 100%;
    max-height: 94vh;
    border-radius: 14px 14px 0 0;
  }

  .records-modal-header,
  .scope-modal-toolbar,
  .scope-modal-body,
  .scope-modal-footer,
  .pnl-calendar-toolbar {
    padding-right: 16px;
    padding-left: 16px;
  }

  .scope-modal-body {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .scope-tree-row {
    grid-template-columns: 1fr;
  }

  .scope-tree-actions,
  .scope-account-pills,
  .scope-modal-footer {
    justify-content: stretch;
  }

  .scope-tree-actions button,
  .scope-modal-footer .records-action {
    flex: 1 1 0;
  }

  .pnl-calendar-toolbar {
    align-items: stretch;
  }

  .pnl-calendar-views,
  .pnl-calendar-nav {
    width: 100%;
  }

  .pnl-calendar-views button {
    min-width: 0;
    flex: 1 1 0;
  }

  .pnl-calendar-nav {
    justify-content: space-between;
  }

  .pnl-calendar-nav strong {
    min-width: 0;
    flex: 1 1 120px;
  }

  .pnl-calendar-summary,
  .pnl-year-grid,
  .pnl-week-grid {
    grid-template-columns: 1fr;
  }

  .pnl-calendar-summary,
  .pnl-calendar-content {
    padding-right: 16px;
    padding-left: 16px;
  }

  .pnl-calendar-weekdays,
  .pnl-month-grid {
    gap: 6px;
  }

  .pnl-calendar-day {
    min-height: 78px;
    gap: 5px;
    padding: 7px 5px;
  }

  .pnl-calendar-day strong {
    font-size: 12px;
  }

  .pnl-calendar-day .pnl-full {
    display: none;
  }

  .pnl-calendar-day .pnl-compact {
    display: inline;
  }

  .pnl-calendar-day small {
    font-size: 11px;
  }

  .pnl-day-order {
    align-items: flex-start;
    flex-direction: column;
  }

  .records-table-wrap {
    overflow: visible;
  }

  .records-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .ib-records-page .records-table {
    min-width: 0;
  }

  .records-table thead {
    display: none;
  }

  .records-table,
  .records-table tbody,
  .records-table tr,
  .records-table td {
    display: block;
    width: 100%;
  }

  .records-table tbody {
    display: grid;
    gap: 12px;
    padding: 12px;
    background: #f8fbff;
  }

  .records-table tr {
    padding: 12px;
    border: 1px solid #dce6f4;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.06);
  }

  .records-table tbody tr:hover {
    background: #fff;
  }

  .records-table td {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    align-items: center;
    max-width: none;
    padding: 9px 0;
    border-bottom: 1px solid #edf1f7;
    white-space: normal;
    text-align: left;
  }

  .records-table td:first-child {
    max-width: none;
  }

  .records-table td:last-child {
    border-bottom: 0;
  }

  .records-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 12px;
    font-weight: 950;
    text-align: left;
    white-space: nowrap;
  }

  .records-table td strong,
  .records-table td small,
  .records-table td > span {
    max-width: 100%;
    overflow: hidden;
    justify-self: start;
    text-overflow: ellipsis;
  }

  .records-table small {
    max-width: min(190px, 100%);
    text-align: left;
  }

  .records-table .account-meta {
    justify-content: flex-start;
    max-width: min(220px, 100%);
  }

  .records-table-footer {
    gap: 12px;
  }
}
